Fix issue where first reserved word of GOT is not initialized if there
[platform/upstream/binutils.git] / gold / ChangeLog
1 2014-05-06  Cary Coutant  <ccoutant@google.com>
2
3         PR gold/16900
4         * i386.cc (Output_data_got_plt_i386): New class.
5         (Output_data_plt_i386::Output_data_plt_i386): Change type of got_plt
6         parameter. Change all callers.
7         (Output_data_plt_i386::layout_): Remove.
8         (Output_data_plt_i386::got_plt_): Change type.
9         (Target_i386::got_plt_): Change type. Change all references.
10         (Target_i386::got_section): Create instance of new class.
11         (Output_data_got_plt_i386::do_write): New function.
12         * x86_64.cc (Output_data_got_plt_x86_64): New class.
13         (Output_data_plt_x86_64::Output_data_plt_x86_64): Change type of got_plt
14         parameter. Change all callers.
15         (Output_data_plt_x86_64::layout_): Remove.
16         (Output_data_plt_x86_64::got_plt_): Change type.
17         (Target_x86_64::got_plt_): Change type. Change all references.
18         (Target_x86_64::got_section): Create instance of new class.
19         (Output_data_got_plt_x86_64::do_write): New function.
20         (Output_data_plt_x86_64::do_write): Don't write reserved words in GOT.
21         (Target_x86_64<size>::init_got_plt_for_update): Create instance of new
22         class.
23
24 2014-05-05  Cary Coutant  <ccoutant@google.com>
25         
26         * gdb-index.cc (Gdb_index_info_reader): Don't complain about language
27         if we have pubnames/pubtypes.
28
29 2014-05-02  Cary Coutant  <ccoutant@google.com>
30
31         * defstd.cc (in_segment): Define __ehdr_start here...
32         * layout.cc (Layout::finalize): ...Instead of here.  Set the
33         output segment when known.
34         * resolve.cc (Symbol::override_base_with_special): Remember
35         the original binding.
36         * symtab.cc (Symbol::set_output_segment): New function.
37         (Symbol::set_undefined): New function.
38         * symtab.h (Symbol::is_weak_undefined): Check original undef
39         binding.
40         (Symbol::is_strong_undefined): New function.
41         (Symbol::set_output_segment): New function.
42         (Symbol::set_undefined): New function.
43         * target-reloc.h (is_strong_undefined): Remove.
44         (issue_undefined_symbol_error): Call Symbol::is_weak_undefined.
45         Check for hidden undefs.
46         (relocate_section): Call Symbol::is_strong_undefined.
47     
48         * testsuite/Makefile.am (ehdr_start_test_1)
49         (ehdr_start_test_2, ehdr_start_test_3)
50         (ehdr_start_test_4, ehdr_start_test_5): New test cases.
51         * testsuite/Makefile.in: Regenerate.
52         * testsuite/ehdr_start_def.cc: New source file.
53         * testsuite/ehdr_start_test.cc: New source file.
54         * testsuite/ehdr_start_test.t: New linker script.
55         * testsuite/ehdr_start_test_4.sh: New shell script.
56
57 2014-04-23  Cary Coutant  <ccoutant@google.com>
58
59         PR gold/16870
60         * x86_64.cc (Target_x86_64::Relocate::relocate): Add missing break.
61
62 2014-04-15  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
63
64         * layout.cc (Layout::include_section): Allow a target to decide
65         whether to include a section.
66         * target.h (Target::should_include_section): New function.
67         (Target::do_should_include_section): New function.
68
69 2014-04-15  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
70
71         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Remove and
72         inline into ...
73         (Copy_relocs::emit): ... here.
74         * copy-relocs.h (Copy_reloc_entry): Change from class to struct.
75         (Copy_reloc_entry::make_copy_reloc): Change from private to protected.
76         (Copy_reloc_entry::entries_): Change from private to protected.
77
78 2014-04-02  Sriraman Tallam  <tmsriram@google.com>
79
80         * icf.cc (get_section_contents): Replace copies of reloc
81         vectors with const references.
82
83 2014-04-02  Cary Coutant  <ccoutant@google.com>
84
85         * configure.ac (HAVE_PUBNAMES): Use C instead of C++.
86         (HAVE_NO_USE_LINKER_PLUGIN): Check for -fno-use-linker-plugin.
87         * configure: Regenerate.
88         * testsuite/Makefile.am (OPT_NO_PLUGINS): New macro for
89         -fno-use-linker-plugin.
90         (LINK1, CXXLINK1): Add it to the link command.
91         * testsuite/Makefile.in: Regenerate.
92
93 2014-03-12  Alan Modra  <amodra@gmail.com>
94
95         * Makefile.in: Regenerate.
96
97 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
98
99         * symtab.h (Symbol::set_nonvis): New function.
100
101 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
102
103         * symtab.cc (Sized_symbol<32>::init_output_data):
104         Instantiate the template.
105         (Sized_symbol<64>::init_output_data): Likewise.
106
107 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
108
109         * symtab.cc (Symbol_table::sized_write_globals): Allow a target to
110         adjust dynamic symbol value.
111         * target.h (Target::adjust_dyn_symbol): New function.
112         (Target::do_adjust_dyn_symbol): New function.
113
114 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
115   
116         * output.cc (Output_data_dynamic::Dynamic_entry::write):
117         Get the value of DYNAMIC_CUSTOM dynamic entry.
118         * output.h (Output_data_dynamic::add_custom): New function.
119         (Dynamic_entry::Dynamic_entry): New constructor for DYNAMIC_CUSTOM
120         dynamic entry.
121         (enum Dynamic_entry::Classification): Add DYNAMIC_CUSTOM.
122         * target.h (Target::dynamic_tag_custom_value): New function.
123         (Target::do_dynamic_tag_custom_value): New function.
124
125 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
126
127         * symtab.cc (Symbol_table::set_dynsym_indexes): Allow a target to set
128         dynsym indexes.
129         * target.h (Target::has_custom_set_dynsym_indexes): New function.
130         (Target::do_has_custom_set_dynsym_indexes): New function.
131         (Target::set_dynsym_indexes): New function.
132         (Target::do_set_dynsym_indexes): New function.
133
134 2014-03-07  Alan Modra  <amodra@gmail.com>
135
136         * powerpc.cc (Powerpc_relocate_functions::Overflow_check): Add
137         CHECK_UNSIGNED, CHECK_LOW_INSN, CHECK_HIGH_INSN.
138         (Powerpc_relocate_functions::has_overflow_unsigned): New function.
139         (Powerpc_relocate_functions::has_overflow_bitfield,
140         overflowed): Use the above.
141         (Target_powerpc::Relocate::relocate): Correct overflow checking
142         for a number of relocations.  Modify overflow test for 16-bit
143         fields in instructions to signed/unsigned according to whether
144         the field takes a signed or unsigned value.
145
146 2014-03-05  Alan Modra  <amodra@gmail.com>
147
148         Update copyright years.
149
150 2014-03-05  Alan Modra  <amodra@gmail.com>
151
152         * powerpc.cc (Target_powerpc::Scan::local, global): Support
153         R_PPC64_ADDR64_LOCAL.
154         (Target_powerpc::Relocate::relocate): Likewise.
155
156 2014-03-03  Alan Modra  <amodra@gmail.com>
157
158         * dwp.cc (print_version): Update copyright year to current.
159
160 2014-02-10  Alan Modra  <amodra@gmail.com>
161
162         * po/gold.pot: Regenerate.
163
164 2014-02-06  Cary Coutant  <ccoutant@google.com>
165
166         Fix problem where -u is ignored when a weak undef is seen.
167
168         * archive.cc (Library_base::should_include_member): Reorder
169         code to check for -u option if a weak undef has already been seen.
170         * testsuite/Makefile.am (weak_undef_test_2): New test case.
171         * testsuite/Makefile.in: Regenerate.
172         * testsuite/weak_undef_file3.cc: New file.
173         * testsuite/weak_undef_file4.cc: New file.
174         * testsuite/weak_undef_test_2.cc: New file.
175
176 2014-02-05  Cary Coutant  <ccoutant@google.com>
177
178         Fix issues with gold undefined symbol diagnostics.
179
180         PR binutils/15435
181         * errors.cc (Errors::undefined_symbol): Move undef vtable symbol
182         check to here.
183         * target-reloc.h (is_strong_undefined): New function.
184         (relocate_section): Move undef vtable symbol check from here.
185         Check for is_strong_undefined.
186
187 2014-02-05  Cary Coutant  <ccoutant@google.com>
188     
189         Fix problems with the --dynamic-list option.
190
191         PR gold/13577
192         * options.cc (General_options::parse_dynamic_list):
193         Set have_dynamic_list_.
194         (General_options::General_options): Initialize have_dynamic_list_.
195         (General_options::finalize): Turn off -Bsymbolic and
196         -Bsymbolic-functions if --dynamic-list provided.
197         * options.h (General_options::have_dynamic_list): New function.
198         (General_options::have_dynamic_list_): New data member.
199         * symtab.h (Symbol::is_preemptible): Handle --dynamic-list
200         correctly.
201    
202         PR gold/16530
203         * symtab.cc (Symbol_table::add_from_relobj): If symbol is named
204         in --dynamic-list, mark it.
205    
206         * testsuite/Makefile.am (gc_dynamic_list_test.sh): New test case.
207         (dynamic_list_2): New test case.
208         * testsuite/Makefile.in: Regenerate.
209         * testsuite/dynamic_list_2.cc: New file.
210         * testsuite/dynamic_list_2.t: New file.
211         * testsuite/dynamic_list_lib1.cc: New file.
212         * testsuite/dynamic_list_lib2.cc: New file.
213         * testsuite/gc_dynamic_list_test.c: New file.
214         * testsuite/gc_dynamic_list_test.sh: New file.
215         * testsuite/gc_dynamic_list_test.t: New file.
216
217 2014-01-28  Cary Coutant  <ccoutant@google.com>
218
219         Add .gdb_index version 7 support.
220
221         * gold/dwarf_reader.cc: include <utility> (for make_pair).
222         (Dwarf_abbrev_table::do_read_abbrevs): Check for compressed
223         debug sections.
224         (Dwarf_ranges_table::read_ranges_table): Likewise.
225         (Dwarf_pubnames_table::read_section): Check for GNU-style
226         sections, and for compressed debug sections.
227         (Dwarf_pubnames_table::read_header): Compute end address of table.
228         (Dwarf_pubnames_table::next_name): Return flag_byte.  Check
229         for end of list by offset, not by offset == 0.
230         (Dwarf_info_reader::do_read_string_table): Check for compressed
231         debug sections.
232         * gold/dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
233         Initialize new data members.
234         (Dwarf_pubnames_table::next_name): return flag_byte.
235         (Dwarf_pubnames_table::end_of_table_): New data member.
236         (Dwarf_pubnames_table::is_gnu_style_): New data member.
237         * gold/gdb-index.cc (gdb_index_version): Update to version 7.
238         (Gdb_index_info_reader::read_pubtable): Read flag_byte.
239         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Don't
240         read skeleton type unit DIEs.
241         (Gdb_index::add_symbol): Add flag_byte; adjust all callers.
242         (Gdb_index::do_write): Write flag_byte.
243         * gold/gdb-index.h (Gdb_index::add_symbol): Add flags parameter.
244         (Gdb_index::Cu_vector): Store flags along with cu indexes.
245         * gold/testsuite/gdb_index_test_3.sh: Allow versions 4-7.
246         * gold/testsuite/gdb_index_test_comm.sh: Likewise.
247
248 2014-01-08  H.J. Lu  <hongjiu.lu@intel.com>
249
250         * version.cc (print_version): Update copyright year to 2014.
251
252 2013-12-19  Dimitry Andric  <dimitry@andric.com>
253
254         * stringpool.cc (Stringpool_template::reserve): Add
255         HAVE_UNORDERED_MAP case.
256         * stringpool.cc (Stringpool_template::print_stats): Likewise.
257
258 2013-12-18  Cary Coutant  <ccoutant@google.com>
259
260         * configure.ac: Check for <unordered_set> and <unordered_map>.
261         * config.in: Regenerate.
262         * configure: Regenerate.
263         * system.h: Use <unordered_set> and <unordered_map> if available.
264
265 2013-12-10  Roland McGrath  <mcgrathr@google.com>
266
267         * Makefile.am (install-exec-local): Prefix $(INSTALL_PROGRAM) uses
268         with $(INSTALL_PROGRAM_ENV).
269         * Makefile.in: Regenerate.
270
271 2013-11-22  Cary Coutant  <ccoutant@google.com>
272
273         * configure.ac: Add check for which library is needed for
274         dlopen.
275         * configure: Regenerate.
276
277 2013-11-22  Cary Coutant  <ccoutant@google.com>
278
279         * testsuite/Makefile.am (exception_x86_64_bnd_test): Use in-tree
280         assembler.
281         * testsuite/Makefile.in: Regenerate.
282
283 2013-11-17  H.J. Lu  <hongjiu.lu@intel.com>
284
285         * x86_64.cc (Target_x86_64<size>::Scan::get_reference_flags):
286         Handle R_X86_64_PC32_BND and R_X86_64_PLT32_BND just like
287         R_X86_64_PC32 and R_X86_64_PLT32, respectively.
288         (Target_x86_64<size>::Scan::local): Likewise.
289         (Target_x86_64<size>::Scan::global): Likewise.
290         (Target_x86_64<size>::Relocate::relocate): Likewise.
291         (Target_x86_64<size>::Relocatable_size_for_reloc::get_size_for_reloc):
292         Likewise.
293         (Target_x86_64<size>::Scan::check_non_pic(): Handle
294         R_X86_64_PC32_BND.
295
296         * testsuite/Makefile.am (check_PROGRAMS): Add
297         exception_x86_64_bnd_test.
298         (exception_x86_64_bnd_test_SOURCES): New macro.
299         (exception_x86_64_bnd_test_DEPENDENCIES): Likewise.
300         (exception_x86_64_bnd_test_LDFLAGS): Likewise.
301         (exception_x86_64_bnd_test_LDADD): Likewise.
302         (exception_x86_64_bnd_1.o): New rule.
303         (exception_x86_64_bnd_2.o): Likewise.
304         * testsuite/Makefile.in: Regenerated.
305
306 2013-11-15  Alan Modra  <amodra@gmail.com>
307
308         * powerpc.cc (Target_powerpc::glink_section): Provide non-const
309         accessor.
310         (Target_powerpc::Branch_info::make_stub): Make global entry stubs.
311         Only call ppc64_local_entry_offset for 64-bit.  Restrict
312         symval_for_branch lookup to ELFv1.
313         (Stub_table::add_plt_call_entry): Use unsigned int off.
314         (Output_data_glink::Address, invalid_address): New.
315         (Output_data_glink::add_eh_frame): Move out of line.  Add
316         support for ELFv2.
317         (Output_data_glink::add_global_entry, find_global_entry,
318         global_entry_address): New functions.
319         (Output_data_glink::global_entry_stubs_, end_branch_table_,
320         ge_size): New variables.
321         (Output_data_glink::set_final_data_size): Add global entry
322         stub sizing.
323         (Output_data_glink::do_write): Write global entry stubs.
324         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Add target
325         parameter.  Return true for ELFv2.  Adjust callers.
326         (Target_powerpc::Scan::local, global): Restrict opd lookup to
327         ELFv1.  Similarly for ifunc and dynamic relocation processing
328         specific to ELFv1.  Recognize that symbols are defined on
329         their plt entries for ELFv2.
330         (Target_powerpc::symval_for_branch): Assert if called for
331         ELFv2 or ppc32.
332         (Target_powerpc::Relocate::relocate): Use global entry plt
333         stub for symbol value if such exists on ELFv2.
334         (Target_powerpc::Relocate::relocate): Don't call
335         symval_for_branch when ELFv2.  Do adjust for local entry
336         offset when ELFv2.
337         (Target_powerpc::do_dynsym_value): Set symbols to global entry
338         plt stub for ELFv2.
339         (Target_powerpc::do_plt_address_for_global): Similarly.
340
341 2013-11-14  Cary Coutant  <ccoutant@google.com>
342
343         Revert patch -- this did not fix the problem, and there is
344         no race there.
345
346         2013-11-14  Cary Coutant  <ccoutant@google.com>
347
348             PR gold/14860
349             * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
350             (Ehframe_hdr::set_final_data_size): Allocate a Lock.
351             * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
352             updating fde_offsets_.
353             (Eh_frame_hdr::lock_): New data member.
354
355 2013-11-14  Cary Coutant  <ccoutant@google.com>
356
357         * dwp.cc (Dwo_file_entry): New type.
358         (File_list): Use Dwo_file_entry.
359         (Dwo_file::verify): New function.
360         (Dwo_file::verify_dwo_list): New function.
361         (Dwo_file::sized_verify_dwo_list): New function.
362         (Dwo_name_info_reader::visit_compilation_unit): Add dwo_id to file
363         list.
364         (Dwp_options): New enum type.
365         (dwp_options): Add --verify-only.
366         (usage): Likewise.
367         (main): Likewise.
368         * dwp.h (gold_info): Add declaration.
369
370 2013-11-14  Cary Coutant  <ccoutant@google.com>
371
372         PR gold/14860
373         * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
374         (Ehframe_hdr::set_final_data_size): Allocate a Lock.
375         * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
376         updating fde_offsets_.
377         (Eh_frame_hdr::lock_): New data member.
378
379 2013-11-06  Cary Coutant  <ccoutant@google.com>
380
381         PR gold/15758
382         * object.cc (Sized_relobj_file::do_layout): Handle .eh_frame sections
383         before reloc sections.
384
385 2013-11-04  Alan Modra  <amodra@gmail.com>
386
387         * symtab.h (Symbol::Reference_flags): Add FUNC_DESC_ABI.
388         (Symbol::needs_dynamic_reloc): Test new flag.
389         * powerpc.cc (needs_dynamic_reloc, use_plt_offset): Delete.
390         (Target_powerpc::Scan::get_reference_flags): Add target param.
391         Return FUNC_DESC_ABI for 64-bit ELFv1.
392         (Target_powerpc::Branch_info::make_stub): Adjust get_reference_flags
393         call.
394         (Target_powerpc::Scan::global): Use Symbol::needs_dynamic_reloc.
395         (Target_powerpc::Relocate::relocate): Use Symbol::use_plt_offset.
396
397 2013-10-31  Cary Coutant  <ccoutant@google.com>
398
399         Restore support for dwp v2 DWARF package file format.
400
401         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
402         tu_length parameter.  Adjust all callers.
403         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
404         * dwp.cc: Include dwarf.h.
405         (Section_bounds): New struct type.
406         (Unit_set): New struct type.
407         (Dwo_file::Dwo_file): Initialize new data member.
408         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
409         Combine and rename to...
410         (Dwo_file::read_unit_index): ...this.
411         (Dwo_file::sized_read_compunit_index)
412         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
413         (Dwo_file::sized_read_unit_index): ...this.
414         (Dwo_file::copy_section): Remove section_name, is_str_offsets
415         parameters; add section_id parameter.
416         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
417         (Dwo_file::add_unit_set): ...this.
418         (Dwo_file::shndx_map_): Remove.
419         (Dwo_file::sect_offsets_): New data member.
420         (Dwp_output_file::Dwp_output_file): Initialize new data members.
421         (Dwp_output_file::add_section): Rename to...
422         (Dwp_output_file::add_contribution): ...this.
423         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
424         (Dwp_output_file::add_tu_set): Likewise.
425         (Dwp_output_file::Contribution): New type.
426         (Dwp_output_file::Section::contributions): New data member.
427         (Dwp_output_file::Cu_or_tu_set): Remove.
428         (Dwp_output_file::Section::Section): New ctor.
429         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
430         (Dwp_output_file::Dwp_index::Section_table): New type.
431         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
432         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
433         parameter.
434         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
435         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
436         (Dwp_output_file::Dwp_index::section_table): New member function.
437         (Dwp_output_file::Dwp_index::section_table_end): New member function.
438         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
439         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
440         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
441         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
442         (Dwp_output_file::Dwp_index::section_table_): New data member.
443         (Dwp_output_file::Dwp_index::section_mask_): New data member.
444         (Dwp_output_file::add_output_section): New member function.
445         (Dwp_output_file::write_new_section): New member function.
446         (Dwp_output_file::write_contributions): New member function.
447         (Dwp_output_file::section_id_map_): New data member.
448         (class Dwo_id_info_reader): Remove.
449         (class Unit_reader): New class.
450         (get_dwarf_section_name): New function.
451         (Dwo_file::read_executable): Adjust initializations of class data.
452         (Dwo_file::read): Add support for v2 package file format.
453         (Dwo_file::read_unit_index): Likewise.
454         (Dwo_file::sized_read_unit_index): Likewise.
455         (Dwo_file::copy_section): Likewise.
456         (Dwo_file::add_unit_set): Likewise.
457         (Dwp_output_file::add_output_section): Likewise.
458         (Dwp_output_file::add_contribution): Likewise.
459         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
460         for empty slot.
461         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
462         file format.
463         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
464         slot.
465         (Dwp_output_file::initialize): Remove unused function.
466         (Dwp_output_file::finalize): Add support for v2 package file format.
467         (Dwp_output_file::write_index): Likewise.
468         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
469         function prototype.
470
471 2013-10-31  Cary Coutant  <ccoutant@google.com>
472
473         * configure.ac: Fix check for -fmerge-constants.
474         * configure.ac: Regenerate.
475
476 2013-10-30  Roland McGrath  <mcgrathr@google.com>
477
478         * x86_64.cc (Output_data_plt_x86_64_nacl::first_plt_entry):
479         Correct 9-byte nop sequence to match what the assembler generates.
480
481 2013-10-30  Alan Modra  <amodra@gmail.com>
482
483         * powerpc.cc (Powerpc_relobj::abiversion, set_abiversion,
484         ppc64_local_entry_offset, ppc64_local_entry_offset,
485         do_read_symbols): New functions.
486         (Powerpc_relobj::e_flags_, st_other_): New vars.
487         (Powerpc_relobj::Powerpc_relobj): Call set_abiversion.
488         (Powerpc_dynobj::abiversion, set_abiversion): New functions.
489         (Powerpc_relobj::e_flags_): New var.
490         (Target_powerpc::first_plt_entry_offset, plt_entry_size): Inline
491         and adjust for ELFv2.
492         (Target_powerpc::abiversion, set_abiversion, stk_toc): New functions.
493         (Powerpc_relobj::do_find_special_sections): Check no .opd in ELFv2.
494         (Powerpc_dynobj::do_find_special_sections): Likewise.
495         (Target_powerpc::do_define_standard_symbols): Define ".TOC.".
496         (Target_powerpc::Branch_info::make_stub): Adjust stub destination
497         to ELFv2 local entry.
498         (Target_powerpc::do_relax): No thread safe barriers needed for
499         ELFv2.
500         (Output_data_plt_powerpc::initial_plt_entry_size_,
501         plt_entry_size): Delete.  Replace all uses with
502         first_plt_entry_offset() and plt_entry_size().
503         (Output_data_plt_powerpc::Output_data_plt_powerpc): Remove
504         reserved_size parm.  Update callers.
505         (Output_data_plt_powerpc::entry_count): Update.
506         (Output_data_plt_powerpc::first_plt_entry_offset): Make private
507         and use Target_powerpc::first_plt_entry_offset().
508         (Output_data_plt_powerpc::get_plt_entry_size): Similarly and
509         rename to plt_entry_size.
510         (Output_data_plt_powerpc::add_ifunc_entry,
511         add_local_ifunc_entry): Adjust reloc for ELFv2.
512         (glink_eh_frame_fde_64): Rename to glink_eh_frame_fde_64v1.
513         (glink_eh_frame_fde_64v2): New.
514         (Stub_table::plt_call_size): Support ELFv2 sizing.
515         (Output_data_glink::add_eh_frame): Use the new FDE.
516         (Output_data_glink::set_final_data_size): Adjust for ELFv2 glink.
517         (Stub_table::do_write): Write ELFv2 stubs and glink.
518         (Target_powerpc::Relocate::relocate): Replaces nop after call
519         with ld 2,24(1) and adjust local offset destination for ELFv2.
520
521 2013-10-30  Alan Modra  <amodra@gmail.com>
522
523         * powerpc.cc (Target_powerpc::Scan::check_non_pic): Handle new relocs.
524         (Target_powerpc::Scan::global, local): Likewise.
525         (Target_powerpc::Relocate::relocate): Likewise.  Check for overflow
526         on all ppc64 @h and @ha relocs.
527
528 2013-10-14  Alan Modra  <amodra@gmail.com>
529
530         * output.h (Output_data_got::add_constant): Tidy.
531         (Output_data_got::add_constant_pair): New function.
532         * powerpc.cc (Output_data_got_powerpc): Override all Output_data_got
533         methods used so as to first call reserve_ent().
534
535 2013-10-11  Roland McGrath  <mcgrathr@google.com>
536
537         * powerpc.cc (Output_data_got_powerpc): Remove unused methods
538         add_got_entry and add_got_entry_pair.
539
540         * configure.ac (TLS_GNU2_DIALECT): Use -Werror in test.
541         (HAVE_PUBNAMES): Likewise.
542         * configure: Regenerate.
543
544         * testsuite/Makefile.am: Replace '-T foo' with '-Wl,-T,foo' throughout.
545         * testsuite/Makefile.in: Regenerate.
546
547         * target.h (Target::adjust_elf_header, Target::do_adjust_elf_header):
548         Remove const from declaration.
549         * target.cc (Sized_target::do_adjust_elf_header): Update definition.
550         * sparc.cc (Target_sparc::do_adjust_elf_header): Likewise.
551         * output.h (Output_file_header): Remove const from member target_
552         and corresponding constructor argument.
553         * output.cc (Output_file_header::Output_file_header): Update prototype.
554         (Output_file_header::do_sized_write): Use this->target_ in place
555         of parameters()->target().
556
557         * testsuite/undef_symbol.cc (Foo::get_a): New method.
558
559         * configure.ac (MERGE_CONSTANTS_FLAG): New check.
560         * configure: Regenerate.
561         * Makefile.in: Regenerate.
562         * testsuite/merge_string_literals_1.c: Renamed to have .cc suffix.
563         * testsuite/merge_string_literals_2.c: Likewise.
564         * testsuite/Makefile.am
565         (merge_string_literals_1.o, merge_string_literals_2.o): Update deps.
566         (AM_CFLAGS, AM_CXXFLAGS): Use $(MERGE_CONSTANTS_FLAG) in place of
567         literal -fmerge-constants.
568         * testsuite/Makefile.in: Regenerate.
569
570         * i386.cc (Target_i386): Remove unused member dynbss_.
571         * arm.cc (Target_arm): Likewise.
572         * powerpc.cc (Target_powerpc): Likewise.
573         * sparc.cc (Target_sparc): Likewise.
574         * tilegx.cc (Target_tilegx): Likewise.
575         * x86_64.cc (Target_x86_64): Likewise.
576         * dwarf_reader.h (Dwarf_info_reader): Remove unused members
577         type_signature_, type_offset_.
578         * plugin.h (Plugin_hook): Remove unused member layout_.
579         * readsyms.h (Add_symbols): Remove unused members dirpath_, dirindex_,
580         mapfile_.
581         (Read_member): Remove unused members input_objects_, symtab_,
582         mapfile_, layout_.
583         (Check_library): Remove unused member symtab_.
584         * archive.h (Lib_group): Remove unused member lib_.
585         * archive.cc (Lib_group::Lib_group): Update initializer.
586         * incremental.h (Incremental_binary): Remove unused member target_.
587         (Incremental_script_entry): Removed unused member script_.
588         * layout.h (Write_symbols_task): Remove unused member input_objects_.
589         * icf.h (Icf): Remove unused member num_tracked_relocs.
590
591         * gold-threads.h (Once): Conditionalize member was_run_lock_ on
592         [ENABLE_THREADS && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4], matching
593         its only use.
594         * gold-threads.cc (Once::Once): Likewise conditionalize initializer.
595
596         * archive.h: Use struct rather than class for forward declaration
597         of Read_symbols_data.
598
599 2013-10-07  Cary Coutant  <ccoutant@google.com>
600
601         PR gold/16010
602         * testsuite/Makefile.am (icf_test): Fix dependencies.
603         (icf_safe_test): Likewise.
604         (icf_safe_so_test): Likewise.
605         (large_symbol_alignment): Add empty _LDADD rule.
606         * testsuite/Makefile.in: Regenerate.
607
608 2013-09-03  Pavel Chupin  <pavel.v.chupin@intel.com>
609
610         PR gold/15927
611         * x86_64.cc (Target_x86_64<size>::Scan::global): Use relative
612         relocation for R_X86_64_32 on x32.
613
614 2013-08-27  Roland McGrath  <mcgrathr@google.com>
615
616         * output.cc (Output_segment::set_section_addresses): Take new
617         Target* argument.  If target->isolate_execinstr() and the segment
618         is executable and starts at a target->abi_pagesize() boundary,
619         pad its end out to a target->abi_pagesize() boundary with code fill.
620         * output.h (Output_segment::set_section_addresses): Update decl.
621         * layout.h (Layout::check_output_data_for_reset_values): Take new
622         argument RELAX_OUTPUTS.
623         (Layout): New member relax_output_list_.
624         (Layout::add_relax_output): New method.
625         * layout.cc (Layout::Layout): Update constructor.
626         (Layout::reset_relax_output): New method.
627         (Layout::clean_up_after_relaxation): Call it.
628         (Layout::prepare_for_relaxation): Update caller.
629         (Layout::set_segment_offsets): Update callers of set_section_addresses.
630         Call reset_relax_output before re-processing segments for
631         isolate_execinstr case.
632         (Layout::write_data): Handle relax_output_list_.
633         (Layout::Relaxation_debug_check::check_output_data_for_reset_values):
634         Take new argument RELAX_OUTPUTS.  Assert it's an empty collection.
635
636 2013-08-23  Yuri Chornoivan  <yurchor@ukr.net>
637
638         PR binutils/15834
639         * object.h: Fix typos.
640
641 2013-08-16  Roland McGrath  <mcgrathr@google.com>
642
643         * i386.cc (Target_i386_nacl::do_code_fill): New virtual function.
644         * x86_64.cc (Target_x86_64_nacl::do_code_fill): New virtual function.
645
646 2013-08-07  Cary Coutant  <ccoutant@google.com>
647
648         Revert support for v2 DWP files:
649
650         2013-03-01  Cary Coutant  <ccoutant@google.com>
651
652             Add dwp support for v2 DWARF package file format.
653             * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
654             tu_length parameter.  Adjust all callers.
655             * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
656             * dwp.cc: Include dwarf.h.
657             (Section_bounds): New struct type.
658             (Unit_set): New struct type.
659             (Dwo_file::Dwo_file): Initialize new data member.
660             (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
661             Combine and rename to...
662             (Dwo_file::read_unit_index): ...this.
663             (Dwo_file::sized_read_compunit_index)
664             (Dwo_file::sized_read_typeunit_index): Combine and rename to...
665             (Dwo_file::sized_read_unit_index): ...this.
666             (Dwo_file::copy_section): Remove section_name, is_str_offsets
667             parameters; add section_id parameter.
668             (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
669             (Dwo_file::add_unit_set): ...this.
670             (Dwo_file::shndx_map_): Remove.
671             (Dwo_file::sect_offsets_): New data member.
672             (Dwp_output_file::Dwp_output_file): Initialize new data members.
673             (Dwp_output_file::add_section): Rename to...
674             (Dwp_output_file::add_contribution): ...this.
675             (Dwp_output_file::add_cu_set): Combine parameters into a struct.
676             (Dwp_output_file::add_tu_set): Likewise.
677             (Dwp_output_file::Contribution): New type.
678             (Dwp_output_file::Section::contributions): New data member.
679             (Dwp_output_file::Cu_or_tu_set): Remove.
680             (Dwp_output_file::Section::Section): New ctor.
681             (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
682             (Dwp_output_file::Dwp_index::Section_table): New type.
683             (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
684             (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
685             parameter.
686             (Dwp_output_file::Dwp_index::shndx_pool): Remove.
687             (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
688             (Dwp_output_file::Dwp_index::section_table): New member function.
689             (Dwp_output_file::Dwp_index::section_table_end): New member function.
690             (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
691             (Dwp_output_file::Dwp_index::section_table_rows): New member function.
692             (Dwp_output_file::Dwp_index::section_table_cols): New member function.
693             (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
694             (Dwp_output_file::Dwp_index::section_table_): New data member.
695             (Dwp_output_file::Dwp_index::section_mask_): New data member.
696             (Dwp_output_file::add_output_section): New member function.
697             (Dwp_output_file::write_new_section): New member function.
698             (Dwp_output_file::write_contributions): New member function.
699             (Dwp_output_file::section_id_map_): New data member.
700             (class Dwo_id_info_reader): Remove.
701             (class Unit_reader): New class.
702             (get_dwarf_section_name): New function.
703             (Dwo_file::read_executable): Adjust initializations of class data.
704             (Dwo_file::read): Add support for v2 package file format.
705             (Dwo_file::read_unit_index): Likewise.
706             (Dwo_file::sized_read_unit_index): Likewise.
707             (Dwo_file::copy_section): Likewise.
708             (Dwo_file::add_unit_set): Likewise.
709             (Dwp_output_file::add_output_section): Likewise.
710             (Dwp_output_file::add_contribution): Likewise.
711             (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
712             for empty slot.
713             (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
714             file format.
715             (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
716             slot.
717             (Dwp_output_file::initialize): Remove unused function.
718             (Dwp_output_file::finalize): Add support for v2 package file format.
719             (Dwp_output_file::write_index): Likewise.
720             * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
721             function prototype.
722
723 2013-07-31  Cary Coutant  <ccoutant@google.com>
724
725         * object.cc (Sized_relobj::do_output_section_address): New function.
726         (Sized_relobj): Instantiate explicitly.
727         * object.h (Object::output_section_address): New function.
728         (Object::do_output_section_address): New function.
729         (Sized_relobj::do_output_section_address): New function.
730         * powerpc.cc (Target_powerpc::symval_for_branch): Use it.
731
732 2013-07-30  Cary Coutant  <ccoutant@google.com>
733             Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
734
735         * parameters.cc (Parameters::entry): Return target-specific entry
736         symbol name.
737         * target.h (Target::entry_symbol_name): New function.
738         (Target_info::entry_symbol_name): New data member.
739
740         * arm.cc (Target_arm::arm_info): Add entry_symbol_name.
741         * i386.cc (Target_i386::i386_info): Likewise.
742         (Target_i386_nacl::i386_nacl_info): Likewise.
743         * sparc.cc (Target_sparc::sparc_info): Likewise.
744         * tilegx.cc (Target_tilegx::tilegx_info): Likewise.
745         * x86_64.cc: (Target_x86_64::x86_64_info) Likewise.
746         (Target_x86_64_nacl::x86_64_nacl_info) Likewise.
747         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
748
749 2013-07-22  Sterling Augustine  <saugustine@google.com>
750
751         * dwarf_reader.cc (Dwarf_pubnames_table::read_section):
752         Convert parameter shndx to local variable. Add parameters symtab
753         and symtab_size.  Scan over section names.  Find relocation
754         section corresponding to current section.  Create and initialize
755         reloc_mapper_ and reloc_type_.
756         (Dwarf_pubnames_table::read_header):  Add assertion.  Change
757         unit_length to off_t.  Initialize member unit_length_.  Fill in field
758         cu_offset_.
759         * dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
760         Initialize new fields unit_length_ and cu_offset_.
761         (Dwarf_pubnames_table::read_section): Update prototype.
762         (Dwarf_pubnames_table::cu_offset): New member function.
763         (Dwarf_pubnames_table::subsection_size): Likewise.
764         (Dwarf_pubnames_table::cu_offset_, Dwarf_pubnames_table::unit_length):
765         New fields.
766         (Dwarf_info_reader::symtab, Dwarf_info_reader::symtab_size): Make
767         member functions public.
768         * gdb_index.cc (Gdb_index_info_reader::read_pubnames_and_pubtypes):
769         Update comment.  Rework logic.  Move repeated parts to...
770         (Gdb_index_info_reader::read_pubtable): ...here. New function.
771         (Gdb_index::Gdb_index): Initialize new fields, pubnames_table_,
772         pubtypes_table_, and stmt_list_offset.
773         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
774         Gdb_index::find_pubtype_offset,
775         Gdb_index::map_pubnames_and_types_to_dies): Define new functions.
776         (Gdb_index::pubnames_read): Update prototype and rework logic.
777         * gdb_index.h (Gdb_index_info_reader, Dwarf_pubnames_table):
778         Forward declare.
779         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
780         Gdb_index::find_pubtype_offset, Gdb_index::pubnames_table)
781         Gdb_index::pubtypes_table, Gdb_index::map_pubnames_and_types_to_dies,
782         Gdb_index::map_pubtable_to_dies):
783         Declare functions.
784         (Gdb_index::pubnames_read): Update declaration.
785         (Gdb_index::Pubname_offset_map): New type.
786         (Gdb_index::cu_pubname_map_, Gdb_index::cu_pubtype_map_,
787         Gdb_index::pubnames_table_, Gdb_index::pubtypes_table_,
788         Gdb_index::stmt_list_offset): Declare.
789         (Gdb_index::pubnames_shndx_, Gdb_index::pubnames_offet_,
790         Gdb_index::pubtypes_object_, Gdb_index::pubtypes_shndx_)
791         Gdb_index::pubtypes_offset_): Remove.
792
793 2013-07-19  Roland McGrath  <mcgrathr@google.com>
794
795         * options.h (General_options): Add -Trodata-segment option.
796         * parameters.cc (Parameters::check_rodata_segment): New function.
797         (Parameters::set_target_once): Call it.
798         * parameters.h (Parameters): Declare it (private member function).
799         * layout.cc (load_seg_unusable_for_headers): New function, broken
800         out of Layout::relaxation_loop_body.  If TARGET->isolate_execinstr()
801         then validate rodata segment rather than text segment.
802         (relaxation_loop_body): Call that.
803         (is_text_segment): New function.  Don't admit a non-executable
804         segment if TARGET->isolate_execinstr().
805         (set_segment_offsets): Call it.  Honor -Trodata-segment option.
806
807 2013-07-15  Shawn Landden  <shawnlandden@gmail.com>
808
809         PR gold/15070
810         * fileread.h (File_read::get_view): Clarify comment about ALIGNED.
811         * nacl.h (Sniff_file::View::View): Request aligned view.
812
813 2013-07-11  Cary Coutant  <ccoutant@google.com>
814
815         * powerpc.cc (Target_powerpc::write_branch_lookup_table): Use
816         correct BRLT entry size.
817
818 2013-07-03  Alan Modra  <amodra@gmail.com>
819
820         * powerpc.cc (Target_powerpc::Relocate::relocate): Update self-call
821         comment.
822
823 2013-07-01  Cary Coutant  <ccoutant@google.com>
824
825         * dwarf_reader.cc (Dwarf_ranges_table::read_ranges_table): Save
826         reloc_type_.
827         (Dwarf_ranges_table::read_range_list): Call lookup_reloc.
828         (Dwarf_ranges_table::lookup_reloc): New function.
829         * dwarf_reader.h (Dwarf_ranges_table::Dwarf_ranges_table): Initialize
830         reloc_type_.
831         (Dwarf_ranges_table::lookup_reloc): New function.
832         (Dwarf_ranges_table::reloc_type_): New data member.
833
834 2013-06-27  Jing Yu  <jingyu@google.com>
835
836         PR gold/15662
837         * powerpc.cc (Output_data_brlt_powerpc::reset_brlt_sizes): New
838         function.
839         (Output_data_brlt_powerpc::finalize_brlt_sizes): New function.
840         (Target_powerpc::do_relax): Call the above.
841
842 2013-06-27  Cary Coutant  <ccoutant@google.com>
843
844         * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
845         on garbage collected .opd section.
846
847 2013-06-27  Alan Modra  <amodra@gmail.com>
848
849         * powerpc.cc (Target_powerpc::do_gc_add_reference): Test dst_shndx
850         is non-zero.
851         (Target_powerpc::do_gc_mark_symbols): Likewise for sym->shndx().
852         (Target_powerpc::do_function_location): Likewise for loc->shndx.
853
854 2013-06-14  Cary Coutant  <ccoutant@google.com>
855
856         * resolve.cc (Symbol::override_base): Don't override st_type
857         from plugin placeholder symbols.
858         (Symbol_table::resolve): Likewise.
859         (Symbol_table::should_override): Don't complain about TLS mismatch
860         if the TO symbol is a plugin placeholder.
861         * testsuite/Makefile.am (plugin_test_tls): New test.
862         * testsuite/Makefile.in: Regenerate.
863         * testsuite/plugin_test_tls.sh: New test script.
864         * testsuite/two_file_test_2_tls.cc: New test source.
865         * testsuite/two_file_test_tls.cc: New test source.
866
867 2013-06-05  Alexander Ivchenko  <alexander.ivchenko@intel.com>
868
869         * layout.cc (Layout::set_segment_offsets): Taking care of the case when
870         the maximum segment alignment is larger than the page size.
871         * testsuite/Makefile.am (large_symbol_alignment): Test that Gold
872         correctly aligns the symbols with large alignemnt.
873         * testsuite/Makefile.in: Regenerate.
874         * testsuite/large_symbol_alignment.cc: New file.
875
876 2013-05-30  Alexander Ivchenko  <alexander.ivchenko@intel.com>
877             Sriraman Tallam  <tmsriram@google.com>
878
879         * options.h (sort_section): New option.
880         * output.h (Input_section_sort_section_prefix_special_ordering_compare):
881         Rename from Input_section_sort_section_name_special_ordering_compare.
882         (Input_section_sort_section_name_compare): New struct.
883         * output.cc (Output_section::Input_section_sort_section_name_compare::
884         operator()): New function.
885         (Output_section::sort_attached_input_sections): Use new sort function
886         for .text if --sort-section=name is specified.
887         * layout.cc (Layout::make_output_section):
888         Add sorting by name when --sort-section=name is specified.
889         * testsuite/Makefile.am (text_section_grouping): Test option
890         --sort-section=name.
891         * testsuite/Makefile.in: Regenerate.
892         * testsuite/section_sorting_name.cc: New file.
893         * testsuite/section_sorting_name.sh: New file.
894
895 2013-05-21  Cary Coutant  <ccoutant@google.com>
896
897         * symtab.h (Symbol::is_cxx_vtable): New function.
898         * target-reloc.h (relocate_section): Check for vtable symbol.
899         * testsuite/Makefile.am (missing_key_func.sh): New test case.
900         * testsuite/Makefile.in: Regenerate.
901         * testsuite/missing_key_func.cc: New test source.
902         * testsuite/missing_key_func.sh: New test script.
903
904 2013-05-21  Cary Coutant  <ccoutant@google.com>
905
906         * object.cc (Sized_relobj_file::get_symbol_location_info): Set
907         type of enclosing symbol.
908         (Relocate_info::location): Check symbol type when describing symbol.
909         * object.h (Symbol_location_info): Remove unused line_number;
910         add enclosing_symbol_type.
911         * testsuite/debug_msg.sh: Adjust expected output.
912
913 2013-05-13  Cary Coutant  <ccoutant@google.com>
914
915         * configure.ac: Export DEFAULT_TARGET.
916         * configure: Regenerate.
917         * Makefile.in: Regenerate.
918         * testsuite/Makefile.am: Add .EXPORT_ALL_VARIABLES.
919         * testsuite/Makefile.in: Regenerate.
920         * testsuite/debug_msg.sh: Delete duplicate tests.
921         Don't check undef_int error message match for powerpc where the
922         source file and line number aren't available.
923
924 2013-05-10  Roland McGrath  <mcgrathr@google.com>
925
926         * options.h (General_options): Add --rosegment-gap option.
927         * options.cc (finalize): --rosegment-gap implies --rosegment.
928         * layout.cc (set_segment_offsets): Let user option override
929         target->rosegment_gap().
930
931 2013-05-10  Roland McGrath  <mcgrathr@google.com>
932
933         * options.h (General_options): Remove leading space from help
934         messages for -nostdlib and --rosegment.
935
936 2013-05-03  Maciej W. Rozycki  <macro@codesourcery.com>
937
938         PR ld/15365
939         * layout.cc (Layout::finalize): Make __ehdr_start STV_HIDDEN.
940
941 2013-05-03  Alan Modra  <amodra@gmail.com>
942
943         * merge.cc (Output_merge_string::do_add_input_section): Correct
944         scan for number of strings.  Rename vars to avoid shadowing.
945         Include missing terminator in input_size_.
946
947 2013-05-01  H.J. Lu  <hongjiu.lu@intel.com>
948
949         * merge.cc (Output_merge_string<Char_type>::do_add_input_section):
950         Restore empty string handling.
951
952 2013-05-01  Cary Coutant  <ccoutant@google.com>
953
954         * stringpool.cc (Stringpool_template::new_key_offset): Fix
955         uninitialized warning.
956
957 2013-04-29  Alexander Ivchenko  <alexander.ivchenko@intel.com>
958
959         * output.cc (Output_section::add_merge_input_section): Allow
960         to merge sections if the alignment is more than character size.
961         * merge.h (Output_merge_string::Output_merge_string): Remove
962         assert.
963         * merge.cc (Output_merge_string<Char_type>::do_add_input_section): Count
964         only not-null strings. Check the alignment of strings.
965         * stringpool.h
966         (Stringpool_template<Stringpool_char>::Stringpool_template): Add
967         alignment as the argument.
968         (Stringpool_template<Stringpool_char>::addralign_): New class member.
969         * stringpool.cc (Stringpool_template<Stringpool_char>::new_key_offset):
970         Align non-zero length strings according to the addralign_.
971         (Stringpool_template<Stringpool_char>::set_string_offsets):
972         Updating offsets according to the given alignment.
973         * testsuite/Makefile.am (text_section_grouping): Test if string
974         literals are getting merged.
975         * testsuite/Makefile.in: Regenerate.
976         * testsuite/merge_string_literals_1.c: New file.
977         * testsuite/merge_string_literals_2.c: Ditto.
978         * testsuite/merge_string_literals.sh: Ditto.
979
980 2013-04-26  Ian Lance Taylor  <iant@google.com>
981
982         * target-reloc.h (relocate_section): If the reloc offset is out of
983         range, pass VIEW as NULL to relocate.relocate.
984         * arm.cc (Target_arm:Relocate::relocate): Check for a NULL view.
985         * i386.cc (Target_i386::Relocate::relocate): Likewise.
986         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
987         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
988         * tilegx.cc (Target_tilegx::Relocate::relocate): Likewise.
989         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
990
991 2013-04-26  Geoff Pike  <gpike@chromium.org>
992
993         * gold.cc (queue_final_tasks): invoke layout->queue_build_id_tasks().
994         * layout.cc (Hash_task): New class.
995         (Layout::queue_build_id_tasks): New function.
996         (Layout::write_build_id): Handle single-thread portion of build ID
997         computation.  (In some cases, all of it is single-threaded.)  Replace
998         {sha1,md5}_process_bytes with {sha1,md5}_buffer to get the same
999         functionality in fewer lines of code.
1000         * layout.h (Layout::queue_build_id_tasks): New function declaration.
1001         * options.h (General_options): make "--build-id" default to tree
1002         rather than sha1.  Add two new options related to --build-id=tree:
1003         --build-id-chunk-size-for-treehash and
1004         --build-id-min-file-size-for-treehash.
1005         * Makefile.am: add testing of --build-id=tree and related new options
1006         (these tests will be invoked by "make check").
1007         * Makefile.in: Regenerate.
1008
1009 2013-04-25  Alan Modra  <amodra@gmail.com>
1010
1011         * configure.tgt: Add powerpcle and powerpc64le.
1012
1013 2013-04-22  Alan Modra  <amodra@gmail.com>
1014
1015         PR gold/15355
1016         * layout.cc (Layout::segment_precedes): Allow more than one
1017         segment with the same type and flags.
1018
1019 2013-04-15  Cary Coutant  <ccoutant@google.com>
1020
1021         * layout.cc (Layout::set_relocatable_section_offsets): Don't
1022         allocate space in file for BSS sections.
1023
1024 2013-04-15  Cary Coutant  <ccoutant@google.com>
1025
1026         * script-sections.cc (Orphan_output_section): Reset address
1027         to zero after each orphaned section for relocatable links.
1028
1029 2013-04-15  Cary Coutant  <ccoutant@google.com>
1030
1031         * symtab.cc (Symbol_table::sized_write_globals): Subtract
1032         section starting address for relocatable link.
1033         * testsuite/Makefile.am (script_test_11): New test.
1034         * testsuite/Makefile.in: Regenerate.
1035         * testsuite/script_test_11.c: New source file.
1036         * testsuite/script_test_11.t: New linker script.
1037
1038 2013-04-13  Alan Modra  <amodra@gmail.com>
1039
1040         * powerpc.cc (Stub_control::can_add_to_stub_group): Don't set
1041         owner when sections are not adjacent and exceed group size.
1042         (Target_powerpc::group_sections): Handle corner case.
1043         (Target_powerpc::Branch_info::make_stub): Handle case where
1044         stub table doesn't exist due to branches in non-exec sections.
1045         (Target_powerpc::Relocate::relocate): Likewise.
1046
1047 2013-04-11  Alan Modra  <amodra@gmail.com>
1048
1049         PR gold/15354
1050         * powerpc.cc (Target_powerpc::make_brlt_section): Name section
1051         .branch_lt to match bfd ld.  Adjust comments throughout file.
1052
1053 2013-04-04  Ian Lance Taylor  <iant@google.com>
1054
1055         GCC PR c++/56840
1056         * object.cc (do_layout_deferred_sections): Handle .eh_frame
1057         sections before checking whether they are included in the link.
1058
1059 2013-03-29  Sriraman Tallam  <tmsriram@google.com>
1060
1061         * archive.cc (Archive::get_elf_object_for_member):  Create the elf
1062         object before calling the plugin claim_file handler.  Pass the elf
1063         object of the archive to the plugin. Delete the elf object if the
1064         plugin claims the file.
1065
1066 2013-03-21  Alan Modra  <amodra@gmail.com>
1067
1068         * layout.cc (Layout::set_segment_offsets): Accept writable .text
1069         segment when omagic.
1070
1071 2013-03-21  Alan Modra  <amodra@gmail.com>
1072
1073         * dwp.cc (Dwp_output_file::add_contribution): Avoid signed/unsigned
1074         comparison warning.
1075         * layout.cc (Layout::create_dynamic_symtab): Avoid "may be used
1076         uninitialized" warning.
1077
1078 2013-03-20  Alan Modra  <amodra@gmail.com>
1079
1080         * symtab.h (Symbol::clear_version): New function.
1081         * symtab.cc (Symbol_table::set_dynsym_indexes): Don't set object
1082         is_needed by weak references.  Clear version for symbols defined
1083         in as-needed objects that are not needed.
1084
1085 2013-03-15  Alan Modra  <amodra@gmail.com>
1086
1087         * powerpc.cc (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Make
1088         static and public.  Add report_err param.  Return false for data refs.
1089         (Target_powerpc::rela_dyn_section): New overloaded function.
1090         (Target_powerpc::plt_, iplt_): Elucidate.
1091         (Output_data_plt_powerpc::entry_count): Handle current_data_size()==0.
1092         (Output_data_plt_powerpc::do_write): Don't write .iplt.
1093         (Output_data_plt_powerpc::plt_entry_count): Don't add .iplt entries.
1094         (Target_powerpc::Scan::local, global): Adjust reloc_needs_plt_for_ifunc
1095         calls.  Put ifunc dynamic relocs in irela_dyn_section.  Only
1096         push_branch and make_plt_entry for ifunc syms when
1097         reloc_needs_plt_for_ifunc.
1098         (Target_powerpc::Relocate::relocate): Don't use plt entry value
1099         for ifunc unless reloc_needs_plt_for_ifunc.
1100
1101 2013-03-15  Alan Modra  <amodra@gmail.com>
1102
1103         * gc.h (gc_process_relocs): Don't look through function descriptors.
1104         * icf.cc (get_section_contents): Do so here instead.
1105
1106 2013-03-13  Alan Modra  <amodra@gmail.com>
1107
1108         * powerpc.cc (is_branch_reloc): Forward declare.
1109         (Target_powerpc::do_can_check_for_function_pointers): New predicate.
1110         (Target_powerpc::Scan::local_reloc_may_be_function_pointer): Return
1111         false for 64-bit, true for 32-bit non-branch relocs.
1112         (Target_powerpc::Scan::global_reloc_may_be_function_pointer): Likewise.
1113         * testsuite/Makefile.am (icf_test): Use linker map file instead of
1114         nm output.
1115         (icf_safe_test): Generate linker map file as well as nm output.
1116         (icf_safe_so_test): Likewise.
1117         * testsuite/Makefile.in: Regenerate.
1118         * testsuite/icf_test.sh: Parse linker map file to determine
1119         section folding.
1120         * testsuite/icf_safe_test.sh: Likewise.  Expect folding for PowerPC.
1121         * testsuite/icf_safe_so_test.sh: Likewise.
1122         (X86_32_or_ARM_specific_safe_fold): Merge into..
1123         (arch_specific_safe_fold): ..this.
1124         (X86_64_specific_safe_fold): Delete unused function.
1125
1126 2013-03-12  Alan Modra  <amodra@gmail.com>
1127
1128         * gc.h (gc_process_relocs): Look through function descriptors
1129         to determine shndx, symvalue and addend used by ICF.  Tidy
1130         variable duplication.
1131
1132 2013-03-11  Alan Modra  <amodra@gmail.com>
1133
1134         * gold.cc (queue_middle_tasks): Move detect_odr_violations..
1135         * layout.cc (Layout_task_runner::run): ..to here.
1136         * symtab.h (struct Symbol_location): Extract from..
1137         (class Symbol_table): ..here.
1138         * symtab.cc (Symbol_table::linenos_from_loc): Invoke function_location.
1139         * target.h (class Target): Add function_location and
1140         do_function_location functions.
1141         (class Sized_target): Add do_function_location.
1142         * object.h (class Sized_relobj_file): Move find_shdr..
1143         (class Object): ..to here.
1144         * object.cc: Likewise.  Update to suit.  Instantiate.
1145         (Sized_relobj_file::find_eh_frame): Update find_shdr call.
1146         * powerpc.cc (class Powerpc_dynobj): New.
1147         (Target_powerpc::do_function_location): New function.
1148         (Powerpc_relobj::do_find_special_sections): Update find_shdr call.
1149         (Powerpc_dynobj::do_read_symbols): New function.
1150         (Target_powerpc::do_make_elf_object): Make a Powerpc_dynobj.
1151
1152 2013-03-08  Ian Lance Taylor  <iant@google.com>
1153
1154         * options.cc (General_options::string_to_object_format): Accept
1155         "default".
1156
1157 2013-03-08  Alan Modra  <amodra@gmail.com>
1158
1159         * ehframe.h (Post_fdes) Make it a vector of Post_fde rather than
1160         pointer to Post_fde.
1161         (struct Post_fde): Move definition to here..
1162         * ehframe.cc (struct Post_fde): ..from here.
1163         (Cie::write): Don't alloc Post_fde.
1164         (Eh_frame::do_sized_write): Update.  Don't free Post_fde.
1165
1166 2013-03-07  Alan Modra  <amodra@gmail.com>
1167
1168         * testsuite/discard_locals_relocatable_test.c: Add a powerpc
1169         relocation referencing .LC0.
1170         * testsuite/discard_locals_test.sh: Remove FIXMEs.
1171
1172 2013-03-07  Alan Modra  <amodra@gmail.com>
1173
1174         * testsuite/ifunc-sel.h (ifunc_sel, ifunc_one): Mark
1175         always_inline.  Add assembly for powerpc to avoid GOT.
1176
1177 2013-03-07  Alan Modra  <amodra@gmail.com>
1178
1179         * testsuite/script_test_10.sh: Don't test .bss section
1180         header number.
1181
1182 2013-03-06  Alan Modra  <amodra@gmail.com>
1183
1184         * powerpc.cc (class Powerpc_relobj): Move some member functions.
1185         (Target_powerpc::symval_for_branch):  Add symtab param.  Update
1186         all callers.  Handle folded sections.
1187         (Target_powerpc::do_gc_add_reference): Don't cast dynamic object
1188         to Powerpc_relobj.
1189         (Global_symbol_visitor_opd::operator()): Likewise.
1190
1191 2013-03-04  Alan Modra  <amodra@gmail.com>
1192
1193         * testsuite/Makefile.am (final_layout_script.lds): Add .sbss.
1194         * testsuite/Makefile.in: Regenerate.
1195
1196 2013-03-01  Cary Coutant  <ccoutant@google.com>
1197
1198         Add dwp support for v2 DWARF package file format.
1199         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
1200         tu_length parameter.  Adjust all callers.
1201         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
1202         * dwp.cc: Include dwarf.h.
1203         (Section_bounds): New struct type.
1204         (Unit_set): New struct type.
1205         (Dwo_file::Dwo_file): Initialize new data member.
1206         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
1207         Combine and rename to...
1208         (Dwo_file::read_unit_index): ...this.
1209         (Dwo_file::sized_read_compunit_index)
1210         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
1211         (Dwo_file::sized_read_unit_index): ...this.
1212         (Dwo_file::copy_section): Remove section_name, is_str_offsets
1213         parameters; add section_id parameter.
1214         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
1215         (Dwo_file::add_unit_set): ...this.
1216         (Dwo_file::shndx_map_): Remove.
1217         (Dwo_file::sect_offsets_): New data member.
1218         (Dwp_output_file::Dwp_output_file): Initialize new data members.
1219         (Dwp_output_file::add_section): Rename to...
1220         (Dwp_output_file::add_contribution): ...this.
1221         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
1222         (Dwp_output_file::add_tu_set): Likewise.
1223         (Dwp_output_file::Contribution): New type.
1224         (Dwp_output_file::Section::contributions): New data member.
1225         (Dwp_output_file::Cu_or_tu_set): Remove.
1226         (Dwp_output_file::Section::Section): New ctor.
1227         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
1228         (Dwp_output_file::Dwp_index::Section_table): New type.
1229         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
1230         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
1231         parameter.
1232         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
1233         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
1234         (Dwp_output_file::Dwp_index::section_table): New member function.
1235         (Dwp_output_file::Dwp_index::section_table_end): New member function.
1236         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
1237         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
1238         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
1239         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
1240         (Dwp_output_file::Dwp_index::section_table_): New data member.
1241         (Dwp_output_file::Dwp_index::section_mask_): New data member.
1242         (Dwp_output_file::add_output_section): New member function.
1243         (Dwp_output_file::write_new_section): New member function.
1244         (Dwp_output_file::write_contributions): New member function.
1245         (Dwp_output_file::section_id_map_): New data member.
1246         (class Dwo_id_info_reader): Remove.
1247         (class Unit_reader): New class.
1248         (get_dwarf_section_name): New function.
1249         (Dwo_file::read_executable): Adjust initializations of class data.
1250         (Dwo_file::read): Add support for v2 package file format.
1251         (Dwo_file::read_unit_index): Likewise.
1252         (Dwo_file::sized_read_unit_index): Likewise.
1253         (Dwo_file::copy_section): Likewise.
1254         (Dwo_file::add_unit_set): Likewise.
1255         (Dwp_output_file::add_output_section): Likewise.
1256         (Dwp_output_file::add_contribution): Likewise.
1257         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
1258         for empty slot.
1259         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
1260         file format.
1261         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
1262         slot.
1263         (Dwp_output_file::initialize): Remove unused function.
1264         (Dwp_output_file::finalize): Add support for v2 package file format.
1265         (Dwp_output_file::write_index): Likewise.
1266         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
1267         function prototype.
1268
1269 2013-03-01  Cary Coutant  <ccoutant@google.com>
1270
1271         * dwarf_reader.cc (Dwarf_info_reader::check_buffer): Move
1272         function into class definition in header file.
1273         (Dwarf_info_reader::warn_corrupt_debug_section): New function.
1274         * dwarf_reader.h (Dwarf_info_reader::warn_corrupt_debug_section):
1275         New function.
1276         (Dwarf_info_reader::check_buffer): Move here from .cc file.
1277
1278 2013-02-28  Alan Modra  <amodra@gmail.com>
1279
1280         * target.h (Target::plt_fde_location, do_plt_fde_location): Declare.
1281         * target.cc (Target::do_plt_fde_location): New function.
1282         * ehframe.h (class FDE): Add post_map field to u_.from_linker,
1283         accessor function, and constructor param.
1284         (struct Post_fde, Post_fdes): Declare.
1285         (Cie::write): Add post_fdes param.
1286         * ehframe.cc (Fde::write): Use plt_fde_location.
1287         (struct Post_fde): Define.
1288         (Cie::write): Stash FDEs added post merge mapping.
1289         (Eh_frame::add_ehframe_for_plt): Assert no new CIEs after mapping.
1290         Adjust Fde constructor call.  Bump final_data_size_ for post map FDEs.
1291         (Eh_frame::do_sized_write): Arrange to write post map FDES after
1292         other FDEs.
1293         * powerpc.cc (Target_powerpc::do_plt_fde_location): New function.
1294         (Target_powerpc::has_glink): New function.
1295         (Target_powerpc::do_relax): Add eh_frame info for stubs.
1296         (struct Eh_cie, eh_frame_cie, glink_eh_frame_fde_64,
1297         glink_eh_frame_fde_32, default_fde): New data.
1298         (Stub_table::eh_frame_added_): New var.
1299         (Stub_table::find_long_branch_entry, stub_address, stub_offset):
1300         Make const.
1301         (Stub_table::add_eh_frame): New function.
1302         (Output_data_glink::add_eh_frame): New function.
1303         (Target_powerpc::make_glink_section): Call add_eh_frame.
1304
1305 2013-02-15  Ian Lance Taylor  <iant@google.com>
1306
1307         * options.h (DEFINE_uint64_alias): Define.
1308         (class General_options): Add -Ttext-segment as an alias for
1309         -Ttext.
1310
1311 2013-02-15  Alan Modra  <amodra@gmail.com>
1312
1313         * powerpc.cc (Stub_table::plt_off): New function, extracted from..
1314         (Stub_table::do_write): ..here, two places.
1315         (Stub_table::plt_call_size): Use it here too.
1316
1317 2013-02-11  Ian Lance Taylor  <iant@google.com>
1318
1319         * descriptors.cc (Descriptors::close_all): New function.
1320         * descriptors.h (class Descriptors): Declare close_all.
1321         (close_all_descriptors): New inline function.
1322         * plugin.cc: Include "descriptors.h".
1323         (Plugin_manager::cleanup): Call close_all_descriptors.
1324
1325 2013-02-06  Alan Modra  <amodra@gmail.com>
1326
1327         * README: Update coding style link.
1328
1329 2013-01-28  Cary Coutant  <ccoutant@google.com>
1330
1331         * dwp.cc (File_list): New typedef.
1332         (Dwo_name_info_reader): New class.
1333         (Dwo_id_info_reader::Dwo_id_info_reader): Remove unused parameters.
1334         (Dwo_id_info_reader::visit_top_die): Remove unused member function.
1335         (Dwo_file::~Dwo_file): Delete input_file_ after obj_.
1336         (Dwo_file::read_executable): New function.
1337         (Dwo_file::read): Move common setup code to ...
1338         (Dwo_file::make_object): ... here.
1339         (dwp_options): Add --exec/-e.
1340         (usage): Likewise.
1341         (main): Likewise.
1342
1343 2013-01-24  Sriraman Tallam  <tmsriram@google.com>
1344
1345         * layout.cc (Layout::layout): Check for option text_reorder.
1346         (Layout::make_output_section): Ditto.
1347         * options.h (text_reorder): New option.
1348         * output.cc (Input_section_sort_compare): Remove special ordering
1349         of section names.
1350         (Output_section::
1351          Input_section_sort_section_name_special_ordering_compare::
1352          operator()): New function.
1353         (Output_section::sort_attached_input_sections): Use new sort function
1354         for .text.
1355         * output.h (Input_section_sort_section_name_special_ordering_compare):
1356         New struct.
1357         * testsuite/Makefile.am (text_section_grouping): Test option
1358         --no-text-reorder
1359         * testsuite/Makefile.in: Regenerate.
1360         * testsuite/text_section_grouping.sh: Check order of functions without
1361         default text reordering.
1362
1363 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
1364
1365         * options.h (General_options): Change default to true for new_dtags.
1366
1367 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
1368
1369         * layout.cc (Layout::finish_dynamic_section): Only add DT_RPATH
1370         when enable_new_dtags is false.  Only add DT_RUNPATH when
1371         enable_new_dtags is true.
1372
1373 2013-01-17  Serge Pavlov  <serge.v.pavlov@gmail.com>
1374
1375         * powerpc.cc (Stub_table::find_plt_call_entry): Make types
1376         used in declaration and definition consistent.
1377         (Target_powerpc::symval_for_branch): Ditto.
1378
1379 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
1380
1381         * testsuite/plugin_final_layout.cc: Fix comment.
1382
1383 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
1384
1385         * layout.cc (Layout::layout): Do not do default sorting for
1386         text sections when section ordering is specified.
1387         (make_output_section): Ditto.
1388         * testsuite/plugin_final_layout.cc: Name the function sections
1389         to catch reordering issues.
1390
1391 2013-01-15  Alan Modra  <amodra@gmail.com>
1392
1393         * powerpc.cc (Target_powerpc::do_relax): Default shared libs to
1394         plt-thread-safe.
1395
1396 2013-01-15  Alan Modra  <amodra@gmail.com>
1397
1398         * testsuite/Makefile.am (final_layout_script.lds): Handle .got section.
1399         * testsuite/Makefile.in: Regenerate.
1400
1401 2013-01-14  Alan Modra  <amodra@gmail.com>
1402
1403         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add various output files.
1404         * testsuite/Makefile.in: Regenerate.
1405
1406 2013-01-11  Pavel Chupin  <pavel.v.chupin@intel.com>
1407
1408         PR bfd/14430
1409         Fix mingw gold build with plugins enabled
1410         * Makefile.am: Replace -ldl with @DLOPEN_LIBS@.
1411         * configure.ac: Export DLOPEN_LIBS and add headers check.
1412         * plugin.cc: Handle non-dlfcn case.
1413         * Makefile.in: Regenerate.
1414         * config.in: Regenerate.
1415         * configure: Regenerate.
1416         * testsuite/Makefile.in: Regenerate.
1417
1418 2013-01-09  Sriraman Tallam  <tmsriram@google.com>
1419
1420         * output.h (sort_attached_input_sections): Change to be public.
1421         * script-sections.cc
1422         (Output_section_definition::set_section_addresses): Sort
1423         attached input sections according to section order before linker
1424         script assigns section addresses.
1425         (Orphan_output_section::set_section_addresses): Sort
1426         attached input sections according to section order before linker
1427         script assigns section addresses.
1428         * Makefile.am (final_layout.sh): Use a simple linker script to
1429         check if section ordering still works.
1430         * Makefile.in: Regenerate.
1431
1432 2013-01-09  Ben Cheng  <bccheng@google.com>
1433
1434         * arm.cc (Target_arm::attributes_accept_div): New function.
1435         (Target_arm::attributes_forbid_div): New function.
1436         (Target_arm::merge_object_attributes): Merge the Tag_DIV_use
1437         attribute using the same new functions as what bfd/elf32_arm.c
1438         does.
1439
1440 2013-01-07  Cary Coutant  <ccoutant@google.com>
1441
1442         PR gold/14993
1443         * output.cc (Output_section::add_input_section): For incremental
1444         updates, don't track input sections that are allocated from patch
1445         space.
1446
1447 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
1448             Ian Lance Taylor  <iant@google.com>
1449
1450         PR gold/14897
1451         * configure.ac (--enable-ld): Removed.
1452         (install_as_default): Set to yes only for --enable-gold=default
1453         or --disable-ld.
1454         * configure: Regenerated.
1455
1456 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
1457
1458         * options.h (General_options): Add -fuse-ld= for GCC linker
1459         option compatibility.
1460
1461 2013-01-04  Cary Coutant  <ccoutant@google.com>
1462
1463         * configure.ac: Fix typo restoring CXXFLAGS.
1464         * configure: Regenerate.
1465
1466 2013-01-04  Cary Coutant  <ccoutant@google.com>
1467
1468         * testsuite/Makefile.am (CXXLINK_S): New macro.
1469         (debug_msg_so.err, debug_msg_ndebug.err): Use CXXLINK_S.
1470         * testsuite/Makefile.in: Regenerate.
1471
1472 2013-01-02  H.J. Lu  <hongjiu.lu@intel.com>
1473
1474         * version.cc (print_version): Update copyright year to 2013.
1475
1476 2012-12-20  Ian Lance Taylor  <iant@google.com>
1477
1478         * layout.cc (Layout::special_ordering_of_input_section): New
1479         function.
1480         (Layout::layout): If input section requires special ordering, must
1481         sort input sections.
1482         (Layout::make_output_section): May sort .text input sections.
1483         (Layout::is_section_name_prefix_grouped): Remove.
1484         * layout.h (class Layout): Declare
1485         special_ordering_of_input_section.  Don't declare
1486         is_section_name_prefix_grouped.
1487         * output.cc (Output_section::add_input_section): Revert last
1488         change.
1489         (Output_section::Input_section_sort::match_file_name): Don't crash
1490         if called on output section data.
1491         (Output_section::Input_section_sort_compare): Sort based on
1492         special ordering.
1493         (Output_section::Input_section_sort_section_order_index_compare):
1494         Revert last patch.
1495         (Output_section::sort_attached_input_sections): Likewise.
1496
1497 2012-12-18  Sriraman Tallam  <tmsriram@google.com>
1498
1499         * layout.cc (Layout::is_section_name_prefix_grouped): New function.
1500         * layout.h (Layout::is_section_name_prefix_grouped): New function.
1501         * output.cc (Output_section::add_input_section): Check if section
1502         name contains special prefix.  Keep input sections to sort such
1503         sections.
1504         (Output_section::Input_section_sort_section_order_index_compare
1505          ::operator()): Group sections according to prefixes.
1506         (Output_section::sort_attached_input_sections): Add condition to
1507         Input_section_entry constructor call.
1508         * testsuite/Makefile.am (text_section_grouping): New test.
1509         * testsuite/Makefile.in: Regenerate.
1510         * testsuite/text_section_grouping.cc: New file.
1511         * testsuite/text_section_grouping.sh: New file.
1512
1513 2012-12-17  Nick Clifton  <nickc@redhat.com>
1514
1515         * Makefile.am: Add copyright notice.
1516         * NEWS: Likewise.
1517         * README: Likewise.
1518         * configure.ac: Likewise.
1519         * ftruncate.c: Likewise.
1520         * Makefile.in: Regenerate.
1521
1522 2012-12-14  Cary Coutant  <ccoutant@google.com>
1523
1524         * testsuite/Makefile.am (exception_separate_shared_12_test): Add
1525         --no-as-needed flag.
1526         (exception_separate_shared_12_test): Likewise.
1527         (incremental_copy_test): Likewise.
1528         * testsuite/Makefile.in: Regenerate.
1529
1530 2012-12-14  Cary Coutant  <ccoutant@google.com>
1531
1532         * dwp.cc (Dwp_output_file::add_cu_set): Check for duplicate CUs.
1533         (Dwp_output_file::Dwp_index::enter_set): Add assert.
1534
1535 2012-12-12  Alan Modra  <amodra@gmail.com>
1536
1537         * powerpc.cc (class Track_tls): New.
1538         (class Relocate, class Scan): Inherit Track_tls.
1539         (Target_powerpc::Scan::local, global): Track tls optimization
1540         and avoid creating plt entry for __tls_get_addr if all uses
1541         are optimized away.
1542         (Target_powerpc::Relocate::relocate): Update to use Track_tls.
1543
1544 2012-12-12  Alan Modra  <amodra@gmail.com>
1545
1546         * options.h (General_options): Add --toc-sort/--no-toc-sort.
1547         Replace no_toc_optimize with toc_optimize.
1548         * output.h (Output_section::input_sections): Provide non-const variant.
1549         * powerpc.cc (Powerpc_relobj::has_small_toc_reloc_,
1550         set_has_small_toc_reloc, has_small_toc_reloc): New variable and
1551         accessors.
1552         (Target_powerpc::Scan::local, global): Call set_has_small_toc_reloc.
1553         (class Sort_toc_sections): New.
1554         (Target_powerpc::do_finalize_sections): Sort toc sections.
1555         (Target_powerpc::Relocate::relocate): Update toc_optimize test.
1556
1557 2012-12-10  Roland McGrath  <mcgrathr@google.com>
1558
1559         * testsuite/binary_unittest.cc (read_all): New function.
1560         (Sized_binary_test): Use it instead of ::read.
1561         * fileread.cc (do_read): Don't assume pread always reads the whole
1562         amount in a single call.
1563
1564 2012-12-10  Alan Modra  <amodra@gmail.com>
1565
1566         * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
1567         Set EM_PPC64 or EM_PPC here.
1568         (Target_selector_powerpc::do_recognize): Delete.
1569
1570 2012-12-10  Alan Modra  <amodra@gmail.com>
1571
1572         * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
1573         stub_table_.
1574         (Target_powerpc::Branch_info::make_stub): Don't omit addend.
1575
1576 2012-12-07  Roland McGrath  <mcgrathr@google.com>
1577
1578         * testsuite/binary_unittest.cc (Sized_binary_test):
1579         Use open_descriptor rather than ::open.
1580
1581 2012-12-07  Alan Modra  <amodra@gmail.com>
1582
1583         * powerpc.cc (Stub_table::do_write): Delete redundant Address
1584         typedef and invalid_address constant.
1585         (Output_data_glink, Stub_table, Target_powerpc): Explicitly
1586         instantiate constants.
1587
1588 2012-12-06  Roland McGrath  <mcgrathr@google.com>
1589
1590         * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
1591         Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
1592         * aclocal.m4: Regenerate.
1593         * configure: Regenerate.
1594         * Makefile.in: Regenerate.
1595         * testsuite/Makefile.in: Regenerate.
1596
1597 2012-12-07  Alan Modra  <amodra@gmail.com>
1598
1599         * options.h (General_options): Add no_toc_optimize.
1600         * powerpc.cc (ok_lo_toc_insn): New function.
1601         (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
1602
1603 2012-12-06  Alan Modra  <amodra@gmail.com>
1604
1605         * options.h (General_options): Add plt_align, plt_static_chain,
1606         plt_thread_safe.  Update stub_group_size help text.
1607         * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
1608         for new plt_thread_safe_ var.
1609         (use_plt_offset): Correct comments.
1610         (Target_powerpc::do_relax): Look for thread creation symbols to
1611         determine default plt_thread_safe value.  Clear plt call stubs
1612         as well as branch stubs each iteration.
1613         (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
1614         insn constants.
1615         (l, hi, ha, write_insn): Move earlier.
1616         (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
1617         (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
1618         plt stubs too.
1619         (Stub_table::update_size): Adjust.
1620         (Stub_table::prev_size, set_prev_size): Delete.
1621         (Stub_table::stub_align): Let --plt-align affect result.
1622         (Stub_table::plt_call_size): Calculate sizes for various stubs.
1623         (Stub_table::branch_stub_size): Use last_plt_size in address calc.
1624         (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
1625         (Stub_table::do_write): Support more stub variants.
1626
1627 2012-12-04  Alan Modra  <amodra@gmail.com>
1628
1629         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
1630         (Target_powerpc::do_define_standard_symbols): New function.
1631
1632 2012-12-03  Alan Modra  <amodra@gmail.com>
1633
1634         * output.h: Formatting, whitespace.
1635
1636 2012-12-03  Alan Modra  <amodra@gmail.com>
1637
1638         * layout.h (Layout::get_executable_sections): Declare.
1639         * layout.cc (Layout::get_executable_sections): New function.
1640         * arm.cc (Target_arm::group_sections): Use it.
1641         (Arm_output_section::group_sections): Delete now redundant test.
1642         * output.cc (Output_reloc::Output_reloc): Add is_relative.
1643         param to handle relative relocs.
1644         * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
1645         (Output_data_reloc::add_absolute): Adjust.
1646         (Output_data_reloc::add_relative): New function.
1647         (Output_data::reset_data_size): New function.
1648         (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
1649         (Output_section::set_addralign): New function.
1650         (Output_section::checkpoint_set_addralign): New function.
1651         (Output_section::clear_section_offsets_need_adjustment): New function.
1652         (Output_section::input_sections): Make public.
1653         * powerpc.cc (class Output_data_brlt_powerpc): New.
1654         (class Stub_table, class Stub_control): New.
1655         (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
1656         stub_table_, set_stub_table, stub_table): New vectors and accessor
1657         functions.
1658         (Target_powerpc::do_may_relax, do_relax, push_branch,
1659         new_stub_table, stub_tables, brlt_section, group_sections,
1660         add_branch_lookup_table, find_branch_lookup_table,
1661         write_branch_lookup_table, make_brlt_section): New functions.
1662         (Target_powerpc::struct Sort_sections, class Branch_info): New.
1663         (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
1664         branch_info_): New vars.
1665         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
1666         make call stubs here.
1667         (Output_data_glink): Remove all call stub handling from this class.
1668         (Target_powerpc::Scan::local, global): Save interesting branch
1669         relocs and relocs for ifunc.  Adjust calls to plt entry functions.
1670         (Target_powerpc::do_finalize_sections): Only make reg save/restore
1671         functions on final link.
1672         (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
1673         Handle long branch destinations too.
1674         (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
1675         do_plt_address_for_local): Adjust lookup of plt call stubs.
1676
1677 2012-11-30  Alan Modra  <amodra@gmail.com>
1678
1679         * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
1680         relocs against protected symbols when building 32-bit shared libs.
1681
1682 2012-11-30  Alan Modra  <amodra@gmail.com>
1683
1684         * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
1685         param.  Call got_section() to make .got.  Update all callers
1686         and their callers and so on.
1687
1688 2012-11-30  Alan Modra  <amodra@gmail.com>
1689
1690         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
1691         _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
1692         (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
1693         value if it already exists.
1694
1695 2012-11-19  H.J. Lu  <hongjiu.lu@intel.com>
1696
1697         PR gold/14858
1698         * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
1699
1700 2012-11-14  Roland McGrath  <mcgrathr@google.com>
1701
1702         * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
1703         than bfc instruction for data sandboxing.
1704
1705 2012-11-08  Alan Modra  <amodra@gmail.com>
1706
1707         * po/POTFILES.in: Regenerate.
1708
1709 2012-11-05  Alan Modra  <amodra@gmail.com>
1710
1711         * configure.ac: Apply 2012-09-10 change to config.in here.
1712         * configure: Regenerate.
1713
1714 2012-11-05  Alan Modra  <amodra@gmail.com>
1715
1716         * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
1717         (struct Opd_ent): Use "Address" rather than "Offset".
1718         (Output_data_got_powerpc::got_base_offset): Return Valtype.
1719         (Target_powerpc::got_section): Make public.
1720         (Target_powerpc::scan_relocs): Move code setting symbols..
1721         (Powerpc_relobj::do_scan_relocs): ..to here, new function.
1722         Create _SDA_BASE_ only when referenced.
1723
1724 2012-11-02  Roland McGrath  <mcgrathr@google.com>
1725
1726         * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
1727         from last change.
1728
1729 2012-11-01  Roland McGrath  <mcgrathr@google.com>
1730
1731         * target.h (Sized_target::relocate_relocs): Use Elf_Off
1732         for offset_in_output_section parameter.
1733         (Sized_target::relocate_special_relocatable): Likewise.
1734         * arm.cc (Target_arm::relocate_relocs): Likewise.
1735         (Target_arm::relocate_special_relocatable): Likewise.
1736         * i386.cc (Target_i386::relocate_relocs): Likewise.
1737         * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
1738         * sparc.cc (Target_sparc::relocate_relocs): Likewise.
1739         * target-reloc.h (relocate_relocs): Likewise.
1740         * testsuite/testfile.cc (Target_test): Likewise.
1741         * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
1742         * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
1743
1744         * system.h: Move inclusion of <clocale> to after <libintl.h> in
1745         [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
1746
1747         * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
1748         parameter, which is unused in the [!F_SETFD] case.
1749
1750         * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
1751         SYMNDX to off_t before comparing it to this->data_size().
1752         * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
1753         * incremental.cc (Output_section_incremental_inputs::do_write):
1754         Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
1755
1756         * nacl.cc: Include "libiberty.h" for vasprintf declaration.
1757
1758 2012-10-30  Steve McIntyre  <steve.mcintyre@linaro.org>
1759
1760         * gold.cc (Target_arm::do_adjust_elf_header): Add the
1761         hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
1762         in EABI_VER5.
1763
1764 2012-10-29  Cary Coutant  <ccoutant@google.com>
1765
1766         * dwp.cc (usage): Add file and exit status parameters;
1767         add --help and --version options.
1768         (print_version): New function.
1769         (main): Add --help and --version options.
1770
1771 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1772
1773         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
1774         final_layout_sequence.txt.
1775         * testsuite/Makefile.in: Regenerated.
1776
1777 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1778
1779         * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
1780         COMPILE generated by automake.
1781         (LINK1): Likewise.
1782         (CXXCOMPILE1): Likewise.
1783         (CXXLINK1): Likewise.
1784         (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
1785         (LINK): Likewise.
1786         (CXXCOMPILE): Likewise.
1787         (CXXLINK): Likewise.
1788         * testsuite/Makefile.in: Regenerated.
1789
1790 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1791
1792         * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
1793         on bad fwrite return.
1794
1795 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1796
1797         * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
1798         on val.
1799
1800 2012-10-23  Cary Coutant  <ccoutant@google.com>
1801
1802         * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
1803         * testsuite/Makefile.in: Regenerate.
1804         * testsuite/dwp_test.h: New source file.
1805         * testsuite/dwp_test_1.cc: New source file.
1806         * testsuite/dwp_test_1.s: New source file.
1807         * testsuite/dwp_test_1.sh: New source file.
1808         * testsuite/dwp_test_1b.cc: New source file.
1809         * testsuite/dwp_test_1b.s: New source file.
1810         * testsuite/dwp_test_2.cc: New source file.
1811         * testsuite/dwp_test_2.s: New source file.
1812         * testsuite/dwp_test_2.sh: New source file.
1813         * testsuite/dwp_test_main.cc: New source file.
1814         * testsuite/dwp_test_main.s: New source file.
1815
1816 2012-10-23  Cary Coutant  <ccoutant@google.com>
1817
1818         * dwp.h: New header file.
1819         * dwp.cc: New source file.
1820         * gold.h: Move shared declarations to system.h.
1821         * system.h: New header file.
1822         * Makefile.am: Add dwp.
1823         * Makefile.in: Regenerate.
1824
1825 2012-10-23  Cary Coutant  <ccoutant@google.com>
1826
1827         * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
1828         Dwarf_info_reader::read_from_pointer.
1829         (Dwarf_pubnames_table::read_header): Likewise.
1830         (Dwarf_pubnames_table::next_name): Likewise.
1831         (Dwarf_die::read_attributes): Likewise.
1832         (Dwarf_die::skip_attributes): Likewise.
1833         (Dwarf_info_reader::read_from_pointer): New function template.
1834         * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
1835         (Dwarf_pubnames_table): Likewise.
1836         (Dwarf_info_reader::read_from_pointer): New function template.
1837         * gdb-index.cc (Gdb_index_info_reader): Adjust call to
1838         Dwarf_pubnames_table ctor.
1839
1840 2012-10-23  Cary Coutant  <ccoutant@google.com>
1841
1842         * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
1843         abbrev_shndx.
1844         * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
1845         abbrev_shndx_.
1846         (Dwarf_info_reader::set_abbrev_shndx): New method.
1847         (Dwarf_info_reader::abbrev_shndx_): New data member.
1848
1849 2012-10-23  Cary Coutant  <ccoutant@google.com>
1850
1851         * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
1852         from object, not parameters.
1853         (Dwarf_info_reader::parse): Likewise.
1854         * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
1855         (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
1856         (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
1857         methods.
1858
1859 2012-10-23  Cary Coutant  <ccoutant@google.com>
1860
1861         * fileread.cc (Input_file::Input_file): New constructor.
1862         * fileread.h (class Input_file): Add new constructor.
1863
1864 2012-10-18  Alan Modra  <amodra@gmail.com>
1865
1866         PR gold/14727
1867         * object.cc (Relobj::is_section_name_included): Also match
1868         .sdata personality section.
1869
1870 2012-10-18  Alan Modra  <amodra@gmail.com>
1871
1872         * target-reloc.h (class Default_comdat_behavior): New, package up..
1873         (get_comdat_behaviour): ..this.
1874         (relocate_section): Add Relocate_comdat_behavior template arg,
1875         adjust code to suit.
1876         * arm.cc (Target_arm::relocate_section): Adjust to suit.
1877         (Target_arm::scan_reloc_section): Likewise.
1878         * i386.cc (Target_i386::relocate_section): Likewise.
1879         * sparc.cc (Target_sparc::relocate_section): Likewise.
1880         * tilegx.cc (Target_tilegx::relocate_section): Likewise.
1881         * x86_64.cc (Target_x86_64::relocate_section): Likewise.
1882         * powerpc.cc (class Relocate_comdat_behavior): New.
1883         (Target_powerpc::relocate_section): Don't zap opd relocs.  Supply
1884         gold::relocate_section with new template arg.
1885
1886 2012-10-18  Alan Modra  <amodra@gmail.com>
1887
1888         * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
1889         dynamic relocs for GOT_TPREL got entries, without symbol if
1890         resolving locally.
1891         (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
1892         (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
1893         (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
1894
1895 2012-10-17  Alan Modra  <amodra@gmail.com>
1896
1897         PR gold/14726
1898         * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
1899
1900 2012-10-16  Sriraman Tallam  <tmsriram@google.com>
1901
1902         * layout.cc (Layout::include_section): Keep sections marked
1903         SHF_EXCLUDE when doing relocatable links.
1904
1905 2012-10-16  Alan Modra  <amodra@gmail.com>
1906
1907         * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
1908         (Target_powerpc::do_finalize_sections): Call it.
1909         (Output_data_save_res): New class and supporting functions.
1910         (Target_powerpc::symval_for_branch): Only look up .opd entry for
1911         normal symbols defined in object files.
1912
1913 2012-10-12  Alan Modra  <amodra@gmail.com>
1914
1915         * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
1916         (struct Opd_ent): Make "discard" a bit field.  Add "gc_mark".
1917         (Target_powerpc::do_gc_mark_symbol): Delay marking function code
1918         section if scan_opd_relocs not yet called.
1919         (Target_powerpc::gc_process_relocs): Call process_gc_mark.
1920
1921 2012-10-12  Alan Modra  <amodra@gmail.com>
1922
1923         * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
1924         add_local_ifunc_entry): Revert last change.
1925         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
1926
1927 2012-10-05  Alan Modra  <amodra@gmail.com>
1928
1929         * powerpc.cc (Target_powerpc::do_plt_address_for_local,
1930         do_plt_address_for_global): New functions.
1931         (Output_data_got_powerpc::do_write): Don't segfault when linking
1932         statically.
1933         (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
1934         add_local_ifunc_entry): Return true on adding entry..
1935         (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
1936         glink->add_entry call.  Remove unused symtab param.  Adjust calls.
1937         (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
1938         (Target_powerpc::make_iplt_section): Remove symtab param.  Don't
1939         set up symbols here.
1940         (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
1941         syms here.  Do so even when no .iplt.  Don't segfault when linking
1942         statically.
1943         (Output_data_glink::add_entry, find_entry): Rearrange params.  Add
1944         new variants without reloc param.
1945         (Glink_sym_ent::Glink_sym_ent): Likewise.
1946         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
1947         reloc when refs will resolve to plt call stub.
1948         (Target_powerpc::Scan::local): Correct ifunc handling.  Allow
1949         R_PPC_PLTREL24 to resolve locally.
1950         (Target_powerpc::Scan::global): Correct ifunc handling.
1951         (Target_powerpc::Relocate::relocate): Correct local sym glink
1952         lookup.  Don't destroy "value" when we have a plt call stub,
1953         and when checking plt call validity.
1954         (Target_powerpc::do_dynsym_value): Simplify.
1955
1956 2012-10-05  Alan Modra  <amodra@gmail.com>
1957
1958         * i386.cc (Output_data_plt_i386::address_for_global,
1959         address_for_local): Add plt offset to returned value.  Adjust uses.
1960         * sparc.cc (Output_data_plt_sparc::address_for_global,
1961         address_for_local): Likewise.
1962         * tilegx.cc (Output_data_plt_tilegx::address_for_global,
1963         address_for_local): Likewise.
1964         * x86_64.cc (Output_data_plt_x86_64::address_for_global,
1965         address_for_local): Likewise.
1966         * target.h (Target::plt_address_for_global, plt_address_for_local):
1967         Update comment.
1968         * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
1969         (Output_data_got::Got_entry::write): Nor here.
1970         * output.h: Comment fix.
1971
1972 2012-10-02  Jiong Wang  <jiwang@tilera.com>
1973
1974         * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
1975         global_offset_table_ value for larget got.
1976         (Target_tilegx::Relocate::relocate): Handle adjusted got value.
1977
1978 2012-09-29  Alan Modra  <amodra@gmail.com>
1979
1980         * powerpc.cc (Target_powerpc::iplt_): New output section.
1981         (Target_powerpc::iplt_section, make_iplt_section,
1982         reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
1983         (Target_powerpc::make_plt_entry): Handle ifunc syms.
1984         Target_powerpc::plt_entry_count): Count iplt entries too.
1985         (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
1986         reloc section in constructor.  New params.
1987         (Target_powerpc::make_plt_section): Create reloc section here instead.
1988         (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
1989         functions.
1990         (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
1991         (Output_data_glink::add_entry, find_entry): New functions to
1992         deal with local syms.
1993         (Glink_sym_ent): Add support for local syms.
1994         (Output_data_glink::do_write): Handle ifunc plt entries.
1995         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1996         (Target_powerpc::Scan::local, global): Handle ifunc syms.
1997         (Target_powerpc::Relocate::relocate): Likewise.
1998         (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
1999
2000 2012-09-25  Alan Modra  <amodra@gmail.com>
2001
2002         * object.h (Sized_relobj_file::adjust_local_symbol,
2003         do_adjust_local_symbol): New functions.
2004         * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
2005         * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
2006         (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
2007         and irregular opd entry spacing.
2008         (Powerpc_relobj::do_read_relocs): Add opd size checks.
2009         (Global_symbol_visitor_opd): New functor.
2010         (Target_powerpc::do_finalize_sections): Omit global symbols defined
2011         on deleted opd entries.
2012
2013 2012-09-15  Jiong Wang  <jiwang@tilera.com>
2014
2015         * tilegx.cc: New file.
2016         * Makefile.am (TARGETSOURCES): Add tilegx.cc
2017         (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
2018         * configure.tgt: Add entries for tilegx*.
2019         * configure.ac: Likewise.
2020         * Makefile.in: Rebuild.
2021         * configure: Likewise.
2022         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
2023         tilegx.
2024
2025 2012-09-13  Alan Modra  <amodra@gmail.com>
2026
2027         * target-reloc.h (scan_relocs): Call scan.local for relocs
2028         against symbols in discarded sections.  Pass is_discarded
2029         param.
2030         * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
2031         Add is_discarded param.
2032         * powerpc (Target_powerpc::Scan::local): Likewise.  Use
2033         is_discarded to flag opd entry as discarded.  Don't emit dyn
2034         relocs on such entries.
2035         (Target_powerpc::Scan::global): Similarly detect and handle
2036         such opd entries.
2037         (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
2038         opd_ent_.  Update all uses.
2039         (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
2040         (Target_powerpc::relocate_section): Zero out discarded opd
2041         entry relocs.
2042
2043 2012-09-12  Ian Lance Taylor  <iant@google.com>
2044
2045         PR gold/14570
2046         * output.cc: Rename Output_data_got template parameter from size
2047         to got_size for all functions.  Compile all variants of
2048         Output_data_got.
2049         (Output_data_got::Got_entry::write): Correct use of size for
2050         symbol value.  Use local_is_tls rather than casting to
2051         Sized_relobj_file.
2052         * object.h (class Object): Add local_is_tls and do_local_is_tls.
2053         (class Sized_relobj_file): Add do_local_is_tls.
2054         * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
2055
2056 2012-09-11  Alan Modra  <amodra@gmail.com>
2057
2058         PR gold/14566
2059         * layout.cc (Layout::set_segment_offsets): When using
2060         common-page-size alignment, ensure we are on a new max-page-size
2061         page.
2062         * output.cc (Output_segment::set_section_addresses): Use
2063         abi_pagesize, not common_pagesize for relro boundary.
2064         (Output_segment::set_offset): Likewise.
2065
2066 2012-09-11  Alan Modra  <amodra@gmail.com>
2067
2068         * output.h (Output_data_got::add_global_tls, add_local_tls,
2069         add_local_tls_pair): New functions.
2070         (Output_data_got::add_local_pair_with_rel): Remove second
2071         reloc param.  Expand comment.
2072         (Output_data_got::Got_entry): Rename use_plt_offset_ to
2073         use_plt_or_tls_offset_, similarly for constructor param.
2074         (Output_data_got::Got_entry::write): Add got_index param.
2075         * output.cc (Output_data_got::add_global_tls, add_local_tls,
2076         add_local_tls_pair): New functions.
2077         (Output_data_got::Got_entry::write): Handle tls symbols
2078         with use_plt_or_tls_offset_ set specially.
2079         (Output_data_got::add_local_pair_with_rel): Only one reloc.
2080         (Output_data_got::do_write): Replace iterator with index, pass
2081         index to entry write function.
2082         * target.h (Target::tls_offset_for_local, tls_offset_for_global,
2083         do_tls_offset_for_local, do_tls_offset_for_global): New functions.
2084         * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
2085         call.
2086         * i386.cc (Target_i386::Scan::local): Likewise.
2087         * sparc.cc (Target_sparc::Scan::local): Likewise.
2088         * x86_64.cc (Target_x86_64::Scan::local): Likewise.
2089         * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
2090         do_tls_offset_for_global): New functions.
2091         (Target_powerpc::Scan::local): Correct TLS relocations and got
2092         entry values.
2093         (Target_powerpc::Scan::global): Don't emit unnecessary
2094         dynamic relocations on TLS GOT entries.
2095
2096 2012-09-10  Matthias Klose  <doko@ubuntu.com>
2097
2098         * config.in: Disable sanity check for kfreebsd.
2099
2100 2012-09-10  Sterling Augustine  <saugustine@google.com>
2101
2102         * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
2103         (Gdb_index::pubtypes_read): New parameter.
2104         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
2105         to calls.
2106         * gdb-index.h (Gdb_index): New fields pubnames_object_ and
2107         pubtypes_object_.
2108
2109 2012-09-09  Alan Modra  <amodra@gmail.com>
2110
2111         * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
2112         (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
2113         * gc.h (gc_process_relocs): Call target gc_add_reference.
2114         * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
2115         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
2116         (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
2117         unnecessary cast.
2118         * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
2119         to cater for when we don't need code offset.  Update use.
2120         (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
2121         (Powerpc_relobj::access_from_map, add_reference, opd_valid,
2122         set_opd_valid): New functions.
2123         (Target_powerpc::do_gc_add_reference): New function.
2124         (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
2125         stashed refs.
2126         (Target_powerpc::do_gc_mark_symbol): New function.
2127
2128 2012-09-06  Cary Coutant  <ccoutant@google.com>
2129
2130         * dwarf_reader.cc (Dwarf_die::read_attributes): Add
2131         DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
2132         (Dwarf_die::skip_attributes): Likewise.
2133         * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
2134         * testsuite/gdb_index_test.cc (inline_func_1): New function.
2135         (main): Call it.
2136         * testsuite/gdb_index_test_comm.sh: Check index for inline function.
2137
2138 2012-09-05  H.J. Lu  <hongjiu.lu@intel.com>
2139
2140         * testsuite/script_test_3.t: Add .got.plt output section
2141         statement.
2142         * testsuite/script_test_4.t: Likewise.
2143
2144 2012-09-05  Alan Modra  <amodra@gmail.com>
2145
2146         * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
2147         update all uses and lose "enum" when using type.
2148
2149 2012-09-05  Alan Modra  <amodra@gmail.com>
2150
2151         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
2152         * configure: Regenerate.
2153         * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
2154         (plugin_final_layout.stdout): Likewise.
2155         (memory_test): Set page sizes to 0x1000.
2156         * testsuite/Makefile.in: Regenerate.
2157         * testsuite/discard_locals_test.sh: Add FIXME comment.
2158         * testsuite/justsyms_exec.c: Disable function test for powerpc64.
2159         * testsuite/pr14265.t: Add .got output section statement.
2160         * testsuite/script_test_2.t: Likewise.
2161         * testsuite/script_test_3.t: Likewise.
2162         * testsuite/script_test_4.t: Likewise.
2163         * testsuite/script_test_5.t: Likewise.
2164         * testsuite/script_test_6.t: Likewise.
2165         * testsuite/script_test_7.t: Likewise.
2166         * testsuite/script_test_9.t: Likewise.
2167
2168 2012-09-05  Alan Modra  <amodra@gmail.com>
2169
2170         * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
2171         (Powerpc_relocate_functions::Status): New typedef.
2172         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
2173         (Target_powerpc::Scan::local): Handle REL64.
2174         (Target_powerpc::Scan::global): Likewise, and dynamic relocs
2175         for REL32 and REL64.
2176         (Target_powerpc::symval_for_branch): New function, extracted from..
2177         (Target_powerpc::Relocate::relocate): ..here.  Correct plt call
2178         checks.  Report overflow errors.
2179
2180 2012-09-05  Alan Modra  <amodra@gmail.com>
2181
2182         * object.h (Sized_relobj_file::emit_relocs): Delete.
2183         (Sized_relobj_file::emit_relocs_reltype): Delete.
2184         * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
2185         relocate_relocs for --emit-relocs.
2186         (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
2187         * output.h: Update comment.
2188         (Output_segment::first_section): New function.
2189         (Output_segment::first_section_load_address): Use first_section.
2190         * output.cc (Output_segment::first_section): New function extracted..
2191         (Output_segment::first_section_load_address): ..from here.  Delete.
2192         * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
2193         * target.h (Sized_target::relocate_for_relocatable): Likewise.
2194         * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
2195         adjust call to target.h function.
2196         * i386.cc (Target_i386): Likewise.
2197         * sparc.cc (Target_sparc): Likewise.
2198         * x86_64.cc (Target_x86_64): Likewise.
2199         * powerpc.cc (Target_powerpc): Likewise.
2200         (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS.  Ensure
2201         first tls section has section symbol for optimised local dynamic
2202         output relocs.
2203         (Target_powerpc::Relocate::relocate): Correct local dynamic value.
2204         (Target_powerpc::relocate_relocs): Adjust relocs emitted for
2205         optimised tls code.
2206         * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
2207         Rename to relocate_relocs.  Update error message.
2208
2209 2012-09-04  Andreas Schwab  <schwab@linux-m68k.org>
2210
2211         * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
2212         --just-symbols.
2213
2214 2012-08-31  Alan Modra  <amodra@gmail.com>
2215
2216         * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
2217         (Powerpc_relobj::toc_base_offset): New stub function.
2218         (Target_powerpc): Add tp_offset, dtp_offset.  Rename
2219         got_mod_index_offset to tlsld_got_offset.  Update all refs.
2220         (Target_powerpc::Relocate::enum skip_tls): New.
2221         (Target_powerpc::call_tls_get_addr_): New var.
2222         (Target_powerpc::is_branch_reloc): Move to file scope.
2223         (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
2224         (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
2225         New functions.
2226         (Target_powerpc::enum Got_type): Delete old values, add new ones.
2227         (powerpc_info): Correct common_pagesize for ppc64.
2228         (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
2229         (Powerpc_relocate_functions): Add overflow check enums and functions.
2230         Add non-shift version of rela, rela_ua.  Delete all rel public
2231         functions.  Delete addr16_lo.  Add addr64, addr64_u, addr32,
2232         addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
2233         addr16_ha3, addr14 functions.
2234         (Output_data_got_powerpc::add_constant_pair): New function.
2235         (Output_data_got_powerpc::got_base_offset): Likewise.
2236         (Output_data_got_powerpc::do_write): Correct 64-bit got header.
2237         (instruction constants): Sort, add some more.
2238         (Output_data_glink::do_write): Add and use Address typedef.  Use
2239         object->toc_base_offset() stub for 64-bit.
2240         (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
2241         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
2242         (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
2243         for R_PPC64_TOC.  Handle more relocs.  Generate got entries for TLS.
2244         Always treat .opd relocs as against locally defined symbol.
2245         Correct condition for RELATIVE relocs.
2246         (Target_powerpc::do_finalize_sections): Test for NULL sections.
2247         (Target_powerpc::Relocate::relocate): Use plt call stub as value
2248         for 32-bit syms with a plt entry.  Correct ppc64 toc base
2249         calculations.  Handle TLS relocs, and more.  Add overflow
2250         checking and adjust for Powerpc_relocate_functions changes.
2251         (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
2252         Reinstate --emit-relocs code with FIXME.
2253
2254 2012-08-30  Alan Modra  <amodra@gmail.com>
2255
2256         * layout.cc (Layout::set_segment_offsets): Set p_align to
2257         abi_pagesize, not common_pagesize.
2258         (Layout::relaxation_loop_body): Similarly use abi_pagesize
2259         to determine whether file header can go in segment.
2260
2261 2012-08-30  Alan Modra  <amodra@gmail.com>
2262
2263         * output.h (Output_reloc::Output_reloc <output section>): Add
2264         is_relative param.  Adjust calls.
2265         (Output_reloc::add_output_section_relative): New functions.
2266         * output.cc (Output_reloc::Output_reloc <output section>): Handle
2267         is_relative.
2268         (Output_reloc::symbol_value): Handle SECTION_CODE.
2269
2270 2012-08-24  Sriraman Tallam  <tmsriram@google.com>
2271
2272         * gold.cc (queue_middle_tasks): Call layout again when unique
2273         segments for sections is desired.
2274         * layout.cc (Layout::Layout): Initialize new members.
2275         (Layout::get_output_section_flags): New function.
2276         (Layout::choose_output_section): Call get_output_section_flags.
2277         (Layout::layout): Make output section for mapping to a unique segment.
2278         (Layout::insert_section_segment_map): New function.
2279         (Layout::attach_allocated_section_to_segment): Make unique segment for
2280         output sections marked so.
2281         (Layout::segment_precedes): Check for unique segments when sorting.
2282         * layout.h (Layout::Unique_segment_info): New struct.
2283         (Layout::Section_segment_map): New typedef.
2284         (Layout::insert_section_segment_map): New function.
2285         (Layout::get_output_section_flags): New function.
2286         (Layout::is_unique_segment_for_sections_specified): New function.
2287         (Layout::set_unique_segment_for_sections_specified): New function.
2288         (Layout::unique_segment_for_sections_specified_): New member.
2289         (Layout::section_segment_map_): New member.
2290         * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
2291         Rename is_gc_pass_one to is_pass_one.
2292         Rename is_gc_pass_two to is_pass_two.
2293         Rename is_gc_or_icf to is_two_pass.
2294         Check for which pass based on whether symbols data is present.
2295         Make it two pass when unique segments for sections is desired.
2296         * output.cc (Output_section::Output_section): Initialize new
2297         members.
2298         * output.h (Output_section::is_unique_segment): New function.
2299         (Output_section::set_is_unique_segment): New function.
2300         (Output_section::is_unique_segment_): New member.
2301         (Output_section::extra_segment_flags): New function.
2302         (Output_section::set_extra_segment_flags): New function.
2303         (Output_section::extra_segment_flags_): New member.
2304         (Output_section::segment_alignment): New function.
2305         (Output_section::set_segment_alignment): New function.
2306         (Output_section::segment_alignment_): New member.
2307         (Output_segment::Output_segment): Initialize is_unique_segment_.
2308         (Output_segment::is_unique_segment): New function.
2309         (Output_segment::set_is_unique_segment): New function.
2310         (Output_segment::is_unique_segment_): New member.
2311         * plugin.cc (allow_unique_segment_for_sections): New function.
2312         (unique_segment_for_sections): New function.
2313         (Plugin::load): Add new functions to transfer vector.
2314         * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
2315         * Makefile.in: Regenerate.
2316         * testsuite/plugin_final_layout.sh: Check if unique segment
2317         functionality works.
2318         * testsuite/plugin_section_order.c (onload): Check if new interfaces
2319         are available.
2320         (allow_unique_segment_for_sections): New global.
2321         (unique_segment_for_sections): New global.
2322         (claim_file_hook): Call allow_unique_segment_for_sections.
2323         (all_symbols_read_hook): Call unique_segment_for_sections.
2324
2325 2012-08-22  Cary Coutant  <ccoutant@google.com>
2326
2327         * layout.cc (Layout::include_section): Don't assert on GROUP
2328         sections with --emit-relocs.
2329
2330 2012-08-21  Cary Coutant  <ccoutant@google.com>
2331
2332         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
2333         if --export-dynamic-symbol names an undef symbol.
2334
2335 2012-08-18  Alan Modra  <amodra@gmail.com>
2336
2337         * powerpc.cc: Formatting and white space.
2338         (Powerpc_relobj): Rename got2_section_ to special_.
2339         Add opd_ent_shndx_ and opd_ent_off_ vectors.
2340         (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
2341         scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
2342         (Target_powerpc): Add Address typedef and invalid_address.  Use
2343         throughout.
2344         (Target_powerpc::is_branch_reloc): New function.
2345         (Powerpc_relocate_functions): Add Address typedef, use throughout.
2346         (Powerpc_relocate_functions:rela, rela_ua): Correct type used
2347         for dst_mask, value and addend.
2348         (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
2349         (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
2350         (Output_data_glink::do_write): Correct toc base.  Don't try to use
2351         uint16_t for 24-bit offset.  Use get_output_section_offset and
2352         check return.
2353         (Target_powerpc::Scan::local): Handle more relocs.
2354         (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
2355         (Target_powerpc::Relocate::relocate): Correct toc base calculation.
2356         Plug in toc restoring insn after plt calls.  Translate branches
2357         to function descriptor symbols to corresponding entry point.
2358         (Target_powerpc::relocate_for_relocatable): Check return from
2359         get_output_section_offset.
2360         * symtab.h: Comment typo.
2361
2362 2012-08-14  Ian Lance Taylor  <iant@google.com>
2363
2364         * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
2365         unsupported_relocal_local to call unsupported_reloc_global.
2366
2367 2012-08-14  Nick Clifton  <nickc@redhat.com>
2368
2369         PR ld/14265
2370         * script-sections.cc (Sections_element::output_section_name): Add
2371         keep return parameter.
2372         (Output_section_element::match_name): Add keep return parameter.
2373         Return the value of the keep_ member.
2374         * script-sections.h (class Output_section): Update
2375         output_section_name prototype.
2376         * layout.cc (Layout::keep_input_section): New public member
2377         function.
2378         (Layout::choose_output_section): Pass keep parameter to
2379         output_section_name.
2380         * layout.h (class Layout): Add keep_input_section.
2381         * object.cc (Sized_relobj_file::do_layout): Check for kept input
2382         sections.
2383         * testsuite/Makefile.am: Add a test.
2384         * testsuite/Makefile.in: Regenerate.
2385         * testsuite/pr14265.c: Source file for the test.
2386         * testsuite/pr14265.t: Linker script for the test.
2387         * testsuite/pr14265.sh: Shell script for the test.
2388
2389 2012-08-14  Alan Modra  <amodra@gmail.com>
2390
2391         * target.h (Target::output_section_name): New function.
2392         (Target::do_output_section_name): New function.
2393         * layout.cc (Layout::choose_output_section): Call the above.
2394         * powerpc.cc (Target_powerpc::do_output_section_name): New function.
2395
2396 2012-08-14  Alan Modra  <amodra@gmail.com>
2397
2398         * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
2399         (Output_data_got_powerpc::do_write): Don't rely on base class lookup
2400         for replace_constant call.
2401         (Output_data_plt_powerpc::do_print_to_mapfile): New function.
2402         (Output_data_glink::do_print_to_mapfile): New function.
2403         (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
2404         (Target_powerpc::Relocate::relocate): Likewise.
2405
2406 2012-08-14  Alan Modra  <amodra@gmail.com>
2407
2408         * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
2409         (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
2410         (Output_data_glink::add_entry,find_entry): Remove shndx param.
2411         (class Glink_sym_ent): Rename from struct Glink_sym_ent.  Remove
2412         all references to shndx_.  Handle special case for R_PPC_PLTREL24
2413         here.
2414         (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
2415         (Output_data_glink::do_write): Retrieve got2_shdnx from object.
2416         (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
2417         here.
2418         (Target_powerpc::Scan::global): Nor on make_plt_entry call.
2419         (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
2420
2421 2012-08-12  Alan Modra  <amodra@gmail.com>
2422
2423         * powerpc.cc: Whitespace fixes.  Wrap overly long lines.
2424         (glink insn constants): Use uint32_t.
2425         (Output_data_glink::add_entry): Use insert, not [] operator.
2426
2427 2012-08-11  Alan Modra  <amodra@gmail.com>
2428
2429         * object.h (Sized_relobj_file::find_shdr): New function.
2430         (Sized_relobj_file::find_special_sections): New function.
2431         * object.cc (Sized_relobj_file::find_shdr): New function.
2432         (Sized_relobj_file::find_eh_frame): Use find_shdr.
2433         (Sized_relobj_file::find_special_sections): New function, split out..
2434         (Sized_relobj_file::do_read_symbols): ..from here.
2435         * output.h (Output_data_got::replace_constant): New function.
2436         (Output_data_got::num_entries): New function.
2437         (Output_data_got::last_got_offset,set_got_size): Use num_entries.
2438         (Output_data_got::got_offset): Protected rather than private.
2439         (Output_data_got::replace_got_entry): New function.
2440         * output.cc (Output_data_got::replace_got_entry): New function.
2441         * powerpc.cc (class Powerpc_relobj): New.
2442         (class Powerpc_relocate_functions): Delete all psymval variants or
2443         convert to value,addend type.  Delete pcrela, pcrela_unaligned.
2444         Implement _ha functions using corresponding _hi function.
2445         (Powerpc_relobj::find_special_sections): New function.
2446         (Target_powerpc::do_make_elf_object): New function.
2447         (class Output_data_got_powerpc): New.
2448         (class Output_data_glink): New.
2449         (class Powerpc_scan_relocatable_reloc): New.
2450         Many more changes througout file.
2451
2452 2012-08-09  Nick Clifton  <nickc@redhat.com>
2453
2454         * po/vi.po: Updated Vietnamese translation.
2455
2456 2012-08-07  Ian Lance Taylor  <iant@google.com>
2457
2458         * layout.cc (Layout::add_target_dynamic_tags): If
2459         dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
2460         plt_rel.
2461
2462 2012-07-30  Nick Clifton  <nickc@redhat.com>
2463
2464         * po/gold.pot: Updated template.
2465         * po/es.po: Updated Spanish translation.
2466
2467 2012-07-18  Cary Coutant  <ccoutant@google.com>
2468
2469         PR gold/14344
2470         * configure.ac: Add check for -gpubnames support.
2471         * configure: Regenerate.
2472         * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
2473         support; force -gno-pubnames.
2474         (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
2475         support.
2476         (gdb_index_test_4): New test.
2477         * testsuite/Makefile.in: Regenerate.
2478         * testsuite/gdb_index_test_1.sh: Refactor code into common file.
2479         * testsuite/gdb_index_test_2.sh: Likewise.
2480         * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
2481         * testsuite/gdb_index_test_4.sh: New script.
2482         * testsuite/gdb_index_test_comm.sh: New script with common code;
2483         don't look for space after colon.
2484
2485 2012-07-16  Sriraman Tallam  <tmsriram@google.com>
2486
2487         * gold.cc (queue_middle_tasks): Update function order only after
2488         deferred objects due to plugins are processed.
2489
2490 2012-07-11  Ian Lance Taylor  <iant@google.com>
2491
2492         * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
2493         (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
2494         (Target_arm::scan_reloc_for_stub): Likewise.
2495         * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
2496         * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
2497         * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
2498         * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
2499         * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
2500
2501 2012-07-10  Dodji Seketeli  <dodji@redhat.com>
2502             Ian Lance Taylor  <iant@google.com>
2503
2504         PR gold/14309
2505         * configure.ac: Test whether std::tr1::hash<off_t> works.
2506         * gold.h: Add a specialization for std::tr1::hash<off_t> if
2507         needed.
2508         * output.h (class Output_fill): Add virtual destructor.
2509         * configure, config.in: Rebuild.
2510
2511 2012-06-22  Roland McGrath  <mcgrathr@google.com>
2512
2513         * layout.cc (finalize): Define __ehdr_start symbol if applicable.
2514
2515 2012-06-12  Rafael Ávila de Espíndola <respindola@mozilla.com>
2516
2517         * plugin.cc (Plugin::load): Handle position independent executables.
2518
2519 2012-06-06  Cary Coutant  <ccoutant@google.com>
2520
2521         * layout.cc (gdb_sections): Remove ".debug_" prefixes,
2522         add .debug_macro.
2523         (lines_only_debug_sections): Likewise.
2524         (gdb_fast_lookup_sections): New static array.
2525         (is_gdb_debug_section): Rename formal parameter.
2526         (is_lines_only_debug_section): Likewise.
2527         (is_gdb_fast_lookup_section): New function.
2528         (Layout::include_section): Check for ".zdebug_" prefix; pass
2529         section name suffix to is_gdb_debug_section, et al.; check for
2530         fast-lookup sections when building .gdb_index.
2531         * options.h (--strip-debug-gdb): Update GDB version number.
2532
2533 2012-06-06  Cary Coutant  <ccoutant@google.com>
2534
2535         * configure.ac: Add check for fallocate.
2536         * configure: Regenerate.
2537         * config.in: Regenerate.
2538
2539         * options.h (class General_options): Add --mmap-output-file and
2540         --posix-fallocate options.
2541         * output.cc: (posix_fallocate): Remove; replace with...
2542         (gold_fallocate): New function.
2543         (Output_file::map_no_anonymous): Call gold_fallocate.
2544         (Output_file::map): Check --mmap-output-file option.
2545
2546 2012-06-05  Jing Yu  <jingyu@google.com>
2547
2548         * gold.h (textdomain): Add do {} to empty while(0).
2549         (bindtextdomain): Likewise.
2550
2551 2012-06-04  Cary Coutant  <ccoutant@google.com>
2552
2553         * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
2554         has_dynsym_index.
2555
2556 2012-05-25  Sriraman Tallam  <tmsriram@google.com>
2557
2558         * symtab.cc (Symbol_table::define_special_symbol):
2559         Initialize *poldsym to prevent uninitialized variable errors.
2560
2561 2012-05-23  Cary Coutant  <ccoutant@google.com>
2562
2563         * layout.cc (Layout::section_name_mapping): Add rules to handle
2564         exact match on .data.rel.ro.local or .data.rel.ro.
2565         (Layout::output_section_name): Check for exact matches.
2566
2567 2012-05-23  Cary Coutant  <ccoutant@google.com>
2568
2569         * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
2570         more carefully.
2571
2572 2012-05-22  Cary Coutant  <ccoutant@google.com>
2573
2574         * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
2575         object before exporting symbol.
2576
2577 2012-05-21  H.J. Lu  <hongjiu.lu@intel.com>
2578
2579         * testsuite/tls_test.cc: Include "config.h" first.
2580         * testsuite/tls_test_c.c: Likewise.
2581
2582 2012-05-17  Daniel Richard G.  <skunk@iskunk.org>
2583             Nick Clifton  <nickc@redhat.com>
2584
2585         PR 14072
2586         * configure.in: Add check that sysdep.h has been included before
2587         any system header files.
2588         * configure: Regenerate.
2589         * config.in: Regenerate.
2590
2591 2012-05-14  Cary Coutant  <ccoutant@google.com>
2592
2593         * layout.cc (Layout::make_output_section): Mark .tdata section
2594         as RELRO.
2595         * testsuite/relro_test.cc: Add a TLS variable.
2596
2597 2012-05-10  H.J. Lu  <hongjiu.lu@intel.com>
2598
2599         PR gold/14091
2600         * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
2601         R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
2602         R_X86_64_64.
2603
2604 2012-05-08  Cary Coutant  <ccoutant@google.com>
2605
2606         * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
2607         (lines_only_debug_sections): Likewise.
2608
2609 2012-05-02  Roland McGrath  <mcgrathr@google.com>
2610
2611         * nacl.cc: New file.
2612         * nacl.h: New file.
2613         * Makefile.am (CCFILES, HFILES): Add them.
2614         * Makefile.in: Regenerate.
2615         * i386.cc (Output_data_plt_i386_nacl): New class.
2616         (Output_data_plt_i386_nacl_exec): New class.
2617         (Output_data_plt_i386_nacl_dyn): New class.
2618         (Target_i386_nacl): New class.
2619         (Target_selector_i386_nacl): New class.
2620         (target_selector_i386): Use it instead of Target_selector_i386.
2621         * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
2622         (Target_x86_64_nacl): New class.
2623         (Target_selector_x86_64_nacl): New class.
2624         (target_selector_x86_64, target_selector_x32): Use it instead of
2625         Target_selector_x86_64.
2626         * arm.cc (Output_data_plt_arm_nacl): New class.
2627         (Target_arm_nacl): New class.
2628         (Target_selector_arm_nacl): New class.
2629         (target_selector_arm, target_selector_armbe): Use it instead of
2630         Target_selector_arm.
2631
2632         * target-select.cc (select_target): Take new Input_file* and off_t
2633         arguments, pass them on to recognize method of selector.
2634         * object.cc (make_elf_sized_object): Update caller.
2635         * parameters.cc (parameters_force_valid_target): Likewise.
2636         * incremental.cc (make_sized_incremental_binary): Likewise.
2637         * target-select.h: Update decl.
2638         (Target_selector::recognize): Take new Input_file* argument,
2639         pass it on to do_recognize.
2640         (Target_selector::do_recognize): Take new Input_file* argument.
2641         * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
2642         * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
2643         * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
2644         * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
2645
2646         * target.h (Target::Target_info): New members isolate_execinstr
2647         and rosegment_gap.
2648         (Target::isolate_execinstr, Target::rosegment_gap): New methods.
2649         * arm.cc (Target_arm::arm_info): Update initializer.
2650         * i386.cc (Target_i386::i386_info): Likewise.
2651         * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
2652         * sparc.cc (Target_sparc::sparc_info): Likewise.
2653         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
2654         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
2655         * layout.cc (Layout::attach_allocated_section_to_segment):
2656         Take new const Target* argument.  If target->isolate_execinstr(), act
2657         like --rosegment.
2658         (Layout::find_first_load_seg): Take new const Target* argument;
2659         if target->isolate_execinstr(), reject PF_X segments.
2660         (Layout::relaxation_loop_body): Update caller.
2661         (Layout::set_segment_offsets): If target->isolate_execinstr(),
2662         reset file offset to zero when we hit LOAD_SEG, and then do a second
2663         loop over the segments before LOAD_SEG to reassign offsets after
2664         addresses have been determined.  Handle target->rosegment_gap().
2665         (Layout::attach_section_to_segment): Take new const Target* argument;
2666         pass it to attach_allocated_section_to_segment.
2667         (Layout::make_output_section): Update caller.
2668         (Layout::attach_sections_to_segments): Take new const Target* argument;
2669         pass it to attach_section_to_segment.
2670         * gold.cc (queue_middle_tasks): Update caller.
2671         * layout.h (Layout): Update method decls with new arguments.
2672
2673         * arm.cc (Target_arm::Target_arm): Take optional argument for the
2674         Target_info pointer to use.
2675         (Target_arm::do_make_data_plt): New virtual method.
2676         (Target_arm::make_data_plt): New method that calls it.
2677         (Target_arm::make_plt_entry): Use it.
2678         (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
2679         for the section alignment.
2680         (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
2681         method.
2682         (Output_data_plt_arm::first_plt_entry_offset): Call it.
2683         (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
2684         method.
2685         (Output_data_plt_arm::get_plt_entry_size): Call it.
2686         (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
2687         (Output_data_plt_arm::fill_plt_entry): New method that calls it.
2688         (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
2689         method.
2690         (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
2691         (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
2692         method instead of sizeof(plt_entry).
2693         (Output_data_plt_arm::add_entry): Likewise.
2694         Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
2695         (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
2696         than static method.
2697         (Target_arm::plt_entry_size): Likewise.
2698         (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
2699         Move to ...
2700         (Output_data_plt_arm_standard): ... here, new class.
2701         (Output_data_plt_arm::do_write): Move guts of PLT filling to...
2702         (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
2703         (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
2704
2705         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
2706         Take additional argument for the PLT entry size.
2707         (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
2708         Use get_plt_entry_size method rather than plt_entry_size variable.
2709         (Output_data_plt_x86_64::reserve_slot): Likewise.
2710         (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
2711         (Output_data_plt_x86_64::add_entry): Likewise.
2712         (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
2713         (Output_data_plt_x86_64::address_for_global): Likewise.
2714         (Output_data_plt_x86_64::address_for_local): Likewise.
2715         (Output_data_plt_x86_64::set_final_data_size): Likewise.
2716         (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
2717         Make method non-static.
2718         (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
2719         method.
2720         (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
2721         (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
2722         (Output_data_plt_x86_64::add_eh_frame): New method to call it.
2723         (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
2724         virtual method.
2725         (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
2726         (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
2727         virtual method.
2728         (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
2729         (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
2730         virtual method.
2731         (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
2732         (Output_data_plt_x86_64::plt_entry_size)
2733         (Output_data_plt_x86_64::first_plt_entry)
2734         (Output_data_plt_x86_64::plt_entry)
2735         (Output_data_plt_x86_64::tlsdesc_plt_entry)
2736         (Output_data_plt_x86_64::plt_eh_frame_fde_size)
2737         (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
2738         (Output_data_plt_x86_64_standard): ... here, new class.
2739         (Target_x86_64::Target_x86_64): Take optional argument for the
2740         Target_info pointer to use.
2741         (Target_x86_64::do_make_data_plt): New virtual method.
2742         (Target_x86_64::make_data_plt): New method to call it.
2743         (Target_x86_64::init_got_plt_for_update): Use that.
2744         Call this->plt_->add_eh_frame method here.
2745         (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
2746         (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
2747         rather than static method.
2748         (Target_x86_64::plt_entry_size): Likewise.
2749         (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
2750         rather than plt_entry_size variable.  Move guts of PLT filling to...
2751         (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
2752         (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
2753         (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
2754
2755         * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
2756         additional argument for the section alignment.
2757         Don't do add_eh_frame_for_plt here.
2758         (Output_data_plt_i386::first_plt_entry_offset): Make the method
2759         non-static.  Use get_plt_entry_size method rather than plt_entry_size
2760         variable.
2761         (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
2762         method.
2763         (Output_data_plt_i386::get_plt_entry_size): Call it.
2764         (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
2765         (Output_data_plt_i386::add_eh_frame): New method to call it.
2766         (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
2767         method.
2768         (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
2769         (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
2770         method.
2771         (Output_data_plt_i386::fill_plt_entry): New method to call it.
2772         (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
2773         method instead of plt_entry_size.
2774         (Output_data_plt_i386::plt_entry_size)
2775         (Output_data_plt_i386::plt_eh_frame_fde_size)
2776         (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
2777         (Output_data_plt_i386_standard): ... here, new class.
2778         (Output_data_plt_i386_exec): New class.
2779         (Output_data_plt_i386::exec_first_plt_entry): Move to ...
2780         (Output_data_plt_i386_exec::first_plt_entry): ... here.
2781         (Output_data_plt_i386::exec_plt_entry): Move to ...
2782         (Output_data_plt_i386_exec::plt_entry): ... here.
2783         (Output_data_plt_i386_dyn): New class.
2784         (Output_data_plt_i386::first_plt_entry): Move to ...
2785         (Output_data_plt_i386_dyn::first_plt_entry): ... here.
2786         (Output_data_plt_i386::dyn_plt_entry): Move to ...
2787         (Output_data_plt_i386_dyn::plt_entry): ... here.
2788         (Target_i386::Target_i386): Take optional argument for the Target_info
2789         pointer to use.
2790         (Target_i386::do_make_data_plt): New virtual method.
2791         (Target_i386::make_data_plt): New method to call it.
2792         (Target_i386::make_plt_section): Use that.
2793         Call this->plt_->add_eh_frame method here.
2794         (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
2795         rather than plt_entry_size variable.
2796         (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
2797         (Output_data_plt_i386::address_for_local): Likewise.
2798         (Output_data_plt_i386::do_write): Likewise.
2799         Move guts of PLT filling to...
2800         (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
2801         (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
2802         (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
2803         (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
2804
2805 2012-05-01  Cary Coutant  <ccoutant@google.com>
2806
2807         * dwarf_reader.cc (Dwarf_die::read_attributes)
2808         (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
2809         (Dwarf_die::uint_attribute): Remove DW_FORM_null.
2810         * reduced_debug_output.cc
2811         (Output_reduced_debug_info_section::get_die_end): Remove
2812         DW_FORM_GNU_ref_index.  Add default case.
2813
2814 2012-04-26  Mark Wielaard  <mjw@redhat.com>
2815
2816         * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
2817         * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
2818         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
2819         DW_AT_high_pc as offset from DW_AT_low_pc.
2820
2821         * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
2822         * testsuite/Makefile.in: Regenerate.
2823         * testsuite/gdb_index_test_3.c: New test source file.
2824         * testsuite/gdb_index_test_3.sh: New test source file.
2825
2826 2012-04-25  Ian Lance Taylor  <iant@google.com>
2827
2828         * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
2829         pointer.
2830         (Stub_addend_reader::operator()): Declare Arm_relocate_functions
2831         as a class, not a struct.
2832         (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
2833         (Target_arm::apply_cortex_a8_workaround): Likewise.
2834         * gc.h: Declare Reloc_types as a struct, not a class.
2835         * object.h: Declare Symbols_data as a struct.
2836         * reloc.h: Declare Read_relocs_data as a struct.
2837         * target.h: Declare Relocate_info as a struct.
2838
2839 2012-04-24  David S. Miller  <davem@davemloft.net>
2840
2841         * sparc.cc (Target_sparc::Relocate::relax_call): New function.
2842         (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
2843         and R_SPARC_WPLT30.
2844
2845 2012-04-24  Cary Coutant  <ccoutant@google.com>
2846
2847         * incremental-dump.cc (find_input_containing_global): Replace
2848         magic number with symbolic constant.
2849         (dump_incremental_inputs): Update version number.
2850         * incremental.cc (Output_section_incremental_inputs): Update version
2851         number; import symbolic constants from Incremental_inputs_reader.
2852         (Incremental_inputs::create_data_sections): Align relocations
2853         section correctly for 64-bit targets.
2854         (Output_section_incremental_inputs::set_final_data_size): Use symbolic
2855         constants; add padding.
2856         (Output_section_incremental_inputs::write_header): Add assert for
2857         header_size.
2858         (Output_section_incremental_inputs::write_input_files): Add assert
2859         for input_entry_size.
2860         (Output_section_incremental_inputs::write_info_blocks): Add padding;
2861         add assert for object_info_size, input_section_entry_size,
2862         global_sym_entry_size.
2863         * incremental.h (Incremental_inputs_reader): Add symbolic constants
2864         for data structure sizes; use them.
2865         (Incremental_input_entry_reader): Import symbolic constants from
2866         Incremental_inputs_reader; use them.
2867
2868 2012-04-23  David S. Miller  <davem@davemloft.net>
2869
2870         * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
2871         and elf_flags_set_.
2872         (Target_sparc::Target_sparc): Initialize new fields.
2873         (Target_sparc::do_make_elf_object): New function.
2874         (Target_sparc::do_adjust_elf_header): New function.
2875
2876 2012-04-23  Cary Coutant  <ccoutant@google.com>
2877
2878         * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
2879         CU range table of gdb index.
2880
2881 2012-04-20  David S. Miller  <davem@davemloft.net>
2882
2883         * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
2884         instead of false.
2885
2886 2012-04-16  David S. Miller  <davem@davemloft.net>
2887
2888         * sparc.cc (Target_sparc::got_address): New function.
2889         (Sparc_relocate_functions::gdop_hix22): New function.
2890         (Sparc_relocate_functions::gdop_lox10): New function.
2891         (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
2892         relocs.
2893         (Target_sparc::Scan::local): Likewise if the global symbol is not
2894         preemptible and is not IFUNC.
2895         (Target_sparc::Relocate::relocate): Perform GOTDATA code
2896         transformations for local and non-preemptible non-IFUNC global
2897         symbols.
2898
2899         * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
2900         writing out 64-bit part of ranges.
2901
2902         * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
2903         -fpic and -fpie respectively.
2904         * Makefile.in: Regenerate.
2905
2906         * sparc.cc (class Target_sparc): Add rela_ifunc_.
2907         (Target_sparc::Target_sparc): Initialize new field.
2908         (Target_sparc::do_plt_section_for_global): New function.
2909         (Target_sparc::do_plt_section_for_local): New function.
2910         (Target_sparc::reloc_needs_plt_for_ifunc): New function.
2911         (Target_sparc::make_plt_section): New function, broken out of
2912         make_plt_entry.  Use ORDER_NON_RELRO_FIRST for ".plt".
2913         (Target_sparc::make_plt_entry): Call make_plt_section.
2914         (Target_sparc::make_local_ifunc_plt_entry): New function.
2915         (Target_sparc::rela_ifunc_section): New function.
2916         (Target_sparc::plt_section): Remove const.
2917         (Output_data_plt_sparc): Update declarations.  Define Global_ifunc
2918         and Local_ifunc types.  Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
2919         and ifunc_count_ fields.
2920         (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
2921         (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
2922         (Output_data_plt_sparc::add_local_ifunc_entry): New function.
2923         (Output_data_plt_sparc::rela_ifunc): New function.
2924         (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
2925         (Output_data_plt_sparc::has_ifunc_section): New function.
2926         (Output_data_plt_sparc::entry_count): Include ifunc_count_.
2927         (Output_data_plt_sparc::address_for_global): New function.
2928         (Output_data_plt_sparc::address_for_local): New function.
2929         (Output_data_plt_sparc::plt_index_to_offset): New function.
2930         (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
2931         and entry_count.
2932         (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
2933         entry_count.
2934         (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
2935         R_SPARC_JMP_IREL to switch.
2936         (Target_sparc::Scan::check_non_pic): Likewise.
2937         (Target_sparc::Scan::local): Handle IFUNC symbols.
2938         (Target_sparc::Scan::local): Likewise.
2939         (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
2940         and plt_address_for_local.
2941         (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
2942         Define __rel_iplt_start and __rel_iplt_end if doing a static link.
2943
2944         * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
2945         (class Output_data_reloc): Adjust calls to Output_reloc_type.
2946         (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
2947         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
2948         global relocs too.
2949         (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
2950         * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
2951         calls.
2952         * sparc.cc (Target_sparc::Scan::global): Likewise.
2953         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
2954
2955 2012-04-16  Cary Coutant  <ccoutant@google.com>
2956
2957         * archive.cc (Library_base::should_include_member): Check for
2958         --export-dynamic-symbol.
2959         * options.h (class General_options): Add --export-dynamic-symbol.
2960         * symtab.cc (Symbol::should_add_dynsym_entry): Check for
2961         --export-dynamic-symbol.
2962         (Symbol_table::gc_mark_undef_symbols): Likewise.
2963         (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
2964
2965 2012-04-12  David S. Miller  <davem@davemloft.net>
2966
2967         * sparc.cc (Reloc::wdisp10): New relocation method.
2968         (Reloc::h34): Likewise.
2969         (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
2970         (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
2971         R_SPARC_WDISP10.
2972         (Target_sparc::Scan::local): Likewise.
2973         (Target_sparc::Scan::global): Likewise.
2974         (Target_sparc::Relocate::relocate): Likewise.
2975
2976 2012-04-09  Cary Coutant  <ccoutant@google.com>
2977
2978         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
2979         low_pc == 0.
2980
2981 2012-04-06  Ian Lance Taylor  <iant@google.com>
2982
2983         * timer.cc: #include <unistd.h>.
2984
2985 2012-04-06  Roland McGrath  <mcgrathr@google.com>
2986
2987         * configure.in (AC_CHECK_HEADERS): Add locale.h.
2988         * config.in: Regenerate.
2989         * configure: Regenerate.
2990
2991 2012-04-05  Nick Clifton  <nickc@redhat.com>
2992
2993         * configure.ac (AC_CHECK_FUNCS): Add setlocale.
2994         (AM_LC_MESSAGES): Add.
2995         * aclocal.m4: Regenerate.
2996         * config.in: Regenerate.
2997         * configure: Regenerate.
2998
2999 2012-03-21  Cary Coutant  <ccoutant@google.com>
3000
3001         * Makefile.am: Add gdb-index.cc, gdb-index.h.
3002         * Makefile.in: Regenerate.
3003         * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
3004         (Sized_elf_reloc_mapper::symbol_section): New function.
3005         (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
3006         (make_elf_reloc_mapper): New function.
3007         (Dwarf_abbrev_table::clear_abbrev_codes): New function.
3008         (Dwarf_abbrev_table::do_read_abbrevs): New function.
3009         (Dwarf_abbrev_table::do_get_abbrev): New function.
3010         (Dwarf_ranges_table::read_ranges_table): New function.
3011         (Dwarf_ranges_table::read_range_list): New function.
3012         (Dwarf_pubnames_table::read_section): New function.
3013         (Dwarf_pubnames_table::read_header): New function.
3014         (Dwarf_pubnames_table::next_name): New function.
3015         (Dwarf_die::Dwarf_die): New function.
3016         (Dwarf_die::read_attributes): New function.
3017         (Dwarf_die::skip_attributes): New function.
3018         (Dwarf_die::set_name): New function.
3019         (Dwarf_die::set_linkage_name): New function.
3020         (Dwarf_die::attribute): New function.
3021         (Dwarf_die::string_attribute): New function.
3022         (Dwarf_die::int_attribute): New function.
3023         (Dwarf_die::uint_attribute): New function.
3024         (Dwarf_die::ref_attribute): New function.
3025         (Dwarf_die::child_offset): New function.
3026         (Dwarf_die::sibling_offset): New function.
3027         (Dwarf_info_reader::check_buffer): New function.
3028         (Dwarf_info_reader::parse): New function.
3029         (Dwarf_info_reader::do_parse): New function.
3030         (Dwarf_info_reader::do_read_string_table): New function.
3031         (Dwarf_info_reader::lookup_reloc): New function.
3032         (Dwarf_info_reader::get_string): New function.
3033         (Dwarf_info_reader::visit_compilation_unit): New function.
3034         (Dwarf_info_reader::visit_type_unit): New function.
3035         (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
3036         Sized_elf_reloc_mapper.
3037         (Sized_dwarf_line_info::symbol_section): Remove function.
3038         (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
3039         (Sized_dwarf_line_info::read_line_mappings): Remove object
3040         parameter, adjust callers.
3041         (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
3042         * dwarf_reader.h: Include <sys/types.h>.
3043         (class Track_relocs): Remove forward declaration.
3044         (class Elf_reloc_mapper): New class.
3045         (class Sized_elf_reloc_mapper): New class.
3046         (class Dwarf_abbrev_table): New class.
3047         (class Dwarf_range_list): New class.
3048         (class Dwarf_ranges_table): New class.
3049         (class Dwarf_pubnames_table): New class.
3050         (class Dwarf_die): New class.
3051         (class Dwarf_info_reader): New class.
3052         (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
3053         (Sized_dwarf_line_info::symbol_section): Remove member function.
3054         * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
3055         base class.
3056         * gdb-index.cc: New source file.
3057         * gdb-index.h: New source file.
3058         * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
3059         and .debug_types sections, call Layout::add_to_gdb_index.
3060         (Sized_relobj_incr::do_section_name): Implement.
3061         (Sized_relobj_incr::do_section_contents): Adjust parameter list and
3062         return type; Implement.
3063         (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
3064         return type.
3065         * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
3066         parameter list and return type.
3067         (Sized_incr_dynobj::do_section_contents): Likewise.
3068         * layout.cc: Include gdb-index.h.
3069         (Layout::Layout): Initialize gdb_index_data_.
3070         (Layout::init_fixed_output_section): Check for .gdb_index section.
3071         (Layout::add_to_gdb_index): New function. Instantiate.
3072         * layout.h: Add forward declaration for class Gdb_index.
3073         (Layout::add_to_gdb_index): New member function.
3074         (Layout::gdb_index_data_): New data member.
3075         * main.cc: Include gdb-index.h.
3076         (main): Print statistics for gdb index.
3077         * object.cc (Object::section_contents): Move code into
3078         do_section_contents.
3079         (need_decompressed_section): Check for sections needed when building
3080         gdb index.
3081         (build_compressed_section_map): Likewise.
3082         (Sized_relobj_file::do_read_symbols): Need local symbols when building
3083         gdb index.
3084         (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
3085         sections; call Layout::add_to_gdb_index.
3086         (Sized_relobj_file::do_decompressed_section_contents): Call
3087         do_section_contents directly.
3088         * object.h (Object::do_section_contents): Adjust parameter list and
3089         return type.
3090         (Object::do_decompressed_section_contents): Call do_section_contents
3091         directly.
3092         (Sized_relobj_file::do_section_contents): Adjust parameter list and
3093         return type.
3094         * options.h (class General_options): Add --gdb-index option.
3095         * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
3096         list and return type.
3097         * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
3098         * reloc.h (Track_relocs::checkpoint): New function.
3099         (Track_relocs::reset): New function.
3100
3101         * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
3102         New test cases.
3103         * testsuite/Makefile.in: Regenerate.
3104         * testsuite/gdb_index_test.cc: New test source file.
3105         * testsuite/gdb_index_test_1.sh: New test source file.
3106         * testsuite/gdb_index_test_2.sh: New test source file.
3107
3108 2012-03-19  Doug Kwan  <dougkwan@google.com>
3109
3110         * arm.cc (Target_arm::do_define_standard_symbols): New method.
3111         (Target_arm::do_finalize_sections): Remove code which defines
3112         __exidx_start and __exidx_end.  Make symbol table parameter
3113         anonymous as it is not used.
3114         * gold.cc (queue_middle_tasks): Call target hook to define any
3115         target-specific symbols.
3116         * target.h (Target::define_standard_symbols): New method.
3117         (Target::do_define_standard_symbols): Same.
3118         * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
3119         * testsuite/Makefile.in: Regenerate.
3120         * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
3121         and __exidx_end.
3122         * testsuite/arm_exidx_test.sh: Check that no unused dynamic
3123         relocations are generated for __exidx_start and __exidx_end.
3124
3125 2012-03-16  Doug Kwan  <dougkwan@google.com>
3126
3127         * testsuite/Makefile.am: Disable test initpri3b.
3128         * testsuite/Makefile.in: Regenerate.
3129
3130 2012-03-15  Doug Kwan  <dougkwan@google.com>
3131
3132         * arm.cc (Target_arm::got_section): Make .got section read-only
3133         if -z now is given.
3134
3135 2012-03-15  Ian Lance Taylor  <iant@google.com>
3136
3137         PR gold/13850
3138         * layout.cc (Layout::make_output_section): Correctly mark
3139         SHT_INIT_ARRAY, et. al., as relro.
3140
3141 2012-03-14  Doug Kwan  <dougkwan@google.com>
3142
3143         * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
3144         dynamic relocations for protected symbols in shared objects.
3145
3146 2012-03-13  Ian Lance Taylor  <iant@google.com>
3147
3148         * resolve.cc (Symbol_table::resolve): When merging common symbols,
3149         keep the larger alignment.
3150
3151 2012-03-12  Cary Coutant  <ccoutant@google.com>
3152
3153         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
3154         handling of DW_LNE_define_file.
3155
3156 2012-03-12  Cary Coutant  <ccoutant@google.com>
3157
3158         * reduced_debug_output.cc
3159         (Output_reduced_debug_info_section::get_die_end): Add new FORM
3160         codes to switch.
3161
3162 2012-02-29  Cary Coutant  <ccoutant@google.com>
3163
3164         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
3165
3166 2012-02-29  Cary Coutant  <ccoutant@google.com>
3167
3168         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
3169         Call Object::decompressed_section_contents.
3170         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
3171         New dtor.
3172         (Sized_dwarf_line_info::buffer_start_): New data member.
3173         * merge.cc (Output_merge_data::do_add_input_section): Call
3174         Object::decompressed_section_contents.
3175         (Output_merge_string::do_add_input_section): Likewise.
3176         * object.cc (need_decompressed_section): New function.
3177         (build_compressed_section_map): Decompress sections needed later.
3178         (Sized_relobj_file::do_decompressed_section_contents): New function.
3179         (Sized_relobj_file::do_discard_decompressed_sections): New function.
3180         * object.h (Object::decompressed_section_contents): New function.
3181         (Object::discard_decompressed_sections): New function.
3182         (Object::do_decompressed_section_contents): New function.
3183         (Object::do_discard_decompressed_sections): New function.
3184         (Compressed_section_info): New type.
3185         (Compressed_section_map): Include decompressed section contents.
3186         (Sized_relobj_file::do_decompressed_section_contents): New function.
3187         (Sized_relobj_file::do_discard_decompressed_sections): New function.
3188
3189 2012-02-16  Cary Coutant  <ccoutant@google.com>
3190
3191         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
3192         * testsuite/Makefile.in: Regenerate.
3193
3194 2012-02-14  Cary Coutant  <ccoutant@google.com>
3195
3196         * options.cc (General_options::finalize): Disallow -pie and -static.
3197
3198 2012-02-03  Doug Kwan  <dougkwan@google.com>
3199
3200         * arm.cc (Arm_relocate_functions::abs8,
3201         Arm_relocate_functions::abs16): Use
3202         Bits::has_signed_unsigned_overflow32.
3203         (Arm_relocate_functions::thm_abs8): Correct range of
3204         overflow check.
3205         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
3206         in assertions.
3207
3208 2012-02-02  Doug Kwan  <dougkwan@google.com>
3209
3210         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
3211         position independent outputs, not just shared objects.
3212
3213 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
3214
3215         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
3216         * configure: Regenerated.
3217
3218 2012-01-27  Ian Lance Taylor  <iant@google.com>
3219
3220         * reloc.h (Bits): New class with static functions, copied from
3221         namespace utils in arm.cc.
3222         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
3223         instead.
3224
3225 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
3226
3227         * incremental.cc (write_info_blocks): Correct relocation offset.
3228
3229 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
3230
3231         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
3232         (Relocate::tls_gd_to_le): Likewise.
3233
3234 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
3235
3236         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
3237
3238 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
3239
3240         * configure.ac: Check if -mcmodel=medium works.
3241         * configure: Regenerated.
3242
3243 2012-01-24  Cary Coutant  <ccoutant@google.com>
3244
3245         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
3246         definition and ...
3247         (read_unsigned_LEB_128_x): ... this new function.
3248         (read_signed_LEB_128): Replaced with inline definition and ...
3249         (read_signed_LEB_128_x): ... this new function.
3250         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
3251         (read_unsigned_LEB_128): Add inline definition.
3252         (read_signed_LEB_128_x): New function.
3253         (read_signed_LEB_128): Add inline definition.
3254         * testsuite/Makefile.am (leb128_unittest): New unit test.
3255         * testsuite/Makefile.in: Regenerate.
3256         * testsuite/leb128_unittest.cc: New unit test.
3257
3258 2012-01-23  Ian Lance Taylor  <iant@google.com>
3259
3260         PR gold/13617
3261         * i386.cc (Target_i386::do_code_fill): When using a jmp
3262         instruction, pad with nop instructions.
3263         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
3264
3265 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
3266
3267         * x86_64.cc (gc_process_relocs): Add typename on types used in
3268         template.
3269         (scan_relocs): Likewise.
3270         (relocate_section): Likewise.
3271         (apply_relocation): Likewise.
3272
3273 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
3274
3275         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
3276         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
3277         under x32.
3278
3279 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
3280
3281         * x86_64.cc: Initial support for x32.
3282
3283 2012-01-03  Cary Coutant  <ccoutant@google.com>
3284
3285         * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
3286         Use abstract base class for GOT.
3287         * gold/output.h (class Output_data_got_base): New abstract base class.
3288         (class Output_data_got): Derive from new base class, adjust ctors.
3289         (Output_data_got::reserve_slot): Make virtual; rename to
3290         do_reserve_slot; Adjust callers.
3291         * gold/target.h (Sized_target::init_got_plt_for_update): Return
3292         pointer to abstract base class.
3293         * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
3294
3295 2011-12-18  Ian Lance Taylor  <iant@google.com>
3296
3297         * object.h (Relobj::local_symbol_value): New function.
3298         (Relobj::local_plt_offset): New function.
3299         (Relobj::local_has_got_offset): New function.
3300         (Relobj::local_got_offset): New function.
3301         (Relobj::set_local_got_offset): New function.
3302         (Relobj::do_local_symbol_value): New pure virtual function.
3303         (Relobj::do_local_plt_offset): Likewise.
3304         (Relobj::do_local_has_got_offset): Likewise.
3305         (Relobj::do_local_got_offset): Likewise.
3306         (Relobj::do_set_local_got_offset): Likewise.
3307         (Sized_relobj::do_local_has_got_offset): Rename from
3308         local_has_got_offset.
3309         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
3310         (Sized_relobj::do_set_local_got_offset): Rename from
3311         set_local_got_offset.
3312         (Sized_relobj_file::do_local_plt_offset): Rename from
3313         local_plt_offset.
3314         (Sized_relobj_file::do_local_symbol_value): New function.
3315         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
3316         local_plt_offset.
3317         * output.cc (Output_data_got::Got_entry::write): Change object to
3318         Relobj.  Use local_symbol_value.
3319         (Output_data_got::add_global_with_rel): Change rel_dyn to
3320         Output_data_reloc_generic*.  Use add_global_generic.
3321         (Output_data_got::add_global_with_rela): Remove.  Change all
3322         callers to use add_global_with_rel.
3323         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
3324         Output_data_reloc_generic*.  Use add_global_generic.
3325         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
3326         callers to use add_global_pair_with_rel.
3327         (Output_data_got::add_local): Change object to Relobj*.
3328         (Output_data_got::add_local_plt): Likewise.
3329         (Output_data_got::add_local_with_rel): Change object to Relobj*,
3330         change rel_dyn to Output_data_reloc_generic*.  Use
3331         add_local_generic.
3332         (Output_data_got::add_local_with_rela): Remove.  Change all
3333         callers to use all_local_with_rel.
3334         (Output_data_got::add_local_pair_with_rel): Change object to
3335         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
3336         add_output_section_generic.
3337         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
3338         callers to use add_local_pair_with_rel.
3339         (Output_data_got::reserve_local): Change object to Relobj*.
3340         * output.h: (class Output_data_reloc_generic): Add pure virtual
3341         declarations for add_global_generic, add_local_generic,
3342         add_output_section_generic.
3343         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
3344         functions for Output_data_reloc_generic.  Update declarations for
3345         changes listed in output.cc.
3346         (class Output_data_got): Change template parameter to got_size.
3347         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
3348         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
3349         function.
3350         (Sized_relobj_incr::do_local_plt_offset): New function.
3351         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
3352         add_global_generic.
3353
3354 2011-12-17  Cary Coutant  <ccoutant@google.com>
3355
3356         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
3357         * resolve.cc (Symbol_table::resolve): Likewise.
3358         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
3359         arrays.
3360         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
3361
3362 2011-12-16  Ian Lance Taylor  <iant@google.com>
3363
3364         * output.h (Output_data_reloc_generic::add): Only call
3365         add_dynamic_reloc if this is a dynamic reloc section.
3366
3367 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
3368
3369         PR gold/13505
3370         * target-reloc.h (apply_relocation): Replace <64, false> with
3371         <size, big_endian>.
3372
3373 2011-11-25  Nick Clifton  <nickc@redhat.com>
3374
3375         * po/it.po: New Italian translation.
3376
3377 2011-11-17  Sterling Augustine  <saugustine@google.com>
3378
3379         * script.cc (script_include_directive): Implement.
3380         (read_script_file): New local variables name and search_path. Update
3381         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
3382         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
3383         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
3384
3385 2011-11-11  Sterling Augustine  <saugustine@google.com>
3386
3387         * yyscript.y (section_cmd): Add support for INCLUDE directive.
3388         (file_or_sections_cmd): Likewise.
3389
3390 2011-11-11  Doug Kwan  <dougkwan@google.com>
3391
3392         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
3393         if --just-symbols is given.
3394
3395 2011-11-10  Doug Kwan  <dougkwan@google.com>
3396
3397         PR gold/13362
3398         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
3399         when processing data relocs.
3400         * reloc.h (Relocate_functions::rel_unaligned): New method.
3401         (Relocate_functions::pcrel_unaligned): Ditto.
3402         (Relocate_functions::rel32_unaligned): Ditto.
3403         (Relocate_functions::pcrel32_unaligned): Ditto.
3404
3405 2011-11-09  Doug Kwan  <dougkwan@google.com>
3406
3407         PR gold/13362
3408         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
3409         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
3410         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
3411         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
3412         (Relocate_functions::rel_unaligned): New.
3413         (Relocate_functions::rel32_unaligned): New.
3414         * target-reloc.h (relocate_for_relocatable): Add code to handle
3415         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
3416         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
3417         arm_unaligned_reloc_r): New targets.
3418         * testsuite/Makefile.in: Regenerate.
3419         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
3420         linking.
3421
3422 2011-11-02  Ian Lance Taylor  <iant@google.com>
3423
3424         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
3425         NATIVE_LINKER.
3426         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
3427         * options.cc (General_options::finalize): Use library search path
3428         from configure script if specified.  If not native and no sysroot,
3429         only search TOOLLIBDIR.
3430         * options.h (Search_directory::Search_directory): Change name to
3431         const std::string&.
3432         (General_options::add_to_library_path_with_sysroot): Change arg to
3433         const std::string&.
3434         * configure, Makefile.in, config.in: Rebuild.
3435
3436 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
3437
3438         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
3439         we are working around the ARM1176 Erratum.
3440         * options.h (General_options::fix_arm1176): Add option.
3441         * testsuite/Makefile.am: Add testcases, and keep current ones
3442         working.
3443         * testsuite/Makefile.in: Regenerate.
3444         * testsuite/arm_fix_1176.s: New file.
3445         * testsuite/arm_fix_1176.sh: Likewise.
3446
3447 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
3448
3449         * arm.cc (Target_arm::Target_arm): Remove initialisation of
3450         may_use_blx_.
3451         (Target_arm::may_use_blx): Remove method.
3452         (Target_arm::set_may_use_blx): Likewise.
3453         (Target_arm::may_use_v4t_interworking): New method.
3454         (Target_arm::may_use_v5t_interworking): Likewise.
3455         (Target_arm::may_use_blx_): Remove member variable.
3456         (Arm_relocate_functions::arm_branch_common): Check for v5T
3457         interworking.
3458         (Arm_relocate_functions::thumb_branch_common): Likewise.
3459         (Reloc_stub::stub_type_for_reloc): Likewise.
3460         (Target_arm::do_finalize_sections): Correct interworking checks.
3461         * testsuite/Makefile.am: Add new tests.
3462         * testsuite/Makefile.in: Regenerate.
3463         * testsuite/arm_farcall_arm_arm.s: New test.
3464         * testsuite/arm_farcall_arm_arm.sh: Likewise.
3465         * testsuite/arm_farcall_arm_thumb.s: Likewise.
3466         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
3467         * testsuite/arm_farcall_thumb_arm.s: Likewise.
3468         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
3469         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
3470         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
3471
3472 2011-10-31  Cary Coutant  <ccoutant@google.com>
3473
3474         PR gold/13023
3475         * expression.cc (Expression::eval_with_dot): Add
3476         is_section_dot_assignment parameter.
3477         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
3478         absolute and assigning to dot within a section.
3479         * script-sections.cc
3480         (Output_section_element_assignment::set_section_addresses): Pass
3481         dot_section to set_if_absolute.
3482         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
3483         as is_section_dot_assignment flag to eval_with_dot.
3484         (Output_section_element_dot_assignment::set_section_addresses):
3485         Likewise.
3486         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
3487         parameter.  Also set value if relative to dot_section; set the
3488         symbol's output_section.
3489         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
3490         parameter.  Adjust all callers.
3491         (Expression::eval_maybe_dot): Likewise.
3492         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
3493         Adjust all callers.
3494         * testsuite/script_test_2.t: Test assignment of an absolute value
3495         to dot within an output section element.
3496
3497 2011-10-31  Cary Coutant  <ccoutant@google.com>
3498
3499         * options.h (class General_options): Add --[no-]gnu-unique options.
3500         * symtab.cc (Symbol_table::sized_write_globals): Convert
3501         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
3502
3503 2011-10-31  Cary Coutant  <ccoutant@google.com>
3504
3505         PR gold/13359
3506         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
3507         unnecessary assertion.
3508         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
3509
3510 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
3511
3512         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
3513         gc_mark_symbol.
3514         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
3515         gc_mark_symbol.
3516         Change to just keep the section associated with symbol.
3517         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
3518         they are externally visible and --export-dynamic is turned on.
3519         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
3520
3521 2011-10-19  Ian Lance Taylor  <iant@google.com>
3522
3523         PR gold/13163
3524         * script-sections.cc
3525         (Output_section_element_dot_assignment::needs_output_section): New
3526         function.
3527
3528 2011-10-19  Ian Lance Taylor  <iant@google.com>
3529
3530         PR gold/13204
3531         * layout.cc (Layout::segment_precedes): Don't assert failure if a
3532         --section-start option was seen.
3533         * options.h (General_options::any_section_start): New function.
3534
3535 2011-10-18  David S. Miller  <davem@davemloft.net>
3536
3537         PR binutils/13301
3538         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
3539         member to track relocation locations that have moved during TLS
3540         reloc optimizations.
3541         (Target_sparc::Relocate::Relocate): Initialize to NULL.
3542         (Target_sparc::Relocate::relocate): Adjust view down by 4
3543         bytes if it matches reloc_adjust_addr_.
3544         (Target_sparc::Relocate::relocate_tls): Always move the
3545         __tls_get_addr call delay slot instruction forward 4 bytes when
3546         performing relaxation.
3547
3548 2011-10-18  Cary Coutant  <ccoutant@google.com>
3549
3550         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
3551         (Output_file::map_no_anonymous): Check for non-zero
3552         return code from posix_fallocate.
3553
3554 2011-10-17  Cary Coutant  <ccoutant@google.com>
3555
3556         PR gold/13245
3557         * plugin.cc (is_visible_from_outside): Check for symbols
3558         referenced from dynamic objects.
3559         * resolve.cc (Symbol_table::resolve): Don't count references
3560         from dynamic objects as references from real ELF files.
3561         * testsuite/plugin_test_2.sh: Adjust expected result.
3562
3563 2011-10-17  Cary Coutant  <ccoutant@google.com>
3564
3565         * gold.cc: Include timer.h.
3566         (queue_middle_tasks): Stamp time.
3567         (queue_final_tasks): Likewise.
3568         * main.cc (main): Store timer in parameters.  Print timers
3569         for each pass.
3570         * parameters.cc (Parameters::Parameters): Initialize timer_.
3571         (Parameters::set_timer): New function.
3572         (set_parameters_timer): New function.
3573         * parameters.h (Parameters::set_timer): New function.
3574         (Parameters::timer): New function.
3575         (Parameters::timer_): New data member.
3576         (set_parameters_timer): New function.
3577         * timer.cc (Timer::stamp): New function.
3578         (Timer::get_pass_time): New function.
3579         * timer.h (Timer::stamp): New function.
3580         (Timer::get_pass_time): New function.
3581         (Timer::pass_times_): New data member.
3582
3583 2011-10-17  Cary Coutant  <ccoutant@google.com>
3584
3585         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
3586         task for members of lib groups.
3587
3588 2011-10-17  Cary Coutant  <ccoutant@google.com>
3589
3590         PR gold/13288
3591         * fileread.cc (File_read::find_view): Add assert.
3592         (File_read::make_view): Move bounds check (replace with assert)...
3593         (File_read::find_or_make_view): ... to here.
3594
3595 2011-10-12  Cary Coutant  <ccoutant@google.com>
3596
3597         * output.cc (Output_file::open_base_file): Handle case where
3598         ::read returns less than requested size.
3599
3600 2011-10-10  Cary Coutant  <ccoutant@google.com>
3601
3602         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
3603         Initialize defined_count_.
3604         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
3605         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
3606         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
3607         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
3608         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
3609         * incremental.h (Sized_relobj_incr::defined_count_): New data
3610         member.
3611         (Sized_incr_dynobj::defined_count_): New data member.
3612         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
3613         Return zeroes instead of internal error.
3614
3615 2011-10-10  Cary Coutant  <ccoutant@google.com>
3616
3617         PR gold/13249
3618         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
3619         (Output_reloc::symbol_value): Return PLT offset if flag is set.
3620         * output.h (class Output_reloc): Add use_plt_offset flag.
3621         (Output_reloc::type_): Adjust size of bit field.
3622         (Output_reloc::use_plt_offset_): New bit field.
3623         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
3624         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
3625         flag.  Adjust all callers.
3626         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
3627         creating RELATIVE relocations.
3628
3629 2011-10-10  Nick Clifton  <nickc@redhat.com>
3630
3631         * po/es.po: Updated Spanish translation.
3632         * po/fi.po: Updated Finnish translation.
3633
3634 2011-10-03   Diego Novillo  <dnovillo@google.com>
3635
3636         * options.cc (parse_uint): Fix dereference of RETVAL.
3637
3638 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
3639
3640         * layout.h (section_order_map_): New member.
3641         (get_section_order_map): New member function.
3642         * output.cc (Output_section::add_input_section): Check for patterns
3643         only when --section-ordering-file is specified.
3644         * gold.cc (queue_middle_tasks): Delay updating order of sections till
3645         output_sections have been formed.
3646         * layout.cc (Layout_Layout): Initialize section_order_map_.
3647         * plugin.cc (update_section_order): Store order in order_map. Do not
3648         update the order.
3649         * testsuite/Makefile.am: Add test case for plugin_final_layout.
3650         * testsuite/Makefile.in: Regenerate.
3651         * testsuite/plugin_section_order.c: New file.
3652         * testsuite/plugin_final_layout.cc: New file.
3653         * testsuite/plugin_final_layout.sh: New file.
3654
3655 2011-09-29  Cary Coutant  <ccoutant@google.com>
3656
3657         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
3658         Check for NULL.
3659         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
3660         symbols during incremental update.
3661         (Symbol_table::add_from_dynobj): Likewise.
3662
3663 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3664             Ian Lance Taylor  <iant@google.com>
3665
3666         * symtab.cc (Symbol_table::define_special_symbol): Always
3667         canonicalize version string.
3668
3669 2011-09-26  Cary Coutant  <ccoutant@google.com>
3670
3671         * gold.cc (queue_initial_tasks): Move option checks ...
3672         * options.cc (General_options::finalize): ... to here. Disable
3673         some options; make others fatal.
3674
3675 2011-09-26  Cary Coutant  <ccoutant@google.com>
3676
3677         gcc PR lto/47247
3678         * plugin.cc (get_symbols_v2): New function.
3679         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
3680         (is_referenced_from_outside): New function.
3681         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
3682         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
3683         (get_symbols): Pass version parameter.
3684         (get_symbols_v2): New function.
3685         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
3686         parameter.
3687         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
3688         (onload): Add LDPT_GET_SYMBOLS_V2.
3689         (all_symbols_read_hook): Use get_symbols_v2; check for
3690         LDPR_PREVAILING_DEF_IRONLY_EXP.
3691         * testsuite/plugin_test_3.sh: Update expected results.
3692
3693 2011-09-23  Simon Baldwin  <simonb@google.com>
3694
3695         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
3696         configuration options.
3697         * configure: Regenerate.
3698         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
3699         * Makefile.in: Regenerate.
3700         * testsuite/Makefile.in: Regenerate.
3701
3702 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
3703
3704         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
3705
3706 2011-09-19  Cary Coutant  <ccoutant@google.com>
3707
3708         * incremental.cc (can_incremental_update): Fix typo in comment.
3709         * incremental.h (can_incremental_update): Likewise.
3710
3711 2011-09-18  Cary Coutant  <ccoutant@google.com>
3712
3713         * incremental.cc (can_incremental_update): New function.
3714         * incremental.h (can_incremental_update): New function.
3715         * layout.cc (Layout::init_fixed_output_section): Call it.
3716         (Layout::make_output_section): Don't allow patch space in .eh_frame.
3717         * object.cc (Sized_relobj_file::do_layout): Call
3718         can_incremental_update.
3719
3720 2011-09-13  Cary Coutant  <ccoutant@google.com>
3721
3722         * configure.ac: Check for glibc support for gnu_indirect_function
3723         support with static linking, setting automake conditional
3724         IFUNC_STATIC.
3725         * Makefile.in: Regenerate.
3726         * configure: Regenerate.
3727
3728         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
3729         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
3730         for IFUNC_STATIC.
3731         * testsuite/Makefile.in: Regenerate.
3732
3733 2011-09-13  Cary Coutant  <ccoutant@google.com>
3734
3735         * incremental.cc (Sized_relobj_incr::do_layout): Call
3736         report_comdat_group for kept comdat sections.
3737         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
3738         * testsuite/Makefile.in: Regenerate.
3739         * testsuite/incr_comdat_test_1.cc: New source file.
3740         * testsuite/incr_comdat_test_2_v1.cc: New source file.
3741         * testsuite/incr_comdat_test_2_v2.cc: New source file.
3742         * testsuite/incr_comdat_test_2_v3.cc: New source file.
3743
3744 2011-09-13  Ian Lance Taylor  <iant@google.com>
3745
3746         * object.cc (Sized_relobj_file::do_layout): Remove unused local
3747         variable external_symbols_offset.
3748
3749 2011-09-12  Ian Lance Taylor  <iant@google.com>
3750
3751         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
3752         triggered if object has no symbols.
3753
3754 2011-09-09  David S. Miller  <davem@davemloft.net>
3755
3756         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
3757         (Output_fill_debug_line::do_write): Likewise.
3758
3759 2011-08-29  Cary Coutant  <ccoutant@google.com>
3760
3761         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
3762         casts to match formatting specs.
3763         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
3764
3765 2011-08-26  Cary Coutant  <ccoutant@google.com>
3766
3767         * layout.cc (Free_list::allocate): Provide guarantee of minimum
3768         remaining hole size when allocating.
3769         (Layout::make_output_section): Set fill methods for debug sections.
3770         * layout.h (Free_list::Free_list_node): Move from private to
3771         public.
3772         (Free_list::set_min_hole_size): New function.
3773         (Free_list::begin, Free_list::end): New functions.
3774         (Free_list::min_hole_): New data member.
3775         * output.cc: Include dwarf.h.
3776         (Output_fill_debug_info::do_minimum_hole_size): New function.
3777         (Output_fill_debug_info::do_write): New function.
3778         (Output_fill_debug_line::do_minimum_hole_size): New function.
3779         (Output_fill_debug_line::do_write): New function.
3780         (Output_section::Output_section): Initialize new data member.
3781         (Output_section::set_final_data_size): Ensure patch space is larger
3782         than minimum hole size.
3783         (Output_section::do_write): Fill holes in debug sections.
3784         * output.h (Output_fill): New class.
3785         (Output_fill_debug_info): New class.
3786         (Output_fill_debug_line): New class.
3787         (Output_section::set_free_space_fill): New function.
3788         (Output_section::free_space_fill_): New data member.
3789         * testsuite/Makefile.am (incremental_test_3): Add
3790         --incremental-patch option.
3791         (incremental_test_4): Likewise.
3792         (incremental_test_5): Likewise.
3793         (incremental_test_6): Likewise.
3794         (incremental_copy_test): Likewise.
3795         (incremental_common_test_1): Likewise.
3796         * testsuite/Makefile.in: Regenerate.
3797
3798 2011-08-26  Nick Clifton  <nickc@redhat.com>
3799
3800         * po/es.po: Updated Spanish translation.
3801
3802 2011-08-01  Cary Coutant  <ccoutant@google.com>
3803
3804         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
3805         * gold/testsuite/Makefile.in: Regenerate.
3806         * gold/testsuite/justsyms_exec.c: New source file.
3807         * gold/testsuite/justsyms_lib.c: New source file.
3808
3809 2011-08-01  Cary Coutant  <ccoutant@google.com>
3810
3811         * layout.cc (Layout::set_segment_offsets): Don't realign text
3812         segment if -Ttext was specified.
3813         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
3814         file type.
3815         * object.h (Sized_relobj_file::e_type): New function.
3816         (Sized_relobj_file::e_type_): New data member.
3817         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
3818         base address for ET_EXEC files.
3819         * target.cc (Target::do_make_elf_object_implementation): Allow
3820         ET_EXEC files with --just-symbols option.
3821
3822 2011-07-28  Cary Coutant  <ccoutant@google.com>
3823
3824         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
3825         Add thread_number parameter.
3826         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
3827         * workqueue-threads.cc
3828         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
3829         current thread if its thread number is greater than desired thread
3830         count.
3831         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
3832         Add thread_number parameter.
3833         (Workqueue::should_cancel_thread): Likewise.
3834         (Workqueue::find_runnable_or_wait): Pass thread_number to
3835         should_cancel_thread.
3836         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
3837         parameter.
3838
3839 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
3840
3841         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
3842         only after checking if it cannot be forced local.
3843         * symtab.h (is_externally_visible): Check if the symbol is not forced
3844         local.
3845
3846 2011-07-15  Ian Lance Taylor  <iant@google.com>
3847
3848         * options.h (class General_options): Add --print-output-format.
3849         Move -EL next to -EB, for  better --help output.
3850         * target-select.cc: Include <cstdio>, "options.h", and
3851         "parameters.h".
3852         (Target_selector::do_target_bfd_name): New function.
3853         (print_output_format): New function.
3854         * target-select.h (class Target_selector): Update declarations.
3855         (Target_selector::target_bfd_name): New function.
3856         (print_output_format): Declare.
3857         * main.cc: Include "target-select.h".
3858         (main): Handle --print-output-format.
3859         * gold.cc: Include "target-select.h".
3860         (queue_initial_tasks): Handle --print-output-format when there are
3861         no input files.
3862         * parameters.cc (parameters_force_valid_target): Give a better
3863         error message if -EB/-EL does not match target.
3864         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
3865         function.
3866
3867 2011-07-15  Ian Lance Taylor  <iant@google.com>
3868
3869         * i386.cc (class Output_data_plt_i386): Add layout_ field.
3870         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
3871         (Output_data_plt_i386::do_write): Write address of .dynamic
3872         section to first entry in .got.plt section.
3873         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
3874         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
3875         Initialize layout_.
3876         (Output_data_plt_x86_64::do_write): Write address of .dynamic
3877         section to first entry in .got.plt section.
3878         * layout.h (Layout::dynamic_section): New function.
3879
3880 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
3881
3882         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
3883         to claim_file call.
3884         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
3885         input_section_position_, and input_section_glob_.
3886         (read_layout_from_file): Call function section_ordering_specified.
3887         * layout.h (is_section_ordering_specified): New function.
3888         (section_ordering_specified): New function.
3889         (section_ordering_specified_): New boolean member.
3890         * main.cc(main): Call load_plugins after layout object is defined.
3891         * output.cc (Output_section::add_input_section): Use
3892         function section_ordering_specified to check if section ordering is
3893         needed.
3894         * output.cc (Output_section::add_relaxed_input_section): Use
3895         function section_ordering_specified to check if section ordering is
3896         needed.
3897         (Output_section::update_section_layout): New function.
3898         (Output_section::sort_attached_input_sections): Check if input section
3899         must be reordered.
3900         * output.h (Output_section::update_section_layout): New function.
3901         * plugin.cc (get_section_count): New function.
3902         (get_section_type): New function.
3903         (get_section_name): New function.
3904         (get_section_contents): New function.
3905         (update_section_order): New function.
3906         (allow_section_ordering): New function.
3907         (Plugin::load): Add the new interfaces to the transfer vector.
3908         (Plugin_manager::load_plugins): New parameter.
3909         (Plugin_manager::all_symbols_read): New parameter.
3910         (Plugin_manager::claim_file): New parameter. Save the elf object for
3911         unclaimed objects.
3912         (Plugin_manager::get_elf_object): New function.
3913         (Plugin_manager::get_view): Change to directly use the bool to check
3914         if get_view is called from claim_file_hook.
3915         * plugin.h (input_objects): New function
3916         (Plugin__manager::load_plugins): New parameter.
3917         (Plugin_manager::claim_file): New parameter.
3918         (Plugin_manager::get_elf_object): New function.
3919         (Plugin_manager::in_claim_file_handler): New function.
3920         (Plugin_manager::in_claim_file_handler_): New member.
3921         (layout): New function.
3922         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
3923         handler with an extra parameter. Make the elf object before calling
3924         claim_file handler.
3925         * testsuite/plugin_test.c (get_section_count): New function pointer.
3926         (get_section_type): New function pointer.
3927         (get_section_name): New function pointer.
3928         (get_section_contents): New function pointer.
3929         (update_section_order): New function pointer.
3930         (allow_section_ordering): New function pointer.
3931         (onload): Check if the new interfaces exist.
3932
3933 2011-07-13  Ian Lance Taylor  <iant@google.com>
3934
3935         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
3936         relro section.
3937         * x86_64.cc (Target_x86_64::got_section): Likewise.
3938         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
3939         (relro_now_test_SOURCES): New variable.
3940         (relro_now_test_DEPENDENCIES): New variable.
3941         (relro_now_test_LDFLAGS): New variable.
3942         (relro_now_test_LDADD): New variable.
3943         (relro_now_test.so): New target.
3944         * testsuite/Makefile.in: Rebuild.
3945
3946 2011-07-12  Ian Lance Taylor  <iant@google.com>
3947
3948         PR gold/12980
3949         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
3950         GLOB_DAT relocation rather than a RELATIVE relocation for a
3951         protected symbol when creating a shared library.
3952         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
3953         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
3954         * testsuite/protected_main_1.cc (main): Test that protected
3955         function has same address.
3956
3957 2011-07-11  Ian Lance Taylor  <iant@google.com>
3958
3959         PR gold/12979
3960         * options.h (class General_options): Add -Bgroup.
3961         * options.cc (General_options::finalize): If -Bgroup is set,
3962         default to --unresolved-symbols=report-all.
3963         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
3964         * target-reloc.h (issue_undefined_symbol_error): Handle
3965         --unresolved-symbols=report-all.
3966
3967 2011-07-08  Ian Lance Taylor  <iant@google.com>
3968
3969         PR gold/11985
3970         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
3971         if linker script discards key sections.
3972         (Layout::create_dynamic_symtab): Likewise.
3973         (Layout::assign_local_dynsym_offsets): Likewise.
3974         (Layout::sized_create_version_sections): Likewise.
3975         (Layout::create_interp): Likewise.
3976         (Layout::finish_dynamic_section): Likewise.
3977         (Layout::set_dynamic_symbol_size): Likewise.
3978
3979 2011-07-08  Ian Lance Taylor  <iant@google.com>
3980
3981         PR gold/12386
3982         * options.h (class General_options): Add --unresolved-symbols.
3983         * target-reloc.h (issue_undefined_symbol_error): Check
3984         --unresolved-symbols.  Add comments.
3985
3986 2011-07-08  Ian Lance Taylor  <iant@google.com>
3987
3988         * testsuite/odr_violation2.cc (Ordering::operator()): Make
3989         expression more complex.
3990
3991 2011-07-08  Ian Lance Taylor  <iant@google.com>
3992
3993         PR gold/11317
3994         * target-reloc.h (issue_undefined_symbol_error): New inline
3995         function, broken out of relocate_section.
3996         (relocate_section): Call issue_undefined_symbol_error.
3997         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
3998         there is no TLS segment if we are about to issue an undefined
3999         symbol error.
4000         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
4001
4002 2011-07-08  Ian Lance Taylor  <iant@google.com>
4003
4004         PR gold/12279
4005         * resolve.cc (Symbol_table::should_override): Add fromtype
4006         parameter.  Change all callers.  Give error when linking together
4007         TLS and non-TLS symbol.
4008         (Symbol_table::should_override_with_special): Add fromtype
4009         parameter.  Change all callers.
4010         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
4011         there is no TLS segment if we have reported some errors.
4012         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
4013
4014 2011-07-08  Ian Lance Taylor  <iant@google.com>
4015
4016         PR gold/12372
4017         * target.h (Target::plt_address_for_global): New function.
4018         (Target::plt_address_for_local): New function.
4019         (Target::plt_section_for_global): Remove.
4020         (Target::plt_section_for_local): Remove.
4021         (Target::do_plt_address_for_global): New virtual function.
4022         (Target::do_plt_address_for_local): New virtual function.
4023         (Target::do_plt_section_for_global): Remove.
4024         (Target::do_plt_section_for_local): Remove.
4025         (Target::register_global_plt_entry): Add Symbol_table and Layout
4026         parameters.
4027         * output.cc (Output_data_got::Got_entry::write): Use
4028         plt_address_for_global and plt_address_for_local.
4029         * layout.cc (Layout::add_target_dynamic_tags): Use size and
4030         address of output section.
4031         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
4032         got_irelative_, and irelative_count_ fields.  Update
4033         declarations.
4034         (Output_data_plt_i386::has_irelative_section): New function.
4035         (Output_data_plt_i386::entry_count): Add irelative_count_.
4036         (Output_data_plt_i386::set_final_data_size): Likewise.
4037         (class Target_i386): Add got_irelative_ and rel_irelative_
4038         fields.  Update declarations.
4039         (Target_i386::Target_i386): Initialize new fields.
4040         (Target_i386::do_plt_address_for_global): New function replacing
4041         do_plt_section_for_global.
4042         (Target_i386::do_plt_address_for_local): New function replacing
4043         do_plt_section_for_local.
4044         (Target_i386::got_section): Create got_irelative_.
4045         (Target_i386::rel_irelative_section): New function.
4046         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
4047         fields.  Don't define __rel_iplt_{start,end}.
4048         (Output_data_plt_i386::add_entry): Add symtab and layout
4049         parameters.  Change all callers.  Use different PLT and GOT for
4050         IFUNC symbols.
4051         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
4052         layout parameters.  Change all callers.  Use different PLT and
4053         GOT.
4054         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
4055         (Output_data_plt_i386::rel_irelative): New function.
4056         (Output_data_plt_i386::address_for_global): New function.
4057         (Output_data_plt_i386::address_for_local): New function.
4058         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
4059         IRELATIVE GOT when changing IFUNC GOT entries.
4060         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
4061         reloc.
4062         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
4063         if we didn't create an IRELATIVE GOT.
4064         (Target_i386::Relocate::relocate): Use plt_address_for_global and
4065         plt_address_for_local.
4066         (Target_i386::do_dynsym_value): Use plt_address_for_global.
4067         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
4068         got_irelative_, and irelative_count_ fields.  Update
4069         declarations.
4070         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
4071         Initialize new fields.  Remove symtab parameter.  Change all
4072         callers.
4073         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
4074         irelative_count_.
4075         (Output_data_plt_x86_64::has_irelative_section): New function.
4076         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
4077         (class Target_x86_64): Add got_irelative_ and rel_irelative_
4078         fields.  Update declarations.
4079         (Target_x86_64::Target_x86_64): Initialize new fields.
4080         (Target_x86_64::do_plt_address_for_global): New function replacing
4081         do_plt_section_for_global.
4082         (Target_x86_64::do_plt_address_for_local): New function replacing
4083         do_plt_section_for_local.
4084         (Target_x86_64::got_section): Create got_irelative_.
4085         (Target_x86_64::rela_irelative_section): New function.
4086         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
4087         all callers.  Don't create __rel_iplt_{start,end}.
4088         (Output_data_plt_x86_64::add_entry): Add symtab and layout
4089         parameters.  Change all callers.  Use different PLT and GOT for
4090         IFUNC symbols.
4091         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
4092         layout parameters.  Change all callers.  Use different PLT and
4093         GOT.
4094         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
4095         parameters.  Change all callers.  Use different PLT and GOT for
4096         IFUNC symbols.
4097         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
4098         (Output_data_plt_x86_64::rela_irelative): New function.
4099         (Output_data_plt_x86_64::address_for_global): New function.
4100         (Output_data_plt_x86_64::address_for_local): New function.
4101         (Output_data_plt_x86_64::set_final_data_size): Likewise.
4102         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
4103         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
4104         (Target_x86_64::register_global_plt_entry): Add symtab and layout
4105         parameters.
4106         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
4107         reloc.
4108         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
4109         symbols if we didn't create an IRELATIVE GOT.
4110         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
4111         plt_address_for_local.
4112         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
4113         * testsuite/ifuncvar1.c: New test file.
4114         * testsuite/ifuncvar2.c: New test file.
4115         * testsuite/ifuncvar3.c: New test file.
4116         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
4117         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
4118         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
4119         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
4120         * testsuite/Makefile.in: Rebuild.
4121
4122 2011-07-07  Cary Coutant  <ccoutant@google.com>
4123
4124         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
4125         (two_file_test_1_ndebug.o): Likewise.
4126         (two_file_test_1b_ndebug.o): Likewise.
4127         (two_file_test_2_ndebug.o): Likewise.
4128         (two_file_test_main_ndebug.o): Likewise.
4129         (incremental_test_2): Link with no-debug versions.
4130
4131 2011-07-06  Cary Coutant  <ccoutant@google.com>
4132
4133         * gold/incremental.cc
4134         (Output_section_incremental_inputs::write_info_blocks): Check for
4135         hidden and internal symbols.
4136
4137 2011-07-06  Cary Coutant  <ccoutant@google.com>
4138
4139         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
4140         Check disposition for startup file.
4141         (Incremental_inputs::report_command_line): Ignore
4142         --incremental-startup-unchanged option.
4143         * options.cc (General_options::parse_incremental_startup_unchanged):
4144         New function.
4145         (General_options::General_options): Initialize new data member.
4146         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
4147         (General_options): Add --incremental-startup-unchanged option.
4148         (General_options::incremental_startup_disposition): New function.
4149         (General_options::incremental_startup_disposition_): New data member.
4150
4151 2011-07-06  Cary Coutant  <ccoutant@google.com>
4152
4153         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
4154         input file index to Script_info ctor.
4155         (Sized_incremental_binary::do_file_has_changed): Find the
4156         command-line argument for files named in scripts.
4157         * incremental.h (Script_info::Script_info): New ctor
4158         with input file index.
4159         (Script_info::input_file_index): New function.
4160         (Script_info::input_file_index_): New data member.
4161         (Incremental_binary::get_library): Add const.
4162         (Incremental_binary::get_script_info): Add const.
4163         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
4164         * testsuite/Makefile.am (incremental_test_5): New test case.
4165         (incremental_test_6): New test case.
4166         * testsuite/Makefile.in: Regenerate.
4167
4168 2011-07-06  Cary Coutant  <ccoutant@google.com>
4169
4170         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
4171         debug output when command lines differ.
4172
4173 2011-07-06  Cary Coutant  <ccoutant@google.com>
4174
4175         * incremental.cc (Incremental_inputs::report_command_line): Ignore
4176         --incremental-patch option.
4177         * layout.cc (Free_list::allocate): Extend allocation beyond original
4178         end if enabled.
4179         (Layout::make_output_section): Mark sections that should get
4180         patch space.
4181         * options.cc (parse_percent): New function.
4182         * options.h (parse_percent): New function.
4183         (DEFINE_percent): New macro.
4184         (General_options): Add --incremental-patch option.
4185         * output.cc (Output_section::Output_section): Initialize new data
4186         members.
4187         (Output_section::add_input_section): Print section name when out
4188         of patch space.
4189         (Output_section::add_output_section_data): Likewise.
4190         (Output_section::set_final_data_size): Add patch space when
4191         doing --incremental-full.
4192         (Output_section::do_reset_address_and_file_offset): Remove patch
4193         space.
4194         (Output_segment::set_section_list_addresses): Print debug output
4195         only if --incremental-update.
4196         * output.h (Output_section::set_is_patch_space_allowed): New function.
4197         (Output_section::is_patch_space_allowed_): New data member.
4198         (Output_section::patch_space_): New data member.
4199         * parameters.cc (Parameters::incremental_full): New function.
4200         * parameters.h (Parameters::incremental_full): New function
4201         * testsuite/Makefile.am (incremental_test_2): Add test for
4202         --incremental-patch option.
4203         * testsuite/Makefile.in: Regenerate.
4204         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
4205         (t18): Remove function body.
4206
4207 2011-07-05  Doug Kwan  <dougkwan@google.com>
4208
4209         PR gold/12771
4210         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
4211         Arm_Address type for relocation result.
4212         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
4213         overflow check.
4214         (Arm_relocate_functions::abs32): Use unaligned access.
4215         (Arm_relocate_functions::rel32): Ditto.
4216         (Arm_relocate_functions::prel31): Ditto.
4217         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
4218         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
4219         static data relocations.
4220         * testsuite/Makefile.in: Regnerate.
4221         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
4222
4223 2011-07-05  Ian Lance Taylor  <iant@google.com>
4224
4225         PR gold/12392
4226         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
4227         symbols if necessary.
4228         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
4229
4230 2011-07-05  Ian Lance Taylor  <iant@google.com>
4231
4232         PR gold/12952
4233         * resolve.cc (Symbol::override_base_with_special): Simply override
4234         version with special symbol version, ignoring previous version.
4235
4236 2011-07-05  Ian Lance Taylor  <iant@google.com>
4237
4238         * object.cc (Sized_relobj_file::include_section_group): Add
4239         information to comment about signature location.
4240
4241 2011-07-02  Ian Lance Taylor  <iant@google.com>
4242
4243         PR gold/12957
4244         * options.h (class General_options): Add -f and -F.
4245         * options.cc (General_options::finalize): Fatal error if -f/-F
4246         are used without -shared.
4247         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
4248
4249 2011-07-02  Ian Lance Taylor  <iant@google.com>
4250
4251         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
4252
4253 2011-07-01  Ian Lance Taylor  <iant@google.com>
4254
4255         PR gold/12525
4256         PR gold/12952
4257         * resolve.cc (Symbol::override_base_with_special): Don't override
4258         the version if the overriding symbol has a different name.
4259         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
4260         all callers.  If we give an error about an undefined version,
4261         define the base version if necessary.
4262         * dynobj.h (class Versions): Update declaration.
4263         * testsuite/weak_alias_test_5.cc: New file.
4264         * testsuite/weak_alias_test.script: New file.
4265         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
4266         and versioned_alias have the right value, and call t2.
4267         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
4268         weak_alias_test_5.so.
4269         (weak_alias_test_LDADD): Likewise.
4270         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
4271         * testsuite/Makefile.in: Rebuild.
4272
4273 2011-07-01  Ian Lance Taylor  <iant@google.com>
4274
4275         PR gold/12525
4276         * options.h (class General_options): Support -z notext.
4277         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
4278         -Wl,-z,notext.
4279         (two_file_shared_nonpic.so): Likewise.
4280         (two_file_shared_mixed.so): Likewise.
4281         (two_file_shared_mixed_1.so): Likewise.
4282         (weak_undef_lib_nonpic.so): Likewise.
4283         (alt/weak_undef_lib_nonpic.so): Likewise.
4284         (tls_test_shared_nonpic.so): Likewise.
4285         * testsuite/Makefile.in: Rebuild.
4286
4287 2011-07-01  Ian Lance Taylor  <iant@google.com>
4288
4289         PR gold/12525
4290         * configure.ac: Test whether static linking works, setting
4291         the automake conditional HAVE_STATIC.
4292         * testsuite/Makefile.am: Disable tests using -static if
4293         HAVE_STATIC is not true.
4294         * configure, testsuite/Makefile.in: Rebuild.
4295
4296 2011-07-01  Ian Lance Taylor  <iant@google.com>
4297
4298         PR gold/12525
4299         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
4300         Assert if we see DW_EH_PE_indirect.
4301         * target.h (Target::ehframe_datarel_base): New function.
4302         (Target::do_ehframe_datarel_base): New target function.
4303         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
4304         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
4305         function.
4306
4307 2011-07-01  Ian Lance Taylor  <iant@google.com>
4308
4309         PR gold/12571
4310         * options.h (class General_options): Add
4311         --ld-generated-unwind-info.
4312         * ehframe.cc (Fde::write): Add address parameter.  Change all
4313         callers.  If associated with PLT, fill in address and size.
4314         (Cie::set_output_offset): Only add merge mapping if there is an
4315         object.
4316         (Cie::write): Add address parameter.  Change all callers.
4317         (Eh_frame::add_ehframe_for_plt): New function.
4318         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
4319         input_offset_ fields into union u_, with new plt field.
4320         (Fde::Fde): Adjust for new union field.
4321         (Fde::Fde) [Output_data version]: New constructor.
4322         (Fde::add_mapping): Only add merge mapping if there is an object.
4323         (class Cie): Update declarations.
4324         (class Eh_frame): Declare add_ehframe_for_plt.
4325         * layout.cc (Layout::layout_eh_frame): Break out code into
4326         make_eh_frame_section, and call it.
4327         (Layout::make_eh_frame_section): New function.
4328         (Layout::add_eh_frame_for_plt): New function.
4329         * layout.h (class Layout): Update declarations.
4330         * merge.cc (Merge_map::add_mapping): Add assertion.
4331         * i386.cc: Include "dwarf.h".
4332         (class Output_data_plt_i386): Make first_plt_entry,
4333         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
4334         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
4335         and plt_eh_frame_fde.
4336         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
4337         boundary.  Call add_eh_frame_for_plt if appropriate.
4338         * x86_64.cc: Include "dwarf.h".
4339         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
4340         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
4341         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
4342         and plt_eh_frame_fde.
4343         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
4344         appropriate.
4345
4346 2011-06-29  Ian Lance Taylor  <iant@google.com>
4347
4348         PR gold/12629
4349         * object.cc (Sized_relobj_file::layout_section): Change shdr
4350         parameter to be const.
4351         (Sized_relobj_file::layout_eh_frame_section): New function, broken
4352         out of do_layout.
4353         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
4354         appropriate.  Call layout_eh_frame_section.
4355         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
4356         sections.
4357         * object.h (class Sized_relobj_file): Update declarations.
4358
4359 2011-06-29  Ian Lance Taylor  <iant@google.com>
4360
4361         PR gold/12652
4362         * script.cc (Token::integer_value): Accept trailing M/m/K/k
4363         modifier.
4364         (Lex::gather_token): Accept trailing M/m/K/k for integers.
4365
4366 2011-06-29  Ian Lance Taylor  <iant@google.com>
4367
4368         PR gold/12675
4369         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
4370         SHT_X86_64_UNWIND.
4371         * layout.cc (Layout::layout_eh_frame): Likewise.
4372
4373 2011-06-29  Ian Lance Taylor  <iant@google.com>
4374
4375         PR gold/12695
4376         * layout.cc (Layout::symtab_section_shndx): New function.
4377         * layout.h (class Layout): Declare symtab_section_shndx.
4378         * output.cc (Output_section::write_header): Call it.
4379
4380 2011-06-29  Ian Lance Taylor  <iant@google.com>
4381
4382         PR gold/12818
4383         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
4384         symbols which are not used in a relocation.
4385
4386 2011-06-28  Ian Lance Taylor  <iant@google.com>
4387
4388         PR gold/12898
4389         * layout.cc (Layout::segment_precedes): Don't crash if a linker
4390         script create indistinguishable segments.
4391         (Layout::set_segment_offsets): Use stable_sort when sorting
4392         segments.  Pass this to Compare_segments constructor.
4393         * layout.h (class Layout): Make segment_precedes non-static.
4394         (class Compare_segments): Change from struct to class.  Add
4395         layout_ field.  Add constructor.
4396         * script-sections.cc
4397         (Script_sections::attach_sections_using_phdrs_clause): Rename
4398         local orphan to is_orphan.  Don't report failure to put empty
4399         section in segment.  On attachment failure, report name of
4400         section, and attach to first PT_LOAD segment.
4401
4402 2011-06-28  Ian Lance Taylor  <iant@google.com>
4403
4404         PR gold/12934
4405         * target-select.cc (Target_selector::Target_selector): Add
4406         emulation parameter.  Change all callers.
4407         (select_target_by_bfd_name): Rename from select_target_by_name.
4408         Change all callers.
4409         (select_target_by_emulation): New function.
4410         (supported_emulation_names): New function.
4411         * target-select.h (class Target_selector): Add emulation_ field.
4412         Update declarations.
4413         (Target_selector::recognize_by_bfd_name): Rename from
4414         recognize_by_name.  Change all callers.
4415         (Target_selector::supported_bfd_names): Rename from
4416         supported_names.  Change all callers.
4417         (Target_selector::recognize_by_emulation): New function.
4418         (Target_selector::supported_emulations): New function.
4419         (Target_selector::emulation): New function.
4420         (Target_selector::do_recognize_by_bfd_name): Rename from
4421         do_recognize_by_name.  Change all callers.
4422         (Target_selector::do_supported_bfd_names): Rename from
4423         do_supported_names.  Change all callers.
4424         (Target_selector::do_recognize_by_emulation): New function.
4425         (Target_selector::do_supported_emulations): New function.
4426         (select_target_by_bfd_name): Change name in declaration.
4427         (select_target_by_emulation): Declare.
4428         (supported_emulation_names): Declare.
4429         * parameters.cc (parameters_force_valid_target): Try to find
4430         target based on emulation from -m option.
4431         * options.h (class General_options): Change doc string for -m.
4432         * options.cc (help): Print emulations.
4433         (General_options::parse_V): Likewise.
4434         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
4435         Add emulation parameter.  Change all callers.
4436
4437 2011-06-28  Ian Lance Taylor  <iant@google.com>
4438
4439         * target.h (class Target): Add osabi_ field.
4440         (Target::osabi): New function.
4441         (Target::set_osabi): New function.
4442         (Target::Target): Initialize osabi_.
4443         (Target::do_adjust_elf_header): Make pure virtual.
4444         (Sized_target::do_adjust_elf_header): Declare.
4445         * target.cc (Sized_target::do_adjust_elf_header): New function.
4446         (class Sized_target): Instantiate all versions.
4447         * freebsd.h (class Target_freebsd): Remove.
4448         (Target_selector_freebsd::do_recognize): Call set_osabi on
4449         Target.
4450         (Target_selector_freebsd::do_recognize_by_name): Likewise.
4451         (Target_selector_freebsd::set_osabi): Remove.
4452         * i386.cc (class Target_i386): Inherit from Sized_target rather
4453         than Target_freebsd.
4454         * x86_64.cc (class Target_x86_64): Likewise.
4455
4456 2011-06-28  Ian Lance Taylor  <iant@google.com>
4457
4458         * target.h (Target::can_check_for_function_pointers): Rewrite.
4459         Make non-virtual.
4460         (Target::can_icf_inline_merge_sections): Likewise.
4461         (Target::section_may_have_icf_unsafe_poineters): Likewise.
4462         (Target::Target_info): Add can_icf_inline_merge_sections field.
4463         (Target::do_can_check_for_function_pointers): New virtual
4464         function.
4465         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
4466         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
4467         from can_check_for_function_pointers, move in file.
4468         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
4469         section_may_have_icf_unsafe_poineters, move in file.
4470         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
4471         * i386.cc (Target_i386::do_can_check_for_function_pointers):
4472         Rename from can_check_for_function_pointers, move in file.
4473         (Target_i386::can_icf_inline_merge_sections): Remove.
4474         (Target_i386::i386_info): Initialize
4475         can_icf_inline_merge_sections.
4476         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
4477         Initialize can_icf_inline_merge_sections.
4478         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
4479         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
4480         Rename from can_check_for_function_pointers, move in file.
4481         (Target_x86_64::can_icf_inline_merge_sections): Remove.
4482         (Target_x86_64::x86_64_info): Initialize
4483         can_icf_inline_merge_sections.
4484         * testsuite/testfile.cc (Target_test::test_target_info):
4485         Likewise.
4486         * icf.cc (get_section_contents): Correct formatting.
4487
4488 2011-06-27  Ian Lance Taylor  <iant@google.com>
4489
4490         * symtab.cc (Symbol::versioned_name): New function.
4491         (Symbol_table::add_to_final_symtab): Use versioned_name when
4492         appropriate.
4493         (Symbol_table::sized_write_symbol): Likewise.
4494         * symtab.h (class Symbol): Declare versioned_name.
4495         * stringpool.h (class Stringpool_template): Add variant of add
4496         which takes a std::basic_string.
4497         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
4498         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
4499         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
4500         (ver_test_12.o): New target.
4501         * testsuite/Makefile.in: Rebuild.
4502
4503 2011-06-27  Doug Kwan  <dougkwan@google.com>
4504
4505         * arm.cc (Arm_relocate_functions::thm_jump8,
4506         Arm_relocate_functions::thm_jump11): Use a wider signed
4507         type to compute offset.
4508         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
4509         arm_thm_jump8.
4510         * testsuite/Makefile.in: Regenerate.
4511         * testsuite/arm_branch_in_range.sh: Check test results of
4512         arm_thm_jump11 and arm_thm_jump8.
4513         * testsuite/arm_thm_jump11.s: New test source file.
4514         * testsuite/arm_thm_jump11.t: New linker script.
4515         * testsuite/arm_thm_jump8.s: New test source file.
4516         * testsuite/arm_thm_jump8.t: New linker script.
4517
4518 2011-06-24  Ian Lance Taylor  <iant@google.com>
4519
4520         * layout.cc: Include "object.h".
4521         (ctors_sections_in_init_array): New static variable.
4522         (Layout::is_ctors_in_init_array): New function.
4523         (Layout::layout): Add entry to ctors_sections_in_init_array if
4524         appropriate.
4525         * layout.h (class Layout): Declare is_ctors_in_init_array.
4526         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
4527         is_ctors_reverse_view is set.
4528         (Sized_relobj_file::write_sections): Add layout parameter.  Change
4529         all callers.  Set is_ctors_reverse_view field of View_size.
4530         (Sized_relobj_file::reverse_words): New function.
4531         * object.h (Sized_relobj_file::View_size): Add
4532         is_ctors_reverse_view field.
4533         (class Sized_relobj_file): Update declarations.
4534         * testsuite/initpri3.c: New test.
4535         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
4536         initpri3b.
4537         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
4538         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
4539         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
4540         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
4541         * testsuite/Makefile.in: Rebuild.
4542
4543 2011-06-24  Cary Coutant  <ccoutant@google.com>
4544
4545         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
4546         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
4547         (debug_msg_cdebug.err): New targets.
4548         * testsuite/Makefile.in: Regenerate.
4549         * testsuite/debug_msg.sh: Check output of link with compressed debug.
4550         Fix checks for link with shared library.
4551
4552 2011-06-24  Doug Kwan  <dougkwan@google.com>
4553
4554         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
4555         skip empty text sections.
4556         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
4557
4558 2011-06-22  Ian Lance Taylor  <iant@google.com>
4559
4560         PR gold/12910
4561         * options.h (class General_options): Add --ctors-in-init-array.
4562         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
4563         friends as SHT_PROGBITS for merging sections.
4564         (Layout::layout): Remove special handling of .init_array and
4565         friends.  Don't sort if doing relocatable link.  Sort for .ctors
4566         and .dtors if ctors_in_init_array.
4567         (Layout::make_output_section): Force correct section types for
4568         .init_array and friends.  Don't sort if doing relocatable link,
4569         Don't sort .ctors and .dtors if ctors_in_init_array.
4570         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
4571         (Layout::output_section_name): Add relobj parameter.  Change all
4572         callers.  Handle .ctors. and .dtors. in code rather than table.
4573         Handle .ctors and .dtors if ctors_in_init_array.
4574         (Layout::match_file_name): New function, moved from output.cc.
4575         * layout.h (class Layout): Update declarations.
4576         * output.cc: Include "layout.h".
4577         (Input_section_sort_entry::get_priority): New function.
4578         (Input_section_sort_entry::match_file_name): Just call
4579         Layout::match_file_name.
4580         (Output_section::Input_section_sort_init_fini_compare::operator()):
4581         Handle .ctors and .dtors.  Sort by explicit priority rather than
4582         by name.
4583         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
4584         * testsuite/initpri2.c: New test.
4585         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
4586         (check_PROGRAMS): Add initpri2.
4587         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
4588         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
4589         * configure, testsuite/Makefile.in: Rebuild.
4590
4591 2011-06-19  Ian Lance Taylor  <iant@google.com>
4592
4593         PR gold/12880
4594         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
4595         .interp section to a PT_INTERP segment even if we have seen a
4596         --dynamic-linker option.  Don't do it if we have seen a PHDRS
4597         clause in a linker script.
4598         (Layout::finalize): Don't create a .interp section if we've
4599         already create a PT_INTERP segment.
4600         (Layout::create_interp): Always call choose_output_section (revert
4601         patch of 2011-06-17).  Don't create PT_INTERP segment.
4602         * script-sections.cc
4603         (Script_sections::create_note_and_tls_segments): Add a .interp
4604         section to a PT_INTERP segment even if we have seen a
4605         --dynamic-linker option.
4606
4607 2011-06-18  Ian Lance Taylor  <iant@google.com>
4608
4609         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
4610         merely because a non-PT_LOAD segment has a dynamic reloc.
4611
4612 2011-06-18  Ian Lance Taylor  <iant@google.com>
4613
4614         * layout.cc (Layout::finish_dynamic_section): Don't create
4615         DT_FLAGS entry if not needed.
4616
4617 2011-06-18  Ian Lance Taylor  <iant@google.com>
4618
4619         PR gold/12745
4620         * layout.cc (Layout::layout_eh_frame): Correct handling of
4621         writable .eh_frame section.
4622
4623 2011-06-17  Ian Lance Taylor  <iant@google.com>
4624
4625         PR gold/12893
4626         * resolve.cc (Symbol_table::resolve): Don't give an error if a
4627         symbol is redefined with the exact same object and value.
4628
4629 2011-06-17  Ian Lance Taylor  <iant@google.com>
4630
4631         PR gold/12880
4632         * layout.h (class Layout): Add interp_segment_ field.
4633         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
4634         (Layout::attach_allocated_section_to_segment): If making shared
4635         library, put .interp section in PT_INTERP segment.
4636         (Layout::finalize): Also call create_interp if -dynamic-linker
4637         option was used.
4638         (Layout::create_interp): Assert that there is no PT_INTERP
4639         segment.  If not using a SECTIONS clause, use make_output_section.
4640         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
4641         * script-sections.cc
4642         (Script_sections::create_note_and_tls_segments): If making shared
4643         library, put .interp section in PT_INTERP segment.
4644
4645 2011-06-17  Ian Lance Taylor  <iant@google.com>
4646
4647         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
4648         when making a shared library.
4649
4650 2011-06-17  Ian Lance Taylor  <iant@google.com>
4651
4652         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
4653         parameter.  Change all callers.  Don't issue warning about PC32
4654         against locally defined symbol.
4655
4656 2011-06-16  Ian Lance Taylor  <iant@google.com>
4657
4658         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
4659         occurs in same object.
4660
4661 2011-06-14  Alan Modra  <amodra@gmail.com>
4662
4663         * po/POTFILES.in: Regenerate.
4664
4665 2011-06-09  Ian Lance Taylor  <iant@google.com>
4666
4667         * script-sections.cc
4668         (Orphan_output_section::set_section_addresses): For a relocatable
4669         link set address to 0.
4670
4671 2011-06-09  Cary Coutant  <ccoutant@google.com>
4672
4673         PR gold/12804
4674         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
4675         used with --compress-debug-sections.
4676         * gold/object.cc (Sized_relobj_file::do_layout): Report
4677         uncompressed size of compressed input sections.
4678
4679 2011-06-08  Cary Coutant  <ccoutant@google.com>
4680
4681         PR gold/12804
4682         * testsuite/two_file_test_2_v1.cc: Change initialization of
4683         v2 to keep it in .data.
4684
4685 2011-06-07  Cary Coutant  <ccoutant@google.com>
4686
4687         * common.cc (Symbol_table::do_allocate_commons_list): Call
4688         gold_fallback.
4689         * errors.cc (Errors::fatal): Adjust call to gold_exit.
4690         (Errors::fallback): New function.
4691         (gold_fallback): New function.
4692         * errors.h (Errors::fallback): New function.
4693         * gold.cc (gold_exit): Change status parameter to enum; adjust
4694         all callers.
4695         (queue_initial_tasks): Call gold_fallback.
4696         * gold.h: Include cstdlib.
4697         (Exit_status): New enum type.
4698         (gold_exit): Change status parameter to enum.
4699         (gold_fallback): New function.
4700         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
4701         (Layout::create_symtab_sections): Likewise.
4702         (Layout::create_shdrs): Likewise.
4703         * main.cc (main): Adjust call to gold_exit.
4704         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
4705         (Output_data_got::add_got_entry_pair): Likewise.
4706         (Output_section::add_input_section): Likewise.
4707         (Output_section::add_output_section_data): Likewise.
4708         (Output_segment::set_section_list_addresses): Likewise.
4709         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
4710
4711 2011-06-07  Cary Coutant  <ccoutant@google.com>
4712
4713         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
4714         for incremental links.
4715         * output.cc (Output_segment::set_section_list_addresses): Remove
4716         FIXME and test for TLS or BSS.
4717
4718 2011-06-07  Cary Coutant  <ccoutant@google.com>
4719
4720         * testsuite/Makefile.am: Add incremental_copy_test,
4721         incremental_common_test_1.
4722         * testsuite/Makefile.in: Regenerate.
4723         * testsuite/common_test_1_v1.c: New source file.
4724         * testsuite/common_test_1_v2.c: New source file.
4725         * testsuite/copy_test_v1.cc: New source file.
4726
4727 2011-06-07  Cary Coutant  <ccoutant@google.com>
4728
4729         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
4730         update, allocate common from bss section's free list.
4731         * incremental-dump.cc (dump_incremental_inputs): Print flag for
4732         linker-defined symbols.
4733         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
4734         Skip GOT and PLT entries that are no longer referenced.
4735         (Output_section_incremental_inputs::write_info_blocks): Mark
4736         linker-defined symbols.
4737         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
4738         * output.cc (Output_section::allocate): New function.
4739         * output.h (Output_section::allocate): New function.
4740         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
4741         linker-defined symbols.
4742         (Symbol::override_base_with_special): Copy is_predefined_ flag.
4743         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
4744         (Symbol::init_base_output_data): Likewise.
4745         (Symbol::init_base_output_segment): Likewise.
4746         (Symbol::init_base_constant): Likewise.
4747         (Sized_symbol::init_output_data): Likewise.
4748         (Sized_symbol::init_output_segment): Likewise.
4749         (Sized_symbol::init_constant): Likewise.
4750         (Symbol_table::do_define_in_output_data): Likewise.
4751         (Symbol_table::do_define_in_output_segment): Likewise.
4752         (Symbol_table::do_define_as_constant): Likewise.
4753         * symtab.h (Symbol::is_predefined): New function.
4754         (Symbol::init_base_output_data): Add is_predefined parameter.
4755         (Symbol::init_base_output_segment): Likewise.
4756         (Symbol::init_base_constant): Likewise.
4757         (Symbol::is_predefined_): New data member.
4758         (Sized_symbol::init_output_data): Add is_predefined parameter.
4759         (Sized_symbol::init_output_segment): Likewise.
4760         (Sized_symbol::init_constant): Likewise.
4761         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
4762
4763 2011-06-07  Cary Coutant  <ccoutant@google.com>
4764
4765         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
4766         instead of emit_copy_reloc.
4767         (Copy_relocs::emit_copy_reloc): Refactor.
4768         (Copy_relocs::make_copy_reloc): New function.
4769         (Copy_relocs::add_copy_reloc): Remove.
4770         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
4771         section.
4772         (Copy_relocs::make_copy_reloc): New function.
4773         (Copy_relocs::add_copy_reloc): Remove.
4774         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
4775         unchanged input files.
4776         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
4777         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
4778         Reserve BSS space for COPY relocations.
4779         (Sized_incremental_binary::do_emit_copy_relocs): New function.
4780         (Output_section_incremental_inputs::write_info_blocks): Record
4781         whether a symbol is copied from a shared object.
4782         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
4783         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
4784         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
4785         (Incremental_input_entry_reader::get_output_symbol_index): Add
4786         is_copy parameter.
4787         (Incremental_binary::emit_copy_relocs): New function.
4788         (Incremental_binary::do_emit_copy_relocs): New function.
4789         (Sized_incremental_binary::Sized_incremental_binary): Initialize
4790         new data member.
4791         (Sized_incremental_binary::add_copy_reloc): New function.
4792         (Sized_incremental_binary::do_emit_copy_relocs): New function.
4793         (Sized_incremental_binary::Copy_reloc): New struct.
4794         (Sized_incremental_binary::Copy_relocs): New typedef.
4795         (Sized_incremental_binary::copy_relocs_): New data member.
4796         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
4797         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
4798         * target.h (Sized_target::emit_copy_reloc): New function.
4799         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
4800
4801 2011-06-02  Cary Coutant  <ccoutant@google.com>
4802
4803         PR gold/12163
4804         * gold/archive.cc (Archive::Archive): Initialize new data member.
4805         (Archive::include_all_members): Return if archive has already been
4806         included.
4807         * gold/archive.h (Archive::include_all_members_): New data member.
4808
4809 2011-06-02  Nick Clifton  <nickc@redhat.com>
4810
4811         * dynobj.h: Fix spelling mistake in comment.
4812         * output.cc: Likewise.
4813
4814 2011-05-31  Doug Kwan  <dougkwan@google.com>
4815             Asier Llano
4816
4817         PR gold/12826
4818         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
4819         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
4820         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
4821         redundant arm_exidx_test.so.
4822         * testsuite/Makefile.in: Regenerate.
4823         (check_SCRIPTS): Add pr12826.sh
4824         (check_DATA): Add pr12826.stdout
4825         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
4826         * testsuite/pr12826.sh: New file.
4827         * testsuite/pr12826_1.s: Ditto.
4828         * testsuite/pr12826_1.s: Ditto.
4829
4830 2011-05-30  Ian Lance Taylor  <iant@google.com>
4831
4832         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
4833         sections.
4834
4835 2011-05-29  Ian Lance Taylor  <iant@google.com>
4836
4837         PR gold/12804
4838         * testsuite/Makefile.am: Use different file name for two_file_test
4839         temporary file for each incremental test.
4840         * testsuite/Makefile.in: Rebuild.
4841
4842 2011-05-29  Ian Lance Taylor  <iant@google.com>
4843
4844         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
4845         binary input file is empty.
4846
4847 2011-05-27  Ian Lance Taylor  <iant@google.com>
4848
4849         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
4850         (ver_test_9.so): Likewise.
4851         * testsuite/Makefile.in: Rebuild.
4852
4853 2011-05-26 Cary Coutant  <ccoutant@google.com>
4854
4855         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
4856         * incremental.cc (Incremental_inputs::report_input_section): Fix
4857         comment, indentation.
4858         (Incremental_inputs::report_comdat_group): New function.
4859         (Output_section_incremental_inputs::set_final_data_size): Adjust size
4860         of data for incremental input file entry.
4861         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
4862         group count, COMDAT group signatures.
4863         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
4864         an unchanged input file.
4865         * incremental.h (Incremental_object_entry::Incremental_object_entry):
4866         Initialize new data member.
4867         (Incremental_object_entry::add_comdat_group): New function.
4868         (Incremental_object_entry::get_comdat_group_count): New function.
4869         (Incremental_object_entry::get_comdat_signature_key): New function.
4870         (Incremental_object_entry::groups_): New data member.
4871         (Incremental_inputs::report_comdat_group): New function.
4872         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
4873         data for incremental input file entry.
4874         (Incremental_input_entry_reader::get_comdat_group_count): New function.
4875         (Incremental_input_entry_reader::get_input_section): Adjust size of
4876         data for incremental input file entry.
4877         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
4878         (Incremental_input_entry_reader::get_comdat_group_signature): New
4879         function.
4880         * object.cc (Sized_relobj::include_section_group): Report kept
4881         COMDAT groups for incremental links.
4882
4883 2011-05-24  David Meyer  <pdox@google.com>
4884
4885         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
4886         with name parameter.  Add found_name parameter.
4887         * fileread.cc (Input_file::find_file): Adjust code accordingly.
4888         * dirsearch.h (class Dirsearch): Update declaration.
4889
4890 2011-05-24  Ian Lance Taylor  <iant@google.com>
4891
4892         * archive.cc (Library_base::should_include_member): Pull in object
4893         from archive if it defines the entry symbol.
4894         * parameters.cc (Parameters::entry): New function.
4895         * parameters.h (class Parameters): Declare entry.
4896         * output.h (class Output_file_header): Remove entry_ field.
4897         * output.cc (Output_file_header::Output_file_header): Remove entry
4898         parameter.  Change all callers.
4899         (Output_file_header::entry): Use parameters->entry.
4900         * gold.cc (queue_middle_tasks): Likewise.
4901         * plugin.cc (Plugin_hook::run): Likewise.
4902
4903 2011-05-24 Cary Coutant  <ccoutant@google.com>
4904
4905         * gold.cc (queue_initial_tasks): Pass incremental base filename
4906         to Output_file::open_base_file; don't print error message.
4907         * incremental-dump.cc (main): Adjust call to
4908         Output_file::open_for_modification.
4909         * incremental-dump.cc (main): Likewise.
4910         * incremental.cc (Incremental_inputs::report_command_line):
4911         Ignore --incremental-base option when comparing command lines.
4912         Ignore parameter when given as separate argument.
4913         * options.h (class General_options): Add --incremental-base.
4914         * output.cc (Output_file::Output_file):
4915         (Output_file::open_base_file): Add base_name and writable parameters;
4916         read base file into new file; print error message here.
4917         (Output_file::map_no_anonymous): Add writable parameter; adjust all
4918         callers.
4919         * output.h (Output_file::open_for_modification): Rename to...
4920         (Output_file::open_base_file): ...this; add base_name and
4921         writable parameters; adjust all callers.
4922         (Output_file::map_no_anonymous): Add writable parameter; adjust all
4923         callers.
4924         * testsuite/Makefile.am (incremental_test_4): Test
4925         --incremental-base.
4926         * testsuite/Makefile.in: Regenerate.
4927
4928 2011-05-24 Cary Coutant  <ccoutant@google.com>
4929
4930         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
4931         incremental_test_4.
4932         * testsuite/Makefile.in: Regenerate.
4933         * testsuite/two_file_test_1_v1.cc: New test source file.
4934         * testsuite/two_file_test_1b_v1.cc: New test source file.
4935         * testsuite/two_file_test_2_v1.cc: New test source file.
4936
4937 2011-05-24 Cary Coutant  <ccoutant@google.com>
4938
4939         * dynobj.h (Dynobj::do_dynobj): New function.
4940         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
4941         flag and soname for shared objects.
4942         * incremental.cc (Incremental_inputs::report_object): Make
4943         either Incremental_object_entry or Incremental_dynobj_entry; add
4944         soname to string table.
4945         (Incremental_inputs::report_input_section): Add assertion.
4946         (Output_section_incremental_inputs::set_final_data_size): Adjust
4947         type of input file entry for shared libraries; adjust size of
4948         shared library info entry.
4949         (Output_section_incremental_inputs::write_input_files): Write
4950         as_needed flag for shared libraries.
4951         (Output_section_incremental_inputs::write_info_blocks): Adjust type
4952         of input file entry for shared libraries; write soname.
4953         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
4954         soname from incremental info.
4955         * incremental.h (enum Incremental_input_flags): Add
4956         INCREMENTAL_INPUT_AS_NEEDED.
4957         (Incremental_input_entry::Incremental_input_entry): Initialize new
4958         data member.
4959         (Incremental_input_entry::set_as_needed): New function.
4960         (Incremental_input_entry::as_needed): New function.
4961         (Incremental_input_entry::do_dynobj_entry): New function.
4962         (Incremental_input_entry::as_needed_): New data member.
4963         (Incremental_object_entry::Incremental_object_entry): Don't check
4964         for shared library.
4965         (Incremental_object_entry::do_type): Likewise.
4966         (class Incremental_dynobj_entry): New class.
4967         (Incremental_input_entry_reader::as_needed): New function.
4968         (Incremental_input_entry_reader::get_soname): New function.
4969         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
4970         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
4971         size of shared library info entry.
4972         * layout.cc (Layout::finish_dynamic_section): Don't test for
4973         incremental link when adding DT_NEEDED entries.
4974         * object.h (Object::Object): Initialize new data member.
4975         (Object::dynobj): New function.
4976         (Object::set_as_needed): New function.
4977         (Object::as_needed): New function.
4978         (Object::do_dynobj): New function.
4979         (Object::as_needed_): New data member.
4980
4981 2011-05-24 Cary Coutant  <ccoutant@google.com>
4982
4983         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
4984         info; adjust display of GOT entries.
4985         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
4986         vector of input objects; remove file_status_.
4987         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
4988         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
4989         got_plt reader; call target hooks to reserve GOT entries.
4990         (Output_section_incremental_inputs::set_final_data_size): Adjust size
4991         of input file info header and GOT info entry.
4992         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
4993         relocation info.
4994         (Got_plt_view_info::got_descriptor): Remove.
4995         (Got_plt_view_info::sym_index): New data member.
4996         (Got_plt_view_info::input_index): New data member.
4997         (Local_got_offset_visitor::visit): Write input file index.
4998         (Global_got_offset_visitor::visit): Write 0 for input file index.
4999         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
5000         with sym_index and input_index.
5001         (Output_section_incremental_inputs::write_got_plt): Adjust size of
5002         incremental info GOT entry; replace got_descriptor with input_index.
5003         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
5004         map from input file index to object.
5005         (Sized_relobj_incr::do_layout): Replace direct data member reference
5006         with accessor function.
5007         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
5008         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
5009         Adjust size of input file info header.
5010         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
5011         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
5012         (Incremental_input_entry_reader::get_input_section): Adjust size of
5013         input file info header.
5014         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
5015         of incremental info GOT entry.
5016         (Incremental_got_plt_reader::get_got_desc): Remove.
5017         (Incremental_got_plt_reader::get_got_symndx): New function.
5018         (Incremental_got_plt_reader::get_got_input_index): New function.
5019         (Sized_incremental_binary::Sized_incremental_binary): Remove
5020         file_status_; add input_objects_.
5021         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
5022         (Sized_incremental_binary::set_file_is_unchanged): Remove.
5023         (Sized_incremental_binary::file_is_unchanged): Remove.
5024         (Sized_incremental_binary::set_input_object): New function.
5025         (Sized_incremental_binary::input_object): New function.
5026         (Sized_incremental_binary::file_status_): Remove.
5027         (Sized_incremental_binary::input_objects_): New data member.
5028         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
5029         references.
5030         (Sized_relobj_incr::invalid_address): Move to base class.
5031         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
5032         class.
5033         (Sized_relobj_incr::do_output_section_offset): Likewise.
5034         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
5035         (Sized_relobj_incr::section_offsets_): Likewise.
5036         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
5037         function.
5038         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
5039         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
5040         with accessor function.
5041         (Sized_relobj_file::do_layout): Likewise.
5042         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
5043         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
5044         (Sized_relobj_file::compute_final_local_value): Replace refs to
5045         section_offsets_ with accessor function.
5046         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
5047         * object.h (Relobj::Relobj): Initialize new data members.
5048         (Relobj::add_dyn_reloc): New function.
5049         (Relobj::first_dyn_reloc): New function.
5050         (Relobj::dyn_reloc_count): New function.
5051         (Relobj::first_dyn_reloc_): New data member.
5052         (Relobj::dyn_reloc_count_): New data member.
5053         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
5054         references.
5055         (Sized_relobj::Address): New typedef.
5056         (Sized_relobj::invalid_address): Move here from child class.
5057         (Sized_relobj::Sized_relobj): Initialize new data members.
5058         (Sized_relobj::sized_relobj): New function.
5059         (Sized_relobj::is_output_section_offset_invalid): Move here from
5060         child class.
5061         (Sized_relobj::get_output_section_offset): Likewise.
5062         (Sized_relobj::local_has_got_offset): Likewise.
5063         (Sized_relobj::local_got_offset): Likewise.
5064         (Sized_relobj::set_local_got_offset): Likewise.
5065         (Sized_relobj::do_for_all_local_got_entries): Likewise.
5066         (Sized_relobj::clear_got_offsets): New function.
5067         (Sized_relobj::section_offsets): Move here from child class.
5068         (Sized_relobj::do_output_section_offset): Likewise.
5069         (Sized_relobj::do_set_section_offset): Likewise.
5070         (Sized_relobj::Local_got_offsets): Likewise.
5071         (Sized_relobj::local_got_offsets_): Likewise.
5072         (Sized_relobj::section_offsets_): Likewise.
5073         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
5074         references.
5075         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
5076         class.
5077         (Sized_relobj_file::sized_relobj): New function
5078         (Sized_relobj_file::local_has_got_offset): Move to base class.
5079         (Sized_relobj_file::local_got_offset): Likewise.
5080         (Sized_relobj_file::set_local_got_offset): Likewise.
5081         (Sized_relobj_file::get_output_section_offset): Likewise.
5082         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
5083         (Sized_relobj_file::do_output_section_offset): Likewise.
5084         (Sized_relobj_file::do_set_section_offset): Likewise.
5085         (Sized_relobj_file::Local_got_offsets): Likewise.
5086         (Sized_relobj_file::local_got_offsets_): Likewise.
5087         (Sized_relobj_file::section_offsets_): Likewise.
5088         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
5089         (all constructors).
5090         (set_needs_dynsym_index): Convert relobj to derived class pointer.
5091         (Output_reloc::get_symbol_index): Likewise.
5092         (Output_reloc::local_section_offset): Likewise.
5093         (Output_reloc::get_address): Likewise.
5094         (Output_reloc::symbol_value): Likewise.
5095         (Output_data_got::reserve_slot): Move to class definition.
5096         (Output_data_got::reserve_local): New function.
5097         (Output_data_got::reserve_slot_for_global): Remove.
5098         (Output_data_got::reserve_global): New function.
5099         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
5100         (all constructors, two instantiations).
5101         (Output_reloc::get_relobj): New function (two instantiations).
5102         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
5103         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
5104         (Output_data_reloc::add_global): Adjust type of relobj.
5105         (Output_data_reloc::add_global_relative): Likewise.
5106         (Output_data_reloc::add_symbolless_global_addend): Likewise.
5107         (Output_data_reloc::add_local): Likewise.
5108         (Output_data_reloc::add_local_relative): Likewise.
5109         (Output_data_reloc::add_symbolless_local_addend): Likewise.
5110         (Output_data_reloc::add_local_section): Likewise.
5111         (Output_data_reloc::add_output_section): Likewise.
5112         (Output_data_reloc::add_absolute): Likewise.
5113         (Output_data_reloc::add_target_specific): Likewise.
5114         (Output_data_got::reserve_slot): Move definition here.
5115         (Output_data_got::reserve_local): New function.
5116         (Output_data_got::reserve_global): New function.
5117         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
5118         section_offsets_ with accessor function.
5119         (Sized_relobj_file::write_sections): Likewise.
5120         (Sized_relobj_file::do_relocate_sections): Likewise.
5121         * target.h (Sized_target::reserve_local_got_entry): New function.
5122         (Sized_target::reserve_global_got_entry): New function.
5123         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
5124         (Target_x86_64::reserve_global_got_entry): New function.
5125         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
5126
5127 2011-05-23 Cary Coutant  <ccoutant@google.com>
5128
5129         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
5130         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
5131         bit when checking got_type.
5132         * incremental.cc (Sized_incremental_binary::setup_readers):
5133         Store symbol table and string table locations; initialize bit vector
5134         of file status flags.
5135         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
5136         unchanged files.
5137         (Sized_incremental_binary::do_process_got_plt): New function.
5138         (Sized_incremental_binary::get_symtab_view): Use stored locations.
5139         (Output_section_incremental_inputs::set_final_data_size): Record
5140         file index for each input file.
5141         (Output_section_incremental_inputs::write_got_plt): Store file index
5142         instead of input entry offset for each GOT entry.
5143         * incremental.h
5144         (Incremental_input_entry::Incremental_input_entry): Initialize new
5145         data member.
5146         (Incremental_input_entry::set_offset): Store file index.
5147         (Incremental_input_entry::get_file_index): New function.
5148         (Incremental_input_entry::file_index_): New data member.
5149         (Incremental_binary::process_got_plt): New function.
5150         (Incremental_binary::do_process_got_plt): New function.
5151         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
5152         data members.
5153         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
5154         (Sized_incremental_binary::set_file_is_unchanged): New function.
5155         (Sized_incremental_binary::file_is_unchanged): New function.
5156         (Sized_incremental_binary::do_process_got_plt): New function.
5157         (Sized_incremental_binary::file_status_): New data member.
5158         (Sized_incremental_binary::main_symtab_loc_): New data member.
5159         (Sized_incremental_binary::main_strtab_loc_): New data member.
5160         * output.cc (Output_data_got::Got_entry::write): Add case
5161         RESERVED_CODE.
5162         (Output_data_got::add_global): Call add_got_entry.
5163         (Output_data_got::add_global_plt): Likewise.
5164         (Output_data_got::add_global_with_rel): Likewise.
5165         (Output_data_got::add_global_with_rela): Likewise.
5166         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
5167         (Output_data_got::add_global_pair_with_rela): Likewise.
5168         (Output_data_got::add_local): Call add_got_entry.
5169         (Output_data_got::add_local_plt): Likewise.
5170         (Output_data_got::add_local_with_rel): Likewise.
5171         (Output_data_got::add_local_with_rela): Likewise.
5172         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
5173         (Output_data_got::add_local_pair_with_rela): Likewise.
5174         (Output_data_got::reserve_slot): New function.
5175         (Output_data_got::reserve_slot_for_global): New function.
5176         (Output_data_got::add_got_entry): New function.
5177         (Output_data_got::add_got_entry_pair): New function.
5178         (Output_section::add_output_section_data): Edit FIXME.
5179         * output.h
5180         (Output_section_data_build::Output_section_data_build): New
5181         constructor with size parameter.
5182         (Output_data_space::Output_data_space): Likewise.
5183         (Output_data_got::Output_data_got): Initialize new data member; new
5184         constructor with size parameter.
5185         (Output_data_got::add_constant): Call add_got_entry.
5186         (Output_data_got::reserve_slot): New function.
5187         (Output_data_got::reserve_slot_for_global): New function.
5188         (class Output_data_got::Got_entry): Add RESERVED_CODE.
5189         (Output_data_got::add_got_entry): New function.
5190         (Output_data_got::add_got_entry_pair): New function.
5191         (Output_data_got::free_list_): New data member.
5192         * target.h (Sized_target::init_got_plt_for_update): New function.
5193         (Sized_target::register_global_plt_entry): New function.
5194         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
5195         Initialize new data member; call init; add constructor with PLT count.
5196         (Output_data_plt_x86_64::init): New function.
5197         (Output_data_plt_x86_64::add_relocation): New function.
5198         (Output_data_plt_x86_64::reserve_slot): New function.
5199         (Output_data_plt_x86_64::free_list_): New data member.
5200         (Target_x86_64::init_got_plt_for_update): New function.
5201         (Target_x86_64::register_global_plt_entry): New function.
5202         (Output_data_plt_x86_64::add_entry): Allocate from free list for
5203         incremental updates.
5204         (Output_data_plt_x86_64::add_relocation): New function.
5205         * testsuite/object_unittest.cc (Object_test): Set default options.
5206
5207 2011-05-16  Ian Lance Taylor  <iant@google.com>
5208
5209         * options.h (class General_options): Make -i a synonym for -r.
5210
5211 2011-05-16  Ian Lance Taylor  <iant@google.com>
5212
5213         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
5214
5215 2011-05-10 Cary Coutant  <ccoutant@google.com>
5216
5217         * object.cc (Sized_relobj::do_count_local_symbols): Check for
5218         strip_all (-s).
5219
5220 2011-05-06  Ian Lance Taylor  <iant@google.com>
5221
5222         * layout.cc (Layout::layout): If the output section flags change,
5223         update the ordering.
5224
5225 2011-04-25 Cary Coutant  <ccoutant@google.com>
5226
5227         * incremental-dump.cc (dump_incremental_inputs): Print local
5228         symbol info for each input file.
5229         * incremental.cc
5230         (Output_section_incremental_inputs::set_final_data_size): Add local
5231         symbol info to input file entries in incremental info.
5232         (Output_section_incremental_inputs::write_info_blocks): Likewise.
5233         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
5234         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
5235         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
5236         implementation.
5237         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
5238         (Sized_incr_relobj::do_relocate): Write the local symbols.
5239         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
5240         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
5241         Adjust size of input file header.
5242         (Incremental_inputs_reader::get_local_symbol_offset): New function.
5243         (Incremental_inputs_reader::get_local_symbol_count): New function.
5244         (Incremental_inputs_reader::get_input_section): Adjust size of input
5245         file header.
5246         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
5247         (Sized_incr_relobj::This): New typedef.
5248         (Sized_incr_relobj::sym_size): New const data member.
5249         (Sized_incr_relobj::Local_symbol): New struct.
5250         (Sized_incr_relobj::do_output_local_symbol_count): New function.
5251         (Sized_incr_relobj::do_local_symbol_offset): New function.
5252         (Sized_incr_relobj::local_symbol_count_): New data member.
5253         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
5254         (Sized_incr_relobj::local_symbol_index_): New data member.
5255         (Sized_incr_relobj::local_symbol_offset_): New data member.
5256         (Sized_incr_relobj::local_dynsym_offset_): New data member.
5257         (Sized_incr_relobj::local_symbols_): New data member.
5258         * object.h (Relobj::output_local_symbol_count): New function.
5259         (Relobj::local_symbol_offset): New function.
5260         (Relobj::do_output_local_symbol_count): New function.
5261         (Relobj::do_local_symbol_offset): New function.
5262         (Sized_relobj::do_output_local_symbol_count): New function.
5263         (Sized_relobj::do_local_symbol_offset): New function.
5264
5265 2011-04-22  Vladimir Simonov  <sv@sw.ru>
5266
5267         * descriptors.cc (set_close_on_exec): New function.
5268         (Descriptors::open): Use set_close_on_exec.
5269         * output.cc (S_ISLNK): Define if not defined.
5270
5271 2011-04-22 Cary Coutant  <ccoutant@google.com>
5272
5273         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
5274         global symbol map.
5275         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
5276         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
5277         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
5278         relocations.
5279         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
5280         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
5281         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
5282         * incremental.h
5283         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
5284         function.
5285         (Incremental_binary::apply_incremental_relocs): New function.
5286         (Incremental_binary::do_apply_incremental_relocs): New function.
5287         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
5288         data member.
5289         (Sized_incremental_binary::add_global_symbol): New function.
5290         (Sized_incremental_binary::global_symbol): New function.
5291         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
5292         (Sized_incremental_binary::symbol_map_): New data member.
5293         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
5294         * target.h (Sized_target::apply_relocation): New function.
5295         * target-reloc.h (apply_relocation): New function.
5296         * x86_64.cc (Target_x86_64::apply_relocation): New function.
5297
5298 2011-04-22  Doug Kwan  <dougkwan@google.com>
5299
5300         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
5301         flag of a SHT_ARM_EXIDX section.
5302         * testsuite/Makefile.am (arm_exidx_test): New test rules.
5303         * testsuite/Makefile.in: Regenerate.
5304         * testsuite/arm_exidx_test.s: New file.
5305         * testsuite/arm_exidx_test.sh: Same.
5306
5307 2011-04-20 Cary Coutant  <ccoutant@google.com>
5308
5309         PR gold/12689
5310         * archive.h (Incremental_archive_entry::Archive_member):
5311         Initialize arg_serial_ (second constructor).
5312
5313 2011-04-17  Ian Lance Taylor  <iant@google.com>
5314
5315         * object.cc (Relocate_info::location): Simplify location string.
5316         * errors.cc (Errors::error_at_location): Don't print program
5317         name.
5318         (Errors::warning_at_location): Likewise.
5319         (Errors::undefined_symbol): Likewise.
5320         * testsuite/debug_msg.sh: Update accordingly.
5321
5322 2011-04-14 Cary Coutant  <ccoutant@google.com>
5323
5324         * gold/layout.cc (Layout::symtab_section_offset): New function.
5325         * gold/layout.h (Layout::symtab_section_offset): New function.
5326         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
5327
5328 2011-04-12  Ian Lance Taylor  <iant@google.com>
5329
5330         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
5331         with MREMAP_MAYMOVE.
5332         * output.h (class Output_file): Add map_is_allocated_ field.
5333         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
5334         not available, provide stubs.  If mremap is not available, #define
5335         it to gold_mremap.
5336         (MREMAP_MAYMOVE): Define if not defined.
5337         (Output_file::Output_file): Initialize map_is_allocated_.
5338         (Output_file::resize): Check map_is_allocated_.
5339         (Output_file::map_anonymous): If mmap fails, use malloc.
5340         (Output_file::unmap): Don't do anything for an anonymous map.
5341         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
5342         is not available, provide stubs.
5343         (File_read::View::~View): Use free rather than delete[].
5344         (File_read::make_view): Use malloc rather than new[].  If mmap
5345         fails, use malloc.
5346         (File_read::find_or_make_view): Use malloc rather than new[].
5347         * gold.h: Remove HAVE_REMAP code.
5348         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
5349         exists.  Rename mremap to gold_mremap.  If mmap is not available
5350         don't do anything.
5351         * configure, config.in: Rebuild.
5352
5353 2011-04-11  Ian Lance Taylor  <iant@google.com>
5354
5355         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
5356         initialize local variable v.
5357
5358 2011-04-11  Cary Coutant  <ccoutant@google.com>
5359
5360         * archive.cc (Archive::include_member): Adjust call to
5361         report_object.
5362         (Add_archive_symbols::run): Track argument serial numbers.
5363         (Lib_group::include_member): Likewise.
5364         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
5365         * archive.h (Incremental_archive_entry::Archive_member):
5366         Initialize arg_serial_.
5367         (Archive_member::arg_serial_): New data member.
5368         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
5369         (Sized_dynobj::do_add_symbols): Track symbols when doing an
5370         incremental link.
5371         (Sized_dynobj::do_for_all_local_got_entries): New function.
5372         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
5373         function.
5374         * fileread.cc (get_mtime): New function.
5375         * fileread.h (get_mtime): New function.
5376         * gold.cc (queue_initial_tasks): Check for incremental update.
5377         (process_incremental_input): New function.
5378         (queue_middle_tasks): Don't force valid target for incremental
5379         update.
5380         * incremental-dump.cc (find_input_containing_global): Adjust
5381         size of symbol info entry.
5382         (dump_incremental_inputs): Dump argument serial number and
5383         in_system_directory flag; bias shndx by 1; print symbol names
5384         when dumping per-file symbol lists; use new symbol info readers.
5385         * incremental.cc
5386         (Output_section_incremental_inputs:update_data_size): New function.
5387         (Sized_incremental_binary::setup_readers): Setup input readers
5388         for each input file; build maps for files added from libraries
5389         and scripts.
5390         (Sized_incremental_binary::check_input_args): New function.
5391         (Sized_incremental_binary::do_check_inputs): Build map of argument
5392         serial numbers to input arguments.
5393         (Sized_incremental_binary::do_file_has_changed): Rename
5394         do_file_is_unchanged to this; compare file modification times.
5395         (Sized_incremental_binary::do_init_layout): New function.
5396         (Sized_incremental_binary::do_reserve_layout): New function.
5397         (Sized_incremental_binary::do_get_input_reader): Remove.
5398         (Sized_incremental_binary::get_symtab_view): New function.
5399         (Incremental_checker::can_incrementally_link_output_file): Remove.
5400         (Incremental_inputs::report_command_line): Exclude --debug options.
5401         (Incremental_inputs::report_archive_begin): Add parameter; track
5402         argument serial numbers; don't put input file entry for archive
5403         before archive members.
5404         (Incremental_inputs::report_archive_end): Put input file entry
5405         for archive after archive members.
5406         (Incremental_inputs::report_object): Add parameter; track argument
5407         serial numbers and in_system_directory flag.
5408         (Incremental_inputs::report_script): Add parameter; track argument
5409         serial numbers.
5410         (Output_section_incremental_inputs::set_final_data_size): Adjust
5411         size of symbol info entry; check for forwarding symbols.
5412         (Output_section_incremental_inputs::write_input_files): Write
5413         in_system_directory flag and argument serial number.
5414         (Output_section_incremental_inputs::write_info_blocks): Map section
5415         indices between incremental info and original input file; store
5416         input section index for each symbol.
5417         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
5418         change operator() to visit().
5419         (class Global_got_offset_visitor): Likewise.
5420         (class Global_symbol_visitor_got_plt):
5421         (Output_section_incremental_inputs::write_got_plt): Use new visitor
5422         classes.
5423         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
5424         (Sized_incr_relobj::do_read_symbols): New function.
5425         (Sized_incr_relobj::do_layout): New function.
5426         (Sized_incr_relobj::do_layout_deferred_sections): New function.
5427         (Sized_incr_relobj::do_add_symbols): New function.
5428         (Sized_incr_relobj::do_should_include_member): New function.
5429         (Sized_incr_relobj::do_for_all_global_symbols): New function.
5430         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
5431         (Sized_incr_relobj::do_section_size): New function.
5432         (Sized_incr_relobj::do_section_name): New function.
5433         (Sized_incr_relobj::do_section_contents): New function.
5434         (Sized_incr_relobj::do_section_flags): New function.
5435         (Sized_incr_relobj::do_section_entsize): New function.
5436         (Sized_incr_relobj::do_section_address): New function.
5437         (Sized_incr_relobj::do_section_type): New function.
5438         (Sized_incr_relobj::do_section_link): New function.
5439         (Sized_incr_relobj::do_section_info): New function.
5440         (Sized_incr_relobj::do_section_addralign): New function.
5441         (Sized_incr_relobj::do_initialize_xindex): New function.
5442         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
5443         (Sized_incr_relobj::do_read_relocs): New function.
5444         (Sized_incr_relobj::do_gc_process_relocs): New function.
5445         (Sized_incr_relobj::do_scan_relocs): New function.
5446         (Sized_incr_relobj::do_count_local_symbols): New function.
5447         (Sized_incr_relobj::do_finalize_local_symbols): New function.
5448         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
5449         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
5450         (Sized_incr_relobj::do_relocate): New function.
5451         (Sized_incr_relobj::do_set_section_offset): New function.
5452         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
5453         (Sized_incr_dynobj::do_read_symbols): New function.
5454         (Sized_incr_dynobj::do_layout): New function.
5455         (Sized_incr_dynobj::do_add_symbols): New function.
5456         (Sized_incr_dynobj::do_should_include_member): New function.
5457         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
5458         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
5459         (Sized_incr_dynobj::do_section_size): New function.
5460         (Sized_incr_dynobj::do_section_name): New function.
5461         (Sized_incr_dynobj::do_section_contents): New function.
5462         (Sized_incr_dynobj::do_section_flags): New function.
5463         (Sized_incr_dynobj::do_section_entsize): New function.
5464         (Sized_incr_dynobj::do_section_address): New function.
5465         (Sized_incr_dynobj::do_section_type): New function.
5466         (Sized_incr_dynobj::do_section_link): New function.
5467         (Sized_incr_dynobj::do_section_info): New function.
5468         (Sized_incr_dynobj::do_section_addralign): New function.
5469         (Sized_incr_dynobj::do_initialize_xindex): New function.
5470         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
5471         (make_sized_incremental_object): New function.
5472         (Incremental_library::copy_unused_symbols): New function.
5473         (Incremental_library::do_for_all_unused_symbols): New function.
5474         * incremental.h (enum Incremental_input_flags): New type.
5475         (class Incremental_checker): Remove.
5476         (Incremental_input_entry::Incremental_input_entry): Add argument
5477         serial number.
5478         (Incremental_input_entry::arg_serial): New function.
5479         (Incremental_input_entry::set_is_in_system_directory): New function.
5480         (Incremental_input_entry::is_in_system_directory): New function.
5481         (Incremental_input_entry::arg_serial_): New data member.
5482         (Incremental_input_entry::is_in_system_directory_): New data member.
5483         (class Script_info): Move here from script.h.
5484         (Script_info::Script_info): Add filename parameter.
5485         (Script_info::filename): New function.
5486         (Script_info::filename_): New data member.
5487         (Incremental_script_entry::Incremental_script_entry): Add argument
5488         serial number.
5489         (Incremental_object_entry::Incremental_object_entry): Likewise.
5490         (Incremental_object_entry::add_input_section): Build list of input
5491         sections with map to original shndx.
5492         (Incremental_object_entry::get_input_section_index): New function.
5493         (Incremental_object_entry::shndx_): New data member.
5494         (Incremental_object_entry::name_key_): Rename; adjust all refs.
5495         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
5496         (Incremental_archive_entry::Incremental_archive_entry): Add argument
5497         serial number.
5498         (Incremental_inputs::report_archive_begin): Likewise.
5499         (Incremental_inputs::report_object): Likewise.
5500         (Incremental_inputs::report_script): Likewise.
5501         (class Incremental_global_symbol_reader): New class.
5502         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
5503         and store flags and input file type.
5504         (Incremental_input_entry_reader::arg_serial): New function.
5505         (Incremental_input_entry_reader::type): Extract type from flags.
5506         (Incremental_input_entry_reader::is_in_system_directory): New function.
5507         (Incremental_input_entry_reader::get_input_section_count): Call
5508         accessor function for type.
5509         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
5510         function for type; adjust size of global symbol entry.
5511         (Incremental_input_entry_reader::get_global_symbol_count): Call
5512         accessor function for type.
5513         (Incremental_input_entry_reader::get_object_count): Likewise.
5514         (Incremental_input_entry_reader::get_object_offset): Likewise.
5515         (Incremental_input_entry_reader::get_member_count): Likewise.
5516         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
5517         (Incremental_input_entry_reader::get_member_offset): Likewise.
5518         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
5519         (Incremental_input_entry_reader::Global_symbol_info): Remove.
5520         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
5521         (Incremental_input_entry_reader::get_global_symbol_reader): New
5522         function.
5523         (Incremental_input_entry_reader::get_output_symbol_index): New
5524         function.
5525         (Incremental_input_entry_reader::type_): Remove.
5526         (Incremental_input_entry_reader::flags_): New data member.
5527         (Incremental_inputs_reader::input_file_offset): New function.
5528         (Incremental_inputs_reader::input_file_index): New function.
5529         (Incremental_inputs_reader::input_file): Call input_file_offset.
5530         (Incremental_inputs_reader::input_file_at_offset): New function.
5531         (Incremental_relocs_reader::get_r_type): Reformat.
5532         (Incremental_relocs_reader::get_r_shndx): Reformat.
5533         (Incremental_relocs_reader::get_r_offset): Reformat.
5534         (Incremental_relocs_reader::data): New function.
5535         (Incremental_binary::Incremental_binary): Initialize new data members.
5536         (Incremental_binary::check_inputs): Add cmdline parameter.
5537         (Incremental_binary::file_is_unchanged): Remove.
5538         (Input_reader::arg_serial): New function.
5539         (Input_reader::get_unused_symbol_count): New function.
5540         (Input_reader::get_unused_symbol): New function.
5541         (Input_reader::do_arg_serial): New function.
5542         (Input_reader::do_get_unused_symbol_count): New function.
5543         (Input_reader::do_get_unused_symbol): New function.
5544         (Incremental_binary::input_file_count): New function.
5545         (Incremental_binary::get_input_reader): Change signature to use
5546         index instead of filename.
5547         (Incremental_binary::file_has_changed): New function.
5548         (Incremental_binary::get_input_argument): New function.
5549         (Incremental_binary::get_library): New function.
5550         (Incremental_binary::get_script_info): New function.
5551         (Incremental_binary::init_layout): New function.
5552         (Incremental_binary::reserve_layout): New function.
5553         (Incremental_binary::output_file): New function.
5554         (Incremental_binary::do_check_inputs): New function.
5555         (Incremental_binary::do_file_is_unchanged): Remove.
5556         (Incremental_binary::do_file_has_changed): New function.
5557         (Incremental_binary::do_init_layout): New function.
5558         (Incremental_binary::do_reserve_layout): New function.
5559         (Incremental_binary::do_input_file_count): New function.
5560         (Incremental_binary::do_get_input_reader): Change signature.
5561         (Incremental_binary::input_args_map_): New data member.
5562         (Incremental_binary::library_map_): New data member.
5563         (Incremental_binary::script_map_): New data member.
5564         (Sized_incremental_binary::Sized_incremental_binary): Initialize
5565         new data members.
5566         (Sized_incremental_binary::output_section): New function.
5567         (Sized_incremental_binary::inputs_reader): Add const.
5568         (Sized_incremental_binary::symtab_reader): Add const.
5569         (Sized_incremental_binary::relocs_reader): Add const.
5570         (Sized_incremental_binary::got_plt_reader): Add const.
5571         (Sized_incremental_binary::get_symtab_view): New function.
5572         (Sized_incremental_binary::Inputs_reader): New typedef.
5573         (Sized_incremental_binary::Input_entry_reader): New typedef.
5574         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
5575         (Sized_incremental_binary::do_file_is_unchanged): Remove.
5576         (Sized_incremental_binary::do_file_has_changed): New function.
5577         (Sized_incremental_binary::do_init_layout): New function.
5578         (Sized_incremental_binary::do_reserve_layout): New function.
5579         (Sized_input_reader::Inputs_reader): Remove.
5580         (Sized_input_reader::Input_entry_reader): Remove.
5581         (Sized_input_reader::do_arg_serial): New function.
5582         (Sized_input_reader::do_get_unused_symbol_count): New function.
5583         (Sized_input_reader::do_get_unused_symbol): New function.
5584         (Sized_incremental_binary::do_input_file_count): New function.
5585         (Sized_incremental_binary::do_get_input_reader): Change signature;
5586         use index instead of filename.
5587         (Sized_incremental_binary::section_map_): New data member.
5588         (Sized_incremental_binary::input_entry_readers_): New data member.
5589         (class Sized_incr_relobj): New class.
5590         (class Sized_incr_dynobj): New class.
5591         (make_sized_incremental_object): New function.
5592         (class Incremental_library): New class.
5593         * layout.cc (Free_list::num_lists): New static data member.
5594         (Free_list::num_nodes): New static data member.
5595         (Free_list::num_removes): New static data member.
5596         (Free_list::num_remove_visits): New static data member.
5597         (Free_list::num_allocates): New static data member.
5598         (Free_list::num_allocate_visits): New static data member.
5599         (Free_list::init): New function.
5600         (Free_list::remove): New function.
5601         (Free_list::allocate): New function.
5602         (Free_list::dump): New function.
5603         (Free_list::print_stats): New function.
5604         (Layout_task_runner::run): Resize output file for incremental updates.
5605         (Layout::Layout): Initialize new data members.
5606         (Layout::set_incremental_base): New function.
5607         (Layout::init_fixed_output_section): New function.
5608         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
5609         incremental updates.
5610         (Layout::create_gold_note): Do not create gold note section for
5611         incremental updates.
5612         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
5613         for incremental updates.
5614         (Layout::set_section_offsets): For incremental updates, allocate space
5615         from free list.
5616         (Layout::create_symtab_sections): Layout with offsets relative to
5617         start of section; for incremental updates, allocate space from free
5618         list.
5619         (Layout::create_shdrs): For incremental updates, allocate space from
5620         free list.
5621         (Layout::finish_dynamic_section): For incremental updates, do not
5622         check --as-needed (fixed in subsequent patch).
5623         * layout.h (class Free_list): New class.
5624         (Layout::set_incremental_base): New function.
5625         (Layout::incremental_base): New function.
5626         (Layout::init_fixed_output_section): New function.
5627         (Layout::allocate): New function.
5628         (Layout::incremental_base_): New data member.
5629         (Layout::free_list_): New data member.
5630         * main.cc (main): Print Free_list statistics.
5631         * object.cc (Relobj::finalize_incremental_relocs): Add
5632         clear_counts parameter; clear counts only when clear_counts is set.
5633         (Sized_relobj::Sized_relobj): Initialize new base class.
5634         (Sized_relobj::do_layout): Don't report special sections.
5635         (Sized_relobj::do_for_all_local_got_entries): New function.
5636         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
5637         symtab_off to all symbol table offsets.
5638         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
5639         * object.h (class Got_offset_list): Move to top of file.
5640         (Object::Object): Allow case where input_file == NULL.
5641         (Object::~Object): Likewise.
5642         (Object::input_file): Assert that input_file != NULL.
5643         (Object::lock): Allow case where input_file == NULL.
5644         (Object::unlock): Likewise.
5645         (Object::is_locked): Likewise.
5646         (Object::token): Likewise.
5647         (Object::release): Likewise.
5648         (Object::is_incremental): New function.
5649         (Object::get_mtime): New function.
5650         (Object::for_all_local_got_entries): New function.
5651         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
5652         (Object::set_is_in_system_directory): New function.
5653         (Object::is_in_system_directory): New function.
5654         (Object::do_is_incremental): New function.
5655         (Object::do_get_mtime): New function.
5656         (Object::do_for_all_local_got_entries): New function.
5657         (Object::is_in_system_directory_): New data member.
5658         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
5659         (class Sized_relobj_base): New class.
5660         (class Sized_relobj): Derive from Sized_relobj_base.
5661         (class Sized_relobj::Symbols): Redeclare from base class.
5662         (class Sized_relobj::local_got_offset_list): Remove.
5663         (class Sized_relobj::Output_sections): Redeclare from base class.
5664         (class Sized_relobj::do_for_all_local_got_entries): New function.
5665         (class Sized_relobj::write_local_symbols): Add offset parameter.
5666         (class Sized_relobj::local_symbol_offset_): Update comment.
5667         (class Sized_relobj::local_dynsym_offset_): Update comment.
5668         * options.cc (Input_arguments::add_file): Remove const.
5669         * options.h (Input_file_argument::Input_file_argument):
5670         Initialize arg_serial_ (all constructors).
5671         (Input_file_argument::set_arg_serial): New function.
5672         (Input_file_argument::arg_serial): New function.
5673         (Input_file_argument::arg_serial_): New data member.
5674         (Input_arguments::Input_arguments): Initialize file_count_.
5675         (Input_arguments::add_file): Remove const.
5676         (Input_arguments::number_of_input_files): New function.
5677         (Input_arguments::file_count_): New data member.
5678         (Command_line::number_of_input_files): Call
5679         Input_arguments::number_of_input_files.
5680         * output.cc (Output_segment_headers::Output_segment_headers):
5681         Set current size.
5682         (Output_section::Input_section::current_data_size): New function.
5683         (Output_section::Output_section): Initialize new data members.
5684         (Output_section::add_input_section): Don't do merge sections for
5685         an incremental link; allocate space from free list for an
5686         incremental update.
5687         (Output_section::add_output_section_data): Allocate space from
5688         free list for an incremental update.
5689         (Output_section::update_data_size): New function.
5690         (Output_section::set_fixed_layout): New function.
5691         (Output_section::reserve): New function.
5692         (Output_segment::set_section_addresses): Remove const.
5693         (Output_segment::set_section_list_addresses): Remove const; allocate
5694         space from free list for an incremental update.
5695         (Output_segment::set_offset): Adjust size of RELRO segment for an
5696         incremental update.
5697         * output.h (Output_data::current_data_size): Move here from
5698         child classes.
5699         (Output_data::pre_finalize_data_size): New function.
5700         (Output_data::update_data_size): New function.
5701         (Output_section_headers::update_data_size): new function.
5702         (Output_section_data_build::current_data_size): Move to Output_data.
5703         (Output_data_strtab::update_data_size): New function.
5704         (Output_section::current_data_size): Move to Output_data.
5705         (Output_section::set_fixed_layout): New function.
5706         (Output_section::has_fixed_layout): New function.
5707         (Output_section::reserve): New function.
5708         (Output_section::update_data_size): New function.
5709         (Output_section::has_fixed_layout_): New data member.
5710         (Output_section::free_list_): New data member.
5711         (Output_segment::set_section_addresses): Remove const.
5712         (Output_segment::set_section_list_addresses): Remove const.
5713         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
5714         New function.
5715         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
5716         New function.
5717         * readsyms.cc (Read_symbols::do_read_symbols): Add library
5718         parameter when calling Add_symbols constructor; store argument
5719         serial number for members of a lib group.
5720         (Add_symbols::locks): Allow case where token == NULL.
5721         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
5722         (Read_member::~Read_member): New function.
5723         (Read_member::is_runnable): New function.
5724         (Read_member::locks): New function.
5725         (Read_member::run): New function.
5726         (Check_script::~Check_script): New function.
5727         (Check_script::is_runnable): New function.
5728         (Check_script::locks): New function.
5729         (Check_script::run): New function.
5730         (Check_library::~Check_library): New function.
5731         (Check_library::is_runnable): New function.
5732         (Check_library::locks): New function.
5733         (Check_library::run): New function.
5734         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
5735         (Add_symbols::library_): New data member.
5736         (class Read_member): New class.
5737         (class Check_script): New class.
5738         (class Check_library): New class.
5739         * reloc.cc (Read_relocs::is_runnable): Allow case where
5740         token == NULL.
5741         (Read_relocs::locks): Likewise.
5742         (Scan_relocs::locks): Likewise.
5743         (Relocate_task::locks): Likewise.
5744         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
5745         to clear counters.
5746         (Sized_relobj::incremental_relocs_scan): Fix comment.
5747         (Sized_relobj::do_relocate): Pass output file offset to
5748         write_local_symbols.
5749         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
5750         from class declaration.
5751         * script.cc (read_input_script): Allocate Script_info; pass
5752         argument serial number to report_script.
5753         * script.h (class Script_info): Move to incremental.h.
5754         * symtab.cc (Symbol_table::add_from_incrobj): New function.
5755         * symtab.h (Symbol_table::add_from_incrobj): New function.
5756         (Symbol_table::set_file_offset): New function.
5757
5758 2011-04-05  Cary Coutant  <ccoutant@google.com>
5759
5760         * incremental-dump.cc (dump_incremental_inputs): Change signature
5761         to take a Sized_incremental_binary; change caller.  Use readers
5762         in Sized_incremental_binary.
5763         * incremental.cc
5764         (Sized_incremental_binary::find_incremental_inputs_sections):
5765         Rename do_find_incremental_inputs_sections to this.
5766         (Sized_incremental_binary::setup_readers): New function.
5767         (Sized_incremental_binary::do_check_inputs): Check
5768         has_incremental_info_ flag; move setup code to setup_readers;
5769         use input readers.
5770         (Sized_incremental_binary::do_file_is_unchanged): New function.
5771         (Sized_incremental_binary::do_get_input_reader): New function.
5772         * incremental.h (class Incremental_binary): Move to end of file.
5773         (Incremental_binary::file_is_unchanged): New function.
5774         (Incremental_binary::do_file_is_unchanged): New function.
5775         (Incremental_binary::Input_reader): New class.
5776         (Incremental_binary::get_input_reader): New function.
5777         (class Sized_incremental_binary): Move to end of file.
5778         (Sized_incremental_binary::Sized_incremental_binary): Setup the
5779         input section reader classes.
5780         (Sized_incremental_binary::has_incremental_info): New function.
5781         (Sized_incremental_binary::inputs_reader): New function.
5782         (Sized_incremental_binary::symtab_reader): New function.
5783         (Sized_incremental_binary::relocs_reader): New function.
5784         (Sized_incremental_binary::got_plt_reader): New function.
5785         (Sized_incremental_binary::do_file_is_unchanged): New function.
5786         (Sized_incremental_binary::Sized_input_reader): New class.
5787         (Sized_incremental_binary::get_input_reader): New function.
5788         (Sized_incremental_binary::find_incremental_inputs_sections):
5789         Rename do_find_incremental_inputs_sections to this.
5790         (Sized_incremental_binary::setup_readers): New function.
5791         (Sized_incremental_binary::has_incremental_info_): New data member.
5792         (Sized_incremental_binary::inputs_reader_): New data member.
5793         (Sized_incremental_binary::symtab_reader_): New data member.
5794         (Sized_incremental_binary::relocs_reader_): New data member.
5795         (Sized_incremental_binary::got_plt_reader_): New data member.
5796         (Sized_incremental_binary::current_input_file_): New data member.
5797
5798 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
5799
5800         PR gold/12640
5801         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
5802         violation.
5803
5804 2011-03-30  Cary Coutant  <ccoutant@google.com>
5805
5806         * archive.cc (Archive::include_member): Adjust call to report_object.
5807         (Add_archive_symbols::run): Add script_info to call to
5808         report_archive_begin.
5809         (Lib_group::include_member): Adjust call to report_object.
5810         (Add_lib_group_symbols::run): Adjust call to report_object.
5811         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
5812         blocks.  Add object count for script input files.
5813         * incremental.cc (Incremental_inputs::report_archive_begin): Add
5814         script_info parameter; change all callers.
5815         (Incremental_inputs::report_object): Add script_info parameter;
5816         change all callers.
5817         (Incremental_inputs::report_script): Store backpointer to
5818         incremental info entry.
5819         (Output_section_incremental_inputs::set_final_data_size): Record
5820         additional information for scripts.
5821         (Output_section_incremental_inputs::write_info_blocks): Likewise.
5822         * incremental.h (Incremental_script_entry::add_object): New function.
5823         (Incremental_script_entry::get_object_count): New function.
5824         (Incremental_script_entry::get_object): New function.
5825         (Incremental_script_entry::objects_): New data member; adjust
5826         constructor.
5827         (Incremental_inputs::report_archive_begin): Add script_info parameter.
5828         (Incremental_inputs::report_object): Add script_info parameter.
5829         (Incremental_inputs_reader::get_object_count): New function.
5830         (Incremental_inputs_reader::get_object_offset): New function.
5831         * options.cc (Input_arguments::add_file): Return reference to
5832         new input argument.
5833         * options.h (Input_argument::set_script_info): New function.
5834         (Input_argument::script_info): New function.
5835         (Input_argument::script_info_): New data member; adjust all
5836         constructors.
5837         (Input_file_group::add_file): Return reference to new input argument.
5838         (Input_file_lib::add_file): Likewise.
5839         (Input_arguments::add_file): Likewise.
5840         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
5841         * script.cc (Parser_closure::Parser_closure): Add script_info
5842         parameter; adjust all callers.
5843         (Parser_closure::script_info): New function.
5844         (Parser_closure::script_info_): New data member.
5845         (read_input_script): Report scripts earlier to incremental info.
5846         (script_add_file): Set script_info in Input_argument.
5847         (script_add_library): Likewise.
5848         * script.h (Script_options::Script_info): Rewrite class.
5849
5850 2011-03-29  Cary Coutant  <ccoutant@google.com>
5851
5852         * archive.cc (Library_base::should_include_member): Move
5853         method here from class Archive.
5854         (Archive::Archive): Initialize base class.
5855         (Archive::should_include_member): Move to base class.
5856         (Archive::do_for_all_unused_symbols): New function.
5857         (Add_archive_symbols::run): Remove redundant access to
5858         incremental_inputs.
5859         (Lib_group::Lib_group): Initialize base class.
5860         (Lib_group::do_filename): New function.
5861         (Lib_group::include_member): Pass pointer to Lib_group to
5862         report_object.
5863         (Lib_group::do_for_all_unused_symbols): New function.
5864         (Add_lib_group_symbols::run): Report archive information for
5865         incremental links.
5866         * archive.h (class Library_base): New base class.
5867         (class Archive): Derive from Library_base.
5868         (Archive::filename): Move to base class.
5869         (Archive::set_incremental_info): Likewise.
5870         (Archive::incremental_info): Likewise.
5871         (Archive::Should_include): Likewise.
5872         (Archive::should_include_member): Likewise.
5873         (Archive::Armap_entry): Remove.
5874         (Archive::Unused_symbol_iterator): Remove.
5875         (Archive::unused_symbols_begin): Remove.
5876         (Archive::unused_symbols_end): Remove.
5877         (Archive::do_filename): New function.
5878         (Archive::do_get_mtime): New function.
5879         (Archive::do_for_all_unused_symbols): New function.
5880         (Archive::task_): Move to base class.
5881         (Archive::incremental_info_): Likewise.
5882         (class Lib_group): Derive from Library_base.
5883         (Lib_group::do_filename): New function.
5884         (Lib_group::do_get_mtime): New function.
5885         (Lib_group::do_for_all_unused_symbols): New function.
5886         (Lib_group::task_): Move to base class.
5887         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
5888         function.
5889         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
5890         function.
5891         * incremental.cc (Incremental_inputs::report_archive_begin):
5892         Use Library_base; call library's get_mtime; add incremental inputs
5893         entry before members.
5894         (class Unused_symbol_visitor): New class.
5895         (Incremental_inputs::report_archive_end): Use Library_base; use
5896         visitor class to record unused symbols; don't add incremental inputs
5897         entry after members.
5898         (Incremental_inputs::report_object): Use Library_base.
5899         * incremental.h
5900         (Incremental_archive_entry::Incremental_archive_entry): Remove
5901         unused Archive parameter.
5902         (Incremental_inputs::report_archive_begin): Use Library_base.
5903         (Incremental_inputs::report_archive_end): Likewise.
5904         (Incremental_inputs::report_object): Likewise.
5905         * object.cc (Sized_relobj::do_for_all_global_symbols): New
5906         function.
5907         * object.h (Object::for_all_global_symbols): New function.
5908         (Object::do_for_all_global_symbols): New function.
5909         (Sized_relobj::do_for_all_global_symbols): New function.
5910         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
5911         function.
5912         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
5913         function.
5914
5915 2011-03-27  Ian Lance Taylor  <iant@google.com>
5916
5917         * archive.cc (Archive::interpret_header): Return -1 if something
5918         goes wrong.  Change callers accordingly.
5919
5920 2011-03-25  Cary Coutant  <ccoutant@google.com>
5921
5922         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
5923         * testsuite/Makefile.in: Regenerate.
5924
5925 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
5926
5927         * plugin.cc (get_view): New.
5928         (Plugin::load): Pass get_view to the plugin.
5929         (Plugin_manager::get_view): New.
5930
5931 2011-03-21  Ian Lance Taylor  <iant@google.com>
5932
5933         * testsuite/final_layout.sh: Rewrite to not use dc.
5934         * testsuite/relro_test.sh: Fail if dc is not present.
5935
5936 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
5937
5938         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
5939         Change == to -eq.
5940         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
5941         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
5942         Change == to -eq.
5943         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
5944         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
5945
5946 2011-03-14  Ian Lance Taylor  <iant@google.com>
5947
5948         * script-sections.cc (Sort_output_sections::script_compare):
5949         Rename from is_before, change return type.
5950         (Sort_output_sections::operator()): Adjust accordingly.
5951
5952 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
5953
5954         PR gold/12572
5955         * testsuite/odr_violation2.cc: Add comment to make all error line
5956         numbers double digits.
5957         * testsuite/debug_msg.sh: Adjust expected errors.
5958
5959 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
5960
5961         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
5962         but mark earlier ones as non-canonical
5963         (offset_to_iterator): Update search target and example
5964         (do_addr2line): Return extra lines in a vector*
5965         (format_file_lineno): Extract from do_addr2line
5966         (one_addr2line): Add vector* out-param
5967         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
5968         when a lineno entry appeared last for its instruction
5969         (Dwarf_line_info): Add vector* out-param
5970         * object.cc (Relocate_info): Pass NULL for the vector* out-param
5971         * symtab.cc (Odr_violation_compare): Include the lineno in the
5972         comparison again.
5973         (linenos_from_loc): New. Combine the canonical line for an
5974         address with its other lines.
5975         (True_if_intersect): New. Helper functor to make
5976         std::set_intersection a query.
5977         (detect_odr_violations): Compare sets of lines instead of just
5978         one line for each function. This became less deterministic, but
5979         has fewer false positives.
5980         * symtab.h: Declarations.
5981         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
5982         mix an optimized and non-optimized object in the same binary
5983         (odr_violation2.so): Same.
5984         * testsuite/Makefile.in: Regenerate from Makefile.am.
5985         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
5986         * testsuite/debug_msg.sh: Update line numbers and add
5987         assertions.
5988         * testsuite/odr_violation1.cc: Use OdrDerived, in a
5989         non-optimized context.
5990         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
5991         isn't inlined, and use OdrDerived in an optimized context.
5992         * testsuite/odr_header1.h: Defines OdrDerived, where
5993         optimization will change the
5994         first-instruction-in-the-destructor's file and line number.
5995         * testsuite/odr_header2.h: Defines OdrBase.
5996
5997 2011-03-09  Ian Lance Taylor  <iant@google.com>
5998
5999         * fileread.cc (File_read::clear_views): Don't delete the whole
6000         file view.
6001
6002 2011-03-08  Ian Lance Taylor  <iant@google.com>
6003
6004         PR gold/12525
6005         * fileread.cc: #include <climits>.
6006         (GOLD_IOV_MAX): Define.
6007         (File_read::read_multiple): Limit number of entries by iov_max.
6008         * fileread.h (class File_read): Always set max_readv_entries to
6009         128.
6010
6011 2011-03-07  Ian Lance Taylor  <iant@google.com>
6012
6013         PR gold/12525
6014         * options.h (class General_options): Add -dy and -dn.
6015
6016 2011-03-02  Cary Coutant  <ccoutant@google.com>
6017
6018         * testsuite/script_test_9.t: Add TLS segment.
6019
6020 2011-03-02  Simon Baldwin  <simonb@google.com>
6021
6022         * configure.ac: Add check for gnu_indirect_function support in
6023         the toolchain building binutils.
6024         * configure: Rebuild.
6025
6026 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
6027
6028         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
6029         plugin only symbols.
6030         (Symbol_table::sized_finalize_symbol) Mark symbol only present
6031         in plugin files as not needed in the symbol table.
6032
6033 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
6034
6035         * output.cc (Output_section::add_input_section): Delay fill
6036         generation for section ordering.
6037
6038 2011-02-09  Ian Lance Taylor  <iant@google.com>
6039
6040         PR gold/12316
6041         * object.h (class Sized_relobj): Remove clear_local_symbols.
6042         * reloc.cc (Sized_relobj::do_relocate): Don't call
6043         clear_local_symbols.
6044
6045 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
6046
6047         * plugin.cc (is_visible_from_outside): Return true for symbols
6048         in the -u option.
6049
6050 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
6051
6052         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
6053         filename.
6054
6055 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
6056
6057         * icf.h (is_section_foldable_candidate): Change type of parameter
6058         to std::string.
6059         * icf.cc (Icf::find_identical_sections): Change type of local variable
6060         section_name to be std::string.
6061         (is_function_ctor_or_dtor): Change type of parameter to std::string.
6062
6063 2011-01-25  Ian Lance Taylor  <iant@google.com>
6064
6065         * script.cc (script_add_extern): Rewrite to use
6066         add_symbol_reference.
6067
6068 2011-01-25  Doug Kwan  <dougkwan@google.com>
6069
6070         * icf.cc (get_section_contents): Always lock section's object.
6071
6072 2011-01-24  Ian Lance Taylor  <iant@google.com>
6073
6074         * options.h (class General_options): Accept
6075         --no-detect-odr-violations.
6076
6077 2011-01-24  Ian Lance Taylor  <iant@google.com>
6078
6079         * version.cc (version_string): Bump to 1.11.
6080
6081 2011-01-24  Ian Lance Taylor  <iant@google.com>
6082
6083         * plugin.cc (class Plugin_rescan): Define new class.
6084         (Plugin_manager::claim_file): Set any_claimed_.
6085         (Plugin_manager::save_archive): New function.
6086         (Plugin_manager::save_input_group): New function.
6087         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
6088         necessary.
6089         (Plugin_manager::new_undefined_symbol): New function.
6090         (Plugin_manager::rescan): New function.
6091         (Plugin_manager::rescannable_defines): New function.
6092         (Plugin_manager::add_input_file): Set any_added_.
6093         * plugin.h (class Plugin_manager): define new fields rescannable_,
6094         undefined_symbols_, any_claimed_, and any_added_.  Declare
6095         Plugin_rescan as friend.  Declare new functions.
6096         (Plugin_manager::Rescannable): Define type.
6097         (Plugin_manager::Rescannable_list): Define type.
6098         (Plugin_manager::Undefined_symbol_list): Define type.
6099         (Plugin_manager::Plugin_manager): Initialize new fields.
6100         * archive.cc (Archive::defines_symbol): New function.
6101         (Add_archive_symbols::run): Pass archive to plugins if any.
6102         * archive.h (class Archive): Declare defines_symbol.
6103         * readsyms.cc (Input_group::~Input_group): New function.
6104         (Finish_group::run): Pass input_group to plugins if any.
6105         * readsyms.h (class Input_group): Declare destructor.
6106         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
6107         any.
6108
6109 2011-01-10  Ian Lance Taylor  <iant@google.com>
6110
6111         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
6112         section as relro.
6113         (Layout::set_segment_offsets): Reset increase_relro before calling
6114         set_section_addresses a second time.
6115
6116 2011-01-04  Cary Coutant  <ccoutant@google.com>
6117
6118         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
6119         sections before NOBITS sections.
6120
6121 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
6122
6123         * version.cc (print_version): Update copyright to 2011.
6124
6125 2010-12-23  Cary Coutant  <ccoutant@google.com>
6126
6127         * output.h (Output_data_reloc::add_output_section): Pass OD instead
6128         of OS to this->add.  Add OD parameter to second form of the function.
6129
6130 2010-12-20  Ian Lance Taylor  <iant@google.com>
6131
6132         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
6133         second of two consecutive entries with same offset.
6134
6135 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6136
6137         * testsuite/Makefile.am (ifuncmain2static_LDADD)
6138         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
6139         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
6140         to avoid unneeded links against $(LDADD).
6141         * testsuite/Makefile.in: Regenerate.
6142
6143 2010-12-15  Ian Lance Taylor  <iant@google.com>
6144
6145         PR gold/12324
6146         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
6147         for R_X86_64_32 and R_X86_64_PC32.
6148         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
6149         ver_matching_def_pic.o.
6150         (ver_matching_def_pic.o): New target.
6151
6152 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6153
6154         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
6155         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
6156         Move definition before File_read::View member definitions.
6157         (File_read::View::~View): Initialize and hold lock before
6158         updating current_mapped_bytes.
6159
6160 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6161
6162         * dwarf_reader.cc: Remove outdated comment.
6163         * gold-threads.cc: Fix typo in error message.
6164         * archive.cc: Fix typos in comments.
6165         * archive.h: Likewise.
6166         * arm-reloc-property.cc: Likewise.
6167         * arm-reloc-property.h: Likewise.
6168         * arm-reloc.def: Likewise.
6169         * arm.cc: Likewise.
6170         * attributes.h: Likewise.
6171         * cref.cc: Likewise.
6172         * ehframe.cc: Likewise.
6173         * fileread.h: Likewise.
6174         * gold.h: Likewise.
6175         * i386.cc: Likewise.
6176         * icf.cc: Likewise.
6177         * incremental.h: Likewise.
6178         * int_encoding.cc: Likewise.
6179         * layout.h: Likewise.
6180         * main.cc: Likewise.
6181         * merge.h: Likewise.
6182         * object.cc: Likewise.
6183         * object.h: Likewise.
6184         * options.cc: Likewise.
6185         * readsyms.cc: Likewise.
6186         * reduced_debug_output.cc: Likewise.
6187         * reloc.cc: Likewise.
6188         * script-sections.cc: Likewise.
6189         * sparc.cc: Likewise.
6190         * symtab.h: Likewise.
6191         * target-reloc.h: Likewise.
6192         * target.cc: Likewise.
6193         * target.h: Likewise.
6194         * timer.cc: Likewise.
6195         * timer.h: Likewise.
6196         * x86_64.cc: Likewise.
6197
6198 2010-12-09  Cary Coutant  <ccoutant@google.com>
6199
6200         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
6201         stack.
6202         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
6203         parameter; change all callers.
6204         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
6205         * options.h (warn_execstack): New option.
6206
6207 2010-12-07  Doug Kwan  <dougkwan@google.com>
6208
6209         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
6210         like function call relocations.
6211
6212 2010-12-07  Ian Lance Taylor  <iant@google.com>
6213
6214         * archive.cc (Archive::get_elf_object_for_member): Permit
6215         punconfigured to be NULL.
6216         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
6217         (Archive::include_member): Pass NULL to get_elf_object_for_member
6218         if we searched for the archive and this is the first included
6219         object.
6220
6221 2010-12-01  Ian Lance Taylor  <iant@google.com>
6222
6223         * dwarf_reader.h (class Sized_dwarf_line_info): Add
6224         track_relocs_type_ field.
6225         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
6226         Set track_relocs_type_.
6227         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
6228         contents when using RELA relocs.
6229         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
6230         reloc_map_.
6231         * reloc.cc (Track_relocs::next_addend): New function.
6232         * reloc.h (class Track_relocs): Declare next_addend.
6233
6234 2010-12-01  Ian Lance Taylor  <iant@google.com>
6235
6236         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
6237         virtual destructor.
6238
6239 2010-12-01  Ian Lance Taylor  <iant@google.com>
6240
6241         * README: Update compilers known to work and fail.
6242
6243 2010-11-23  Matthias Klose  <doko@ubuntu.com>
6244
6245         * configure.in: For --enable-gold, handle value `default' instead of
6246         `both*'.  Always install ld as ld.bfd, install as ld if gold is
6247         not the default.
6248         * configure: Regenerate.
6249
6250 2010-11-18  Doug Kwan  <dougkwan@google.com>
6251
6252         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
6253         and right_alignment to be zero.  Store result alignment only if it is
6254         greater than existing alignment.
6255
6256 2010-11-16  Cary Coutant  <ccoutant@google.com>
6257
6258         PR gold/12220
6259         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
6260         Check for ".zdebug_line".
6261
6262 2010-11-16  Doug Kwan  <dougkwan@google.com>
6263             Cary Coutant  <ccoutant@google.com>
6264
6265         * output.h (Output_segment::set_section_addresses): Pass increase_relro
6266         by reference; adjust all callers.
6267         * output.cc (Output_segment::set_section_addresses): Adjust references
6268         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
6269         list is empty.
6270         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
6271         end at page boundary.
6272
6273 2010-11-16  Cary Coutant  <ccoutant@google.com>
6274
6275         PR gold/12220
6276         * layout.cc (Layout::choose_output_section): Transform names of
6277         compressed sections even when using a script with a SECTIONS clause.
6278         (Layout::output_section_name): Remove code to transform
6279         compressed debug section names.
6280         * output.cc (Output_section::add_input_section): Use uncompressed
6281         section size when tracking input sections.
6282
6283 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
6284
6285         * symtab.h (Symbol::NON_PIC_REF): Remove.
6286         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
6287         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
6288         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
6289         (Symbol::use_plt_offset): Take a flags argument and pass it
6290         directly to needs_dynamic_reloc.  Restrict check for undefined
6291         weak symbols to function calls.
6292         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
6293         (Target_arm::Scan::global): Use it.
6294         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
6295         (Target_arm::Relocate::relocate): Likewise.
6296         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
6297         parameter with an r_type parameter.  Use get_reference_flags
6298         to get the flags.
6299         (Target_arm::Relocate::relocate): Update accordingly.
6300         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
6301         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
6302         (Target_i386::Scan::global): Likewise.
6303         (Target_i386::Relocate::relocate): Likewise.
6304         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
6305         parameter with an r_type parameter.  Use get_reference_flags
6306         to get the flags.
6307         (Target_i386::Relocate::relocate): Update accordingly.
6308         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
6309         (Target_powerpc::Scan::global): Use it.
6310         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
6311         (Target_powerpc::Relocate::relocate): Likewise.
6312         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
6313         (Target_sparc::Scan::global): Use it.
6314         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
6315         (Target_sparc::Relocate::relocate): Likewise.
6316         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
6317         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
6318         (Target_x86_64::Scan::global): Likewise.
6319         (Target_x86_64::Relocate::relocate): Likewise.
6320
6321 2010-11-08  Doug Kwan  <dougkwan@google.com>
6322             Cary Coutant  <ccoutant@google.com>
6323
6324         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
6325         (Arm_exidx_merge_section::section_contents_): New data member.
6326         (Arm_input_section::Arm_input_section): Initialize original_contents_.
6327         (Arm_input_section::~Arm_input_section): De-allocate memory.
6328         (Arm_input_section::original_contents_): New data member.
6329         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
6330         in parameters instead of calling Object::section_contents without
6331         locking.
6332         (Arm_output_section::group_section): New parameter TASK.  Pass it
6333         to callees that need locking objects.
6334         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
6335         to lock EXIDX input sections.  Fix a formatting issue.  Call
6336         Arm_exidx_merged_section::build_contents to create merged section
6337         contents.
6338         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
6339         to lock object of stub table owner.
6340         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
6341         TEXT_SIZE to initialize data member TEXT_SIZE_.
6342         (Arm_exidx_input_section::addralign): Fix typo in comment.
6343         (Arm_exidx_input_section::text_size): New method.
6344         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
6345         that require locking objects.  Lock objects before scanning for stubs
6346         and updating local symbols.
6347         (Arm_input_section<big_endian>::init): Copy contents of original
6348         input section.
6349         (Arm_input_section<big_endian>::do_write): Use saved contents of
6350         original input section instead of calling Object::section_contents
6351         without locking.
6352         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
6353         size without calling Object::section_size().
6354         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
6355         for size.  Allocate a buffer for merged EXIDX entries.
6356         (Arm_exidx_merged_section::build_contents): New method.
6357         (Arm_exidx_merged_section::do_write): Move merge section contents
6358         building code to Arm_exidx_merged_section::build_contetns.  Write
6359         out contetns in buffer instead of building it on the fly.
6360         (Arm_relobj::make_exidx_input_section): Also pass text section size
6361         to Arm_exidx_input_section constructor.
6362         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
6363         (Arm_dynobj::do_read_symbols): Fix memory leak.
6364         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
6365         * target.h: (class Task): Add forward declaration.
6366         (Target::relax): Add new parameter TASK and pass it to
6367         Target::do_relax().
6368         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
6369
6370 2010-11-05  Cary Coutant  <ccoutant@google.com>
6371
6372         PR gold/10708
6373         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
6374         object when reading from the file.
6375         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
6376         second layout pass.
6377         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
6378         when reading section contents.
6379         (get_section_contents): Likewise.
6380         (icf::find_identical_sections): Likewise.
6381         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
6382         object when reading from the file.
6383         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
6384         the object when doing deferred section layout.
6385
6386 2010-11-03  Nick Clifton  <nickc@redhat.com>
6387
6388         PR gold/12001
6389         * script.h (class Symbol_assignment: name): New member.  Returns
6390         the name of the symbol.
6391         * scrfipt.cc (Script_options::is_pending_assignment): New member.
6392         Returns true if the given symbol name is on the list of
6393         assignments wating to be processed.
6394         * archive.cc (should_incldue_member): If the symbol is undefined,
6395         check to see if it is on the list of symbols pending assignment.
6396
6397 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
6398
6399         * script-sections.cc (Script_sections::find_memory_region): Check
6400         for a NULL output section pointer.
6401
6402 2010-10-29  Doug Kwan  <dougkwan@google.com>
6403
6404         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
6405         Output_section::add_relaxed_input_section.
6406         * output.cc (Output_section::add_relaxed_input_section): Add new
6407         arguments LAYOUT and NAME.  Set section order index.
6408         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
6409         Copy section order index.
6410         * output.h (Output_section::add_relaxed_input_section): Add new
6411         arguments LAYOUT and NAME.
6412
6413 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6414
6415         * testsuite/Makefile.am: Move gcctestdir/ld rule to
6416         NATIVE_OR_CROSS_LINKER.
6417         * testsuite/Makefile.in: Regenerate.
6418
6419 2010-10-20  Doug Kwan  <dougkwan@google.com>
6420
6421         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
6422         without SHF_LINK_ORDER flags.
6423         * layout.cc (Layout::choose_output_section): Do not filter
6424         SHF_LINK_ORDER flag in a relocatable link.
6425
6426 2010-10-17  Cary Coutant  <ccoutant@google.com>
6427
6428         * output.h (Output_segment::set_section_addresses): Change function
6429         signature.  Update all callers.
6430         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
6431         sections.
6432         (Output_segment::set_section_addresses): Align after last TLS
6433         section.  Add padding before last relro section instead of after.
6434
6435 2010-10-17  Doug Kwan  <dougkwan@google.com>
6436
6437         * gold/arm.cc (Target_arm::got_section): Use correct order and set
6438         GOT output section to be writable.
6439
6440 2010-10-14  Cary Coutant  <ccoutant@google.com>
6441
6442         * debug.h (DEBUG_INCREMENTAL): New flag.
6443         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
6444         * gold.cc (queue_initial_tasks): Check parameters for incremental link
6445         mode.
6446         * incremental.cc (report_command_line): Ignore all forms of
6447         --incremental.
6448         * layout.cc (Layout::Layout): Check parameters for incremental link
6449         mode.
6450         * options.cc (General_options::parse_incremental): New function.
6451         (General_options::parse_no_incremental): New function.
6452         (General_options::parse_incremental_full): New function.
6453         (General_options::parse_incremental_update): New function.
6454         (General_options::incremental_mode_): New data member.
6455         (General_options::finalize): Check incremental_mode_.
6456         * options.h (General_options): Update help text for --incremental.
6457         Add --no-incremental, --incremental-full, --incremental-update.
6458         (General_options::Incremental_mode): New enum type.
6459         (General_options::incremental_mode): New function.
6460         (General_options::incremental_mode_): New data member.
6461         * parameters.cc (Parameters::incremental_mode_): New data member.
6462         (Parameters::set_options): Set incremental_mode_.
6463         (Parameters::set_incremental_full): New function.
6464         (Parameters::incremental): New function.
6465         (Parameters::incremental_update): New function.
6466         (set_parameters_incremental_full): New function.
6467         * parameters.h (Parameters::set_incremental_full): New function.
6468         (Parameters::incremental): New function.
6469         (Parameters::incremental_update): New function.
6470         (Parameters::incremental_mode_): New data member.
6471         (set_parameters_incremental_full): New function.
6472         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
6473         incremental link mode.
6474         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
6475         (Sized_relobj::do_relocate_sections): Likewise.
6476         * testsuite/Makefile.am (incremental_test): Use --incremental-full
6477         option.
6478         * testsuite/Makefile.in: Regenerate.
6479         * testsuite/incremental_test.sh: Filter all forms of --incremental.
6480
6481 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6482
6483         * script-sections.h (class Script_sections): Make
6484         Sections_elements typedef public.
6485         * script-sections.cc (class Sort_output_sections): Add elements_
6486         field.  Add constructor which sets it; change all callers.
6487         (Sort_output_sections::is_before): New function.
6488         (Sort_output_sections::operator()): Call is_before.
6489         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
6490         conditional.
6491         * testsuite/script_test_10.sh: New test. Test script section
6492         order.
6493         * testsuite/script_test_10.t: Likewise.
6494         * testsuite/script_test_10.s: Likewise.
6495         * testsuite/Makefile.am: Wrap the cross linker tests and the
6496         common tests into NATIVE_OR_CROSS_LINKER.
6497         (check_SCRIPTS): Add script_test_10.sh.
6498         (check_DATA): Add script_test_10.stdout.
6499         (script_test_10.o, script_test_10): New targets.
6500         (script_test_10.stdout): New target.
6501         * configure, testsuite/Makefile.in: Regenerate.
6502
6503 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6504
6505         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
6506         error for the deprecated relocations.
6507         (Target_arm::Scan::global): Likewise.
6508         (Target_arm::Relocate::relocate): Likewise.
6509
6510 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
6511
6512         * fileread.cc (Input_file::find_file): Initialize *found_name
6513         and *namep when using the fallback search for case 4.
6514
6515 2010-10-11  Cary Coutant  <ccoutant@google.com>
6516
6517         * options.h (class General_options): Redefine -z lazy as an alias for
6518         the negation of -z now.
6519
6520 2010-10-11  Ian Lance Taylor  <iant@google.com>
6521
6522         * resolve.cc (symbol_to_bits): Report the value of the unsupported
6523         binding.
6524
6525 2010-10-06  Nick Clifton  <nickc@redhat.com>
6526
6527         * script-sections.cc(class Memory_region): Remove
6528         current_lma_offset_ field.  Rename current_vma_offset_ to
6529         current_offset_.  Add last_section_ field.
6530         (Memory_region::get_current_vma_address): Rename to
6531         get_current_address.
6532         (Memory_region::get_current_lma_address): Delete.
6533         (Memory_region::increment_vma_offset): Rename to
6534         increment_offset.
6535         (Memory_region::increment_lma_offset): Delete.
6536         (Memory_region::attributes_compatible): New method.  Returns
6537         true if the provided section is compatible with the region.
6538         (Memory_region::get_last_section): New method.  Returns the last
6539         section to use the region.
6540         (Memory_region::set_last_section): New method.  Stores the last
6541         section to use the region.
6542         (Script_sections::block_in_region): New method.  Returns true if
6543         a block of memory is contained within a region.
6544         (Script_sections::find_memory_region): New method.  Locates a
6545         memory region to be used to set a VMA or LMA address.
6546         (Output_section_definition::set_section_addresses): Add code to
6547         check for addresses set by memory regions.
6548         (Output_segment::set_section_addresses): Remove memory region
6549         walking code.
6550         (Script_sections::create_segment): Add a warning if a header
6551         segment is created outside of any region.
6552         * script-sections.h (class Script_sections): Add prototypes for
6553         find_memory_region and block_in_region methods.
6554         * testsuite/memory_test.s: Use .long instead of .word.
6555         * testsuite/memory_test.t: Add some more output sections.
6556         * testsuite/memory_test.sh: Update expected output.
6557
6558 2010-10-02  Doug Kwan  <dougkwan@google.com>
6559
6560         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
6561         defintion to symtab.h
6562         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
6563         declaration to defintion.
6564
6565 2010-10-01  Nick Clifton  <nickc@redhat.com>
6566
6567         * expression.cc (eval): Replace dummy argument with NULL.
6568         (eval_maybe_dot): Check for a NULL result section pointer.
6569         (Symbol_expression::value): Likewise.
6570         (Dot_expression::value): Likewise.
6571         (BINARY_EXPRESSION): Likewise.
6572         (Max_expression::value): Likewise.
6573         (Min_expression::value): Likewise.
6574         (Absolute_expression::value): Likewise.
6575         (Addr_expression::value_from_output_section): Likewise.
6576         (Loaddddr_expression::value_from_output_section): Likewise.
6577         (Segment_start_expression::value): Likewise.
6578         * script-sections.cc
6579         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
6580         argument with NULL.
6581         (Sections_elememt_dot_assignment::set_section_addresses):
6582         Likewise.
6583         (Output_data_expression::do_write_to_buffer): Likewise.
6584         (Output_section_definition::finalize_symbols): Likewise.
6585         (Output_section_definition::set_section_addresses): Likewise.
6586
6587 2010-09-30  Doug Kwan  <dougkwan@google.com>
6588
6589         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
6590
6591 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
6592
6593         * target.h (Target::can_icf_inline_merge_sections): New virtual
6594         function.
6595         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
6596         virtual function.
6597         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
6598         virtual function.
6599         * icf.cc (get_section_contents): Inline merge sections only when
6600         target allows it.
6601
6602 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6603
6604         * configure: Regenerate.
6605
6606 2010-09-17  Ian Lance Taylor  <iant@google.com>
6607
6608         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
6609         * testsuite/Makefile.am (memory_test.o): New target.
6610         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
6611         memory_test.t.
6612         * testsuite/Makefile.in: Rebuild.
6613
6614 2010-09-17  Doug Kwan  <dougkwan@google.com>
6615
6616         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
6617         defintion if relocation uses GOT entries of the symbol.
6618         * testsuite/icf_safe_test.sh: Fix test.
6619         * testsuite/icf_safe_so_test.sh: Fix test.
6620
6621 2010-09-16  Cary Coutant  <ccoutant@google.com>
6622
6623         * script_sections.cc (class Memory_region): Remove "NULL" from
6624         vector initializations.
6625
6626 2010-09-15  Cary Coutant  <ccoutant@google.com>
6627
6628         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
6629         Resolve forwarding symbols.
6630
6631 2010-09-15  Doug Kwan  <dougkwan@google.com>
6632
6633         * gold/testsuite/script_test_3.t: Add ARM special sections.
6634         * gold/testsuite/script_test_4.t: Same.
6635         * gold/testsuite/script_test_5.t: Same.
6636         * gold/testsuite/script_test_6.t: Same.
6637         * gold/testsuite/script_test_7.t: Same.
6638         * gold/testsuite/script_test_7.t: Same.
6639         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
6640
6641 2010-09-14  Cary Coutant  <ccoutant@google.com>
6642
6643         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
6644         (Target_x86_64::Relocate::relocate_tls): Replace check for
6645         saw_tls_block_reloc_ with test for executable section.
6646
6647 2010-09-12  Cary Coutant  <ccoutant@google.com>
6648
6649         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
6650         position-independent executables to shared libraries need dynamic
6651         relocations.
6652         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
6653         position-independent executables.
6654         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
6655         * testsuite/Makefile.in: Regenerate.
6656
6657 2010-09-10  Nick Clifton  <nickc@redhat.com>
6658
6659         PR gold/11997
6660         * testsuite/memory_test.t: Discard any sections that are not
6661         needed.
6662
6663 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
6664
6665         PR gold/11996
6666         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
6667         "This::" to work around a bug in gcc 4.2.
6668
6669         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
6670
6671 2010-09-09  Rafael Espindola  <espindola@google.com>
6672
6673         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
6674         sections with different PF_X flags in the same segment.
6675         (Layout::find_first_load_seg): Search all segments to find the first
6676         one.
6677         * options.h (rosegment): New.
6678
6679 2010-09-08  Rafael Espindola  <espindola@google.com>
6680
6681         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
6682
6683 2010-09-08  Doug Kwan  <dougkwan@google.com>
6684
6685         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
6686         (Arm_relobj::do_relocate_sections): Add new parameter for output
6687         file to match the parent.
6688         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
6689         of local symbols instead of input values.  Update code to track
6690         changes in gold::relocate_section.
6691         * object.cc (Sized_relobj::compute_final_local_value): New methods.
6692         (Sized_relobj::compute_final_local_value_internal): New methods.
6693         (Sized_relobj::do_finalize_local_symbols): Move code from loop
6694         body into private version of Sized_relobj::compute_final_local_value.
6695         Call the inline method.
6696         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
6697         merged symbol value if there is one.
6698         (Symbol_value::has_output_value): New method defintiion.
6699         (Sized_relobj::Compute_final_local_value_status): New enum type.
6700         (Sized_relobj::compute_final_local_value): New methods.
6701         (Sized_relobj::compute_final_local_value_internal): New methods.
6702         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
6703         and arm_cortex_a8.sh.
6704         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
6705         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
6706         New tests.
6707         * Makefile.in: Regenerate.
6708         * testsuite/arm_bl_out_of_range.s: Update test.
6709         * testsuite/thumb_bl_out_of_range.s: Ditto.
6710         * testsuite/thumb_blx_out_of_range.s: Ditto.
6711         * testsuite/arm_branch_out_of_range.sh: New file.
6712         * testsuite/arm_cortex_a8.sh: Ditto.
6713         * testsuite/arm_cortex_a8_b.s: Ditto.
6714         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
6715         * testsuite/arm_cortex_a8_b_local.s: Ditto.
6716         * testsuite/arm_cortex_a8_bl.s: Ditto.
6717         * testsuite/arm_cortex_a8_blx.s: Ditto.
6718         * testsuite/arm_cortex_a8_local.s: Ditto.
6719         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
6720         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
6721
6722 2010-09-08  Rafael Espindola  <espindola@google.com>
6723
6724         * Makefile.am (memory_test.stdout): Run readelf with -W.
6725         * Makefile.in: Regenerate.
6726         * testsuite/memory_test.sh: Make the regexps accept both 32 and
6727         64 bit output.
6728
6729 2010-09-08  Rafael Espindola  <espindola@google.com>
6730
6731         * script-sections.cc (Script_sections::add_memory_region): Convert
6732         field precision to int.
6733         * script.cc (script_set_section_region, script_set_section_region):
6734         Convert field precision to int.
6735
6736 2010-09-08  Rafael Espindola  <espindola@google.com>
6737
6738         * arm.cc (do_finalize_sections): Create the __exidx_start and
6739         __exdix_end symbols even when the section is missing.
6740
6741 2010-09-08  Nick Clifton  <nickc@redhat.com>
6742
6743         * README: Remove claim that MEMORY is not supported.
6744         * expression.cc (script_exp_function_origin)
6745         (script_exp_function_length): Move from here to ...
6746         * script.cc: ... here.
6747         (script_set_section_region, script_add_memory)
6748         (script_parse_memory_attr, script_include_directive): New
6749         functions.
6750         * script-sections.cc
6751         (class Memory_region): New class.
6752         (class Output_section_definition): Add set_memory_region,
6753         set_section_vma, set_section_lma and get_section_name methods.
6754         (class Script_Sections): Add add_memory_region,
6755         find_memory_region, find_memory_region_origin,
6756         find_memory_region_length and set_memory_region methods.
6757         Have set_section_addresses method walk the list of set memory
6758         regions.
6759         Extend the print methos to display memory regions.
6760         * script-sections.h: Add prototypes for new methods.
6761         Add enum for MEMORY region attributes.
6762         * yyscript.y: Add support for parsing MEMORY regions.
6763         * script-c.h: Add prototypes for new functions.
6764         * testsuite/Makefile.am: Add test of MEMORY region functionality.
6765         * testsuite/Makefile.in: Regenerate.
6766         * testsuite/memory_test.sh: New script.
6767         * testsuite/memory_test.s: New assembler source file.
6768         * testsuite/memory_test.t: New linker script.
6769
6770 2010-08-27  Doug Kwan  <dougkwan@google.com>
6771
6772         * gold/resolve.cc (Symbol_table::should_override): Let a weak
6773         reference override an existing dynamic weak reference.
6774         * testsuite/Makefile.am: Add new test dyn_weak_ref.
6775         * testsuite/Makefile.in: Regenerate.
6776         * testsuite/dyn_weak_ref.sh: New file.
6777         * testsuite/dyn_weak_ref_1.c: Ditto.
6778         * testsuite/dyn_weak_ref_2.c: Ditto.
6779
6780 2010-08-27  Ian Lance Taylor  <iant@google.com>
6781
6782         * incremental.h (class Incremental_input_entry): Add virtual
6783         destructor.
6784
6785 2010-08-27  Ian Lance Taylor  <iant@google.com>
6786
6787         * testsuite/start_lib_test_3.c: Mark t3 as used.
6788
6789 2010-08-27  Nick Clifton  <nickc@redhat.com>
6790
6791         * options.cc (version_script): Fix small typo in previous
6792         whitespace tidyup.
6793
6794 2010-08-25  Nick Clifton  <nickc@redhat.com>
6795
6796         * archive.cc: Formatting fixes: Remove whitespace between
6797         typename and following asterisk.  Remove whitespace between
6798         function name and opening parenthesis.
6799         * archive.h: Likewise.
6800         * arm.cc: Likewise.
6801         * attributes.cc: Likewise.
6802         * attributes.h: Likewise.
6803         * common.cc: Likewise.
6804         * copy-relocs.cc: Likewise.
6805         * dirsearch.h: Likewise.
6806         * dynobj.cc: Likewise.
6807         * ehframe.cc: Likewise.
6808         * ehframe.h: Likewise.
6809         * expression.cc: Likewise.
6810         * fileread.cc: Likewise.
6811         * fileread.h: Likewise.
6812         * gc.h: Likewise.
6813         * gold-threads.cc: Likewise.
6814         * gold.cc: Likewise.
6815         * i386.cc: Likewise.
6816         * icf.h: Likewise.
6817         * incremental-dump.cc: Likewise.
6818         * incremental.cc: Likewise.
6819         * layout.cc: Likewise.
6820         * layout.h: Likewise.
6821         * main.cc: Likewise.
6822         * merge.cc: Likewise.
6823         * merge.h: Likewise.
6824         * object.cc: Likewise.
6825         * object.h: Likewise.
6826         * options.cc: Likewise.
6827         * options.h: Likewise.
6828         * output.cc: Likewise.
6829         * output.h: Likewise.
6830         * plugin.cc: Likewise.
6831         * plugin.h: Likewise.
6832         * powerpc.cc: Likewise.
6833         * reloc.cc: Likewise.
6834         * script-c.h: Likewise.
6835         * script-sections.cc: Likewise.
6836         * script.cc: Likewise.
6837         * stringpool.cc: Likewise.
6838         * symtab.cc: Likewise.
6839         * symtab.h: Likewise.
6840         * target.cc: Likewise.
6841         * timer.cc: Likewise.
6842         * timer.h: Likewise.
6843         * version.cc: Likewise.
6844         * x86_64.cc: Likewise.
6845
6846 2010-08-24  Nick Clifton  <nickc@redhat.com>
6847
6848         PR 11899
6849         * layout.cc (segment_precedes): Sort segments by their physical
6850         addresses, if they have been set.
6851
6852 2010-08-23  Cary Coutant  <ccoutant@google.com>
6853
6854         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
6855         symbols data.
6856         (Lib_group::include_member): Unlock object after deleting its
6857         symbols data.
6858         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
6859         the bug fixed here.
6860
6861 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
6862             Cary Coutant  <ccoutant@google.com>
6863
6864         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
6865         constructor, and set_blocker.
6866         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
6867         readsyms_blocker_.
6868         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
6869         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
6870         * testsuite/Makefile.am (start_lib_test): New test case.
6871         * testsuite/Makefile.in: Regenerate.
6872         * testsuite/start_lib_test_main.c: New file.
6873         * testsuite/start_lib_test_1.c: New file.
6874         * testsuite/start_lib_test_2.c: New file.
6875         * testsuite/start_lib_test_3.c: New file.
6876
6877 2010-08-19  Ian Lance Taylor  <iant@google.com>
6878
6879         * Makefile.in: Rebuild with automake 1.11.1.
6880         * aclocal.m4: Likewise.
6881         * testsuite/Makefile.in: Likewise.
6882
6883 2010-08-19  Ian Lance Taylor  <iant@google.com>
6884
6885         PR 10893
6886         * i386.cc (class Output_data_plt_i386): Update declarations.
6887         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
6888         local_ifuncs_ fields.
6889         (Target_i386::do_plt_section_for_global): New function.
6890         (Target_i386::do_plt_section_for_local): New function.
6891         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
6892         parameter; change all callers.  Initialize global_ifuncs_ and
6893         local_ifuncs_.  If doing a static link define __rel_iplt_start and
6894         __rel_iplt_end.
6895         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
6896         (Output_data_plt_i386::add_local_ifunc_entry): New function.
6897         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
6898         symbols.
6899         (Target_i386::make_plt_section): New function, broken out of
6900         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
6901         (Target_i386::make_plt_entry): Call make_plt_section.
6902         (Target_i386::make_local_ifunc_plt_entry): New function.
6903         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
6904         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
6905         R_386_IRELATIVE to switch.
6906         (Target_i386::Scan::global): Likewise.
6907         (Target_i386::Relocate::relocate): Likewise.
6908         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
6909         switch.
6910         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
6911         (Target_x86_64::do_plt_section_for_global): New function.
6912         (Target_x86_64::do_plt_section_for_local): New function.
6913         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
6914         parameter; change all callers.  If doing a static link define
6915         __rela_iplt_start and __rela_iplt_end.
6916         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
6917         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
6918         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
6919         to point to .plt.
6920         (Target_x86_64::make_local_ifunc_plt_entry): New function.
6921         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
6922         switch.
6923         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
6924         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
6925         R_X86_64_IRELATIVE to switch.
6926         (Target_x86_64::Scan::global): Likewise.
6927         (Target_x86_64::Relocate::relocate): Likewise.
6928         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
6929         switch.
6930         * target.h (class Target): Add plt_section_for_global and
6931         plt_section_for_local functions.  Add do_plt_section_for_global
6932         and do_plt_section_for_local virtual functions.
6933         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
6934         clarifying comments.
6935         (Symbol::use_plt_offset): Handle IFUNC symbol.
6936         * object.cc (Sized_relobj::Sized_relobj): Initialize
6937         local_plt_offsets_.
6938         (Sized_relobj::local_has_plt_offset): New function.
6939         (Sized_relobj::local_plt_offset): New function.
6940         (Sized_relobj::set_local_plt_offset): New function.
6941         (Sized_relobj::do_count): Handle IFUNC symbol.
6942         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
6943         a bit away from input_shndx_ field.  Add set_is_func_symbol and
6944         is_ifunc_symbol functions.
6945         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
6946         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
6947         local_plt_offsets_ field.
6948         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
6949         * output.h (class Output_section_data): Add non-const
6950         output_section function.
6951         (class Output_data_got): Update declarations.
6952         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
6953         Add use_plt_offset parameter to global and local constructors.
6954         Change all callers.  Change local_sym_index_ field to 31 bits.
6955         Change GSYM_CODE and CONSTANT_CODE accordingly.
6956         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
6957         doing a static link don't set sh_link field.
6958         (Output_data_got::Got_entry::write): Use PLT offset if
6959         appropriate.
6960         (Output_data_got::add_global_plt): New function.
6961         (Output_data_got::add_local_plt): New function.
6962         * target-reloc.h (relocate_section): Handle IFUNC symbol.
6963         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
6964         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
6965         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
6966         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
6967         IFUNC conditional.
6968         * testsuite/ifunc-sel.h: New file.
6969         * testsuite/ifuncmain1.c: New file.
6970         * testsuite/ifuncmain1vis.c: New file.
6971         * testsuite/ifuncmod1.c: New file.
6972         * testsuite/ifuncdep2.c: New file.
6973         * testsuite/ifuncmain2.c: New file.
6974         * testsuite/ifuncmain3.c: New file.
6975         * testsuite/ifuncmod3.c: New file.
6976         * testsuite/ifuncmain4.c: New file.
6977         * testsuite/ifuncmain5.c: New file.
6978         * testsuite/ifuncmod5.c: New file.
6979         * testsuite/ifuncmain6pie.c: New file.
6980         * testsuite/ifuncmod6.c: New file.
6981         * testsuite/ifuncmain7.c: New file.
6982         * configure, testsuite/Makefile.in: Rebuild.
6983
6984 2010-08-18  Ian Lance Taylor  <iant@google.com>
6985
6986         * incremental.cc
6987         (Output_section_incremental_inputs::write_input_files): Add cast
6988         to avoid signed/unsigned comparison warning.
6989         (Output_section_incremental_inputs::write_info_blocks): Likewise.
6990
6991 2010-08-12  Cary Coutant  <ccoutant@google.com>
6992
6993         * common.cc (Sort_commons::operator()): Remove unnecessary code.
6994
6995 2010-08-13  Ian Lance Taylor  <iant@google.com>
6996
6997         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
6998
6999 2010-08-12  Cary Coutant  <ccoutant@google.com>
7000             Doug Kwan  <dougkwan@google.com>
7001
7002         * resolve.cc (Symbol_table::should_override): When a weak dynamic
7003         defintion overrides non-weak undef, remember that the original undef
7004         is not weak.
7005         * symtab.cc (Symbol_table::sized_write_global): For undef without
7006         an original weak binding, set binding to global in output.
7007         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
7008         * testsuite/Makefile.in: Regenerate.
7009         * testsuite/strong_ref_weak_def.sh: New file.
7010         * testsuite/strong_ref_weak_def_1.c: Ditto.
7011         * testsuite/strong_ref_weak_def_2.c: Ditto.
7012
7013 2010-08-12  Cary Coutant  <ccoutant@google.com>
7014
7015         * testsuite/incremental_test.sh: Rewrite.
7016         * testsuite/incremental_test_1.c: Rewrite.
7017         * testsuite/incremental_test_2.c: Rewrite.
7018
7019 2010-08-12  Cary Coutant  <ccoutant@google.com>
7020
7021         * arm.cc (Target_arm::got_size): Add const.
7022         (Target_arm::got_entry_count): New function.
7023         (Target_arm::plt_entry_count): New function.
7024         (Target_arm::first_plt_entry_offset): New function.
7025         (Target_arm::plt_entry_size): New function.
7026         (Output_data_plt_arm::entry_count): New function.
7027         (Output_data_plt_arm::first_plt_entry_offset): New function.
7028         (Output_data_plt_arm::get_plt_entry_size): New function.
7029         * i386.cc (Target_i386::got_size): Add const.
7030         (Target_i386::got_entry_count): New function.
7031         (Target_i386::plt_entry_count): New function.
7032         (Target_i386::first_plt_entry_offset): New function.
7033         (Target_i386::plt_entry_size): New function.
7034         (Output_data_plt_i386::entry_count): New function.
7035         (Output_data_plt_i386::first_plt_entry_offset): New function.
7036         (Output_data_plt_i386::get_plt_entry_size): New function.
7037         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
7038         find_incremental_inputs_sections.  Dump incremental_got_plt section.
7039         * incremental.cc: Include target.h.
7040         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
7041         parameter.  Adjust all callers.  Find incremental_got_plt section.
7042         (Incremental_inputs::create_data_sections): Create incremental_got_plt
7043         section.
7044         (Output_section_incremental_inputs::set_final_data_size): Calculate
7045         size of incremental_got_plt section.
7046         (Output_section_incremental_inputs::do_write): Write the
7047         incremental_got_plt section.
7048         (Got_plt_view_info): New struct.
7049         (Local_got_offset_visitor): New class.
7050         (Global_got_offset_visitor): New class.
7051         (Global_symbol_visitor_got_plt): New class.
7052         (Output_section_incremental_inputs::write_got_plt): New function.
7053         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
7054         Add parameter.  Adjust all callers.
7055         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
7056         (Incremental_inputs::got_plt_section): New function.
7057         (Incremental_inputs::got_plt_section_): New data member.
7058         (Incremental_got_plt_reader): New class.
7059         * layout.cc (Layout::create_incremental_info_sections): Add the
7060         incremental_got_plt section.
7061         * object.h (Got_offset_list::get_list): New function.
7062         (Got offset_list::for_all_got_offsets): New function.
7063         (Sized_relobj::local_got_offset_list): New function.
7064         * powerpc.cc (Target_powerpc::got_size): Add const.
7065         (Target_powerpc::got_entry_count): New function.
7066         (Target_powerpc::plt_entry_count): New function.
7067         (Target_powerpc::first_plt_entry_offset): New function.
7068         (Target_powerpc::plt_entry_size): New function.
7069         (Output_data_plt_powerpc::entry_count): New function.
7070         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
7071         (Output_data_plt_powerpc::get_plt_entry_size): New function.
7072         * sparc.cc (Target_sparc::got_size): Add const.
7073         (Target_sparc::got_entry_count): New function.
7074         (Target_sparc::plt_entry_count): New function.
7075         (Target_sparc::first_plt_entry_offset): New function.
7076         (Target_sparc::plt_entry_size): New function.
7077         (Output_data_plt_sparc::entry_count): New function.
7078         (Output_data_plt_sparc::first_plt_entry_offset): New function.
7079         (Output_data_plt_sparc::get_plt_entry_size): New function.
7080         * symtab.h (Symbol::got_offset_list): New function.
7081         (Symbol_table::for_all_symbols): New function.
7082         * target.h (Sized_target::got_entry_count): New function.
7083         (Sized_target::plt_entry_count): New function.
7084         (Sized_target::plt_entry_size): New function.
7085         * x86_64.cc (Target_x86_64::got_size): Add const.
7086         (Target_x86_64::got_entry_count): New function.
7087         (Target_x86_64::plt_entry_count): New function.
7088         (Target_x86_64::first_plt_entry_offset): New function.
7089         (Target_x86_64::plt_entry_size): New function.
7090         (Output_data_plt_x86_64::entry_count): New function.
7091         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
7092         (Output_data_plt_x86_64::get_plt_entry_size): New function.
7093
7094 2010-08-12  Cary Coutant  <ccoutant@google.com>
7095
7096         * archive.cc: Include incremental.h.
7097         (Archive::Archive): Initialize incremental_info_.
7098         (Archive::include_member): Record archive members in incremental info.
7099         (Add_archive_symbols::run): Record begin and end of an archive in
7100         incremental info.
7101         (Lib_group::include_member): Record objects in incremental info.
7102         * archive.h (Incremental_archive_entry): Forward declaration.
7103         (Archive::set_incremental_info): New member function.
7104         (Archive::incremental_info): New member function.
7105         (Archive::Unused_symbol_iterator): New class.
7106         (Archive::unused_symbols_begin): New member function.
7107         (Archive::unused_symbols_end): New member function.
7108         (Archive::incremental_info_): New data member.
7109         * incremental-dump.cc (find_input_containing_global): New function.
7110         (dump_incremental_inputs): Dump new incremental info sections.
7111         * incremental.cc: Include symtab.h.
7112         (Output_section_incremental_inputs): New class.
7113         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
7114         new incremental info sections.
7115         (Sized_incremental_binary::do_check_inputs): Likewise.
7116         (Incremental_inputs::report_archive): Remove.
7117         (Incremental_inputs::report_archive_begin): New function.
7118         (Incremental_inputs::report_archive_end): New function.
7119         (Incremental_inputs::report_object): New function.
7120         (Incremental_inputs::finalize_inputs): Remove.
7121         (Incremental_inputs::report_input_section): New function.
7122         (Incremental_inputs::report_script): Rewrite.
7123         (Incremental_inputs::finalize): Do nothing but finalize string table.
7124         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
7125         (Incremental_inputs::sized_create_inputs_section_data): Remove.
7126         (Incremental_inputs::create_data_sections): New function.
7127         (Incremental_inputs::relocs_entsize): New function.
7128         (Output_section_incremental_inputs::set_final_data_size): New function.
7129         (Output_section_incremental_inputs::do_write): New function.
7130         (Output_section_incremental_inputs::write_header): New function.
7131         (Output_section_incremental_inputs::write_input_files): New function.
7132         (Output_section_incremental_inputs::write_info_blocks): New function.
7133         (Output_section_incremental_inputs::write_symtab): New function.
7134         * incremental.h (Incremental_script_entry): Forward declaration.
7135         (Incremental_object_entry): Forward declaration.
7136         (Incremental_archive_entry): Forward declaration.
7137         (Incremental_inputs): Forward declaration.
7138         (Incremental_inputs_header_data): Remove.
7139         (Incremental_inputs_header): Remove.
7140         (Incremental_inputs_header_write): Remove.
7141         (Incremental_inputs_entry_data): Remove.
7142         (Incremental_inputs_entry): Remove.
7143         (Incremental_inputs_entry_write): Remove.
7144         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
7145         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
7146         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
7147         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
7148         Likewise.
7149         (Incremental_input_entry): New class.
7150         (Incremental_script_entry): New class.
7151         (Incremental_object_entry): New class.
7152         (Incremental_archive_entry): New class.
7153         (Incremental_inputs::Incremental_inputs): Initialize new data members.
7154         (Incremental_inputs::report_inputs): Remove.
7155         (Incremental_inputs::report_archive): Remove.
7156         (Incremental_inputs::report_archive_begin): New function.
7157         (Incremental_inputs::report_archive_end): New function.
7158         (Incremental_inputs::report_object): Change prototype.
7159         (Incremental_inputs::report_input_section): New function.
7160         (Incremental_inputs::report_script): Change prototype.
7161         (Incremental_inputs::get_reloc_count): New function.
7162         (Incremental_inputs::set_reloc_count): New function.
7163         (Incremental_inputs::create_data_sections): New function.
7164         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
7165         (Incremental_inputs::inputs_section): New function.
7166         (Incremental_inputs::symtab_section): New function.
7167         (Incremental_inputs::relocs_section): New function.
7168         (Incremental_inputs::get_stringpool): Add const.
7169         (Incremental_inputs::command_line): Add const.
7170         (Incremental_inputs::inputs): Remove.
7171         (Incremental_inputs::command_line_key): New function.
7172         (Incremental_inputs::input_file_count): New function.
7173         (Incremental_inputs::input_files): New function.
7174         (Incremental_inputs::relocs_entsize): New function.
7175         (Incremental_inputs::sized_create_inputs_section_data): Remove.
7176         (Incremental_inputs::finalize_inputs): Remove.
7177         (Incremental_inputs::Input_info): Remove.
7178         (Incremental_inputs::lock_): Remove.
7179         (Incremental_inputs::inputs_): Change type.
7180         (Incremental_inputs::inputs_map_): Remove.
7181         (Incremental_inputs::current_object_entry_): New data member.
7182         (Incremental_inputs::inputs_section_): New data member.
7183         (Incremental_inputs::symtab_section_): New data member.
7184         (Incremental_inputs::relocs_section_): New data member.
7185         (Incremental_inputs::reloc_count_): New data member.
7186         (Incremental_inputs_reader): New class.
7187         (Incremental_symtab_reader): New class.
7188         (Incremental_relocs_reader): New class.
7189         * layout.cc (Layout::finalize): Move finalization of incremental info
7190         and creation of incremental info sections to follow finalization of
7191         symbol table.  Set offsets for postprocessing sections.
7192         (Layout::create_incremental_info_sections): Call
7193         Incremental_inputs::create_data_sections.  Add incremental symtab
7194         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
7195         sections to layout after input sections.
7196         * layout.h (struct Timespec): Forward declaration.
7197         (Layout::incremental_inputs): Add const.
7198         (Layout::create_incremental_info_sections): Add parameter.
7199         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
7200         * object.cc: Include incremental.h.
7201         (Relobj::finalize_incremental_relocs): New function.
7202         (Sized_relobj::do_layout): Record input sections in incremental info.
7203         * object.h (Object::output_section): New function.
7204         (Object::output_section_offset): Moved from Relobj.
7205         (Object::get_incremental_reloc_base): New function.
7206         (Object::get_incremental_reloc_count): New function.
7207         (Object::do_output_section): New function.
7208         (Object::do_output_section_offset): Moved from Relobj.
7209         (Object::do_get_incremental_reloc_base): New function.
7210         (Object::do_get_incremental_reloc_count): New function.
7211         (Object::Object): Initialize new data members.
7212         (Relobj::output_section): Renamed do_output_section and moved to
7213         protected.
7214         (Relobj::output_section_offset): Moved to Object.
7215         (Relobj::do_get_incremental_reloc_base): New function.
7216         (Relobj::do_get_incremental_reloc_count): New function.
7217         (Relobj::allocate_incremental_reloc_counts): New function.
7218         (Relobj::count_incremental_reloc): New function.
7219         (Relobj::finalize_incremental_relocs): New function.
7220         (Relobj::next_incremental_reloc_index): New function.
7221         (Relobj::reloc_counts_): New data member.
7222         (Relobj::reloc_bases_): New data member.
7223         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
7224         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
7225         (Sized_relobj::incremental_relocs_scan): New function.
7226         (Sized_relobj::incremental_relocs_scan_reltype): New function.
7227         (Sized_relobj::incremental_relocs_write): New function.
7228         (Sized_relobj::incremental_relocs_write_reltype): New function.
7229         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
7230         incremental link.
7231         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
7232         archives and object files elsewhere.
7233         (Add_symbols::run): Report object files here.
7234         (Finish_group::run): Report end of archive at end of group.
7235         * reloc.cc: Include layout.h, incremental.h.
7236         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
7237         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
7238         (Sized_relobj::incremental_relocs_scan): New function.
7239         (Sized_relobj::incremental_relocs_scan_reltype): New function.
7240         (Sized_relobj::do_relocate_sections): Write incremental relocations.
7241         (Sized_relobj::incremental_relocs_write): New function.
7242         (Sized_relobj::incremental_relocs_write_reltype): New function.
7243         * script.cc (read_input_script): Rewrite test for incremental link.
7244         Change call to Incremental_inputs::report_script.
7245         * symtab.h (Symbol_table::first_global_index): New function.
7246         (Symbol_table::output_count): New function.
7247
7248 2010-08-12  Doug Kwan  <dougkwan@google.com>
7249
7250         * arm.cc (Target_arm::merge_object_attributes): Check command line
7251         options --no-wchar-size-warning and --no-enum-size-warning.
7252         * options.h (General_options): Add ld-compatible options
7253         --no-enum-size-warning and --no-wchar-size-warning.
7254
7255 2010-08-04  Ian Lance Taylor  <iant@google.com>
7256
7257         * x86_64.cc (Target_x86_64::Scan::local): Use
7258         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
7259         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
7260         (Target_x86_64::Scan::global): Likewise.
7261         (Target_x86_64::Relocate::relocate): Likewise.
7262         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
7263         Likewise.
7264
7265 2010-08-03  Cary Coutant  <ccoutant@google.com>
7266
7267         * merge.cc (Output_merge_string::do_add_input_section): Count strings
7268         to reserve space in merged_strings vector. Keep total input size
7269         for stats.
7270         (Output_merge_string::do_print_merge_stats): Print total input size.
7271         * merge.h (Output_merge_string): Add input_size_ field.
7272         * stringpool.cc (Stringpool_template::string_length): Move
7273         implementations out of Stringpool_template class and place in
7274         stringpool.h.
7275         * stringpool.h (string_length): Move out of Stringpool_template.
7276
7277 2010-08-03  Ian Lance Taylor  <iant@google.com>
7278
7279         PR 11712
7280         * layout.cc (relaxation_loop_body): If address of load segment is
7281         set, adjust address to include headers if possible.
7282
7283 2010-08-03  Ian Lance Taylor  <iant@google.com>
7284
7285         * version.cc (version_string): Bump to 1.10.
7286
7287 2010-08-03  Ian Lance Taylor  <iant@google.com>
7288
7289         PR 11805
7290         * layout.h (enum Output_section_order): Define.
7291         (class Layout): Update declarations.
7292         * layout.cc (Layout::get_output_section): Add order parameter.
7293         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
7294         is_first_non_relro parameters.  Change all callers.
7295         (Layout::choose_output_section): Likewise.
7296         (Layout::add_output_section_data): Likewise.
7297         (Layout::make_output_section): Likewise.  Set order.
7298         (Layout::default_section_order): New function.
7299         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
7300         * output.cc (Output_section::Output_section): Initialize order_.
7301         Don't initialize deleted fields.
7302         (Output_segment::Output_segment): Don't initialize deleted
7303         fields.
7304         (Output_segment::add_output_section_to_load): New function
7305         replacing add_output_section.  Change all callers to call this or
7306         add_output_section_to_nonload.
7307         (Output_segment::add_output_section_to_nonload): New function.
7308         (Output_segment::remove_output_section): Rewrite.
7309         (Output_segment::add_initial_output_data): Likewise.
7310         (Output_segment::has_any_data_sections): Likewise.
7311         (Output_segment::is_first_section_relro): Likewise.
7312         (Output_segment::maximum_alignment): Likewise.
7313         (Output_segment::has_dynamic_reloc): New function replacing
7314         dynamic_reloc_count.  Change all callers.
7315         (Output_segment::has_dynamic_reloc_list): New function replacing
7316         dynamic_reloc_count_list.  Change all callers.
7317         (Output_segment::set_section_addresses): Rewrite.
7318         (Output_segment::set_offset): Rewrite.
7319         (Output_segment::find_first_and_last_list): Remove.
7320         (Output_segment::set_tls_offsets): Rewrite.
7321         (Output_segment::first_section_load_address): Likewise.
7322         (Output_segment::output_section_count): Likewise.
7323         (Output_segment::section_with_lowest_load_address): Likewise.
7324         (Output_segment::write_section_headers): Likewise.
7325         (Output_segment::print_sections_to_map): Likewise.
7326         * output.h (class Output_data): Remove dynamic_reloc_count_
7327         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
7328         (Output_data::add_dynamic_reloc): Rewrite.
7329         (Output_data::has_dynamic_reloc): New function.
7330         (Output_data::dynamic_reloc_count): Remove.
7331         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
7332         is_last_relro_, is_first_non_relro_, is_interp_,
7333         is_dynamic_linker_section_ fields.  Add order and set_order
7334         functions.  Remove is_relro_local, set_is_relro_local,
7335         is_last_relro, set_is_last_relro, is_first_non_relro,
7336         set_is_first_non_relro functions, is_interp, set_is_interp,
7337         is_dynamic_linker_section, and set_is_dynamic_linker_section
7338         functions.
7339         (class Output_segment): Change Output_data_list from std::list to
7340         std:;vector.  Add output_lists_ field.  Remove output_data_ and
7341         output_bss_ fields.  Update declarations.
7342
7343 2010-08-02  Ian Lance Taylor  <iant@google.com>
7344
7345         * arm.cc (Target_arm::gc_process_relocs): Use typename.
7346         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
7347         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
7348
7349 2010-08-02  Ian Lance Taylor  <iant@google.com>
7350
7351         PR 11855
7352         * script.cc (Script_options::Script_options): Initialize
7353         symbol_definitions_ and symbol_references_.
7354         (Script_options::add_symbol_assignment): Update
7355         symbol_definitions_ and symbol_references_.
7356         (Script_options::add_symbol_reference): New function.
7357         (script_symbol): New function.
7358         * script.h (class Script_options): Add symbol_definitions_ and
7359         symbol_references_ fields.
7360         (Script_options::referenced_const_iterator): New type.
7361         (Script_options::referenced_begin): New function.
7362         (Script_options::referenced_end): New function.
7363         (Script_options::is_referenced): New function.
7364         (Script_options::any_unreferenced): New function.
7365         * script-c.h (script_symbol): Declare.
7366         * yyscript.y (exp): Call script_symbol.
7367         * symtab.cc: Include "script.h".
7368         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
7369         Change all callers.  Check symbols referenced by scripts.
7370         (Symbol_table::add_undefined_symbols_from_command_line): Add
7371         layout parameter.  Change all callers.
7372         (Symbol_table::do_add_undefined_symbols_from_command_line):
7373         Likewise.  Break out loop body.  Check symbols referenced by
7374         scripts.
7375         (Symbol_table::add_undefined_symbol_from_command_line): New
7376         function broken out of
7377         do_add_undefined_symbols_from_command_line.
7378         * symtab.h (class Symbol_table): Update declarations.
7379         * archive.cc: Include "layout.h".
7380         (Archive::should_include_member): Add layout parameter.  Change
7381         all callers.  Check for symbol mentioned in expression.
7382         * archive.h (class Archive): Update declaration.
7383         * object.cc (Sized_relobj::do_should_include_member): Add layout
7384         parameter.
7385         * object.h (Object::should_include_member): Add layout parameter.
7386         Change all callers.
7387         (Object::do_should_include_member): Add layout parameter.
7388         (class Sized_relobj): Update declaration.
7389         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
7390         parameter.
7391         * dynobj.h (class Sized_dynobj): Update declaration.
7392         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
7393         layout parameter.
7394         * plugin.h (class Sized_pluginobj): Update declaration.
7395
7396 2010-08-02  Ian Lance Taylor  <iant@google.com>
7397
7398         PR 11866
7399         * output.cc (Output_segment::set_offset): Search for the first and
7400         last sections rather than assuming that the list is in order.
7401         (Output_segment::find_first_and_last_list): New function.
7402         * output.h (class Output_segment): Update declarations.
7403         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
7404         (relro_strip_test_SOURCES): New variable.
7405         (relro_strip_test_DEPENDENCIES): New variable.
7406         (relro_strip_test_LDFLAGS): New variable.
7407         (relro_strip_test_LDADD): New variable.
7408         (relro_strip_test.so): New target.
7409
7410 2010-08-02  Ian Lance Taylor  <iant@google.com>
7411
7412         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
7413         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
7414         (Target_i386::got_tlsdesc_section): New function.
7415         (Target_i386::got_section): Create space for GOT entries for
7416         TLSDESC relocations.
7417         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
7418         R_386_TLS_GOTDESC.
7419         (Target_i386::Scan::global): Likewise.
7420         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
7421         using TLSDESC GOT.
7422         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
7423         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
7424         (Target_x86_64::got_tlsdesc_section): New function.
7425         (Target_x86_64::got_section): Create space for GOT entries for
7426         TLSDESC relocations.
7427         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
7428         R_386_TLS_GOTDESC.
7429         (Target_x86_64::Scan::global): Likewise.
7430         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
7431         using TLSDESC GOT.
7432
7433 2010-08-02  Ian Lance Taylor  <iant@google.com>
7434
7435         * testsuite/final_layout.sh: Use dc to convert from hex to
7436         decimal.
7437
7438 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
7439
7440         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
7441         paramter to the call to gold::gc_process_relocs.
7442         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
7443         paramter to the call to gold::gc_process_relocs.
7444         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
7445         parameter to the call to gold::gc_process_relocs.
7446         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
7447         template parameter to the call to gold::gc_process_relocs.
7448         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
7449         paramter to the call to gold::gc_process_relocs.
7450         * gc.h (get_embedded_addend_size): New function.
7451         (gc_process_relocs): Save the size of the reloc for use by ICF.
7452         * icf.cc (get_section_contents): Get the addend from the text section
7453         for SHT_REL relocation sections.
7454         * icf.h (Icf::Reloc_addend_size_info): New typedef.
7455         (Icf::Reloc_info): Add new member reloc_addend_size_info.
7456         * int_encoding.h (read_from_pointer): New overloaded function.
7457         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
7458         * testsuite/icf_sht_rel_addend_test.sh: New file.
7459         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
7460         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
7461
7462 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7463
7464         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
7465         * Makefile.in: Regenerate.
7466         * testsuite/Makefile.in: Regenerate.
7467
7468 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
7469
7470         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
7471         * gold/testsuite/debug_msg.cc: Likewise.
7472         * gold/testsuite/odr_violation1.cc
7473         * gold/testsuite/odr_violation2.cc
7474
7475 2010-07-21  Cary Coutant  <ccoutant@google.com>
7476
7477         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
7478         string, and length fields.
7479         (Output_merge_string::Merged_strings_list): New type.
7480         (Output_merge_string::Merged_strings_lists): New typedef.
7481         (Output_merge_string): Replace merged_strings_ with
7482         merged_strings_lists_.
7483         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
7484         Merged_strings_list per input object and section.  Don't store pointer
7485         to the string.  Don't store length with each merged string entry.
7486         (Output_merge_string::finalize_merged_data): Loop over list of merged
7487         strings lists.  Recompute length of each merged string.
7488
7489 2010-07-15  Cary Coutant  <ccoutant@google.com>
7490
7491         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
7492         here.
7493
7494 2010-07-14  Ian Lance Taylor  <iant@google.com>
7495
7496         * descriptors.cc (Descriptors::open): Report correct name in error
7497         message.
7498
7499 2010-07-13  Doug Kwan  <dougkwan@google.com>
7500
7501         * arm.cc (Arm_input_section::Arm_input_section): For a
7502         SHT_ARM_EXIDX section, always keeps the input sections.
7503         (Arm_input_section::set_exidx_section_link): New method.
7504         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
7505         has_errors_ to false.
7506         (Arm_exidx_input_section::has_errors,
7507         Arm_exidx_input_section::set_has_errors): New methods.
7508         (Arm_exidx_input_section::has_errors_): New data member.
7509         (Arm_relobj::get_exidx_shndx_list): New method.
7510         (Arm_output_section::append_text_sections_to_list): Do not skip
7511         section without SHF_EXECINSTR.
7512         (Arm_output_section::fix_exidx_coverage): Skip input sections with
7513         errors.
7514         (Arm_relobj::make_exidx_input_section): Add new parameter for text
7515         section header.  Make error messages more verbose.  Check for
7516         a non-executable section linked to an EXIDX section.
7517         (Arm_relobj::do_read_symbols): Remove error checking, which has been
7518         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
7519         check that there is no deferred EXIDX section if we exit early.
7520         Instead of not making an EXIDX section in case of an error, make one
7521         and set the has_errors flag of it.
7522         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
7523         in a relocatable link.
7524         (Target_arm::do_relax): Look for the EXIDX output section instead of
7525         assuming that it is called .ARM.exidx.
7526         (Target_arm::fix_exidx_coverage): Add a new parameter for input
7527         section list.  Do not check for SHF_EXECINSTR section flags but
7528         skip any input section with errors.
7529         * output.cc (Output_section::Output_section): Initialize
7530         always_keeps_input_sections_ to false.
7531         (Output_section::add_input_section): Check for
7532         always_keeps_input_sections_.
7533         *  output.h (Output_section::always_keeps_input_sections,
7534         Output_section::set_always_keeps_input_sections): New methods.
7535         (Output_section::always_keeps_input_sections): New data member.
7536
7537 2010-07-13  Rafael Espindola  <espindola@google.com>
7538
7539         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
7540         * fileread.h (Input_file): Add try_extra_search_path and find_file.
7541
7542 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
7543             Ian Lance Taylor  <iant@google.com>
7544
7545         * output.h (Output_section_lookup_maps::add_merge_section):
7546         Correct check of whether value was inserted.
7547         (Output_section_lookup_maps::add_merge_input_section): Likewise.
7548         (Output_section_lookup_maps::add_relaxed_input_section):
7549         Likewise.
7550         * arm.cc (Target_arm::got_section): Remove used local os.
7551         * i386.cc (Target_i386::got_section): Likewise.
7552         * x86_64.cc (Target_x86_64::got_section): Likewise.
7553         * sparc.cc (Target_sparc::got_section): Likewise.
7554         (Target_sparc::relocate): Remove unused local have_got_offset.
7555         * powerpc.cc (Target_powerpc::relocate): Likewise.
7556
7557 2010-07-13  Ian Lance Taylor  <iant@google.com>
7558
7559         * compressed_output.cc (zlib_decompress): Fix signature in
7560         !HAVE_ZLIB_H case.
7561
7562         * archive.cc (Archive::include_member): Unlock an external member
7563         of a thin archive.  Don't bother to delete an object we know is
7564         NULL.
7565
7566 2010-07-12  Cary Coutant  <ccoutant@google.com>
7567
7568         * compressed_output.cc (zlib_decompress): New function.
7569         (get_uncompressed_size): New function.
7570         (decompress_input_section): New function.
7571         * compressed_output.h (get_uncompressed_size): New function.
7572         (decompress_input_section): New function.
7573         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
7574         Handle compressed debug sections.
7575         * layout.cc (is_compressed_debug_section): New function.
7576         (Layout::output_section_name): Map compressed section names to
7577         canonical names.
7578         * layout.h (is_compressed_debug_section): New function.
7579         (is_debug_info_section): Recognize compressed debug sections.
7580         * merge.cc: Include compressed_output.h.
7581         (Output_merge_data::do_add_input_section): Handle compressed
7582         debug sections.
7583         (Output_merge_string::do_add_input_section): Handle compressed
7584         debug sections.
7585         * object.cc: Include compressed_output.h.
7586         (Sized_relobj::Sized_relobj): Initialize new data members.
7587         (build_compressed_section_map): New function.
7588         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
7589         * object.h (Object::section_is_compressed): New method.
7590         (Object::do_section_is_compressed): New method.
7591         (Sized_relobj::Compressed_section_map): New type.
7592         (Sized_relobj::do_section_is_compressed): New method.
7593         (Sized_relobj::compressed_sections_): New data member.
7594         * output.cc (Output_section::add_input_section): Handle compressed
7595         debug sections.
7596         * reloc.cc: Include compressed_output.h.
7597         (Sized_relobj::write_sections): Handle compressed debug sections.
7598
7599 2010-07-08  Cary Coutant  <ccoutant@google.com>
7600
7601         * resolve.cc (Symbol_table::resolve): Remember whether undef was
7602         weak when resolving to a dynamic def.
7603         (Symbol_table::should_override): Add adjust_dyndef flag; set it
7604         for weak undef/dynamic def cases. Adjust callers.
7605         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
7606         undef_binding_weak_.
7607         (Symbol_table::sized_write_globals): Adjust symbol binding.
7608         (Symbol_table::sized_write_symbol): Add binding parameter.
7609         * symtab.h (Symbol::set_undef_binding): New method.
7610         (Symbol::is_undef_binding_weak): New method.
7611         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
7612         (Symbol_table::should_override): Add new parameter.
7613         (Symbol_table::sized_write_symbol): Add new parameter.
7614
7615         * testsuite/weak_undef_file1.cc: Add new test case.
7616         * testsuite/weak_undef_file2.cc: Fix header comment.
7617         * testsuite/weak_undef_test.cc: Add new test case.
7618
7619 2010-06-29  Doug Kwan  <dougkwan@google.com>
7620
7621         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
7622         Initialize USE_SYMBOL_.
7623         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
7624         definition.
7625         (Arm_reloc_property::uses_symbol_): New data member declaration.
7626         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
7627         uses symbol value and symbol is undefined but not weakly undefined.
7628
7629 2010-06-28  Rafael Espindola  <espindola@google.com>
7630
7631         * plugin.cc (Plugin::load): Use dlerror.
7632
7633 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
7634
7635         * symtab.cc (detect_odr_violations): When reporting an ODR
7636         violation, report an object where the symbol is defined.
7637
7638 2010-06-25  Doug Kwan  <dougkwan@google.com>
7639
7640         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
7641         (Target_arm::section_may_have_icf_unsafe_pointers): New method
7642         definition.
7643         (Target_arm::Scan::local_reloc_may_be_function_pointer,
7644         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
7645         target hook to detect function points.
7646         (Target_arm::Scan::possible_function_pointer_reloc): New method.
7647         * icf.h (Icf::check_section_for_function_pointers): Change type of
7648         parameter SECTION_NAME to const reference to std::string.  Use
7649         target hook to determine if section may have unsafe pointers.
7650         * target.h (Target::section_may_have_icf_unsafe_pointers): New
7651         method definition.
7652
7653 2010-06-21  Rafael Espindola  <espindola@google.com>
7654
7655         * fileread.cc (Input_file::find_fie): New
7656         (Input_file::open): Use Input_file::find_fie.
7657         * fileread.h (Input_file::find_fie): New
7658         * plugin.cc (set_extra_library_path): New.
7659         (Plugin::load): Add set_extra_library_path to the transfer vector.
7660         (Plugin_manager::set_extra_library_path): New.
7661         (Plugin_manager::add_input_file): Use the extra search path if set.
7662         (set_extra_library_path(): New.
7663         * plugin.h (Plugin_manager): Add set_extra_library_path and
7664         extra_search_path_.
7665
7666 2010-06-19  Cary Coutant  <ccoutant@google.com>
7667
7668         * layout.cc (gdb_sections): Add .debug_types.
7669         (lines_only_debug_sections): Likewise.
7670
7671 2010-06-18  Rafael Espindola  <espindola@google.com>
7672
7673         * plugin.cc (add_input_file,add_input_library)
7674         (Plugin_manager::add_input_file): Make filename arguments const.
7675         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
7676         const.
7677
7678 2010-06-16  Doug Kwan  <dougkwan@google.com>
7679
7680         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
7681         .ARM.attributes section if we have not merged any input
7682         attributes sections.
7683
7684 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7685
7686         * arm.cc: Allow combining objects with no EABI version
7687         information.
7688
7689 2010-06-15  Rafael Espindola  <espindola@google.com>
7690
7691         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
7692
7693 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7694
7695         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
7696         (struct iovec): Correct !HAVE_READV definition.
7697
7698 2010-06-10  Cary Coutant  <ccoutant@google.com>
7699
7700         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
7701         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
7702         reloc sections.
7703         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
7704
7705         PR 11683
7706         * symtab.h (Symbol::is_placeholder): New member function.
7707         * target-reloc.h (relocate_section): Check for placeholder symbols.
7708
7709         * testsuite/Makefile.am (plugin_test_8): New test.
7710         (plugin_test_9): New test.
7711         * testsuite/Makefile.in: Regenerate.
7712
7713 2010-06-09  Nick Clifton  <nickc@redhat.com>
7714
7715         * yyscript.y (input_list_element): Allow strings prefixed with
7716         the '-' character.  Treat these as libraries.
7717         * script.cc (script_add_library): New function.  Adds a library
7718         specified by "-l<name>" found in an input script.
7719         * script-c.h: Add prototype for script_add_library.
7720
7721 2010-06-07  Doug Kwan  <dougkwan@google.com>
7722
7723         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
7724         Restrict stub-group size to be within long conditional branch
7725         range when working around cortex-A8 erratum.
7726
7727 2010-06-07  Damien Diederen  <dd@crosstwine.com>
7728
7729         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
7730         #ifdef typo.
7731
7732 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
7733
7734         PR gold/11658
7735         * output.cc
7736         (Output_section::Input_section_sort_entry::compare_section_ordering):
7737         Change to return non-zero correctly.
7738         (Output_section::Input_section_sort_section_order_index_compare
7739         ::operator()): Change to fix ambiguity in comparisons.
7740
7741 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
7742
7743         * gold.h (is_wildcard_string): New function.
7744         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
7745         (Layout::layout_eh_frame): Ditto.
7746         (Layout::find_section_order_index): New method.
7747         (Layout::read_layout_from_file): New method.
7748         * layout.h (Layout::find_section_order_index): New method.
7749         (Layout::read_layout_from_file): New method.
7750         (Layout::input_section_position_): New private member.
7751         (Layout::input_section_glob_): New private member.
7752         * main.cc (main): Call read_layout_from_file here.
7753         * options.h (--section-ordering-file): New option.
7754         * output.cc (Output_section::input_section_order_specified_): New
7755         member.
7756         (Output_section::Output_section): Initialize new member.
7757         (Output_section::add_input_section): Add new parameter.
7758         Keep input sections when --section-ordering-file is used.
7759         (Output_section::set_final_data_size): Sort input sections when
7760         section ordering file is specified.
7761         (Output_section::Input_section_sort_entry): Add new parameter.
7762         Check sorting type.
7763         (Output_section::Input_section_sort_entry::compare_section_ordering):
7764         New method.
7765         (Output_section::Input_section_sort_compare::operator()): Change to
7766         consider section_order_index.
7767         (Output_section::Input_section_sort_init_fini_compare::operator()):
7768         Change to consider section_order_index.
7769         (Output_section::Input_section_sort_section_order_index_compare
7770         ::operator()): New method.
7771         (Output_section::sort_attached_input_sections): Change to sort
7772         according to section order when specified.
7773         (Output_section::add_input_section<32, true>): Add new parameter.
7774         (Output_section::add_input_section<64, true>): Add new parameter.
7775         (Output_section::add_input_section<32, false>): Add new parameter.
7776         (Output_section::add_input_section<64, false>): Add new parameter.
7777         * output.h (Output_section::add_input_section): Add new parameter.
7778         (Output_section::input_section_order_specified): New
7779         method.
7780         (Output_section::set_input_section_order_specified): New method.
7781         (Input_section::Input_section): Initialize section_order_index_.
7782         (Input_section::section_order_index): New method.
7783         (Input_section::set_section_order_index): New method.
7784         (Input_section::section_order_index_): New member.
7785         (Input_section::Input_section_sort_section_order_index_compare): New
7786         struct.
7787         (Output_section::input_section_order_specified_): New member.
7788         * script-sections.cc (is_wildcard_string): Delete and move modified
7789         method to gold.h.
7790         (Output_section_element_input::Output_section_element_input): Modify
7791         call to is_wildcard_string.
7792         (Output_section_element_input::Input_section_pattern
7793         ::Input_section_pattern): Ditto.
7794         (Output_section_element_input::Output_section_element_input): Ditto.
7795         * testsuite/Makefile.am (final_layout): New test case.
7796         * testsuite/Makefile.in: Regenerate.
7797         * testsuite/final_layout.cc: New file.
7798         * testsuite/final_layout.sh: New file.
7799
7800 2010-06-01  Rafael Espindola  <espindola@google.com>
7801
7802         * plugin.cc (Plugin::load): Pass the output name to the plugin.
7803
7804 2010-06-01  Rafael Espindola  <espindola@google.com>
7805
7806         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
7807         visibility of symbols.
7808
7809 2010-05-27  Doug Kwan  <dougkwan@google.com>
7810
7811         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
7812         from start of output section instead of address for a local symbol
7813         in a merged or relaxed section when doing a relocatable link.
7814
7815 2010-05-26  Rafael Espindola  <espindola@google.com>
7816
7817         PR 11604
7818         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
7819         adding sections the garbage collector removed.
7820         * gold/testsuite/Makefile.am: Add test.
7821         * gold/testsuite/Makefile.in: Regenerate.
7822         * gold/testsuite/plugin_test_7.sh: New.
7823         * gold/testsuite/plugin_test_7_1.c: New.
7824         * gold/testsuite/plugin_test_7_2.c: New.
7825
7826 2010-05-26  Rafael Espindola  <espindola@google.com>
7827
7828         * script-sections.cc (Output_section_definition::set_section_addresses):
7829         Check for --section-start.
7830
7831 2010-05-26  Doug Kwan  <dougkwan@google.com>
7832
7833         * arm.cc (Arm_scan_relocatable_relocs): New class.
7834         (Target_arm::relocate_special_relocatable): New method.
7835         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
7836         (Arm_relocate_functions::thumb_branch_common): Same.
7837         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
7838         instead of Default_scan_relocatable_relocs.
7839         * target-reloc.h (relocate_for_relocatable): Let target handle
7840         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
7841         * target.h (Sized_target::relocate_special_relocatable): New method.
7842
7843 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7844
7845         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
7846
7847 2010-05-23  Doug Kwan  <dougkwan@google.com>
7848
7849         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
7850         instead of a cast.
7851         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
7852         with a direct branch, not a conditional branch, to a stub.
7853         * merge.cc (Output_merge_base::record_input_section): New method
7854         defintion.
7855         (Output_merge_data::do_add_input_section): Record input section if
7856         keeps-input-sections flag is set.
7857         (Output_merge_string::do_add_input_section): Ditto.
7858         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
7859         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
7860         INPUT_SECTIONS_.
7861         (Output_merge_base::keeps_input_sections,
7862         Output_merge_base::set_keeps_input_sections,
7863         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
7864         method definitions.
7865         (Output_merge_base::Input_sections): New type declaration.
7866         (Output_merge_base::input_sections_begin,
7867         Output_merge_base::input_sections_end,
7868         Output_merge_base::do_set_keeps_input_sections): New method definitions.
7869         (Output_merge_base::bool keeps_input_sections_,
7870         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
7871         Output_merge_base::input_sections_): New data members.
7872         (Output_merge_data::do_set_keeps_input_sections): New method
7873         defintion.
7874         (Output_merge_string::do_set_keeps_input_sections): Ditto.
7875         * output.cc (Output_section::Input_section::relobj): Move method
7876         defintion from class declaration to here and handle merge sections.
7877         (Output_section::Input_section::shndx): Ditto.
7878         (Output_section::Output_section): Remove initializations of removed
7879         data members and initialize new data member LOOKUP_MAPS_.
7880         (Output_section::add_input_section): Set keeps-input-sections flag
7881         for a newly created merge output section as appropriate.  Adjust code
7882         to use Output_section_lookup_maps class.
7883         (Output_section::add_relaxed_input_section): Adjst code for lookup
7884         maps code refactoring.
7885         (Output_section::add_merge_input_section): Add a new parameter
7886         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
7887         class.  If adding input section to a newly created merge output
7888         section fails, remove the new merge section.
7889         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
7890         Adjust code for use of the Output_section_lookup_maps class.
7891         (Output_section::find_merge_section): Ditto.
7892         (Output_section::build_lookup_maps): New method defintion.
7893         (Output_section::find_relaxed_input_section): Adjust code to use
7894         Output_section_lookup_maps class.
7895         (Output_section::get_input_sections): Export merge sections.  Adjust
7896         code to use Output_section_lookup_maps class.
7897         (Output_section:::add_script_input_section): Adjust code to use
7898         Output_section_lookup_maps class.  Update lookup maps for merge
7899         sections also.
7900         (Output_section::discard_states): Use Output_section_lookup_maps.
7901         (Output_section::restore_states): Same.
7902         * output.h (Merge_section_properties): Move class defintion out of
7903         Output_section.
7904         (Output_section_lookup_maps): New class.
7905         (Output_section::Input_section::is_merge_section): New method
7906         defintion.
7907         (Output_section::Input_section::relobj): Move defintion out of class
7908         defintion.  Declare method only.
7909         (Output_section::Input_section::shndx): Ditto.
7910         (Output_section::Input_section::output_merge_base): New method defintion.
7911         (Output_section::Input_section::u2_.pomb): New union field.
7912         (Output_section::Merge_section_by_properties_map,
7913         Output_section::Output_section_data_by_input_section_map,
7914         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
7915         Remove types.
7916         (Output_section::add_merge_input_section): Add new parameter
7917         KEEPS_INPUT_SECTIONS.
7918         (Output_section::build_lookup_maps): New method declaration.
7919         (Output_section::merge_section_map_,
7920         Output_section::merge_section_by_properties_map_,
7921         Output_section::relaxed_input_section_map_,
7922         Output_section::is_relaxed_input_section_map_valid_): Remove data
7923         members.
7924         (Output_section::lookup_maps_): New data member.
7925
7926 2010-05-21  Doug Kwan  <dougkwan@google.com>
7927
7928         PR gold/11619
7929         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
7930         avoid a compilation error.
7931
7932 2010-05-19  Rafael Espindola  <espindola@google.com>
7933
7934         * script-sections.cc (Output_section_definition::allocate_to_segment):
7935         Update the phdrs_list even when the output section is NULL.
7936         * testsuite/Makefile.am: Add test.
7937         * testsuite/Makefile.in: Regenerate.
7938         * testsuite/script_test_9.cc: New.
7939         * testsuite/script_test_9.sh: New.
7940         * testsuite/script_test_9.t: New.
7941
7942 2010-05-19  Doug Kwan  <dougkwan@google.com>
7943
7944         * arm.cc (Arm_input_section::original_size): New method.
7945         (Arm_input_section::do_addralign): Add a cast.
7946         (Arm_input_section::do_output_offset): Remove static cast.
7947         (Arm_input_section::original_addralign,
7948          Arm_input_section::original_size_): Change type to uint32_t.
7949         (Arm_input_section::init): Add safe casts for section alignment
7950         and size.
7951         (Arm_input_section::set_final_data_size): Do not set address and
7952         offset of stub table.
7953         (Arm_output_section::fix_exidx_coverage): Change use of of
7954         Output_section::Simple_input_section to that of
7955         Output_section::Input_section.
7956         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
7957         except for the first pass.
7958         * output.cc (Output_section::get_input_sections): Change type of
7959         input_sections to std::list<Input_section>.
7960         (Output_section::add_script_input_section): Rename from
7961         Output_section::add_simple_input_section.  Change type of SIS
7962         parameter from Simple_input_section to Input_section.
7963         * output.h (Output_section::Simple_input_section): Remove class.
7964         (Output_section::Input_section): Change class visibility to public.
7965         (Output_section::Input_section::addralign): Use stored alignments
7966         for special input sections if set.
7967         (Output_section::Input_section::set_addralign): New method.
7968         (Output_section::get_input_sections): Change parameter type from
7969         list of Simple_input_section to list of Input_section.
7970         (Output_section::add_script_input_section): Rename from
7971         Output_section::add_simple_input_section. Change first parameter's
7972         type from Simple_input_section to Input_section and remove the
7973         second and third parameters.
7974         * script-sections.cc (Input_section::Input_section_list): Change
7975         type to list of Output_section::Input_section/
7976         (Input_section_info::Input_section_info): Change parameter type of
7977         INPUT_SECTION to Output_section::Input_section.
7978         (Input_section_info::input_section): Change return type.
7979         (Input_section_info::input_section_): Change type to
7980         Output_section::Input_section.
7981         (Output_section_element_input::set_section_addresses): Adjust code
7982         to use Output_section::Input_section instead of
7983         Output_section::Simple_input_section.  Adjust code for renaming
7984         of Output_section::add_simple_input_section.
7985         (Orphan_output_section::set_section_addresses): Ditto.
7986
7987 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7988
7989         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
7990         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
7991
7992 2010-05-18  Rafael Espindola  <espindola@google.com>
7993
7994         * options.cc (General_options::finalize): Handle -nostdlib.
7995         * options.h (nostdlib): New option.
7996         * script.cc (script_add_search_dir): Handle -nostdlib.
7997
7998 2010-05-12  Doug Kwan  <dougkwan@google.com>
7999
8000         * arm.cc (Target_arm::do_finalize_sections): Create an empty
8001         attributes section only if there no attributes section after merging.
8002         (Target_arm::merge_object_attributes): Move value of
8003         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
8004         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
8005         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
8006         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
8007         and arm_attr_merge_7.stdout.
8008         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
8009         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
8010         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
8011         arm_attr_merge_7b.o): New rules.
8012         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
8013         arm_attr_merge_7
8014         * testsuite/Makefile.in: Regenerate.
8015         * testsuite/arm_attr_merge.sh: New file.
8016         * testsuite/arm_attr_merge_[67][ab].s: Same.
8017
8018 2010-05-05  Nick Clifton  <nickc@redhat.com>
8019
8020         * po/es.po: Updated Spanish translation.
8021
8022 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
8023
8024         * Makefile.am (install-exec-local): Properly install gold as
8025         default cross linker.
8026         * Makefile.in: Regenerated.
8027
8028 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
8029             Nick Clifton  <nickc@redhat.com>
8030
8031         * configure.ac (install_as_default): Define and set to false
8032         unless --enable-gold or --enable-gold=both/gold has been
8033         specified.
8034         * configure: Regenerate.
8035
8036         * Makefile.am (install-exec-local): Install the executable as
8037         'ld.gold'.  If install_as_default is true then also install it as
8038         'ld'.
8039         * Makefile.in: Regenerated.
8040
8041 2010-04-24  Ian Lance Taylor  <iant@google.com>
8042
8043         * layout.cc (Layout::layout_reloc): In relocatable link don't
8044         combine reloc sections for grouped sections.
8045
8046 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
8047
8048         * gc.h (gc_process_relocs): Pass information on relocs pointing to
8049         sections that are not ordinary to icf.
8050         * icf.cc (get_section_contents): Handle relocation pointing to section
8051         with no object or shndx information.
8052         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
8053         * testsuite/Makefile.in: Regenerate.
8054         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
8055         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
8056
8057 2010-04-22  Ian Lance Taylor  <iant@google.com>
8058
8059         * expression.cc (Expression::Expression_eval_info): Add
8060         result_alignment_pointer field.
8061         (Expression::eval_with_dot): Add result_alignment_pointer
8062         parameter.  Change all callers.
8063         (Expression::eval_maybe_dot): Likewise.
8064         (class Binary_expression): Add alignment_pointer parameter to
8065         left_value and right_value.  Change all callers.
8066         (BINARY_EXPRESSION): Set result alignment.
8067         (class Trinary_expression): Add alignment_pointer parameter to
8068         arg2_value and arg3_value.  Change all callers.
8069         (Trinary_cond::value): Set result alignment.
8070         (Max_expression::value, Min_expression::value): Likewise.
8071         (Align_expression::value): Likewise.
8072         * script-sections.cc (class Sections_element): Add dot_alignment
8073         parameter to set_section_addresses virtual function.  Update
8074         instantiations.
8075         (class Output_section_element): Likewise.
8076         (Script_sections::create_segments): Add dot_alignment parameter.
8077         Change all callers.
8078         (Script_sections::create_segments_from_phdrs_clause): Likewise.
8079         (Script_sections::set_phdrs_clause_addresses): Likewise.
8080         * script-sections.h: Update declarations.
8081         * script.h: Update declarations.
8082         * output.h (Output_segment::set_minimum_p_align): Don't decrease
8083         min_p_align.
8084         * testsuite/script_test_3.t: Set large alignment.
8085         * testsuite/script_test_3.sh: Make sure that at least one LOAD
8086         segment has expected alignment.
8087
8088 2010-04-22  Nick Clifton  <nickc@redhat.com>
8089
8090         * po/gold.pot: Updated by the Translation project.
8091         * po/vi.po: Updated Vietnamese translation.
8092
8093 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
8094
8095         * testsuite/Makefile.am (check_PROGRAMS): Add
8096         icf_virtual_function_folding_test.
8097         * testsuite/Makefile.in: Regenerated.
8098
8099 2010-04-15  Andrew Haley  <aph@redhat.com>
8100
8101         * options.h (merge_exidx_entries): New option.
8102         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
8103         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
8104         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
8105         (Target_arm::merge_exidx_entries): New function.
8106         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
8107         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
8108         to Arm_exidx_fixup constructor.
8109         Add new arg, merge_exidx_entries.
8110         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
8111         Arm_output_section::fix_exidx_coverage.
8112
8113 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
8114
8115         * icf.cc (get_section_contents): Check for preemptible functions.
8116         Ignore addend when appropriate.
8117         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
8118         section folded.
8119         (add_from_relobj): Check for section folded.
8120         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
8121         * symtab.h (should_add_dynsym_entry): Add new parameter.
8122         * target-reloc.h (scan_relocs): Check for section folded.
8123         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
8124         Check reloc types for function pointers in shared objects.
8125         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
8126         case.
8127         (icf_preemptible_functions_test): New test case.
8128         (icf_string_merge_test): New test case.
8129         * testsuite.Makefile.in: Regenerate.
8130         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
8131         bar_glob.  Refactor code.
8132         * testsuite/icf_preemptible_functions_test.cc: New file.
8133         * testsuite/icf_preemptible_functions_test.sh: New file.
8134         * testsuite/icf_string_merge_test.cc: New file.
8135         * testsuite/icf_string_merge_test.sh: New file.
8136         * testsuite/icf_virtual_function_folding_test.cc: New file.
8137         * testsuite/icf_virtual_function_folding_test.sh: New file.
8138
8139 2010-04-14  Doug Kwan  <dougkwan@google.com>
8140
8141         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
8142         for local symbol recounting if we remove a section due to ICF.
8143         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
8144         there are no regular objects in input.
8145
8146 2010-04-13  Doug Kwan  <dougkwan@google.com>
8147
8148         * arm.cc (Arm_input_section::set_final_data_size): Compute
8149         accurate final data size instead of using current data size.
8150
8151 2010-04-09  Doug Kwan  <dougkwan@google.com>
8152
8153         * layout.cc (Layout::choose_output_section): Handle script section
8154         types.
8155         (Layout::make_output_section_for_script): Add section type parameter.
8156         Handle script section types.
8157         * layout.h (Layout::make_output_section_for_script): Add section
8158         type parameter.
8159         * output.cc (Output_section::Output_section): Initialize data member
8160         is_noload_.
8161         (Output_section::do_reset_address_and_file_offset): Do not set address
8162         to 0 if section is a NOLOAD section.
8163         * output.h (Output_section::is_noload): New method.
8164         (Output_section::set_is_noload): Ditto.
8165         (Output_section::is_noload_): New data member.
8166         * script-c.h (Script_section_type): New enum type.
8167         (struct Parser_output_section_header): Add new file section_type.
8168         * script-sections.cc (Sections_element::output_section_name): Add
8169         parameter for returning script section type.
8170         (Output_section_definition::output_section_name): Ditto.
8171         (Output_section_definition::section_type)P; New method.
8172         (Output_section_definiton::script_section_type_name): Ditto.
8173         (Output_section_definition::script_section_type_): New data member.
8174         (Output_section_definition::Output_section_definition): Initialize
8175         data member Output_section_definition::script_section_type_.
8176         (Output_section_definition::create_sections): Pass script section type
8177         to Layout::make_output_section_for_script.
8178         (Output_section_definition::output_section_name): Return script
8179         section type to caller.
8180         (Output_section_definition::set_section_address): Do not advance
8181         dot value and load address if section type is NOLOAD.  Set address
8182         of NOLOAD sections regardless of section flags.
8183         (Output_section_definition::print): Print section type if it is
8184         not SCRIPT_SECTION_TYPE_NONE.
8185         (Output_section_definition::section_type): New method.
8186         (Output_section_definition::script_section_type_name): Ditto.
8187         (Script_sections::output_section_name): Add new parameter
8188         PSECTION_TYPE for returning script section type.  Pass it to
8189         section elements.  Handle discard sections.
8190         (Sort_output_sections::operator()): Handle NOLOAD sections.
8191         * script-sections.h (Script_sections::Section_type): New enum type.
8192         (Script_sections::output_section_name): Add a new parameter for
8193         returning script section type.
8194         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
8195         INFO and NOLOAD.
8196         * yyscript.y (union): Add new field SECTION_TYPE.
8197         (COPY, DSECT, INFO, NOLOAD): New tokens.
8198         (opt_address_and_section_type): Change type to output_section_header.
8199         (section_type): New non-terminal
8200         (section_header): Handle section type.
8201         (opt_address_and_section_type): Return section type value.
8202
8203 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
8204
8205         * testsuite/plugin_common_test_1.c (foo): Add prototype.
8206         * testsuite/plugin_common_test_2.c (foo): Likewise.
8207
8208 2010-04-08  Doug Kwan  <dougkwan@google.com>
8209
8210         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
8211         Output_merge_data.
8212         * output.cc (Output_section::add_merge_input_section): Simplify
8213         code and return status of Output_merge_base::add_input_section.
8214         Update merge section map only if Output_merge_base::add_input_section
8215         returns true.
8216
8217 2010-04-07  Doug Kwan  <dougkwan@google.com>
8218
8219         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
8220         if section is marked as containing instructions but has no mapping
8221         symbols.
8222         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
8223         correct section index.
8224         (Arm_relobj::find_linked_text_section): Ditto.
8225
8226 2010-04-07  Cary Coutant  <ccoutant@google.com>
8227
8228         * archive.cc (include_member): Destroy Read_symbols_data object before
8229         releasing file.
8230         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
8231         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
8232         (Read_symbols_data::~Read_symbols_data) New destructor.
8233         (Section_relocs::Section_relocs) New constructor.
8234         (Section_relocs::~Section_relocs) New destructor.
8235         (Read_relocs_data::Read_relocs_data) New constructor.
8236         (Read_relocs_data::~Read_relocs_data) New destructor.
8237         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
8238         pointers to NULL after deleting.
8239
8240 2010-04-07  Doug Kwan  <dougkwan@google.com>
8241
8242         * arm.cc: Replace "endianity" with "endianness" in comments.
8243         (Arm_exidx_cantunwind): Ditto.
8244         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
8245         (Arm_relobj::merge_flags_and_attributes): New method.
8246         (Arm_relobj::merge_flags_and_attributes_): New data member.
8247         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
8248         (Arm_relobj::scan_sections_for_stubs): Ditto.
8249         (Arm_relobj::do_read_symbols): Check to see if we really want to
8250         merge processor-specific flags and attributes.  Exit early if
8251         an object is empty except for section names and the undefined symbol.
8252         (Target_arm::do_finalize_sections): Move check for ELF format to
8253         Arm_relobj::do_read_symbols.  Merge processor specific flags and
8254         attributes from a regular object only when we have determined that
8255         it is aapropriate.  Do not create an .ARM.attributes section in
8256         output if there is no regular input object.
8257         (Target_arm::merge_processor_specific_flags): Check
8258         --warn-mismatch before printing any error.
8259         (Target_arm::merge_object_attributes): Ditto.
8260         * gold.cc (queue_middle_tasks): Handle the case in which there is
8261         no regular object in input.
8262         * options.cc (General_options::parse_EB): New method.
8263         (General_options::parse_EL): Same.
8264         (General_options::General_options): Initialize endianness_.
8265         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
8266         New options.
8267         (General_options::Endianness): New enum.
8268         (General_options::endianness): New method.
8269         (General_options::endianness_): New data member.
8270         * parameters.cc (Parameters::set_options): Check target endianness.
8271         (Parameters::set_target_once): Ditto.
8272         (Parameters::check_target_endianness): New method.
8273         (parameters_force_valid_target): If either -EL or -EB is specified,
8274         use it to define endianness of default target.
8275         * parameters.h (Parameters::check_target_endianness): New method
8276         declaration.
8277         * target.h (class Target): Change "endianity" to "endianness"
8278         in comments.
8279
8280 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8281
8282         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
8283         * configure: Regenerate.
8284         * Makefile.in: Regenerate.
8285         * testsuite/Makefile.in: Regenerate.
8286
8287 2010-04-06  Cary Coutant  <ccoutant@google.com>
8288
8289         gcc PR lto/42757
8290         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
8291         prevailing definitions of common symbols.
8292         * testsuite/plugin_test_6.sh: New test case.
8293         * testsuite/plugin_common_test_1.c: New test case.
8294         * testsuite/plugin_common_test_2.c: New test case.
8295         * testsuite/Makefile.am (plugin_test_6): New test case.
8296         * testsuite/Makefile.in: Regenerate.
8297
8298 2010-04-06  Nick Clifton  <nickc@redhat.com>
8299
8300         * po/vi.po: New Vietnamese translation.
8301
8302 2010-03-30  Doug Kwan  <dougkwan@google.com>
8303
8304         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
8305
8306 2010-03-25  Doug Kwan  <dougkwan@google.com>
8307
8308         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
8309         to avoid a conversion warning on a 32-bit host.
8310
8311 2010-03-24  Ian Lance Taylor  <iant@google.com>
8312
8313         * testsuite/script_test_3.t: Add a TLS segment.
8314         * testsuite/Makefile.am (check_PROGRAMS): Add
8315         tls_phdrs_script_test.
8316         (tls_phdrs_script_test_SOURCES): Define.
8317         (tls_phdrs_script_test_DEPENDENCIES): Define.
8318         (tls_phdrs_script_test_LDFLAGS): Define.
8319         (tls_phdrs_script_test_LDADD): Define.
8320         * testsuite/Makefile.in: Rebuild.
8321
8322 2010-03-23  Cary Coutant  <ccoutant@google.com>
8323
8324         * fileread.cc (find_or_make_view): Fix comment.
8325
8326 2010-03-23  Ian Lance Taylor  <iant@google.com>
8327
8328         * script-sections.cc (class Orphan_section_placement): Define
8329         PLACE_TLS and PLACE_TLS_BSS.
8330         (Orphan_section_placement::Orphan_section_placement): Initialize
8331         new places.
8332         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
8333         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
8334         (tls_script_test_SOURCES): Define.
8335         (tls_script_test_DEPENDENCIES): Define.
8336         (tls_script_test_LDFLAGS): Define.
8337         (tls_script_test_LDADD): Define.
8338         * testsuite/Makefile.in: Rebuild.
8339
8340 2010-03-22  Doug Kwan  <dougkwan@google.com>
8341
8342         * arm.cc (Arm_relocate_functions::abs8,
8343         Arm_relocate_functions::abs16): Use correct check for overflow
8344         specified in the ARM ELF specs.
8345         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
8346         target of a BLX instruction specially.
8347         (Reloc_stub::stub_type_for_reloc): Ditto.
8348         (Relocate::relocate): Use symbolic names instead of numeric relocation
8349         codes to report error.
8350         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
8351         workaround.
8352         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
8353         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
8354         thumb2_blx_out_of_range.stdout
8355         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
8356         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
8357         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
8358         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
8359         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
8360         thumb2_blx_in_range, thumb2_blx_in_range.o,
8361         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
8362         thumb2_blx_out_of_range.o): New rules.
8363         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
8364         thumb2_blx_in_range and thumb2_blx_out_of_range.
8365         * testsuite/Makefile.in: Regenerate.
8366         * arm_branch_in_range.sh: Add tests for THUMB BLX.
8367         * testsuite/thumb_blx_in_range.s: New file.
8368         * testsuite/thumb_blx_out_of_range.s: New file.
8369
8370 2010-03-22  Rafael Espindola  <espindola@google.com>
8371
8372         * archive.cc (Should_include): Move to archive.h.
8373         (should_include_member): Make it a member of Archive.
8374         (Lib_group): New.
8375         (Add_lib_group_symbols): New.
8376         * archive.h: Include options.h.
8377         (Archive_member): Moved from Archive.
8378         (Should_include): Moved from archive.cc.
8379         (Lib_group): New.
8380         (Add_lib_group_symbols): New.
8381         * dynobj.cc (do_should_include_member): New.
8382         * dynobj.h (do_should_include_member): New.
8383         * gold.cc (queue_initial_tasks): Update call to queue.
8384         * main.cc (main): Print lib group stats.
8385         * object.cc (do_should_include_member): New.
8386         * object.h: Include archive.h.
8387         (Object::should_include_member): New.
8388         (Object::do_should_include_member): New.
8389         (Sized_relobj::do_should_include_member): New.
8390         * options.cc (General_options::parse_start_lib): New.
8391         (General_options::parse_end_lib): New.
8392         (Input_arguments::add_file): Handle lib groups.
8393         (Input_arguments::start_group): Check we are not in a lib.
8394         (Input_arguments::start_lib): New.
8395         (Input_arguments::end_lib): New.
8396         * options.h (General_options): Add start_lib and end_lib.
8397         (Input_argument::lib_): New.
8398         (Input_argument::lib): New.
8399         (Input_argument::is_lib): New.
8400         (Input_file_lib): New.
8401         (Input_arguments::in_lib_): New.
8402         (Input_arguments::in_lib): New.
8403         (Input_arguments::start_lib): New.
8404         (Input_arguments::end_lib_): New.
8405         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
8406         in unused members as preempted.
8407         (Sized_pluginobj::do_should_include_member): New.
8408         * plugin.h (Sized_pluginobj::do_should_include_member): New.
8409         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
8410         return the blocker.
8411         (Read_symbols::do_whole_lib_group): New.
8412         (Read_symbols::do_lib_group): New.
8413         (Read_symbols::do_read_symbols): Handle lib groups.
8414         (Read_symbols::get_name): Handle lib groups.
8415         * readsyms.h (Read_symbols): Add an archive member pointer.
8416         (Read_symbols::do_whole_lib_group): New.
8417         (Read_symbols::do_lib_group): New.
8418         (Read_symbols::member_): New.
8419         * script.cc (read_input_script): Update call to queue_soon.
8420
8421 2010-03-19  Doug Kwan  <dougkwan@google.com>
8422
8423         * arm.cc (Stub_table::Stub_table): Initialize new data members
8424         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
8425         (Stub_table::add_reloc_stub): Assign stub offset and update
8426         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
8427         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
8428         New data members.
8429         (Stub_table::update_data_size_and_addralign): Use
8430         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
8431         instead of going over all reloc stubs.
8432         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
8433         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
8434         Stringpool_template::offset_ to size of Stringpool_char.
8435         (Stringpool_template::new_key_offset): Remove code to initialize
8436         Stringpool_template::offset_.
8437         * stringpool.h (Stringpool_template::set_no_zero_null): Set
8438         Stringpool_template::offset_ to zero.
8439
8440 2010-03-15  Doug Kwan  <dougkwan@google.com>
8441
8442         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
8443         offset_.
8444         (Stringpool_template::new_key_offset): New method.
8445         (Stringpool_template::add_string): Assign offsets when adding new
8446         strings.
8447         (Stringpool_template::set_string_offsets): Do not set string offsets
8448         when not optimizing.
8449         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
8450         member size_.
8451         (Chunked_vector::clear): Clear size_.
8452         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
8453         (Chunked_vector::size): Return size_.
8454         (Chunked_vector::push_back): Use size_ to find insert position.
8455         (Chunked_vector::size_): New data member.
8456         (Stringpool_template::set_no_zero_null): Assert string set is empty.
8457         (Stringpool_template::new_key_offset): New method declaration.
8458         (Stringpool_template::offset_): New data member.
8459
8460 2010-03-15   Rafael Espindola  <espindola@google.com>
8461
8462         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
8463         Add_symbols' constructor.
8464         * readsyms.h (Add_symbols): Remove the input_group member.
8465
8466 2010-03-10  Ian Lance Taylor  <iant@google.com>
8467
8468         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
8469         target to ask whether a reference to a symbol requires a stack
8470         split.
8471         * target.h (Target::is_call_to_non_split): New function.
8472         (Target::do_is_call_to_non_split): Declare virtual function.
8473         * target.cc: Include "symtab.h".
8474         (Target::do_is_call_to_non_split): New function.
8475         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
8476
8477 2010-03-10  Cary Coutant  <ccoutant@google.com>
8478
8479         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
8480         (File_read::open[1]): Remove initial mapping of whole_file_view_.
8481         (File_read::open[2]): Add whole_file_view_ to list of views.
8482         (File_read::make_view): Remove test of whole_file_view_.
8483         (File_read::find_or_make_view): Create whole_file_view_ if
8484         necessary.
8485         (File_read::clear_views): Replace bool parameter with enum;
8486         adjust all callers.  Don't delete views with permanent data;
8487         do delete cached views and views from archives if
8488         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
8489         if clearing the corresponding view.
8490         * fileread.h (File_read::Clear_views_mode): New enum.
8491         (File_read::View::is_permanent_view): New method.
8492         (File_read::clear_views): Replace bool parameter
8493         with enum; adjust all callers.
8494         * options.h (General_options): Change keep_files_mapped option;
8495         add map_whole_files.
8496         * readsyms.cc (Add_symbols::run): Delete sd_ object before
8497         releasing the file.
8498         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
8499         the file.
8500
8501 2010-03-10  David S. Miller  <davem@davemloft.net>
8502
8503         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
8504
8505 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
8506
8507         * icf.cc (get_section_contents): Add '@' marker after processing the
8508         merge reloc.
8509
8510 2010-03-08  Doug Kwan  <dougkwan@google.com>
8511
8512         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
8513         due to a conversion warning.
8514         (Arm_relobj::update_output_local_symbol_count): Check for local
8515         symbol with unset output index.
8516
8517 2010-03-05  Ian Lance Taylor  <iant@google.com>
8518
8519         * options.h (class General_options): Add --spare-dynamic-tags.
8520         * output.cc (Output_data_dynamic::set_final_data_size): Implement
8521         --spare-dynamic-tags.
8522
8523 2010-03-05  Ian Lance Taylor  <iant@google.com>
8524
8525         * incremental.cc: Include "libiberty.h".
8526
8527 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
8528
8529         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
8530         function, is_info_ member.
8531         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
8532         (Versions::Versions): Update caller.
8533         (Versions::define_base_version): Likewise.
8534         (Versions::add_def): Likewise.
8535
8536 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
8537
8538         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
8539         (Scan::possible_function_pointer_reloc): New function.
8540         (Scan::local_reloc_may_be_function_pointer): Change to call
8541         possible_function_pointer_reloc.
8542         (Scan::global_reloc_may_be_function_pointer): Ditto.
8543         * icf.h (Icf::check_section_for_function_pointers): Change to reject
8544         relocations in ".data.rel.ro._ZTV" section.
8545         * testsuite/icf_safe_so_test.sh: Change to pass i386.
8546         * testsuite/icf_safe_so_test.cc: Ditto.
8547         * testsuite/icf_safe_test.cc: Ditto.
8548         * testsuite/icf_safe_test.sh: Ditto.
8549
8550 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8551             Ian Lance Taylor  <iant@google.com>
8552
8553         * target-reloc.h (relocate_section): Check the symbol table index
8554         for -1U before setting the local symbol index.
8555         (scan_relocatable_relocs): If copying the relocation, record that
8556         the local symbol is required.
8557         * object.h (Symbol_value::is_output_symtab_index_set): New
8558         function.
8559         (Symbol_value::may_be_discarded_from_output_symtab): New
8560         function.
8561         (Symbol_value::has_output_symtab_entry): New function.
8562         (Symbol_value::needs_output_symtab_entry): Remove.
8563         (Symbol_value::output_symtab_index): Make sure the symbol index is
8564         set.
8565         (Symbol_value::set_output_symtab_index): Make sure the symbol
8566         index is not set.  Make sure the new index is valid.
8567         (Symbol_value::set_must_have_output_symtab_entry): New function.
8568         (Symbol_value::has_output_dynsym_entry): New function.
8569         (Symbol_value::set_output_dynsym_index): Make sure the new index
8570         is valid.
8571         (Sized_relobj::set_must_have_output_symtab_entry): New function.
8572         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
8573         local symbol if permitted.
8574         (Sized_relobj::do_finalize_local_symbols): Call
8575         is_output_symtab_index_set rather than needs_output_symtab_entry.
8576         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
8577         rather than needs_output_symtab_entry.  Call
8578         has_output_dynsym_entry rather than needs_output_dynsym_entry.
8579         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
8580         is_output_symtab_index_set rather than needs_output_symtab_entry.
8581         * testsuite/discard_locals_relocatable_test.c: New file.
8582         * testsuite/discard_locals_test.sh: Test -r.
8583         * testsuite/Makefile.am (check_DATA): Add
8584         discard_locals_relocatable_test1.syms,
8585         discard_local_relocatable_test2.syms.
8586         (MOSTLYCLEANFILES): Likewise.  Also add
8587         discard_locals_relocatable_test1.lout and
8588         discard_locals_relocatable_test2.out.
8589         (discard_locals_relocatable_test1.syms): New target.
8590         (discard_locals_relocatable_test.o): New target.
8591         (discard_locals_relocatable_test1.out): New target.
8592         (discard_locals_relocatable_test2.syms): New target.
8593         (discard_locals_relocatable_test2.out): New target.
8594         (various): Add missing ../ld-new dependencies.
8595         * testsuite/Makefile.in: Rebuild.
8596
8597 2010-03-03  Nick Clifton  <nickc@redhat.com>
8598
8599         * po/fi.po: New Finnish translation.
8600
8601 2010-03-01  Doug Kwan  <dougkwan@google.com>
8602
8603         * layout.cc (Layout::Layout): Force section types of .init_array*,
8604         .preinit_array* and .fini_array* sections.
8605         * output.cc (Output_section::Input_section_sort_entry::has_priority):
8606         Fix check of return value of std::string::find.().
8607         (Output_section::Input_section_sort_compare::operator()): Remove
8608         comment about .init_array.
8609         (Output_section::Input_section_sort_init_fini_compare::operator()):
8610         New method.
8611         (Output_section::sort_attached_input_sections): Handle .init_array
8612         and .fini_array specially.
8613         * output.h (Output_section::Inut_section_sort_compare): Update
8614         comment.
8615         (Output_section::Input_section_sort_init_fini_compare): New struct.
8616
8617 2010-02-26  Doug Kwan  <dougkwan@google.com>
8618
8619         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
8620         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
8621         * testsuite/debug_msg.sh: Avoid matching source line number for
8622         use of global variable undef_int.
8623
8624 2010-02-26  Doug Kwan  <dougkwan@google.com>
8625
8626         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
8627         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
8628         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
8629         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
8630         * options.cc (General_options::General_options): Initialize member
8631         fix_v4bx_.
8632         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
8633         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
8634         and rm_no_fix_v4bx.stdout
8635         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
8636         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
8637         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
8638         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
8639         and arm_no_fix_v4bx.
8640         * Makefile.in: Regenerate.
8641         * testsuite/arm_fix_v4bx.s: New file.
8642         * testsuite/arm_fix_v4bx.sh: Ditto.
8643
8644 2010-02-24  Doug Kwan  <dougkwan@google.com>
8645
8646         * arm.cc (Target_arm::got_section): Make the .got section the first
8647         non RELRO section in the data segment.
8648         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
8649         suffixes of section names.
8650
8651 2010-02-24  Doug Kwan  <dougkwan@google.com>
8652
8653         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
8654         flags and attributes merging if an input file is a binary file.
8655         * fileread.cc (Input_file::open): Record format of original file.
8656         * fileread.h (Input_file::Format): New enum type.
8657         (Input_file::Input_file): Initialize data member format_.
8658         (Input_file::format): New method definition.
8659         (Input_file::format_):: New data member.
8660
8661 2010-02-24  Doug Kwan  <dougkwan@google.com>
8662
8663         * arm.cc (Arm_output_data_got): New class.
8664         (ARM_TCB_SIZE): New constant
8665         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
8666         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
8667         If user uses a script with a SECTIONS clause, issue only a warning
8668         for a misplaced EXIDX input section.  Otherwise, issue an error.
8669         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
8670         garbage collection.
8671         (Target_arm::got_mode_index_entry): Handle static linking.
8672         (Target_arm::Scan::local): Ditto.
8673         (Target_arm::Scan::global): Ditto.
8674         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
8675         all incorrectly implemented relocations.
8676         (Target_arm::fix_exidx_coverage): Pass layout to
8677         Arm_output_section::fix_exidx_coverage.
8678         * layout.cc (Layout::section_name_mapping): Remove trailing dots
8679         from ".ARM.exidx." and ".ARM.extab.".
8680
8681 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8682
8683         * arm.cc (Target_arm::do_finalize_sections): Create attribute
8684         section if it does not already exist.
8685         * attributes.cc (Attributes_section_data::Attributes_section_data):
8686         Don't crash if size is zero.
8687
8688 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8689             Ian Lance Taylor  <iant@google.com>
8690
8691         * gold.cc (queue_middle_tasks): If no input files were opened,
8692         exit.
8693         * workqueue.h (Task_function::Task_function): Assert that there is
8694         a blocker.
8695
8696 2010-02-22  Doug Kwan  <dougkwan@google.com>
8697
8698         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
8699         * icf.cc (get_section_contents): Cast snprintf arguments to long long
8700         types to avoid warnings due to different uint64_t implementations
8701         on different hosts.
8702
8703 2010-02-21  Doug Kwan  <dougkwan@google.com>
8704
8705         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
8706         handling of the maximum backward branch offset.
8707         (Arm_relocate_functions::thumb_branch_common): Ditto.
8708         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
8709         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
8710         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
8711         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
8712         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
8713         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
8714         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
8715         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
8716         thumb_bl_out_of_range thumb_bl_out_of_range.o,
8717         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
8718         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
8719         thumb2_bl_out_of_range.o): New rules.
8720         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
8721         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
8722         thumb2_bl_out_of_range
8723         * testsuite/Makefile.in: Regenerate.
8724         * testsuite/arm_bl_in_range.s: New file.
8725         * testsuite/arm_bl_out_of_range.s: Ditto.
8726         * testsuite/arm_branch_in_range.sh: Ditto.
8727         * testsuite/arm_branch_range.t: Ditto.
8728         * testsuite/thumb2_branch_range.t: Ditto.
8729         * testsuite/thumb_bl_in_range.s: Ditto.
8730         * testsuite/thumb_bl_out_of_range.s: Ditto.
8731         * testsuite/thumb_branch_range.t: Ditto.
8732
8733 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
8734
8735         * gc.h (gc_process_relocs): Change vectors to point to the new list.
8736         Add reloc offset information.
8737         * icf.cc (get_section_contents): Change iterators to point to the new
8738         vectors. Add reloc offset information to the contents.
8739         * icf.h (Icf::Sections_reachable_info): New typedef.
8740         (Icf::Sections_reachable_list): New typedef.
8741         (Icf::Offset_info): New typedef.
8742         (Icf::Reloc_info): New struct typedef.
8743         (Icf::Reloc_info_list): New typedef.
8744         (Icf::symbol_reloc_list): Delete method.
8745         (Icf::addend_reloc_list): Delete method.
8746         (Icf::section_reloc_list): Delete method.
8747         (Icf::reloc_info_list): New method.
8748         (Icf::reloc_info_list_): New member.
8749
8750 2010-02-19  Doug Kwan  <dougkwan@google.com>
8751
8752         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
8753         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
8754         * arm.cc (Arm_relocation_functions): New forward declaration.
8755         (Target_arm::Target_arm): Initialize new data members
8756         got_mod_index_offset_ and tls_base_symbol_defined_.
8757         (Target_arm::Relocate::relocate_tls): New method.
8758         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
8759          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
8760         New methods.
8761         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
8762         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
8763         (Target_arm::got_mod_index_offset_,
8764         Target_arm::tls_base_symbol_defined_): New data members.
8765         (Target_arm::Scan::local, Target::Scan::global,
8766         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
8767         relocations.
8768
8769 2010-02-18  Doug Kwan  <dougkwan@google.com>
8770
8771         * arm.cc (Arm_relobj::find_linked_text_section): New method.
8772         (Arm_relobj::make_exidx_input_section): Pass section index of linked
8773         text section as a parameter becuase some broken tools may not set
8774         the link in section header.
8775         (Target_arm::has_got_section): New method.
8776         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
8777         without any mapping symbol as data only.  Remove warning.
8778         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
8779         link in its section header, try to discover the link by inspecting the
8780         REL31 relocation at the beginning of the section.
8781         (Target_arm::Scan::check_non_pic): Report name of offending relocation
8782         in error message.
8783         (Target_arm::Scan::global): Treat any reference to the symbol
8784         _GLOBAL_OFFSET_TABLE_ as a GOT access.
8785
8786 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
8787
8788         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
8789         (Scan::global_reloc_may_be_function_pointer): New function.
8790         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
8791         (Scan::global_reloc_may_be_function_pointer): New function.
8792         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
8793         (Scan::global_reloc_may_be_function_pointer): New function.
8794         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
8795         (Scan::global_reloc_may_be_function_pointer): New function.
8796         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
8797         (Scan::global_reloc_may_be_function_pointer): New function.
8798         (Scan::possible_function_pointer_reloc): New function.
8799         (Target_x86_64::can_check_for_function_pointers): New function.
8800         * gc.h (gc_process_relocs): Scan relocation types to determine if
8801         function pointers were taken for targets that support it.
8802         * icf.cc (Icf::find_identical_sections): Include functions for
8803         folding in safe ICF whose pointer is not taken.
8804         * icf.h (Secn_fptr_taken_set): New typedef.
8805         (fptr_section_id_): New member.
8806         (section_has_function_pointers): New function.
8807         (set_section_has_function_pointers): New function.
8808         (check_section_for_function_pointers): New function.
8809         * options.h: Fix comment for safe ICF option.
8810         * target.h (can_check_for_function_pointers): New function.
8811         * testsuite/Makefile.am: Add icf_safe_so_test test case.
8812         Modify icf_safe_test for X86-64.
8813         * testsuite/Makefile.in: Regenerate.
8814         * testsuite/icf_safe_so_test.cc: New file.
8815         * testsuite/icf_safe_so_test.sh: New file.
8816         * testsuite/icf_safe_test.cc (kept_func_3): New function.
8817         (main): Change to take pointer to function kept_func_3.
8818         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
8819         folding is done correctly for X86-64.
8820
8821 2010-02-12  David S. Miller  <davem@davemloft.net>
8822
8823         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
8824         is_symbolless parameter.
8825         (Output_reloc<SHT_REL>::is_symbolless): New.
8826         (Output_reloc<SHT_REL>::is_symbolless_): New.
8827         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
8828         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
8829         (Output_reloc<SHT_RELA>::is_symbolless): New.
8830         (Output_data_reloc::add_global): Handle is_symbolless.
8831         (Output_data_reloc::add_global_relative): Likewise.
8832         (Output_data_reloc::add_local): Likewise.
8833         (Output_data_reloc::add_local_relative): Likewise.
8834         (Output_data_reloc::add_symbolless_global_addend): New.
8835         (Output_data_reloc::add_symbolless_local_addend): New.
8836         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
8837         is_symbolless.
8838         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
8839         instead of ->is_relative_
8840         (Output_reloc::write): Likewise.
8841         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
8842         (Output_reloc::write_rel): Simplify.
8843
8844         * sparc.cc (Target_sparc::Scan::local): Use
8845         ->add_symbolless_local_addend as needed.
8846         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
8847         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
8848         based upon relocation offset.
8849
8850 2010-02-11  Doug Kwan  <dougkwan@google.com>
8851
8852         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
8853         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
8854         beginning of function.
8855         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
8856         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
8857         parameter is_32bit in calls to should_apply_static_reloc.
8858         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
8859         (check_DATA): Add arm_abs_global.stdout.
8860         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
8861         arm_abs_global.stdout): New rules.
8862         (MOSTLLYCLEANFILES): Add arm_abs_global
8863         * Makefile.in: Regenerate.
8864         * testsuite/arm_abs_global.s: New file.
8865         * testsuite/arm_abs_global.sh: Ditto.
8866         * testsuite/arm_abs_lib.s: Ditto.
8867
8868 2010-02-11  Ian Lance Taylor  <iant@google.com>
8869
8870         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
8871         Read_relocs task.
8872         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
8873         Allocate_commons_task first.
8874         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
8875         task, rather than symtab_lock_.
8876         (Gc_process_relocs::~Gc_process_relocs): New function.
8877         (Gc_process_relocs::is_runnable): Check this_blocker_.
8878         (Gc_process_relocs::locks): Use next_blocker_ rather than
8879         blocker_.
8880         (Scan_relocs::~Scan_relocs): New function.
8881         (Scan_relocs::is_runnable): Check this_blocker_ rather than
8882         symtab_lock_.
8883         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
8884         next_blocker_.
8885         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
8886         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
8887         constructor accordingly.
8888         (class Gc_process_relocs): Likewise.
8889         (class Scan_relocs): Likewise.
8890         * common.h (class Allocate_commons_task): Remove symtab_lock_
8891         field, and corresponding constructor parameter.
8892         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
8893         symtab_lock_.
8894         (Allocate_commons_task::locks): Likewise.
8895
8896 2010-02-11  Ian Lance Taylor  <iant@google.com>
8897
8898         * gold-threads.h (class Once): Define.
8899         (class Initialize_lock): Rewrite as child of Once.
8900         * gold-threads.cc (class Once_initialize): Define.
8901         (once_pointer_control): New static variable.
8902         (once_pointer, once_arg): New static variables.
8903         (c_run_once): New static function.
8904         (Once::Once, Once::run_once, Once::internal_run): New functions.
8905         (class Initialize_lock_once): Remove.
8906         (initialize_lock_control): Remove.
8907         (initialize_lock_pointer): Remove.
8908         (initialize_lock_once): Remove.
8909         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
8910         (Initialize_lock::initialize): Rewrite.
8911         (Initialize_lock::do_run_once): New function.
8912         * archive.cc (Archive::interpret_header): Only clear name if it is
8913         not already empty.
8914         * fileread.cc: Include "gold-threads.h"
8915         (file_counts_lock): New static variable.
8916         (file_counts_initialize_lock): Likewise.
8917         (File_read::release): Only increment counts when using --stats.
8918         Use a lock around the increment.
8919         * parameters.cc (class Set_parameters_target_once): Define.
8920         (set_parameters_target_once): New static variable.
8921         (Parameters::Parameters): Move here from parameters.h.
8922         (Parameters::set_target): Rewrite.
8923         (Parameters::set_target_once): New function.
8924         (Parameters::clear_target): Move here and rewrite.
8925         * parameters.h (class Parameters): Update declarations.  Add
8926         set_parameters_target_once_ field.
8927         (Parameters::Parameters): Move to parameters.cc.
8928         (Parameters::clear_target): Likewise.
8929         * readsyms.cc (Read_symbols::do_group): Create a Start_group
8930         task.
8931         (Start_group::~Start_group): New function.
8932         (Start_group::is_runnable): New function.
8933         (Start_group::locks, Start_group::run): New functions.
8934         (Finish_group::run): Change saw_undefined to size_t.
8935         * readsyms.h (class Start_group): Define.
8936         (class Finish_group): Change saw_undefined_ field to size_t.
8937         (Finish_group::Finish_group): Remove saw_undefined and
8938         this_blocker parameters.  Change all callers.
8939         (Finish_group::set_saw_undefined): New function.
8940         (Finish_group::set_blocker): New function.
8941         * symtab.h (class Symbol_table): Change saw_undefined to return
8942         size_t.  Change saw_undefined_ field to size_t.
8943         * target-select.cc (Set_target_once::do_run_once): New function.
8944         (Target_selector::Target_selector): Initialize set_target_once_
8945         field.  Don't initialize lock_ and initialize_lock_ fields.
8946         (Target_selector::instantiate_target): Rewrite.
8947         (Target_selector::set_target): New function.
8948         * target-select.h (class Set_target_once): Define.
8949         (class Target_selector): Update declarations.  Make
8950         Set_target_once a friend.  Remove lock_ and initialize_lock_
8951         fields.  Add set_target_once_ field.
8952
8953 2010-02-10  Ian Lance Taylor  <iant@google.com>
8954
8955         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
8956         queueing any tasks.
8957         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
8958         (queue_middle_tasks): Add all blockers before queueing any tasks.
8959         (queue_final_tasks): Likewise.
8960         * token.h (Task_token::add_blockers): New function.
8961         * object.h (Input_objects::number_of_relobjs): New function.
8962
8963 2010-02-10  Ian Lance Taylor  <iant@google.com>
8964
8965         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
8966         shared, not if not position independent.
8967         * x86_64.cc (Relocate::relocate_tls): Likewise.
8968         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
8969         (tls_pie_pic_test): New target.
8970         * testsuite/Makefile.in: Rebuild.
8971
8972         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
8973         (tls_test_main_pie.o, tls_test_pie.o): New targets.
8974         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
8975         * testsuite/Makefile.in: Rebuild.
8976
8977 2010-02-09  David S. Miller  <davem@davemloft.net>
8978
8979         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
8980         R_SPARC_RELATIVE using ->add_local_relative().
8981         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
8982
8983         * output.h (Output_data_dynamic::add_section_size): New method
8984         that takes two Output_data objects.
8985         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
8986         entry param.  Handle it in initializers.
8987         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
8988         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
8989         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
8990         arg.
8991         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
8992         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
8993         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
8994         for dynrel_includes_plt.
8995         * i386.cc (Target_i386::do_finalize_sections): Likewise.
8996         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8997         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
8998         before .rela.plt
8999         (Target_sparc::do_finalize_sections): Update to pass true for
9000         dynrel_includes_plt.
9001         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
9002         output before .rela.plt
9003         (Target_powerpc::do_finalize_sections): Update to pass true for
9004         dynrel_includes_plt when 32-bit.
9005
9006 2010-02-08  Doug Kwan  <dougkwan@google.com>
9007
9008         * arm.cc (Arm_relobj::simple_input_section_output_address): New
9009         method.
9010         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
9011         Arm_relobj::scan_section_for_cortex_a8_stubs,
9012         Arm_relobj::do_relocation_section): Instead of calling
9013         Output_section::output_address, use faster
9014         Arm_relobj::simple_input_section_output_address.
9015
9016 2010-02-08  David S. Miller  <davem@davemloft.net>
9017
9018         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
9019         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
9020         relocation helper function.
9021
9022         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
9023         just like R_SPARC_GOT{10,13,22}.
9024         (Target_sparc::Scan::local): Likewise.
9025         (Target_sparc::Relocate:relocate): Likewise.
9026
9027 2010-02-06  Ian Lance Taylor  <iant@google.com>
9028
9029         * configure.ac: Rewrite targetobjs duplicate removal code to use
9030         only shell constructs.
9031         * configure: Rebuild.
9032
9033 2010-02-05  Doug Kwan  <dougkwan@google.com>
9034
9035         PR 11247
9036         * arm.cc (Arm_relobj::section_is_scannable): New method.
9037         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
9038         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
9039
9040 2010-02-04  Doug Kwan  <dougkwan@google.com>
9041
9042         PR 11247
9043         * arm-reloc-property.cc (cstdio): Include.
9044         * configure.ac (targetobjs): Remove duplicates.
9045         * configure: Regenerate.
9046         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
9047         big and little endian version for a given address size.
9048
9049 2010-02-03  Doug Kwan  <dougkwan@google.com>
9050
9051         * arm-reloc-property.cc
9052         (Arm_reloc_property_table::reloc_name_in_error_message): New method
9053         definition.
9054         * arm-reloc-property.h
9055         (Arm_reloc_property_table::get_implemented_static_reloc_property):
9056         New method definition.
9057         (Arm_reloc_property_table::reloc_name_in_error_message): New method
9058         declaration.
9059         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
9060         overflow to N.
9061         (GOT_PREL): Change implemented to Y.
9062         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
9063         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
9064         (Arm_relocate_functions::movw_abs_nc): Remove method.
9065         (Arm_relocate_functions::movt_abs): Ditto.
9066         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
9067         (Arm_relocate_functions::thm_movt_abs): Ditto.
9068         (Arm_relocate_functions::movw_rel_nc): Ditto.
9069         (Arm_relocate_functions::movw_rel): Ditto.
9070         (Arm_relocate_functions::movt_rel): Ditto.
9071         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
9072         (Arm_relocate_functions:thm_movw_rel): Ditto.
9073         (Arm_relocate_functions:thm_movt_rel): Ditto.
9074         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
9075         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
9076         New method definitions.
9077         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
9078         (Arm_relocation_functions::arm_grp_ldr): Ditto.
9079         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
9080         (Arm_relocation_functions::arm_grp_ldc): Ditto.
9081         (Target_arm::Relocate::relocate): Check for non-static or
9082         unimplemented relocation code and exit early.  Change calls to
9083         Target_arm::reloc_uses_thumb_bit and
9084         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
9085         instead.  Refactor code to handle similar relocations to increase
9086         code sharing.  Remove check for unsupported relocation code in switch
9087         statement.
9088         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
9089         relocation property table to find out size.  Change error message to
9090         print out the name of a relocation code instead of the numeric value.
9091         (Target_arm::scan_reloc_for_stub): Use relocation property table
9092         instead of calling Target_arm::reloc_uses_thumb_bit().
9093
9094 2010-02-02  Doug Kwan  <dougkwan@google.com>
9095
9096         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
9097         types of relaxed input section.
9098
9099 2010-02-02  Doug Kwan  <dougkwan@google.com>
9100
9101         * Makefile.am (HFILES): Add arm-reloc-property.h.
9102         (DEFFILES): New.
9103         (TARGETSOURCES): Add arm-reloc-property.cc
9104         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
9105         (libgold_a_SOURCES): $(DEFFILES)
9106         * Makefile.in: Regenerate.
9107         * arm-reloc-property.cc: New file.
9108         * arm-reloc-property.h: New file.
9109         * arm-reloc.def: New file.
9110         * arm.cc: Update comments.
9111         (arm-reloc-property.h): New included header.
9112         (arm_reloc_property_table): New global variable.
9113         (Target_arm::do_select_as_default_target): New method definition.
9114         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
9115         arm-reloc-property to targ_extra_obj.
9116         * parameters.cc (set_parameters_target): Call
9117         Target::select_as_default_target().
9118         * target.h (Target::select_as_default_target): New method definition.
9119         (Target::do_select_as_default_target): Same.
9120
9121 2010-02-01  Doug Kwan  <dougkwan@google.com>
9122
9123         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
9124         first_output_text_section_.
9125         (Arm_exidx_fixup::first_output_text_section): New method definition.
9126         (Arm_exidx_fixup::first_output_text_section_): New data member.
9127         (Arm_exidx_fixup::process_exidx_section): Record the first text
9128         output section seen.
9129         (Arm_output_section::fix_exidx_coverage): Set correct linked section
9130         and entsize in output section header.
9131
9132 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9133
9134         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
9135         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
9136         (Arm_relocate_functions::thm_alu11): New Method.
9137         (Arm_relocate_functions::thm_pc8): New Method.
9138         (Arm_relocate_functions::thm_pc12): New Method.
9139         (Target_arm::Scan::local): Handle the relocations.
9140         (Target_arm::Scan::global): Likewise.
9141         (Target_arm::Relocate::relocate): Likewise.
9142         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9143
9144 2010-01-29  Doug Kwan  <dougkwan@google.com>
9145
9146         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
9147         of relocation types as ld.
9148
9149 2010-01-29  Doug Kwan  <dougkwan@google.com>
9150
9151         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
9152         to public.
9153         (Arm_relocate_functions::thumb_branch_common): Ditto.
9154         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
9155         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
9156         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
9157         Arm_relocate_functions::jump24): Remove.
9158         (Target_arm::Relocate::relocate): Adjust code to call
9159         Arm_relocation_functions::arm_branch_common and
9160         Arm_relocation_functions::thumb_branch_common instead of their removed
9161         wrappers.  Merge switch-cases together to reduce source code size.
9162
9163 2010-01-29  Doug Kwan  <dougkwan@google.com>
9164
9165         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
9166         output_local_symbol_count_needs_update_.
9167         (Arm_relobj::output_local_symbol_count_needs_update,
9168          Arm_relobj::set_output_local_symbol_count_needs_update,
9169          Arm_relobj::update_output_local_symbol_count): New methods.
9170         (Arm_relobj::output_local_symbol_count_needs_update_): New data
9171         member.
9172         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
9173         of pointed function as in a R_ARM_PREL31 relocation.
9174         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
9175         for output local symbol count updating.
9176         (Target_arm::do_relax): Update output local symbol counts in objects
9177         if necessary.
9178         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
9179
9180 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9181
9182         * arm.cc: Added support for the ARM relocations:
9183         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
9184         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
9185         (Arm_relocate_functions::movw_rel_nc): Renamed (was
9186         movw_prel_nc).
9187         (Arm_relocate_functions::movw_rel): New method.
9188         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
9189         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
9190         thm_movw_prel_nc).
9191         (Arm_relocate_functions::thm_movw_rel): New method.
9192         (Arm_relocate_functions::thm_movt_rel): Renamed (was
9193         thm_movt_prel).
9194         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
9195         relocations.
9196         (Target_arm::Scan::global): Likewise.
9197         (Target_arm::Relocate::relocate): Likewise.
9198         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9199         Likewise.
9200
9201 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9202
9203         * arm.cc: Added support for ARM group relocations.
9204         (Target_arm::reloc_needs_sym_origin): New method.
9205         (Arm_relocate_functions::calc_grp_kn): New method.
9206         (Arm_relocate_functions::calc_grp_residual): New method.
9207         (Arm_relocate_functions::calc_grp_gn): New method.
9208         (Arm_relocate_functions::arm_grp_alu): New Method.
9209         (Arm_relocate_functions::arm_grp_ldr): New Method.
9210         (Arm_relocate_functions::arm_grp_ldrs): New Method.
9211         (Arm_relocate_functions::arm_grp_ldc): New Method.
9212         (Target_arm::Scan::local): Handle the ARM group relocations.
9213         (Target_arm::Scan::global): Likewise.
9214         (Target_arm::Relocate::relocate): Likewise.
9215         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9216         Likewise.
9217
9218 2010-01-26  Doug Kwan  <dougkwan@google.com>
9219
9220         * arm.cc (set): Include.
9221         (class Arm_exidx_fixup): Change type of last_input_section_ to const
9222         pointer type.
9223         (Arm_output_section::Text_section_list): New type.
9224         (Arm_output_section::append_text_sections_to_list): New method.
9225         (Arm_output_section::fix_exidx_coverage): Ditto.
9226         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
9227         (Arm_relobj::convert_input_section_to_relaxed_section): Use
9228         Relobj::set_section_offset() instead of
9229         Sized_relobj::invalidate_section_offset().
9230         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
9231         parameter for section headers. Ignore relocation sections for
9232         unallocated sections and EXIDX sections.
9233         (Target_arm::fix_exidx_coverage): New method.
9234         (Target_arm::output_section_address_less_than): New type.
9235         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
9236         linked text section instead of the EXIDX section.
9237         (Arm_output_section::create_stub_group): Add an assertion to check
9238         that this is not an EXIDX output section.
9239         (Arm_output_section::append_text_sections_to_list): New method.
9240         (Arm_output_section::fix_exidx_coverage): Ditto.
9241         (Arm_relobj::scan_sections_for_stubs): Adjust call to
9242         Arm_relobj::section_needs_reloc_stub_scanning.
9243         (Target_arm::do_relax): Fix EXIDX output section coverage in the
9244         first pass.
9245         (Target_arm::fix_exidx_coverage): New method.
9246         * object.h (Relobj::set_output_section): New method.
9247         (Sized_relobj::invalidate_section_offset): Remove method.
9248         (Sized_relobj::do_invalidate_section_offset): Remove method.
9249         (Sized_relobj::do_set_section_offset): Handle offset value -1.
9250
9251 2010-01-25  Doug Kwan  <dougkwan@google.com>
9252
9253         * arm.cc (Arm_exidx_merged_section::do_output_offset):
9254         Fix warning due to signed and unsigned comparison on a 32-bit host.
9255
9256 2010-01-22  Doug Kwan  <dougkwan@google.com>
9257
9258         * arm.cc (Target_arm::do_relax): Record an output section for section
9259         offset adjustment it contains any stub table that has changed.
9260         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
9261         offsets in an output section if necessary.
9262         * output.cc (Output_section::Output_section): Initialize
9263         section_offsets_need_adjustments_.
9264         (Output_section::add_input_section_for_script): Renamed to
9265         Output_section::add_simple_input_section.
9266         (Output_section::save_states): Add a comment.
9267         (Output_section::discard_states): New method defintion.
9268         (Output_section::adjust_section_offsets): Same.
9269         * output.h (Output_section::add_input_section_for_script): Renamed to
9270         Output_section::add_simple_input_section.
9271         (Output_section::discard_states): New method declaration.
9272         (Output_section::adjust_section_offsets): Same.
9273         (Output_section::section_offsets_need_adjustment,
9274         Output_section::set_section_offsets_need_adjustment): New method
9275         definitions.
9276         (Output_section::section_offsets_need_adjustment_): New data member.
9277         * script-sections.cc
9278         (Output_section_element_input::set_section_address): Adjust code for
9279         renaming of Output_section::add_input_section_for_script.
9280         (Orphan_output_section::set_section_address): Same.
9281
9282 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9283
9284         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
9285         Fix_v4bx enum values .
9286         * gold/options.h (General_options): New option definitions.
9287         (General_options::fix_v4bx): New method.
9288         (General_options::Fix_v4bx): New enum.
9289         * gold/options.cc (General_options::parse_fix_v4bx): New method.
9290         (General_options::parse_fix_v4bx_interworking): New method.
9291
9292 2010-01-22  Doug Kwan  <dougkwan@google.com>
9293
9294         * arm.cc (Arm_exidx_fixup): New class.
9295
9296 2010-01-21  Doug Kwan  <dougkwan@google.com>
9297
9298         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
9299         classes.
9300         (Arm_exidx_section_offset_map): New type.
9301
9302 2010-01-21  Doug Kwan  <dougkwan@google.com>
9303
9304         * arm.cc (Arm_exidx_input_section): New class.
9305         (Arm_relobj::exidx_input_section_by_link,
9306         Arm_relobj::exidx_input_section_by_shndx,
9307         Arm_relobj::make_exidx_input_section): New methods.
9308         (read_arm_attributes_section): Remove.
9309         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
9310         information about them.
9311         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
9312         to here.
9313
9314 2010-01-20  Doug Kwan  <dougkwan@google.com>
9315
9316         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
9317         Input_section_specifier to Section_id.
9318         (Target_arm::new_arm_input_section: Adjust code for change of key
9319         type.
9320         (Target_arm::find_arm_input_section): Ditto.
9321         * gc.h (object.h): Include for Section_id nand Section_id_hash.
9322         (Section_id): Remove.
9323         (Garbage_collection::Section_id_hash): Remove.
9324         * icf.h (object.h): Include for Section_id nand Section_id_hash.
9325         (Section_id): Remove.
9326         (Icf::Section_id_hash): Remove.
9327         * object.h (Section_id, Const_section_id, Section_id_hash,
9328         Const_section_id_hash): New type definitions.
9329         * output.cc (Output_section::add_relaxed_input_section): Change to
9330         use Const_section_id instead of Input_section_specifier as key type.
9331         (Output_section::add_merge_input_section): Ditto.
9332         (Output_section::build_relaxation_map): Change to use Section_id
9333         instead of Input_section_specifier as key type.
9334         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
9335         Ditto.
9336         (Output_section::convert_input_sections_to_relaxed_sections): Change
9337         to use Const_section_id instead of Input_section_specifier as key type.
9338         (Output_section::find_merge_section): Ditto.
9339         (Output_section::find_relaxed_input_section): Ditto.
9340         * output.h (Input_section_specifier): Remove class.
9341         (Output_section::Output_section_data_by_input_section_map): Change
9342         key type to Const_section_id.
9343         (Output_section::Output_relaxed_input_section_by_input_section_map):
9344         Ditto.
9345         (Output_section::Relaxation_map): Change key type to Section_id.
9346
9347 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9348
9349         * gold/arm.cc: Added support for R_ARM_V4BX relocation
9350         (class Arm_v4bx_stub): New class.
9351         (DEF_STUBS): Updated definition to support v4_veneer_bx.
9352         (Stub_factory::make_arm_v4bx_stub): New method.
9353         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
9354         (Stub_table::empty): Handle v4bx stubs.
9355         (Stub_table::add_arm_v4bx_stub): New method.
9356         (Stub_table::find_arm_v4bx_stub): New method.
9357         (Arm_relocate_functions::v4bx): New method.
9358         (Target_arm::fix_v4bx): New method.
9359         (Target_arm::Target_arm): Handle R_ARM_V4BX.
9360         (Stub_table::relocate_stubs): Likewise.
9361         (Stub_table::do_write): Likewise.
9362         (Stub_table::update_data_size_and_addralign): Likewise.
9363         (Stub_table::finalize_stubs):  Likewise.
9364         (Target_arm::Scan::local): Likewise.
9365         (Target_arm::Scan::global): Likewise.
9366         (Target_arm::do_finalize_sections): Likewise.
9367         (Target_arm::Relocate::relocate): Likewise.
9368         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9369         Likewise.
9370         (Target_arm::scan_reloc_for_stub): Likewise.
9371         (Target_arm::scan_reloc_section_for_stubs): Likewise.
9372
9373 2010-01-19  Ian Lance Taylor  <iant@google.com>
9374
9375         * output.cc (Output_section_headers::do_sized_write): Write large
9376         segment count to sh_info field.
9377         (Output_file_header::do_sized_write): For large segment count,
9378         write PN_XNUM to e_phnum field.
9379
9380 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9381
9382         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
9383         (Arm_relocate_functions::thm_jump8): New function.
9384         (Arm_relocate_functions::thm_jump11): New function.
9385         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
9386         R_ARM_THM_JUMP11.
9387         (Target_arm::Scan::global): Likewise.
9388         (Target_arm::Relocate::relocate): Likewise.
9389         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9390         Likewise.
9391
9392 2010-01-14  Doug Kwan  <dougkwan@google.com>
9393
9394         * arm.cc (map, utility): Include headers.
9395         (Target_arm::apply_cortex_a8_workaround): New method.
9396         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
9397         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
9398         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
9399         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
9400         the --[no-]fix-cortex-a8 command line options.
9401         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
9402         (Target_arm::relocate_stub): Use addend in instruction template.
9403         * options.h (DEFINE_bool): Set the user-set flag.
9404         (General_options): Add --[no-]-fix-cortex options.
9405         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
9406         : Update fast look-up map after conversion.
9407
9408 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
9409
9410         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
9411         in the first pass of do_layout.
9412
9413 2010-01-13  Doug Kwan  <dougkwan@google.com>
9414
9415         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
9416         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
9417         apparent compiler problem of not folding static constant integral
9418         data members of elfcpp::Elf_sizes<32>.
9419
9420 2010-01-13  Doug Kwan  <dougkwan@google.com>
9421
9422         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
9423         Arm_relobj::section_needs_cortex_a8_stub_scanning,
9424         Arm_relobj::scan_section_for_cortex_a8_erratum,
9425         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
9426         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
9427         sections to scan for relocation stubs into a new method
9428         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
9429         relocation and Cortex-A8 stub scanning.
9430         (Target_arm::do_relax): Force stubs to be after stubbed sections
9431         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
9432         the beginning of a new relaxation pass.  Update a comment.
9433         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
9434
9435 2010-01-12  Ian Lance Taylor  <iant@google.com>
9436
9437         * target-reloc.h (visibility_error): New inline function.
9438         (relocate_section): Call visibility_error.
9439         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
9440         (MOSTLYCLEANFILES): Likewise.
9441         (protected_4_pic.o, protected_3.err): New targets.
9442         * testsuite/protected_4.cc: New file.
9443
9444 2010-01-12  Doug Kwan  <dougkwan@google.com>
9445
9446         * arm.cc (Cortex_a8_reloc): New class.
9447         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
9448         and cortex_a8_relocs_info_.
9449         (Target_arm::fix_cortex_a8): New method definition.
9450         (Target_arm::Cortex_a8_relocs_info): New type.
9451         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
9452         New data member declarations.
9453         (Target_arm::scan_reloc_for_stub): Record information about
9454         relocations for THUMB branches that might be exempted from the
9455         Cortex-A8 workaround.
9456         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
9457         at the beginning of a relaxation pass.
9458
9459 2010-01-12  Doug Kwan  <dougkwan@google.com>
9460
9461         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
9462         (Arm_relobj::Mapping_symbol_position,
9463          Arm_reloj::Mapping_symbol_position_less,
9464          Arm_relobj::Mapping_symbols_info): New types.
9465         (Target_arm::is_mapping_symbol_name): New method definition.
9466         (Arm_relobj::do_count_local_symbols): Save information about mapping
9467         symbols.
9468
9469 2010-01-11  Doug Kwan  <dougkwan@google.com>
9470
9471         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
9472         Arm_relocate_functions::thumb32_branch_upper,
9473         Arm_relocate_functions::thumb32_branch_lower,
9474         Arm_relocate_functions::thumb32_cond_branch_offset,
9475         Arm_relocate_functions::thumb32_cond_branch_upper,
9476         Arm_relocate_functions::thumb32_cond_branch_lower,
9477         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
9478         branch offset encoding.
9479         (Arm_relocate_functions::thumb_branch_common): Use new branch
9480         offset encoding methods to avoid code duplication.
9481         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
9482         (Stub_addend_reader::operator()): Use new branch encoding method
9483         to avoid code duplication.
9484
9485 2010-01-11  Doug Kwan  <dougkwan@google.com>
9486
9487         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
9488         (Target_arm::do_finalize_sections): Define special EXIDX section
9489         symbols only if referenced.
9490         * gc.h (Garbage_collection::add_reference): New method.
9491         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
9492         code duplication.
9493
9494 2010-01-11  Ian Lance Taylor  <iant@google.com>
9495
9496         * script.cc (Version_script_info::build_expression_list_lookup):
9497         Change complaing about duplicate wildcard match from error to
9498         warning.
9499
9500         * script.cc (class Lazy_demangler): Recreate--revert part of patch
9501         of 2009-12-30.
9502         (Version_script_info::Version_script_info): Initialize globs_,
9503         default_version_, default_is_global_, and exact_.  Don't
9504         initialize globals_ or locals_.
9505         (Version_script_info::build_lookup_tables): Build local symbols
9506         first.
9507         (Version_script_info::unquote): New function.
9508         (Version_script_info::add_exact_match): New function.
9509         (Version_script_info::build_expression_list_lookup): Remove lookup
9510         parameter.  Add is_global parameter.  Change all callers.  Handle
9511         wildcard pattern specially.  Unquote pattern.  Call
9512         add_exact_match.
9513         (Version_script_info::get_name_to_match): New function.
9514         (Version_script_info::get_symbol_version): New function.
9515         (Version_script_info::get_symbol_version_helper): Remove.
9516         (Version_script_info::check_unmatched_names): Call unquote.
9517         * script.h (class Version_script_info): Change get_symbol_version
9518         to be non-inline and add is_global parameter; change all callers.
9519         Rewrite symbol_is_local.  Update declarations.  Define struct
9520         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
9521         Remove globals_ and locals_ members.  Add exact_, globs_,
9522         default_version_, is_global_.
9523         (Version_script_info::Glob): Remove pattern, add expression and
9524         is_global.  Update constructor.  Change all callers.
9525         * dynobj.cc (Versions::finalize): Mark the version symbol as the
9526         default version.
9527         (Versions::symbol_section_contents): If a symbol is undefined, or
9528         defined in a dynamic object, set the version index to
9529         VER_NDX_LOCAL.
9530         * symtab.cc (Symbol_table::add_from_relobj): Don't call
9531         symbol_is_local.
9532         (Symbol_table::add_from_pluginobj): Likewise.
9533         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
9534
9535 2010-01-11  Doug Kwan  <dougkwan@google.com>
9536
9537         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
9538         (incremental_dump_LDADD): Add linking option for libintl.
9539         * Makefile.in: Regenerate.
9540
9541 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
9542
9543         PR gold/11144
9544         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
9545         instead of -Ds.
9546         * testsuite/Makefile.in: Regenerated.
9547
9548 2010-01-10  Doug Kwan  <dougkwan@google.com>
9549
9550         * options.h (DEFINE_var): Use parentheses around argument varname__
9551         in macro body to avoid any unintended subsequent substitutions.
9552
9553 2010-01-10  Ian Lance Taylor  <iant@google.com>
9554
9555         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
9556         candidates before doing symbol resolution.
9557
9558         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
9559         ODR candidates if only one is weak.
9560
9561 2010-01-08  Ian Lance Taylor  <iant@google.com>
9562
9563         * script.cc (Version_script_info::build_expression_list_lookup):
9564         Don't warn about ambiguous version, just record the ambiguity.
9565         (Version_script_info::get_symbol_version_helper): Give error if
9566         version is ambiguous.
9567
9568 2010-01-08  Doug Kwan  <dougkwan@google.com>
9569
9570         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
9571         prev_data_size_ and prev_addralign_.  Remove initializer for
9572         deleted data member has_been_changed_.
9573         (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
9574         to determine if the table is empty.
9575         (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
9576         Remove.
9577         (Stub_table::add_reloc_stub): Define method in class definition
9578         instead of just declaring it there.
9579         (Stub_table::add_cortex_a8_stub): New method definition.
9580         (Stub_table::update_data_size_and_addralign): Ditto.
9581         (Stub_table::finalize_stubs): Ditto.
9582         (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
9583         (Stub_table::do_addralign_): Return address alignment in the
9584         (Stub_table::do_reset_address_and_file_offset): Define method in
9585         class definition instead of declaring it there.  Set current data
9586         size to be the data size of the previous pass.
9587         (Stub_table::set_final_data_size): Use current data size as the
9588         final data size.
9589         (Stub_table::relocate_stub): Change parameter type of stub from
9590         Reloc_stub pointer to Stub pointer.
9591         (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
9592         (Stub_table::Cortex_a8_stub_list): New typedef.
9593         (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
9594          Stub_table::prev_addralign_): New data member.
9595         (Arm_relobj::Arm_relobj): Initialize data member
9596         section_has_cortex_a8_workaround_.
9597         (Arm_relobj::section_has_cortex_a8_workaround,
9598          Arm_relobj::mark_section_for_cortex_a8_workaround): New method
9599          definitions.
9600         (Arm_relobj::section_has_cortex_a8_workaround_): New data member
9601         declarations.
9602         (Target_arm::relocate_stub): Change parameter type of stub from
9603         Reloc_stub pointer to Stub pointer.
9604         (Insn_template::size, Insn_template::alignment): Handle
9605         THUMB16_SPECIAL_TYPE.
9606         (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
9607          Stub_table::update_data_size_and_addralign,
9608          Stub_table::apply_cortex_a8_workaround_to_address_range): New method
9609         definitions.
9610         (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
9611         (Stub_table::do_write): Ditto.
9612         (Target_arm::do_relax): Adjust code for changes in Stub_table.
9613
9614 2010-01-08  Ian Lance Taylor  <iant@google.com>
9615
9616         PR 11108
9617         * symtab.h (class Symbol): Remove fields is_target_special_ and
9618         has_plt_offset_.  Add field is_defined_in_discarded_section_.
9619         (Symbol::is_defined_in_discarded_section): New function.
9620         (Symbol::set_is_defined_in_discarded_section): New function.
9621         (Symbol::has_plt_offset): Rewrite.
9622         (Symbol::set_plt_offset): Verify that new offset is not -1U.
9623         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
9624         Don't initialize is_target_special_ or has_plt_offset_.
9625         Initialize is_defined_in_discarded_section_.
9626         (Symbol_table::add_from_relobj): If appropriate, set
9627         is_defined_in_discarded_section.
9628         * resolve.cc (Symbol::override_base_with_special): Don't test
9629         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
9630         * target-reloc.h (relocate_section): Do special handling for
9631         symbols defined in discarded sections for global symbols as well
9632         as local symbols.
9633
9634 2010-01-08  Ian Lance Taylor  <iant@google.com>
9635
9636         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
9637         the SHT_SYMTAB case.
9638
9639 2010-01-08  Ian Lance Taylor  <iant@google.com>
9640
9641         * object.cc (Sized_relobj::do_layout): Don't get confused if
9642         layout_eh_frame returns NULL.
9643
9644 2010-01-08  Ian Lance Taylor  <iant@google.com>
9645
9646         PR 11084
9647         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
9648         dynamic symbol table, use the normal symbol table.
9649         (Sized_dynobj::do_read_symbols): Remove assertion about type of
9650         symbol table.
9651
9652 2010-01-08  Ian Lance Taylor  <iant@google.com>
9653
9654         PR 11072
9655         * layout.cc (Layout::include_section): Remove .gnu_debuglink
9656         sections.
9657
9658 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
9659
9660         * version.cc (print_version): Change to "Copyright 2010".
9661
9662 2010-01-08  Ian Lance Taylor  <iant@google.com>
9663
9664         PR 10287
9665         PR 11063
9666         * i386.cc (class Target_i386): Change return type of plt_section
9667         to be non-const.
9668         (class Output_data_plt_i386): Add tls_desc_rel_ field.
9669         (Output_data_plt_i386::Output_data_plt_i386): Initialize
9670         tls_desc_rel_ field.
9671         (Output_data_plt_i386::rel_tls_desc): New function.
9672         (Target_i386::rel_tls_desc_section): New function.
9673         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
9674         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
9675         R_386_TLS_DESC reloc in rel_tls_desc_section.
9676         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
9677         Define struct Tlsdesc_info.
9678         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
9679         (Target_x86_64::do_reloc_symbol_index): New function.
9680         (Target_x86_64::add_tlsdesc_info): New function.
9681         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
9682         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
9683         tlsdesc_rel_ field.
9684         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
9685         all callers.
9686         (Output_data_plt_x86_64::rela_tlsdesc): New function.
9687         (Target_x86_64::rela_tlsdesc_section): New function.
9688         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
9689         handling.
9690         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
9691         (Target_x86_64::do_reloc_addend): New function.
9692         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
9693         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
9694         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
9695         (Output_reloc::type): New function.
9696         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
9697         (Output_reloc::is_target_specific): New function.
9698         (Output_reloc::target_arg): New function.
9699         (class Output_reloc) [SHT_RELA]: Add four new constructors for
9700         absolute relocs and target specific relocs.
9701         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
9702         add_target_specific.
9703         (class Output_data_reloc) [SHT_RELA]: Likewise.
9704         * output.cc (Output_reloc::Output_reloc): Add four new versions
9705         for absolute relocs and target specific relocs.
9706         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
9707         (Output_reloc::get_symbol_index): Likewise.
9708         (Output_reloc::local_section_offset): Check that local_sym_index_
9709         is not TARGET_CODE or 0.
9710         (Output_reloc::symbol_value): Likewise.
9711         (Output_reloc::write) [SHT_RELA]: Call target for target specific
9712         reloc.
9713         * target.h (class Target): Add reloc_symbol_index and reloc_addend
9714         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
9715         functions.
9716         * layout.cc (add_target_dynamic_tags): Use output section for
9717         DT_PLTRELSZ and DT_JMPREL.
9718
9719 2010-01-07  Ian Lance Taylor  <iant@google.com>
9720
9721         PR 11061
9722         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
9723         function.
9724         (class Output_data_reloc_generic): Define.
9725         (class Output_data_reloc_base): Change base class to
9726         Output_data_reloc_generic.  Change add() method to call
9727         bump_relative_reloc_count for a relative reloc.  Remove
9728         sort_relocs_ field.
9729         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
9730         to sort_relocs().
9731         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
9732         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
9733         appropriate.
9734         * layout.h (class Layout): Update declaration.
9735
9736 2010-01-07  Ian Lance Taylor  <iant@google.com>
9737
9738         * output.h (class Output_data): Add const version of
9739         output_section and do_output_section.
9740         (class Output_section_data): Add const version of
9741         do_output_section.
9742         (class Output_section): Likewise.
9743         * layout.cc (Layout::add_target_dynamic_tags): New function.
9744         * layout.h (class Layout): Update declarations.
9745         * arm.cc (Target_arm::do_finalize_sections): Use
9746         add_target_dynamic_tags.
9747         * i386.cc (Target_i386::do_finalize_sections): Likewise.
9748         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
9749         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
9750         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
9751
9752 2010-01-07  Ian Lance Taylor  <iant@google.com>
9753
9754         PR 11042
9755         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
9756         object as needed.
9757
9758 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
9759             Ian Lance Taylor  <iant@google.com>
9760
9761         PR 11019
9762         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
9763         Xindex::read_symtab_xindex.
9764
9765 2010-01-07  Doug Kwan  <dougkwan@google.com>
9766
9767         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
9768         (Insn_template::thumb16_bcond_insn): New method declaration.
9769         (Insn_template): Fix spelling.
9770         (Stub::thumb16_special): New method declaration.
9771         (Stub::do_write): Define virtual method which was previously pure
9772         virtual.
9773         (Stub::do_thumb16_special): New method declaration.
9774         (Stub::do_fixed_endian_write): New template member.
9775         (Reloc_stub::do_write): Remove.
9776         (Reloc_stub::do_fixed_endian_write): Remove.
9777         (Cortex_a8_stub): New class definition.
9778         (Stub_factory::make_cortex_a8_stub): New method definition.
9779         (Stub_factory::Stub_factory): Add missing static storage class
9780         qualifier for elf32_arm_stub_a8_veneer_blx.
9781
9782 2010-01-07  Ian Lance Taylor  <iant@google.com>
9783
9784         PR 10980
9785         * options.h (class General_options): Add --warn-unresolved-symbols
9786         and --error-unresolved-symbols.
9787         * errors.cc (Errors::undefined_symbol): Implement
9788         --warn-unresolved-symbols.
9789
9790         * options.h (class General_options): Add -z text and -z textoff.
9791         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
9792
9793 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
9794
9795         * gc.h (Garbage_collection::Cident_section_map): New typedef.
9796         (Garbage_collection::cident_sections): New function.
9797         (Garbage_collection::add_cident_section): New function.
9798         (Garbage_collection::cident_sections_): New member.
9799         (gc_process_relocs): Add references to sections whose names are C
9800         identifiers.
9801         * gold.h (cident_section_start_prefix): New constant.
9802         (cident_section_stop_prefix): New constant.
9803         (is_cident): New function.
9804         * layout.cc (Layout::define_section_symbols): Replace string constants
9805         with the newly defined constants.
9806         * object.cc (Sized_relobj::do_layout): Track sections whose names are
9807         C identifiers.
9808         * testsuite/Makefile.am: Add gc_orphan_section_test.
9809         * testsuite/Makefile.in: Regenerate.
9810         * testsuite/gc_orphan_section_test.cc: New file.
9811         * testsuite/gc_orphan_section_test.sh: New file.
9812
9813 2010-01-06  Ian Lance Taylor  <iant@google.com>
9814
9815         PR 10980
9816         * options.h (class General_options): Add --warn-shared-textrel.
9817         * layout.cc (Layout::finish_dynamic_section): Implement
9818         --warn-shared-textrel.
9819
9820         PR 10980
9821         * options.h (class General_options): Add --warn-multiple-gp.
9822
9823 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9824
9825         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
9826         $(THREADSLIB) and $(LIBDL).
9827         * Makefile.in: Rebuild.
9828
9829 2010-01-06  Ian Lance Taylor  <iant@google.com>
9830
9831         PR 10980
9832         * options.cc (General_options::parse_section_start): New function.
9833         (General_options::section_start): New function.
9834         (General_options::General_options): Initialize all members.
9835         * options.h: Include <map>
9836         (class General_options): Add --section-start.  Add section_starts_
9837         member.
9838         * layout.cc (Layout::attach_allocated_section_to_segment): If
9839         --section-start was used, set the address of the segment.  Remove
9840         local sort_sections.
9841         (Layout::relaxation_loop_body): If the address of the load segment
9842         has been set by --section-start, don't use it.
9843         * output.h (Output_segment::update_flags_for_output_section): New
9844         function.
9845         * output.cc (Output_segment::add_output_section): Call
9846         update_flags_for_output_section.
9847
9848 2010-01-05  Ian Lance Taylor  <iant@google.com>
9849
9850         PR 10980
9851         * options.h (class General_options): Add --undefined-version.
9852         * script.cc (struct Version_expression): Add was_matched_by_symbol
9853         field.
9854         (Version_script_info::matched_symbol): New function.
9855         (Version_script_info::get_symbol_version_helper): Call
9856         matched_symbol.
9857         (Version_script_info::check_unmatched_names): New function.
9858         * script.h (class Version_script_info): Update declarations.
9859         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
9860
9861         * options.h (class General_options): Use DEFINE_bool_alias for
9862         allow_multiple_definition.
9863         * resolve.cc (Symbol_table::should_override): Don't test
9864         allow_multiple_definition.
9865
9866         PR 10980
9867         * options.h (class General_options): Add --cref.
9868         * main.cc (main): Print cref table if --cref.  Don't close mapfile
9869         until after printing cref table.
9870         * cref.cc: Include "symtab.h".
9871         (class Cref_inputs): Define Cref_table_compare and Cref_table.
9872         (Cref_table_compare::operator()): New function.
9873         (Cref_inputs::gather_cref): New function.
9874         (filecol): New static const.
9875         (Cref_inputs::print_cref): New function.
9876         (Cref::print_cref): New function.
9877         * cref.h: Include <cstdio>.
9878         (class Cref): Update declarations.
9879         * mapfile.h (Mapfile::file): New function.
9880         * object.h (class Object): Define Symbols.  Declare virtual
9881         do_get_global_symbols.
9882         (Object::get_global_symbols): New function.
9883         * object.cc (Input_objects::add_object): Pass object to cref_ if
9884         --cref.
9885         (Input_objects::archive_start): Likewise.
9886         (Input_objects::archive_stop): Likewise.
9887         (Input_objects::print_cref): New function.
9888         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
9889         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
9890         --cref.
9891         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
9892         function.
9893         * plugin.h (class Sized_pluginobj): Update declarations.
9894
9895 2010-01-05  Ian Lance Taylor  <iant@google.com>
9896
9897         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
9898         to is_default_version.  Rename insdef to insdefault.
9899         (Symbol_table::add_from_relobj): Rename def to is_default_version
9900         and local to is_forced_local.
9901         (Symbol_table::add_from_pluginobj): Likewise.
9902         (Symbol_table::add_from_dynobj): Likewise.
9903         (Symbol_table::define_special_symbol): Rename insdef to
9904         insdefault.
9905
9906 2010-01-04  Ian Lance Taylor  <iant@google.com>
9907
9908         PR 10980
9909         * options.h (class General_options): Add
9910         --allow-multiple-definition and -z muldefs.
9911         * resolve.cc (Symbol_table::should_override): Don't warn about a
9912         multiple symbol definition if --allow-multiple-definition or -z
9913         muldefs.
9914
9915         PR 10980
9916         * options.h (class General_options): Add --add-needed and
9917         --copy-dt-needed-entries.  Tweak --as-needed help entry.
9918         * object.cc (Input_objects::check_dynamic_dependencies): Give an
9919         error if --copy-dt-needed-entries aka --add-needed is used and
9920         would cause a change in behaviour.
9921
9922         PR 10980
9923         * options.h (class General_options): Add -G as a short version of
9924         --shared.  Add no-op options -assert, -g, and -i.
9925
9926 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
9927
9928         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
9929         check for .text or .gnu.linkonce.t sections.
9930         * icf.cc (Icf::find_identical_sections): Ditto.
9931         Change the detection for mangled function name within the section
9932         name.
9933         * icf.h (is_section_foldable_candidate): New function.
9934
9935 2009-12-30  Ian Lance Taylor  <iant@google.com>
9936
9937         PR 10980
9938         * options.h (class General_options): Permit two dashes with
9939         --retain-symbols-file.
9940
9941 2009-12-30  Ian Lance Taylor  <iant@google.com>
9942
9943         PR 10979
9944         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
9945         don't put the file header and segment headers in the text
9946         segment.
9947
9948         PR 10979
9949         * common.cc (Sort_commons::operator()): Stabilize sort when both
9950         entries are NULL.
9951         (Symbol_table::do_allocate_commons_list): When allocating common
9952         symbols, skip a symbol which is no longer common.
9953         * symtab.h (Symbol::is_common): Test whether the symbol comes from
9954         an object before checking its type.
9955         * testsuite/common_test_2.c: New file.
9956         * testsuite/common_test_3.c: New file.
9957         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
9958         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
9959         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
9960         (common_test_2_pic.o, common_test_2.so): New targets.
9961         (common_test_3_pic.o, common_test_3.so): New targets.
9962         * testsuite/Makefile.in: Rebuild.
9963
9964         PR 10979
9965         * script.cc (read_input_script): If we see a new SECTIONS clause,
9966         and we have added an input section, give an error.
9967         * layout.h (class Layout): Add have_added_input_section function.
9968         Add have_added_input_section_ field.
9969         * layout.cc (Layout::Layout): Initialize
9970         have_added_input_section_.
9971         (Layout::layout): Set have_added_input_section_.
9972         (Layout::layout_eh_frame): Likewise.
9973
9974 2009-12-30  Ian Lance Taylor  <iant@google.com>
9975
9976         PR 10931
9977         * options.h (class General_options): Add --sort-common option.
9978         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
9979         * common.cc (Sort_common): Add sort_order parameter to
9980         constructor.  Add sort_order_ field.
9981         (Sort_commons::operator): Check sort_order_.
9982         (Symbol_table::allocate_commons): Determine the sort order.
9983         (Symbol_table::do_allocate_commons): Add sort_order parameter.
9984         Change all callers.
9985         (Symbol_table::do_allocate_commons_list): Likewise.
9986
9987 2009-12-30  Ian Lance Taylor  <iant@google.com>
9988
9989         PR 10916
9990         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
9991         symbols from this object, don't change the visibility of an
9992         undefined symbol.
9993         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
9994
9995 2009-12-30  Ian Lance Taylor  <iant@google.com>
9996
9997         PR 10861
9998         * script.h (class Version_script_info): Define Language enum.
9999         Update declarations.  Define Glob, Exact, and Lookup types.  Add
10000         new fields globals_, locals_, and is_finalized_.
10001         * script.cc: Various formatting fixes.
10002         (class Parser_closure): Change language_stack_ from a vector of
10003         std::string to one of Version_script_info::Language.  Adjust all
10004         uses accordingly.
10005         (class Lazy_demangler): Remove.
10006         (struct Version_expression): Change language from std::string to
10007         Version_script_info::Language.
10008         (Version_script_info::Version_script_info): New function.
10009         (Version_script_info::~Version_script_info): Don't call clear.
10010         (Version_script_info::finalize): New function.
10011         (Version_script_info::build_lookup_tables): New function.
10012         (Version_script_info::build_expression_list_lookup): New
10013         function.
10014         (Version_script_info::get_symbol_version_helper): Rewrite to use
10015         lookup tables.
10016         (Version_script_info::print_expression_list): Adjust to use
10017         Version_script_info::Language.
10018         (script_push_lex_into_version_mode): Check that the version script
10019         has not been finalized.
10020         (version_script_push_lang): Change language string to
10021         Version_script_info::Language.
10022         * options.cc (Command_line::version_script): New function.
10023         * options.h (class General_options): Add finalize_dynamic_list
10024         function.  Change version_script from declaration to definition.
10025         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
10026         * testsuite/version_script.map: Remove duplicate def of foo.
10027         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
10028         version_script.map.
10029         * testsuite/Makefile.in: Rebuild.
10030
10031 2009-12-30  Ian Lance Taylor  <iant@google.com>
10032
10033         PR 10843
10034         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
10035         if the input symbol index is 0, make the output symbol index 0.
10036
10037 2009-12-30  Ian Lance Taylor  <iant@google.com>
10038
10039         PR 10670
10040         * options.h (class General_options): Add -x/--discard-all.
10041         * object.cc (Sized_relobj::do_count_local_symbols): Handle
10042         --discard-all.  If the local symbol needs a dynamic entry, check
10043         that before handling --discard-locals.
10044
10045 2009-12-30  Ian Lance Taylor  <iant@google.com>
10046
10047         PR 10450
10048         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
10049         flags to PF_R.
10050         (Output_segment::add_output_section): Don't change the flags if
10051         the type is PT_TLS.
10052
10053         PR 10450
10054         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
10055         GNU hash table if they need a dynamic value.  Otherwise, don't add
10056         them if they are defined in a dynamic object or are forced local.
10057
10058 2009-12-29  Ian Lance Taylor  <iant@google.com>
10059
10060         PR 10450
10061         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
10062         .gnu.hash table for a 32-bit target.
10063
10064         PR 10450
10065         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
10066         regular and a dynamic object only needs a dynamic symbol table
10067         entry if it is externally visible.
10068
10069         PR 10450
10070         * i386.cc (class Target_i386): Initialize global_offset_table_ in
10071         constructor.  Add global_offset_table_ field.
10072         (Target_i386::got_section): Set global_offset_table_.
10073         (Target_i386::do_finalize_sections): Set global_offset_table_
10074         size.
10075         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
10076         in constructor.  Add global_offset_table_ field.
10077         (Target_x86_64::got_section): Set global_offset_table_.
10078         (Target_x86_64::do_finalize_sections): Set global_offset_table_
10079         size.
10080
10081         * layout.cc (Layout::Layout): Initialize increase_relro_.
10082         (Layout::get_output_section): Add is_relro, is_last_relro, and
10083         is_first_non_relro parameters.  Change all callers.
10084         (Layout::choose_output_section): Likewise.
10085         (Layout::add_output_section_data): Likewise.
10086         (Layout::make_output_section): Likewise.
10087         (Layout::set_segment_offsets): Clear increase_relro when using a
10088         linker script.
10089         * layout.h (class Layout): Add increase_relro method.  Add
10090         increase_relro_ field.  Update declarations.
10091         * output.cc (Output_section::Output_section): Initialize
10092         is_last_relro_ and is_first_non_relro_.
10093         (Output_segment::add_output_section): Group relro sections is
10094         do_sort is true.  Handle is_last_relro and is_first_non_relro.
10095         (Output_segment::maximum_alignment): Remove relro handling.
10096         (Output_segment::set_section_addresses): Add increase_relro
10097         parameter.  Change all callers.  Add initial alignment to align
10098         relro sections on separate page.  Remove old relro handling.
10099         (Output_segment::set_section_list_addresses): Remove in_relro
10100         parameter.  Change all callers.
10101         (Output_segment::set_offset): Add increase parameter.  Change all
10102         callers.  Remove old relro handling.
10103         * output.h (class Output_section): Add new methods: is_last_relro,
10104         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
10105         Add is_last_relro_ and is_first_non_relro_ fields.
10106         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
10107         Create separate .got.plt section.  Call increase_relro.
10108         * x86_64.cc (Target_x86_64::got_section): Likewise.
10109         * testsuite/relro_script_test.t: Add .got.plt.
10110
10111         PR 10450
10112         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
10113         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
10114         (Layout::finalize): Call set_dynamic_symbol_size.
10115         (Layout::set_dynamic_symbol_size): New function.
10116         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
10117         set_dynamic_symbol_size.
10118
10119         PR 10450
10120         * output.h (class Output_section): Add is_entsize_zero_ field.
10121         * output.cc (Output_section::Output_section): Initialize
10122         is_entsize_zero_.
10123         (Output_section::set_entsize): If two different entsizes are
10124         requested, force it to zero.
10125         (Output_section::add_input_section): Set flags for .debug_str
10126         before updating section flags.  Set entsize.
10127         (Output_section::update_flags_for_input_section): Set SHF_MERGE
10128         and SHF_STRING if all input sections have those flags.
10129
10130 2009-12-29   Rafael Espindola  <espindola@google.com>
10131
10132         * main.cc (main): Fix the sys time reporting.
10133         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
10134         reporting.
10135
10136 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
10137
10138         * options.cc (General_options::parse_version): Allow -v to exit
10139         without an error if there is nothing to link.
10140
10141 2009-12-29  Ian Lance Taylor  <iant@google.com>
10142
10143         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
10144         using a version of gcc before 4.1.
10145         * configure: Rebuild.
10146
10147 2009-12-28  Chris Demetriou  <cgd@google.com>
10148
10149         * attributes.cc (Output_attributes_section_data::do_write): Use
10150         std::vector::front rather than std::vector::data.
10151
10152 2009-12-28  Ian Lance Taylor  <iant@google.com>
10153
10154         * symtab.h (class Symbol_table): Add enum Defined.
10155         * resolve.cc (Symbol_table::should_override): Add defined
10156         parameter.  Change all callers.  Test whether object is NULL
10157         before calling a method on it.
10158         (Symbol_table::report_resolve_problem): Add defined parameter.
10159         Change all callers.
10160         (Symbol_table::should_override_with_special): Likewise.
10161         * symtab.cc (Symbol_table::define_in_output_data): Add defined
10162         parameter.  Change all callers.
10163         (Symbol_table::do_define_in_output_data): Likewise.
10164         (Symbol_table::define_in_output_segment): Likewise.
10165         (Symbol_table::do_define_in_output_segment): Likewise.
10166         (Symbol_table::define_as_constant): Likewise.
10167         (Symbol_table::do_define_as_constant): Likewise.
10168         * script.h (class Symbol_assignment): Add is_defsym parameter to
10169         constructor; change all callers.
10170         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
10171         parameter.  Change all callers.  Add is_defsym_ field.
10172         (class Parser_closure): Add parsing_defsym parameter to
10173         constructor; change all callers.  Add parsing_defsym accessor
10174         function.  Add parsing_defsym_ field.
10175
10176 2009-12-28  Ian Lance Taylor  <iant@google.com>
10177
10178         * gold.cc (queue_middle_tasks): Fix formatting.
10179         * object.cc (Relobj::is_section_name_included): Likewise.
10180
10181 2009-12-23  Ian Lance Taylor  <iant@google.com>
10182
10183         * i386.cc (Target_i386::do_calls_non_split): Recognize
10184         -fsplit-stack prologue for a function with a static chain.
10185         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
10186         -fsplit-stack prologue when using %r11.
10187
10188 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
10189
10190         * options.cc (General_options::parse_version): Make -v continue and do
10191         the link like GNU ld does.
10192
10193 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
10194
10195         * Makefile.am (CCFILES): Add timer.cc.
10196         (HFILES): Add timer.h.
10197         * configure.ac: Check for sysconf and times.
10198         * main.cc: include timer.h.
10199         (main): Use Timer instead of get_run_time.
10200         * timer.cc: New.
10201         * timer.h: New.
10202         * workqueue.cc: include timer.h.
10203         (Workqueue::find_and_run_task):
10204         Report user, sys and wall time.
10205         * Makefile.in: Regenerate.
10206         * config.in: Regenerate.
10207         * configure: Regenerate.
10208
10209 2009-12-16  Doug Kwan  <dougkwan@google.com>
10210
10211         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
10212         sections.
10213         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
10214         relaxed input sections.
10215         * output.cc (Output_section::find_relaxed_input_section): Change
10216         return type to Output_relaxed_input_section pointer.  Adjust code
10217         for new type of relaxed_input_section_map_.
10218         * output.h (Output_section::find_relaxed_input_section): Change
10219         return type to Output_relaxed_input_section pointer.
10220         (Output_section::Output_relaxed_input_section_by_input_section_map):
10221         New type.
10222         (Output_section::relaxed_input_section_map_): Change type to
10223         Output_section::Output_relaxed_input_section_by_input_section_map.
10224         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
10225         input section.
10226
10227 2009-12-15  Ian Lance Taylor  <iant@google.com>
10228
10229         * layout.cc (Layout::create_shstrtab): Only write out after input
10230         sections if we are compressing debug sections.
10231
10232 2009-12-15  Ian Lance Taylor  <iant@google.com>
10233
10234         * archive.cc (Archive::add_symbols): Only look up a symbol without
10235         a version if there is, in fact, a version.
10236
10237 2009-12-14  Ian Lance Taylor  <iant@google.com>
10238
10239         Revert -Wshadow changes, all changes from:
10240         2009-12-11  Doug Kwan  <dougkwan@google.com>
10241         2009-12-11  Nick Clifton  <nickc@redhat.com>
10242         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
10243
10244 2009-12-11  Doug Kwan  <dougkwan@google.com>
10245
10246         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
10247         due to -Wshadow.
10248         * attributes.cc (Object_attribute::size): Ditto.
10249         (Attributes_section_data::size): Ditto.
10250         (Attributes_section_data::Attributes_section_data): Ditto.
10251         (Output_attributes_section_data::do_write): Ditto.
10252         * attributes.h (Object_attribute::set_type): Ditto.
10253         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
10254
10255 2009-12-11  Nick Clifton  <nickc@redhat.com>
10256
10257         * archive.cc: Fix shadowed variable warnings.
10258         * arm.cc: Likewise.
10259         * compressed_output.cc: Likewise.
10260         * compressed_output.h: Likewise.
10261         * configure: Likewise.
10262         * dwarf_reader.cc: Likewise.
10263         * dynobj.cc: Likewise.
10264         * dynobj.h: Likewise.
10265         * ehframe.cc: Likewise.
10266         * ehframe.h: Likewise.
10267         * errors.cc: Likewise.
10268         * expression.cc: Likewise.
10269         * fileread.cc: Likewise.
10270         * fileread.h: Likewise.
10271         * freebsd.h: Likewise.
10272         * i386.cc: Likewise.
10273         * icf.cc: Likewise.
10274         * incremental.h: Likewise.
10275         * layout.cc: Likewise.
10276         * layout.h: Likewise.
10277         * mapfile.cc: Likewise.
10278         * merge.cc: Likewise.
10279         * merge.h: Likewise.
10280         * object.cc: Likewise.
10281         * object.h: Likewise.
10282         * options.h: Likewise.
10283         * output.cc: Likewise.
10284         * output.h: Likewise.
10285         * parameters.cc: Likewise.
10286         * plugin.cc: Likewise.
10287         * powerpc.cc: Likewise.
10288         * reduced_debug_output.cc: Likewise.
10289         * reduced_debug_output.h: Likewise.
10290         * reloc.cc: Likewise.
10291         * reloc.h: Likewise.
10292         * resolve.cc: Likewise.
10293         * script-sections.cc: Likewise.
10294         * script.cc: Likewise.
10295         * script.h: Likewise.
10296         * sparc.cc: Likewise.
10297         * symtab.cc: Likewise.
10298         * symtab.h: Likewise.
10299         * target-select.cc: Likewise.
10300         * target-select.h: Likewise.
10301         * token.h: Likewise.
10302         * workqueue.cc: Likewise.
10303         * workqueue.h: Likewise.
10304         * x86_64.cc: Likewise.
10305
10306 2009-12-10  Doug Kwan  <dougkwan@google.com>
10307
10308         * arm.cc (attributes.h): New include.
10309         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
10310         (Arm_relobj::~Arm_relobj): Delete object pointed by
10311         attributes_section_data_.
10312         (Arm_relobj::attributes_section_data): New method definition.
10313         (Arm_relobj::attributes_section_data_): New data member declaration.
10314         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
10315         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
10316         attributes_section_data_.
10317         (Arm_dynobj::attributes_section_data): New method definition.
10318         (Arm_dynobj::attributes_section_data_): New data member declaration.
10319         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
10320         initialization value of may_use_blx_ to false.
10321         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
10322         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
10323         object attributes to compute results instead of hard-coding.
10324         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
10325         Target_arm::get_secondary_compatible_arch,
10326         Target_arm::set_secondary_compatible_arch
10327         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
10328         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
10329         New method declarations.
10330         (Target_arm::get_aeabi_object_attribute): New method definition.
10331         (Target_arm::attributes_section_data_): New data member declaration.
10332         (read_arm_attributes_section): New template definition.
10333         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
10334         (Arm_dynobj::do_read_symbols): Ditto.
10335         (Target_arm::do_finalize_sections): Merge attributes sections from
10336         input.  Check for BLX use after attributes section merging.
10337         Fix __exidx_start and __exidx_end visibility.  Create an
10338         .ARM.attributes section if necessary.
10339         (Target_arm::get_secondary_compatible_arch,
10340         Target_arm::set_secondary_compatible_arch,
10341         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
10342         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
10343         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
10344         New method definitions.
10345
10346 2009-12-09  Ian Lance Taylor  <iant@google.com>
10347
10348         * plugin.cc (Plugin::load): Don't cast from void* to a function
10349         pointer.
10350
10351 2009-12-09  Ian Lance Taylor  <iant@google.com>
10352
10353         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
10354         information fields.
10355
10356 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
10357
10358         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
10359         Replace two_file_shared_1.so with two_file_shared_2.so.
10360         * testsuite/Makefile.in: Regenerated.
10361
10362 2009-12-08  Doug Kwan  <dougkwan@google.com>
10363
10364         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
10365         (HFILES): Add attributes.h and int_encoding.h.
10366         * Makefile.in: Regenerate.
10367         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
10368         function definitions to int_encoding.cc
10369         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
10370         prototypes to int_encoding.h
10371         * reduced_debug_output.cc (int_encoding.h): New include.
10372         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
10373         function definitions to int_encoding.cc
10374         (insert_into_vector, read_from_pointer): Move template definitions to
10375         int_encoding.h
10376         * attributes.cc: New file.
10377         * attributes.h: New file.
10378         * int_encoding.cc: New file.
10379         * int_encoding.h: New file.
10380
10381 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
10382
10383         PR gold/11055
10384         * incremental-dump.cc (dump_incremental_inputs): New.
10385         (main): Use dump_incremental_inputs.
10386
10387 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
10388
10389         PR gold/10893
10390         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
10391         checking elfcpp::STT_FUNC.
10392         (Target_i386::Relocate::relocate): Likewise.
10393         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
10394
10395         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
10396         symbols from shared libraries into normal FUNC symbols.
10397
10398         * symtab.h (Symbol): Add is_func and use it.
10399
10400 2009-12-05  Doug Kwan  <dougkwan@google.com>
10401
10402         * arm.cc (Target_arm::arm_info): Initialize new fields
10403         attributes_section and attributes_vendor.
10404         * i386.cc (Target_i386::i386_info): Same.
10405         * object.cc (Sized_relobj::do_layout): Skip attribute section.
10406         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
10407         fields attributes_section and attributes_vendor.
10408         * sparc.cc (Target_sparc::sparc_info): Same.
10409         * target.h (Target::attributes_section, Target::attributes_vendor,
10410         Target::is_attributes_section, Target::attribute_arg_type,
10411         Target::attributes_order): New method definitions.
10412         (Target::Target_info::attributes_section,
10413         Target::Target_info::attributes_vendor): New fields.
10414         (Target::do_attribute_arg_type, Target::do_attributes_order): New
10415         virtual method definitions.
10416         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
10417         attributes_section and attributes_vendor.
10418         * testsuite/testfile.cc (Target_test::test_target_info): Same.
10419
10420 2009-12-05  Doug Kwan  <dougkwan@google.com>
10421
10422         * arm.cc: Update comments about interworking and stub generation.
10423         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
10424         considered as non-PIC.
10425         (Arm_relocate_functions::base_abs): Fix formatting.
10426         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
10427         of function to use GOT entry address instead of offset.
10428         (Target_arm::Scan::global): Issue an error if a symbol would need a
10429         PLT does not get one because it is untyped.  Remove code to create
10430         dynamic symbols for relative branches.
10431         (Target_arm::Relocate::relocate: Use 0 instead of false since function
10432         takes unsigned integer instead of boolean.
10433
10434 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
10435
10436         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
10437         (two_file_test_LDADD): Likewise.
10438         (common_test_1_LDADD): Likewise.
10439         (exception_test_LDADD) Likewise.
10440         (weak_test_LDADD): Likewise.
10441         (many_sections_test_LDADD): Likewise.
10442         (initpri1_LDADD): Likewise.
10443         (script_test_1_LDADD): Likewise.
10444         (script_test_2_LDADD): Likewise.
10445         (justsyms_LDADD): Likewise.
10446         (binary_test_LDADD): Likewise.
10447         (large_LDADD): Likewise.
10448         * testsuite/Makefile.in: Regenerated.
10449
10450 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
10451
10452         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
10453         (Symbol_table::override_with_special): Likewise.
10454         (Symbol_table::add_from_object): Likewise.
10455
10456 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
10457
10458         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
10459         Don't set the data_offset twice.
10460
10461 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
10462
10463         * testsuite/Makefile.in: Regenerate.
10464
10465 2009-12-03  Doug Kwan  <dougkwan@google.com>
10466
10467         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
10468         (Target_arm::do_finalize_sections): Add parameter for symbol table
10469         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
10470         * i386.cc (Target_i386::do_finalize_sections): Add an additional
10471         parameter for symbol table pointer.
10472         * layout.cc (Layout::finalize): Call Target::finalize_sections with
10473         an additional parameter for a pointer to symbol table.
10474         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
10475         parameter for a symbol table pointer.
10476         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
10477         * target.h (Target::finalize_sections, Target::do_finalize_sections):
10478         Ditto.
10479         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
10480         parameter for a symbol table pointer.
10481
10482 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
10483
10484         * incremental.cc (Incremental_inputs_header)
10485         (Incremental_inputs_header_write, Incremental_inputs_entry)
10486         (Incremental_inputs_entry_write): Move ...
10487         * incremental.h (Incremental_inputs_header)
10488         (Incremental_inputs_header_write, Incremental_inputs_entry)
10489         (Incremental_inputs_entry_write): here.
10490
10491 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10492
10493         * incremental.cc (make_sized_incremental_binary): Set the target.
10494         Error if it is incompatible.
10495         * output.h (Output_file): Add filename method.
10496
10497 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10498
10499         * incremental.cc (Incremental_inputs_entry): Remove unused argument
10500         from the get_* methods.
10501
10502 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10503
10504         * incremental-dump.cc (main): Check that the offeset of a script is 0.
10505         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
10506         Write 0 for the data_offset of scripts.
10507
10508 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10509
10510         * testsuite/Makefile.am: Add the incremental_test.sh test.
10511         * testsuite/incremental_test.sh: New.
10512         * testsuite/incremental_test_1.c: New.
10513         * testsuite/incremental_test_2.c: New.
10514
10515 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
10516
10517         * incremental-dump.cc (main): Fix typos.
10518
10519 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
10520
10521         PR gold/11025
10522         * incremental-dump.cc (main): Use llu to print 64 bit values.
10523
10524 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
10525             H.J. Lu  <hongjiu.lu@intel.com>
10526
10527         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
10528         $(LIBDL).
10529         (incremental_dump_LDADD): Likewise.
10530         * Makefile.in: Regenerated.
10531
10532 2009-11-25  Doug Kwan  <dougkwan@google.com>
10533
10534         Revert:
10535
10536         2009-11-25  Doug Kwan  <dougkwan@google.com>
10537
10538                 * arm.cc (Target_arm::Target_arm): Move method definition
10539                 outside of class definition.  Add code to handle
10540                 --target1-rel, --target1-abs and --target2= options.
10541                 (Target_arm::get_reloc_reloc_type): Change method to be
10542                 non-static and const.
10543                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
10544                 New data member declaration.
10545                 (Target_arm::Scan::local, Target_arm::Scan::global,
10546                 Target_arm::Relocate::relocate,
10547                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10548                 Adjust call to Target_arm::get_real_reloc_type.
10549                 (Target_arm::get_real_reloc_type): Use command line options
10550                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
10551                 * options.h (--target1-rel, --target1-abs, --target2): New
10552                 ARM-only options.
10553
10554 2009-11-25  Doug Kwan  <dougkwan@google.com>
10555
10556         * arm.cc (Target_arm::Target_arm): Move method definition outside of
10557         class definition.  Add code to handle --target1-rel, --target1-abs
10558         and --target2= options.
10559         (Target_arm::get_reloc_reloc_type): Change method to be non-static
10560         and const.
10561         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
10562         member declaration.
10563         (Target_arm::Scan::local, Target_arm::Scan::global,
10564         Target_arm::Relocate::relocate,
10565         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
10566         call to Target_arm::get_real_reloc_type.
10567         (Target_arm::get_real_reloc_type): Use command line options to
10568         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
10569         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
10570         options.
10571
10572 2009-11-25  Doug Kwan  <dougkwan@google.com>
10573
10574         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
10575         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
10576         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
10577         formatting.
10578         (Arm_relocate_functions::thm_call): Replace body with a call to
10579         Arm_relocate_functions::thumb_branch_common.
10580         (Arm_relocate_functions::thm_jump24,
10581         Arm_relocate_functions::thm_xpc22): New method definitions.
10582         (Arm_relocate_functions::thumb_branch_common): New method definition.
10583         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
10584         operator.
10585         (Target_arm::Relocate::relocate): Adjust call to thm_call.
10586         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
10587
10588 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
10589
10590         * Makefile.am: Build incremental-dump
10591         * Makefile.in: Regenerate.
10592         * incremental-dump.cc: New.
10593         * incremental.cc (Incremental_inputs_header_data,
10594         Incremental_inputs_entry_data): Move to incremental.h
10595         * incremental.h: (Incremental_inputs_header_data,
10596         Incremental_inputs_entry_data): Move from incremental.cc
10597
10598 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
10599
10600         * incremental.cc (Incremental_inputs_header,
10601         Incremental_inputs_header_write, Incremental_inputs_entry,
10602         Incremental_inputs_entry_write): Add a typedef with the data type.
10603
10604 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
10605
10606         * incremental.cc (Incremental_inputs_header,
10607         Incremental_inputs_header_write, Incremental_inputs_entry,
10608         Incremental_inputs_entry_write): Update comment about which
10609         type has the filed descriptions.
10610
10611 2009-11-15  Doug Kwan  <dougkwan@google.com>
10612
10613         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
10614         (Arm_relocate_functions::arm_branch_common): Change method defintion
10615         in class definition to a method declaration and update list of formal
10616         parameters.
10617         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
10618         Arm_relocation_functions::jump24): Adjust call to
10619         Arm_relocate_functions::arm_branch_common.  Update list of formal
10620         parameters.
10621         (Arm_relocate_functions::xpc25): New method definition.
10622         (Arm_relocate_functions::arm_branch_common): Move method defintion
10623         out from class definition.  Use stubs for mode-switching and extending
10624         branch ranges.
10625         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
10626         specially.  Change code to enable use of stubs in ARM branches.
10627
10628 2009-11-10  Doug Kwan  <dougkwan@google.com>
10629
10630         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
10631         in method declaration.
10632         (Target_arm::relocate_stub): New method declaration.
10633         (Target_arm::default_target): Change to return a pointer instead of
10634         a const reference.
10635         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
10636         Target_arm::default_target.
10637         (Arm_Relobj::do_relocate_sections): Remove options paramater in
10638         method definition.
10639         (Target_arm::relocate_section): Adjust view.
10640         (Target_arm::relocate_stub): New method definition.
10641
10642 2009-11-10  Doug Kwan  <dougkwan@google.com>
10643
10644         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
10645         a format warning.
10646         * incremental.cc (open_incremental_binary): Initialized local
10647         variables to avoid warnings.
10648         * object.cc (make_elf_object): Ditto.
10649         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
10650         a format warning.
10651
10652 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
10653
10654         PR gold/10930
10655         * testsuite/plugin_test.c: Include "config.h".
10656
10657 2009-11-09  Doug Kwan  <dougkwan@google.com>
10658
10659         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
10660         (arm_symbol_value): Remove.
10661         (Arm_relocate_functions::arm_branch_common,
10662         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
10663         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
10664         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
10665         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
10666         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
10667         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
10668         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
10669         Arm_relocate_functions::thm_mobw_abs_nc,
10670         Arm_relocate_functions::thm_mov_abs,
10671         Arm_relocate_functions::movw_prel_nc,
10672         Arm_relocate_functions::thm_movt_abs,
10673         Arm_relocate_functions::movt_prel,
10674         Arm_relocate_functions::thm_movw_prel_nc,
10675         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
10676         (Target_arm::Relocate::relocate): Only decompose address into two
10677         parts if relocation type uses the thumb-bit and pass the actual
10678         bit instead of a flag indicating that the thumb-bit is used.  Adjust
10679         calls to methods in Arm_relocate_functions for this change.
10680
10681 2009-11-08  Ian Lance Taylor  <iant@google.com>
10682
10683         PR 10925
10684         * reloc.cc: Instantiate
10685         Sized_relobj::initialize_input_to_output_maps and
10686         Sized_relobj:free_input_to_output_maps.
10687
10688 2009-11-06  Ian Lance Taylor  <iant@google.com>
10689
10690         PR 10876
10691         * defstd.cc (in_segment): Set only_if_ref true for "end".
10692
10693 2009-11-06  Doug Kwan  <dougkwan@google.com>
10694
10695         * arm.cc (class Reloc_stub): Correct a comment.
10696         (Target_arm::Target_arm): Initialize arm_input_section_map_.
10697         (Target_arm::scan_section_for_stubs): New method declaration.
10698         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
10699         Change methods from private to protected.
10700         (Target_arm::do_may_relax): New method definition.
10701         (Target_arm::do_relax, Target_arm::group_sections,
10702         Target_arm::scan_reloc_for_stub,
10703         Target_arm::scan_reloc_section_for_stubs): New method declarations.
10704         (Target_arm::arm_input_section_map_): New data member declaration.
10705         (Target_arm::scan_reloc_for_stub,
10706         Target_arm::scan_reloc_section_for_stubs,
10707         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
10708         Target_arm::do_relax): New method definitions.
10709
10710 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
10711
10712         * configure.ac: Check for (struct stat)::st_mtim
10713         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
10714         * config.in: Regenerate.
10715         * configure: Regenerate.
10716
10717 2009-11-05  Ian Lance Taylor  <iant@google.com>
10718
10719         PR 10910
10720         * output.cc (Output_segment::add_output_section): Add missing
10721         return statement.
10722
10723 2009-11-04  Ian Lance Taylor  <iant@google.com>
10724
10725         PR 10880
10726         * object.h (class Object): Add is_needed and set_is_needed
10727         methods.  Add is_needed_ field.  Make bool fields into bitfields.
10728         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
10729         defined in a dynamic object and referenced by a regular object,
10730         set is_needed for the dynamic object.
10731         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
10732         if the file is marked with as_needed and it is not needed.
10733
10734 2009-11-04  Ian Lance Taylor  <iant@google.com>
10735
10736         PR 10887
10737         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
10738         tags if data is discarded by linker script.
10739         * i386.cc (Target_i386::do_finalize_sections): Likewise.
10740         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
10741         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
10742         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
10743
10744 2009-11-04  Ian Lance Taylor  <iant@google.com>
10745
10746         * layout.cc (Layout::get_output_section): Add is_interp and
10747         is_dynamic_linker_section parameters.  Change all callers.
10748         (Layout::choose_output_section): Likewise.
10749         (Layout::make_output_section): Likewise.
10750         (Layout::add_output_section_data): Add is_dynamic_linker_section
10751         parameter.  Change all callers.
10752         * layout.h (class Layout): Update declarations.
10753         * output.h (class Output_section): Add is_interp, set_is_interp,
10754         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
10755         Add is_interp_, is_dynamic_linker_section_ fields.  Change
10756         generate_code_fills_at_write_ to a bitfield.
10757         * output.cc (Output_section::Output_sections): Initialize new
10758         fields.
10759         (Output_segment::add_output_section): Add do_sort parameter.
10760         Change all callers.
10761
10762 2009-11-03  Ian Lance Taylor  <iant@google.com>
10763
10764         PR 10860
10765         * options.h (class General_options): Add --warn-common.
10766         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
10767         merging two common symbols.
10768         (Symbol_table::should_override): Handle --warn-common when merging
10769         a common symbol with a defined symbol.  Use report_resolve_problem
10770         for multiple definitions.
10771         (Symbol_table::report_resolve_problem): New function.
10772         * symtab.h (class Symbol_table): Declare report_resolve_problem.
10773
10774 2009-11-03  Doug Kwan  <dougkwan@google.com>
10775
10776         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
10777         stub_factory_.
10778         (Target_arm::stub_factory): New method definition.
10779         (Target_arm::new_arm_input_section,
10780         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
10781         Target_arm::reloc_uses_thumb_bit): New method declarations.
10782         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
10783         New type definitions.
10784         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
10785         member declarations.
10786         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
10787         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
10788         New method definitions.
10789
10790 2009-11-03  Ian Lance Taylor  <iant@google.com>
10791
10792         * options.h (class General_options): Add --warn_constructors.
10793
10794 2009-11-03  Ian Lance Taylor  <iant@google.com>
10795
10796         PR 10893
10797         * defstd.cc (in_section): Add entries for __rel_iplt_start,
10798         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
10799
10800 2009-11-03  Ian Lance Taylor  <iant@google.com>
10801
10802         PR 10895
10803         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
10804         --msgid-bugs-address.
10805         (install-pdf): New target.
10806         (install-data_yes): Look up one directory to find mkinstalldirs.
10807
10808 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
10809
10810         * po/Make-in (.po.gmo): Don't generate .gmo files in source
10811         tree.
10812
10813 2009-10-30  Doug Kwan  <dougkwan@google.com>
10814
10815         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
10816
10817 2009-10-30  Doug Kwan  <dougkwan@google.com>
10818
10819         * arm.cc (Stub_addend_reader): New struct template definition
10820         and partial specializations.
10821         (Stub_addend_reader::operator()): New method definition for a
10822         partially specialized template.
10823
10824 2009-10-30  Doug Kwan  <dougkwan@google.com>
10825
10826         * arm.cc (Arm_relobj::processor_specific_flags): New method
10827         definition.
10828         (Arm_relobj::do_read_symbols): New method declaration.
10829         (Arm_relobj::processor_specific_flags_): New data member declaration.
10830         (Arm_dynobj): New class definition.
10831         (Target_arm::do_finalize_sections): Add input_objects parameter.
10832         (Target_arm::do_adjust_elf_header): New method declaration.
10833         (Target_arm::are_eabi_versions_compatible,
10834         (Target_arm::merge_processor_specific_flags): New method declaration.
10835         (Target_arm::do_make_elf_object): New overloaded method definitions
10836         and declaration.
10837         (Arm_relobj::do_read_symbols): New method definition.
10838         (Arm_dynobj::do_read_symbols): Ditto.
10839         (Target_arm::do_finalize_sections): Add input_objects parameters.
10840         Merge processor-specific flags from all input objects.
10841         (Target_arm::are_eabi_versions_compatible,
10842         Target_arm::merge_processor_specific_flags,
10843         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
10844         New method definitions.
10845         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
10846         Input_objects pointer type parameter.
10847         * layout.cc (Layout::finalize): Pass input objects to target's.
10848         finalize_sections function.
10849         * output.cc (Output_file_header::do_sized_write): Set ELF file
10850         header's processor-specific flags.
10851         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
10852         Input_objects pointer type parameter.
10853         * sparc.cc (Target_sparc::do_finalize_sections): Same.
10854         * target.h (Input_objects): New forward class declaration.
10855         (Target::processor_specific_flags,
10856         Target::are_processor_specific_flags_sect): New method definitions.
10857         (Target::finalize_sections): Add input_objects parameter.
10858         (Target::Target): Initialize processor_specific_flags_ and
10859         are_processor_specific_flags_set_.
10860         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
10861         parameter.
10862         (Target::set_processor_specific_flags): New method definition.
10863         (Target::processor_specific_flags_,
10864         Target::are_processor_specific_flags_set_): New data member
10865         declarations.
10866         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
10867         Input_objects pointer type parameter.
10868
10869 2009-10-30  Doug Kwan  <dougkwan@google.com>
10870
10871         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
10872
10873 2009-10-28  Ian Lance Taylor  <iant@google.com>
10874
10875         * object.h (class Relobj): Drop options parameter from
10876         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
10877         do_scan_relocs, do_relocate.  Change all callers.
10878         (class Sized_relobj): Drop options parameters from
10879         do_gc_process_relocs, do_scan_relocs, do_relocate,
10880         do_relocate_sections, relocate_sections, emit_relocs_scan,
10881         emit_relocs_scan_reltype.  Change all callers.
10882         (struct Relocate_info): Remove options field and all references to
10883         it.
10884         * reloc.h (class Read_relocs): Remove options constructor
10885         parameter and options_ field.  Change all callers.
10886         (class Gc_process_relocs, class Scan_relocs): Likewise.
10887         (class Relocate_task): Likewise.
10888         * target-reloc.h (scan_relocs): Remove options parameter.  Change
10889         all callers.
10890         (scan_relocatable_relocs): Likewise.
10891         * target.h (class Sized_target): Remove options parameter from
10892         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
10893         all callers.
10894         * gc.h (gc_process_relocs): Remove options parameter.  Change all
10895         callers.
10896         * arm.cc: Update functions to remove options parameters.
10897         * i386.cc: Likewise.
10898         * powerpc.cc: Likewise.
10899         * sparc.cc: Likewise.
10900         * x86_64.cc: Likewise.
10901         * testsuite/testfile.cc: Likewise.
10902
10903 2009-10-28  Doug Kwan  <dougkwan@google.com>
10904
10905         * arm.cc (Arm_relobj): New class definition.
10906         (Arm_relobj::scan_sections_for_stubs,
10907         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
10908         New method definitions.
10909
10910 2009-10-28  Cary Coutant  <ccoutant@google.com>
10911
10912         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
10913         (Plugin::cleanup_done_): New member.
10914         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
10915         (Plugin_manager::cleanup_done_): Remove.
10916         (Plugin_manager::add_input_file): Edit error message.
10917         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
10918         (Plugin_manager::cleanup): Remove use of cleanup_done_.
10919
10920 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
10921
10922         * fileread.cc: (File_read::View::~View): Use the new
10923         data_ownership_ filed.
10924         (File_read::~File_read): Dispose the new whole_file_view_.
10925         (File_read::open): Mmap the whole file if needed.
10926         (File_read::open): Use whole_file_view_ instead of contents_.
10927         (File_read::find_view): Use whole_file_view_ if applicable.
10928         (File_read::do_read): Use whole_file_view_ instead of contents_.
10929         (File_read::make_view): Use whole_file_view_ instead of contents_,
10930         update File_read::View::View call.
10931         (File_read::find_or_make_view): Update File_read::View::View
10932         call.
10933         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
10934         remove contents_
10935         (File_read::View::Data_ownership): New enum.
10936         (File_read::View::View): Replace bool mapped_ with Data_ownership
10937         argument.
10938         (File_read::View::mapped_): Remove (replaced by data_ownership_).
10939         (File_read::View::data_ownership_): New field.
10940         (File_read::contents_): Remove (replaced by whole_file_view_).
10941         (File_read::whole_file_view_): New field.
10942         * options.h (class General_options): Add --keep-files-mapped.
10943
10944 2009-10-27  Cary Coutant  <ccoutant@google.com>
10945
10946         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
10947         * testsuite/Makefile.am (plugin_test_5): New test case.
10948         * testsuite/Makefile.in: Regenerate.
10949
10950 2009-10-25  Doug Kwan  <dougkwan@google.com>
10951
10952         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
10953         from private to protected to allow access by child class.
10954         (Sized_relobj::do_relocate_sections): New method declaration.
10955         (Sized_relobj::relocate_sections): Virtualize.
10956         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
10957         Sized_relobj::relocate_sections.  Instantiate template explicitly
10958         for different target sizes and endianity.
10959
10960 2009-10-24  Doug Kwan  <dougkwan@google.com>
10961
10962         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
10963         (Arm_input_section::as_arm_input_section): New method.
10964         (Arm_output_section): New class definition.
10965         (Arm_output_section::create_stub_group,
10966         Arm_output_section::group_sections): New method definitions.
10967
10968 2009-10-22  Doug Kwan  <dougkwan@google.com>
10969
10970         * arm.cc (Arm_input_section): New class definition.
10971         (Arm_input_section::init, Arm_input_section:do_write,
10972         Arm_input_section::set_final_data_size,
10973         Arm_input_section::do_reset_address_and_file_offset): New method
10974         definitions.
10975
10976 2009-10-21  Doug Kwan  <dougkwan@google.com>
10977
10978         * arm.cc (Stub_table, Arm_input_section): New forward class
10979         declarations.
10980         (Stub_table): New class defintion.
10981         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
10982         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
10983         New method definition.
10984
10985 2009-10-21  Doug Kwan  <dougkwan@google.com>
10986
10987         * arm.cc: Update copyright comments.
10988         (Target_arm): New forward class template declaration.
10989         (Arm_address): New type.
10990         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
10991         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
10992         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
10993         constants.
10994         (Insn_template): Same.
10995         (DEF_STUBS): New macro.
10996         (Stub_type): New enum type.
10997         (Stub_template): New class definition.
10998         (Stub): Same.
10999         (Reloc_stub): Same.
11000         (Stub_factory): Same.
11001         (Target_arm::Target_arm): Initialize may_use_blx_ and
11002         should_force_pic_veneer_.
11003         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
11004         Target_arm::should_force_pic_veneer,
11005         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
11006         Target_arm::using_thumb_only, Target_arm:;default_target): New
11007         method defintions.
11008         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
11009         New data member declarations.
11010         (Insn_template::size, Insn_template::alignment): New method defintions.
11011         (Stub_template::Stub_template): New method definition.
11012         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
11013         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
11014         (Stub_factory::Stub_factory): New method definition.
11015         * gold.h (string_hash): New template.
11016         * output.h (Input_section_specifier::hash_value): Use
11017         gold::string_hash.
11018         (Input_section_specifier::string_hash): Remove.
11019         * stringpool.cc (Stringpool_template::string_hash): Use
11020         gold::string_hash.
11021
11022 2009-10-20  Doug Kwan  <dougkwan@google.com>
11023
11024         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
11025         symbols of relaxed input sections.
11026         * output.h (Output_section::find_relaxed_input_section): Make
11027         method public.
11028
11029 2009-10-16  Doug Kwan  <dougkwan@google.com>
11030
11031         * dynobj.cc (Versions::Versions): Initialize version_script_.
11032         Only insert base version symbol definition for a shared object
11033         if version script defines any version versions.
11034         (Versions::define_base_version): New method definition.
11035         (Versions::add_def): Check that base version is not needed.
11036         (Versions::add_need): Define base version lazily.
11037         * dynobj.h (Versions::define_base_version): New method declaration.
11038         (Versions::needs_base_version_): New data member declaration.
11039         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
11040         (check_DATA): Add no_version_test.stdout.
11041         (libno_version_test.so, no_version_test.o no_version_test.stdout):
11042         New make rules.
11043         * testsuite/Makefile.in: Regenerate.
11044         * testsuite/no_version_test.c: New file.
11045         * testsuite/no_version_test.sh: Ditto.
11046
11047 2009-10-16  Doug Kwan  <dougkwan@google.com>
11048
11049         * expression.cc (class Segment_start_expression): New class definition.
11050         (Segment_start_expression::value): New method definition.
11051         (script_exp_function_segment_start): Return a new
11052         Segment_start_expression.
11053         * gold/script-c.h (script_saw_segment_start_expression): New function
11054         prototype.
11055         * script-sections.cc (Script_sections::Script_sections): Initialize
11056         SAW_SEGMENT_START_EXPRESSION_ to false.
11057         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
11058         and -Tbbs options to specify section addresses if given in
11059         command line and no SEGMENT_START expression is seen in a script.
11060         * script-sections.h (Script_sections::saw_segment_start_expression,
11061         Script_sections::set_saw_segment_start_expression): New method
11062         definition.
11063         (Script_sections::saw_segment_start_expression_): New data member
11064         declaration.
11065         * script.cc (script_saw_segment_start_expression): New function.
11066         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
11067         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
11068         script_test_7.sh and script_test_8.sh.
11069         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
11070         script_test_8.stdout.
11071         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
11072         (script_test_6, script_test_6.stdout, script_test_7,
11073         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
11074         * Makefile.in: Regenerate.
11075         * testsuite/script_test_6.sh: New file.
11076         * testsuite/script_test_6.t: Same.
11077         * testsuite/script_test_7.sh: Same.
11078         * testsuite/script_test_7.t: Same.
11079         * testsuite/script_test_8.sh: Same.
11080
11081 2009-10-16  Doug Kwan  <dougkwan@google.com>
11082
11083         * output.cc (Output_segment::set_section_list_address): Cast
11084         expressions to unsigned long long type to avoid format warnings.
11085
11086 2009-10-15  Ian Lance Taylor  <iant@google.com>
11087
11088         * script.cc (Script_options::add_symbol_assignment): Always add a
11089         dot assignment to script_sections_.
11090         * script-sections.cc (Script_sections::add_dot_assignment):
11091         Initialize if necessary.
11092
11093         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
11094         program headers with no load segment if there is a linker script.
11095
11096         * layout.cc (Layout::set_segment_offsets): Align the file offset
11097         to the segment aligment for -N or -n with no load segment.
11098         * output.cc (Output_segment::add_output_section): Don't crash if
11099         the first section is a TLS section.
11100         (Output_segment::set_section_list_addresses): Print an error
11101         message if the address moves backward in a linker script.
11102         * script-sections.cc
11103         (Output_section_element_input::set_section_addresses): Don't
11104         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
11105         (Orphan_output_section::set_section_addresses): Likewise.
11106
11107 2009-10-15  Doug Kwan  <dougkwan@google.com>
11108
11109         * layout.cc (Layout::finish_dynamic_section): Generate tags
11110         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
11111         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
11112         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
11113
11114 2009-10-14  Ian Lance Taylor  <iant@google.com>
11115
11116         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
11117         fields.
11118         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
11119         data_shdr fields of relinfo.
11120         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
11121         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
11122         R_386_TLS_LDO_32, adjust based on section flags.
11123         (Target_i386::Relocate::fix_up_ldo): Remove.
11124
11125 2009-10-13  Ian Lance Taylor  <iant@google.com>
11126
11127         Add support for -pie.
11128         * options.h (class General_options): Add -pie and
11129         --pic-executable.
11130         (General_options::output_is_position_independent): Test -pie.
11131         (General_options::output_is_executable): Return true if not shared
11132         and not relocatable.
11133         (General_options::output_is_pie): Remove.
11134         * options.cc (General_options::finalize): Reject incompatible uses
11135         of -pie.
11136         * gold.cc (queue_middle_tasks): A -pie link is not static.
11137         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
11138         * symtab.cc (Symbol::final_value_is_known): Return false if
11139         output_is_position_independent.
11140         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
11141         output_is_position_independent.
11142         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
11143         output_is_position_independent.
11144         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
11145         output_is_position_independent.
11146         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
11147         two_file_pie_test.
11148         (basic_pie_test.o, basic_pie_test): New targets.
11149         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
11150         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
11151         (two_file_pie_test): New target.
11152         * testsuite/Makefile.in: Rebuild.
11153         * README: Remove note saying that -pie is not supported.
11154
11155 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
11156
11157         * options.h (class General_options): Add -init and -fini.
11158         * layout.cc (Layout::finish_dynamic_section): Emit
11159         given init and fini functions.
11160
11161 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
11162
11163         * gc.h (gc_process_relocs): Check if icf is enabled using new
11164         function.
11165         * gold.cc (queue_initial_tasks): Likewise.
11166         (queue_middle_tasks): Likewise.
11167         * object.cc (do_layout): Likewise.
11168         * symtab.cc (is_section_folded): Likewise.
11169         * main.cc (main): Likewise.
11170         * reloc.cc (Read_relocs::run): Likewise.
11171         (Sized_relobj::do_scan_relocs): Likewise.
11172         * icf.cc (is_function_ctor_or_dtor): New function.
11173         (Icf::find_identical_sections): Check if function is ctor or dtor when
11174         safe icf is chosen.
11175         * options.h (General_options::icf): Change option to be an enum.
11176         (Icf_status): New enum.
11177         (icf_enabled): New method.
11178         (icf_safe_folding): New method.
11179         (set_icf_status): New method.
11180         (icf_status_): New variable.
11181         * (options.cc) (General_options::finalize): Set icf_status_.
11182         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
11183         icf_test and icf_keep_unique_test to use the --icf enum flag.
11184         * testsuite/icf_safe_test.sh: New file.
11185         * testsuite/icf_safe_test.cc: New file.
11186
11187 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
11188
11189         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
11190         includes to gc.h and icf.h.
11191         * arm.cc: Include gc.h.
11192         * gold.cc: Likewise.
11193         * i386.cc: Likewise.
11194         * powerpc.cc: Likewise.
11195         * sparc.cc: Likewise.
11196         * x86_64.cc: Likewise.
11197         * gc.h: Include icf.h.
11198
11199 2009-10-11  Ian Lance Taylor  <iant@google.com>
11200
11201         * plugin.cc: Include "gold.h" before other header files.
11202
11203 2009-10-10  Chris Demetriou  <cgd@google.com>
11204
11205         * options.h (Input_file_argument::Input_file_type): New enum.
11206         (Input_file_argument::is_lib_): Replace with...
11207         (Input_file_argument::type_): New member.
11208         (Input_file_argument::Input_file_argument): Take Input_file_type
11209         'type' rather than boolean 'is_lib' as second argument.
11210         (Input_file_argument::is_lib): Use type_.
11211         (Input_file_argument::is_searched_file): New function.
11212         (Input_file_argument::may_need_search): Handle is_searched_file.
11213         * options.cc (General_options::parse_library): Support -l:filename.
11214         (General_options::parse_just_symbols): Update for Input_file_argument
11215         changes.
11216         (Command_line::process): Likewise.
11217         * archive.cc (Archive::get_file_and_offset): Likewise.
11218         * plugin.cc (Plugin_manager::release_input_file): Likewise.
11219         * script.cc (read_script_file, script_add_file): Likewise.
11220         * fileread.cc (Input_file::Input_file): Likewise.
11221         (Input_file::will_search_for): Handle is_searched_file.
11222         (Input_file::open): Likewise.
11223         * readsyms.cc (Read_symbols::get_name): Likewise.
11224         * testsuite/Makefile.am (searched_file_test): New test.
11225         * testsuite/Makefile.in: Regenerate.
11226         * testsuite/searched_file_test.cc: New file.
11227         * testsuite/searched_file_test_lib.cc: New file.
11228
11229 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11230             Ian Lance Taylor  <iant@google.com>
11231
11232         * descriptor.cc: Include <cstdio> and "binary-io.h".
11233         (Descriptors::open): Open the files in binary mode always.
11234         * script.cc (Lex::get_token): Treat \r as whitespace.
11235
11236 2009-10-09  Ian Lance Taylor  <iant@google.com>
11237
11238         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
11239
11240 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11241             Ian Lance Taylor  <iant@google.com>
11242
11243         * configure.ac: Check for readv function also.
11244         * fileread.cc (readv): Define if not HAVE_READV.
11245         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
11246         does not exist.
11247         * config.in: Regenerate.
11248         * configure: Regenerate.
11249
11250 2009-10-09  Doug Kwan  <dougkwan@google.com>
11251
11252         * layout.cc (Layout::make_output_section): Call target hook to make
11253         ordinary output section.
11254         (Layout::finalize): Adjust parameter list of call the
11255         Target::may_relax().
11256         * layout.h (class Layout::section_list): New method.
11257         * merge.h (Output_merge_base::entsize): Change visibility to public.
11258         (Output_merge_base::is_string, Output_merge_base::do_is_string):
11259         New methods.
11260         (Output_merge_string::do_is_string): New method.
11261         * object.cc (Sized_relobj::do_setup): renamed from
11262         Sized_relobj::set_up.
11263         * object.h (Sized_relobj::adjust_shndx,
11264         Sized_relobj::initializ_input_to_output_maps,
11265         Sized_relobj::free_input_to_output_maps): Change visibilities to
11266         protected.
11267         (Sized_relobj::setup): Virtualize.
11268         (Sized_relobj::do_setup): New method declaration.
11269         (Sized_relobj::invalidate_section_offset,
11270         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
11271         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
11272         * options.cc (parse_int): New function.
11273         * options.h (parse_int): New declaration.
11274         (DEFINE_int): New macro.
11275         (stub_group_size): New option.
11276         * output.cc (Output_section::Output_section): Initialize memebers
11277         merge_section_map_, merge_section_by_properties_map_,
11278         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
11279         (Output_section::add_input_section): Handled deferred code-fill
11280         generation and remove an old comment.
11281         (Output_section::add_relaxed_input_section): New method definition.
11282         (Output_section::add_merge_input_section): Use merge section by
11283         properties map to speed to search.  Update merge section maps
11284         as appropriate.
11285         (Output_section::build_relaxation_map): New method definition.
11286         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
11287         Same.
11288         (Output_section::relax_input_section): Renamed to
11289         Output_section::convert_input_sections_to_relaxed_sections and change
11290         interface to take a vector of pointers to relaxed sections.
11291         (Output_section::find_merge_section,
11292         Output_section::find_relaxed_input_section): New method definitions.
11293         (Output_section::is_input_address_mapped,
11294         Output_section::output_offset, Output_section::output_address):
11295         Use output section data maps to speed up searching.
11296         (Output_section::find_starting_output_address): Add comments.
11297         (Output_section::do_write,
11298         Output_section::write_to_postprocessing_buffer): Do code-fill
11299         generation as appropriate.
11300         (Output_section::get_input_sections): Invalidate relaxed input section
11301         map.
11302         (Output_section::restore_states): Adjust type of checkpoint .
11303         Invalidate relaxed input section map.
11304         * output.h (Output_merge_base): New class declaration.
11305         (Input_section_specifier): New class defintion.
11306         (class Output_relaxed_input_section) Change base class to
11307         Output_section_data_build.
11308         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
11309         base class initializer.
11310         (Output_section::add_relaxed_input_section): New method declaration.
11311         (Output_section::Input_section): Change visibility to protected.
11312         (Output_section::Input_section::relobj,
11313         Output_section::Input_section::shndx): Handle relaxed input sections.
11314         Output_section::input_sections) Change visibility to protected.  Also
11315         define overload to return a non-const pointer.
11316         (Output_section::Merge_section_properties): New class defintion.
11317         (Output_section::Merge_section_by_properties_map,
11318         Output_section::Output_section_data_by_input_section_map,
11319         Output_section::Relaxation_map): New types.
11320         (Output_section::relax_input_section): Rename method to
11321         Output_section::convert_input_sections_to_relaxed_sections and change
11322         interface to take a vector of relaxed section pointers.
11323         (Output_section::find_merge_section,
11324         Output_section::find_relaxed_input_section,
11325         Output_section::build_relaxation_map,
11326         Output_section::convert_input_sections_in_list_to_relaxed_sections):
11327         New method declarations.
11328         (Output_section::merge_section_map_
11329         Output_section::merge_section_by_properties_map_,
11330         Output_section::relaxed_input_section_map_,
11331         Output_section::is_relaxed_input_section_map_valid_,
11332         Output_section::generate_code_fills_at_write_): New data members.
11333         * script-sections.cc
11334         (Output_section_element_input::set_section_addresses): Call
11335         current_data_size and addralign methods of relaxed input sections.
11336         (Orphan_output_section::set_section_addresses): Call current_data_size
11337         and addralign methods of relaxed input sections.
11338         * symtab.cc (Symbol_table::compute_final_value): Extract template
11339         from the body of Symbol_table::sized_finalize_symbol.
11340         (Symbol_table::sized_finalized_symbol): Call
11341         Symbol_table::compute_final_value.
11342         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
11343         (Symbol_table::compute_final_value): New templated method declaration.
11344         * target.cc (Target::do_make_output_section): New method defintion.
11345         * target.h (Target::make_output_section): New method declaration.
11346         (Target::relax): Add more parameters for input objects, symbol table
11347         and layout.  Adjust call to do_relax.
11348         (Target::do_make_output_section): New method declaration.
11349         (Target::do_relax): Add parameters for input objects, symbol table
11350         and layout.
11351
11352 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11353
11354         * pread.c: Include stdio.h.
11355
11356 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11357
11358         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
11359         defined.
11360
11361 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11362
11363         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
11364         Change read_shndx type to unsigned int.
11365         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
11366         int.
11367         (Sized_dwarf_line_info::read_line_mappings): Likewise.
11368         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
11369         Change read_shndx type to unsigned int.
11370         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
11371         int.
11372         (Sized_dwarf_line_info::read_line_mappings): Likewise.
11373         * layout.cc (Layout::create_symtab_sections): Cast the result of
11374         local_symcount * symsize to off_t in the gold_assert.
11375
11376 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11377
11378         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
11379         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
11380         R_ARM_BASE_ABS.
11381         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
11382         (Arm_relocate_functions::thm_abs5): New function.
11383         (Arm_relocate_functions::abs12): New function.
11384         (Arm_relocate_functions::abs16): New function.
11385         (Arm_relocate_functions::base_abs): New function.
11386         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
11387         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
11388         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
11389         R_ARM_BASE_ABS.
11390         (Scan::global): Likewise.
11391         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
11392         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
11393         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
11394         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
11395         R_ARM_BASE_ABS.
11396
11397 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11398
11399         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
11400         (Arm_relocate_functions::movt_prel): New function.
11401         (Arm_relocate_functions::thm_movw_prel_nc): New function.
11402         (Arm_relocate_functions::thm_movt_prel): New function.
11403         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
11404         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
11405         (Scan::global, Relocate::relocate): Likewise.
11406         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11407
11408 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
11409
11410         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
11411         Incremental_checker.
11412         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
11413         unsigned int.
11414         (class Incremental_inputs_header): New class.
11415         (Incremental_inputs_header_writer): Edit comment.
11416         (Incremental_inputs_entry): New class.
11417         (Incremental_inputs_entry_writer): Edit comment.
11418         (Sized_incremental_binary::do_find_incremental_inputs_section):
11419         Add *strtab_shndx parameter, fill it.
11420         (Sized_incremental_binary::do_check_inputs): New method.
11421         (Incremental_checker::can_incrementally_link_output_file): Use
11422         Sized_incremental_binary::check_inputs.
11423         (Incremental_inputs::report_command_line): Save command line in
11424         command_line_.
11425         * incremental.h:
11426         (Incremental_binary::find_incremental_inputs_section): New
11427         method.
11428         (Incremental_binary::do_find_incremental_inputs_section): Add
11429         strtab_shndx parameter.
11430         (Incremental_binary::do_check_inputs): New pure virtual method.
11431         (Sized_incremental_binary::do_check_inputs): Declare.
11432         (Incremental_checker::Incremental_checker): Add incremental_inputs
11433         parameter, use it to initialize incremental_inputs_.
11434         (Incremental_checker::incremental_inputs_): New field.
11435         (Incremental_checker::command_line): New method.
11436         (Incremental_checker::inputs): New method.
11437         (Incremental_checker::command_line_): New field.
11438
11439 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
11440
11441         * incremental.cc: Include <cstdarg> and "target-select.h".
11442         (vexplain_no_incremental): New function.
11443         (explain_no_incremental): New function.
11444         (Incremental_binary::error): New method.
11445         (Sized_incremental_binary::do_find_incremental_inputs_section): New
11446         method.
11447         (make_sized_incremental_binary): New function.
11448         (open_incremental_binary): New function.
11449         (can_incrementally_link_file): Add checks if output is ELF and has
11450         inputs section.
11451         * incremental.h: Include "elfcpp_file.h" and "output.h".
11452         (Incremental_binary): New class.
11453         (Sized_incremental_binary): New class.
11454         (open_incremental_binary): Declare.
11455         * object.cc (is_elf_object): Use
11456         elfcpp::Elf_recognizer::is_elf_file.
11457         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
11458         * output.h (Output_file::filesize): New method.
11459
11460 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11461
11462         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
11463         New function.
11464         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
11465         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
11466         function.
11467         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
11468         function.
11469         (Arm_relocate_functions::movw_abs_nc): New function.
11470         (Arm_relocate_functions::movt_abs): New function.
11471         (Arm_relocate_functions::thm_movw_abs_nc): New function.
11472         (Arm_relocate_functions::thm_movt_abs): New function.
11473         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
11474         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
11475         (Scan::global): Likewise.
11476         (Relocate::relocate): Likewise.
11477         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11478
11479 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11480
11481         * arm.cc (Arm_relocate_functions::got_prel) New function.
11482         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
11483         (Relocate::relocate): Likewise.
11484         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11485
11486 2009-10-06  Ian Lance Taylor  <iant@google.com>
11487
11488         * options.h (class General_options): Define
11489         split_stack_adjust_size parameter.
11490         * object.h (class Object): Add uses_split_stack_ and
11491         has_no_split_stack_ fields.  Add uses_split_stack and
11492         has_no_split_stack accessor functions.  Declare
11493         handle_split_stack_section.
11494         (class Reloc_symbol_changes): Define.
11495         (class Sized_relobj): Define Function_offsets.  Declare
11496         split_stack_adjust, split_stack_adjust_reltype, and
11497         find_functions.
11498         * object.cc (Object::handle_split_stack_section): New function.
11499         (Sized_relobj::do_layout): Call handle_split_stack_section.
11500         * dynobj.cc (Sized_dynobj::do_layout): Call
11501         handle_split_stack_section.
11502         * reloc.cc (Sized_relobj::relocate_sections): Call
11503         split_stack_adjust for executable sections in split_stack
11504         objects.  Pass reloc_map to relocate_section.
11505         (Sized_relobj::split_stack_adjust): New function.
11506         (Sized_relobj::split_stack_adjust_reltype): New function.
11507         (Sized_relobj::find_functions): New function.
11508         * target-reloc.h: Include "object.h".
11509         (relocate_section): Add reloc_symbol_changes parameter.  Change
11510         all callers.
11511         * target.h (class Target): Add calls_non_split method.  Declare
11512         do_calls_non_split virtual method.  Declare match_view and
11513         set_view_to_nop.
11514         * target.cc: Include "elfcpp.h".
11515         (Target::do_calls_non_split): New function.
11516         (Target::match_view): New function.
11517         (Target::set_view_to_nop): New function.
11518         * gold.cc (queue_middle_tasks): Give an error if mixing
11519         split-stack and non-split-stack objects with -r.
11520         * i386.cc (Target_i386::relocate_section): Add
11521         reloc_symbol_changes parameter.
11522         (Target_i386::do_calls_non_split): New function.
11523         * x86_64.cc (Target_x86_64::relocate_section): Add
11524         reloc_symbol_changes parameter.
11525         (Target_x86_64::do_calls_non_split): New function.
11526         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
11527         parameter.
11528         * powerpc.cc (Target_powerpc::relocate_section): Add
11529         reloc_symbol_changes parameter.
11530         * sparc.cc (Target_sparc::relocate_section): Add
11531         reloc_symbol_changes parameter.
11532         * configure.ac: Call AM_CONDITIONAL for the default target.
11533         * configure: Rebuild.
11534         * testsuite/Makefile.am (TEST_AS): New variable.
11535         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
11536         (check_DATA): Add split_i386 and split_x86_64 files.
11537         (SPLIT_DEFSYMS): Define.
11538         (split_i386_[1234n].o): New targets.
11539         (split_i386_[124]): New targets.
11540         (split_i386_[1234r].stdout): New targets.
11541         (split_x86_64_[1234n].o): New targets.
11542         (split_x86_64_[124]): New targets.
11543         (split_x86_64_[1234r].stdout): New targets.
11544         (MOSTLYCLEANFILES): Add new executables.
11545         * testsuite/split_i386.sh: New file.
11546         * testsuite/split_x86_64.sh: New file.
11547         * testsuite/split_i386_1.s: New file.
11548         * testsuite/split_i386_2.s: New file.
11549         * testsuite/split_i386_3.s: New file.
11550         * testsuite/split_i386_4.s: New file.
11551         * testsuite/split_i386_n.s: New file.
11552         * testsuite/split_x86_64_1.s: New file.
11553         * testsuite/split_x86_64_2.s: New file.
11554         * testsuite/split_x86_64_3.s: New file.
11555         * testsuite/split_x86_64_4.s: New file.
11556         * testsuite/split_x86_64_n.s: New file.
11557         * testsuite/testfile.cc (Target_test): Update relocation_section
11558         function.
11559         * testsuite/Makefile.in: Rebuild.
11560
11561 2009-10-06  Ian Lance Taylor  <iant@google.com>
11562
11563         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
11564         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
11565         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
11566         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
11567         the address on ldo_addrs_.
11568         (Target_i386::Relocate::fix_up_ldo): New function.
11569
11570 2009-10-06   Rafael Espindola  <espindola@google.com>
11571
11572         * plugin.cc (add_input_library): New.
11573         (Plugin::load): Add add_input_library to tv.
11574         (Plugin_manager::add_input_file): Add the is_lib argument.
11575         (add_input_file): Update call to Plugin_manager::add_input_file.
11576         (add_input_library): New.
11577         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
11578
11579 2009-09-30  Doug Kwan  <dougkwan@google.com>
11580
11581         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
11582         symbol and call Symbol::may_need_copy_reloc to determine if
11583         a copy reloc is needed.
11584         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
11585         nocopyreloc is given in command line.
11586         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
11587         given in command line.
11588         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
11589         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
11590         of the removed Target_i386::may_need_copy_reloc.
11591         * options.h (copyreloc): New option with default value false.
11592         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
11593         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
11594         instead of the removed Target_powerpc::may_need_copy_reloc.
11595         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
11596         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
11597         instead of the removed Target_sparc::may_need_copy_reloc.
11598         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
11599         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
11600         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
11601         instead of the removed Target_x86_64::may_need_copy_reloc.
11602
11603 2009-09-30  Ian Lance Taylor  <iant@google.com>
11604
11605         * object.h (class Object): Remove target_ field, and target,
11606         sized_target, and set_target methods.
11607         (Object::sized_target): Remove.
11608         (class Sized_relobj): Update declarations.  Remove sized_target.
11609         * object.cc (Sized_relobj::setup): Remove target parameter.
11610         Change all callers.
11611         (Input_objects::add_object): Don't do anything with the target.
11612         (make_elf_sized_object): Add punconfigured parameter.  Change all
11613         callers.  Set or test parameter target.
11614         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
11615         Change all callers.
11616         * parameters.cc (Parameters::set_target): Change parameter type to
11617         be non-const.
11618         (Parameters::default_target): Remove.
11619         (set_parameters_target): Change parameter type to be non-const.
11620         (parameters_force_valid_target): New function.
11621         (parameters_clear_target): New function.
11622         * parameters.h (class Parameters): Update declarations.  Remove
11623         default_target method.  Add sized_target and clear_target
11624         methods.  Change target_ to be non-const.
11625         (set_parameters_target): Update declaration.
11626         (parameters_force_valid_target): Declare.
11627         (parameters_clear_target): Declare.
11628         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
11629         as NULL if we aren't searching.
11630         (Add_symbols::run): Don't check for compatible target.
11631         * fileread.cc (Input_file::open_binary): Call
11632         parameters_force_valid_target.
11633         * gold.cc (queue_middle_tasks): Likewise.
11634         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
11635         set_target on object.
11636         * dynobj.h (class Sized_dynobj): Update declarations.
11637         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
11638         make_elf_object returns NULL.
11639         (Archive::include_member): Don't check whether object target is
11640         compatible.
11641         * output.cc (Output_section::add_input_section): Get target from
11642         parameters.
11643         (Output_section::relax_input_section): Likewise.
11644         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
11645         parameters.
11646         (Sized_relobj::do_scan_relocs): Likewise.
11647         (Sized_relobj::relocate_sections): Likewise.
11648         * resolve.cc (Symbol_table::resolve): Likewise.
11649         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
11650         parameter.  Change all callers.
11651         (Symbol_table::add_from_object): Get target from parameters.
11652         (Symbol_table::add_from_relobj): Don't check object target.
11653         (Symbol_table::add_from_dynobj): Likewise.
11654         (Symbol_table::define_special_symbol): Get target from
11655         parameters.
11656         * symtab.h (class Symbol_table): Update declaration.
11657         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
11658         parameter.  Change all callers.  Clear parameter target.
11659         (Binary_test): Test target here.
11660         * testsuite/object_unittest.cc (gold_testsuite): Remove
11661         target_test_pointer parameter.  Change all callers.
11662         (Object_test): Test target here.
11663
11664 2009-09-26  Ian Lance Taylor  <iant@google.com>
11665
11666         * testsuite/initpri1.c: Don't try to use constructor priorities if
11667         compiling with gcc before 4.3.
11668
11669 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
11670
11671         * testsuite/retain_symbols_file_test.sh (check_present): Change
11672         output file name to retain_symbols_file_test.stdout.
11673         (check_absent): Likewise.
11674
11675 2009-09-18  Craig Silverstein  <csilvers@google.com>
11676
11677         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
11678         * options.cc: Include <cerrno> and <fstream>.
11679         (General_options::finalize): Parse -retain-symbols-file tag.
11680         * options.h: New flag.
11681         (General_options): New method should_retain_symbol, new
11682         variable symbols_to_retain.
11683         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
11684         should_retain_symbol map.
11685         * testsuite/Makefile.am (retain_symbols_file_test): New test.
11686         * testsuite/Makefile.in: Regenerate.
11687         * testsuite/retain_symbols_file_test.sh: New file.
11688
11689 2009-09-18  Nick Clifton  <nickc@redhat.com>
11690
11691         * po/es.po: Updated Spanish translation.
11692
11693 2009-09-17  Doug Kwan  <dougkwan@google.com>
11694
11695         * debug.h (DEBUG_RELAXATION): New constant.
11696         (DEBUG_ALL): Add DEBUG_RELAXATION.
11697         (debug_string_to_enum): Add relaxation debug option.
11698         * layout.cc
11699         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
11700         Layout::Relaxation_debug_check::read_sections,
11701         Layout::Relaxation_debug_check::read_sections): New method definitions.
11702         (Layout::Layout): Initialize data members
11703         record_output_section_data_from_scrips_,
11704         script_output_section_data_list_ and relaxation_debug_check_.
11705         (Layout::save_segments, Layout::restore_segments,
11706         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
11707         Layout::relaxation_loop_body): New method definitions.
11708         (Layout::finalize): Support relaxation.  Move section layout code to
11709         Layout::relaxation_loop_body.
11710         (Layout::set_asection_address_from_script): Move code for orphan
11711         section placement out.
11712         (Layout::place_orphan_sections_in_script): New method definition.
11713         * layout.h (Output_segment_headers, Output_file_header):
11714         New forward class declarations.
11715         (Layout::~Layout): Define.
11716         (Layout::new_output_section_data_from_script): New method definition.
11717         (Layout::place_orphan_sections_in_script): New method declaration.
11718         (Layout::Segment_states): New type declaration.
11719         (Layout::save_segments, Layout::restore_segments,
11720         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
11721         Layout::relaxation_loop_body): New method declarations.
11722         (Layout::Output_section_data_list): New type declaration.
11723         (Layout::Relaxation_debug_check): New class definition.
11724         (Layout::record_output_section_data_from_script_,
11725         Layout::script_output_section_data_list_, Layout::segment_states_,
11726         Layout::relaxation_debug_check_): New data members.
11727         * output.cc: (Output_section_headers::do_size): New method definition.
11728         (Output_section_headers::Output_section_headers): Move size
11729         computation to Output_section_headers::do_size.
11730         (Output_segment_headers::do_size): New method definition.
11731         (Output_file_header::Output_file_header): Move size computation to
11732         Output_file_header::do_size and call it.
11733         (Output_file_header::do_size): New method definition.
11734         (Output_data_group::Output_data_group): Adjust call to
11735         Output_section_data.
11736         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
11737         (Output_symtab_xindex::do_write): Add array bound check.
11738         (Output_section::Input_section::print_to_mapfile): Handle
11739         RELAXED_INPUT_SECTION_CODE.
11740         (Output_section::Output_section): Initialize data member checkpoint_.
11741         (Output_section::~Output_section): Delete checkpoint object pointed
11742         by checkpoint_.
11743         (Output_section::add_input_section): Always add an Input_section if
11744         relaxing.
11745         (Output_section::add_merge_input_section): Add assert.
11746         (Output_section::relax_input_section): New method definition.
11747         (Output_section::set_final_data_size): Set load address to zero for
11748         an unallocated section.
11749         (Output_section::do_address_and_file_offset_have_reset_values):
11750         New method definition.
11751         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
11752         Handle relaxed input section.
11753         (Output_section::sort_attached_input_sections): Checkpoint input
11754         section list lazily.
11755         (Output_section::get_input_sections): Change type of input_sections to
11756         list of Simple_input_section pointers.  Checkpoint input section list
11757         lazily.  Also handle relaxed input sections.
11758         (Output_section::add_input_section_for_script): Take a reference to
11759         a Simple_input_section object instead of Relobj pointer and section
11760         index as parameter.  Handle relaxed input sections.
11761         (Output_section::save_states, Output_section::restore_states): New
11762         method definitions.
11763         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
11764         (Output_data::is_data_size_fixed): New method definition.
11765         (Output_data::reset_addresss_and_file_offset): Do not reset data size
11766         if it is fixed.
11767         (Output_data::address_and_file_offset_have_reset_values): New method
11768         definition.
11769         (Output_data::do_address_and_file_offset_have_reset_values): New method
11770         definition.
11771         (Output_data::set_data_size): Check that data size is not fixed.
11772         (Output_data::fix_data_size): New method definition.
11773         (Output_data::is_data_size_fixed_): New data member.
11774         (Output_section_headers::set_final_data_size): New method definition.
11775         (Output_section_headers::do_size): New method declaration.
11776         (Output_segment_headers::set_final_data_size): New method definition.
11777         (Output_segment_headers::do_size): New method declaration.
11778         (Output_file_header::set_final_data_size)::New method definition.
11779         (Output_file_header::do_size)::New method declaration.
11780         (Output_section_data::Output_section_data): Add new parameter
11781         is_data_size_fixed and use it to fix data size.
11782         (Output_data_const::Output_data_const): Adjust call to base class
11783         constructor and fix data size.
11784         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
11785         base class constructor and fix data size.
11786         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
11787         base class constructor and fix data size.
11788         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
11789         class constructor and fix data size.
11790         (Output_data_group::set_final_data_size): New method definition.
11791         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
11792         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
11793         class constructor and fix data size.
11794         (Output_relaxed_input_section): New class definition.
11795         (Output_section::Simple_input_section): New class definition.
11796         (Output_section::get_input_sections): Adjust parameter list.
11797         (Output_section::add_input_section_for_script): Same.
11798         (Output_section::save_states, Output_section::restore_states,
11799         Output_section::do_address_and_file_offset_have_reset_values,
11800         (Output_section::Input_section::Input_section): Handle
11801         RELAXED_INPUT_SECTION_CODE.  Add new overload for
11802         Output_relaxed_input_section.
11803         (Output_section::Input_section::is_input_section,
11804         Output_section::Input_section::set_output_section): Handle relaxed
11805         input section.
11806         (Output_section::Input_section::is_relaxed_input_section,
11807         Output_section::Input_section::output_section_data,
11808         Output_section::Input_section::relaxed_input_section): New method
11809         definitions.
11810         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
11811         value.
11812         (Output_section::Input_section::u1_): Update comments.
11813         (Output_section::Input_section::u2_): Add new union member poris.
11814         (Output_section::Checkpoint_output_section): New classs definition.
11815         (Output_section::relax_input_section): New method declaration.
11816         (Output_section::checkpoint_): New data member.
11817         (Output_segment): Update comments.
11818         (Output_segment::Output_segment): Un-privatize copy constructor.
11819         (Output_segment::operator=): Un-privatize.
11820         * script-sections.cc (Output_section_element::Input_section_list):
11821         Change element type to Output_section::Simple_input_section.
11822         (Output_section_element_dot_assignment::set_section_addresses):
11823         Register output section data for relaxation clean up.
11824         (Output_data_exression::Output_data_expression): Adjust call to base
11825         constructor to fix data size.
11826         (Output_section_element_data::set_section_addresses): Register
11827         Output_data_expression object for relaxation clean up.
11828         (struct Input_section_info): Replace Relobj pointer and section index
11829         pair with Output_section::Simple_input_section and Convert struct to a
11830         class.
11831         (Input_section_sorter::operator()): Adjust access to
11832         Input_section_info data member to use accessors.
11833         (Output_section_element_input::set_section_addresses): Use layout
11834         parameter.  Adjust code to use Output_section::Simple_input_section
11835         and Input_secction_info classes.  Register filler for relaxation
11836         clean up.
11837         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
11838         and section index pair with Output_section::Simple_input_section
11839         class.  Adjust code accordingly.
11840         (Phdrs_element::release_segment): New method definition.
11841         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
11842         segment list.
11843         (Script_sections::release_segments): New method definition.
11844         * gold/script-sections.h (Script_sections::release_segments): New
11845         method declaration.
11846         * gold/target.h (Target::may_relax, Target::relax,
11847         Target::do_may_relax, Target::do_relax): New method definitions.
11848
11849 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11850
11851         * arm.cc (has_signed_unsigned_overflow): New function.
11852         (Arm_relocate_functions::abs8): New function.
11853         (Target_arm::Scan::local): Handle R_ARM_ABS8.
11854         (Target_arm::Scan::global): Likewise.
11855         (Target_arm::relocate::relocate): Likewise.
11856         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
11857         Likewise.
11858
11859 2009-09-16  Cary Coutant  <ccoutant@google.com>
11860
11861         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
11862         * testsuite/Makefile.in: Regenerate.
11863
11864 2009-09-11  Nick Clifton  <nickc@redhat.com>
11865
11866         * po/gold.pot: Updated by the Translation project.
11867
11868 2009-09-08  Cary Coutant  <ccoutant@google.com>
11869
11870         * output.cc (Output_file::open): Add execute permission to empty file.
11871         * testsuite/Makefile.am (permission_test): New test.
11872         * testsuite/Makefile.in: Regenerate.
11873
11874 2009-09-02  Ian Lance Taylor  <iant@google.com>
11875
11876         * output.cc (Output_file::resize): Call map_no_anonymous rather
11877         than map.
11878
11879 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
11880
11881         * gold.cc: Include "incremental.h".
11882         (queue_initial_tasks): Call Incremental_checker methods.
11883         * incremental.cc: Include "output.h".
11884         (Incremental_checker::can_incrementally_link_output_file): New
11885         method.
11886         * incremental.h (Incremental_checker): New class.
11887
11888         * output.cc (Output_file::open_for_modification): New method.
11889         (Output_file::map_anonymous): Changed return type to bool.  Record
11890         map in base_ field.
11891         (Output_file::map_no_anonymous): New method, broken out of map.
11892         (Output_file::map): Use map_no_anonymous and map_anonymous.
11893         * output.h (class Output_file): Update declarations.
11894
11895 2009-08-24  Cary Coutant  <ccoutant@google.com>
11896
11897         * options.h (Command_line::Pre_options): New class.
11898         (Command_line::pre_options): New member.
11899         * options.cc (gold::options::ready_to_register): New variable.
11900         (One_option::register_option): Do nothing if not registering options.
11901         Assert if same short option registered twice.
11902         (General_options::General_options): Turn off option registration when
11903         done constructing.
11904         (Command_line::Pre_options::Pre_options): New constructor.
11905
11906 2009-08-24  Cary Coutant  <ccoutant@google.com>
11907
11908         * options.h (General_options::no_keep_memory): Remove incorrect
11909         short option.
11910
11911 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
11912
11913         * Makefile.am (am__skiplex, am__skipyacc): New.
11914         * Makefile.in: Regenerate.
11915
11916 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
11917
11918         * Makefile.am (AM_CPPFLAGS): Renamed from ...
11919         (INCLUDES): ... this.
11920         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
11921         (AM_CPPFLAGS): Renamed from ...
11922         (INCLUDE): ... this.
11923         * Makefile.in, testsuite/Makefile.in: Regenerate.
11924
11925         * Makefile.in: Regenerate.
11926         * aclocal.m4: Likewise.
11927         * config.in: Likewise.
11928         * configure: Likewise.
11929         * testsuite/Makefile.in: Likewise.
11930
11931         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
11932         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
11933         * Makefile.in: Regenerate.
11934         * testsuite/Makefile.in: Regenerate.
11935
11936 2009-08-19  Cary Coutant  <ccoutant@google.com>
11937
11938         * resolve.cc (Symbol_table::resolve): Don't complain about defined
11939         symbols in shared libraries overridden by hidden or internal symbols
11940         in the main program.
11941
11942 2009-08-19  Chris Demetriou  <cgd@google.com>
11943
11944         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
11945         checking source file names in error messages.
11946
11947 2009-08-18  Doug Kwan  <dougkwan@google.com>
11948
11949         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
11950         an elcpp::Ehdr as parameter.  Adjust call to set_target.
11951         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
11952         an elfcpp::Ehdr as parameter.
11953         * object.cc (Object::set_target): Remove the version that looks up
11954         a target and sets it.
11955         (Sized_relobj::setup): Take a Target object instead of
11956         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
11957         (make_elf_sized_object): Find target and ask target to
11958         make an ELF object.
11959         * object.h: (Object::set_target): Remove the version that looks up
11960         a target and sets it.
11961         (Sized_relobj::setup): Take a Target object instead of
11962         an elfcpp:Ehdr as parameter.
11963         * target.cc: Include dynobj.h.
11964         (Target::do_make_elf_object_implementation): New.
11965         (Target::do_make_elf_object): New.
11966         * target.h (Target::make_elf_object): New template declaration.
11967         (Target::do_make_elf_object): New method declarations.
11968         (Target::do_make_elf_object_implementation): New template declaration.
11969
11970 2009-08-14  Ian Lance Taylor  <iant@google.com>
11971
11972         * gold.h (FUNCTION_NAME): Define.
11973         (gold_unreachable): Use FUNCTION_NAME.
11974
11975 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
11976
11977         * icf.cc (Icf::find_identical_sections): Issue a warning when a
11978         symbol in the --keep-unique list is not found.
11979
11980 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
11981
11982         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
11983         been maked as --keep-unique.
11984         (Icf::unfold_section): New function.
11985         * icf.h (Icf::unfold_section): New function.
11986         * options.h (General_options::keep_unique): New option.
11987         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
11988         * testsuite/Makefile.in: Regenerate.
11989         * testsuite/icf_keep_unique_test.sh: New file.
11990         * testsuite/icf_keep_unique_test.cc: New file.
11991
11992 2009-08-12  Cary Coutant  <ccoutant@google.com>
11993
11994         PR 10471
11995         * resolve.cc (Symbol_table::resolve): Check for references from
11996         dynamic objects to hidden and internal symbols.
11997         * testsuite/Makefile.am (hidden_test.sh): New test.
11998         * testsuite/Makefile.in: Regenerate.
11999         * testsuite/hidden_test.sh: New script.
12000         * testsuite/hidden_test_1.c: New test source.
12001         * testsuite/hidden_test_main.c: New test source.
12002
12003 2009-08-11  Doug Kwan  <dougkwan@google.com>
12004
12005         * arm.cc: Update comments.
12006         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
12007         segment to locate the .ARM.exidx section if present.
12008
12009 2009-08-09  Doug Kwan  <dougkwan@google.com>
12010
12011         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
12012         patch.
12013
12014 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
12015         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
12016         compiler warnings.
12017
12018 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
12019
12020         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
12021         valid tls_segment only for non-debug-section relocations.
12022         * testsuite/Makefile.am: Add gc_tls_test.
12023         * testsuite/Makefile.in: Regenerate.
12024         * testsuite/gc_tls_test.cc: New file.
12025         * testsuite/gc_tls_test.sh: New file.
12026
12027 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
12028
12029         * icf.cc: New file.
12030         * icf.h: New file.
12031         * Makefile.am (CCFILES): Add icf.cc.
12032         (HFILES): Add icf.h
12033         * Makefile.in: Regenerate.
12034         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
12035         * gc.h (gc_process_relocs): Populate lists used by icf to contain
12036         section, symbol and addend information for the relocs.
12037         * gold.cc (queue_middle_tasks): Call identical code folding.
12038         * gold.h: Add defines for multimap.
12039         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
12040         to the call of finalize_local_symbols.
12041         * main.cc (main): Create object of class Icf.
12042         * object.cc (Sized_relobj::do_layout): Allow this function to be
12043         called twice during icf.
12044         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
12045         to sections marked as identical by icf.
12046         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
12047         when available.
12048         (Sized_relobj::do_section_entsize): New function.
12049         * object.h (Object::section_entsize): New function.
12050         (Object::do_section_entsize): New pure virtual function.
12051         (Relobj::finalize_local_symbols): Add new parameter.
12052         (Relobj::do_section_entsize): New function.
12053         * options.h (General_options::icf): New option.
12054         (General_options::icf_iterations): New option.
12055         (General_options::print_icf_sections): New option.
12056         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
12057         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
12058         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
12059         icf.
12060         * symtab.cc (Symbol_table::is_section_folded): New function.
12061         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
12062         to sections marked as identical by icf.
12063         * symtab.h (Symbol_table::set_icf): New function.
12064         (Symbol_table::icf): New function.
12065         (Symbol_table::is_section_folded): New function.
12066         (Symbol_table::icf_): New data member.
12067         * target-reloc.h (relocate_section): Ignore sections folded by icf.
12068         * testsuite/Makefile.am: Add commands to build icf_test.
12069         * testsuite/Makefile.in: Regenerate.
12070         * testsuite/icf_test.sh: New file.
12071         * testsuite/icf_test.cc: New file.
12072
12073 2009-07-24  Chris Demetriou  <cgd@google.com>
12074
12075         * layout.cc (is_compressible_debug_section): Fix incorrect
12076         comment about compressed section names.
12077
12078 2009-07-20  Ian Lance Taylor  <ian@airs.com>
12079
12080         PR 10419
12081         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
12082
12083 2009-07-16  Ian Lance Taylor  <iant@google.com>
12084
12085         PR 10400
12086         * layout.h: #include <map>.
12087         (class Kept_section): Change from struct to class.  Add accessors
12088         and setters.  Add section size to Comdat_group mapping.  Change
12089         Comdat_group to std::map.  Add is_comdat_ field.  Add
12090         linkonce_size field in union.
12091         (class Layout): Update declaration of find_or_add_kept_section.
12092         Don't declare find_kept_object.
12093         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
12094         parameter.  Add object, shndx, is_comdat, and is_group_name
12095         parameters.  Change all callers.  Adjust for new Kept_section.
12096         (Layout::find_kept_object): Remove.
12097         * object.cc (Sized_relobj::include_section_group): Update use of
12098         Kept_section.  Rename secnum to shndx.  Only record
12099         Kept_comdat_section if sections are the same size.
12100         (Sized_relobj::include_linkonce_section): Update use of
12101         Kept_section.  Only record Kept_comdat_section if sections are the
12102         same size.  Set size of linkonce section.
12103         (Sized_relobj::map_to_kept_section): Update call to
12104         get_kept_comdat_section.
12105         * object.h (class Sized_relobj): Rename fields in
12106         Kept_comdat_section to drop trailing underscores; change object
12107         field to Relobj*.  Change Kept_comdat_section_table to store
12108         struct rather than pointer.
12109         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
12110         Add kept_object and kept_shndx parameters.  Change all callers.
12111         (Sized_relobj::get_kept_comdat_section): Change return type to
12112         bool.  Add kept_object and kept_shndx parameters.  Change all
12113         callers.
12114         * plugin.cc (Pluginobj::include_comdat_group): Update call to
12115         Layout::find_or_add_kept_section.
12116
12117 2009-07-09  Ian Lance Taylor  <iant@google.com>
12118
12119         * merge.cc (Object_merge_map::initialize_input_to_output_map):
12120         Reserve space in the hash table.
12121
12122 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
12123
12124         * fileread.cc (File_read::get_mtime): New method.
12125         * fileread.h (Timespec): New structure.
12126         (File_read::get_mtime): New method.
12127         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
12128         Renamed from timestamp_nsec.
12129         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
12130         Elf_Xword.
12131         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
12132         timestamp_nsec.
12133         (Incremental_inputs::report_archive): Save mtime; style fix.
12134         (Incremental_inputs::report_obejct): Save mtime; style fix.
12135         (Incremental_inputs::report_script): Save mtime; style fix.
12136         (Incremental_inputs::finalize_inputs): Style fix.
12137         (Incremental_inputs::finalize): Style fix.
12138         (Incremental_inputs::create_input_section_data): Store inputs
12139         mtime.
12140         * incremental.h (Incremental_inputs::report_script): Add mtime
12141         argument.
12142         (Incremental_inputs::Input_info::Input_info): Intialize only one
12143         union member.
12144         (Incremental_inputs::Input_info::archive): Move to nameless
12145         union.
12146         (Incremental_inputs::Input_info::obejct): Move to nameless union.
12147         (Incremental_inputs::Input_info::script): Move to nameless union.
12148         (Incremental_inputs::mtime): New field.
12149         * script.cc (read_input_script): Pass file mtime to
12150         Incremental_input.
12151         * script.h (Script_info::inputs): Style fix.
12152
12153 2009-07-01  Ian Lance Taylor  <ian@airs.com>
12154
12155         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
12156         instead of 32.
12157
12158 2009-06-24  Ian Lance Taylor  <iant@google.com>
12159
12160         PR 10156
12161         * layout.cc (Layout::choose_output_section): If we find an
12162         existing section, update the flags.
12163         (Layout::create_notes): New function, broken out of
12164         Layout::finalize.
12165         (Layout::finalize): Don't create note sections.
12166         (Layout::create_note): Don't crash if linker script discards
12167         section.
12168         (Layout::create_gold_note): Likewise.
12169         (Layout::create_build_id): Likewise.  Don't set
12170         after_input_sections on the section.
12171         (Layout::create_executable_stack_info): Remove target parameter.
12172         Change caller.
12173         * layout.h (class Layout): Declare create_notes.  Update
12174         declaration of create_executable_stack_info.
12175         * gold.cc (queue_middle_tasks): Call create_notes.
12176         * output.cc (Output_section::update_flags_for_input_section): Move
12177         here from output.h.  If SHF_ALLOC flag is newly set, mark address
12178         invalid.
12179         * output.h (Output_data::mark_address_invalid): New function.
12180         (class Output_section): Only declare, not define,
12181         update_flags_for_input_section.  Remove set_flags.
12182
12183 2009-06-24  Ian Lance Taylor  <iant@google.com>
12184
12185         * script-sections.cc (Output_section_definition::
12186         set_section_addresses): Rename shadowing local load_address to
12187         laddr.
12188
12189 2009-06-24  Ian Lance Taylor  <iant@google.com>
12190
12191         PR 10244
12192         * reloc.cc (relocate_sections): Skip empty relocation sections.
12193
12194 2009-06-23  Ian Lance Taylor  <iant@google.com>
12195
12196         PR 10156
12197         * layout.cc (Layout::create_note): Use choose_output_section
12198         rather than make_output_section.
12199
12200 2009-06-23  Ian Lance Taylor  <iant@google.com>
12201
12202         PR 10237
12203         * options.cc (General_options::parse_V): Set printed_version_.
12204         (General_options::General_options): Initialize printed_version_.
12205         * options.h (class General_options): Add printed_version_ field.
12206         * gold.cc (queue_initial_tasks): If there are no input files,
12207         don't give a fatal error if we printed the version information.
12208         (queue_middle_tasks): If using -r with a shared object, give a
12209         fatal error rather than an ordinary error.
12210
12211 2009-06-23  Ian Lance Taylor  <iant@google.com>
12212
12213         PR 10219
12214         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
12215         (Layout::make_output_section): Set have_stabstr_section_ if we see
12216         a .stab*str section.
12217         (Layout::finalize): Call link_stabs_sections.
12218         (Layout::link_stabs_sections): New file.
12219         * layout.h (class Layout): Add have_stabstr_section_ field.
12220         Declare link_stabs_sections.
12221
12222 2009-06-23  Doug Kwan  <dougkwan@google.com>
12223
12224         * Makefile.am (libgold_a_LIBADD): New.
12225         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
12226         * Makefile.in: Regenerate.
12227         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
12228         * configure: Regenerate.
12229         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
12230         * fileread.cc: Include sys/state.h
12231         * gold.h: Declare memmem and strndup if found missing.
12232         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
12233
12234 2009-06-23  Ian Lance Taylor  <iant@google.com>
12235
12236         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
12237         * configure: Rebuild.
12238
12239 2009-06-23  Ian Lance Taylor  <iant@google.com>
12240
12241         PR 10147
12242         * object.cc (Object::section_contents): Don't try to get a view if
12243         the section has length zero.
12244         (Object::handle_gnu_warning_section): If the section is empty, use
12245         the name of the section as the warning.
12246
12247 2009-06-23  Ian Lance Taylor  <iant@google.com>
12248
12249         PR 10133
12250         * stringpool.h (class Stringpool_template): Add optimize_ field.
12251         (Stringpool_template::set_optimize): New function.
12252         * stringpool.cc (Stringpool_template::Stringpool_template):
12253         Initialize optimize_ field.
12254         (Stringpool_template::set_string_offsets): Test local optimize
12255         fild rather than parameter.
12256         * layout.cc (Layout::Layout): Call set_optimize on the section
12257         name stringpool.
12258
12259 2009-06-22  Ian Lance Taylor  <iant@google.com>
12260
12261         PR 10030
12262         * yyscript.y: Parse TARGET.
12263         * script.cc (script_set_target): New function.
12264         * script-c.h (script_set_target): Declare.
12265         * options.cc (General_options::string_to_object_format): Rename
12266         from string_to_object_format in anonymous namespace.  Change
12267         callers.
12268         * options.h (class General_options): Declare
12269         string_to_object_format.
12270
12271 2009-06-22  Ian Lance Taylor  <iant@google.com>
12272
12273         * script-sections.cc (Script_sections::create_segments): Don't put
12274         program headers in a PT_LOAD segment if -n or -N.
12275
12276 2009-06-22  Ian Lance Taylor  <iant@google.com>
12277
12278         PR 10141
12279         * options.h (class General_options): Add -z lazy and -z now.  Sort
12280         -z options into alphabetical order.
12281         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
12282
12283 2009-06-21  Ian Lance Taylor  <iant@google.com>
12284
12285         * layout.cc (Layout::make_output_section): Call
12286         Target::new_output_section.
12287         (Layout::attach_allocated_section_to_segment): Put large section
12288         sections in a separate load segment with the large segment flag
12289         set.
12290         (Layout::segment_precedes): Sort large data segments after other
12291         load segments.
12292         (align_file_offset): New static function.
12293         (Layout::set_segment_offsets): Use align_file_offset.
12294         * output.h (class Output_section): Add is_small_section_ and
12295         is_large_section_ fields.
12296         (Output_section::is_small_section): New function.
12297         (Output_section::set_is_small_section):  New function.
12298         (Output_section::is_large_section): New function.
12299         (Output_section::set_is_large_section): New function.
12300         (Output_section::is_large_data_section): New function.
12301         (class Output_segment): Add is_large_data_segment_ field.
12302         (Output_segment::is_large_data_segment): New function.
12303         (Output_segment::set_is_large_data_segment): New function.
12304         * output.cc (Output_section::Output_section): Initialize new
12305         fields.
12306         (Output_segment::Output_segment): Likewise.
12307         (Output_segment::add_output_section): Add assertion that large
12308         data sections always go in large data segments.  Force small data
12309         sections to the end of the list of data sections.  Force small BSS
12310         sections to the start of the list of BSS sections.  For large BSS
12311         sections to the end of the list of BSS sections.
12312         * symtab.h (class Symbol): Declare is_common_shndx.
12313         (Symbol::is_defined): Check Symbol::is_common_shndx.
12314         (Symbol::is_common): Likewise.
12315         (class Symbol_table): Define enum Commons_section_type.  Update
12316         declarations.  Add small_commons_ and large_commons_ fields.
12317         * symtab.cc (Symbol::is_common_shndx): New function.
12318         (Symbol_table::Symbol_table): Initialize new fields.
12319         (Symbol_table::add_from_object): Put small and large common
12320         symbols in the right list.
12321         (Symbol_table::sized_finalized_symbol): Check
12322         Symbol::is_common_shndx.
12323         (Symbol_table::sized_write_globals): Likewise.
12324         * common.cc (Symbol_table::do_allocate_commons): Allocate new
12325         common symbol lists.  Don't call do_allocate_commons_list if the
12326         list is empty.
12327         (Symbol_table::do_allocate_commons_list): Remove is_tls
12328         parameter.  Add comons_section_type parameter.  Change all
12329         callers.  Handle small and large common symbols.
12330         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
12331         Symbol::is_common_shndx.
12332         * resolve.cc (symbol_to_bits): Likewise.
12333         * target.h (Target::small_common_shndx): New function.
12334         (Target::small_common_section_flags): New function.
12335         (Target::large_common_shndx): New function.
12336         (Target::large_common_section_flags): New function.
12337         (Target::new_output_section): New function.
12338         (Target::Target_info): Add small_common_shndx, large_common_shndx,
12339         small_common_section_flags, and large_common_section_flags
12340         fields.
12341         (Target::do_new_output_section): New virtual function.
12342         * arm.cc (Target_arm::arm_info): Initialize new fields.
12343         * i386.cc (Target_i386::i386_info): Likewise.
12344         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
12345         Likewise.
12346         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
12347         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
12348         (Target_x86_64::do_new_output_section): New function.
12349         * configure.ac: Define conditional MCMODEL_MEDIUM.
12350         * testsuite/Makefile.am (check_PROGRAMS): Add large.
12351         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
12352         (large_LDFLAGS): Define.
12353         * testsuite/large.c: New file.
12354         * testsuite/testfile.cc (Target_test::test_target_info):
12355         Initialize new fields.
12356         * configure, testsuite/Makefile.in: Rebuild.
12357
12358 2009-06-05  Doug Kwan  <dougkwan@google.com>
12359
12360         * Makefile.am (CCFILES): Add target.cc.
12361         * Makefile.in: Regenerate.
12362         * i386.cc (class Target_i386): Define new virtual method to
12363         override do_is_local_label_name in parent.
12364         * object.cc (Sized_relobj::do_count_local_symbols): Discard
12365         local symbols if --discard-locals or -X is given.
12366         * options.h (class General_options): Declare new options
12367         '--discard-locals' and '-X' for discarding locals.
12368         * target.h (class Target): Define new methods is_local_label_name.
12369         Declare new virtual method do_is_local_label_name.
12370         * target.cc: New file.
12371         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
12372         (check_SCRIPTS): Add discard_locals_test.sh.
12373         (check_DATA): Add discard_local_tests.syms.
12374         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
12375         (discard_local_tests.syms, discard_locals_test.o): New make rules.
12376         * testsuite/Makefile.in: Regenerate.
12377         * testsuite/discard_locals_test.c: New file.
12378         * testsuite/discard_locals_test.sh: Same.
12379
12380 2009-06-05  Doug Kwan  <dougkwan@google.com>
12381
12382         * object.cc (Sized_relobj::Sized_relobj): Initialize
12383         discarded_eh_frame_shndx_ to -1U.
12384         (Sized_relobj::do_layout): Record index of a discard .eh_frame
12385         section.
12386         (Sized_relobj::do_count_local_symbols): Skip local symbols in
12387         a discarded .eh_frame section.
12388         (Sized_relobj::do_finalize_local_symbols): Ditto.
12389         * object.h (class Sized_relobj): Declare new member
12390         discarded_eh_frame_shndx_.
12391         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
12392         (local_labels_test.o, local_labels_test): New rules.
12393         * testsuite/Makefile.in: Regenerate.
12394
12395 2009-06-04  Doug Kwan  <dougkwan@google.com>
12396
12397         * layout.cc (Layout::section_name_mapping): Add mapping for
12398         special ARM sections.
12399
12400 2009-06-03  Doug Kwan  <dougkwan@google.com>
12401
12402         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
12403         (utils::has_overflow): Same.
12404
12405 2009-06-03  Ian Lance Taylor  <iant@google.com>
12406
12407         * layout.cc (Layout::section_name_mapping): New array, replacing
12408         Layout::linkonce_mapping.
12409         (Layout::section_name_mapping_count): New variable, replacing
12410         Layout::linkonce_mapping_count.
12411         (Layout::linkonce_output_name): Remove.
12412         (Layout::output_section_name): Rewrite.
12413         * layout.h (class Layout): Rename Linkonce_mapping to
12414         Section_name_mapping, linkonce_mapping to section_name_mapping,
12415         linkonce_mapping_count to section_name_mapping_count.  Don't
12416         declare linkonce_output_name.
12417
12418 2009-06-03  Doug Kwan  <dougkwan@google.com>
12419
12420         * gold/arm.cc (namespace utils): New.
12421         (Target_arm::reloc_is_non_pic): Define new method.
12422         (class Arm_relocate_functions): New.
12423         (Target_arm::Relocate::relocate): Handle relocation types used by
12424         Android.
12425
12426 2009-06-03  Ian Lance Taylor  <iant@google.com>
12427
12428         * arm.cc (Target_arm::scan::global): Use || instead of |.
12429
12430 2009-06-02  Doug Kwan  <dougkwan@google.com>
12431
12432         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
12433         issued_non_pic_error_.
12434         (class Target_arm::Scan): Declare new method check_non_pic.
12435         Define new method symbol_needs_plt_entry.
12436         Declare new data member issued_non_pic_error_.
12437         (class Target_arm::Relocate): Declare new method
12438         should_apply_static_reloc.
12439         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
12440         (Target_arm::Scan::check_non_pic): Define new method.
12441         (Target_arm::Scan::local): Handle a small subset of reloc types used
12442         by Android.
12443         (Target_arm::Scan::local): Same.
12444         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
12445
12446 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
12447
12448         * incremental.cc (Incremental_inputs::report_command_line): Filter
12449         out --incremental-* options.
12450
12451 2009-05-29  Doug Kwan  <dougkwan@google.com>
12452
12453         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
12454         template class.
12455         (class Target_arm): Update comment.
12456         (Target_arm::Target_arm): Initialize new data members GOT_,
12457         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
12458         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
12459         and Target_arm::rel_dyn_section.
12460         Declare new_enum Target_arm::Got_type.
12461         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
12462         and DYNBSS_.
12463         Update commments for member do_dynsym_value.
12464         (Target_arm::got_size, Target_arm::plt_section,
12465         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
12466         new methods inside class defintion.
12467         (Target_arm::got_section): Define new method.
12468         (Target_arm::rel_dyn_section): Same.
12469         (Output_data_plt_arm): New template class.
12470         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
12471         (Output_data_plt_arm:do_adjust_output_section): Define new method.
12472         (Output_data_plt_arm::add_entry): Same.
12473         (Output_data_plt_arm::first_plt_entry): Define new
12474         static data member for PLT instruction template.
12475         (Output_data_plt_arm::plt_entry): Same.
12476         (Output_data_plt_arm::do_write): Define new method.
12477         (Target_arm::make_plt_entry): Same.
12478         (Target_arm::do_finalize_sections): Same.
12479         (Target_arm::do_dynsym_value): Same.
12480
12481 2009-05-28  Doug Kwan  <dougkwan@google.com>
12482
12483         * Makefile.am (TARGETSOURCES): Add arm.cc.
12484         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
12485         * Makefile.in: Regenerate.
12486         * arm.cc: New file.
12487         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
12488
12489 2009-05-26  Doug Kwan  <dougkwan@google.com>
12490
12491         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
12492         (General_options::check_excluded_libs): Strip off directories in
12493         archive name before matching like GNU ld does.
12494         * testsuite/Makefile.am (MOSTLYCLEANFILES,
12495         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
12496         (exclude_libs_test_LDFLAGS): Add linker option
12497         -Wl,--exclude-libs,libexclude_libs_test_3
12498         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
12499         an explicit archive without using -l.
12500         (alt/libexclude_libs_test_3.a): New make rule.
12501         * testsuite/Makefile.in: Regenerate.
12502         * testsuite/exclude_libs_test.c : Declare lib3_default().
12503         (main): Call it.
12504         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
12505         * exclude_libs_test_3.c: New file.
12506
12507 2009-05-26  Nick Clifton  <nickc@redhat.com>
12508
12509         * po/id.po: New Indonesian translation.
12510         * po/gold.pot: Updated template file.
12511
12512 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
12513
12514         * testsuite/Makefile.am: Add -ffunction-sections to compile
12515         gc_comdat_test files.  Add -Wl,--gc-sections to build
12516         gc_comdat_test.
12517         * testsuite/Makefile.in: Regenerate.
12518         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
12519
12520 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
12521
12522         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
12523         kept comdat section was garbage collected.
12524         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
12525         * testsuite/Makefile.in: Regenerate.
12526         * testsuite/gc_comdat_test.sh: New file.
12527         * testsuite/gc_comdat_test_1.cc: New file.
12528         * testsuite/gc_comdat_test_2.cc: New file.
12529
12530 2009-05-19  Doug Kwan  <dougkwan@google.com>
12531
12532         * archive.cc (Archive::Archive): Move constructor from archive.h
12533         to here.  Initialize no_export_.
12534         (Archive::get_elf_object_for_member): Set no_export flag of object.
12535         * archive.h (Archive::Archive): Move constructor body to
12536         archive.cc.
12537         (Archive::no_export): New method.
12538         (Archive::no_export_): New field.
12539         * object.h (Object::Object): Initialize no_export_ to false.
12540         (Object::no_export, Object::set_no_export): New methods.
12541         (Object::no_export_): New field.
12542         * options.cc (General_options::parse_exclude_libs): New method.
12543         (General_options::check_excluded_libs) Same.
12544         * options.h (exclude_libs): New option.
12545         (General_options::check_excluded_libs): New method declaration.
12546         (General_options::excluded_libs_): New field.
12547         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
12548         default or protected visibility if an object has no-export flag set.
12549         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
12550         (check_SCRIPTS): Add exclude_libs_test.sh.
12551         (check_DATA): Add exclude_libs_test.syms.
12552         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
12553         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
12554         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
12555         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
12556         (exclude_libs_test.syms, libexclude_libs_test_1.a,
12557         libexclude_libs_test_2.a): New rules.
12558         * testsuite/Makefile.in: Regenerate.
12559         * testsuite/exclude_libs_test.c: New file.
12560         * testsuite/exclude_libs_test.sh: Ditto.
12561         * testsuite/exclude_libs_test_1.c: Ditto.
12562         * testsuite/exclude_libs_test_2.c: Ditto.
12563
12564 2009-05-15  Ian Lance Taylor  <iant@google.com>
12565
12566         * configure.ac: Check for declarations for cases where libiberty.h
12567         checks HAVE_DECL_xxx.
12568         * configure, config.in: Rebuild.
12569
12570 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
12571
12572         * gold.h (Incremental_argument_list): Remove (invalid) forward
12573         declaration.
12574         * incremental.cc (Incremental_inputs::report_achive): New method.
12575         (Incremental_inputs::report_object): New method.
12576         (Incremental_inputs::report_script): New method.
12577         (Incremental_inputs::finalize_inputs): New method.
12578         (Incremental_inputs::finalize): Call finalize_inputs().
12579         (Incremental_inputs::sized_create_incremental_inputs_section_data):
12580         Create inputs entries.
12581         * incremental.h (Incremental_input_type): New enum.
12582         (Incremental_inputs::Incremental_input): Initialize new fields.
12583         (Incremental_inputs::report_inputs): New method.
12584         (Incremental_inputs::report_achive): New method.
12585         (Incremental_inputs::report_object): New method.
12586         (Incremental_inputs::report_script): New method.
12587         (Incremental_inputs::finalize_inputs): New method.
12588         (Incremental_inputs::Input_info): New struct.
12589         (Incremental_inputs::Input_info_map): New typedef.
12590         (Incremental_inputs::lock_): New field.
12591         (Incremental_inputs::Inputs_): New field.
12592         (Incremental_inputs::Inputs_map): New field.
12593         * main.cc (main): Call Incremental_input::report_inputs.
12594         * options.h (Input_argument_list): Typedef moved from
12595         Input_arguments.
12596         (Input_file_group::Files): Remove, use ::Input_argument_list.
12597         (Input_file_group::Input_argument_list): Remove, use
12598         ::Input_argument_list.
12599         * plugin.cc (Plugin_manager::add_input_file): Add error in
12600         incremental build.
12601         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
12602         functions.
12603         * script.cc (read_input_script): Call
12604         Incremental_input::report_script.
12605         * script.h (Script_info): New class.
12606
12607 2009-04-27  Ian Lance Taylor  <iant@google.com>
12608
12609         * x86_64.cc (do_adjust_output_section): Set entsize to
12610         plt_entry_size.
12611
12612 2009-04-23  Elliott Hughes  <enh@google.com>
12613
12614         * output.cc (Output_file::close): After short writes, continue
12615         writing from the correct offset in the buffer being written.
12616
12617 2009-04-23  Chris Demetriou  <cgd@google.com>
12618
12619         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
12620         * configure: Regenerate.
12621         * config.in: Regenerate.
12622         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
12623         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
12624
12625 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
12626
12627         * incremental.cc (Incremental_inputs_header_data): Renamed from
12628         Incremental_input_header_data.
12629         (Incremental_inputs_header_data::data_size): New field.
12630         (Incremental_inputs_header_data::put_input_file_count): Renamed
12631         from input_file_count.
12632         (Incremental_inputs_header_data::put_command_line_offset): Renamed
12633         from command_line_offset.
12634         (Incremental_inputs_header_data::put_reserved): Renamed from
12635         put_reserved.
12636         (Incremental_inputs_entry_data): Renamed from
12637         Incremental_input_entry_data.
12638         (Incremental_inputs_entry_data::data_size): New field.
12639         (Incremental_inputs::report_command_line): New method.
12640         (Incremental_inputs::finalize): New method.
12641         (Incremental_inputs::create_incremental_inputs_data): New method.
12642         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
12643         * incremental.h: New file.
12644         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
12645         (Layout::finalize): Create incremental inputs section in
12646         incremental builds.
12647         (Layout::create_incremental_info_sections): New method.
12648         * layout.h (Layout::incremental_inputs): New method.
12649         (Layout::create_incremental_info_sections): New method.
12650         (Layout::incremental_inputs_): New field.
12651         * main.cc (main): Notify Incremental_input of the command line.
12652
12653 2009-04-01  Ian Lance Taylor  <iant@google.com>
12654             Mikolaj Zalewski  <mikolajz@google.com>
12655
12656         * gold.h (reserve_unordered_map): Define, three versions, one for
12657         each version of Unordered_map.
12658         * layout.cc (Layout::Layout): Remove options parameter.  Add
12659         number_of_input_files parameter.  Don't initialize options_.
12660         Initialize number_of_input_files_ and resized_signatures_.  Move
12661         sections_are_attached_.
12662         (Layout::layout_group): Reserve space for group_signatures_.
12663         (Layout::find_or_add_kept_section): Change name parameter to be a
12664         reference.  Resize signatures_ map when it gets large enough.
12665         (Layout::layout_eh_frame): Use parameters->options() instead of
12666         this->options_.
12667         (Layout::make_output_section): Likewise.
12668         (Layout::attach_allocated_section_to_segment): Likewise.
12669         (Layout::finalize, Layout::create_executable_stack): Likewise.
12670         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
12671         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
12672         * layout.h (class Layout): Update declarations.  Remove options_
12673         field.  Add number_of_input_files_ and resized_signatures_
12674         fields.  Move sections_are_attached_ field.
12675         * main.cc (main): Pass number of input files to Layout
12676         constructor.  Don't pass options.
12677
12678 2009-03-30  Ian Lance Taylor  <iant@google.com>
12679
12680         * ffsll.c (ffsll): Correct implementation.
12681
12682 2009-03-27  Ian Lance Taylor  <iant@google.com>
12683
12684         * ffsll.c: New file.
12685         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
12686         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
12687         * ftruncate.c (ftruncate): Declare before definition.
12688         * mremap.c (mremap): Likewise.
12689         * pread.c (pread): Likewise.
12690         * configure, Makefile.in, config.in: Rebuild.
12691
12692         * mremap.c: New file.
12693         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
12694         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
12695         (mremap): Declare if HAVE_MREMAP is not defined.
12696         * configure, Makefile.in, config.in: Rebuild.
12697
12698 2009-03-27  Cary Coutant  <ccoutant@google.com>
12699
12700         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
12701         position independent.
12702         * sparc.cc (Target_sparc::check_non_pic): Likewise.
12703         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
12704
12705 2009-03-24  Cary Coutant  <ccoutant@google.com>
12706
12707         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
12708         an executable.
12709         (needs_dynamic_reloc): Likewise.
12710
12711 2009-03-24  Ian Lance Taylor  <iant@google.com>
12712
12713         * yyscript.y (file_cmd): Recognize EXTERN.
12714         (extern_name_list, extern_name_list_body): New nonterminals.
12715         * script.cc (script_add_extern): Define.
12716         * script-c.h (script_add_extern): Declare.
12717
12718 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
12719
12720         * object.cc (is_elf_object): Define.
12721         * object.h (is_elf_object): Declare.
12722         * archive.cc (Archive::get_elf_object_for_member): Call
12723         is_elf_object.
12724         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
12725
12726 2009-03-24  Elliott Hughes  <enh@google.com>
12727
12728         * output.cc (Output_file::map_anonymous): Define.
12729         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
12730         try an anonymous one.  Report the size if the mmap fails.
12731         * output.h (class Output_file): Declare map_anonymous.
12732
12733 2009-03-24  Ian Lance Taylor  <iant@google.com>
12734
12735         * target-select.cc (instantiate_target): Don't acquire the lock if
12736         the instantiated_target_ field has already been set.
12737
12738 2009-03-23  Ian Lance Taylor  <iant@google.com>
12739
12740         * gold-threads.h (class Initialize_lock): Define.
12741         * gold-threads.cc (class Initialize_lock_once): Define.
12742         (initialize_lock_control): New static variable.
12743         (initialize_lock_pointer): New static variable.
12744         (initialize_lock_once): New static function.
12745         (Initialize_lock::Initialize_lock): Define.
12746         (Initialize_lock::initialize): Define.
12747         * target-select.h: Include "gold-threads.h".
12748         (class Target_selector): Add lock_ and initialize_lock_ fields.
12749         Don't define instantiate_target, just declare it.
12750         * target-select.cc (Target_selector::Target_selector): Initialize
12751         new fields.
12752         (Target_selector::instantiate_target): Define.
12753         * descriptors.h: Include "gold-threads.h".
12754         (class Descriptors): Add initialize_lock_ field.
12755         * descriptors.cc (Descriptors::Descriptors): Initialize new
12756         field.
12757         (Descriptors::open): Use initialize_lock_ field
12758         * errors.h (class Errors): Add initialize_lock_ field.
12759         * errors.cc (Errors::Errors): Initialize new field.
12760         (Errors::initialize_lock): Use initialize_lock_ field.
12761         * powerpc.cc (class Target_selector_powerpc): Remove
12762         instantiated_target_ field.  In do_recognize call
12763         instantiate_target rather than do_instantiate_target.  In
12764         do_instantiate_target just allocate a new target.
12765         * sparc.cc (class Target_selector_sparc): Likewise.
12766
12767         * freebsd.h: New file.
12768         * i386.cc: Include "freebsd.h".
12769         (Target_i386): Derive from Target_freebsd rather than
12770         Sized_target.
12771         (Target_selector_i386): Derive from Target_selector_freebsd rather
12772         than Target_selector.
12773         * x86_64.cc: Include "freebsd.h".
12774         (Target_x86_64): Derive from Target_freebsd rather than
12775         Sized_target.
12776         (Target_selector_x86_64): Derive from Target_selector_freebsd
12777         rather than Target_selector.
12778         * target.h (class Target): Add adjust_elf_header and
12779         do_adjust_elf_header.
12780         * output.cc (Output_file_header:: do_sized_write): Call target
12781         adjust_elf_header routine.
12782         * configure.tgt: Set targ_osabi.
12783         * configure.ac: Define GOLD_DEFAULT_OSABI.
12784         * parameters.cc (Parameters::default_target): Pass
12785         GOLD_DEFAULT_OSABI to select_target.
12786         * target-select.h (class Target_selector): Make instantiate_target
12787         protected rather than private.
12788         * Makefile.am (HFILES): Add freebsd.h.
12789         * configure, Makefile.in, config.in: Rebuild.
12790
12791         * merge.cc (do_add_input_section): Correct pend value.  Change
12792         message about last entry not being null terminated from error to
12793         warning.
12794
12795 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
12796
12797         * incremental.cc: New file.
12798         * Makefile.am (CCFILES): Add incremental.cc.
12799         * Makefile.in: Rebuild.
12800
12801 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
12802
12803         * layout.cc (Layout::output_section_name): Preserve names
12804         of '.note.' sections.
12805
12806 2009-03-19  Ian Lance Taylor  <iant@google.com>
12807
12808         * descriptors.cc (Descriptors::open): Check that the options are
12809         valid before using them.
12810
12811 2009-03-18  Ian Lance Taylor  <iant@google.com>
12812
12813         * script-sections.h: Include <list>.
12814         (class Script_sections): Change Sections_elements from std::vector
12815         to std::list.  Typedef public Elements_iterator.  Add
12816         orphan_section_placement_, data_segment_align_start_, and
12817         saw_data_segment_align_ fields.  Remove data_segment_align_index_
12818         field.
12819         * script-sections.cc (class Orphan_section_placement): New class.
12820         (class Sections_element): Add virtual functions is_relro and
12821         orphan_section_init.  Remove virtual function place_orphan_here.
12822         (class Output_section_definition): Add is_relro and
12823         orphan_section_init.  Remove place_orphan_here.
12824         (class Orphan_output_section): Likewise.
12825         (Script_sections::Script_sections): Update for field changes.
12826         (Script_sections::data_segment_align): Set saw_data_segment_align_
12827         and data_segment_align_start_, not data_segment_align_index.
12828         (Script_sections::data_segment_relro_end): Check
12829         saw_data_segment_align_.  Use data_segment_align_start_ rather
12830         than data_segment_align_index_.
12831         (Script_sections::place_orphan): Rewrite to use
12832         Orphan_section_placement.
12833
12834 2009-03-17  Ian Lance Taylor  <iant@google.com>
12835
12836         * archive.cc (Archive::add_symbols): Check for a version attached
12837         to the symbol name in the archive map.
12838         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
12839         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
12840         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
12841         (ver_test_11.a): New target.
12842         * testsuite/Makefile.in: Rebuild.
12843
12844         * configure.ac: Check for chsize and posix_fallocate.  Replace
12845         ftruncate.
12846         * ftruncate.c: New file, from gnulib.
12847         * output.cc (posix_fallocate): Define dummy version if not
12848         HAVE_POSIX_FALLOCATE.
12849         (Output_file::map): Call posix_fallocate rather than lseek and
12850         write.
12851         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
12852         * configure, Makefile.in, config.in: Rebuild.
12853
12854 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
12855
12856         * layout.h (Layout::create_note): Add section_name parameter.
12857         * layout.cc (Layout::create_note): Likewise.
12858         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
12859
12860 2009-03-17  Ian Lance Taylor  <iant@google.com>
12861
12862         * descriptors.cc: Include "options.h".
12863         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
12864         (Descriptors::open): Always use O_CLOEXEC when opening a new
12865         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
12866         then set FD_CLOEXEC.
12867
12868         * sparc.cc (class Target_sparc): Add has_got_section.
12869         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
12870         make sure we have a GOT section.
12871
12872         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
12873         (Target_sparc::Scan::local): Likewise.
12874         (Target_sparc::Scan::global): Likewise.
12875         (Target_sparc::Relocate::relocate): Likewise.
12876         (Target_sparc::Relocate::relocate_tls): Likewise.
12877
12878         * symtab.cc (Symbol_table::define_default_version): New function,
12879         broken out of add_from_object.
12880         (Symbol_table::add_from_object): Call define_default_version.
12881         (Symbol_table::define_special_symbol): Add resolve_oldsym
12882         parameter.  Change all callers.  If the version for a symbol comes
12883         from a version script, resolve it with the symbol with the same
12884         name with no version.  Also add the symbol without a version if
12885         appropriate.
12886         (do_define_in_output_data): If resolving with oldsym, don't delete
12887         sym.
12888         (do_define_in_output_segment): Likewise.
12889         (do_define_as_constant): Likewise.
12890         * symtab.h (class Symbol_table): Update declarations.
12891
12892 2009-03-13  Ian Lance Taylor  <iant@google.com>
12893
12894         * readsyms.cc (Read_symbols::incompatible_warning): New function.
12895         (Read_symbols::requeue): New function.
12896         (Read_symbols::do_read_symbols): If make_elf_object fails because
12897         the target type is not configured, and the file was searched for,
12898         issue a warning and retry with the next directory.
12899         (Add_symbols::run): If the file has an incompatible format, and
12900         it was searched for, requeue the Read_symbols task.  On error,
12901         release the object.
12902         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
12903         dirindex parameter to constructor.  Change all callers.  Declare
12904         incompatible_warning and requeue.
12905         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
12906         input_argument_ and input_group_ fields.  Add them to
12907         constructor.  Change all callers.
12908         (class Read_script): Add dirindex_ field.  Add it to constructor.
12909         Change all callers.
12910         * archive.cc (Archive::setup): Remove input_objects parameter.
12911         Change all callers.
12912         (Archive::get_file_and_offset): Likewise.
12913         (Archive::read_all_symbols): Likewise.
12914         (Archive::read_symbols): Likewise.
12915         (Archive::get_elf_object_for_member): Remove input_objects
12916         parameter.  Add punconfigured parameter.  Change all callers.
12917         (Archive::add_symbols): Change return type to bool.  Check return
12918         value of include_member.
12919         (Archive::include_all_members): Likewise.
12920         (Archive::include_member): Change return type to bool.  Return
12921         false if first included object has incompatible target.  Set
12922         included_member_ field.
12923         (Add_archive_symbols::run): If add_symbols returns false, requeue
12924         Read_symbols task.
12925         * archive.h (class Archive): Add included_member_ field.
12926         Initialize it in constructor.  Add input_file and searched_for
12927         methods.  Update declarations.
12928         (class Add_archive_symbols): Add dirpath_, dirindex_, and
12929         input_argument_ fields.  Add them to constructor.  Change all
12930         callers.
12931         * script.cc: Include "target-select.h".
12932         (class Parser_closure): Add skip_on_incompatible_target_ and
12933         found_incompatible_target_ fields.  Add
12934         skip_on_incompatible_target parameter to constructor.  Change all
12935         callers.  Add methods skip_on_incompatible_target,
12936         clear_skip_on_incompatible_target, found_incompatible_target, and
12937         set_found_incompatible_target.
12938         (read_input_script): Add dirindex parameter.  Change all callers.
12939         If parser finds an incompatible target, requeue Read_symbols
12940         task.
12941         (script_set_symbol): Clear skip_on_incompatible_target in
12942         closure.
12943         (script_add_assertion, script_parse_option): Likewise.
12944         (script_start_sections, script_add_phdr): Likewise.
12945         (script_check_output_format): New function.
12946         * script.h (read_input_script): Update declaration.
12947         * script-c.h (script_check_output_format): Declare.
12948         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
12949         (ignore_cmd): Remove OUTPUT_FORMAT.
12950         * fileread.cc (Input_file::Input_file): Add explicit this.
12951         (Input_file::will_search_for): New function.
12952         (Input_file::open): Add pindex parameter.  Change all callers.
12953         * fileread.h (class Input_file): Add input_file_argument method.
12954         Declare will_search_for.  Update declarations.
12955         * object.cc (make_elf_object): Add punconfigured parameter.
12956         Change all callers.
12957         * object.h (class Object): Make input_file public.  Add
12958         searched_for method.
12959         (make_elf_object): Update declaration.
12960         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
12961         restart search.
12962         * dirsearch.h (class Dirsearch): Update declaration.
12963         * options.h (class General_options): Add --warn-search-mismatch.
12964         * parameters.cc (Parameters::is_compatible_target): New function.
12965         * parameters.h (class Parameters): Declare is_compatible_target.
12966         * workqueue.cc (Workqueue::add_blocker): New function.
12967         * workqueue.h (class Workqueue): Declare add_blocker.
12968
12969         * fileread.cc (Input_file::open): Remove options parameter.
12970         Change all callers.
12971         (Input_file::open_binary): Likewise.
12972         * script.cc (read_input_script): Likewise.
12973         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
12974         options parameter from constructor.  Change all callers.
12975         (class Read_script): Likewise.
12976         * fileread.h (class Input_file): Update declarations.
12977         * script.h (read_input_script): Update declaration.
12978
12979 2009-03-10  Nick Clifton  <nickc@redhat.com>
12980
12981         * po/es.po: New Spanish translation.
12982
12983 2009-03-06  Cary Coutant  <ccoutant@google.com>
12984
12985         * options.cc (parse_short_option): Keep dash_z from registering itself.
12986
12987 2009-03-03  Ian Lance Taylor  <iant@google.com>
12988
12989         PR 9918
12990         * target-reloc.h (relocate_section): Pass output_section to
12991         relocate.
12992         * i386.cc (Target_i386::should_apply_static_reloc): Add
12993         output_section parameter.  Change all callers.
12994         (Target_i386::Relocate::relocate): Add output_section parameter.
12995         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
12996         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
12997         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
12998         * testsuite/two_file_shared.sh: New script.
12999         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
13000         (check_DATA): Add two_file_shared.dbg.
13001         (two_file_shared.dbg): New target.
13002         * testsuite/Makefile.in: Rebuild.
13003
13004 2009-03-01  Ian Lance Taylor  <iant@google.com>
13005
13006         * configure.ac: Check for byteswap.h.
13007         * configure: Rebuild.
13008         * config.in: Rebuild.
13009
13010 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
13011
13012         * layout.cc (Layout::find_or_add_kept_section): New function.
13013         (Layout::add_comdat): Removed.
13014         * layout.h (struct Kept_section): Move out of class Layout.
13015         Remove trailing underscores from field names.  Add group_sections
13016         field.  Rename group_ field to is_group.  Change all uses.
13017         (class Layout): Declare find_or_add_kept_section, not add_comdat.
13018         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
13019         comdat_groups_ field.
13020         (Sized_relobj::include_section_group): Use
13021         find_or_add_kept_section and Kept_section::group_sections.
13022         (Sized_relobj::include_linkonce_section): Likewise.
13023         * object.cc (class Sized_relobj): Don't define Comdat_group or
13024         Comdat_group_table.  Remove find_comdat_group and
13025         add_comdat_group.  Remove comdat_groups_ field.
13026         * plugin.cc (include_comdat_group): Use
13027         Layout::find_or_add_kept_section.
13028
13029 2009-02-28  Ian Lance Taylor  <iant@google.com>
13030
13031         * README: --gc-sections and map files are now supported.  Document
13032         some build requirements.
13033
13034         PR 6992
13035         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
13036         relocatable link set the value of the section symbol to zero.
13037         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
13038         relocatable link don't include the section address in the local
13039         symbol value.
13040
13041 2009-02-27  Ian Lance Taylor  <iant@google.com>
13042
13043         PR 6811
13044         * options.h (class Search_directory): Add is_system_directory.
13045         (class General_options): Declare is_in_system_directory.
13046         * options.cc (get_relative_sysroot): Make static.
13047         (get_default_sysroot): Make static.
13048         (General_optoins::is_in_system_directory): New function.
13049         * fileread.cc (Input_file::is_in_system_directory): New function.
13050         * fileread.h (class Input_file): Declare is_in_system_directory.
13051         * object.h (class Object): Add is_in_system_directory.
13052         (class Input_objects): Remove system_library_directory_ field.
13053         * object.cc (Input_objects::add_object): Don't set
13054         system_library_directory_.
13055         (input_objects::found_in_system_library_directory): Remove.
13056         * symtab.cc (Symbol_table::write_globals): Remove input_objects
13057         parameter.  Change all callers.
13058         (Symbol_table::sized_write_globals): Likewise.
13059         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
13060         Call Object::is_in_system_directory.
13061         * symtab.h (class Symbol_table): Update declarations.
13062
13063         PR 5990
13064         * descriptors.h (Open_descriptor): Add is_on_stack field.
13065         * descriptors.cc (Descriptors::open): If the descriptor is on the
13066         top of the stack, remove it.  Initialize is_on_stack field.
13067         (Descriptors::release): Only add pod to stack if it is not on the
13068         stack already.
13069         (Descriptors::close_some_descriptor): Clear stack_next and
13070         is_on_stack fields.
13071
13072         PR 7091
13073         * output.cc (Output_section::find_starting_output_address): Rename
13074         from starting_output_address; add PADDR parameter; change return
13075         type.
13076         * output.h (class Output_section): Declare
13077         find_starting_output_address instead of starting_output_address.
13078         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
13079         section symbol for which we can't find a merge section.
13080
13081         PR 9836
13082         * symtab.cc (Symbol_table::add_from_object): If the visibility is
13083         hidden or internal, force the symbol to be local.
13084         * resolve.cc (Symbol::override_visibility): Define.
13085         (Symbol::override_base): Use override_visibility.
13086         (Symbol_table::resolve): Likewise.
13087         (Symbol::override_base_with_special): Likewise.
13088         (Symbol_table::override_with_special): If the visibility is hidden
13089         or internal, force the symbol to be local.
13090         * symtab.h (class Symbol): Add set_visibility and
13091         override_visibility.
13092         * testsuite/ver_test_1.sh: New file.
13093         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
13094         (check_DATA): Add ver_test_1.syms.
13095         (ver_test_1.syms): New target.
13096         * testsuite/Makefile.in: Rebuild.
13097
13098 2009-02-25  Cary Coutant  <ccoutant@google.com>
13099
13100         * layout.cc (Layout::choose_output_section): Don't rename sections
13101         when using a linker script that has a SECTIONS clause.
13102         * Makefile.in: Regenerate.
13103
13104         * testsuite/Makefile.am (script_test_5.sh): New test case.
13105         * testsuite/Makefile.in: Regenerate.
13106         * testsuite/script_test_5.cc: New file.
13107         * testsuite/script_test_5.sh: New file.
13108         * testsuite/script_test_5.t: New file.
13109
13110 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
13111
13112         * archive.cc (Archive::include_member): Update calls to add_symbols.
13113         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
13114         the Layout argument.
13115         * dynobj.h (do_add_symbols): Add the Layout argument.
13116         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
13117         Layout argument.
13118         * object.h (Object::add_symbols): Add the Layout argument.
13119         (Object::do_add_symbols): Add the Layout argument.
13120         (Sized_relobj::do_add_symbols): Add the Layout argument.
13121         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
13122         Unify the two versions.
13123         (Add_plugin_symbols): Remove.
13124         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
13125         (Sized_pluginobj::do_add_symbols): Unify the two versions.
13126         (Add_plugin_symbols): Remove.
13127         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
13128         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
13129         (Add_symbols::run): Make it work with Pulginobj.
13130
13131 2009-02-06  Ian Lance Taylor  <iant@google.com>
13132
13133         * object.cc (Sized_relobj::do_layout): Make info message start
13134         with lower case letter.
13135
13136 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
13137
13138         * binary.cc: Fix file comment.
13139
13140         * options.h (enum Incremental_disposition): Define.
13141         (class General_options): Add new options: --incremental,
13142         --incremental_changed, --incremental_unchanged,
13143         --incremental_unknown.  Add incremental_disposition_ and
13144         implicit_incremental_ fields.
13145         (General_options::incremental_disposition): New function.
13146         (class Position_dependent_options): Add incremental_disposition
13147         option.
13148         (Position_dependent_options::copy_from_options): Set incremental
13149         dispositions.
13150         * options.cc (General_options::parse_incremental_changed): New
13151         function.
13152         (General_options::parse_incremental_unchanged): New function.
13153         (General_options::parse_incremental_unknown): New function.
13154         (General_options::General_options): Initialize new fields
13155         incremental_disposition_ and implicit_incremental_.
13156         (General_options::finalize): Check for uasge of --incremental-*
13157         without --incremental.
13158
13159 2009-02-06  Chris Demetriou  <cgd@google.com>
13160
13161         * gold.h (gold_undefined_symbol): Change to take only a Symbol
13162         pointer and to report location as the file name associated with
13163         the symbol.
13164         (gold_undefined_symbol_at_location): New function to replace the
13165         old gold_undefined_symbol functionality.
13166         * target-reloc.h (relocate_section): Update to use
13167         gold_undefined_symbol_at_location.
13168         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
13169         Call gold_undefined_symbol function rather than gold_error.
13170         * errors.h (Errors::undefined_symbol): Take location as a
13171         string, rather than calculating it from a relocation.
13172         * errors.cc (Errors::fatal): Print "fatal error:" before the
13173         formatted message.
13174         (Errors::error, Errors::error_at_location): Print "error: "
13175         before the formatted message.
13176         (Errors::undefined_symbol): Take location as a string, rather
13177         than calculating it from a relocation.
13178         (gold_undefined_symbol_at_location): New function akin to
13179         old gold_undefined_symbol, calculates location from relocation.
13180         (gold_undefined_symbol): Change to take only a Symbol pointer
13181         and to report location as the file name associated with the symbol.
13182         * testsuite/debug_msg.sh: Update for changed error messages.
13183         * testsuite/undef_symbol.sh: Likewise.
13184
13185 2009-02-04  Duncan Sands  <baldrick@free.fr>
13186
13187         PR 9812
13188         * reduced_debug_output.h
13189         (Output_reduced_debug_abbrev_section::failed): Use format for
13190         gold_warning.
13191         (Output_reduced_debug_info_section::faild): Likewise.
13192
13193 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
13194
13195         * script.cc (Lazy_demangler): New class.
13196         (Version_script_info::get_symbol_version_helper): Demangle a
13197         symbol only once.
13198
13199 2009-01-29  Cary Coutant  <ccoutant@google.com>
13200
13201         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
13202         to __tls_get_addr.
13203         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
13204
13205 2009-01-28  Ian Lance Taylor  <iant@google.com>
13206
13207         * version.cc (version_string): Bump to 1.9.
13208
13209         * gold.h: Include <cstring> and <stdint.h>.
13210         * version.cc: Include <cstdio>.
13211         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
13212         warning.
13213         * reduced_debug_output.cc (insert_into_vector): Rename from
13214         Insert_into_vector; change all callers.  Use Swap_unaligned to
13215         avoid aliasing issue; remove union since it is unnecessary.
13216
13217 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
13218
13219         * Makefile.am (CCFILES): Add gc.cc.
13220         (HFILES): Add gc.h.
13221         * Makefile.in: Regenerate.
13222         * gold.cc (Gc_runner): New class.
13223         (queue_initial_tasks): Call garbage collection related tasks
13224         when corresponding options are invoked.
13225         (queue_middle_gc_tasks): New function.
13226         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
13227         processed early before laying out sections during garbage collection.
13228         * gold.h (queue_middle_gc_tasks): New function.
13229         (is_prefix_of): Move from "layout.cc".
13230         * i386.cc (Target_i386::gc_process_relocs): New function.
13231         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
13232         * main.cc (main): Create object of class "Garbage_collection".
13233         * object.cc (Relobj::copy_symbols_data): New function.
13234         (Relobj::is_section_name_included): New function.
13235         (Sized_relobj::do_layout): Allow this function to be called twice
13236         during garbage collection and defer layout of section during the
13237         first call.
13238         * object.h (Relobj::get_symbols_data): New function.
13239         (Relobj::is_section_name_included): New function.
13240         (Relobj::copy_symbols_data): New function.
13241         (Relobj::set_symbols_data): New function.
13242         (Relobj::get_relocs_data): New function.
13243         (Relobj::set_relocs_data): New function.
13244         (Relobj::is_output_section_offset_invalid): New pure virtual function.
13245         (Relobj::gc_process_relocs): New function.
13246         (Relobj::do_gc_process_relocs): New pure virtual function.
13247         (Relobj::sd_): New data member.
13248         (Sized_relobj::is_output_section_offset_invalid): New function.
13249         (Sized_relobj::do_gc_process_relocs): New function.
13250         * options.h (General_options::gc_sections): Modify to not be a no-op.
13251         (General_options::print_gc_sections): New option.
13252         * plugin.cc (Plugin_finish::run): Remove function call to
13253         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
13254         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
13255         * reloc.cc (Read_relocs::run): Add task to process relocs and
13256         determine unreferenced sections when doing garbage collection.
13257         (Gc_process_relocs): New class.
13258         (Sized_relobj::do_gc_process_relocs): New function.
13259         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
13260         sections that are garbage collected.
13261         * reloc.h (Gc_process_relocs): New class.
13262         * sparc.cc (Target_sparc::gc_process_relocs): New function.
13263         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
13264         symbols whose corresponding sections are garbage collected.
13265         (Symbol_table::Symbol_table): Add new parameter for the garbage
13266         collection object.
13267         (Symbol_table::gc_mark_undef_symbols): New function.
13268         (Symbol_table::gc_mark_symbol_for_shlib): New function.
13269         (Symbol_table::gc_mark_dyn_syms): New function.
13270         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
13271         as garbage.
13272         (Symbol_table::add_from_object): Likewise.
13273         (Symbol_table::add_from_relobj): When building shared objects, do not
13274         treat externally visible symbols as garbage.
13275         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
13276         table information for static and relocatable links.
13277         * symtab.h (Symbol_table::set_gc): New function.
13278         (Symbol_table::gc): New function.
13279         (Symbol_table::gc_mark_undef_symbols): New function.
13280         (Symbol_table::gc_mark_symbol_for_shlib): New function.
13281         (Symbol_table::gc_mark_dyn_syms): New function.
13282         (Symbol_table::gc_): New data member.
13283         * target.h (Sized_target::gc_process_relocs): New pure virtual
13284         function.
13285         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
13286         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
13287
13288 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
13289
13290         * options.h (General_options::gc_sections): Define as a no-op for now.
13291         (General_options::no_keep_memory): Ditto.
13292         (General_options::Bshareable): Define.
13293         * options.cc (General_options::finalize): Honor -Bshareable.
13294
13295 2009-01-20  Andreas Schwab  <schwab@suse.de>
13296
13297         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
13298         read the value in the contents, since we don't use it.  Use the
13299         template endianness when writing.
13300         (Relocate::relocate): Use it for R_PPC_REL16_HA.
13301
13302 2009-01-19  Andreas Schwab  <schwab@suse.de>
13303
13304         * configure.tgt (powerpc64-*): Fix targ_obj.
13305
13306 2009-01-15  Ian Lance Taylor  <iant@google.com>
13307
13308         * object.cc (Sized_relobj::write_local_symbols): Don't write out
13309         local symbols when stripping all symbols.
13310
13311 2009-01-14  Cary Coutant  <ccoutant@google.com>
13312
13313         * output.cc (Output_reloc): Add explicit instantiations.
13314
13315 2009-01-14  Cary Coutant  <ccoutant@google.com>
13316
13317         * archive.cc (Archive::get_elf_object_for_member): Remove call
13318         to File_read::claim_for_plugin.
13319         * descriptors.cc (Descriptors::open): Remove reference to
13320         is_claimed.
13321         (Descriptors::claim_for_plugin): Remove.
13322         * descriptors.h (Descriptors::claim_for_plugin): Remove.
13323         (Descriptors::is_claimed): Remove.
13324         (claim_descriptor_for_plugin): Remove.
13325         * fileread.cc (File_read::claim_for_plugin): Remove.
13326         * fileread.h (File_read::claim_for_plugin): Remove.
13327         (File_read::descriptor): Reopen descriptor if necessary.
13328         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
13329         (Plugin_manager::all_symbols_read): Add task parameter. Change
13330         all callers.
13331         (Plugin_manager::get_input_file): New function.
13332         (Plugin_manager::release_input_file): New function.
13333         (Pluginobj::Pluginobj): Add filesize parameter and initialize
13334         corresponding data member.
13335         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
13336         and pass to base constructor. Change all callers.
13337         (get_input_file, release_input_file): New functions.
13338         (make_sized_plugin_object): Add filesize parameter. Change all callers.
13339         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
13340         (Plugin_manager::all_symbols_read): Add task parameter.
13341         (Plugin_manager::get_input_file): New function.
13342         (Plugin_manager::release_input_file): New function.
13343         (Plugin_manager::task_): New data member.
13344         (Pluginobj::Pluginobj): Add filesize parameter.
13345         (Pluginobj::filename): New function.
13346         (Pluginobj::descriptor): New function.
13347         (Pluginobj::filesize): New function.
13348         (Pluginobj::filesize_): New data member.
13349         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
13350         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
13351         File_read::claim_for_plugin; use Object::unlock to unlock the file.
13352
13353         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
13354         with archive libraries.
13355         * testsuite/Makefile.in: Regenerate.
13356         * testsuite/plugin_test.c (struct sym_info): New type.
13357         (get_input_file, release_input_file): New static variables.
13358         (onload): Capture new transfer vector entries.
13359         (claim_file_hook): Stop reading at end of file according to filesize.
13360         Factor out parsing of readelf output into separate function.
13361         (all_symbols_read_hook): Exercise get_input_file and release_input_file
13362         APIs and get the source file name from the symbol table.  Convert
13363         source file name to corresponding object file name.  Print info
13364         message when adding new input files.
13365         (parse_readelf_line): New function.
13366         * testsuite/plugin_test_1.sh: Add checks for new info messages.
13367         * testsuite/plugin_test_2.sh: Likewise.
13368         * testsuite/plugin_test_3.sh: Likewise.
13369         * testsuite/plugin_test_4.sh: New test case.
13370
13371 2009-01-07  Ian Lance Taylor  <iant@google.com>
13372
13373         * version.cc (version_string): Bump to 1.8.
13374
13375 2008-12-23  Cary Coutant  <ccoutant@google.com>
13376
13377         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
13378         * plugin.cc (Plugin_manager::finish): Rename as
13379         layout_deferred_objects.  Move cleanup to separate function.
13380         (Plugin_manager::cleanup): New function.
13381         (Plugin_finish::run): Call layout_deferred_objects and cleanup
13382         separately.
13383         * plugin.h (Plugin_manager::finish): Rename as
13384         layout_deferred_objects.
13385         (Plugin_manager::cleanup): New function.
13386         (Plugin_manager::cleanup_done): New field.
13387
13388 2008-12-23  Cary Coutant  <ccoutant@google.com>
13389
13390         * plugin.cc (is_visible_from_outside): New function.
13391         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
13392         so we don't return "IR only" status for exported symbols or -r links.
13393
13394         * testsuite/Makefile.am (plugin_test_3): New test case.
13395         * testsuite/Makefile.in: Regenerate.
13396         * testsuite/plugin_test_3.sh: New file.
13397
13398 2008-12-22  Cary Coutant  <ccoutant@google.com>
13399
13400         * object.cc (Sized_relobj::layout_section): New function.
13401         (Sized_relobj::do_layout): Defer layout of input sections until after
13402         plugin has provided replacement files.
13403         (Sized_relobj::do_layout_deferred_sections): New function.
13404         * object.h (Relobj::set_section_offset): Remove virtual keyword.
13405         (Relobj::layout_deferred_sections): New function.
13406         (Relobj::do_layout_deferred_sections): New function.
13407         (Sized_relobj::do_layout_deferred_sections): New function.
13408         (Sized_relobj::layout_section): New function.
13409         (Sized_relobj::Deferred_layout): New structure.
13410         (Sized_relobj::deferred_layout_): New field.
13411         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
13412         Change all callers.  Layout deferred sections.
13413         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
13414         references.
13415         (Plugin_hook::run): Move code from do_plugin_hook inline.
13416         (Plugin_hook::do_plugin_hook): Remove.
13417         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
13418         (Plugin_manager::finish): Renamed, was cleanup.
13419         (Plugin_manager::should_defer_layout): New function.
13420         (Plugin_manager::add_deferred_layout_object): New function.
13421         (Plugin_manager::Deferred_layout_list): New type.
13422         (Plugin_manager::deferred_layout_objects_): New field.
13423         (Plugin_hook::do_plugin_hook): Remove.
13424
13425 2008-12-17  Ian Lance Taylor  <iant@google.com>
13426
13427         * options.h (class General_options): Add --no case for
13428         --export-dynamic.
13429
13430 2008-12-16  Cary Coutant  <ccoutant@google.com>
13431
13432         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
13433         vector.
13434         (Plugin_manager::claim_file): Create plugin object even if
13435         plugin did not call the add_symbols callback.
13436         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
13437         asking for more symbols than were added.
13438         * testsuite/Makefile.am (plugin_test_1): Add test case with
13439         no global symbols.
13440         (empty.syms): New target.
13441         * testsuite/Makefile.in: Regenerate.
13442         * testsuite/plugin_test.c (claim_file_hook): Add new debug
13443         message. Don't call add_symbols if no globals.
13444         (all_symbols_read_hook): Don't provide replacement for empty
13445         claimed file.
13446
13447 2008-12-12  Ian Lance Taylor  <iant@google.com>
13448
13449         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
13450         r_type == 0 for a local symbol with r_sym == 0.
13451         (scan_relocatable_relocs): Pass r_sym to
13452         local_non_section_strategy.
13453         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
13454         r_sym parameter.
13455
13456         * configure.ac: Update test for TLS descriptors: they are
13457         supported as of glibc 2.9.
13458         * configure: Rebuild.
13459
13460 2008-12-11  Ian Lance Taylor  <iant@google.com>
13461
13462         PR 7091
13463         * target-reloc.h (Default_scan_relocatable_relocs): For each
13464         function, map r_type == 0 to RELOC_DISCARD.
13465
13466 2008-12-10  Cary Coutant  <ccoutant@google.com>
13467
13468         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
13469         object to override a kept COMDAT group from a plugin object.
13470
13471 2008-12-09  Ian Lance Taylor  <iant@google.com>
13472
13473         PR 7088
13474         * yyscript.y (file_cmd): Handle INPUT.
13475
13476         * testsuite/initpri1.c: Change all declarations to be full
13477         prototypes by adding void, to avoid compiler warnings.
13478
13479 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
13480
13481         * options.cc (General_options::parse_plugin_opt): New.
13482         (General_options::add_plugin): The argument now is just the filename.
13483         (General_options::add_plugin_option): New.
13484         * options.h (plugin_opt): New.
13485         (add_plugin): Change argument name.
13486         (add_plugin_option): New.
13487         * plugin.cc (Plugin::load): Don't parse the plugin option.
13488         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
13489         (Plugin::add_option): New.
13490         (Plugin::args_): Change type.
13491         (Plugin::filename_): New.
13492         (Plugin_manager::add_plugin_option): New.
13493         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
13494         * testsuite/Makefile.in: Regenerate.
13495
13496 2008-12-05  Cary Coutant  <ccoutant@google.com>
13497
13498         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
13499         Handle --strip-lto-sections option.
13500         * options.h (strip_lto_sections): New option.
13501
13502 2008-12-01  Cary Coutant  <ccoutant@google.com>
13503
13504         * plugin.cc (ld_plugin_message): Change format parameter to const.
13505         Fix mismatch between new[] and delete.
13506
13507 2008-11-14  Cary Coutant  <ccoutant@google.com>
13508
13509         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
13510         instead of -1U.
13511
13512 2008-11-05  Craig Silverstein  <csilvers@google.com>
13513
13514         * options.cc (General_options::parse_dynamic_list): New function.
13515         * options.h (General_options): New flags dynamic_list,
13516         dynamic_list_data, dynamic_list_cpp_new, and
13517         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
13518         (General_options::in_dynamic_list): New function.
13519         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
13520         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
13521         (Lex::can_continue_name): Likewise.
13522         (yylex): Likewise.
13523         (read_script_file): New parameter script_options.
13524         (read_dynamic_list): New function.
13525         (Script_options::define_dynamic_list): New function.
13526         (dynamic_list_keyword_parsecodes): New variable.
13527         (dynamic_list_keywords): New variable.
13528         * script.h (Script_options::define_dynamic_list): New function
13529         prototype.
13530         (read_dynamic_list): New function prototype.
13531         * symtab.cc (strprefix): New macro.
13532         (Symbol::should_add_dynsym_entry): Support dynamic_list,
13533         dynamic_list_data, dynamic_list_cpp_new, and
13534         dynamic_list_cpp_typeinfo.
13535         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
13536         (dynamic_list_expr): New rule.
13537         (dynamic_list_nodes): Likewise.
13538         (dynamic_list_node): Likewise.
13539         * testsuite/Makefile.am (dynamic_list): New test.
13540         * testsuite/Makefile.in: Regenerated.
13541         * testsuite/dynamic_list.t: New file.
13542         * testsuite/dynamic_list.sh: New file.
13543
13544 2008-11-05  Craig Silverstein  <csilvers@google.com>
13545
13546         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
13547         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
13548         (t11_last): Likewise.
13549         * testsuite/ver_test_6.c (main): Likewise.
13550
13551 2008-10-07  Cary Coutant  <ccoutant@google.com>
13552
13553         * options.c (General_options::finalize): Add check for -static and
13554         -shared.
13555         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
13556         is not empty.
13557
13558 2008-10-02  Cary Coutant  <ccoutant@google.com>
13559
13560         * plugin.cc (make_sized_plugin_object): Fix conditional
13561         compilation to work when not all targets are enabled.
13562
13563 2008-09-29  Cary Coutant  <ccoutant@google.com>
13564
13565         * archive.cc (Archive::get_file_and_offset): Use filename instead
13566         of name to get library path.
13567         (Archive::include_member): Unlock external member of a thin archive.
13568
13569         * testsuite/Makefile.am (TEST_AR): New variable.
13570         (thin_archive_test_1): New test.
13571         (thin_archive_test_2): New test.
13572         * testsuite/Makefile.in: Regenerate.
13573         * testsuite/thin_archive_main.cc: New file.
13574         * testsuite/thin_archive_test_1.cc: New file.
13575         * testsuite/thin_archive_test_2.cc: New file.
13576         * testsuite/thin_archive_test_3.cc: New file.
13577         * testsuite/thin_archive_test_4.cc: New file.
13578
13579 2008-09-29  Cary Coutant  <ccoutant@google.com>
13580
13581         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
13582         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
13583         instead of -1U.
13584         (Sized_relobj::do_finalize_local_symbols): Likewise.
13585         (Sized_relobj::map_to_kept_section): Likewise.
13586         * object.h (Sized_relobj::invalid_address): New constant.
13587         (Sized_relobj::do_output_section_offset): Check for invalid_address
13588         and return -1ULL.
13589         * output.cc (Output_reloc::local_section_offset): Use constant
13590         invalid_address instead of -1U.
13591         (Output_reloc::get_address): Likewise.
13592         (Output_section::output_address): Change -1U to -1ULL.
13593         * output.h (Output_reloc::invalid_address): New constant.
13594         * reloc.cc (Sized_relobj::write_sections): Use constant
13595         invalid_address instead of -1U.
13596         (Sized_relobj::relocate_sections): Likewise.
13597         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
13598         values for merge sections.
13599         * target-reloc.h (relocate_for_relocatable): Use constant
13600         invalid_address instead of -1U.
13601
13602 2008-09-19  Cary Coutant  <ccoutant@google.com>
13603
13604         Add plugin functionality for link-time optimization (LTO).
13605         * configure.ac (plugins): Add --enable-plugins option.
13606         * configure: Regenerate.
13607         * config.in: Regenerate.
13608         * Makefile.am (LIBDL): New variable.
13609         (CCFILES): Add plugin.cc.
13610         (HFILES): Add plugin.h.
13611         (ldadd_var): Add LIBDL.
13612         * Makefile.in: Regenerate.
13613
13614         * archive.cc: Include "plugin.h".
13615         (Archive::setup): Don't preread archive symbols when using a plugin.
13616         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
13617         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
13618         files.
13619         (Archive::include_member): Add symbols from plugin objects.
13620         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
13621         * descriptors.cc (Descriptors::open): Check for file descriptors
13622         abandoned by plugins.
13623         (Descriptors::claim_for_plugin): New function.
13624         * descriptors.h (Descriptors::claim_for_plugin): New function.
13625         (Open_descriptor::is_claimed): New field.
13626         (claim_descriptor_for_plugin): New function.
13627         * fileread.cc (File_read::claim_for_plugin): New function.
13628         * fileread.h (File_read::claim_for_plugin): New function.
13629         (File_read::descriptor): New function.
13630         * gold.cc: Include "plugin.h".
13631         (queue_initial_tasks): Add task to call plugin hooks for generating
13632         new object files.
13633         * main.cc: Include "plugin.h".
13634         (main): Load plugin libraries.
13635         * object.h (Pluginobj): Declare.
13636         (Object::pluginobj): New function.
13637         (Object::do_pluginobj): New function.
13638         (Object::set_target): New function.
13639         * options.cc: Include "plugin.h".
13640         (General_options::parse_plugin): New function.
13641         (General_options::General_options): Initialize plugins_ field.
13642         (General_options::add_plugin): New function.
13643         * options.h (Plugin_manager): Declare.
13644         (General_options): Add --plugin option.
13645         (General_options::has_plugins): New function.
13646         (General_options::plugins): New function.
13647         (General_options::add_plugin): New function.
13648         (General_options::plugins_): New field.
13649         * plugin.cc: New file.
13650         * plugin.h: New file.
13651         * readsyms.cc: Include "plugin.h".
13652         (Read_symbols::do_read_symbols): Check for archive before checking
13653         for ELF file.  Call plugin hooks to claim files.
13654         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
13655         from a real object file; force override when processing replacement
13656         files.
13657         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
13658         (Symbol::init_base_object): Likewise.
13659         (Symbol::init_base_output_data): Likewise.
13660         (Symbol::init_base_output_segment): Likewise.
13661         (Symbol::init_base_constant): Likewise.
13662         (Symbol::init_base_undefined): Likewise.
13663         (Symbol::output_section): Assert that object is not a plugin.
13664         (Symbol_table::add_from_pluginobj): New function.
13665         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
13666         undefined.
13667         (Symbol_table::sized_write_globals): Likewise.
13668         (Symbol_table::add_from_pluginobj): Instantiate template.
13669         * symtab.h (Sized_pluginobj): Declare.
13670         (Symbol::in_real_elf): New function.
13671         (Symbol::set_in_real_elf): New function.
13672         (Symbol::in_real_elf_): New field.
13673         (Symbol_table::add_from_pluginobj): New function.
13674
13675         * testsuite/Makefile.am (AM_CFLAGS): New variable.
13676         (LIBDL): New variable.
13677         (LDADD): Add LIBDL.
13678         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
13679         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
13680         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
13681         (MOSTLYCLEANFILES): Likewise.
13682         * testsuite/Makefile.in: Regenerate.
13683         * testsuite/plugin_test.c: New file.
13684         * testsuite/plugin_test_1.sh: New file.
13685         * testsuite/plugin_test_2.sh: New file.
13686
13687 2008-09-16  Ian Lance Taylor  <iant@google.com>
13688
13689         * target-reloc.h (relocate_section): Check whether a symbol is
13690         defined by the ABI before reporting an undefined symbol error.
13691         * target.h (Target::is_defined_by_abi): Make parameter const.
13692         (Target::do_is_defined_by_abi): Likewise.
13693         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
13694         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
13695         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
13696         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
13697         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
13698         * testsuite/Makefile.in: Rebuild.
13699
13700         * fileread.cc (make_view): Add casts to avoid warning.
13701
13702 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
13703
13704         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
13705         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
13706
13707 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
13708
13709         * options.h (General_options::output_is_executable): New.
13710         (General_options::output_is_pie): New.
13711         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
13712         for shared libraries.
13713         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
13714
13715 2008-09-11  Chris Demetriou  <cgd@google.com>
13716
13717         * options.h (origin): New -z option.
13718         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
13719         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
13720         in DT_FLAGS_1.
13721
13722 2008-09-05  Cary Coutant  <ccoutant@google.com>
13723
13724         * fileread.cc (File_read::make_view): Add check for attempt to map
13725         beyond end of file.
13726
13727 2008-09-05  Cary Coutant  <ccoutant@google.com>
13728
13729         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
13730         explicit instantiations.
13731
13732 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
13733
13734         PR gold/6858
13735         * options.cc (General_options::finalize): Allow undefined symbols
13736         in shlibs if linking -shared.
13737
13738         PR gold/6859
13739         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
13740         symbols as not needing a dynsym entry.
13741
13742 2008-08-20  Craig Silverstein  <csilvers@google.com>
13743
13744         * fileread.cc (File_read::open): Do not lock the file unless it
13745         was successfully opened.
13746
13747 2008-08-14  Cary Coutant  <ccoutant@google.com>
13748
13749         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
13750         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
13751         * testsuite/tls_test.cc (struct int128): 128-bit struct
13752         for testing TLS relocs with non-zero addend.
13753         (v12): New TLS variable.
13754         (t12): New test.
13755         (t_last): Add check for v12.
13756         * testsuite/tls_test.h (t12): New function.
13757         * testsuite/tls_test_main.cc (thread_routine): Call new test.
13758
13759 2008-08-13  Ian Lance Taylor  <iant@google.com>
13760
13761         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
13762         set tls_segment_ or relro_segment_.
13763         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
13764         when appropriate.
13765         * output.h (Output_section::clear_is_relro): New function.
13766         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
13767         sections specially even when output_data_ is empty.
13768         (Output_segment::maximum_alignment): When first section is relro,
13769         only force alignment for PT_LOAD segments.
13770         * script.cc (script_data_segment_align): New function.
13771         (script_data_segment_relro_end): New function.
13772         * script-c.h (script_data_segment_align): Declare.
13773         (script_data_segment_relro_end): Declare.
13774         * script-sections.h (class Script_sections): Declare
13775         data_segment_align and data_segment_relro_end.  Add fields
13776         segment_align_index_ and saw_relro_end_.
13777         * script-sections.cc (class Sections_element): Add set_is_relro
13778         virtual function.  Add new bool* parameter to place_orphan_here.
13779         Add get_output_section virtual function.
13780         (class Output_section_definition): Add set_is_relro.  Add new
13781         bool* parameter to place_orphan_here.  Add get_output_section.
13782         Add is_relro_ field.
13783         (Output_section_definition::Output_section_definition): Initialize
13784         evaluated_address_, evaluated_load_address, evaluated_addralign_,
13785         and is_relro_ fields.
13786         (Output_section_definition::place_orphan_here): Add is_relro
13787         parameter.
13788         (Output_section_definition::set_section_addresses): Set relro for
13789         output section.
13790         (Output_section_definition::alternate_constraint): Likewise.
13791         (class Orphan_output_section): Add new bool* parameter to
13792         place_orphan_here.  Add get_output_section.
13793         (Orphan_output_section::place_orphan_here): Add is_relro
13794         parameter.
13795         (Script_sections::Script_sections): Initialize
13796         data_segment_align_index_ and saw_relro_end_.
13797         (Script_sections::data_segment_align): New function.
13798         (Script_sections::data_segment_relro_end): New function.
13799         (Script_sections::place_orphan): Set or clear is_relro.
13800         (Script_sections::set_section_addresses): Force alignment of first
13801         TLS section.
13802         * yyscript.y (exp): Call script_data_segment_align and
13803         script_data_segment_relro_end.
13804         * testsuite/relro_script_test.t: New file.
13805         * testsuite/relro_test.cc (using_script): Declare.
13806         (t1, t2): Test using_script.
13807         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
13808         (relro_script_test_SOURCES): Define.
13809         (relro_script_test_DEPENDENCIES): Define.
13810         (relro_script_test_LDFLAGS): Define.
13811         (relro_script_test_LDADD): Define.
13812         (relro_script_test.so): New target.
13813         * testsuite/Makefile.in: Rebuild.
13814
13815 2008-08-06  Cary Coutant <ccoutant@google.com>
13816
13817         * archive.cc (Archive::total_archives, Archive::total_members)
13818         (Archive::total_members_loaded): New variables.
13819         (Archive::setup): Add parameter.  Add option to preread
13820         archive symbols.
13821         (Archive::read_armap): Add counter.
13822         (Archive::get_file_and_offset): New function.
13823         (Archive::get_elf_object_for_member): New function.
13824         (Archive::read_all_symbols): New function.
13825         (Archive::read_symbols): New function.
13826         (Archive::add_symbols): Add counters.
13827         (Archive::include_all_members): Use armap to find members if it's
13828         already built.
13829         (Archive::include_member): Skip reading symbols if already read.
13830         Factored code into Archive::get_file_and_offset and
13831         Archive::get_elf_object_for_member.  Changed call to
13832         Mapfile::report_include_archive_member.
13833         (Archive::print_stats): New function.
13834         * archive.h: Declare Object and Read_symbols_data classes.
13835         (Archive::Archive): Add initializers for new members.
13836         (Archive::setup): Add parameter.
13837         (Archive::print_stats): New function.
13838         (Archive::total_archives, Archive::total_members)
13839         (Archive::total_members_loaded): New variables.
13840         (Archive::get_file_and_offset): New function.
13841         (Archive::get_elf_object_for_member): New function.
13842         (Archive::read_all_symbols): New function.
13843         (Archive::read_symbols): New function.
13844         (Archive::Archive_member): New class.
13845         (Archive::members_): New member.
13846         (Archive::num_members_): New member.
13847         * main.cc: Include archive.h.
13848         (main): Call Archive::print_stats.
13849         * mapfile.cc (Mapfile::report_include_archive_member): Delete
13850         archive parameter; member_name is now the fully-decorated name.
13851         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
13852         * options.h: (General_options): Add --preread-archive-symbols option.
13853         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
13854         Archive::setup.
13855
13856 2008-08-04  Ian Lance Taylor  <iant@google.com>
13857
13858         * symtab.h (Symbol::use_plt_offset): New function.
13859         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
13860         * powerpc.cc (Relocate::relocate): Likewise.
13861         * sparc.cc (Relocate::relocate): Likewise.
13862         * x86_64.cc (Relocate::relocate): Likewise.
13863         * testsuite/weak_plt.sh: New test.
13864         * testsuite/weak_plt_main.cc: New test.
13865         * testsuite/weak_plt_shared.cc: New test.
13866         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
13867         (check_PROGRAMS): Add weak_plt.
13868         (check_DATA): Add weak_plt_shared.so.
13869         (weak_plt_main_pic.o, weak_plt): New targets.
13870         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
13871         * testsuite/Makefile.in: Rebuild.
13872
13873         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
13874         gcctestdir/ld.
13875         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
13876         * testsuite/Makefile.in: Rebuild.
13877
13878 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
13879
13880         * Makefile.am (POTFILES.in): Set LC_ALL=C.
13881         * Makefile.in: Regenerate.
13882         * po/POTFILES.in: Regenerate.
13883
13884 2008-07-29  Ian Lance Taylor  <iant@google.com>
13885
13886         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
13887         symbols before other symbols.
13888         * testsuite/script_test_2.cc (test_addr): Declare.
13889         (test_addr_alias): Declare.
13890         (main): Check that test_addr and test_addr_alias have the right
13891         values.
13892         * testsuite/script_test_2.t: Define test_addr_alias and
13893         test_addr.
13894
13895 2008-07-24  Ian Lance Taylor  <iant@google.com>
13896
13897         PR 5990
13898         * descriptors.cc: New file.
13899         * descriptors.h: New file.
13900         * gold-threads.h (class Hold_optional_lock): New class.
13901         * fileread.cc: Include "descriptors.h".
13902         (File_read::~File_read): Release descriptor rather than closing
13903         it.
13904         (File_read::open) [file]: Call open_descriptor rather than open.
13905         Set is_descriptor_opened_.
13906         (File_read::open) [memory]: Assert that descriptor is not open.
13907         (File_read::reopen_descriptor): New function.
13908         (File_read::release): Release descriptor.
13909         (File_read::do_read): Make non-const.  Reopen descriptor.
13910         (File_read::read): Make non-const.
13911         (File_read::make_view): Reopen descriptor.
13912         (File_read::do_readv): Likewise.
13913         * fileread.h (class File_read): Add is_descriptor_opened_ field.
13914         Update declarations.
13915         * layout.cc: Include "descriptors.h".
13916         (Layout::create_build_id): Use open_descriptor rather than open.
13917         * output.cc: Include "descriptors.h".
13918         (Output_file::open): Use open_descriptor rather than open.
13919         * archive.cc (Archive::const_iterator): Change Archive to be
13920         non-const.
13921         (Archive::begin, Archive::end): Make non-const.
13922         (Archive::count_members): Likewise.
13923         * archive.h (class Archive): Update declarations.
13924         * object.h (Object::read): Make non-const.
13925         * Makefile.am (CCFILES): Add descriptors.cc.
13926         (HFILES): Add descriptors.h.
13927         * Makefile.in: Rebuild.
13928
13929         PR 6716
13930         * gold.h: Always include <clocale>.  Add Solaris workarounds
13931         following code in binutils/sysdep.h.
13932
13933         PR 6048
13934         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
13935         this->eh_frame_hdr_ is NULL before using it.
13936
13937         * dynobj.cc (Versions::Versions): Update comment.
13938
13939         * dynobj.cc (Versions::Versions): If there is an soname, use it as
13940         the base version name.
13941
13942         * stringpool.cc (Stringpool_template::add_with_length): Set key to
13943         array size plus one.
13944         (Stringpool_template::set_string_offsets): Subtract one from key
13945         before using it as an array index.
13946         (Stringpool_template::get_offset_with_length): Likewise.
13947         (Stringpool_template::write_to_buffer): Likewise.
13948         * stringpool.h (Stringpool_template::get_offset_from_key):
13949         Likewise.
13950
13951 2008-07-23  Ian Lance Taylor  <iant@google.com>
13952
13953         PR 6658
13954         * object.h (Merged_symbol_value::value): Do our best to handle a
13955         negative addend.
13956
13957         PR 6647
13958         * script.cc (Version_script_info::get_versions): Don't add empty
13959         version tag to return value.
13960         (Version_script_info::get_symbol_version_helper): Change return
13961         type to bool.  Add pversion parameter.  Change all callers.
13962         (script_register_vers_node): Don't require a non-NULL tag.
13963         * script.h (class Version_script_info): Update declarations.
13964         (Version_script_info::get_symbol_version): Change return type to
13965         bool.  Add version parameter.  Change all callers.
13966         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
13967         handling.  Handle an empty version from a version script.
13968         (Symbol_table::define_special_symbol): Likewise.
13969         * testsuite/ver_test_10.script: New file.
13970         * testsuite/ver_test_10.sh: New file.
13971         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
13972         (check_DATA): Add ver_test_10.syms.
13973         (ver_test_10.syms, ver_test_10.so): New target.
13974         * testsuite/Makefile.in: Rebuild.
13975
13976 2008-07-23  Simon Baldwin  <simonb@google.com>
13977
13978         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
13979         to zero for undefined symbols from dynamic libraries.
13980
13981 2008-07-23  Ian Lance Taylor  <iant@google.com>
13982
13983         * symtab.cc (Symbol_table::resolve): Remove version parameter.
13984         Change all callers.
13985         * symtab.h (class Symbol_table): Update declaration.
13986         * testsuite/ver_test_9.cc: New file.
13987         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
13988         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
13989         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
13990         (ver_test_9.so, ver_test_9.o): New targets.
13991         * testsuite/Makefile.in: Rebuild.
13992
13993 2008-07-22  Ian Lance Taylor  <iant@google.com>
13994
13995         * options.h (class General_options): Define --check-sections.
13996         * layout.cc (Layout::set_segment_offsets): Handle
13997         --check-sections.
13998
13999         * options.h (class General_options): Define -n/--nmagic and
14000         -N/--omagic.
14001         * options.cc (General_options::finalize): For -n/--nmagic or
14002         -N/--omagic, set -static.
14003         * layout.cc (Layout::attach_allocated_section_to_segment): If
14004         -N/--omagic, don't put read-only and read-write sections in
14005         different segments.
14006         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
14007         finding a read-only segment.
14008         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
14009         don't set the minimum segment alignment to the common page size,
14010         and don't set the file offset to the address modulo the page size.
14011         * script-sections.cc (Script_sections::create_segments): If
14012         -n/--omagic, don't put read-only and read-write sections in
14013         different segments.
14014
14015         * cref.cc: New file.
14016         * cref.h: New file.
14017         * options.h (class General_options): Add --print-symbol-counts.
14018         * main.cc (main): Issue defined symbol report if requested.
14019         * archive.cc (Archive::interpret_header): Make into a const member
14020         function.
14021         (Archive::add_symbols): Call Input_objects::archive_start and
14022         archive_stop.
14023         (Archive::const_iterator): Define new class.
14024         (Archive::begin, Archive::end): New functions.
14025         (Archive::include_all_members): Rewrite to use iterator.
14026         (Archive::count_members): New function.
14027         * archive.h (class Archive): Update declarations.
14028         (Archive::filename): New function.
14029         * object.cc: Include "cref.h".
14030         (Sized_relobj::Sized_relobj): Initialize defined_count_.
14031         (Sized_relobj::do_get_global_symbol_counts): New function.
14032         (Input_objects::add_object): Add object to cross-referencer.
14033         (Input_objects::archive_start): New function.
14034         (Input_objects::archive_stop): New function.
14035         (Input_objects::print_symbol_counts): New function.
14036         * object.h: Declare Cref and Archive.
14037         (Object::get_global_symbol_counts): New function.
14038         (Object::do_get_global_symbol_counts): New pure virtual function.
14039         (class Sized_relobj): Add defined_count_ field.  Update
14040         declarations.
14041         (class Input_objects): Add cref_ field.  Update constructor.
14042         Update declarations.
14043         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
14044         defined_count_.
14045         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
14046         symbol counts.
14047         (Sized_dynobj::do_get_global_symbol_counts): New function.
14048         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
14049         defined_count_.  Update declarations.  Define Symbols typedef.
14050         * symtab.cc (Symbol_table::add_from_relobj): Add defined
14051         parameter.  Change all callers.
14052         (Symbol_table::add_from_dynobj): Add sympointers and defined
14053         parameters.  Change all callers.
14054         * symtab.h (class Symbol_table): Update declarations.
14055         * Makefile.am (CCFILES): Add cref.cc.
14056         (HFILES): Add cref.h.
14057         * Makefile.in: Rebuild.
14058
14059 2008-07-22  Simon Baldwin  <simonb@google.com>
14060
14061         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
14062         to zero when writing undefined symbols.
14063
14064 2008-07-22  Ian Lance Taylor  <iant@google.com>
14065
14066         * output.cc (Output_section::add_input_section): Don't try to
14067         merge empty merge sections.
14068
14069 2008-07-21  Craig Silverstein  <csilvers@google.com>
14070
14071         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
14072         Include symbol version in error message.
14073
14074 2008-07-20  Chris Demetriou  <cgd@google.com>
14075
14076         * configure.ac (gold_cv_c_random_seed): New configured variable.
14077         (RANDOM_SEED_CFLAGS): New substituted variable.
14078         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
14079         * configure: Rebuild.
14080         * Makefile.in: Likewise.
14081         * testsuite/Makefile.in: Likewise.
14082
14083 2008-07-18  Ian Lance Taylor  <iant@google.com>
14084
14085         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
14086         where we see NAME/NULL and NAME/VERSION  as separate symbols.
14087         * testsuite/ver_test_main.cc (main): Call t4.
14088         (t4, t4_2a): Define.
14089         * testsuite/ver_test_2.cc (t4_2): Define.
14090         * testsuite/ver_test_2.script: Put t4_2a in VER2.
14091         * testsuite/ver_test_4.cc (t4_2a): Define.
14092         * testsuite/ver_test_4.script: Put t4_2a in VER2.
14093         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
14094
14095 2008-07-17  Ian Lance Taylor  <iant@google.com>
14096
14097         * dynobj.cc (Versions::add_def): If we give an error about a
14098         missing version, go ahead and create the version anyhow.
14099
14100 2008-07-10  Ian Lance Taylor  <iant@google.com>
14101
14102         Handle output sections with more than 0x7fffffff bytes.
14103         * object.h (class Relobj): Change map_to_output_ to
14104         output_sections_, and just keep a section pointer.  Change all
14105         uses.  Move comdat group support to Sized_relobj.
14106         (Relobj::is_section_specially_mapped): Remove.
14107         (Relobj::output_section): Remove poff parameter.  Change all
14108         callers.
14109         (Relobj::output_section_offset): New function.
14110         (Relobj::set_section_offset): Rewrite.
14111         (Relobj::map_to_output): Remove.
14112         (Relobj::output_sections): New function.
14113         (Relobj::do_output_section_offset): New pure virtual function.
14114         (Relobj::do_set_section_offset): Likewise.
14115         (class Sized_relobj): Add section_offsets_ field.  Add comdat
14116         group support from Relobj.  Update declarations.
14117         (Sized_relobj::get_output_section_offset): New function.
14118         (Sized_relobj::do_output_section_offset): New function.
14119         (Sized_relobj::do_set_section_offset): New function.
14120         * object.cc (Relobj::output_section_address): Remove.
14121         (Sized_relobj::Sized_relobj): Initialize new fields.
14122         (Sized_relobj::include_section_group): Cast find_kept_object to
14123         Sized_relobj.
14124         (Sized_relobj::include_linkonce_section): Likewise.
14125         (Sized_relobj::do_layout): Use separate arrays for output section
14126         and output offset.
14127         (Sized_relobj::do_count_local_symbols): Change map_to_output to
14128         output_sections.
14129         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
14130         output_sections and section_offsets.
14131         (Sized_relobj::write_local_symbols): Likewise.
14132         (map_to_kept_section): Compute output address directly.
14133         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
14134         output_sections and section_offsets.
14135         (Sized_relobj::write_sections): Likewise.
14136         (Sized_relobj::relocate_sections): Likewise.
14137         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
14138         * output.h (class Output_reloc): Update declarations.  Change
14139         u2_.relobj to Sized_relobj*.
14140         (class Output_data_reloc): Change add functions to use
14141         Sized_relobj*.
14142         * output.cc (Output_reloc::Output_reloc): Change relobj to
14143         Sized_relobj*.
14144         (Output_reloc::local_section_offset): Change return type to
14145         Elf_Addr.  Use get_output_section_offset.
14146         (Output_reloc::get_address): Likewise.
14147         (Output_section::is_input_address_mapped): Don't call
14148         is_section_specially_mapped.
14149         (Output_section::output_offset): Likewise.
14150         (Output_section::output_address): Likewise.
14151         (Output_section::starting_output_address): Likewise.
14152         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
14153         parameter to Sized_relobj*.
14154         (Copy_relocs::need_copy_reloc): Likewise.
14155         (Copy_relocs::save): Likewise.
14156         * copy-relocs.h (class Copy_relocs): Update declarations.
14157         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
14158         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
14159         * target-reloc.h (relocate_for_relocatable): Change
14160         offset_in_output_section type to Elf_Addr.  Change code that uses
14161         it as well.
14162         * layout.cc (Layout::layout): Always set *off.
14163         * mapfile.cc (Mapfile::print_input_section): Use
14164         output_section_offset.
14165         * i386.cc (Target_i386::copy_reloc): Change object parameter to
14166         Sized_relobj*.
14167         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
14168         * sparc.cc (Target_sparc::copy_reloc): Likewise.
14169         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
14170
14171 2008-07-03  Ian Lance Taylor  <iant@google.com>
14172
14173         * layout.cc (Layout::include_section): Do not discard unrecognized
14174         SHT_STRTAB sections.
14175
14176 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
14177
14178         * script.cc (Lex::can_continue_name): Make '?' allowable in
14179         version-script names.
14180         * testsuite/version_script.map: Change glob pattern to use '?'
14181
14182 2008-06-30  Manish Singh  <yosh@gimp.org>
14183
14184         PR 6585
14185         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
14186         Correct typo.
14187
14188 2008-06-30  Ian Lance Taylor  <iant@google.com>
14189
14190         PR 6660
14191         PR 6682
14192         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
14193         versions]: Don't try to read the value in the contents, since we
14194         don't use it.  Use the template endianness when writing.
14195
14196 2008-06-25  Cary Coutant  <ccoutant@google.com>
14197
14198         * fileread.cc (File_read::make_view): Assert on zero-length view.
14199         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
14200         symbol table when there are no symbols to read.
14201
14202 2008-06-23  Craig Silverstein  <csilvers@google.com>
14203
14204         * version.cc (version_string): Bump to 1.7
14205
14206 2008-06-18  Craig Silverstein  <csilvers@google.com>
14207
14208         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
14209         constant 0xFFFF to type Valtype.
14210         (Powerpc_relocate_functions::rel16_ha): Likewise.
14211
14212 2008-06-17  Ian Lance Taylor  <iant@google.com>
14213
14214         * output.h (Output_section::Input_section): Initialize p2align_ to
14215         zero for Output_section_data constructors.
14216         (Output_section::Input_section::addralign): If not an input
14217         section, return the alignment of the Output_section_data.
14218         * testsuite/copy_test.cc: New file.
14219         * testsuite/copy_test_1.cc: New file.
14220         * testsuite/copy_test_2.cc: New file.
14221         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
14222         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
14223         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
14224         (copy_test_1_pic.o, copy_test_1.so): New targets.
14225         (copy_test_2_pic.o, copy_test_2.so): New targets.
14226         * testsuite/Makefile.in: Rebuild.
14227
14228         * script-sections.cc (Script_sections::place_orphan): Initialize
14229         local variable exact.
14230
14231 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
14232
14233         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
14234
14235 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
14236             David S. Miller  <davem@davemloft.net>
14237
14238         * powerpc.cc: New file.
14239         * Makefile.am (TARGETSOURCES): Add powerpc.cc
14240         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
14241         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
14242         * Makefile.in: Rebuild.
14243
14244 2008-06-09  Ian Lance Taylor  <iant@google.com>
14245
14246         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
14247         <exception>.
14248         (throwing, orig_terminate): New static variables.
14249         (terminate_handler): New static function.
14250         (t2): Set terminate handler.
14251
14252 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
14253
14254         PR 6584
14255         * binary.cc (Binary_to_elf::sized_convert): Fix .data
14256         alignment.
14257
14258 2008-05-30  Cary Coutant  <ccoutant@google.com>
14259
14260         * archive.cc (Archive::include_all_members) Correct to step
14261         over symbol table and extended name table in thin archives.
14262
14263 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
14264
14265         PR 6407
14266         * target-reloc.h (relocate_for_relocatable): Fix new_offset
14267         calculation.
14268
14269 2008-05-28  Caleb Howe  <cshowe@google.com>
14270
14271         * reduced_debug_output.cc: New file.
14272         * reduced_debug_output.h: New file.
14273         * options.h (class General_options): Add --strip-debug-non-line.
14274         * options.cc (General_options::finalize): Add strip_debug_non_line
14275         to the strip heirarchy.
14276         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
14277         fields.
14278         * layout.cc: Include "reduced_debug_output.h".
14279         (Layout::Layout): Initialize new fields.
14280         (line_only_debug_sections): New static array.
14281         (is_lines_only_debug_sections): New static inline function.
14282         (Layout::include_section): Handle --strip-debug-non-line.
14283         (Layout::make_output_section): If --strip-debug-non-line, build
14284         new output sections for .debug_abbrev and .debug_info.
14285         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
14286         gold.  Warn about possible overflow.
14287         (read_signed_LEB_128): Likewise.
14288         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
14289         (read_signed_LEB_128): Declare.
14290         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
14291         (HFILES): Add reduced_debug_output.h.
14292         * Makefile.in: Rebuild.
14293
14294 2008-05-21  Ian Lance Taylor  <iant@google.com>
14295
14296         * mapfile.cc: New file.
14297         * mapfile.h: New file.
14298         * options.h (class General_options): Add -M/--print-map and -Map.
14299         * options.cc (General_options::finalize): Make -M equivalent to
14300         -Map -.
14301         * main.cc: Include <cstdio> and "mapfile.h".
14302         (main): Open mapfile if requested.
14303         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
14304         constructor.  Change caller.
14305         (queue_initial_tasks): Add mapfile parameter.  Change caller.
14306         (queue_middle_tasks): Likewise.
14307         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
14308         declarations.
14309         * archive.cc: Include "mapfile.h".
14310         (Archive::add_symbols): Add mapfile parameter.  Change all
14311         callers.  Pass mapfile, symbol, and reason to include_member.
14312         (Archive::include_all_members): Add mapfile parameter.  Change all
14313         callers.
14314         (Archive::include_member): Add mapfile, sym, and why parameters.
14315         Change all callers.  Report inclusion to map file.
14316         * archive.h: Include "fileread.h".
14317         (class Archive): Update declarations.
14318         (Archive::file): New const method.
14319         (class Add_archive_symbols): Add mapfile_ field.  Update
14320         constructor.  Change all callers.
14321         * readsyms.h (class Read_symbols): Likewise.
14322         (class Finish_group): Likewise.
14323         (class Read_script): Likewise.
14324         * common.cc: Include "mapfile.h".
14325         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
14326         all callers.
14327         (Symbol_table::do_allocate_commons): Likewise.
14328         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
14329         symbol allocation to mapfile.
14330         * common.h (class Allocate_commons_task): Add mapfile_ field.
14331         Update constructor.  Change all callers.
14332         * symtab.h (class Symbol_table): Update declarations.
14333         * layout.cc: Include "mapfile.h".
14334         (Layout_task_runner::run): Print information to mapfile.
14335         (Layout::create_gold_note): Change Output_data_fixed_space to
14336         Output_data_zero_fill.
14337         (Layout::create_build_id): Likewise.
14338         (Layout::print_to_mapfile): New function.
14339         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
14340         constructor.  Change caller.
14341         (class Layout): Declare print_to_mapfile.
14342         * output.cc (Output_section::Input_section::print_to_mapfile): New
14343         function.
14344         (Output_section::add_input_section): If producing a map, always
14345         add to input_sections_ list.
14346         (Output_section::do_print_to_mapfile): New function.
14347         (Output_segment::print_sections_to_mapfile): New function.
14348         (Output_segment::print_section_list_to_mapfile): New function.
14349         * output.h: Include "mapfile.h".
14350         (Output_data::print_to_mapfile): New function.
14351         (Output_data::do_print_to_mapfile): New virtual function.
14352         (Output_segment_headers::do_print_to_mapfile): New function.
14353         (Output_file_header::do_print_to_mapfile): New function.
14354         (Output_data_const::do_print_to_mapfile): New function.
14355         (class Output_data_const_buffer): Add map_name_ field.  Update
14356         constructor.  Change all callers.  Add do_print_to_mapfile
14357         function.
14358         (class Output_data_fixed_space): Likewise.
14359         (class Output_data_space): Likewise.
14360         (class Output_data_zero_fill): New class.
14361         (Output_data_strtab::do_print_to_mapfile): New function.
14362         (Output_data_reloc_base::do_print_to_mapfile): New function.
14363         (Output_relocatable_relocs::do_print_to_mapfile): New function.
14364         (Output_data_group::do_print_to_mapfile): New function.
14365         (Output_data_got::do_print_to_mapfile): New function.
14366         (Output_data_dynamic::do_print_to_mapfile): New function.
14367         (Output_symtab_xindex::do_print_to_mapfile): New function.
14368         (class Output_section): Declare do_print_to_mapflie.  Declare
14369         print_to_mapfile in Input_section.
14370         (class Output_segment): Declare new functions.
14371         * object.h (Sized_relobj::symbol_count): New function.
14372         * script-sections.cc
14373         (Output_section_element_dot_assignment::set_section_addresses):
14374         Change Output_data_fixed_space to Output_data_zero_fill.
14375         (Output_data_expression::do_print_to_mapfile): New function.
14376         * script.cc (read_input_script): Add mapfile parameter.  Change
14377         all callers.
14378         * script.h (read_input_script): Update declaration.
14379         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
14380         (Eh_frame::do_print_to_mapfile): New function.
14381         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
14382         (Output_merge_string::do_print_to_mapfile): New function.
14383         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
14384         function.
14385         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
14386         function.
14387         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
14388         function.
14389         * Makefile.am (CCFILES): Add mapfile.cc.
14390         (HFILES): Add mapfile.h.
14391         * Makefile.in: Rebuild.
14392
14393 2008-05-19  Ian Lance Taylor  <iant@google.com>
14394
14395         * options.h (class General_options): Add -z relro.
14396         * layout.cc (Layout::Layout): Initialize relro_segment_.
14397         (Layout::add_output_section_data): Return the output section.
14398         (Layout::make_output_section): Rcognize relro sections and mark
14399         them appropriately.
14400         (Layout::attach_allocated_section_to_segment): Put relro sections
14401         in a PT_GNU_RELRO segment.
14402         (Layout::create_initial_dynamic_sections): Mark the .dynamic
14403         section as relro.
14404         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
14405         PT_TLS segments.
14406         (Layout::linkonce_mapping): Map d.rel.ro.local to
14407         .data.rel.ro.local.
14408         (Layout::output_section_name): Us .data.rel.ro.local for any
14409         section which begins with that.
14410         * layout.h (class Layout): Update add_output_section_data
14411         declaration.  Add relro_segment_ field.
14412         * output.cc (Output_section::Output_section): Initialize is_relro_
14413         and is_relro_local_ fields.
14414         (Output_segment::add_output_section): Group relro sections.
14415         (Output_segment::is_first_section_relro): New function.
14416         (Output_segment::maximum_alignment): If there is a relro section,
14417         align the segment to the common page size.
14418         (Output_segment::set_section_addresses): Track whether we are
14419         looking at relro sections.  If the last section is a relro
14420         section, align to the common page size.
14421         (Output_segment::set_section_list_addresses): Add in_relro
14422         parameter.  Change all callers.  Align to the page size when
14423         moving from relro to non-relro section.
14424         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
14425         segment.
14426         * output.h (class Output_section): Add is_relro_ and
14427         is_relro_local_ fields.
14428         (Output_section::is_relro): New function.
14429         (Output_section::set_is_relro): New function.
14430         (Output_section::is_relro_local): New function.
14431         (Output_section::set_is_relro_local): New function.
14432         (class Output_segment): Update declarations.
14433         * i386.cc (Target_i386::got_section): Mark .got section as relro.
14434         * sparc.cc (Target_sparc::got_section): Likewise.
14435         * x86_64.cc (Target_x86_64::got_section): Likewise.
14436         * testsuite/relro_test_main.cc: New file.
14437         * testsuite/relro_test.cc: New file.
14438         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
14439         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
14440         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
14441         (relro_test.so, relro_test_pic.o): New targets.
14442         * testsuite/Makefile.in: Rebuild.
14443
14444 2008-05-16  Ian Lance Taylor  <iant@google.com>
14445
14446         * output.cc (Output_segment::add_output_section): Remove front
14447         parameter.
14448         * output.h (class Output_segment): Remove
14449         add_initial_output_section and overloaded add_output_section.
14450         Update declaration of remaining add_output_section.
14451         * layout.cc (Layout::create_interp): Call add_output_section
14452         rather than add_initial_output_section.
14453         (Layout::finish_dynamic_section): Likewise.
14454
14455         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
14456         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
14457         know the dynamic type.
14458         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
14459         field.  Initialize it in constructor.
14460         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
14461         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
14462         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
14463         reloc.
14464
14465         * output.cc (Output_reloc::get_address): Change return type to
14466         Elf_Addr.
14467         * output.h (class Output_reloc): Update get_address declaration.
14468         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
14469         for section addresses.
14470
14471 2008-05-09  Ian Lance Taylor  <iant@google.com>
14472
14473         PR 6493
14474         * gold.cc (gold_nomem): Use return value of write.
14475
14476 2008-05-08  Ian Lance Taylor  <iant@google.com>
14477
14478         * symtab.c (Symbol::init_base_output_data): Add version
14479         parameter.  Change all callers.
14480         (Symbol::init_base_output_segment): Likewise.
14481         (Symbol::init_base_constant): Likewise.
14482         (Symbol::init_base_undefined): Likewise.
14483         (Sized_symbol::init_output_data): Likewise.
14484         (Sized_symbol::init_output_segment): Likewise.
14485         (Sized_symbol::init_constant): Likewise.
14486         (Sized_symbol::init_undefined): Likewise.
14487         (Symbol_table::do_define_in_output_data): If the new symbol has a
14488         version, mark it as the default.
14489         (Symbol_table::do_define_in_output_segment): Likewise.
14490         (Symbol_table::do_define_as_constant): Likewise.
14491         * symtab.h (class Symbol): Update declarations.
14492         (class Sized_symbol): Likewise.
14493         * resolve.cc (Symbol::override_version): New function.
14494         (Symbol::override_base): Call override_version.
14495         (Symbol::override_base_with_special): Likewise.
14496         * testsuite/ver_script_8.script: New file.
14497         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
14498         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
14499         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
14500         (ver_test_8_1.so, ver_test_8_2.so): New targets.
14501
14502 2008-05-06  Ian Lance Taylor  <iant@google.com>
14503
14504         PR 6049
14505         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
14506         functions.
14507         (class General_options): Remove existing --undefined, and add
14508         --no-undefined instead.  Add new --undefined as synonym for -u.
14509         * archive.cc (Archive::add_symbols): Check whether symbol was
14510         named with -u.
14511         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
14512         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
14513         all uses.  Add IS_UNDEFINED.  Update declarations to split
14514         different versions of init_base.  Declare init_base_undefined.
14515         (Symbol::is_defined): Handle IS_UNDEFINED.
14516         (Symbol::is_undefined): Likewise.
14517         (Symbol::is_weak_undefined): Call is_undefined.
14518         (Symbol::is_absolute): Handle IS_CONSTANT.
14519         (class Sized_symbol): Update declarations to split different
14520         versions of init.  Declare init_undefined.
14521         (class Symbol_table): Declare new functions.
14522         * symtab.cc (Symbol::init_base_object): Rename from init_base.
14523         Change all callers.
14524         (Symbol::init_base_output_data): Likewise.
14525         (Symbol::init_base_output_segment): Likewise.
14526         (Symbol::init_base_constant): Likewise.
14527         (Symbol::init_base_undefined): New function.
14528         (Sized_symbol::init_object): Rename from init.  Change all
14529         callers.
14530         (Sized_symbol::init_output_data): Likewise.
14531         (Sized_symbol::init_output_segment): Likewise.
14532         (Sized_symbol::init_constant): Likewise.
14533         (Sized_symbol::init_undefined): New function.
14534         (Symbol_table::add_undefined_symbols_from_command_line): New
14535         function.
14536         (Symbol_table::do_add_undefined_symbols_from_command_line): New
14537         function.
14538         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
14539         (Symbol::output_section): Likewise.
14540         (Symbol::set_output_section): Likewise.
14541         (Symbol_table::sized_finalize_symbol): Likewise.
14542         (Symbol_table::sized_write_globals): Likewise.
14543         * resolve.cc (Symbol_table::should_override): Likewise.
14544         (Symbol::override_base_with_special): Likewise.
14545
14546         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
14547         symbol, change it to have default visibility.
14548         * testsuite/protected_1.cc: New file.
14549         * testsuite/protected_2.cc: New file.
14550         * testsuite/protected_3.cc: New file.
14551         * testsuite/protected_main_1.cc: New file.
14552         * testsuite/protected_main_2.cc: New file.
14553         * testsuite/protected_main_3.cc: New file.
14554         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
14555         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
14556         (protected_1_LDFLAGS, protected_1_LDADD): Define.
14557         (protected_1.so): New target.
14558         (protected_1_pic.o, protected_2_pic.o): New targets.
14559         (protected_3_pic.o): New target.
14560         (check_PROGRAMS): Add protected_2.
14561         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
14562         (protected_2_LDFLAGS, protected_2_LDADD): Define.
14563         * testsuite/Makefile.in: Rebuild.
14564
14565         * options.h (DEFINE_var): Add set_user_set_##varname__.
14566         (DEFINE_bool_alias): New macro.
14567         (class General_options): Define -Bstatic using DEFINE_bool_alias
14568         rather than DEFINE_special.  Add --undefined as an alias for -z
14569         defs.
14570         * options.cc (General_options::parse_Bstatic): Remove.
14571
14572         * options.h (class General_options): Add --fatal-warnings.
14573         * main.cc (main): Implement --fatal-warnings.
14574         * errors.h (Errors::warning_count): New function.
14575
14576         * options.h (class General_options): Add -Bsymbolic-functions.
14577         * symtab.h (Symbol::is_preemptible): Check for
14578         -Bsymbolic-functions.
14579
14580 2008-05-05  Ian Lance Taylor  <iant@google.com>
14581
14582         * options.h (DEFINE_bool): For DASH_Z, create the negative option
14583         as noVARNAME rather than no-VARNAME.
14584         (class General_options): Add option -z combreloc.
14585         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
14586         get_address.
14587         (Output_reloc::sort_before) [SHT_REL]: New function.
14588         (Output_reloc::sort_before) [SHT_RELA]: New function.
14589         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
14590         Sort_relocs_comparison.
14591         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
14592         parameter.  Change all callers.
14593         (Output_data_reloc::Output_data_reloc) [both versions]: Add
14594         sort_relocs parameter.  Change all callers.
14595         * output.cc (Output_reloc::get_address): New function, broken out
14596         of write_rel.
14597         (Output_reloc::write_rel): Call it.
14598         (Output_reloc::compare): New function.
14599         (Output_data_reloc_base::do_write): Optionally sort relocs.
14600
14601         * configure.ac: If targ_extra_obj is set, link it in.
14602         * configure.tgt: Initialize all variables.
14603         (x86_64*): Set targ_extra_obj and targ_extra_size.
14604         * configure: Rebuild.
14605
14606         * object.cc (Sized_relobj::include_section_group): Adjust section
14607         indexes read from group data.  Build vector to pass to
14608         layout_group.
14609         * layout.cc (Layout::layout_group): Add flags and shndxes
14610         parameters.  Remove contents parameter.  Change caller.  Update
14611         explicit instantiations.
14612         * layout.h (class Layout): Update layout_group declaration.
14613         * output.cc (Output_data_group::Output_data_group): Add flags and
14614         input_shndxes parameters.  Remove contents parameter.  Change
14615         caller.
14616         (Output_data_group::do_write): Change input_sections_ to
14617         input_shndxes_.
14618         * output.h (class Output_data_group): Update constructor
14619         declaration.  Rename input_sections_ to input_shndxes_.
14620         * testsuite/many_sections_test.cc: Add template.
14621
14622 2008-04-30  Cary Coutant  <ccoutant@google.com>
14623
14624         * target-reloc.h (relocate_section): Fix dead-pointer bug.
14625
14626         * layout.cc (Layout::include_section): Refactored check for debug
14627         info section.
14628         (Layout::add_comdat): Add new parameters.  Change type
14629         of signature parameter.  Add object and shndx to signatures table.
14630         (Layout::find_kept_object): New function.
14631         * layout.h: Include <cstring>.
14632         (Layout::is_debug_info_section): New function.
14633         (Layout::add_comdat): Add new parameters.
14634         (Layout::find_kept_object): New function.
14635         (Layout::Kept_section): New struct.
14636         (Layout::Signatures): Change type of map range.
14637         * object.cc (Relobj::output_section_address): New function.
14638         (Sized_relobj::include_section_group): Add new parameters.  Change
14639         calls to Layout::add_comdat.  Change to build table of kept comdat
14640         groups and table mapping discarded sections to kept sections.
14641         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
14642         (Sized_relobj::do_layout): Change calls to include_section_group and
14643         include_linkonce_section.
14644         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
14645         value to zero when section is discarded.
14646         (Sized_relobj::map_to_kept_section): New function.
14647         * object.h (Relobj::output_section_address): New function.
14648         (Relobj::Comdat_group): New type.
14649         (Relobj::find_comdat_group): New function.
14650         (Relobj::Comdat_group_table): New type.
14651         (Relobj::Kept_comdat_section): New type.
14652         (Relobj::Kept_comdat_section_table): New type.
14653         (Relobj::add_comdat_group): New function.
14654         (Relobj::set_kept_comdat_section): New function.
14655         (Relobj::get_kept_comdat_section): New function.
14656         (Relobj::comdat_groups_): New field.
14657         (Relobj::kept_comdat_sections_): New field.
14658         (Symbol_value::input_value): Update comment.
14659         (Sized_relobj::map_to_kept_section) New function.
14660         (Sized_relobj::include_linkonce_section): Add new parameter.
14661         * target-reloc.h (Comdat_behavior): New type.
14662         (get_comdat_behavior): New function.
14663         (relocate_section): Add code to map a discarded section to the
14664         corresponding kept section when applying a relocation.
14665
14666 2008-04-30  Craig Silverstein  <csilvers@google.com>
14667
14668         * dwarf_reader.cc (next_generation_count): New static var.
14669         (Addr2line_cache_entry): New struct.
14670         (addr2line_cache): New static var.
14671         (Dwarf_line_info::one_addr2line): Added caching.
14672         (Dwarf_line_info::clear_addr2line_cache): New function.
14673         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
14674         cache-size parameter.
14675         (Dwarf_line_info::one_addr2line_cache): New function.
14676         * symtab.cc (Symbol_table::detect_odr_violations): Pass
14677         new cache-size argument to one_addr2line(), and clear cache.
14678
14679 2008-04-28  Cary Coutant  <ccoutant@google.com>
14680
14681         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
14682         R_386_PC8 relocations.
14683
14684 2008-04-23  Ian Lance Taylor  <iant@google.com>
14685
14686         * object.cc (Sized_relobj::include_section_group): Check for
14687         invalid section group.
14688
14689         * object.cc (make_elf_object): Correct test for 64-bit ELF file
14690         header size.
14691
14692         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
14693         than read for file header.
14694         * archive.cc (Archive::include_member): Likewise.
14695
14696 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
14697
14698         * aclocal.m4: Regenerate.
14699         * configure: Regenerate.
14700
14701 2008-04-19  Ian Lance Taylor  <iant@google.com>
14702
14703         * version.cc (version_string): Bump to 1.6.
14704
14705         * testsuite/Makefile.am (many_sections_r_test): New target.
14706         (many_sections_r_test_SOURCES): Remove.
14707         (many_sections_r_test_DEPENDENCIES): Remove.
14708         (many_sections_r_test_LDFLAGS): Remove.
14709         (many_sections_r_test_LDADD): Remove.
14710
14711         * object.cc (Sized_relobj::do_add_symbols): Always pass
14712         local_symbol_count_ to add_from_relobj.
14713
14714         * testsuite/Makefile.am (many_sections_check.h): Only check one in
14715         every thousand variables.
14716         * testsuite/Makefile.in: Rebuild.
14717
14718         * object.cc (Xindex::initialize_symtab_xindex): New function.
14719         (Xindex::read_symtab_xindex): New function.
14720         (Xindex::sym_xindex_to_shndx): New function.
14721         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
14722         available.
14723         (Sized_relobj::do_initialize_xindex): New function.
14724         (Sized_relobj::do_read_symbols): Adjust section links.
14725         (Sized_relobj::symbol_section_and_value): Add is_ordinary
14726         parameter.  Change all callers.
14727         (Sized_relobj::include_section_group): Adjust section links and
14728         symbol section indexes.
14729         (Sized_relobj::do_layout): Adjust section links.
14730         (Sized_relobj::do_count_local_symbols): Adjust section links and
14731         symbol section indexes.
14732         (Sized_relobj::do_finalize_local_symbols): Distinguish between
14733         ordinary and special symbols.
14734         (Sized_relobj::write_local_symbols): Add symtab_xindex and
14735         dynsym_xindex parameters.  Change all callers.  Adjust section
14736         links.  Use SHN_XINDEX when needed.
14737         (Sized_relobj::get_symbol_location_info): Adjust section links.
14738         Don't get fooled by special symbols.
14739         * object.h (class Xindex): Define.
14740         (class Object): Add xindex_ parameter.  Declare virtual functoin
14741         do_initialize_xindex.
14742         (Object::adjust_sym_shndx): New function.
14743         (Object::set_xindex): New protected function.
14744         (class Symbol_value): Add is_ordinary_shndx_ field.
14745         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
14746         (Symbol_value::value): Assert ordinary section.
14747         (Symbol_value::initialize_input_to_output_map): Likewise.
14748         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
14749         Change all callers.
14750         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
14751         all callers.
14752         (class Sized_relobj): Update declarations.
14753         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
14754         parameter.  Change all callers.
14755         (Sized_relobj::adjust_shndx): New function.
14756         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
14757         field.
14758         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
14759         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
14760         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
14761         (Sized_dynobj::read_dynsym_section): Adjust section links.
14762         (Sized_dynobj::read_dynamic): Likewise.
14763         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
14764         section links.
14765         (Sized_dynobj::do_initialize_xindex): New function.
14766         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
14767         do_initialize_xindex.
14768         (Sized_dynobj::adjust_shndx): New function.
14769         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
14770         dynsym_xindex_ fields.
14771         (Layout::finalize): Add a call to set_section_indexes before
14772         creating the symtab sections.
14773         (Layout::set_section_indexes): Don't do anything if the section
14774         already has a section index.
14775         (Layout::create_symtab_sections): Add shnum parameter.  Change
14776         caller.  Create .symtab_shndx section if needed.
14777         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
14778         caller.
14779         (Layout::allocated_output_section_count): New function.
14780         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
14781         needed.
14782         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
14783         fields.  Update declarations.
14784         (Layout::symtab_xindex): New function.
14785         (Layout::dynsym_xindex): New function.
14786         (class Write_symbols_task): Add layout_ field.
14787         (Write_symbols_task::Write_symbols_task): Add layout parameter.
14788         Change caller.
14789         * output.cc (Output_section_headers::Output_section_headers): Add
14790         shstrtab_section parameter.  Change all callers.
14791         (Output_section_headers::do_sized_write): Store overflow values
14792         for section count and section string table section index in
14793         section header zero.
14794         (Output_file_header::do_sized_write): Check for overflow of
14795         section count and section string table section index.
14796         (Output_symtab_xindex::do_write): New function.
14797         (Output_symtab_xindex::endian_do_write): New function.
14798         * output.h (class Output_section_headers): Add shstrtab_section_.
14799         Update declarations.
14800         (class Output_symtab_xindex): Define.
14801         (Output_section::has_out_shndx): New function.
14802         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
14803         field.
14804         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
14805         Change all callers.
14806         (Sized_symbol::init): Likewise.
14807         (Symbol::output_section): Check for ordinary symbol.
14808         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
14809         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
14810         callers.
14811         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
14812         Change all callers.  Simplify handling of symbols from sections
14813         not included in the link.
14814         (Symbol_table::add_from_dynobj): Handle ordinary symbol
14815         distinction.
14816         (Weak_alias_sorter::operator()): Assert that symbols are
14817         ordinary.
14818         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
14819         distinction.
14820         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
14821         parameters.  Change all callers.
14822         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
14823         symbol distinction.  Use SHN_XINDEX when needed.
14824         (Symbol_table::write_section_symbol): Add symtab_xindex
14825         parameter.  Change all callers.
14826         (Symbol_table::sized_write_section_symbol): Likewise.  Use
14827         SHN_XINDEX when needed.
14828         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
14829         declarations.
14830         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
14831         (Symbol::is_defined): Check is_ordinary.
14832         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
14833         (Symbol::is_absolute, Symbol::is_common): Likewise.
14834         (class Sized_symbol): Update declarations.
14835         (class Symbol_table): Update declarations.
14836         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
14837         parameters.  Change all callers.
14838         (Sized_symbol::override): Likewise.
14839         (Symbol_table::override): Likewise.
14840         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
14841         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
14842         is_ordinary, and orig_st_shndx parameters.  Change all callers.
14843         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
14844         to be in an ordinary section.
14845         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
14846         object and is_ordinary parameters.  Change all callers.
14847         (Sized_dwarf_line_info::read_relocs): Add object parameter.
14848         Change all callers.  Don't add undefined or non-ordinary symbols
14849         to reloc_map_.
14850         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
14851         Change all callers.
14852         * dwarf_reader.h (class Sized_dwarf_line_info): Update
14853         declarations.
14854         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
14855         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
14856         (Sized_relobj::relocate_sections): Likewise.
14857         * target-reloc.h (scan_relocs): Adjust section symbol index.
14858         (scan_relocatable_relocs): Likewise.
14859         * i386.cc (Scan::local): Check for ordinary symbols.
14860         * sparc.cc (Scan::local): Likewise.
14861         * x86_64.cc (Scan::local): Likewise.
14862         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
14863         to symbol_section_and_value.
14864         * testsuite/many_sections_test.cc: New file.
14865         * testsuite/Makefile.am (BUILT_SOURCES): Define.
14866         (check_PROGRAMS): Add many_sections_test.
14867         (many_sections_test_SOURCES): Define.
14868         (many_sections_test_DEPENDENCIES): Define.
14869         (many_sections_test_LDFLAGS): Define.
14870         (BUILT_SOURCES): Add many_sections_define.h.
14871         (many_sections_define.h): New target.
14872         (BUILT_SOURCES): Add many_sections_check.h.
14873         (many_sections_check.h): New target.
14874         (check_PROGRAMS): Add many_sections_r_test.
14875         (many_sections_r_test_SOURCES): Define.
14876         (many_sections_r_test_DEPENDENCIES): Define.
14877         (many_sections_r_test_LDFLAGS): Define.
14878         (many_sections_r_test_LDADD): Define.
14879         (many_sections_r_test.o): New target.
14880         * testsuite/Makefile.in: Rebuild.
14881
14882 2008-04-17  Cary Coutant  <ccoutant@google.com>
14883
14884         * errors.cc (Errors::info): New function.
14885         (gold_info): New function.
14886         * errors.h (Errors::info): New function.
14887         * gold.h (gold_info): New function.
14888         * object.cc (Input_objects::add_object): Print trace output.
14889         * options.cc (options::parse_set): New function.
14890         (General_options::parse_wrap): Deleted.
14891         (General_options::General_options): Deleted initializer.
14892         * options.h (options::String_set): New typedef.
14893         (options::parse_set): New function.
14894         (DEFINE_set): New macro.
14895         (General_options::wrap): Changed to use DEFINE_set. Changed
14896         callers of any_wrap_symbols and is_wrap_symbol.
14897         (General_options::trace, General_options::trace_symbol):
14898         New options.
14899         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
14900         (General_options::wrap_symbols_): Deleted.
14901         * symtab.cc (Symbol_table::add_from_object): Print trace output.
14902
14903 2008-04-17  David S. Miller  <davem@davemloft.net>
14904
14905         * options.cc (General_options::parse_V): New function.
14906         * options.h: Add entries for -V and -Qy.
14907
14908 2008-04-17  Ian Lance Taylor  <iant@google.com>
14909
14910         * common.cc (Symbol_table::allocate_commons): Remove options
14911         parameter.  Change caller.
14912         (Symbol_table::do_allocate_commons): Remove options parameter.
14913         Change caller.  Just call do_allocate_commons_list twice.
14914         (Symbol_table::do_allocate_commons_list): New function, broken out
14915         of do_allocate_commons.
14916         * common.h (class Allocate_commons_task): Remove options_ field.
14917         Update constructor.
14918         * symtab.cc (Symbol_table::Symbol_table): Initialize
14919         tls_commons_.
14920         (Symbol_table::add_from_object): Put TLS common symbols on
14921         tls_commons_ list.
14922         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
14923         which are IN_OUTPUT_DATA.
14924         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
14925         allocate_commons and do_allocate_commons declarations.  Declare
14926         do_allocate_commons_list.
14927         * gold.cc (queue_middle_tasks): Update creation of
14928         Allocate_commons_task to not pass options.
14929         * testsuite/Makefile.am (INCLUDES): Add -I.. .
14930         (TLS_TEST_C_FLAGS): New variable.
14931         (tls_test_c_pic.o): New target.
14932         (tls_test_shared.so): Link in tls_test_c_pic.o.
14933         (tls_test_c_pic_ie.o): New target.
14934         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
14935         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
14936         (tls_test_c.o): New target.
14937         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
14938         (tls_pic_test_LDADD): Likewise.
14939         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
14940         (tls_shared_gd_to_ie_test_LDADD): Likewise.
14941         (tls_test_c_gnu2.o): New target.
14942         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
14943         tls_test_c_gnu2.o.
14944         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
14945         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
14946         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
14947         * testsuite/tls_test.cc: Include "config.h".
14948         (t_last): Call t11_last.
14949         * testsuite/tls_test.h (t11, t11_last): Declare.
14950         * testsuite/tls_test_c.c: New file.
14951         * testsuite/tls_test_main.cc (thread_routine): Call t11.
14952         * configure.ac: Check for OpenMP support.
14953         * configure, config.in, Makefile.in: Rebuild.
14954         * testsuite/Makefile.in: Rebuild.
14955
14956 2008-04-16  Cary Coutant  <ccoutant@google.com>
14957
14958         * i386.cc (Target_i386::define_tls_base_symbol): New function.
14959         (Target_i386::tls_base_symbol_defined_): New field.
14960         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
14961         (Target_i386::Scan::global): Likewise.
14962         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
14963         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
14964         (Target_x86_64::tls_base_symbol_defined_): New field.
14965         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
14966         (Target_x86_64::Scan::global): Likewise.
14967
14968 2008-04-16  Cary Coutant  <ccoutant@google.com>
14969
14970         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
14971         (Symbol::needs_plt_entry): Allow weak undefined symbols.
14972         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
14973         building shared libraries.
14974         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
14975         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
14976         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
14977         * testsuite/Makefile.in: Rebuild.
14978         * testsuite/weak_undef.h: New file.
14979         * testsuite/weak_undef_file1.cc: Add extra test cases.
14980         * testsuite/weak_undef_file2.cc: Likewise.
14981         * testsuite/weak_undef_test.cc: Likewise.
14982
14983 2008-04-16  David S. Miller  <davem@davemloft.net>
14984
14985         * sparc.cc (Target_sparc::Scan): Change from struct to class.
14986         Add issued_non_pic_error_ field.  Declare check_non_pic.
14987         (Target_sparc::Scan::check_non_pic): New function.
14988         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
14989         (Target_sparc::Scan::global): Likewise.
14990
14991         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
14992         * configure: Rebuild.
14993
14994         * options.h (DEFINE_enable): New macro.
14995         (new_dtags): New enable option.
14996         (initfirst, interpose, loadfltr, nodefaultlib,
14997         nodelete, nodlopen, nodump): New -z options.
14998         * layout.cc (Layout:finish_dynamic_section): If new
14999         dtags enabled, emit DT_RUNPATH.  Also, emit a
15000         DT_FLAGS_1 containing any specified -z flags.
15001
15002 2008-04-16  Ian Lance Taylor  <iant@google.com>
15003
15004         * copy-relocs.cc: New file.
15005         * copy-relocs.h: New file.
15006         * reloc.cc: Remove Copy_relocs code.
15007         * reloc.h: Likewise.
15008         * reloc-types.h (struct Reloc_types) [both versions]: Add
15009         get_reloc_addend_noerror.
15010         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
15011         variants of add_global which take an addend which must be zero.
15012         * i386.cc: Include "copy-relocs.h".
15013         (class Target_i386): Change type of copy_relocs_ to variable,
15014         update initializer.
15015         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
15016         Change all callers.
15017         (Target_i386::do_finalize_sections): Change handling of
15018         copy_relocs_.
15019         * sparc.cc: Include "copy-relocs.h".
15020         (class Target_sparc): Change type of copy_relocs_ to variable,
15021         update initializer.
15022         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
15023         Change all callers.
15024         (Target_sparc::do_finalize_sections): Change handling of
15025         copy_relocs_.
15026         * x86_64.cc: Include "copy-relocs.h".
15027         (class Target_x86_64): Change type of copy_relocs_ to variable,
15028         update initializer.
15029         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
15030         class.  Change all callers.
15031         (Target_x86_64::do_finalize_sections): Change handling of
15032         copy_relocs_.
15033         * Makefile.am (CCFILES): Add copy-relocs.cc.
15034         (HFILES): Add copy-relocs.h.
15035
15036         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
15037
15038         * testsuite/script_test_4.sh: Permit leading zeroes.
15039
15040 2008-04-15  Ian Lance Taylor  <iant@google.com>
15041
15042         * script-sections.cc (Script_sections::create_segments): Use
15043         header_size_adjustment even when there is enough room for the
15044         headers.
15045         * testsuite/script_test_4.sh: New file.
15046         * testsuite/script_test_4.t: New file.
15047         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
15048         (check_DATA): Add script_test_4.stdout.
15049         (MOSTLYCLEANFILES): Likewise.
15050         (script_test_4): New target.
15051         (script_test_4.stdout): New target.
15052         * testsuite/Makefile.in: Rebuild.
15053
15054         * sparc.cc: Add definitions for Output_data_plt_sparc class
15055         constants.
15056
15057 2008-04-14  David S. Miller  <davem@davemloft.net>
15058
15059         * sparc.cc: New file.
15060         * Makefile.am (TARGETSOURCES): Add sparc.cc
15061         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
15062         * configure.tgt: Document targ_extra_size and
15063         targ_extra_big_endian.  Add entries for sparc-* and
15064         sparc64-*.
15065         * configure.ac: Handle targ_extra_size and
15066         targ_extra_big_endian.
15067         * Makefile.in: Rebuild.
15068         * configure: Likewise.
15069         * po/POTFILES.in: Likewise.
15070         * po/gold.pot: Likewise.
15071
15072 2008-04-14  Ian Lance Taylor  <iant@google.com>
15073
15074         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
15075         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
15076         in the name/type/flags to section mapping.  Don't call
15077         allocate_output_section.
15078         (Layout::choose_output_section): Change parameter from adjust_name
15079         to is_input_section.  Don't permit input sections after sections
15080         are attached to segments.  Don't call allocate_output_section.
15081         (Layout::layout_eh_frame): Call update_flags_for_input_section,
15082         not write_enable_output_section.
15083         (Layout::make_output_section): Don't push to
15084         unattached_section_list_ nor call attach_to_segment.  Call
15085         attach_section_to_segment if sections are attached.
15086         (Layout::attach_sections_to_segments): New function.
15087         (Layout::attach_section_to_segment): New function.
15088         (Layout::attach_allocated_section_to_segment): Rename from
15089         attach_to_segment.  Remove flags parameter.
15090         (Layout::allocate_output_section): Remove function.
15091         (Layout::write_enable_output_section): Remove function.
15092         * layout.h (class Layout): Update for above changes.  Add new
15093         field sections_are_attached_.
15094         * output.h (Output_section::update_flags_for_input_section): New
15095         function.
15096         * output.cc (Output_section::add_input_section): Call
15097         update_flags_for_input_section.
15098         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
15099
15100 2008-04-11  Cary Coutant  <ccoutant@google.com>
15101
15102         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
15103         thought unnecessary.
15104         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
15105
15106 2008-04-11  Ian Lance Taylor  <iant@google.com>
15107
15108         * output.h (class Output_section_data): Remove inline definition
15109         of set_addralign.
15110         * output.cc (Output_section_data::set_addralign): New function.
15111
15112 2008-04-11  Cary Coutant  <ccoutant@google.com>
15113
15114         Add support for TLS descriptors for i386 and x86_64.
15115         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
15116         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
15117         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
15118         GOT_TYPE_TLS_DESC.
15119         (Target_i386::got_mod_index_entry): Remove unnecessary code.
15120         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
15121         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
15122         relocations.
15123         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
15124         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
15125         Fix problem with initial-exec relocations.
15126         (Target_i386::Relocate::relocate_tls): Likewise.
15127         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
15128         relaxation.
15129         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
15130         support for section-plus-offset dynamic table entries.
15131         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
15132         (Output_data_dynamic::Dynamic_entry): Add support for
15133         section-plus-offset dynamic table entries.
15134         (Output_data_dynamic::Classification): Likewise.
15135         (Output_data_dynamic::classification_): Renamed offset_.
15136         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
15137         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
15138         (Target_x86_64::make_plt_section): New function.
15139         (Target_x86_64::reserve_tlsdesc_entries): New function.
15140         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
15141         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
15142         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
15143         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
15144         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
15145         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
15146         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
15147         add extra PLT entry for TLS descriptors.
15148         (Output_data_plt_x86_64::got_): New field.
15149         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
15150         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
15151         fields.
15152         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
15153         descriptors.
15154         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
15155         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
15156         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
15157         R_386_TLS_DESC_CALL relocations.
15158         (Target_x86_64::Scan::global): Likewise.
15159         (Target_x86_64::do_finalize_sections): Add dynamic table entries
15160         for TLS descriptors.
15161         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
15162         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
15163         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
15164         GD-to-IE relaxation.
15165         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
15166         and TLS_DESCRIPTORS.
15167         * Makefile.in: Rebuild.
15168         * configure: Rebuild.
15169         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
15170         (tls_test_shared2.so): New target.
15171         (tls_shared_gd_to_ie_test_SOURCES): New variable.
15172         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
15173         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
15174         (tls_shared_gd_to_ie_test_LDADD): New variable.
15175         (tls_shared_gnu2_gd_to_ie_test): New target.
15176         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
15177         New targets.
15178         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
15179         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
15180         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
15181         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
15182         (tls_shared_gnu2_test): New target.
15183         (tls_test_gnu2_shared.so): New target.
15184         (tls_shared_gnu2_test_SOURCES): New variable.
15185         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
15186         (tls_shared_gnu2_test_LDFLAGS): New variable.
15187         (tls_shared_gnu2_test_LDADD): New variable.
15188         * testsuite/Makefile.in: Rebuild.
15189         * testsuite/Makefile.
15190
15191 2008-04-11  Ian Lance Taylor  <iant@google.com>
15192
15193         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
15194         justsyms.t.
15195         * testsuite/Makefile.in: Rebuild.
15196
15197         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
15198         long.
15199         * testsuite/script_test_2.cc (main): Adjust test.
15200
15201 2008-04-11  David S. Miller  <davem@davemloft.net>
15202             Ian Lance Taylor  <iant@google.com>
15203
15204         * options.h (General_options): Add entries for '-Y' and
15205         '-relax'.
15206         * options.cc (General_options:finalize): If -Y was used, add those
15207         entries to the library path instead of the default "/lib" and
15208         "/usr/lib".
15209
15210 2008-04-11  David S. Miller  <davem@davemloft.net>
15211
15212         * testsuite/justsyms.t: Start at 0x100.
15213         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
15214         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
15215         long.
15216         * testsuite/script_test_2.cc: Adjust string and section length
15217         checks.
15218
15219 2008-04-09  Ian Lance Taylor  <iant@google.com>
15220
15221         PR gold/5996
15222         * script-sections.cc (Sections_element::allocate_to_segment): Add
15223         orphan parameter.
15224         (Output_section_definition::allocate_to_segment): Likewise.
15225         (Orphan_output_section::allocate_to_segment): Likewise.
15226         (Script_sections::attach_sections_using_phdrs_clause): Don't
15227         propagate non-PT_LOAD segments to orphan sections.
15228         * testsuite/Makefile.am (script_test_3.stdout): Generate using
15229         readelf rather than objdump.
15230         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
15231         .interp section and PT_INTERP segment are the same size.
15232         * testsuite/Makefile.in: Rebuild.
15233
15234         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
15235         aliases for symbols defined in the same object.
15236         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
15237         (weak_alias_test_SOURCES): New variable.
15238         (weak_alias_test_DEPENDENCIES): New variable.
15239         (weak_alias_test_LDFLAGS): New variable.
15240         (weak_alias_test_LDADD): New variable.
15241         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
15242         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
15243         (weak_alias_test_3.o): New target.
15244         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
15245         * testsuite/weak_alias_test_main.cc: New file.
15246         * testsuite/weak_alias_test_1.cc: New file.
15247         * testsuite/weak_alias_test_2.cc: New file.
15248         * testsuite/weak_alias_test_3.cc: New file.
15249
15250 2008-04-08  Ian Lance Taylor  <iant@google.com>
15251
15252         * options.h (class General_options): Add --noinhibit-exec option.
15253         * main.cc (main): Check --noinhibit-exec.
15254
15255         * options.h (class General_options): Define --wrap as a special
15256         option.  Add wrap_symbols_ field.
15257         (General_options::any_wrap_symbols): New function.
15258         (General_options::is_wrap_symbol): New function.
15259         * options.cc (General_options::parse_wrap): New function.
15260         (General_options::General_options): Initialize wrap_symbols_.
15261         * symtab.cc (Symbol_table::wrap_symbol): New function.
15262         (Symbol_table::add_from_object): Handle --wrap.
15263         * symtab.h (class Symbol_table): Declare wrap_symbol.
15264         * target.h (Target::wrap_char): New function.
15265         (Target::Target_info): Add wrap_char field.
15266         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
15267         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
15268         * testsuite/testfile.cc (Target_test::test_target_info):
15269         Likewise.
15270
15271         * errors.cc (Errors::undefined_symbol): Mention symbol version if
15272         there is one.
15273
15274         * layout.h (class Layout): Add added_eh_frame_data_ field.
15275         * layout.cc (Layout::Layout): Initialize new field.
15276         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
15277         output section until we find a section we merged successfully.
15278         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
15279         that the size be non-zero.
15280
15281         * merge.cc (Object_merge_map::get_output_offset): Remove inline
15282         qualifier.
15283
15284 2008-04-08  Craig Silverstein  <csilvers@google.com>
15285
15286         * configure.ac: Export new conditional variable HAVE_ZLIB.
15287         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
15288         on HAVE_ZLIB.
15289         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
15290         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15291
15292 2008-04-07  Ian Lance Taylor  <iant@google.com>
15293
15294         * version.cc (version_string): Set to "1.5".
15295
15296         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
15297         Add issued_non_pic_error_ field.  Declare check_non_pic.
15298         (Target_x86_64::Scan::check_non_pic): New function.
15299         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
15300         (Target_x86_64::Scan::global): Likewise.
15301
15302         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
15303         addend parameter.  Change caller.  Handle merge sections.
15304         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
15305         Address to Addend.  Don't add in the result of
15306         local_section_offset, pass down the addend and use the returned
15307         value.
15308         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
15309         Update declarations of local_section_offset and symbol_value.
15310         * testsuite/two_file_test_1.cc (t18): New function.
15311         * testsuite/two_file_test_2.cc (f18): New function.
15312         * testsuite/two_file_test_main.cc (main): Call t18.
15313         * testsuite/two_file_test.h (t18, f18): Declare.
15314
15315         * configure.ac: Don't test for objdump, c++filt, or readelf.
15316         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
15317         conditionals.
15318         (TEST_READELF): New variable.
15319         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
15320         (check_PROGRAMS): Add two_file_strip_test.
15321         (two_file_strip_test): New target.
15322         (check_PROGRAMS): Add two_file_same_shared_strip_test.
15323         (two_file_same_shared_strip_test_SOURCES): New variable.
15324         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
15325         (two_file_same_shared_strip_test_LDFLAGS): New variable.
15326         (two_file_same_shared_strip_test_LDADD): New variable.
15327         (two_file_shared_strip.so): New target.
15328         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
15329         (ver_test_5.syms, ver_test_7.syms): Likewise.
15330         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
15331         (strip_test_3.stdout): Use TEST_OBJDUMP.
15332         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15333
15334 2008-04-04  Cary Coutant  <ccoutant@google.com>
15335
15336         * symtab.h (Symbol::is_weak_undefined): New function.
15337         (Symbol::is_strong_undefined): New function.
15338         (Symbol::is_absolute): New function.
15339         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
15340         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
15341         absolute symbols.
15342         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
15343         (weak_undef_test): New target.
15344         * testsuite/Makefile.in: Rebuild.
15345         * testsuite/weak_undef_file1.cc: New file.
15346         * testsuite/weak_undef_file2.cc: New file.
15347         * testsuite/weak_undef_test.cc: New file.
15348
15349 2008-04-03  Craig Silverstein  <csilvers@google.com>
15350
15351         * compressed_output.h (class Output_compressed_section): Use
15352         unsigned buffer.
15353         * compressed_output.cc (zlib_compress): Use unsigned buffers,
15354         add zlib header.
15355         (zlib_compressed_suffix): Removed.
15356         (Output_compressed_section::set_final_data_size): Use unsigned
15357         buffers.
15358         * testsuite/Makefile.am (flagstest_compress_debug_sections):
15359         Fix linker invocation.
15360         (flagstest_o_specialfile_and_compress_debug_sections):
15361         Likewise.
15362         * testsuite/Makefile.in: Regenerated.
15363
15364 2008-04-02  David S. Miller  <davem@davemloft.net>
15365
15366         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
15367         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
15368
15369 2008-04-02  Craig Silverstein  <csilvers@google.com>
15370
15371         * TODO: New file.
15372
15373 2008-04-02  Ian Lance Taylor  <iant@google.com>
15374
15375         * fileread.cc (File_read::find_view): Add byteshift and vshifted
15376         parameters.  Update for new key type to views_.  Change all
15377         callers.
15378         (File_read::read): Adjust for byteshift in returned view.
15379         (File_read::add_view): New function, broken out of
15380         find_and_make_view.
15381         (File_read::make_view): New function, broken out of
15382         find_and_make_view.
15383         (File_read::find_or_make_view): Add offset and aligned
15384         parameters.  Rewrite accordingly.  Change all callers.
15385         (File_read::get_view): Add offset and aligned parameters.  Adjust
15386         for byteshift in return value.
15387         (File_read::get_lasting_view): Likewise.
15388         * fileread.h (class File_read): Update declarations.
15389         (class File_read::View): Add byteshift_ field.  Add byteshift to
15390         constructor.  Add byteshift method.
15391         * archive.h (Archive::clear_uncached_views): New function.
15392         (Archive::get_view): Add aligned parameter.  Change all callers.
15393         * object.h (Object::get_view): Add aligned parameter.  Change all
15394         callers.
15395         (Object::get_lasting_view): Likewise.
15396
15397         * fileread.cc (File_read::release): Don't call clear_views if
15398         there are multiple objects.
15399         * fileread.h (File_read::clear_uncached_views): New function.
15400         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
15401         on the archive.
15402
15403 2008-03-31  Cary Coutant  <ccoutant@google.com>
15404
15405         Add thin archive support.
15406         * archive.cc (Archive::armagt): New const.
15407         (Archive::setup): Remove task parameter and calls to unlock.
15408         (Archive::unlock_nested_archives): New function.
15409         (Archive::read_header): Add nested_off parameter. Change
15410         all callers.
15411         (Archive::interpret_header): Likewise.
15412         (Archive::include_all_members): Change to handle thin
15413         archives.
15414         (Archive::include_member): Likewise.
15415         * archive.h (Archive::Archive): Add new parameters and
15416         initializers.
15417         (Archive::armagt): New const.
15418         (Archive::setup): Remove task parameter.
15419         (Archive::unlock_nested_archives): New function.
15420         (Archive::read_header): Add nested_off parameter.
15421         (Archive::interpret_header): Likewise.
15422         (Archive::Nested_archive_table): New typedef.
15423         (Archive::is_thin_archive_): New field.
15424         (Archive::nested_archives_): New field.
15425         (Archive::options_): New field.
15426         (Archive::dirpath_): New field.
15427         (Archive::task_): New field.
15428         * readsyms.cc (Read_symbols::do_read_symbols): Add check
15429         for thin archives.  Pass additional parameters to
15430         Archive::Archive.  Unlock the archive file after calling
15431         Archive::setup.
15432
15433 2008-03-29  Ian Lance Taylor  <iant@google.com>
15434
15435         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
15436         version symbol to be local.
15437         * testsuite/ver_test_4.sh: New file.
15438         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
15439         (check_DATA): Add ver_test_4.syms.
15440         (ver_test_4.syms): New target.
15441         * testsuite/Makefile.in: Rebuild.
15442
15443         * output.cc
15444         (Output_section::Input_section_sort_entry::has_priority): New
15445         function.
15446         (Output_section::Input_section_sort_entry::match_file_name): New
15447         function.
15448         (Output_section::Input_section_sort_entry::match_section_name):
15449         Remove.
15450         (Output_section::Input_section_sort_entry::match_section_name_prefix):
15451         Remove.
15452         (Output_section::Input_section_sort_entry::match_section_file):
15453         Remove.
15454         (Output_section::Input_section_sort_compare::operator()): Rewrite
15455         using new Input_section_sort_entry functions.  Sort crtbegin and
15456         crtend first.  Sort sections with no priority before sections with
15457         a priority.
15458         * testsuite/initpri1.c (d3): Check j != 4.
15459         (cd5): New constructor/destructor function.
15460         (main): Check j != 2.
15461
15462         * symtab.cc (Symbol_table::add_from_object): If we don't use the
15463         new symbol when resolving, don't call set_is_default.
15464         * testsuite/ver_test_7.cc: New file.
15465         * testsuite/ver_test_7.sh: New file.
15466         * testsuite/Makefile.am (ver_test_7.so): New target.
15467         (ver_test_7.o): New target.
15468         (check_SCRIPTS): Add ver_test_7.sh.
15469         (check_DATA): Add ver_test_7.syms.
15470         (ver_test_7.syms): New target.
15471
15472 2008-03-28  Ian Lance Taylor  <iant@google.com>
15473
15474         * layout.cc (Layout::layout): If we see an input section with a
15475         name that needs sorting, set the must_sort flag for the output
15476         section.
15477         (Layout::make_output_section): If the name of the output section
15478         indicates that it might require sorting, set the may_sort flag.
15479         * output.h (Output_section::may_sort_attached_input_sections): New
15480         function.
15481         (Output_section::set_may_sort_attached_input_sections): New
15482         function.
15483         (Output_section::must_sort_attached_input_sections): New
15484         function.
15485         (Output_section::set_must_sort_attached_input_sections): New
15486         function.
15487         (class Output_section): Declare Input_section_sort_entry.  Define
15488         Input_section_sort_compare.  Declare
15489         sort_attached_input_sections.  Add new fields:
15490         may_sort_attached_input_sections_,
15491         must_sort_attached_input_sections_,
15492         attached_input_sections_are_sorted_.
15493         * output.cc (Output_section::Output_section): Initialize new
15494         fields.
15495         (Output_section::add_input_section): Add an entry to
15496         input_sections_ if may_sort or must_sort are true.
15497         (Output_section::set_final_data_size): Call
15498         sort_attached_input_sections if necessary.
15499         (Output_section::Input_section_sort_entry): Define new class.
15500         (Output_section::Input_section_sort_compare::operator()): New
15501         function.
15502         (Output_section::sort_attached_input_sections): New function.
15503         * configure.ac: Check whether the compiler supports constructor
15504         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
15505         * testsuite/initpri1.c: New file.
15506         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
15507         CONSTRUCTOR_PRIORITY.
15508         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
15509         (initpri1_LDFLAGS): New variable.
15510         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15511
15512 2008-03-27  Ian Lance Taylor  <iant@google.com>
15513
15514         * common.cc (Sort_commons::operator): Correct sorting algorithm.
15515         * testsuite/common_test_1.c: New file.
15516         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
15517         (common_test_1_SOURCES): New variable.
15518         (common_test_1_DEPENDENCIES): New variable.
15519         (common_test_1_LDFLAGS): New variable.
15520
15521         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
15522         and commons_ correctly when NAME/VERSION does not override
15523         NAME/NULL.
15524         * testsuite/ver_test_6.c: New file.
15525         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
15526         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
15527         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
15528
15529 2008-03-26  Ian Lance Taylor  <iant@google.com>
15530
15531         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
15532         of an undefined symbol from a version script.
15533         * testsuite/Makefile.am (ver_test_5.so): New target.
15534         (ver_test_5.o): New target.
15535         (check_SCRIPTS): Add ver_test_5.sh.
15536         (check_DATA): Add ver_test_5.syms.
15537         (ver_test_5.syms): New target.
15538         * testsuite/ver_test_5.cc: New file.
15539         * testsuite/ver_test_5.script: New file.
15540         * testsuite/ver_test_5.sh: New file.
15541         * Makefile.in, testsuite/Makefile.in: Rebuild.
15542
15543         PR gold/5986
15544         Fix problems building gold with gcc 4.3.0.
15545         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
15546         (gold_error_at_location, gold_warning_at_location): Use it.
15547         * configure.ac: Check whether we can compile and use a template
15548         function with a printf attribute.
15549         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
15550         when jumping over bytes.
15551         * object.cc: Instantiate Object::read_section_data.
15552         * debug.h: Include <cstring>
15553         * dwarf_reader.cc: Include <algorithm>
15554         * main.cc: Include <cstring>.
15555         * options.cc: Include <cstring>.
15556         * output.cc: Include <cstring>.
15557         * script.cc: Include <cstring>.
15558         * script.h: Include <string>.
15559         * symtab.cc: Include <cstring> and <algorithm>.
15560         * target-select.cc: Include <cstring>.
15561         * version.cc: Include <string>.
15562         * testsuite/testmain.cc: Include <cstdlib>.
15563         * configure, config.in: Rebuild.
15564
15565 2008-03-25  Ian Lance Taylor  <iant@google.com>
15566
15567         * options.cc: Include "../bfd/bfdver.h".
15568         (options::help): Print bug reporting address.
15569
15570         * version.cc (print_version): Adjust output for current value of
15571         BFD_VERSION_STRING.
15572
15573         * NEWS: New file.
15574
15575         * options.cc (options::help): Print list of supported targets.
15576         * target-select.h: Include <vector>.
15577         (class Target_selector): Make machine_, size_, and is_big_endian_
15578         fields const.  Add bfd_name_ and instantiated_target_ fields.
15579         (Target_selector::Target_selector): Add bfd_name parameter.
15580         (Target_selector::recognize): Make non-virtual, call
15581         do_recognize.
15582         (Target_selector::recognize_by_name): Make non-virtual, call
15583         do_recognize_by_name.
15584         (Target_selector::supported_names): New function.
15585         (Target_selector::bfd_name): New function.
15586         (Target_selector::do_instantiate_target): New pure virtual
15587         function.
15588         (Target_selector::do_recognize): New virtual function.
15589         (Target_selector::do_recognize_by_name): New virtual function.
15590         (Target_selector::instantiate_target): New private function.
15591         (supported_target_names): Declare.
15592         * target-select.cc (Target_selector::Target_selector): Update for
15593         new parameter and fields.
15594         (select_target_by_name): Check that the name matches before
15595         calling recognize_by_name.
15596         (supported_target_names): New function.
15597         * i386.cc (class Target_selector_i386): Update Target_selector
15598         constructor call.  Remove recognize and recognize_by_name.  Add
15599         do_instantiate_target.
15600         * x86_64.cc (class Target_selector_x86_64): Likewise.
15601         * testsuite/testfile.cc (class Target_selector_test): Update for
15602         changes to Target_selector.
15603
15604         * README: Rewrite, with some notes on unsupported features.
15605
15606 2008-03-24  Cary Coutant  <ccoutant@google.com>
15607
15608         * i386.cc (Target_i386::Got_type): New enum declaration.
15609         (Target_i386::Scan::local): Updated callers of Output_data_got
15610         member functions.
15611         (Target_i386::Scan::global): Likewise.
15612         (Target_i386::Relocate::relocate): Likewise.
15613         (Target_i386::Relocate::relocate_tls): Likewise.
15614         * object.h (Got_offset_list): New class.
15615         (Sized_relobj::local_has_got_offset): Added got_type parameter.
15616         (Sized_relobj::local_got_offset): Likewise.
15617         (Sized_relobj::set_local_got_offset): Likewise.
15618         (Sized_relobj::local_has_tls_got_offset): Removed.
15619         (Sized_relobj::local_tls_got_offset): Removed.
15620         (Sized_relobj::set_local_tls_got_offset): Removed.
15621         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
15622         * output.cc (Output_data_got::add_global): Added got_type parameter.
15623         (Output_data_got::add_global_with_rel): Likewise.
15624         (Output_data_got::add_global_with_rela): Likewise.
15625         (Output_data_got::add_global_pair_with_rel): New function.
15626         (Output_data_got::add_global_pair_with_rela): New function.
15627         (Output_data_got::add_local): Added got_type parameter.
15628         (Output_data_got::add_local_with_rel): Likewise.
15629         (Output_data_got::add_local_with_rela): Likewise.
15630         (Output_data_got::add_local_pair_with_rel): New function.
15631         (Output_data_got::add_local_pair_with_rela): New function.
15632         (Output_data_got::add_global_tls): Removed.
15633         (Output_data_got::add_global_tls_with_rel): Removed.
15634         (Output_data_got::add_global_tls_with_rela): Removed.
15635         (Output_data_got::add_local_tls): Removed.
15636         (Output_data_got::add_local_tls_with_rel): Removed.
15637         (Output_data_got::add_local_tls_with_rela): Removed.
15638         * output.h (Output_data_got::add_global): Added got_type parameter.
15639         (Output_data_got::add_global_with_rel): Likewise.
15640         (Output_data_got::add_global_with_rela): Likewise.
15641         (Output_data_got::add_global_pair_with_rel): New function.
15642         (Output_data_got::add_global_pair_with_rela): New function.
15643         (Output_data_got::add_local): Added got_type parameter.
15644         (Output_data_got::add_local_with_rel): Likewise.
15645         (Output_data_got::add_local_with_rela): Likewise.
15646         (Output_data_got::add_local_pair_with_rel): New function.
15647         (Output_data_got::add_local_pair_with_rela): New function.
15648         (Output_data_got::add_global_tls): Removed.
15649         (Output_data_got::add_global_tls_with_rel): Removed.
15650         (Output_data_got::add_global_tls_with_rela): Removed.
15651         (Output_data_got::add_local_tls): Removed.
15652         (Output_data_got::add_local_tls_with_rel): Removed.
15653         (Output_data_got::add_local_tls_with_rela): Removed.
15654         * resolve.cc (Symbol::override_base_with_special): Removed
15655         reference to has_got_offset_ field.
15656         * symtab.cc (Symbol::init_fields): Replaced initialization
15657         of got_offset_ with got_offsets_.  Removed initialization
15658         of has_got_offset_
15659         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
15660         (Symbol::got_offset): Likewise.
15661         (Symbol::set_got_offset): Likewise.
15662         (Symbol::has_tls_got_offset): Removed.
15663         (Symbol::tls_got_offset): Removed.
15664         (Symbol::set_tls_got_offset): Removed.
15665         (Symbol::got_offset_): Removed.
15666         (Symbol::tls_mod_got_offset_): Removed.
15667         (Symbol::tls_pair_got_offset_): Removed.
15668         (Symbol::got_offsets_): New field.
15669         (Symbol::has_got_offset): Removed.
15670         (Symbol::has_tls_mod_got_offset): Removed.
15671         (Symbol::has_tls_pair_got_offset): Removed.
15672         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
15673         (Target_x86_64::Scan::local): Updated callers of Output_data_got
15674         member functions.
15675         (Target_x86_64::Scan::global): Likewise.
15676         (Target_x86_64::Relocate::relocate): Likewise.
15677         (Target_x86_64::Relocate::relocate_tls): Likewise.
15678
15679 2008-03-25  Ben Elliston  <bje@au.ibm.com>
15680
15681         * yyscript.y: Fix spelling error in comment.
15682
15683 2008-03-24  Ian Lance Taylor  <iant@google.com>
15684
15685         * options.h (class General_options): Define build_id option.
15686         * layout.h (class Layout): Declare write_build_id, create_note,
15687         create_build_id.  Add build_id_note_ member.
15688         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
15689         "libiberty.h", "md5.h", "sha1.h".
15690         (Layout::Layout): Initialize eh_frame_data_,
15691         eh_frame_hdr_section_, and build_id_note_.
15692         (Layout::finalize): Call create_build_id.
15693         (Layout::create_note): New function, broken out of
15694         Layout::create_gold_note.
15695         (Layout::create_gold_note): Call create_note.
15696         (Layout::create_build_id): New function.
15697         (Layout::write_build_id): New function.
15698         (Close_task_runner::run): Call write_build_id.
15699
15700         * x86_64.cc: Correct license to GPLv3.
15701
15702 2008-03-23  Ian Lance Taylor  <iant@google.com>
15703
15704         * options.cc: Include "demangle.h".
15705         (parse_optional_string): New function.
15706         (parse_long_option): Handle takes_optional_argument.
15707         (parse_short_option): Update dash_z initializer.  Handle
15708         takes_optional_argument.
15709         (General_options::General_options): Initialize do_demangle_.
15710         (General_options::finalize): Set do_demangle_.  Handle demangling
15711         style.
15712         * options.h (parse_optional_string): Declare.
15713         (struct One_option): Add optional_arg field.  Update constructor.
15714         Update call constructor calls.  Add takes_optional_argument
15715         function.
15716         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
15717         (DEFINE_optional_string): Define.
15718         (General_options::demangle): Change from DEFINE_bool to
15719         DEFINE_optional_string.
15720         (General_options::no_demangle): New function.
15721         (General_options::do_demangle): New function.
15722         (General_options::set_do_demangle): New function.
15723         (General_options::execstack_status_): Move definition to end of
15724         class definition.
15725         (General_options::static_): Likewise.
15726         (General_options::do_demangle_): New field.
15727         * object.cc (big_endian>::get_symbol_location_info): Call
15728         Options::do_demangle, not Options::demangle.
15729         * symtab.cc (demangle): Likewise.
15730
15731 2008-03-22  Ian Lance Taylor  <iant@google.com>
15732
15733         * gold.h: Include <cstddef> and <sys/types.h>
15734         * options.h: Include <cstring>.
15735
15736 2008-03-21  Ian Lance Taylor  <iant@google.com>
15737
15738         * Added source code to GNU binutils.
15739 \f
15740 Copyright (C) 2008-2014 Free Software Foundation, Inc.
15741
15742 Copying and distribution of this file, with or without modification,
15743 are permitted in any medium without royalty provided the copyright
15744 notice and this notice are preserved.
15745
15746 Local Variables:
15747 mode: change-log
15748 left-margin: 8
15749 fill-column: 74
15750 version-control: never
15751 End: