52934f497a40ba15dcc85dbf0f231e6cf9233bab
[external/binutils.git] / gold / ChangeLog
1 2014-05-05  Cary Coutant  <ccoutant@google.com>
2         
3         * gdb-index.cc (Gdb_index_info_reader): Don't complain about language
4         if we have pubnames/pubtypes.
5
6 2014-05-02  Cary Coutant  <ccoutant@google.com>
7
8         * defstd.cc (in_segment): Define __ehdr_start here...
9         * layout.cc (Layout::finalize): ...Instead of here.  Set the
10         output segment when known.
11         * resolve.cc (Symbol::override_base_with_special): Remember
12         the original binding.
13         * symtab.cc (Symbol::set_output_segment): New function.
14         (Symbol::set_undefined): New function.
15         * symtab.h (Symbol::is_weak_undefined): Check original undef
16         binding.
17         (Symbol::is_strong_undefined): New function.
18         (Symbol::set_output_segment): New function.
19         (Symbol::set_undefined): New function.
20         * target-reloc.h (is_strong_undefined): Remove.
21         (issue_undefined_symbol_error): Call Symbol::is_weak_undefined.
22         Check for hidden undefs.
23         (relocate_section): Call Symbol::is_strong_undefined.
24     
25         * testsuite/Makefile.am (ehdr_start_test_1)
26         (ehdr_start_test_2, ehdr_start_test_3)
27         (ehdr_start_test_4, ehdr_start_test_5): New test cases.
28         * testsuite/Makefile.in: Regenerate.
29         * testsuite/ehdr_start_def.cc: New source file.
30         * testsuite/ehdr_start_test.cc: New source file.
31         * testsuite/ehdr_start_test.t: New linker script.
32         * testsuite/ehdr_start_test_4.sh: New shell script.
33
34 2014-04-23  Cary Coutant  <ccoutant@google.com>
35
36         PR gold/16870
37         * x86_64.cc (Target_x86_64::Relocate::relocate): Add missing break.
38
39 2014-04-15  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
40
41         * layout.cc (Layout::include_section): Allow a target to decide
42         whether to include a section.
43         * target.h (Target::should_include_section): New function.
44         (Target::do_should_include_section): New function.
45
46 2014-04-15  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
47
48         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Remove and
49         inline into ...
50         (Copy_relocs::emit): ... here.
51         * copy-relocs.h (Copy_reloc_entry): Change from class to struct.
52         (Copy_reloc_entry::make_copy_reloc): Change from private to protected.
53         (Copy_reloc_entry::entries_): Change from private to protected.
54
55 2014-04-02  Sriraman Tallam  <tmsriram@google.com>
56
57         * icf.cc (get_section_contents): Replace copies of reloc
58         vectors with const references.
59
60 2014-04-02  Cary Coutant  <ccoutant@google.com>
61
62         * configure.ac (HAVE_PUBNAMES): Use C instead of C++.
63         (HAVE_NO_USE_LINKER_PLUGIN): Check for -fno-use-linker-plugin.
64         * configure: Regenerate.
65         * testsuite/Makefile.am (OPT_NO_PLUGINS): New macro for
66         -fno-use-linker-plugin.
67         (LINK1, CXXLINK1): Add it to the link command.
68         * testsuite/Makefile.in: Regenerate.
69
70 2014-03-12  Alan Modra  <amodra@gmail.com>
71
72         * Makefile.in: Regenerate.
73
74 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
75
76         * symtab.h (Symbol::set_nonvis): New function.
77
78 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
79
80         * symtab.cc (Sized_symbol<32>::init_output_data):
81         Instantiate the template.
82         (Sized_symbol<64>::init_output_data): Likewise.
83
84 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
85
86         * symtab.cc (Symbol_table::sized_write_globals): Allow a target to
87         adjust dynamic symbol value.
88         * target.h (Target::adjust_dyn_symbol): New function.
89         (Target::do_adjust_dyn_symbol): New function.
90
91 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
92   
93         * output.cc (Output_data_dynamic::Dynamic_entry::write):
94         Get the value of DYNAMIC_CUSTOM dynamic entry.
95         * output.h (Output_data_dynamic::add_custom): New function.
96         (Dynamic_entry::Dynamic_entry): New constructor for DYNAMIC_CUSTOM
97         dynamic entry.
98         (enum Dynamic_entry::Classification): Add DYNAMIC_CUSTOM.
99         * target.h (Target::dynamic_tag_custom_value): New function.
100         (Target::do_dynamic_tag_custom_value): New function.
101
102 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
103
104         * symtab.cc (Symbol_table::set_dynsym_indexes): Allow a target to set
105         dynsym indexes.
106         * target.h (Target::has_custom_set_dynsym_indexes): New function.
107         (Target::do_has_custom_set_dynsym_indexes): New function.
108         (Target::set_dynsym_indexes): New function.
109         (Target::do_set_dynsym_indexes): New function.
110
111 2014-03-07  Alan Modra  <amodra@gmail.com>
112
113         * powerpc.cc (Powerpc_relocate_functions::Overflow_check): Add
114         CHECK_UNSIGNED, CHECK_LOW_INSN, CHECK_HIGH_INSN.
115         (Powerpc_relocate_functions::has_overflow_unsigned): New function.
116         (Powerpc_relocate_functions::has_overflow_bitfield,
117         overflowed): Use the above.
118         (Target_powerpc::Relocate::relocate): Correct overflow checking
119         for a number of relocations.  Modify overflow test for 16-bit
120         fields in instructions to signed/unsigned according to whether
121         the field takes a signed or unsigned value.
122
123 2014-03-05  Alan Modra  <amodra@gmail.com>
124
125         Update copyright years.
126
127 2014-03-05  Alan Modra  <amodra@gmail.com>
128
129         * powerpc.cc (Target_powerpc::Scan::local, global): Support
130         R_PPC64_ADDR64_LOCAL.
131         (Target_powerpc::Relocate::relocate): Likewise.
132
133 2014-03-03  Alan Modra  <amodra@gmail.com>
134
135         * dwp.cc (print_version): Update copyright year to current.
136
137 2014-02-10  Alan Modra  <amodra@gmail.com>
138
139         * po/gold.pot: Regenerate.
140
141 2014-02-06  Cary Coutant  <ccoutant@google.com>
142
143         Fix problem where -u is ignored when a weak undef is seen.
144
145         * archive.cc (Library_base::should_include_member): Reorder
146         code to check for -u option if a weak undef has already been seen.
147         * testsuite/Makefile.am (weak_undef_test_2): New test case.
148         * testsuite/Makefile.in: Regenerate.
149         * testsuite/weak_undef_file3.cc: New file.
150         * testsuite/weak_undef_file4.cc: New file.
151         * testsuite/weak_undef_test_2.cc: New file.
152
153 2014-02-05  Cary Coutant  <ccoutant@google.com>
154
155         Fix issues with gold undefined symbol diagnostics.
156
157         PR binutils/15435
158         * errors.cc (Errors::undefined_symbol): Move undef vtable symbol
159         check to here.
160         * target-reloc.h (is_strong_undefined): New function.
161         (relocate_section): Move undef vtable symbol check from here.
162         Check for is_strong_undefined.
163
164 2014-02-05  Cary Coutant  <ccoutant@google.com>
165     
166         Fix problems with the --dynamic-list option.
167
168         PR gold/13577
169         * options.cc (General_options::parse_dynamic_list):
170         Set have_dynamic_list_.
171         (General_options::General_options): Initialize have_dynamic_list_.
172         (General_options::finalize): Turn off -Bsymbolic and
173         -Bsymbolic-functions if --dynamic-list provided.
174         * options.h (General_options::have_dynamic_list): New function.
175         (General_options::have_dynamic_list_): New data member.
176         * symtab.h (Symbol::is_preemptible): Handle --dynamic-list
177         correctly.
178    
179         PR gold/16530
180         * symtab.cc (Symbol_table::add_from_relobj): If symbol is named
181         in --dynamic-list, mark it.
182    
183         * testsuite/Makefile.am (gc_dynamic_list_test.sh): New test case.
184         (dynamic_list_2): New test case.
185         * testsuite/Makefile.in: Regenerate.
186         * testsuite/dynamic_list_2.cc: New file.
187         * testsuite/dynamic_list_2.t: New file.
188         * testsuite/dynamic_list_lib1.cc: New file.
189         * testsuite/dynamic_list_lib2.cc: New file.
190         * testsuite/gc_dynamic_list_test.c: New file.
191         * testsuite/gc_dynamic_list_test.sh: New file.
192         * testsuite/gc_dynamic_list_test.t: New file.
193
194 2014-01-28  Cary Coutant  <ccoutant@google.com>
195
196         Add .gdb_index version 7 support.
197
198         * gold/dwarf_reader.cc: include <utility> (for make_pair).
199         (Dwarf_abbrev_table::do_read_abbrevs): Check for compressed
200         debug sections.
201         (Dwarf_ranges_table::read_ranges_table): Likewise.
202         (Dwarf_pubnames_table::read_section): Check for GNU-style
203         sections, and for compressed debug sections.
204         (Dwarf_pubnames_table::read_header): Compute end address of table.
205         (Dwarf_pubnames_table::next_name): Return flag_byte.  Check
206         for end of list by offset, not by offset == 0.
207         (Dwarf_info_reader::do_read_string_table): Check for compressed
208         debug sections.
209         * gold/dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
210         Initialize new data members.
211         (Dwarf_pubnames_table::next_name): return flag_byte.
212         (Dwarf_pubnames_table::end_of_table_): New data member.
213         (Dwarf_pubnames_table::is_gnu_style_): New data member.
214         * gold/gdb-index.cc (gdb_index_version): Update to version 7.
215         (Gdb_index_info_reader::read_pubtable): Read flag_byte.
216         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Don't
217         read skeleton type unit DIEs.
218         (Gdb_index::add_symbol): Add flag_byte; adjust all callers.
219         (Gdb_index::do_write): Write flag_byte.
220         * gold/gdb-index.h (Gdb_index::add_symbol): Add flags parameter.
221         (Gdb_index::Cu_vector): Store flags along with cu indexes.
222         * gold/testsuite/gdb_index_test_3.sh: Allow versions 4-7.
223         * gold/testsuite/gdb_index_test_comm.sh: Likewise.
224
225 2014-01-08  H.J. Lu  <hongjiu.lu@intel.com>
226
227         * version.cc (print_version): Update copyright year to 2014.
228
229 2013-12-19  Dimitry Andric  <dimitry@andric.com>
230
231         * stringpool.cc (Stringpool_template::reserve): Add
232         HAVE_UNORDERED_MAP case.
233         * stringpool.cc (Stringpool_template::print_stats): Likewise.
234
235 2013-12-18  Cary Coutant  <ccoutant@google.com>
236
237         * configure.ac: Check for <unordered_set> and <unordered_map>.
238         * config.in: Regenerate.
239         * configure: Regenerate.
240         * system.h: Use <unordered_set> and <unordered_map> if available.
241
242 2013-12-10  Roland McGrath  <mcgrathr@google.com>
243
244         * Makefile.am (install-exec-local): Prefix $(INSTALL_PROGRAM) uses
245         with $(INSTALL_PROGRAM_ENV).
246         * Makefile.in: Regenerate.
247
248 2013-11-22  Cary Coutant  <ccoutant@google.com>
249
250         * configure.ac: Add check for which library is needed for
251         dlopen.
252         * configure: Regenerate.
253
254 2013-11-22  Cary Coutant  <ccoutant@google.com>
255
256         * testsuite/Makefile.am (exception_x86_64_bnd_test): Use in-tree
257         assembler.
258         * testsuite/Makefile.in: Regenerate.
259
260 2013-11-17  H.J. Lu  <hongjiu.lu@intel.com>
261
262         * x86_64.cc (Target_x86_64<size>::Scan::get_reference_flags):
263         Handle R_X86_64_PC32_BND and R_X86_64_PLT32_BND just like
264         R_X86_64_PC32 and R_X86_64_PLT32, respectively.
265         (Target_x86_64<size>::Scan::local): Likewise.
266         (Target_x86_64<size>::Scan::global): Likewise.
267         (Target_x86_64<size>::Relocate::relocate): Likewise.
268         (Target_x86_64<size>::Relocatable_size_for_reloc::get_size_for_reloc):
269         Likewise.
270         (Target_x86_64<size>::Scan::check_non_pic(): Handle
271         R_X86_64_PC32_BND.
272
273         * testsuite/Makefile.am (check_PROGRAMS): Add
274         exception_x86_64_bnd_test.
275         (exception_x86_64_bnd_test_SOURCES): New macro.
276         (exception_x86_64_bnd_test_DEPENDENCIES): Likewise.
277         (exception_x86_64_bnd_test_LDFLAGS): Likewise.
278         (exception_x86_64_bnd_test_LDADD): Likewise.
279         (exception_x86_64_bnd_1.o): New rule.
280         (exception_x86_64_bnd_2.o): Likewise.
281         * testsuite/Makefile.in: Regenerated.
282
283 2013-11-15  Alan Modra  <amodra@gmail.com>
284
285         * powerpc.cc (Target_powerpc::glink_section): Provide non-const
286         accessor.
287         (Target_powerpc::Branch_info::make_stub): Make global entry stubs.
288         Only call ppc64_local_entry_offset for 64-bit.  Restrict
289         symval_for_branch lookup to ELFv1.
290         (Stub_table::add_plt_call_entry): Use unsigned int off.
291         (Output_data_glink::Address, invalid_address): New.
292         (Output_data_glink::add_eh_frame): Move out of line.  Add
293         support for ELFv2.
294         (Output_data_glink::add_global_entry, find_global_entry,
295         global_entry_address): New functions.
296         (Output_data_glink::global_entry_stubs_, end_branch_table_,
297         ge_size): New variables.
298         (Output_data_glink::set_final_data_size): Add global entry
299         stub sizing.
300         (Output_data_glink::do_write): Write global entry stubs.
301         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Add target
302         parameter.  Return true for ELFv2.  Adjust callers.
303         (Target_powerpc::Scan::local, global): Restrict opd lookup to
304         ELFv1.  Similarly for ifunc and dynamic relocation processing
305         specific to ELFv1.  Recognize that symbols are defined on
306         their plt entries for ELFv2.
307         (Target_powerpc::symval_for_branch): Assert if called for
308         ELFv2 or ppc32.
309         (Target_powerpc::Relocate::relocate): Use global entry plt
310         stub for symbol value if such exists on ELFv2.
311         (Target_powerpc::Relocate::relocate): Don't call
312         symval_for_branch when ELFv2.  Do adjust for local entry
313         offset when ELFv2.
314         (Target_powerpc::do_dynsym_value): Set symbols to global entry
315         plt stub for ELFv2.
316         (Target_powerpc::do_plt_address_for_global): Similarly.
317
318 2013-11-14  Cary Coutant  <ccoutant@google.com>
319
320         Revert patch -- this did not fix the problem, and there is
321         no race there.
322
323         2013-11-14  Cary Coutant  <ccoutant@google.com>
324
325             PR gold/14860
326             * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
327             (Ehframe_hdr::set_final_data_size): Allocate a Lock.
328             * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
329             updating fde_offsets_.
330             (Eh_frame_hdr::lock_): New data member.
331
332 2013-11-14  Cary Coutant  <ccoutant@google.com>
333
334         * dwp.cc (Dwo_file_entry): New type.
335         (File_list): Use Dwo_file_entry.
336         (Dwo_file::verify): New function.
337         (Dwo_file::verify_dwo_list): New function.
338         (Dwo_file::sized_verify_dwo_list): New function.
339         (Dwo_name_info_reader::visit_compilation_unit): Add dwo_id to file
340         list.
341         (Dwp_options): New enum type.
342         (dwp_options): Add --verify-only.
343         (usage): Likewise.
344         (main): Likewise.
345         * dwp.h (gold_info): Add declaration.
346
347 2013-11-14  Cary Coutant  <ccoutant@google.com>
348
349         PR gold/14860
350         * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
351         (Ehframe_hdr::set_final_data_size): Allocate a Lock.
352         * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
353         updating fde_offsets_.
354         (Eh_frame_hdr::lock_): New data member.
355
356 2013-11-06  Cary Coutant  <ccoutant@google.com>
357
358         PR gold/15758
359         * object.cc (Sized_relobj_file::do_layout): Handle .eh_frame sections
360         before reloc sections.
361
362 2013-11-04  Alan Modra  <amodra@gmail.com>
363
364         * symtab.h (Symbol::Reference_flags): Add FUNC_DESC_ABI.
365         (Symbol::needs_dynamic_reloc): Test new flag.
366         * powerpc.cc (needs_dynamic_reloc, use_plt_offset): Delete.
367         (Target_powerpc::Scan::get_reference_flags): Add target param.
368         Return FUNC_DESC_ABI for 64-bit ELFv1.
369         (Target_powerpc::Branch_info::make_stub): Adjust get_reference_flags
370         call.
371         (Target_powerpc::Scan::global): Use Symbol::needs_dynamic_reloc.
372         (Target_powerpc::Relocate::relocate): Use Symbol::use_plt_offset.
373
374 2013-10-31  Cary Coutant  <ccoutant@google.com>
375
376         Restore support for dwp v2 DWARF package file format.
377
378         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
379         tu_length parameter.  Adjust all callers.
380         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
381         * dwp.cc: Include dwarf.h.
382         (Section_bounds): New struct type.
383         (Unit_set): New struct type.
384         (Dwo_file::Dwo_file): Initialize new data member.
385         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
386         Combine and rename to...
387         (Dwo_file::read_unit_index): ...this.
388         (Dwo_file::sized_read_compunit_index)
389         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
390         (Dwo_file::sized_read_unit_index): ...this.
391         (Dwo_file::copy_section): Remove section_name, is_str_offsets
392         parameters; add section_id parameter.
393         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
394         (Dwo_file::add_unit_set): ...this.
395         (Dwo_file::shndx_map_): Remove.
396         (Dwo_file::sect_offsets_): New data member.
397         (Dwp_output_file::Dwp_output_file): Initialize new data members.
398         (Dwp_output_file::add_section): Rename to...
399         (Dwp_output_file::add_contribution): ...this.
400         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
401         (Dwp_output_file::add_tu_set): Likewise.
402         (Dwp_output_file::Contribution): New type.
403         (Dwp_output_file::Section::contributions): New data member.
404         (Dwp_output_file::Cu_or_tu_set): Remove.
405         (Dwp_output_file::Section::Section): New ctor.
406         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
407         (Dwp_output_file::Dwp_index::Section_table): New type.
408         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
409         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
410         parameter.
411         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
412         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
413         (Dwp_output_file::Dwp_index::section_table): New member function.
414         (Dwp_output_file::Dwp_index::section_table_end): New member function.
415         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
416         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
417         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
418         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
419         (Dwp_output_file::Dwp_index::section_table_): New data member.
420         (Dwp_output_file::Dwp_index::section_mask_): New data member.
421         (Dwp_output_file::add_output_section): New member function.
422         (Dwp_output_file::write_new_section): New member function.
423         (Dwp_output_file::write_contributions): New member function.
424         (Dwp_output_file::section_id_map_): New data member.
425         (class Dwo_id_info_reader): Remove.
426         (class Unit_reader): New class.
427         (get_dwarf_section_name): New function.
428         (Dwo_file::read_executable): Adjust initializations of class data.
429         (Dwo_file::read): Add support for v2 package file format.
430         (Dwo_file::read_unit_index): Likewise.
431         (Dwo_file::sized_read_unit_index): Likewise.
432         (Dwo_file::copy_section): Likewise.
433         (Dwo_file::add_unit_set): Likewise.
434         (Dwp_output_file::add_output_section): Likewise.
435         (Dwp_output_file::add_contribution): Likewise.
436         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
437         for empty slot.
438         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
439         file format.
440         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
441         slot.
442         (Dwp_output_file::initialize): Remove unused function.
443         (Dwp_output_file::finalize): Add support for v2 package file format.
444         (Dwp_output_file::write_index): Likewise.
445         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
446         function prototype.
447
448 2013-10-31  Cary Coutant  <ccoutant@google.com>
449
450         * configure.ac: Fix check for -fmerge-constants.
451         * configure.ac: Regenerate.
452
453 2013-10-30  Roland McGrath  <mcgrathr@google.com>
454
455         * x86_64.cc (Output_data_plt_x86_64_nacl::first_plt_entry):
456         Correct 9-byte nop sequence to match what the assembler generates.
457
458 2013-10-30  Alan Modra  <amodra@gmail.com>
459
460         * powerpc.cc (Powerpc_relobj::abiversion, set_abiversion,
461         ppc64_local_entry_offset, ppc64_local_entry_offset,
462         do_read_symbols): New functions.
463         (Powerpc_relobj::e_flags_, st_other_): New vars.
464         (Powerpc_relobj::Powerpc_relobj): Call set_abiversion.
465         (Powerpc_dynobj::abiversion, set_abiversion): New functions.
466         (Powerpc_relobj::e_flags_): New var.
467         (Target_powerpc::first_plt_entry_offset, plt_entry_size): Inline
468         and adjust for ELFv2.
469         (Target_powerpc::abiversion, set_abiversion, stk_toc): New functions.
470         (Powerpc_relobj::do_find_special_sections): Check no .opd in ELFv2.
471         (Powerpc_dynobj::do_find_special_sections): Likewise.
472         (Target_powerpc::do_define_standard_symbols): Define ".TOC.".
473         (Target_powerpc::Branch_info::make_stub): Adjust stub destination
474         to ELFv2 local entry.
475         (Target_powerpc::do_relax): No thread safe barriers needed for
476         ELFv2.
477         (Output_data_plt_powerpc::initial_plt_entry_size_,
478         plt_entry_size): Delete.  Replace all uses with
479         first_plt_entry_offset() and plt_entry_size().
480         (Output_data_plt_powerpc::Output_data_plt_powerpc): Remove
481         reserved_size parm.  Update callers.
482         (Output_data_plt_powerpc::entry_count): Update.
483         (Output_data_plt_powerpc::first_plt_entry_offset): Make private
484         and use Target_powerpc::first_plt_entry_offset().
485         (Output_data_plt_powerpc::get_plt_entry_size): Similarly and
486         rename to plt_entry_size.
487         (Output_data_plt_powerpc::add_ifunc_entry,
488         add_local_ifunc_entry): Adjust reloc for ELFv2.
489         (glink_eh_frame_fde_64): Rename to glink_eh_frame_fde_64v1.
490         (glink_eh_frame_fde_64v2): New.
491         (Stub_table::plt_call_size): Support ELFv2 sizing.
492         (Output_data_glink::add_eh_frame): Use the new FDE.
493         (Output_data_glink::set_final_data_size): Adjust for ELFv2 glink.
494         (Stub_table::do_write): Write ELFv2 stubs and glink.
495         (Target_powerpc::Relocate::relocate): Replaces nop after call
496         with ld 2,24(1) and adjust local offset destination for ELFv2.
497
498 2013-10-30  Alan Modra  <amodra@gmail.com>
499
500         * powerpc.cc (Target_powerpc::Scan::check_non_pic): Handle new relocs.
501         (Target_powerpc::Scan::global, local): Likewise.
502         (Target_powerpc::Relocate::relocate): Likewise.  Check for overflow
503         on all ppc64 @h and @ha relocs.
504
505 2013-10-14  Alan Modra  <amodra@gmail.com>
506
507         * output.h (Output_data_got::add_constant): Tidy.
508         (Output_data_got::add_constant_pair): New function.
509         * powerpc.cc (Output_data_got_powerpc): Override all Output_data_got
510         methods used so as to first call reserve_ent().
511
512 2013-10-11  Roland McGrath  <mcgrathr@google.com>
513
514         * powerpc.cc (Output_data_got_powerpc): Remove unused methods
515         add_got_entry and add_got_entry_pair.
516
517         * configure.ac (TLS_GNU2_DIALECT): Use -Werror in test.
518         (HAVE_PUBNAMES): Likewise.
519         * configure: Regenerate.
520
521         * testsuite/Makefile.am: Replace '-T foo' with '-Wl,-T,foo' throughout.
522         * testsuite/Makefile.in: Regenerate.
523
524         * target.h (Target::adjust_elf_header, Target::do_adjust_elf_header):
525         Remove const from declaration.
526         * target.cc (Sized_target::do_adjust_elf_header): Update definition.
527         * sparc.cc (Target_sparc::do_adjust_elf_header): Likewise.
528         * output.h (Output_file_header): Remove const from member target_
529         and corresponding constructor argument.
530         * output.cc (Output_file_header::Output_file_header): Update prototype.
531         (Output_file_header::do_sized_write): Use this->target_ in place
532         of parameters()->target().
533
534         * testsuite/undef_symbol.cc (Foo::get_a): New method.
535
536         * configure.ac (MERGE_CONSTANTS_FLAG): New check.
537         * configure: Regenerate.
538         * Makefile.in: Regenerate.
539         * testsuite/merge_string_literals_1.c: Renamed to have .cc suffix.
540         * testsuite/merge_string_literals_2.c: Likewise.
541         * testsuite/Makefile.am
542         (merge_string_literals_1.o, merge_string_literals_2.o): Update deps.
543         (AM_CFLAGS, AM_CXXFLAGS): Use $(MERGE_CONSTANTS_FLAG) in place of
544         literal -fmerge-constants.
545         * testsuite/Makefile.in: Regenerate.
546
547         * i386.cc (Target_i386): Remove unused member dynbss_.
548         * arm.cc (Target_arm): Likewise.
549         * powerpc.cc (Target_powerpc): Likewise.
550         * sparc.cc (Target_sparc): Likewise.
551         * tilegx.cc (Target_tilegx): Likewise.
552         * x86_64.cc (Target_x86_64): Likewise.
553         * dwarf_reader.h (Dwarf_info_reader): Remove unused members
554         type_signature_, type_offset_.
555         * plugin.h (Plugin_hook): Remove unused member layout_.
556         * readsyms.h (Add_symbols): Remove unused members dirpath_, dirindex_,
557         mapfile_.
558         (Read_member): Remove unused members input_objects_, symtab_,
559         mapfile_, layout_.
560         (Check_library): Remove unused member symtab_.
561         * archive.h (Lib_group): Remove unused member lib_.
562         * archive.cc (Lib_group::Lib_group): Update initializer.
563         * incremental.h (Incremental_binary): Remove unused member target_.
564         (Incremental_script_entry): Removed unused member script_.
565         * layout.h (Write_symbols_task): Remove unused member input_objects_.
566         * icf.h (Icf): Remove unused member num_tracked_relocs.
567
568         * gold-threads.h (Once): Conditionalize member was_run_lock_ on
569         [ENABLE_THREADS && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4], matching
570         its only use.
571         * gold-threads.cc (Once::Once): Likewise conditionalize initializer.
572
573         * archive.h: Use struct rather than class for forward declaration
574         of Read_symbols_data.
575
576 2013-10-07  Cary Coutant  <ccoutant@google.com>
577
578         PR gold/16010
579         * testsuite/Makefile.am (icf_test): Fix dependencies.
580         (icf_safe_test): Likewise.
581         (icf_safe_so_test): Likewise.
582         (large_symbol_alignment): Add empty _LDADD rule.
583         * testsuite/Makefile.in: Regenerate.
584
585 2013-09-03  Pavel Chupin  <pavel.v.chupin@intel.com>
586
587         PR gold/15927
588         * x86_64.cc (Target_x86_64<size>::Scan::global): Use relative
589         relocation for R_X86_64_32 on x32.
590
591 2013-08-27  Roland McGrath  <mcgrathr@google.com>
592
593         * output.cc (Output_segment::set_section_addresses): Take new
594         Target* argument.  If target->isolate_execinstr() and the segment
595         is executable and starts at a target->abi_pagesize() boundary,
596         pad its end out to a target->abi_pagesize() boundary with code fill.
597         * output.h (Output_segment::set_section_addresses): Update decl.
598         * layout.h (Layout::check_output_data_for_reset_values): Take new
599         argument RELAX_OUTPUTS.
600         (Layout): New member relax_output_list_.
601         (Layout::add_relax_output): New method.
602         * layout.cc (Layout::Layout): Update constructor.
603         (Layout::reset_relax_output): New method.
604         (Layout::clean_up_after_relaxation): Call it.
605         (Layout::prepare_for_relaxation): Update caller.
606         (Layout::set_segment_offsets): Update callers of set_section_addresses.
607         Call reset_relax_output before re-processing segments for
608         isolate_execinstr case.
609         (Layout::write_data): Handle relax_output_list_.
610         (Layout::Relaxation_debug_check::check_output_data_for_reset_values):
611         Take new argument RELAX_OUTPUTS.  Assert it's an empty collection.
612
613 2013-08-23  Yuri Chornoivan  <yurchor@ukr.net>
614
615         PR binutils/15834
616         * object.h: Fix typos.
617
618 2013-08-16  Roland McGrath  <mcgrathr@google.com>
619
620         * i386.cc (Target_i386_nacl::do_code_fill): New virtual function.
621         * x86_64.cc (Target_x86_64_nacl::do_code_fill): New virtual function.
622
623 2013-08-07  Cary Coutant  <ccoutant@google.com>
624
625         Revert support for v2 DWP files:
626
627         2013-03-01  Cary Coutant  <ccoutant@google.com>
628
629             Add dwp support for v2 DWARF package file format.
630             * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
631             tu_length parameter.  Adjust all callers.
632             * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
633             * dwp.cc: Include dwarf.h.
634             (Section_bounds): New struct type.
635             (Unit_set): New struct type.
636             (Dwo_file::Dwo_file): Initialize new data member.
637             (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
638             Combine and rename to...
639             (Dwo_file::read_unit_index): ...this.
640             (Dwo_file::sized_read_compunit_index)
641             (Dwo_file::sized_read_typeunit_index): Combine and rename to...
642             (Dwo_file::sized_read_unit_index): ...this.
643             (Dwo_file::copy_section): Remove section_name, is_str_offsets
644             parameters; add section_id parameter.
645             (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
646             (Dwo_file::add_unit_set): ...this.
647             (Dwo_file::shndx_map_): Remove.
648             (Dwo_file::sect_offsets_): New data member.
649             (Dwp_output_file::Dwp_output_file): Initialize new data members.
650             (Dwp_output_file::add_section): Rename to...
651             (Dwp_output_file::add_contribution): ...this.
652             (Dwp_output_file::add_cu_set): Combine parameters into a struct.
653             (Dwp_output_file::add_tu_set): Likewise.
654             (Dwp_output_file::Contribution): New type.
655             (Dwp_output_file::Section::contributions): New data member.
656             (Dwp_output_file::Cu_or_tu_set): Remove.
657             (Dwp_output_file::Section::Section): New ctor.
658             (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
659             (Dwp_output_file::Dwp_index::Section_table): New type.
660             (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
661             (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
662             parameter.
663             (Dwp_output_file::Dwp_index::shndx_pool): Remove.
664             (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
665             (Dwp_output_file::Dwp_index::section_table): New member function.
666             (Dwp_output_file::Dwp_index::section_table_end): New member function.
667             (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
668             (Dwp_output_file::Dwp_index::section_table_rows): New member function.
669             (Dwp_output_file::Dwp_index::section_table_cols): New member function.
670             (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
671             (Dwp_output_file::Dwp_index::section_table_): New data member.
672             (Dwp_output_file::Dwp_index::section_mask_): New data member.
673             (Dwp_output_file::add_output_section): New member function.
674             (Dwp_output_file::write_new_section): New member function.
675             (Dwp_output_file::write_contributions): New member function.
676             (Dwp_output_file::section_id_map_): New data member.
677             (class Dwo_id_info_reader): Remove.
678             (class Unit_reader): New class.
679             (get_dwarf_section_name): New function.
680             (Dwo_file::read_executable): Adjust initializations of class data.
681             (Dwo_file::read): Add support for v2 package file format.
682             (Dwo_file::read_unit_index): Likewise.
683             (Dwo_file::sized_read_unit_index): Likewise.
684             (Dwo_file::copy_section): Likewise.
685             (Dwo_file::add_unit_set): Likewise.
686             (Dwp_output_file::add_output_section): Likewise.
687             (Dwp_output_file::add_contribution): Likewise.
688             (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
689             for empty slot.
690             (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
691             file format.
692             (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
693             slot.
694             (Dwp_output_file::initialize): Remove unused function.
695             (Dwp_output_file::finalize): Add support for v2 package file format.
696             (Dwp_output_file::write_index): Likewise.
697             * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
698             function prototype.
699
700 2013-07-31  Cary Coutant  <ccoutant@google.com>
701
702         * object.cc (Sized_relobj::do_output_section_address): New function.
703         (Sized_relobj): Instantiate explicitly.
704         * object.h (Object::output_section_address): New function.
705         (Object::do_output_section_address): New function.
706         (Sized_relobj::do_output_section_address): New function.
707         * powerpc.cc (Target_powerpc::symval_for_branch): Use it.
708
709 2013-07-30  Cary Coutant  <ccoutant@google.com>
710             Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
711
712         * parameters.cc (Parameters::entry): Return target-specific entry
713         symbol name.
714         * target.h (Target::entry_symbol_name): New function.
715         (Target_info::entry_symbol_name): New data member.
716
717         * arm.cc (Target_arm::arm_info): Add entry_symbol_name.
718         * i386.cc (Target_i386::i386_info): Likewise.
719         (Target_i386_nacl::i386_nacl_info): Likewise.
720         * sparc.cc (Target_sparc::sparc_info): Likewise.
721         * tilegx.cc (Target_tilegx::tilegx_info): Likewise.
722         * x86_64.cc: (Target_x86_64::x86_64_info) Likewise.
723         (Target_x86_64_nacl::x86_64_nacl_info) Likewise.
724         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
725
726 2013-07-22  Sterling Augustine  <saugustine@google.com>
727
728         * dwarf_reader.cc (Dwarf_pubnames_table::read_section):
729         Convert parameter shndx to local variable. Add parameters symtab
730         and symtab_size.  Scan over section names.  Find relocation
731         section corresponding to current section.  Create and initialize
732         reloc_mapper_ and reloc_type_.
733         (Dwarf_pubnames_table::read_header):  Add assertion.  Change
734         unit_length to off_t.  Initialize member unit_length_.  Fill in field
735         cu_offset_.
736         * dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
737         Initialize new fields unit_length_ and cu_offset_.
738         (Dwarf_pubnames_table::read_section): Update prototype.
739         (Dwarf_pubnames_table::cu_offset): New member function.
740         (Dwarf_pubnames_table::subsection_size): Likewise.
741         (Dwarf_pubnames_table::cu_offset_, Dwarf_pubnames_table::unit_length):
742         New fields.
743         (Dwarf_info_reader::symtab, Dwarf_info_reader::symtab_size): Make
744         member functions public.
745         * gdb_index.cc (Gdb_index_info_reader::read_pubnames_and_pubtypes):
746         Update comment.  Rework logic.  Move repeated parts to...
747         (Gdb_index_info_reader::read_pubtable): ...here. New function.
748         (Gdb_index::Gdb_index): Initialize new fields, pubnames_table_,
749         pubtypes_table_, and stmt_list_offset.
750         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
751         Gdb_index::find_pubtype_offset,
752         Gdb_index::map_pubnames_and_types_to_dies): Define new functions.
753         (Gdb_index::pubnames_read): Update prototype and rework logic.
754         * gdb_index.h (Gdb_index_info_reader, Dwarf_pubnames_table):
755         Forward declare.
756         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
757         Gdb_index::find_pubtype_offset, Gdb_index::pubnames_table)
758         Gdb_index::pubtypes_table, Gdb_index::map_pubnames_and_types_to_dies,
759         Gdb_index::map_pubtable_to_dies):
760         Declare functions.
761         (Gdb_index::pubnames_read): Update declaration.
762         (Gdb_index::Pubname_offset_map): New type.
763         (Gdb_index::cu_pubname_map_, Gdb_index::cu_pubtype_map_,
764         Gdb_index::pubnames_table_, Gdb_index::pubtypes_table_,
765         Gdb_index::stmt_list_offset): Declare.
766         (Gdb_index::pubnames_shndx_, Gdb_index::pubnames_offet_,
767         Gdb_index::pubtypes_object_, Gdb_index::pubtypes_shndx_)
768         Gdb_index::pubtypes_offset_): Remove.
769
770 2013-07-19  Roland McGrath  <mcgrathr@google.com>
771
772         * options.h (General_options): Add -Trodata-segment option.
773         * parameters.cc (Parameters::check_rodata_segment): New function.
774         (Parameters::set_target_once): Call it.
775         * parameters.h (Parameters): Declare it (private member function).
776         * layout.cc (load_seg_unusable_for_headers): New function, broken
777         out of Layout::relaxation_loop_body.  If TARGET->isolate_execinstr()
778         then validate rodata segment rather than text segment.
779         (relaxation_loop_body): Call that.
780         (is_text_segment): New function.  Don't admit a non-executable
781         segment if TARGET->isolate_execinstr().
782         (set_segment_offsets): Call it.  Honor -Trodata-segment option.
783
784 2013-07-15  Shawn Landden  <shawnlandden@gmail.com>
785
786         PR gold/15070
787         * fileread.h (File_read::get_view): Clarify comment about ALIGNED.
788         * nacl.h (Sniff_file::View::View): Request aligned view.
789
790 2013-07-11  Cary Coutant  <ccoutant@google.com>
791
792         * powerpc.cc (Target_powerpc::write_branch_lookup_table): Use
793         correct BRLT entry size.
794
795 2013-07-03  Alan Modra  <amodra@gmail.com>
796
797         * powerpc.cc (Target_powerpc::Relocate::relocate): Update self-call
798         comment.
799
800 2013-07-01  Cary Coutant  <ccoutant@google.com>
801
802         * dwarf_reader.cc (Dwarf_ranges_table::read_ranges_table): Save
803         reloc_type_.
804         (Dwarf_ranges_table::read_range_list): Call lookup_reloc.
805         (Dwarf_ranges_table::lookup_reloc): New function.
806         * dwarf_reader.h (Dwarf_ranges_table::Dwarf_ranges_table): Initialize
807         reloc_type_.
808         (Dwarf_ranges_table::lookup_reloc): New function.
809         (Dwarf_ranges_table::reloc_type_): New data member.
810
811 2013-06-27  Jing Yu  <jingyu@google.com>
812
813         PR gold/15662
814         * powerpc.cc (Output_data_brlt_powerpc::reset_brlt_sizes): New
815         function.
816         (Output_data_brlt_powerpc::finalize_brlt_sizes): New function.
817         (Target_powerpc::do_relax): Call the above.
818
819 2013-06-27  Cary Coutant  <ccoutant@google.com>
820
821         * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
822         on garbage collected .opd section.
823
824 2013-06-27  Alan Modra  <amodra@gmail.com>
825
826         * powerpc.cc (Target_powerpc::do_gc_add_reference): Test dst_shndx
827         is non-zero.
828         (Target_powerpc::do_gc_mark_symbols): Likewise for sym->shndx().
829         (Target_powerpc::do_function_location): Likewise for loc->shndx.
830
831 2013-06-14  Cary Coutant  <ccoutant@google.com>
832
833         * resolve.cc (Symbol::override_base): Don't override st_type
834         from plugin placeholder symbols.
835         (Symbol_table::resolve): Likewise.
836         (Symbol_table::should_override): Don't complain about TLS mismatch
837         if the TO symbol is a plugin placeholder.
838         * testsuite/Makefile.am (plugin_test_tls): New test.
839         * testsuite/Makefile.in: Regenerate.
840         * testsuite/plugin_test_tls.sh: New test script.
841         * testsuite/two_file_test_2_tls.cc: New test source.
842         * testsuite/two_file_test_tls.cc: New test source.
843
844 2013-06-05  Alexander Ivchenko  <alexander.ivchenko@intel.com>
845
846         * layout.cc (Layout::set_segment_offsets): Taking care of the case when
847         the maximum segment alignment is larger than the page size.
848         * testsuite/Makefile.am (large_symbol_alignment): Test that Gold
849         correctly aligns the symbols with large alignemnt.
850         * testsuite/Makefile.in: Regenerate.
851         * testsuite/large_symbol_alignment.cc: New file.
852
853 2013-05-30  Alexander Ivchenko  <alexander.ivchenko@intel.com>
854             Sriraman Tallam  <tmsriram@google.com>
855
856         * options.h (sort_section): New option.
857         * output.h (Input_section_sort_section_prefix_special_ordering_compare):
858         Rename from Input_section_sort_section_name_special_ordering_compare.
859         (Input_section_sort_section_name_compare): New struct.
860         * output.cc (Output_section::Input_section_sort_section_name_compare::
861         operator()): New function.
862         (Output_section::sort_attached_input_sections): Use new sort function
863         for .text if --sort-section=name is specified.
864         * layout.cc (Layout::make_output_section):
865         Add sorting by name when --sort-section=name is specified.
866         * testsuite/Makefile.am (text_section_grouping): Test option
867         --sort-section=name.
868         * testsuite/Makefile.in: Regenerate.
869         * testsuite/section_sorting_name.cc: New file.
870         * testsuite/section_sorting_name.sh: New file.
871
872 2013-05-21  Cary Coutant  <ccoutant@google.com>
873
874         * symtab.h (Symbol::is_cxx_vtable): New function.
875         * target-reloc.h (relocate_section): Check for vtable symbol.
876         * testsuite/Makefile.am (missing_key_func.sh): New test case.
877         * testsuite/Makefile.in: Regenerate.
878         * testsuite/missing_key_func.cc: New test source.
879         * testsuite/missing_key_func.sh: New test script.
880
881 2013-05-21  Cary Coutant  <ccoutant@google.com>
882
883         * object.cc (Sized_relobj_file::get_symbol_location_info): Set
884         type of enclosing symbol.
885         (Relocate_info::location): Check symbol type when describing symbol.
886         * object.h (Symbol_location_info): Remove unused line_number;
887         add enclosing_symbol_type.
888         * testsuite/debug_msg.sh: Adjust expected output.
889
890 2013-05-13  Cary Coutant  <ccoutant@google.com>
891
892         * configure.ac: Export DEFAULT_TARGET.
893         * configure: Regenerate.
894         * Makefile.in: Regenerate.
895         * testsuite/Makefile.am: Add .EXPORT_ALL_VARIABLES.
896         * testsuite/Makefile.in: Regenerate.
897         * testsuite/debug_msg.sh: Delete duplicate tests.
898         Don't check undef_int error message match for powerpc where the
899         source file and line number aren't available.
900
901 2013-05-10  Roland McGrath  <mcgrathr@google.com>
902
903         * options.h (General_options): Add --rosegment-gap option.
904         * options.cc (finalize): --rosegment-gap implies --rosegment.
905         * layout.cc (set_segment_offsets): Let user option override
906         target->rosegment_gap().
907
908 2013-05-10  Roland McGrath  <mcgrathr@google.com>
909
910         * options.h (General_options): Remove leading space from help
911         messages for -nostdlib and --rosegment.
912
913 2013-05-03  Maciej W. Rozycki  <macro@codesourcery.com>
914
915         PR ld/15365
916         * layout.cc (Layout::finalize): Make __ehdr_start STV_HIDDEN.
917
918 2013-05-03  Alan Modra  <amodra@gmail.com>
919
920         * merge.cc (Output_merge_string::do_add_input_section): Correct
921         scan for number of strings.  Rename vars to avoid shadowing.
922         Include missing terminator in input_size_.
923
924 2013-05-01  H.J. Lu  <hongjiu.lu@intel.com>
925
926         * merge.cc (Output_merge_string<Char_type>::do_add_input_section):
927         Restore empty string handling.
928
929 2013-05-01  Cary Coutant  <ccoutant@google.com>
930
931         * stringpool.cc (Stringpool_template::new_key_offset): Fix
932         uninitialized warning.
933
934 2013-04-29  Alexander Ivchenko  <alexander.ivchenko@intel.com>
935
936         * output.cc (Output_section::add_merge_input_section): Allow
937         to merge sections if the alignment is more than character size.
938         * merge.h (Output_merge_string::Output_merge_string): Remove
939         assert.
940         * merge.cc (Output_merge_string<Char_type>::do_add_input_section): Count
941         only not-null strings. Check the alignment of strings.
942         * stringpool.h
943         (Stringpool_template<Stringpool_char>::Stringpool_template): Add
944         alignment as the argument.
945         (Stringpool_template<Stringpool_char>::addralign_): New class member.
946         * stringpool.cc (Stringpool_template<Stringpool_char>::new_key_offset):
947         Align non-zero length strings according to the addralign_.
948         (Stringpool_template<Stringpool_char>::set_string_offsets):
949         Updating offsets according to the given alignment.
950         * testsuite/Makefile.am (text_section_grouping): Test if string
951         literals are getting merged.
952         * testsuite/Makefile.in: Regenerate.
953         * testsuite/merge_string_literals_1.c: New file.
954         * testsuite/merge_string_literals_2.c: Ditto.
955         * testsuite/merge_string_literals.sh: Ditto.
956
957 2013-04-26  Ian Lance Taylor  <iant@google.com>
958
959         * target-reloc.h (relocate_section): If the reloc offset is out of
960         range, pass VIEW as NULL to relocate.relocate.
961         * arm.cc (Target_arm:Relocate::relocate): Check for a NULL view.
962         * i386.cc (Target_i386::Relocate::relocate): Likewise.
963         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
964         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
965         * tilegx.cc (Target_tilegx::Relocate::relocate): Likewise.
966         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
967
968 2013-04-26  Geoff Pike  <gpike@chromium.org>
969
970         * gold.cc (queue_final_tasks): invoke layout->queue_build_id_tasks().
971         * layout.cc (Hash_task): New class.
972         (Layout::queue_build_id_tasks): New function.
973         (Layout::write_build_id): Handle single-thread portion of build ID
974         computation.  (In some cases, all of it is single-threaded.)  Replace
975         {sha1,md5}_process_bytes with {sha1,md5}_buffer to get the same
976         functionality in fewer lines of code.
977         * layout.h (Layout::queue_build_id_tasks): New function declaration.
978         * options.h (General_options): make "--build-id" default to tree
979         rather than sha1.  Add two new options related to --build-id=tree:
980         --build-id-chunk-size-for-treehash and
981         --build-id-min-file-size-for-treehash.
982         * Makefile.am: add testing of --build-id=tree and related new options
983         (these tests will be invoked by "make check").
984         * Makefile.in: Regenerate.
985
986 2013-04-25  Alan Modra  <amodra@gmail.com>
987
988         * configure.tgt: Add powerpcle and powerpc64le.
989
990 2013-04-22  Alan Modra  <amodra@gmail.com>
991
992         PR gold/15355
993         * layout.cc (Layout::segment_precedes): Allow more than one
994         segment with the same type and flags.
995
996 2013-04-15  Cary Coutant  <ccoutant@google.com>
997
998         * layout.cc (Layout::set_relocatable_section_offsets): Don't
999         allocate space in file for BSS sections.
1000
1001 2013-04-15  Cary Coutant  <ccoutant@google.com>
1002
1003         * script-sections.cc (Orphan_output_section): Reset address
1004         to zero after each orphaned section for relocatable links.
1005
1006 2013-04-15  Cary Coutant  <ccoutant@google.com>
1007
1008         * symtab.cc (Symbol_table::sized_write_globals): Subtract
1009         section starting address for relocatable link.
1010         * testsuite/Makefile.am (script_test_11): New test.
1011         * testsuite/Makefile.in: Regenerate.
1012         * testsuite/script_test_11.c: New source file.
1013         * testsuite/script_test_11.t: New linker script.
1014
1015 2013-04-13  Alan Modra  <amodra@gmail.com>
1016
1017         * powerpc.cc (Stub_control::can_add_to_stub_group): Don't set
1018         owner when sections are not adjacent and exceed group size.
1019         (Target_powerpc::group_sections): Handle corner case.
1020         (Target_powerpc::Branch_info::make_stub): Handle case where
1021         stub table doesn't exist due to branches in non-exec sections.
1022         (Target_powerpc::Relocate::relocate): Likewise.
1023
1024 2013-04-11  Alan Modra  <amodra@gmail.com>
1025
1026         PR gold/15354
1027         * powerpc.cc (Target_powerpc::make_brlt_section): Name section
1028         .branch_lt to match bfd ld.  Adjust comments throughout file.
1029
1030 2013-04-04  Ian Lance Taylor  <iant@google.com>
1031
1032         GCC PR c++/56840
1033         * object.cc (do_layout_deferred_sections): Handle .eh_frame
1034         sections before checking whether they are included in the link.
1035
1036 2013-03-29  Sriraman Tallam  <tmsriram@google.com>
1037
1038         * archive.cc (Archive::get_elf_object_for_member):  Create the elf
1039         object before calling the plugin claim_file handler.  Pass the elf
1040         object of the archive to the plugin. Delete the elf object if the
1041         plugin claims the file.
1042
1043 2013-03-21  Alan Modra  <amodra@gmail.com>
1044
1045         * layout.cc (Layout::set_segment_offsets): Accept writable .text
1046         segment when omagic.
1047
1048 2013-03-21  Alan Modra  <amodra@gmail.com>
1049
1050         * dwp.cc (Dwp_output_file::add_contribution): Avoid signed/unsigned
1051         comparison warning.
1052         * layout.cc (Layout::create_dynamic_symtab): Avoid "may be used
1053         uninitialized" warning.
1054
1055 2013-03-20  Alan Modra  <amodra@gmail.com>
1056
1057         * symtab.h (Symbol::clear_version): New function.
1058         * symtab.cc (Symbol_table::set_dynsym_indexes): Don't set object
1059         is_needed by weak references.  Clear version for symbols defined
1060         in as-needed objects that are not needed.
1061
1062 2013-03-15  Alan Modra  <amodra@gmail.com>
1063
1064         * powerpc.cc (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Make
1065         static and public.  Add report_err param.  Return false for data refs.
1066         (Target_powerpc::rela_dyn_section): New overloaded function.
1067         (Target_powerpc::plt_, iplt_): Elucidate.
1068         (Output_data_plt_powerpc::entry_count): Handle current_data_size()==0.
1069         (Output_data_plt_powerpc::do_write): Don't write .iplt.
1070         (Output_data_plt_powerpc::plt_entry_count): Don't add .iplt entries.
1071         (Target_powerpc::Scan::local, global): Adjust reloc_needs_plt_for_ifunc
1072         calls.  Put ifunc dynamic relocs in irela_dyn_section.  Only
1073         push_branch and make_plt_entry for ifunc syms when
1074         reloc_needs_plt_for_ifunc.
1075         (Target_powerpc::Relocate::relocate): Don't use plt entry value
1076         for ifunc unless reloc_needs_plt_for_ifunc.
1077
1078 2013-03-15  Alan Modra  <amodra@gmail.com>
1079
1080         * gc.h (gc_process_relocs): Don't look through function descriptors.
1081         * icf.cc (get_section_contents): Do so here instead.
1082
1083 2013-03-13  Alan Modra  <amodra@gmail.com>
1084
1085         * powerpc.cc (is_branch_reloc): Forward declare.
1086         (Target_powerpc::do_can_check_for_function_pointers): New predicate.
1087         (Target_powerpc::Scan::local_reloc_may_be_function_pointer): Return
1088         false for 64-bit, true for 32-bit non-branch relocs.
1089         (Target_powerpc::Scan::global_reloc_may_be_function_pointer): Likewise.
1090         * testsuite/Makefile.am (icf_test): Use linker map file instead of
1091         nm output.
1092         (icf_safe_test): Generate linker map file as well as nm output.
1093         (icf_safe_so_test): Likewise.
1094         * testsuite/Makefile.in: Regenerate.
1095         * testsuite/icf_test.sh: Parse linker map file to determine
1096         section folding.
1097         * testsuite/icf_safe_test.sh: Likewise.  Expect folding for PowerPC.
1098         * testsuite/icf_safe_so_test.sh: Likewise.
1099         (X86_32_or_ARM_specific_safe_fold): Merge into..
1100         (arch_specific_safe_fold): ..this.
1101         (X86_64_specific_safe_fold): Delete unused function.
1102
1103 2013-03-12  Alan Modra  <amodra@gmail.com>
1104
1105         * gc.h (gc_process_relocs): Look through function descriptors
1106         to determine shndx, symvalue and addend used by ICF.  Tidy
1107         variable duplication.
1108
1109 2013-03-11  Alan Modra  <amodra@gmail.com>
1110
1111         * gold.cc (queue_middle_tasks): Move detect_odr_violations..
1112         * layout.cc (Layout_task_runner::run): ..to here.
1113         * symtab.h (struct Symbol_location): Extract from..
1114         (class Symbol_table): ..here.
1115         * symtab.cc (Symbol_table::linenos_from_loc): Invoke function_location.
1116         * target.h (class Target): Add function_location and
1117         do_function_location functions.
1118         (class Sized_target): Add do_function_location.
1119         * object.h (class Sized_relobj_file): Move find_shdr..
1120         (class Object): ..to here.
1121         * object.cc: Likewise.  Update to suit.  Instantiate.
1122         (Sized_relobj_file::find_eh_frame): Update find_shdr call.
1123         * powerpc.cc (class Powerpc_dynobj): New.
1124         (Target_powerpc::do_function_location): New function.
1125         (Powerpc_relobj::do_find_special_sections): Update find_shdr call.
1126         (Powerpc_dynobj::do_read_symbols): New function.
1127         (Target_powerpc::do_make_elf_object): Make a Powerpc_dynobj.
1128
1129 2013-03-08  Ian Lance Taylor  <iant@google.com>
1130
1131         * options.cc (General_options::string_to_object_format): Accept
1132         "default".
1133
1134 2013-03-08  Alan Modra  <amodra@gmail.com>
1135
1136         * ehframe.h (Post_fdes) Make it a vector of Post_fde rather than
1137         pointer to Post_fde.
1138         (struct Post_fde): Move definition to here..
1139         * ehframe.cc (struct Post_fde): ..from here.
1140         (Cie::write): Don't alloc Post_fde.
1141         (Eh_frame::do_sized_write): Update.  Don't free Post_fde.
1142
1143 2013-03-07  Alan Modra  <amodra@gmail.com>
1144
1145         * testsuite/discard_locals_relocatable_test.c: Add a powerpc
1146         relocation referencing .LC0.
1147         * testsuite/discard_locals_test.sh: Remove FIXMEs.
1148
1149 2013-03-07  Alan Modra  <amodra@gmail.com>
1150
1151         * testsuite/ifunc-sel.h (ifunc_sel, ifunc_one): Mark
1152         always_inline.  Add assembly for powerpc to avoid GOT.
1153
1154 2013-03-07  Alan Modra  <amodra@gmail.com>
1155
1156         * testsuite/script_test_10.sh: Don't test .bss section
1157         header number.
1158
1159 2013-03-06  Alan Modra  <amodra@gmail.com>
1160
1161         * powerpc.cc (class Powerpc_relobj): Move some member functions.
1162         (Target_powerpc::symval_for_branch):  Add symtab param.  Update
1163         all callers.  Handle folded sections.
1164         (Target_powerpc::do_gc_add_reference): Don't cast dynamic object
1165         to Powerpc_relobj.
1166         (Global_symbol_visitor_opd::operator()): Likewise.
1167
1168 2013-03-04  Alan Modra  <amodra@gmail.com>
1169
1170         * testsuite/Makefile.am (final_layout_script.lds): Add .sbss.
1171         * testsuite/Makefile.in: Regenerate.
1172
1173 2013-03-01  Cary Coutant  <ccoutant@google.com>
1174
1175         Add dwp support for v2 DWARF package file format.
1176         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
1177         tu_length parameter.  Adjust all callers.
1178         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
1179         * dwp.cc: Include dwarf.h.
1180         (Section_bounds): New struct type.
1181         (Unit_set): New struct type.
1182         (Dwo_file::Dwo_file): Initialize new data member.
1183         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
1184         Combine and rename to...
1185         (Dwo_file::read_unit_index): ...this.
1186         (Dwo_file::sized_read_compunit_index)
1187         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
1188         (Dwo_file::sized_read_unit_index): ...this.
1189         (Dwo_file::copy_section): Remove section_name, is_str_offsets
1190         parameters; add section_id parameter.
1191         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
1192         (Dwo_file::add_unit_set): ...this.
1193         (Dwo_file::shndx_map_): Remove.
1194         (Dwo_file::sect_offsets_): New data member.
1195         (Dwp_output_file::Dwp_output_file): Initialize new data members.
1196         (Dwp_output_file::add_section): Rename to...
1197         (Dwp_output_file::add_contribution): ...this.
1198         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
1199         (Dwp_output_file::add_tu_set): Likewise.
1200         (Dwp_output_file::Contribution): New type.
1201         (Dwp_output_file::Section::contributions): New data member.
1202         (Dwp_output_file::Cu_or_tu_set): Remove.
1203         (Dwp_output_file::Section::Section): New ctor.
1204         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
1205         (Dwp_output_file::Dwp_index::Section_table): New type.
1206         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
1207         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
1208         parameter.
1209         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
1210         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
1211         (Dwp_output_file::Dwp_index::section_table): New member function.
1212         (Dwp_output_file::Dwp_index::section_table_end): New member function.
1213         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
1214         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
1215         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
1216         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
1217         (Dwp_output_file::Dwp_index::section_table_): New data member.
1218         (Dwp_output_file::Dwp_index::section_mask_): New data member.
1219         (Dwp_output_file::add_output_section): New member function.
1220         (Dwp_output_file::write_new_section): New member function.
1221         (Dwp_output_file::write_contributions): New member function.
1222         (Dwp_output_file::section_id_map_): New data member.
1223         (class Dwo_id_info_reader): Remove.
1224         (class Unit_reader): New class.
1225         (get_dwarf_section_name): New function.
1226         (Dwo_file::read_executable): Adjust initializations of class data.
1227         (Dwo_file::read): Add support for v2 package file format.
1228         (Dwo_file::read_unit_index): Likewise.
1229         (Dwo_file::sized_read_unit_index): Likewise.
1230         (Dwo_file::copy_section): Likewise.
1231         (Dwo_file::add_unit_set): Likewise.
1232         (Dwp_output_file::add_output_section): Likewise.
1233         (Dwp_output_file::add_contribution): Likewise.
1234         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
1235         for empty slot.
1236         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
1237         file format.
1238         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
1239         slot.
1240         (Dwp_output_file::initialize): Remove unused function.
1241         (Dwp_output_file::finalize): Add support for v2 package file format.
1242         (Dwp_output_file::write_index): Likewise.
1243         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
1244         function prototype.
1245
1246 2013-03-01  Cary Coutant  <ccoutant@google.com>
1247
1248         * dwarf_reader.cc (Dwarf_info_reader::check_buffer): Move
1249         function into class definition in header file.
1250         (Dwarf_info_reader::warn_corrupt_debug_section): New function.
1251         * dwarf_reader.h (Dwarf_info_reader::warn_corrupt_debug_section):
1252         New function.
1253         (Dwarf_info_reader::check_buffer): Move here from .cc file.
1254
1255 2013-02-28  Alan Modra  <amodra@gmail.com>
1256
1257         * target.h (Target::plt_fde_location, do_plt_fde_location): Declare.
1258         * target.cc (Target::do_plt_fde_location): New function.
1259         * ehframe.h (class FDE): Add post_map field to u_.from_linker,
1260         accessor function, and constructor param.
1261         (struct Post_fde, Post_fdes): Declare.
1262         (Cie::write): Add post_fdes param.
1263         * ehframe.cc (Fde::write): Use plt_fde_location.
1264         (struct Post_fde): Define.
1265         (Cie::write): Stash FDEs added post merge mapping.
1266         (Eh_frame::add_ehframe_for_plt): Assert no new CIEs after mapping.
1267         Adjust Fde constructor call.  Bump final_data_size_ for post map FDEs.
1268         (Eh_frame::do_sized_write): Arrange to write post map FDES after
1269         other FDEs.
1270         * powerpc.cc (Target_powerpc::do_plt_fde_location): New function.
1271         (Target_powerpc::has_glink): New function.
1272         (Target_powerpc::do_relax): Add eh_frame info for stubs.
1273         (struct Eh_cie, eh_frame_cie, glink_eh_frame_fde_64,
1274         glink_eh_frame_fde_32, default_fde): New data.
1275         (Stub_table::eh_frame_added_): New var.
1276         (Stub_table::find_long_branch_entry, stub_address, stub_offset):
1277         Make const.
1278         (Stub_table::add_eh_frame): New function.
1279         (Output_data_glink::add_eh_frame): New function.
1280         (Target_powerpc::make_glink_section): Call add_eh_frame.
1281
1282 2013-02-15  Ian Lance Taylor  <iant@google.com>
1283
1284         * options.h (DEFINE_uint64_alias): Define.
1285         (class General_options): Add -Ttext-segment as an alias for
1286         -Ttext.
1287
1288 2013-02-15  Alan Modra  <amodra@gmail.com>
1289
1290         * powerpc.cc (Stub_table::plt_off): New function, extracted from..
1291         (Stub_table::do_write): ..here, two places.
1292         (Stub_table::plt_call_size): Use it here too.
1293
1294 2013-02-11  Ian Lance Taylor  <iant@google.com>
1295
1296         * descriptors.cc (Descriptors::close_all): New function.
1297         * descriptors.h (class Descriptors): Declare close_all.
1298         (close_all_descriptors): New inline function.
1299         * plugin.cc: Include "descriptors.h".
1300         (Plugin_manager::cleanup): Call close_all_descriptors.
1301
1302 2013-02-06  Alan Modra  <amodra@gmail.com>
1303
1304         * README: Update coding style link.
1305
1306 2013-01-28  Cary Coutant  <ccoutant@google.com>
1307
1308         * dwp.cc (File_list): New typedef.
1309         (Dwo_name_info_reader): New class.
1310         (Dwo_id_info_reader::Dwo_id_info_reader): Remove unused parameters.
1311         (Dwo_id_info_reader::visit_top_die): Remove unused member function.
1312         (Dwo_file::~Dwo_file): Delete input_file_ after obj_.
1313         (Dwo_file::read_executable): New function.
1314         (Dwo_file::read): Move common setup code to ...
1315         (Dwo_file::make_object): ... here.
1316         (dwp_options): Add --exec/-e.
1317         (usage): Likewise.
1318         (main): Likewise.
1319
1320 2013-01-24  Sriraman Tallam  <tmsriram@google.com>
1321
1322         * layout.cc (Layout::layout): Check for option text_reorder.
1323         (Layout::make_output_section): Ditto.
1324         * options.h (text_reorder): New option.
1325         * output.cc (Input_section_sort_compare): Remove special ordering
1326         of section names.
1327         (Output_section::
1328          Input_section_sort_section_name_special_ordering_compare::
1329          operator()): New function.
1330         (Output_section::sort_attached_input_sections): Use new sort function
1331         for .text.
1332         * output.h (Input_section_sort_section_name_special_ordering_compare):
1333         New struct.
1334         * testsuite/Makefile.am (text_section_grouping): Test option
1335         --no-text-reorder
1336         * testsuite/Makefile.in: Regenerate.
1337         * testsuite/text_section_grouping.sh: Check order of functions without
1338         default text reordering.
1339
1340 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
1341
1342         * options.h (General_options): Change default to true for new_dtags.
1343
1344 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
1345
1346         * layout.cc (Layout::finish_dynamic_section): Only add DT_RPATH
1347         when enable_new_dtags is false.  Only add DT_RUNPATH when
1348         enable_new_dtags is true.
1349
1350 2013-01-17  Serge Pavlov  <serge.v.pavlov@gmail.com>
1351
1352         * powerpc.cc (Stub_table::find_plt_call_entry): Make types
1353         used in declaration and definition consistent.
1354         (Target_powerpc::symval_for_branch): Ditto.
1355
1356 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
1357
1358         * testsuite/plugin_final_layout.cc: Fix comment.
1359
1360 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
1361
1362         * layout.cc (Layout::layout): Do not do default sorting for
1363         text sections when section ordering is specified.
1364         (make_output_section): Ditto.
1365         * testsuite/plugin_final_layout.cc: Name the function sections
1366         to catch reordering issues.
1367
1368 2013-01-15  Alan Modra  <amodra@gmail.com>
1369
1370         * powerpc.cc (Target_powerpc::do_relax): Default shared libs to
1371         plt-thread-safe.
1372
1373 2013-01-15  Alan Modra  <amodra@gmail.com>
1374
1375         * testsuite/Makefile.am (final_layout_script.lds): Handle .got section.
1376         * testsuite/Makefile.in: Regenerate.
1377
1378 2013-01-14  Alan Modra  <amodra@gmail.com>
1379
1380         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add various output files.
1381         * testsuite/Makefile.in: Regenerate.
1382
1383 2013-01-11  Pavel Chupin  <pavel.v.chupin@intel.com>
1384
1385         PR bfd/14430
1386         Fix mingw gold build with plugins enabled
1387         * Makefile.am: Replace -ldl with @DLOPEN_LIBS@.
1388         * configure.ac: Export DLOPEN_LIBS and add headers check.
1389         * plugin.cc: Handle non-dlfcn case.
1390         * Makefile.in: Regenerate.
1391         * config.in: Regenerate.
1392         * configure: Regenerate.
1393         * testsuite/Makefile.in: Regenerate.
1394
1395 2013-01-09  Sriraman Tallam  <tmsriram@google.com>
1396
1397         * output.h (sort_attached_input_sections): Change to be public.
1398         * script-sections.cc
1399         (Output_section_definition::set_section_addresses): Sort
1400         attached input sections according to section order before linker
1401         script assigns section addresses.
1402         (Orphan_output_section::set_section_addresses): Sort
1403         attached input sections according to section order before linker
1404         script assigns section addresses.
1405         * Makefile.am (final_layout.sh): Use a simple linker script to
1406         check if section ordering still works.
1407         * Makefile.in: Regenerate.
1408
1409 2013-01-09  Ben Cheng  <bccheng@google.com>
1410
1411         * arm.cc (Target_arm::attributes_accept_div): New function.
1412         (Target_arm::attributes_forbid_div): New function.
1413         (Target_arm::merge_object_attributes): Merge the Tag_DIV_use
1414         attribute using the same new functions as what bfd/elf32_arm.c
1415         does.
1416
1417 2013-01-07  Cary Coutant  <ccoutant@google.com>
1418
1419         PR gold/14993
1420         * output.cc (Output_section::add_input_section): For incremental
1421         updates, don't track input sections that are allocated from patch
1422         space.
1423
1424 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
1425             Ian Lance Taylor  <iant@google.com>
1426
1427         PR gold/14897
1428         * configure.ac (--enable-ld): Removed.
1429         (install_as_default): Set to yes only for --enable-gold=default
1430         or --disable-ld.
1431         * configure: Regenerated.
1432
1433 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
1434
1435         * options.h (General_options): Add -fuse-ld= for GCC linker
1436         option compatibility.
1437
1438 2013-01-04  Cary Coutant  <ccoutant@google.com>
1439
1440         * configure.ac: Fix typo restoring CXXFLAGS.
1441         * configure: Regenerate.
1442
1443 2013-01-04  Cary Coutant  <ccoutant@google.com>
1444
1445         * testsuite/Makefile.am (CXXLINK_S): New macro.
1446         (debug_msg_so.err, debug_msg_ndebug.err): Use CXXLINK_S.
1447         * testsuite/Makefile.in: Regenerate.
1448
1449 2013-01-02  H.J. Lu  <hongjiu.lu@intel.com>
1450
1451         * version.cc (print_version): Update copyright year to 2013.
1452
1453 2012-12-20  Ian Lance Taylor  <iant@google.com>
1454
1455         * layout.cc (Layout::special_ordering_of_input_section): New
1456         function.
1457         (Layout::layout): If input section requires special ordering, must
1458         sort input sections.
1459         (Layout::make_output_section): May sort .text input sections.
1460         (Layout::is_section_name_prefix_grouped): Remove.
1461         * layout.h (class Layout): Declare
1462         special_ordering_of_input_section.  Don't declare
1463         is_section_name_prefix_grouped.
1464         * output.cc (Output_section::add_input_section): Revert last
1465         change.
1466         (Output_section::Input_section_sort::match_file_name): Don't crash
1467         if called on output section data.
1468         (Output_section::Input_section_sort_compare): Sort based on
1469         special ordering.
1470         (Output_section::Input_section_sort_section_order_index_compare):
1471         Revert last patch.
1472         (Output_section::sort_attached_input_sections): Likewise.
1473
1474 2012-12-18  Sriraman Tallam  <tmsriram@google.com>
1475
1476         * layout.cc (Layout::is_section_name_prefix_grouped): New function.
1477         * layout.h (Layout::is_section_name_prefix_grouped): New function.
1478         * output.cc (Output_section::add_input_section): Check if section
1479         name contains special prefix.  Keep input sections to sort such
1480         sections.
1481         (Output_section::Input_section_sort_section_order_index_compare
1482          ::operator()): Group sections according to prefixes.
1483         (Output_section::sort_attached_input_sections): Add condition to
1484         Input_section_entry constructor call.
1485         * testsuite/Makefile.am (text_section_grouping): New test.
1486         * testsuite/Makefile.in: Regenerate.
1487         * testsuite/text_section_grouping.cc: New file.
1488         * testsuite/text_section_grouping.sh: New file.
1489
1490 2012-12-17  Nick Clifton  <nickc@redhat.com>
1491
1492         * Makefile.am: Add copyright notice.
1493         * NEWS: Likewise.
1494         * README: Likewise.
1495         * configure.ac: Likewise.
1496         * ftruncate.c: Likewise.
1497         * Makefile.in: Regenerate.
1498
1499 2012-12-14  Cary Coutant  <ccoutant@google.com>
1500
1501         * testsuite/Makefile.am (exception_separate_shared_12_test): Add
1502         --no-as-needed flag.
1503         (exception_separate_shared_12_test): Likewise.
1504         (incremental_copy_test): Likewise.
1505         * testsuite/Makefile.in: Regenerate.
1506
1507 2012-12-14  Cary Coutant  <ccoutant@google.com>
1508
1509         * dwp.cc (Dwp_output_file::add_cu_set): Check for duplicate CUs.
1510         (Dwp_output_file::Dwp_index::enter_set): Add assert.
1511
1512 2012-12-12  Alan Modra  <amodra@gmail.com>
1513
1514         * powerpc.cc (class Track_tls): New.
1515         (class Relocate, class Scan): Inherit Track_tls.
1516         (Target_powerpc::Scan::local, global): Track tls optimization
1517         and avoid creating plt entry for __tls_get_addr if all uses
1518         are optimized away.
1519         (Target_powerpc::Relocate::relocate): Update to use Track_tls.
1520
1521 2012-12-12  Alan Modra  <amodra@gmail.com>
1522
1523         * options.h (General_options): Add --toc-sort/--no-toc-sort.
1524         Replace no_toc_optimize with toc_optimize.
1525         * output.h (Output_section::input_sections): Provide non-const variant.
1526         * powerpc.cc (Powerpc_relobj::has_small_toc_reloc_,
1527         set_has_small_toc_reloc, has_small_toc_reloc): New variable and
1528         accessors.
1529         (Target_powerpc::Scan::local, global): Call set_has_small_toc_reloc.
1530         (class Sort_toc_sections): New.
1531         (Target_powerpc::do_finalize_sections): Sort toc sections.
1532         (Target_powerpc::Relocate::relocate): Update toc_optimize test.
1533
1534 2012-12-10  Roland McGrath  <mcgrathr@google.com>
1535
1536         * testsuite/binary_unittest.cc (read_all): New function.
1537         (Sized_binary_test): Use it instead of ::read.
1538         * fileread.cc (do_read): Don't assume pread always reads the whole
1539         amount in a single call.
1540
1541 2012-12-10  Alan Modra  <amodra@gmail.com>
1542
1543         * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
1544         Set EM_PPC64 or EM_PPC here.
1545         (Target_selector_powerpc::do_recognize): Delete.
1546
1547 2012-12-10  Alan Modra  <amodra@gmail.com>
1548
1549         * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
1550         stub_table_.
1551         (Target_powerpc::Branch_info::make_stub): Don't omit addend.
1552
1553 2012-12-07  Roland McGrath  <mcgrathr@google.com>
1554
1555         * testsuite/binary_unittest.cc (Sized_binary_test):
1556         Use open_descriptor rather than ::open.
1557
1558 2012-12-07  Alan Modra  <amodra@gmail.com>
1559
1560         * powerpc.cc (Stub_table::do_write): Delete redundant Address
1561         typedef and invalid_address constant.
1562         (Output_data_glink, Stub_table, Target_powerpc): Explicitly
1563         instantiate constants.
1564
1565 2012-12-06  Roland McGrath  <mcgrathr@google.com>
1566
1567         * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
1568         Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
1569         * aclocal.m4: Regenerate.
1570         * configure: Regenerate.
1571         * Makefile.in: Regenerate.
1572         * testsuite/Makefile.in: Regenerate.
1573
1574 2012-12-07  Alan Modra  <amodra@gmail.com>
1575
1576         * options.h (General_options): Add no_toc_optimize.
1577         * powerpc.cc (ok_lo_toc_insn): New function.
1578         (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
1579
1580 2012-12-06  Alan Modra  <amodra@gmail.com>
1581
1582         * options.h (General_options): Add plt_align, plt_static_chain,
1583         plt_thread_safe.  Update stub_group_size help text.
1584         * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
1585         for new plt_thread_safe_ var.
1586         (use_plt_offset): Correct comments.
1587         (Target_powerpc::do_relax): Look for thread creation symbols to
1588         determine default plt_thread_safe value.  Clear plt call stubs
1589         as well as branch stubs each iteration.
1590         (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
1591         insn constants.
1592         (l, hi, ha, write_insn): Move earlier.
1593         (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
1594         (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
1595         plt stubs too.
1596         (Stub_table::update_size): Adjust.
1597         (Stub_table::prev_size, set_prev_size): Delete.
1598         (Stub_table::stub_align): Let --plt-align affect result.
1599         (Stub_table::plt_call_size): Calculate sizes for various stubs.
1600         (Stub_table::branch_stub_size): Use last_plt_size in address calc.
1601         (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
1602         (Stub_table::do_write): Support more stub variants.
1603
1604 2012-12-04  Alan Modra  <amodra@gmail.com>
1605
1606         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
1607         (Target_powerpc::do_define_standard_symbols): New function.
1608
1609 2012-12-03  Alan Modra  <amodra@gmail.com>
1610
1611         * output.h: Formatting, whitespace.
1612
1613 2012-12-03  Alan Modra  <amodra@gmail.com>
1614
1615         * layout.h (Layout::get_executable_sections): Declare.
1616         * layout.cc (Layout::get_executable_sections): New function.
1617         * arm.cc (Target_arm::group_sections): Use it.
1618         (Arm_output_section::group_sections): Delete now redundant test.
1619         * output.cc (Output_reloc::Output_reloc): Add is_relative.
1620         param to handle relative relocs.
1621         * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
1622         (Output_data_reloc::add_absolute): Adjust.
1623         (Output_data_reloc::add_relative): New function.
1624         (Output_data::reset_data_size): New function.
1625         (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
1626         (Output_section::set_addralign): New function.
1627         (Output_section::checkpoint_set_addralign): New function.
1628         (Output_section::clear_section_offsets_need_adjustment): New function.
1629         (Output_section::input_sections): Make public.
1630         * powerpc.cc (class Output_data_brlt_powerpc): New.
1631         (class Stub_table, class Stub_control): New.
1632         (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
1633         stub_table_, set_stub_table, stub_table): New vectors and accessor
1634         functions.
1635         (Target_powerpc::do_may_relax, do_relax, push_branch,
1636         new_stub_table, stub_tables, brlt_section, group_sections,
1637         add_branch_lookup_table, find_branch_lookup_table,
1638         write_branch_lookup_table, make_brlt_section): New functions.
1639         (Target_powerpc::struct Sort_sections, class Branch_info): New.
1640         (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
1641         branch_info_): New vars.
1642         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
1643         make call stubs here.
1644         (Output_data_glink): Remove all call stub handling from this class.
1645         (Target_powerpc::Scan::local, global): Save interesting branch
1646         relocs and relocs for ifunc.  Adjust calls to plt entry functions.
1647         (Target_powerpc::do_finalize_sections): Only make reg save/restore
1648         functions on final link.
1649         (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
1650         Handle long branch destinations too.
1651         (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
1652         do_plt_address_for_local): Adjust lookup of plt call stubs.
1653
1654 2012-11-30  Alan Modra  <amodra@gmail.com>
1655
1656         * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
1657         relocs against protected symbols when building 32-bit shared libs.
1658
1659 2012-11-30  Alan Modra  <amodra@gmail.com>
1660
1661         * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
1662         param.  Call got_section() to make .got.  Update all callers
1663         and their callers and so on.
1664
1665 2012-11-30  Alan Modra  <amodra@gmail.com>
1666
1667         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
1668         _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
1669         (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
1670         value if it already exists.
1671
1672 2012-11-19  H.J. Lu  <hongjiu.lu@intel.com>
1673
1674         PR gold/14858
1675         * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
1676
1677 2012-11-14  Roland McGrath  <mcgrathr@google.com>
1678
1679         * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
1680         than bfc instruction for data sandboxing.
1681
1682 2012-11-08  Alan Modra  <amodra@gmail.com>
1683
1684         * po/POTFILES.in: Regenerate.
1685
1686 2012-11-05  Alan Modra  <amodra@gmail.com>
1687
1688         * configure.ac: Apply 2012-09-10 change to config.in here.
1689         * configure: Regenerate.
1690
1691 2012-11-05  Alan Modra  <amodra@gmail.com>
1692
1693         * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
1694         (struct Opd_ent): Use "Address" rather than "Offset".
1695         (Output_data_got_powerpc::got_base_offset): Return Valtype.
1696         (Target_powerpc::got_section): Make public.
1697         (Target_powerpc::scan_relocs): Move code setting symbols..
1698         (Powerpc_relobj::do_scan_relocs): ..to here, new function.
1699         Create _SDA_BASE_ only when referenced.
1700
1701 2012-11-02  Roland McGrath  <mcgrathr@google.com>
1702
1703         * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
1704         from last change.
1705
1706 2012-11-01  Roland McGrath  <mcgrathr@google.com>
1707
1708         * target.h (Sized_target::relocate_relocs): Use Elf_Off
1709         for offset_in_output_section parameter.
1710         (Sized_target::relocate_special_relocatable): Likewise.
1711         * arm.cc (Target_arm::relocate_relocs): Likewise.
1712         (Target_arm::relocate_special_relocatable): Likewise.
1713         * i386.cc (Target_i386::relocate_relocs): Likewise.
1714         * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
1715         * sparc.cc (Target_sparc::relocate_relocs): Likewise.
1716         * target-reloc.h (relocate_relocs): Likewise.
1717         * testsuite/testfile.cc (Target_test): Likewise.
1718         * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
1719         * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
1720
1721         * system.h: Move inclusion of <clocale> to after <libintl.h> in
1722         [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
1723
1724         * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
1725         parameter, which is unused in the [!F_SETFD] case.
1726
1727         * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
1728         SYMNDX to off_t before comparing it to this->data_size().
1729         * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
1730         * incremental.cc (Output_section_incremental_inputs::do_write):
1731         Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
1732
1733         * nacl.cc: Include "libiberty.h" for vasprintf declaration.
1734
1735 2012-10-30  Steve McIntyre  <steve.mcintyre@linaro.org>
1736
1737         * gold.cc (Target_arm::do_adjust_elf_header): Add the
1738         hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
1739         in EABI_VER5.
1740
1741 2012-10-29  Cary Coutant  <ccoutant@google.com>
1742
1743         * dwp.cc (usage): Add file and exit status parameters;
1744         add --help and --version options.
1745         (print_version): New function.
1746         (main): Add --help and --version options.
1747
1748 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1749
1750         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
1751         final_layout_sequence.txt.
1752         * testsuite/Makefile.in: Regenerated.
1753
1754 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1755
1756         * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
1757         COMPILE generated by automake.
1758         (LINK1): Likewise.
1759         (CXXCOMPILE1): Likewise.
1760         (CXXLINK1): Likewise.
1761         (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
1762         (LINK): Likewise.
1763         (CXXCOMPILE): Likewise.
1764         (CXXLINK): Likewise.
1765         * testsuite/Makefile.in: Regenerated.
1766
1767 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1768
1769         * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
1770         on bad fwrite return.
1771
1772 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1773
1774         * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
1775         on val.
1776
1777 2012-10-23  Cary Coutant  <ccoutant@google.com>
1778
1779         * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
1780         * testsuite/Makefile.in: Regenerate.
1781         * testsuite/dwp_test.h: New source file.
1782         * testsuite/dwp_test_1.cc: New source file.
1783         * testsuite/dwp_test_1.s: New source file.
1784         * testsuite/dwp_test_1.sh: New source file.
1785         * testsuite/dwp_test_1b.cc: New source file.
1786         * testsuite/dwp_test_1b.s: New source file.
1787         * testsuite/dwp_test_2.cc: New source file.
1788         * testsuite/dwp_test_2.s: New source file.
1789         * testsuite/dwp_test_2.sh: New source file.
1790         * testsuite/dwp_test_main.cc: New source file.
1791         * testsuite/dwp_test_main.s: New source file.
1792
1793 2012-10-23  Cary Coutant  <ccoutant@google.com>
1794
1795         * dwp.h: New header file.
1796         * dwp.cc: New source file.
1797         * gold.h: Move shared declarations to system.h.
1798         * system.h: New header file.
1799         * Makefile.am: Add dwp.
1800         * Makefile.in: Regenerate.
1801
1802 2012-10-23  Cary Coutant  <ccoutant@google.com>
1803
1804         * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
1805         Dwarf_info_reader::read_from_pointer.
1806         (Dwarf_pubnames_table::read_header): Likewise.
1807         (Dwarf_pubnames_table::next_name): Likewise.
1808         (Dwarf_die::read_attributes): Likewise.
1809         (Dwarf_die::skip_attributes): Likewise.
1810         (Dwarf_info_reader::read_from_pointer): New function template.
1811         * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
1812         (Dwarf_pubnames_table): Likewise.
1813         (Dwarf_info_reader::read_from_pointer): New function template.
1814         * gdb-index.cc (Gdb_index_info_reader): Adjust call to
1815         Dwarf_pubnames_table ctor.
1816
1817 2012-10-23  Cary Coutant  <ccoutant@google.com>
1818
1819         * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
1820         abbrev_shndx.
1821         * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
1822         abbrev_shndx_.
1823         (Dwarf_info_reader::set_abbrev_shndx): New method.
1824         (Dwarf_info_reader::abbrev_shndx_): New data member.
1825
1826 2012-10-23  Cary Coutant  <ccoutant@google.com>
1827
1828         * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
1829         from object, not parameters.
1830         (Dwarf_info_reader::parse): Likewise.
1831         * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
1832         (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
1833         (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
1834         methods.
1835
1836 2012-10-23  Cary Coutant  <ccoutant@google.com>
1837
1838         * fileread.cc (Input_file::Input_file): New constructor.
1839         * fileread.h (class Input_file): Add new constructor.
1840
1841 2012-10-18  Alan Modra  <amodra@gmail.com>
1842
1843         PR gold/14727
1844         * object.cc (Relobj::is_section_name_included): Also match
1845         .sdata personality section.
1846
1847 2012-10-18  Alan Modra  <amodra@gmail.com>
1848
1849         * target-reloc.h (class Default_comdat_behavior): New, package up..
1850         (get_comdat_behaviour): ..this.
1851         (relocate_section): Add Relocate_comdat_behavior template arg,
1852         adjust code to suit.
1853         * arm.cc (Target_arm::relocate_section): Adjust to suit.
1854         (Target_arm::scan_reloc_section): Likewise.
1855         * i386.cc (Target_i386::relocate_section): Likewise.
1856         * sparc.cc (Target_sparc::relocate_section): Likewise.
1857         * tilegx.cc (Target_tilegx::relocate_section): Likewise.
1858         * x86_64.cc (Target_x86_64::relocate_section): Likewise.
1859         * powerpc.cc (class Relocate_comdat_behavior): New.
1860         (Target_powerpc::relocate_section): Don't zap opd relocs.  Supply
1861         gold::relocate_section with new template arg.
1862
1863 2012-10-18  Alan Modra  <amodra@gmail.com>
1864
1865         * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
1866         dynamic relocs for GOT_TPREL got entries, without symbol if
1867         resolving locally.
1868         (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
1869         (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
1870         (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
1871
1872 2012-10-17  Alan Modra  <amodra@gmail.com>
1873
1874         PR gold/14726
1875         * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
1876
1877 2012-10-16  Sriraman Tallam  <tmsriram@google.com>
1878
1879         * layout.cc (Layout::include_section): Keep sections marked
1880         SHF_EXCLUDE when doing relocatable links.
1881
1882 2012-10-16  Alan Modra  <amodra@gmail.com>
1883
1884         * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
1885         (Target_powerpc::do_finalize_sections): Call it.
1886         (Output_data_save_res): New class and supporting functions.
1887         (Target_powerpc::symval_for_branch): Only look up .opd entry for
1888         normal symbols defined in object files.
1889
1890 2012-10-12  Alan Modra  <amodra@gmail.com>
1891
1892         * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
1893         (struct Opd_ent): Make "discard" a bit field.  Add "gc_mark".
1894         (Target_powerpc::do_gc_mark_symbol): Delay marking function code
1895         section if scan_opd_relocs not yet called.
1896         (Target_powerpc::gc_process_relocs): Call process_gc_mark.
1897
1898 2012-10-12  Alan Modra  <amodra@gmail.com>
1899
1900         * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
1901         add_local_ifunc_entry): Revert last change.
1902         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
1903
1904 2012-10-05  Alan Modra  <amodra@gmail.com>
1905
1906         * powerpc.cc (Target_powerpc::do_plt_address_for_local,
1907         do_plt_address_for_global): New functions.
1908         (Output_data_got_powerpc::do_write): Don't segfault when linking
1909         statically.
1910         (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
1911         add_local_ifunc_entry): Return true on adding entry..
1912         (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
1913         glink->add_entry call.  Remove unused symtab param.  Adjust calls.
1914         (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
1915         (Target_powerpc::make_iplt_section): Remove symtab param.  Don't
1916         set up symbols here.
1917         (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
1918         syms here.  Do so even when no .iplt.  Don't segfault when linking
1919         statically.
1920         (Output_data_glink::add_entry, find_entry): Rearrange params.  Add
1921         new variants without reloc param.
1922         (Glink_sym_ent::Glink_sym_ent): Likewise.
1923         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
1924         reloc when refs will resolve to plt call stub.
1925         (Target_powerpc::Scan::local): Correct ifunc handling.  Allow
1926         R_PPC_PLTREL24 to resolve locally.
1927         (Target_powerpc::Scan::global): Correct ifunc handling.
1928         (Target_powerpc::Relocate::relocate): Correct local sym glink
1929         lookup.  Don't destroy "value" when we have a plt call stub,
1930         and when checking plt call validity.
1931         (Target_powerpc::do_dynsym_value): Simplify.
1932
1933 2012-10-05  Alan Modra  <amodra@gmail.com>
1934
1935         * i386.cc (Output_data_plt_i386::address_for_global,
1936         address_for_local): Add plt offset to returned value.  Adjust uses.
1937         * sparc.cc (Output_data_plt_sparc::address_for_global,
1938         address_for_local): Likewise.
1939         * tilegx.cc (Output_data_plt_tilegx::address_for_global,
1940         address_for_local): Likewise.
1941         * x86_64.cc (Output_data_plt_x86_64::address_for_global,
1942         address_for_local): Likewise.
1943         * target.h (Target::plt_address_for_global, plt_address_for_local):
1944         Update comment.
1945         * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
1946         (Output_data_got::Got_entry::write): Nor here.
1947         * output.h: Comment fix.
1948
1949 2012-10-02  Jiong Wang  <jiwang@tilera.com>
1950
1951         * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
1952         global_offset_table_ value for larget got.
1953         (Target_tilegx::Relocate::relocate): Handle adjusted got value.
1954
1955 2012-09-29  Alan Modra  <amodra@gmail.com>
1956
1957         * powerpc.cc (Target_powerpc::iplt_): New output section.
1958         (Target_powerpc::iplt_section, make_iplt_section,
1959         reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
1960         (Target_powerpc::make_plt_entry): Handle ifunc syms.
1961         Target_powerpc::plt_entry_count): Count iplt entries too.
1962         (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
1963         reloc section in constructor.  New params.
1964         (Target_powerpc::make_plt_section): Create reloc section here instead.
1965         (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
1966         functions.
1967         (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
1968         (Output_data_glink::add_entry, find_entry): New functions to
1969         deal with local syms.
1970         (Glink_sym_ent): Add support for local syms.
1971         (Output_data_glink::do_write): Handle ifunc plt entries.
1972         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1973         (Target_powerpc::Scan::local, global): Handle ifunc syms.
1974         (Target_powerpc::Relocate::relocate): Likewise.
1975         (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
1976
1977 2012-09-25  Alan Modra  <amodra@gmail.com>
1978
1979         * object.h (Sized_relobj_file::adjust_local_symbol,
1980         do_adjust_local_symbol): New functions.
1981         * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
1982         * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
1983         (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
1984         and irregular opd entry spacing.
1985         (Powerpc_relobj::do_read_relocs): Add opd size checks.
1986         (Global_symbol_visitor_opd): New functor.
1987         (Target_powerpc::do_finalize_sections): Omit global symbols defined
1988         on deleted opd entries.
1989
1990 2012-09-15  Jiong Wang  <jiwang@tilera.com>
1991
1992         * tilegx.cc: New file.
1993         * Makefile.am (TARGETSOURCES): Add tilegx.cc
1994         (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
1995         * configure.tgt: Add entries for tilegx*.
1996         * configure.ac: Likewise.
1997         * Makefile.in: Rebuild.
1998         * configure: Likewise.
1999         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
2000         tilegx.
2001
2002 2012-09-13  Alan Modra  <amodra@gmail.com>
2003
2004         * target-reloc.h (scan_relocs): Call scan.local for relocs
2005         against symbols in discarded sections.  Pass is_discarded
2006         param.
2007         * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
2008         Add is_discarded param.
2009         * powerpc (Target_powerpc::Scan::local): Likewise.  Use
2010         is_discarded to flag opd entry as discarded.  Don't emit dyn
2011         relocs on such entries.
2012         (Target_powerpc::Scan::global): Similarly detect and handle
2013         such opd entries.
2014         (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
2015         opd_ent_.  Update all uses.
2016         (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
2017         (Target_powerpc::relocate_section): Zero out discarded opd
2018         entry relocs.
2019
2020 2012-09-12  Ian Lance Taylor  <iant@google.com>
2021
2022         PR gold/14570
2023         * output.cc: Rename Output_data_got template parameter from size
2024         to got_size for all functions.  Compile all variants of
2025         Output_data_got.
2026         (Output_data_got::Got_entry::write): Correct use of size for
2027         symbol value.  Use local_is_tls rather than casting to
2028         Sized_relobj_file.
2029         * object.h (class Object): Add local_is_tls and do_local_is_tls.
2030         (class Sized_relobj_file): Add do_local_is_tls.
2031         * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
2032
2033 2012-09-11  Alan Modra  <amodra@gmail.com>
2034
2035         PR gold/14566
2036         * layout.cc (Layout::set_segment_offsets): When using
2037         common-page-size alignment, ensure we are on a new max-page-size
2038         page.
2039         * output.cc (Output_segment::set_section_addresses): Use
2040         abi_pagesize, not common_pagesize for relro boundary.
2041         (Output_segment::set_offset): Likewise.
2042
2043 2012-09-11  Alan Modra  <amodra@gmail.com>
2044
2045         * output.h (Output_data_got::add_global_tls, add_local_tls,
2046         add_local_tls_pair): New functions.
2047         (Output_data_got::add_local_pair_with_rel): Remove second
2048         reloc param.  Expand comment.
2049         (Output_data_got::Got_entry): Rename use_plt_offset_ to
2050         use_plt_or_tls_offset_, similarly for constructor param.
2051         (Output_data_got::Got_entry::write): Add got_index param.
2052         * output.cc (Output_data_got::add_global_tls, add_local_tls,
2053         add_local_tls_pair): New functions.
2054         (Output_data_got::Got_entry::write): Handle tls symbols
2055         with use_plt_or_tls_offset_ set specially.
2056         (Output_data_got::add_local_pair_with_rel): Only one reloc.
2057         (Output_data_got::do_write): Replace iterator with index, pass
2058         index to entry write function.
2059         * target.h (Target::tls_offset_for_local, tls_offset_for_global,
2060         do_tls_offset_for_local, do_tls_offset_for_global): New functions.
2061         * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
2062         call.
2063         * i386.cc (Target_i386::Scan::local): Likewise.
2064         * sparc.cc (Target_sparc::Scan::local): Likewise.
2065         * x86_64.cc (Target_x86_64::Scan::local): Likewise.
2066         * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
2067         do_tls_offset_for_global): New functions.
2068         (Target_powerpc::Scan::local): Correct TLS relocations and got
2069         entry values.
2070         (Target_powerpc::Scan::global): Don't emit unnecessary
2071         dynamic relocations on TLS GOT entries.
2072
2073 2012-09-10  Matthias Klose  <doko@ubuntu.com>
2074
2075         * config.in: Disable sanity check for kfreebsd.
2076
2077 2012-09-10  Sterling Augustine  <saugustine@google.com>
2078
2079         * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
2080         (Gdb_index::pubtypes_read): New parameter.
2081         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
2082         to calls.
2083         * gdb-index.h (Gdb_index): New fields pubnames_object_ and
2084         pubtypes_object_.
2085
2086 2012-09-09  Alan Modra  <amodra@gmail.com>
2087
2088         * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
2089         (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
2090         * gc.h (gc_process_relocs): Call target gc_add_reference.
2091         * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
2092         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
2093         (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
2094         unnecessary cast.
2095         * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
2096         to cater for when we don't need code offset.  Update use.
2097         (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
2098         (Powerpc_relobj::access_from_map, add_reference, opd_valid,
2099         set_opd_valid): New functions.
2100         (Target_powerpc::do_gc_add_reference): New function.
2101         (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
2102         stashed refs.
2103         (Target_powerpc::do_gc_mark_symbol): New function.
2104
2105 2012-09-06  Cary Coutant  <ccoutant@google.com>
2106
2107         * dwarf_reader.cc (Dwarf_die::read_attributes): Add
2108         DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
2109         (Dwarf_die::skip_attributes): Likewise.
2110         * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
2111         * testsuite/gdb_index_test.cc (inline_func_1): New function.
2112         (main): Call it.
2113         * testsuite/gdb_index_test_comm.sh: Check index for inline function.
2114
2115 2012-09-05  H.J. Lu  <hongjiu.lu@intel.com>
2116
2117         * testsuite/script_test_3.t: Add .got.plt output section
2118         statement.
2119         * testsuite/script_test_4.t: Likewise.
2120
2121 2012-09-05  Alan Modra  <amodra@gmail.com>
2122
2123         * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
2124         update all uses and lose "enum" when using type.
2125
2126 2012-09-05  Alan Modra  <amodra@gmail.com>
2127
2128         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
2129         * configure: Regenerate.
2130         * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
2131         (plugin_final_layout.stdout): Likewise.
2132         (memory_test): Set page sizes to 0x1000.
2133         * testsuite/Makefile.in: Regenerate.
2134         * testsuite/discard_locals_test.sh: Add FIXME comment.
2135         * testsuite/justsyms_exec.c: Disable function test for powerpc64.
2136         * testsuite/pr14265.t: Add .got output section statement.
2137         * testsuite/script_test_2.t: Likewise.
2138         * testsuite/script_test_3.t: Likewise.
2139         * testsuite/script_test_4.t: Likewise.
2140         * testsuite/script_test_5.t: Likewise.
2141         * testsuite/script_test_6.t: Likewise.
2142         * testsuite/script_test_7.t: Likewise.
2143         * testsuite/script_test_9.t: Likewise.
2144
2145 2012-09-05  Alan Modra  <amodra@gmail.com>
2146
2147         * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
2148         (Powerpc_relocate_functions::Status): New typedef.
2149         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
2150         (Target_powerpc::Scan::local): Handle REL64.
2151         (Target_powerpc::Scan::global): Likewise, and dynamic relocs
2152         for REL32 and REL64.
2153         (Target_powerpc::symval_for_branch): New function, extracted from..
2154         (Target_powerpc::Relocate::relocate): ..here.  Correct plt call
2155         checks.  Report overflow errors.
2156
2157 2012-09-05  Alan Modra  <amodra@gmail.com>
2158
2159         * object.h (Sized_relobj_file::emit_relocs): Delete.
2160         (Sized_relobj_file::emit_relocs_reltype): Delete.
2161         * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
2162         relocate_relocs for --emit-relocs.
2163         (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
2164         * output.h: Update comment.
2165         (Output_segment::first_section): New function.
2166         (Output_segment::first_section_load_address): Use first_section.
2167         * output.cc (Output_segment::first_section): New function extracted..
2168         (Output_segment::first_section_load_address): ..from here.  Delete.
2169         * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
2170         * target.h (Sized_target::relocate_for_relocatable): Likewise.
2171         * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
2172         adjust call to target.h function.
2173         * i386.cc (Target_i386): Likewise.
2174         * sparc.cc (Target_sparc): Likewise.
2175         * x86_64.cc (Target_x86_64): Likewise.
2176         * powerpc.cc (Target_powerpc): Likewise.
2177         (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS.  Ensure
2178         first tls section has section symbol for optimised local dynamic
2179         output relocs.
2180         (Target_powerpc::Relocate::relocate): Correct local dynamic value.
2181         (Target_powerpc::relocate_relocs): Adjust relocs emitted for
2182         optimised tls code.
2183         * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
2184         Rename to relocate_relocs.  Update error message.
2185
2186 2012-09-04  Andreas Schwab  <schwab@linux-m68k.org>
2187
2188         * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
2189         --just-symbols.
2190
2191 2012-08-31  Alan Modra  <amodra@gmail.com>
2192
2193         * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
2194         (Powerpc_relobj::toc_base_offset): New stub function.
2195         (Target_powerpc): Add tp_offset, dtp_offset.  Rename
2196         got_mod_index_offset to tlsld_got_offset.  Update all refs.
2197         (Target_powerpc::Relocate::enum skip_tls): New.
2198         (Target_powerpc::call_tls_get_addr_): New var.
2199         (Target_powerpc::is_branch_reloc): Move to file scope.
2200         (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
2201         (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
2202         New functions.
2203         (Target_powerpc::enum Got_type): Delete old values, add new ones.
2204         (powerpc_info): Correct common_pagesize for ppc64.
2205         (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
2206         (Powerpc_relocate_functions): Add overflow check enums and functions.
2207         Add non-shift version of rela, rela_ua.  Delete all rel public
2208         functions.  Delete addr16_lo.  Add addr64, addr64_u, addr32,
2209         addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
2210         addr16_ha3, addr14 functions.
2211         (Output_data_got_powerpc::add_constant_pair): New function.
2212         (Output_data_got_powerpc::got_base_offset): Likewise.
2213         (Output_data_got_powerpc::do_write): Correct 64-bit got header.
2214         (instruction constants): Sort, add some more.
2215         (Output_data_glink::do_write): Add and use Address typedef.  Use
2216         object->toc_base_offset() stub for 64-bit.
2217         (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
2218         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
2219         (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
2220         for R_PPC64_TOC.  Handle more relocs.  Generate got entries for TLS.
2221         Always treat .opd relocs as against locally defined symbol.
2222         Correct condition for RELATIVE relocs.
2223         (Target_powerpc::do_finalize_sections): Test for NULL sections.
2224         (Target_powerpc::Relocate::relocate): Use plt call stub as value
2225         for 32-bit syms with a plt entry.  Correct ppc64 toc base
2226         calculations.  Handle TLS relocs, and more.  Add overflow
2227         checking and adjust for Powerpc_relocate_functions changes.
2228         (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
2229         Reinstate --emit-relocs code with FIXME.
2230
2231 2012-08-30  Alan Modra  <amodra@gmail.com>
2232
2233         * layout.cc (Layout::set_segment_offsets): Set p_align to
2234         abi_pagesize, not common_pagesize.
2235         (Layout::relaxation_loop_body): Similarly use abi_pagesize
2236         to determine whether file header can go in segment.
2237
2238 2012-08-30  Alan Modra  <amodra@gmail.com>
2239
2240         * output.h (Output_reloc::Output_reloc <output section>): Add
2241         is_relative param.  Adjust calls.
2242         (Output_reloc::add_output_section_relative): New functions.
2243         * output.cc (Output_reloc::Output_reloc <output section>): Handle
2244         is_relative.
2245         (Output_reloc::symbol_value): Handle SECTION_CODE.
2246
2247 2012-08-24  Sriraman Tallam  <tmsriram@google.com>
2248
2249         * gold.cc (queue_middle_tasks): Call layout again when unique
2250         segments for sections is desired.
2251         * layout.cc (Layout::Layout): Initialize new members.
2252         (Layout::get_output_section_flags): New function.
2253         (Layout::choose_output_section): Call get_output_section_flags.
2254         (Layout::layout): Make output section for mapping to a unique segment.
2255         (Layout::insert_section_segment_map): New function.
2256         (Layout::attach_allocated_section_to_segment): Make unique segment for
2257         output sections marked so.
2258         (Layout::segment_precedes): Check for unique segments when sorting.
2259         * layout.h (Layout::Unique_segment_info): New struct.
2260         (Layout::Section_segment_map): New typedef.
2261         (Layout::insert_section_segment_map): New function.
2262         (Layout::get_output_section_flags): New function.
2263         (Layout::is_unique_segment_for_sections_specified): New function.
2264         (Layout::set_unique_segment_for_sections_specified): New function.
2265         (Layout::unique_segment_for_sections_specified_): New member.
2266         (Layout::section_segment_map_): New member.
2267         * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
2268         Rename is_gc_pass_one to is_pass_one.
2269         Rename is_gc_pass_two to is_pass_two.
2270         Rename is_gc_or_icf to is_two_pass.
2271         Check for which pass based on whether symbols data is present.
2272         Make it two pass when unique segments for sections is desired.
2273         * output.cc (Output_section::Output_section): Initialize new
2274         members.
2275         * output.h (Output_section::is_unique_segment): New function.
2276         (Output_section::set_is_unique_segment): New function.
2277         (Output_section::is_unique_segment_): New member.
2278         (Output_section::extra_segment_flags): New function.
2279         (Output_section::set_extra_segment_flags): New function.
2280         (Output_section::extra_segment_flags_): New member.
2281         (Output_section::segment_alignment): New function.
2282         (Output_section::set_segment_alignment): New function.
2283         (Output_section::segment_alignment_): New member.
2284         (Output_segment::Output_segment): Initialize is_unique_segment_.
2285         (Output_segment::is_unique_segment): New function.
2286         (Output_segment::set_is_unique_segment): New function.
2287         (Output_segment::is_unique_segment_): New member.
2288         * plugin.cc (allow_unique_segment_for_sections): New function.
2289         (unique_segment_for_sections): New function.
2290         (Plugin::load): Add new functions to transfer vector.
2291         * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
2292         * Makefile.in: Regenerate.
2293         * testsuite/plugin_final_layout.sh: Check if unique segment
2294         functionality works.
2295         * testsuite/plugin_section_order.c (onload): Check if new interfaces
2296         are available.
2297         (allow_unique_segment_for_sections): New global.
2298         (unique_segment_for_sections): New global.
2299         (claim_file_hook): Call allow_unique_segment_for_sections.
2300         (all_symbols_read_hook): Call unique_segment_for_sections.
2301
2302 2012-08-22  Cary Coutant  <ccoutant@google.com>
2303
2304         * layout.cc (Layout::include_section): Don't assert on GROUP
2305         sections with --emit-relocs.
2306
2307 2012-08-21  Cary Coutant  <ccoutant@google.com>
2308
2309         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
2310         if --export-dynamic-symbol names an undef symbol.
2311
2312 2012-08-18  Alan Modra  <amodra@gmail.com>
2313
2314         * powerpc.cc: Formatting and white space.
2315         (Powerpc_relobj): Rename got2_section_ to special_.
2316         Add opd_ent_shndx_ and opd_ent_off_ vectors.
2317         (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
2318         scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
2319         (Target_powerpc): Add Address typedef and invalid_address.  Use
2320         throughout.
2321         (Target_powerpc::is_branch_reloc): New function.
2322         (Powerpc_relocate_functions): Add Address typedef, use throughout.
2323         (Powerpc_relocate_functions:rela, rela_ua): Correct type used
2324         for dst_mask, value and addend.
2325         (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
2326         (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
2327         (Output_data_glink::do_write): Correct toc base.  Don't try to use
2328         uint16_t for 24-bit offset.  Use get_output_section_offset and
2329         check return.
2330         (Target_powerpc::Scan::local): Handle more relocs.
2331         (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
2332         (Target_powerpc::Relocate::relocate): Correct toc base calculation.
2333         Plug in toc restoring insn after plt calls.  Translate branches
2334         to function descriptor symbols to corresponding entry point.
2335         (Target_powerpc::relocate_for_relocatable): Check return from
2336         get_output_section_offset.
2337         * symtab.h: Comment typo.
2338
2339 2012-08-14  Ian Lance Taylor  <iant@google.com>
2340
2341         * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
2342         unsupported_relocal_local to call unsupported_reloc_global.
2343
2344 2012-08-14  Nick Clifton  <nickc@redhat.com>
2345
2346         PR ld/14265
2347         * script-sections.cc (Sections_element::output_section_name): Add
2348         keep return parameter.
2349         (Output_section_element::match_name): Add keep return parameter.
2350         Return the value of the keep_ member.
2351         * script-sections.h (class Output_section): Update
2352         output_section_name prototype.
2353         * layout.cc (Layout::keep_input_section): New public member
2354         function.
2355         (Layout::choose_output_section): Pass keep parameter to
2356         output_section_name.
2357         * layout.h (class Layout): Add keep_input_section.
2358         * object.cc (Sized_relobj_file::do_layout): Check for kept input
2359         sections.
2360         * testsuite/Makefile.am: Add a test.
2361         * testsuite/Makefile.in: Regenerate.
2362         * testsuite/pr14265.c: Source file for the test.
2363         * testsuite/pr14265.t: Linker script for the test.
2364         * testsuite/pr14265.sh: Shell script for the test.
2365
2366 2012-08-14  Alan Modra  <amodra@gmail.com>
2367
2368         * target.h (Target::output_section_name): New function.
2369         (Target::do_output_section_name): New function.
2370         * layout.cc (Layout::choose_output_section): Call the above.
2371         * powerpc.cc (Target_powerpc::do_output_section_name): New function.
2372
2373 2012-08-14  Alan Modra  <amodra@gmail.com>
2374
2375         * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
2376         (Output_data_got_powerpc::do_write): Don't rely on base class lookup
2377         for replace_constant call.
2378         (Output_data_plt_powerpc::do_print_to_mapfile): New function.
2379         (Output_data_glink::do_print_to_mapfile): New function.
2380         (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
2381         (Target_powerpc::Relocate::relocate): Likewise.
2382
2383 2012-08-14  Alan Modra  <amodra@gmail.com>
2384
2385         * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
2386         (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
2387         (Output_data_glink::add_entry,find_entry): Remove shndx param.
2388         (class Glink_sym_ent): Rename from struct Glink_sym_ent.  Remove
2389         all references to shndx_.  Handle special case for R_PPC_PLTREL24
2390         here.
2391         (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
2392         (Output_data_glink::do_write): Retrieve got2_shdnx from object.
2393         (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
2394         here.
2395         (Target_powerpc::Scan::global): Nor on make_plt_entry call.
2396         (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
2397
2398 2012-08-12  Alan Modra  <amodra@gmail.com>
2399
2400         * powerpc.cc: Whitespace fixes.  Wrap overly long lines.
2401         (glink insn constants): Use uint32_t.
2402         (Output_data_glink::add_entry): Use insert, not [] operator.
2403
2404 2012-08-11  Alan Modra  <amodra@gmail.com>
2405
2406         * object.h (Sized_relobj_file::find_shdr): New function.
2407         (Sized_relobj_file::find_special_sections): New function.
2408         * object.cc (Sized_relobj_file::find_shdr): New function.
2409         (Sized_relobj_file::find_eh_frame): Use find_shdr.
2410         (Sized_relobj_file::find_special_sections): New function, split out..
2411         (Sized_relobj_file::do_read_symbols): ..from here.
2412         * output.h (Output_data_got::replace_constant): New function.
2413         (Output_data_got::num_entries): New function.
2414         (Output_data_got::last_got_offset,set_got_size): Use num_entries.
2415         (Output_data_got::got_offset): Protected rather than private.
2416         (Output_data_got::replace_got_entry): New function.
2417         * output.cc (Output_data_got::replace_got_entry): New function.
2418         * powerpc.cc (class Powerpc_relobj): New.
2419         (class Powerpc_relocate_functions): Delete all psymval variants or
2420         convert to value,addend type.  Delete pcrela, pcrela_unaligned.
2421         Implement _ha functions using corresponding _hi function.
2422         (Powerpc_relobj::find_special_sections): New function.
2423         (Target_powerpc::do_make_elf_object): New function.
2424         (class Output_data_got_powerpc): New.
2425         (class Output_data_glink): New.
2426         (class Powerpc_scan_relocatable_reloc): New.
2427         Many more changes througout file.
2428
2429 2012-08-09  Nick Clifton  <nickc@redhat.com>
2430
2431         * po/vi.po: Updated Vietnamese translation.
2432
2433 2012-08-07  Ian Lance Taylor  <iant@google.com>
2434
2435         * layout.cc (Layout::add_target_dynamic_tags): If
2436         dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
2437         plt_rel.
2438
2439 2012-07-30  Nick Clifton  <nickc@redhat.com>
2440
2441         * po/gold.pot: Updated template.
2442         * po/es.po: Updated Spanish translation.
2443
2444 2012-07-18  Cary Coutant  <ccoutant@google.com>
2445
2446         PR gold/14344
2447         * configure.ac: Add check for -gpubnames support.
2448         * configure: Regenerate.
2449         * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
2450         support; force -gno-pubnames.
2451         (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
2452         support.
2453         (gdb_index_test_4): New test.
2454         * testsuite/Makefile.in: Regenerate.
2455         * testsuite/gdb_index_test_1.sh: Refactor code into common file.
2456         * testsuite/gdb_index_test_2.sh: Likewise.
2457         * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
2458         * testsuite/gdb_index_test_4.sh: New script.
2459         * testsuite/gdb_index_test_comm.sh: New script with common code;
2460         don't look for space after colon.
2461
2462 2012-07-16  Sriraman Tallam  <tmsriram@google.com>
2463
2464         * gold.cc (queue_middle_tasks): Update function order only after
2465         deferred objects due to plugins are processed.
2466
2467 2012-07-11  Ian Lance Taylor  <iant@google.com>
2468
2469         * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
2470         (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
2471         (Target_arm::scan_reloc_for_stub): Likewise.
2472         * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
2473         * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
2474         * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
2475         * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
2476         * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
2477
2478 2012-07-10  Dodji Seketeli  <dodji@redhat.com>
2479             Ian Lance Taylor  <iant@google.com>
2480
2481         PR gold/14309
2482         * configure.ac: Test whether std::tr1::hash<off_t> works.
2483         * gold.h: Add a specialization for std::tr1::hash<off_t> if
2484         needed.
2485         * output.h (class Output_fill): Add virtual destructor.
2486         * configure, config.in: Rebuild.
2487
2488 2012-06-22  Roland McGrath  <mcgrathr@google.com>
2489
2490         * layout.cc (finalize): Define __ehdr_start symbol if applicable.
2491
2492 2012-06-12  Rafael Ávila de Espíndola <respindola@mozilla.com>
2493
2494         * plugin.cc (Plugin::load): Handle position independent executables.
2495
2496 2012-06-06  Cary Coutant  <ccoutant@google.com>
2497
2498         * layout.cc (gdb_sections): Remove ".debug_" prefixes,
2499         add .debug_macro.
2500         (lines_only_debug_sections): Likewise.
2501         (gdb_fast_lookup_sections): New static array.
2502         (is_gdb_debug_section): Rename formal parameter.
2503         (is_lines_only_debug_section): Likewise.
2504         (is_gdb_fast_lookup_section): New function.
2505         (Layout::include_section): Check for ".zdebug_" prefix; pass
2506         section name suffix to is_gdb_debug_section, et al.; check for
2507         fast-lookup sections when building .gdb_index.
2508         * options.h (--strip-debug-gdb): Update GDB version number.
2509
2510 2012-06-06  Cary Coutant  <ccoutant@google.com>
2511
2512         * configure.ac: Add check for fallocate.
2513         * configure: Regenerate.
2514         * config.in: Regenerate.
2515
2516         * options.h (class General_options): Add --mmap-output-file and
2517         --posix-fallocate options.
2518         * output.cc: (posix_fallocate): Remove; replace with...
2519         (gold_fallocate): New function.
2520         (Output_file::map_no_anonymous): Call gold_fallocate.
2521         (Output_file::map): Check --mmap-output-file option.
2522
2523 2012-06-05  Jing Yu  <jingyu@google.com>
2524
2525         * gold.h (textdomain): Add do {} to empty while(0).
2526         (bindtextdomain): Likewise.
2527
2528 2012-06-04  Cary Coutant  <ccoutant@google.com>
2529
2530         * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
2531         has_dynsym_index.
2532
2533 2012-05-25  Sriraman Tallam  <tmsriram@google.com>
2534
2535         * symtab.cc (Symbol_table::define_special_symbol):
2536         Initialize *poldsym to prevent uninitialized variable errors.
2537
2538 2012-05-23  Cary Coutant  <ccoutant@google.com>
2539
2540         * layout.cc (Layout::section_name_mapping): Add rules to handle
2541         exact match on .data.rel.ro.local or .data.rel.ro.
2542         (Layout::output_section_name): Check for exact matches.
2543
2544 2012-05-23  Cary Coutant  <ccoutant@google.com>
2545
2546         * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
2547         more carefully.
2548
2549 2012-05-22  Cary Coutant  <ccoutant@google.com>
2550
2551         * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
2552         object before exporting symbol.
2553
2554 2012-05-21  H.J. Lu  <hongjiu.lu@intel.com>
2555
2556         * testsuite/tls_test.cc: Include "config.h" first.
2557         * testsuite/tls_test_c.c: Likewise.
2558
2559 2012-05-17  Daniel Richard G.  <skunk@iskunk.org>
2560             Nick Clifton  <nickc@redhat.com>
2561
2562         PR 14072
2563         * configure.in: Add check that sysdep.h has been included before
2564         any system header files.
2565         * configure: Regenerate.
2566         * config.in: Regenerate.
2567
2568 2012-05-14  Cary Coutant  <ccoutant@google.com>
2569
2570         * layout.cc (Layout::make_output_section): Mark .tdata section
2571         as RELRO.
2572         * testsuite/relro_test.cc: Add a TLS variable.
2573
2574 2012-05-10  H.J. Lu  <hongjiu.lu@intel.com>
2575
2576         PR gold/14091
2577         * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
2578         R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
2579         R_X86_64_64.
2580
2581 2012-05-08  Cary Coutant  <ccoutant@google.com>
2582
2583         * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
2584         (lines_only_debug_sections): Likewise.
2585
2586 2012-05-02  Roland McGrath  <mcgrathr@google.com>
2587
2588         * nacl.cc: New file.
2589         * nacl.h: New file.
2590         * Makefile.am (CCFILES, HFILES): Add them.
2591         * Makefile.in: Regenerate.
2592         * i386.cc (Output_data_plt_i386_nacl): New class.
2593         (Output_data_plt_i386_nacl_exec): New class.
2594         (Output_data_plt_i386_nacl_dyn): New class.
2595         (Target_i386_nacl): New class.
2596         (Target_selector_i386_nacl): New class.
2597         (target_selector_i386): Use it instead of Target_selector_i386.
2598         * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
2599         (Target_x86_64_nacl): New class.
2600         (Target_selector_x86_64_nacl): New class.
2601         (target_selector_x86_64, target_selector_x32): Use it instead of
2602         Target_selector_x86_64.
2603         * arm.cc (Output_data_plt_arm_nacl): New class.
2604         (Target_arm_nacl): New class.
2605         (Target_selector_arm_nacl): New class.
2606         (target_selector_arm, target_selector_armbe): Use it instead of
2607         Target_selector_arm.
2608
2609         * target-select.cc (select_target): Take new Input_file* and off_t
2610         arguments, pass them on to recognize method of selector.
2611         * object.cc (make_elf_sized_object): Update caller.
2612         * parameters.cc (parameters_force_valid_target): Likewise.
2613         * incremental.cc (make_sized_incremental_binary): Likewise.
2614         * target-select.h: Update decl.
2615         (Target_selector::recognize): Take new Input_file* argument,
2616         pass it on to do_recognize.
2617         (Target_selector::do_recognize): Take new Input_file* argument.
2618         * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
2619         * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
2620         * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
2621         * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
2622
2623         * target.h (Target::Target_info): New members isolate_execinstr
2624         and rosegment_gap.
2625         (Target::isolate_execinstr, Target::rosegment_gap): New methods.
2626         * arm.cc (Target_arm::arm_info): Update initializer.
2627         * i386.cc (Target_i386::i386_info): Likewise.
2628         * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
2629         * sparc.cc (Target_sparc::sparc_info): Likewise.
2630         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
2631         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
2632         * layout.cc (Layout::attach_allocated_section_to_segment):
2633         Take new const Target* argument.  If target->isolate_execinstr(), act
2634         like --rosegment.
2635         (Layout::find_first_load_seg): Take new const Target* argument;
2636         if target->isolate_execinstr(), reject PF_X segments.
2637         (Layout::relaxation_loop_body): Update caller.
2638         (Layout::set_segment_offsets): If target->isolate_execinstr(),
2639         reset file offset to zero when we hit LOAD_SEG, and then do a second
2640         loop over the segments before LOAD_SEG to reassign offsets after
2641         addresses have been determined.  Handle target->rosegment_gap().
2642         (Layout::attach_section_to_segment): Take new const Target* argument;
2643         pass it to attach_allocated_section_to_segment.
2644         (Layout::make_output_section): Update caller.
2645         (Layout::attach_sections_to_segments): Take new const Target* argument;
2646         pass it to attach_section_to_segment.
2647         * gold.cc (queue_middle_tasks): Update caller.
2648         * layout.h (Layout): Update method decls with new arguments.
2649
2650         * arm.cc (Target_arm::Target_arm): Take optional argument for the
2651         Target_info pointer to use.
2652         (Target_arm::do_make_data_plt): New virtual method.
2653         (Target_arm::make_data_plt): New method that calls it.
2654         (Target_arm::make_plt_entry): Use it.
2655         (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
2656         for the section alignment.
2657         (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
2658         method.
2659         (Output_data_plt_arm::first_plt_entry_offset): Call it.
2660         (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
2661         method.
2662         (Output_data_plt_arm::get_plt_entry_size): Call it.
2663         (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
2664         (Output_data_plt_arm::fill_plt_entry): New method that calls it.
2665         (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
2666         method.
2667         (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
2668         (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
2669         method instead of sizeof(plt_entry).
2670         (Output_data_plt_arm::add_entry): Likewise.
2671         Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
2672         (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
2673         than static method.
2674         (Target_arm::plt_entry_size): Likewise.
2675         (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
2676         Move to ...
2677         (Output_data_plt_arm_standard): ... here, new class.
2678         (Output_data_plt_arm::do_write): Move guts of PLT filling to...
2679         (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
2680         (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
2681
2682         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
2683         Take additional argument for the PLT entry size.
2684         (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
2685         Use get_plt_entry_size method rather than plt_entry_size variable.
2686         (Output_data_plt_x86_64::reserve_slot): Likewise.
2687         (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
2688         (Output_data_plt_x86_64::add_entry): Likewise.
2689         (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
2690         (Output_data_plt_x86_64::address_for_global): Likewise.
2691         (Output_data_plt_x86_64::address_for_local): Likewise.
2692         (Output_data_plt_x86_64::set_final_data_size): Likewise.
2693         (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
2694         Make method non-static.
2695         (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
2696         method.
2697         (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
2698         (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
2699         (Output_data_plt_x86_64::add_eh_frame): New method to call it.
2700         (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
2701         virtual method.
2702         (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
2703         (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
2704         virtual method.
2705         (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
2706         (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
2707         virtual method.
2708         (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
2709         (Output_data_plt_x86_64::plt_entry_size)
2710         (Output_data_plt_x86_64::first_plt_entry)
2711         (Output_data_plt_x86_64::plt_entry)
2712         (Output_data_plt_x86_64::tlsdesc_plt_entry)
2713         (Output_data_plt_x86_64::plt_eh_frame_fde_size)
2714         (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
2715         (Output_data_plt_x86_64_standard): ... here, new class.
2716         (Target_x86_64::Target_x86_64): Take optional argument for the
2717         Target_info pointer to use.
2718         (Target_x86_64::do_make_data_plt): New virtual method.
2719         (Target_x86_64::make_data_plt): New method to call it.
2720         (Target_x86_64::init_got_plt_for_update): Use that.
2721         Call this->plt_->add_eh_frame method here.
2722         (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
2723         (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
2724         rather than static method.
2725         (Target_x86_64::plt_entry_size): Likewise.
2726         (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
2727         rather than plt_entry_size variable.  Move guts of PLT filling to...
2728         (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
2729         (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
2730         (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
2731
2732         * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
2733         additional argument for the section alignment.
2734         Don't do add_eh_frame_for_plt here.
2735         (Output_data_plt_i386::first_plt_entry_offset): Make the method
2736         non-static.  Use get_plt_entry_size method rather than plt_entry_size
2737         variable.
2738         (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
2739         method.
2740         (Output_data_plt_i386::get_plt_entry_size): Call it.
2741         (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
2742         (Output_data_plt_i386::add_eh_frame): New method to call it.
2743         (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
2744         method.
2745         (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
2746         (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
2747         method.
2748         (Output_data_plt_i386::fill_plt_entry): New method to call it.
2749         (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
2750         method instead of plt_entry_size.
2751         (Output_data_plt_i386::plt_entry_size)
2752         (Output_data_plt_i386::plt_eh_frame_fde_size)
2753         (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
2754         (Output_data_plt_i386_standard): ... here, new class.
2755         (Output_data_plt_i386_exec): New class.
2756         (Output_data_plt_i386::exec_first_plt_entry): Move to ...
2757         (Output_data_plt_i386_exec::first_plt_entry): ... here.
2758         (Output_data_plt_i386::exec_plt_entry): Move to ...
2759         (Output_data_plt_i386_exec::plt_entry): ... here.
2760         (Output_data_plt_i386_dyn): New class.
2761         (Output_data_plt_i386::first_plt_entry): Move to ...
2762         (Output_data_plt_i386_dyn::first_plt_entry): ... here.
2763         (Output_data_plt_i386::dyn_plt_entry): Move to ...
2764         (Output_data_plt_i386_dyn::plt_entry): ... here.
2765         (Target_i386::Target_i386): Take optional argument for the Target_info
2766         pointer to use.
2767         (Target_i386::do_make_data_plt): New virtual method.
2768         (Target_i386::make_data_plt): New method to call it.
2769         (Target_i386::make_plt_section): Use that.
2770         Call this->plt_->add_eh_frame method here.
2771         (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
2772         rather than plt_entry_size variable.
2773         (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
2774         (Output_data_plt_i386::address_for_local): Likewise.
2775         (Output_data_plt_i386::do_write): Likewise.
2776         Move guts of PLT filling to...
2777         (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
2778         (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
2779         (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
2780         (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
2781
2782 2012-05-01  Cary Coutant  <ccoutant@google.com>
2783
2784         * dwarf_reader.cc (Dwarf_die::read_attributes)
2785         (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
2786         (Dwarf_die::uint_attribute): Remove DW_FORM_null.
2787         * reduced_debug_output.cc
2788         (Output_reduced_debug_info_section::get_die_end): Remove
2789         DW_FORM_GNU_ref_index.  Add default case.
2790
2791 2012-04-26  Mark Wielaard  <mjw@redhat.com>
2792
2793         * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
2794         * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
2795         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
2796         DW_AT_high_pc as offset from DW_AT_low_pc.
2797
2798         * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
2799         * testsuite/Makefile.in: Regenerate.
2800         * testsuite/gdb_index_test_3.c: New test source file.
2801         * testsuite/gdb_index_test_3.sh: New test source file.
2802
2803 2012-04-25  Ian Lance Taylor  <iant@google.com>
2804
2805         * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
2806         pointer.
2807         (Stub_addend_reader::operator()): Declare Arm_relocate_functions
2808         as a class, not a struct.
2809         (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
2810         (Target_arm::apply_cortex_a8_workaround): Likewise.
2811         * gc.h: Declare Reloc_types as a struct, not a class.
2812         * object.h: Declare Symbols_data as a struct.
2813         * reloc.h: Declare Read_relocs_data as a struct.
2814         * target.h: Declare Relocate_info as a struct.
2815
2816 2012-04-24  David S. Miller  <davem@davemloft.net>
2817
2818         * sparc.cc (Target_sparc::Relocate::relax_call): New function.
2819         (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
2820         and R_SPARC_WPLT30.
2821
2822 2012-04-24  Cary Coutant  <ccoutant@google.com>
2823
2824         * incremental-dump.cc (find_input_containing_global): Replace
2825         magic number with symbolic constant.
2826         (dump_incremental_inputs): Update version number.
2827         * incremental.cc (Output_section_incremental_inputs): Update version
2828         number; import symbolic constants from Incremental_inputs_reader.
2829         (Incremental_inputs::create_data_sections): Align relocations
2830         section correctly for 64-bit targets.
2831         (Output_section_incremental_inputs::set_final_data_size): Use symbolic
2832         constants; add padding.
2833         (Output_section_incremental_inputs::write_header): Add assert for
2834         header_size.
2835         (Output_section_incremental_inputs::write_input_files): Add assert
2836         for input_entry_size.
2837         (Output_section_incremental_inputs::write_info_blocks): Add padding;
2838         add assert for object_info_size, input_section_entry_size,
2839         global_sym_entry_size.
2840         * incremental.h (Incremental_inputs_reader): Add symbolic constants
2841         for data structure sizes; use them.
2842         (Incremental_input_entry_reader): Import symbolic constants from
2843         Incremental_inputs_reader; use them.
2844
2845 2012-04-23  David S. Miller  <davem@davemloft.net>
2846
2847         * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
2848         and elf_flags_set_.
2849         (Target_sparc::Target_sparc): Initialize new fields.
2850         (Target_sparc::do_make_elf_object): New function.
2851         (Target_sparc::do_adjust_elf_header): New function.
2852
2853 2012-04-23  Cary Coutant  <ccoutant@google.com>
2854
2855         * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
2856         CU range table of gdb index.
2857
2858 2012-04-20  David S. Miller  <davem@davemloft.net>
2859
2860         * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
2861         instead of false.
2862
2863 2012-04-16  David S. Miller  <davem@davemloft.net>
2864
2865         * sparc.cc (Target_sparc::got_address): New function.
2866         (Sparc_relocate_functions::gdop_hix22): New function.
2867         (Sparc_relocate_functions::gdop_lox10): New function.
2868         (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
2869         relocs.
2870         (Target_sparc::Scan::local): Likewise if the global symbol is not
2871         preemptible and is not IFUNC.
2872         (Target_sparc::Relocate::relocate): Perform GOTDATA code
2873         transformations for local and non-preemptible non-IFUNC global
2874         symbols.
2875
2876         * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
2877         writing out 64-bit part of ranges.
2878
2879         * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
2880         -fpic and -fpie respectively.
2881         * Makefile.in: Regenerate.
2882
2883         * sparc.cc (class Target_sparc): Add rela_ifunc_.
2884         (Target_sparc::Target_sparc): Initialize new field.
2885         (Target_sparc::do_plt_section_for_global): New function.
2886         (Target_sparc::do_plt_section_for_local): New function.
2887         (Target_sparc::reloc_needs_plt_for_ifunc): New function.
2888         (Target_sparc::make_plt_section): New function, broken out of
2889         make_plt_entry.  Use ORDER_NON_RELRO_FIRST for ".plt".
2890         (Target_sparc::make_plt_entry): Call make_plt_section.
2891         (Target_sparc::make_local_ifunc_plt_entry): New function.
2892         (Target_sparc::rela_ifunc_section): New function.
2893         (Target_sparc::plt_section): Remove const.
2894         (Output_data_plt_sparc): Update declarations.  Define Global_ifunc
2895         and Local_ifunc types.  Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
2896         and ifunc_count_ fields.
2897         (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
2898         (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
2899         (Output_data_plt_sparc::add_local_ifunc_entry): New function.
2900         (Output_data_plt_sparc::rela_ifunc): New function.
2901         (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
2902         (Output_data_plt_sparc::has_ifunc_section): New function.
2903         (Output_data_plt_sparc::entry_count): Include ifunc_count_.
2904         (Output_data_plt_sparc::address_for_global): New function.
2905         (Output_data_plt_sparc::address_for_local): New function.
2906         (Output_data_plt_sparc::plt_index_to_offset): New function.
2907         (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
2908         and entry_count.
2909         (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
2910         entry_count.
2911         (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
2912         R_SPARC_JMP_IREL to switch.
2913         (Target_sparc::Scan::check_non_pic): Likewise.
2914         (Target_sparc::Scan::local): Handle IFUNC symbols.
2915         (Target_sparc::Scan::local): Likewise.
2916         (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
2917         and plt_address_for_local.
2918         (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
2919         Define __rel_iplt_start and __rel_iplt_end if doing a static link.
2920
2921         * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
2922         (class Output_data_reloc): Adjust calls to Output_reloc_type.
2923         (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
2924         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
2925         global relocs too.
2926         (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
2927         * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
2928         calls.
2929         * sparc.cc (Target_sparc::Scan::global): Likewise.
2930         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
2931
2932 2012-04-16  Cary Coutant  <ccoutant@google.com>
2933
2934         * archive.cc (Library_base::should_include_member): Check for
2935         --export-dynamic-symbol.
2936         * options.h (class General_options): Add --export-dynamic-symbol.
2937         * symtab.cc (Symbol::should_add_dynsym_entry): Check for
2938         --export-dynamic-symbol.
2939         (Symbol_table::gc_mark_undef_symbols): Likewise.
2940         (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
2941
2942 2012-04-12  David S. Miller  <davem@davemloft.net>
2943
2944         * sparc.cc (Reloc::wdisp10): New relocation method.
2945         (Reloc::h34): Likewise.
2946         (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
2947         (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
2948         R_SPARC_WDISP10.
2949         (Target_sparc::Scan::local): Likewise.
2950         (Target_sparc::Scan::global): Likewise.
2951         (Target_sparc::Relocate::relocate): Likewise.
2952
2953 2012-04-09  Cary Coutant  <ccoutant@google.com>
2954
2955         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
2956         low_pc == 0.
2957
2958 2012-04-06  Ian Lance Taylor  <iant@google.com>
2959
2960         * timer.cc: #include <unistd.h>.
2961
2962 2012-04-06  Roland McGrath  <mcgrathr@google.com>
2963
2964         * configure.in (AC_CHECK_HEADERS): Add locale.h.
2965         * config.in: Regenerate.
2966         * configure: Regenerate.
2967
2968 2012-04-05  Nick Clifton  <nickc@redhat.com>
2969
2970         * configure.ac (AC_CHECK_FUNCS): Add setlocale.
2971         (AM_LC_MESSAGES): Add.
2972         * aclocal.m4: Regenerate.
2973         * config.in: Regenerate.
2974         * configure: Regenerate.
2975
2976 2012-03-21  Cary Coutant  <ccoutant@google.com>
2977
2978         * Makefile.am: Add gdb-index.cc, gdb-index.h.
2979         * Makefile.in: Regenerate.
2980         * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
2981         (Sized_elf_reloc_mapper::symbol_section): New function.
2982         (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
2983         (make_elf_reloc_mapper): New function.
2984         (Dwarf_abbrev_table::clear_abbrev_codes): New function.
2985         (Dwarf_abbrev_table::do_read_abbrevs): New function.
2986         (Dwarf_abbrev_table::do_get_abbrev): New function.
2987         (Dwarf_ranges_table::read_ranges_table): New function.
2988         (Dwarf_ranges_table::read_range_list): New function.
2989         (Dwarf_pubnames_table::read_section): New function.
2990         (Dwarf_pubnames_table::read_header): New function.
2991         (Dwarf_pubnames_table::next_name): New function.
2992         (Dwarf_die::Dwarf_die): New function.
2993         (Dwarf_die::read_attributes): New function.
2994         (Dwarf_die::skip_attributes): New function.
2995         (Dwarf_die::set_name): New function.
2996         (Dwarf_die::set_linkage_name): New function.
2997         (Dwarf_die::attribute): New function.
2998         (Dwarf_die::string_attribute): New function.
2999         (Dwarf_die::int_attribute): New function.
3000         (Dwarf_die::uint_attribute): New function.
3001         (Dwarf_die::ref_attribute): New function.
3002         (Dwarf_die::child_offset): New function.
3003         (Dwarf_die::sibling_offset): New function.
3004         (Dwarf_info_reader::check_buffer): New function.
3005         (Dwarf_info_reader::parse): New function.
3006         (Dwarf_info_reader::do_parse): New function.
3007         (Dwarf_info_reader::do_read_string_table): New function.
3008         (Dwarf_info_reader::lookup_reloc): New function.
3009         (Dwarf_info_reader::get_string): New function.
3010         (Dwarf_info_reader::visit_compilation_unit): New function.
3011         (Dwarf_info_reader::visit_type_unit): New function.
3012         (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
3013         Sized_elf_reloc_mapper.
3014         (Sized_dwarf_line_info::symbol_section): Remove function.
3015         (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
3016         (Sized_dwarf_line_info::read_line_mappings): Remove object
3017         parameter, adjust callers.
3018         (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
3019         * dwarf_reader.h: Include <sys/types.h>.
3020         (class Track_relocs): Remove forward declaration.
3021         (class Elf_reloc_mapper): New class.
3022         (class Sized_elf_reloc_mapper): New class.
3023         (class Dwarf_abbrev_table): New class.
3024         (class Dwarf_range_list): New class.
3025         (class Dwarf_ranges_table): New class.
3026         (class Dwarf_pubnames_table): New class.
3027         (class Dwarf_die): New class.
3028         (class Dwarf_info_reader): New class.
3029         (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
3030         (Sized_dwarf_line_info::symbol_section): Remove member function.
3031         * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
3032         base class.
3033         * gdb-index.cc: New source file.
3034         * gdb-index.h: New source file.
3035         * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
3036         and .debug_types sections, call Layout::add_to_gdb_index.
3037         (Sized_relobj_incr::do_section_name): Implement.
3038         (Sized_relobj_incr::do_section_contents): Adjust parameter list and
3039         return type; Implement.
3040         (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
3041         return type.
3042         * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
3043         parameter list and return type.
3044         (Sized_incr_dynobj::do_section_contents): Likewise.
3045         * layout.cc: Include gdb-index.h.
3046         (Layout::Layout): Initialize gdb_index_data_.
3047         (Layout::init_fixed_output_section): Check for .gdb_index section.
3048         (Layout::add_to_gdb_index): New function. Instantiate.
3049         * layout.h: Add forward declaration for class Gdb_index.
3050         (Layout::add_to_gdb_index): New member function.
3051         (Layout::gdb_index_data_): New data member.
3052         * main.cc: Include gdb-index.h.
3053         (main): Print statistics for gdb index.
3054         * object.cc (Object::section_contents): Move code into
3055         do_section_contents.
3056         (need_decompressed_section): Check for sections needed when building
3057         gdb index.
3058         (build_compressed_section_map): Likewise.
3059         (Sized_relobj_file::do_read_symbols): Need local symbols when building
3060         gdb index.
3061         (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
3062         sections; call Layout::add_to_gdb_index.
3063         (Sized_relobj_file::do_decompressed_section_contents): Call
3064         do_section_contents directly.
3065         * object.h (Object::do_section_contents): Adjust parameter list and
3066         return type.
3067         (Object::do_decompressed_section_contents): Call do_section_contents
3068         directly.
3069         (Sized_relobj_file::do_section_contents): Adjust parameter list and
3070         return type.
3071         * options.h (class General_options): Add --gdb-index option.
3072         * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
3073         list and return type.
3074         * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
3075         * reloc.h (Track_relocs::checkpoint): New function.
3076         (Track_relocs::reset): New function.
3077
3078         * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
3079         New test cases.
3080         * testsuite/Makefile.in: Regenerate.
3081         * testsuite/gdb_index_test.cc: New test source file.
3082         * testsuite/gdb_index_test_1.sh: New test source file.
3083         * testsuite/gdb_index_test_2.sh: New test source file.
3084
3085 2012-03-19  Doug Kwan  <dougkwan@google.com>
3086
3087         * arm.cc (Target_arm::do_define_standard_symbols): New method.
3088         (Target_arm::do_finalize_sections): Remove code which defines
3089         __exidx_start and __exidx_end.  Make symbol table parameter
3090         anonymous as it is not used.
3091         * gold.cc (queue_middle_tasks): Call target hook to define any
3092         target-specific symbols.
3093         * target.h (Target::define_standard_symbols): New method.
3094         (Target::do_define_standard_symbols): Same.
3095         * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
3096         * testsuite/Makefile.in: Regenerate.
3097         * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
3098         and __exidx_end.
3099         * testsuite/arm_exidx_test.sh: Check that no unused dynamic
3100         relocations are generated for __exidx_start and __exidx_end.
3101
3102 2012-03-16  Doug Kwan  <dougkwan@google.com>
3103
3104         * testsuite/Makefile.am: Disable test initpri3b.
3105         * testsuite/Makefile.in: Regenerate.
3106
3107 2012-03-15  Doug Kwan  <dougkwan@google.com>
3108
3109         * arm.cc (Target_arm::got_section): Make .got section read-only
3110         if -z now is given.
3111
3112 2012-03-15  Ian Lance Taylor  <iant@google.com>
3113
3114         PR gold/13850
3115         * layout.cc (Layout::make_output_section): Correctly mark
3116         SHT_INIT_ARRAY, et. al., as relro.
3117
3118 2012-03-14  Doug Kwan  <dougkwan@google.com>
3119
3120         * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
3121         dynamic relocations for protected symbols in shared objects.
3122
3123 2012-03-13  Ian Lance Taylor  <iant@google.com>
3124
3125         * resolve.cc (Symbol_table::resolve): When merging common symbols,
3126         keep the larger alignment.
3127
3128 2012-03-12  Cary Coutant  <ccoutant@google.com>
3129
3130         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
3131         handling of DW_LNE_define_file.
3132
3133 2012-03-12  Cary Coutant  <ccoutant@google.com>
3134
3135         * reduced_debug_output.cc
3136         (Output_reduced_debug_info_section::get_die_end): Add new FORM
3137         codes to switch.
3138
3139 2012-02-29  Cary Coutant  <ccoutant@google.com>
3140
3141         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
3142
3143 2012-02-29  Cary Coutant  <ccoutant@google.com>
3144
3145         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
3146         Call Object::decompressed_section_contents.
3147         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
3148         New dtor.
3149         (Sized_dwarf_line_info::buffer_start_): New data member.
3150         * merge.cc (Output_merge_data::do_add_input_section): Call
3151         Object::decompressed_section_contents.
3152         (Output_merge_string::do_add_input_section): Likewise.
3153         * object.cc (need_decompressed_section): New function.
3154         (build_compressed_section_map): Decompress sections needed later.
3155         (Sized_relobj_file::do_decompressed_section_contents): New function.
3156         (Sized_relobj_file::do_discard_decompressed_sections): New function.
3157         * object.h (Object::decompressed_section_contents): New function.
3158         (Object::discard_decompressed_sections): New function.
3159         (Object::do_decompressed_section_contents): New function.
3160         (Object::do_discard_decompressed_sections): New function.
3161         (Compressed_section_info): New type.
3162         (Compressed_section_map): Include decompressed section contents.
3163         (Sized_relobj_file::do_decompressed_section_contents): New function.
3164         (Sized_relobj_file::do_discard_decompressed_sections): New function.
3165
3166 2012-02-16  Cary Coutant  <ccoutant@google.com>
3167
3168         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
3169         * testsuite/Makefile.in: Regenerate.
3170
3171 2012-02-14  Cary Coutant  <ccoutant@google.com>
3172
3173         * options.cc (General_options::finalize): Disallow -pie and -static.
3174
3175 2012-02-03  Doug Kwan  <dougkwan@google.com>
3176
3177         * arm.cc (Arm_relocate_functions::abs8,
3178         Arm_relocate_functions::abs16): Use
3179         Bits::has_signed_unsigned_overflow32.
3180         (Arm_relocate_functions::thm_abs8): Correct range of
3181         overflow check.
3182         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
3183         in assertions.
3184
3185 2012-02-02  Doug Kwan  <dougkwan@google.com>
3186
3187         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
3188         position independent outputs, not just shared objects.
3189
3190 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
3191
3192         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
3193         * configure: Regenerated.
3194
3195 2012-01-27  Ian Lance Taylor  <iant@google.com>
3196
3197         * reloc.h (Bits): New class with static functions, copied from
3198         namespace utils in arm.cc.
3199         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
3200         instead.
3201
3202 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
3203
3204         * incremental.cc (write_info_blocks): Correct relocation offset.
3205
3206 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
3207
3208         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
3209         (Relocate::tls_gd_to_le): Likewise.
3210
3211 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
3212
3213         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
3214
3215 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
3216
3217         * configure.ac: Check if -mcmodel=medium works.
3218         * configure: Regenerated.
3219
3220 2012-01-24  Cary Coutant  <ccoutant@google.com>
3221
3222         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
3223         definition and ...
3224         (read_unsigned_LEB_128_x): ... this new function.
3225         (read_signed_LEB_128): Replaced with inline definition and ...
3226         (read_signed_LEB_128_x): ... this new function.
3227         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
3228         (read_unsigned_LEB_128): Add inline definition.
3229         (read_signed_LEB_128_x): New function.
3230         (read_signed_LEB_128): Add inline definition.
3231         * testsuite/Makefile.am (leb128_unittest): New unit test.
3232         * testsuite/Makefile.in: Regenerate.
3233         * testsuite/leb128_unittest.cc: New unit test.
3234
3235 2012-01-23  Ian Lance Taylor  <iant@google.com>
3236
3237         PR gold/13617
3238         * i386.cc (Target_i386::do_code_fill): When using a jmp
3239         instruction, pad with nop instructions.
3240         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
3241
3242 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
3243
3244         * x86_64.cc (gc_process_relocs): Add typename on types used in
3245         template.
3246         (scan_relocs): Likewise.
3247         (relocate_section): Likewise.
3248         (apply_relocation): Likewise.
3249
3250 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
3251
3252         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
3253         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
3254         under x32.
3255
3256 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
3257
3258         * x86_64.cc: Initial support for x32.
3259
3260 2012-01-03  Cary Coutant  <ccoutant@google.com>
3261
3262         * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
3263         Use abstract base class for GOT.
3264         * gold/output.h (class Output_data_got_base): New abstract base class.
3265         (class Output_data_got): Derive from new base class, adjust ctors.
3266         (Output_data_got::reserve_slot): Make virtual; rename to
3267         do_reserve_slot; Adjust callers.
3268         * gold/target.h (Sized_target::init_got_plt_for_update): Return
3269         pointer to abstract base class.
3270         * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
3271
3272 2011-12-18  Ian Lance Taylor  <iant@google.com>
3273
3274         * object.h (Relobj::local_symbol_value): New function.
3275         (Relobj::local_plt_offset): New function.
3276         (Relobj::local_has_got_offset): New function.
3277         (Relobj::local_got_offset): New function.
3278         (Relobj::set_local_got_offset): New function.
3279         (Relobj::do_local_symbol_value): New pure virtual function.
3280         (Relobj::do_local_plt_offset): Likewise.
3281         (Relobj::do_local_has_got_offset): Likewise.
3282         (Relobj::do_local_got_offset): Likewise.
3283         (Relobj::do_set_local_got_offset): Likewise.
3284         (Sized_relobj::do_local_has_got_offset): Rename from
3285         local_has_got_offset.
3286         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
3287         (Sized_relobj::do_set_local_got_offset): Rename from
3288         set_local_got_offset.
3289         (Sized_relobj_file::do_local_plt_offset): Rename from
3290         local_plt_offset.
3291         (Sized_relobj_file::do_local_symbol_value): New function.
3292         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
3293         local_plt_offset.
3294         * output.cc (Output_data_got::Got_entry::write): Change object to
3295         Relobj.  Use local_symbol_value.
3296         (Output_data_got::add_global_with_rel): Change rel_dyn to
3297         Output_data_reloc_generic*.  Use add_global_generic.
3298         (Output_data_got::add_global_with_rela): Remove.  Change all
3299         callers to use add_global_with_rel.
3300         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
3301         Output_data_reloc_generic*.  Use add_global_generic.
3302         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
3303         callers to use add_global_pair_with_rel.
3304         (Output_data_got::add_local): Change object to Relobj*.
3305         (Output_data_got::add_local_plt): Likewise.
3306         (Output_data_got::add_local_with_rel): Change object to Relobj*,
3307         change rel_dyn to Output_data_reloc_generic*.  Use
3308         add_local_generic.
3309         (Output_data_got::add_local_with_rela): Remove.  Change all
3310         callers to use all_local_with_rel.
3311         (Output_data_got::add_local_pair_with_rel): Change object to
3312         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
3313         add_output_section_generic.
3314         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
3315         callers to use add_local_pair_with_rel.
3316         (Output_data_got::reserve_local): Change object to Relobj*.
3317         * output.h: (class Output_data_reloc_generic): Add pure virtual
3318         declarations for add_global_generic, add_local_generic,
3319         add_output_section_generic.
3320         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
3321         functions for Output_data_reloc_generic.  Update declarations for
3322         changes listed in output.cc.
3323         (class Output_data_got): Change template parameter to got_size.
3324         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
3325         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
3326         function.
3327         (Sized_relobj_incr::do_local_plt_offset): New function.
3328         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
3329         add_global_generic.
3330
3331 2011-12-17  Cary Coutant  <ccoutant@google.com>
3332
3333         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
3334         * resolve.cc (Symbol_table::resolve): Likewise.
3335         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
3336         arrays.
3337         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
3338
3339 2011-12-16  Ian Lance Taylor  <iant@google.com>
3340
3341         * output.h (Output_data_reloc_generic::add): Only call
3342         add_dynamic_reloc if this is a dynamic reloc section.
3343
3344 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
3345
3346         PR gold/13505
3347         * target-reloc.h (apply_relocation): Replace <64, false> with
3348         <size, big_endian>.
3349
3350 2011-11-25  Nick Clifton  <nickc@redhat.com>
3351
3352         * po/it.po: New Italian translation.
3353
3354 2011-11-17  Sterling Augustine  <saugustine@google.com>
3355
3356         * script.cc (script_include_directive): Implement.
3357         (read_script_file): New local variables name and search_path. Update
3358         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
3359         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
3360         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
3361
3362 2011-11-11  Sterling Augustine  <saugustine@google.com>
3363
3364         * yyscript.y (section_cmd): Add support for INCLUDE directive.
3365         (file_or_sections_cmd): Likewise.
3366
3367 2011-11-11  Doug Kwan  <dougkwan@google.com>
3368
3369         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
3370         if --just-symbols is given.
3371
3372 2011-11-10  Doug Kwan  <dougkwan@google.com>
3373
3374         PR gold/13362
3375         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
3376         when processing data relocs.
3377         * reloc.h (Relocate_functions::rel_unaligned): New method.
3378         (Relocate_functions::pcrel_unaligned): Ditto.
3379         (Relocate_functions::rel32_unaligned): Ditto.
3380         (Relocate_functions::pcrel32_unaligned): Ditto.
3381
3382 2011-11-09  Doug Kwan  <dougkwan@google.com>
3383
3384         PR gold/13362
3385         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
3386         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
3387         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
3388         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
3389         (Relocate_functions::rel_unaligned): New.
3390         (Relocate_functions::rel32_unaligned): New.
3391         * target-reloc.h (relocate_for_relocatable): Add code to handle
3392         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
3393         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
3394         arm_unaligned_reloc_r): New targets.
3395         * testsuite/Makefile.in: Regenerate.
3396         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
3397         linking.
3398
3399 2011-11-02  Ian Lance Taylor  <iant@google.com>
3400
3401         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
3402         NATIVE_LINKER.
3403         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
3404         * options.cc (General_options::finalize): Use library search path
3405         from configure script if specified.  If not native and no sysroot,
3406         only search TOOLLIBDIR.
3407         * options.h (Search_directory::Search_directory): Change name to
3408         const std::string&.
3409         (General_options::add_to_library_path_with_sysroot): Change arg to
3410         const std::string&.
3411         * configure, Makefile.in, config.in: Rebuild.
3412
3413 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
3414
3415         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
3416         we are working around the ARM1176 Erratum.
3417         * options.h (General_options::fix_arm1176): Add option.
3418         * testsuite/Makefile.am: Add testcases, and keep current ones
3419         working.
3420         * testsuite/Makefile.in: Regenerate.
3421         * testsuite/arm_fix_1176.s: New file.
3422         * testsuite/arm_fix_1176.sh: Likewise.
3423
3424 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
3425
3426         * arm.cc (Target_arm::Target_arm): Remove initialisation of
3427         may_use_blx_.
3428         (Target_arm::may_use_blx): Remove method.
3429         (Target_arm::set_may_use_blx): Likewise.
3430         (Target_arm::may_use_v4t_interworking): New method.
3431         (Target_arm::may_use_v5t_interworking): Likewise.
3432         (Target_arm::may_use_blx_): Remove member variable.
3433         (Arm_relocate_functions::arm_branch_common): Check for v5T
3434         interworking.
3435         (Arm_relocate_functions::thumb_branch_common): Likewise.
3436         (Reloc_stub::stub_type_for_reloc): Likewise.
3437         (Target_arm::do_finalize_sections): Correct interworking checks.
3438         * testsuite/Makefile.am: Add new tests.
3439         * testsuite/Makefile.in: Regenerate.
3440         * testsuite/arm_farcall_arm_arm.s: New test.
3441         * testsuite/arm_farcall_arm_arm.sh: Likewise.
3442         * testsuite/arm_farcall_arm_thumb.s: Likewise.
3443         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
3444         * testsuite/arm_farcall_thumb_arm.s: Likewise.
3445         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
3446         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
3447         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
3448
3449 2011-10-31  Cary Coutant  <ccoutant@google.com>
3450
3451         PR gold/13023
3452         * expression.cc (Expression::eval_with_dot): Add
3453         is_section_dot_assignment parameter.
3454         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
3455         absolute and assigning to dot within a section.
3456         * script-sections.cc
3457         (Output_section_element_assignment::set_section_addresses): Pass
3458         dot_section to set_if_absolute.
3459         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
3460         as is_section_dot_assignment flag to eval_with_dot.
3461         (Output_section_element_dot_assignment::set_section_addresses):
3462         Likewise.
3463         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
3464         parameter.  Also set value if relative to dot_section; set the
3465         symbol's output_section.
3466         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
3467         parameter.  Adjust all callers.
3468         (Expression::eval_maybe_dot): Likewise.
3469         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
3470         Adjust all callers.
3471         * testsuite/script_test_2.t: Test assignment of an absolute value
3472         to dot within an output section element.
3473
3474 2011-10-31  Cary Coutant  <ccoutant@google.com>
3475
3476         * options.h (class General_options): Add --[no-]gnu-unique options.
3477         * symtab.cc (Symbol_table::sized_write_globals): Convert
3478         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
3479
3480 2011-10-31  Cary Coutant  <ccoutant@google.com>
3481
3482         PR gold/13359
3483         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
3484         unnecessary assertion.
3485         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
3486
3487 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
3488
3489         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
3490         gc_mark_symbol.
3491         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
3492         gc_mark_symbol.
3493         Change to just keep the section associated with symbol.
3494         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
3495         they are externally visible and --export-dynamic is turned on.
3496         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
3497
3498 2011-10-19  Ian Lance Taylor  <iant@google.com>
3499
3500         PR gold/13163
3501         * script-sections.cc
3502         (Output_section_element_dot_assignment::needs_output_section): New
3503         function.
3504
3505 2011-10-19  Ian Lance Taylor  <iant@google.com>
3506
3507         PR gold/13204
3508         * layout.cc (Layout::segment_precedes): Don't assert failure if a
3509         --section-start option was seen.
3510         * options.h (General_options::any_section_start): New function.
3511
3512 2011-10-18  David S. Miller  <davem@davemloft.net>
3513
3514         PR binutils/13301
3515         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
3516         member to track relocation locations that have moved during TLS
3517         reloc optimizations.
3518         (Target_sparc::Relocate::Relocate): Initialize to NULL.
3519         (Target_sparc::Relocate::relocate): Adjust view down by 4
3520         bytes if it matches reloc_adjust_addr_.
3521         (Target_sparc::Relocate::relocate_tls): Always move the
3522         __tls_get_addr call delay slot instruction forward 4 bytes when
3523         performing relaxation.
3524
3525 2011-10-18  Cary Coutant  <ccoutant@google.com>
3526
3527         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
3528         (Output_file::map_no_anonymous): Check for non-zero
3529         return code from posix_fallocate.
3530
3531 2011-10-17  Cary Coutant  <ccoutant@google.com>
3532
3533         PR gold/13245
3534         * plugin.cc (is_visible_from_outside): Check for symbols
3535         referenced from dynamic objects.
3536         * resolve.cc (Symbol_table::resolve): Don't count references
3537         from dynamic objects as references from real ELF files.
3538         * testsuite/plugin_test_2.sh: Adjust expected result.
3539
3540 2011-10-17  Cary Coutant  <ccoutant@google.com>
3541
3542         * gold.cc: Include timer.h.
3543         (queue_middle_tasks): Stamp time.
3544         (queue_final_tasks): Likewise.
3545         * main.cc (main): Store timer in parameters.  Print timers
3546         for each pass.
3547         * parameters.cc (Parameters::Parameters): Initialize timer_.
3548         (Parameters::set_timer): New function.
3549         (set_parameters_timer): New function.
3550         * parameters.h (Parameters::set_timer): New function.
3551         (Parameters::timer): New function.
3552         (Parameters::timer_): New data member.
3553         (set_parameters_timer): New function.
3554         * timer.cc (Timer::stamp): New function.
3555         (Timer::get_pass_time): New function.
3556         * timer.h (Timer::stamp): New function.
3557         (Timer::get_pass_time): New function.
3558         (Timer::pass_times_): New data member.
3559
3560 2011-10-17  Cary Coutant  <ccoutant@google.com>
3561
3562         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
3563         task for members of lib groups.
3564
3565 2011-10-17  Cary Coutant  <ccoutant@google.com>
3566
3567         PR gold/13288
3568         * fileread.cc (File_read::find_view): Add assert.
3569         (File_read::make_view): Move bounds check (replace with assert)...
3570         (File_read::find_or_make_view): ... to here.
3571
3572 2011-10-12  Cary Coutant  <ccoutant@google.com>
3573
3574         * output.cc (Output_file::open_base_file): Handle case where
3575         ::read returns less than requested size.
3576
3577 2011-10-10  Cary Coutant  <ccoutant@google.com>
3578
3579         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
3580         Initialize defined_count_.
3581         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
3582         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
3583         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
3584         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
3585         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
3586         * incremental.h (Sized_relobj_incr::defined_count_): New data
3587         member.
3588         (Sized_incr_dynobj::defined_count_): New data member.
3589         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
3590         Return zeroes instead of internal error.
3591
3592 2011-10-10  Cary Coutant  <ccoutant@google.com>
3593
3594         PR gold/13249
3595         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
3596         (Output_reloc::symbol_value): Return PLT offset if flag is set.
3597         * output.h (class Output_reloc): Add use_plt_offset flag.
3598         (Output_reloc::type_): Adjust size of bit field.
3599         (Output_reloc::use_plt_offset_): New bit field.
3600         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
3601         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
3602         flag.  Adjust all callers.
3603         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
3604         creating RELATIVE relocations.
3605
3606 2011-10-10  Nick Clifton  <nickc@redhat.com>
3607
3608         * po/es.po: Updated Spanish translation.
3609         * po/fi.po: Updated Finnish translation.
3610
3611 2011-10-03   Diego Novillo  <dnovillo@google.com>
3612
3613         * options.cc (parse_uint): Fix dereference of RETVAL.
3614
3615 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
3616
3617         * layout.h (section_order_map_): New member.
3618         (get_section_order_map): New member function.
3619         * output.cc (Output_section::add_input_section): Check for patterns
3620         only when --section-ordering-file is specified.
3621         * gold.cc (queue_middle_tasks): Delay updating order of sections till
3622         output_sections have been formed.
3623         * layout.cc (Layout_Layout): Initialize section_order_map_.
3624         * plugin.cc (update_section_order): Store order in order_map. Do not
3625         update the order.
3626         * testsuite/Makefile.am: Add test case for plugin_final_layout.
3627         * testsuite/Makefile.in: Regenerate.
3628         * testsuite/plugin_section_order.c: New file.
3629         * testsuite/plugin_final_layout.cc: New file.
3630         * testsuite/plugin_final_layout.sh: New file.
3631
3632 2011-09-29  Cary Coutant  <ccoutant@google.com>
3633
3634         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
3635         Check for NULL.
3636         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
3637         symbols during incremental update.
3638         (Symbol_table::add_from_dynobj): Likewise.
3639
3640 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3641             Ian Lance Taylor  <iant@google.com>
3642
3643         * symtab.cc (Symbol_table::define_special_symbol): Always
3644         canonicalize version string.
3645
3646 2011-09-26  Cary Coutant  <ccoutant@google.com>
3647
3648         * gold.cc (queue_initial_tasks): Move option checks ...
3649         * options.cc (General_options::finalize): ... to here. Disable
3650         some options; make others fatal.
3651
3652 2011-09-26  Cary Coutant  <ccoutant@google.com>
3653
3654         gcc PR lto/47247
3655         * plugin.cc (get_symbols_v2): New function.
3656         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
3657         (is_referenced_from_outside): New function.
3658         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
3659         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
3660         (get_symbols): Pass version parameter.
3661         (get_symbols_v2): New function.
3662         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
3663         parameter.
3664         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
3665         (onload): Add LDPT_GET_SYMBOLS_V2.
3666         (all_symbols_read_hook): Use get_symbols_v2; check for
3667         LDPR_PREVAILING_DEF_IRONLY_EXP.
3668         * testsuite/plugin_test_3.sh: Update expected results.
3669
3670 2011-09-23  Simon Baldwin  <simonb@google.com>
3671
3672         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
3673         configuration options.
3674         * configure: Regenerate.
3675         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
3676         * Makefile.in: Regenerate.
3677         * testsuite/Makefile.in: Regenerate.
3678
3679 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
3680
3681         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
3682
3683 2011-09-19  Cary Coutant  <ccoutant@google.com>
3684
3685         * incremental.cc (can_incremental_update): Fix typo in comment.
3686         * incremental.h (can_incremental_update): Likewise.
3687
3688 2011-09-18  Cary Coutant  <ccoutant@google.com>
3689
3690         * incremental.cc (can_incremental_update): New function.
3691         * incremental.h (can_incremental_update): New function.
3692         * layout.cc (Layout::init_fixed_output_section): Call it.
3693         (Layout::make_output_section): Don't allow patch space in .eh_frame.
3694         * object.cc (Sized_relobj_file::do_layout): Call
3695         can_incremental_update.
3696
3697 2011-09-13  Cary Coutant  <ccoutant@google.com>
3698
3699         * configure.ac: Check for glibc support for gnu_indirect_function
3700         support with static linking, setting automake conditional
3701         IFUNC_STATIC.
3702         * Makefile.in: Regenerate.
3703         * configure: Regenerate.
3704
3705         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
3706         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
3707         for IFUNC_STATIC.
3708         * testsuite/Makefile.in: Regenerate.
3709
3710 2011-09-13  Cary Coutant  <ccoutant@google.com>
3711
3712         * incremental.cc (Sized_relobj_incr::do_layout): Call
3713         report_comdat_group for kept comdat sections.
3714         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
3715         * testsuite/Makefile.in: Regenerate.
3716         * testsuite/incr_comdat_test_1.cc: New source file.
3717         * testsuite/incr_comdat_test_2_v1.cc: New source file.
3718         * testsuite/incr_comdat_test_2_v2.cc: New source file.
3719         * testsuite/incr_comdat_test_2_v3.cc: New source file.
3720
3721 2011-09-13  Ian Lance Taylor  <iant@google.com>
3722
3723         * object.cc (Sized_relobj_file::do_layout): Remove unused local
3724         variable external_symbols_offset.
3725
3726 2011-09-12  Ian Lance Taylor  <iant@google.com>
3727
3728         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
3729         triggered if object has no symbols.
3730
3731 2011-09-09  David S. Miller  <davem@davemloft.net>
3732
3733         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
3734         (Output_fill_debug_line::do_write): Likewise.
3735
3736 2011-08-29  Cary Coutant  <ccoutant@google.com>
3737
3738         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
3739         casts to match formatting specs.
3740         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
3741
3742 2011-08-26  Cary Coutant  <ccoutant@google.com>
3743
3744         * layout.cc (Free_list::allocate): Provide guarantee of minimum
3745         remaining hole size when allocating.
3746         (Layout::make_output_section): Set fill methods for debug sections.
3747         * layout.h (Free_list::Free_list_node): Move from private to
3748         public.
3749         (Free_list::set_min_hole_size): New function.
3750         (Free_list::begin, Free_list::end): New functions.
3751         (Free_list::min_hole_): New data member.
3752         * output.cc: Include dwarf.h.
3753         (Output_fill_debug_info::do_minimum_hole_size): New function.
3754         (Output_fill_debug_info::do_write): New function.
3755         (Output_fill_debug_line::do_minimum_hole_size): New function.
3756         (Output_fill_debug_line::do_write): New function.
3757         (Output_section::Output_section): Initialize new data member.
3758         (Output_section::set_final_data_size): Ensure patch space is larger
3759         than minimum hole size.
3760         (Output_section::do_write): Fill holes in debug sections.
3761         * output.h (Output_fill): New class.
3762         (Output_fill_debug_info): New class.
3763         (Output_fill_debug_line): New class.
3764         (Output_section::set_free_space_fill): New function.
3765         (Output_section::free_space_fill_): New data member.
3766         * testsuite/Makefile.am (incremental_test_3): Add
3767         --incremental-patch option.
3768         (incremental_test_4): Likewise.
3769         (incremental_test_5): Likewise.
3770         (incremental_test_6): Likewise.
3771         (incremental_copy_test): Likewise.
3772         (incremental_common_test_1): Likewise.
3773         * testsuite/Makefile.in: Regenerate.
3774
3775 2011-08-26  Nick Clifton  <nickc@redhat.com>
3776
3777         * po/es.po: Updated Spanish translation.
3778
3779 2011-08-01  Cary Coutant  <ccoutant@google.com>
3780
3781         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
3782         * gold/testsuite/Makefile.in: Regenerate.
3783         * gold/testsuite/justsyms_exec.c: New source file.
3784         * gold/testsuite/justsyms_lib.c: New source file.
3785
3786 2011-08-01  Cary Coutant  <ccoutant@google.com>
3787
3788         * layout.cc (Layout::set_segment_offsets): Don't realign text
3789         segment if -Ttext was specified.
3790         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
3791         file type.
3792         * object.h (Sized_relobj_file::e_type): New function.
3793         (Sized_relobj_file::e_type_): New data member.
3794         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
3795         base address for ET_EXEC files.
3796         * target.cc (Target::do_make_elf_object_implementation): Allow
3797         ET_EXEC files with --just-symbols option.
3798
3799 2011-07-28  Cary Coutant  <ccoutant@google.com>
3800
3801         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
3802         Add thread_number parameter.
3803         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
3804         * workqueue-threads.cc
3805         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
3806         current thread if its thread number is greater than desired thread
3807         count.
3808         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
3809         Add thread_number parameter.
3810         (Workqueue::should_cancel_thread): Likewise.
3811         (Workqueue::find_runnable_or_wait): Pass thread_number to
3812         should_cancel_thread.
3813         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
3814         parameter.
3815
3816 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
3817
3818         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
3819         only after checking if it cannot be forced local.
3820         * symtab.h (is_externally_visible): Check if the symbol is not forced
3821         local.
3822
3823 2011-07-15  Ian Lance Taylor  <iant@google.com>
3824
3825         * options.h (class General_options): Add --print-output-format.
3826         Move -EL next to -EB, for  better --help output.
3827         * target-select.cc: Include <cstdio>, "options.h", and
3828         "parameters.h".
3829         (Target_selector::do_target_bfd_name): New function.
3830         (print_output_format): New function.
3831         * target-select.h (class Target_selector): Update declarations.
3832         (Target_selector::target_bfd_name): New function.
3833         (print_output_format): Declare.
3834         * main.cc: Include "target-select.h".
3835         (main): Handle --print-output-format.
3836         * gold.cc: Include "target-select.h".
3837         (queue_initial_tasks): Handle --print-output-format when there are
3838         no input files.
3839         * parameters.cc (parameters_force_valid_target): Give a better
3840         error message if -EB/-EL does not match target.
3841         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
3842         function.
3843
3844 2011-07-15  Ian Lance Taylor  <iant@google.com>
3845
3846         * i386.cc (class Output_data_plt_i386): Add layout_ field.
3847         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
3848         (Output_data_plt_i386::do_write): Write address of .dynamic
3849         section to first entry in .got.plt section.
3850         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
3851         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
3852         Initialize layout_.
3853         (Output_data_plt_x86_64::do_write): Write address of .dynamic
3854         section to first entry in .got.plt section.
3855         * layout.h (Layout::dynamic_section): New function.
3856
3857 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
3858
3859         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
3860         to claim_file call.
3861         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
3862         input_section_position_, and input_section_glob_.
3863         (read_layout_from_file): Call function section_ordering_specified.
3864         * layout.h (is_section_ordering_specified): New function.
3865         (section_ordering_specified): New function.
3866         (section_ordering_specified_): New boolean member.
3867         * main.cc(main): Call load_plugins after layout object is defined.
3868         * output.cc (Output_section::add_input_section): Use
3869         function section_ordering_specified to check if section ordering is
3870         needed.
3871         * output.cc (Output_section::add_relaxed_input_section): Use
3872         function section_ordering_specified to check if section ordering is
3873         needed.
3874         (Output_section::update_section_layout): New function.
3875         (Output_section::sort_attached_input_sections): Check if input section
3876         must be reordered.
3877         * output.h (Output_section::update_section_layout): New function.
3878         * plugin.cc (get_section_count): New function.
3879         (get_section_type): New function.
3880         (get_section_name): New function.
3881         (get_section_contents): New function.
3882         (update_section_order): New function.
3883         (allow_section_ordering): New function.
3884         (Plugin::load): Add the new interfaces to the transfer vector.
3885         (Plugin_manager::load_plugins): New parameter.
3886         (Plugin_manager::all_symbols_read): New parameter.
3887         (Plugin_manager::claim_file): New parameter. Save the elf object for
3888         unclaimed objects.
3889         (Plugin_manager::get_elf_object): New function.
3890         (Plugin_manager::get_view): Change to directly use the bool to check
3891         if get_view is called from claim_file_hook.
3892         * plugin.h (input_objects): New function
3893         (Plugin__manager::load_plugins): New parameter.
3894         (Plugin_manager::claim_file): New parameter.
3895         (Plugin_manager::get_elf_object): New function.
3896         (Plugin_manager::in_claim_file_handler): New function.
3897         (Plugin_manager::in_claim_file_handler_): New member.
3898         (layout): New function.
3899         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
3900         handler with an extra parameter. Make the elf object before calling
3901         claim_file handler.
3902         * testsuite/plugin_test.c (get_section_count): New function pointer.
3903         (get_section_type): New function pointer.
3904         (get_section_name): New function pointer.
3905         (get_section_contents): New function pointer.
3906         (update_section_order): New function pointer.
3907         (allow_section_ordering): New function pointer.
3908         (onload): Check if the new interfaces exist.
3909
3910 2011-07-13  Ian Lance Taylor  <iant@google.com>
3911
3912         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
3913         relro section.
3914         * x86_64.cc (Target_x86_64::got_section): Likewise.
3915         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
3916         (relro_now_test_SOURCES): New variable.
3917         (relro_now_test_DEPENDENCIES): New variable.
3918         (relro_now_test_LDFLAGS): New variable.
3919         (relro_now_test_LDADD): New variable.
3920         (relro_now_test.so): New target.
3921         * testsuite/Makefile.in: Rebuild.
3922
3923 2011-07-12  Ian Lance Taylor  <iant@google.com>
3924
3925         PR gold/12980
3926         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
3927         GLOB_DAT relocation rather than a RELATIVE relocation for a
3928         protected symbol when creating a shared library.
3929         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
3930         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
3931         * testsuite/protected_main_1.cc (main): Test that protected
3932         function has same address.
3933
3934 2011-07-11  Ian Lance Taylor  <iant@google.com>
3935
3936         PR gold/12979
3937         * options.h (class General_options): Add -Bgroup.
3938         * options.cc (General_options::finalize): If -Bgroup is set,
3939         default to --unresolved-symbols=report-all.
3940         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
3941         * target-reloc.h (issue_undefined_symbol_error): Handle
3942         --unresolved-symbols=report-all.
3943
3944 2011-07-08  Ian Lance Taylor  <iant@google.com>
3945
3946         PR gold/11985
3947         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
3948         if linker script discards key sections.
3949         (Layout::create_dynamic_symtab): Likewise.
3950         (Layout::assign_local_dynsym_offsets): Likewise.
3951         (Layout::sized_create_version_sections): Likewise.
3952         (Layout::create_interp): Likewise.
3953         (Layout::finish_dynamic_section): Likewise.
3954         (Layout::set_dynamic_symbol_size): Likewise.
3955
3956 2011-07-08  Ian Lance Taylor  <iant@google.com>
3957
3958         PR gold/12386
3959         * options.h (class General_options): Add --unresolved-symbols.
3960         * target-reloc.h (issue_undefined_symbol_error): Check
3961         --unresolved-symbols.  Add comments.
3962
3963 2011-07-08  Ian Lance Taylor  <iant@google.com>
3964
3965         * testsuite/odr_violation2.cc (Ordering::operator()): Make
3966         expression more complex.
3967
3968 2011-07-08  Ian Lance Taylor  <iant@google.com>
3969
3970         PR gold/11317
3971         * target-reloc.h (issue_undefined_symbol_error): New inline
3972         function, broken out of relocate_section.
3973         (relocate_section): Call issue_undefined_symbol_error.
3974         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
3975         there is no TLS segment if we are about to issue an undefined
3976         symbol error.
3977         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
3978
3979 2011-07-08  Ian Lance Taylor  <iant@google.com>
3980
3981         PR gold/12279
3982         * resolve.cc (Symbol_table::should_override): Add fromtype
3983         parameter.  Change all callers.  Give error when linking together
3984         TLS and non-TLS symbol.
3985         (Symbol_table::should_override_with_special): Add fromtype
3986         parameter.  Change all callers.
3987         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
3988         there is no TLS segment if we have reported some errors.
3989         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
3990
3991 2011-07-08  Ian Lance Taylor  <iant@google.com>
3992
3993         PR gold/12372
3994         * target.h (Target::plt_address_for_global): New function.
3995         (Target::plt_address_for_local): New function.
3996         (Target::plt_section_for_global): Remove.
3997         (Target::plt_section_for_local): Remove.
3998         (Target::do_plt_address_for_global): New virtual function.
3999         (Target::do_plt_address_for_local): New virtual function.
4000         (Target::do_plt_section_for_global): Remove.
4001         (Target::do_plt_section_for_local): Remove.
4002         (Target::register_global_plt_entry): Add Symbol_table and Layout
4003         parameters.
4004         * output.cc (Output_data_got::Got_entry::write): Use
4005         plt_address_for_global and plt_address_for_local.
4006         * layout.cc (Layout::add_target_dynamic_tags): Use size and
4007         address of output section.
4008         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
4009         got_irelative_, and irelative_count_ fields.  Update
4010         declarations.
4011         (Output_data_plt_i386::has_irelative_section): New function.
4012         (Output_data_plt_i386::entry_count): Add irelative_count_.
4013         (Output_data_plt_i386::set_final_data_size): Likewise.
4014         (class Target_i386): Add got_irelative_ and rel_irelative_
4015         fields.  Update declarations.
4016         (Target_i386::Target_i386): Initialize new fields.
4017         (Target_i386::do_plt_address_for_global): New function replacing
4018         do_plt_section_for_global.
4019         (Target_i386::do_plt_address_for_local): New function replacing
4020         do_plt_section_for_local.
4021         (Target_i386::got_section): Create got_irelative_.
4022         (Target_i386::rel_irelative_section): New function.
4023         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
4024         fields.  Don't define __rel_iplt_{start,end}.
4025         (Output_data_plt_i386::add_entry): Add symtab and layout
4026         parameters.  Change all callers.  Use different PLT and GOT for
4027         IFUNC symbols.
4028         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
4029         layout parameters.  Change all callers.  Use different PLT and
4030         GOT.
4031         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
4032         (Output_data_plt_i386::rel_irelative): New function.
4033         (Output_data_plt_i386::address_for_global): New function.
4034         (Output_data_plt_i386::address_for_local): New function.
4035         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
4036         IRELATIVE GOT when changing IFUNC GOT entries.
4037         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
4038         reloc.
4039         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
4040         if we didn't create an IRELATIVE GOT.
4041         (Target_i386::Relocate::relocate): Use plt_address_for_global and
4042         plt_address_for_local.
4043         (Target_i386::do_dynsym_value): Use plt_address_for_global.
4044         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
4045         got_irelative_, and irelative_count_ fields.  Update
4046         declarations.
4047         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
4048         Initialize new fields.  Remove symtab parameter.  Change all
4049         callers.
4050         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
4051         irelative_count_.
4052         (Output_data_plt_x86_64::has_irelative_section): New function.
4053         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
4054         (class Target_x86_64): Add got_irelative_ and rel_irelative_
4055         fields.  Update declarations.
4056         (Target_x86_64::Target_x86_64): Initialize new fields.
4057         (Target_x86_64::do_plt_address_for_global): New function replacing
4058         do_plt_section_for_global.
4059         (Target_x86_64::do_plt_address_for_local): New function replacing
4060         do_plt_section_for_local.
4061         (Target_x86_64::got_section): Create got_irelative_.
4062         (Target_x86_64::rela_irelative_section): New function.
4063         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
4064         all callers.  Don't create __rel_iplt_{start,end}.
4065         (Output_data_plt_x86_64::add_entry): Add symtab and layout
4066         parameters.  Change all callers.  Use different PLT and GOT for
4067         IFUNC symbols.
4068         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
4069         layout parameters.  Change all callers.  Use different PLT and
4070         GOT.
4071         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
4072         parameters.  Change all callers.  Use different PLT and GOT for
4073         IFUNC symbols.
4074         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
4075         (Output_data_plt_x86_64::rela_irelative): New function.
4076         (Output_data_plt_x86_64::address_for_global): New function.
4077         (Output_data_plt_x86_64::address_for_local): New function.
4078         (Output_data_plt_x86_64::set_final_data_size): Likewise.
4079         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
4080         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
4081         (Target_x86_64::register_global_plt_entry): Add symtab and layout
4082         parameters.
4083         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
4084         reloc.
4085         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
4086         symbols if we didn't create an IRELATIVE GOT.
4087         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
4088         plt_address_for_local.
4089         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
4090         * testsuite/ifuncvar1.c: New test file.
4091         * testsuite/ifuncvar2.c: New test file.
4092         * testsuite/ifuncvar3.c: New test file.
4093         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
4094         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
4095         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
4096         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
4097         * testsuite/Makefile.in: Rebuild.
4098
4099 2011-07-07  Cary Coutant  <ccoutant@google.com>
4100
4101         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
4102         (two_file_test_1_ndebug.o): Likewise.
4103         (two_file_test_1b_ndebug.o): Likewise.
4104         (two_file_test_2_ndebug.o): Likewise.
4105         (two_file_test_main_ndebug.o): Likewise.
4106         (incremental_test_2): Link with no-debug versions.
4107
4108 2011-07-06  Cary Coutant  <ccoutant@google.com>
4109
4110         * gold/incremental.cc
4111         (Output_section_incremental_inputs::write_info_blocks): Check for
4112         hidden and internal symbols.
4113
4114 2011-07-06  Cary Coutant  <ccoutant@google.com>
4115
4116         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
4117         Check disposition for startup file.
4118         (Incremental_inputs::report_command_line): Ignore
4119         --incremental-startup-unchanged option.
4120         * options.cc (General_options::parse_incremental_startup_unchanged):
4121         New function.
4122         (General_options::General_options): Initialize new data member.
4123         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
4124         (General_options): Add --incremental-startup-unchanged option.
4125         (General_options::incremental_startup_disposition): New function.
4126         (General_options::incremental_startup_disposition_): New data member.
4127
4128 2011-07-06  Cary Coutant  <ccoutant@google.com>
4129
4130         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
4131         input file index to Script_info ctor.
4132         (Sized_incremental_binary::do_file_has_changed): Find the
4133         command-line argument for files named in scripts.
4134         * incremental.h (Script_info::Script_info): New ctor
4135         with input file index.
4136         (Script_info::input_file_index): New function.
4137         (Script_info::input_file_index_): New data member.
4138         (Incremental_binary::get_library): Add const.
4139         (Incremental_binary::get_script_info): Add const.
4140         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
4141         * testsuite/Makefile.am (incremental_test_5): New test case.
4142         (incremental_test_6): New test case.
4143         * testsuite/Makefile.in: Regenerate.
4144
4145 2011-07-06  Cary Coutant  <ccoutant@google.com>
4146
4147         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
4148         debug output when command lines differ.
4149
4150 2011-07-06  Cary Coutant  <ccoutant@google.com>
4151
4152         * incremental.cc (Incremental_inputs::report_command_line): Ignore
4153         --incremental-patch option.
4154         * layout.cc (Free_list::allocate): Extend allocation beyond original
4155         end if enabled.
4156         (Layout::make_output_section): Mark sections that should get
4157         patch space.
4158         * options.cc (parse_percent): New function.
4159         * options.h (parse_percent): New function.
4160         (DEFINE_percent): New macro.
4161         (General_options): Add --incremental-patch option.
4162         * output.cc (Output_section::Output_section): Initialize new data
4163         members.
4164         (Output_section::add_input_section): Print section name when out
4165         of patch space.
4166         (Output_section::add_output_section_data): Likewise.
4167         (Output_section::set_final_data_size): Add patch space when
4168         doing --incremental-full.
4169         (Output_section::do_reset_address_and_file_offset): Remove patch
4170         space.
4171         (Output_segment::set_section_list_addresses): Print debug output
4172         only if --incremental-update.
4173         * output.h (Output_section::set_is_patch_space_allowed): New function.
4174         (Output_section::is_patch_space_allowed_): New data member.
4175         (Output_section::patch_space_): New data member.
4176         * parameters.cc (Parameters::incremental_full): New function.
4177         * parameters.h (Parameters::incremental_full): New function
4178         * testsuite/Makefile.am (incremental_test_2): Add test for
4179         --incremental-patch option.
4180         * testsuite/Makefile.in: Regenerate.
4181         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
4182         (t18): Remove function body.
4183
4184 2011-07-05  Doug Kwan  <dougkwan@google.com>
4185
4186         PR gold/12771
4187         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
4188         Arm_Address type for relocation result.
4189         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
4190         overflow check.
4191         (Arm_relocate_functions::abs32): Use unaligned access.
4192         (Arm_relocate_functions::rel32): Ditto.
4193         (Arm_relocate_functions::prel31): Ditto.
4194         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
4195         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
4196         static data relocations.
4197         * testsuite/Makefile.in: Regnerate.
4198         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
4199
4200 2011-07-05  Ian Lance Taylor  <iant@google.com>
4201
4202         PR gold/12392
4203         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
4204         symbols if necessary.
4205         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
4206
4207 2011-07-05  Ian Lance Taylor  <iant@google.com>
4208
4209         PR gold/12952
4210         * resolve.cc (Symbol::override_base_with_special): Simply override
4211         version with special symbol version, ignoring previous version.
4212
4213 2011-07-05  Ian Lance Taylor  <iant@google.com>
4214
4215         * object.cc (Sized_relobj_file::include_section_group): Add
4216         information to comment about signature location.
4217
4218 2011-07-02  Ian Lance Taylor  <iant@google.com>
4219
4220         PR gold/12957
4221         * options.h (class General_options): Add -f and -F.
4222         * options.cc (General_options::finalize): Fatal error if -f/-F
4223         are used without -shared.
4224         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
4225
4226 2011-07-02  Ian Lance Taylor  <iant@google.com>
4227
4228         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
4229
4230 2011-07-01  Ian Lance Taylor  <iant@google.com>
4231
4232         PR gold/12525
4233         PR gold/12952
4234         * resolve.cc (Symbol::override_base_with_special): Don't override
4235         the version if the overriding symbol has a different name.
4236         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
4237         all callers.  If we give an error about an undefined version,
4238         define the base version if necessary.
4239         * dynobj.h (class Versions): Update declaration.
4240         * testsuite/weak_alias_test_5.cc: New file.
4241         * testsuite/weak_alias_test.script: New file.
4242         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
4243         and versioned_alias have the right value, and call t2.
4244         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
4245         weak_alias_test_5.so.
4246         (weak_alias_test_LDADD): Likewise.
4247         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
4248         * testsuite/Makefile.in: Rebuild.
4249
4250 2011-07-01  Ian Lance Taylor  <iant@google.com>
4251
4252         PR gold/12525
4253         * options.h (class General_options): Support -z notext.
4254         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
4255         -Wl,-z,notext.
4256         (two_file_shared_nonpic.so): Likewise.
4257         (two_file_shared_mixed.so): Likewise.
4258         (two_file_shared_mixed_1.so): Likewise.
4259         (weak_undef_lib_nonpic.so): Likewise.
4260         (alt/weak_undef_lib_nonpic.so): Likewise.
4261         (tls_test_shared_nonpic.so): Likewise.
4262         * testsuite/Makefile.in: Rebuild.
4263
4264 2011-07-01  Ian Lance Taylor  <iant@google.com>
4265
4266         PR gold/12525
4267         * configure.ac: Test whether static linking works, setting
4268         the automake conditional HAVE_STATIC.
4269         * testsuite/Makefile.am: Disable tests using -static if
4270         HAVE_STATIC is not true.
4271         * configure, testsuite/Makefile.in: Rebuild.
4272
4273 2011-07-01  Ian Lance Taylor  <iant@google.com>
4274
4275         PR gold/12525
4276         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
4277         Assert if we see DW_EH_PE_indirect.
4278         * target.h (Target::ehframe_datarel_base): New function.
4279         (Target::do_ehframe_datarel_base): New target function.
4280         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
4281         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
4282         function.
4283
4284 2011-07-01  Ian Lance Taylor  <iant@google.com>
4285
4286         PR gold/12571
4287         * options.h (class General_options): Add
4288         --ld-generated-unwind-info.
4289         * ehframe.cc (Fde::write): Add address parameter.  Change all
4290         callers.  If associated with PLT, fill in address and size.
4291         (Cie::set_output_offset): Only add merge mapping if there is an
4292         object.
4293         (Cie::write): Add address parameter.  Change all callers.
4294         (Eh_frame::add_ehframe_for_plt): New function.
4295         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
4296         input_offset_ fields into union u_, with new plt field.
4297         (Fde::Fde): Adjust for new union field.
4298         (Fde::Fde) [Output_data version]: New constructor.
4299         (Fde::add_mapping): Only add merge mapping if there is an object.
4300         (class Cie): Update declarations.
4301         (class Eh_frame): Declare add_ehframe_for_plt.
4302         * layout.cc (Layout::layout_eh_frame): Break out code into
4303         make_eh_frame_section, and call it.
4304         (Layout::make_eh_frame_section): New function.
4305         (Layout::add_eh_frame_for_plt): New function.
4306         * layout.h (class Layout): Update declarations.
4307         * merge.cc (Merge_map::add_mapping): Add assertion.
4308         * i386.cc: Include "dwarf.h".
4309         (class Output_data_plt_i386): Make first_plt_entry,
4310         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
4311         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
4312         and plt_eh_frame_fde.
4313         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
4314         boundary.  Call add_eh_frame_for_plt if appropriate.
4315         * x86_64.cc: Include "dwarf.h".
4316         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
4317         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
4318         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
4319         and plt_eh_frame_fde.
4320         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
4321         appropriate.
4322
4323 2011-06-29  Ian Lance Taylor  <iant@google.com>
4324
4325         PR gold/12629
4326         * object.cc (Sized_relobj_file::layout_section): Change shdr
4327         parameter to be const.
4328         (Sized_relobj_file::layout_eh_frame_section): New function, broken
4329         out of do_layout.
4330         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
4331         appropriate.  Call layout_eh_frame_section.
4332         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
4333         sections.
4334         * object.h (class Sized_relobj_file): Update declarations.
4335
4336 2011-06-29  Ian Lance Taylor  <iant@google.com>
4337
4338         PR gold/12652
4339         * script.cc (Token::integer_value): Accept trailing M/m/K/k
4340         modifier.
4341         (Lex::gather_token): Accept trailing M/m/K/k for integers.
4342
4343 2011-06-29  Ian Lance Taylor  <iant@google.com>
4344
4345         PR gold/12675
4346         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
4347         SHT_X86_64_UNWIND.
4348         * layout.cc (Layout::layout_eh_frame): Likewise.
4349
4350 2011-06-29  Ian Lance Taylor  <iant@google.com>
4351
4352         PR gold/12695
4353         * layout.cc (Layout::symtab_section_shndx): New function.
4354         * layout.h (class Layout): Declare symtab_section_shndx.
4355         * output.cc (Output_section::write_header): Call it.
4356
4357 2011-06-29  Ian Lance Taylor  <iant@google.com>
4358
4359         PR gold/12818
4360         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
4361         symbols which are not used in a relocation.
4362
4363 2011-06-28  Ian Lance Taylor  <iant@google.com>
4364
4365         PR gold/12898
4366         * layout.cc (Layout::segment_precedes): Don't crash if a linker
4367         script create indistinguishable segments.
4368         (Layout::set_segment_offsets): Use stable_sort when sorting
4369         segments.  Pass this to Compare_segments constructor.
4370         * layout.h (class Layout): Make segment_precedes non-static.
4371         (class Compare_segments): Change from struct to class.  Add
4372         layout_ field.  Add constructor.
4373         * script-sections.cc
4374         (Script_sections::attach_sections_using_phdrs_clause): Rename
4375         local orphan to is_orphan.  Don't report failure to put empty
4376         section in segment.  On attachment failure, report name of
4377         section, and attach to first PT_LOAD segment.
4378
4379 2011-06-28  Ian Lance Taylor  <iant@google.com>
4380
4381         PR gold/12934
4382         * target-select.cc (Target_selector::Target_selector): Add
4383         emulation parameter.  Change all callers.
4384         (select_target_by_bfd_name): Rename from select_target_by_name.
4385         Change all callers.
4386         (select_target_by_emulation): New function.
4387         (supported_emulation_names): New function.
4388         * target-select.h (class Target_selector): Add emulation_ field.
4389         Update declarations.
4390         (Target_selector::recognize_by_bfd_name): Rename from
4391         recognize_by_name.  Change all callers.
4392         (Target_selector::supported_bfd_names): Rename from
4393         supported_names.  Change all callers.
4394         (Target_selector::recognize_by_emulation): New function.
4395         (Target_selector::supported_emulations): New function.
4396         (Target_selector::emulation): New function.
4397         (Target_selector::do_recognize_by_bfd_name): Rename from
4398         do_recognize_by_name.  Change all callers.
4399         (Target_selector::do_supported_bfd_names): Rename from
4400         do_supported_names.  Change all callers.
4401         (Target_selector::do_recognize_by_emulation): New function.
4402         (Target_selector::do_supported_emulations): New function.
4403         (select_target_by_bfd_name): Change name in declaration.
4404         (select_target_by_emulation): Declare.
4405         (supported_emulation_names): Declare.
4406         * parameters.cc (parameters_force_valid_target): Try to find
4407         target based on emulation from -m option.
4408         * options.h (class General_options): Change doc string for -m.
4409         * options.cc (help): Print emulations.
4410         (General_options::parse_V): Likewise.
4411         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
4412         Add emulation parameter.  Change all callers.
4413
4414 2011-06-28  Ian Lance Taylor  <iant@google.com>
4415
4416         * target.h (class Target): Add osabi_ field.
4417         (Target::osabi): New function.
4418         (Target::set_osabi): New function.
4419         (Target::Target): Initialize osabi_.
4420         (Target::do_adjust_elf_header): Make pure virtual.
4421         (Sized_target::do_adjust_elf_header): Declare.
4422         * target.cc (Sized_target::do_adjust_elf_header): New function.
4423         (class Sized_target): Instantiate all versions.
4424         * freebsd.h (class Target_freebsd): Remove.
4425         (Target_selector_freebsd::do_recognize): Call set_osabi on
4426         Target.
4427         (Target_selector_freebsd::do_recognize_by_name): Likewise.
4428         (Target_selector_freebsd::set_osabi): Remove.
4429         * i386.cc (class Target_i386): Inherit from Sized_target rather
4430         than Target_freebsd.
4431         * x86_64.cc (class Target_x86_64): Likewise.
4432
4433 2011-06-28  Ian Lance Taylor  <iant@google.com>
4434
4435         * target.h (Target::can_check_for_function_pointers): Rewrite.
4436         Make non-virtual.
4437         (Target::can_icf_inline_merge_sections): Likewise.
4438         (Target::section_may_have_icf_unsafe_poineters): Likewise.
4439         (Target::Target_info): Add can_icf_inline_merge_sections field.
4440         (Target::do_can_check_for_function_pointers): New virtual
4441         function.
4442         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
4443         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
4444         from can_check_for_function_pointers, move in file.
4445         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
4446         section_may_have_icf_unsafe_poineters, move in file.
4447         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
4448         * i386.cc (Target_i386::do_can_check_for_function_pointers):
4449         Rename from can_check_for_function_pointers, move in file.
4450         (Target_i386::can_icf_inline_merge_sections): Remove.
4451         (Target_i386::i386_info): Initialize
4452         can_icf_inline_merge_sections.
4453         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
4454         Initialize can_icf_inline_merge_sections.
4455         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
4456         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
4457         Rename from can_check_for_function_pointers, move in file.
4458         (Target_x86_64::can_icf_inline_merge_sections): Remove.
4459         (Target_x86_64::x86_64_info): Initialize
4460         can_icf_inline_merge_sections.
4461         * testsuite/testfile.cc (Target_test::test_target_info):
4462         Likewise.
4463         * icf.cc (get_section_contents): Correct formatting.
4464
4465 2011-06-27  Ian Lance Taylor  <iant@google.com>
4466
4467         * symtab.cc (Symbol::versioned_name): New function.
4468         (Symbol_table::add_to_final_symtab): Use versioned_name when
4469         appropriate.
4470         (Symbol_table::sized_write_symbol): Likewise.
4471         * symtab.h (class Symbol): Declare versioned_name.
4472         * stringpool.h (class Stringpool_template): Add variant of add
4473         which takes a std::basic_string.
4474         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
4475         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
4476         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
4477         (ver_test_12.o): New target.
4478         * testsuite/Makefile.in: Rebuild.
4479
4480 2011-06-27  Doug Kwan  <dougkwan@google.com>
4481
4482         * arm.cc (Arm_relocate_functions::thm_jump8,
4483         Arm_relocate_functions::thm_jump11): Use a wider signed
4484         type to compute offset.
4485         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
4486         arm_thm_jump8.
4487         * testsuite/Makefile.in: Regenerate.
4488         * testsuite/arm_branch_in_range.sh: Check test results of
4489         arm_thm_jump11 and arm_thm_jump8.
4490         * testsuite/arm_thm_jump11.s: New test source file.
4491         * testsuite/arm_thm_jump11.t: New linker script.
4492         * testsuite/arm_thm_jump8.s: New test source file.
4493         * testsuite/arm_thm_jump8.t: New linker script.
4494
4495 2011-06-24  Ian Lance Taylor  <iant@google.com>
4496
4497         * layout.cc: Include "object.h".
4498         (ctors_sections_in_init_array): New static variable.
4499         (Layout::is_ctors_in_init_array): New function.
4500         (Layout::layout): Add entry to ctors_sections_in_init_array if
4501         appropriate.
4502         * layout.h (class Layout): Declare is_ctors_in_init_array.
4503         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
4504         is_ctors_reverse_view is set.
4505         (Sized_relobj_file::write_sections): Add layout parameter.  Change
4506         all callers.  Set is_ctors_reverse_view field of View_size.
4507         (Sized_relobj_file::reverse_words): New function.
4508         * object.h (Sized_relobj_file::View_size): Add
4509         is_ctors_reverse_view field.
4510         (class Sized_relobj_file): Update declarations.
4511         * testsuite/initpri3.c: New test.
4512         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
4513         initpri3b.
4514         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
4515         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
4516         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
4517         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
4518         * testsuite/Makefile.in: Rebuild.
4519
4520 2011-06-24  Cary Coutant  <ccoutant@google.com>
4521
4522         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
4523         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
4524         (debug_msg_cdebug.err): New targets.
4525         * testsuite/Makefile.in: Regenerate.
4526         * testsuite/debug_msg.sh: Check output of link with compressed debug.
4527         Fix checks for link with shared library.
4528
4529 2011-06-24  Doug Kwan  <dougkwan@google.com>
4530
4531         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
4532         skip empty text sections.
4533         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
4534
4535 2011-06-22  Ian Lance Taylor  <iant@google.com>
4536
4537         PR gold/12910
4538         * options.h (class General_options): Add --ctors-in-init-array.
4539         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
4540         friends as SHT_PROGBITS for merging sections.
4541         (Layout::layout): Remove special handling of .init_array and
4542         friends.  Don't sort if doing relocatable link.  Sort for .ctors
4543         and .dtors if ctors_in_init_array.
4544         (Layout::make_output_section): Force correct section types for
4545         .init_array and friends.  Don't sort if doing relocatable link,
4546         Don't sort .ctors and .dtors if ctors_in_init_array.
4547         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
4548         (Layout::output_section_name): Add relobj parameter.  Change all
4549         callers.  Handle .ctors. and .dtors. in code rather than table.
4550         Handle .ctors and .dtors if ctors_in_init_array.
4551         (Layout::match_file_name): New function, moved from output.cc.
4552         * layout.h (class Layout): Update declarations.
4553         * output.cc: Include "layout.h".
4554         (Input_section_sort_entry::get_priority): New function.
4555         (Input_section_sort_entry::match_file_name): Just call
4556         Layout::match_file_name.
4557         (Output_section::Input_section_sort_init_fini_compare::operator()):
4558         Handle .ctors and .dtors.  Sort by explicit priority rather than
4559         by name.
4560         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
4561         * testsuite/initpri2.c: New test.
4562         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
4563         (check_PROGRAMS): Add initpri2.
4564         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
4565         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
4566         * configure, testsuite/Makefile.in: Rebuild.
4567
4568 2011-06-19  Ian Lance Taylor  <iant@google.com>
4569
4570         PR gold/12880
4571         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
4572         .interp section to a PT_INTERP segment even if we have seen a
4573         --dynamic-linker option.  Don't do it if we have seen a PHDRS
4574         clause in a linker script.
4575         (Layout::finalize): Don't create a .interp section if we've
4576         already create a PT_INTERP segment.
4577         (Layout::create_interp): Always call choose_output_section (revert
4578         patch of 2011-06-17).  Don't create PT_INTERP segment.
4579         * script-sections.cc
4580         (Script_sections::create_note_and_tls_segments): Add a .interp
4581         section to a PT_INTERP segment even if we have seen a
4582         --dynamic-linker option.
4583
4584 2011-06-18  Ian Lance Taylor  <iant@google.com>
4585
4586         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
4587         merely because a non-PT_LOAD segment has a dynamic reloc.
4588
4589 2011-06-18  Ian Lance Taylor  <iant@google.com>
4590
4591         * layout.cc (Layout::finish_dynamic_section): Don't create
4592         DT_FLAGS entry if not needed.
4593
4594 2011-06-18  Ian Lance Taylor  <iant@google.com>
4595
4596         PR gold/12745
4597         * layout.cc (Layout::layout_eh_frame): Correct handling of
4598         writable .eh_frame section.
4599
4600 2011-06-17  Ian Lance Taylor  <iant@google.com>
4601
4602         PR gold/12893
4603         * resolve.cc (Symbol_table::resolve): Don't give an error if a
4604         symbol is redefined with the exact same object and value.
4605
4606 2011-06-17  Ian Lance Taylor  <iant@google.com>
4607
4608         PR gold/12880
4609         * layout.h (class Layout): Add interp_segment_ field.
4610         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
4611         (Layout::attach_allocated_section_to_segment): If making shared
4612         library, put .interp section in PT_INTERP segment.
4613         (Layout::finalize): Also call create_interp if -dynamic-linker
4614         option was used.
4615         (Layout::create_interp): Assert that there is no PT_INTERP
4616         segment.  If not using a SECTIONS clause, use make_output_section.
4617         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
4618         * script-sections.cc
4619         (Script_sections::create_note_and_tls_segments): If making shared
4620         library, put .interp section in PT_INTERP segment.
4621
4622 2011-06-17  Ian Lance Taylor  <iant@google.com>
4623
4624         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
4625         when making a shared library.
4626
4627 2011-06-17  Ian Lance Taylor  <iant@google.com>
4628
4629         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
4630         parameter.  Change all callers.  Don't issue warning about PC32
4631         against locally defined symbol.
4632
4633 2011-06-16  Ian Lance Taylor  <iant@google.com>
4634
4635         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
4636         occurs in same object.
4637
4638 2011-06-14  Alan Modra  <amodra@gmail.com>
4639
4640         * po/POTFILES.in: Regenerate.
4641
4642 2011-06-09  Ian Lance Taylor  <iant@google.com>
4643
4644         * script-sections.cc
4645         (Orphan_output_section::set_section_addresses): For a relocatable
4646         link set address to 0.
4647
4648 2011-06-09  Cary Coutant  <ccoutant@google.com>
4649
4650         PR gold/12804
4651         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
4652         used with --compress-debug-sections.
4653         * gold/object.cc (Sized_relobj_file::do_layout): Report
4654         uncompressed size of compressed input sections.
4655
4656 2011-06-08  Cary Coutant  <ccoutant@google.com>
4657
4658         PR gold/12804
4659         * testsuite/two_file_test_2_v1.cc: Change initialization of
4660         v2 to keep it in .data.
4661
4662 2011-06-07  Cary Coutant  <ccoutant@google.com>
4663
4664         * common.cc (Symbol_table::do_allocate_commons_list): Call
4665         gold_fallback.
4666         * errors.cc (Errors::fatal): Adjust call to gold_exit.
4667         (Errors::fallback): New function.
4668         (gold_fallback): New function.
4669         * errors.h (Errors::fallback): New function.
4670         * gold.cc (gold_exit): Change status parameter to enum; adjust
4671         all callers.
4672         (queue_initial_tasks): Call gold_fallback.
4673         * gold.h: Include cstdlib.
4674         (Exit_status): New enum type.
4675         (gold_exit): Change status parameter to enum.
4676         (gold_fallback): New function.
4677         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
4678         (Layout::create_symtab_sections): Likewise.
4679         (Layout::create_shdrs): Likewise.
4680         * main.cc (main): Adjust call to gold_exit.
4681         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
4682         (Output_data_got::add_got_entry_pair): Likewise.
4683         (Output_section::add_input_section): Likewise.
4684         (Output_section::add_output_section_data): Likewise.
4685         (Output_segment::set_section_list_addresses): Likewise.
4686         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
4687
4688 2011-06-07  Cary Coutant  <ccoutant@google.com>
4689
4690         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
4691         for incremental links.
4692         * output.cc (Output_segment::set_section_list_addresses): Remove
4693         FIXME and test for TLS or BSS.
4694
4695 2011-06-07  Cary Coutant  <ccoutant@google.com>
4696
4697         * testsuite/Makefile.am: Add incremental_copy_test,
4698         incremental_common_test_1.
4699         * testsuite/Makefile.in: Regenerate.
4700         * testsuite/common_test_1_v1.c: New source file.
4701         * testsuite/common_test_1_v2.c: New source file.
4702         * testsuite/copy_test_v1.cc: New source file.
4703
4704 2011-06-07  Cary Coutant  <ccoutant@google.com>
4705
4706         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
4707         update, allocate common from bss section's free list.
4708         * incremental-dump.cc (dump_incremental_inputs): Print flag for
4709         linker-defined symbols.
4710         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
4711         Skip GOT and PLT entries that are no longer referenced.
4712         (Output_section_incremental_inputs::write_info_blocks): Mark
4713         linker-defined symbols.
4714         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
4715         * output.cc (Output_section::allocate): New function.
4716         * output.h (Output_section::allocate): New function.
4717         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
4718         linker-defined symbols.
4719         (Symbol::override_base_with_special): Copy is_predefined_ flag.
4720         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
4721         (Symbol::init_base_output_data): Likewise.
4722         (Symbol::init_base_output_segment): Likewise.
4723         (Symbol::init_base_constant): Likewise.
4724         (Sized_symbol::init_output_data): Likewise.
4725         (Sized_symbol::init_output_segment): Likewise.
4726         (Sized_symbol::init_constant): Likewise.
4727         (Symbol_table::do_define_in_output_data): Likewise.
4728         (Symbol_table::do_define_in_output_segment): Likewise.
4729         (Symbol_table::do_define_as_constant): Likewise.
4730         * symtab.h (Symbol::is_predefined): New function.
4731         (Symbol::init_base_output_data): Add is_predefined parameter.
4732         (Symbol::init_base_output_segment): Likewise.
4733         (Symbol::init_base_constant): Likewise.
4734         (Symbol::is_predefined_): New data member.
4735         (Sized_symbol::init_output_data): Add is_predefined parameter.
4736         (Sized_symbol::init_output_segment): Likewise.
4737         (Sized_symbol::init_constant): Likewise.
4738         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
4739
4740 2011-06-07  Cary Coutant  <ccoutant@google.com>
4741
4742         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
4743         instead of emit_copy_reloc.
4744         (Copy_relocs::emit_copy_reloc): Refactor.
4745         (Copy_relocs::make_copy_reloc): New function.
4746         (Copy_relocs::add_copy_reloc): Remove.
4747         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
4748         section.
4749         (Copy_relocs::make_copy_reloc): New function.
4750         (Copy_relocs::add_copy_reloc): Remove.
4751         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
4752         unchanged input files.
4753         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
4754         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
4755         Reserve BSS space for COPY relocations.
4756         (Sized_incremental_binary::do_emit_copy_relocs): New function.
4757         (Output_section_incremental_inputs::write_info_blocks): Record
4758         whether a symbol is copied from a shared object.
4759         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
4760         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
4761         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
4762         (Incremental_input_entry_reader::get_output_symbol_index): Add
4763         is_copy parameter.
4764         (Incremental_binary::emit_copy_relocs): New function.
4765         (Incremental_binary::do_emit_copy_relocs): New function.
4766         (Sized_incremental_binary::Sized_incremental_binary): Initialize
4767         new data member.
4768         (Sized_incremental_binary::add_copy_reloc): New function.
4769         (Sized_incremental_binary::do_emit_copy_relocs): New function.
4770         (Sized_incremental_binary::Copy_reloc): New struct.
4771         (Sized_incremental_binary::Copy_relocs): New typedef.
4772         (Sized_incremental_binary::copy_relocs_): New data member.
4773         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
4774         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
4775         * target.h (Sized_target::emit_copy_reloc): New function.
4776         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
4777
4778 2011-06-02  Cary Coutant  <ccoutant@google.com>
4779
4780         PR gold/12163
4781         * gold/archive.cc (Archive::Archive): Initialize new data member.
4782         (Archive::include_all_members): Return if archive has already been
4783         included.
4784         * gold/archive.h (Archive::include_all_members_): New data member.
4785
4786 2011-06-02  Nick Clifton  <nickc@redhat.com>
4787
4788         * dynobj.h: Fix spelling mistake in comment.
4789         * output.cc: Likewise.
4790
4791 2011-05-31  Doug Kwan  <dougkwan@google.com>
4792             Asier Llano
4793
4794         PR gold/12826
4795         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
4796         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
4797         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
4798         redundant arm_exidx_test.so.
4799         * testsuite/Makefile.in: Regenerate.
4800         (check_SCRIPTS): Add pr12826.sh
4801         (check_DATA): Add pr12826.stdout
4802         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
4803         * testsuite/pr12826.sh: New file.
4804         * testsuite/pr12826_1.s: Ditto.
4805         * testsuite/pr12826_1.s: Ditto.
4806
4807 2011-05-30  Ian Lance Taylor  <iant@google.com>
4808
4809         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
4810         sections.
4811
4812 2011-05-29  Ian Lance Taylor  <iant@google.com>
4813
4814         PR gold/12804
4815         * testsuite/Makefile.am: Use different file name for two_file_test
4816         temporary file for each incremental test.
4817         * testsuite/Makefile.in: Rebuild.
4818
4819 2011-05-29  Ian Lance Taylor  <iant@google.com>
4820
4821         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
4822         binary input file is empty.
4823
4824 2011-05-27  Ian Lance Taylor  <iant@google.com>
4825
4826         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
4827         (ver_test_9.so): Likewise.
4828         * testsuite/Makefile.in: Rebuild.
4829
4830 2011-05-26 Cary Coutant  <ccoutant@google.com>
4831
4832         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
4833         * incremental.cc (Incremental_inputs::report_input_section): Fix
4834         comment, indentation.
4835         (Incremental_inputs::report_comdat_group): New function.
4836         (Output_section_incremental_inputs::set_final_data_size): Adjust size
4837         of data for incremental input file entry.
4838         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
4839         group count, COMDAT group signatures.
4840         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
4841         an unchanged input file.
4842         * incremental.h (Incremental_object_entry::Incremental_object_entry):
4843         Initialize new data member.
4844         (Incremental_object_entry::add_comdat_group): New function.
4845         (Incremental_object_entry::get_comdat_group_count): New function.
4846         (Incremental_object_entry::get_comdat_signature_key): New function.
4847         (Incremental_object_entry::groups_): New data member.
4848         (Incremental_inputs::report_comdat_group): New function.
4849         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
4850         data for incremental input file entry.
4851         (Incremental_input_entry_reader::get_comdat_group_count): New function.
4852         (Incremental_input_entry_reader::get_input_section): Adjust size of
4853         data for incremental input file entry.
4854         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
4855         (Incremental_input_entry_reader::get_comdat_group_signature): New
4856         function.
4857         * object.cc (Sized_relobj::include_section_group): Report kept
4858         COMDAT groups for incremental links.
4859
4860 2011-05-24  David Meyer  <pdox@google.com>
4861
4862         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
4863         with name parameter.  Add found_name parameter.
4864         * fileread.cc (Input_file::find_file): Adjust code accordingly.
4865         * dirsearch.h (class Dirsearch): Update declaration.
4866
4867 2011-05-24  Ian Lance Taylor  <iant@google.com>
4868
4869         * archive.cc (Library_base::should_include_member): Pull in object
4870         from archive if it defines the entry symbol.
4871         * parameters.cc (Parameters::entry): New function.
4872         * parameters.h (class Parameters): Declare entry.
4873         * output.h (class Output_file_header): Remove entry_ field.
4874         * output.cc (Output_file_header::Output_file_header): Remove entry
4875         parameter.  Change all callers.
4876         (Output_file_header::entry): Use parameters->entry.
4877         * gold.cc (queue_middle_tasks): Likewise.
4878         * plugin.cc (Plugin_hook::run): Likewise.
4879
4880 2011-05-24 Cary Coutant  <ccoutant@google.com>
4881
4882         * gold.cc (queue_initial_tasks): Pass incremental base filename
4883         to Output_file::open_base_file; don't print error message.
4884         * incremental-dump.cc (main): Adjust call to
4885         Output_file::open_for_modification.
4886         * incremental-dump.cc (main): Likewise.
4887         * incremental.cc (Incremental_inputs::report_command_line):
4888         Ignore --incremental-base option when comparing command lines.
4889         Ignore parameter when given as separate argument.
4890         * options.h (class General_options): Add --incremental-base.
4891         * output.cc (Output_file::Output_file):
4892         (Output_file::open_base_file): Add base_name and writable parameters;
4893         read base file into new file; print error message here.
4894         (Output_file::map_no_anonymous): Add writable parameter; adjust all
4895         callers.
4896         * output.h (Output_file::open_for_modification): Rename to...
4897         (Output_file::open_base_file): ...this; add base_name and
4898         writable parameters; adjust all callers.
4899         (Output_file::map_no_anonymous): Add writable parameter; adjust all
4900         callers.
4901         * testsuite/Makefile.am (incremental_test_4): Test
4902         --incremental-base.
4903         * testsuite/Makefile.in: Regenerate.
4904
4905 2011-05-24 Cary Coutant  <ccoutant@google.com>
4906
4907         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
4908         incremental_test_4.
4909         * testsuite/Makefile.in: Regenerate.
4910         * testsuite/two_file_test_1_v1.cc: New test source file.
4911         * testsuite/two_file_test_1b_v1.cc: New test source file.
4912         * testsuite/two_file_test_2_v1.cc: New test source file.
4913
4914 2011-05-24 Cary Coutant  <ccoutant@google.com>
4915
4916         * dynobj.h (Dynobj::do_dynobj): New function.
4917         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
4918         flag and soname for shared objects.
4919         * incremental.cc (Incremental_inputs::report_object): Make
4920         either Incremental_object_entry or Incremental_dynobj_entry; add
4921         soname to string table.
4922         (Incremental_inputs::report_input_section): Add assertion.
4923         (Output_section_incremental_inputs::set_final_data_size): Adjust
4924         type of input file entry for shared libraries; adjust size of
4925         shared library info entry.
4926         (Output_section_incremental_inputs::write_input_files): Write
4927         as_needed flag for shared libraries.
4928         (Output_section_incremental_inputs::write_info_blocks): Adjust type
4929         of input file entry for shared libraries; write soname.
4930         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
4931         soname from incremental info.
4932         * incremental.h (enum Incremental_input_flags): Add
4933         INCREMENTAL_INPUT_AS_NEEDED.
4934         (Incremental_input_entry::Incremental_input_entry): Initialize new
4935         data member.
4936         (Incremental_input_entry::set_as_needed): New function.
4937         (Incremental_input_entry::as_needed): New function.
4938         (Incremental_input_entry::do_dynobj_entry): New function.
4939         (Incremental_input_entry::as_needed_): New data member.
4940         (Incremental_object_entry::Incremental_object_entry): Don't check
4941         for shared library.
4942         (Incremental_object_entry::do_type): Likewise.
4943         (class Incremental_dynobj_entry): New class.
4944         (Incremental_input_entry_reader::as_needed): New function.
4945         (Incremental_input_entry_reader::get_soname): New function.
4946         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
4947         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
4948         size of shared library info entry.
4949         * layout.cc (Layout::finish_dynamic_section): Don't test for
4950         incremental link when adding DT_NEEDED entries.
4951         * object.h (Object::Object): Initialize new data member.
4952         (Object::dynobj): New function.
4953         (Object::set_as_needed): New function.
4954         (Object::as_needed): New function.
4955         (Object::do_dynobj): New function.
4956         (Object::as_needed_): New data member.
4957
4958 2011-05-24 Cary Coutant  <ccoutant@google.com>
4959
4960         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
4961         info; adjust display of GOT entries.
4962         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
4963         vector of input objects; remove file_status_.
4964         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
4965         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
4966         got_plt reader; call target hooks to reserve GOT entries.
4967         (Output_section_incremental_inputs::set_final_data_size): Adjust size
4968         of input file info header and GOT info entry.
4969         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
4970         relocation info.
4971         (Got_plt_view_info::got_descriptor): Remove.
4972         (Got_plt_view_info::sym_index): New data member.
4973         (Got_plt_view_info::input_index): New data member.
4974         (Local_got_offset_visitor::visit): Write input file index.
4975         (Global_got_offset_visitor::visit): Write 0 for input file index.
4976         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
4977         with sym_index and input_index.
4978         (Output_section_incremental_inputs::write_got_plt): Adjust size of
4979         incremental info GOT entry; replace got_descriptor with input_index.
4980         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
4981         map from input file index to object.
4982         (Sized_relobj_incr::do_layout): Replace direct data member reference
4983         with accessor function.
4984         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
4985         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
4986         Adjust size of input file info header.
4987         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
4988         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
4989         (Incremental_input_entry_reader::get_input_section): Adjust size of
4990         input file info header.
4991         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
4992         of incremental info GOT entry.
4993         (Incremental_got_plt_reader::get_got_desc): Remove.
4994         (Incremental_got_plt_reader::get_got_symndx): New function.
4995         (Incremental_got_plt_reader::get_got_input_index): New function.
4996         (Sized_incremental_binary::Sized_incremental_binary): Remove
4997         file_status_; add input_objects_.
4998         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
4999         (Sized_incremental_binary::set_file_is_unchanged): Remove.
5000         (Sized_incremental_binary::file_is_unchanged): Remove.
5001         (Sized_incremental_binary::set_input_object): New function.
5002         (Sized_incremental_binary::input_object): New function.
5003         (Sized_incremental_binary::file_status_): Remove.
5004         (Sized_incremental_binary::input_objects_): New data member.
5005         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
5006         references.
5007         (Sized_relobj_incr::invalid_address): Move to base class.
5008         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
5009         class.
5010         (Sized_relobj_incr::do_output_section_offset): Likewise.
5011         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
5012         (Sized_relobj_incr::section_offsets_): Likewise.
5013         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
5014         function.
5015         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
5016         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
5017         with accessor function.
5018         (Sized_relobj_file::do_layout): Likewise.
5019         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
5020         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
5021         (Sized_relobj_file::compute_final_local_value): Replace refs to
5022         section_offsets_ with accessor function.
5023         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
5024         * object.h (Relobj::Relobj): Initialize new data members.
5025         (Relobj::add_dyn_reloc): New function.
5026         (Relobj::first_dyn_reloc): New function.
5027         (Relobj::dyn_reloc_count): New function.
5028         (Relobj::first_dyn_reloc_): New data member.
5029         (Relobj::dyn_reloc_count_): New data member.
5030         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
5031         references.
5032         (Sized_relobj::Address): New typedef.
5033         (Sized_relobj::invalid_address): Move here from child class.
5034         (Sized_relobj::Sized_relobj): Initialize new data members.
5035         (Sized_relobj::sized_relobj): New function.
5036         (Sized_relobj::is_output_section_offset_invalid): Move here from
5037         child class.
5038         (Sized_relobj::get_output_section_offset): Likewise.
5039         (Sized_relobj::local_has_got_offset): Likewise.
5040         (Sized_relobj::local_got_offset): Likewise.
5041         (Sized_relobj::set_local_got_offset): Likewise.
5042         (Sized_relobj::do_for_all_local_got_entries): Likewise.
5043         (Sized_relobj::clear_got_offsets): New function.
5044         (Sized_relobj::section_offsets): Move here from child class.
5045         (Sized_relobj::do_output_section_offset): Likewise.
5046         (Sized_relobj::do_set_section_offset): Likewise.
5047         (Sized_relobj::Local_got_offsets): Likewise.
5048         (Sized_relobj::local_got_offsets_): Likewise.
5049         (Sized_relobj::section_offsets_): Likewise.
5050         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
5051         references.
5052         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
5053         class.
5054         (Sized_relobj_file::sized_relobj): New function
5055         (Sized_relobj_file::local_has_got_offset): Move to base class.
5056         (Sized_relobj_file::local_got_offset): Likewise.
5057         (Sized_relobj_file::set_local_got_offset): Likewise.
5058         (Sized_relobj_file::get_output_section_offset): Likewise.
5059         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
5060         (Sized_relobj_file::do_output_section_offset): Likewise.
5061         (Sized_relobj_file::do_set_section_offset): Likewise.
5062         (Sized_relobj_file::Local_got_offsets): Likewise.
5063         (Sized_relobj_file::local_got_offsets_): Likewise.
5064         (Sized_relobj_file::section_offsets_): Likewise.
5065         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
5066         (all constructors).
5067         (set_needs_dynsym_index): Convert relobj to derived class pointer.
5068         (Output_reloc::get_symbol_index): Likewise.
5069         (Output_reloc::local_section_offset): Likewise.
5070         (Output_reloc::get_address): Likewise.
5071         (Output_reloc::symbol_value): Likewise.
5072         (Output_data_got::reserve_slot): Move to class definition.
5073         (Output_data_got::reserve_local): New function.
5074         (Output_data_got::reserve_slot_for_global): Remove.
5075         (Output_data_got::reserve_global): New function.
5076         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
5077         (all constructors, two instantiations).
5078         (Output_reloc::get_relobj): New function (two instantiations).
5079         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
5080         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
5081         (Output_data_reloc::add_global): Adjust type of relobj.
5082         (Output_data_reloc::add_global_relative): Likewise.
5083         (Output_data_reloc::add_symbolless_global_addend): Likewise.
5084         (Output_data_reloc::add_local): Likewise.
5085         (Output_data_reloc::add_local_relative): Likewise.
5086         (Output_data_reloc::add_symbolless_local_addend): Likewise.
5087         (Output_data_reloc::add_local_section): Likewise.
5088         (Output_data_reloc::add_output_section): Likewise.
5089         (Output_data_reloc::add_absolute): Likewise.
5090         (Output_data_reloc::add_target_specific): Likewise.
5091         (Output_data_got::reserve_slot): Move definition here.
5092         (Output_data_got::reserve_local): New function.
5093         (Output_data_got::reserve_global): New function.
5094         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
5095         section_offsets_ with accessor function.
5096         (Sized_relobj_file::write_sections): Likewise.
5097         (Sized_relobj_file::do_relocate_sections): Likewise.
5098         * target.h (Sized_target::reserve_local_got_entry): New function.
5099         (Sized_target::reserve_global_got_entry): New function.
5100         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
5101         (Target_x86_64::reserve_global_got_entry): New function.
5102         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
5103
5104 2011-05-23 Cary Coutant  <ccoutant@google.com>
5105
5106         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
5107         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
5108         bit when checking got_type.
5109         * incremental.cc (Sized_incremental_binary::setup_readers):
5110         Store symbol table and string table locations; initialize bit vector
5111         of file status flags.
5112         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
5113         unchanged files.
5114         (Sized_incremental_binary::do_process_got_plt): New function.
5115         (Sized_incremental_binary::get_symtab_view): Use stored locations.
5116         (Output_section_incremental_inputs::set_final_data_size): Record
5117         file index for each input file.
5118         (Output_section_incremental_inputs::write_got_plt): Store file index
5119         instead of input entry offset for each GOT entry.
5120         * incremental.h
5121         (Incremental_input_entry::Incremental_input_entry): Initialize new
5122         data member.
5123         (Incremental_input_entry::set_offset): Store file index.
5124         (Incremental_input_entry::get_file_index): New function.
5125         (Incremental_input_entry::file_index_): New data member.
5126         (Incremental_binary::process_got_plt): New function.
5127         (Incremental_binary::do_process_got_plt): New function.
5128         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
5129         data members.
5130         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
5131         (Sized_incremental_binary::set_file_is_unchanged): New function.
5132         (Sized_incremental_binary::file_is_unchanged): New function.
5133         (Sized_incremental_binary::do_process_got_plt): New function.
5134         (Sized_incremental_binary::file_status_): New data member.
5135         (Sized_incremental_binary::main_symtab_loc_): New data member.
5136         (Sized_incremental_binary::main_strtab_loc_): New data member.
5137         * output.cc (Output_data_got::Got_entry::write): Add case
5138         RESERVED_CODE.
5139         (Output_data_got::add_global): Call add_got_entry.
5140         (Output_data_got::add_global_plt): Likewise.
5141         (Output_data_got::add_global_with_rel): Likewise.
5142         (Output_data_got::add_global_with_rela): Likewise.
5143         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
5144         (Output_data_got::add_global_pair_with_rela): Likewise.
5145         (Output_data_got::add_local): Call add_got_entry.
5146         (Output_data_got::add_local_plt): Likewise.
5147         (Output_data_got::add_local_with_rel): Likewise.
5148         (Output_data_got::add_local_with_rela): Likewise.
5149         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
5150         (Output_data_got::add_local_pair_with_rela): Likewise.
5151         (Output_data_got::reserve_slot): New function.
5152         (Output_data_got::reserve_slot_for_global): New function.
5153         (Output_data_got::add_got_entry): New function.
5154         (Output_data_got::add_got_entry_pair): New function.
5155         (Output_section::add_output_section_data): Edit FIXME.
5156         * output.h
5157         (Output_section_data_build::Output_section_data_build): New
5158         constructor with size parameter.
5159         (Output_data_space::Output_data_space): Likewise.
5160         (Output_data_got::Output_data_got): Initialize new data member; new
5161         constructor with size parameter.
5162         (Output_data_got::add_constant): Call add_got_entry.
5163         (Output_data_got::reserve_slot): New function.
5164         (Output_data_got::reserve_slot_for_global): New function.
5165         (class Output_data_got::Got_entry): Add RESERVED_CODE.
5166         (Output_data_got::add_got_entry): New function.
5167         (Output_data_got::add_got_entry_pair): New function.
5168         (Output_data_got::free_list_): New data member.
5169         * target.h (Sized_target::init_got_plt_for_update): New function.
5170         (Sized_target::register_global_plt_entry): New function.
5171         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
5172         Initialize new data member; call init; add constructor with PLT count.
5173         (Output_data_plt_x86_64::init): New function.
5174         (Output_data_plt_x86_64::add_relocation): New function.
5175         (Output_data_plt_x86_64::reserve_slot): New function.
5176         (Output_data_plt_x86_64::free_list_): New data member.
5177         (Target_x86_64::init_got_plt_for_update): New function.
5178         (Target_x86_64::register_global_plt_entry): New function.
5179         (Output_data_plt_x86_64::add_entry): Allocate from free list for
5180         incremental updates.
5181         (Output_data_plt_x86_64::add_relocation): New function.
5182         * testsuite/object_unittest.cc (Object_test): Set default options.
5183
5184 2011-05-16  Ian Lance Taylor  <iant@google.com>
5185
5186         * options.h (class General_options): Make -i a synonym for -r.
5187
5188 2011-05-16  Ian Lance Taylor  <iant@google.com>
5189
5190         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
5191
5192 2011-05-10 Cary Coutant  <ccoutant@google.com>
5193
5194         * object.cc (Sized_relobj::do_count_local_symbols): Check for
5195         strip_all (-s).
5196
5197 2011-05-06  Ian Lance Taylor  <iant@google.com>
5198
5199         * layout.cc (Layout::layout): If the output section flags change,
5200         update the ordering.
5201
5202 2011-04-25 Cary Coutant  <ccoutant@google.com>
5203
5204         * incremental-dump.cc (dump_incremental_inputs): Print local
5205         symbol info for each input file.
5206         * incremental.cc
5207         (Output_section_incremental_inputs::set_final_data_size): Add local
5208         symbol info to input file entries in incremental info.
5209         (Output_section_incremental_inputs::write_info_blocks): Likewise.
5210         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
5211         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
5212         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
5213         implementation.
5214         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
5215         (Sized_incr_relobj::do_relocate): Write the local symbols.
5216         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
5217         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
5218         Adjust size of input file header.
5219         (Incremental_inputs_reader::get_local_symbol_offset): New function.
5220         (Incremental_inputs_reader::get_local_symbol_count): New function.
5221         (Incremental_inputs_reader::get_input_section): Adjust size of input
5222         file header.
5223         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
5224         (Sized_incr_relobj::This): New typedef.
5225         (Sized_incr_relobj::sym_size): New const data member.
5226         (Sized_incr_relobj::Local_symbol): New struct.
5227         (Sized_incr_relobj::do_output_local_symbol_count): New function.
5228         (Sized_incr_relobj::do_local_symbol_offset): New function.
5229         (Sized_incr_relobj::local_symbol_count_): New data member.
5230         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
5231         (Sized_incr_relobj::local_symbol_index_): New data member.
5232         (Sized_incr_relobj::local_symbol_offset_): New data member.
5233         (Sized_incr_relobj::local_dynsym_offset_): New data member.
5234         (Sized_incr_relobj::local_symbols_): New data member.
5235         * object.h (Relobj::output_local_symbol_count): New function.
5236         (Relobj::local_symbol_offset): New function.
5237         (Relobj::do_output_local_symbol_count): New function.
5238         (Relobj::do_local_symbol_offset): New function.
5239         (Sized_relobj::do_output_local_symbol_count): New function.
5240         (Sized_relobj::do_local_symbol_offset): New function.
5241
5242 2011-04-22  Vladimir Simonov  <sv@sw.ru>
5243
5244         * descriptors.cc (set_close_on_exec): New function.
5245         (Descriptors::open): Use set_close_on_exec.
5246         * output.cc (S_ISLNK): Define if not defined.
5247
5248 2011-04-22 Cary Coutant  <ccoutant@google.com>
5249
5250         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
5251         global symbol map.
5252         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
5253         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
5254         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
5255         relocations.
5256         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
5257         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
5258         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
5259         * incremental.h
5260         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
5261         function.
5262         (Incremental_binary::apply_incremental_relocs): New function.
5263         (Incremental_binary::do_apply_incremental_relocs): New function.
5264         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
5265         data member.
5266         (Sized_incremental_binary::add_global_symbol): New function.
5267         (Sized_incremental_binary::global_symbol): New function.
5268         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
5269         (Sized_incremental_binary::symbol_map_): New data member.
5270         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
5271         * target.h (Sized_target::apply_relocation): New function.
5272         * target-reloc.h (apply_relocation): New function.
5273         * x86_64.cc (Target_x86_64::apply_relocation): New function.
5274
5275 2011-04-22  Doug Kwan  <dougkwan@google.com>
5276
5277         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
5278         flag of a SHT_ARM_EXIDX section.
5279         * testsuite/Makefile.am (arm_exidx_test): New test rules.
5280         * testsuite/Makefile.in: Regenerate.
5281         * testsuite/arm_exidx_test.s: New file.
5282         * testsuite/arm_exidx_test.sh: Same.
5283
5284 2011-04-20 Cary Coutant  <ccoutant@google.com>
5285
5286         PR gold/12689
5287         * archive.h (Incremental_archive_entry::Archive_member):
5288         Initialize arg_serial_ (second constructor).
5289
5290 2011-04-17  Ian Lance Taylor  <iant@google.com>
5291
5292         * object.cc (Relocate_info::location): Simplify location string.
5293         * errors.cc (Errors::error_at_location): Don't print program
5294         name.
5295         (Errors::warning_at_location): Likewise.
5296         (Errors::undefined_symbol): Likewise.
5297         * testsuite/debug_msg.sh: Update accordingly.
5298
5299 2011-04-14 Cary Coutant  <ccoutant@google.com>
5300
5301         * gold/layout.cc (Layout::symtab_section_offset): New function.
5302         * gold/layout.h (Layout::symtab_section_offset): New function.
5303         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
5304
5305 2011-04-12  Ian Lance Taylor  <iant@google.com>
5306
5307         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
5308         with MREMAP_MAYMOVE.
5309         * output.h (class Output_file): Add map_is_allocated_ field.
5310         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
5311         not available, provide stubs.  If mremap is not available, #define
5312         it to gold_mremap.
5313         (MREMAP_MAYMOVE): Define if not defined.
5314         (Output_file::Output_file): Initialize map_is_allocated_.
5315         (Output_file::resize): Check map_is_allocated_.
5316         (Output_file::map_anonymous): If mmap fails, use malloc.
5317         (Output_file::unmap): Don't do anything for an anonymous map.
5318         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
5319         is not available, provide stubs.
5320         (File_read::View::~View): Use free rather than delete[].
5321         (File_read::make_view): Use malloc rather than new[].  If mmap
5322         fails, use malloc.
5323         (File_read::find_or_make_view): Use malloc rather than new[].
5324         * gold.h: Remove HAVE_REMAP code.
5325         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
5326         exists.  Rename mremap to gold_mremap.  If mmap is not available
5327         don't do anything.
5328         * configure, config.in: Rebuild.
5329
5330 2011-04-11  Ian Lance Taylor  <iant@google.com>
5331
5332         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
5333         initialize local variable v.
5334
5335 2011-04-11  Cary Coutant  <ccoutant@google.com>
5336
5337         * archive.cc (Archive::include_member): Adjust call to
5338         report_object.
5339         (Add_archive_symbols::run): Track argument serial numbers.
5340         (Lib_group::include_member): Likewise.
5341         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
5342         * archive.h (Incremental_archive_entry::Archive_member):
5343         Initialize arg_serial_.
5344         (Archive_member::arg_serial_): New data member.
5345         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
5346         (Sized_dynobj::do_add_symbols): Track symbols when doing an
5347         incremental link.
5348         (Sized_dynobj::do_for_all_local_got_entries): New function.
5349         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
5350         function.
5351         * fileread.cc (get_mtime): New function.
5352         * fileread.h (get_mtime): New function.
5353         * gold.cc (queue_initial_tasks): Check for incremental update.
5354         (process_incremental_input): New function.
5355         (queue_middle_tasks): Don't force valid target for incremental
5356         update.
5357         * incremental-dump.cc (find_input_containing_global): Adjust
5358         size of symbol info entry.
5359         (dump_incremental_inputs): Dump argument serial number and
5360         in_system_directory flag; bias shndx by 1; print symbol names
5361         when dumping per-file symbol lists; use new symbol info readers.
5362         * incremental.cc
5363         (Output_section_incremental_inputs:update_data_size): New function.
5364         (Sized_incremental_binary::setup_readers): Setup input readers
5365         for each input file; build maps for files added from libraries
5366         and scripts.
5367         (Sized_incremental_binary::check_input_args): New function.
5368         (Sized_incremental_binary::do_check_inputs): Build map of argument
5369         serial numbers to input arguments.
5370         (Sized_incremental_binary::do_file_has_changed): Rename
5371         do_file_is_unchanged to this; compare file modification times.
5372         (Sized_incremental_binary::do_init_layout): New function.
5373         (Sized_incremental_binary::do_reserve_layout): New function.
5374         (Sized_incremental_binary::do_get_input_reader): Remove.
5375         (Sized_incremental_binary::get_symtab_view): New function.
5376         (Incremental_checker::can_incrementally_link_output_file): Remove.
5377         (Incremental_inputs::report_command_line): Exclude --debug options.
5378         (Incremental_inputs::report_archive_begin): Add parameter; track
5379         argument serial numbers; don't put input file entry for archive
5380         before archive members.
5381         (Incremental_inputs::report_archive_end): Put input file entry
5382         for archive after archive members.
5383         (Incremental_inputs::report_object): Add parameter; track argument
5384         serial numbers and in_system_directory flag.
5385         (Incremental_inputs::report_script): Add parameter; track argument
5386         serial numbers.
5387         (Output_section_incremental_inputs::set_final_data_size): Adjust
5388         size of symbol info entry; check for forwarding symbols.
5389         (Output_section_incremental_inputs::write_input_files): Write
5390         in_system_directory flag and argument serial number.
5391         (Output_section_incremental_inputs::write_info_blocks): Map section
5392         indices between incremental info and original input file; store
5393         input section index for each symbol.
5394         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
5395         change operator() to visit().
5396         (class Global_got_offset_visitor): Likewise.
5397         (class Global_symbol_visitor_got_plt):
5398         (Output_section_incremental_inputs::write_got_plt): Use new visitor
5399         classes.
5400         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
5401         (Sized_incr_relobj::do_read_symbols): New function.
5402         (Sized_incr_relobj::do_layout): New function.
5403         (Sized_incr_relobj::do_layout_deferred_sections): New function.
5404         (Sized_incr_relobj::do_add_symbols): New function.
5405         (Sized_incr_relobj::do_should_include_member): New function.
5406         (Sized_incr_relobj::do_for_all_global_symbols): New function.
5407         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
5408         (Sized_incr_relobj::do_section_size): New function.
5409         (Sized_incr_relobj::do_section_name): New function.
5410         (Sized_incr_relobj::do_section_contents): New function.
5411         (Sized_incr_relobj::do_section_flags): New function.
5412         (Sized_incr_relobj::do_section_entsize): New function.
5413         (Sized_incr_relobj::do_section_address): New function.
5414         (Sized_incr_relobj::do_section_type): New function.
5415         (Sized_incr_relobj::do_section_link): New function.
5416         (Sized_incr_relobj::do_section_info): New function.
5417         (Sized_incr_relobj::do_section_addralign): New function.
5418         (Sized_incr_relobj::do_initialize_xindex): New function.
5419         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
5420         (Sized_incr_relobj::do_read_relocs): New function.
5421         (Sized_incr_relobj::do_gc_process_relocs): New function.
5422         (Sized_incr_relobj::do_scan_relocs): New function.
5423         (Sized_incr_relobj::do_count_local_symbols): New function.
5424         (Sized_incr_relobj::do_finalize_local_symbols): New function.
5425         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
5426         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
5427         (Sized_incr_relobj::do_relocate): New function.
5428         (Sized_incr_relobj::do_set_section_offset): New function.
5429         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
5430         (Sized_incr_dynobj::do_read_symbols): New function.
5431         (Sized_incr_dynobj::do_layout): New function.
5432         (Sized_incr_dynobj::do_add_symbols): New function.
5433         (Sized_incr_dynobj::do_should_include_member): New function.
5434         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
5435         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
5436         (Sized_incr_dynobj::do_section_size): New function.
5437         (Sized_incr_dynobj::do_section_name): New function.
5438         (Sized_incr_dynobj::do_section_contents): New function.
5439         (Sized_incr_dynobj::do_section_flags): New function.
5440         (Sized_incr_dynobj::do_section_entsize): New function.
5441         (Sized_incr_dynobj::do_section_address): New function.
5442         (Sized_incr_dynobj::do_section_type): New function.
5443         (Sized_incr_dynobj::do_section_link): New function.
5444         (Sized_incr_dynobj::do_section_info): New function.
5445         (Sized_incr_dynobj::do_section_addralign): New function.
5446         (Sized_incr_dynobj::do_initialize_xindex): New function.
5447         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
5448         (make_sized_incremental_object): New function.
5449         (Incremental_library::copy_unused_symbols): New function.
5450         (Incremental_library::do_for_all_unused_symbols): New function.
5451         * incremental.h (enum Incremental_input_flags): New type.
5452         (class Incremental_checker): Remove.
5453         (Incremental_input_entry::Incremental_input_entry): Add argument
5454         serial number.
5455         (Incremental_input_entry::arg_serial): New function.
5456         (Incremental_input_entry::set_is_in_system_directory): New function.
5457         (Incremental_input_entry::is_in_system_directory): New function.
5458         (Incremental_input_entry::arg_serial_): New data member.
5459         (Incremental_input_entry::is_in_system_directory_): New data member.
5460         (class Script_info): Move here from script.h.
5461         (Script_info::Script_info): Add filename parameter.
5462         (Script_info::filename): New function.
5463         (Script_info::filename_): New data member.
5464         (Incremental_script_entry::Incremental_script_entry): Add argument
5465         serial number.
5466         (Incremental_object_entry::Incremental_object_entry): Likewise.
5467         (Incremental_object_entry::add_input_section): Build list of input
5468         sections with map to original shndx.
5469         (Incremental_object_entry::get_input_section_index): New function.
5470         (Incremental_object_entry::shndx_): New data member.
5471         (Incremental_object_entry::name_key_): Rename; adjust all refs.
5472         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
5473         (Incremental_archive_entry::Incremental_archive_entry): Add argument
5474         serial number.
5475         (Incremental_inputs::report_archive_begin): Likewise.
5476         (Incremental_inputs::report_object): Likewise.
5477         (Incremental_inputs::report_script): Likewise.
5478         (class Incremental_global_symbol_reader): New class.
5479         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
5480         and store flags and input file type.
5481         (Incremental_input_entry_reader::arg_serial): New function.
5482         (Incremental_input_entry_reader::type): Extract type from flags.
5483         (Incremental_input_entry_reader::is_in_system_directory): New function.
5484         (Incremental_input_entry_reader::get_input_section_count): Call
5485         accessor function for type.
5486         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
5487         function for type; adjust size of global symbol entry.
5488         (Incremental_input_entry_reader::get_global_symbol_count): Call
5489         accessor function for type.
5490         (Incremental_input_entry_reader::get_object_count): Likewise.
5491         (Incremental_input_entry_reader::get_object_offset): Likewise.
5492         (Incremental_input_entry_reader::get_member_count): Likewise.
5493         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
5494         (Incremental_input_entry_reader::get_member_offset): Likewise.
5495         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
5496         (Incremental_input_entry_reader::Global_symbol_info): Remove.
5497         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
5498         (Incremental_input_entry_reader::get_global_symbol_reader): New
5499         function.
5500         (Incremental_input_entry_reader::get_output_symbol_index): New
5501         function.
5502         (Incremental_input_entry_reader::type_): Remove.
5503         (Incremental_input_entry_reader::flags_): New data member.
5504         (Incremental_inputs_reader::input_file_offset): New function.
5505         (Incremental_inputs_reader::input_file_index): New function.
5506         (Incremental_inputs_reader::input_file): Call input_file_offset.
5507         (Incremental_inputs_reader::input_file_at_offset): New function.
5508         (Incremental_relocs_reader::get_r_type): Reformat.
5509         (Incremental_relocs_reader::get_r_shndx): Reformat.
5510         (Incremental_relocs_reader::get_r_offset): Reformat.
5511         (Incremental_relocs_reader::data): New function.
5512         (Incremental_binary::Incremental_binary): Initialize new data members.
5513         (Incremental_binary::check_inputs): Add cmdline parameter.
5514         (Incremental_binary::file_is_unchanged): Remove.
5515         (Input_reader::arg_serial): New function.
5516         (Input_reader::get_unused_symbol_count): New function.
5517         (Input_reader::get_unused_symbol): New function.
5518         (Input_reader::do_arg_serial): New function.
5519         (Input_reader::do_get_unused_symbol_count): New function.
5520         (Input_reader::do_get_unused_symbol): New function.
5521         (Incremental_binary::input_file_count): New function.
5522         (Incremental_binary::get_input_reader): Change signature to use
5523         index instead of filename.
5524         (Incremental_binary::file_has_changed): New function.
5525         (Incremental_binary::get_input_argument): New function.
5526         (Incremental_binary::get_library): New function.
5527         (Incremental_binary::get_script_info): New function.
5528         (Incremental_binary::init_layout): New function.
5529         (Incremental_binary::reserve_layout): New function.
5530         (Incremental_binary::output_file): New function.
5531         (Incremental_binary::do_check_inputs): New function.
5532         (Incremental_binary::do_file_is_unchanged): Remove.
5533         (Incremental_binary::do_file_has_changed): New function.
5534         (Incremental_binary::do_init_layout): New function.
5535         (Incremental_binary::do_reserve_layout): New function.
5536         (Incremental_binary::do_input_file_count): New function.
5537         (Incremental_binary::do_get_input_reader): Change signature.
5538         (Incremental_binary::input_args_map_): New data member.
5539         (Incremental_binary::library_map_): New data member.
5540         (Incremental_binary::script_map_): New data member.
5541         (Sized_incremental_binary::Sized_incremental_binary): Initialize
5542         new data members.
5543         (Sized_incremental_binary::output_section): New function.
5544         (Sized_incremental_binary::inputs_reader): Add const.
5545         (Sized_incremental_binary::symtab_reader): Add const.
5546         (Sized_incremental_binary::relocs_reader): Add const.
5547         (Sized_incremental_binary::got_plt_reader): Add const.
5548         (Sized_incremental_binary::get_symtab_view): New function.
5549         (Sized_incremental_binary::Inputs_reader): New typedef.
5550         (Sized_incremental_binary::Input_entry_reader): New typedef.
5551         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
5552         (Sized_incremental_binary::do_file_is_unchanged): Remove.
5553         (Sized_incremental_binary::do_file_has_changed): New function.
5554         (Sized_incremental_binary::do_init_layout): New function.
5555         (Sized_incremental_binary::do_reserve_layout): New function.
5556         (Sized_input_reader::Inputs_reader): Remove.
5557         (Sized_input_reader::Input_entry_reader): Remove.
5558         (Sized_input_reader::do_arg_serial): New function.
5559         (Sized_input_reader::do_get_unused_symbol_count): New function.
5560         (Sized_input_reader::do_get_unused_symbol): New function.
5561         (Sized_incremental_binary::do_input_file_count): New function.
5562         (Sized_incremental_binary::do_get_input_reader): Change signature;
5563         use index instead of filename.
5564         (Sized_incremental_binary::section_map_): New data member.
5565         (Sized_incremental_binary::input_entry_readers_): New data member.
5566         (class Sized_incr_relobj): New class.
5567         (class Sized_incr_dynobj): New class.
5568         (make_sized_incremental_object): New function.
5569         (class Incremental_library): New class.
5570         * layout.cc (Free_list::num_lists): New static data member.
5571         (Free_list::num_nodes): New static data member.
5572         (Free_list::num_removes): New static data member.
5573         (Free_list::num_remove_visits): New static data member.
5574         (Free_list::num_allocates): New static data member.
5575         (Free_list::num_allocate_visits): New static data member.
5576         (Free_list::init): New function.
5577         (Free_list::remove): New function.
5578         (Free_list::allocate): New function.
5579         (Free_list::dump): New function.
5580         (Free_list::print_stats): New function.
5581         (Layout_task_runner::run): Resize output file for incremental updates.
5582         (Layout::Layout): Initialize new data members.
5583         (Layout::set_incremental_base): New function.
5584         (Layout::init_fixed_output_section): New function.
5585         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
5586         incremental updates.
5587         (Layout::create_gold_note): Do not create gold note section for
5588         incremental updates.
5589         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
5590         for incremental updates.
5591         (Layout::set_section_offsets): For incremental updates, allocate space
5592         from free list.
5593         (Layout::create_symtab_sections): Layout with offsets relative to
5594         start of section; for incremental updates, allocate space from free
5595         list.
5596         (Layout::create_shdrs): For incremental updates, allocate space from
5597         free list.
5598         (Layout::finish_dynamic_section): For incremental updates, do not
5599         check --as-needed (fixed in subsequent patch).
5600         * layout.h (class Free_list): New class.
5601         (Layout::set_incremental_base): New function.
5602         (Layout::incremental_base): New function.
5603         (Layout::init_fixed_output_section): New function.
5604         (Layout::allocate): New function.
5605         (Layout::incremental_base_): New data member.
5606         (Layout::free_list_): New data member.
5607         * main.cc (main): Print Free_list statistics.
5608         * object.cc (Relobj::finalize_incremental_relocs): Add
5609         clear_counts parameter; clear counts only when clear_counts is set.
5610         (Sized_relobj::Sized_relobj): Initialize new base class.
5611         (Sized_relobj::do_layout): Don't report special sections.
5612         (Sized_relobj::do_for_all_local_got_entries): New function.
5613         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
5614         symtab_off to all symbol table offsets.
5615         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
5616         * object.h (class Got_offset_list): Move to top of file.
5617         (Object::Object): Allow case where input_file == NULL.
5618         (Object::~Object): Likewise.
5619         (Object::input_file): Assert that input_file != NULL.
5620         (Object::lock): Allow case where input_file == NULL.
5621         (Object::unlock): Likewise.
5622         (Object::is_locked): Likewise.
5623         (Object::token): Likewise.
5624         (Object::release): Likewise.
5625         (Object::is_incremental): New function.
5626         (Object::get_mtime): New function.
5627         (Object::for_all_local_got_entries): New function.
5628         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
5629         (Object::set_is_in_system_directory): New function.
5630         (Object::is_in_system_directory): New function.
5631         (Object::do_is_incremental): New function.
5632         (Object::do_get_mtime): New function.
5633         (Object::do_for_all_local_got_entries): New function.
5634         (Object::is_in_system_directory_): New data member.
5635         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
5636         (class Sized_relobj_base): New class.
5637         (class Sized_relobj): Derive from Sized_relobj_base.
5638         (class Sized_relobj::Symbols): Redeclare from base class.
5639         (class Sized_relobj::local_got_offset_list): Remove.
5640         (class Sized_relobj::Output_sections): Redeclare from base class.
5641         (class Sized_relobj::do_for_all_local_got_entries): New function.
5642         (class Sized_relobj::write_local_symbols): Add offset parameter.
5643         (class Sized_relobj::local_symbol_offset_): Update comment.
5644         (class Sized_relobj::local_dynsym_offset_): Update comment.
5645         * options.cc (Input_arguments::add_file): Remove const.
5646         * options.h (Input_file_argument::Input_file_argument):
5647         Initialize arg_serial_ (all constructors).
5648         (Input_file_argument::set_arg_serial): New function.
5649         (Input_file_argument::arg_serial): New function.
5650         (Input_file_argument::arg_serial_): New data member.
5651         (Input_arguments::Input_arguments): Initialize file_count_.
5652         (Input_arguments::add_file): Remove const.
5653         (Input_arguments::number_of_input_files): New function.
5654         (Input_arguments::file_count_): New data member.
5655         (Command_line::number_of_input_files): Call
5656         Input_arguments::number_of_input_files.
5657         * output.cc (Output_segment_headers::Output_segment_headers):
5658         Set current size.
5659         (Output_section::Input_section::current_data_size): New function.
5660         (Output_section::Output_section): Initialize new data members.
5661         (Output_section::add_input_section): Don't do merge sections for
5662         an incremental link; allocate space from free list for an
5663         incremental update.
5664         (Output_section::add_output_section_data): Allocate space from
5665         free list for an incremental update.
5666         (Output_section::update_data_size): New function.
5667         (Output_section::set_fixed_layout): New function.
5668         (Output_section::reserve): New function.
5669         (Output_segment::set_section_addresses): Remove const.
5670         (Output_segment::set_section_list_addresses): Remove const; allocate
5671         space from free list for an incremental update.
5672         (Output_segment::set_offset): Adjust size of RELRO segment for an
5673         incremental update.
5674         * output.h (Output_data::current_data_size): Move here from
5675         child classes.
5676         (Output_data::pre_finalize_data_size): New function.
5677         (Output_data::update_data_size): New function.
5678         (Output_section_headers::update_data_size): new function.
5679         (Output_section_data_build::current_data_size): Move to Output_data.
5680         (Output_data_strtab::update_data_size): New function.
5681         (Output_section::current_data_size): Move to Output_data.
5682         (Output_section::set_fixed_layout): New function.
5683         (Output_section::has_fixed_layout): New function.
5684         (Output_section::reserve): New function.
5685         (Output_section::update_data_size): New function.
5686         (Output_section::has_fixed_layout_): New data member.
5687         (Output_section::free_list_): New data member.
5688         (Output_segment::set_section_addresses): Remove const.
5689         (Output_segment::set_section_list_addresses): Remove const.
5690         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
5691         New function.
5692         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
5693         New function.
5694         * readsyms.cc (Read_symbols::do_read_symbols): Add library
5695         parameter when calling Add_symbols constructor; store argument
5696         serial number for members of a lib group.
5697         (Add_symbols::locks): Allow case where token == NULL.
5698         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
5699         (Read_member::~Read_member): New function.
5700         (Read_member::is_runnable): New function.
5701         (Read_member::locks): New function.
5702         (Read_member::run): New function.
5703         (Check_script::~Check_script): New function.
5704         (Check_script::is_runnable): New function.
5705         (Check_script::locks): New function.
5706         (Check_script::run): New function.
5707         (Check_library::~Check_library): New function.
5708         (Check_library::is_runnable): New function.
5709         (Check_library::locks): New function.
5710         (Check_library::run): New function.
5711         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
5712         (Add_symbols::library_): New data member.
5713         (class Read_member): New class.
5714         (class Check_script): New class.
5715         (class Check_library): New class.
5716         * reloc.cc (Read_relocs::is_runnable): Allow case where
5717         token == NULL.
5718         (Read_relocs::locks): Likewise.
5719         (Scan_relocs::locks): Likewise.
5720         (Relocate_task::locks): Likewise.
5721         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
5722         to clear counters.
5723         (Sized_relobj::incremental_relocs_scan): Fix comment.
5724         (Sized_relobj::do_relocate): Pass output file offset to
5725         write_local_symbols.
5726         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
5727         from class declaration.
5728         * script.cc (read_input_script): Allocate Script_info; pass
5729         argument serial number to report_script.
5730         * script.h (class Script_info): Move to incremental.h.
5731         * symtab.cc (Symbol_table::add_from_incrobj): New function.
5732         * symtab.h (Symbol_table::add_from_incrobj): New function.
5733         (Symbol_table::set_file_offset): New function.
5734
5735 2011-04-05  Cary Coutant  <ccoutant@google.com>
5736
5737         * incremental-dump.cc (dump_incremental_inputs): Change signature
5738         to take a Sized_incremental_binary; change caller.  Use readers
5739         in Sized_incremental_binary.
5740         * incremental.cc
5741         (Sized_incremental_binary::find_incremental_inputs_sections):
5742         Rename do_find_incremental_inputs_sections to this.
5743         (Sized_incremental_binary::setup_readers): New function.
5744         (Sized_incremental_binary::do_check_inputs): Check
5745         has_incremental_info_ flag; move setup code to setup_readers;
5746         use input readers.
5747         (Sized_incremental_binary::do_file_is_unchanged): New function.
5748         (Sized_incremental_binary::do_get_input_reader): New function.
5749         * incremental.h (class Incremental_binary): Move to end of file.
5750         (Incremental_binary::file_is_unchanged): New function.
5751         (Incremental_binary::do_file_is_unchanged): New function.
5752         (Incremental_binary::Input_reader): New class.
5753         (Incremental_binary::get_input_reader): New function.
5754         (class Sized_incremental_binary): Move to end of file.
5755         (Sized_incremental_binary::Sized_incremental_binary): Setup the
5756         input section reader classes.
5757         (Sized_incremental_binary::has_incremental_info): New function.
5758         (Sized_incremental_binary::inputs_reader): New function.
5759         (Sized_incremental_binary::symtab_reader): New function.
5760         (Sized_incremental_binary::relocs_reader): New function.
5761         (Sized_incremental_binary::got_plt_reader): New function.
5762         (Sized_incremental_binary::do_file_is_unchanged): New function.
5763         (Sized_incremental_binary::Sized_input_reader): New class.
5764         (Sized_incremental_binary::get_input_reader): New function.
5765         (Sized_incremental_binary::find_incremental_inputs_sections):
5766         Rename do_find_incremental_inputs_sections to this.
5767         (Sized_incremental_binary::setup_readers): New function.
5768         (Sized_incremental_binary::has_incremental_info_): New data member.
5769         (Sized_incremental_binary::inputs_reader_): New data member.
5770         (Sized_incremental_binary::symtab_reader_): New data member.
5771         (Sized_incremental_binary::relocs_reader_): New data member.
5772         (Sized_incremental_binary::got_plt_reader_): New data member.
5773         (Sized_incremental_binary::current_input_file_): New data member.
5774
5775 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
5776
5777         PR gold/12640
5778         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
5779         violation.
5780
5781 2011-03-30  Cary Coutant  <ccoutant@google.com>
5782
5783         * archive.cc (Archive::include_member): Adjust call to report_object.
5784         (Add_archive_symbols::run): Add script_info to call to
5785         report_archive_begin.
5786         (Lib_group::include_member): Adjust call to report_object.
5787         (Add_lib_group_symbols::run): Adjust call to report_object.
5788         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
5789         blocks.  Add object count for script input files.
5790         * incremental.cc (Incremental_inputs::report_archive_begin): Add
5791         script_info parameter; change all callers.
5792         (Incremental_inputs::report_object): Add script_info parameter;
5793         change all callers.
5794         (Incremental_inputs::report_script): Store backpointer to
5795         incremental info entry.
5796         (Output_section_incremental_inputs::set_final_data_size): Record
5797         additional information for scripts.
5798         (Output_section_incremental_inputs::write_info_blocks): Likewise.
5799         * incremental.h (Incremental_script_entry::add_object): New function.
5800         (Incremental_script_entry::get_object_count): New function.
5801         (Incremental_script_entry::get_object): New function.
5802         (Incremental_script_entry::objects_): New data member; adjust
5803         constructor.
5804         (Incremental_inputs::report_archive_begin): Add script_info parameter.
5805         (Incremental_inputs::report_object): Add script_info parameter.
5806         (Incremental_inputs_reader::get_object_count): New function.
5807         (Incremental_inputs_reader::get_object_offset): New function.
5808         * options.cc (Input_arguments::add_file): Return reference to
5809         new input argument.
5810         * options.h (Input_argument::set_script_info): New function.
5811         (Input_argument::script_info): New function.
5812         (Input_argument::script_info_): New data member; adjust all
5813         constructors.
5814         (Input_file_group::add_file): Return reference to new input argument.
5815         (Input_file_lib::add_file): Likewise.
5816         (Input_arguments::add_file): Likewise.
5817         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
5818         * script.cc (Parser_closure::Parser_closure): Add script_info
5819         parameter; adjust all callers.
5820         (Parser_closure::script_info): New function.
5821         (Parser_closure::script_info_): New data member.
5822         (read_input_script): Report scripts earlier to incremental info.
5823         (script_add_file): Set script_info in Input_argument.
5824         (script_add_library): Likewise.
5825         * script.h (Script_options::Script_info): Rewrite class.
5826
5827 2011-03-29  Cary Coutant  <ccoutant@google.com>
5828
5829         * archive.cc (Library_base::should_include_member): Move
5830         method here from class Archive.
5831         (Archive::Archive): Initialize base class.
5832         (Archive::should_include_member): Move to base class.
5833         (Archive::do_for_all_unused_symbols): New function.
5834         (Add_archive_symbols::run): Remove redundant access to
5835         incremental_inputs.
5836         (Lib_group::Lib_group): Initialize base class.
5837         (Lib_group::do_filename): New function.
5838         (Lib_group::include_member): Pass pointer to Lib_group to
5839         report_object.
5840         (Lib_group::do_for_all_unused_symbols): New function.
5841         (Add_lib_group_symbols::run): Report archive information for
5842         incremental links.
5843         * archive.h (class Library_base): New base class.
5844         (class Archive): Derive from Library_base.
5845         (Archive::filename): Move to base class.
5846         (Archive::set_incremental_info): Likewise.
5847         (Archive::incremental_info): Likewise.
5848         (Archive::Should_include): Likewise.
5849         (Archive::should_include_member): Likewise.
5850         (Archive::Armap_entry): Remove.
5851         (Archive::Unused_symbol_iterator): Remove.
5852         (Archive::unused_symbols_begin): Remove.
5853         (Archive::unused_symbols_end): Remove.
5854         (Archive::do_filename): New function.
5855         (Archive::do_get_mtime): New function.
5856         (Archive::do_for_all_unused_symbols): New function.
5857         (Archive::task_): Move to base class.
5858         (Archive::incremental_info_): Likewise.
5859         (class Lib_group): Derive from Library_base.
5860         (Lib_group::do_filename): New function.
5861         (Lib_group::do_get_mtime): New function.
5862         (Lib_group::do_for_all_unused_symbols): New function.
5863         (Lib_group::task_): Move to base class.
5864         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
5865         function.
5866         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
5867         function.
5868         * incremental.cc (Incremental_inputs::report_archive_begin):
5869         Use Library_base; call library's get_mtime; add incremental inputs
5870         entry before members.
5871         (class Unused_symbol_visitor): New class.
5872         (Incremental_inputs::report_archive_end): Use Library_base; use
5873         visitor class to record unused symbols; don't add incremental inputs
5874         entry after members.
5875         (Incremental_inputs::report_object): Use Library_base.
5876         * incremental.h
5877         (Incremental_archive_entry::Incremental_archive_entry): Remove
5878         unused Archive parameter.
5879         (Incremental_inputs::report_archive_begin): Use Library_base.
5880         (Incremental_inputs::report_archive_end): Likewise.
5881         (Incremental_inputs::report_object): Likewise.
5882         * object.cc (Sized_relobj::do_for_all_global_symbols): New
5883         function.
5884         * object.h (Object::for_all_global_symbols): New function.
5885         (Object::do_for_all_global_symbols): New function.
5886         (Sized_relobj::do_for_all_global_symbols): New function.
5887         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
5888         function.
5889         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
5890         function.
5891
5892 2011-03-27  Ian Lance Taylor  <iant@google.com>
5893
5894         * archive.cc (Archive::interpret_header): Return -1 if something
5895         goes wrong.  Change callers accordingly.
5896
5897 2011-03-25  Cary Coutant  <ccoutant@google.com>
5898
5899         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
5900         * testsuite/Makefile.in: Regenerate.
5901
5902 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
5903
5904         * plugin.cc (get_view): New.
5905         (Plugin::load): Pass get_view to the plugin.
5906         (Plugin_manager::get_view): New.
5907
5908 2011-03-21  Ian Lance Taylor  <iant@google.com>
5909
5910         * testsuite/final_layout.sh: Rewrite to not use dc.
5911         * testsuite/relro_test.sh: Fail if dc is not present.
5912
5913 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
5914
5915         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
5916         Change == to -eq.
5917         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
5918         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
5919         Change == to -eq.
5920         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
5921         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
5922
5923 2011-03-14  Ian Lance Taylor  <iant@google.com>
5924
5925         * script-sections.cc (Sort_output_sections::script_compare):
5926         Rename from is_before, change return type.
5927         (Sort_output_sections::operator()): Adjust accordingly.
5928
5929 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
5930
5931         PR gold/12572
5932         * testsuite/odr_violation2.cc: Add comment to make all error line
5933         numbers double digits.
5934         * testsuite/debug_msg.sh: Adjust expected errors.
5935
5936 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
5937
5938         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
5939         but mark earlier ones as non-canonical
5940         (offset_to_iterator): Update search target and example
5941         (do_addr2line): Return extra lines in a vector*
5942         (format_file_lineno): Extract from do_addr2line
5943         (one_addr2line): Add vector* out-param
5944         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
5945         when a lineno entry appeared last for its instruction
5946         (Dwarf_line_info): Add vector* out-param
5947         * object.cc (Relocate_info): Pass NULL for the vector* out-param
5948         * symtab.cc (Odr_violation_compare): Include the lineno in the
5949         comparison again.
5950         (linenos_from_loc): New. Combine the canonical line for an
5951         address with its other lines.
5952         (True_if_intersect): New. Helper functor to make
5953         std::set_intersection a query.
5954         (detect_odr_violations): Compare sets of lines instead of just
5955         one line for each function. This became less deterministic, but
5956         has fewer false positives.
5957         * symtab.h: Declarations.
5958         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
5959         mix an optimized and non-optimized object in the same binary
5960         (odr_violation2.so): Same.
5961         * testsuite/Makefile.in: Regenerate from Makefile.am.
5962         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
5963         * testsuite/debug_msg.sh: Update line numbers and add
5964         assertions.
5965         * testsuite/odr_violation1.cc: Use OdrDerived, in a
5966         non-optimized context.
5967         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
5968         isn't inlined, and use OdrDerived in an optimized context.
5969         * testsuite/odr_header1.h: Defines OdrDerived, where
5970         optimization will change the
5971         first-instruction-in-the-destructor's file and line number.
5972         * testsuite/odr_header2.h: Defines OdrBase.
5973
5974 2011-03-09  Ian Lance Taylor  <iant@google.com>
5975
5976         * fileread.cc (File_read::clear_views): Don't delete the whole
5977         file view.
5978
5979 2011-03-08  Ian Lance Taylor  <iant@google.com>
5980
5981         PR gold/12525
5982         * fileread.cc: #include <climits>.
5983         (GOLD_IOV_MAX): Define.
5984         (File_read::read_multiple): Limit number of entries by iov_max.
5985         * fileread.h (class File_read): Always set max_readv_entries to
5986         128.
5987
5988 2011-03-07  Ian Lance Taylor  <iant@google.com>
5989
5990         PR gold/12525
5991         * options.h (class General_options): Add -dy and -dn.
5992
5993 2011-03-02  Cary Coutant  <ccoutant@google.com>
5994
5995         * testsuite/script_test_9.t: Add TLS segment.
5996
5997 2011-03-02  Simon Baldwin  <simonb@google.com>
5998
5999         * configure.ac: Add check for gnu_indirect_function support in
6000         the toolchain building binutils.
6001         * configure: Rebuild.
6002
6003 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
6004
6005         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
6006         plugin only symbols.
6007         (Symbol_table::sized_finalize_symbol) Mark symbol only present
6008         in plugin files as not needed in the symbol table.
6009
6010 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
6011
6012         * output.cc (Output_section::add_input_section): Delay fill
6013         generation for section ordering.
6014
6015 2011-02-09  Ian Lance Taylor  <iant@google.com>
6016
6017         PR gold/12316
6018         * object.h (class Sized_relobj): Remove clear_local_symbols.
6019         * reloc.cc (Sized_relobj::do_relocate): Don't call
6020         clear_local_symbols.
6021
6022 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
6023
6024         * plugin.cc (is_visible_from_outside): Return true for symbols
6025         in the -u option.
6026
6027 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
6028
6029         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
6030         filename.
6031
6032 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
6033
6034         * icf.h (is_section_foldable_candidate): Change type of parameter
6035         to std::string.
6036         * icf.cc (Icf::find_identical_sections): Change type of local variable
6037         section_name to be std::string.
6038         (is_function_ctor_or_dtor): Change type of parameter to std::string.
6039
6040 2011-01-25  Ian Lance Taylor  <iant@google.com>
6041
6042         * script.cc (script_add_extern): Rewrite to use
6043         add_symbol_reference.
6044
6045 2011-01-25  Doug Kwan  <dougkwan@google.com>
6046
6047         * icf.cc (get_section_contents): Always lock section's object.
6048
6049 2011-01-24  Ian Lance Taylor  <iant@google.com>
6050
6051         * options.h (class General_options): Accept
6052         --no-detect-odr-violations.
6053
6054 2011-01-24  Ian Lance Taylor  <iant@google.com>
6055
6056         * version.cc (version_string): Bump to 1.11.
6057
6058 2011-01-24  Ian Lance Taylor  <iant@google.com>
6059
6060         * plugin.cc (class Plugin_rescan): Define new class.
6061         (Plugin_manager::claim_file): Set any_claimed_.
6062         (Plugin_manager::save_archive): New function.
6063         (Plugin_manager::save_input_group): New function.
6064         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
6065         necessary.
6066         (Plugin_manager::new_undefined_symbol): New function.
6067         (Plugin_manager::rescan): New function.
6068         (Plugin_manager::rescannable_defines): New function.
6069         (Plugin_manager::add_input_file): Set any_added_.
6070         * plugin.h (class Plugin_manager): define new fields rescannable_,
6071         undefined_symbols_, any_claimed_, and any_added_.  Declare
6072         Plugin_rescan as friend.  Declare new functions.
6073         (Plugin_manager::Rescannable): Define type.
6074         (Plugin_manager::Rescannable_list): Define type.
6075         (Plugin_manager::Undefined_symbol_list): Define type.
6076         (Plugin_manager::Plugin_manager): Initialize new fields.
6077         * archive.cc (Archive::defines_symbol): New function.
6078         (Add_archive_symbols::run): Pass archive to plugins if any.
6079         * archive.h (class Archive): Declare defines_symbol.
6080         * readsyms.cc (Input_group::~Input_group): New function.
6081         (Finish_group::run): Pass input_group to plugins if any.
6082         * readsyms.h (class Input_group): Declare destructor.
6083         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
6084         any.
6085
6086 2011-01-10  Ian Lance Taylor  <iant@google.com>
6087
6088         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
6089         section as relro.
6090         (Layout::set_segment_offsets): Reset increase_relro before calling
6091         set_section_addresses a second time.
6092
6093 2011-01-04  Cary Coutant  <ccoutant@google.com>
6094
6095         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
6096         sections before NOBITS sections.
6097
6098 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
6099
6100         * version.cc (print_version): Update copyright to 2011.
6101
6102 2010-12-23  Cary Coutant  <ccoutant@google.com>
6103
6104         * output.h (Output_data_reloc::add_output_section): Pass OD instead
6105         of OS to this->add.  Add OD parameter to second form of the function.
6106
6107 2010-12-20  Ian Lance Taylor  <iant@google.com>
6108
6109         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
6110         second of two consecutive entries with same offset.
6111
6112 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6113
6114         * testsuite/Makefile.am (ifuncmain2static_LDADD)
6115         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
6116         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
6117         to avoid unneeded links against $(LDADD).
6118         * testsuite/Makefile.in: Regenerate.
6119
6120 2010-12-15  Ian Lance Taylor  <iant@google.com>
6121
6122         PR gold/12324
6123         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
6124         for R_X86_64_32 and R_X86_64_PC32.
6125         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
6126         ver_matching_def_pic.o.
6127         (ver_matching_def_pic.o): New target.
6128
6129 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6130
6131         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
6132         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
6133         Move definition before File_read::View member definitions.
6134         (File_read::View::~View): Initialize and hold lock before
6135         updating current_mapped_bytes.
6136
6137 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6138
6139         * dwarf_reader.cc: Remove outdated comment.
6140         * gold-threads.cc: Fix typo in error message.
6141         * archive.cc: Fix typos in comments.
6142         * archive.h: Likewise.
6143         * arm-reloc-property.cc: Likewise.
6144         * arm-reloc-property.h: Likewise.
6145         * arm-reloc.def: Likewise.
6146         * arm.cc: Likewise.
6147         * attributes.h: Likewise.
6148         * cref.cc: Likewise.
6149         * ehframe.cc: Likewise.
6150         * fileread.h: Likewise.
6151         * gold.h: Likewise.
6152         * i386.cc: Likewise.
6153         * icf.cc: Likewise.
6154         * incremental.h: Likewise.
6155         * int_encoding.cc: Likewise.
6156         * layout.h: Likewise.
6157         * main.cc: Likewise.
6158         * merge.h: Likewise.
6159         * object.cc: Likewise.
6160         * object.h: Likewise.
6161         * options.cc: Likewise.
6162         * readsyms.cc: Likewise.
6163         * reduced_debug_output.cc: Likewise.
6164         * reloc.cc: Likewise.
6165         * script-sections.cc: Likewise.
6166         * sparc.cc: Likewise.
6167         * symtab.h: Likewise.
6168         * target-reloc.h: Likewise.
6169         * target.cc: Likewise.
6170         * target.h: Likewise.
6171         * timer.cc: Likewise.
6172         * timer.h: Likewise.
6173         * x86_64.cc: Likewise.
6174
6175 2010-12-09  Cary Coutant  <ccoutant@google.com>
6176
6177         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
6178         stack.
6179         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
6180         parameter; change all callers.
6181         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
6182         * options.h (warn_execstack): New option.
6183
6184 2010-12-07  Doug Kwan  <dougkwan@google.com>
6185
6186         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
6187         like function call relocations.
6188
6189 2010-12-07  Ian Lance Taylor  <iant@google.com>
6190
6191         * archive.cc (Archive::get_elf_object_for_member): Permit
6192         punconfigured to be NULL.
6193         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
6194         (Archive::include_member): Pass NULL to get_elf_object_for_member
6195         if we searched for the archive and this is the first included
6196         object.
6197
6198 2010-12-01  Ian Lance Taylor  <iant@google.com>
6199
6200         * dwarf_reader.h (class Sized_dwarf_line_info): Add
6201         track_relocs_type_ field.
6202         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
6203         Set track_relocs_type_.
6204         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
6205         contents when using RELA relocs.
6206         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
6207         reloc_map_.
6208         * reloc.cc (Track_relocs::next_addend): New function.
6209         * reloc.h (class Track_relocs): Declare next_addend.
6210
6211 2010-12-01  Ian Lance Taylor  <iant@google.com>
6212
6213         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
6214         virtual destructor.
6215
6216 2010-12-01  Ian Lance Taylor  <iant@google.com>
6217
6218         * README: Update compilers known to work and fail.
6219
6220 2010-11-23  Matthias Klose  <doko@ubuntu.com>
6221
6222         * configure.in: For --enable-gold, handle value `default' instead of
6223         `both*'.  Always install ld as ld.bfd, install as ld if gold is
6224         not the default.
6225         * configure: Regenerate.
6226
6227 2010-11-18  Doug Kwan  <dougkwan@google.com>
6228
6229         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
6230         and right_alignment to be zero.  Store result alignment only if it is
6231         greater than existing alignment.
6232
6233 2010-11-16  Cary Coutant  <ccoutant@google.com>
6234
6235         PR gold/12220
6236         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
6237         Check for ".zdebug_line".
6238
6239 2010-11-16  Doug Kwan  <dougkwan@google.com>
6240             Cary Coutant  <ccoutant@google.com>
6241
6242         * output.h (Output_segment::set_section_addresses): Pass increase_relro
6243         by reference; adjust all callers.
6244         * output.cc (Output_segment::set_section_addresses): Adjust references
6245         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
6246         list is empty.
6247         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
6248         end at page boundary.
6249
6250 2010-11-16  Cary Coutant  <ccoutant@google.com>
6251
6252         PR gold/12220
6253         * layout.cc (Layout::choose_output_section): Transform names of
6254         compressed sections even when using a script with a SECTIONS clause.
6255         (Layout::output_section_name): Remove code to transform
6256         compressed debug section names.
6257         * output.cc (Output_section::add_input_section): Use uncompressed
6258         section size when tracking input sections.
6259
6260 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
6261
6262         * symtab.h (Symbol::NON_PIC_REF): Remove.
6263         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
6264         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
6265         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
6266         (Symbol::use_plt_offset): Take a flags argument and pass it
6267         directly to needs_dynamic_reloc.  Restrict check for undefined
6268         weak symbols to function calls.
6269         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
6270         (Target_arm::Scan::global): Use it.
6271         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
6272         (Target_arm::Relocate::relocate): Likewise.
6273         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
6274         parameter with an r_type parameter.  Use get_reference_flags
6275         to get the flags.
6276         (Target_arm::Relocate::relocate): Update accordingly.
6277         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
6278         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
6279         (Target_i386::Scan::global): Likewise.
6280         (Target_i386::Relocate::relocate): Likewise.
6281         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
6282         parameter with an r_type parameter.  Use get_reference_flags
6283         to get the flags.
6284         (Target_i386::Relocate::relocate): Update accordingly.
6285         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
6286         (Target_powerpc::Scan::global): Use it.
6287         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
6288         (Target_powerpc::Relocate::relocate): Likewise.
6289         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
6290         (Target_sparc::Scan::global): Use it.
6291         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
6292         (Target_sparc::Relocate::relocate): Likewise.
6293         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
6294         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
6295         (Target_x86_64::Scan::global): Likewise.
6296         (Target_x86_64::Relocate::relocate): Likewise.
6297
6298 2010-11-08  Doug Kwan  <dougkwan@google.com>
6299             Cary Coutant  <ccoutant@google.com>
6300
6301         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
6302         (Arm_exidx_merge_section::section_contents_): New data member.
6303         (Arm_input_section::Arm_input_section): Initialize original_contents_.
6304         (Arm_input_section::~Arm_input_section): De-allocate memory.
6305         (Arm_input_section::original_contents_): New data member.
6306         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
6307         in parameters instead of calling Object::section_contents without
6308         locking.
6309         (Arm_output_section::group_section): New parameter TASK.  Pass it
6310         to callees that need locking objects.
6311         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
6312         to lock EXIDX input sections.  Fix a formatting issue.  Call
6313         Arm_exidx_merged_section::build_contents to create merged section
6314         contents.
6315         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
6316         to lock object of stub table owner.
6317         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
6318         TEXT_SIZE to initialize data member TEXT_SIZE_.
6319         (Arm_exidx_input_section::addralign): Fix typo in comment.
6320         (Arm_exidx_input_section::text_size): New method.
6321         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
6322         that require locking objects.  Lock objects before scanning for stubs
6323         and updating local symbols.
6324         (Arm_input_section<big_endian>::init): Copy contents of original
6325         input section.
6326         (Arm_input_section<big_endian>::do_write): Use saved contents of
6327         original input section instead of calling Object::section_contents
6328         without locking.
6329         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
6330         size without calling Object::section_size().
6331         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
6332         for size.  Allocate a buffer for merged EXIDX entries.
6333         (Arm_exidx_merged_section::build_contents): New method.
6334         (Arm_exidx_merged_section::do_write): Move merge section contents
6335         building code to Arm_exidx_merged_section::build_contetns.  Write
6336         out contetns in buffer instead of building it on the fly.
6337         (Arm_relobj::make_exidx_input_section): Also pass text section size
6338         to Arm_exidx_input_section constructor.
6339         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
6340         (Arm_dynobj::do_read_symbols): Fix memory leak.
6341         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
6342         * target.h: (class Task): Add forward declaration.
6343         (Target::relax): Add new parameter TASK and pass it to
6344         Target::do_relax().
6345         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
6346
6347 2010-11-05  Cary Coutant  <ccoutant@google.com>
6348
6349         PR gold/10708
6350         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
6351         object when reading from the file.
6352         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
6353         second layout pass.
6354         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
6355         when reading section contents.
6356         (get_section_contents): Likewise.
6357         (icf::find_identical_sections): Likewise.
6358         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
6359         object when reading from the file.
6360         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
6361         the object when doing deferred section layout.
6362
6363 2010-11-03  Nick Clifton  <nickc@redhat.com>
6364
6365         PR gold/12001
6366         * script.h (class Symbol_assignment: name): New member.  Returns
6367         the name of the symbol.
6368         * scrfipt.cc (Script_options::is_pending_assignment): New member.
6369         Returns true if the given symbol name is on the list of
6370         assignments wating to be processed.
6371         * archive.cc (should_incldue_member): If the symbol is undefined,
6372         check to see if it is on the list of symbols pending assignment.
6373
6374 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
6375
6376         * script-sections.cc (Script_sections::find_memory_region): Check
6377         for a NULL output section pointer.
6378
6379 2010-10-29  Doug Kwan  <dougkwan@google.com>
6380
6381         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
6382         Output_section::add_relaxed_input_section.
6383         * output.cc (Output_section::add_relaxed_input_section): Add new
6384         arguments LAYOUT and NAME.  Set section order index.
6385         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
6386         Copy section order index.
6387         * output.h (Output_section::add_relaxed_input_section): Add new
6388         arguments LAYOUT and NAME.
6389
6390 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6391
6392         * testsuite/Makefile.am: Move gcctestdir/ld rule to
6393         NATIVE_OR_CROSS_LINKER.
6394         * testsuite/Makefile.in: Regenerate.
6395
6396 2010-10-20  Doug Kwan  <dougkwan@google.com>
6397
6398         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
6399         without SHF_LINK_ORDER flags.
6400         * layout.cc (Layout::choose_output_section): Do not filter
6401         SHF_LINK_ORDER flag in a relocatable link.
6402
6403 2010-10-17  Cary Coutant  <ccoutant@google.com>
6404
6405         * output.h (Output_segment::set_section_addresses): Change function
6406         signature.  Update all callers.
6407         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
6408         sections.
6409         (Output_segment::set_section_addresses): Align after last TLS
6410         section.  Add padding before last relro section instead of after.
6411
6412 2010-10-17  Doug Kwan  <dougkwan@google.com>
6413
6414         * gold/arm.cc (Target_arm::got_section): Use correct order and set
6415         GOT output section to be writable.
6416
6417 2010-10-14  Cary Coutant  <ccoutant@google.com>
6418
6419         * debug.h (DEBUG_INCREMENTAL): New flag.
6420         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
6421         * gold.cc (queue_initial_tasks): Check parameters for incremental link
6422         mode.
6423         * incremental.cc (report_command_line): Ignore all forms of
6424         --incremental.
6425         * layout.cc (Layout::Layout): Check parameters for incremental link
6426         mode.
6427         * options.cc (General_options::parse_incremental): New function.
6428         (General_options::parse_no_incremental): New function.
6429         (General_options::parse_incremental_full): New function.
6430         (General_options::parse_incremental_update): New function.
6431         (General_options::incremental_mode_): New data member.
6432         (General_options::finalize): Check incremental_mode_.
6433         * options.h (General_options): Update help text for --incremental.
6434         Add --no-incremental, --incremental-full, --incremental-update.
6435         (General_options::Incremental_mode): New enum type.
6436         (General_options::incremental_mode): New function.
6437         (General_options::incremental_mode_): New data member.
6438         * parameters.cc (Parameters::incremental_mode_): New data member.
6439         (Parameters::set_options): Set incremental_mode_.
6440         (Parameters::set_incremental_full): New function.
6441         (Parameters::incremental): New function.
6442         (Parameters::incremental_update): New function.
6443         (set_parameters_incremental_full): New function.
6444         * parameters.h (Parameters::set_incremental_full): New function.
6445         (Parameters::incremental): New function.
6446         (Parameters::incremental_update): New function.
6447         (Parameters::incremental_mode_): New data member.
6448         (set_parameters_incremental_full): New function.
6449         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
6450         incremental link mode.
6451         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
6452         (Sized_relobj::do_relocate_sections): Likewise.
6453         * testsuite/Makefile.am (incremental_test): Use --incremental-full
6454         option.
6455         * testsuite/Makefile.in: Regenerate.
6456         * testsuite/incremental_test.sh: Filter all forms of --incremental.
6457
6458 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6459
6460         * script-sections.h (class Script_sections): Make
6461         Sections_elements typedef public.
6462         * script-sections.cc (class Sort_output_sections): Add elements_
6463         field.  Add constructor which sets it; change all callers.
6464         (Sort_output_sections::is_before): New function.
6465         (Sort_output_sections::operator()): Call is_before.
6466         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
6467         conditional.
6468         * testsuite/script_test_10.sh: New test. Test script section
6469         order.
6470         * testsuite/script_test_10.t: Likewise.
6471         * testsuite/script_test_10.s: Likewise.
6472         * testsuite/Makefile.am: Wrap the cross linker tests and the
6473         common tests into NATIVE_OR_CROSS_LINKER.
6474         (check_SCRIPTS): Add script_test_10.sh.
6475         (check_DATA): Add script_test_10.stdout.
6476         (script_test_10.o, script_test_10): New targets.
6477         (script_test_10.stdout): New target.
6478         * configure, testsuite/Makefile.in: Regenerate.
6479
6480 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6481
6482         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
6483         error for the deprecated relocations.
6484         (Target_arm::Scan::global): Likewise.
6485         (Target_arm::Relocate::relocate): Likewise.
6486
6487 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
6488
6489         * fileread.cc (Input_file::find_file): Initialize *found_name
6490         and *namep when using the fallback search for case 4.
6491
6492 2010-10-11  Cary Coutant  <ccoutant@google.com>
6493
6494         * options.h (class General_options): Redefine -z lazy as an alias for
6495         the negation of -z now.
6496
6497 2010-10-11  Ian Lance Taylor  <iant@google.com>
6498
6499         * resolve.cc (symbol_to_bits): Report the value of the unsupported
6500         binding.
6501
6502 2010-10-06  Nick Clifton  <nickc@redhat.com>
6503
6504         * script-sections.cc(class Memory_region): Remove
6505         current_lma_offset_ field.  Rename current_vma_offset_ to
6506         current_offset_.  Add last_section_ field.
6507         (Memory_region::get_current_vma_address): Rename to
6508         get_current_address.
6509         (Memory_region::get_current_lma_address): Delete.
6510         (Memory_region::increment_vma_offset): Rename to
6511         increment_offset.
6512         (Memory_region::increment_lma_offset): Delete.
6513         (Memory_region::attributes_compatible): New method.  Returns
6514         true if the provided section is compatible with the region.
6515         (Memory_region::get_last_section): New method.  Returns the last
6516         section to use the region.
6517         (Memory_region::set_last_section): New method.  Stores the last
6518         section to use the region.
6519         (Script_sections::block_in_region): New method.  Returns true if
6520         a block of memory is contained within a region.
6521         (Script_sections::find_memory_region): New method.  Locates a
6522         memory region to be used to set a VMA or LMA address.
6523         (Output_section_definition::set_section_addresses): Add code to
6524         check for addresses set by memory regions.
6525         (Output_segment::set_section_addresses): Remove memory region
6526         walking code.
6527         (Script_sections::create_segment): Add a warning if a header
6528         segment is created outside of any region.
6529         * script-sections.h (class Script_sections): Add prototypes for
6530         find_memory_region and block_in_region methods.
6531         * testsuite/memory_test.s: Use .long instead of .word.
6532         * testsuite/memory_test.t: Add some more output sections.
6533         * testsuite/memory_test.sh: Update expected output.
6534
6535 2010-10-02  Doug Kwan  <dougkwan@google.com>
6536
6537         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
6538         defintion to symtab.h
6539         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
6540         declaration to defintion.
6541
6542 2010-10-01  Nick Clifton  <nickc@redhat.com>
6543
6544         * expression.cc (eval): Replace dummy argument with NULL.
6545         (eval_maybe_dot): Check for a NULL result section pointer.
6546         (Symbol_expression::value): Likewise.
6547         (Dot_expression::value): Likewise.
6548         (BINARY_EXPRESSION): Likewise.
6549         (Max_expression::value): Likewise.
6550         (Min_expression::value): Likewise.
6551         (Absolute_expression::value): Likewise.
6552         (Addr_expression::value_from_output_section): Likewise.
6553         (Loaddddr_expression::value_from_output_section): Likewise.
6554         (Segment_start_expression::value): Likewise.
6555         * script-sections.cc
6556         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
6557         argument with NULL.
6558         (Sections_elememt_dot_assignment::set_section_addresses):
6559         Likewise.
6560         (Output_data_expression::do_write_to_buffer): Likewise.
6561         (Output_section_definition::finalize_symbols): Likewise.
6562         (Output_section_definition::set_section_addresses): Likewise.
6563
6564 2010-09-30  Doug Kwan  <dougkwan@google.com>
6565
6566         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
6567
6568 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
6569
6570         * target.h (Target::can_icf_inline_merge_sections): New virtual
6571         function.
6572         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
6573         virtual function.
6574         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
6575         virtual function.
6576         * icf.cc (get_section_contents): Inline merge sections only when
6577         target allows it.
6578
6579 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6580
6581         * configure: Regenerate.
6582
6583 2010-09-17  Ian Lance Taylor  <iant@google.com>
6584
6585         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
6586         * testsuite/Makefile.am (memory_test.o): New target.
6587         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
6588         memory_test.t.
6589         * testsuite/Makefile.in: Rebuild.
6590
6591 2010-09-17  Doug Kwan  <dougkwan@google.com>
6592
6593         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
6594         defintion if relocation uses GOT entries of the symbol.
6595         * testsuite/icf_safe_test.sh: Fix test.
6596         * testsuite/icf_safe_so_test.sh: Fix test.
6597
6598 2010-09-16  Cary Coutant  <ccoutant@google.com>
6599
6600         * script_sections.cc (class Memory_region): Remove "NULL" from
6601         vector initializations.
6602
6603 2010-09-15  Cary Coutant  <ccoutant@google.com>
6604
6605         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
6606         Resolve forwarding symbols.
6607
6608 2010-09-15  Doug Kwan  <dougkwan@google.com>
6609
6610         * gold/testsuite/script_test_3.t: Add ARM special sections.
6611         * gold/testsuite/script_test_4.t: Same.
6612         * gold/testsuite/script_test_5.t: Same.
6613         * gold/testsuite/script_test_6.t: Same.
6614         * gold/testsuite/script_test_7.t: Same.
6615         * gold/testsuite/script_test_7.t: Same.
6616         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
6617
6618 2010-09-14  Cary Coutant  <ccoutant@google.com>
6619
6620         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
6621         (Target_x86_64::Relocate::relocate_tls): Replace check for
6622         saw_tls_block_reloc_ with test for executable section.
6623
6624 2010-09-12  Cary Coutant  <ccoutant@google.com>
6625
6626         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
6627         position-independent executables to shared libraries need dynamic
6628         relocations.
6629         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
6630         position-independent executables.
6631         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
6632         * testsuite/Makefile.in: Regenerate.
6633
6634 2010-09-10  Nick Clifton  <nickc@redhat.com>
6635
6636         PR gold/11997
6637         * testsuite/memory_test.t: Discard any sections that are not
6638         needed.
6639
6640 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
6641
6642         PR gold/11996
6643         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
6644         "This::" to work around a bug in gcc 4.2.
6645
6646         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
6647
6648 2010-09-09  Rafael Espindola  <espindola@google.com>
6649
6650         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
6651         sections with different PF_X flags in the same segment.
6652         (Layout::find_first_load_seg): Search all segments to find the first
6653         one.
6654         * options.h (rosegment): New.
6655
6656 2010-09-08  Rafael Espindola  <espindola@google.com>
6657
6658         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
6659
6660 2010-09-08  Doug Kwan  <dougkwan@google.com>
6661
6662         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
6663         (Arm_relobj::do_relocate_sections): Add new parameter for output
6664         file to match the parent.
6665         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
6666         of local symbols instead of input values.  Update code to track
6667         changes in gold::relocate_section.
6668         * object.cc (Sized_relobj::compute_final_local_value): New methods.
6669         (Sized_relobj::compute_final_local_value_internal): New methods.
6670         (Sized_relobj::do_finalize_local_symbols): Move code from loop
6671         body into private version of Sized_relobj::compute_final_local_value.
6672         Call the inline method.
6673         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
6674         merged symbol value if there is one.
6675         (Symbol_value::has_output_value): New method defintiion.
6676         (Sized_relobj::Compute_final_local_value_status): New enum type.
6677         (Sized_relobj::compute_final_local_value): New methods.
6678         (Sized_relobj::compute_final_local_value_internal): New methods.
6679         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
6680         and arm_cortex_a8.sh.
6681         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
6682         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
6683         New tests.
6684         * Makefile.in: Regenerate.
6685         * testsuite/arm_bl_out_of_range.s: Update test.
6686         * testsuite/thumb_bl_out_of_range.s: Ditto.
6687         * testsuite/thumb_blx_out_of_range.s: Ditto.
6688         * testsuite/arm_branch_out_of_range.sh: New file.
6689         * testsuite/arm_cortex_a8.sh: Ditto.
6690         * testsuite/arm_cortex_a8_b.s: Ditto.
6691         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
6692         * testsuite/arm_cortex_a8_b_local.s: Ditto.
6693         * testsuite/arm_cortex_a8_bl.s: Ditto.
6694         * testsuite/arm_cortex_a8_blx.s: Ditto.
6695         * testsuite/arm_cortex_a8_local.s: Ditto.
6696         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
6697         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
6698
6699 2010-09-08  Rafael Espindola  <espindola@google.com>
6700
6701         * Makefile.am (memory_test.stdout): Run readelf with -W.
6702         * Makefile.in: Regenerate.
6703         * testsuite/memory_test.sh: Make the regexps accept both 32 and
6704         64 bit output.
6705
6706 2010-09-08  Rafael Espindola  <espindola@google.com>
6707
6708         * script-sections.cc (Script_sections::add_memory_region): Convert
6709         field precision to int.
6710         * script.cc (script_set_section_region, script_set_section_region):
6711         Convert field precision to int.
6712
6713 2010-09-08  Rafael Espindola  <espindola@google.com>
6714
6715         * arm.cc (do_finalize_sections): Create the __exidx_start and
6716         __exdix_end symbols even when the section is missing.
6717
6718 2010-09-08  Nick Clifton  <nickc@redhat.com>
6719
6720         * README: Remove claim that MEMORY is not supported.
6721         * expression.cc (script_exp_function_origin)
6722         (script_exp_function_length): Move from here to ...
6723         * script.cc: ... here.
6724         (script_set_section_region, script_add_memory)
6725         (script_parse_memory_attr, script_include_directive): New
6726         functions.
6727         * script-sections.cc
6728         (class Memory_region): New class.
6729         (class Output_section_definition): Add set_memory_region,
6730         set_section_vma, set_section_lma and get_section_name methods.
6731         (class Script_Sections): Add add_memory_region,
6732         find_memory_region, find_memory_region_origin,
6733         find_memory_region_length and set_memory_region methods.
6734         Have set_section_addresses method walk the list of set memory
6735         regions.
6736         Extend the print methos to display memory regions.
6737         * script-sections.h: Add prototypes for new methods.
6738         Add enum for MEMORY region attributes.
6739         * yyscript.y: Add support for parsing MEMORY regions.
6740         * script-c.h: Add prototypes for new functions.
6741         * testsuite/Makefile.am: Add test of MEMORY region functionality.
6742         * testsuite/Makefile.in: Regenerate.
6743         * testsuite/memory_test.sh: New script.
6744         * testsuite/memory_test.s: New assembler source file.
6745         * testsuite/memory_test.t: New linker script.
6746
6747 2010-08-27  Doug Kwan  <dougkwan@google.com>
6748
6749         * gold/resolve.cc (Symbol_table::should_override): Let a weak
6750         reference override an existing dynamic weak reference.
6751         * testsuite/Makefile.am: Add new test dyn_weak_ref.
6752         * testsuite/Makefile.in: Regenerate.
6753         * testsuite/dyn_weak_ref.sh: New file.
6754         * testsuite/dyn_weak_ref_1.c: Ditto.
6755         * testsuite/dyn_weak_ref_2.c: Ditto.
6756
6757 2010-08-27  Ian Lance Taylor  <iant@google.com>
6758
6759         * incremental.h (class Incremental_input_entry): Add virtual
6760         destructor.
6761
6762 2010-08-27  Ian Lance Taylor  <iant@google.com>
6763
6764         * testsuite/start_lib_test_3.c: Mark t3 as used.
6765
6766 2010-08-27  Nick Clifton  <nickc@redhat.com>
6767
6768         * options.cc (version_script): Fix small typo in previous
6769         whitespace tidyup.
6770
6771 2010-08-25  Nick Clifton  <nickc@redhat.com>
6772
6773         * archive.cc: Formatting fixes: Remove whitespace between
6774         typename and following asterisk.  Remove whitespace between
6775         function name and opening parenthesis.
6776         * archive.h: Likewise.
6777         * arm.cc: Likewise.
6778         * attributes.cc: Likewise.
6779         * attributes.h: Likewise.
6780         * common.cc: Likewise.
6781         * copy-relocs.cc: Likewise.
6782         * dirsearch.h: Likewise.
6783         * dynobj.cc: Likewise.
6784         * ehframe.cc: Likewise.
6785         * ehframe.h: Likewise.
6786         * expression.cc: Likewise.
6787         * fileread.cc: Likewise.
6788         * fileread.h: Likewise.
6789         * gc.h: Likewise.
6790         * gold-threads.cc: Likewise.
6791         * gold.cc: Likewise.
6792         * i386.cc: Likewise.
6793         * icf.h: Likewise.
6794         * incremental-dump.cc: Likewise.
6795         * incremental.cc: Likewise.
6796         * layout.cc: Likewise.
6797         * layout.h: Likewise.
6798         * main.cc: Likewise.
6799         * merge.cc: Likewise.
6800         * merge.h: Likewise.
6801         * object.cc: Likewise.
6802         * object.h: Likewise.
6803         * options.cc: Likewise.
6804         * options.h: Likewise.
6805         * output.cc: Likewise.
6806         * output.h: Likewise.
6807         * plugin.cc: Likewise.
6808         * plugin.h: Likewise.
6809         * powerpc.cc: Likewise.
6810         * reloc.cc: Likewise.
6811         * script-c.h: Likewise.
6812         * script-sections.cc: Likewise.
6813         * script.cc: Likewise.
6814         * stringpool.cc: Likewise.
6815         * symtab.cc: Likewise.
6816         * symtab.h: Likewise.
6817         * target.cc: Likewise.
6818         * timer.cc: Likewise.
6819         * timer.h: Likewise.
6820         * version.cc: Likewise.
6821         * x86_64.cc: Likewise.
6822
6823 2010-08-24  Nick Clifton  <nickc@redhat.com>
6824
6825         PR 11899
6826         * layout.cc (segment_precedes): Sort segments by their physical
6827         addresses, if they have been set.
6828
6829 2010-08-23  Cary Coutant  <ccoutant@google.com>
6830
6831         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
6832         symbols data.
6833         (Lib_group::include_member): Unlock object after deleting its
6834         symbols data.
6835         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
6836         the bug fixed here.
6837
6838 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
6839             Cary Coutant  <ccoutant@google.com>
6840
6841         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
6842         constructor, and set_blocker.
6843         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
6844         readsyms_blocker_.
6845         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
6846         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
6847         * testsuite/Makefile.am (start_lib_test): New test case.
6848         * testsuite/Makefile.in: Regenerate.
6849         * testsuite/start_lib_test_main.c: New file.
6850         * testsuite/start_lib_test_1.c: New file.
6851         * testsuite/start_lib_test_2.c: New file.
6852         * testsuite/start_lib_test_3.c: New file.
6853
6854 2010-08-19  Ian Lance Taylor  <iant@google.com>
6855
6856         * Makefile.in: Rebuild with automake 1.11.1.
6857         * aclocal.m4: Likewise.
6858         * testsuite/Makefile.in: Likewise.
6859
6860 2010-08-19  Ian Lance Taylor  <iant@google.com>
6861
6862         PR 10893
6863         * i386.cc (class Output_data_plt_i386): Update declarations.
6864         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
6865         local_ifuncs_ fields.
6866         (Target_i386::do_plt_section_for_global): New function.
6867         (Target_i386::do_plt_section_for_local): New function.
6868         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
6869         parameter; change all callers.  Initialize global_ifuncs_ and
6870         local_ifuncs_.  If doing a static link define __rel_iplt_start and
6871         __rel_iplt_end.
6872         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
6873         (Output_data_plt_i386::add_local_ifunc_entry): New function.
6874         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
6875         symbols.
6876         (Target_i386::make_plt_section): New function, broken out of
6877         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
6878         (Target_i386::make_plt_entry): Call make_plt_section.
6879         (Target_i386::make_local_ifunc_plt_entry): New function.
6880         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
6881         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
6882         R_386_IRELATIVE to switch.
6883         (Target_i386::Scan::global): Likewise.
6884         (Target_i386::Relocate::relocate): Likewise.
6885         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
6886         switch.
6887         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
6888         (Target_x86_64::do_plt_section_for_global): New function.
6889         (Target_x86_64::do_plt_section_for_local): New function.
6890         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
6891         parameter; change all callers.  If doing a static link define
6892         __rela_iplt_start and __rela_iplt_end.
6893         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
6894         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
6895         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
6896         to point to .plt.
6897         (Target_x86_64::make_local_ifunc_plt_entry): New function.
6898         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
6899         switch.
6900         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
6901         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
6902         R_X86_64_IRELATIVE to switch.
6903         (Target_x86_64::Scan::global): Likewise.
6904         (Target_x86_64::Relocate::relocate): Likewise.
6905         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
6906         switch.
6907         * target.h (class Target): Add plt_section_for_global and
6908         plt_section_for_local functions.  Add do_plt_section_for_global
6909         and do_plt_section_for_local virtual functions.
6910         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
6911         clarifying comments.
6912         (Symbol::use_plt_offset): Handle IFUNC symbol.
6913         * object.cc (Sized_relobj::Sized_relobj): Initialize
6914         local_plt_offsets_.
6915         (Sized_relobj::local_has_plt_offset): New function.
6916         (Sized_relobj::local_plt_offset): New function.
6917         (Sized_relobj::set_local_plt_offset): New function.
6918         (Sized_relobj::do_count): Handle IFUNC symbol.
6919         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
6920         a bit away from input_shndx_ field.  Add set_is_func_symbol and
6921         is_ifunc_symbol functions.
6922         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
6923         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
6924         local_plt_offsets_ field.
6925         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
6926         * output.h (class Output_section_data): Add non-const
6927         output_section function.
6928         (class Output_data_got): Update declarations.
6929         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
6930         Add use_plt_offset parameter to global and local constructors.
6931         Change all callers.  Change local_sym_index_ field to 31 bits.
6932         Change GSYM_CODE and CONSTANT_CODE accordingly.
6933         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
6934         doing a static link don't set sh_link field.
6935         (Output_data_got::Got_entry::write): Use PLT offset if
6936         appropriate.
6937         (Output_data_got::add_global_plt): New function.
6938         (Output_data_got::add_local_plt): New function.
6939         * target-reloc.h (relocate_section): Handle IFUNC symbol.
6940         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
6941         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
6942         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
6943         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
6944         IFUNC conditional.
6945         * testsuite/ifunc-sel.h: New file.
6946         * testsuite/ifuncmain1.c: New file.
6947         * testsuite/ifuncmain1vis.c: New file.
6948         * testsuite/ifuncmod1.c: New file.
6949         * testsuite/ifuncdep2.c: New file.
6950         * testsuite/ifuncmain2.c: New file.
6951         * testsuite/ifuncmain3.c: New file.
6952         * testsuite/ifuncmod3.c: New file.
6953         * testsuite/ifuncmain4.c: New file.
6954         * testsuite/ifuncmain5.c: New file.
6955         * testsuite/ifuncmod5.c: New file.
6956         * testsuite/ifuncmain6pie.c: New file.
6957         * testsuite/ifuncmod6.c: New file.
6958         * testsuite/ifuncmain7.c: New file.
6959         * configure, testsuite/Makefile.in: Rebuild.
6960
6961 2010-08-18  Ian Lance Taylor  <iant@google.com>
6962
6963         * incremental.cc
6964         (Output_section_incremental_inputs::write_input_files): Add cast
6965         to avoid signed/unsigned comparison warning.
6966         (Output_section_incremental_inputs::write_info_blocks): Likewise.
6967
6968 2010-08-12  Cary Coutant  <ccoutant@google.com>
6969
6970         * common.cc (Sort_commons::operator()): Remove unnecessary code.
6971
6972 2010-08-13  Ian Lance Taylor  <iant@google.com>
6973
6974         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
6975
6976 2010-08-12  Cary Coutant  <ccoutant@google.com>
6977             Doug Kwan  <dougkwan@google.com>
6978
6979         * resolve.cc (Symbol_table::should_override): When a weak dynamic
6980         defintion overrides non-weak undef, remember that the original undef
6981         is not weak.
6982         * symtab.cc (Symbol_table::sized_write_global): For undef without
6983         an original weak binding, set binding to global in output.
6984         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
6985         * testsuite/Makefile.in: Regenerate.
6986         * testsuite/strong_ref_weak_def.sh: New file.
6987         * testsuite/strong_ref_weak_def_1.c: Ditto.
6988         * testsuite/strong_ref_weak_def_2.c: Ditto.
6989
6990 2010-08-12  Cary Coutant  <ccoutant@google.com>
6991
6992         * testsuite/incremental_test.sh: Rewrite.
6993         * testsuite/incremental_test_1.c: Rewrite.
6994         * testsuite/incremental_test_2.c: Rewrite.
6995
6996 2010-08-12  Cary Coutant  <ccoutant@google.com>
6997
6998         * arm.cc (Target_arm::got_size): Add const.
6999         (Target_arm::got_entry_count): New function.
7000         (Target_arm::plt_entry_count): New function.
7001         (Target_arm::first_plt_entry_offset): New function.
7002         (Target_arm::plt_entry_size): New function.
7003         (Output_data_plt_arm::entry_count): New function.
7004         (Output_data_plt_arm::first_plt_entry_offset): New function.
7005         (Output_data_plt_arm::get_plt_entry_size): New function.
7006         * i386.cc (Target_i386::got_size): Add const.
7007         (Target_i386::got_entry_count): New function.
7008         (Target_i386::plt_entry_count): New function.
7009         (Target_i386::first_plt_entry_offset): New function.
7010         (Target_i386::plt_entry_size): New function.
7011         (Output_data_plt_i386::entry_count): New function.
7012         (Output_data_plt_i386::first_plt_entry_offset): New function.
7013         (Output_data_plt_i386::get_plt_entry_size): New function.
7014         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
7015         find_incremental_inputs_sections.  Dump incremental_got_plt section.
7016         * incremental.cc: Include target.h.
7017         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
7018         parameter.  Adjust all callers.  Find incremental_got_plt section.
7019         (Incremental_inputs::create_data_sections): Create incremental_got_plt
7020         section.
7021         (Output_section_incremental_inputs::set_final_data_size): Calculate
7022         size of incremental_got_plt section.
7023         (Output_section_incremental_inputs::do_write): Write the
7024         incremental_got_plt section.
7025         (Got_plt_view_info): New struct.
7026         (Local_got_offset_visitor): New class.
7027         (Global_got_offset_visitor): New class.
7028         (Global_symbol_visitor_got_plt): New class.
7029         (Output_section_incremental_inputs::write_got_plt): New function.
7030         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
7031         Add parameter.  Adjust all callers.
7032         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
7033         (Incremental_inputs::got_plt_section): New function.
7034         (Incremental_inputs::got_plt_section_): New data member.
7035         (Incremental_got_plt_reader): New class.
7036         * layout.cc (Layout::create_incremental_info_sections): Add the
7037         incremental_got_plt section.
7038         * object.h (Got_offset_list::get_list): New function.
7039         (Got offset_list::for_all_got_offsets): New function.
7040         (Sized_relobj::local_got_offset_list): New function.
7041         * powerpc.cc (Target_powerpc::got_size): Add const.
7042         (Target_powerpc::got_entry_count): New function.
7043         (Target_powerpc::plt_entry_count): New function.
7044         (Target_powerpc::first_plt_entry_offset): New function.
7045         (Target_powerpc::plt_entry_size): New function.
7046         (Output_data_plt_powerpc::entry_count): New function.
7047         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
7048         (Output_data_plt_powerpc::get_plt_entry_size): New function.
7049         * sparc.cc (Target_sparc::got_size): Add const.
7050         (Target_sparc::got_entry_count): New function.
7051         (Target_sparc::plt_entry_count): New function.
7052         (Target_sparc::first_plt_entry_offset): New function.
7053         (Target_sparc::plt_entry_size): New function.
7054         (Output_data_plt_sparc::entry_count): New function.
7055         (Output_data_plt_sparc::first_plt_entry_offset): New function.
7056         (Output_data_plt_sparc::get_plt_entry_size): New function.
7057         * symtab.h (Symbol::got_offset_list): New function.
7058         (Symbol_table::for_all_symbols): New function.
7059         * target.h (Sized_target::got_entry_count): New function.
7060         (Sized_target::plt_entry_count): New function.
7061         (Sized_target::plt_entry_size): New function.
7062         * x86_64.cc (Target_x86_64::got_size): Add const.
7063         (Target_x86_64::got_entry_count): New function.
7064         (Target_x86_64::plt_entry_count): New function.
7065         (Target_x86_64::first_plt_entry_offset): New function.
7066         (Target_x86_64::plt_entry_size): New function.
7067         (Output_data_plt_x86_64::entry_count): New function.
7068         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
7069         (Output_data_plt_x86_64::get_plt_entry_size): New function.
7070
7071 2010-08-12  Cary Coutant  <ccoutant@google.com>
7072
7073         * archive.cc: Include incremental.h.
7074         (Archive::Archive): Initialize incremental_info_.
7075         (Archive::include_member): Record archive members in incremental info.
7076         (Add_archive_symbols::run): Record begin and end of an archive in
7077         incremental info.
7078         (Lib_group::include_member): Record objects in incremental info.
7079         * archive.h (Incremental_archive_entry): Forward declaration.
7080         (Archive::set_incremental_info): New member function.
7081         (Archive::incremental_info): New member function.
7082         (Archive::Unused_symbol_iterator): New class.
7083         (Archive::unused_symbols_begin): New member function.
7084         (Archive::unused_symbols_end): New member function.
7085         (Archive::incremental_info_): New data member.
7086         * incremental-dump.cc (find_input_containing_global): New function.
7087         (dump_incremental_inputs): Dump new incremental info sections.
7088         * incremental.cc: Include symtab.h.
7089         (Output_section_incremental_inputs): New class.
7090         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
7091         new incremental info sections.
7092         (Sized_incremental_binary::do_check_inputs): Likewise.
7093         (Incremental_inputs::report_archive): Remove.
7094         (Incremental_inputs::report_archive_begin): New function.
7095         (Incremental_inputs::report_archive_end): New function.
7096         (Incremental_inputs::report_object): New function.
7097         (Incremental_inputs::finalize_inputs): Remove.
7098         (Incremental_inputs::report_input_section): New function.
7099         (Incremental_inputs::report_script): Rewrite.
7100         (Incremental_inputs::finalize): Do nothing but finalize string table.
7101         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
7102         (Incremental_inputs::sized_create_inputs_section_data): Remove.
7103         (Incremental_inputs::create_data_sections): New function.
7104         (Incremental_inputs::relocs_entsize): New function.
7105         (Output_section_incremental_inputs::set_final_data_size): New function.
7106         (Output_section_incremental_inputs::do_write): New function.
7107         (Output_section_incremental_inputs::write_header): New function.
7108         (Output_section_incremental_inputs::write_input_files): New function.
7109         (Output_section_incremental_inputs::write_info_blocks): New function.
7110         (Output_section_incremental_inputs::write_symtab): New function.
7111         * incremental.h (Incremental_script_entry): Forward declaration.
7112         (Incremental_object_entry): Forward declaration.
7113         (Incremental_archive_entry): Forward declaration.
7114         (Incremental_inputs): Forward declaration.
7115         (Incremental_inputs_header_data): Remove.
7116         (Incremental_inputs_header): Remove.
7117         (Incremental_inputs_header_write): Remove.
7118         (Incremental_inputs_entry_data): Remove.
7119         (Incremental_inputs_entry): Remove.
7120         (Incremental_inputs_entry_write): Remove.
7121         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
7122         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
7123         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
7124         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
7125         Likewise.
7126         (Incremental_input_entry): New class.
7127         (Incremental_script_entry): New class.
7128         (Incremental_object_entry): New class.
7129         (Incremental_archive_entry): New class.
7130         (Incremental_inputs::Incremental_inputs): Initialize new data members.
7131         (Incremental_inputs::report_inputs): Remove.
7132         (Incremental_inputs::report_archive): Remove.
7133         (Incremental_inputs::report_archive_begin): New function.
7134         (Incremental_inputs::report_archive_end): New function.
7135         (Incremental_inputs::report_object): Change prototype.
7136         (Incremental_inputs::report_input_section): New function.
7137         (Incremental_inputs::report_script): Change prototype.
7138         (Incremental_inputs::get_reloc_count): New function.
7139         (Incremental_inputs::set_reloc_count): New function.
7140         (Incremental_inputs::create_data_sections): New function.
7141         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
7142         (Incremental_inputs::inputs_section): New function.
7143         (Incremental_inputs::symtab_section): New function.
7144         (Incremental_inputs::relocs_section): New function.
7145         (Incremental_inputs::get_stringpool): Add const.
7146         (Incremental_inputs::command_line): Add const.
7147         (Incremental_inputs::inputs): Remove.
7148         (Incremental_inputs::command_line_key): New function.
7149         (Incremental_inputs::input_file_count): New function.
7150         (Incremental_inputs::input_files): New function.
7151         (Incremental_inputs::relocs_entsize): New function.
7152         (Incremental_inputs::sized_create_inputs_section_data): Remove.
7153         (Incremental_inputs::finalize_inputs): Remove.
7154         (Incremental_inputs::Input_info): Remove.
7155         (Incremental_inputs::lock_): Remove.
7156         (Incremental_inputs::inputs_): Change type.
7157         (Incremental_inputs::inputs_map_): Remove.
7158         (Incremental_inputs::current_object_entry_): New data member.
7159         (Incremental_inputs::inputs_section_): New data member.
7160         (Incremental_inputs::symtab_section_): New data member.
7161         (Incremental_inputs::relocs_section_): New data member.
7162         (Incremental_inputs::reloc_count_): New data member.
7163         (Incremental_inputs_reader): New class.
7164         (Incremental_symtab_reader): New class.
7165         (Incremental_relocs_reader): New class.
7166         * layout.cc (Layout::finalize): Move finalization of incremental info
7167         and creation of incremental info sections to follow finalization of
7168         symbol table.  Set offsets for postprocessing sections.
7169         (Layout::create_incremental_info_sections): Call
7170         Incremental_inputs::create_data_sections.  Add incremental symtab
7171         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
7172         sections to layout after input sections.
7173         * layout.h (struct Timespec): Forward declaration.
7174         (Layout::incremental_inputs): Add const.
7175         (Layout::create_incremental_info_sections): Add parameter.
7176         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
7177         * object.cc: Include incremental.h.
7178         (Relobj::finalize_incremental_relocs): New function.
7179         (Sized_relobj::do_layout): Record input sections in incremental info.
7180         * object.h (Object::output_section): New function.
7181         (Object::output_section_offset): Moved from Relobj.
7182         (Object::get_incremental_reloc_base): New function.
7183         (Object::get_incremental_reloc_count): New function.
7184         (Object::do_output_section): New function.
7185         (Object::do_output_section_offset): Moved from Relobj.
7186         (Object::do_get_incremental_reloc_base): New function.
7187         (Object::do_get_incremental_reloc_count): New function.
7188         (Object::Object): Initialize new data members.
7189         (Relobj::output_section): Renamed do_output_section and moved to
7190         protected.
7191         (Relobj::output_section_offset): Moved to Object.
7192         (Relobj::do_get_incremental_reloc_base): New function.
7193         (Relobj::do_get_incremental_reloc_count): New function.
7194         (Relobj::allocate_incremental_reloc_counts): New function.
7195         (Relobj::count_incremental_reloc): New function.
7196         (Relobj::finalize_incremental_relocs): New function.
7197         (Relobj::next_incremental_reloc_index): New function.
7198         (Relobj::reloc_counts_): New data member.
7199         (Relobj::reloc_bases_): New data member.
7200         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
7201         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
7202         (Sized_relobj::incremental_relocs_scan): New function.
7203         (Sized_relobj::incremental_relocs_scan_reltype): New function.
7204         (Sized_relobj::incremental_relocs_write): New function.
7205         (Sized_relobj::incremental_relocs_write_reltype): New function.
7206         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
7207         incremental link.
7208         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
7209         archives and object files elsewhere.
7210         (Add_symbols::run): Report object files here.
7211         (Finish_group::run): Report end of archive at end of group.
7212         * reloc.cc: Include layout.h, incremental.h.
7213         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
7214         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
7215         (Sized_relobj::incremental_relocs_scan): New function.
7216         (Sized_relobj::incremental_relocs_scan_reltype): New function.
7217         (Sized_relobj::do_relocate_sections): Write incremental relocations.
7218         (Sized_relobj::incremental_relocs_write): New function.
7219         (Sized_relobj::incremental_relocs_write_reltype): New function.
7220         * script.cc (read_input_script): Rewrite test for incremental link.
7221         Change call to Incremental_inputs::report_script.
7222         * symtab.h (Symbol_table::first_global_index): New function.
7223         (Symbol_table::output_count): New function.
7224
7225 2010-08-12  Doug Kwan  <dougkwan@google.com>
7226
7227         * arm.cc (Target_arm::merge_object_attributes): Check command line
7228         options --no-wchar-size-warning and --no-enum-size-warning.
7229         * options.h (General_options): Add ld-compatible options
7230         --no-enum-size-warning and --no-wchar-size-warning.
7231
7232 2010-08-04  Ian Lance Taylor  <iant@google.com>
7233
7234         * x86_64.cc (Target_x86_64::Scan::local): Use
7235         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
7236         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
7237         (Target_x86_64::Scan::global): Likewise.
7238         (Target_x86_64::Relocate::relocate): Likewise.
7239         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
7240         Likewise.
7241
7242 2010-08-03  Cary Coutant  <ccoutant@google.com>
7243
7244         * merge.cc (Output_merge_string::do_add_input_section): Count strings
7245         to reserve space in merged_strings vector. Keep total input size
7246         for stats.
7247         (Output_merge_string::do_print_merge_stats): Print total input size.
7248         * merge.h (Output_merge_string): Add input_size_ field.
7249         * stringpool.cc (Stringpool_template::string_length): Move
7250         implementations out of Stringpool_template class and place in
7251         stringpool.h.
7252         * stringpool.h (string_length): Move out of Stringpool_template.
7253
7254 2010-08-03  Ian Lance Taylor  <iant@google.com>
7255
7256         PR 11712
7257         * layout.cc (relaxation_loop_body): If address of load segment is
7258         set, adjust address to include headers if possible.
7259
7260 2010-08-03  Ian Lance Taylor  <iant@google.com>
7261
7262         * version.cc (version_string): Bump to 1.10.
7263
7264 2010-08-03  Ian Lance Taylor  <iant@google.com>
7265
7266         PR 11805
7267         * layout.h (enum Output_section_order): Define.
7268         (class Layout): Update declarations.
7269         * layout.cc (Layout::get_output_section): Add order parameter.
7270         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
7271         is_first_non_relro parameters.  Change all callers.
7272         (Layout::choose_output_section): Likewise.
7273         (Layout::add_output_section_data): Likewise.
7274         (Layout::make_output_section): Likewise.  Set order.
7275         (Layout::default_section_order): New function.
7276         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
7277         * output.cc (Output_section::Output_section): Initialize order_.
7278         Don't initialize deleted fields.
7279         (Output_segment::Output_segment): Don't initialize deleted
7280         fields.
7281         (Output_segment::add_output_section_to_load): New function
7282         replacing add_output_section.  Change all callers to call this or
7283         add_output_section_to_nonload.
7284         (Output_segment::add_output_section_to_nonload): New function.
7285         (Output_segment::remove_output_section): Rewrite.
7286         (Output_segment::add_initial_output_data): Likewise.
7287         (Output_segment::has_any_data_sections): Likewise.
7288         (Output_segment::is_first_section_relro): Likewise.
7289         (Output_segment::maximum_alignment): Likewise.
7290         (Output_segment::has_dynamic_reloc): New function replacing
7291         dynamic_reloc_count.  Change all callers.
7292         (Output_segment::has_dynamic_reloc_list): New function replacing
7293         dynamic_reloc_count_list.  Change all callers.
7294         (Output_segment::set_section_addresses): Rewrite.
7295         (Output_segment::set_offset): Rewrite.
7296         (Output_segment::find_first_and_last_list): Remove.
7297         (Output_segment::set_tls_offsets): Rewrite.
7298         (Output_segment::first_section_load_address): Likewise.
7299         (Output_segment::output_section_count): Likewise.
7300         (Output_segment::section_with_lowest_load_address): Likewise.
7301         (Output_segment::write_section_headers): Likewise.
7302         (Output_segment::print_sections_to_map): Likewise.
7303         * output.h (class Output_data): Remove dynamic_reloc_count_
7304         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
7305         (Output_data::add_dynamic_reloc): Rewrite.
7306         (Output_data::has_dynamic_reloc): New function.
7307         (Output_data::dynamic_reloc_count): Remove.
7308         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
7309         is_last_relro_, is_first_non_relro_, is_interp_,
7310         is_dynamic_linker_section_ fields.  Add order and set_order
7311         functions.  Remove is_relro_local, set_is_relro_local,
7312         is_last_relro, set_is_last_relro, is_first_non_relro,
7313         set_is_first_non_relro functions, is_interp, set_is_interp,
7314         is_dynamic_linker_section, and set_is_dynamic_linker_section
7315         functions.
7316         (class Output_segment): Change Output_data_list from std::list to
7317         std:;vector.  Add output_lists_ field.  Remove output_data_ and
7318         output_bss_ fields.  Update declarations.
7319
7320 2010-08-02  Ian Lance Taylor  <iant@google.com>
7321
7322         * arm.cc (Target_arm::gc_process_relocs): Use typename.
7323         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
7324         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
7325
7326 2010-08-02  Ian Lance Taylor  <iant@google.com>
7327
7328         PR 11855
7329         * script.cc (Script_options::Script_options): Initialize
7330         symbol_definitions_ and symbol_references_.
7331         (Script_options::add_symbol_assignment): Update
7332         symbol_definitions_ and symbol_references_.
7333         (Script_options::add_symbol_reference): New function.
7334         (script_symbol): New function.
7335         * script.h (class Script_options): Add symbol_definitions_ and
7336         symbol_references_ fields.
7337         (Script_options::referenced_const_iterator): New type.
7338         (Script_options::referenced_begin): New function.
7339         (Script_options::referenced_end): New function.
7340         (Script_options::is_referenced): New function.
7341         (Script_options::any_unreferenced): New function.
7342         * script-c.h (script_symbol): Declare.
7343         * yyscript.y (exp): Call script_symbol.
7344         * symtab.cc: Include "script.h".
7345         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
7346         Change all callers.  Check symbols referenced by scripts.
7347         (Symbol_table::add_undefined_symbols_from_command_line): Add
7348         layout parameter.  Change all callers.
7349         (Symbol_table::do_add_undefined_symbols_from_command_line):
7350         Likewise.  Break out loop body.  Check symbols referenced by
7351         scripts.
7352         (Symbol_table::add_undefined_symbol_from_command_line): New
7353         function broken out of
7354         do_add_undefined_symbols_from_command_line.
7355         * symtab.h (class Symbol_table): Update declarations.
7356         * archive.cc: Include "layout.h".
7357         (Archive::should_include_member): Add layout parameter.  Change
7358         all callers.  Check for symbol mentioned in expression.
7359         * archive.h (class Archive): Update declaration.
7360         * object.cc (Sized_relobj::do_should_include_member): Add layout
7361         parameter.
7362         * object.h (Object::should_include_member): Add layout parameter.
7363         Change all callers.
7364         (Object::do_should_include_member): Add layout parameter.
7365         (class Sized_relobj): Update declaration.
7366         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
7367         parameter.
7368         * dynobj.h (class Sized_dynobj): Update declaration.
7369         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
7370         layout parameter.
7371         * plugin.h (class Sized_pluginobj): Update declaration.
7372
7373 2010-08-02  Ian Lance Taylor  <iant@google.com>
7374
7375         PR 11866
7376         * output.cc (Output_segment::set_offset): Search for the first and
7377         last sections rather than assuming that the list is in order.
7378         (Output_segment::find_first_and_last_list): New function.
7379         * output.h (class Output_segment): Update declarations.
7380         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
7381         (relro_strip_test_SOURCES): New variable.
7382         (relro_strip_test_DEPENDENCIES): New variable.
7383         (relro_strip_test_LDFLAGS): New variable.
7384         (relro_strip_test_LDADD): New variable.
7385         (relro_strip_test.so): New target.
7386
7387 2010-08-02  Ian Lance Taylor  <iant@google.com>
7388
7389         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
7390         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
7391         (Target_i386::got_tlsdesc_section): New function.
7392         (Target_i386::got_section): Create space for GOT entries for
7393         TLSDESC relocations.
7394         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
7395         R_386_TLS_GOTDESC.
7396         (Target_i386::Scan::global): Likewise.
7397         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
7398         using TLSDESC GOT.
7399         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
7400         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
7401         (Target_x86_64::got_tlsdesc_section): New function.
7402         (Target_x86_64::got_section): Create space for GOT entries for
7403         TLSDESC relocations.
7404         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
7405         R_386_TLS_GOTDESC.
7406         (Target_x86_64::Scan::global): Likewise.
7407         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
7408         using TLSDESC GOT.
7409
7410 2010-08-02  Ian Lance Taylor  <iant@google.com>
7411
7412         * testsuite/final_layout.sh: Use dc to convert from hex to
7413         decimal.
7414
7415 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
7416
7417         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
7418         paramter to the call to gold::gc_process_relocs.
7419         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
7420         paramter to the call to gold::gc_process_relocs.
7421         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
7422         parameter to the call to gold::gc_process_relocs.
7423         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
7424         template parameter to the call to gold::gc_process_relocs.
7425         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
7426         paramter to the call to gold::gc_process_relocs.
7427         * gc.h (get_embedded_addend_size): New function.
7428         (gc_process_relocs): Save the size of the reloc for use by ICF.
7429         * icf.cc (get_section_contents): Get the addend from the text section
7430         for SHT_REL relocation sections.
7431         * icf.h (Icf::Reloc_addend_size_info): New typedef.
7432         (Icf::Reloc_info): Add new member reloc_addend_size_info.
7433         * int_encoding.h (read_from_pointer): New overloaded function.
7434         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
7435         * testsuite/icf_sht_rel_addend_test.sh: New file.
7436         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
7437         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
7438
7439 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7440
7441         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
7442         * Makefile.in: Regenerate.
7443         * testsuite/Makefile.in: Regenerate.
7444
7445 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
7446
7447         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
7448         * gold/testsuite/debug_msg.cc: Likewise.
7449         * gold/testsuite/odr_violation1.cc
7450         * gold/testsuite/odr_violation2.cc
7451
7452 2010-07-21  Cary Coutant  <ccoutant@google.com>
7453
7454         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
7455         string, and length fields.
7456         (Output_merge_string::Merged_strings_list): New type.
7457         (Output_merge_string::Merged_strings_lists): New typedef.
7458         (Output_merge_string): Replace merged_strings_ with
7459         merged_strings_lists_.
7460         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
7461         Merged_strings_list per input object and section.  Don't store pointer
7462         to the string.  Don't store length with each merged string entry.
7463         (Output_merge_string::finalize_merged_data): Loop over list of merged
7464         strings lists.  Recompute length of each merged string.
7465
7466 2010-07-15  Cary Coutant  <ccoutant@google.com>
7467
7468         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
7469         here.
7470
7471 2010-07-14  Ian Lance Taylor  <iant@google.com>
7472
7473         * descriptors.cc (Descriptors::open): Report correct name in error
7474         message.
7475
7476 2010-07-13  Doug Kwan  <dougkwan@google.com>
7477
7478         * arm.cc (Arm_input_section::Arm_input_section): For a
7479         SHT_ARM_EXIDX section, always keeps the input sections.
7480         (Arm_input_section::set_exidx_section_link): New method.
7481         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
7482         has_errors_ to false.
7483         (Arm_exidx_input_section::has_errors,
7484         Arm_exidx_input_section::set_has_errors): New methods.
7485         (Arm_exidx_input_section::has_errors_): New data member.
7486         (Arm_relobj::get_exidx_shndx_list): New method.
7487         (Arm_output_section::append_text_sections_to_list): Do not skip
7488         section without SHF_EXECINSTR.
7489         (Arm_output_section::fix_exidx_coverage): Skip input sections with
7490         errors.
7491         (Arm_relobj::make_exidx_input_section): Add new parameter for text
7492         section header.  Make error messages more verbose.  Check for
7493         a non-executable section linked to an EXIDX section.
7494         (Arm_relobj::do_read_symbols): Remove error checking, which has been
7495         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
7496         check that there is no deferred EXIDX section if we exit early.
7497         Instead of not making an EXIDX section in case of an error, make one
7498         and set the has_errors flag of it.
7499         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
7500         in a relocatable link.
7501         (Target_arm::do_relax): Look for the EXIDX output section instead of
7502         assuming that it is called .ARM.exidx.
7503         (Target_arm::fix_exidx_coverage): Add a new parameter for input
7504         section list.  Do not check for SHF_EXECINSTR section flags but
7505         skip any input section with errors.
7506         * output.cc (Output_section::Output_section): Initialize
7507         always_keeps_input_sections_ to false.
7508         (Output_section::add_input_section): Check for
7509         always_keeps_input_sections_.
7510         *  output.h (Output_section::always_keeps_input_sections,
7511         Output_section::set_always_keeps_input_sections): New methods.
7512         (Output_section::always_keeps_input_sections): New data member.
7513
7514 2010-07-13  Rafael Espindola  <espindola@google.com>
7515
7516         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
7517         * fileread.h (Input_file): Add try_extra_search_path and find_file.
7518
7519 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
7520             Ian Lance Taylor  <iant@google.com>
7521
7522         * output.h (Output_section_lookup_maps::add_merge_section):
7523         Correct check of whether value was inserted.
7524         (Output_section_lookup_maps::add_merge_input_section): Likewise.
7525         (Output_section_lookup_maps::add_relaxed_input_section):
7526         Likewise.
7527         * arm.cc (Target_arm::got_section): Remove used local os.
7528         * i386.cc (Target_i386::got_section): Likewise.
7529         * x86_64.cc (Target_x86_64::got_section): Likewise.
7530         * sparc.cc (Target_sparc::got_section): Likewise.
7531         (Target_sparc::relocate): Remove unused local have_got_offset.
7532         * powerpc.cc (Target_powerpc::relocate): Likewise.
7533
7534 2010-07-13  Ian Lance Taylor  <iant@google.com>
7535
7536         * compressed_output.cc (zlib_decompress): Fix signature in
7537         !HAVE_ZLIB_H case.
7538
7539         * archive.cc (Archive::include_member): Unlock an external member
7540         of a thin archive.  Don't bother to delete an object we know is
7541         NULL.
7542
7543 2010-07-12  Cary Coutant  <ccoutant@google.com>
7544
7545         * compressed_output.cc (zlib_decompress): New function.
7546         (get_uncompressed_size): New function.
7547         (decompress_input_section): New function.
7548         * compressed_output.h (get_uncompressed_size): New function.
7549         (decompress_input_section): New function.
7550         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
7551         Handle compressed debug sections.
7552         * layout.cc (is_compressed_debug_section): New function.
7553         (Layout::output_section_name): Map compressed section names to
7554         canonical names.
7555         * layout.h (is_compressed_debug_section): New function.
7556         (is_debug_info_section): Recognize compressed debug sections.
7557         * merge.cc: Include compressed_output.h.
7558         (Output_merge_data::do_add_input_section): Handle compressed
7559         debug sections.
7560         (Output_merge_string::do_add_input_section): Handle compressed
7561         debug sections.
7562         * object.cc: Include compressed_output.h.
7563         (Sized_relobj::Sized_relobj): Initialize new data members.
7564         (build_compressed_section_map): New function.
7565         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
7566         * object.h (Object::section_is_compressed): New method.
7567         (Object::do_section_is_compressed): New method.
7568         (Sized_relobj::Compressed_section_map): New type.
7569         (Sized_relobj::do_section_is_compressed): New method.
7570         (Sized_relobj::compressed_sections_): New data member.
7571         * output.cc (Output_section::add_input_section): Handle compressed
7572         debug sections.
7573         * reloc.cc: Include compressed_output.h.
7574         (Sized_relobj::write_sections): Handle compressed debug sections.
7575
7576 2010-07-08  Cary Coutant  <ccoutant@google.com>
7577
7578         * resolve.cc (Symbol_table::resolve): Remember whether undef was
7579         weak when resolving to a dynamic def.
7580         (Symbol_table::should_override): Add adjust_dyndef flag; set it
7581         for weak undef/dynamic def cases. Adjust callers.
7582         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
7583         undef_binding_weak_.
7584         (Symbol_table::sized_write_globals): Adjust symbol binding.
7585         (Symbol_table::sized_write_symbol): Add binding parameter.
7586         * symtab.h (Symbol::set_undef_binding): New method.
7587         (Symbol::is_undef_binding_weak): New method.
7588         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
7589         (Symbol_table::should_override): Add new parameter.
7590         (Symbol_table::sized_write_symbol): Add new parameter.
7591
7592         * testsuite/weak_undef_file1.cc: Add new test case.
7593         * testsuite/weak_undef_file2.cc: Fix header comment.
7594         * testsuite/weak_undef_test.cc: Add new test case.
7595
7596 2010-06-29  Doug Kwan  <dougkwan@google.com>
7597
7598         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
7599         Initialize USE_SYMBOL_.
7600         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
7601         definition.
7602         (Arm_reloc_property::uses_symbol_): New data member declaration.
7603         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
7604         uses symbol value and symbol is undefined but not weakly undefined.
7605
7606 2010-06-28  Rafael Espindola  <espindola@google.com>
7607
7608         * plugin.cc (Plugin::load): Use dlerror.
7609
7610 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
7611
7612         * symtab.cc (detect_odr_violations): When reporting an ODR
7613         violation, report an object where the symbol is defined.
7614
7615 2010-06-25  Doug Kwan  <dougkwan@google.com>
7616
7617         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
7618         (Target_arm::section_may_have_icf_unsafe_pointers): New method
7619         definition.
7620         (Target_arm::Scan::local_reloc_may_be_function_pointer,
7621         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
7622         target hook to detect function points.
7623         (Target_arm::Scan::possible_function_pointer_reloc): New method.
7624         * icf.h (Icf::check_section_for_function_pointers): Change type of
7625         parameter SECTION_NAME to const reference to std::string.  Use
7626         target hook to determine if section may have unsafe pointers.
7627         * target.h (Target::section_may_have_icf_unsafe_pointers): New
7628         method definition.
7629
7630 2010-06-21  Rafael Espindola  <espindola@google.com>
7631
7632         * fileread.cc (Input_file::find_fie): New
7633         (Input_file::open): Use Input_file::find_fie.
7634         * fileread.h (Input_file::find_fie): New
7635         * plugin.cc (set_extra_library_path): New.
7636         (Plugin::load): Add set_extra_library_path to the transfer vector.
7637         (Plugin_manager::set_extra_library_path): New.
7638         (Plugin_manager::add_input_file): Use the extra search path if set.
7639         (set_extra_library_path(): New.
7640         * plugin.h (Plugin_manager): Add set_extra_library_path and
7641         extra_search_path_.
7642
7643 2010-06-19  Cary Coutant  <ccoutant@google.com>
7644
7645         * layout.cc (gdb_sections): Add .debug_types.
7646         (lines_only_debug_sections): Likewise.
7647
7648 2010-06-18  Rafael Espindola  <espindola@google.com>
7649
7650         * plugin.cc (add_input_file,add_input_library)
7651         (Plugin_manager::add_input_file): Make filename arguments const.
7652         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
7653         const.
7654
7655 2010-06-16  Doug Kwan  <dougkwan@google.com>
7656
7657         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
7658         .ARM.attributes section if we have not merged any input
7659         attributes sections.
7660
7661 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7662
7663         * arm.cc: Allow combining objects with no EABI version
7664         information.
7665
7666 2010-06-15  Rafael Espindola  <espindola@google.com>
7667
7668         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
7669
7670 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7671
7672         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
7673         (struct iovec): Correct !HAVE_READV definition.
7674
7675 2010-06-10  Cary Coutant  <ccoutant@google.com>
7676
7677         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
7678         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
7679         reloc sections.
7680         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
7681
7682         PR 11683
7683         * symtab.h (Symbol::is_placeholder): New member function.
7684         * target-reloc.h (relocate_section): Check for placeholder symbols.
7685
7686         * testsuite/Makefile.am (plugin_test_8): New test.
7687         (plugin_test_9): New test.
7688         * testsuite/Makefile.in: Regenerate.
7689
7690 2010-06-09  Nick Clifton  <nickc@redhat.com>
7691
7692         * yyscript.y (input_list_element): Allow strings prefixed with
7693         the '-' character.  Treat these as libraries.
7694         * script.cc (script_add_library): New function.  Adds a library
7695         specified by "-l<name>" found in an input script.
7696         * script-c.h: Add prototype for script_add_library.
7697
7698 2010-06-07  Doug Kwan  <dougkwan@google.com>
7699
7700         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
7701         Restrict stub-group size to be within long conditional branch
7702         range when working around cortex-A8 erratum.
7703
7704 2010-06-07  Damien Diederen  <dd@crosstwine.com>
7705
7706         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
7707         #ifdef typo.
7708
7709 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
7710
7711         PR gold/11658
7712         * output.cc
7713         (Output_section::Input_section_sort_entry::compare_section_ordering):
7714         Change to return non-zero correctly.
7715         (Output_section::Input_section_sort_section_order_index_compare
7716         ::operator()): Change to fix ambiguity in comparisons.
7717
7718 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
7719
7720         * gold.h (is_wildcard_string): New function.
7721         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
7722         (Layout::layout_eh_frame): Ditto.
7723         (Layout::find_section_order_index): New method.
7724         (Layout::read_layout_from_file): New method.
7725         * layout.h (Layout::find_section_order_index): New method.
7726         (Layout::read_layout_from_file): New method.
7727         (Layout::input_section_position_): New private member.
7728         (Layout::input_section_glob_): New private member.
7729         * main.cc (main): Call read_layout_from_file here.
7730         * options.h (--section-ordering-file): New option.
7731         * output.cc (Output_section::input_section_order_specified_): New
7732         member.
7733         (Output_section::Output_section): Initialize new member.
7734         (Output_section::add_input_section): Add new parameter.
7735         Keep input sections when --section-ordering-file is used.
7736         (Output_section::set_final_data_size): Sort input sections when
7737         section ordering file is specified.
7738         (Output_section::Input_section_sort_entry): Add new parameter.
7739         Check sorting type.
7740         (Output_section::Input_section_sort_entry::compare_section_ordering):
7741         New method.
7742         (Output_section::Input_section_sort_compare::operator()): Change to
7743         consider section_order_index.
7744         (Output_section::Input_section_sort_init_fini_compare::operator()):
7745         Change to consider section_order_index.
7746         (Output_section::Input_section_sort_section_order_index_compare
7747         ::operator()): New method.
7748         (Output_section::sort_attached_input_sections): Change to sort
7749         according to section order when specified.
7750         (Output_section::add_input_section<32, true>): Add new parameter.
7751         (Output_section::add_input_section<64, true>): Add new parameter.
7752         (Output_section::add_input_section<32, false>): Add new parameter.
7753         (Output_section::add_input_section<64, false>): Add new parameter.
7754         * output.h (Output_section::add_input_section): Add new parameter.
7755         (Output_section::input_section_order_specified): New
7756         method.
7757         (Output_section::set_input_section_order_specified): New method.
7758         (Input_section::Input_section): Initialize section_order_index_.
7759         (Input_section::section_order_index): New method.
7760         (Input_section::set_section_order_index): New method.
7761         (Input_section::section_order_index_): New member.
7762         (Input_section::Input_section_sort_section_order_index_compare): New
7763         struct.
7764         (Output_section::input_section_order_specified_): New member.
7765         * script-sections.cc (is_wildcard_string): Delete and move modified
7766         method to gold.h.
7767         (Output_section_element_input::Output_section_element_input): Modify
7768         call to is_wildcard_string.
7769         (Output_section_element_input::Input_section_pattern
7770         ::Input_section_pattern): Ditto.
7771         (Output_section_element_input::Output_section_element_input): Ditto.
7772         * testsuite/Makefile.am (final_layout): New test case.
7773         * testsuite/Makefile.in: Regenerate.
7774         * testsuite/final_layout.cc: New file.
7775         * testsuite/final_layout.sh: New file.
7776
7777 2010-06-01  Rafael Espindola  <espindola@google.com>
7778
7779         * plugin.cc (Plugin::load): Pass the output name to the plugin.
7780
7781 2010-06-01  Rafael Espindola  <espindola@google.com>
7782
7783         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
7784         visibility of symbols.
7785
7786 2010-05-27  Doug Kwan  <dougkwan@google.com>
7787
7788         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
7789         from start of output section instead of address for a local symbol
7790         in a merged or relaxed section when doing a relocatable link.
7791
7792 2010-05-26  Rafael Espindola  <espindola@google.com>
7793
7794         PR 11604
7795         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
7796         adding sections the garbage collector removed.
7797         * gold/testsuite/Makefile.am: Add test.
7798         * gold/testsuite/Makefile.in: Regenerate.
7799         * gold/testsuite/plugin_test_7.sh: New.
7800         * gold/testsuite/plugin_test_7_1.c: New.
7801         * gold/testsuite/plugin_test_7_2.c: New.
7802
7803 2010-05-26  Rafael Espindola  <espindola@google.com>
7804
7805         * script-sections.cc (Output_section_definition::set_section_addresses):
7806         Check for --section-start.
7807
7808 2010-05-26  Doug Kwan  <dougkwan@google.com>
7809
7810         * arm.cc (Arm_scan_relocatable_relocs): New class.
7811         (Target_arm::relocate_special_relocatable): New method.
7812         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
7813         (Arm_relocate_functions::thumb_branch_common): Same.
7814         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
7815         instead of Default_scan_relocatable_relocs.
7816         * target-reloc.h (relocate_for_relocatable): Let target handle
7817         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
7818         * target.h (Sized_target::relocate_special_relocatable): New method.
7819
7820 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7821
7822         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
7823
7824 2010-05-23  Doug Kwan  <dougkwan@google.com>
7825
7826         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
7827         instead of a cast.
7828         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
7829         with a direct branch, not a conditional branch, to a stub.
7830         * merge.cc (Output_merge_base::record_input_section): New method
7831         defintion.
7832         (Output_merge_data::do_add_input_section): Record input section if
7833         keeps-input-sections flag is set.
7834         (Output_merge_string::do_add_input_section): Ditto.
7835         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
7836         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
7837         INPUT_SECTIONS_.
7838         (Output_merge_base::keeps_input_sections,
7839         Output_merge_base::set_keeps_input_sections,
7840         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
7841         method definitions.
7842         (Output_merge_base::Input_sections): New type declaration.
7843         (Output_merge_base::input_sections_begin,
7844         Output_merge_base::input_sections_end,
7845         Output_merge_base::do_set_keeps_input_sections): New method definitions.
7846         (Output_merge_base::bool keeps_input_sections_,
7847         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
7848         Output_merge_base::input_sections_): New data members.
7849         (Output_merge_data::do_set_keeps_input_sections): New method
7850         defintion.
7851         (Output_merge_string::do_set_keeps_input_sections): Ditto.
7852         * output.cc (Output_section::Input_section::relobj): Move method
7853         defintion from class declaration to here and handle merge sections.
7854         (Output_section::Input_section::shndx): Ditto.
7855         (Output_section::Output_section): Remove initializations of removed
7856         data members and initialize new data member LOOKUP_MAPS_.
7857         (Output_section::add_input_section): Set keeps-input-sections flag
7858         for a newly created merge output section as appropriate.  Adjust code
7859         to use Output_section_lookup_maps class.
7860         (Output_section::add_relaxed_input_section): Adjst code for lookup
7861         maps code refactoring.
7862         (Output_section::add_merge_input_section): Add a new parameter
7863         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
7864         class.  If adding input section to a newly created merge output
7865         section fails, remove the new merge section.
7866         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
7867         Adjust code for use of the Output_section_lookup_maps class.
7868         (Output_section::find_merge_section): Ditto.
7869         (Output_section::build_lookup_maps): New method defintion.
7870         (Output_section::find_relaxed_input_section): Adjust code to use
7871         Output_section_lookup_maps class.
7872         (Output_section::get_input_sections): Export merge sections.  Adjust
7873         code to use Output_section_lookup_maps class.
7874         (Output_section:::add_script_input_section): Adjust code to use
7875         Output_section_lookup_maps class.  Update lookup maps for merge
7876         sections also.
7877         (Output_section::discard_states): Use Output_section_lookup_maps.
7878         (Output_section::restore_states): Same.
7879         * output.h (Merge_section_properties): Move class defintion out of
7880         Output_section.
7881         (Output_section_lookup_maps): New class.
7882         (Output_section::Input_section::is_merge_section): New method
7883         defintion.
7884         (Output_section::Input_section::relobj): Move defintion out of class
7885         defintion.  Declare method only.
7886         (Output_section::Input_section::shndx): Ditto.
7887         (Output_section::Input_section::output_merge_base): New method defintion.
7888         (Output_section::Input_section::u2_.pomb): New union field.
7889         (Output_section::Merge_section_by_properties_map,
7890         Output_section::Output_section_data_by_input_section_map,
7891         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
7892         Remove types.
7893         (Output_section::add_merge_input_section): Add new parameter
7894         KEEPS_INPUT_SECTIONS.
7895         (Output_section::build_lookup_maps): New method declaration.
7896         (Output_section::merge_section_map_,
7897         Output_section::merge_section_by_properties_map_,
7898         Output_section::relaxed_input_section_map_,
7899         Output_section::is_relaxed_input_section_map_valid_): Remove data
7900         members.
7901         (Output_section::lookup_maps_): New data member.
7902
7903 2010-05-21  Doug Kwan  <dougkwan@google.com>
7904
7905         PR gold/11619
7906         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
7907         avoid a compilation error.
7908
7909 2010-05-19  Rafael Espindola  <espindola@google.com>
7910
7911         * script-sections.cc (Output_section_definition::allocate_to_segment):
7912         Update the phdrs_list even when the output section is NULL.
7913         * testsuite/Makefile.am: Add test.
7914         * testsuite/Makefile.in: Regenerate.
7915         * testsuite/script_test_9.cc: New.
7916         * testsuite/script_test_9.sh: New.
7917         * testsuite/script_test_9.t: New.
7918
7919 2010-05-19  Doug Kwan  <dougkwan@google.com>
7920
7921         * arm.cc (Arm_input_section::original_size): New method.
7922         (Arm_input_section::do_addralign): Add a cast.
7923         (Arm_input_section::do_output_offset): Remove static cast.
7924         (Arm_input_section::original_addralign,
7925          Arm_input_section::original_size_): Change type to uint32_t.
7926         (Arm_input_section::init): Add safe casts for section alignment
7927         and size.
7928         (Arm_input_section::set_final_data_size): Do not set address and
7929         offset of stub table.
7930         (Arm_output_section::fix_exidx_coverage): Change use of of
7931         Output_section::Simple_input_section to that of
7932         Output_section::Input_section.
7933         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
7934         except for the first pass.
7935         * output.cc (Output_section::get_input_sections): Change type of
7936         input_sections to std::list<Input_section>.
7937         (Output_section::add_script_input_section): Rename from
7938         Output_section::add_simple_input_section.  Change type of SIS
7939         parameter from Simple_input_section to Input_section.
7940         * output.h (Output_section::Simple_input_section): Remove class.
7941         (Output_section::Input_section): Change class visibility to public.
7942         (Output_section::Input_section::addralign): Use stored alignments
7943         for special input sections if set.
7944         (Output_section::Input_section::set_addralign): New method.
7945         (Output_section::get_input_sections): Change parameter type from
7946         list of Simple_input_section to list of Input_section.
7947         (Output_section::add_script_input_section): Rename from
7948         Output_section::add_simple_input_section. Change first parameter's
7949         type from Simple_input_section to Input_section and remove the
7950         second and third parameters.
7951         * script-sections.cc (Input_section::Input_section_list): Change
7952         type to list of Output_section::Input_section/
7953         (Input_section_info::Input_section_info): Change parameter type of
7954         INPUT_SECTION to Output_section::Input_section.
7955         (Input_section_info::input_section): Change return type.
7956         (Input_section_info::input_section_): Change type to
7957         Output_section::Input_section.
7958         (Output_section_element_input::set_section_addresses): Adjust code
7959         to use Output_section::Input_section instead of
7960         Output_section::Simple_input_section.  Adjust code for renaming
7961         of Output_section::add_simple_input_section.
7962         (Orphan_output_section::set_section_addresses): Ditto.
7963
7964 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7965
7966         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
7967         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
7968
7969 2010-05-18  Rafael Espindola  <espindola@google.com>
7970
7971         * options.cc (General_options::finalize): Handle -nostdlib.
7972         * options.h (nostdlib): New option.
7973         * script.cc (script_add_search_dir): Handle -nostdlib.
7974
7975 2010-05-12  Doug Kwan  <dougkwan@google.com>
7976
7977         * arm.cc (Target_arm::do_finalize_sections): Create an empty
7978         attributes section only if there no attributes section after merging.
7979         (Target_arm::merge_object_attributes): Move value of
7980         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
7981         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
7982         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
7983         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
7984         and arm_attr_merge_7.stdout.
7985         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
7986         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
7987         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
7988         arm_attr_merge_7b.o): New rules.
7989         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
7990         arm_attr_merge_7
7991         * testsuite/Makefile.in: Regenerate.
7992         * testsuite/arm_attr_merge.sh: New file.
7993         * testsuite/arm_attr_merge_[67][ab].s: Same.
7994
7995 2010-05-05  Nick Clifton  <nickc@redhat.com>
7996
7997         * po/es.po: Updated Spanish translation.
7998
7999 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
8000
8001         * Makefile.am (install-exec-local): Properly install gold as
8002         default cross linker.
8003         * Makefile.in: Regenerated.
8004
8005 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
8006             Nick Clifton  <nickc@redhat.com>
8007
8008         * configure.ac (install_as_default): Define and set to false
8009         unless --enable-gold or --enable-gold=both/gold has been
8010         specified.
8011         * configure: Regenerate.
8012
8013         * Makefile.am (install-exec-local): Install the executable as
8014         'ld.gold'.  If install_as_default is true then also install it as
8015         'ld'.
8016         * Makefile.in: Regenerated.
8017
8018 2010-04-24  Ian Lance Taylor  <iant@google.com>
8019
8020         * layout.cc (Layout::layout_reloc): In relocatable link don't
8021         combine reloc sections for grouped sections.
8022
8023 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
8024
8025         * gc.h (gc_process_relocs): Pass information on relocs pointing to
8026         sections that are not ordinary to icf.
8027         * icf.cc (get_section_contents): Handle relocation pointing to section
8028         with no object or shndx information.
8029         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
8030         * testsuite/Makefile.in: Regenerate.
8031         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
8032         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
8033
8034 2010-04-22  Ian Lance Taylor  <iant@google.com>
8035
8036         * expression.cc (Expression::Expression_eval_info): Add
8037         result_alignment_pointer field.
8038         (Expression::eval_with_dot): Add result_alignment_pointer
8039         parameter.  Change all callers.
8040         (Expression::eval_maybe_dot): Likewise.
8041         (class Binary_expression): Add alignment_pointer parameter to
8042         left_value and right_value.  Change all callers.
8043         (BINARY_EXPRESSION): Set result alignment.
8044         (class Trinary_expression): Add alignment_pointer parameter to
8045         arg2_value and arg3_value.  Change all callers.
8046         (Trinary_cond::value): Set result alignment.
8047         (Max_expression::value, Min_expression::value): Likewise.
8048         (Align_expression::value): Likewise.
8049         * script-sections.cc (class Sections_element): Add dot_alignment
8050         parameter to set_section_addresses virtual function.  Update
8051         instantiations.
8052         (class Output_section_element): Likewise.
8053         (Script_sections::create_segments): Add dot_alignment parameter.
8054         Change all callers.
8055         (Script_sections::create_segments_from_phdrs_clause): Likewise.
8056         (Script_sections::set_phdrs_clause_addresses): Likewise.
8057         * script-sections.h: Update declarations.
8058         * script.h: Update declarations.
8059         * output.h (Output_segment::set_minimum_p_align): Don't decrease
8060         min_p_align.
8061         * testsuite/script_test_3.t: Set large alignment.
8062         * testsuite/script_test_3.sh: Make sure that at least one LOAD
8063         segment has expected alignment.
8064
8065 2010-04-22  Nick Clifton  <nickc@redhat.com>
8066
8067         * po/gold.pot: Updated by the Translation project.
8068         * po/vi.po: Updated Vietnamese translation.
8069
8070 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
8071
8072         * testsuite/Makefile.am (check_PROGRAMS): Add
8073         icf_virtual_function_folding_test.
8074         * testsuite/Makefile.in: Regenerated.
8075
8076 2010-04-15  Andrew Haley  <aph@redhat.com>
8077
8078         * options.h (merge_exidx_entries): New option.
8079         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
8080         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
8081         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
8082         (Target_arm::merge_exidx_entries): New function.
8083         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
8084         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
8085         to Arm_exidx_fixup constructor.
8086         Add new arg, merge_exidx_entries.
8087         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
8088         Arm_output_section::fix_exidx_coverage.
8089
8090 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
8091
8092         * icf.cc (get_section_contents): Check for preemptible functions.
8093         Ignore addend when appropriate.
8094         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
8095         section folded.
8096         (add_from_relobj): Check for section folded.
8097         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
8098         * symtab.h (should_add_dynsym_entry): Add new parameter.
8099         * target-reloc.h (scan_relocs): Check for section folded.
8100         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
8101         Check reloc types for function pointers in shared objects.
8102         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
8103         case.
8104         (icf_preemptible_functions_test): New test case.
8105         (icf_string_merge_test): New test case.
8106         * testsuite.Makefile.in: Regenerate.
8107         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
8108         bar_glob.  Refactor code.
8109         * testsuite/icf_preemptible_functions_test.cc: New file.
8110         * testsuite/icf_preemptible_functions_test.sh: New file.
8111         * testsuite/icf_string_merge_test.cc: New file.
8112         * testsuite/icf_string_merge_test.sh: New file.
8113         * testsuite/icf_virtual_function_folding_test.cc: New file.
8114         * testsuite/icf_virtual_function_folding_test.sh: New file.
8115
8116 2010-04-14  Doug Kwan  <dougkwan@google.com>
8117
8118         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
8119         for local symbol recounting if we remove a section due to ICF.
8120         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
8121         there are no regular objects in input.
8122
8123 2010-04-13  Doug Kwan  <dougkwan@google.com>
8124
8125         * arm.cc (Arm_input_section::set_final_data_size): Compute
8126         accurate final data size instead of using current data size.
8127
8128 2010-04-09  Doug Kwan  <dougkwan@google.com>
8129
8130         * layout.cc (Layout::choose_output_section): Handle script section
8131         types.
8132         (Layout::make_output_section_for_script): Add section type parameter.
8133         Handle script section types.
8134         * layout.h (Layout::make_output_section_for_script): Add section
8135         type parameter.
8136         * output.cc (Output_section::Output_section): Initialize data member
8137         is_noload_.
8138         (Output_section::do_reset_address_and_file_offset): Do not set address
8139         to 0 if section is a NOLOAD section.
8140         * output.h (Output_section::is_noload): New method.
8141         (Output_section::set_is_noload): Ditto.
8142         (Output_section::is_noload_): New data member.
8143         * script-c.h (Script_section_type): New enum type.
8144         (struct Parser_output_section_header): Add new file section_type.
8145         * script-sections.cc (Sections_element::output_section_name): Add
8146         parameter for returning script section type.
8147         (Output_section_definition::output_section_name): Ditto.
8148         (Output_section_definition::section_type)P; New method.
8149         (Output_section_definiton::script_section_type_name): Ditto.
8150         (Output_section_definition::script_section_type_): New data member.
8151         (Output_section_definition::Output_section_definition): Initialize
8152         data member Output_section_definition::script_section_type_.
8153         (Output_section_definition::create_sections): Pass script section type
8154         to Layout::make_output_section_for_script.
8155         (Output_section_definition::output_section_name): Return script
8156         section type to caller.
8157         (Output_section_definition::set_section_address): Do not advance
8158         dot value and load address if section type is NOLOAD.  Set address
8159         of NOLOAD sections regardless of section flags.
8160         (Output_section_definition::print): Print section type if it is
8161         not SCRIPT_SECTION_TYPE_NONE.
8162         (Output_section_definition::section_type): New method.
8163         (Output_section_definition::script_section_type_name): Ditto.
8164         (Script_sections::output_section_name): Add new parameter
8165         PSECTION_TYPE for returning script section type.  Pass it to
8166         section elements.  Handle discard sections.
8167         (Sort_output_sections::operator()): Handle NOLOAD sections.
8168         * script-sections.h (Script_sections::Section_type): New enum type.
8169         (Script_sections::output_section_name): Add a new parameter for
8170         returning script section type.
8171         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
8172         INFO and NOLOAD.
8173         * yyscript.y (union): Add new field SECTION_TYPE.
8174         (COPY, DSECT, INFO, NOLOAD): New tokens.
8175         (opt_address_and_section_type): Change type to output_section_header.
8176         (section_type): New non-terminal
8177         (section_header): Handle section type.
8178         (opt_address_and_section_type): Return section type value.
8179
8180 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
8181
8182         * testsuite/plugin_common_test_1.c (foo): Add prototype.
8183         * testsuite/plugin_common_test_2.c (foo): Likewise.
8184
8185 2010-04-08  Doug Kwan  <dougkwan@google.com>
8186
8187         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
8188         Output_merge_data.
8189         * output.cc (Output_section::add_merge_input_section): Simplify
8190         code and return status of Output_merge_base::add_input_section.
8191         Update merge section map only if Output_merge_base::add_input_section
8192         returns true.
8193
8194 2010-04-07  Doug Kwan  <dougkwan@google.com>
8195
8196         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
8197         if section is marked as containing instructions but has no mapping
8198         symbols.
8199         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
8200         correct section index.
8201         (Arm_relobj::find_linked_text_section): Ditto.
8202
8203 2010-04-07  Cary Coutant  <ccoutant@google.com>
8204
8205         * archive.cc (include_member): Destroy Read_symbols_data object before
8206         releasing file.
8207         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
8208         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
8209         (Read_symbols_data::~Read_symbols_data) New destructor.
8210         (Section_relocs::Section_relocs) New constructor.
8211         (Section_relocs::~Section_relocs) New destructor.
8212         (Read_relocs_data::Read_relocs_data) New constructor.
8213         (Read_relocs_data::~Read_relocs_data) New destructor.
8214         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
8215         pointers to NULL after deleting.
8216
8217 2010-04-07  Doug Kwan  <dougkwan@google.com>
8218
8219         * arm.cc: Replace "endianity" with "endianness" in comments.
8220         (Arm_exidx_cantunwind): Ditto.
8221         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
8222         (Arm_relobj::merge_flags_and_attributes): New method.
8223         (Arm_relobj::merge_flags_and_attributes_): New data member.
8224         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
8225         (Arm_relobj::scan_sections_for_stubs): Ditto.
8226         (Arm_relobj::do_read_symbols): Check to see if we really want to
8227         merge processor-specific flags and attributes.  Exit early if
8228         an object is empty except for section names and the undefined symbol.
8229         (Target_arm::do_finalize_sections): Move check for ELF format to
8230         Arm_relobj::do_read_symbols.  Merge processor specific flags and
8231         attributes from a regular object only when we have determined that
8232         it is aapropriate.  Do not create an .ARM.attributes section in
8233         output if there is no regular input object.
8234         (Target_arm::merge_processor_specific_flags): Check
8235         --warn-mismatch before printing any error.
8236         (Target_arm::merge_object_attributes): Ditto.
8237         * gold.cc (queue_middle_tasks): Handle the case in which there is
8238         no regular object in input.
8239         * options.cc (General_options::parse_EB): New method.
8240         (General_options::parse_EL): Same.
8241         (General_options::General_options): Initialize endianness_.
8242         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
8243         New options.
8244         (General_options::Endianness): New enum.
8245         (General_options::endianness): New method.
8246         (General_options::endianness_): New data member.
8247         * parameters.cc (Parameters::set_options): Check target endianness.
8248         (Parameters::set_target_once): Ditto.
8249         (Parameters::check_target_endianness): New method.
8250         (parameters_force_valid_target): If either -EL or -EB is specified,
8251         use it to define endianness of default target.
8252         * parameters.h (Parameters::check_target_endianness): New method
8253         declaration.
8254         * target.h (class Target): Change "endianity" to "endianness"
8255         in comments.
8256
8257 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8258
8259         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
8260         * configure: Regenerate.
8261         * Makefile.in: Regenerate.
8262         * testsuite/Makefile.in: Regenerate.
8263
8264 2010-04-06  Cary Coutant  <ccoutant@google.com>
8265
8266         gcc PR lto/42757
8267         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
8268         prevailing definitions of common symbols.
8269         * testsuite/plugin_test_6.sh: New test case.
8270         * testsuite/plugin_common_test_1.c: New test case.
8271         * testsuite/plugin_common_test_2.c: New test case.
8272         * testsuite/Makefile.am (plugin_test_6): New test case.
8273         * testsuite/Makefile.in: Regenerate.
8274
8275 2010-04-06  Nick Clifton  <nickc@redhat.com>
8276
8277         * po/vi.po: New Vietnamese translation.
8278
8279 2010-03-30  Doug Kwan  <dougkwan@google.com>
8280
8281         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
8282
8283 2010-03-25  Doug Kwan  <dougkwan@google.com>
8284
8285         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
8286         to avoid a conversion warning on a 32-bit host.
8287
8288 2010-03-24  Ian Lance Taylor  <iant@google.com>
8289
8290         * testsuite/script_test_3.t: Add a TLS segment.
8291         * testsuite/Makefile.am (check_PROGRAMS): Add
8292         tls_phdrs_script_test.
8293         (tls_phdrs_script_test_SOURCES): Define.
8294         (tls_phdrs_script_test_DEPENDENCIES): Define.
8295         (tls_phdrs_script_test_LDFLAGS): Define.
8296         (tls_phdrs_script_test_LDADD): Define.
8297         * testsuite/Makefile.in: Rebuild.
8298
8299 2010-03-23  Cary Coutant  <ccoutant@google.com>
8300
8301         * fileread.cc (find_or_make_view): Fix comment.
8302
8303 2010-03-23  Ian Lance Taylor  <iant@google.com>
8304
8305         * script-sections.cc (class Orphan_section_placement): Define
8306         PLACE_TLS and PLACE_TLS_BSS.
8307         (Orphan_section_placement::Orphan_section_placement): Initialize
8308         new places.
8309         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
8310         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
8311         (tls_script_test_SOURCES): Define.
8312         (tls_script_test_DEPENDENCIES): Define.
8313         (tls_script_test_LDFLAGS): Define.
8314         (tls_script_test_LDADD): Define.
8315         * testsuite/Makefile.in: Rebuild.
8316
8317 2010-03-22  Doug Kwan  <dougkwan@google.com>
8318
8319         * arm.cc (Arm_relocate_functions::abs8,
8320         Arm_relocate_functions::abs16): Use correct check for overflow
8321         specified in the ARM ELF specs.
8322         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
8323         target of a BLX instruction specially.
8324         (Reloc_stub::stub_type_for_reloc): Ditto.
8325         (Relocate::relocate): Use symbolic names instead of numeric relocation
8326         codes to report error.
8327         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
8328         workaround.
8329         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
8330         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
8331         thumb2_blx_out_of_range.stdout
8332         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
8333         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
8334         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
8335         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
8336         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
8337         thumb2_blx_in_range, thumb2_blx_in_range.o,
8338         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
8339         thumb2_blx_out_of_range.o): New rules.
8340         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
8341         thumb2_blx_in_range and thumb2_blx_out_of_range.
8342         * testsuite/Makefile.in: Regenerate.
8343         * arm_branch_in_range.sh: Add tests for THUMB BLX.
8344         * testsuite/thumb_blx_in_range.s: New file.
8345         * testsuite/thumb_blx_out_of_range.s: New file.
8346
8347 2010-03-22  Rafael Espindola  <espindola@google.com>
8348
8349         * archive.cc (Should_include): Move to archive.h.
8350         (should_include_member): Make it a member of Archive.
8351         (Lib_group): New.
8352         (Add_lib_group_symbols): New.
8353         * archive.h: Include options.h.
8354         (Archive_member): Moved from Archive.
8355         (Should_include): Moved from archive.cc.
8356         (Lib_group): New.
8357         (Add_lib_group_symbols): New.
8358         * dynobj.cc (do_should_include_member): New.
8359         * dynobj.h (do_should_include_member): New.
8360         * gold.cc (queue_initial_tasks): Update call to queue.
8361         * main.cc (main): Print lib group stats.
8362         * object.cc (do_should_include_member): New.
8363         * object.h: Include archive.h.
8364         (Object::should_include_member): New.
8365         (Object::do_should_include_member): New.
8366         (Sized_relobj::do_should_include_member): New.
8367         * options.cc (General_options::parse_start_lib): New.
8368         (General_options::parse_end_lib): New.
8369         (Input_arguments::add_file): Handle lib groups.
8370         (Input_arguments::start_group): Check we are not in a lib.
8371         (Input_arguments::start_lib): New.
8372         (Input_arguments::end_lib): New.
8373         * options.h (General_options): Add start_lib and end_lib.
8374         (Input_argument::lib_): New.
8375         (Input_argument::lib): New.
8376         (Input_argument::is_lib): New.
8377         (Input_file_lib): New.
8378         (Input_arguments::in_lib_): New.
8379         (Input_arguments::in_lib): New.
8380         (Input_arguments::start_lib): New.
8381         (Input_arguments::end_lib_): New.
8382         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
8383         in unused members as preempted.
8384         (Sized_pluginobj::do_should_include_member): New.
8385         * plugin.h (Sized_pluginobj::do_should_include_member): New.
8386         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
8387         return the blocker.
8388         (Read_symbols::do_whole_lib_group): New.
8389         (Read_symbols::do_lib_group): New.
8390         (Read_symbols::do_read_symbols): Handle lib groups.
8391         (Read_symbols::get_name): Handle lib groups.
8392         * readsyms.h (Read_symbols): Add an archive member pointer.
8393         (Read_symbols::do_whole_lib_group): New.
8394         (Read_symbols::do_lib_group): New.
8395         (Read_symbols::member_): New.
8396         * script.cc (read_input_script): Update call to queue_soon.
8397
8398 2010-03-19  Doug Kwan  <dougkwan@google.com>
8399
8400         * arm.cc (Stub_table::Stub_table): Initialize new data members
8401         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
8402         (Stub_table::add_reloc_stub): Assign stub offset and update
8403         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
8404         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
8405         New data members.
8406         (Stub_table::update_data_size_and_addralign): Use
8407         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
8408         instead of going over all reloc stubs.
8409         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
8410         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
8411         Stringpool_template::offset_ to size of Stringpool_char.
8412         (Stringpool_template::new_key_offset): Remove code to initialize
8413         Stringpool_template::offset_.
8414         * stringpool.h (Stringpool_template::set_no_zero_null): Set
8415         Stringpool_template::offset_ to zero.
8416
8417 2010-03-15  Doug Kwan  <dougkwan@google.com>
8418
8419         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
8420         offset_.
8421         (Stringpool_template::new_key_offset): New method.
8422         (Stringpool_template::add_string): Assign offsets when adding new
8423         strings.
8424         (Stringpool_template::set_string_offsets): Do not set string offsets
8425         when not optimizing.
8426         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
8427         member size_.
8428         (Chunked_vector::clear): Clear size_.
8429         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
8430         (Chunked_vector::size): Return size_.
8431         (Chunked_vector::push_back): Use size_ to find insert position.
8432         (Chunked_vector::size_): New data member.
8433         (Stringpool_template::set_no_zero_null): Assert string set is empty.
8434         (Stringpool_template::new_key_offset): New method declaration.
8435         (Stringpool_template::offset_): New data member.
8436
8437 2010-03-15   Rafael Espindola  <espindola@google.com>
8438
8439         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
8440         Add_symbols' constructor.
8441         * readsyms.h (Add_symbols): Remove the input_group member.
8442
8443 2010-03-10  Ian Lance Taylor  <iant@google.com>
8444
8445         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
8446         target to ask whether a reference to a symbol requires a stack
8447         split.
8448         * target.h (Target::is_call_to_non_split): New function.
8449         (Target::do_is_call_to_non_split): Declare virtual function.
8450         * target.cc: Include "symtab.h".
8451         (Target::do_is_call_to_non_split): New function.
8452         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
8453
8454 2010-03-10  Cary Coutant  <ccoutant@google.com>
8455
8456         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
8457         (File_read::open[1]): Remove initial mapping of whole_file_view_.
8458         (File_read::open[2]): Add whole_file_view_ to list of views.
8459         (File_read::make_view): Remove test of whole_file_view_.
8460         (File_read::find_or_make_view): Create whole_file_view_ if
8461         necessary.
8462         (File_read::clear_views): Replace bool parameter with enum;
8463         adjust all callers.  Don't delete views with permanent data;
8464         do delete cached views and views from archives if
8465         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
8466         if clearing the corresponding view.
8467         * fileread.h (File_read::Clear_views_mode): New enum.
8468         (File_read::View::is_permanent_view): New method.
8469         (File_read::clear_views): Replace bool parameter
8470         with enum; adjust all callers.
8471         * options.h (General_options): Change keep_files_mapped option;
8472         add map_whole_files.
8473         * readsyms.cc (Add_symbols::run): Delete sd_ object before
8474         releasing the file.
8475         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
8476         the file.
8477
8478 2010-03-10  David S. Miller  <davem@davemloft.net>
8479
8480         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
8481
8482 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
8483
8484         * icf.cc (get_section_contents): Add '@' marker after processing the
8485         merge reloc.
8486
8487 2010-03-08  Doug Kwan  <dougkwan@google.com>
8488
8489         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
8490         due to a conversion warning.
8491         (Arm_relobj::update_output_local_symbol_count): Check for local
8492         symbol with unset output index.
8493
8494 2010-03-05  Ian Lance Taylor  <iant@google.com>
8495
8496         * options.h (class General_options): Add --spare-dynamic-tags.
8497         * output.cc (Output_data_dynamic::set_final_data_size): Implement
8498         --spare-dynamic-tags.
8499
8500 2010-03-05  Ian Lance Taylor  <iant@google.com>
8501
8502         * incremental.cc: Include "libiberty.h".
8503
8504 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
8505
8506         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
8507         function, is_info_ member.
8508         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
8509         (Versions::Versions): Update caller.
8510         (Versions::define_base_version): Likewise.
8511         (Versions::add_def): Likewise.
8512
8513 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
8514
8515         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
8516         (Scan::possible_function_pointer_reloc): New function.
8517         (Scan::local_reloc_may_be_function_pointer): Change to call
8518         possible_function_pointer_reloc.
8519         (Scan::global_reloc_may_be_function_pointer): Ditto.
8520         * icf.h (Icf::check_section_for_function_pointers): Change to reject
8521         relocations in ".data.rel.ro._ZTV" section.
8522         * testsuite/icf_safe_so_test.sh: Change to pass i386.
8523         * testsuite/icf_safe_so_test.cc: Ditto.
8524         * testsuite/icf_safe_test.cc: Ditto.
8525         * testsuite/icf_safe_test.sh: Ditto.
8526
8527 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8528             Ian Lance Taylor  <iant@google.com>
8529
8530         * target-reloc.h (relocate_section): Check the symbol table index
8531         for -1U before setting the local symbol index.
8532         (scan_relocatable_relocs): If copying the relocation, record that
8533         the local symbol is required.
8534         * object.h (Symbol_value::is_output_symtab_index_set): New
8535         function.
8536         (Symbol_value::may_be_discarded_from_output_symtab): New
8537         function.
8538         (Symbol_value::has_output_symtab_entry): New function.
8539         (Symbol_value::needs_output_symtab_entry): Remove.
8540         (Symbol_value::output_symtab_index): Make sure the symbol index is
8541         set.
8542         (Symbol_value::set_output_symtab_index): Make sure the symbol
8543         index is not set.  Make sure the new index is valid.
8544         (Symbol_value::set_must_have_output_symtab_entry): New function.
8545         (Symbol_value::has_output_dynsym_entry): New function.
8546         (Symbol_value::set_output_dynsym_index): Make sure the new index
8547         is valid.
8548         (Sized_relobj::set_must_have_output_symtab_entry): New function.
8549         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
8550         local symbol if permitted.
8551         (Sized_relobj::do_finalize_local_symbols): Call
8552         is_output_symtab_index_set rather than needs_output_symtab_entry.
8553         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
8554         rather than needs_output_symtab_entry.  Call
8555         has_output_dynsym_entry rather than needs_output_dynsym_entry.
8556         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
8557         is_output_symtab_index_set rather than needs_output_symtab_entry.
8558         * testsuite/discard_locals_relocatable_test.c: New file.
8559         * testsuite/discard_locals_test.sh: Test -r.
8560         * testsuite/Makefile.am (check_DATA): Add
8561         discard_locals_relocatable_test1.syms,
8562         discard_local_relocatable_test2.syms.
8563         (MOSTLYCLEANFILES): Likewise.  Also add
8564         discard_locals_relocatable_test1.lout and
8565         discard_locals_relocatable_test2.out.
8566         (discard_locals_relocatable_test1.syms): New target.
8567         (discard_locals_relocatable_test.o): New target.
8568         (discard_locals_relocatable_test1.out): New target.
8569         (discard_locals_relocatable_test2.syms): New target.
8570         (discard_locals_relocatable_test2.out): New target.
8571         (various): Add missing ../ld-new dependencies.
8572         * testsuite/Makefile.in: Rebuild.
8573
8574 2010-03-03  Nick Clifton  <nickc@redhat.com>
8575
8576         * po/fi.po: New Finnish translation.
8577
8578 2010-03-01  Doug Kwan  <dougkwan@google.com>
8579
8580         * layout.cc (Layout::Layout): Force section types of .init_array*,
8581         .preinit_array* and .fini_array* sections.
8582         * output.cc (Output_section::Input_section_sort_entry::has_priority):
8583         Fix check of return value of std::string::find.().
8584         (Output_section::Input_section_sort_compare::operator()): Remove
8585         comment about .init_array.
8586         (Output_section::Input_section_sort_init_fini_compare::operator()):
8587         New method.
8588         (Output_section::sort_attached_input_sections): Handle .init_array
8589         and .fini_array specially.
8590         * output.h (Output_section::Inut_section_sort_compare): Update
8591         comment.
8592         (Output_section::Input_section_sort_init_fini_compare): New struct.
8593
8594 2010-02-26  Doug Kwan  <dougkwan@google.com>
8595
8596         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
8597         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
8598         * testsuite/debug_msg.sh: Avoid matching source line number for
8599         use of global variable undef_int.
8600
8601 2010-02-26  Doug Kwan  <dougkwan@google.com>
8602
8603         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
8604         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
8605         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
8606         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
8607         * options.cc (General_options::General_options): Initialize member
8608         fix_v4bx_.
8609         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
8610         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
8611         and rm_no_fix_v4bx.stdout
8612         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
8613         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
8614         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
8615         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
8616         and arm_no_fix_v4bx.
8617         * Makefile.in: Regenerate.
8618         * testsuite/arm_fix_v4bx.s: New file.
8619         * testsuite/arm_fix_v4bx.sh: Ditto.
8620
8621 2010-02-24  Doug Kwan  <dougkwan@google.com>
8622
8623         * arm.cc (Target_arm::got_section): Make the .got section the first
8624         non RELRO section in the data segment.
8625         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
8626         suffixes of section names.
8627
8628 2010-02-24  Doug Kwan  <dougkwan@google.com>
8629
8630         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
8631         flags and attributes merging if an input file is a binary file.
8632         * fileread.cc (Input_file::open): Record format of original file.
8633         * fileread.h (Input_file::Format): New enum type.
8634         (Input_file::Input_file): Initialize data member format_.
8635         (Input_file::format): New method definition.
8636         (Input_file::format_):: New data member.
8637
8638 2010-02-24  Doug Kwan  <dougkwan@google.com>
8639
8640         * arm.cc (Arm_output_data_got): New class.
8641         (ARM_TCB_SIZE): New constant
8642         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
8643         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
8644         If user uses a script with a SECTIONS clause, issue only a warning
8645         for a misplaced EXIDX input section.  Otherwise, issue an error.
8646         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
8647         garbage collection.
8648         (Target_arm::got_mode_index_entry): Handle static linking.
8649         (Target_arm::Scan::local): Ditto.
8650         (Target_arm::Scan::global): Ditto.
8651         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
8652         all incorrectly implemented relocations.
8653         (Target_arm::fix_exidx_coverage): Pass layout to
8654         Arm_output_section::fix_exidx_coverage.
8655         * layout.cc (Layout::section_name_mapping): Remove trailing dots
8656         from ".ARM.exidx." and ".ARM.extab.".
8657
8658 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8659
8660         * arm.cc (Target_arm::do_finalize_sections): Create attribute
8661         section if it does not already exist.
8662         * attributes.cc (Attributes_section_data::Attributes_section_data):
8663         Don't crash if size is zero.
8664
8665 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8666             Ian Lance Taylor  <iant@google.com>
8667
8668         * gold.cc (queue_middle_tasks): If no input files were opened,
8669         exit.
8670         * workqueue.h (Task_function::Task_function): Assert that there is
8671         a blocker.
8672
8673 2010-02-22  Doug Kwan  <dougkwan@google.com>
8674
8675         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
8676         * icf.cc (get_section_contents): Cast snprintf arguments to long long
8677         types to avoid warnings due to different uint64_t implementations
8678         on different hosts.
8679
8680 2010-02-21  Doug Kwan  <dougkwan@google.com>
8681
8682         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
8683         handling of the maximum backward branch offset.
8684         (Arm_relocate_functions::thumb_branch_common): Ditto.
8685         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
8686         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
8687         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
8688         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
8689         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
8690         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
8691         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
8692         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
8693         thumb_bl_out_of_range thumb_bl_out_of_range.o,
8694         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
8695         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
8696         thumb2_bl_out_of_range.o): New rules.
8697         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
8698         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
8699         thumb2_bl_out_of_range
8700         * testsuite/Makefile.in: Regenerate.
8701         * testsuite/arm_bl_in_range.s: New file.
8702         * testsuite/arm_bl_out_of_range.s: Ditto.
8703         * testsuite/arm_branch_in_range.sh: Ditto.
8704         * testsuite/arm_branch_range.t: Ditto.
8705         * testsuite/thumb2_branch_range.t: Ditto.
8706         * testsuite/thumb_bl_in_range.s: Ditto.
8707         * testsuite/thumb_bl_out_of_range.s: Ditto.
8708         * testsuite/thumb_branch_range.t: Ditto.
8709
8710 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
8711
8712         * gc.h (gc_process_relocs): Change vectors to point to the new list.
8713         Add reloc offset information.
8714         * icf.cc (get_section_contents): Change iterators to point to the new
8715         vectors. Add reloc offset information to the contents.
8716         * icf.h (Icf::Sections_reachable_info): New typedef.
8717         (Icf::Sections_reachable_list): New typedef.
8718         (Icf::Offset_info): New typedef.
8719         (Icf::Reloc_info): New struct typedef.
8720         (Icf::Reloc_info_list): New typedef.
8721         (Icf::symbol_reloc_list): Delete method.
8722         (Icf::addend_reloc_list): Delete method.
8723         (Icf::section_reloc_list): Delete method.
8724         (Icf::reloc_info_list): New method.
8725         (Icf::reloc_info_list_): New member.
8726
8727 2010-02-19  Doug Kwan  <dougkwan@google.com>
8728
8729         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
8730         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
8731         * arm.cc (Arm_relocation_functions): New forward declaration.
8732         (Target_arm::Target_arm): Initialize new data members
8733         got_mod_index_offset_ and tls_base_symbol_defined_.
8734         (Target_arm::Relocate::relocate_tls): New method.
8735         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
8736          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
8737         New methods.
8738         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
8739         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
8740         (Target_arm::got_mod_index_offset_,
8741         Target_arm::tls_base_symbol_defined_): New data members.
8742         (Target_arm::Scan::local, Target::Scan::global,
8743         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
8744         relocations.
8745
8746 2010-02-18  Doug Kwan  <dougkwan@google.com>
8747
8748         * arm.cc (Arm_relobj::find_linked_text_section): New method.
8749         (Arm_relobj::make_exidx_input_section): Pass section index of linked
8750         text section as a parameter becuase some broken tools may not set
8751         the link in section header.
8752         (Target_arm::has_got_section): New method.
8753         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
8754         without any mapping symbol as data only.  Remove warning.
8755         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
8756         link in its section header, try to discover the link by inspecting the
8757         REL31 relocation at the beginning of the section.
8758         (Target_arm::Scan::check_non_pic): Report name of offending relocation
8759         in error message.
8760         (Target_arm::Scan::global): Treat any reference to the symbol
8761         _GLOBAL_OFFSET_TABLE_ as a GOT access.
8762
8763 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
8764
8765         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
8766         (Scan::global_reloc_may_be_function_pointer): New function.
8767         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
8768         (Scan::global_reloc_may_be_function_pointer): New function.
8769         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
8770         (Scan::global_reloc_may_be_function_pointer): New function.
8771         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
8772         (Scan::global_reloc_may_be_function_pointer): New function.
8773         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
8774         (Scan::global_reloc_may_be_function_pointer): New function.
8775         (Scan::possible_function_pointer_reloc): New function.
8776         (Target_x86_64::can_check_for_function_pointers): New function.
8777         * gc.h (gc_process_relocs): Scan relocation types to determine if
8778         function pointers were taken for targets that support it.
8779         * icf.cc (Icf::find_identical_sections): Include functions for
8780         folding in safe ICF whose pointer is not taken.
8781         * icf.h (Secn_fptr_taken_set): New typedef.
8782         (fptr_section_id_): New member.
8783         (section_has_function_pointers): New function.
8784         (set_section_has_function_pointers): New function.
8785         (check_section_for_function_pointers): New function.
8786         * options.h: Fix comment for safe ICF option.
8787         * target.h (can_check_for_function_pointers): New function.
8788         * testsuite/Makefile.am: Add icf_safe_so_test test case.
8789         Modify icf_safe_test for X86-64.
8790         * testsuite/Makefile.in: Regenerate.
8791         * testsuite/icf_safe_so_test.cc: New file.
8792         * testsuite/icf_safe_so_test.sh: New file.
8793         * testsuite/icf_safe_test.cc (kept_func_3): New function.
8794         (main): Change to take pointer to function kept_func_3.
8795         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
8796         folding is done correctly for X86-64.
8797
8798 2010-02-12  David S. Miller  <davem@davemloft.net>
8799
8800         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
8801         is_symbolless parameter.
8802         (Output_reloc<SHT_REL>::is_symbolless): New.
8803         (Output_reloc<SHT_REL>::is_symbolless_): New.
8804         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
8805         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
8806         (Output_reloc<SHT_RELA>::is_symbolless): New.
8807         (Output_data_reloc::add_global): Handle is_symbolless.
8808         (Output_data_reloc::add_global_relative): Likewise.
8809         (Output_data_reloc::add_local): Likewise.
8810         (Output_data_reloc::add_local_relative): Likewise.
8811         (Output_data_reloc::add_symbolless_global_addend): New.
8812         (Output_data_reloc::add_symbolless_local_addend): New.
8813         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
8814         is_symbolless.
8815         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
8816         instead of ->is_relative_
8817         (Output_reloc::write): Likewise.
8818         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
8819         (Output_reloc::write_rel): Simplify.
8820
8821         * sparc.cc (Target_sparc::Scan::local): Use
8822         ->add_symbolless_local_addend as needed.
8823         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
8824         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
8825         based upon relocation offset.
8826
8827 2010-02-11  Doug Kwan  <dougkwan@google.com>
8828
8829         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
8830         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
8831         beginning of function.
8832         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
8833         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
8834         parameter is_32bit in calls to should_apply_static_reloc.
8835         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
8836         (check_DATA): Add arm_abs_global.stdout.
8837         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
8838         arm_abs_global.stdout): New rules.
8839         (MOSTLLYCLEANFILES): Add arm_abs_global
8840         * Makefile.in: Regenerate.
8841         * testsuite/arm_abs_global.s: New file.
8842         * testsuite/arm_abs_global.sh: Ditto.
8843         * testsuite/arm_abs_lib.s: Ditto.
8844
8845 2010-02-11  Ian Lance Taylor  <iant@google.com>
8846
8847         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
8848         Read_relocs task.
8849         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
8850         Allocate_commons_task first.
8851         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
8852         task, rather than symtab_lock_.
8853         (Gc_process_relocs::~Gc_process_relocs): New function.
8854         (Gc_process_relocs::is_runnable): Check this_blocker_.
8855         (Gc_process_relocs::locks): Use next_blocker_ rather than
8856         blocker_.
8857         (Scan_relocs::~Scan_relocs): New function.
8858         (Scan_relocs::is_runnable): Check this_blocker_ rather than
8859         symtab_lock_.
8860         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
8861         next_blocker_.
8862         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
8863         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
8864         constructor accordingly.
8865         (class Gc_process_relocs): Likewise.
8866         (class Scan_relocs): Likewise.
8867         * common.h (class Allocate_commons_task): Remove symtab_lock_
8868         field, and corresponding constructor parameter.
8869         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
8870         symtab_lock_.
8871         (Allocate_commons_task::locks): Likewise.
8872
8873 2010-02-11  Ian Lance Taylor  <iant@google.com>
8874
8875         * gold-threads.h (class Once): Define.
8876         (class Initialize_lock): Rewrite as child of Once.
8877         * gold-threads.cc (class Once_initialize): Define.
8878         (once_pointer_control): New static variable.
8879         (once_pointer, once_arg): New static variables.
8880         (c_run_once): New static function.
8881         (Once::Once, Once::run_once, Once::internal_run): New functions.
8882         (class Initialize_lock_once): Remove.
8883         (initialize_lock_control): Remove.
8884         (initialize_lock_pointer): Remove.
8885         (initialize_lock_once): Remove.
8886         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
8887         (Initialize_lock::initialize): Rewrite.
8888         (Initialize_lock::do_run_once): New function.
8889         * archive.cc (Archive::interpret_header): Only clear name if it is
8890         not already empty.
8891         * fileread.cc: Include "gold-threads.h"
8892         (file_counts_lock): New static variable.
8893         (file_counts_initialize_lock): Likewise.
8894         (File_read::release): Only increment counts when using --stats.
8895         Use a lock around the increment.
8896         * parameters.cc (class Set_parameters_target_once): Define.
8897         (set_parameters_target_once): New static variable.
8898         (Parameters::Parameters): Move here from parameters.h.
8899         (Parameters::set_target): Rewrite.
8900         (Parameters::set_target_once): New function.
8901         (Parameters::clear_target): Move here and rewrite.
8902         * parameters.h (class Parameters): Update declarations.  Add
8903         set_parameters_target_once_ field.
8904         (Parameters::Parameters): Move to parameters.cc.
8905         (Parameters::clear_target): Likewise.
8906         * readsyms.cc (Read_symbols::do_group): Create a Start_group
8907         task.
8908         (Start_group::~Start_group): New function.
8909         (Start_group::is_runnable): New function.
8910         (Start_group::locks, Start_group::run): New functions.
8911         (Finish_group::run): Change saw_undefined to size_t.
8912         * readsyms.h (class Start_group): Define.
8913         (class Finish_group): Change saw_undefined_ field to size_t.
8914         (Finish_group::Finish_group): Remove saw_undefined and
8915         this_blocker parameters.  Change all callers.
8916         (Finish_group::set_saw_undefined): New function.
8917         (Finish_group::set_blocker): New function.
8918         * symtab.h (class Symbol_table): Change saw_undefined to return
8919         size_t.  Change saw_undefined_ field to size_t.
8920         * target-select.cc (Set_target_once::do_run_once): New function.
8921         (Target_selector::Target_selector): Initialize set_target_once_
8922         field.  Don't initialize lock_ and initialize_lock_ fields.
8923         (Target_selector::instantiate_target): Rewrite.
8924         (Target_selector::set_target): New function.
8925         * target-select.h (class Set_target_once): Define.
8926         (class Target_selector): Update declarations.  Make
8927         Set_target_once a friend.  Remove lock_ and initialize_lock_
8928         fields.  Add set_target_once_ field.
8929
8930 2010-02-10  Ian Lance Taylor  <iant@google.com>
8931
8932         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
8933         queueing any tasks.
8934         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
8935         (queue_middle_tasks): Add all blockers before queueing any tasks.
8936         (queue_final_tasks): Likewise.
8937         * token.h (Task_token::add_blockers): New function.
8938         * object.h (Input_objects::number_of_relobjs): New function.
8939
8940 2010-02-10  Ian Lance Taylor  <iant@google.com>
8941
8942         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
8943         shared, not if not position independent.
8944         * x86_64.cc (Relocate::relocate_tls): Likewise.
8945         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
8946         (tls_pie_pic_test): New target.
8947         * testsuite/Makefile.in: Rebuild.
8948
8949         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
8950         (tls_test_main_pie.o, tls_test_pie.o): New targets.
8951         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
8952         * testsuite/Makefile.in: Rebuild.
8953
8954 2010-02-09  David S. Miller  <davem@davemloft.net>
8955
8956         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
8957         R_SPARC_RELATIVE using ->add_local_relative().
8958         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
8959
8960         * output.h (Output_data_dynamic::add_section_size): New method
8961         that takes two Output_data objects.
8962         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
8963         entry param.  Handle it in initializers.
8964         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
8965         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
8966         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
8967         arg.
8968         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
8969         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
8970         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
8971         for dynrel_includes_plt.
8972         * i386.cc (Target_i386::do_finalize_sections): Likewise.
8973         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8974         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
8975         before .rela.plt
8976         (Target_sparc::do_finalize_sections): Update to pass true for
8977         dynrel_includes_plt.
8978         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
8979         output before .rela.plt
8980         (Target_powerpc::do_finalize_sections): Update to pass true for
8981         dynrel_includes_plt when 32-bit.
8982
8983 2010-02-08  Doug Kwan  <dougkwan@google.com>
8984
8985         * arm.cc (Arm_relobj::simple_input_section_output_address): New
8986         method.
8987         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
8988         Arm_relobj::scan_section_for_cortex_a8_stubs,
8989         Arm_relobj::do_relocation_section): Instead of calling
8990         Output_section::output_address, use faster
8991         Arm_relobj::simple_input_section_output_address.
8992
8993 2010-02-08  David S. Miller  <davem@davemloft.net>
8994
8995         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
8996         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
8997         relocation helper function.
8998
8999         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
9000         just like R_SPARC_GOT{10,13,22}.
9001         (Target_sparc::Scan::local): Likewise.
9002         (Target_sparc::Relocate:relocate): Likewise.
9003
9004 2010-02-06  Ian Lance Taylor  <iant@google.com>
9005
9006         * configure.ac: Rewrite targetobjs duplicate removal code to use
9007         only shell constructs.
9008         * configure: Rebuild.
9009
9010 2010-02-05  Doug Kwan  <dougkwan@google.com>
9011
9012         PR 11247
9013         * arm.cc (Arm_relobj::section_is_scannable): New method.
9014         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
9015         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
9016
9017 2010-02-04  Doug Kwan  <dougkwan@google.com>
9018
9019         PR 11247
9020         * arm-reloc-property.cc (cstdio): Include.
9021         * configure.ac (targetobjs): Remove duplicates.
9022         * configure: Regenerate.
9023         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
9024         big and little endian version for a given address size.
9025
9026 2010-02-03  Doug Kwan  <dougkwan@google.com>
9027
9028         * arm-reloc-property.cc
9029         (Arm_reloc_property_table::reloc_name_in_error_message): New method
9030         definition.
9031         * arm-reloc-property.h
9032         (Arm_reloc_property_table::get_implemented_static_reloc_property):
9033         New method definition.
9034         (Arm_reloc_property_table::reloc_name_in_error_message): New method
9035         declaration.
9036         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
9037         overflow to N.
9038         (GOT_PREL): Change implemented to Y.
9039         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
9040         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
9041         (Arm_relocate_functions::movw_abs_nc): Remove method.
9042         (Arm_relocate_functions::movt_abs): Ditto.
9043         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
9044         (Arm_relocate_functions::thm_movt_abs): Ditto.
9045         (Arm_relocate_functions::movw_rel_nc): Ditto.
9046         (Arm_relocate_functions::movw_rel): Ditto.
9047         (Arm_relocate_functions::movt_rel): Ditto.
9048         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
9049         (Arm_relocate_functions:thm_movw_rel): Ditto.
9050         (Arm_relocate_functions:thm_movt_rel): Ditto.
9051         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
9052         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
9053         New method definitions.
9054         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
9055         (Arm_relocation_functions::arm_grp_ldr): Ditto.
9056         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
9057         (Arm_relocation_functions::arm_grp_ldc): Ditto.
9058         (Target_arm::Relocate::relocate): Check for non-static or
9059         unimplemented relocation code and exit early.  Change calls to
9060         Target_arm::reloc_uses_thumb_bit and
9061         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
9062         instead.  Refactor code to handle similar relocations to increase
9063         code sharing.  Remove check for unsupported relocation code in switch
9064         statement.
9065         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
9066         relocation property table to find out size.  Change error message to
9067         print out the name of a relocation code instead of the numeric value.
9068         (Target_arm::scan_reloc_for_stub): Use relocation property table
9069         instead of calling Target_arm::reloc_uses_thumb_bit().
9070
9071 2010-02-02  Doug Kwan  <dougkwan@google.com>
9072
9073         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
9074         types of relaxed input section.
9075
9076 2010-02-02  Doug Kwan  <dougkwan@google.com>
9077
9078         * Makefile.am (HFILES): Add arm-reloc-property.h.
9079         (DEFFILES): New.
9080         (TARGETSOURCES): Add arm-reloc-property.cc
9081         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
9082         (libgold_a_SOURCES): $(DEFFILES)
9083         * Makefile.in: Regenerate.
9084         * arm-reloc-property.cc: New file.
9085         * arm-reloc-property.h: New file.
9086         * arm-reloc.def: New file.
9087         * arm.cc: Update comments.
9088         (arm-reloc-property.h): New included header.
9089         (arm_reloc_property_table): New global variable.
9090         (Target_arm::do_select_as_default_target): New method definition.
9091         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
9092         arm-reloc-property to targ_extra_obj.
9093         * parameters.cc (set_parameters_target): Call
9094         Target::select_as_default_target().
9095         * target.h (Target::select_as_default_target): New method definition.
9096         (Target::do_select_as_default_target): Same.
9097
9098 2010-02-01  Doug Kwan  <dougkwan@google.com>
9099
9100         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
9101         first_output_text_section_.
9102         (Arm_exidx_fixup::first_output_text_section): New method definition.
9103         (Arm_exidx_fixup::first_output_text_section_): New data member.
9104         (Arm_exidx_fixup::process_exidx_section): Record the first text
9105         output section seen.
9106         (Arm_output_section::fix_exidx_coverage): Set correct linked section
9107         and entsize in output section header.
9108
9109 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9110
9111         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
9112         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
9113         (Arm_relocate_functions::thm_alu11): New Method.
9114         (Arm_relocate_functions::thm_pc8): New Method.
9115         (Arm_relocate_functions::thm_pc12): New Method.
9116         (Target_arm::Scan::local): Handle the relocations.
9117         (Target_arm::Scan::global): Likewise.
9118         (Target_arm::Relocate::relocate): Likewise.
9119         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9120
9121 2010-01-29  Doug Kwan  <dougkwan@google.com>
9122
9123         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
9124         of relocation types as ld.
9125
9126 2010-01-29  Doug Kwan  <dougkwan@google.com>
9127
9128         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
9129         to public.
9130         (Arm_relocate_functions::thumb_branch_common): Ditto.
9131         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
9132         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
9133         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
9134         Arm_relocate_functions::jump24): Remove.
9135         (Target_arm::Relocate::relocate): Adjust code to call
9136         Arm_relocation_functions::arm_branch_common and
9137         Arm_relocation_functions::thumb_branch_common instead of their removed
9138         wrappers.  Merge switch-cases together to reduce source code size.
9139
9140 2010-01-29  Doug Kwan  <dougkwan@google.com>
9141
9142         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
9143         output_local_symbol_count_needs_update_.
9144         (Arm_relobj::output_local_symbol_count_needs_update,
9145          Arm_relobj::set_output_local_symbol_count_needs_update,
9146          Arm_relobj::update_output_local_symbol_count): New methods.
9147         (Arm_relobj::output_local_symbol_count_needs_update_): New data
9148         member.
9149         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
9150         of pointed function as in a R_ARM_PREL31 relocation.
9151         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
9152         for output local symbol count updating.
9153         (Target_arm::do_relax): Update output local symbol counts in objects
9154         if necessary.
9155         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
9156
9157 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9158
9159         * arm.cc: Added support for the ARM relocations:
9160         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
9161         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
9162         (Arm_relocate_functions::movw_rel_nc): Renamed (was
9163         movw_prel_nc).
9164         (Arm_relocate_functions::movw_rel): New method.
9165         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
9166         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
9167         thm_movw_prel_nc).
9168         (Arm_relocate_functions::thm_movw_rel): New method.
9169         (Arm_relocate_functions::thm_movt_rel): Renamed (was
9170         thm_movt_prel).
9171         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
9172         relocations.
9173         (Target_arm::Scan::global): Likewise.
9174         (Target_arm::Relocate::relocate): Likewise.
9175         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9176         Likewise.
9177
9178 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9179
9180         * arm.cc: Added support for ARM group relocations.
9181         (Target_arm::reloc_needs_sym_origin): New method.
9182         (Arm_relocate_functions::calc_grp_kn): New method.
9183         (Arm_relocate_functions::calc_grp_residual): New method.
9184         (Arm_relocate_functions::calc_grp_gn): New method.
9185         (Arm_relocate_functions::arm_grp_alu): New Method.
9186         (Arm_relocate_functions::arm_grp_ldr): New Method.
9187         (Arm_relocate_functions::arm_grp_ldrs): New Method.
9188         (Arm_relocate_functions::arm_grp_ldc): New Method.
9189         (Target_arm::Scan::local): Handle the ARM group relocations.
9190         (Target_arm::Scan::global): Likewise.
9191         (Target_arm::Relocate::relocate): Likewise.
9192         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9193         Likewise.
9194
9195 2010-01-26  Doug Kwan  <dougkwan@google.com>
9196
9197         * arm.cc (set): Include.
9198         (class Arm_exidx_fixup): Change type of last_input_section_ to const
9199         pointer type.
9200         (Arm_output_section::Text_section_list): New type.
9201         (Arm_output_section::append_text_sections_to_list): New method.
9202         (Arm_output_section::fix_exidx_coverage): Ditto.
9203         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
9204         (Arm_relobj::convert_input_section_to_relaxed_section): Use
9205         Relobj::set_section_offset() instead of
9206         Sized_relobj::invalidate_section_offset().
9207         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
9208         parameter for section headers. Ignore relocation sections for
9209         unallocated sections and EXIDX sections.
9210         (Target_arm::fix_exidx_coverage): New method.
9211         (Target_arm::output_section_address_less_than): New type.
9212         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
9213         linked text section instead of the EXIDX section.
9214         (Arm_output_section::create_stub_group): Add an assertion to check
9215         that this is not an EXIDX output section.
9216         (Arm_output_section::append_text_sections_to_list): New method.
9217         (Arm_output_section::fix_exidx_coverage): Ditto.
9218         (Arm_relobj::scan_sections_for_stubs): Adjust call to
9219         Arm_relobj::section_needs_reloc_stub_scanning.
9220         (Target_arm::do_relax): Fix EXIDX output section coverage in the
9221         first pass.
9222         (Target_arm::fix_exidx_coverage): New method.
9223         * object.h (Relobj::set_output_section): New method.
9224         (Sized_relobj::invalidate_section_offset): Remove method.
9225         (Sized_relobj::do_invalidate_section_offset): Remove method.
9226         (Sized_relobj::do_set_section_offset): Handle offset value -1.
9227
9228 2010-01-25  Doug Kwan  <dougkwan@google.com>
9229
9230         * arm.cc (Arm_exidx_merged_section::do_output_offset):
9231         Fix warning due to signed and unsigned comparison on a 32-bit host.
9232
9233 2010-01-22  Doug Kwan  <dougkwan@google.com>
9234
9235         * arm.cc (Target_arm::do_relax): Record an output section for section
9236         offset adjustment it contains any stub table that has changed.
9237         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
9238         offsets in an output section if necessary.
9239         * output.cc (Output_section::Output_section): Initialize
9240         section_offsets_need_adjustments_.
9241         (Output_section::add_input_section_for_script): Renamed to
9242         Output_section::add_simple_input_section.
9243         (Output_section::save_states): Add a comment.
9244         (Output_section::discard_states): New method defintion.
9245         (Output_section::adjust_section_offsets): Same.
9246         * output.h (Output_section::add_input_section_for_script): Renamed to
9247         Output_section::add_simple_input_section.
9248         (Output_section::discard_states): New method declaration.
9249         (Output_section::adjust_section_offsets): Same.
9250         (Output_section::section_offsets_need_adjustment,
9251         Output_section::set_section_offsets_need_adjustment): New method
9252         definitions.
9253         (Output_section::section_offsets_need_adjustment_): New data member.
9254         * script-sections.cc
9255         (Output_section_element_input::set_section_address): Adjust code for
9256         renaming of Output_section::add_input_section_for_script.
9257         (Orphan_output_section::set_section_address): Same.
9258
9259 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9260
9261         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
9262         Fix_v4bx enum values .
9263         * gold/options.h (General_options): New option definitions.
9264         (General_options::fix_v4bx): New method.
9265         (General_options::Fix_v4bx): New enum.
9266         * gold/options.cc (General_options::parse_fix_v4bx): New method.
9267         (General_options::parse_fix_v4bx_interworking): New method.
9268
9269 2010-01-22  Doug Kwan  <dougkwan@google.com>
9270
9271         * arm.cc (Arm_exidx_fixup): New class.
9272
9273 2010-01-21  Doug Kwan  <dougkwan@google.com>
9274
9275         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
9276         classes.
9277         (Arm_exidx_section_offset_map): New type.
9278
9279 2010-01-21  Doug Kwan  <dougkwan@google.com>
9280
9281         * arm.cc (Arm_exidx_input_section): New class.
9282         (Arm_relobj::exidx_input_section_by_link,
9283         Arm_relobj::exidx_input_section_by_shndx,
9284         Arm_relobj::make_exidx_input_section): New methods.
9285         (read_arm_attributes_section): Remove.
9286         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
9287         information about them.
9288         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
9289         to here.
9290
9291 2010-01-20  Doug Kwan  <dougkwan@google.com>
9292
9293         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
9294         Input_section_specifier to Section_id.
9295         (Target_arm::new_arm_input_section: Adjust code for change of key
9296         type.
9297         (Target_arm::find_arm_input_section): Ditto.
9298         * gc.h (object.h): Include for Section_id nand Section_id_hash.
9299         (Section_id): Remove.
9300         (Garbage_collection::Section_id_hash): Remove.
9301         * icf.h (object.h): Include for Section_id nand Section_id_hash.
9302         (Section_id): Remove.
9303         (Icf::Section_id_hash): Remove.
9304         * object.h (Section_id, Const_section_id, Section_id_hash,
9305         Const_section_id_hash): New type definitions.
9306         * output.cc (Output_section::add_relaxed_input_section): Change to
9307         use Const_section_id instead of Input_section_specifier as key type.
9308         (Output_section::add_merge_input_section): Ditto.
9309         (Output_section::build_relaxation_map): Change to use Section_id
9310         instead of Input_section_specifier as key type.
9311         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
9312         Ditto.
9313         (Output_section::convert_input_sections_to_relaxed_sections): Change
9314         to use Const_section_id instead of Input_section_specifier as key type.
9315         (Output_section::find_merge_section): Ditto.
9316         (Output_section::find_relaxed_input_section): Ditto.
9317         * output.h (Input_section_specifier): Remove class.
9318         (Output_section::Output_section_data_by_input_section_map): Change
9319         key type to Const_section_id.
9320         (Output_section::Output_relaxed_input_section_by_input_section_map):
9321         Ditto.
9322         (Output_section::Relaxation_map): Change key type to Section_id.
9323
9324 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9325
9326         * gold/arm.cc: Added support for R_ARM_V4BX relocation
9327         (class Arm_v4bx_stub): New class.
9328         (DEF_STUBS): Updated definition to support v4_veneer_bx.
9329         (Stub_factory::make_arm_v4bx_stub): New method.
9330         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
9331         (Stub_table::empty): Handle v4bx stubs.
9332         (Stub_table::add_arm_v4bx_stub): New method.
9333         (Stub_table::find_arm_v4bx_stub): New method.
9334         (Arm_relocate_functions::v4bx): New method.
9335         (Target_arm::fix_v4bx): New method.
9336         (Target_arm::Target_arm): Handle R_ARM_V4BX.
9337         (Stub_table::relocate_stubs): Likewise.
9338         (Stub_table::do_write): Likewise.
9339         (Stub_table::update_data_size_and_addralign): Likewise.
9340         (Stub_table::finalize_stubs):  Likewise.
9341         (Target_arm::Scan::local): Likewise.
9342         (Target_arm::Scan::global): Likewise.
9343         (Target_arm::do_finalize_sections): Likewise.
9344         (Target_arm::Relocate::relocate): Likewise.
9345         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9346         Likewise.
9347         (Target_arm::scan_reloc_for_stub): Likewise.
9348         (Target_arm::scan_reloc_section_for_stubs): Likewise.
9349
9350 2010-01-19  Ian Lance Taylor  <iant@google.com>
9351
9352         * output.cc (Output_section_headers::do_sized_write): Write large
9353         segment count to sh_info field.
9354         (Output_file_header::do_sized_write): For large segment count,
9355         write PN_XNUM to e_phnum field.
9356
9357 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9358
9359         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
9360         (Arm_relocate_functions::thm_jump8): New function.
9361         (Arm_relocate_functions::thm_jump11): New function.
9362         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
9363         R_ARM_THM_JUMP11.
9364         (Target_arm::Scan::global): Likewise.
9365         (Target_arm::Relocate::relocate): Likewise.
9366         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9367         Likewise.
9368
9369 2010-01-14  Doug Kwan  <dougkwan@google.com>
9370
9371         * arm.cc (map, utility): Include headers.
9372         (Target_arm::apply_cortex_a8_workaround): New method.
9373         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
9374         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
9375         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
9376         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
9377         the --[no-]fix-cortex-a8 command line options.
9378         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
9379         (Target_arm::relocate_stub): Use addend in instruction template.
9380         * options.h (DEFINE_bool): Set the user-set flag.
9381         (General_options): Add --[no-]-fix-cortex options.
9382         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
9383         : Update fast look-up map after conversion.
9384
9385 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
9386
9387         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
9388         in the first pass of do_layout.
9389
9390 2010-01-13  Doug Kwan  <dougkwan@google.com>
9391
9392         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
9393         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
9394         apparent compiler problem of not folding static constant integral
9395         data members of elfcpp::Elf_sizes<32>.
9396
9397 2010-01-13  Doug Kwan  <dougkwan@google.com>
9398
9399         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
9400         Arm_relobj::section_needs_cortex_a8_stub_scanning,
9401         Arm_relobj::scan_section_for_cortex_a8_erratum,
9402         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
9403         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
9404         sections to scan for relocation stubs into a new method
9405         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
9406         relocation and Cortex-A8 stub scanning.
9407         (Target_arm::do_relax): Force stubs to be after stubbed sections
9408         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
9409         the beginning of a new relaxation pass.  Update a comment.
9410         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
9411
9412 2010-01-12  Ian Lance Taylor  <iant@google.com>
9413
9414         * target-reloc.h (visibility_error): New inline function.
9415         (relocate_section): Call visibility_error.
9416         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
9417         (MOSTLYCLEANFILES): Likewise.
9418         (protected_4_pic.o, protected_3.err): New targets.
9419         * testsuite/protected_4.cc: New file.
9420
9421 2010-01-12  Doug Kwan  <dougkwan@google.com>
9422
9423         * arm.cc (Cortex_a8_reloc): New class.
9424         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
9425         and cortex_a8_relocs_info_.
9426         (Target_arm::fix_cortex_a8): New method definition.
9427         (Target_arm::Cortex_a8_relocs_info): New type.
9428         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
9429         New data member declarations.
9430         (Target_arm::scan_reloc_for_stub): Record information about
9431         relocations for THUMB branches that might be exempted from the
9432         Cortex-A8 workaround.
9433         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
9434         at the beginning of a relaxation pass.
9435
9436 2010-01-12  Doug Kwan  <dougkwan@google.com>
9437
9438         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
9439         (Arm_relobj::Mapping_symbol_position,
9440          Arm_reloj::Mapping_symbol_position_less,
9441          Arm_relobj::Mapping_symbols_info): New types.
9442         (Target_arm::is_mapping_symbol_name): New method definition.
9443         (Arm_relobj::do_count_local_symbols): Save information about mapping
9444         symbols.
9445
9446 2010-01-11  Doug Kwan  <dougkwan@google.com>
9447
9448         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
9449         Arm_relocate_functions::thumb32_branch_upper,
9450         Arm_relocate_functions::thumb32_branch_lower,
9451         Arm_relocate_functions::thumb32_cond_branch_offset,
9452         Arm_relocate_functions::thumb32_cond_branch_upper,
9453         Arm_relocate_functions::thumb32_cond_branch_lower,
9454         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
9455         branch offset encoding.
9456         (Arm_relocate_functions::thumb_branch_common): Use new branch
9457         offset encoding methods to avoid code duplication.
9458         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
9459         (Stub_addend_reader::operator()): Use new branch encoding method
9460         to avoid code duplication.
9461
9462 2010-01-11  Doug Kwan  <dougkwan@google.com>
9463
9464         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
9465         (Target_arm::do_finalize_sections): Define special EXIDX section
9466         symbols only if referenced.
9467         * gc.h (Garbage_collection::add_reference): New method.
9468         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
9469         code duplication.
9470
9471 2010-01-11  Ian Lance Taylor  <iant@google.com>
9472
9473         * script.cc (Version_script_info::build_expression_list_lookup):
9474         Change complaing about duplicate wildcard match from error to
9475         warning.
9476
9477         * script.cc (class Lazy_demangler): Recreate--revert part of patch
9478         of 2009-12-30.
9479         (Version_script_info::Version_script_info): Initialize globs_,
9480         default_version_, default_is_global_, and exact_.  Don't
9481         initialize globals_ or locals_.
9482         (Version_script_info::build_lookup_tables): Build local symbols
9483         first.
9484         (Version_script_info::unquote): New function.
9485         (Version_script_info::add_exact_match): New function.
9486         (Version_script_info::build_expression_list_lookup): Remove lookup
9487         parameter.  Add is_global parameter.  Change all callers.  Handle
9488         wildcard pattern specially.  Unquote pattern.  Call
9489         add_exact_match.
9490         (Version_script_info::get_name_to_match): New function.
9491         (Version_script_info::get_symbol_version): New function.
9492         (Version_script_info::get_symbol_version_helper): Remove.
9493         (Version_script_info::check_unmatched_names): Call unquote.
9494         * script.h (class Version_script_info): Change get_symbol_version
9495         to be non-inline and add is_global parameter; change all callers.
9496         Rewrite symbol_is_local.  Update declarations.  Define struct
9497         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
9498         Remove globals_ and locals_ members.  Add exact_, globs_,
9499         default_version_, is_global_.
9500         (Version_script_info::Glob): Remove pattern, add expression and
9501         is_global.  Update constructor.  Change all callers.
9502         * dynobj.cc (Versions::finalize): Mark the version symbol as the
9503         default version.
9504         (Versions::symbol_section_contents): If a symbol is undefined, or
9505         defined in a dynamic object, set the version index to
9506         VER_NDX_LOCAL.
9507         * symtab.cc (Symbol_table::add_from_relobj): Don't call
9508         symbol_is_local.
9509         (Symbol_table::add_from_pluginobj): Likewise.
9510         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
9511
9512 2010-01-11  Doug Kwan  <dougkwan@google.com>
9513
9514         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
9515         (incremental_dump_LDADD): Add linking option for libintl.
9516         * Makefile.in: Regenerate.
9517
9518 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
9519
9520         PR gold/11144
9521         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
9522         instead of -Ds.
9523         * testsuite/Makefile.in: Regenerated.
9524
9525 2010-01-10  Doug Kwan  <dougkwan@google.com>
9526
9527         * options.h (DEFINE_var): Use parentheses around argument varname__
9528         in macro body to avoid any unintended subsequent substitutions.
9529
9530 2010-01-10  Ian Lance Taylor  <iant@google.com>
9531
9532         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
9533         candidates before doing symbol resolution.
9534
9535         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
9536         ODR candidates if only one is weak.
9537
9538 2010-01-08  Ian Lance Taylor  <iant@google.com>
9539
9540         * script.cc (Version_script_info::build_expression_list_lookup):
9541         Don't warn about ambiguous version, just record the ambiguity.
9542         (Version_script_info::get_symbol_version_helper): Give error if
9543         version is ambiguous.
9544
9545 2010-01-08  Doug Kwan  <dougkwan@google.com>
9546
9547         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
9548         prev_data_size_ and prev_addralign_.  Remove initializer for
9549         deleted data member has_been_changed_.
9550         (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
9551         to determine if the table is empty.
9552         (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
9553         Remove.
9554         (Stub_table::add_reloc_stub): Define method in class definition
9555         instead of just declaring it there.
9556         (Stub_table::add_cortex_a8_stub): New method definition.
9557         (Stub_table::update_data_size_and_addralign): Ditto.
9558         (Stub_table::finalize_stubs): Ditto.
9559         (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
9560         (Stub_table::do_addralign_): Return address alignment in the
9561         (Stub_table::do_reset_address_and_file_offset): Define method in
9562         class definition instead of declaring it there.  Set current data
9563         size to be the data size of the previous pass.
9564         (Stub_table::set_final_data_size): Use current data size as the
9565         final data size.
9566         (Stub_table::relocate_stub): Change parameter type of stub from
9567         Reloc_stub pointer to Stub pointer.
9568         (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
9569         (Stub_table::Cortex_a8_stub_list): New typedef.
9570         (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
9571          Stub_table::prev_addralign_): New data member.
9572         (Arm_relobj::Arm_relobj): Initialize data member
9573         section_has_cortex_a8_workaround_.
9574         (Arm_relobj::section_has_cortex_a8_workaround,
9575          Arm_relobj::mark_section_for_cortex_a8_workaround): New method
9576          definitions.
9577         (Arm_relobj::section_has_cortex_a8_workaround_): New data member
9578         declarations.
9579         (Target_arm::relocate_stub): Change parameter type of stub from
9580         Reloc_stub pointer to Stub pointer.
9581         (Insn_template::size, Insn_template::alignment): Handle
9582         THUMB16_SPECIAL_TYPE.
9583         (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
9584          Stub_table::update_data_size_and_addralign,
9585          Stub_table::apply_cortex_a8_workaround_to_address_range): New method
9586         definitions.
9587         (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
9588         (Stub_table::do_write): Ditto.
9589         (Target_arm::do_relax): Adjust code for changes in Stub_table.
9590
9591 2010-01-08  Ian Lance Taylor  <iant@google.com>
9592
9593         PR 11108
9594         * symtab.h (class Symbol): Remove fields is_target_special_ and
9595         has_plt_offset_.  Add field is_defined_in_discarded_section_.
9596         (Symbol::is_defined_in_discarded_section): New function.
9597         (Symbol::set_is_defined_in_discarded_section): New function.
9598         (Symbol::has_plt_offset): Rewrite.
9599         (Symbol::set_plt_offset): Verify that new offset is not -1U.
9600         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
9601         Don't initialize is_target_special_ or has_plt_offset_.
9602         Initialize is_defined_in_discarded_section_.
9603         (Symbol_table::add_from_relobj): If appropriate, set
9604         is_defined_in_discarded_section.
9605         * resolve.cc (Symbol::override_base_with_special): Don't test
9606         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
9607         * target-reloc.h (relocate_section): Do special handling for
9608         symbols defined in discarded sections for global symbols as well
9609         as local symbols.
9610
9611 2010-01-08  Ian Lance Taylor  <iant@google.com>
9612
9613         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
9614         the SHT_SYMTAB case.
9615
9616 2010-01-08  Ian Lance Taylor  <iant@google.com>
9617
9618         * object.cc (Sized_relobj::do_layout): Don't get confused if
9619         layout_eh_frame returns NULL.
9620
9621 2010-01-08  Ian Lance Taylor  <iant@google.com>
9622
9623         PR 11084
9624         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
9625         dynamic symbol table, use the normal symbol table.
9626         (Sized_dynobj::do_read_symbols): Remove assertion about type of
9627         symbol table.
9628
9629 2010-01-08  Ian Lance Taylor  <iant@google.com>
9630
9631         PR 11072
9632         * layout.cc (Layout::include_section): Remove .gnu_debuglink
9633         sections.
9634
9635 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
9636
9637         * version.cc (print_version): Change to "Copyright 2010".
9638
9639 2010-01-08  Ian Lance Taylor  <iant@google.com>
9640
9641         PR 10287
9642         PR 11063
9643         * i386.cc (class Target_i386): Change return type of plt_section
9644         to be non-const.
9645         (class Output_data_plt_i386): Add tls_desc_rel_ field.
9646         (Output_data_plt_i386::Output_data_plt_i386): Initialize
9647         tls_desc_rel_ field.
9648         (Output_data_plt_i386::rel_tls_desc): New function.
9649         (Target_i386::rel_tls_desc_section): New function.
9650         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
9651         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
9652         R_386_TLS_DESC reloc in rel_tls_desc_section.
9653         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
9654         Define struct Tlsdesc_info.
9655         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
9656         (Target_x86_64::do_reloc_symbol_index): New function.
9657         (Target_x86_64::add_tlsdesc_info): New function.
9658         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
9659         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
9660         tlsdesc_rel_ field.
9661         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
9662         all callers.
9663         (Output_data_plt_x86_64::rela_tlsdesc): New function.
9664         (Target_x86_64::rela_tlsdesc_section): New function.
9665         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
9666         handling.
9667         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
9668         (Target_x86_64::do_reloc_addend): New function.
9669         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
9670         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
9671         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
9672         (Output_reloc::type): New function.
9673         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
9674         (Output_reloc::is_target_specific): New function.
9675         (Output_reloc::target_arg): New function.
9676         (class Output_reloc) [SHT_RELA]: Add four new constructors for
9677         absolute relocs and target specific relocs.
9678         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
9679         add_target_specific.
9680         (class Output_data_reloc) [SHT_RELA]: Likewise.
9681         * output.cc (Output_reloc::Output_reloc): Add four new versions
9682         for absolute relocs and target specific relocs.
9683         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
9684         (Output_reloc::get_symbol_index): Likewise.
9685         (Output_reloc::local_section_offset): Check that local_sym_index_
9686         is not TARGET_CODE or 0.
9687         (Output_reloc::symbol_value): Likewise.
9688         (Output_reloc::write) [SHT_RELA]: Call target for target specific
9689         reloc.
9690         * target.h (class Target): Add reloc_symbol_index and reloc_addend
9691         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
9692         functions.
9693         * layout.cc (add_target_dynamic_tags): Use output section for
9694         DT_PLTRELSZ and DT_JMPREL.
9695
9696 2010-01-07  Ian Lance Taylor  <iant@google.com>
9697
9698         PR 11061
9699         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
9700         function.
9701         (class Output_data_reloc_generic): Define.
9702         (class Output_data_reloc_base): Change base class to
9703         Output_data_reloc_generic.  Change add() method to call
9704         bump_relative_reloc_count for a relative reloc.  Remove
9705         sort_relocs_ field.
9706         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
9707         to sort_relocs().
9708         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
9709         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
9710         appropriate.
9711         * layout.h (class Layout): Update declaration.
9712
9713 2010-01-07  Ian Lance Taylor  <iant@google.com>
9714
9715         * output.h (class Output_data): Add const version of
9716         output_section and do_output_section.
9717         (class Output_section_data): Add const version of
9718         do_output_section.
9719         (class Output_section): Likewise.
9720         * layout.cc (Layout::add_target_dynamic_tags): New function.
9721         * layout.h (class Layout): Update declarations.
9722         * arm.cc (Target_arm::do_finalize_sections): Use
9723         add_target_dynamic_tags.
9724         * i386.cc (Target_i386::do_finalize_sections): Likewise.
9725         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
9726         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
9727         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
9728
9729 2010-01-07  Ian Lance Taylor  <iant@google.com>
9730
9731         PR 11042
9732         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
9733         object as needed.
9734
9735 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
9736             Ian Lance Taylor  <iant@google.com>
9737
9738         PR 11019
9739         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
9740         Xindex::read_symtab_xindex.
9741
9742 2010-01-07  Doug Kwan  <dougkwan@google.com>
9743
9744         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
9745         (Insn_template::thumb16_bcond_insn): New method declaration.
9746         (Insn_template): Fix spelling.
9747         (Stub::thumb16_special): New method declaration.
9748         (Stub::do_write): Define virtual method which was previously pure
9749         virtual.
9750         (Stub::do_thumb16_special): New method declaration.
9751         (Stub::do_fixed_endian_write): New template member.
9752         (Reloc_stub::do_write): Remove.
9753         (Reloc_stub::do_fixed_endian_write): Remove.
9754         (Cortex_a8_stub): New class definition.
9755         (Stub_factory::make_cortex_a8_stub): New method definition.
9756         (Stub_factory::Stub_factory): Add missing static storage class
9757         qualifier for elf32_arm_stub_a8_veneer_blx.
9758
9759 2010-01-07  Ian Lance Taylor  <iant@google.com>
9760
9761         PR 10980
9762         * options.h (class General_options): Add --warn-unresolved-symbols
9763         and --error-unresolved-symbols.
9764         * errors.cc (Errors::undefined_symbol): Implement
9765         --warn-unresolved-symbols.
9766
9767         * options.h (class General_options): Add -z text and -z textoff.
9768         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
9769
9770 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
9771
9772         * gc.h (Garbage_collection::Cident_section_map): New typedef.
9773         (Garbage_collection::cident_sections): New function.
9774         (Garbage_collection::add_cident_section): New function.
9775         (Garbage_collection::cident_sections_): New member.
9776         (gc_process_relocs): Add references to sections whose names are C
9777         identifiers.
9778         * gold.h (cident_section_start_prefix): New constant.
9779         (cident_section_stop_prefix): New constant.
9780         (is_cident): New function.
9781         * layout.cc (Layout::define_section_symbols): Replace string constants
9782         with the newly defined constants.
9783         * object.cc (Sized_relobj::do_layout): Track sections whose names are
9784         C identifiers.
9785         * testsuite/Makefile.am: Add gc_orphan_section_test.
9786         * testsuite/Makefile.in: Regenerate.
9787         * testsuite/gc_orphan_section_test.cc: New file.
9788         * testsuite/gc_orphan_section_test.sh: New file.
9789
9790 2010-01-06  Ian Lance Taylor  <iant@google.com>
9791
9792         PR 10980
9793         * options.h (class General_options): Add --warn-shared-textrel.
9794         * layout.cc (Layout::finish_dynamic_section): Implement
9795         --warn-shared-textrel.
9796
9797         PR 10980
9798         * options.h (class General_options): Add --warn-multiple-gp.
9799
9800 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9801
9802         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
9803         $(THREADSLIB) and $(LIBDL).
9804         * Makefile.in: Rebuild.
9805
9806 2010-01-06  Ian Lance Taylor  <iant@google.com>
9807
9808         PR 10980
9809         * options.cc (General_options::parse_section_start): New function.
9810         (General_options::section_start): New function.
9811         (General_options::General_options): Initialize all members.
9812         * options.h: Include <map>
9813         (class General_options): Add --section-start.  Add section_starts_
9814         member.
9815         * layout.cc (Layout::attach_allocated_section_to_segment): If
9816         --section-start was used, set the address of the segment.  Remove
9817         local sort_sections.
9818         (Layout::relaxation_loop_body): If the address of the load segment
9819         has been set by --section-start, don't use it.
9820         * output.h (Output_segment::update_flags_for_output_section): New
9821         function.
9822         * output.cc (Output_segment::add_output_section): Call
9823         update_flags_for_output_section.
9824
9825 2010-01-05  Ian Lance Taylor  <iant@google.com>
9826
9827         PR 10980
9828         * options.h (class General_options): Add --undefined-version.
9829         * script.cc (struct Version_expression): Add was_matched_by_symbol
9830         field.
9831         (Version_script_info::matched_symbol): New function.
9832         (Version_script_info::get_symbol_version_helper): Call
9833         matched_symbol.
9834         (Version_script_info::check_unmatched_names): New function.
9835         * script.h (class Version_script_info): Update declarations.
9836         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
9837
9838         * options.h (class General_options): Use DEFINE_bool_alias for
9839         allow_multiple_definition.
9840         * resolve.cc (Symbol_table::should_override): Don't test
9841         allow_multiple_definition.
9842
9843         PR 10980
9844         * options.h (class General_options): Add --cref.
9845         * main.cc (main): Print cref table if --cref.  Don't close mapfile
9846         until after printing cref table.
9847         * cref.cc: Include "symtab.h".
9848         (class Cref_inputs): Define Cref_table_compare and Cref_table.
9849         (Cref_table_compare::operator()): New function.
9850         (Cref_inputs::gather_cref): New function.
9851         (filecol): New static const.
9852         (Cref_inputs::print_cref): New function.
9853         (Cref::print_cref): New function.
9854         * cref.h: Include <cstdio>.
9855         (class Cref): Update declarations.
9856         * mapfile.h (Mapfile::file): New function.
9857         * object.h (class Object): Define Symbols.  Declare virtual
9858         do_get_global_symbols.
9859         (Object::get_global_symbols): New function.
9860         * object.cc (Input_objects::add_object): Pass object to cref_ if
9861         --cref.
9862         (Input_objects::archive_start): Likewise.
9863         (Input_objects::archive_stop): Likewise.
9864         (Input_objects::print_cref): New function.
9865         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
9866         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
9867         --cref.
9868         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
9869         function.
9870         * plugin.h (class Sized_pluginobj): Update declarations.
9871
9872 2010-01-05  Ian Lance Taylor  <iant@google.com>
9873
9874         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
9875         to is_default_version.  Rename insdef to insdefault.
9876         (Symbol_table::add_from_relobj): Rename def to is_default_version
9877         and local to is_forced_local.
9878         (Symbol_table::add_from_pluginobj): Likewise.
9879         (Symbol_table::add_from_dynobj): Likewise.
9880         (Symbol_table::define_special_symbol): Rename insdef to
9881         insdefault.
9882
9883 2010-01-04  Ian Lance Taylor  <iant@google.com>
9884
9885         PR 10980
9886         * options.h (class General_options): Add
9887         --allow-multiple-definition and -z muldefs.
9888         * resolve.cc (Symbol_table::should_override): Don't warn about a
9889         multiple symbol definition if --allow-multiple-definition or -z
9890         muldefs.
9891
9892         PR 10980
9893         * options.h (class General_options): Add --add-needed and
9894         --copy-dt-needed-entries.  Tweak --as-needed help entry.
9895         * object.cc (Input_objects::check_dynamic_dependencies): Give an
9896         error if --copy-dt-needed-entries aka --add-needed is used and
9897         would cause a change in behaviour.
9898
9899         PR 10980
9900         * options.h (class General_options): Add -G as a short version of
9901         --shared.  Add no-op options -assert, -g, and -i.
9902
9903 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
9904
9905         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
9906         check for .text or .gnu.linkonce.t sections.
9907         * icf.cc (Icf::find_identical_sections): Ditto.
9908         Change the detection for mangled function name within the section
9909         name.
9910         * icf.h (is_section_foldable_candidate): New function.
9911
9912 2009-12-30  Ian Lance Taylor  <iant@google.com>
9913
9914         PR 10980
9915         * options.h (class General_options): Permit two dashes with
9916         --retain-symbols-file.
9917
9918 2009-12-30  Ian Lance Taylor  <iant@google.com>
9919
9920         PR 10979
9921         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
9922         don't put the file header and segment headers in the text
9923         segment.
9924
9925         PR 10979
9926         * common.cc (Sort_commons::operator()): Stabilize sort when both
9927         entries are NULL.
9928         (Symbol_table::do_allocate_commons_list): When allocating common
9929         symbols, skip a symbol which is no longer common.
9930         * symtab.h (Symbol::is_common): Test whether the symbol comes from
9931         an object before checking its type.
9932         * testsuite/common_test_2.c: New file.
9933         * testsuite/common_test_3.c: New file.
9934         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
9935         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
9936         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
9937         (common_test_2_pic.o, common_test_2.so): New targets.
9938         (common_test_3_pic.o, common_test_3.so): New targets.
9939         * testsuite/Makefile.in: Rebuild.
9940
9941         PR 10979
9942         * script.cc (read_input_script): If we see a new SECTIONS clause,
9943         and we have added an input section, give an error.
9944         * layout.h (class Layout): Add have_added_input_section function.
9945         Add have_added_input_section_ field.
9946         * layout.cc (Layout::Layout): Initialize
9947         have_added_input_section_.
9948         (Layout::layout): Set have_added_input_section_.
9949         (Layout::layout_eh_frame): Likewise.
9950
9951 2009-12-30  Ian Lance Taylor  <iant@google.com>
9952
9953         PR 10931
9954         * options.h (class General_options): Add --sort-common option.
9955         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
9956         * common.cc (Sort_common): Add sort_order parameter to
9957         constructor.  Add sort_order_ field.
9958         (Sort_commons::operator): Check sort_order_.
9959         (Symbol_table::allocate_commons): Determine the sort order.
9960         (Symbol_table::do_allocate_commons): Add sort_order parameter.
9961         Change all callers.
9962         (Symbol_table::do_allocate_commons_list): Likewise.
9963
9964 2009-12-30  Ian Lance Taylor  <iant@google.com>
9965
9966         PR 10916
9967         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
9968         symbols from this object, don't change the visibility of an
9969         undefined symbol.
9970         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
9971
9972 2009-12-30  Ian Lance Taylor  <iant@google.com>
9973
9974         PR 10861
9975         * script.h (class Version_script_info): Define Language enum.
9976         Update declarations.  Define Glob, Exact, and Lookup types.  Add
9977         new fields globals_, locals_, and is_finalized_.
9978         * script.cc: Various formatting fixes.
9979         (class Parser_closure): Change language_stack_ from a vector of
9980         std::string to one of Version_script_info::Language.  Adjust all
9981         uses accordingly.
9982         (class Lazy_demangler): Remove.
9983         (struct Version_expression): Change language from std::string to
9984         Version_script_info::Language.
9985         (Version_script_info::Version_script_info): New function.
9986         (Version_script_info::~Version_script_info): Don't call clear.
9987         (Version_script_info::finalize): New function.
9988         (Version_script_info::build_lookup_tables): New function.
9989         (Version_script_info::build_expression_list_lookup): New
9990         function.
9991         (Version_script_info::get_symbol_version_helper): Rewrite to use
9992         lookup tables.
9993         (Version_script_info::print_expression_list): Adjust to use
9994         Version_script_info::Language.
9995         (script_push_lex_into_version_mode): Check that the version script
9996         has not been finalized.
9997         (version_script_push_lang): Change language string to
9998         Version_script_info::Language.
9999         * options.cc (Command_line::version_script): New function.
10000         * options.h (class General_options): Add finalize_dynamic_list
10001         function.  Change version_script from declaration to definition.
10002         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
10003         * testsuite/version_script.map: Remove duplicate def of foo.
10004         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
10005         version_script.map.
10006         * testsuite/Makefile.in: Rebuild.
10007
10008 2009-12-30  Ian Lance Taylor  <iant@google.com>
10009
10010         PR 10843
10011         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
10012         if the input symbol index is 0, make the output symbol index 0.
10013
10014 2009-12-30  Ian Lance Taylor  <iant@google.com>
10015
10016         PR 10670
10017         * options.h (class General_options): Add -x/--discard-all.
10018         * object.cc (Sized_relobj::do_count_local_symbols): Handle
10019         --discard-all.  If the local symbol needs a dynamic entry, check
10020         that before handling --discard-locals.
10021
10022 2009-12-30  Ian Lance Taylor  <iant@google.com>
10023
10024         PR 10450
10025         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
10026         flags to PF_R.
10027         (Output_segment::add_output_section): Don't change the flags if
10028         the type is PT_TLS.
10029
10030         PR 10450
10031         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
10032         GNU hash table if they need a dynamic value.  Otherwise, don't add
10033         them if they are defined in a dynamic object or are forced local.
10034
10035 2009-12-29  Ian Lance Taylor  <iant@google.com>
10036
10037         PR 10450
10038         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
10039         .gnu.hash table for a 32-bit target.
10040
10041         PR 10450
10042         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
10043         regular and a dynamic object only needs a dynamic symbol table
10044         entry if it is externally visible.
10045
10046         PR 10450
10047         * i386.cc (class Target_i386): Initialize global_offset_table_ in
10048         constructor.  Add global_offset_table_ field.
10049         (Target_i386::got_section): Set global_offset_table_.
10050         (Target_i386::do_finalize_sections): Set global_offset_table_
10051         size.
10052         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
10053         in constructor.  Add global_offset_table_ field.
10054         (Target_x86_64::got_section): Set global_offset_table_.
10055         (Target_x86_64::do_finalize_sections): Set global_offset_table_
10056         size.
10057
10058         * layout.cc (Layout::Layout): Initialize increase_relro_.
10059         (Layout::get_output_section): Add is_relro, is_last_relro, and
10060         is_first_non_relro parameters.  Change all callers.
10061         (Layout::choose_output_section): Likewise.
10062         (Layout::add_output_section_data): Likewise.
10063         (Layout::make_output_section): Likewise.
10064         (Layout::set_segment_offsets): Clear increase_relro when using a
10065         linker script.
10066         * layout.h (class Layout): Add increase_relro method.  Add
10067         increase_relro_ field.  Update declarations.
10068         * output.cc (Output_section::Output_section): Initialize
10069         is_last_relro_ and is_first_non_relro_.
10070         (Output_segment::add_output_section): Group relro sections is
10071         do_sort is true.  Handle is_last_relro and is_first_non_relro.
10072         (Output_segment::maximum_alignment): Remove relro handling.
10073         (Output_segment::set_section_addresses): Add increase_relro
10074         parameter.  Change all callers.  Add initial alignment to align
10075         relro sections on separate page.  Remove old relro handling.
10076         (Output_segment::set_section_list_addresses): Remove in_relro
10077         parameter.  Change all callers.
10078         (Output_segment::set_offset): Add increase parameter.  Change all
10079         callers.  Remove old relro handling.
10080         * output.h (class Output_section): Add new methods: is_last_relro,
10081         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
10082         Add is_last_relro_ and is_first_non_relro_ fields.
10083         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
10084         Create separate .got.plt section.  Call increase_relro.
10085         * x86_64.cc (Target_x86_64::got_section): Likewise.
10086         * testsuite/relro_script_test.t: Add .got.plt.
10087
10088         PR 10450
10089         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
10090         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
10091         (Layout::finalize): Call set_dynamic_symbol_size.
10092         (Layout::set_dynamic_symbol_size): New function.
10093         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
10094         set_dynamic_symbol_size.
10095
10096         PR 10450
10097         * output.h (class Output_section): Add is_entsize_zero_ field.
10098         * output.cc (Output_section::Output_section): Initialize
10099         is_entsize_zero_.
10100         (Output_section::set_entsize): If two different entsizes are
10101         requested, force it to zero.
10102         (Output_section::add_input_section): Set flags for .debug_str
10103         before updating section flags.  Set entsize.
10104         (Output_section::update_flags_for_input_section): Set SHF_MERGE
10105         and SHF_STRING if all input sections have those flags.
10106
10107 2009-12-29   Rafael Espindola  <espindola@google.com>
10108
10109         * main.cc (main): Fix the sys time reporting.
10110         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
10111         reporting.
10112
10113 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
10114
10115         * options.cc (General_options::parse_version): Allow -v to exit
10116         without an error if there is nothing to link.
10117
10118 2009-12-29  Ian Lance Taylor  <iant@google.com>
10119
10120         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
10121         using a version of gcc before 4.1.
10122         * configure: Rebuild.
10123
10124 2009-12-28  Chris Demetriou  <cgd@google.com>
10125
10126         * attributes.cc (Output_attributes_section_data::do_write): Use
10127         std::vector::front rather than std::vector::data.
10128
10129 2009-12-28  Ian Lance Taylor  <iant@google.com>
10130
10131         * symtab.h (class Symbol_table): Add enum Defined.
10132         * resolve.cc (Symbol_table::should_override): Add defined
10133         parameter.  Change all callers.  Test whether object is NULL
10134         before calling a method on it.
10135         (Symbol_table::report_resolve_problem): Add defined parameter.
10136         Change all callers.
10137         (Symbol_table::should_override_with_special): Likewise.
10138         * symtab.cc (Symbol_table::define_in_output_data): Add defined
10139         parameter.  Change all callers.
10140         (Symbol_table::do_define_in_output_data): Likewise.
10141         (Symbol_table::define_in_output_segment): Likewise.
10142         (Symbol_table::do_define_in_output_segment): Likewise.
10143         (Symbol_table::define_as_constant): Likewise.
10144         (Symbol_table::do_define_as_constant): Likewise.
10145         * script.h (class Symbol_assignment): Add is_defsym parameter to
10146         constructor; change all callers.
10147         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
10148         parameter.  Change all callers.  Add is_defsym_ field.
10149         (class Parser_closure): Add parsing_defsym parameter to
10150         constructor; change all callers.  Add parsing_defsym accessor
10151         function.  Add parsing_defsym_ field.
10152
10153 2009-12-28  Ian Lance Taylor  <iant@google.com>
10154
10155         * gold.cc (queue_middle_tasks): Fix formatting.
10156         * object.cc (Relobj::is_section_name_included): Likewise.
10157
10158 2009-12-23  Ian Lance Taylor  <iant@google.com>
10159
10160         * i386.cc (Target_i386::do_calls_non_split): Recognize
10161         -fsplit-stack prologue for a function with a static chain.
10162         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
10163         -fsplit-stack prologue when using %r11.
10164
10165 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
10166
10167         * options.cc (General_options::parse_version): Make -v continue and do
10168         the link like GNU ld does.
10169
10170 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
10171
10172         * Makefile.am (CCFILES): Add timer.cc.
10173         (HFILES): Add timer.h.
10174         * configure.ac: Check for sysconf and times.
10175         * main.cc: include timer.h.
10176         (main): Use Timer instead of get_run_time.
10177         * timer.cc: New.
10178         * timer.h: New.
10179         * workqueue.cc: include timer.h.
10180         (Workqueue::find_and_run_task):
10181         Report user, sys and wall time.
10182         * Makefile.in: Regenerate.
10183         * config.in: Regenerate.
10184         * configure: Regenerate.
10185
10186 2009-12-16  Doug Kwan  <dougkwan@google.com>
10187
10188         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
10189         sections.
10190         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
10191         relaxed input sections.
10192         * output.cc (Output_section::find_relaxed_input_section): Change
10193         return type to Output_relaxed_input_section pointer.  Adjust code
10194         for new type of relaxed_input_section_map_.
10195         * output.h (Output_section::find_relaxed_input_section): Change
10196         return type to Output_relaxed_input_section pointer.
10197         (Output_section::Output_relaxed_input_section_by_input_section_map):
10198         New type.
10199         (Output_section::relaxed_input_section_map_): Change type to
10200         Output_section::Output_relaxed_input_section_by_input_section_map.
10201         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
10202         input section.
10203
10204 2009-12-15  Ian Lance Taylor  <iant@google.com>
10205
10206         * layout.cc (Layout::create_shstrtab): Only write out after input
10207         sections if we are compressing debug sections.
10208
10209 2009-12-15  Ian Lance Taylor  <iant@google.com>
10210
10211         * archive.cc (Archive::add_symbols): Only look up a symbol without
10212         a version if there is, in fact, a version.
10213
10214 2009-12-14  Ian Lance Taylor  <iant@google.com>
10215
10216         Revert -Wshadow changes, all changes from:
10217         2009-12-11  Doug Kwan  <dougkwan@google.com>
10218         2009-12-11  Nick Clifton  <nickc@redhat.com>
10219         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
10220
10221 2009-12-11  Doug Kwan  <dougkwan@google.com>
10222
10223         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
10224         due to -Wshadow.
10225         * attributes.cc (Object_attribute::size): Ditto.
10226         (Attributes_section_data::size): Ditto.
10227         (Attributes_section_data::Attributes_section_data): Ditto.
10228         (Output_attributes_section_data::do_write): Ditto.
10229         * attributes.h (Object_attribute::set_type): Ditto.
10230         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
10231
10232 2009-12-11  Nick Clifton  <nickc@redhat.com>
10233
10234         * archive.cc: Fix shadowed variable warnings.
10235         * arm.cc: Likewise.
10236         * compressed_output.cc: Likewise.
10237         * compressed_output.h: Likewise.
10238         * configure: Likewise.
10239         * dwarf_reader.cc: Likewise.
10240         * dynobj.cc: Likewise.
10241         * dynobj.h: Likewise.
10242         * ehframe.cc: Likewise.
10243         * ehframe.h: Likewise.
10244         * errors.cc: Likewise.
10245         * expression.cc: Likewise.
10246         * fileread.cc: Likewise.
10247         * fileread.h: Likewise.
10248         * freebsd.h: Likewise.
10249         * i386.cc: Likewise.
10250         * icf.cc: Likewise.
10251         * incremental.h: Likewise.
10252         * layout.cc: Likewise.
10253         * layout.h: Likewise.
10254         * mapfile.cc: Likewise.
10255         * merge.cc: Likewise.
10256         * merge.h: Likewise.
10257         * object.cc: Likewise.
10258         * object.h: Likewise.
10259         * options.h: Likewise.
10260         * output.cc: Likewise.
10261         * output.h: Likewise.
10262         * parameters.cc: Likewise.
10263         * plugin.cc: Likewise.
10264         * powerpc.cc: Likewise.
10265         * reduced_debug_output.cc: Likewise.
10266         * reduced_debug_output.h: Likewise.
10267         * reloc.cc: Likewise.
10268         * reloc.h: Likewise.
10269         * resolve.cc: Likewise.
10270         * script-sections.cc: Likewise.
10271         * script.cc: Likewise.
10272         * script.h: Likewise.
10273         * sparc.cc: Likewise.
10274         * symtab.cc: Likewise.
10275         * symtab.h: Likewise.
10276         * target-select.cc: Likewise.
10277         * target-select.h: Likewise.
10278         * token.h: Likewise.
10279         * workqueue.cc: Likewise.
10280         * workqueue.h: Likewise.
10281         * x86_64.cc: Likewise.
10282
10283 2009-12-10  Doug Kwan  <dougkwan@google.com>
10284
10285         * arm.cc (attributes.h): New include.
10286         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
10287         (Arm_relobj::~Arm_relobj): Delete object pointed by
10288         attributes_section_data_.
10289         (Arm_relobj::attributes_section_data): New method definition.
10290         (Arm_relobj::attributes_section_data_): New data member declaration.
10291         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
10292         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
10293         attributes_section_data_.
10294         (Arm_dynobj::attributes_section_data): New method definition.
10295         (Arm_dynobj::attributes_section_data_): New data member declaration.
10296         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
10297         initialization value of may_use_blx_ to false.
10298         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
10299         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
10300         object attributes to compute results instead of hard-coding.
10301         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
10302         Target_arm::get_secondary_compatible_arch,
10303         Target_arm::set_secondary_compatible_arch
10304         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
10305         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
10306         New method declarations.
10307         (Target_arm::get_aeabi_object_attribute): New method definition.
10308         (Target_arm::attributes_section_data_): New data member declaration.
10309         (read_arm_attributes_section): New template definition.
10310         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
10311         (Arm_dynobj::do_read_symbols): Ditto.
10312         (Target_arm::do_finalize_sections): Merge attributes sections from
10313         input.  Check for BLX use after attributes section merging.
10314         Fix __exidx_start and __exidx_end visibility.  Create an
10315         .ARM.attributes section if necessary.
10316         (Target_arm::get_secondary_compatible_arch,
10317         Target_arm::set_secondary_compatible_arch,
10318         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
10319         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
10320         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
10321         New method definitions.
10322
10323 2009-12-09  Ian Lance Taylor  <iant@google.com>
10324
10325         * plugin.cc (Plugin::load): Don't cast from void* to a function
10326         pointer.
10327
10328 2009-12-09  Ian Lance Taylor  <iant@google.com>
10329
10330         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
10331         information fields.
10332
10333 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
10334
10335         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
10336         Replace two_file_shared_1.so with two_file_shared_2.so.
10337         * testsuite/Makefile.in: Regenerated.
10338
10339 2009-12-08  Doug Kwan  <dougkwan@google.com>
10340
10341         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
10342         (HFILES): Add attributes.h and int_encoding.h.
10343         * Makefile.in: Regenerate.
10344         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
10345         function definitions to int_encoding.cc
10346         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
10347         prototypes to int_encoding.h
10348         * reduced_debug_output.cc (int_encoding.h): New include.
10349         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
10350         function definitions to int_encoding.cc
10351         (insert_into_vector, read_from_pointer): Move template definitions to
10352         int_encoding.h
10353         * attributes.cc: New file.
10354         * attributes.h: New file.
10355         * int_encoding.cc: New file.
10356         * int_encoding.h: New file.
10357
10358 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
10359
10360         PR gold/11055
10361         * incremental-dump.cc (dump_incremental_inputs): New.
10362         (main): Use dump_incremental_inputs.
10363
10364 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
10365
10366         PR gold/10893
10367         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
10368         checking elfcpp::STT_FUNC.
10369         (Target_i386::Relocate::relocate): Likewise.
10370         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
10371
10372         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
10373         symbols from shared libraries into normal FUNC symbols.
10374
10375         * symtab.h (Symbol): Add is_func and use it.
10376
10377 2009-12-05  Doug Kwan  <dougkwan@google.com>
10378
10379         * arm.cc (Target_arm::arm_info): Initialize new fields
10380         attributes_section and attributes_vendor.
10381         * i386.cc (Target_i386::i386_info): Same.
10382         * object.cc (Sized_relobj::do_layout): Skip attribute section.
10383         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
10384         fields attributes_section and attributes_vendor.
10385         * sparc.cc (Target_sparc::sparc_info): Same.
10386         * target.h (Target::attributes_section, Target::attributes_vendor,
10387         Target::is_attributes_section, Target::attribute_arg_type,
10388         Target::attributes_order): New method definitions.
10389         (Target::Target_info::attributes_section,
10390         Target::Target_info::attributes_vendor): New fields.
10391         (Target::do_attribute_arg_type, Target::do_attributes_order): New
10392         virtual method definitions.
10393         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
10394         attributes_section and attributes_vendor.
10395         * testsuite/testfile.cc (Target_test::test_target_info): Same.
10396
10397 2009-12-05  Doug Kwan  <dougkwan@google.com>
10398
10399         * arm.cc: Update comments about interworking and stub generation.
10400         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
10401         considered as non-PIC.
10402         (Arm_relocate_functions::base_abs): Fix formatting.
10403         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
10404         of function to use GOT entry address instead of offset.
10405         (Target_arm::Scan::global): Issue an error if a symbol would need a
10406         PLT does not get one because it is untyped.  Remove code to create
10407         dynamic symbols for relative branches.
10408         (Target_arm::Relocate::relocate: Use 0 instead of false since function
10409         takes unsigned integer instead of boolean.
10410
10411 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
10412
10413         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
10414         (two_file_test_LDADD): Likewise.
10415         (common_test_1_LDADD): Likewise.
10416         (exception_test_LDADD) Likewise.
10417         (weak_test_LDADD): Likewise.
10418         (many_sections_test_LDADD): Likewise.
10419         (initpri1_LDADD): Likewise.
10420         (script_test_1_LDADD): Likewise.
10421         (script_test_2_LDADD): Likewise.
10422         (justsyms_LDADD): Likewise.
10423         (binary_test_LDADD): Likewise.
10424         (large_LDADD): Likewise.
10425         * testsuite/Makefile.in: Regenerated.
10426
10427 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
10428
10429         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
10430         (Symbol_table::override_with_special): Likewise.
10431         (Symbol_table::add_from_object): Likewise.
10432
10433 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
10434
10435         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
10436         Don't set the data_offset twice.
10437
10438 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
10439
10440         * testsuite/Makefile.in: Regenerate.
10441
10442 2009-12-03  Doug Kwan  <dougkwan@google.com>
10443
10444         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
10445         (Target_arm::do_finalize_sections): Add parameter for symbol table
10446         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
10447         * i386.cc (Target_i386::do_finalize_sections): Add an additional
10448         parameter for symbol table pointer.
10449         * layout.cc (Layout::finalize): Call Target::finalize_sections with
10450         an additional parameter for a pointer to symbol table.
10451         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
10452         parameter for a symbol table pointer.
10453         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
10454         * target.h (Target::finalize_sections, Target::do_finalize_sections):
10455         Ditto.
10456         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
10457         parameter for a symbol table pointer.
10458
10459 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
10460
10461         * incremental.cc (Incremental_inputs_header)
10462         (Incremental_inputs_header_write, Incremental_inputs_entry)
10463         (Incremental_inputs_entry_write): Move ...
10464         * incremental.h (Incremental_inputs_header)
10465         (Incremental_inputs_header_write, Incremental_inputs_entry)
10466         (Incremental_inputs_entry_write): here.
10467
10468 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10469
10470         * incremental.cc (make_sized_incremental_binary): Set the target.
10471         Error if it is incompatible.
10472         * output.h (Output_file): Add filename method.
10473
10474 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10475
10476         * incremental.cc (Incremental_inputs_entry): Remove unused argument
10477         from the get_* methods.
10478
10479 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10480
10481         * incremental-dump.cc (main): Check that the offeset of a script is 0.
10482         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
10483         Write 0 for the data_offset of scripts.
10484
10485 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10486
10487         * testsuite/Makefile.am: Add the incremental_test.sh test.
10488         * testsuite/incremental_test.sh: New.
10489         * testsuite/incremental_test_1.c: New.
10490         * testsuite/incremental_test_2.c: New.
10491
10492 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
10493
10494         * incremental-dump.cc (main): Fix typos.
10495
10496 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
10497
10498         PR gold/11025
10499         * incremental-dump.cc (main): Use llu to print 64 bit values.
10500
10501 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
10502             H.J. Lu  <hongjiu.lu@intel.com>
10503
10504         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
10505         $(LIBDL).
10506         (incremental_dump_LDADD): Likewise.
10507         * Makefile.in: Regenerated.
10508
10509 2009-11-25  Doug Kwan  <dougkwan@google.com>
10510
10511         Revert:
10512
10513         2009-11-25  Doug Kwan  <dougkwan@google.com>
10514
10515                 * arm.cc (Target_arm::Target_arm): Move method definition
10516                 outside of class definition.  Add code to handle
10517                 --target1-rel, --target1-abs and --target2= options.
10518                 (Target_arm::get_reloc_reloc_type): Change method to be
10519                 non-static and const.
10520                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
10521                 New data member declaration.
10522                 (Target_arm::Scan::local, Target_arm::Scan::global,
10523                 Target_arm::Relocate::relocate,
10524                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10525                 Adjust call to Target_arm::get_real_reloc_type.
10526                 (Target_arm::get_real_reloc_type): Use command line options
10527                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
10528                 * options.h (--target1-rel, --target1-abs, --target2): New
10529                 ARM-only options.
10530
10531 2009-11-25  Doug Kwan  <dougkwan@google.com>
10532
10533         * arm.cc (Target_arm::Target_arm): Move method definition outside of
10534         class definition.  Add code to handle --target1-rel, --target1-abs
10535         and --target2= options.
10536         (Target_arm::get_reloc_reloc_type): Change method to be non-static
10537         and const.
10538         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
10539         member declaration.
10540         (Target_arm::Scan::local, Target_arm::Scan::global,
10541         Target_arm::Relocate::relocate,
10542         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
10543         call to Target_arm::get_real_reloc_type.
10544         (Target_arm::get_real_reloc_type): Use command line options to
10545         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
10546         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
10547         options.
10548
10549 2009-11-25  Doug Kwan  <dougkwan@google.com>
10550
10551         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
10552         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
10553         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
10554         formatting.
10555         (Arm_relocate_functions::thm_call): Replace body with a call to
10556         Arm_relocate_functions::thumb_branch_common.
10557         (Arm_relocate_functions::thm_jump24,
10558         Arm_relocate_functions::thm_xpc22): New method definitions.
10559         (Arm_relocate_functions::thumb_branch_common): New method definition.
10560         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
10561         operator.
10562         (Target_arm::Relocate::relocate): Adjust call to thm_call.
10563         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
10564
10565 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
10566
10567         * Makefile.am: Build incremental-dump
10568         * Makefile.in: Regenerate.
10569         * incremental-dump.cc: New.
10570         * incremental.cc (Incremental_inputs_header_data,
10571         Incremental_inputs_entry_data): Move to incremental.h
10572         * incremental.h: (Incremental_inputs_header_data,
10573         Incremental_inputs_entry_data): Move from incremental.cc
10574
10575 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
10576
10577         * incremental.cc (Incremental_inputs_header,
10578         Incremental_inputs_header_write, Incremental_inputs_entry,
10579         Incremental_inputs_entry_write): Add a typedef with the data type.
10580
10581 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
10582
10583         * incremental.cc (Incremental_inputs_header,
10584         Incremental_inputs_header_write, Incremental_inputs_entry,
10585         Incremental_inputs_entry_write): Update comment about which
10586         type has the filed descriptions.
10587
10588 2009-11-15  Doug Kwan  <dougkwan@google.com>
10589
10590         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
10591         (Arm_relocate_functions::arm_branch_common): Change method defintion
10592         in class definition to a method declaration and update list of formal
10593         parameters.
10594         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
10595         Arm_relocation_functions::jump24): Adjust call to
10596         Arm_relocate_functions::arm_branch_common.  Update list of formal
10597         parameters.
10598         (Arm_relocate_functions::xpc25): New method definition.
10599         (Arm_relocate_functions::arm_branch_common): Move method defintion
10600         out from class definition.  Use stubs for mode-switching and extending
10601         branch ranges.
10602         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
10603         specially.  Change code to enable use of stubs in ARM branches.
10604
10605 2009-11-10  Doug Kwan  <dougkwan@google.com>
10606
10607         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
10608         in method declaration.
10609         (Target_arm::relocate_stub): New method declaration.
10610         (Target_arm::default_target): Change to return a pointer instead of
10611         a const reference.
10612         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
10613         Target_arm::default_target.
10614         (Arm_Relobj::do_relocate_sections): Remove options paramater in
10615         method definition.
10616         (Target_arm::relocate_section): Adjust view.
10617         (Target_arm::relocate_stub): New method definition.
10618
10619 2009-11-10  Doug Kwan  <dougkwan@google.com>
10620
10621         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
10622         a format warning.
10623         * incremental.cc (open_incremental_binary): Initialized local
10624         variables to avoid warnings.
10625         * object.cc (make_elf_object): Ditto.
10626         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
10627         a format warning.
10628
10629 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
10630
10631         PR gold/10930
10632         * testsuite/plugin_test.c: Include "config.h".
10633
10634 2009-11-09  Doug Kwan  <dougkwan@google.com>
10635
10636         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
10637         (arm_symbol_value): Remove.
10638         (Arm_relocate_functions::arm_branch_common,
10639         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
10640         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
10641         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
10642         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
10643         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
10644         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
10645         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
10646         Arm_relocate_functions::thm_mobw_abs_nc,
10647         Arm_relocate_functions::thm_mov_abs,
10648         Arm_relocate_functions::movw_prel_nc,
10649         Arm_relocate_functions::thm_movt_abs,
10650         Arm_relocate_functions::movt_prel,
10651         Arm_relocate_functions::thm_movw_prel_nc,
10652         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
10653         (Target_arm::Relocate::relocate): Only decompose address into two
10654         parts if relocation type uses the thumb-bit and pass the actual
10655         bit instead of a flag indicating that the thumb-bit is used.  Adjust
10656         calls to methods in Arm_relocate_functions for this change.
10657
10658 2009-11-08  Ian Lance Taylor  <iant@google.com>
10659
10660         PR 10925
10661         * reloc.cc: Instantiate
10662         Sized_relobj::initialize_input_to_output_maps and
10663         Sized_relobj:free_input_to_output_maps.
10664
10665 2009-11-06  Ian Lance Taylor  <iant@google.com>
10666
10667         PR 10876
10668         * defstd.cc (in_segment): Set only_if_ref true for "end".
10669
10670 2009-11-06  Doug Kwan  <dougkwan@google.com>
10671
10672         * arm.cc (class Reloc_stub): Correct a comment.
10673         (Target_arm::Target_arm): Initialize arm_input_section_map_.
10674         (Target_arm::scan_section_for_stubs): New method declaration.
10675         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
10676         Change methods from private to protected.
10677         (Target_arm::do_may_relax): New method definition.
10678         (Target_arm::do_relax, Target_arm::group_sections,
10679         Target_arm::scan_reloc_for_stub,
10680         Target_arm::scan_reloc_section_for_stubs): New method declarations.
10681         (Target_arm::arm_input_section_map_): New data member declaration.
10682         (Target_arm::scan_reloc_for_stub,
10683         Target_arm::scan_reloc_section_for_stubs,
10684         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
10685         Target_arm::do_relax): New method definitions.
10686
10687 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
10688
10689         * configure.ac: Check for (struct stat)::st_mtim
10690         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
10691         * config.in: Regenerate.
10692         * configure: Regenerate.
10693
10694 2009-11-05  Ian Lance Taylor  <iant@google.com>
10695
10696         PR 10910
10697         * output.cc (Output_segment::add_output_section): Add missing
10698         return statement.
10699
10700 2009-11-04  Ian Lance Taylor  <iant@google.com>
10701
10702         PR 10880
10703         * object.h (class Object): Add is_needed and set_is_needed
10704         methods.  Add is_needed_ field.  Make bool fields into bitfields.
10705         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
10706         defined in a dynamic object and referenced by a regular object,
10707         set is_needed for the dynamic object.
10708         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
10709         if the file is marked with as_needed and it is not needed.
10710
10711 2009-11-04  Ian Lance Taylor  <iant@google.com>
10712
10713         PR 10887
10714         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
10715         tags if data is discarded by linker script.
10716         * i386.cc (Target_i386::do_finalize_sections): Likewise.
10717         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
10718         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
10719         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
10720
10721 2009-11-04  Ian Lance Taylor  <iant@google.com>
10722
10723         * layout.cc (Layout::get_output_section): Add is_interp and
10724         is_dynamic_linker_section parameters.  Change all callers.
10725         (Layout::choose_output_section): Likewise.
10726         (Layout::make_output_section): Likewise.
10727         (Layout::add_output_section_data): Add is_dynamic_linker_section
10728         parameter.  Change all callers.
10729         * layout.h (class Layout): Update declarations.
10730         * output.h (class Output_section): Add is_interp, set_is_interp,
10731         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
10732         Add is_interp_, is_dynamic_linker_section_ fields.  Change
10733         generate_code_fills_at_write_ to a bitfield.
10734         * output.cc (Output_section::Output_sections): Initialize new
10735         fields.
10736         (Output_segment::add_output_section): Add do_sort parameter.
10737         Change all callers.
10738
10739 2009-11-03  Ian Lance Taylor  <iant@google.com>
10740
10741         PR 10860
10742         * options.h (class General_options): Add --warn-common.
10743         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
10744         merging two common symbols.
10745         (Symbol_table::should_override): Handle --warn-common when merging
10746         a common symbol with a defined symbol.  Use report_resolve_problem
10747         for multiple definitions.
10748         (Symbol_table::report_resolve_problem): New function.
10749         * symtab.h (class Symbol_table): Declare report_resolve_problem.
10750
10751 2009-11-03  Doug Kwan  <dougkwan@google.com>
10752
10753         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
10754         stub_factory_.
10755         (Target_arm::stub_factory): New method definition.
10756         (Target_arm::new_arm_input_section,
10757         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
10758         Target_arm::reloc_uses_thumb_bit): New method declarations.
10759         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
10760         New type definitions.
10761         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
10762         member declarations.
10763         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
10764         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
10765         New method definitions.
10766
10767 2009-11-03  Ian Lance Taylor  <iant@google.com>
10768
10769         * options.h (class General_options): Add --warn_constructors.
10770
10771 2009-11-03  Ian Lance Taylor  <iant@google.com>
10772
10773         PR 10893
10774         * defstd.cc (in_section): Add entries for __rel_iplt_start,
10775         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
10776
10777 2009-11-03  Ian Lance Taylor  <iant@google.com>
10778
10779         PR 10895
10780         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
10781         --msgid-bugs-address.
10782         (install-pdf): New target.
10783         (install-data_yes): Look up one directory to find mkinstalldirs.
10784
10785 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
10786
10787         * po/Make-in (.po.gmo): Don't generate .gmo files in source
10788         tree.
10789
10790 2009-10-30  Doug Kwan  <dougkwan@google.com>
10791
10792         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
10793
10794 2009-10-30  Doug Kwan  <dougkwan@google.com>
10795
10796         * arm.cc (Stub_addend_reader): New struct template definition
10797         and partial specializations.
10798         (Stub_addend_reader::operator()): New method definition for a
10799         partially specialized template.
10800
10801 2009-10-30  Doug Kwan  <dougkwan@google.com>
10802
10803         * arm.cc (Arm_relobj::processor_specific_flags): New method
10804         definition.
10805         (Arm_relobj::do_read_symbols): New method declaration.
10806         (Arm_relobj::processor_specific_flags_): New data member declaration.
10807         (Arm_dynobj): New class definition.
10808         (Target_arm::do_finalize_sections): Add input_objects parameter.
10809         (Target_arm::do_adjust_elf_header): New method declaration.
10810         (Target_arm::are_eabi_versions_compatible,
10811         (Target_arm::merge_processor_specific_flags): New method declaration.
10812         (Target_arm::do_make_elf_object): New overloaded method definitions
10813         and declaration.
10814         (Arm_relobj::do_read_symbols): New method definition.
10815         (Arm_dynobj::do_read_symbols): Ditto.
10816         (Target_arm::do_finalize_sections): Add input_objects parameters.
10817         Merge processor-specific flags from all input objects.
10818         (Target_arm::are_eabi_versions_compatible,
10819         Target_arm::merge_processor_specific_flags,
10820         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
10821         New method definitions.
10822         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
10823         Input_objects pointer type parameter.
10824         * layout.cc (Layout::finalize): Pass input objects to target's.
10825         finalize_sections function.
10826         * output.cc (Output_file_header::do_sized_write): Set ELF file
10827         header's processor-specific flags.
10828         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
10829         Input_objects pointer type parameter.
10830         * sparc.cc (Target_sparc::do_finalize_sections): Same.
10831         * target.h (Input_objects): New forward class declaration.
10832         (Target::processor_specific_flags,
10833         Target::are_processor_specific_flags_sect): New method definitions.
10834         (Target::finalize_sections): Add input_objects parameter.
10835         (Target::Target): Initialize processor_specific_flags_ and
10836         are_processor_specific_flags_set_.
10837         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
10838         parameter.
10839         (Target::set_processor_specific_flags): New method definition.
10840         (Target::processor_specific_flags_,
10841         Target::are_processor_specific_flags_set_): New data member
10842         declarations.
10843         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
10844         Input_objects pointer type parameter.
10845
10846 2009-10-30  Doug Kwan  <dougkwan@google.com>
10847
10848         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
10849
10850 2009-10-28  Ian Lance Taylor  <iant@google.com>
10851
10852         * object.h (class Relobj): Drop options parameter from
10853         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
10854         do_scan_relocs, do_relocate.  Change all callers.
10855         (class Sized_relobj): Drop options parameters from
10856         do_gc_process_relocs, do_scan_relocs, do_relocate,
10857         do_relocate_sections, relocate_sections, emit_relocs_scan,
10858         emit_relocs_scan_reltype.  Change all callers.
10859         (struct Relocate_info): Remove options field and all references to
10860         it.
10861         * reloc.h (class Read_relocs): Remove options constructor
10862         parameter and options_ field.  Change all callers.
10863         (class Gc_process_relocs, class Scan_relocs): Likewise.
10864         (class Relocate_task): Likewise.
10865         * target-reloc.h (scan_relocs): Remove options parameter.  Change
10866         all callers.
10867         (scan_relocatable_relocs): Likewise.
10868         * target.h (class Sized_target): Remove options parameter from
10869         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
10870         all callers.
10871         * gc.h (gc_process_relocs): Remove options parameter.  Change all
10872         callers.
10873         * arm.cc: Update functions to remove options parameters.
10874         * i386.cc: Likewise.
10875         * powerpc.cc: Likewise.
10876         * sparc.cc: Likewise.
10877         * x86_64.cc: Likewise.
10878         * testsuite/testfile.cc: Likewise.
10879
10880 2009-10-28  Doug Kwan  <dougkwan@google.com>
10881
10882         * arm.cc (Arm_relobj): New class definition.
10883         (Arm_relobj::scan_sections_for_stubs,
10884         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
10885         New method definitions.
10886
10887 2009-10-28  Cary Coutant  <ccoutant@google.com>
10888
10889         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
10890         (Plugin::cleanup_done_): New member.
10891         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
10892         (Plugin_manager::cleanup_done_): Remove.
10893         (Plugin_manager::add_input_file): Edit error message.
10894         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
10895         (Plugin_manager::cleanup): Remove use of cleanup_done_.
10896
10897 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
10898
10899         * fileread.cc: (File_read::View::~View): Use the new
10900         data_ownership_ filed.
10901         (File_read::~File_read): Dispose the new whole_file_view_.
10902         (File_read::open): Mmap the whole file if needed.
10903         (File_read::open): Use whole_file_view_ instead of contents_.
10904         (File_read::find_view): Use whole_file_view_ if applicable.
10905         (File_read::do_read): Use whole_file_view_ instead of contents_.
10906         (File_read::make_view): Use whole_file_view_ instead of contents_,
10907         update File_read::View::View call.
10908         (File_read::find_or_make_view): Update File_read::View::View
10909         call.
10910         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
10911         remove contents_
10912         (File_read::View::Data_ownership): New enum.
10913         (File_read::View::View): Replace bool mapped_ with Data_ownership
10914         argument.
10915         (File_read::View::mapped_): Remove (replaced by data_ownership_).
10916         (File_read::View::data_ownership_): New field.
10917         (File_read::contents_): Remove (replaced by whole_file_view_).
10918         (File_read::whole_file_view_): New field.
10919         * options.h (class General_options): Add --keep-files-mapped.
10920
10921 2009-10-27  Cary Coutant  <ccoutant@google.com>
10922
10923         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
10924         * testsuite/Makefile.am (plugin_test_5): New test case.
10925         * testsuite/Makefile.in: Regenerate.
10926
10927 2009-10-25  Doug Kwan  <dougkwan@google.com>
10928
10929         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
10930         from private to protected to allow access by child class.
10931         (Sized_relobj::do_relocate_sections): New method declaration.
10932         (Sized_relobj::relocate_sections): Virtualize.
10933         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
10934         Sized_relobj::relocate_sections.  Instantiate template explicitly
10935         for different target sizes and endianity.
10936
10937 2009-10-24  Doug Kwan  <dougkwan@google.com>
10938
10939         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
10940         (Arm_input_section::as_arm_input_section): New method.
10941         (Arm_output_section): New class definition.
10942         (Arm_output_section::create_stub_group,
10943         Arm_output_section::group_sections): New method definitions.
10944
10945 2009-10-22  Doug Kwan  <dougkwan@google.com>
10946
10947         * arm.cc (Arm_input_section): New class definition.
10948         (Arm_input_section::init, Arm_input_section:do_write,
10949         Arm_input_section::set_final_data_size,
10950         Arm_input_section::do_reset_address_and_file_offset): New method
10951         definitions.
10952
10953 2009-10-21  Doug Kwan  <dougkwan@google.com>
10954
10955         * arm.cc (Stub_table, Arm_input_section): New forward class
10956         declarations.
10957         (Stub_table): New class defintion.
10958         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
10959         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
10960         New method definition.
10961
10962 2009-10-21  Doug Kwan  <dougkwan@google.com>
10963
10964         * arm.cc: Update copyright comments.
10965         (Target_arm): New forward class template declaration.
10966         (Arm_address): New type.
10967         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
10968         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
10969         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
10970         constants.
10971         (Insn_template): Same.
10972         (DEF_STUBS): New macro.
10973         (Stub_type): New enum type.
10974         (Stub_template): New class definition.
10975         (Stub): Same.
10976         (Reloc_stub): Same.
10977         (Stub_factory): Same.
10978         (Target_arm::Target_arm): Initialize may_use_blx_ and
10979         should_force_pic_veneer_.
10980         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
10981         Target_arm::should_force_pic_veneer,
10982         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
10983         Target_arm::using_thumb_only, Target_arm:;default_target): New
10984         method defintions.
10985         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
10986         New data member declarations.
10987         (Insn_template::size, Insn_template::alignment): New method defintions.
10988         (Stub_template::Stub_template): New method definition.
10989         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
10990         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
10991         (Stub_factory::Stub_factory): New method definition.
10992         * gold.h (string_hash): New template.
10993         * output.h (Input_section_specifier::hash_value): Use
10994         gold::string_hash.
10995         (Input_section_specifier::string_hash): Remove.
10996         * stringpool.cc (Stringpool_template::string_hash): Use
10997         gold::string_hash.
10998
10999 2009-10-20  Doug Kwan  <dougkwan@google.com>
11000
11001         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
11002         symbols of relaxed input sections.
11003         * output.h (Output_section::find_relaxed_input_section): Make
11004         method public.
11005
11006 2009-10-16  Doug Kwan  <dougkwan@google.com>
11007
11008         * dynobj.cc (Versions::Versions): Initialize version_script_.
11009         Only insert base version symbol definition for a shared object
11010         if version script defines any version versions.
11011         (Versions::define_base_version): New method definition.
11012         (Versions::add_def): Check that base version is not needed.
11013         (Versions::add_need): Define base version lazily.
11014         * dynobj.h (Versions::define_base_version): New method declaration.
11015         (Versions::needs_base_version_): New data member declaration.
11016         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
11017         (check_DATA): Add no_version_test.stdout.
11018         (libno_version_test.so, no_version_test.o no_version_test.stdout):
11019         New make rules.
11020         * testsuite/Makefile.in: Regenerate.
11021         * testsuite/no_version_test.c: New file.
11022         * testsuite/no_version_test.sh: Ditto.
11023
11024 2009-10-16  Doug Kwan  <dougkwan@google.com>
11025
11026         * expression.cc (class Segment_start_expression): New class definition.
11027         (Segment_start_expression::value): New method definition.
11028         (script_exp_function_segment_start): Return a new
11029         Segment_start_expression.
11030         * gold/script-c.h (script_saw_segment_start_expression): New function
11031         prototype.
11032         * script-sections.cc (Script_sections::Script_sections): Initialize
11033         SAW_SEGMENT_START_EXPRESSION_ to false.
11034         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
11035         and -Tbbs options to specify section addresses if given in
11036         command line and no SEGMENT_START expression is seen in a script.
11037         * script-sections.h (Script_sections::saw_segment_start_expression,
11038         Script_sections::set_saw_segment_start_expression): New method
11039         definition.
11040         (Script_sections::saw_segment_start_expression_): New data member
11041         declaration.
11042         * script.cc (script_saw_segment_start_expression): New function.
11043         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
11044         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
11045         script_test_7.sh and script_test_8.sh.
11046         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
11047         script_test_8.stdout.
11048         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
11049         (script_test_6, script_test_6.stdout, script_test_7,
11050         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
11051         * Makefile.in: Regenerate.
11052         * testsuite/script_test_6.sh: New file.
11053         * testsuite/script_test_6.t: Same.
11054         * testsuite/script_test_7.sh: Same.
11055         * testsuite/script_test_7.t: Same.
11056         * testsuite/script_test_8.sh: Same.
11057
11058 2009-10-16  Doug Kwan  <dougkwan@google.com>
11059
11060         * output.cc (Output_segment::set_section_list_address): Cast
11061         expressions to unsigned long long type to avoid format warnings.
11062
11063 2009-10-15  Ian Lance Taylor  <iant@google.com>
11064
11065         * script.cc (Script_options::add_symbol_assignment): Always add a
11066         dot assignment to script_sections_.
11067         * script-sections.cc (Script_sections::add_dot_assignment):
11068         Initialize if necessary.
11069
11070         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
11071         program headers with no load segment if there is a linker script.
11072
11073         * layout.cc (Layout::set_segment_offsets): Align the file offset
11074         to the segment aligment for -N or -n with no load segment.
11075         * output.cc (Output_segment::add_output_section): Don't crash if
11076         the first section is a TLS section.
11077         (Output_segment::set_section_list_addresses): Print an error
11078         message if the address moves backward in a linker script.
11079         * script-sections.cc
11080         (Output_section_element_input::set_section_addresses): Don't
11081         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
11082         (Orphan_output_section::set_section_addresses): Likewise.
11083
11084 2009-10-15  Doug Kwan  <dougkwan@google.com>
11085
11086         * layout.cc (Layout::finish_dynamic_section): Generate tags
11087         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
11088         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
11089         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
11090
11091 2009-10-14  Ian Lance Taylor  <iant@google.com>
11092
11093         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
11094         fields.
11095         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
11096         data_shdr fields of relinfo.
11097         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
11098         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
11099         R_386_TLS_LDO_32, adjust based on section flags.
11100         (Target_i386::Relocate::fix_up_ldo): Remove.
11101
11102 2009-10-13  Ian Lance Taylor  <iant@google.com>
11103
11104         Add support for -pie.
11105         * options.h (class General_options): Add -pie and
11106         --pic-executable.
11107         (General_options::output_is_position_independent): Test -pie.
11108         (General_options::output_is_executable): Return true if not shared
11109         and not relocatable.
11110         (General_options::output_is_pie): Remove.
11111         * options.cc (General_options::finalize): Reject incompatible uses
11112         of -pie.
11113         * gold.cc (queue_middle_tasks): A -pie link is not static.
11114         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
11115         * symtab.cc (Symbol::final_value_is_known): Return false if
11116         output_is_position_independent.
11117         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
11118         output_is_position_independent.
11119         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
11120         output_is_position_independent.
11121         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
11122         output_is_position_independent.
11123         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
11124         two_file_pie_test.
11125         (basic_pie_test.o, basic_pie_test): New targets.
11126         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
11127         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
11128         (two_file_pie_test): New target.
11129         * testsuite/Makefile.in: Rebuild.
11130         * README: Remove note saying that -pie is not supported.
11131
11132 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
11133
11134         * options.h (class General_options): Add -init and -fini.
11135         * layout.cc (Layout::finish_dynamic_section): Emit
11136         given init and fini functions.
11137
11138 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
11139
11140         * gc.h (gc_process_relocs): Check if icf is enabled using new
11141         function.
11142         * gold.cc (queue_initial_tasks): Likewise.
11143         (queue_middle_tasks): Likewise.
11144         * object.cc (do_layout): Likewise.
11145         * symtab.cc (is_section_folded): Likewise.
11146         * main.cc (main): Likewise.
11147         * reloc.cc (Read_relocs::run): Likewise.
11148         (Sized_relobj::do_scan_relocs): Likewise.
11149         * icf.cc (is_function_ctor_or_dtor): New function.
11150         (Icf::find_identical_sections): Check if function is ctor or dtor when
11151         safe icf is chosen.
11152         * options.h (General_options::icf): Change option to be an enum.
11153         (Icf_status): New enum.
11154         (icf_enabled): New method.
11155         (icf_safe_folding): New method.
11156         (set_icf_status): New method.
11157         (icf_status_): New variable.
11158         * (options.cc) (General_options::finalize): Set icf_status_.
11159         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
11160         icf_test and icf_keep_unique_test to use the --icf enum flag.
11161         * testsuite/icf_safe_test.sh: New file.
11162         * testsuite/icf_safe_test.cc: New file.
11163
11164 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
11165
11166         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
11167         includes to gc.h and icf.h.
11168         * arm.cc: Include gc.h.
11169         * gold.cc: Likewise.
11170         * i386.cc: Likewise.
11171         * powerpc.cc: Likewise.
11172         * sparc.cc: Likewise.
11173         * x86_64.cc: Likewise.
11174         * gc.h: Include icf.h.
11175
11176 2009-10-11  Ian Lance Taylor  <iant@google.com>
11177
11178         * plugin.cc: Include "gold.h" before other header files.
11179
11180 2009-10-10  Chris Demetriou  <cgd@google.com>
11181
11182         * options.h (Input_file_argument::Input_file_type): New enum.
11183         (Input_file_argument::is_lib_): Replace with...
11184         (Input_file_argument::type_): New member.
11185         (Input_file_argument::Input_file_argument): Take Input_file_type
11186         'type' rather than boolean 'is_lib' as second argument.
11187         (Input_file_argument::is_lib): Use type_.
11188         (Input_file_argument::is_searched_file): New function.
11189         (Input_file_argument::may_need_search): Handle is_searched_file.
11190         * options.cc (General_options::parse_library): Support -l:filename.
11191         (General_options::parse_just_symbols): Update for Input_file_argument
11192         changes.
11193         (Command_line::process): Likewise.
11194         * archive.cc (Archive::get_file_and_offset): Likewise.
11195         * plugin.cc (Plugin_manager::release_input_file): Likewise.
11196         * script.cc (read_script_file, script_add_file): Likewise.
11197         * fileread.cc (Input_file::Input_file): Likewise.
11198         (Input_file::will_search_for): Handle is_searched_file.
11199         (Input_file::open): Likewise.
11200         * readsyms.cc (Read_symbols::get_name): Likewise.
11201         * testsuite/Makefile.am (searched_file_test): New test.
11202         * testsuite/Makefile.in: Regenerate.
11203         * testsuite/searched_file_test.cc: New file.
11204         * testsuite/searched_file_test_lib.cc: New file.
11205
11206 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11207             Ian Lance Taylor  <iant@google.com>
11208
11209         * descriptor.cc: Include <cstdio> and "binary-io.h".
11210         (Descriptors::open): Open the files in binary mode always.
11211         * script.cc (Lex::get_token): Treat \r as whitespace.
11212
11213 2009-10-09  Ian Lance Taylor  <iant@google.com>
11214
11215         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
11216
11217 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11218             Ian Lance Taylor  <iant@google.com>
11219
11220         * configure.ac: Check for readv function also.
11221         * fileread.cc (readv): Define if not HAVE_READV.
11222         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
11223         does not exist.
11224         * config.in: Regenerate.
11225         * configure: Regenerate.
11226
11227 2009-10-09  Doug Kwan  <dougkwan@google.com>
11228
11229         * layout.cc (Layout::make_output_section): Call target hook to make
11230         ordinary output section.
11231         (Layout::finalize): Adjust parameter list of call the
11232         Target::may_relax().
11233         * layout.h (class Layout::section_list): New method.
11234         * merge.h (Output_merge_base::entsize): Change visibility to public.
11235         (Output_merge_base::is_string, Output_merge_base::do_is_string):
11236         New methods.
11237         (Output_merge_string::do_is_string): New method.
11238         * object.cc (Sized_relobj::do_setup): renamed from
11239         Sized_relobj::set_up.
11240         * object.h (Sized_relobj::adjust_shndx,
11241         Sized_relobj::initializ_input_to_output_maps,
11242         Sized_relobj::free_input_to_output_maps): Change visibilities to
11243         protected.
11244         (Sized_relobj::setup): Virtualize.
11245         (Sized_relobj::do_setup): New method declaration.
11246         (Sized_relobj::invalidate_section_offset,
11247         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
11248         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
11249         * options.cc (parse_int): New function.
11250         * options.h (parse_int): New declaration.
11251         (DEFINE_int): New macro.
11252         (stub_group_size): New option.
11253         * output.cc (Output_section::Output_section): Initialize memebers
11254         merge_section_map_, merge_section_by_properties_map_,
11255         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
11256         (Output_section::add_input_section): Handled deferred code-fill
11257         generation and remove an old comment.
11258         (Output_section::add_relaxed_input_section): New method definition.
11259         (Output_section::add_merge_input_section): Use merge section by
11260         properties map to speed to search.  Update merge section maps
11261         as appropriate.
11262         (Output_section::build_relaxation_map): New method definition.
11263         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
11264         Same.
11265         (Output_section::relax_input_section): Renamed to
11266         Output_section::convert_input_sections_to_relaxed_sections and change
11267         interface to take a vector of pointers to relaxed sections.
11268         (Output_section::find_merge_section,
11269         Output_section::find_relaxed_input_section): New method definitions.
11270         (Output_section::is_input_address_mapped,
11271         Output_section::output_offset, Output_section::output_address):
11272         Use output section data maps to speed up searching.
11273         (Output_section::find_starting_output_address): Add comments.
11274         (Output_section::do_write,
11275         Output_section::write_to_postprocessing_buffer): Do code-fill
11276         generation as appropriate.
11277         (Output_section::get_input_sections): Invalidate relaxed input section
11278         map.
11279         (Output_section::restore_states): Adjust type of checkpoint .
11280         Invalidate relaxed input section map.
11281         * output.h (Output_merge_base): New class declaration.
11282         (Input_section_specifier): New class defintion.
11283         (class Output_relaxed_input_section) Change base class to
11284         Output_section_data_build.
11285         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
11286         base class initializer.
11287         (Output_section::add_relaxed_input_section): New method declaration.
11288         (Output_section::Input_section): Change visibility to protected.
11289         (Output_section::Input_section::relobj,
11290         Output_section::Input_section::shndx): Handle relaxed input sections.
11291         Output_section::input_sections) Change visibility to protected.  Also
11292         define overload to return a non-const pointer.
11293         (Output_section::Merge_section_properties): New class defintion.
11294         (Output_section::Merge_section_by_properties_map,
11295         Output_section::Output_section_data_by_input_section_map,
11296         Output_section::Relaxation_map): New types.
11297         (Output_section::relax_input_section): Rename method to
11298         Output_section::convert_input_sections_to_relaxed_sections and change
11299         interface to take a vector of relaxed section pointers.
11300         (Output_section::find_merge_section,
11301         Output_section::find_relaxed_input_section,
11302         Output_section::build_relaxation_map,
11303         Output_section::convert_input_sections_in_list_to_relaxed_sections):
11304         New method declarations.
11305         (Output_section::merge_section_map_
11306         Output_section::merge_section_by_properties_map_,
11307         Output_section::relaxed_input_section_map_,
11308         Output_section::is_relaxed_input_section_map_valid_,
11309         Output_section::generate_code_fills_at_write_): New data members.
11310         * script-sections.cc
11311         (Output_section_element_input::set_section_addresses): Call
11312         current_data_size and addralign methods of relaxed input sections.
11313         (Orphan_output_section::set_section_addresses): Call current_data_size
11314         and addralign methods of relaxed input sections.
11315         * symtab.cc (Symbol_table::compute_final_value): Extract template
11316         from the body of Symbol_table::sized_finalize_symbol.
11317         (Symbol_table::sized_finalized_symbol): Call
11318         Symbol_table::compute_final_value.
11319         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
11320         (Symbol_table::compute_final_value): New templated method declaration.
11321         * target.cc (Target::do_make_output_section): New method defintion.
11322         * target.h (Target::make_output_section): New method declaration.
11323         (Target::relax): Add more parameters for input objects, symbol table
11324         and layout.  Adjust call to do_relax.
11325         (Target::do_make_output_section): New method declaration.
11326         (Target::do_relax): Add parameters for input objects, symbol table
11327         and layout.
11328
11329 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11330
11331         * pread.c: Include stdio.h.
11332
11333 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11334
11335         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
11336         defined.
11337
11338 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11339
11340         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
11341         Change read_shndx type to unsigned int.
11342         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
11343         int.
11344         (Sized_dwarf_line_info::read_line_mappings): Likewise.
11345         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
11346         Change read_shndx type to unsigned int.
11347         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
11348         int.
11349         (Sized_dwarf_line_info::read_line_mappings): Likewise.
11350         * layout.cc (Layout::create_symtab_sections): Cast the result of
11351         local_symcount * symsize to off_t in the gold_assert.
11352
11353 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11354
11355         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
11356         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
11357         R_ARM_BASE_ABS.
11358         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
11359         (Arm_relocate_functions::thm_abs5): New function.
11360         (Arm_relocate_functions::abs12): New function.
11361         (Arm_relocate_functions::abs16): New function.
11362         (Arm_relocate_functions::base_abs): New function.
11363         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
11364         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
11365         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
11366         R_ARM_BASE_ABS.
11367         (Scan::global): Likewise.
11368         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
11369         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
11370         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
11371         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
11372         R_ARM_BASE_ABS.
11373
11374 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11375
11376         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
11377         (Arm_relocate_functions::movt_prel): New function.
11378         (Arm_relocate_functions::thm_movw_prel_nc): New function.
11379         (Arm_relocate_functions::thm_movt_prel): New function.
11380         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
11381         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
11382         (Scan::global, Relocate::relocate): Likewise.
11383         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11384
11385 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
11386
11387         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
11388         Incremental_checker.
11389         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
11390         unsigned int.
11391         (class Incremental_inputs_header): New class.
11392         (Incremental_inputs_header_writer): Edit comment.
11393         (Incremental_inputs_entry): New class.
11394         (Incremental_inputs_entry_writer): Edit comment.
11395         (Sized_incremental_binary::do_find_incremental_inputs_section):
11396         Add *strtab_shndx parameter, fill it.
11397         (Sized_incremental_binary::do_check_inputs): New method.
11398         (Incremental_checker::can_incrementally_link_output_file): Use
11399         Sized_incremental_binary::check_inputs.
11400         (Incremental_inputs::report_command_line): Save command line in
11401         command_line_.
11402         * incremental.h:
11403         (Incremental_binary::find_incremental_inputs_section): New
11404         method.
11405         (Incremental_binary::do_find_incremental_inputs_section): Add
11406         strtab_shndx parameter.
11407         (Incremental_binary::do_check_inputs): New pure virtual method.
11408         (Sized_incremental_binary::do_check_inputs): Declare.
11409         (Incremental_checker::Incremental_checker): Add incremental_inputs
11410         parameter, use it to initialize incremental_inputs_.
11411         (Incremental_checker::incremental_inputs_): New field.
11412         (Incremental_checker::command_line): New method.
11413         (Incremental_checker::inputs): New method.
11414         (Incremental_checker::command_line_): New field.
11415
11416 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
11417
11418         * incremental.cc: Include <cstdarg> and "target-select.h".
11419         (vexplain_no_incremental): New function.
11420         (explain_no_incremental): New function.
11421         (Incremental_binary::error): New method.
11422         (Sized_incremental_binary::do_find_incremental_inputs_section): New
11423         method.
11424         (make_sized_incremental_binary): New function.
11425         (open_incremental_binary): New function.
11426         (can_incrementally_link_file): Add checks if output is ELF and has
11427         inputs section.
11428         * incremental.h: Include "elfcpp_file.h" and "output.h".
11429         (Incremental_binary): New class.
11430         (Sized_incremental_binary): New class.
11431         (open_incremental_binary): Declare.
11432         * object.cc (is_elf_object): Use
11433         elfcpp::Elf_recognizer::is_elf_file.
11434         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
11435         * output.h (Output_file::filesize): New method.
11436
11437 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11438
11439         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
11440         New function.
11441         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
11442         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
11443         function.
11444         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
11445         function.
11446         (Arm_relocate_functions::movw_abs_nc): New function.
11447         (Arm_relocate_functions::movt_abs): New function.
11448         (Arm_relocate_functions::thm_movw_abs_nc): New function.
11449         (Arm_relocate_functions::thm_movt_abs): New function.
11450         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
11451         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
11452         (Scan::global): Likewise.
11453         (Relocate::relocate): Likewise.
11454         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11455
11456 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11457
11458         * arm.cc (Arm_relocate_functions::got_prel) New function.
11459         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
11460         (Relocate::relocate): Likewise.
11461         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11462
11463 2009-10-06  Ian Lance Taylor  <iant@google.com>
11464
11465         * options.h (class General_options): Define
11466         split_stack_adjust_size parameter.
11467         * object.h (class Object): Add uses_split_stack_ and
11468         has_no_split_stack_ fields.  Add uses_split_stack and
11469         has_no_split_stack accessor functions.  Declare
11470         handle_split_stack_section.
11471         (class Reloc_symbol_changes): Define.
11472         (class Sized_relobj): Define Function_offsets.  Declare
11473         split_stack_adjust, split_stack_adjust_reltype, and
11474         find_functions.
11475         * object.cc (Object::handle_split_stack_section): New function.
11476         (Sized_relobj::do_layout): Call handle_split_stack_section.
11477         * dynobj.cc (Sized_dynobj::do_layout): Call
11478         handle_split_stack_section.
11479         * reloc.cc (Sized_relobj::relocate_sections): Call
11480         split_stack_adjust for executable sections in split_stack
11481         objects.  Pass reloc_map to relocate_section.
11482         (Sized_relobj::split_stack_adjust): New function.
11483         (Sized_relobj::split_stack_adjust_reltype): New function.
11484         (Sized_relobj::find_functions): New function.
11485         * target-reloc.h: Include "object.h".
11486         (relocate_section): Add reloc_symbol_changes parameter.  Change
11487         all callers.
11488         * target.h (class Target): Add calls_non_split method.  Declare
11489         do_calls_non_split virtual method.  Declare match_view and
11490         set_view_to_nop.
11491         * target.cc: Include "elfcpp.h".
11492         (Target::do_calls_non_split): New function.
11493         (Target::match_view): New function.
11494         (Target::set_view_to_nop): New function.
11495         * gold.cc (queue_middle_tasks): Give an error if mixing
11496         split-stack and non-split-stack objects with -r.
11497         * i386.cc (Target_i386::relocate_section): Add
11498         reloc_symbol_changes parameter.
11499         (Target_i386::do_calls_non_split): New function.
11500         * x86_64.cc (Target_x86_64::relocate_section): Add
11501         reloc_symbol_changes parameter.
11502         (Target_x86_64::do_calls_non_split): New function.
11503         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
11504         parameter.
11505         * powerpc.cc (Target_powerpc::relocate_section): Add
11506         reloc_symbol_changes parameter.
11507         * sparc.cc (Target_sparc::relocate_section): Add
11508         reloc_symbol_changes parameter.
11509         * configure.ac: Call AM_CONDITIONAL for the default target.
11510         * configure: Rebuild.
11511         * testsuite/Makefile.am (TEST_AS): New variable.
11512         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
11513         (check_DATA): Add split_i386 and split_x86_64 files.
11514         (SPLIT_DEFSYMS): Define.
11515         (split_i386_[1234n].o): New targets.
11516         (split_i386_[124]): New targets.
11517         (split_i386_[1234r].stdout): New targets.
11518         (split_x86_64_[1234n].o): New targets.
11519         (split_x86_64_[124]): New targets.
11520         (split_x86_64_[1234r].stdout): New targets.
11521         (MOSTLYCLEANFILES): Add new executables.
11522         * testsuite/split_i386.sh: New file.
11523         * testsuite/split_x86_64.sh: New file.
11524         * testsuite/split_i386_1.s: New file.
11525         * testsuite/split_i386_2.s: New file.
11526         * testsuite/split_i386_3.s: New file.
11527         * testsuite/split_i386_4.s: New file.
11528         * testsuite/split_i386_n.s: New file.
11529         * testsuite/split_x86_64_1.s: New file.
11530         * testsuite/split_x86_64_2.s: New file.
11531         * testsuite/split_x86_64_3.s: New file.
11532         * testsuite/split_x86_64_4.s: New file.
11533         * testsuite/split_x86_64_n.s: New file.
11534         * testsuite/testfile.cc (Target_test): Update relocation_section
11535         function.
11536         * testsuite/Makefile.in: Rebuild.
11537
11538 2009-10-06  Ian Lance Taylor  <iant@google.com>
11539
11540         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
11541         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
11542         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
11543         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
11544         the address on ldo_addrs_.
11545         (Target_i386::Relocate::fix_up_ldo): New function.
11546
11547 2009-10-06   Rafael Espindola  <espindola@google.com>
11548
11549         * plugin.cc (add_input_library): New.
11550         (Plugin::load): Add add_input_library to tv.
11551         (Plugin_manager::add_input_file): Add the is_lib argument.
11552         (add_input_file): Update call to Plugin_manager::add_input_file.
11553         (add_input_library): New.
11554         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
11555
11556 2009-09-30  Doug Kwan  <dougkwan@google.com>
11557
11558         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
11559         symbol and call Symbol::may_need_copy_reloc to determine if
11560         a copy reloc is needed.
11561         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
11562         nocopyreloc is given in command line.
11563         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
11564         given in command line.
11565         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
11566         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
11567         of the removed Target_i386::may_need_copy_reloc.
11568         * options.h (copyreloc): New option with default value false.
11569         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
11570         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
11571         instead of the removed Target_powerpc::may_need_copy_reloc.
11572         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
11573         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
11574         instead of the removed Target_sparc::may_need_copy_reloc.
11575         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
11576         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
11577         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
11578         instead of the removed Target_x86_64::may_need_copy_reloc.
11579
11580 2009-09-30  Ian Lance Taylor  <iant@google.com>
11581
11582         * object.h (class Object): Remove target_ field, and target,
11583         sized_target, and set_target methods.
11584         (Object::sized_target): Remove.
11585         (class Sized_relobj): Update declarations.  Remove sized_target.
11586         * object.cc (Sized_relobj::setup): Remove target parameter.
11587         Change all callers.
11588         (Input_objects::add_object): Don't do anything with the target.
11589         (make_elf_sized_object): Add punconfigured parameter.  Change all
11590         callers.  Set or test parameter target.
11591         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
11592         Change all callers.
11593         * parameters.cc (Parameters::set_target): Change parameter type to
11594         be non-const.
11595         (Parameters::default_target): Remove.
11596         (set_parameters_target): Change parameter type to be non-const.
11597         (parameters_force_valid_target): New function.
11598         (parameters_clear_target): New function.
11599         * parameters.h (class Parameters): Update declarations.  Remove
11600         default_target method.  Add sized_target and clear_target
11601         methods.  Change target_ to be non-const.
11602         (set_parameters_target): Update declaration.
11603         (parameters_force_valid_target): Declare.
11604         (parameters_clear_target): Declare.
11605         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
11606         as NULL if we aren't searching.
11607         (Add_symbols::run): Don't check for compatible target.
11608         * fileread.cc (Input_file::open_binary): Call
11609         parameters_force_valid_target.
11610         * gold.cc (queue_middle_tasks): Likewise.
11611         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
11612         set_target on object.
11613         * dynobj.h (class Sized_dynobj): Update declarations.
11614         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
11615         make_elf_object returns NULL.
11616         (Archive::include_member): Don't check whether object target is
11617         compatible.
11618         * output.cc (Output_section::add_input_section): Get target from
11619         parameters.
11620         (Output_section::relax_input_section): Likewise.
11621         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
11622         parameters.
11623         (Sized_relobj::do_scan_relocs): Likewise.
11624         (Sized_relobj::relocate_sections): Likewise.
11625         * resolve.cc (Symbol_table::resolve): Likewise.
11626         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
11627         parameter.  Change all callers.
11628         (Symbol_table::add_from_object): Get target from parameters.
11629         (Symbol_table::add_from_relobj): Don't check object target.
11630         (Symbol_table::add_from_dynobj): Likewise.
11631         (Symbol_table::define_special_symbol): Get target from
11632         parameters.
11633         * symtab.h (class Symbol_table): Update declaration.
11634         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
11635         parameter.  Change all callers.  Clear parameter target.
11636         (Binary_test): Test target here.
11637         * testsuite/object_unittest.cc (gold_testsuite): Remove
11638         target_test_pointer parameter.  Change all callers.
11639         (Object_test): Test target here.
11640
11641 2009-09-26  Ian Lance Taylor  <iant@google.com>
11642
11643         * testsuite/initpri1.c: Don't try to use constructor priorities if
11644         compiling with gcc before 4.3.
11645
11646 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
11647
11648         * testsuite/retain_symbols_file_test.sh (check_present): Change
11649         output file name to retain_symbols_file_test.stdout.
11650         (check_absent): Likewise.
11651
11652 2009-09-18  Craig Silverstein  <csilvers@google.com>
11653
11654         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
11655         * options.cc: Include <cerrno> and <fstream>.
11656         (General_options::finalize): Parse -retain-symbols-file tag.
11657         * options.h: New flag.
11658         (General_options): New method should_retain_symbol, new
11659         variable symbols_to_retain.
11660         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
11661         should_retain_symbol map.
11662         * testsuite/Makefile.am (retain_symbols_file_test): New test.
11663         * testsuite/Makefile.in: Regenerate.
11664         * testsuite/retain_symbols_file_test.sh: New file.
11665
11666 2009-09-18  Nick Clifton  <nickc@redhat.com>
11667
11668         * po/es.po: Updated Spanish translation.
11669
11670 2009-09-17  Doug Kwan  <dougkwan@google.com>
11671
11672         * debug.h (DEBUG_RELAXATION): New constant.
11673         (DEBUG_ALL): Add DEBUG_RELAXATION.
11674         (debug_string_to_enum): Add relaxation debug option.
11675         * layout.cc
11676         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
11677         Layout::Relaxation_debug_check::read_sections,
11678         Layout::Relaxation_debug_check::read_sections): New method definitions.
11679         (Layout::Layout): Initialize data members
11680         record_output_section_data_from_scrips_,
11681         script_output_section_data_list_ and relaxation_debug_check_.
11682         (Layout::save_segments, Layout::restore_segments,
11683         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
11684         Layout::relaxation_loop_body): New method definitions.
11685         (Layout::finalize): Support relaxation.  Move section layout code to
11686         Layout::relaxation_loop_body.
11687         (Layout::set_asection_address_from_script): Move code for orphan
11688         section placement out.
11689         (Layout::place_orphan_sections_in_script): New method definition.
11690         * layout.h (Output_segment_headers, Output_file_header):
11691         New forward class declarations.
11692         (Layout::~Layout): Define.
11693         (Layout::new_output_section_data_from_script): New method definition.
11694         (Layout::place_orphan_sections_in_script): New method declaration.
11695         (Layout::Segment_states): New type declaration.
11696         (Layout::save_segments, Layout::restore_segments,
11697         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
11698         Layout::relaxation_loop_body): New method declarations.
11699         (Layout::Output_section_data_list): New type declaration.
11700         (Layout::Relaxation_debug_check): New class definition.
11701         (Layout::record_output_section_data_from_script_,
11702         Layout::script_output_section_data_list_, Layout::segment_states_,
11703         Layout::relaxation_debug_check_): New data members.
11704         * output.cc: (Output_section_headers::do_size): New method definition.
11705         (Output_section_headers::Output_section_headers): Move size
11706         computation to Output_section_headers::do_size.
11707         (Output_segment_headers::do_size): New method definition.
11708         (Output_file_header::Output_file_header): Move size computation to
11709         Output_file_header::do_size and call it.
11710         (Output_file_header::do_size): New method definition.
11711         (Output_data_group::Output_data_group): Adjust call to
11712         Output_section_data.
11713         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
11714         (Output_symtab_xindex::do_write): Add array bound check.
11715         (Output_section::Input_section::print_to_mapfile): Handle
11716         RELAXED_INPUT_SECTION_CODE.
11717         (Output_section::Output_section): Initialize data member checkpoint_.
11718         (Output_section::~Output_section): Delete checkpoint object pointed
11719         by checkpoint_.
11720         (Output_section::add_input_section): Always add an Input_section if
11721         relaxing.
11722         (Output_section::add_merge_input_section): Add assert.
11723         (Output_section::relax_input_section): New method definition.
11724         (Output_section::set_final_data_size): Set load address to zero for
11725         an unallocated section.
11726         (Output_section::do_address_and_file_offset_have_reset_values):
11727         New method definition.
11728         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
11729         Handle relaxed input section.
11730         (Output_section::sort_attached_input_sections): Checkpoint input
11731         section list lazily.
11732         (Output_section::get_input_sections): Change type of input_sections to
11733         list of Simple_input_section pointers.  Checkpoint input section list
11734         lazily.  Also handle relaxed input sections.
11735         (Output_section::add_input_section_for_script): Take a reference to
11736         a Simple_input_section object instead of Relobj pointer and section
11737         index as parameter.  Handle relaxed input sections.
11738         (Output_section::save_states, Output_section::restore_states): New
11739         method definitions.
11740         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
11741         (Output_data::is_data_size_fixed): New method definition.
11742         (Output_data::reset_addresss_and_file_offset): Do not reset data size
11743         if it is fixed.
11744         (Output_data::address_and_file_offset_have_reset_values): New method
11745         definition.
11746         (Output_data::do_address_and_file_offset_have_reset_values): New method
11747         definition.
11748         (Output_data::set_data_size): Check that data size is not fixed.
11749         (Output_data::fix_data_size): New method definition.
11750         (Output_data::is_data_size_fixed_): New data member.
11751         (Output_section_headers::set_final_data_size): New method definition.
11752         (Output_section_headers::do_size): New method declaration.
11753         (Output_segment_headers::set_final_data_size): New method definition.
11754         (Output_segment_headers::do_size): New method declaration.
11755         (Output_file_header::set_final_data_size)::New method definition.
11756         (Output_file_header::do_size)::New method declaration.
11757         (Output_section_data::Output_section_data): Add new parameter
11758         is_data_size_fixed and use it to fix data size.
11759         (Output_data_const::Output_data_const): Adjust call to base class
11760         constructor and fix data size.
11761         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
11762         base class constructor and fix data size.
11763         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
11764         base class constructor and fix data size.
11765         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
11766         class constructor and fix data size.
11767         (Output_data_group::set_final_data_size): New method definition.
11768         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
11769         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
11770         class constructor and fix data size.
11771         (Output_relaxed_input_section): New class definition.
11772         (Output_section::Simple_input_section): New class definition.
11773         (Output_section::get_input_sections): Adjust parameter list.
11774         (Output_section::add_input_section_for_script): Same.
11775         (Output_section::save_states, Output_section::restore_states,
11776         Output_section::do_address_and_file_offset_have_reset_values,
11777         (Output_section::Input_section::Input_section): Handle
11778         RELAXED_INPUT_SECTION_CODE.  Add new overload for
11779         Output_relaxed_input_section.
11780         (Output_section::Input_section::is_input_section,
11781         Output_section::Input_section::set_output_section): Handle relaxed
11782         input section.
11783         (Output_section::Input_section::is_relaxed_input_section,
11784         Output_section::Input_section::output_section_data,
11785         Output_section::Input_section::relaxed_input_section): New method
11786         definitions.
11787         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
11788         value.
11789         (Output_section::Input_section::u1_): Update comments.
11790         (Output_section::Input_section::u2_): Add new union member poris.
11791         (Output_section::Checkpoint_output_section): New classs definition.
11792         (Output_section::relax_input_section): New method declaration.
11793         (Output_section::checkpoint_): New data member.
11794         (Output_segment): Update comments.
11795         (Output_segment::Output_segment): Un-privatize copy constructor.
11796         (Output_segment::operator=): Un-privatize.
11797         * script-sections.cc (Output_section_element::Input_section_list):
11798         Change element type to Output_section::Simple_input_section.
11799         (Output_section_element_dot_assignment::set_section_addresses):
11800         Register output section data for relaxation clean up.
11801         (Output_data_exression::Output_data_expression): Adjust call to base
11802         constructor to fix data size.
11803         (Output_section_element_data::set_section_addresses): Register
11804         Output_data_expression object for relaxation clean up.
11805         (struct Input_section_info): Replace Relobj pointer and section index
11806         pair with Output_section::Simple_input_section and Convert struct to a
11807         class.
11808         (Input_section_sorter::operator()): Adjust access to
11809         Input_section_info data member to use accessors.
11810         (Output_section_element_input::set_section_addresses): Use layout
11811         parameter.  Adjust code to use Output_section::Simple_input_section
11812         and Input_secction_info classes.  Register filler for relaxation
11813         clean up.
11814         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
11815         and section index pair with Output_section::Simple_input_section
11816         class.  Adjust code accordingly.
11817         (Phdrs_element::release_segment): New method definition.
11818         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
11819         segment list.
11820         (Script_sections::release_segments): New method definition.
11821         * gold/script-sections.h (Script_sections::release_segments): New
11822         method declaration.
11823         * gold/target.h (Target::may_relax, Target::relax,
11824         Target::do_may_relax, Target::do_relax): New method definitions.
11825
11826 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11827
11828         * arm.cc (has_signed_unsigned_overflow): New function.
11829         (Arm_relocate_functions::abs8): New function.
11830         (Target_arm::Scan::local): Handle R_ARM_ABS8.
11831         (Target_arm::Scan::global): Likewise.
11832         (Target_arm::relocate::relocate): Likewise.
11833         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
11834         Likewise.
11835
11836 2009-09-16  Cary Coutant  <ccoutant@google.com>
11837
11838         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
11839         * testsuite/Makefile.in: Regenerate.
11840
11841 2009-09-11  Nick Clifton  <nickc@redhat.com>
11842
11843         * po/gold.pot: Updated by the Translation project.
11844
11845 2009-09-08  Cary Coutant  <ccoutant@google.com>
11846
11847         * output.cc (Output_file::open): Add execute permission to empty file.
11848         * testsuite/Makefile.am (permission_test): New test.
11849         * testsuite/Makefile.in: Regenerate.
11850
11851 2009-09-02  Ian Lance Taylor  <iant@google.com>
11852
11853         * output.cc (Output_file::resize): Call map_no_anonymous rather
11854         than map.
11855
11856 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
11857
11858         * gold.cc: Include "incremental.h".
11859         (queue_initial_tasks): Call Incremental_checker methods.
11860         * incremental.cc: Include "output.h".
11861         (Incremental_checker::can_incrementally_link_output_file): New
11862         method.
11863         * incremental.h (Incremental_checker): New class.
11864
11865         * output.cc (Output_file::open_for_modification): New method.
11866         (Output_file::map_anonymous): Changed return type to bool.  Record
11867         map in base_ field.
11868         (Output_file::map_no_anonymous): New method, broken out of map.
11869         (Output_file::map): Use map_no_anonymous and map_anonymous.
11870         * output.h (class Output_file): Update declarations.
11871
11872 2009-08-24  Cary Coutant  <ccoutant@google.com>
11873
11874         * options.h (Command_line::Pre_options): New class.
11875         (Command_line::pre_options): New member.
11876         * options.cc (gold::options::ready_to_register): New variable.
11877         (One_option::register_option): Do nothing if not registering options.
11878         Assert if same short option registered twice.
11879         (General_options::General_options): Turn off option registration when
11880         done constructing.
11881         (Command_line::Pre_options::Pre_options): New constructor.
11882
11883 2009-08-24  Cary Coutant  <ccoutant@google.com>
11884
11885         * options.h (General_options::no_keep_memory): Remove incorrect
11886         short option.
11887
11888 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
11889
11890         * Makefile.am (am__skiplex, am__skipyacc): New.
11891         * Makefile.in: Regenerate.
11892
11893 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
11894
11895         * Makefile.am (AM_CPPFLAGS): Renamed from ...
11896         (INCLUDES): ... this.
11897         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
11898         (AM_CPPFLAGS): Renamed from ...
11899         (INCLUDE): ... this.
11900         * Makefile.in, testsuite/Makefile.in: Regenerate.
11901
11902         * Makefile.in: Regenerate.
11903         * aclocal.m4: Likewise.
11904         * config.in: Likewise.
11905         * configure: Likewise.
11906         * testsuite/Makefile.in: Likewise.
11907
11908         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
11909         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
11910         * Makefile.in: Regenerate.
11911         * testsuite/Makefile.in: Regenerate.
11912
11913 2009-08-19  Cary Coutant  <ccoutant@google.com>
11914
11915         * resolve.cc (Symbol_table::resolve): Don't complain about defined
11916         symbols in shared libraries overridden by hidden or internal symbols
11917         in the main program.
11918
11919 2009-08-19  Chris Demetriou  <cgd@google.com>
11920
11921         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
11922         checking source file names in error messages.
11923
11924 2009-08-18  Doug Kwan  <dougkwan@google.com>
11925
11926         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
11927         an elcpp::Ehdr as parameter.  Adjust call to set_target.
11928         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
11929         an elfcpp::Ehdr as parameter.
11930         * object.cc (Object::set_target): Remove the version that looks up
11931         a target and sets it.
11932         (Sized_relobj::setup): Take a Target object instead of
11933         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
11934         (make_elf_sized_object): Find target and ask target to
11935         make an ELF object.
11936         * object.h: (Object::set_target): Remove the version that looks up
11937         a target and sets it.
11938         (Sized_relobj::setup): Take a Target object instead of
11939         an elfcpp:Ehdr as parameter.
11940         * target.cc: Include dynobj.h.
11941         (Target::do_make_elf_object_implementation): New.
11942         (Target::do_make_elf_object): New.
11943         * target.h (Target::make_elf_object): New template declaration.
11944         (Target::do_make_elf_object): New method declarations.
11945         (Target::do_make_elf_object_implementation): New template declaration.
11946
11947 2009-08-14  Ian Lance Taylor  <iant@google.com>
11948
11949         * gold.h (FUNCTION_NAME): Define.
11950         (gold_unreachable): Use FUNCTION_NAME.
11951
11952 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
11953
11954         * icf.cc (Icf::find_identical_sections): Issue a warning when a
11955         symbol in the --keep-unique list is not found.
11956
11957 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
11958
11959         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
11960         been maked as --keep-unique.
11961         (Icf::unfold_section): New function.
11962         * icf.h (Icf::unfold_section): New function.
11963         * options.h (General_options::keep_unique): New option.
11964         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
11965         * testsuite/Makefile.in: Regenerate.
11966         * testsuite/icf_keep_unique_test.sh: New file.
11967         * testsuite/icf_keep_unique_test.cc: New file.
11968
11969 2009-08-12  Cary Coutant  <ccoutant@google.com>
11970
11971         PR 10471
11972         * resolve.cc (Symbol_table::resolve): Check for references from
11973         dynamic objects to hidden and internal symbols.
11974         * testsuite/Makefile.am (hidden_test.sh): New test.
11975         * testsuite/Makefile.in: Regenerate.
11976         * testsuite/hidden_test.sh: New script.
11977         * testsuite/hidden_test_1.c: New test source.
11978         * testsuite/hidden_test_main.c: New test source.
11979
11980 2009-08-11  Doug Kwan  <dougkwan@google.com>
11981
11982         * arm.cc: Update comments.
11983         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
11984         segment to locate the .ARM.exidx section if present.
11985
11986 2009-08-09  Doug Kwan  <dougkwan@google.com>
11987
11988         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
11989         patch.
11990
11991 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
11992         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
11993         compiler warnings.
11994
11995 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
11996
11997         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
11998         valid tls_segment only for non-debug-section relocations.
11999         * testsuite/Makefile.am: Add gc_tls_test.
12000         * testsuite/Makefile.in: Regenerate.
12001         * testsuite/gc_tls_test.cc: New file.
12002         * testsuite/gc_tls_test.sh: New file.
12003
12004 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
12005
12006         * icf.cc: New file.
12007         * icf.h: New file.
12008         * Makefile.am (CCFILES): Add icf.cc.
12009         (HFILES): Add icf.h
12010         * Makefile.in: Regenerate.
12011         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
12012         * gc.h (gc_process_relocs): Populate lists used by icf to contain
12013         section, symbol and addend information for the relocs.
12014         * gold.cc (queue_middle_tasks): Call identical code folding.
12015         * gold.h: Add defines for multimap.
12016         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
12017         to the call of finalize_local_symbols.
12018         * main.cc (main): Create object of class Icf.
12019         * object.cc (Sized_relobj::do_layout): Allow this function to be
12020         called twice during icf.
12021         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
12022         to sections marked as identical by icf.
12023         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
12024         when available.
12025         (Sized_relobj::do_section_entsize): New function.
12026         * object.h (Object::section_entsize): New function.
12027         (Object::do_section_entsize): New pure virtual function.
12028         (Relobj::finalize_local_symbols): Add new parameter.
12029         (Relobj::do_section_entsize): New function.
12030         * options.h (General_options::icf): New option.
12031         (General_options::icf_iterations): New option.
12032         (General_options::print_icf_sections): New option.
12033         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
12034         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
12035         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
12036         icf.
12037         * symtab.cc (Symbol_table::is_section_folded): New function.
12038         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
12039         to sections marked as identical by icf.
12040         * symtab.h (Symbol_table::set_icf): New function.
12041         (Symbol_table::icf): New function.
12042         (Symbol_table::is_section_folded): New function.
12043         (Symbol_table::icf_): New data member.
12044         * target-reloc.h (relocate_section): Ignore sections folded by icf.
12045         * testsuite/Makefile.am: Add commands to build icf_test.
12046         * testsuite/Makefile.in: Regenerate.
12047         * testsuite/icf_test.sh: New file.
12048         * testsuite/icf_test.cc: New file.
12049
12050 2009-07-24  Chris Demetriou  <cgd@google.com>
12051
12052         * layout.cc (is_compressible_debug_section): Fix incorrect
12053         comment about compressed section names.
12054
12055 2009-07-20  Ian Lance Taylor  <ian@airs.com>
12056
12057         PR 10419
12058         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
12059
12060 2009-07-16  Ian Lance Taylor  <iant@google.com>
12061
12062         PR 10400
12063         * layout.h: #include <map>.
12064         (class Kept_section): Change from struct to class.  Add accessors
12065         and setters.  Add section size to Comdat_group mapping.  Change
12066         Comdat_group to std::map.  Add is_comdat_ field.  Add
12067         linkonce_size field in union.
12068         (class Layout): Update declaration of find_or_add_kept_section.
12069         Don't declare find_kept_object.
12070         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
12071         parameter.  Add object, shndx, is_comdat, and is_group_name
12072         parameters.  Change all callers.  Adjust for new Kept_section.
12073         (Layout::find_kept_object): Remove.
12074         * object.cc (Sized_relobj::include_section_group): Update use of
12075         Kept_section.  Rename secnum to shndx.  Only record
12076         Kept_comdat_section if sections are the same size.
12077         (Sized_relobj::include_linkonce_section): Update use of
12078         Kept_section.  Only record Kept_comdat_section if sections are the
12079         same size.  Set size of linkonce section.
12080         (Sized_relobj::map_to_kept_section): Update call to
12081         get_kept_comdat_section.
12082         * object.h (class Sized_relobj): Rename fields in
12083         Kept_comdat_section to drop trailing underscores; change object
12084         field to Relobj*.  Change Kept_comdat_section_table to store
12085         struct rather than pointer.
12086         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
12087         Add kept_object and kept_shndx parameters.  Change all callers.
12088         (Sized_relobj::get_kept_comdat_section): Change return type to
12089         bool.  Add kept_object and kept_shndx parameters.  Change all
12090         callers.
12091         * plugin.cc (Pluginobj::include_comdat_group): Update call to
12092         Layout::find_or_add_kept_section.
12093
12094 2009-07-09  Ian Lance Taylor  <iant@google.com>
12095
12096         * merge.cc (Object_merge_map::initialize_input_to_output_map):
12097         Reserve space in the hash table.
12098
12099 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
12100
12101         * fileread.cc (File_read::get_mtime): New method.
12102         * fileread.h (Timespec): New structure.
12103         (File_read::get_mtime): New method.
12104         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
12105         Renamed from timestamp_nsec.
12106         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
12107         Elf_Xword.
12108         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
12109         timestamp_nsec.
12110         (Incremental_inputs::report_archive): Save mtime; style fix.
12111         (Incremental_inputs::report_obejct): Save mtime; style fix.
12112         (Incremental_inputs::report_script): Save mtime; style fix.
12113         (Incremental_inputs::finalize_inputs): Style fix.
12114         (Incremental_inputs::finalize): Style fix.
12115         (Incremental_inputs::create_input_section_data): Store inputs
12116         mtime.
12117         * incremental.h (Incremental_inputs::report_script): Add mtime
12118         argument.
12119         (Incremental_inputs::Input_info::Input_info): Intialize only one
12120         union member.
12121         (Incremental_inputs::Input_info::archive): Move to nameless
12122         union.
12123         (Incremental_inputs::Input_info::obejct): Move to nameless union.
12124         (Incremental_inputs::Input_info::script): Move to nameless union.
12125         (Incremental_inputs::mtime): New field.
12126         * script.cc (read_input_script): Pass file mtime to
12127         Incremental_input.
12128         * script.h (Script_info::inputs): Style fix.
12129
12130 2009-07-01  Ian Lance Taylor  <ian@airs.com>
12131
12132         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
12133         instead of 32.
12134
12135 2009-06-24  Ian Lance Taylor  <iant@google.com>
12136
12137         PR 10156
12138         * layout.cc (Layout::choose_output_section): If we find an
12139         existing section, update the flags.
12140         (Layout::create_notes): New function, broken out of
12141         Layout::finalize.
12142         (Layout::finalize): Don't create note sections.
12143         (Layout::create_note): Don't crash if linker script discards
12144         section.
12145         (Layout::create_gold_note): Likewise.
12146         (Layout::create_build_id): Likewise.  Don't set
12147         after_input_sections on the section.
12148         (Layout::create_executable_stack_info): Remove target parameter.
12149         Change caller.
12150         * layout.h (class Layout): Declare create_notes.  Update
12151         declaration of create_executable_stack_info.
12152         * gold.cc (queue_middle_tasks): Call create_notes.
12153         * output.cc (Output_section::update_flags_for_input_section): Move
12154         here from output.h.  If SHF_ALLOC flag is newly set, mark address
12155         invalid.
12156         * output.h (Output_data::mark_address_invalid): New function.
12157         (class Output_section): Only declare, not define,
12158         update_flags_for_input_section.  Remove set_flags.
12159
12160 2009-06-24  Ian Lance Taylor  <iant@google.com>
12161
12162         * script-sections.cc (Output_section_definition::
12163         set_section_addresses): Rename shadowing local load_address to
12164         laddr.
12165
12166 2009-06-24  Ian Lance Taylor  <iant@google.com>
12167
12168         PR 10244
12169         * reloc.cc (relocate_sections): Skip empty relocation sections.
12170
12171 2009-06-23  Ian Lance Taylor  <iant@google.com>
12172
12173         PR 10156
12174         * layout.cc (Layout::create_note): Use choose_output_section
12175         rather than make_output_section.
12176
12177 2009-06-23  Ian Lance Taylor  <iant@google.com>
12178
12179         PR 10237
12180         * options.cc (General_options::parse_V): Set printed_version_.
12181         (General_options::General_options): Initialize printed_version_.
12182         * options.h (class General_options): Add printed_version_ field.
12183         * gold.cc (queue_initial_tasks): If there are no input files,
12184         don't give a fatal error if we printed the version information.
12185         (queue_middle_tasks): If using -r with a shared object, give a
12186         fatal error rather than an ordinary error.
12187
12188 2009-06-23  Ian Lance Taylor  <iant@google.com>
12189
12190         PR 10219
12191         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
12192         (Layout::make_output_section): Set have_stabstr_section_ if we see
12193         a .stab*str section.
12194         (Layout::finalize): Call link_stabs_sections.
12195         (Layout::link_stabs_sections): New file.
12196         * layout.h (class Layout): Add have_stabstr_section_ field.
12197         Declare link_stabs_sections.
12198
12199 2009-06-23  Doug Kwan  <dougkwan@google.com>
12200
12201         * Makefile.am (libgold_a_LIBADD): New.
12202         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
12203         * Makefile.in: Regenerate.
12204         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
12205         * configure: Regenerate.
12206         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
12207         * fileread.cc: Include sys/state.h
12208         * gold.h: Declare memmem and strndup if found missing.
12209         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
12210
12211 2009-06-23  Ian Lance Taylor  <iant@google.com>
12212
12213         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
12214         * configure: Rebuild.
12215
12216 2009-06-23  Ian Lance Taylor  <iant@google.com>
12217
12218         PR 10147
12219         * object.cc (Object::section_contents): Don't try to get a view if
12220         the section has length zero.
12221         (Object::handle_gnu_warning_section): If the section is empty, use
12222         the name of the section as the warning.
12223
12224 2009-06-23  Ian Lance Taylor  <iant@google.com>
12225
12226         PR 10133
12227         * stringpool.h (class Stringpool_template): Add optimize_ field.
12228         (Stringpool_template::set_optimize): New function.
12229         * stringpool.cc (Stringpool_template::Stringpool_template):
12230         Initialize optimize_ field.
12231         (Stringpool_template::set_string_offsets): Test local optimize
12232         fild rather than parameter.
12233         * layout.cc (Layout::Layout): Call set_optimize on the section
12234         name stringpool.
12235
12236 2009-06-22  Ian Lance Taylor  <iant@google.com>
12237
12238         PR 10030
12239         * yyscript.y: Parse TARGET.
12240         * script.cc (script_set_target): New function.
12241         * script-c.h (script_set_target): Declare.
12242         * options.cc (General_options::string_to_object_format): Rename
12243         from string_to_object_format in anonymous namespace.  Change
12244         callers.
12245         * options.h (class General_options): Declare
12246         string_to_object_format.
12247
12248 2009-06-22  Ian Lance Taylor  <iant@google.com>
12249
12250         * script-sections.cc (Script_sections::create_segments): Don't put
12251         program headers in a PT_LOAD segment if -n or -N.
12252
12253 2009-06-22  Ian Lance Taylor  <iant@google.com>
12254
12255         PR 10141
12256         * options.h (class General_options): Add -z lazy and -z now.  Sort
12257         -z options into alphabetical order.
12258         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
12259
12260 2009-06-21  Ian Lance Taylor  <iant@google.com>
12261
12262         * layout.cc (Layout::make_output_section): Call
12263         Target::new_output_section.
12264         (Layout::attach_allocated_section_to_segment): Put large section
12265         sections in a separate load segment with the large segment flag
12266         set.
12267         (Layout::segment_precedes): Sort large data segments after other
12268         load segments.
12269         (align_file_offset): New static function.
12270         (Layout::set_segment_offsets): Use align_file_offset.
12271         * output.h (class Output_section): Add is_small_section_ and
12272         is_large_section_ fields.
12273         (Output_section::is_small_section): New function.
12274         (Output_section::set_is_small_section):  New function.
12275         (Output_section::is_large_section): New function.
12276         (Output_section::set_is_large_section): New function.
12277         (Output_section::is_large_data_section): New function.
12278         (class Output_segment): Add is_large_data_segment_ field.
12279         (Output_segment::is_large_data_segment): New function.
12280         (Output_segment::set_is_large_data_segment): New function.
12281         * output.cc (Output_section::Output_section): Initialize new
12282         fields.
12283         (Output_segment::Output_segment): Likewise.
12284         (Output_segment::add_output_section): Add assertion that large
12285         data sections always go in large data segments.  Force small data
12286         sections to the end of the list of data sections.  Force small BSS
12287         sections to the start of the list of BSS sections.  For large BSS
12288         sections to the end of the list of BSS sections.
12289         * symtab.h (class Symbol): Declare is_common_shndx.
12290         (Symbol::is_defined): Check Symbol::is_common_shndx.
12291         (Symbol::is_common): Likewise.
12292         (class Symbol_table): Define enum Commons_section_type.  Update
12293         declarations.  Add small_commons_ and large_commons_ fields.
12294         * symtab.cc (Symbol::is_common_shndx): New function.
12295         (Symbol_table::Symbol_table): Initialize new fields.
12296         (Symbol_table::add_from_object): Put small and large common
12297         symbols in the right list.
12298         (Symbol_table::sized_finalized_symbol): Check
12299         Symbol::is_common_shndx.
12300         (Symbol_table::sized_write_globals): Likewise.
12301         * common.cc (Symbol_table::do_allocate_commons): Allocate new
12302         common symbol lists.  Don't call do_allocate_commons_list if the
12303         list is empty.
12304         (Symbol_table::do_allocate_commons_list): Remove is_tls
12305         parameter.  Add comons_section_type parameter.  Change all
12306         callers.  Handle small and large common symbols.
12307         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
12308         Symbol::is_common_shndx.
12309         * resolve.cc (symbol_to_bits): Likewise.
12310         * target.h (Target::small_common_shndx): New function.
12311         (Target::small_common_section_flags): New function.
12312         (Target::large_common_shndx): New function.
12313         (Target::large_common_section_flags): New function.
12314         (Target::new_output_section): New function.
12315         (Target::Target_info): Add small_common_shndx, large_common_shndx,
12316         small_common_section_flags, and large_common_section_flags
12317         fields.
12318         (Target::do_new_output_section): New virtual function.
12319         * arm.cc (Target_arm::arm_info): Initialize new fields.
12320         * i386.cc (Target_i386::i386_info): Likewise.
12321         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
12322         Likewise.
12323         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
12324         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
12325         (Target_x86_64::do_new_output_section): New function.
12326         * configure.ac: Define conditional MCMODEL_MEDIUM.
12327         * testsuite/Makefile.am (check_PROGRAMS): Add large.
12328         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
12329         (large_LDFLAGS): Define.
12330         * testsuite/large.c: New file.
12331         * testsuite/testfile.cc (Target_test::test_target_info):
12332         Initialize new fields.
12333         * configure, testsuite/Makefile.in: Rebuild.
12334
12335 2009-06-05  Doug Kwan  <dougkwan@google.com>
12336
12337         * Makefile.am (CCFILES): Add target.cc.
12338         * Makefile.in: Regenerate.
12339         * i386.cc (class Target_i386): Define new virtual method to
12340         override do_is_local_label_name in parent.
12341         * object.cc (Sized_relobj::do_count_local_symbols): Discard
12342         local symbols if --discard-locals or -X is given.
12343         * options.h (class General_options): Declare new options
12344         '--discard-locals' and '-X' for discarding locals.
12345         * target.h (class Target): Define new methods is_local_label_name.
12346         Declare new virtual method do_is_local_label_name.
12347         * target.cc: New file.
12348         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
12349         (check_SCRIPTS): Add discard_locals_test.sh.
12350         (check_DATA): Add discard_local_tests.syms.
12351         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
12352         (discard_local_tests.syms, discard_locals_test.o): New make rules.
12353         * testsuite/Makefile.in: Regenerate.
12354         * testsuite/discard_locals_test.c: New file.
12355         * testsuite/discard_locals_test.sh: Same.
12356
12357 2009-06-05  Doug Kwan  <dougkwan@google.com>
12358
12359         * object.cc (Sized_relobj::Sized_relobj): Initialize
12360         discarded_eh_frame_shndx_ to -1U.
12361         (Sized_relobj::do_layout): Record index of a discard .eh_frame
12362         section.
12363         (Sized_relobj::do_count_local_symbols): Skip local symbols in
12364         a discarded .eh_frame section.
12365         (Sized_relobj::do_finalize_local_symbols): Ditto.
12366         * object.h (class Sized_relobj): Declare new member
12367         discarded_eh_frame_shndx_.
12368         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
12369         (local_labels_test.o, local_labels_test): New rules.
12370         * testsuite/Makefile.in: Regenerate.
12371
12372 2009-06-04  Doug Kwan  <dougkwan@google.com>
12373
12374         * layout.cc (Layout::section_name_mapping): Add mapping for
12375         special ARM sections.
12376
12377 2009-06-03  Doug Kwan  <dougkwan@google.com>
12378
12379         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
12380         (utils::has_overflow): Same.
12381
12382 2009-06-03  Ian Lance Taylor  <iant@google.com>
12383
12384         * layout.cc (Layout::section_name_mapping): New array, replacing
12385         Layout::linkonce_mapping.
12386         (Layout::section_name_mapping_count): New variable, replacing
12387         Layout::linkonce_mapping_count.
12388         (Layout::linkonce_output_name): Remove.
12389         (Layout::output_section_name): Rewrite.
12390         * layout.h (class Layout): Rename Linkonce_mapping to
12391         Section_name_mapping, linkonce_mapping to section_name_mapping,
12392         linkonce_mapping_count to section_name_mapping_count.  Don't
12393         declare linkonce_output_name.
12394
12395 2009-06-03  Doug Kwan  <dougkwan@google.com>
12396
12397         * gold/arm.cc (namespace utils): New.
12398         (Target_arm::reloc_is_non_pic): Define new method.
12399         (class Arm_relocate_functions): New.
12400         (Target_arm::Relocate::relocate): Handle relocation types used by
12401         Android.
12402
12403 2009-06-03  Ian Lance Taylor  <iant@google.com>
12404
12405         * arm.cc (Target_arm::scan::global): Use || instead of |.
12406
12407 2009-06-02  Doug Kwan  <dougkwan@google.com>
12408
12409         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
12410         issued_non_pic_error_.
12411         (class Target_arm::Scan): Declare new method check_non_pic.
12412         Define new method symbol_needs_plt_entry.
12413         Declare new data member issued_non_pic_error_.
12414         (class Target_arm::Relocate): Declare new method
12415         should_apply_static_reloc.
12416         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
12417         (Target_arm::Scan::check_non_pic): Define new method.
12418         (Target_arm::Scan::local): Handle a small subset of reloc types used
12419         by Android.
12420         (Target_arm::Scan::local): Same.
12421         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
12422
12423 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
12424
12425         * incremental.cc (Incremental_inputs::report_command_line): Filter
12426         out --incremental-* options.
12427
12428 2009-05-29  Doug Kwan  <dougkwan@google.com>
12429
12430         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
12431         template class.
12432         (class Target_arm): Update comment.
12433         (Target_arm::Target_arm): Initialize new data members GOT_,
12434         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
12435         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
12436         and Target_arm::rel_dyn_section.
12437         Declare new_enum Target_arm::Got_type.
12438         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
12439         and DYNBSS_.
12440         Update commments for member do_dynsym_value.
12441         (Target_arm::got_size, Target_arm::plt_section,
12442         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
12443         new methods inside class defintion.
12444         (Target_arm::got_section): Define new method.
12445         (Target_arm::rel_dyn_section): Same.
12446         (Output_data_plt_arm): New template class.
12447         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
12448         (Output_data_plt_arm:do_adjust_output_section): Define new method.
12449         (Output_data_plt_arm::add_entry): Same.
12450         (Output_data_plt_arm::first_plt_entry): Define new
12451         static data member for PLT instruction template.
12452         (Output_data_plt_arm::plt_entry): Same.
12453         (Output_data_plt_arm::do_write): Define new method.
12454         (Target_arm::make_plt_entry): Same.
12455         (Target_arm::do_finalize_sections): Same.
12456         (Target_arm::do_dynsym_value): Same.
12457
12458 2009-05-28  Doug Kwan  <dougkwan@google.com>
12459
12460         * Makefile.am (TARGETSOURCES): Add arm.cc.
12461         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
12462         * Makefile.in: Regenerate.
12463         * arm.cc: New file.
12464         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
12465
12466 2009-05-26  Doug Kwan  <dougkwan@google.com>
12467
12468         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
12469         (General_options::check_excluded_libs): Strip off directories in
12470         archive name before matching like GNU ld does.
12471         * testsuite/Makefile.am (MOSTLYCLEANFILES,
12472         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
12473         (exclude_libs_test_LDFLAGS): Add linker option
12474         -Wl,--exclude-libs,libexclude_libs_test_3
12475         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
12476         an explicit archive without using -l.
12477         (alt/libexclude_libs_test_3.a): New make rule.
12478         * testsuite/Makefile.in: Regenerate.
12479         * testsuite/exclude_libs_test.c : Declare lib3_default().
12480         (main): Call it.
12481         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
12482         * exclude_libs_test_3.c: New file.
12483
12484 2009-05-26  Nick Clifton  <nickc@redhat.com>
12485
12486         * po/id.po: New Indonesian translation.
12487         * po/gold.pot: Updated template file.
12488
12489 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
12490
12491         * testsuite/Makefile.am: Add -ffunction-sections to compile
12492         gc_comdat_test files.  Add -Wl,--gc-sections to build
12493         gc_comdat_test.
12494         * testsuite/Makefile.in: Regenerate.
12495         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
12496
12497 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
12498
12499         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
12500         kept comdat section was garbage collected.
12501         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
12502         * testsuite/Makefile.in: Regenerate.
12503         * testsuite/gc_comdat_test.sh: New file.
12504         * testsuite/gc_comdat_test_1.cc: New file.
12505         * testsuite/gc_comdat_test_2.cc: New file.
12506
12507 2009-05-19  Doug Kwan  <dougkwan@google.com>
12508
12509         * archive.cc (Archive::Archive): Move constructor from archive.h
12510         to here.  Initialize no_export_.
12511         (Archive::get_elf_object_for_member): Set no_export flag of object.
12512         * archive.h (Archive::Archive): Move constructor body to
12513         archive.cc.
12514         (Archive::no_export): New method.
12515         (Archive::no_export_): New field.
12516         * object.h (Object::Object): Initialize no_export_ to false.
12517         (Object::no_export, Object::set_no_export): New methods.
12518         (Object::no_export_): New field.
12519         * options.cc (General_options::parse_exclude_libs): New method.
12520         (General_options::check_excluded_libs) Same.
12521         * options.h (exclude_libs): New option.
12522         (General_options::check_excluded_libs): New method declaration.
12523         (General_options::excluded_libs_): New field.
12524         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
12525         default or protected visibility if an object has no-export flag set.
12526         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
12527         (check_SCRIPTS): Add exclude_libs_test.sh.
12528         (check_DATA): Add exclude_libs_test.syms.
12529         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
12530         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
12531         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
12532         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
12533         (exclude_libs_test.syms, libexclude_libs_test_1.a,
12534         libexclude_libs_test_2.a): New rules.
12535         * testsuite/Makefile.in: Regenerate.
12536         * testsuite/exclude_libs_test.c: New file.
12537         * testsuite/exclude_libs_test.sh: Ditto.
12538         * testsuite/exclude_libs_test_1.c: Ditto.
12539         * testsuite/exclude_libs_test_2.c: Ditto.
12540
12541 2009-05-15  Ian Lance Taylor  <iant@google.com>
12542
12543         * configure.ac: Check for declarations for cases where libiberty.h
12544         checks HAVE_DECL_xxx.
12545         * configure, config.in: Rebuild.
12546
12547 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
12548
12549         * gold.h (Incremental_argument_list): Remove (invalid) forward
12550         declaration.
12551         * incremental.cc (Incremental_inputs::report_achive): New method.
12552         (Incremental_inputs::report_object): New method.
12553         (Incremental_inputs::report_script): New method.
12554         (Incremental_inputs::finalize_inputs): New method.
12555         (Incremental_inputs::finalize): Call finalize_inputs().
12556         (Incremental_inputs::sized_create_incremental_inputs_section_data):
12557         Create inputs entries.
12558         * incremental.h (Incremental_input_type): New enum.
12559         (Incremental_inputs::Incremental_input): Initialize new fields.
12560         (Incremental_inputs::report_inputs): New method.
12561         (Incremental_inputs::report_achive): New method.
12562         (Incremental_inputs::report_object): New method.
12563         (Incremental_inputs::report_script): New method.
12564         (Incremental_inputs::finalize_inputs): New method.
12565         (Incremental_inputs::Input_info): New struct.
12566         (Incremental_inputs::Input_info_map): New typedef.
12567         (Incremental_inputs::lock_): New field.
12568         (Incremental_inputs::Inputs_): New field.
12569         (Incremental_inputs::Inputs_map): New field.
12570         * main.cc (main): Call Incremental_input::report_inputs.
12571         * options.h (Input_argument_list): Typedef moved from
12572         Input_arguments.
12573         (Input_file_group::Files): Remove, use ::Input_argument_list.
12574         (Input_file_group::Input_argument_list): Remove, use
12575         ::Input_argument_list.
12576         * plugin.cc (Plugin_manager::add_input_file): Add error in
12577         incremental build.
12578         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
12579         functions.
12580         * script.cc (read_input_script): Call
12581         Incremental_input::report_script.
12582         * script.h (Script_info): New class.
12583
12584 2009-04-27  Ian Lance Taylor  <iant@google.com>
12585
12586         * x86_64.cc (do_adjust_output_section): Set entsize to
12587         plt_entry_size.
12588
12589 2009-04-23  Elliott Hughes  <enh@google.com>
12590
12591         * output.cc (Output_file::close): After short writes, continue
12592         writing from the correct offset in the buffer being written.
12593
12594 2009-04-23  Chris Demetriou  <cgd@google.com>
12595
12596         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
12597         * configure: Regenerate.
12598         * config.in: Regenerate.
12599         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
12600         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
12601
12602 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
12603
12604         * incremental.cc (Incremental_inputs_header_data): Renamed from
12605         Incremental_input_header_data.
12606         (Incremental_inputs_header_data::data_size): New field.
12607         (Incremental_inputs_header_data::put_input_file_count): Renamed
12608         from input_file_count.
12609         (Incremental_inputs_header_data::put_command_line_offset): Renamed
12610         from command_line_offset.
12611         (Incremental_inputs_header_data::put_reserved): Renamed from
12612         put_reserved.
12613         (Incremental_inputs_entry_data): Renamed from
12614         Incremental_input_entry_data.
12615         (Incremental_inputs_entry_data::data_size): New field.
12616         (Incremental_inputs::report_command_line): New method.
12617         (Incremental_inputs::finalize): New method.
12618         (Incremental_inputs::create_incremental_inputs_data): New method.
12619         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
12620         * incremental.h: New file.
12621         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
12622         (Layout::finalize): Create incremental inputs section in
12623         incremental builds.
12624         (Layout::create_incremental_info_sections): New method.
12625         * layout.h (Layout::incremental_inputs): New method.
12626         (Layout::create_incremental_info_sections): New method.
12627         (Layout::incremental_inputs_): New field.
12628         * main.cc (main): Notify Incremental_input of the command line.
12629
12630 2009-04-01  Ian Lance Taylor  <iant@google.com>
12631             Mikolaj Zalewski  <mikolajz@google.com>
12632
12633         * gold.h (reserve_unordered_map): Define, three versions, one for
12634         each version of Unordered_map.
12635         * layout.cc (Layout::Layout): Remove options parameter.  Add
12636         number_of_input_files parameter.  Don't initialize options_.
12637         Initialize number_of_input_files_ and resized_signatures_.  Move
12638         sections_are_attached_.
12639         (Layout::layout_group): Reserve space for group_signatures_.
12640         (Layout::find_or_add_kept_section): Change name parameter to be a
12641         reference.  Resize signatures_ map when it gets large enough.
12642         (Layout::layout_eh_frame): Use parameters->options() instead of
12643         this->options_.
12644         (Layout::make_output_section): Likewise.
12645         (Layout::attach_allocated_section_to_segment): Likewise.
12646         (Layout::finalize, Layout::create_executable_stack): Likewise.
12647         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
12648         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
12649         * layout.h (class Layout): Update declarations.  Remove options_
12650         field.  Add number_of_input_files_ and resized_signatures_
12651         fields.  Move sections_are_attached_ field.
12652         * main.cc (main): Pass number of input files to Layout
12653         constructor.  Don't pass options.
12654
12655 2009-03-30  Ian Lance Taylor  <iant@google.com>
12656
12657         * ffsll.c (ffsll): Correct implementation.
12658
12659 2009-03-27  Ian Lance Taylor  <iant@google.com>
12660
12661         * ffsll.c: New file.
12662         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
12663         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
12664         * ftruncate.c (ftruncate): Declare before definition.
12665         * mremap.c (mremap): Likewise.
12666         * pread.c (pread): Likewise.
12667         * configure, Makefile.in, config.in: Rebuild.
12668
12669         * mremap.c: New file.
12670         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
12671         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
12672         (mremap): Declare if HAVE_MREMAP is not defined.
12673         * configure, Makefile.in, config.in: Rebuild.
12674
12675 2009-03-27  Cary Coutant  <ccoutant@google.com>
12676
12677         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
12678         position independent.
12679         * sparc.cc (Target_sparc::check_non_pic): Likewise.
12680         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
12681
12682 2009-03-24  Cary Coutant  <ccoutant@google.com>
12683
12684         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
12685         an executable.
12686         (needs_dynamic_reloc): Likewise.
12687
12688 2009-03-24  Ian Lance Taylor  <iant@google.com>
12689
12690         * yyscript.y (file_cmd): Recognize EXTERN.
12691         (extern_name_list, extern_name_list_body): New nonterminals.
12692         * script.cc (script_add_extern): Define.
12693         * script-c.h (script_add_extern): Declare.
12694
12695 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
12696
12697         * object.cc (is_elf_object): Define.
12698         * object.h (is_elf_object): Declare.
12699         * archive.cc (Archive::get_elf_object_for_member): Call
12700         is_elf_object.
12701         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
12702
12703 2009-03-24  Elliott Hughes  <enh@google.com>
12704
12705         * output.cc (Output_file::map_anonymous): Define.
12706         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
12707         try an anonymous one.  Report the size if the mmap fails.
12708         * output.h (class Output_file): Declare map_anonymous.
12709
12710 2009-03-24  Ian Lance Taylor  <iant@google.com>
12711
12712         * target-select.cc (instantiate_target): Don't acquire the lock if
12713         the instantiated_target_ field has already been set.
12714
12715 2009-03-23  Ian Lance Taylor  <iant@google.com>
12716
12717         * gold-threads.h (class Initialize_lock): Define.
12718         * gold-threads.cc (class Initialize_lock_once): Define.
12719         (initialize_lock_control): New static variable.
12720         (initialize_lock_pointer): New static variable.
12721         (initialize_lock_once): New static function.
12722         (Initialize_lock::Initialize_lock): Define.
12723         (Initialize_lock::initialize): Define.
12724         * target-select.h: Include "gold-threads.h".
12725         (class Target_selector): Add lock_ and initialize_lock_ fields.
12726         Don't define instantiate_target, just declare it.
12727         * target-select.cc (Target_selector::Target_selector): Initialize
12728         new fields.
12729         (Target_selector::instantiate_target): Define.
12730         * descriptors.h: Include "gold-threads.h".
12731         (class Descriptors): Add initialize_lock_ field.
12732         * descriptors.cc (Descriptors::Descriptors): Initialize new
12733         field.
12734         (Descriptors::open): Use initialize_lock_ field
12735         * errors.h (class Errors): Add initialize_lock_ field.
12736         * errors.cc (Errors::Errors): Initialize new field.
12737         (Errors::initialize_lock): Use initialize_lock_ field.
12738         * powerpc.cc (class Target_selector_powerpc): Remove
12739         instantiated_target_ field.  In do_recognize call
12740         instantiate_target rather than do_instantiate_target.  In
12741         do_instantiate_target just allocate a new target.
12742         * sparc.cc (class Target_selector_sparc): Likewise.
12743
12744         * freebsd.h: New file.
12745         * i386.cc: Include "freebsd.h".
12746         (Target_i386): Derive from Target_freebsd rather than
12747         Sized_target.
12748         (Target_selector_i386): Derive from Target_selector_freebsd rather
12749         than Target_selector.
12750         * x86_64.cc: Include "freebsd.h".
12751         (Target_x86_64): Derive from Target_freebsd rather than
12752         Sized_target.
12753         (Target_selector_x86_64): Derive from Target_selector_freebsd
12754         rather than Target_selector.
12755         * target.h (class Target): Add adjust_elf_header and
12756         do_adjust_elf_header.
12757         * output.cc (Output_file_header:: do_sized_write): Call target
12758         adjust_elf_header routine.
12759         * configure.tgt: Set targ_osabi.
12760         * configure.ac: Define GOLD_DEFAULT_OSABI.
12761         * parameters.cc (Parameters::default_target): Pass
12762         GOLD_DEFAULT_OSABI to select_target.
12763         * target-select.h (class Target_selector): Make instantiate_target
12764         protected rather than private.
12765         * Makefile.am (HFILES): Add freebsd.h.
12766         * configure, Makefile.in, config.in: Rebuild.
12767
12768         * merge.cc (do_add_input_section): Correct pend value.  Change
12769         message about last entry not being null terminated from error to
12770         warning.
12771
12772 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
12773
12774         * incremental.cc: New file.
12775         * Makefile.am (CCFILES): Add incremental.cc.
12776         * Makefile.in: Rebuild.
12777
12778 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
12779
12780         * layout.cc (Layout::output_section_name): Preserve names
12781         of '.note.' sections.
12782
12783 2009-03-19  Ian Lance Taylor  <iant@google.com>
12784
12785         * descriptors.cc (Descriptors::open): Check that the options are
12786         valid before using them.
12787
12788 2009-03-18  Ian Lance Taylor  <iant@google.com>
12789
12790         * script-sections.h: Include <list>.
12791         (class Script_sections): Change Sections_elements from std::vector
12792         to std::list.  Typedef public Elements_iterator.  Add
12793         orphan_section_placement_, data_segment_align_start_, and
12794         saw_data_segment_align_ fields.  Remove data_segment_align_index_
12795         field.
12796         * script-sections.cc (class Orphan_section_placement): New class.
12797         (class Sections_element): Add virtual functions is_relro and
12798         orphan_section_init.  Remove virtual function place_orphan_here.
12799         (class Output_section_definition): Add is_relro and
12800         orphan_section_init.  Remove place_orphan_here.
12801         (class Orphan_output_section): Likewise.
12802         (Script_sections::Script_sections): Update for field changes.
12803         (Script_sections::data_segment_align): Set saw_data_segment_align_
12804         and data_segment_align_start_, not data_segment_align_index.
12805         (Script_sections::data_segment_relro_end): Check
12806         saw_data_segment_align_.  Use data_segment_align_start_ rather
12807         than data_segment_align_index_.
12808         (Script_sections::place_orphan): Rewrite to use
12809         Orphan_section_placement.
12810
12811 2009-03-17  Ian Lance Taylor  <iant@google.com>
12812
12813         * archive.cc (Archive::add_symbols): Check for a version attached
12814         to the symbol name in the archive map.
12815         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
12816         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
12817         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
12818         (ver_test_11.a): New target.
12819         * testsuite/Makefile.in: Rebuild.
12820
12821         * configure.ac: Check for chsize and posix_fallocate.  Replace
12822         ftruncate.
12823         * ftruncate.c: New file, from gnulib.
12824         * output.cc (posix_fallocate): Define dummy version if not
12825         HAVE_POSIX_FALLOCATE.
12826         (Output_file::map): Call posix_fallocate rather than lseek and
12827         write.
12828         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
12829         * configure, Makefile.in, config.in: Rebuild.
12830
12831 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
12832
12833         * layout.h (Layout::create_note): Add section_name parameter.
12834         * layout.cc (Layout::create_note): Likewise.
12835         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
12836
12837 2009-03-17  Ian Lance Taylor  <iant@google.com>
12838
12839         * descriptors.cc: Include "options.h".
12840         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
12841         (Descriptors::open): Always use O_CLOEXEC when opening a new
12842         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
12843         then set FD_CLOEXEC.
12844
12845         * sparc.cc (class Target_sparc): Add has_got_section.
12846         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
12847         make sure we have a GOT section.
12848
12849         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
12850         (Target_sparc::Scan::local): Likewise.
12851         (Target_sparc::Scan::global): Likewise.
12852         (Target_sparc::Relocate::relocate): Likewise.
12853         (Target_sparc::Relocate::relocate_tls): Likewise.
12854
12855         * symtab.cc (Symbol_table::define_default_version): New function,
12856         broken out of add_from_object.
12857         (Symbol_table::add_from_object): Call define_default_version.
12858         (Symbol_table::define_special_symbol): Add resolve_oldsym
12859         parameter.  Change all callers.  If the version for a symbol comes
12860         from a version script, resolve it with the symbol with the same
12861         name with no version.  Also add the symbol without a version if
12862         appropriate.
12863         (do_define_in_output_data): If resolving with oldsym, don't delete
12864         sym.
12865         (do_define_in_output_segment): Likewise.
12866         (do_define_as_constant): Likewise.
12867         * symtab.h (class Symbol_table): Update declarations.
12868
12869 2009-03-13  Ian Lance Taylor  <iant@google.com>
12870
12871         * readsyms.cc (Read_symbols::incompatible_warning): New function.
12872         (Read_symbols::requeue): New function.
12873         (Read_symbols::do_read_symbols): If make_elf_object fails because
12874         the target type is not configured, and the file was searched for,
12875         issue a warning and retry with the next directory.
12876         (Add_symbols::run): If the file has an incompatible format, and
12877         it was searched for, requeue the Read_symbols task.  On error,
12878         release the object.
12879         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
12880         dirindex parameter to constructor.  Change all callers.  Declare
12881         incompatible_warning and requeue.
12882         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
12883         input_argument_ and input_group_ fields.  Add them to
12884         constructor.  Change all callers.
12885         (class Read_script): Add dirindex_ field.  Add it to constructor.
12886         Change all callers.
12887         * archive.cc (Archive::setup): Remove input_objects parameter.
12888         Change all callers.
12889         (Archive::get_file_and_offset): Likewise.
12890         (Archive::read_all_symbols): Likewise.
12891         (Archive::read_symbols): Likewise.
12892         (Archive::get_elf_object_for_member): Remove input_objects
12893         parameter.  Add punconfigured parameter.  Change all callers.
12894         (Archive::add_symbols): Change return type to bool.  Check return
12895         value of include_member.
12896         (Archive::include_all_members): Likewise.
12897         (Archive::include_member): Change return type to bool.  Return
12898         false if first included object has incompatible target.  Set
12899         included_member_ field.
12900         (Add_archive_symbols::run): If add_symbols returns false, requeue
12901         Read_symbols task.
12902         * archive.h (class Archive): Add included_member_ field.
12903         Initialize it in constructor.  Add input_file and searched_for
12904         methods.  Update declarations.
12905         (class Add_archive_symbols): Add dirpath_, dirindex_, and
12906         input_argument_ fields.  Add them to constructor.  Change all
12907         callers.
12908         * script.cc: Include "target-select.h".
12909         (class Parser_closure): Add skip_on_incompatible_target_ and
12910         found_incompatible_target_ fields.  Add
12911         skip_on_incompatible_target parameter to constructor.  Change all
12912         callers.  Add methods skip_on_incompatible_target,
12913         clear_skip_on_incompatible_target, found_incompatible_target, and
12914         set_found_incompatible_target.
12915         (read_input_script): Add dirindex parameter.  Change all callers.
12916         If parser finds an incompatible target, requeue Read_symbols
12917         task.
12918         (script_set_symbol): Clear skip_on_incompatible_target in
12919         closure.
12920         (script_add_assertion, script_parse_option): Likewise.
12921         (script_start_sections, script_add_phdr): Likewise.
12922         (script_check_output_format): New function.
12923         * script.h (read_input_script): Update declaration.
12924         * script-c.h (script_check_output_format): Declare.
12925         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
12926         (ignore_cmd): Remove OUTPUT_FORMAT.
12927         * fileread.cc (Input_file::Input_file): Add explicit this.
12928         (Input_file::will_search_for): New function.
12929         (Input_file::open): Add pindex parameter.  Change all callers.
12930         * fileread.h (class Input_file): Add input_file_argument method.
12931         Declare will_search_for.  Update declarations.
12932         * object.cc (make_elf_object): Add punconfigured parameter.
12933         Change all callers.
12934         * object.h (class Object): Make input_file public.  Add
12935         searched_for method.
12936         (make_elf_object): Update declaration.
12937         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
12938         restart search.
12939         * dirsearch.h (class Dirsearch): Update declaration.
12940         * options.h (class General_options): Add --warn-search-mismatch.
12941         * parameters.cc (Parameters::is_compatible_target): New function.
12942         * parameters.h (class Parameters): Declare is_compatible_target.
12943         * workqueue.cc (Workqueue::add_blocker): New function.
12944         * workqueue.h (class Workqueue): Declare add_blocker.
12945
12946         * fileread.cc (Input_file::open): Remove options parameter.
12947         Change all callers.
12948         (Input_file::open_binary): Likewise.
12949         * script.cc (read_input_script): Likewise.
12950         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
12951         options parameter from constructor.  Change all callers.
12952         (class Read_script): Likewise.
12953         * fileread.h (class Input_file): Update declarations.
12954         * script.h (read_input_script): Update declaration.
12955
12956 2009-03-10  Nick Clifton  <nickc@redhat.com>
12957
12958         * po/es.po: New Spanish translation.
12959
12960 2009-03-06  Cary Coutant  <ccoutant@google.com>
12961
12962         * options.cc (parse_short_option): Keep dash_z from registering itself.
12963
12964 2009-03-03  Ian Lance Taylor  <iant@google.com>
12965
12966         PR 9918
12967         * target-reloc.h (relocate_section): Pass output_section to
12968         relocate.
12969         * i386.cc (Target_i386::should_apply_static_reloc): Add
12970         output_section parameter.  Change all callers.
12971         (Target_i386::Relocate::relocate): Add output_section parameter.
12972         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
12973         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
12974         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
12975         * testsuite/two_file_shared.sh: New script.
12976         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
12977         (check_DATA): Add two_file_shared.dbg.
12978         (two_file_shared.dbg): New target.
12979         * testsuite/Makefile.in: Rebuild.
12980
12981 2009-03-01  Ian Lance Taylor  <iant@google.com>
12982
12983         * configure.ac: Check for byteswap.h.
12984         * configure: Rebuild.
12985         * config.in: Rebuild.
12986
12987 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
12988
12989         * layout.cc (Layout::find_or_add_kept_section): New function.
12990         (Layout::add_comdat): Removed.
12991         * layout.h (struct Kept_section): Move out of class Layout.
12992         Remove trailing underscores from field names.  Add group_sections
12993         field.  Rename group_ field to is_group.  Change all uses.
12994         (class Layout): Declare find_or_add_kept_section, not add_comdat.
12995         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
12996         comdat_groups_ field.
12997         (Sized_relobj::include_section_group): Use
12998         find_or_add_kept_section and Kept_section::group_sections.
12999         (Sized_relobj::include_linkonce_section): Likewise.
13000         * object.cc (class Sized_relobj): Don't define Comdat_group or
13001         Comdat_group_table.  Remove find_comdat_group and
13002         add_comdat_group.  Remove comdat_groups_ field.
13003         * plugin.cc (include_comdat_group): Use
13004         Layout::find_or_add_kept_section.
13005
13006 2009-02-28  Ian Lance Taylor  <iant@google.com>
13007
13008         * README: --gc-sections and map files are now supported.  Document
13009         some build requirements.
13010
13011         PR 6992
13012         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
13013         relocatable link set the value of the section symbol to zero.
13014         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
13015         relocatable link don't include the section address in the local
13016         symbol value.
13017
13018 2009-02-27  Ian Lance Taylor  <iant@google.com>
13019
13020         PR 6811
13021         * options.h (class Search_directory): Add is_system_directory.
13022         (class General_options): Declare is_in_system_directory.
13023         * options.cc (get_relative_sysroot): Make static.
13024         (get_default_sysroot): Make static.
13025         (General_optoins::is_in_system_directory): New function.
13026         * fileread.cc (Input_file::is_in_system_directory): New function.
13027         * fileread.h (class Input_file): Declare is_in_system_directory.
13028         * object.h (class Object): Add is_in_system_directory.
13029         (class Input_objects): Remove system_library_directory_ field.
13030         * object.cc (Input_objects::add_object): Don't set
13031         system_library_directory_.
13032         (input_objects::found_in_system_library_directory): Remove.
13033         * symtab.cc (Symbol_table::write_globals): Remove input_objects
13034         parameter.  Change all callers.
13035         (Symbol_table::sized_write_globals): Likewise.
13036         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
13037         Call Object::is_in_system_directory.
13038         * symtab.h (class Symbol_table): Update declarations.
13039
13040         PR 5990
13041         * descriptors.h (Open_descriptor): Add is_on_stack field.
13042         * descriptors.cc (Descriptors::open): If the descriptor is on the
13043         top of the stack, remove it.  Initialize is_on_stack field.
13044         (Descriptors::release): Only add pod to stack if it is not on the
13045         stack already.
13046         (Descriptors::close_some_descriptor): Clear stack_next and
13047         is_on_stack fields.
13048
13049         PR 7091
13050         * output.cc (Output_section::find_starting_output_address): Rename
13051         from starting_output_address; add PADDR parameter; change return
13052         type.
13053         * output.h (class Output_section): Declare
13054         find_starting_output_address instead of starting_output_address.
13055         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
13056         section symbol for which we can't find a merge section.
13057
13058         PR 9836
13059         * symtab.cc (Symbol_table::add_from_object): If the visibility is
13060         hidden or internal, force the symbol to be local.
13061         * resolve.cc (Symbol::override_visibility): Define.
13062         (Symbol::override_base): Use override_visibility.
13063         (Symbol_table::resolve): Likewise.
13064         (Symbol::override_base_with_special): Likewise.
13065         (Symbol_table::override_with_special): If the visibility is hidden
13066         or internal, force the symbol to be local.
13067         * symtab.h (class Symbol): Add set_visibility and
13068         override_visibility.
13069         * testsuite/ver_test_1.sh: New file.
13070         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
13071         (check_DATA): Add ver_test_1.syms.
13072         (ver_test_1.syms): New target.
13073         * testsuite/Makefile.in: Rebuild.
13074
13075 2009-02-25  Cary Coutant  <ccoutant@google.com>
13076
13077         * layout.cc (Layout::choose_output_section): Don't rename sections
13078         when using a linker script that has a SECTIONS clause.
13079         * Makefile.in: Regenerate.
13080
13081         * testsuite/Makefile.am (script_test_5.sh): New test case.
13082         * testsuite/Makefile.in: Regenerate.
13083         * testsuite/script_test_5.cc: New file.
13084         * testsuite/script_test_5.sh: New file.
13085         * testsuite/script_test_5.t: New file.
13086
13087 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
13088
13089         * archive.cc (Archive::include_member): Update calls to add_symbols.
13090         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
13091         the Layout argument.
13092         * dynobj.h (do_add_symbols): Add the Layout argument.
13093         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
13094         Layout argument.
13095         * object.h (Object::add_symbols): Add the Layout argument.
13096         (Object::do_add_symbols): Add the Layout argument.
13097         (Sized_relobj::do_add_symbols): Add the Layout argument.
13098         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
13099         Unify the two versions.
13100         (Add_plugin_symbols): Remove.
13101         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
13102         (Sized_pluginobj::do_add_symbols): Unify the two versions.
13103         (Add_plugin_symbols): Remove.
13104         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
13105         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
13106         (Add_symbols::run): Make it work with Pulginobj.
13107
13108 2009-02-06  Ian Lance Taylor  <iant@google.com>
13109
13110         * object.cc (Sized_relobj::do_layout): Make info message start
13111         with lower case letter.
13112
13113 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
13114
13115         * binary.cc: Fix file comment.
13116
13117         * options.h (enum Incremental_disposition): Define.
13118         (class General_options): Add new options: --incremental,
13119         --incremental_changed, --incremental_unchanged,
13120         --incremental_unknown.  Add incremental_disposition_ and
13121         implicit_incremental_ fields.
13122         (General_options::incremental_disposition): New function.
13123         (class Position_dependent_options): Add incremental_disposition
13124         option.
13125         (Position_dependent_options::copy_from_options): Set incremental
13126         dispositions.
13127         * options.cc (General_options::parse_incremental_changed): New
13128         function.
13129         (General_options::parse_incremental_unchanged): New function.
13130         (General_options::parse_incremental_unknown): New function.
13131         (General_options::General_options): Initialize new fields
13132         incremental_disposition_ and implicit_incremental_.
13133         (General_options::finalize): Check for uasge of --incremental-*
13134         without --incremental.
13135
13136 2009-02-06  Chris Demetriou  <cgd@google.com>
13137
13138         * gold.h (gold_undefined_symbol): Change to take only a Symbol
13139         pointer and to report location as the file name associated with
13140         the symbol.
13141         (gold_undefined_symbol_at_location): New function to replace the
13142         old gold_undefined_symbol functionality.
13143         * target-reloc.h (relocate_section): Update to use
13144         gold_undefined_symbol_at_location.
13145         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
13146         Call gold_undefined_symbol function rather than gold_error.
13147         * errors.h (Errors::undefined_symbol): Take location as a
13148         string, rather than calculating it from a relocation.
13149         * errors.cc (Errors::fatal): Print "fatal error:" before the
13150         formatted message.
13151         (Errors::error, Errors::error_at_location): Print "error: "
13152         before the formatted message.
13153         (Errors::undefined_symbol): Take location as a string, rather
13154         than calculating it from a relocation.
13155         (gold_undefined_symbol_at_location): New function akin to
13156         old gold_undefined_symbol, calculates location from relocation.
13157         (gold_undefined_symbol): Change to take only a Symbol pointer
13158         and to report location as the file name associated with the symbol.
13159         * testsuite/debug_msg.sh: Update for changed error messages.
13160         * testsuite/undef_symbol.sh: Likewise.
13161
13162 2009-02-04  Duncan Sands  <baldrick@free.fr>
13163
13164         PR 9812
13165         * reduced_debug_output.h
13166         (Output_reduced_debug_abbrev_section::failed): Use format for
13167         gold_warning.
13168         (Output_reduced_debug_info_section::faild): Likewise.
13169
13170 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
13171
13172         * script.cc (Lazy_demangler): New class.
13173         (Version_script_info::get_symbol_version_helper): Demangle a
13174         symbol only once.
13175
13176 2009-01-29  Cary Coutant  <ccoutant@google.com>
13177
13178         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
13179         to __tls_get_addr.
13180         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
13181
13182 2009-01-28  Ian Lance Taylor  <iant@google.com>
13183
13184         * version.cc (version_string): Bump to 1.9.
13185
13186         * gold.h: Include <cstring> and <stdint.h>.
13187         * version.cc: Include <cstdio>.
13188         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
13189         warning.
13190         * reduced_debug_output.cc (insert_into_vector): Rename from
13191         Insert_into_vector; change all callers.  Use Swap_unaligned to
13192         avoid aliasing issue; remove union since it is unnecessary.
13193
13194 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
13195
13196         * Makefile.am (CCFILES): Add gc.cc.
13197         (HFILES): Add gc.h.
13198         * Makefile.in: Regenerate.
13199         * gold.cc (Gc_runner): New class.
13200         (queue_initial_tasks): Call garbage collection related tasks
13201         when corresponding options are invoked.
13202         (queue_middle_gc_tasks): New function.
13203         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
13204         processed early before laying out sections during garbage collection.
13205         * gold.h (queue_middle_gc_tasks): New function.
13206         (is_prefix_of): Move from "layout.cc".
13207         * i386.cc (Target_i386::gc_process_relocs): New function.
13208         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
13209         * main.cc (main): Create object of class "Garbage_collection".
13210         * object.cc (Relobj::copy_symbols_data): New function.
13211         (Relobj::is_section_name_included): New function.
13212         (Sized_relobj::do_layout): Allow this function to be called twice
13213         during garbage collection and defer layout of section during the
13214         first call.
13215         * object.h (Relobj::get_symbols_data): New function.
13216         (Relobj::is_section_name_included): New function.
13217         (Relobj::copy_symbols_data): New function.
13218         (Relobj::set_symbols_data): New function.
13219         (Relobj::get_relocs_data): New function.
13220         (Relobj::set_relocs_data): New function.
13221         (Relobj::is_output_section_offset_invalid): New pure virtual function.
13222         (Relobj::gc_process_relocs): New function.
13223         (Relobj::do_gc_process_relocs): New pure virtual function.
13224         (Relobj::sd_): New data member.
13225         (Sized_relobj::is_output_section_offset_invalid): New function.
13226         (Sized_relobj::do_gc_process_relocs): New function.
13227         * options.h (General_options::gc_sections): Modify to not be a no-op.
13228         (General_options::print_gc_sections): New option.
13229         * plugin.cc (Plugin_finish::run): Remove function call to
13230         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
13231         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
13232         * reloc.cc (Read_relocs::run): Add task to process relocs and
13233         determine unreferenced sections when doing garbage collection.
13234         (Gc_process_relocs): New class.
13235         (Sized_relobj::do_gc_process_relocs): New function.
13236         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
13237         sections that are garbage collected.
13238         * reloc.h (Gc_process_relocs): New class.
13239         * sparc.cc (Target_sparc::gc_process_relocs): New function.
13240         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
13241         symbols whose corresponding sections are garbage collected.
13242         (Symbol_table::Symbol_table): Add new parameter for the garbage
13243         collection object.
13244         (Symbol_table::gc_mark_undef_symbols): New function.
13245         (Symbol_table::gc_mark_symbol_for_shlib): New function.
13246         (Symbol_table::gc_mark_dyn_syms): New function.
13247         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
13248         as garbage.
13249         (Symbol_table::add_from_object): Likewise.
13250         (Symbol_table::add_from_relobj): When building shared objects, do not
13251         treat externally visible symbols as garbage.
13252         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
13253         table information for static and relocatable links.
13254         * symtab.h (Symbol_table::set_gc): New function.
13255         (Symbol_table::gc): New function.
13256         (Symbol_table::gc_mark_undef_symbols): New function.
13257         (Symbol_table::gc_mark_symbol_for_shlib): New function.
13258         (Symbol_table::gc_mark_dyn_syms): New function.
13259         (Symbol_table::gc_): New data member.
13260         * target.h (Sized_target::gc_process_relocs): New pure virtual
13261         function.
13262         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
13263         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
13264
13265 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
13266
13267         * options.h (General_options::gc_sections): Define as a no-op for now.
13268         (General_options::no_keep_memory): Ditto.
13269         (General_options::Bshareable): Define.
13270         * options.cc (General_options::finalize): Honor -Bshareable.
13271
13272 2009-01-20  Andreas Schwab  <schwab@suse.de>
13273
13274         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
13275         read the value in the contents, since we don't use it.  Use the
13276         template endianness when writing.
13277         (Relocate::relocate): Use it for R_PPC_REL16_HA.
13278
13279 2009-01-19  Andreas Schwab  <schwab@suse.de>
13280
13281         * configure.tgt (powerpc64-*): Fix targ_obj.
13282
13283 2009-01-15  Ian Lance Taylor  <iant@google.com>
13284
13285         * object.cc (Sized_relobj::write_local_symbols): Don't write out
13286         local symbols when stripping all symbols.
13287
13288 2009-01-14  Cary Coutant  <ccoutant@google.com>
13289
13290         * output.cc (Output_reloc): Add explicit instantiations.
13291
13292 2009-01-14  Cary Coutant  <ccoutant@google.com>
13293
13294         * archive.cc (Archive::get_elf_object_for_member): Remove call
13295         to File_read::claim_for_plugin.
13296         * descriptors.cc (Descriptors::open): Remove reference to
13297         is_claimed.
13298         (Descriptors::claim_for_plugin): Remove.
13299         * descriptors.h (Descriptors::claim_for_plugin): Remove.
13300         (Descriptors::is_claimed): Remove.
13301         (claim_descriptor_for_plugin): Remove.
13302         * fileread.cc (File_read::claim_for_plugin): Remove.
13303         * fileread.h (File_read::claim_for_plugin): Remove.
13304         (File_read::descriptor): Reopen descriptor if necessary.
13305         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
13306         (Plugin_manager::all_symbols_read): Add task parameter. Change
13307         all callers.
13308         (Plugin_manager::get_input_file): New function.
13309         (Plugin_manager::release_input_file): New function.
13310         (Pluginobj::Pluginobj): Add filesize parameter and initialize
13311         corresponding data member.
13312         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
13313         and pass to base constructor. Change all callers.
13314         (get_input_file, release_input_file): New functions.
13315         (make_sized_plugin_object): Add filesize parameter. Change all callers.
13316         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
13317         (Plugin_manager::all_symbols_read): Add task parameter.
13318         (Plugin_manager::get_input_file): New function.
13319         (Plugin_manager::release_input_file): New function.
13320         (Plugin_manager::task_): New data member.
13321         (Pluginobj::Pluginobj): Add filesize parameter.
13322         (Pluginobj::filename): New function.
13323         (Pluginobj::descriptor): New function.
13324         (Pluginobj::filesize): New function.
13325         (Pluginobj::filesize_): New data member.
13326         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
13327         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
13328         File_read::claim_for_plugin; use Object::unlock to unlock the file.
13329
13330         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
13331         with archive libraries.
13332         * testsuite/Makefile.in: Regenerate.
13333         * testsuite/plugin_test.c (struct sym_info): New type.
13334         (get_input_file, release_input_file): New static variables.
13335         (onload): Capture new transfer vector entries.
13336         (claim_file_hook): Stop reading at end of file according to filesize.
13337         Factor out parsing of readelf output into separate function.
13338         (all_symbols_read_hook): Exercise get_input_file and release_input_file
13339         APIs and get the source file name from the symbol table.  Convert
13340         source file name to corresponding object file name.  Print info
13341         message when adding new input files.
13342         (parse_readelf_line): New function.
13343         * testsuite/plugin_test_1.sh: Add checks for new info messages.
13344         * testsuite/plugin_test_2.sh: Likewise.
13345         * testsuite/plugin_test_3.sh: Likewise.
13346         * testsuite/plugin_test_4.sh: New test case.
13347
13348 2009-01-07  Ian Lance Taylor  <iant@google.com>
13349
13350         * version.cc (version_string): Bump to 1.8.
13351
13352 2008-12-23  Cary Coutant  <ccoutant@google.com>
13353
13354         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
13355         * plugin.cc (Plugin_manager::finish): Rename as
13356         layout_deferred_objects.  Move cleanup to separate function.
13357         (Plugin_manager::cleanup): New function.
13358         (Plugin_finish::run): Call layout_deferred_objects and cleanup
13359         separately.
13360         * plugin.h (Plugin_manager::finish): Rename as
13361         layout_deferred_objects.
13362         (Plugin_manager::cleanup): New function.
13363         (Plugin_manager::cleanup_done): New field.
13364
13365 2008-12-23  Cary Coutant  <ccoutant@google.com>
13366
13367         * plugin.cc (is_visible_from_outside): New function.
13368         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
13369         so we don't return "IR only" status for exported symbols or -r links.
13370
13371         * testsuite/Makefile.am (plugin_test_3): New test case.
13372         * testsuite/Makefile.in: Regenerate.
13373         * testsuite/plugin_test_3.sh: New file.
13374
13375 2008-12-22  Cary Coutant  <ccoutant@google.com>
13376
13377         * object.cc (Sized_relobj::layout_section): New function.
13378         (Sized_relobj::do_layout): Defer layout of input sections until after
13379         plugin has provided replacement files.
13380         (Sized_relobj::do_layout_deferred_sections): New function.
13381         * object.h (Relobj::set_section_offset): Remove virtual keyword.
13382         (Relobj::layout_deferred_sections): New function.
13383         (Relobj::do_layout_deferred_sections): New function.
13384         (Sized_relobj::do_layout_deferred_sections): New function.
13385         (Sized_relobj::layout_section): New function.
13386         (Sized_relobj::Deferred_layout): New structure.
13387         (Sized_relobj::deferred_layout_): New field.
13388         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
13389         Change all callers.  Layout deferred sections.
13390         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
13391         references.
13392         (Plugin_hook::run): Move code from do_plugin_hook inline.
13393         (Plugin_hook::do_plugin_hook): Remove.
13394         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
13395         (Plugin_manager::finish): Renamed, was cleanup.
13396         (Plugin_manager::should_defer_layout): New function.
13397         (Plugin_manager::add_deferred_layout_object): New function.
13398         (Plugin_manager::Deferred_layout_list): New type.
13399         (Plugin_manager::deferred_layout_objects_): New field.
13400         (Plugin_hook::do_plugin_hook): Remove.
13401
13402 2008-12-17  Ian Lance Taylor  <iant@google.com>
13403
13404         * options.h (class General_options): Add --no case for
13405         --export-dynamic.
13406
13407 2008-12-16  Cary Coutant  <ccoutant@google.com>
13408
13409         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
13410         vector.
13411         (Plugin_manager::claim_file): Create plugin object even if
13412         plugin did not call the add_symbols callback.
13413         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
13414         asking for more symbols than were added.
13415         * testsuite/Makefile.am (plugin_test_1): Add test case with
13416         no global symbols.
13417         (empty.syms): New target.
13418         * testsuite/Makefile.in: Regenerate.
13419         * testsuite/plugin_test.c (claim_file_hook): Add new debug
13420         message. Don't call add_symbols if no globals.
13421         (all_symbols_read_hook): Don't provide replacement for empty
13422         claimed file.
13423
13424 2008-12-12  Ian Lance Taylor  <iant@google.com>
13425
13426         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
13427         r_type == 0 for a local symbol with r_sym == 0.
13428         (scan_relocatable_relocs): Pass r_sym to
13429         local_non_section_strategy.
13430         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
13431         r_sym parameter.
13432
13433         * configure.ac: Update test for TLS descriptors: they are
13434         supported as of glibc 2.9.
13435         * configure: Rebuild.
13436
13437 2008-12-11  Ian Lance Taylor  <iant@google.com>
13438
13439         PR 7091
13440         * target-reloc.h (Default_scan_relocatable_relocs): For each
13441         function, map r_type == 0 to RELOC_DISCARD.
13442
13443 2008-12-10  Cary Coutant  <ccoutant@google.com>
13444
13445         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
13446         object to override a kept COMDAT group from a plugin object.
13447
13448 2008-12-09  Ian Lance Taylor  <iant@google.com>
13449
13450         PR 7088
13451         * yyscript.y (file_cmd): Handle INPUT.
13452
13453         * testsuite/initpri1.c: Change all declarations to be full
13454         prototypes by adding void, to avoid compiler warnings.
13455
13456 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
13457
13458         * options.cc (General_options::parse_plugin_opt): New.
13459         (General_options::add_plugin): The argument now is just the filename.
13460         (General_options::add_plugin_option): New.
13461         * options.h (plugin_opt): New.
13462         (add_plugin): Change argument name.
13463         (add_plugin_option): New.
13464         * plugin.cc (Plugin::load): Don't parse the plugin option.
13465         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
13466         (Plugin::add_option): New.
13467         (Plugin::args_): Change type.
13468         (Plugin::filename_): New.
13469         (Plugin_manager::add_plugin_option): New.
13470         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
13471         * testsuite/Makefile.in: Regenerate.
13472
13473 2008-12-05  Cary Coutant  <ccoutant@google.com>
13474
13475         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
13476         Handle --strip-lto-sections option.
13477         * options.h (strip_lto_sections): New option.
13478
13479 2008-12-01  Cary Coutant  <ccoutant@google.com>
13480
13481         * plugin.cc (ld_plugin_message): Change format parameter to const.
13482         Fix mismatch between new[] and delete.
13483
13484 2008-11-14  Cary Coutant  <ccoutant@google.com>
13485
13486         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
13487         instead of -1U.
13488
13489 2008-11-05  Craig Silverstein  <csilvers@google.com>
13490
13491         * options.cc (General_options::parse_dynamic_list): New function.
13492         * options.h (General_options): New flags dynamic_list,
13493         dynamic_list_data, dynamic_list_cpp_new, and
13494         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
13495         (General_options::in_dynamic_list): New function.
13496         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
13497         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
13498         (Lex::can_continue_name): Likewise.
13499         (yylex): Likewise.
13500         (read_script_file): New parameter script_options.
13501         (read_dynamic_list): New function.
13502         (Script_options::define_dynamic_list): New function.
13503         (dynamic_list_keyword_parsecodes): New variable.
13504         (dynamic_list_keywords): New variable.
13505         * script.h (Script_options::define_dynamic_list): New function
13506         prototype.
13507         (read_dynamic_list): New function prototype.
13508         * symtab.cc (strprefix): New macro.
13509         (Symbol::should_add_dynsym_entry): Support dynamic_list,
13510         dynamic_list_data, dynamic_list_cpp_new, and
13511         dynamic_list_cpp_typeinfo.
13512         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
13513         (dynamic_list_expr): New rule.
13514         (dynamic_list_nodes): Likewise.
13515         (dynamic_list_node): Likewise.
13516         * testsuite/Makefile.am (dynamic_list): New test.
13517         * testsuite/Makefile.in: Regenerated.
13518         * testsuite/dynamic_list.t: New file.
13519         * testsuite/dynamic_list.sh: New file.
13520
13521 2008-11-05  Craig Silverstein  <csilvers@google.com>
13522
13523         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
13524         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
13525         (t11_last): Likewise.
13526         * testsuite/ver_test_6.c (main): Likewise.
13527
13528 2008-10-07  Cary Coutant  <ccoutant@google.com>
13529
13530         * options.c (General_options::finalize): Add check for -static and
13531         -shared.
13532         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
13533         is not empty.
13534
13535 2008-10-02  Cary Coutant  <ccoutant@google.com>
13536
13537         * plugin.cc (make_sized_plugin_object): Fix conditional
13538         compilation to work when not all targets are enabled.
13539
13540 2008-09-29  Cary Coutant  <ccoutant@google.com>
13541
13542         * archive.cc (Archive::get_file_and_offset): Use filename instead
13543         of name to get library path.
13544         (Archive::include_member): Unlock external member of a thin archive.
13545
13546         * testsuite/Makefile.am (TEST_AR): New variable.
13547         (thin_archive_test_1): New test.
13548         (thin_archive_test_2): New test.
13549         * testsuite/Makefile.in: Regenerate.
13550         * testsuite/thin_archive_main.cc: New file.
13551         * testsuite/thin_archive_test_1.cc: New file.
13552         * testsuite/thin_archive_test_2.cc: New file.
13553         * testsuite/thin_archive_test_3.cc: New file.
13554         * testsuite/thin_archive_test_4.cc: New file.
13555
13556 2008-09-29  Cary Coutant  <ccoutant@google.com>
13557
13558         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
13559         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
13560         instead of -1U.
13561         (Sized_relobj::do_finalize_local_symbols): Likewise.
13562         (Sized_relobj::map_to_kept_section): Likewise.
13563         * object.h (Sized_relobj::invalid_address): New constant.
13564         (Sized_relobj::do_output_section_offset): Check for invalid_address
13565         and return -1ULL.
13566         * output.cc (Output_reloc::local_section_offset): Use constant
13567         invalid_address instead of -1U.
13568         (Output_reloc::get_address): Likewise.
13569         (Output_section::output_address): Change -1U to -1ULL.
13570         * output.h (Output_reloc::invalid_address): New constant.
13571         * reloc.cc (Sized_relobj::write_sections): Use constant
13572         invalid_address instead of -1U.
13573         (Sized_relobj::relocate_sections): Likewise.
13574         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
13575         values for merge sections.
13576         * target-reloc.h (relocate_for_relocatable): Use constant
13577         invalid_address instead of -1U.
13578
13579 2008-09-19  Cary Coutant  <ccoutant@google.com>
13580
13581         Add plugin functionality for link-time optimization (LTO).
13582         * configure.ac (plugins): Add --enable-plugins option.
13583         * configure: Regenerate.
13584         * config.in: Regenerate.
13585         * Makefile.am (LIBDL): New variable.
13586         (CCFILES): Add plugin.cc.
13587         (HFILES): Add plugin.h.
13588         (ldadd_var): Add LIBDL.
13589         * Makefile.in: Regenerate.
13590
13591         * archive.cc: Include "plugin.h".
13592         (Archive::setup): Don't preread archive symbols when using a plugin.
13593         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
13594         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
13595         files.
13596         (Archive::include_member): Add symbols from plugin objects.
13597         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
13598         * descriptors.cc (Descriptors::open): Check for file descriptors
13599         abandoned by plugins.
13600         (Descriptors::claim_for_plugin): New function.
13601         * descriptors.h (Descriptors::claim_for_plugin): New function.
13602         (Open_descriptor::is_claimed): New field.
13603         (claim_descriptor_for_plugin): New function.
13604         * fileread.cc (File_read::claim_for_plugin): New function.
13605         * fileread.h (File_read::claim_for_plugin): New function.
13606         (File_read::descriptor): New function.
13607         * gold.cc: Include "plugin.h".
13608         (queue_initial_tasks): Add task to call plugin hooks for generating
13609         new object files.
13610         * main.cc: Include "plugin.h".
13611         (main): Load plugin libraries.
13612         * object.h (Pluginobj): Declare.
13613         (Object::pluginobj): New function.
13614         (Object::do_pluginobj): New function.
13615         (Object::set_target): New function.
13616         * options.cc: Include "plugin.h".
13617         (General_options::parse_plugin): New function.
13618         (General_options::General_options): Initialize plugins_ field.
13619         (General_options::add_plugin): New function.
13620         * options.h (Plugin_manager): Declare.
13621         (General_options): Add --plugin option.
13622         (General_options::has_plugins): New function.
13623         (General_options::plugins): New function.
13624         (General_options::add_plugin): New function.
13625         (General_options::plugins_): New field.
13626         * plugin.cc: New file.
13627         * plugin.h: New file.
13628         * readsyms.cc: Include "plugin.h".
13629         (Read_symbols::do_read_symbols): Check for archive before checking
13630         for ELF file.  Call plugin hooks to claim files.
13631         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
13632         from a real object file; force override when processing replacement
13633         files.
13634         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
13635         (Symbol::init_base_object): Likewise.
13636         (Symbol::init_base_output_data): Likewise.
13637         (Symbol::init_base_output_segment): Likewise.
13638         (Symbol::init_base_constant): Likewise.
13639         (Symbol::init_base_undefined): Likewise.
13640         (Symbol::output_section): Assert that object is not a plugin.
13641         (Symbol_table::add_from_pluginobj): New function.
13642         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
13643         undefined.
13644         (Symbol_table::sized_write_globals): Likewise.
13645         (Symbol_table::add_from_pluginobj): Instantiate template.
13646         * symtab.h (Sized_pluginobj): Declare.
13647         (Symbol::in_real_elf): New function.
13648         (Symbol::set_in_real_elf): New function.
13649         (Symbol::in_real_elf_): New field.
13650         (Symbol_table::add_from_pluginobj): New function.
13651
13652         * testsuite/Makefile.am (AM_CFLAGS): New variable.
13653         (LIBDL): New variable.
13654         (LDADD): Add LIBDL.
13655         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
13656         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
13657         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
13658         (MOSTLYCLEANFILES): Likewise.
13659         * testsuite/Makefile.in: Regenerate.
13660         * testsuite/plugin_test.c: New file.
13661         * testsuite/plugin_test_1.sh: New file.
13662         * testsuite/plugin_test_2.sh: New file.
13663
13664 2008-09-16  Ian Lance Taylor  <iant@google.com>
13665
13666         * target-reloc.h (relocate_section): Check whether a symbol is
13667         defined by the ABI before reporting an undefined symbol error.
13668         * target.h (Target::is_defined_by_abi): Make parameter const.
13669         (Target::do_is_defined_by_abi): Likewise.
13670         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
13671         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
13672         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
13673         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
13674         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
13675         * testsuite/Makefile.in: Rebuild.
13676
13677         * fileread.cc (make_view): Add casts to avoid warning.
13678
13679 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
13680
13681         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
13682         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
13683
13684 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
13685
13686         * options.h (General_options::output_is_executable): New.
13687         (General_options::output_is_pie): New.
13688         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
13689         for shared libraries.
13690         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
13691
13692 2008-09-11  Chris Demetriou  <cgd@google.com>
13693
13694         * options.h (origin): New -z option.
13695         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
13696         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
13697         in DT_FLAGS_1.
13698
13699 2008-09-05  Cary Coutant  <ccoutant@google.com>
13700
13701         * fileread.cc (File_read::make_view): Add check for attempt to map
13702         beyond end of file.
13703
13704 2008-09-05  Cary Coutant  <ccoutant@google.com>
13705
13706         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
13707         explicit instantiations.
13708
13709 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
13710
13711         PR gold/6858
13712         * options.cc (General_options::finalize): Allow undefined symbols
13713         in shlibs if linking -shared.
13714
13715         PR gold/6859
13716         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
13717         symbols as not needing a dynsym entry.
13718
13719 2008-08-20  Craig Silverstein  <csilvers@google.com>
13720
13721         * fileread.cc (File_read::open): Do not lock the file unless it
13722         was successfully opened.
13723
13724 2008-08-14  Cary Coutant  <ccoutant@google.com>
13725
13726         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
13727         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
13728         * testsuite/tls_test.cc (struct int128): 128-bit struct
13729         for testing TLS relocs with non-zero addend.
13730         (v12): New TLS variable.
13731         (t12): New test.
13732         (t_last): Add check for v12.
13733         * testsuite/tls_test.h (t12): New function.
13734         * testsuite/tls_test_main.cc (thread_routine): Call new test.
13735
13736 2008-08-13  Ian Lance Taylor  <iant@google.com>
13737
13738         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
13739         set tls_segment_ or relro_segment_.
13740         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
13741         when appropriate.
13742         * output.h (Output_section::clear_is_relro): New function.
13743         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
13744         sections specially even when output_data_ is empty.
13745         (Output_segment::maximum_alignment): When first section is relro,
13746         only force alignment for PT_LOAD segments.
13747         * script.cc (script_data_segment_align): New function.
13748         (script_data_segment_relro_end): New function.
13749         * script-c.h (script_data_segment_align): Declare.
13750         (script_data_segment_relro_end): Declare.
13751         * script-sections.h (class Script_sections): Declare
13752         data_segment_align and data_segment_relro_end.  Add fields
13753         segment_align_index_ and saw_relro_end_.
13754         * script-sections.cc (class Sections_element): Add set_is_relro
13755         virtual function.  Add new bool* parameter to place_orphan_here.
13756         Add get_output_section virtual function.
13757         (class Output_section_definition): Add set_is_relro.  Add new
13758         bool* parameter to place_orphan_here.  Add get_output_section.
13759         Add is_relro_ field.
13760         (Output_section_definition::Output_section_definition): Initialize
13761         evaluated_address_, evaluated_load_address, evaluated_addralign_,
13762         and is_relro_ fields.
13763         (Output_section_definition::place_orphan_here): Add is_relro
13764         parameter.
13765         (Output_section_definition::set_section_addresses): Set relro for
13766         output section.
13767         (Output_section_definition::alternate_constraint): Likewise.
13768         (class Orphan_output_section): Add new bool* parameter to
13769         place_orphan_here.  Add get_output_section.
13770         (Orphan_output_section::place_orphan_here): Add is_relro
13771         parameter.
13772         (Script_sections::Script_sections): Initialize
13773         data_segment_align_index_ and saw_relro_end_.
13774         (Script_sections::data_segment_align): New function.
13775         (Script_sections::data_segment_relro_end): New function.
13776         (Script_sections::place_orphan): Set or clear is_relro.
13777         (Script_sections::set_section_addresses): Force alignment of first
13778         TLS section.
13779         * yyscript.y (exp): Call script_data_segment_align and
13780         script_data_segment_relro_end.
13781         * testsuite/relro_script_test.t: New file.
13782         * testsuite/relro_test.cc (using_script): Declare.
13783         (t1, t2): Test using_script.
13784         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
13785         (relro_script_test_SOURCES): Define.
13786         (relro_script_test_DEPENDENCIES): Define.
13787         (relro_script_test_LDFLAGS): Define.
13788         (relro_script_test_LDADD): Define.
13789         (relro_script_test.so): New target.
13790         * testsuite/Makefile.in: Rebuild.
13791
13792 2008-08-06  Cary Coutant <ccoutant@google.com>
13793
13794         * archive.cc (Archive::total_archives, Archive::total_members)
13795         (Archive::total_members_loaded): New variables.
13796         (Archive::setup): Add parameter.  Add option to preread
13797         archive symbols.
13798         (Archive::read_armap): Add counter.
13799         (Archive::get_file_and_offset): New function.
13800         (Archive::get_elf_object_for_member): New function.
13801         (Archive::read_all_symbols): New function.
13802         (Archive::read_symbols): New function.
13803         (Archive::add_symbols): Add counters.
13804         (Archive::include_all_members): Use armap to find members if it's
13805         already built.
13806         (Archive::include_member): Skip reading symbols if already read.
13807         Factored code into Archive::get_file_and_offset and
13808         Archive::get_elf_object_for_member.  Changed call to
13809         Mapfile::report_include_archive_member.
13810         (Archive::print_stats): New function.
13811         * archive.h: Declare Object and Read_symbols_data classes.
13812         (Archive::Archive): Add initializers for new members.
13813         (Archive::setup): Add parameter.
13814         (Archive::print_stats): New function.
13815         (Archive::total_archives, Archive::total_members)
13816         (Archive::total_members_loaded): New variables.
13817         (Archive::get_file_and_offset): New function.
13818         (Archive::get_elf_object_for_member): New function.
13819         (Archive::read_all_symbols): New function.
13820         (Archive::read_symbols): New function.
13821         (Archive::Archive_member): New class.
13822         (Archive::members_): New member.
13823         (Archive::num_members_): New member.
13824         * main.cc: Include archive.h.
13825         (main): Call Archive::print_stats.
13826         * mapfile.cc (Mapfile::report_include_archive_member): Delete
13827         archive parameter; member_name is now the fully-decorated name.
13828         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
13829         * options.h: (General_options): Add --preread-archive-symbols option.
13830         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
13831         Archive::setup.
13832
13833 2008-08-04  Ian Lance Taylor  <iant@google.com>
13834
13835         * symtab.h (Symbol::use_plt_offset): New function.
13836         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
13837         * powerpc.cc (Relocate::relocate): Likewise.
13838         * sparc.cc (Relocate::relocate): Likewise.
13839         * x86_64.cc (Relocate::relocate): Likewise.
13840         * testsuite/weak_plt.sh: New test.
13841         * testsuite/weak_plt_main.cc: New test.
13842         * testsuite/weak_plt_shared.cc: New test.
13843         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
13844         (check_PROGRAMS): Add weak_plt.
13845         (check_DATA): Add weak_plt_shared.so.
13846         (weak_plt_main_pic.o, weak_plt): New targets.
13847         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
13848         * testsuite/Makefile.in: Rebuild.
13849
13850         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
13851         gcctestdir/ld.
13852         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
13853         * testsuite/Makefile.in: Rebuild.
13854
13855 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
13856
13857         * Makefile.am (POTFILES.in): Set LC_ALL=C.
13858         * Makefile.in: Regenerate.
13859         * po/POTFILES.in: Regenerate.
13860
13861 2008-07-29  Ian Lance Taylor  <iant@google.com>
13862
13863         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
13864         symbols before other symbols.
13865         * testsuite/script_test_2.cc (test_addr): Declare.
13866         (test_addr_alias): Declare.
13867         (main): Check that test_addr and test_addr_alias have the right
13868         values.
13869         * testsuite/script_test_2.t: Define test_addr_alias and
13870         test_addr.
13871
13872 2008-07-24  Ian Lance Taylor  <iant@google.com>
13873
13874         PR 5990
13875         * descriptors.cc: New file.
13876         * descriptors.h: New file.
13877         * gold-threads.h (class Hold_optional_lock): New class.
13878         * fileread.cc: Include "descriptors.h".
13879         (File_read::~File_read): Release descriptor rather than closing
13880         it.
13881         (File_read::open) [file]: Call open_descriptor rather than open.
13882         Set is_descriptor_opened_.
13883         (File_read::open) [memory]: Assert that descriptor is not open.
13884         (File_read::reopen_descriptor): New function.
13885         (File_read::release): Release descriptor.
13886         (File_read::do_read): Make non-const.  Reopen descriptor.
13887         (File_read::read): Make non-const.
13888         (File_read::make_view): Reopen descriptor.
13889         (File_read::do_readv): Likewise.
13890         * fileread.h (class File_read): Add is_descriptor_opened_ field.
13891         Update declarations.
13892         * layout.cc: Include "descriptors.h".
13893         (Layout::create_build_id): Use open_descriptor rather than open.
13894         * output.cc: Include "descriptors.h".
13895         (Output_file::open): Use open_descriptor rather than open.
13896         * archive.cc (Archive::const_iterator): Change Archive to be
13897         non-const.
13898         (Archive::begin, Archive::end): Make non-const.
13899         (Archive::count_members): Likewise.
13900         * archive.h (class Archive): Update declarations.
13901         * object.h (Object::read): Make non-const.
13902         * Makefile.am (CCFILES): Add descriptors.cc.
13903         (HFILES): Add descriptors.h.
13904         * Makefile.in: Rebuild.
13905
13906         PR 6716
13907         * gold.h: Always include <clocale>.  Add Solaris workarounds
13908         following code in binutils/sysdep.h.
13909
13910         PR 6048
13911         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
13912         this->eh_frame_hdr_ is NULL before using it.
13913
13914         * dynobj.cc (Versions::Versions): Update comment.
13915
13916         * dynobj.cc (Versions::Versions): If there is an soname, use it as
13917         the base version name.
13918
13919         * stringpool.cc (Stringpool_template::add_with_length): Set key to
13920         array size plus one.
13921         (Stringpool_template::set_string_offsets): Subtract one from key
13922         before using it as an array index.
13923         (Stringpool_template::get_offset_with_length): Likewise.
13924         (Stringpool_template::write_to_buffer): Likewise.
13925         * stringpool.h (Stringpool_template::get_offset_from_key):
13926         Likewise.
13927
13928 2008-07-23  Ian Lance Taylor  <iant@google.com>
13929
13930         PR 6658
13931         * object.h (Merged_symbol_value::value): Do our best to handle a
13932         negative addend.
13933
13934         PR 6647
13935         * script.cc (Version_script_info::get_versions): Don't add empty
13936         version tag to return value.
13937         (Version_script_info::get_symbol_version_helper): Change return
13938         type to bool.  Add pversion parameter.  Change all callers.
13939         (script_register_vers_node): Don't require a non-NULL tag.
13940         * script.h (class Version_script_info): Update declarations.
13941         (Version_script_info::get_symbol_version): Change return type to
13942         bool.  Add version parameter.  Change all callers.
13943         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
13944         handling.  Handle an empty version from a version script.
13945         (Symbol_table::define_special_symbol): Likewise.
13946         * testsuite/ver_test_10.script: New file.
13947         * testsuite/ver_test_10.sh: New file.
13948         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
13949         (check_DATA): Add ver_test_10.syms.
13950         (ver_test_10.syms, ver_test_10.so): New target.
13951         * testsuite/Makefile.in: Rebuild.
13952
13953 2008-07-23  Simon Baldwin  <simonb@google.com>
13954
13955         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
13956         to zero for undefined symbols from dynamic libraries.
13957
13958 2008-07-23  Ian Lance Taylor  <iant@google.com>
13959
13960         * symtab.cc (Symbol_table::resolve): Remove version parameter.
13961         Change all callers.
13962         * symtab.h (class Symbol_table): Update declaration.
13963         * testsuite/ver_test_9.cc: New file.
13964         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
13965         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
13966         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
13967         (ver_test_9.so, ver_test_9.o): New targets.
13968         * testsuite/Makefile.in: Rebuild.
13969
13970 2008-07-22  Ian Lance Taylor  <iant@google.com>
13971
13972         * options.h (class General_options): Define --check-sections.
13973         * layout.cc (Layout::set_segment_offsets): Handle
13974         --check-sections.
13975
13976         * options.h (class General_options): Define -n/--nmagic and
13977         -N/--omagic.
13978         * options.cc (General_options::finalize): For -n/--nmagic or
13979         -N/--omagic, set -static.
13980         * layout.cc (Layout::attach_allocated_section_to_segment): If
13981         -N/--omagic, don't put read-only and read-write sections in
13982         different segments.
13983         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
13984         finding a read-only segment.
13985         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
13986         don't set the minimum segment alignment to the common page size,
13987         and don't set the file offset to the address modulo the page size.
13988         * script-sections.cc (Script_sections::create_segments): If
13989         -n/--omagic, don't put read-only and read-write sections in
13990         different segments.
13991
13992         * cref.cc: New file.
13993         * cref.h: New file.
13994         * options.h (class General_options): Add --print-symbol-counts.
13995         * main.cc (main): Issue defined symbol report if requested.
13996         * archive.cc (Archive::interpret_header): Make into a const member
13997         function.
13998         (Archive::add_symbols): Call Input_objects::archive_start and
13999         archive_stop.
14000         (Archive::const_iterator): Define new class.
14001         (Archive::begin, Archive::end): New functions.
14002         (Archive::include_all_members): Rewrite to use iterator.
14003         (Archive::count_members): New function.
14004         * archive.h (class Archive): Update declarations.
14005         (Archive::filename): New function.
14006         * object.cc: Include "cref.h".
14007         (Sized_relobj::Sized_relobj): Initialize defined_count_.
14008         (Sized_relobj::do_get_global_symbol_counts): New function.
14009         (Input_objects::add_object): Add object to cross-referencer.
14010         (Input_objects::archive_start): New function.
14011         (Input_objects::archive_stop): New function.
14012         (Input_objects::print_symbol_counts): New function.
14013         * object.h: Declare Cref and Archive.
14014         (Object::get_global_symbol_counts): New function.
14015         (Object::do_get_global_symbol_counts): New pure virtual function.
14016         (class Sized_relobj): Add defined_count_ field.  Update
14017         declarations.
14018         (class Input_objects): Add cref_ field.  Update constructor.
14019         Update declarations.
14020         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
14021         defined_count_.
14022         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
14023         symbol counts.
14024         (Sized_dynobj::do_get_global_symbol_counts): New function.
14025         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
14026         defined_count_.  Update declarations.  Define Symbols typedef.
14027         * symtab.cc (Symbol_table::add_from_relobj): Add defined
14028         parameter.  Change all callers.
14029         (Symbol_table::add_from_dynobj): Add sympointers and defined
14030         parameters.  Change all callers.
14031         * symtab.h (class Symbol_table): Update declarations.
14032         * Makefile.am (CCFILES): Add cref.cc.
14033         (HFILES): Add cref.h.
14034         * Makefile.in: Rebuild.
14035
14036 2008-07-22  Simon Baldwin  <simonb@google.com>
14037
14038         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
14039         to zero when writing undefined symbols.
14040
14041 2008-07-22  Ian Lance Taylor  <iant@google.com>
14042
14043         * output.cc (Output_section::add_input_section): Don't try to
14044         merge empty merge sections.
14045
14046 2008-07-21  Craig Silverstein  <csilvers@google.com>
14047
14048         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
14049         Include symbol version in error message.
14050
14051 2008-07-20  Chris Demetriou  <cgd@google.com>
14052
14053         * configure.ac (gold_cv_c_random_seed): New configured variable.
14054         (RANDOM_SEED_CFLAGS): New substituted variable.
14055         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
14056         * configure: Rebuild.
14057         * Makefile.in: Likewise.
14058         * testsuite/Makefile.in: Likewise.
14059
14060 2008-07-18  Ian Lance Taylor  <iant@google.com>
14061
14062         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
14063         where we see NAME/NULL and NAME/VERSION  as separate symbols.
14064         * testsuite/ver_test_main.cc (main): Call t4.
14065         (t4, t4_2a): Define.
14066         * testsuite/ver_test_2.cc (t4_2): Define.
14067         * testsuite/ver_test_2.script: Put t4_2a in VER2.
14068         * testsuite/ver_test_4.cc (t4_2a): Define.
14069         * testsuite/ver_test_4.script: Put t4_2a in VER2.
14070         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
14071
14072 2008-07-17  Ian Lance Taylor  <iant@google.com>
14073
14074         * dynobj.cc (Versions::add_def): If we give an error about a
14075         missing version, go ahead and create the version anyhow.
14076
14077 2008-07-10  Ian Lance Taylor  <iant@google.com>
14078
14079         Handle output sections with more than 0x7fffffff bytes.
14080         * object.h (class Relobj): Change map_to_output_ to
14081         output_sections_, and just keep a section pointer.  Change all
14082         uses.  Move comdat group support to Sized_relobj.
14083         (Relobj::is_section_specially_mapped): Remove.
14084         (Relobj::output_section): Remove poff parameter.  Change all
14085         callers.
14086         (Relobj::output_section_offset): New function.
14087         (Relobj::set_section_offset): Rewrite.
14088         (Relobj::map_to_output): Remove.
14089         (Relobj::output_sections): New function.
14090         (Relobj::do_output_section_offset): New pure virtual function.
14091         (Relobj::do_set_section_offset): Likewise.
14092         (class Sized_relobj): Add section_offsets_ field.  Add comdat
14093         group support from Relobj.  Update declarations.
14094         (Sized_relobj::get_output_section_offset): New function.
14095         (Sized_relobj::do_output_section_offset): New function.
14096         (Sized_relobj::do_set_section_offset): New function.
14097         * object.cc (Relobj::output_section_address): Remove.
14098         (Sized_relobj::Sized_relobj): Initialize new fields.
14099         (Sized_relobj::include_section_group): Cast find_kept_object to
14100         Sized_relobj.
14101         (Sized_relobj::include_linkonce_section): Likewise.
14102         (Sized_relobj::do_layout): Use separate arrays for output section
14103         and output offset.
14104         (Sized_relobj::do_count_local_symbols): Change map_to_output to
14105         output_sections.
14106         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
14107         output_sections and section_offsets.
14108         (Sized_relobj::write_local_symbols): Likewise.
14109         (map_to_kept_section): Compute output address directly.
14110         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
14111         output_sections and section_offsets.
14112         (Sized_relobj::write_sections): Likewise.
14113         (Sized_relobj::relocate_sections): Likewise.
14114         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
14115         * output.h (class Output_reloc): Update declarations.  Change
14116         u2_.relobj to Sized_relobj*.
14117         (class Output_data_reloc): Change add functions to use
14118         Sized_relobj*.
14119         * output.cc (Output_reloc::Output_reloc): Change relobj to
14120         Sized_relobj*.
14121         (Output_reloc::local_section_offset): Change return type to
14122         Elf_Addr.  Use get_output_section_offset.
14123         (Output_reloc::get_address): Likewise.
14124         (Output_section::is_input_address_mapped): Don't call
14125         is_section_specially_mapped.
14126         (Output_section::output_offset): Likewise.
14127         (Output_section::output_address): Likewise.
14128         (Output_section::starting_output_address): Likewise.
14129         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
14130         parameter to Sized_relobj*.
14131         (Copy_relocs::need_copy_reloc): Likewise.
14132         (Copy_relocs::save): Likewise.
14133         * copy-relocs.h (class Copy_relocs): Update declarations.
14134         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
14135         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
14136         * target-reloc.h (relocate_for_relocatable): Change
14137         offset_in_output_section type to Elf_Addr.  Change code that uses
14138         it as well.
14139         * layout.cc (Layout::layout): Always set *off.
14140         * mapfile.cc (Mapfile::print_input_section): Use
14141         output_section_offset.
14142         * i386.cc (Target_i386::copy_reloc): Change object parameter to
14143         Sized_relobj*.
14144         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
14145         * sparc.cc (Target_sparc::copy_reloc): Likewise.
14146         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
14147
14148 2008-07-03  Ian Lance Taylor  <iant@google.com>
14149
14150         * layout.cc (Layout::include_section): Do not discard unrecognized
14151         SHT_STRTAB sections.
14152
14153 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
14154
14155         * script.cc (Lex::can_continue_name): Make '?' allowable in
14156         version-script names.
14157         * testsuite/version_script.map: Change glob pattern to use '?'
14158
14159 2008-06-30  Manish Singh  <yosh@gimp.org>
14160
14161         PR 6585
14162         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
14163         Correct typo.
14164
14165 2008-06-30  Ian Lance Taylor  <iant@google.com>
14166
14167         PR 6660
14168         PR 6682
14169         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
14170         versions]: Don't try to read the value in the contents, since we
14171         don't use it.  Use the template endianness when writing.
14172
14173 2008-06-25  Cary Coutant  <ccoutant@google.com>
14174
14175         * fileread.cc (File_read::make_view): Assert on zero-length view.
14176         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
14177         symbol table when there are no symbols to read.
14178
14179 2008-06-23  Craig Silverstein  <csilvers@google.com>
14180
14181         * version.cc (version_string): Bump to 1.7
14182
14183 2008-06-18  Craig Silverstein  <csilvers@google.com>
14184
14185         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
14186         constant 0xFFFF to type Valtype.
14187         (Powerpc_relocate_functions::rel16_ha): Likewise.
14188
14189 2008-06-17  Ian Lance Taylor  <iant@google.com>
14190
14191         * output.h (Output_section::Input_section): Initialize p2align_ to
14192         zero for Output_section_data constructors.
14193         (Output_section::Input_section::addralign): If not an input
14194         section, return the alignment of the Output_section_data.
14195         * testsuite/copy_test.cc: New file.
14196         * testsuite/copy_test_1.cc: New file.
14197         * testsuite/copy_test_2.cc: New file.
14198         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
14199         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
14200         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
14201         (copy_test_1_pic.o, copy_test_1.so): New targets.
14202         (copy_test_2_pic.o, copy_test_2.so): New targets.
14203         * testsuite/Makefile.in: Rebuild.
14204
14205         * script-sections.cc (Script_sections::place_orphan): Initialize
14206         local variable exact.
14207
14208 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
14209
14210         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
14211
14212 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
14213             David S. Miller  <davem@davemloft.net>
14214
14215         * powerpc.cc: New file.
14216         * Makefile.am (TARGETSOURCES): Add powerpc.cc
14217         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
14218         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
14219         * Makefile.in: Rebuild.
14220
14221 2008-06-09  Ian Lance Taylor  <iant@google.com>
14222
14223         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
14224         <exception>.
14225         (throwing, orig_terminate): New static variables.
14226         (terminate_handler): New static function.
14227         (t2): Set terminate handler.
14228
14229 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
14230
14231         PR 6584
14232         * binary.cc (Binary_to_elf::sized_convert): Fix .data
14233         alignment.
14234
14235 2008-05-30  Cary Coutant  <ccoutant@google.com>
14236
14237         * archive.cc (Archive::include_all_members) Correct to step
14238         over symbol table and extended name table in thin archives.
14239
14240 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
14241
14242         PR 6407
14243         * target-reloc.h (relocate_for_relocatable): Fix new_offset
14244         calculation.
14245
14246 2008-05-28  Caleb Howe  <cshowe@google.com>
14247
14248         * reduced_debug_output.cc: New file.
14249         * reduced_debug_output.h: New file.
14250         * options.h (class General_options): Add --strip-debug-non-line.
14251         * options.cc (General_options::finalize): Add strip_debug_non_line
14252         to the strip heirarchy.
14253         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
14254         fields.
14255         * layout.cc: Include "reduced_debug_output.h".
14256         (Layout::Layout): Initialize new fields.
14257         (line_only_debug_sections): New static array.
14258         (is_lines_only_debug_sections): New static inline function.
14259         (Layout::include_section): Handle --strip-debug-non-line.
14260         (Layout::make_output_section): If --strip-debug-non-line, build
14261         new output sections for .debug_abbrev and .debug_info.
14262         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
14263         gold.  Warn about possible overflow.
14264         (read_signed_LEB_128): Likewise.
14265         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
14266         (read_signed_LEB_128): Declare.
14267         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
14268         (HFILES): Add reduced_debug_output.h.
14269         * Makefile.in: Rebuild.
14270
14271 2008-05-21  Ian Lance Taylor  <iant@google.com>
14272
14273         * mapfile.cc: New file.
14274         * mapfile.h: New file.
14275         * options.h (class General_options): Add -M/--print-map and -Map.
14276         * options.cc (General_options::finalize): Make -M equivalent to
14277         -Map -.
14278         * main.cc: Include <cstdio> and "mapfile.h".
14279         (main): Open mapfile if requested.
14280         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
14281         constructor.  Change caller.
14282         (queue_initial_tasks): Add mapfile parameter.  Change caller.
14283         (queue_middle_tasks): Likewise.
14284         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
14285         declarations.
14286         * archive.cc: Include "mapfile.h".
14287         (Archive::add_symbols): Add mapfile parameter.  Change all
14288         callers.  Pass mapfile, symbol, and reason to include_member.
14289         (Archive::include_all_members): Add mapfile parameter.  Change all
14290         callers.
14291         (Archive::include_member): Add mapfile, sym, and why parameters.
14292         Change all callers.  Report inclusion to map file.
14293         * archive.h: Include "fileread.h".
14294         (class Archive): Update declarations.
14295         (Archive::file): New const method.
14296         (class Add_archive_symbols): Add mapfile_ field.  Update
14297         constructor.  Change all callers.
14298         * readsyms.h (class Read_symbols): Likewise.
14299         (class Finish_group): Likewise.
14300         (class Read_script): Likewise.
14301         * common.cc: Include "mapfile.h".
14302         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
14303         all callers.
14304         (Symbol_table::do_allocate_commons): Likewise.
14305         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
14306         symbol allocation to mapfile.
14307         * common.h (class Allocate_commons_task): Add mapfile_ field.
14308         Update constructor.  Change all callers.
14309         * symtab.h (class Symbol_table): Update declarations.
14310         * layout.cc: Include "mapfile.h".
14311         (Layout_task_runner::run): Print information to mapfile.
14312         (Layout::create_gold_note): Change Output_data_fixed_space to
14313         Output_data_zero_fill.
14314         (Layout::create_build_id): Likewise.
14315         (Layout::print_to_mapfile): New function.
14316         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
14317         constructor.  Change caller.
14318         (class Layout): Declare print_to_mapfile.
14319         * output.cc (Output_section::Input_section::print_to_mapfile): New
14320         function.
14321         (Output_section::add_input_section): If producing a map, always
14322         add to input_sections_ list.
14323         (Output_section::do_print_to_mapfile): New function.
14324         (Output_segment::print_sections_to_mapfile): New function.
14325         (Output_segment::print_section_list_to_mapfile): New function.
14326         * output.h: Include "mapfile.h".
14327         (Output_data::print_to_mapfile): New function.
14328         (Output_data::do_print_to_mapfile): New virtual function.
14329         (Output_segment_headers::do_print_to_mapfile): New function.
14330         (Output_file_header::do_print_to_mapfile): New function.
14331         (Output_data_const::do_print_to_mapfile): New function.
14332         (class Output_data_const_buffer): Add map_name_ field.  Update
14333         constructor.  Change all callers.  Add do_print_to_mapfile
14334         function.
14335         (class Output_data_fixed_space): Likewise.
14336         (class Output_data_space): Likewise.
14337         (class Output_data_zero_fill): New class.
14338         (Output_data_strtab::do_print_to_mapfile): New function.
14339         (Output_data_reloc_base::do_print_to_mapfile): New function.
14340         (Output_relocatable_relocs::do_print_to_mapfile): New function.
14341         (Output_data_group::do_print_to_mapfile): New function.
14342         (Output_data_got::do_print_to_mapfile): New function.
14343         (Output_data_dynamic::do_print_to_mapfile): New function.
14344         (Output_symtab_xindex::do_print_to_mapfile): New function.
14345         (class Output_section): Declare do_print_to_mapflie.  Declare
14346         print_to_mapfile in Input_section.
14347         (class Output_segment): Declare new functions.
14348         * object.h (Sized_relobj::symbol_count): New function.
14349         * script-sections.cc
14350         (Output_section_element_dot_assignment::set_section_addresses):
14351         Change Output_data_fixed_space to Output_data_zero_fill.
14352         (Output_data_expression::do_print_to_mapfile): New function.
14353         * script.cc (read_input_script): Add mapfile parameter.  Change
14354         all callers.
14355         * script.h (read_input_script): Update declaration.
14356         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
14357         (Eh_frame::do_print_to_mapfile): New function.
14358         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
14359         (Output_merge_string::do_print_to_mapfile): New function.
14360         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
14361         function.
14362         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
14363         function.
14364         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
14365         function.
14366         * Makefile.am (CCFILES): Add mapfile.cc.
14367         (HFILES): Add mapfile.h.
14368         * Makefile.in: Rebuild.
14369
14370 2008-05-19  Ian Lance Taylor  <iant@google.com>
14371
14372         * options.h (class General_options): Add -z relro.
14373         * layout.cc (Layout::Layout): Initialize relro_segment_.
14374         (Layout::add_output_section_data): Return the output section.
14375         (Layout::make_output_section): Rcognize relro sections and mark
14376         them appropriately.
14377         (Layout::attach_allocated_section_to_segment): Put relro sections
14378         in a PT_GNU_RELRO segment.
14379         (Layout::create_initial_dynamic_sections): Mark the .dynamic
14380         section as relro.
14381         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
14382         PT_TLS segments.
14383         (Layout::linkonce_mapping): Map d.rel.ro.local to
14384         .data.rel.ro.local.
14385         (Layout::output_section_name): Us .data.rel.ro.local for any
14386         section which begins with that.
14387         * layout.h (class Layout): Update add_output_section_data
14388         declaration.  Add relro_segment_ field.
14389         * output.cc (Output_section::Output_section): Initialize is_relro_
14390         and is_relro_local_ fields.
14391         (Output_segment::add_output_section): Group relro sections.
14392         (Output_segment::is_first_section_relro): New function.
14393         (Output_segment::maximum_alignment): If there is a relro section,
14394         align the segment to the common page size.
14395         (Output_segment::set_section_addresses): Track whether we are
14396         looking at relro sections.  If the last section is a relro
14397         section, align to the common page size.
14398         (Output_segment::set_section_list_addresses): Add in_relro
14399         parameter.  Change all callers.  Align to the page size when
14400         moving from relro to non-relro section.
14401         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
14402         segment.
14403         * output.h (class Output_section): Add is_relro_ and
14404         is_relro_local_ fields.
14405         (Output_section::is_relro): New function.
14406         (Output_section::set_is_relro): New function.
14407         (Output_section::is_relro_local): New function.
14408         (Output_section::set_is_relro_local): New function.
14409         (class Output_segment): Update declarations.
14410         * i386.cc (Target_i386::got_section): Mark .got section as relro.
14411         * sparc.cc (Target_sparc::got_section): Likewise.
14412         * x86_64.cc (Target_x86_64::got_section): Likewise.
14413         * testsuite/relro_test_main.cc: New file.
14414         * testsuite/relro_test.cc: New file.
14415         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
14416         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
14417         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
14418         (relro_test.so, relro_test_pic.o): New targets.
14419         * testsuite/Makefile.in: Rebuild.
14420
14421 2008-05-16  Ian Lance Taylor  <iant@google.com>
14422
14423         * output.cc (Output_segment::add_output_section): Remove front
14424         parameter.
14425         * output.h (class Output_segment): Remove
14426         add_initial_output_section and overloaded add_output_section.
14427         Update declaration of remaining add_output_section.
14428         * layout.cc (Layout::create_interp): Call add_output_section
14429         rather than add_initial_output_section.
14430         (Layout::finish_dynamic_section): Likewise.
14431
14432         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
14433         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
14434         know the dynamic type.
14435         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
14436         field.  Initialize it in constructor.
14437         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
14438         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
14439         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
14440         reloc.
14441
14442         * output.cc (Output_reloc::get_address): Change return type to
14443         Elf_Addr.
14444         * output.h (class Output_reloc): Update get_address declaration.
14445         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
14446         for section addresses.
14447
14448 2008-05-09  Ian Lance Taylor  <iant@google.com>
14449
14450         PR 6493
14451         * gold.cc (gold_nomem): Use return value of write.
14452
14453 2008-05-08  Ian Lance Taylor  <iant@google.com>
14454
14455         * symtab.c (Symbol::init_base_output_data): Add version
14456         parameter.  Change all callers.
14457         (Symbol::init_base_output_segment): Likewise.
14458         (Symbol::init_base_constant): Likewise.
14459         (Symbol::init_base_undefined): Likewise.
14460         (Sized_symbol::init_output_data): Likewise.
14461         (Sized_symbol::init_output_segment): Likewise.
14462         (Sized_symbol::init_constant): Likewise.
14463         (Sized_symbol::init_undefined): Likewise.
14464         (Symbol_table::do_define_in_output_data): If the new symbol has a
14465         version, mark it as the default.
14466         (Symbol_table::do_define_in_output_segment): Likewise.
14467         (Symbol_table::do_define_as_constant): Likewise.
14468         * symtab.h (class Symbol): Update declarations.
14469         (class Sized_symbol): Likewise.
14470         * resolve.cc (Symbol::override_version): New function.
14471         (Symbol::override_base): Call override_version.
14472         (Symbol::override_base_with_special): Likewise.
14473         * testsuite/ver_script_8.script: New file.
14474         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
14475         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
14476         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
14477         (ver_test_8_1.so, ver_test_8_2.so): New targets.
14478
14479 2008-05-06  Ian Lance Taylor  <iant@google.com>
14480
14481         PR 6049
14482         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
14483         functions.
14484         (class General_options): Remove existing --undefined, and add
14485         --no-undefined instead.  Add new --undefined as synonym for -u.
14486         * archive.cc (Archive::add_symbols): Check whether symbol was
14487         named with -u.
14488         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
14489         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
14490         all uses.  Add IS_UNDEFINED.  Update declarations to split
14491         different versions of init_base.  Declare init_base_undefined.
14492         (Symbol::is_defined): Handle IS_UNDEFINED.
14493         (Symbol::is_undefined): Likewise.
14494         (Symbol::is_weak_undefined): Call is_undefined.
14495         (Symbol::is_absolute): Handle IS_CONSTANT.
14496         (class Sized_symbol): Update declarations to split different
14497         versions of init.  Declare init_undefined.
14498         (class Symbol_table): Declare new functions.
14499         * symtab.cc (Symbol::init_base_object): Rename from init_base.
14500         Change all callers.
14501         (Symbol::init_base_output_data): Likewise.
14502         (Symbol::init_base_output_segment): Likewise.
14503         (Symbol::init_base_constant): Likewise.
14504         (Symbol::init_base_undefined): New function.
14505         (Sized_symbol::init_object): Rename from init.  Change all
14506         callers.
14507         (Sized_symbol::init_output_data): Likewise.
14508         (Sized_symbol::init_output_segment): Likewise.
14509         (Sized_symbol::init_constant): Likewise.
14510         (Sized_symbol::init_undefined): New function.
14511         (Symbol_table::add_undefined_symbols_from_command_line): New
14512         function.
14513         (Symbol_table::do_add_undefined_symbols_from_command_line): New
14514         function.
14515         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
14516         (Symbol::output_section): Likewise.
14517         (Symbol::set_output_section): Likewise.
14518         (Symbol_table::sized_finalize_symbol): Likewise.
14519         (Symbol_table::sized_write_globals): Likewise.
14520         * resolve.cc (Symbol_table::should_override): Likewise.
14521         (Symbol::override_base_with_special): Likewise.
14522
14523         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
14524         symbol, change it to have default visibility.
14525         * testsuite/protected_1.cc: New file.
14526         * testsuite/protected_2.cc: New file.
14527         * testsuite/protected_3.cc: New file.
14528         * testsuite/protected_main_1.cc: New file.
14529         * testsuite/protected_main_2.cc: New file.
14530         * testsuite/protected_main_3.cc: New file.
14531         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
14532         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
14533         (protected_1_LDFLAGS, protected_1_LDADD): Define.
14534         (protected_1.so): New target.
14535         (protected_1_pic.o, protected_2_pic.o): New targets.
14536         (protected_3_pic.o): New target.
14537         (check_PROGRAMS): Add protected_2.
14538         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
14539         (protected_2_LDFLAGS, protected_2_LDADD): Define.
14540         * testsuite/Makefile.in: Rebuild.
14541
14542         * options.h (DEFINE_var): Add set_user_set_##varname__.
14543         (DEFINE_bool_alias): New macro.
14544         (class General_options): Define -Bstatic using DEFINE_bool_alias
14545         rather than DEFINE_special.  Add --undefined as an alias for -z
14546         defs.
14547         * options.cc (General_options::parse_Bstatic): Remove.
14548
14549         * options.h (class General_options): Add --fatal-warnings.
14550         * main.cc (main): Implement --fatal-warnings.
14551         * errors.h (Errors::warning_count): New function.
14552
14553         * options.h (class General_options): Add -Bsymbolic-functions.
14554         * symtab.h (Symbol::is_preemptible): Check for
14555         -Bsymbolic-functions.
14556
14557 2008-05-05  Ian Lance Taylor  <iant@google.com>
14558
14559         * options.h (DEFINE_bool): For DASH_Z, create the negative option
14560         as noVARNAME rather than no-VARNAME.
14561         (class General_options): Add option -z combreloc.
14562         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
14563         get_address.
14564         (Output_reloc::sort_before) [SHT_REL]: New function.
14565         (Output_reloc::sort_before) [SHT_RELA]: New function.
14566         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
14567         Sort_relocs_comparison.
14568         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
14569         parameter.  Change all callers.
14570         (Output_data_reloc::Output_data_reloc) [both versions]: Add
14571         sort_relocs parameter.  Change all callers.
14572         * output.cc (Output_reloc::get_address): New function, broken out
14573         of write_rel.
14574         (Output_reloc::write_rel): Call it.
14575         (Output_reloc::compare): New function.
14576         (Output_data_reloc_base::do_write): Optionally sort relocs.
14577
14578         * configure.ac: If targ_extra_obj is set, link it in.
14579         * configure.tgt: Initialize all variables.
14580         (x86_64*): Set targ_extra_obj and targ_extra_size.
14581         * configure: Rebuild.
14582
14583         * object.cc (Sized_relobj::include_section_group): Adjust section
14584         indexes read from group data.  Build vector to pass to
14585         layout_group.
14586         * layout.cc (Layout::layout_group): Add flags and shndxes
14587         parameters.  Remove contents parameter.  Change caller.  Update
14588         explicit instantiations.
14589         * layout.h (class Layout): Update layout_group declaration.
14590         * output.cc (Output_data_group::Output_data_group): Add flags and
14591         input_shndxes parameters.  Remove contents parameter.  Change
14592         caller.
14593         (Output_data_group::do_write): Change input_sections_ to
14594         input_shndxes_.
14595         * output.h (class Output_data_group): Update constructor
14596         declaration.  Rename input_sections_ to input_shndxes_.
14597         * testsuite/many_sections_test.cc: Add template.
14598
14599 2008-04-30  Cary Coutant  <ccoutant@google.com>
14600
14601         * target-reloc.h (relocate_section): Fix dead-pointer bug.
14602
14603         * layout.cc (Layout::include_section): Refactored check for debug
14604         info section.
14605         (Layout::add_comdat): Add new parameters.  Change type
14606         of signature parameter.  Add object and shndx to signatures table.
14607         (Layout::find_kept_object): New function.
14608         * layout.h: Include <cstring>.
14609         (Layout::is_debug_info_section): New function.
14610         (Layout::add_comdat): Add new parameters.
14611         (Layout::find_kept_object): New function.
14612         (Layout::Kept_section): New struct.
14613         (Layout::Signatures): Change type of map range.
14614         * object.cc (Relobj::output_section_address): New function.
14615         (Sized_relobj::include_section_group): Add new parameters.  Change
14616         calls to Layout::add_comdat.  Change to build table of kept comdat
14617         groups and table mapping discarded sections to kept sections.
14618         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
14619         (Sized_relobj::do_layout): Change calls to include_section_group and
14620         include_linkonce_section.
14621         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
14622         value to zero when section is discarded.
14623         (Sized_relobj::map_to_kept_section): New function.
14624         * object.h (Relobj::output_section_address): New function.
14625         (Relobj::Comdat_group): New type.
14626         (Relobj::find_comdat_group): New function.
14627         (Relobj::Comdat_group_table): New type.
14628         (Relobj::Kept_comdat_section): New type.
14629         (Relobj::Kept_comdat_section_table): New type.
14630         (Relobj::add_comdat_group): New function.
14631         (Relobj::set_kept_comdat_section): New function.
14632         (Relobj::get_kept_comdat_section): New function.
14633         (Relobj::comdat_groups_): New field.
14634         (Relobj::kept_comdat_sections_): New field.
14635         (Symbol_value::input_value): Update comment.
14636         (Sized_relobj::map_to_kept_section) New function.
14637         (Sized_relobj::include_linkonce_section): Add new parameter.
14638         * target-reloc.h (Comdat_behavior): New type.
14639         (get_comdat_behavior): New function.
14640         (relocate_section): Add code to map a discarded section to the
14641         corresponding kept section when applying a relocation.
14642
14643 2008-04-30  Craig Silverstein  <csilvers@google.com>
14644
14645         * dwarf_reader.cc (next_generation_count): New static var.
14646         (Addr2line_cache_entry): New struct.
14647         (addr2line_cache): New static var.
14648         (Dwarf_line_info::one_addr2line): Added caching.
14649         (Dwarf_line_info::clear_addr2line_cache): New function.
14650         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
14651         cache-size parameter.
14652         (Dwarf_line_info::one_addr2line_cache): New function.
14653         * symtab.cc (Symbol_table::detect_odr_violations): Pass
14654         new cache-size argument to one_addr2line(), and clear cache.
14655
14656 2008-04-28  Cary Coutant  <ccoutant@google.com>
14657
14658         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
14659         R_386_PC8 relocations.
14660
14661 2008-04-23  Ian Lance Taylor  <iant@google.com>
14662
14663         * object.cc (Sized_relobj::include_section_group): Check for
14664         invalid section group.
14665
14666         * object.cc (make_elf_object): Correct test for 64-bit ELF file
14667         header size.
14668
14669         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
14670         than read for file header.
14671         * archive.cc (Archive::include_member): Likewise.
14672
14673 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
14674
14675         * aclocal.m4: Regenerate.
14676         * configure: Regenerate.
14677
14678 2008-04-19  Ian Lance Taylor  <iant@google.com>
14679
14680         * version.cc (version_string): Bump to 1.6.
14681
14682         * testsuite/Makefile.am (many_sections_r_test): New target.
14683         (many_sections_r_test_SOURCES): Remove.
14684         (many_sections_r_test_DEPENDENCIES): Remove.
14685         (many_sections_r_test_LDFLAGS): Remove.
14686         (many_sections_r_test_LDADD): Remove.
14687
14688         * object.cc (Sized_relobj::do_add_symbols): Always pass
14689         local_symbol_count_ to add_from_relobj.
14690
14691         * testsuite/Makefile.am (many_sections_check.h): Only check one in
14692         every thousand variables.
14693         * testsuite/Makefile.in: Rebuild.
14694
14695         * object.cc (Xindex::initialize_symtab_xindex): New function.
14696         (Xindex::read_symtab_xindex): New function.
14697         (Xindex::sym_xindex_to_shndx): New function.
14698         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
14699         available.
14700         (Sized_relobj::do_initialize_xindex): New function.
14701         (Sized_relobj::do_read_symbols): Adjust section links.
14702         (Sized_relobj::symbol_section_and_value): Add is_ordinary
14703         parameter.  Change all callers.
14704         (Sized_relobj::include_section_group): Adjust section links and
14705         symbol section indexes.
14706         (Sized_relobj::do_layout): Adjust section links.
14707         (Sized_relobj::do_count_local_symbols): Adjust section links and
14708         symbol section indexes.
14709         (Sized_relobj::do_finalize_local_symbols): Distinguish between
14710         ordinary and special symbols.
14711         (Sized_relobj::write_local_symbols): Add symtab_xindex and
14712         dynsym_xindex parameters.  Change all callers.  Adjust section
14713         links.  Use SHN_XINDEX when needed.
14714         (Sized_relobj::get_symbol_location_info): Adjust section links.
14715         Don't get fooled by special symbols.
14716         * object.h (class Xindex): Define.
14717         (class Object): Add xindex_ parameter.  Declare virtual functoin
14718         do_initialize_xindex.
14719         (Object::adjust_sym_shndx): New function.
14720         (Object::set_xindex): New protected function.
14721         (class Symbol_value): Add is_ordinary_shndx_ field.
14722         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
14723         (Symbol_value::value): Assert ordinary section.
14724         (Symbol_value::initialize_input_to_output_map): Likewise.
14725         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
14726         Change all callers.
14727         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
14728         all callers.
14729         (class Sized_relobj): Update declarations.
14730         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
14731         parameter.  Change all callers.
14732         (Sized_relobj::adjust_shndx): New function.
14733         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
14734         field.
14735         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
14736         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
14737         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
14738         (Sized_dynobj::read_dynsym_section): Adjust section links.
14739         (Sized_dynobj::read_dynamic): Likewise.
14740         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
14741         section links.
14742         (Sized_dynobj::do_initialize_xindex): New function.
14743         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
14744         do_initialize_xindex.
14745         (Sized_dynobj::adjust_shndx): New function.
14746         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
14747         dynsym_xindex_ fields.
14748         (Layout::finalize): Add a call to set_section_indexes before
14749         creating the symtab sections.
14750         (Layout::set_section_indexes): Don't do anything if the section
14751         already has a section index.
14752         (Layout::create_symtab_sections): Add shnum parameter.  Change
14753         caller.  Create .symtab_shndx section if needed.
14754         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
14755         caller.
14756         (Layout::allocated_output_section_count): New function.
14757         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
14758         needed.
14759         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
14760         fields.  Update declarations.
14761         (Layout::symtab_xindex): New function.
14762         (Layout::dynsym_xindex): New function.
14763         (class Write_symbols_task): Add layout_ field.
14764         (Write_symbols_task::Write_symbols_task): Add layout parameter.
14765         Change caller.
14766         * output.cc (Output_section_headers::Output_section_headers): Add
14767         shstrtab_section parameter.  Change all callers.
14768         (Output_section_headers::do_sized_write): Store overflow values
14769         for section count and section string table section index in
14770         section header zero.
14771         (Output_file_header::do_sized_write): Check for overflow of
14772         section count and section string table section index.
14773         (Output_symtab_xindex::do_write): New function.
14774         (Output_symtab_xindex::endian_do_write): New function.
14775         * output.h (class Output_section_headers): Add shstrtab_section_.
14776         Update declarations.
14777         (class Output_symtab_xindex): Define.
14778         (Output_section::has_out_shndx): New function.
14779         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
14780         field.
14781         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
14782         Change all callers.
14783         (Sized_symbol::init): Likewise.
14784         (Symbol::output_section): Check for ordinary symbol.
14785         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
14786         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
14787         callers.
14788         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
14789         Change all callers.  Simplify handling of symbols from sections
14790         not included in the link.
14791         (Symbol_table::add_from_dynobj): Handle ordinary symbol
14792         distinction.
14793         (Weak_alias_sorter::operator()): Assert that symbols are
14794         ordinary.
14795         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
14796         distinction.
14797         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
14798         parameters.  Change all callers.
14799         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
14800         symbol distinction.  Use SHN_XINDEX when needed.
14801         (Symbol_table::write_section_symbol): Add symtab_xindex
14802         parameter.  Change all callers.
14803         (Symbol_table::sized_write_section_symbol): Likewise.  Use
14804         SHN_XINDEX when needed.
14805         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
14806         declarations.
14807         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
14808         (Symbol::is_defined): Check is_ordinary.
14809         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
14810         (Symbol::is_absolute, Symbol::is_common): Likewise.
14811         (class Sized_symbol): Update declarations.
14812         (class Symbol_table): Update declarations.
14813         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
14814         parameters.  Change all callers.
14815         (Sized_symbol::override): Likewise.
14816         (Symbol_table::override): Likewise.
14817         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
14818         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
14819         is_ordinary, and orig_st_shndx parameters.  Change all callers.
14820         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
14821         to be in an ordinary section.
14822         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
14823         object and is_ordinary parameters.  Change all callers.
14824         (Sized_dwarf_line_info::read_relocs): Add object parameter.
14825         Change all callers.  Don't add undefined or non-ordinary symbols
14826         to reloc_map_.
14827         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
14828         Change all callers.
14829         * dwarf_reader.h (class Sized_dwarf_line_info): Update
14830         declarations.
14831         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
14832         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
14833         (Sized_relobj::relocate_sections): Likewise.
14834         * target-reloc.h (scan_relocs): Adjust section symbol index.
14835         (scan_relocatable_relocs): Likewise.
14836         * i386.cc (Scan::local): Check for ordinary symbols.
14837         * sparc.cc (Scan::local): Likewise.
14838         * x86_64.cc (Scan::local): Likewise.
14839         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
14840         to symbol_section_and_value.
14841         * testsuite/many_sections_test.cc: New file.
14842         * testsuite/Makefile.am (BUILT_SOURCES): Define.
14843         (check_PROGRAMS): Add many_sections_test.
14844         (many_sections_test_SOURCES): Define.
14845         (many_sections_test_DEPENDENCIES): Define.
14846         (many_sections_test_LDFLAGS): Define.
14847         (BUILT_SOURCES): Add many_sections_define.h.
14848         (many_sections_define.h): New target.
14849         (BUILT_SOURCES): Add many_sections_check.h.
14850         (many_sections_check.h): New target.
14851         (check_PROGRAMS): Add many_sections_r_test.
14852         (many_sections_r_test_SOURCES): Define.
14853         (many_sections_r_test_DEPENDENCIES): Define.
14854         (many_sections_r_test_LDFLAGS): Define.
14855         (many_sections_r_test_LDADD): Define.
14856         (many_sections_r_test.o): New target.
14857         * testsuite/Makefile.in: Rebuild.
14858
14859 2008-04-17  Cary Coutant  <ccoutant@google.com>
14860
14861         * errors.cc (Errors::info): New function.
14862         (gold_info): New function.
14863         * errors.h (Errors::info): New function.
14864         * gold.h (gold_info): New function.
14865         * object.cc (Input_objects::add_object): Print trace output.
14866         * options.cc (options::parse_set): New function.
14867         (General_options::parse_wrap): Deleted.
14868         (General_options::General_options): Deleted initializer.
14869         * options.h (options::String_set): New typedef.
14870         (options::parse_set): New function.
14871         (DEFINE_set): New macro.
14872         (General_options::wrap): Changed to use DEFINE_set. Changed
14873         callers of any_wrap_symbols and is_wrap_symbol.
14874         (General_options::trace, General_options::trace_symbol):
14875         New options.
14876         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
14877         (General_options::wrap_symbols_): Deleted.
14878         * symtab.cc (Symbol_table::add_from_object): Print trace output.
14879
14880 2008-04-17  David S. Miller  <davem@davemloft.net>
14881
14882         * options.cc (General_options::parse_V): New function.
14883         * options.h: Add entries for -V and -Qy.
14884
14885 2008-04-17  Ian Lance Taylor  <iant@google.com>
14886
14887         * common.cc (Symbol_table::allocate_commons): Remove options
14888         parameter.  Change caller.
14889         (Symbol_table::do_allocate_commons): Remove options parameter.
14890         Change caller.  Just call do_allocate_commons_list twice.
14891         (Symbol_table::do_allocate_commons_list): New function, broken out
14892         of do_allocate_commons.
14893         * common.h (class Allocate_commons_task): Remove options_ field.
14894         Update constructor.
14895         * symtab.cc (Symbol_table::Symbol_table): Initialize
14896         tls_commons_.
14897         (Symbol_table::add_from_object): Put TLS common symbols on
14898         tls_commons_ list.
14899         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
14900         which are IN_OUTPUT_DATA.
14901         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
14902         allocate_commons and do_allocate_commons declarations.  Declare
14903         do_allocate_commons_list.
14904         * gold.cc (queue_middle_tasks): Update creation of
14905         Allocate_commons_task to not pass options.
14906         * testsuite/Makefile.am (INCLUDES): Add -I.. .
14907         (TLS_TEST_C_FLAGS): New variable.
14908         (tls_test_c_pic.o): New target.
14909         (tls_test_shared.so): Link in tls_test_c_pic.o.
14910         (tls_test_c_pic_ie.o): New target.
14911         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
14912         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
14913         (tls_test_c.o): New target.
14914         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
14915         (tls_pic_test_LDADD): Likewise.
14916         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
14917         (tls_shared_gd_to_ie_test_LDADD): Likewise.
14918         (tls_test_c_gnu2.o): New target.
14919         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
14920         tls_test_c_gnu2.o.
14921         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
14922         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
14923         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
14924         * testsuite/tls_test.cc: Include "config.h".
14925         (t_last): Call t11_last.
14926         * testsuite/tls_test.h (t11, t11_last): Declare.
14927         * testsuite/tls_test_c.c: New file.
14928         * testsuite/tls_test_main.cc (thread_routine): Call t11.
14929         * configure.ac: Check for OpenMP support.
14930         * configure, config.in, Makefile.in: Rebuild.
14931         * testsuite/Makefile.in: Rebuild.
14932
14933 2008-04-16  Cary Coutant  <ccoutant@google.com>
14934
14935         * i386.cc (Target_i386::define_tls_base_symbol): New function.
14936         (Target_i386::tls_base_symbol_defined_): New field.
14937         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
14938         (Target_i386::Scan::global): Likewise.
14939         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
14940         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
14941         (Target_x86_64::tls_base_symbol_defined_): New field.
14942         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
14943         (Target_x86_64::Scan::global): Likewise.
14944
14945 2008-04-16  Cary Coutant  <ccoutant@google.com>
14946
14947         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
14948         (Symbol::needs_plt_entry): Allow weak undefined symbols.
14949         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
14950         building shared libraries.
14951         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
14952         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
14953         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
14954         * testsuite/Makefile.in: Rebuild.
14955         * testsuite/weak_undef.h: New file.
14956         * testsuite/weak_undef_file1.cc: Add extra test cases.
14957         * testsuite/weak_undef_file2.cc: Likewise.
14958         * testsuite/weak_undef_test.cc: Likewise.
14959
14960 2008-04-16  David S. Miller  <davem@davemloft.net>
14961
14962         * sparc.cc (Target_sparc::Scan): Change from struct to class.
14963         Add issued_non_pic_error_ field.  Declare check_non_pic.
14964         (Target_sparc::Scan::check_non_pic): New function.
14965         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
14966         (Target_sparc::Scan::global): Likewise.
14967
14968         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
14969         * configure: Rebuild.
14970
14971         * options.h (DEFINE_enable): New macro.
14972         (new_dtags): New enable option.
14973         (initfirst, interpose, loadfltr, nodefaultlib,
14974         nodelete, nodlopen, nodump): New -z options.
14975         * layout.cc (Layout:finish_dynamic_section): If new
14976         dtags enabled, emit DT_RUNPATH.  Also, emit a
14977         DT_FLAGS_1 containing any specified -z flags.
14978
14979 2008-04-16  Ian Lance Taylor  <iant@google.com>
14980
14981         * copy-relocs.cc: New file.
14982         * copy-relocs.h: New file.
14983         * reloc.cc: Remove Copy_relocs code.
14984         * reloc.h: Likewise.
14985         * reloc-types.h (struct Reloc_types) [both versions]: Add
14986         get_reloc_addend_noerror.
14987         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
14988         variants of add_global which take an addend which must be zero.
14989         * i386.cc: Include "copy-relocs.h".
14990         (class Target_i386): Change type of copy_relocs_ to variable,
14991         update initializer.
14992         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
14993         Change all callers.
14994         (Target_i386::do_finalize_sections): Change handling of
14995         copy_relocs_.
14996         * sparc.cc: Include "copy-relocs.h".
14997         (class Target_sparc): Change type of copy_relocs_ to variable,
14998         update initializer.
14999         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
15000         Change all callers.
15001         (Target_sparc::do_finalize_sections): Change handling of
15002         copy_relocs_.
15003         * x86_64.cc: Include "copy-relocs.h".
15004         (class Target_x86_64): Change type of copy_relocs_ to variable,
15005         update initializer.
15006         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
15007         class.  Change all callers.
15008         (Target_x86_64::do_finalize_sections): Change handling of
15009         copy_relocs_.
15010         * Makefile.am (CCFILES): Add copy-relocs.cc.
15011         (HFILES): Add copy-relocs.h.
15012
15013         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
15014
15015         * testsuite/script_test_4.sh: Permit leading zeroes.
15016
15017 2008-04-15  Ian Lance Taylor  <iant@google.com>
15018
15019         * script-sections.cc (Script_sections::create_segments): Use
15020         header_size_adjustment even when there is enough room for the
15021         headers.
15022         * testsuite/script_test_4.sh: New file.
15023         * testsuite/script_test_4.t: New file.
15024         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
15025         (check_DATA): Add script_test_4.stdout.
15026         (MOSTLYCLEANFILES): Likewise.
15027         (script_test_4): New target.
15028         (script_test_4.stdout): New target.
15029         * testsuite/Makefile.in: Rebuild.
15030
15031         * sparc.cc: Add definitions for Output_data_plt_sparc class
15032         constants.
15033
15034 2008-04-14  David S. Miller  <davem@davemloft.net>
15035
15036         * sparc.cc: New file.
15037         * Makefile.am (TARGETSOURCES): Add sparc.cc
15038         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
15039         * configure.tgt: Document targ_extra_size and
15040         targ_extra_big_endian.  Add entries for sparc-* and
15041         sparc64-*.
15042         * configure.ac: Handle targ_extra_size and
15043         targ_extra_big_endian.
15044         * Makefile.in: Rebuild.
15045         * configure: Likewise.
15046         * po/POTFILES.in: Likewise.
15047         * po/gold.pot: Likewise.
15048
15049 2008-04-14  Ian Lance Taylor  <iant@google.com>
15050
15051         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
15052         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
15053         in the name/type/flags to section mapping.  Don't call
15054         allocate_output_section.
15055         (Layout::choose_output_section): Change parameter from adjust_name
15056         to is_input_section.  Don't permit input sections after sections
15057         are attached to segments.  Don't call allocate_output_section.
15058         (Layout::layout_eh_frame): Call update_flags_for_input_section,
15059         not write_enable_output_section.
15060         (Layout::make_output_section): Don't push to
15061         unattached_section_list_ nor call attach_to_segment.  Call
15062         attach_section_to_segment if sections are attached.
15063         (Layout::attach_sections_to_segments): New function.
15064         (Layout::attach_section_to_segment): New function.
15065         (Layout::attach_allocated_section_to_segment): Rename from
15066         attach_to_segment.  Remove flags parameter.
15067         (Layout::allocate_output_section): Remove function.
15068         (Layout::write_enable_output_section): Remove function.
15069         * layout.h (class Layout): Update for above changes.  Add new
15070         field sections_are_attached_.
15071         * output.h (Output_section::update_flags_for_input_section): New
15072         function.
15073         * output.cc (Output_section::add_input_section): Call
15074         update_flags_for_input_section.
15075         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
15076
15077 2008-04-11  Cary Coutant  <ccoutant@google.com>
15078
15079         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
15080         thought unnecessary.
15081         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
15082
15083 2008-04-11  Ian Lance Taylor  <iant@google.com>
15084
15085         * output.h (class Output_section_data): Remove inline definition
15086         of set_addralign.
15087         * output.cc (Output_section_data::set_addralign): New function.
15088
15089 2008-04-11  Cary Coutant  <ccoutant@google.com>
15090
15091         Add support for TLS descriptors for i386 and x86_64.
15092         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
15093         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
15094         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
15095         GOT_TYPE_TLS_DESC.
15096         (Target_i386::got_mod_index_entry): Remove unnecessary code.
15097         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
15098         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
15099         relocations.
15100         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
15101         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
15102         Fix problem with initial-exec relocations.
15103         (Target_i386::Relocate::relocate_tls): Likewise.
15104         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
15105         relaxation.
15106         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
15107         support for section-plus-offset dynamic table entries.
15108         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
15109         (Output_data_dynamic::Dynamic_entry): Add support for
15110         section-plus-offset dynamic table entries.
15111         (Output_data_dynamic::Classification): Likewise.
15112         (Output_data_dynamic::classification_): Renamed offset_.
15113         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
15114         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
15115         (Target_x86_64::make_plt_section): New function.
15116         (Target_x86_64::reserve_tlsdesc_entries): New function.
15117         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
15118         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
15119         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
15120         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
15121         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
15122         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
15123         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
15124         add extra PLT entry for TLS descriptors.
15125         (Output_data_plt_x86_64::got_): New field.
15126         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
15127         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
15128         fields.
15129         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
15130         descriptors.
15131         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
15132         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
15133         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
15134         R_386_TLS_DESC_CALL relocations.
15135         (Target_x86_64::Scan::global): Likewise.
15136         (Target_x86_64::do_finalize_sections): Add dynamic table entries
15137         for TLS descriptors.
15138         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
15139         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
15140         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
15141         GD-to-IE relaxation.
15142         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
15143         and TLS_DESCRIPTORS.
15144         * Makefile.in: Rebuild.
15145         * configure: Rebuild.
15146         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
15147         (tls_test_shared2.so): New target.
15148         (tls_shared_gd_to_ie_test_SOURCES): New variable.
15149         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
15150         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
15151         (tls_shared_gd_to_ie_test_LDADD): New variable.
15152         (tls_shared_gnu2_gd_to_ie_test): New target.
15153         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
15154         New targets.
15155         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
15156         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
15157         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
15158         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
15159         (tls_shared_gnu2_test): New target.
15160         (tls_test_gnu2_shared.so): New target.
15161         (tls_shared_gnu2_test_SOURCES): New variable.
15162         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
15163         (tls_shared_gnu2_test_LDFLAGS): New variable.
15164         (tls_shared_gnu2_test_LDADD): New variable.
15165         * testsuite/Makefile.in: Rebuild.
15166         * testsuite/Makefile.
15167
15168 2008-04-11  Ian Lance Taylor  <iant@google.com>
15169
15170         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
15171         justsyms.t.
15172         * testsuite/Makefile.in: Rebuild.
15173
15174         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
15175         long.
15176         * testsuite/script_test_2.cc (main): Adjust test.
15177
15178 2008-04-11  David S. Miller  <davem@davemloft.net>
15179             Ian Lance Taylor  <iant@google.com>
15180
15181         * options.h (General_options): Add entries for '-Y' and
15182         '-relax'.
15183         * options.cc (General_options:finalize): If -Y was used, add those
15184         entries to the library path instead of the default "/lib" and
15185         "/usr/lib".
15186
15187 2008-04-11  David S. Miller  <davem@davemloft.net>
15188
15189         * testsuite/justsyms.t: Start at 0x100.
15190         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
15191         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
15192         long.
15193         * testsuite/script_test_2.cc: Adjust string and section length
15194         checks.
15195
15196 2008-04-09  Ian Lance Taylor  <iant@google.com>
15197
15198         PR gold/5996
15199         * script-sections.cc (Sections_element::allocate_to_segment): Add
15200         orphan parameter.
15201         (Output_section_definition::allocate_to_segment): Likewise.
15202         (Orphan_output_section::allocate_to_segment): Likewise.
15203         (Script_sections::attach_sections_using_phdrs_clause): Don't
15204         propagate non-PT_LOAD segments to orphan sections.
15205         * testsuite/Makefile.am (script_test_3.stdout): Generate using
15206         readelf rather than objdump.
15207         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
15208         .interp section and PT_INTERP segment are the same size.
15209         * testsuite/Makefile.in: Rebuild.
15210
15211         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
15212         aliases for symbols defined in the same object.
15213         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
15214         (weak_alias_test_SOURCES): New variable.
15215         (weak_alias_test_DEPENDENCIES): New variable.
15216         (weak_alias_test_LDFLAGS): New variable.
15217         (weak_alias_test_LDADD): New variable.
15218         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
15219         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
15220         (weak_alias_test_3.o): New target.
15221         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
15222         * testsuite/weak_alias_test_main.cc: New file.
15223         * testsuite/weak_alias_test_1.cc: New file.
15224         * testsuite/weak_alias_test_2.cc: New file.
15225         * testsuite/weak_alias_test_3.cc: New file.
15226
15227 2008-04-08  Ian Lance Taylor  <iant@google.com>
15228
15229         * options.h (class General_options): Add --noinhibit-exec option.
15230         * main.cc (main): Check --noinhibit-exec.
15231
15232         * options.h (class General_options): Define --wrap as a special
15233         option.  Add wrap_symbols_ field.
15234         (General_options::any_wrap_symbols): New function.
15235         (General_options::is_wrap_symbol): New function.
15236         * options.cc (General_options::parse_wrap): New function.
15237         (General_options::General_options): Initialize wrap_symbols_.
15238         * symtab.cc (Symbol_table::wrap_symbol): New function.
15239         (Symbol_table::add_from_object): Handle --wrap.
15240         * symtab.h (class Symbol_table): Declare wrap_symbol.
15241         * target.h (Target::wrap_char): New function.
15242         (Target::Target_info): Add wrap_char field.
15243         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
15244         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
15245         * testsuite/testfile.cc (Target_test::test_target_info):
15246         Likewise.
15247
15248         * errors.cc (Errors::undefined_symbol): Mention symbol version if
15249         there is one.
15250
15251         * layout.h (class Layout): Add added_eh_frame_data_ field.
15252         * layout.cc (Layout::Layout): Initialize new field.
15253         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
15254         output section until we find a section we merged successfully.
15255         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
15256         that the size be non-zero.
15257
15258         * merge.cc (Object_merge_map::get_output_offset): Remove inline
15259         qualifier.
15260
15261 2008-04-08  Craig Silverstein  <csilvers@google.com>
15262
15263         * configure.ac: Export new conditional variable HAVE_ZLIB.
15264         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
15265         on HAVE_ZLIB.
15266         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
15267         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15268
15269 2008-04-07  Ian Lance Taylor  <iant@google.com>
15270
15271         * version.cc (version_string): Set to "1.5".
15272
15273         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
15274         Add issued_non_pic_error_ field.  Declare check_non_pic.
15275         (Target_x86_64::Scan::check_non_pic): New function.
15276         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
15277         (Target_x86_64::Scan::global): Likewise.
15278
15279         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
15280         addend parameter.  Change caller.  Handle merge sections.
15281         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
15282         Address to Addend.  Don't add in the result of
15283         local_section_offset, pass down the addend and use the returned
15284         value.
15285         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
15286         Update declarations of local_section_offset and symbol_value.
15287         * testsuite/two_file_test_1.cc (t18): New function.
15288         * testsuite/two_file_test_2.cc (f18): New function.
15289         * testsuite/two_file_test_main.cc (main): Call t18.
15290         * testsuite/two_file_test.h (t18, f18): Declare.
15291
15292         * configure.ac: Don't test for objdump, c++filt, or readelf.
15293         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
15294         conditionals.
15295         (TEST_READELF): New variable.
15296         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
15297         (check_PROGRAMS): Add two_file_strip_test.
15298         (two_file_strip_test): New target.
15299         (check_PROGRAMS): Add two_file_same_shared_strip_test.
15300         (two_file_same_shared_strip_test_SOURCES): New variable.
15301         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
15302         (two_file_same_shared_strip_test_LDFLAGS): New variable.
15303         (two_file_same_shared_strip_test_LDADD): New variable.
15304         (two_file_shared_strip.so): New target.
15305         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
15306         (ver_test_5.syms, ver_test_7.syms): Likewise.
15307         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
15308         (strip_test_3.stdout): Use TEST_OBJDUMP.
15309         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15310
15311 2008-04-04  Cary Coutant  <ccoutant@google.com>
15312
15313         * symtab.h (Symbol::is_weak_undefined): New function.
15314         (Symbol::is_strong_undefined): New function.
15315         (Symbol::is_absolute): New function.
15316         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
15317         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
15318         absolute symbols.
15319         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
15320         (weak_undef_test): New target.
15321         * testsuite/Makefile.in: Rebuild.
15322         * testsuite/weak_undef_file1.cc: New file.
15323         * testsuite/weak_undef_file2.cc: New file.
15324         * testsuite/weak_undef_test.cc: New file.
15325
15326 2008-04-03  Craig Silverstein  <csilvers@google.com>
15327
15328         * compressed_output.h (class Output_compressed_section): Use
15329         unsigned buffer.
15330         * compressed_output.cc (zlib_compress): Use unsigned buffers,
15331         add zlib header.
15332         (zlib_compressed_suffix): Removed.
15333         (Output_compressed_section::set_final_data_size): Use unsigned
15334         buffers.
15335         * testsuite/Makefile.am (flagstest_compress_debug_sections):
15336         Fix linker invocation.
15337         (flagstest_o_specialfile_and_compress_debug_sections):
15338         Likewise.
15339         * testsuite/Makefile.in: Regenerated.
15340
15341 2008-04-02  David S. Miller  <davem@davemloft.net>
15342
15343         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
15344         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
15345
15346 2008-04-02  Craig Silverstein  <csilvers@google.com>
15347
15348         * TODO: New file.
15349
15350 2008-04-02  Ian Lance Taylor  <iant@google.com>
15351
15352         * fileread.cc (File_read::find_view): Add byteshift and vshifted
15353         parameters.  Update for new key type to views_.  Change all
15354         callers.
15355         (File_read::read): Adjust for byteshift in returned view.
15356         (File_read::add_view): New function, broken out of
15357         find_and_make_view.
15358         (File_read::make_view): New function, broken out of
15359         find_and_make_view.
15360         (File_read::find_or_make_view): Add offset and aligned
15361         parameters.  Rewrite accordingly.  Change all callers.
15362         (File_read::get_view): Add offset and aligned parameters.  Adjust
15363         for byteshift in return value.
15364         (File_read::get_lasting_view): Likewise.
15365         * fileread.h (class File_read): Update declarations.
15366         (class File_read::View): Add byteshift_ field.  Add byteshift to
15367         constructor.  Add byteshift method.
15368         * archive.h (Archive::clear_uncached_views): New function.
15369         (Archive::get_view): Add aligned parameter.  Change all callers.
15370         * object.h (Object::get_view): Add aligned parameter.  Change all
15371         callers.
15372         (Object::get_lasting_view): Likewise.
15373
15374         * fileread.cc (File_read::release): Don't call clear_views if
15375         there are multiple objects.
15376         * fileread.h (File_read::clear_uncached_views): New function.
15377         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
15378         on the archive.
15379
15380 2008-03-31  Cary Coutant  <ccoutant@google.com>
15381
15382         Add thin archive support.
15383         * archive.cc (Archive::armagt): New const.
15384         (Archive::setup): Remove task parameter and calls to unlock.
15385         (Archive::unlock_nested_archives): New function.
15386         (Archive::read_header): Add nested_off parameter. Change
15387         all callers.
15388         (Archive::interpret_header): Likewise.
15389         (Archive::include_all_members): Change to handle thin
15390         archives.
15391         (Archive::include_member): Likewise.
15392         * archive.h (Archive::Archive): Add new parameters and
15393         initializers.
15394         (Archive::armagt): New const.
15395         (Archive::setup): Remove task parameter.
15396         (Archive::unlock_nested_archives): New function.
15397         (Archive::read_header): Add nested_off parameter.
15398         (Archive::interpret_header): Likewise.
15399         (Archive::Nested_archive_table): New typedef.
15400         (Archive::is_thin_archive_): New field.
15401         (Archive::nested_archives_): New field.
15402         (Archive::options_): New field.
15403         (Archive::dirpath_): New field.
15404         (Archive::task_): New field.
15405         * readsyms.cc (Read_symbols::do_read_symbols): Add check
15406         for thin archives.  Pass additional parameters to
15407         Archive::Archive.  Unlock the archive file after calling
15408         Archive::setup.
15409
15410 2008-03-29  Ian Lance Taylor  <iant@google.com>
15411
15412         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
15413         version symbol to be local.
15414         * testsuite/ver_test_4.sh: New file.
15415         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
15416         (check_DATA): Add ver_test_4.syms.
15417         (ver_test_4.syms): New target.
15418         * testsuite/Makefile.in: Rebuild.
15419
15420         * output.cc
15421         (Output_section::Input_section_sort_entry::has_priority): New
15422         function.
15423         (Output_section::Input_section_sort_entry::match_file_name): New
15424         function.
15425         (Output_section::Input_section_sort_entry::match_section_name):
15426         Remove.
15427         (Output_section::Input_section_sort_entry::match_section_name_prefix):
15428         Remove.
15429         (Output_section::Input_section_sort_entry::match_section_file):
15430         Remove.
15431         (Output_section::Input_section_sort_compare::operator()): Rewrite
15432         using new Input_section_sort_entry functions.  Sort crtbegin and
15433         crtend first.  Sort sections with no priority before sections with
15434         a priority.
15435         * testsuite/initpri1.c (d3): Check j != 4.
15436         (cd5): New constructor/destructor function.
15437         (main): Check j != 2.
15438
15439         * symtab.cc (Symbol_table::add_from_object): If we don't use the
15440         new symbol when resolving, don't call set_is_default.
15441         * testsuite/ver_test_7.cc: New file.
15442         * testsuite/ver_test_7.sh: New file.
15443         * testsuite/Makefile.am (ver_test_7.so): New target.
15444         (ver_test_7.o): New target.
15445         (check_SCRIPTS): Add ver_test_7.sh.
15446         (check_DATA): Add ver_test_7.syms.
15447         (ver_test_7.syms): New target.
15448
15449 2008-03-28  Ian Lance Taylor  <iant@google.com>
15450
15451         * layout.cc (Layout::layout): If we see an input section with a
15452         name that needs sorting, set the must_sort flag for the output
15453         section.
15454         (Layout::make_output_section): If the name of the output section
15455         indicates that it might require sorting, set the may_sort flag.
15456         * output.h (Output_section::may_sort_attached_input_sections): New
15457         function.
15458         (Output_section::set_may_sort_attached_input_sections): New
15459         function.
15460         (Output_section::must_sort_attached_input_sections): New
15461         function.
15462         (Output_section::set_must_sort_attached_input_sections): New
15463         function.
15464         (class Output_section): Declare Input_section_sort_entry.  Define
15465         Input_section_sort_compare.  Declare
15466         sort_attached_input_sections.  Add new fields:
15467         may_sort_attached_input_sections_,
15468         must_sort_attached_input_sections_,
15469         attached_input_sections_are_sorted_.
15470         * output.cc (Output_section::Output_section): Initialize new
15471         fields.
15472         (Output_section::add_input_section): Add an entry to
15473         input_sections_ if may_sort or must_sort are true.
15474         (Output_section::set_final_data_size): Call
15475         sort_attached_input_sections if necessary.
15476         (Output_section::Input_section_sort_entry): Define new class.
15477         (Output_section::Input_section_sort_compare::operator()): New
15478         function.
15479         (Output_section::sort_attached_input_sections): New function.
15480         * configure.ac: Check whether the compiler supports constructor
15481         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
15482         * testsuite/initpri1.c: New file.
15483         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
15484         CONSTRUCTOR_PRIORITY.
15485         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
15486         (initpri1_LDFLAGS): New variable.
15487         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15488
15489 2008-03-27  Ian Lance Taylor  <iant@google.com>
15490
15491         * common.cc (Sort_commons::operator): Correct sorting algorithm.
15492         * testsuite/common_test_1.c: New file.
15493         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
15494         (common_test_1_SOURCES): New variable.
15495         (common_test_1_DEPENDENCIES): New variable.
15496         (common_test_1_LDFLAGS): New variable.
15497
15498         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
15499         and commons_ correctly when NAME/VERSION does not override
15500         NAME/NULL.
15501         * testsuite/ver_test_6.c: New file.
15502         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
15503         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
15504         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
15505
15506 2008-03-26  Ian Lance Taylor  <iant@google.com>
15507
15508         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
15509         of an undefined symbol from a version script.
15510         * testsuite/Makefile.am (ver_test_5.so): New target.
15511         (ver_test_5.o): New target.
15512         (check_SCRIPTS): Add ver_test_5.sh.
15513         (check_DATA): Add ver_test_5.syms.
15514         (ver_test_5.syms): New target.
15515         * testsuite/ver_test_5.cc: New file.
15516         * testsuite/ver_test_5.script: New file.
15517         * testsuite/ver_test_5.sh: New file.
15518         * Makefile.in, testsuite/Makefile.in: Rebuild.
15519
15520         PR gold/5986
15521         Fix problems building gold with gcc 4.3.0.
15522         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
15523         (gold_error_at_location, gold_warning_at_location): Use it.
15524         * configure.ac: Check whether we can compile and use a template
15525         function with a printf attribute.
15526         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
15527         when jumping over bytes.
15528         * object.cc: Instantiate Object::read_section_data.
15529         * debug.h: Include <cstring>
15530         * dwarf_reader.cc: Include <algorithm>
15531         * main.cc: Include <cstring>.
15532         * options.cc: Include <cstring>.
15533         * output.cc: Include <cstring>.
15534         * script.cc: Include <cstring>.
15535         * script.h: Include <string>.
15536         * symtab.cc: Include <cstring> and <algorithm>.
15537         * target-select.cc: Include <cstring>.
15538         * version.cc: Include <string>.
15539         * testsuite/testmain.cc: Include <cstdlib>.
15540         * configure, config.in: Rebuild.
15541
15542 2008-03-25  Ian Lance Taylor  <iant@google.com>
15543
15544         * options.cc: Include "../bfd/bfdver.h".
15545         (options::help): Print bug reporting address.
15546
15547         * version.cc (print_version): Adjust output for current value of
15548         BFD_VERSION_STRING.
15549
15550         * NEWS: New file.
15551
15552         * options.cc (options::help): Print list of supported targets.
15553         * target-select.h: Include <vector>.
15554         (class Target_selector): Make machine_, size_, and is_big_endian_
15555         fields const.  Add bfd_name_ and instantiated_target_ fields.
15556         (Target_selector::Target_selector): Add bfd_name parameter.
15557         (Target_selector::recognize): Make non-virtual, call
15558         do_recognize.
15559         (Target_selector::recognize_by_name): Make non-virtual, call
15560         do_recognize_by_name.
15561         (Target_selector::supported_names): New function.
15562         (Target_selector::bfd_name): New function.
15563         (Target_selector::do_instantiate_target): New pure virtual
15564         function.
15565         (Target_selector::do_recognize): New virtual function.
15566         (Target_selector::do_recognize_by_name): New virtual function.
15567         (Target_selector::instantiate_target): New private function.
15568         (supported_target_names): Declare.
15569         * target-select.cc (Target_selector::Target_selector): Update for
15570         new parameter and fields.
15571         (select_target_by_name): Check that the name matches before
15572         calling recognize_by_name.
15573         (supported_target_names): New function.
15574         * i386.cc (class Target_selector_i386): Update Target_selector
15575         constructor call.  Remove recognize and recognize_by_name.  Add
15576         do_instantiate_target.
15577         * x86_64.cc (class Target_selector_x86_64): Likewise.
15578         * testsuite/testfile.cc (class Target_selector_test): Update for
15579         changes to Target_selector.
15580
15581         * README: Rewrite, with some notes on unsupported features.
15582
15583 2008-03-24  Cary Coutant  <ccoutant@google.com>
15584
15585         * i386.cc (Target_i386::Got_type): New enum declaration.
15586         (Target_i386::Scan::local): Updated callers of Output_data_got
15587         member functions.
15588         (Target_i386::Scan::global): Likewise.
15589         (Target_i386::Relocate::relocate): Likewise.
15590         (Target_i386::Relocate::relocate_tls): Likewise.
15591         * object.h (Got_offset_list): New class.
15592         (Sized_relobj::local_has_got_offset): Added got_type parameter.
15593         (Sized_relobj::local_got_offset): Likewise.
15594         (Sized_relobj::set_local_got_offset): Likewise.
15595         (Sized_relobj::local_has_tls_got_offset): Removed.
15596         (Sized_relobj::local_tls_got_offset): Removed.
15597         (Sized_relobj::set_local_tls_got_offset): Removed.
15598         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
15599         * output.cc (Output_data_got::add_global): Added got_type parameter.
15600         (Output_data_got::add_global_with_rel): Likewise.
15601         (Output_data_got::add_global_with_rela): Likewise.
15602         (Output_data_got::add_global_pair_with_rel): New function.
15603         (Output_data_got::add_global_pair_with_rela): New function.
15604         (Output_data_got::add_local): Added got_type parameter.
15605         (Output_data_got::add_local_with_rel): Likewise.
15606         (Output_data_got::add_local_with_rela): Likewise.
15607         (Output_data_got::add_local_pair_with_rel): New function.
15608         (Output_data_got::add_local_pair_with_rela): New function.
15609         (Output_data_got::add_global_tls): Removed.
15610         (Output_data_got::add_global_tls_with_rel): Removed.
15611         (Output_data_got::add_global_tls_with_rela): Removed.
15612         (Output_data_got::add_local_tls): Removed.
15613         (Output_data_got::add_local_tls_with_rel): Removed.
15614         (Output_data_got::add_local_tls_with_rela): Removed.
15615         * output.h (Output_data_got::add_global): Added got_type parameter.
15616         (Output_data_got::add_global_with_rel): Likewise.
15617         (Output_data_got::add_global_with_rela): Likewise.
15618         (Output_data_got::add_global_pair_with_rel): New function.
15619         (Output_data_got::add_global_pair_with_rela): New function.
15620         (Output_data_got::add_local): Added got_type parameter.
15621         (Output_data_got::add_local_with_rel): Likewise.
15622         (Output_data_got::add_local_with_rela): Likewise.
15623         (Output_data_got::add_local_pair_with_rel): New function.
15624         (Output_data_got::add_local_pair_with_rela): New function.
15625         (Output_data_got::add_global_tls): Removed.
15626         (Output_data_got::add_global_tls_with_rel): Removed.
15627         (Output_data_got::add_global_tls_with_rela): Removed.
15628         (Output_data_got::add_local_tls): Removed.
15629         (Output_data_got::add_local_tls_with_rel): Removed.
15630         (Output_data_got::add_local_tls_with_rela): Removed.
15631         * resolve.cc (Symbol::override_base_with_special): Removed
15632         reference to has_got_offset_ field.
15633         * symtab.cc (Symbol::init_fields): Replaced initialization
15634         of got_offset_ with got_offsets_.  Removed initialization
15635         of has_got_offset_
15636         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
15637         (Symbol::got_offset): Likewise.
15638         (Symbol::set_got_offset): Likewise.
15639         (Symbol::has_tls_got_offset): Removed.
15640         (Symbol::tls_got_offset): Removed.
15641         (Symbol::set_tls_got_offset): Removed.
15642         (Symbol::got_offset_): Removed.
15643         (Symbol::tls_mod_got_offset_): Removed.
15644         (Symbol::tls_pair_got_offset_): Removed.
15645         (Symbol::got_offsets_): New field.
15646         (Symbol::has_got_offset): Removed.
15647         (Symbol::has_tls_mod_got_offset): Removed.
15648         (Symbol::has_tls_pair_got_offset): Removed.
15649         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
15650         (Target_x86_64::Scan::local): Updated callers of Output_data_got
15651         member functions.
15652         (Target_x86_64::Scan::global): Likewise.
15653         (Target_x86_64::Relocate::relocate): Likewise.
15654         (Target_x86_64::Relocate::relocate_tls): Likewise.
15655
15656 2008-03-25  Ben Elliston  <bje@au.ibm.com>
15657
15658         * yyscript.y: Fix spelling error in comment.
15659
15660 2008-03-24  Ian Lance Taylor  <iant@google.com>
15661
15662         * options.h (class General_options): Define build_id option.
15663         * layout.h (class Layout): Declare write_build_id, create_note,
15664         create_build_id.  Add build_id_note_ member.
15665         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
15666         "libiberty.h", "md5.h", "sha1.h".
15667         (Layout::Layout): Initialize eh_frame_data_,
15668         eh_frame_hdr_section_, and build_id_note_.
15669         (Layout::finalize): Call create_build_id.
15670         (Layout::create_note): New function, broken out of
15671         Layout::create_gold_note.
15672         (Layout::create_gold_note): Call create_note.
15673         (Layout::create_build_id): New function.
15674         (Layout::write_build_id): New function.
15675         (Close_task_runner::run): Call write_build_id.
15676
15677         * x86_64.cc: Correct license to GPLv3.
15678
15679 2008-03-23  Ian Lance Taylor  <iant@google.com>
15680
15681         * options.cc: Include "demangle.h".
15682         (parse_optional_string): New function.
15683         (parse_long_option): Handle takes_optional_argument.
15684         (parse_short_option): Update dash_z initializer.  Handle
15685         takes_optional_argument.
15686         (General_options::General_options): Initialize do_demangle_.
15687         (General_options::finalize): Set do_demangle_.  Handle demangling
15688         style.
15689         * options.h (parse_optional_string): Declare.
15690         (struct One_option): Add optional_arg field.  Update constructor.
15691         Update call constructor calls.  Add takes_optional_argument
15692         function.
15693         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
15694         (DEFINE_optional_string): Define.
15695         (General_options::demangle): Change from DEFINE_bool to
15696         DEFINE_optional_string.
15697         (General_options::no_demangle): New function.
15698         (General_options::do_demangle): New function.
15699         (General_options::set_do_demangle): New function.
15700         (General_options::execstack_status_): Move definition to end of
15701         class definition.
15702         (General_options::static_): Likewise.
15703         (General_options::do_demangle_): New field.
15704         * object.cc (big_endian>::get_symbol_location_info): Call
15705         Options::do_demangle, not Options::demangle.
15706         * symtab.cc (demangle): Likewise.
15707
15708 2008-03-22  Ian Lance Taylor  <iant@google.com>
15709
15710         * gold.h: Include <cstddef> and <sys/types.h>
15711         * options.h: Include <cstring>.
15712
15713 2008-03-21  Ian Lance Taylor  <iant@google.com>
15714
15715         * Added source code to GNU binutils.
15716 \f
15717 Copyright (C) 2008-2014 Free Software Foundation, Inc.
15718
15719 Copying and distribution of this file, with or without modification,
15720 are permitted in any medium without royalty provided the copyright
15721 notice and this notice are preserved.
15722
15723 Local Variables:
15724 mode: change-log
15725 left-margin: 8
15726 fill-column: 74
15727 version-control: never
15728 End: