Allow target to decide whether to include a section.
[external/binutils.git] / gold / ChangeLog
1 2014-04-15  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
2
3         * layout.cc (Layout::include_section): Allow a target to decide
4         whether to include a section.
5         * target.h (Target::should_include_section): New function.
6         (Target::do_should_include_section): New function.
7
8 2014-04-15  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
9
10         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Remove and
11         inline into ...
12         (Copy_relocs::emit): ... here.
13         * copy-relocs.h (Copy_reloc_entry): Change from class to struct.
14         (Copy_reloc_entry::make_copy_reloc): Change from private to protected.
15         (Copy_reloc_entry::entries_): Change from private to protected.
16
17 2014-04-02  Sriraman Tallam  <tmsriram@google.com>
18
19         * icf.cc (get_section_contents): Replace copies of reloc
20         vectors with const references.
21
22 2014-04-02  Cary Coutant  <ccoutant@google.com>
23
24         * configure.ac (HAVE_PUBNAMES): Use C instead of C++.
25         (HAVE_NO_USE_LINKER_PLUGIN): Check for -fno-use-linker-plugin.
26         * configure: Regenerate.
27         * testsuite/Makefile.am (OPT_NO_PLUGINS): New macro for
28         -fno-use-linker-plugin.
29         (LINK1, CXXLINK1): Add it to the link command.
30         * testsuite/Makefile.in: Regenerate.
31
32 2014-03-12  Alan Modra  <amodra@gmail.com>
33
34         * Makefile.in: Regenerate.
35
36 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
37
38         * symtab.h (Symbol::set_nonvis): New function.
39
40 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
41
42         * symtab.cc (Sized_symbol<32>::init_output_data):
43         Instantiate the template.
44         (Sized_symbol<64>::init_output_data): Likewise.
45
46 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
47
48         * symtab.cc (Symbol_table::sized_write_globals): Allow a target to
49         adjust dynamic symbol value.
50         * target.h (Target::adjust_dyn_symbol): New function.
51         (Target::do_adjust_dyn_symbol): New function.
52
53 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
54   
55         * output.cc (Output_data_dynamic::Dynamic_entry::write):
56         Get the value of DYNAMIC_CUSTOM dynamic entry.
57         * output.h (Output_data_dynamic::add_custom): New function.
58         (Dynamic_entry::Dynamic_entry): New constructor for DYNAMIC_CUSTOM
59         dynamic entry.
60         (enum Dynamic_entry::Classification): Add DYNAMIC_CUSTOM.
61         * target.h (Target::dynamic_tag_custom_value): New function.
62         (Target::do_dynamic_tag_custom_value): New function.
63
64 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
65
66         * symtab.cc (Symbol_table::set_dynsym_indexes): Allow a target to set
67         dynsym indexes.
68         * target.h (Target::has_custom_set_dynsym_indexes): New function.
69         (Target::do_has_custom_set_dynsym_indexes): New function.
70         (Target::set_dynsym_indexes): New function.
71         (Target::do_set_dynsym_indexes): New function.
72
73 2014-03-07  Alan Modra  <amodra@gmail.com>
74
75         * powerpc.cc (Powerpc_relocate_functions::Overflow_check): Add
76         CHECK_UNSIGNED, CHECK_LOW_INSN, CHECK_HIGH_INSN.
77         (Powerpc_relocate_functions::has_overflow_unsigned): New function.
78         (Powerpc_relocate_functions::has_overflow_bitfield,
79         overflowed): Use the above.
80         (Target_powerpc::Relocate::relocate): Correct overflow checking
81         for a number of relocations.  Modify overflow test for 16-bit
82         fields in instructions to signed/unsigned according to whether
83         the field takes a signed or unsigned value.
84
85 2014-03-05  Alan Modra  <amodra@gmail.com>
86
87         Update copyright years.
88
89 2014-03-05  Alan Modra  <amodra@gmail.com>
90
91         * powerpc.cc (Target_powerpc::Scan::local, global): Support
92         R_PPC64_ADDR64_LOCAL.
93         (Target_powerpc::Relocate::relocate): Likewise.
94
95 2014-03-03  Alan Modra  <amodra@gmail.com>
96
97         * dwp.cc (print_version): Update copyright year to current.
98
99 2014-02-10  Alan Modra  <amodra@gmail.com>
100
101         * po/gold.pot: Regenerate.
102
103 2014-02-06  Cary Coutant  <ccoutant@google.com>
104
105         Fix problem where -u is ignored when a weak undef is seen.
106
107         * archive.cc (Library_base::should_include_member): Reorder
108         code to check for -u option if a weak undef has already been seen.
109         * testsuite/Makefile.am (weak_undef_test_2): New test case.
110         * testsuite/Makefile.in: Regenerate.
111         * testsuite/weak_undef_file3.cc: New file.
112         * testsuite/weak_undef_file4.cc: New file.
113         * testsuite/weak_undef_test_2.cc: New file.
114
115 2014-02-05  Cary Coutant  <ccoutant@google.com>
116
117         Fix issues with gold undefined symbol diagnostics.
118
119         PR binutils/15435
120         * errors.cc (Errors::undefined_symbol): Move undef vtable symbol
121         check to here.
122         * target-reloc.h (is_strong_undefined): New function.
123         (relocate_section): Move undef vtable symbol check from here.
124         Check for is_strong_undefined.
125
126 2014-02-05  Cary Coutant  <ccoutant@google.com>
127     
128         Fix problems with the --dynamic-list option.
129
130         PR gold/13577
131         * options.cc (General_options::parse_dynamic_list):
132         Set have_dynamic_list_.
133         (General_options::General_options): Initialize have_dynamic_list_.
134         (General_options::finalize): Turn off -Bsymbolic and
135         -Bsymbolic-functions if --dynamic-list provided.
136         * options.h (General_options::have_dynamic_list): New function.
137         (General_options::have_dynamic_list_): New data member.
138         * symtab.h (Symbol::is_preemptible): Handle --dynamic-list
139         correctly.
140    
141         PR gold/16530
142         * symtab.cc (Symbol_table::add_from_relobj): If symbol is named
143         in --dynamic-list, mark it.
144    
145         * testsuite/Makefile.am (gc_dynamic_list_test.sh): New test case.
146         (dynamic_list_2): New test case.
147         * testsuite/Makefile.in: Regenerate.
148         * testsuite/dynamic_list_2.cc: New file.
149         * testsuite/dynamic_list_2.t: New file.
150         * testsuite/dynamic_list_lib1.cc: New file.
151         * testsuite/dynamic_list_lib2.cc: New file.
152         * testsuite/gc_dynamic_list_test.c: New file.
153         * testsuite/gc_dynamic_list_test.sh: New file.
154         * testsuite/gc_dynamic_list_test.t: New file.
155
156 2014-01-28  Cary Coutant  <ccoutant@google.com>
157
158         Add .gdb_index version 7 support.
159
160         * gold/dwarf_reader.cc: include <utility> (for make_pair).
161         (Dwarf_abbrev_table::do_read_abbrevs): Check for compressed
162         debug sections.
163         (Dwarf_ranges_table::read_ranges_table): Likewise.
164         (Dwarf_pubnames_table::read_section): Check for GNU-style
165         sections, and for compressed debug sections.
166         (Dwarf_pubnames_table::read_header): Compute end address of table.
167         (Dwarf_pubnames_table::next_name): Return flag_byte.  Check
168         for end of list by offset, not by offset == 0.
169         (Dwarf_info_reader::do_read_string_table): Check for compressed
170         debug sections.
171         * gold/dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
172         Initialize new data members.
173         (Dwarf_pubnames_table::next_name): return flag_byte.
174         (Dwarf_pubnames_table::end_of_table_): New data member.
175         (Dwarf_pubnames_table::is_gnu_style_): New data member.
176         * gold/gdb-index.cc (gdb_index_version): Update to version 7.
177         (Gdb_index_info_reader::read_pubtable): Read flag_byte.
178         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Don't
179         read skeleton type unit DIEs.
180         (Gdb_index::add_symbol): Add flag_byte; adjust all callers.
181         (Gdb_index::do_write): Write flag_byte.
182         * gold/gdb-index.h (Gdb_index::add_symbol): Add flags parameter.
183         (Gdb_index::Cu_vector): Store flags along with cu indexes.
184         * gold/testsuite/gdb_index_test_3.sh: Allow versions 4-7.
185         * gold/testsuite/gdb_index_test_comm.sh: Likewise.
186
187 2014-01-08  H.J. Lu  <hongjiu.lu@intel.com>
188
189         * version.cc (print_version): Update copyright year to 2014.
190
191 2013-12-19  Dimitry Andric  <dimitry@andric.com>
192
193         * stringpool.cc (Stringpool_template::reserve): Add
194         HAVE_UNORDERED_MAP case.
195         * stringpool.cc (Stringpool_template::print_stats): Likewise.
196
197 2013-12-18  Cary Coutant  <ccoutant@google.com>
198
199         * configure.ac: Check for <unordered_set> and <unordered_map>.
200         * config.in: Regenerate.
201         * configure: Regenerate.
202         * system.h: Use <unordered_set> and <unordered_map> if available.
203
204 2013-12-10  Roland McGrath  <mcgrathr@google.com>
205
206         * Makefile.am (install-exec-local): Prefix $(INSTALL_PROGRAM) uses
207         with $(INSTALL_PROGRAM_ENV).
208         * Makefile.in: Regenerate.
209
210 2013-11-22  Cary Coutant  <ccoutant@google.com>
211
212         * configure.ac: Add check for which library is needed for
213         dlopen.
214         * configure: Regenerate.
215
216 2013-11-22  Cary Coutant  <ccoutant@google.com>
217
218         * testsuite/Makefile.am (exception_x86_64_bnd_test): Use in-tree
219         assembler.
220         * testsuite/Makefile.in: Regenerate.
221
222 2013-11-17  H.J. Lu  <hongjiu.lu@intel.com>
223
224         * x86_64.cc (Target_x86_64<size>::Scan::get_reference_flags):
225         Handle R_X86_64_PC32_BND and R_X86_64_PLT32_BND just like
226         R_X86_64_PC32 and R_X86_64_PLT32, respectively.
227         (Target_x86_64<size>::Scan::local): Likewise.
228         (Target_x86_64<size>::Scan::global): Likewise.
229         (Target_x86_64<size>::Relocate::relocate): Likewise.
230         (Target_x86_64<size>::Relocatable_size_for_reloc::get_size_for_reloc):
231         Likewise.
232         (Target_x86_64<size>::Scan::check_non_pic(): Handle
233         R_X86_64_PC32_BND.
234
235         * testsuite/Makefile.am (check_PROGRAMS): Add
236         exception_x86_64_bnd_test.
237         (exception_x86_64_bnd_test_SOURCES): New macro.
238         (exception_x86_64_bnd_test_DEPENDENCIES): Likewise.
239         (exception_x86_64_bnd_test_LDFLAGS): Likewise.
240         (exception_x86_64_bnd_test_LDADD): Likewise.
241         (exception_x86_64_bnd_1.o): New rule.
242         (exception_x86_64_bnd_2.o): Likewise.
243         * testsuite/Makefile.in: Regenerated.
244
245 2013-11-15  Alan Modra  <amodra@gmail.com>
246
247         * powerpc.cc (Target_powerpc::glink_section): Provide non-const
248         accessor.
249         (Target_powerpc::Branch_info::make_stub): Make global entry stubs.
250         Only call ppc64_local_entry_offset for 64-bit.  Restrict
251         symval_for_branch lookup to ELFv1.
252         (Stub_table::add_plt_call_entry): Use unsigned int off.
253         (Output_data_glink::Address, invalid_address): New.
254         (Output_data_glink::add_eh_frame): Move out of line.  Add
255         support for ELFv2.
256         (Output_data_glink::add_global_entry, find_global_entry,
257         global_entry_address): New functions.
258         (Output_data_glink::global_entry_stubs_, end_branch_table_,
259         ge_size): New variables.
260         (Output_data_glink::set_final_data_size): Add global entry
261         stub sizing.
262         (Output_data_glink::do_write): Write global entry stubs.
263         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Add target
264         parameter.  Return true for ELFv2.  Adjust callers.
265         (Target_powerpc::Scan::local, global): Restrict opd lookup to
266         ELFv1.  Similarly for ifunc and dynamic relocation processing
267         specific to ELFv1.  Recognize that symbols are defined on
268         their plt entries for ELFv2.
269         (Target_powerpc::symval_for_branch): Assert if called for
270         ELFv2 or ppc32.
271         (Target_powerpc::Relocate::relocate): Use global entry plt
272         stub for symbol value if such exists on ELFv2.
273         (Target_powerpc::Relocate::relocate): Don't call
274         symval_for_branch when ELFv2.  Do adjust for local entry
275         offset when ELFv2.
276         (Target_powerpc::do_dynsym_value): Set symbols to global entry
277         plt stub for ELFv2.
278         (Target_powerpc::do_plt_address_for_global): Similarly.
279
280 2013-11-14  Cary Coutant  <ccoutant@google.com>
281
282         Revert patch -- this did not fix the problem, and there is
283         no race there.
284
285         2013-11-14  Cary Coutant  <ccoutant@google.com>
286
287             PR gold/14860
288             * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
289             (Ehframe_hdr::set_final_data_size): Allocate a Lock.
290             * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
291             updating fde_offsets_.
292             (Eh_frame_hdr::lock_): New data member.
293
294 2013-11-14  Cary Coutant  <ccoutant@google.com>
295
296         * dwp.cc (Dwo_file_entry): New type.
297         (File_list): Use Dwo_file_entry.
298         (Dwo_file::verify): New function.
299         (Dwo_file::verify_dwo_list): New function.
300         (Dwo_file::sized_verify_dwo_list): New function.
301         (Dwo_name_info_reader::visit_compilation_unit): Add dwo_id to file
302         list.
303         (Dwp_options): New enum type.
304         (dwp_options): Add --verify-only.
305         (usage): Likewise.
306         (main): Likewise.
307         * dwp.h (gold_info): Add declaration.
308
309 2013-11-14  Cary Coutant  <ccoutant@google.com>
310
311         PR gold/14860
312         * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
313         (Ehframe_hdr::set_final_data_size): Allocate a Lock.
314         * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
315         updating fde_offsets_.
316         (Eh_frame_hdr::lock_): New data member.
317
318 2013-11-06  Cary Coutant  <ccoutant@google.com>
319
320         PR gold/15758
321         * object.cc (Sized_relobj_file::do_layout): Handle .eh_frame sections
322         before reloc sections.
323
324 2013-11-04  Alan Modra  <amodra@gmail.com>
325
326         * symtab.h (Symbol::Reference_flags): Add FUNC_DESC_ABI.
327         (Symbol::needs_dynamic_reloc): Test new flag.
328         * powerpc.cc (needs_dynamic_reloc, use_plt_offset): Delete.
329         (Target_powerpc::Scan::get_reference_flags): Add target param.
330         Return FUNC_DESC_ABI for 64-bit ELFv1.
331         (Target_powerpc::Branch_info::make_stub): Adjust get_reference_flags
332         call.
333         (Target_powerpc::Scan::global): Use Symbol::needs_dynamic_reloc.
334         (Target_powerpc::Relocate::relocate): Use Symbol::use_plt_offset.
335
336 2013-10-31  Cary Coutant  <ccoutant@google.com>
337
338         Restore support for dwp v2 DWARF package file format.
339
340         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
341         tu_length parameter.  Adjust all callers.
342         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
343         * dwp.cc: Include dwarf.h.
344         (Section_bounds): New struct type.
345         (Unit_set): New struct type.
346         (Dwo_file::Dwo_file): Initialize new data member.
347         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
348         Combine and rename to...
349         (Dwo_file::read_unit_index): ...this.
350         (Dwo_file::sized_read_compunit_index)
351         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
352         (Dwo_file::sized_read_unit_index): ...this.
353         (Dwo_file::copy_section): Remove section_name, is_str_offsets
354         parameters; add section_id parameter.
355         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
356         (Dwo_file::add_unit_set): ...this.
357         (Dwo_file::shndx_map_): Remove.
358         (Dwo_file::sect_offsets_): New data member.
359         (Dwp_output_file::Dwp_output_file): Initialize new data members.
360         (Dwp_output_file::add_section): Rename to...
361         (Dwp_output_file::add_contribution): ...this.
362         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
363         (Dwp_output_file::add_tu_set): Likewise.
364         (Dwp_output_file::Contribution): New type.
365         (Dwp_output_file::Section::contributions): New data member.
366         (Dwp_output_file::Cu_or_tu_set): Remove.
367         (Dwp_output_file::Section::Section): New ctor.
368         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
369         (Dwp_output_file::Dwp_index::Section_table): New type.
370         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
371         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
372         parameter.
373         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
374         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
375         (Dwp_output_file::Dwp_index::section_table): New member function.
376         (Dwp_output_file::Dwp_index::section_table_end): New member function.
377         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
378         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
379         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
380         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
381         (Dwp_output_file::Dwp_index::section_table_): New data member.
382         (Dwp_output_file::Dwp_index::section_mask_): New data member.
383         (Dwp_output_file::add_output_section): New member function.
384         (Dwp_output_file::write_new_section): New member function.
385         (Dwp_output_file::write_contributions): New member function.
386         (Dwp_output_file::section_id_map_): New data member.
387         (class Dwo_id_info_reader): Remove.
388         (class Unit_reader): New class.
389         (get_dwarf_section_name): New function.
390         (Dwo_file::read_executable): Adjust initializations of class data.
391         (Dwo_file::read): Add support for v2 package file format.
392         (Dwo_file::read_unit_index): Likewise.
393         (Dwo_file::sized_read_unit_index): Likewise.
394         (Dwo_file::copy_section): Likewise.
395         (Dwo_file::add_unit_set): Likewise.
396         (Dwp_output_file::add_output_section): Likewise.
397         (Dwp_output_file::add_contribution): Likewise.
398         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
399         for empty slot.
400         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
401         file format.
402         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
403         slot.
404         (Dwp_output_file::initialize): Remove unused function.
405         (Dwp_output_file::finalize): Add support for v2 package file format.
406         (Dwp_output_file::write_index): Likewise.
407         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
408         function prototype.
409
410 2013-10-31  Cary Coutant  <ccoutant@google.com>
411
412         * configure.ac: Fix check for -fmerge-constants.
413         * configure.ac: Regenerate.
414
415 2013-10-30  Roland McGrath  <mcgrathr@google.com>
416
417         * x86_64.cc (Output_data_plt_x86_64_nacl::first_plt_entry):
418         Correct 9-byte nop sequence to match what the assembler generates.
419
420 2013-10-30  Alan Modra  <amodra@gmail.com>
421
422         * powerpc.cc (Powerpc_relobj::abiversion, set_abiversion,
423         ppc64_local_entry_offset, ppc64_local_entry_offset,
424         do_read_symbols): New functions.
425         (Powerpc_relobj::e_flags_, st_other_): New vars.
426         (Powerpc_relobj::Powerpc_relobj): Call set_abiversion.
427         (Powerpc_dynobj::abiversion, set_abiversion): New functions.
428         (Powerpc_relobj::e_flags_): New var.
429         (Target_powerpc::first_plt_entry_offset, plt_entry_size): Inline
430         and adjust for ELFv2.
431         (Target_powerpc::abiversion, set_abiversion, stk_toc): New functions.
432         (Powerpc_relobj::do_find_special_sections): Check no .opd in ELFv2.
433         (Powerpc_dynobj::do_find_special_sections): Likewise.
434         (Target_powerpc::do_define_standard_symbols): Define ".TOC.".
435         (Target_powerpc::Branch_info::make_stub): Adjust stub destination
436         to ELFv2 local entry.
437         (Target_powerpc::do_relax): No thread safe barriers needed for
438         ELFv2.
439         (Output_data_plt_powerpc::initial_plt_entry_size_,
440         plt_entry_size): Delete.  Replace all uses with
441         first_plt_entry_offset() and plt_entry_size().
442         (Output_data_plt_powerpc::Output_data_plt_powerpc): Remove
443         reserved_size parm.  Update callers.
444         (Output_data_plt_powerpc::entry_count): Update.
445         (Output_data_plt_powerpc::first_plt_entry_offset): Make private
446         and use Target_powerpc::first_plt_entry_offset().
447         (Output_data_plt_powerpc::get_plt_entry_size): Similarly and
448         rename to plt_entry_size.
449         (Output_data_plt_powerpc::add_ifunc_entry,
450         add_local_ifunc_entry): Adjust reloc for ELFv2.
451         (glink_eh_frame_fde_64): Rename to glink_eh_frame_fde_64v1.
452         (glink_eh_frame_fde_64v2): New.
453         (Stub_table::plt_call_size): Support ELFv2 sizing.
454         (Output_data_glink::add_eh_frame): Use the new FDE.
455         (Output_data_glink::set_final_data_size): Adjust for ELFv2 glink.
456         (Stub_table::do_write): Write ELFv2 stubs and glink.
457         (Target_powerpc::Relocate::relocate): Replaces nop after call
458         with ld 2,24(1) and adjust local offset destination for ELFv2.
459
460 2013-10-30  Alan Modra  <amodra@gmail.com>
461
462         * powerpc.cc (Target_powerpc::Scan::check_non_pic): Handle new relocs.
463         (Target_powerpc::Scan::global, local): Likewise.
464         (Target_powerpc::Relocate::relocate): Likewise.  Check for overflow
465         on all ppc64 @h and @ha relocs.
466
467 2013-10-14  Alan Modra  <amodra@gmail.com>
468
469         * output.h (Output_data_got::add_constant): Tidy.
470         (Output_data_got::add_constant_pair): New function.
471         * powerpc.cc (Output_data_got_powerpc): Override all Output_data_got
472         methods used so as to first call reserve_ent().
473
474 2013-10-11  Roland McGrath  <mcgrathr@google.com>
475
476         * powerpc.cc (Output_data_got_powerpc): Remove unused methods
477         add_got_entry and add_got_entry_pair.
478
479         * configure.ac (TLS_GNU2_DIALECT): Use -Werror in test.
480         (HAVE_PUBNAMES): Likewise.
481         * configure: Regenerate.
482
483         * testsuite/Makefile.am: Replace '-T foo' with '-Wl,-T,foo' throughout.
484         * testsuite/Makefile.in: Regenerate.
485
486         * target.h (Target::adjust_elf_header, Target::do_adjust_elf_header):
487         Remove const from declaration.
488         * target.cc (Sized_target::do_adjust_elf_header): Update definition.
489         * sparc.cc (Target_sparc::do_adjust_elf_header): Likewise.
490         * output.h (Output_file_header): Remove const from member target_
491         and corresponding constructor argument.
492         * output.cc (Output_file_header::Output_file_header): Update prototype.
493         (Output_file_header::do_sized_write): Use this->target_ in place
494         of parameters()->target().
495
496         * testsuite/undef_symbol.cc (Foo::get_a): New method.
497
498         * configure.ac (MERGE_CONSTANTS_FLAG): New check.
499         * configure: Regenerate.
500         * Makefile.in: Regenerate.
501         * testsuite/merge_string_literals_1.c: Renamed to have .cc suffix.
502         * testsuite/merge_string_literals_2.c: Likewise.
503         * testsuite/Makefile.am
504         (merge_string_literals_1.o, merge_string_literals_2.o): Update deps.
505         (AM_CFLAGS, AM_CXXFLAGS): Use $(MERGE_CONSTANTS_FLAG) in place of
506         literal -fmerge-constants.
507         * testsuite/Makefile.in: Regenerate.
508
509         * i386.cc (Target_i386): Remove unused member dynbss_.
510         * arm.cc (Target_arm): Likewise.
511         * powerpc.cc (Target_powerpc): Likewise.
512         * sparc.cc (Target_sparc): Likewise.
513         * tilegx.cc (Target_tilegx): Likewise.
514         * x86_64.cc (Target_x86_64): Likewise.
515         * dwarf_reader.h (Dwarf_info_reader): Remove unused members
516         type_signature_, type_offset_.
517         * plugin.h (Plugin_hook): Remove unused member layout_.
518         * readsyms.h (Add_symbols): Remove unused members dirpath_, dirindex_,
519         mapfile_.
520         (Read_member): Remove unused members input_objects_, symtab_,
521         mapfile_, layout_.
522         (Check_library): Remove unused member symtab_.
523         * archive.h (Lib_group): Remove unused member lib_.
524         * archive.cc (Lib_group::Lib_group): Update initializer.
525         * incremental.h (Incremental_binary): Remove unused member target_.
526         (Incremental_script_entry): Removed unused member script_.
527         * layout.h (Write_symbols_task): Remove unused member input_objects_.
528         * icf.h (Icf): Remove unused member num_tracked_relocs.
529
530         * gold-threads.h (Once): Conditionalize member was_run_lock_ on
531         [ENABLE_THREADS && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4], matching
532         its only use.
533         * gold-threads.cc (Once::Once): Likewise conditionalize initializer.
534
535         * archive.h: Use struct rather than class for forward declaration
536         of Read_symbols_data.
537
538 2013-10-07  Cary Coutant  <ccoutant@google.com>
539
540         PR gold/16010
541         * testsuite/Makefile.am (icf_test): Fix dependencies.
542         (icf_safe_test): Likewise.
543         (icf_safe_so_test): Likewise.
544         (large_symbol_alignment): Add empty _LDADD rule.
545         * testsuite/Makefile.in: Regenerate.
546
547 2013-09-03  Pavel Chupin  <pavel.v.chupin@intel.com>
548
549         PR gold/15927
550         * x86_64.cc (Target_x86_64<size>::Scan::global): Use relative
551         relocation for R_X86_64_32 on x32.
552
553 2013-08-27  Roland McGrath  <mcgrathr@google.com>
554
555         * output.cc (Output_segment::set_section_addresses): Take new
556         Target* argument.  If target->isolate_execinstr() and the segment
557         is executable and starts at a target->abi_pagesize() boundary,
558         pad its end out to a target->abi_pagesize() boundary with code fill.
559         * output.h (Output_segment::set_section_addresses): Update decl.
560         * layout.h (Layout::check_output_data_for_reset_values): Take new
561         argument RELAX_OUTPUTS.
562         (Layout): New member relax_output_list_.
563         (Layout::add_relax_output): New method.
564         * layout.cc (Layout::Layout): Update constructor.
565         (Layout::reset_relax_output): New method.
566         (Layout::clean_up_after_relaxation): Call it.
567         (Layout::prepare_for_relaxation): Update caller.
568         (Layout::set_segment_offsets): Update callers of set_section_addresses.
569         Call reset_relax_output before re-processing segments for
570         isolate_execinstr case.
571         (Layout::write_data): Handle relax_output_list_.
572         (Layout::Relaxation_debug_check::check_output_data_for_reset_values):
573         Take new argument RELAX_OUTPUTS.  Assert it's an empty collection.
574
575 2013-08-23  Yuri Chornoivan  <yurchor@ukr.net>
576
577         PR binutils/15834
578         * object.h: Fix typos.
579
580 2013-08-16  Roland McGrath  <mcgrathr@google.com>
581
582         * i386.cc (Target_i386_nacl::do_code_fill): New virtual function.
583         * x86_64.cc (Target_x86_64_nacl::do_code_fill): New virtual function.
584
585 2013-08-07  Cary Coutant  <ccoutant@google.com>
586
587         Revert support for v2 DWP files:
588
589         2013-03-01  Cary Coutant  <ccoutant@google.com>
590
591             Add dwp support for v2 DWARF package file format.
592             * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
593             tu_length parameter.  Adjust all callers.
594             * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
595             * dwp.cc: Include dwarf.h.
596             (Section_bounds): New struct type.
597             (Unit_set): New struct type.
598             (Dwo_file::Dwo_file): Initialize new data member.
599             (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
600             Combine and rename to...
601             (Dwo_file::read_unit_index): ...this.
602             (Dwo_file::sized_read_compunit_index)
603             (Dwo_file::sized_read_typeunit_index): Combine and rename to...
604             (Dwo_file::sized_read_unit_index): ...this.
605             (Dwo_file::copy_section): Remove section_name, is_str_offsets
606             parameters; add section_id parameter.
607             (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
608             (Dwo_file::add_unit_set): ...this.
609             (Dwo_file::shndx_map_): Remove.
610             (Dwo_file::sect_offsets_): New data member.
611             (Dwp_output_file::Dwp_output_file): Initialize new data members.
612             (Dwp_output_file::add_section): Rename to...
613             (Dwp_output_file::add_contribution): ...this.
614             (Dwp_output_file::add_cu_set): Combine parameters into a struct.
615             (Dwp_output_file::add_tu_set): Likewise.
616             (Dwp_output_file::Contribution): New type.
617             (Dwp_output_file::Section::contributions): New data member.
618             (Dwp_output_file::Cu_or_tu_set): Remove.
619             (Dwp_output_file::Section::Section): New ctor.
620             (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
621             (Dwp_output_file::Dwp_index::Section_table): New type.
622             (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
623             (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
624             parameter.
625             (Dwp_output_file::Dwp_index::shndx_pool): Remove.
626             (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
627             (Dwp_output_file::Dwp_index::section_table): New member function.
628             (Dwp_output_file::Dwp_index::section_table_end): New member function.
629             (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
630             (Dwp_output_file::Dwp_index::section_table_rows): New member function.
631             (Dwp_output_file::Dwp_index::section_table_cols): New member function.
632             (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
633             (Dwp_output_file::Dwp_index::section_table_): New data member.
634             (Dwp_output_file::Dwp_index::section_mask_): New data member.
635             (Dwp_output_file::add_output_section): New member function.
636             (Dwp_output_file::write_new_section): New member function.
637             (Dwp_output_file::write_contributions): New member function.
638             (Dwp_output_file::section_id_map_): New data member.
639             (class Dwo_id_info_reader): Remove.
640             (class Unit_reader): New class.
641             (get_dwarf_section_name): New function.
642             (Dwo_file::read_executable): Adjust initializations of class data.
643             (Dwo_file::read): Add support for v2 package file format.
644             (Dwo_file::read_unit_index): Likewise.
645             (Dwo_file::sized_read_unit_index): Likewise.
646             (Dwo_file::copy_section): Likewise.
647             (Dwo_file::add_unit_set): Likewise.
648             (Dwp_output_file::add_output_section): Likewise.
649             (Dwp_output_file::add_contribution): Likewise.
650             (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
651             for empty slot.
652             (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
653             file format.
654             (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
655             slot.
656             (Dwp_output_file::initialize): Remove unused function.
657             (Dwp_output_file::finalize): Add support for v2 package file format.
658             (Dwp_output_file::write_index): Likewise.
659             * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
660             function prototype.
661
662 2013-07-31  Cary Coutant  <ccoutant@google.com>
663
664         * object.cc (Sized_relobj::do_output_section_address): New function.
665         (Sized_relobj): Instantiate explicitly.
666         * object.h (Object::output_section_address): New function.
667         (Object::do_output_section_address): New function.
668         (Sized_relobj::do_output_section_address): New function.
669         * powerpc.cc (Target_powerpc::symval_for_branch): Use it.
670
671 2013-07-30  Cary Coutant  <ccoutant@google.com>
672             Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
673
674         * parameters.cc (Parameters::entry): Return target-specific entry
675         symbol name.
676         * target.h (Target::entry_symbol_name): New function.
677         (Target_info::entry_symbol_name): New data member.
678
679         * arm.cc (Target_arm::arm_info): Add entry_symbol_name.
680         * i386.cc (Target_i386::i386_info): Likewise.
681         (Target_i386_nacl::i386_nacl_info): Likewise.
682         * sparc.cc (Target_sparc::sparc_info): Likewise.
683         * tilegx.cc (Target_tilegx::tilegx_info): Likewise.
684         * x86_64.cc: (Target_x86_64::x86_64_info) Likewise.
685         (Target_x86_64_nacl::x86_64_nacl_info) Likewise.
686         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
687
688 2013-07-22  Sterling Augustine  <saugustine@google.com>
689
690         * dwarf_reader.cc (Dwarf_pubnames_table::read_section):
691         Convert parameter shndx to local variable. Add parameters symtab
692         and symtab_size.  Scan over section names.  Find relocation
693         section corresponding to current section.  Create and initialize
694         reloc_mapper_ and reloc_type_.
695         (Dwarf_pubnames_table::read_header):  Add assertion.  Change
696         unit_length to off_t.  Initialize member unit_length_.  Fill in field
697         cu_offset_.
698         * dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
699         Initialize new fields unit_length_ and cu_offset_.
700         (Dwarf_pubnames_table::read_section): Update prototype.
701         (Dwarf_pubnames_table::cu_offset): New member function.
702         (Dwarf_pubnames_table::subsection_size): Likewise.
703         (Dwarf_pubnames_table::cu_offset_, Dwarf_pubnames_table::unit_length):
704         New fields.
705         (Dwarf_info_reader::symtab, Dwarf_info_reader::symtab_size): Make
706         member functions public.
707         * gdb_index.cc (Gdb_index_info_reader::read_pubnames_and_pubtypes):
708         Update comment.  Rework logic.  Move repeated parts to...
709         (Gdb_index_info_reader::read_pubtable): ...here. New function.
710         (Gdb_index::Gdb_index): Initialize new fields, pubnames_table_,
711         pubtypes_table_, and stmt_list_offset.
712         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
713         Gdb_index::find_pubtype_offset,
714         Gdb_index::map_pubnames_and_types_to_dies): Define new functions.
715         (Gdb_index::pubnames_read): Update prototype and rework logic.
716         * gdb_index.h (Gdb_index_info_reader, Dwarf_pubnames_table):
717         Forward declare.
718         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
719         Gdb_index::find_pubtype_offset, Gdb_index::pubnames_table)
720         Gdb_index::pubtypes_table, Gdb_index::map_pubnames_and_types_to_dies,
721         Gdb_index::map_pubtable_to_dies):
722         Declare functions.
723         (Gdb_index::pubnames_read): Update declaration.
724         (Gdb_index::Pubname_offset_map): New type.
725         (Gdb_index::cu_pubname_map_, Gdb_index::cu_pubtype_map_,
726         Gdb_index::pubnames_table_, Gdb_index::pubtypes_table_,
727         Gdb_index::stmt_list_offset): Declare.
728         (Gdb_index::pubnames_shndx_, Gdb_index::pubnames_offet_,
729         Gdb_index::pubtypes_object_, Gdb_index::pubtypes_shndx_)
730         Gdb_index::pubtypes_offset_): Remove.
731
732 2013-07-19  Roland McGrath  <mcgrathr@google.com>
733
734         * options.h (General_options): Add -Trodata-segment option.
735         * parameters.cc (Parameters::check_rodata_segment): New function.
736         (Parameters::set_target_once): Call it.
737         * parameters.h (Parameters): Declare it (private member function).
738         * layout.cc (load_seg_unusable_for_headers): New function, broken
739         out of Layout::relaxation_loop_body.  If TARGET->isolate_execinstr()
740         then validate rodata segment rather than text segment.
741         (relaxation_loop_body): Call that.
742         (is_text_segment): New function.  Don't admit a non-executable
743         segment if TARGET->isolate_execinstr().
744         (set_segment_offsets): Call it.  Honor -Trodata-segment option.
745
746 2013-07-15  Shawn Landden  <shawnlandden@gmail.com>
747
748         PR gold/15070
749         * fileread.h (File_read::get_view): Clarify comment about ALIGNED.
750         * nacl.h (Sniff_file::View::View): Request aligned view.
751
752 2013-07-11  Cary Coutant  <ccoutant@google.com>
753
754         * powerpc.cc (Target_powerpc::write_branch_lookup_table): Use
755         correct BRLT entry size.
756
757 2013-07-03  Alan Modra  <amodra@gmail.com>
758
759         * powerpc.cc (Target_powerpc::Relocate::relocate): Update self-call
760         comment.
761
762 2013-07-01  Cary Coutant  <ccoutant@google.com>
763
764         * dwarf_reader.cc (Dwarf_ranges_table::read_ranges_table): Save
765         reloc_type_.
766         (Dwarf_ranges_table::read_range_list): Call lookup_reloc.
767         (Dwarf_ranges_table::lookup_reloc): New function.
768         * dwarf_reader.h (Dwarf_ranges_table::Dwarf_ranges_table): Initialize
769         reloc_type_.
770         (Dwarf_ranges_table::lookup_reloc): New function.
771         (Dwarf_ranges_table::reloc_type_): New data member.
772
773 2013-06-27  Jing Yu  <jingyu@google.com>
774
775         PR gold/15662
776         * powerpc.cc (Output_data_brlt_powerpc::reset_brlt_sizes): New
777         function.
778         (Output_data_brlt_powerpc::finalize_brlt_sizes): New function.
779         (Target_powerpc::do_relax): Call the above.
780
781 2013-06-27  Cary Coutant  <ccoutant@google.com>
782
783         * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
784         on garbage collected .opd section.
785
786 2013-06-27  Alan Modra  <amodra@gmail.com>
787
788         * powerpc.cc (Target_powerpc::do_gc_add_reference): Test dst_shndx
789         is non-zero.
790         (Target_powerpc::do_gc_mark_symbols): Likewise for sym->shndx().
791         (Target_powerpc::do_function_location): Likewise for loc->shndx.
792
793 2013-06-14  Cary Coutant  <ccoutant@google.com>
794
795         * resolve.cc (Symbol::override_base): Don't override st_type
796         from plugin placeholder symbols.
797         (Symbol_table::resolve): Likewise.
798         (Symbol_table::should_override): Don't complain about TLS mismatch
799         if the TO symbol is a plugin placeholder.
800         * testsuite/Makefile.am (plugin_test_tls): New test.
801         * testsuite/Makefile.in: Regenerate.
802         * testsuite/plugin_test_tls.sh: New test script.
803         * testsuite/two_file_test_2_tls.cc: New test source.
804         * testsuite/two_file_test_tls.cc: New test source.
805
806 2013-06-05  Alexander Ivchenko  <alexander.ivchenko@intel.com>
807
808         * layout.cc (Layout::set_segment_offsets): Taking care of the case when
809         the maximum segment alignment is larger than the page size.
810         * testsuite/Makefile.am (large_symbol_alignment): Test that Gold
811         correctly aligns the symbols with large alignemnt.
812         * testsuite/Makefile.in: Regenerate.
813         * testsuite/large_symbol_alignment.cc: New file.
814
815 2013-05-30  Alexander Ivchenko  <alexander.ivchenko@intel.com>
816             Sriraman Tallam  <tmsriram@google.com>
817
818         * options.h (sort_section): New option.
819         * output.h (Input_section_sort_section_prefix_special_ordering_compare):
820         Rename from Input_section_sort_section_name_special_ordering_compare.
821         (Input_section_sort_section_name_compare): New struct.
822         * output.cc (Output_section::Input_section_sort_section_name_compare::
823         operator()): New function.
824         (Output_section::sort_attached_input_sections): Use new sort function
825         for .text if --sort-section=name is specified.
826         * layout.cc (Layout::make_output_section):
827         Add sorting by name when --sort-section=name is specified.
828         * testsuite/Makefile.am (text_section_grouping): Test option
829         --sort-section=name.
830         * testsuite/Makefile.in: Regenerate.
831         * testsuite/section_sorting_name.cc: New file.
832         * testsuite/section_sorting_name.sh: New file.
833
834 2013-05-21  Cary Coutant  <ccoutant@google.com>
835
836         * symtab.h (Symbol::is_cxx_vtable): New function.
837         * target-reloc.h (relocate_section): Check for vtable symbol.
838         * testsuite/Makefile.am (missing_key_func.sh): New test case.
839         * testsuite/Makefile.in: Regenerate.
840         * testsuite/missing_key_func.cc: New test source.
841         * testsuite/missing_key_func.sh: New test script.
842
843 2013-05-21  Cary Coutant  <ccoutant@google.com>
844
845         * object.cc (Sized_relobj_file::get_symbol_location_info): Set
846         type of enclosing symbol.
847         (Relocate_info::location): Check symbol type when describing symbol.
848         * object.h (Symbol_location_info): Remove unused line_number;
849         add enclosing_symbol_type.
850         * testsuite/debug_msg.sh: Adjust expected output.
851
852 2013-05-13  Cary Coutant  <ccoutant@google.com>
853
854         * configure.ac: Export DEFAULT_TARGET.
855         * configure: Regenerate.
856         * Makefile.in: Regenerate.
857         * testsuite/Makefile.am: Add .EXPORT_ALL_VARIABLES.
858         * testsuite/Makefile.in: Regenerate.
859         * testsuite/debug_msg.sh: Delete duplicate tests.
860         Don't check undef_int error message match for powerpc where the
861         source file and line number aren't available.
862
863 2013-05-10  Roland McGrath  <mcgrathr@google.com>
864
865         * options.h (General_options): Add --rosegment-gap option.
866         * options.cc (finalize): --rosegment-gap implies --rosegment.
867         * layout.cc (set_segment_offsets): Let user option override
868         target->rosegment_gap().
869
870 2013-05-10  Roland McGrath  <mcgrathr@google.com>
871
872         * options.h (General_options): Remove leading space from help
873         messages for -nostdlib and --rosegment.
874
875 2013-05-03  Maciej W. Rozycki  <macro@codesourcery.com>
876
877         PR ld/15365
878         * layout.cc (Layout::finalize): Make __ehdr_start STV_HIDDEN.
879
880 2013-05-03  Alan Modra  <amodra@gmail.com>
881
882         * merge.cc (Output_merge_string::do_add_input_section): Correct
883         scan for number of strings.  Rename vars to avoid shadowing.
884         Include missing terminator in input_size_.
885
886 2013-05-01  H.J. Lu  <hongjiu.lu@intel.com>
887
888         * merge.cc (Output_merge_string<Char_type>::do_add_input_section):
889         Restore empty string handling.
890
891 2013-05-01  Cary Coutant  <ccoutant@google.com>
892
893         * stringpool.cc (Stringpool_template::new_key_offset): Fix
894         uninitialized warning.
895
896 2013-04-29  Alexander Ivchenko  <alexander.ivchenko@intel.com>
897
898         * output.cc (Output_section::add_merge_input_section): Allow
899         to merge sections if the alignment is more than character size.
900         * merge.h (Output_merge_string::Output_merge_string): Remove
901         assert.
902         * merge.cc (Output_merge_string<Char_type>::do_add_input_section): Count
903         only not-null strings. Check the alignment of strings.
904         * stringpool.h
905         (Stringpool_template<Stringpool_char>::Stringpool_template): Add
906         alignment as the argument.
907         (Stringpool_template<Stringpool_char>::addralign_): New class member.
908         * stringpool.cc (Stringpool_template<Stringpool_char>::new_key_offset):
909         Align non-zero length strings according to the addralign_.
910         (Stringpool_template<Stringpool_char>::set_string_offsets):
911         Updating offsets according to the given alignment.
912         * testsuite/Makefile.am (text_section_grouping): Test if string
913         literals are getting merged.
914         * testsuite/Makefile.in: Regenerate.
915         * testsuite/merge_string_literals_1.c: New file.
916         * testsuite/merge_string_literals_2.c: Ditto.
917         * testsuite/merge_string_literals.sh: Ditto.
918
919 2013-04-26  Ian Lance Taylor  <iant@google.com>
920
921         * target-reloc.h (relocate_section): If the reloc offset is out of
922         range, pass VIEW as NULL to relocate.relocate.
923         * arm.cc (Target_arm:Relocate::relocate): Check for a NULL view.
924         * i386.cc (Target_i386::Relocate::relocate): Likewise.
925         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
926         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
927         * tilegx.cc (Target_tilegx::Relocate::relocate): Likewise.
928         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
929
930 2013-04-26  Geoff Pike  <gpike@chromium.org>
931
932         * gold.cc (queue_final_tasks): invoke layout->queue_build_id_tasks().
933         * layout.cc (Hash_task): New class.
934         (Layout::queue_build_id_tasks): New function.
935         (Layout::write_build_id): Handle single-thread portion of build ID
936         computation.  (In some cases, all of it is single-threaded.)  Replace
937         {sha1,md5}_process_bytes with {sha1,md5}_buffer to get the same
938         functionality in fewer lines of code.
939         * layout.h (Layout::queue_build_id_tasks): New function declaration.
940         * options.h (General_options): make "--build-id" default to tree
941         rather than sha1.  Add two new options related to --build-id=tree:
942         --build-id-chunk-size-for-treehash and
943         --build-id-min-file-size-for-treehash.
944         * Makefile.am: add testing of --build-id=tree and related new options
945         (these tests will be invoked by "make check").
946         * Makefile.in: Regenerate.
947
948 2013-04-25  Alan Modra  <amodra@gmail.com>
949
950         * configure.tgt: Add powerpcle and powerpc64le.
951
952 2013-04-22  Alan Modra  <amodra@gmail.com>
953
954         PR gold/15355
955         * layout.cc (Layout::segment_precedes): Allow more than one
956         segment with the same type and flags.
957
958 2013-04-15  Cary Coutant  <ccoutant@google.com>
959
960         * layout.cc (Layout::set_relocatable_section_offsets): Don't
961         allocate space in file for BSS sections.
962
963 2013-04-15  Cary Coutant  <ccoutant@google.com>
964
965         * script-sections.cc (Orphan_output_section): Reset address
966         to zero after each orphaned section for relocatable links.
967
968 2013-04-15  Cary Coutant  <ccoutant@google.com>
969
970         * symtab.cc (Symbol_table::sized_write_globals): Subtract
971         section starting address for relocatable link.
972         * testsuite/Makefile.am (script_test_11): New test.
973         * testsuite/Makefile.in: Regenerate.
974         * testsuite/script_test_11.c: New source file.
975         * testsuite/script_test_11.t: New linker script.
976
977 2013-04-13  Alan Modra  <amodra@gmail.com>
978
979         * powerpc.cc (Stub_control::can_add_to_stub_group): Don't set
980         owner when sections are not adjacent and exceed group size.
981         (Target_powerpc::group_sections): Handle corner case.
982         (Target_powerpc::Branch_info::make_stub): Handle case where
983         stub table doesn't exist due to branches in non-exec sections.
984         (Target_powerpc::Relocate::relocate): Likewise.
985
986 2013-04-11  Alan Modra  <amodra@gmail.com>
987
988         PR gold/15354
989         * powerpc.cc (Target_powerpc::make_brlt_section): Name section
990         .branch_lt to match bfd ld.  Adjust comments throughout file.
991
992 2013-04-04  Ian Lance Taylor  <iant@google.com>
993
994         GCC PR c++/56840
995         * object.cc (do_layout_deferred_sections): Handle .eh_frame
996         sections before checking whether they are included in the link.
997
998 2013-03-29  Sriraman Tallam  <tmsriram@google.com>
999
1000         * archive.cc (Archive::get_elf_object_for_member):  Create the elf
1001         object before calling the plugin claim_file handler.  Pass the elf
1002         object of the archive to the plugin. Delete the elf object if the
1003         plugin claims the file.
1004
1005 2013-03-21  Alan Modra  <amodra@gmail.com>
1006
1007         * layout.cc (Layout::set_segment_offsets): Accept writable .text
1008         segment when omagic.
1009
1010 2013-03-21  Alan Modra  <amodra@gmail.com>
1011
1012         * dwp.cc (Dwp_output_file::add_contribution): Avoid signed/unsigned
1013         comparison warning.
1014         * layout.cc (Layout::create_dynamic_symtab): Avoid "may be used
1015         uninitialized" warning.
1016
1017 2013-03-20  Alan Modra  <amodra@gmail.com>
1018
1019         * symtab.h (Symbol::clear_version): New function.
1020         * symtab.cc (Symbol_table::set_dynsym_indexes): Don't set object
1021         is_needed by weak references.  Clear version for symbols defined
1022         in as-needed objects that are not needed.
1023
1024 2013-03-15  Alan Modra  <amodra@gmail.com>
1025
1026         * powerpc.cc (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Make
1027         static and public.  Add report_err param.  Return false for data refs.
1028         (Target_powerpc::rela_dyn_section): New overloaded function.
1029         (Target_powerpc::plt_, iplt_): Elucidate.
1030         (Output_data_plt_powerpc::entry_count): Handle current_data_size()==0.
1031         (Output_data_plt_powerpc::do_write): Don't write .iplt.
1032         (Output_data_plt_powerpc::plt_entry_count): Don't add .iplt entries.
1033         (Target_powerpc::Scan::local, global): Adjust reloc_needs_plt_for_ifunc
1034         calls.  Put ifunc dynamic relocs in irela_dyn_section.  Only
1035         push_branch and make_plt_entry for ifunc syms when
1036         reloc_needs_plt_for_ifunc.
1037         (Target_powerpc::Relocate::relocate): Don't use plt entry value
1038         for ifunc unless reloc_needs_plt_for_ifunc.
1039
1040 2013-03-15  Alan Modra  <amodra@gmail.com>
1041
1042         * gc.h (gc_process_relocs): Don't look through function descriptors.
1043         * icf.cc (get_section_contents): Do so here instead.
1044
1045 2013-03-13  Alan Modra  <amodra@gmail.com>
1046
1047         * powerpc.cc (is_branch_reloc): Forward declare.
1048         (Target_powerpc::do_can_check_for_function_pointers): New predicate.
1049         (Target_powerpc::Scan::local_reloc_may_be_function_pointer): Return
1050         false for 64-bit, true for 32-bit non-branch relocs.
1051         (Target_powerpc::Scan::global_reloc_may_be_function_pointer): Likewise.
1052         * testsuite/Makefile.am (icf_test): Use linker map file instead of
1053         nm output.
1054         (icf_safe_test): Generate linker map file as well as nm output.
1055         (icf_safe_so_test): Likewise.
1056         * testsuite/Makefile.in: Regenerate.
1057         * testsuite/icf_test.sh: Parse linker map file to determine
1058         section folding.
1059         * testsuite/icf_safe_test.sh: Likewise.  Expect folding for PowerPC.
1060         * testsuite/icf_safe_so_test.sh: Likewise.
1061         (X86_32_or_ARM_specific_safe_fold): Merge into..
1062         (arch_specific_safe_fold): ..this.
1063         (X86_64_specific_safe_fold): Delete unused function.
1064
1065 2013-03-12  Alan Modra  <amodra@gmail.com>
1066
1067         * gc.h (gc_process_relocs): Look through function descriptors
1068         to determine shndx, symvalue and addend used by ICF.  Tidy
1069         variable duplication.
1070
1071 2013-03-11  Alan Modra  <amodra@gmail.com>
1072
1073         * gold.cc (queue_middle_tasks): Move detect_odr_violations..
1074         * layout.cc (Layout_task_runner::run): ..to here.
1075         * symtab.h (struct Symbol_location): Extract from..
1076         (class Symbol_table): ..here.
1077         * symtab.cc (Symbol_table::linenos_from_loc): Invoke function_location.
1078         * target.h (class Target): Add function_location and
1079         do_function_location functions.
1080         (class Sized_target): Add do_function_location.
1081         * object.h (class Sized_relobj_file): Move find_shdr..
1082         (class Object): ..to here.
1083         * object.cc: Likewise.  Update to suit.  Instantiate.
1084         (Sized_relobj_file::find_eh_frame): Update find_shdr call.
1085         * powerpc.cc (class Powerpc_dynobj): New.
1086         (Target_powerpc::do_function_location): New function.
1087         (Powerpc_relobj::do_find_special_sections): Update find_shdr call.
1088         (Powerpc_dynobj::do_read_symbols): New function.
1089         (Target_powerpc::do_make_elf_object): Make a Powerpc_dynobj.
1090
1091 2013-03-08  Ian Lance Taylor  <iant@google.com>
1092
1093         * options.cc (General_options::string_to_object_format): Accept
1094         "default".
1095
1096 2013-03-08  Alan Modra  <amodra@gmail.com>
1097
1098         * ehframe.h (Post_fdes) Make it a vector of Post_fde rather than
1099         pointer to Post_fde.
1100         (struct Post_fde): Move definition to here..
1101         * ehframe.cc (struct Post_fde): ..from here.
1102         (Cie::write): Don't alloc Post_fde.
1103         (Eh_frame::do_sized_write): Update.  Don't free Post_fde.
1104
1105 2013-03-07  Alan Modra  <amodra@gmail.com>
1106
1107         * testsuite/discard_locals_relocatable_test.c: Add a powerpc
1108         relocation referencing .LC0.
1109         * testsuite/discard_locals_test.sh: Remove FIXMEs.
1110
1111 2013-03-07  Alan Modra  <amodra@gmail.com>
1112
1113         * testsuite/ifunc-sel.h (ifunc_sel, ifunc_one): Mark
1114         always_inline.  Add assembly for powerpc to avoid GOT.
1115
1116 2013-03-07  Alan Modra  <amodra@gmail.com>
1117
1118         * testsuite/script_test_10.sh: Don't test .bss section
1119         header number.
1120
1121 2013-03-06  Alan Modra  <amodra@gmail.com>
1122
1123         * powerpc.cc (class Powerpc_relobj): Move some member functions.
1124         (Target_powerpc::symval_for_branch):  Add symtab param.  Update
1125         all callers.  Handle folded sections.
1126         (Target_powerpc::do_gc_add_reference): Don't cast dynamic object
1127         to Powerpc_relobj.
1128         (Global_symbol_visitor_opd::operator()): Likewise.
1129
1130 2013-03-04  Alan Modra  <amodra@gmail.com>
1131
1132         * testsuite/Makefile.am (final_layout_script.lds): Add .sbss.
1133         * testsuite/Makefile.in: Regenerate.
1134
1135 2013-03-01  Cary Coutant  <ccoutant@google.com>
1136
1137         Add dwp support for v2 DWARF package file format.
1138         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
1139         tu_length parameter.  Adjust all callers.
1140         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
1141         * dwp.cc: Include dwarf.h.
1142         (Section_bounds): New struct type.
1143         (Unit_set): New struct type.
1144         (Dwo_file::Dwo_file): Initialize new data member.
1145         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
1146         Combine and rename to...
1147         (Dwo_file::read_unit_index): ...this.
1148         (Dwo_file::sized_read_compunit_index)
1149         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
1150         (Dwo_file::sized_read_unit_index): ...this.
1151         (Dwo_file::copy_section): Remove section_name, is_str_offsets
1152         parameters; add section_id parameter.
1153         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
1154         (Dwo_file::add_unit_set): ...this.
1155         (Dwo_file::shndx_map_): Remove.
1156         (Dwo_file::sect_offsets_): New data member.
1157         (Dwp_output_file::Dwp_output_file): Initialize new data members.
1158         (Dwp_output_file::add_section): Rename to...
1159         (Dwp_output_file::add_contribution): ...this.
1160         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
1161         (Dwp_output_file::add_tu_set): Likewise.
1162         (Dwp_output_file::Contribution): New type.
1163         (Dwp_output_file::Section::contributions): New data member.
1164         (Dwp_output_file::Cu_or_tu_set): Remove.
1165         (Dwp_output_file::Section::Section): New ctor.
1166         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
1167         (Dwp_output_file::Dwp_index::Section_table): New type.
1168         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
1169         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
1170         parameter.
1171         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
1172         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
1173         (Dwp_output_file::Dwp_index::section_table): New member function.
1174         (Dwp_output_file::Dwp_index::section_table_end): New member function.
1175         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
1176         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
1177         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
1178         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
1179         (Dwp_output_file::Dwp_index::section_table_): New data member.
1180         (Dwp_output_file::Dwp_index::section_mask_): New data member.
1181         (Dwp_output_file::add_output_section): New member function.
1182         (Dwp_output_file::write_new_section): New member function.
1183         (Dwp_output_file::write_contributions): New member function.
1184         (Dwp_output_file::section_id_map_): New data member.
1185         (class Dwo_id_info_reader): Remove.
1186         (class Unit_reader): New class.
1187         (get_dwarf_section_name): New function.
1188         (Dwo_file::read_executable): Adjust initializations of class data.
1189         (Dwo_file::read): Add support for v2 package file format.
1190         (Dwo_file::read_unit_index): Likewise.
1191         (Dwo_file::sized_read_unit_index): Likewise.
1192         (Dwo_file::copy_section): Likewise.
1193         (Dwo_file::add_unit_set): Likewise.
1194         (Dwp_output_file::add_output_section): Likewise.
1195         (Dwp_output_file::add_contribution): Likewise.
1196         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
1197         for empty slot.
1198         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
1199         file format.
1200         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
1201         slot.
1202         (Dwp_output_file::initialize): Remove unused function.
1203         (Dwp_output_file::finalize): Add support for v2 package file format.
1204         (Dwp_output_file::write_index): Likewise.
1205         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
1206         function prototype.
1207
1208 2013-03-01  Cary Coutant  <ccoutant@google.com>
1209
1210         * dwarf_reader.cc (Dwarf_info_reader::check_buffer): Move
1211         function into class definition in header file.
1212         (Dwarf_info_reader::warn_corrupt_debug_section): New function.
1213         * dwarf_reader.h (Dwarf_info_reader::warn_corrupt_debug_section):
1214         New function.
1215         (Dwarf_info_reader::check_buffer): Move here from .cc file.
1216
1217 2013-02-28  Alan Modra  <amodra@gmail.com>
1218
1219         * target.h (Target::plt_fde_location, do_plt_fde_location): Declare.
1220         * target.cc (Target::do_plt_fde_location): New function.
1221         * ehframe.h (class FDE): Add post_map field to u_.from_linker,
1222         accessor function, and constructor param.
1223         (struct Post_fde, Post_fdes): Declare.
1224         (Cie::write): Add post_fdes param.
1225         * ehframe.cc (Fde::write): Use plt_fde_location.
1226         (struct Post_fde): Define.
1227         (Cie::write): Stash FDEs added post merge mapping.
1228         (Eh_frame::add_ehframe_for_plt): Assert no new CIEs after mapping.
1229         Adjust Fde constructor call.  Bump final_data_size_ for post map FDEs.
1230         (Eh_frame::do_sized_write): Arrange to write post map FDES after
1231         other FDEs.
1232         * powerpc.cc (Target_powerpc::do_plt_fde_location): New function.
1233         (Target_powerpc::has_glink): New function.
1234         (Target_powerpc::do_relax): Add eh_frame info for stubs.
1235         (struct Eh_cie, eh_frame_cie, glink_eh_frame_fde_64,
1236         glink_eh_frame_fde_32, default_fde): New data.
1237         (Stub_table::eh_frame_added_): New var.
1238         (Stub_table::find_long_branch_entry, stub_address, stub_offset):
1239         Make const.
1240         (Stub_table::add_eh_frame): New function.
1241         (Output_data_glink::add_eh_frame): New function.
1242         (Target_powerpc::make_glink_section): Call add_eh_frame.
1243
1244 2013-02-15  Ian Lance Taylor  <iant@google.com>
1245
1246         * options.h (DEFINE_uint64_alias): Define.
1247         (class General_options): Add -Ttext-segment as an alias for
1248         -Ttext.
1249
1250 2013-02-15  Alan Modra  <amodra@gmail.com>
1251
1252         * powerpc.cc (Stub_table::plt_off): New function, extracted from..
1253         (Stub_table::do_write): ..here, two places.
1254         (Stub_table::plt_call_size): Use it here too.
1255
1256 2013-02-11  Ian Lance Taylor  <iant@google.com>
1257
1258         * descriptors.cc (Descriptors::close_all): New function.
1259         * descriptors.h (class Descriptors): Declare close_all.
1260         (close_all_descriptors): New inline function.
1261         * plugin.cc: Include "descriptors.h".
1262         (Plugin_manager::cleanup): Call close_all_descriptors.
1263
1264 2013-02-06  Alan Modra  <amodra@gmail.com>
1265
1266         * README: Update coding style link.
1267
1268 2013-01-28  Cary Coutant  <ccoutant@google.com>
1269
1270         * dwp.cc (File_list): New typedef.
1271         (Dwo_name_info_reader): New class.
1272         (Dwo_id_info_reader::Dwo_id_info_reader): Remove unused parameters.
1273         (Dwo_id_info_reader::visit_top_die): Remove unused member function.
1274         (Dwo_file::~Dwo_file): Delete input_file_ after obj_.
1275         (Dwo_file::read_executable): New function.
1276         (Dwo_file::read): Move common setup code to ...
1277         (Dwo_file::make_object): ... here.
1278         (dwp_options): Add --exec/-e.
1279         (usage): Likewise.
1280         (main): Likewise.
1281
1282 2013-01-24  Sriraman Tallam  <tmsriram@google.com>
1283
1284         * layout.cc (Layout::layout): Check for option text_reorder.
1285         (Layout::make_output_section): Ditto.
1286         * options.h (text_reorder): New option.
1287         * output.cc (Input_section_sort_compare): Remove special ordering
1288         of section names.
1289         (Output_section::
1290          Input_section_sort_section_name_special_ordering_compare::
1291          operator()): New function.
1292         (Output_section::sort_attached_input_sections): Use new sort function
1293         for .text.
1294         * output.h (Input_section_sort_section_name_special_ordering_compare):
1295         New struct.
1296         * testsuite/Makefile.am (text_section_grouping): Test option
1297         --no-text-reorder
1298         * testsuite/Makefile.in: Regenerate.
1299         * testsuite/text_section_grouping.sh: Check order of functions without
1300         default text reordering.
1301
1302 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
1303
1304         * options.h (General_options): Change default to true for new_dtags.
1305
1306 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
1307
1308         * layout.cc (Layout::finish_dynamic_section): Only add DT_RPATH
1309         when enable_new_dtags is false.  Only add DT_RUNPATH when
1310         enable_new_dtags is true.
1311
1312 2013-01-17  Serge Pavlov  <serge.v.pavlov@gmail.com>
1313
1314         * powerpc.cc (Stub_table::find_plt_call_entry): Make types
1315         used in declaration and definition consistent.
1316         (Target_powerpc::symval_for_branch): Ditto.
1317
1318 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
1319
1320         * testsuite/plugin_final_layout.cc: Fix comment.
1321
1322 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
1323
1324         * layout.cc (Layout::layout): Do not do default sorting for
1325         text sections when section ordering is specified.
1326         (make_output_section): Ditto.
1327         * testsuite/plugin_final_layout.cc: Name the function sections
1328         to catch reordering issues.
1329
1330 2013-01-15  Alan Modra  <amodra@gmail.com>
1331
1332         * powerpc.cc (Target_powerpc::do_relax): Default shared libs to
1333         plt-thread-safe.
1334
1335 2013-01-15  Alan Modra  <amodra@gmail.com>
1336
1337         * testsuite/Makefile.am (final_layout_script.lds): Handle .got section.
1338         * testsuite/Makefile.in: Regenerate.
1339
1340 2013-01-14  Alan Modra  <amodra@gmail.com>
1341
1342         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add various output files.
1343         * testsuite/Makefile.in: Regenerate.
1344
1345 2013-01-11  Pavel Chupin  <pavel.v.chupin@intel.com>
1346
1347         PR bfd/14430
1348         Fix mingw gold build with plugins enabled
1349         * Makefile.am: Replace -ldl with @DLOPEN_LIBS@.
1350         * configure.ac: Export DLOPEN_LIBS and add headers check.
1351         * plugin.cc: Handle non-dlfcn case.
1352         * Makefile.in: Regenerate.
1353         * config.in: Regenerate.
1354         * configure: Regenerate.
1355         * testsuite/Makefile.in: Regenerate.
1356
1357 2013-01-09  Sriraman Tallam  <tmsriram@google.com>
1358
1359         * output.h (sort_attached_input_sections): Change to be public.
1360         * script-sections.cc
1361         (Output_section_definition::set_section_addresses): Sort
1362         attached input sections according to section order before linker
1363         script assigns section addresses.
1364         (Orphan_output_section::set_section_addresses): Sort
1365         attached input sections according to section order before linker
1366         script assigns section addresses.
1367         * Makefile.am (final_layout.sh): Use a simple linker script to
1368         check if section ordering still works.
1369         * Makefile.in: Regenerate.
1370
1371 2013-01-09  Ben Cheng  <bccheng@google.com>
1372
1373         * arm.cc (Target_arm::attributes_accept_div): New function.
1374         (Target_arm::attributes_forbid_div): New function.
1375         (Target_arm::merge_object_attributes): Merge the Tag_DIV_use
1376         attribute using the same new functions as what bfd/elf32_arm.c
1377         does.
1378
1379 2013-01-07  Cary Coutant  <ccoutant@google.com>
1380
1381         PR gold/14993
1382         * output.cc (Output_section::add_input_section): For incremental
1383         updates, don't track input sections that are allocated from patch
1384         space.
1385
1386 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
1387             Ian Lance Taylor  <iant@google.com>
1388
1389         PR gold/14897
1390         * configure.ac (--enable-ld): Removed.
1391         (install_as_default): Set to yes only for --enable-gold=default
1392         or --disable-ld.
1393         * configure: Regenerated.
1394
1395 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
1396
1397         * options.h (General_options): Add -fuse-ld= for GCC linker
1398         option compatibility.
1399
1400 2013-01-04  Cary Coutant  <ccoutant@google.com>
1401
1402         * configure.ac: Fix typo restoring CXXFLAGS.
1403         * configure: Regenerate.
1404
1405 2013-01-04  Cary Coutant  <ccoutant@google.com>
1406
1407         * testsuite/Makefile.am (CXXLINK_S): New macro.
1408         (debug_msg_so.err, debug_msg_ndebug.err): Use CXXLINK_S.
1409         * testsuite/Makefile.in: Regenerate.
1410
1411 2013-01-02  H.J. Lu  <hongjiu.lu@intel.com>
1412
1413         * version.cc (print_version): Update copyright year to 2013.
1414
1415 2012-12-20  Ian Lance Taylor  <iant@google.com>
1416
1417         * layout.cc (Layout::special_ordering_of_input_section): New
1418         function.
1419         (Layout::layout): If input section requires special ordering, must
1420         sort input sections.
1421         (Layout::make_output_section): May sort .text input sections.
1422         (Layout::is_section_name_prefix_grouped): Remove.
1423         * layout.h (class Layout): Declare
1424         special_ordering_of_input_section.  Don't declare
1425         is_section_name_prefix_grouped.
1426         * output.cc (Output_section::add_input_section): Revert last
1427         change.
1428         (Output_section::Input_section_sort::match_file_name): Don't crash
1429         if called on output section data.
1430         (Output_section::Input_section_sort_compare): Sort based on
1431         special ordering.
1432         (Output_section::Input_section_sort_section_order_index_compare):
1433         Revert last patch.
1434         (Output_section::sort_attached_input_sections): Likewise.
1435
1436 2012-12-18  Sriraman Tallam  <tmsriram@google.com>
1437
1438         * layout.cc (Layout::is_section_name_prefix_grouped): New function.
1439         * layout.h (Layout::is_section_name_prefix_grouped): New function.
1440         * output.cc (Output_section::add_input_section): Check if section
1441         name contains special prefix.  Keep input sections to sort such
1442         sections.
1443         (Output_section::Input_section_sort_section_order_index_compare
1444          ::operator()): Group sections according to prefixes.
1445         (Output_section::sort_attached_input_sections): Add condition to
1446         Input_section_entry constructor call.
1447         * testsuite/Makefile.am (text_section_grouping): New test.
1448         * testsuite/Makefile.in: Regenerate.
1449         * testsuite/text_section_grouping.cc: New file.
1450         * testsuite/text_section_grouping.sh: New file.
1451
1452 2012-12-17  Nick Clifton  <nickc@redhat.com>
1453
1454         * Makefile.am: Add copyright notice.
1455         * NEWS: Likewise.
1456         * README: Likewise.
1457         * configure.ac: Likewise.
1458         * ftruncate.c: Likewise.
1459         * Makefile.in: Regenerate.
1460
1461 2012-12-14  Cary Coutant  <ccoutant@google.com>
1462
1463         * testsuite/Makefile.am (exception_separate_shared_12_test): Add
1464         --no-as-needed flag.
1465         (exception_separate_shared_12_test): Likewise.
1466         (incremental_copy_test): Likewise.
1467         * testsuite/Makefile.in: Regenerate.
1468
1469 2012-12-14  Cary Coutant  <ccoutant@google.com>
1470
1471         * dwp.cc (Dwp_output_file::add_cu_set): Check for duplicate CUs.
1472         (Dwp_output_file::Dwp_index::enter_set): Add assert.
1473
1474 2012-12-12  Alan Modra  <amodra@gmail.com>
1475
1476         * powerpc.cc (class Track_tls): New.
1477         (class Relocate, class Scan): Inherit Track_tls.
1478         (Target_powerpc::Scan::local, global): Track tls optimization
1479         and avoid creating plt entry for __tls_get_addr if all uses
1480         are optimized away.
1481         (Target_powerpc::Relocate::relocate): Update to use Track_tls.
1482
1483 2012-12-12  Alan Modra  <amodra@gmail.com>
1484
1485         * options.h (General_options): Add --toc-sort/--no-toc-sort.
1486         Replace no_toc_optimize with toc_optimize.
1487         * output.h (Output_section::input_sections): Provide non-const variant.
1488         * powerpc.cc (Powerpc_relobj::has_small_toc_reloc_,
1489         set_has_small_toc_reloc, has_small_toc_reloc): New variable and
1490         accessors.
1491         (Target_powerpc::Scan::local, global): Call set_has_small_toc_reloc.
1492         (class Sort_toc_sections): New.
1493         (Target_powerpc::do_finalize_sections): Sort toc sections.
1494         (Target_powerpc::Relocate::relocate): Update toc_optimize test.
1495
1496 2012-12-10  Roland McGrath  <mcgrathr@google.com>
1497
1498         * testsuite/binary_unittest.cc (read_all): New function.
1499         (Sized_binary_test): Use it instead of ::read.
1500         * fileread.cc (do_read): Don't assume pread always reads the whole
1501         amount in a single call.
1502
1503 2012-12-10  Alan Modra  <amodra@gmail.com>
1504
1505         * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
1506         Set EM_PPC64 or EM_PPC here.
1507         (Target_selector_powerpc::do_recognize): Delete.
1508
1509 2012-12-10  Alan Modra  <amodra@gmail.com>
1510
1511         * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
1512         stub_table_.
1513         (Target_powerpc::Branch_info::make_stub): Don't omit addend.
1514
1515 2012-12-07  Roland McGrath  <mcgrathr@google.com>
1516
1517         * testsuite/binary_unittest.cc (Sized_binary_test):
1518         Use open_descriptor rather than ::open.
1519
1520 2012-12-07  Alan Modra  <amodra@gmail.com>
1521
1522         * powerpc.cc (Stub_table::do_write): Delete redundant Address
1523         typedef and invalid_address constant.
1524         (Output_data_glink, Stub_table, Target_powerpc): Explicitly
1525         instantiate constants.
1526
1527 2012-12-06  Roland McGrath  <mcgrathr@google.com>
1528
1529         * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
1530         Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
1531         * aclocal.m4: Regenerate.
1532         * configure: Regenerate.
1533         * Makefile.in: Regenerate.
1534         * testsuite/Makefile.in: Regenerate.
1535
1536 2012-12-07  Alan Modra  <amodra@gmail.com>
1537
1538         * options.h (General_options): Add no_toc_optimize.
1539         * powerpc.cc (ok_lo_toc_insn): New function.
1540         (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
1541
1542 2012-12-06  Alan Modra  <amodra@gmail.com>
1543
1544         * options.h (General_options): Add plt_align, plt_static_chain,
1545         plt_thread_safe.  Update stub_group_size help text.
1546         * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
1547         for new plt_thread_safe_ var.
1548         (use_plt_offset): Correct comments.
1549         (Target_powerpc::do_relax): Look for thread creation symbols to
1550         determine default plt_thread_safe value.  Clear plt call stubs
1551         as well as branch stubs each iteration.
1552         (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
1553         insn constants.
1554         (l, hi, ha, write_insn): Move earlier.
1555         (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
1556         (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
1557         plt stubs too.
1558         (Stub_table::update_size): Adjust.
1559         (Stub_table::prev_size, set_prev_size): Delete.
1560         (Stub_table::stub_align): Let --plt-align affect result.
1561         (Stub_table::plt_call_size): Calculate sizes for various stubs.
1562         (Stub_table::branch_stub_size): Use last_plt_size in address calc.
1563         (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
1564         (Stub_table::do_write): Support more stub variants.
1565
1566 2012-12-04  Alan Modra  <amodra@gmail.com>
1567
1568         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
1569         (Target_powerpc::do_define_standard_symbols): New function.
1570
1571 2012-12-03  Alan Modra  <amodra@gmail.com>
1572
1573         * output.h: Formatting, whitespace.
1574
1575 2012-12-03  Alan Modra  <amodra@gmail.com>
1576
1577         * layout.h (Layout::get_executable_sections): Declare.
1578         * layout.cc (Layout::get_executable_sections): New function.
1579         * arm.cc (Target_arm::group_sections): Use it.
1580         (Arm_output_section::group_sections): Delete now redundant test.
1581         * output.cc (Output_reloc::Output_reloc): Add is_relative.
1582         param to handle relative relocs.
1583         * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
1584         (Output_data_reloc::add_absolute): Adjust.
1585         (Output_data_reloc::add_relative): New function.
1586         (Output_data::reset_data_size): New function.
1587         (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
1588         (Output_section::set_addralign): New function.
1589         (Output_section::checkpoint_set_addralign): New function.
1590         (Output_section::clear_section_offsets_need_adjustment): New function.
1591         (Output_section::input_sections): Make public.
1592         * powerpc.cc (class Output_data_brlt_powerpc): New.
1593         (class Stub_table, class Stub_control): New.
1594         (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
1595         stub_table_, set_stub_table, stub_table): New vectors and accessor
1596         functions.
1597         (Target_powerpc::do_may_relax, do_relax, push_branch,
1598         new_stub_table, stub_tables, brlt_section, group_sections,
1599         add_branch_lookup_table, find_branch_lookup_table,
1600         write_branch_lookup_table, make_brlt_section): New functions.
1601         (Target_powerpc::struct Sort_sections, class Branch_info): New.
1602         (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
1603         branch_info_): New vars.
1604         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
1605         make call stubs here.
1606         (Output_data_glink): Remove all call stub handling from this class.
1607         (Target_powerpc::Scan::local, global): Save interesting branch
1608         relocs and relocs for ifunc.  Adjust calls to plt entry functions.
1609         (Target_powerpc::do_finalize_sections): Only make reg save/restore
1610         functions on final link.
1611         (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
1612         Handle long branch destinations too.
1613         (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
1614         do_plt_address_for_local): Adjust lookup of plt call stubs.
1615
1616 2012-11-30  Alan Modra  <amodra@gmail.com>
1617
1618         * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
1619         relocs against protected symbols when building 32-bit shared libs.
1620
1621 2012-11-30  Alan Modra  <amodra@gmail.com>
1622
1623         * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
1624         param.  Call got_section() to make .got.  Update all callers
1625         and their callers and so on.
1626
1627 2012-11-30  Alan Modra  <amodra@gmail.com>
1628
1629         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
1630         _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
1631         (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
1632         value if it already exists.
1633
1634 2012-11-19  H.J. Lu  <hongjiu.lu@intel.com>
1635
1636         PR gold/14858
1637         * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
1638
1639 2012-11-14  Roland McGrath  <mcgrathr@google.com>
1640
1641         * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
1642         than bfc instruction for data sandboxing.
1643
1644 2012-11-08  Alan Modra  <amodra@gmail.com>
1645
1646         * po/POTFILES.in: Regenerate.
1647
1648 2012-11-05  Alan Modra  <amodra@gmail.com>
1649
1650         * configure.ac: Apply 2012-09-10 change to config.in here.
1651         * configure: Regenerate.
1652
1653 2012-11-05  Alan Modra  <amodra@gmail.com>
1654
1655         * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
1656         (struct Opd_ent): Use "Address" rather than "Offset".
1657         (Output_data_got_powerpc::got_base_offset): Return Valtype.
1658         (Target_powerpc::got_section): Make public.
1659         (Target_powerpc::scan_relocs): Move code setting symbols..
1660         (Powerpc_relobj::do_scan_relocs): ..to here, new function.
1661         Create _SDA_BASE_ only when referenced.
1662
1663 2012-11-02  Roland McGrath  <mcgrathr@google.com>
1664
1665         * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
1666         from last change.
1667
1668 2012-11-01  Roland McGrath  <mcgrathr@google.com>
1669
1670         * target.h (Sized_target::relocate_relocs): Use Elf_Off
1671         for offset_in_output_section parameter.
1672         (Sized_target::relocate_special_relocatable): Likewise.
1673         * arm.cc (Target_arm::relocate_relocs): Likewise.
1674         (Target_arm::relocate_special_relocatable): Likewise.
1675         * i386.cc (Target_i386::relocate_relocs): Likewise.
1676         * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
1677         * sparc.cc (Target_sparc::relocate_relocs): Likewise.
1678         * target-reloc.h (relocate_relocs): Likewise.
1679         * testsuite/testfile.cc (Target_test): Likewise.
1680         * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
1681         * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
1682
1683         * system.h: Move inclusion of <clocale> to after <libintl.h> in
1684         [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
1685
1686         * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
1687         parameter, which is unused in the [!F_SETFD] case.
1688
1689         * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
1690         SYMNDX to off_t before comparing it to this->data_size().
1691         * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
1692         * incremental.cc (Output_section_incremental_inputs::do_write):
1693         Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
1694
1695         * nacl.cc: Include "libiberty.h" for vasprintf declaration.
1696
1697 2012-10-30  Steve McIntyre  <steve.mcintyre@linaro.org>
1698
1699         * gold.cc (Target_arm::do_adjust_elf_header): Add the
1700         hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
1701         in EABI_VER5.
1702
1703 2012-10-29  Cary Coutant  <ccoutant@google.com>
1704
1705         * dwp.cc (usage): Add file and exit status parameters;
1706         add --help and --version options.
1707         (print_version): New function.
1708         (main): Add --help and --version options.
1709
1710 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1711
1712         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
1713         final_layout_sequence.txt.
1714         * testsuite/Makefile.in: Regenerated.
1715
1716 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1717
1718         * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
1719         COMPILE generated by automake.
1720         (LINK1): Likewise.
1721         (CXXCOMPILE1): Likewise.
1722         (CXXLINK1): Likewise.
1723         (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
1724         (LINK): Likewise.
1725         (CXXCOMPILE): Likewise.
1726         (CXXLINK): Likewise.
1727         * testsuite/Makefile.in: Regenerated.
1728
1729 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1730
1731         * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
1732         on bad fwrite return.
1733
1734 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1735
1736         * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
1737         on val.
1738
1739 2012-10-23  Cary Coutant  <ccoutant@google.com>
1740
1741         * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
1742         * testsuite/Makefile.in: Regenerate.
1743         * testsuite/dwp_test.h: New source file.
1744         * testsuite/dwp_test_1.cc: New source file.
1745         * testsuite/dwp_test_1.s: New source file.
1746         * testsuite/dwp_test_1.sh: New source file.
1747         * testsuite/dwp_test_1b.cc: New source file.
1748         * testsuite/dwp_test_1b.s: New source file.
1749         * testsuite/dwp_test_2.cc: New source file.
1750         * testsuite/dwp_test_2.s: New source file.
1751         * testsuite/dwp_test_2.sh: New source file.
1752         * testsuite/dwp_test_main.cc: New source file.
1753         * testsuite/dwp_test_main.s: New source file.
1754
1755 2012-10-23  Cary Coutant  <ccoutant@google.com>
1756
1757         * dwp.h: New header file.
1758         * dwp.cc: New source file.
1759         * gold.h: Move shared declarations to system.h.
1760         * system.h: New header file.
1761         * Makefile.am: Add dwp.
1762         * Makefile.in: Regenerate.
1763
1764 2012-10-23  Cary Coutant  <ccoutant@google.com>
1765
1766         * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
1767         Dwarf_info_reader::read_from_pointer.
1768         (Dwarf_pubnames_table::read_header): Likewise.
1769         (Dwarf_pubnames_table::next_name): Likewise.
1770         (Dwarf_die::read_attributes): Likewise.
1771         (Dwarf_die::skip_attributes): Likewise.
1772         (Dwarf_info_reader::read_from_pointer): New function template.
1773         * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
1774         (Dwarf_pubnames_table): Likewise.
1775         (Dwarf_info_reader::read_from_pointer): New function template.
1776         * gdb-index.cc (Gdb_index_info_reader): Adjust call to
1777         Dwarf_pubnames_table ctor.
1778
1779 2012-10-23  Cary Coutant  <ccoutant@google.com>
1780
1781         * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
1782         abbrev_shndx.
1783         * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
1784         abbrev_shndx_.
1785         (Dwarf_info_reader::set_abbrev_shndx): New method.
1786         (Dwarf_info_reader::abbrev_shndx_): New data member.
1787
1788 2012-10-23  Cary Coutant  <ccoutant@google.com>
1789
1790         * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
1791         from object, not parameters.
1792         (Dwarf_info_reader::parse): Likewise.
1793         * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
1794         (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
1795         (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
1796         methods.
1797
1798 2012-10-23  Cary Coutant  <ccoutant@google.com>
1799
1800         * fileread.cc (Input_file::Input_file): New constructor.
1801         * fileread.h (class Input_file): Add new constructor.
1802
1803 2012-10-18  Alan Modra  <amodra@gmail.com>
1804
1805         PR gold/14727
1806         * object.cc (Relobj::is_section_name_included): Also match
1807         .sdata personality section.
1808
1809 2012-10-18  Alan Modra  <amodra@gmail.com>
1810
1811         * target-reloc.h (class Default_comdat_behavior): New, package up..
1812         (get_comdat_behaviour): ..this.
1813         (relocate_section): Add Relocate_comdat_behavior template arg,
1814         adjust code to suit.
1815         * arm.cc (Target_arm::relocate_section): Adjust to suit.
1816         (Target_arm::scan_reloc_section): Likewise.
1817         * i386.cc (Target_i386::relocate_section): Likewise.
1818         * sparc.cc (Target_sparc::relocate_section): Likewise.
1819         * tilegx.cc (Target_tilegx::relocate_section): Likewise.
1820         * x86_64.cc (Target_x86_64::relocate_section): Likewise.
1821         * powerpc.cc (class Relocate_comdat_behavior): New.
1822         (Target_powerpc::relocate_section): Don't zap opd relocs.  Supply
1823         gold::relocate_section with new template arg.
1824
1825 2012-10-18  Alan Modra  <amodra@gmail.com>
1826
1827         * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
1828         dynamic relocs for GOT_TPREL got entries, without symbol if
1829         resolving locally.
1830         (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
1831         (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
1832         (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
1833
1834 2012-10-17  Alan Modra  <amodra@gmail.com>
1835
1836         PR gold/14726
1837         * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
1838
1839 2012-10-16  Sriraman Tallam  <tmsriram@google.com>
1840
1841         * layout.cc (Layout::include_section): Keep sections marked
1842         SHF_EXCLUDE when doing relocatable links.
1843
1844 2012-10-16  Alan Modra  <amodra@gmail.com>
1845
1846         * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
1847         (Target_powerpc::do_finalize_sections): Call it.
1848         (Output_data_save_res): New class and supporting functions.
1849         (Target_powerpc::symval_for_branch): Only look up .opd entry for
1850         normal symbols defined in object files.
1851
1852 2012-10-12  Alan Modra  <amodra@gmail.com>
1853
1854         * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
1855         (struct Opd_ent): Make "discard" a bit field.  Add "gc_mark".
1856         (Target_powerpc::do_gc_mark_symbol): Delay marking function code
1857         section if scan_opd_relocs not yet called.
1858         (Target_powerpc::gc_process_relocs): Call process_gc_mark.
1859
1860 2012-10-12  Alan Modra  <amodra@gmail.com>
1861
1862         * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
1863         add_local_ifunc_entry): Revert last change.
1864         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
1865
1866 2012-10-05  Alan Modra  <amodra@gmail.com>
1867
1868         * powerpc.cc (Target_powerpc::do_plt_address_for_local,
1869         do_plt_address_for_global): New functions.
1870         (Output_data_got_powerpc::do_write): Don't segfault when linking
1871         statically.
1872         (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
1873         add_local_ifunc_entry): Return true on adding entry..
1874         (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
1875         glink->add_entry call.  Remove unused symtab param.  Adjust calls.
1876         (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
1877         (Target_powerpc::make_iplt_section): Remove symtab param.  Don't
1878         set up symbols here.
1879         (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
1880         syms here.  Do so even when no .iplt.  Don't segfault when linking
1881         statically.
1882         (Output_data_glink::add_entry, find_entry): Rearrange params.  Add
1883         new variants without reloc param.
1884         (Glink_sym_ent::Glink_sym_ent): Likewise.
1885         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
1886         reloc when refs will resolve to plt call stub.
1887         (Target_powerpc::Scan::local): Correct ifunc handling.  Allow
1888         R_PPC_PLTREL24 to resolve locally.
1889         (Target_powerpc::Scan::global): Correct ifunc handling.
1890         (Target_powerpc::Relocate::relocate): Correct local sym glink
1891         lookup.  Don't destroy "value" when we have a plt call stub,
1892         and when checking plt call validity.
1893         (Target_powerpc::do_dynsym_value): Simplify.
1894
1895 2012-10-05  Alan Modra  <amodra@gmail.com>
1896
1897         * i386.cc (Output_data_plt_i386::address_for_global,
1898         address_for_local): Add plt offset to returned value.  Adjust uses.
1899         * sparc.cc (Output_data_plt_sparc::address_for_global,
1900         address_for_local): Likewise.
1901         * tilegx.cc (Output_data_plt_tilegx::address_for_global,
1902         address_for_local): Likewise.
1903         * x86_64.cc (Output_data_plt_x86_64::address_for_global,
1904         address_for_local): Likewise.
1905         * target.h (Target::plt_address_for_global, plt_address_for_local):
1906         Update comment.
1907         * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
1908         (Output_data_got::Got_entry::write): Nor here.
1909         * output.h: Comment fix.
1910
1911 2012-10-02  Jiong Wang  <jiwang@tilera.com>
1912
1913         * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
1914         global_offset_table_ value for larget got.
1915         (Target_tilegx::Relocate::relocate): Handle adjusted got value.
1916
1917 2012-09-29  Alan Modra  <amodra@gmail.com>
1918
1919         * powerpc.cc (Target_powerpc::iplt_): New output section.
1920         (Target_powerpc::iplt_section, make_iplt_section,
1921         reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
1922         (Target_powerpc::make_plt_entry): Handle ifunc syms.
1923         Target_powerpc::plt_entry_count): Count iplt entries too.
1924         (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
1925         reloc section in constructor.  New params.
1926         (Target_powerpc::make_plt_section): Create reloc section here instead.
1927         (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
1928         functions.
1929         (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
1930         (Output_data_glink::add_entry, find_entry): New functions to
1931         deal with local syms.
1932         (Glink_sym_ent): Add support for local syms.
1933         (Output_data_glink::do_write): Handle ifunc plt entries.
1934         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1935         (Target_powerpc::Scan::local, global): Handle ifunc syms.
1936         (Target_powerpc::Relocate::relocate): Likewise.
1937         (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
1938
1939 2012-09-25  Alan Modra  <amodra@gmail.com>
1940
1941         * object.h (Sized_relobj_file::adjust_local_symbol,
1942         do_adjust_local_symbol): New functions.
1943         * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
1944         * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
1945         (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
1946         and irregular opd entry spacing.
1947         (Powerpc_relobj::do_read_relocs): Add opd size checks.
1948         (Global_symbol_visitor_opd): New functor.
1949         (Target_powerpc::do_finalize_sections): Omit global symbols defined
1950         on deleted opd entries.
1951
1952 2012-09-15  Jiong Wang  <jiwang@tilera.com>
1953
1954         * tilegx.cc: New file.
1955         * Makefile.am (TARGETSOURCES): Add tilegx.cc
1956         (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
1957         * configure.tgt: Add entries for tilegx*.
1958         * configure.ac: Likewise.
1959         * Makefile.in: Rebuild.
1960         * configure: Likewise.
1961         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
1962         tilegx.
1963
1964 2012-09-13  Alan Modra  <amodra@gmail.com>
1965
1966         * target-reloc.h (scan_relocs): Call scan.local for relocs
1967         against symbols in discarded sections.  Pass is_discarded
1968         param.
1969         * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
1970         Add is_discarded param.
1971         * powerpc (Target_powerpc::Scan::local): Likewise.  Use
1972         is_discarded to flag opd entry as discarded.  Don't emit dyn
1973         relocs on such entries.
1974         (Target_powerpc::Scan::global): Similarly detect and handle
1975         such opd entries.
1976         (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
1977         opd_ent_.  Update all uses.
1978         (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
1979         (Target_powerpc::relocate_section): Zero out discarded opd
1980         entry relocs.
1981
1982 2012-09-12  Ian Lance Taylor  <iant@google.com>
1983
1984         PR gold/14570
1985         * output.cc: Rename Output_data_got template parameter from size
1986         to got_size for all functions.  Compile all variants of
1987         Output_data_got.
1988         (Output_data_got::Got_entry::write): Correct use of size for
1989         symbol value.  Use local_is_tls rather than casting to
1990         Sized_relobj_file.
1991         * object.h (class Object): Add local_is_tls and do_local_is_tls.
1992         (class Sized_relobj_file): Add do_local_is_tls.
1993         * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
1994
1995 2012-09-11  Alan Modra  <amodra@gmail.com>
1996
1997         PR gold/14566
1998         * layout.cc (Layout::set_segment_offsets): When using
1999         common-page-size alignment, ensure we are on a new max-page-size
2000         page.
2001         * output.cc (Output_segment::set_section_addresses): Use
2002         abi_pagesize, not common_pagesize for relro boundary.
2003         (Output_segment::set_offset): Likewise.
2004
2005 2012-09-11  Alan Modra  <amodra@gmail.com>
2006
2007         * output.h (Output_data_got::add_global_tls, add_local_tls,
2008         add_local_tls_pair): New functions.
2009         (Output_data_got::add_local_pair_with_rel): Remove second
2010         reloc param.  Expand comment.
2011         (Output_data_got::Got_entry): Rename use_plt_offset_ to
2012         use_plt_or_tls_offset_, similarly for constructor param.
2013         (Output_data_got::Got_entry::write): Add got_index param.
2014         * output.cc (Output_data_got::add_global_tls, add_local_tls,
2015         add_local_tls_pair): New functions.
2016         (Output_data_got::Got_entry::write): Handle tls symbols
2017         with use_plt_or_tls_offset_ set specially.
2018         (Output_data_got::add_local_pair_with_rel): Only one reloc.
2019         (Output_data_got::do_write): Replace iterator with index, pass
2020         index to entry write function.
2021         * target.h (Target::tls_offset_for_local, tls_offset_for_global,
2022         do_tls_offset_for_local, do_tls_offset_for_global): New functions.
2023         * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
2024         call.
2025         * i386.cc (Target_i386::Scan::local): Likewise.
2026         * sparc.cc (Target_sparc::Scan::local): Likewise.
2027         * x86_64.cc (Target_x86_64::Scan::local): Likewise.
2028         * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
2029         do_tls_offset_for_global): New functions.
2030         (Target_powerpc::Scan::local): Correct TLS relocations and got
2031         entry values.
2032         (Target_powerpc::Scan::global): Don't emit unnecessary
2033         dynamic relocations on TLS GOT entries.
2034
2035 2012-09-10  Matthias Klose  <doko@ubuntu.com>
2036
2037         * config.in: Disable sanity check for kfreebsd.
2038
2039 2012-09-10  Sterling Augustine  <saugustine@google.com>
2040
2041         * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
2042         (Gdb_index::pubtypes_read): New parameter.
2043         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
2044         to calls.
2045         * gdb-index.h (Gdb_index): New fields pubnames_object_ and
2046         pubtypes_object_.
2047
2048 2012-09-09  Alan Modra  <amodra@gmail.com>
2049
2050         * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
2051         (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
2052         * gc.h (gc_process_relocs): Call target gc_add_reference.
2053         * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
2054         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
2055         (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
2056         unnecessary cast.
2057         * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
2058         to cater for when we don't need code offset.  Update use.
2059         (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
2060         (Powerpc_relobj::access_from_map, add_reference, opd_valid,
2061         set_opd_valid): New functions.
2062         (Target_powerpc::do_gc_add_reference): New function.
2063         (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
2064         stashed refs.
2065         (Target_powerpc::do_gc_mark_symbol): New function.
2066
2067 2012-09-06  Cary Coutant  <ccoutant@google.com>
2068
2069         * dwarf_reader.cc (Dwarf_die::read_attributes): Add
2070         DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
2071         (Dwarf_die::skip_attributes): Likewise.
2072         * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
2073         * testsuite/gdb_index_test.cc (inline_func_1): New function.
2074         (main): Call it.
2075         * testsuite/gdb_index_test_comm.sh: Check index for inline function.
2076
2077 2012-09-05  H.J. Lu  <hongjiu.lu@intel.com>
2078
2079         * testsuite/script_test_3.t: Add .got.plt output section
2080         statement.
2081         * testsuite/script_test_4.t: Likewise.
2082
2083 2012-09-05  Alan Modra  <amodra@gmail.com>
2084
2085         * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
2086         update all uses and lose "enum" when using type.
2087
2088 2012-09-05  Alan Modra  <amodra@gmail.com>
2089
2090         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
2091         * configure: Regenerate.
2092         * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
2093         (plugin_final_layout.stdout): Likewise.
2094         (memory_test): Set page sizes to 0x1000.
2095         * testsuite/Makefile.in: Regenerate.
2096         * testsuite/discard_locals_test.sh: Add FIXME comment.
2097         * testsuite/justsyms_exec.c: Disable function test for powerpc64.
2098         * testsuite/pr14265.t: Add .got output section statement.
2099         * testsuite/script_test_2.t: Likewise.
2100         * testsuite/script_test_3.t: Likewise.
2101         * testsuite/script_test_4.t: Likewise.
2102         * testsuite/script_test_5.t: Likewise.
2103         * testsuite/script_test_6.t: Likewise.
2104         * testsuite/script_test_7.t: Likewise.
2105         * testsuite/script_test_9.t: Likewise.
2106
2107 2012-09-05  Alan Modra  <amodra@gmail.com>
2108
2109         * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
2110         (Powerpc_relocate_functions::Status): New typedef.
2111         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
2112         (Target_powerpc::Scan::local): Handle REL64.
2113         (Target_powerpc::Scan::global): Likewise, and dynamic relocs
2114         for REL32 and REL64.
2115         (Target_powerpc::symval_for_branch): New function, extracted from..
2116         (Target_powerpc::Relocate::relocate): ..here.  Correct plt call
2117         checks.  Report overflow errors.
2118
2119 2012-09-05  Alan Modra  <amodra@gmail.com>
2120
2121         * object.h (Sized_relobj_file::emit_relocs): Delete.
2122         (Sized_relobj_file::emit_relocs_reltype): Delete.
2123         * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
2124         relocate_relocs for --emit-relocs.
2125         (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
2126         * output.h: Update comment.
2127         (Output_segment::first_section): New function.
2128         (Output_segment::first_section_load_address): Use first_section.
2129         * output.cc (Output_segment::first_section): New function extracted..
2130         (Output_segment::first_section_load_address): ..from here.  Delete.
2131         * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
2132         * target.h (Sized_target::relocate_for_relocatable): Likewise.
2133         * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
2134         adjust call to target.h function.
2135         * i386.cc (Target_i386): Likewise.
2136         * sparc.cc (Target_sparc): Likewise.
2137         * x86_64.cc (Target_x86_64): Likewise.
2138         * powerpc.cc (Target_powerpc): Likewise.
2139         (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS.  Ensure
2140         first tls section has section symbol for optimised local dynamic
2141         output relocs.
2142         (Target_powerpc::Relocate::relocate): Correct local dynamic value.
2143         (Target_powerpc::relocate_relocs): Adjust relocs emitted for
2144         optimised tls code.
2145         * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
2146         Rename to relocate_relocs.  Update error message.
2147
2148 2012-09-04  Andreas Schwab  <schwab@linux-m68k.org>
2149
2150         * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
2151         --just-symbols.
2152
2153 2012-08-31  Alan Modra  <amodra@gmail.com>
2154
2155         * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
2156         (Powerpc_relobj::toc_base_offset): New stub function.
2157         (Target_powerpc): Add tp_offset, dtp_offset.  Rename
2158         got_mod_index_offset to tlsld_got_offset.  Update all refs.
2159         (Target_powerpc::Relocate::enum skip_tls): New.
2160         (Target_powerpc::call_tls_get_addr_): New var.
2161         (Target_powerpc::is_branch_reloc): Move to file scope.
2162         (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
2163         (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
2164         New functions.
2165         (Target_powerpc::enum Got_type): Delete old values, add new ones.
2166         (powerpc_info): Correct common_pagesize for ppc64.
2167         (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
2168         (Powerpc_relocate_functions): Add overflow check enums and functions.
2169         Add non-shift version of rela, rela_ua.  Delete all rel public
2170         functions.  Delete addr16_lo.  Add addr64, addr64_u, addr32,
2171         addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
2172         addr16_ha3, addr14 functions.
2173         (Output_data_got_powerpc::add_constant_pair): New function.
2174         (Output_data_got_powerpc::got_base_offset): Likewise.
2175         (Output_data_got_powerpc::do_write): Correct 64-bit got header.
2176         (instruction constants): Sort, add some more.
2177         (Output_data_glink::do_write): Add and use Address typedef.  Use
2178         object->toc_base_offset() stub for 64-bit.
2179         (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
2180         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
2181         (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
2182         for R_PPC64_TOC.  Handle more relocs.  Generate got entries for TLS.
2183         Always treat .opd relocs as against locally defined symbol.
2184         Correct condition for RELATIVE relocs.
2185         (Target_powerpc::do_finalize_sections): Test for NULL sections.
2186         (Target_powerpc::Relocate::relocate): Use plt call stub as value
2187         for 32-bit syms with a plt entry.  Correct ppc64 toc base
2188         calculations.  Handle TLS relocs, and more.  Add overflow
2189         checking and adjust for Powerpc_relocate_functions changes.
2190         (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
2191         Reinstate --emit-relocs code with FIXME.
2192
2193 2012-08-30  Alan Modra  <amodra@gmail.com>
2194
2195         * layout.cc (Layout::set_segment_offsets): Set p_align to
2196         abi_pagesize, not common_pagesize.
2197         (Layout::relaxation_loop_body): Similarly use abi_pagesize
2198         to determine whether file header can go in segment.
2199
2200 2012-08-30  Alan Modra  <amodra@gmail.com>
2201
2202         * output.h (Output_reloc::Output_reloc <output section>): Add
2203         is_relative param.  Adjust calls.
2204         (Output_reloc::add_output_section_relative): New functions.
2205         * output.cc (Output_reloc::Output_reloc <output section>): Handle
2206         is_relative.
2207         (Output_reloc::symbol_value): Handle SECTION_CODE.
2208
2209 2012-08-24  Sriraman Tallam  <tmsriram@google.com>
2210
2211         * gold.cc (queue_middle_tasks): Call layout again when unique
2212         segments for sections is desired.
2213         * layout.cc (Layout::Layout): Initialize new members.
2214         (Layout::get_output_section_flags): New function.
2215         (Layout::choose_output_section): Call get_output_section_flags.
2216         (Layout::layout): Make output section for mapping to a unique segment.
2217         (Layout::insert_section_segment_map): New function.
2218         (Layout::attach_allocated_section_to_segment): Make unique segment for
2219         output sections marked so.
2220         (Layout::segment_precedes): Check for unique segments when sorting.
2221         * layout.h (Layout::Unique_segment_info): New struct.
2222         (Layout::Section_segment_map): New typedef.
2223         (Layout::insert_section_segment_map): New function.
2224         (Layout::get_output_section_flags): New function.
2225         (Layout::is_unique_segment_for_sections_specified): New function.
2226         (Layout::set_unique_segment_for_sections_specified): New function.
2227         (Layout::unique_segment_for_sections_specified_): New member.
2228         (Layout::section_segment_map_): New member.
2229         * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
2230         Rename is_gc_pass_one to is_pass_one.
2231         Rename is_gc_pass_two to is_pass_two.
2232         Rename is_gc_or_icf to is_two_pass.
2233         Check for which pass based on whether symbols data is present.
2234         Make it two pass when unique segments for sections is desired.
2235         * output.cc (Output_section::Output_section): Initialize new
2236         members.
2237         * output.h (Output_section::is_unique_segment): New function.
2238         (Output_section::set_is_unique_segment): New function.
2239         (Output_section::is_unique_segment_): New member.
2240         (Output_section::extra_segment_flags): New function.
2241         (Output_section::set_extra_segment_flags): New function.
2242         (Output_section::extra_segment_flags_): New member.
2243         (Output_section::segment_alignment): New function.
2244         (Output_section::set_segment_alignment): New function.
2245         (Output_section::segment_alignment_): New member.
2246         (Output_segment::Output_segment): Initialize is_unique_segment_.
2247         (Output_segment::is_unique_segment): New function.
2248         (Output_segment::set_is_unique_segment): New function.
2249         (Output_segment::is_unique_segment_): New member.
2250         * plugin.cc (allow_unique_segment_for_sections): New function.
2251         (unique_segment_for_sections): New function.
2252         (Plugin::load): Add new functions to transfer vector.
2253         * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
2254         * Makefile.in: Regenerate.
2255         * testsuite/plugin_final_layout.sh: Check if unique segment
2256         functionality works.
2257         * testsuite/plugin_section_order.c (onload): Check if new interfaces
2258         are available.
2259         (allow_unique_segment_for_sections): New global.
2260         (unique_segment_for_sections): New global.
2261         (claim_file_hook): Call allow_unique_segment_for_sections.
2262         (all_symbols_read_hook): Call unique_segment_for_sections.
2263
2264 2012-08-22  Cary Coutant  <ccoutant@google.com>
2265
2266         * layout.cc (Layout::include_section): Don't assert on GROUP
2267         sections with --emit-relocs.
2268
2269 2012-08-21  Cary Coutant  <ccoutant@google.com>
2270
2271         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
2272         if --export-dynamic-symbol names an undef symbol.
2273
2274 2012-08-18  Alan Modra  <amodra@gmail.com>
2275
2276         * powerpc.cc: Formatting and white space.
2277         (Powerpc_relobj): Rename got2_section_ to special_.
2278         Add opd_ent_shndx_ and opd_ent_off_ vectors.
2279         (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
2280         scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
2281         (Target_powerpc): Add Address typedef and invalid_address.  Use
2282         throughout.
2283         (Target_powerpc::is_branch_reloc): New function.
2284         (Powerpc_relocate_functions): Add Address typedef, use throughout.
2285         (Powerpc_relocate_functions:rela, rela_ua): Correct type used
2286         for dst_mask, value and addend.
2287         (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
2288         (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
2289         (Output_data_glink::do_write): Correct toc base.  Don't try to use
2290         uint16_t for 24-bit offset.  Use get_output_section_offset and
2291         check return.
2292         (Target_powerpc::Scan::local): Handle more relocs.
2293         (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
2294         (Target_powerpc::Relocate::relocate): Correct toc base calculation.
2295         Plug in toc restoring insn after plt calls.  Translate branches
2296         to function descriptor symbols to corresponding entry point.
2297         (Target_powerpc::relocate_for_relocatable): Check return from
2298         get_output_section_offset.
2299         * symtab.h: Comment typo.
2300
2301 2012-08-14  Ian Lance Taylor  <iant@google.com>
2302
2303         * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
2304         unsupported_relocal_local to call unsupported_reloc_global.
2305
2306 2012-08-14  Nick Clifton  <nickc@redhat.com>
2307
2308         PR ld/14265
2309         * script-sections.cc (Sections_element::output_section_name): Add
2310         keep return parameter.
2311         (Output_section_element::match_name): Add keep return parameter.
2312         Return the value of the keep_ member.
2313         * script-sections.h (class Output_section): Update
2314         output_section_name prototype.
2315         * layout.cc (Layout::keep_input_section): New public member
2316         function.
2317         (Layout::choose_output_section): Pass keep parameter to
2318         output_section_name.
2319         * layout.h (class Layout): Add keep_input_section.
2320         * object.cc (Sized_relobj_file::do_layout): Check for kept input
2321         sections.
2322         * testsuite/Makefile.am: Add a test.
2323         * testsuite/Makefile.in: Regenerate.
2324         * testsuite/pr14265.c: Source file for the test.
2325         * testsuite/pr14265.t: Linker script for the test.
2326         * testsuite/pr14265.sh: Shell script for the test.
2327
2328 2012-08-14  Alan Modra  <amodra@gmail.com>
2329
2330         * target.h (Target::output_section_name): New function.
2331         (Target::do_output_section_name): New function.
2332         * layout.cc (Layout::choose_output_section): Call the above.
2333         * powerpc.cc (Target_powerpc::do_output_section_name): New function.
2334
2335 2012-08-14  Alan Modra  <amodra@gmail.com>
2336
2337         * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
2338         (Output_data_got_powerpc::do_write): Don't rely on base class lookup
2339         for replace_constant call.
2340         (Output_data_plt_powerpc::do_print_to_mapfile): New function.
2341         (Output_data_glink::do_print_to_mapfile): New function.
2342         (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
2343         (Target_powerpc::Relocate::relocate): Likewise.
2344
2345 2012-08-14  Alan Modra  <amodra@gmail.com>
2346
2347         * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
2348         (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
2349         (Output_data_glink::add_entry,find_entry): Remove shndx param.
2350         (class Glink_sym_ent): Rename from struct Glink_sym_ent.  Remove
2351         all references to shndx_.  Handle special case for R_PPC_PLTREL24
2352         here.
2353         (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
2354         (Output_data_glink::do_write): Retrieve got2_shdnx from object.
2355         (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
2356         here.
2357         (Target_powerpc::Scan::global): Nor on make_plt_entry call.
2358         (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
2359
2360 2012-08-12  Alan Modra  <amodra@gmail.com>
2361
2362         * powerpc.cc: Whitespace fixes.  Wrap overly long lines.
2363         (glink insn constants): Use uint32_t.
2364         (Output_data_glink::add_entry): Use insert, not [] operator.
2365
2366 2012-08-11  Alan Modra  <amodra@gmail.com>
2367
2368         * object.h (Sized_relobj_file::find_shdr): New function.
2369         (Sized_relobj_file::find_special_sections): New function.
2370         * object.cc (Sized_relobj_file::find_shdr): New function.
2371         (Sized_relobj_file::find_eh_frame): Use find_shdr.
2372         (Sized_relobj_file::find_special_sections): New function, split out..
2373         (Sized_relobj_file::do_read_symbols): ..from here.
2374         * output.h (Output_data_got::replace_constant): New function.
2375         (Output_data_got::num_entries): New function.
2376         (Output_data_got::last_got_offset,set_got_size): Use num_entries.
2377         (Output_data_got::got_offset): Protected rather than private.
2378         (Output_data_got::replace_got_entry): New function.
2379         * output.cc (Output_data_got::replace_got_entry): New function.
2380         * powerpc.cc (class Powerpc_relobj): New.
2381         (class Powerpc_relocate_functions): Delete all psymval variants or
2382         convert to value,addend type.  Delete pcrela, pcrela_unaligned.
2383         Implement _ha functions using corresponding _hi function.
2384         (Powerpc_relobj::find_special_sections): New function.
2385         (Target_powerpc::do_make_elf_object): New function.
2386         (class Output_data_got_powerpc): New.
2387         (class Output_data_glink): New.
2388         (class Powerpc_scan_relocatable_reloc): New.
2389         Many more changes througout file.
2390
2391 2012-08-09  Nick Clifton  <nickc@redhat.com>
2392
2393         * po/vi.po: Updated Vietnamese translation.
2394
2395 2012-08-07  Ian Lance Taylor  <iant@google.com>
2396
2397         * layout.cc (Layout::add_target_dynamic_tags): If
2398         dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
2399         plt_rel.
2400
2401 2012-07-30  Nick Clifton  <nickc@redhat.com>
2402
2403         * po/gold.pot: Updated template.
2404         * po/es.po: Updated Spanish translation.
2405
2406 2012-07-18  Cary Coutant  <ccoutant@google.com>
2407
2408         PR gold/14344
2409         * configure.ac: Add check for -gpubnames support.
2410         * configure: Regenerate.
2411         * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
2412         support; force -gno-pubnames.
2413         (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
2414         support.
2415         (gdb_index_test_4): New test.
2416         * testsuite/Makefile.in: Regenerate.
2417         * testsuite/gdb_index_test_1.sh: Refactor code into common file.
2418         * testsuite/gdb_index_test_2.sh: Likewise.
2419         * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
2420         * testsuite/gdb_index_test_4.sh: New script.
2421         * testsuite/gdb_index_test_comm.sh: New script with common code;
2422         don't look for space after colon.
2423
2424 2012-07-16  Sriraman Tallam  <tmsriram@google.com>
2425
2426         * gold.cc (queue_middle_tasks): Update function order only after
2427         deferred objects due to plugins are processed.
2428
2429 2012-07-11  Ian Lance Taylor  <iant@google.com>
2430
2431         * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
2432         (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
2433         (Target_arm::scan_reloc_for_stub): Likewise.
2434         * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
2435         * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
2436         * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
2437         * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
2438         * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
2439
2440 2012-07-10  Dodji Seketeli  <dodji@redhat.com>
2441             Ian Lance Taylor  <iant@google.com>
2442
2443         PR gold/14309
2444         * configure.ac: Test whether std::tr1::hash<off_t> works.
2445         * gold.h: Add a specialization for std::tr1::hash<off_t> if
2446         needed.
2447         * output.h (class Output_fill): Add virtual destructor.
2448         * configure, config.in: Rebuild.
2449
2450 2012-06-22  Roland McGrath  <mcgrathr@google.com>
2451
2452         * layout.cc (finalize): Define __ehdr_start symbol if applicable.
2453
2454 2012-06-12  Rafael Ávila de Espíndola <respindola@mozilla.com>
2455
2456         * plugin.cc (Plugin::load): Handle position independent executables.
2457
2458 2012-06-06  Cary Coutant  <ccoutant@google.com>
2459
2460         * layout.cc (gdb_sections): Remove ".debug_" prefixes,
2461         add .debug_macro.
2462         (lines_only_debug_sections): Likewise.
2463         (gdb_fast_lookup_sections): New static array.
2464         (is_gdb_debug_section): Rename formal parameter.
2465         (is_lines_only_debug_section): Likewise.
2466         (is_gdb_fast_lookup_section): New function.
2467         (Layout::include_section): Check for ".zdebug_" prefix; pass
2468         section name suffix to is_gdb_debug_section, et al.; check for
2469         fast-lookup sections when building .gdb_index.
2470         * options.h (--strip-debug-gdb): Update GDB version number.
2471
2472 2012-06-06  Cary Coutant  <ccoutant@google.com>
2473
2474         * configure.ac: Add check for fallocate.
2475         * configure: Regenerate.
2476         * config.in: Regenerate.
2477
2478         * options.h (class General_options): Add --mmap-output-file and
2479         --posix-fallocate options.
2480         * output.cc: (posix_fallocate): Remove; replace with...
2481         (gold_fallocate): New function.
2482         (Output_file::map_no_anonymous): Call gold_fallocate.
2483         (Output_file::map): Check --mmap-output-file option.
2484
2485 2012-06-05  Jing Yu  <jingyu@google.com>
2486
2487         * gold.h (textdomain): Add do {} to empty while(0).
2488         (bindtextdomain): Likewise.
2489
2490 2012-06-04  Cary Coutant  <ccoutant@google.com>
2491
2492         * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
2493         has_dynsym_index.
2494
2495 2012-05-25  Sriraman Tallam  <tmsriram@google.com>
2496
2497         * symtab.cc (Symbol_table::define_special_symbol):
2498         Initialize *poldsym to prevent uninitialized variable errors.
2499
2500 2012-05-23  Cary Coutant  <ccoutant@google.com>
2501
2502         * layout.cc (Layout::section_name_mapping): Add rules to handle
2503         exact match on .data.rel.ro.local or .data.rel.ro.
2504         (Layout::output_section_name): Check for exact matches.
2505
2506 2012-05-23  Cary Coutant  <ccoutant@google.com>
2507
2508         * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
2509         more carefully.
2510
2511 2012-05-22  Cary Coutant  <ccoutant@google.com>
2512
2513         * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
2514         object before exporting symbol.
2515
2516 2012-05-21  H.J. Lu  <hongjiu.lu@intel.com>
2517
2518         * testsuite/tls_test.cc: Include "config.h" first.
2519         * testsuite/tls_test_c.c: Likewise.
2520
2521 2012-05-17  Daniel Richard G.  <skunk@iskunk.org>
2522             Nick Clifton  <nickc@redhat.com>
2523
2524         PR 14072
2525         * configure.in: Add check that sysdep.h has been included before
2526         any system header files.
2527         * configure: Regenerate.
2528         * config.in: Regenerate.
2529
2530 2012-05-14  Cary Coutant  <ccoutant@google.com>
2531
2532         * layout.cc (Layout::make_output_section): Mark .tdata section
2533         as RELRO.
2534         * testsuite/relro_test.cc: Add a TLS variable.
2535
2536 2012-05-10  H.J. Lu  <hongjiu.lu@intel.com>
2537
2538         PR gold/14091
2539         * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
2540         R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
2541         R_X86_64_64.
2542
2543 2012-05-08  Cary Coutant  <ccoutant@google.com>
2544
2545         * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
2546         (lines_only_debug_sections): Likewise.
2547
2548 2012-05-02  Roland McGrath  <mcgrathr@google.com>
2549
2550         * nacl.cc: New file.
2551         * nacl.h: New file.
2552         * Makefile.am (CCFILES, HFILES): Add them.
2553         * Makefile.in: Regenerate.
2554         * i386.cc (Output_data_plt_i386_nacl): New class.
2555         (Output_data_plt_i386_nacl_exec): New class.
2556         (Output_data_plt_i386_nacl_dyn): New class.
2557         (Target_i386_nacl): New class.
2558         (Target_selector_i386_nacl): New class.
2559         (target_selector_i386): Use it instead of Target_selector_i386.
2560         * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
2561         (Target_x86_64_nacl): New class.
2562         (Target_selector_x86_64_nacl): New class.
2563         (target_selector_x86_64, target_selector_x32): Use it instead of
2564         Target_selector_x86_64.
2565         * arm.cc (Output_data_plt_arm_nacl): New class.
2566         (Target_arm_nacl): New class.
2567         (Target_selector_arm_nacl): New class.
2568         (target_selector_arm, target_selector_armbe): Use it instead of
2569         Target_selector_arm.
2570
2571         * target-select.cc (select_target): Take new Input_file* and off_t
2572         arguments, pass them on to recognize method of selector.
2573         * object.cc (make_elf_sized_object): Update caller.
2574         * parameters.cc (parameters_force_valid_target): Likewise.
2575         * incremental.cc (make_sized_incremental_binary): Likewise.
2576         * target-select.h: Update decl.
2577         (Target_selector::recognize): Take new Input_file* argument,
2578         pass it on to do_recognize.
2579         (Target_selector::do_recognize): Take new Input_file* argument.
2580         * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
2581         * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
2582         * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
2583         * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
2584
2585         * target.h (Target::Target_info): New members isolate_execinstr
2586         and rosegment_gap.
2587         (Target::isolate_execinstr, Target::rosegment_gap): New methods.
2588         * arm.cc (Target_arm::arm_info): Update initializer.
2589         * i386.cc (Target_i386::i386_info): Likewise.
2590         * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
2591         * sparc.cc (Target_sparc::sparc_info): Likewise.
2592         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
2593         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
2594         * layout.cc (Layout::attach_allocated_section_to_segment):
2595         Take new const Target* argument.  If target->isolate_execinstr(), act
2596         like --rosegment.
2597         (Layout::find_first_load_seg): Take new const Target* argument;
2598         if target->isolate_execinstr(), reject PF_X segments.
2599         (Layout::relaxation_loop_body): Update caller.
2600         (Layout::set_segment_offsets): If target->isolate_execinstr(),
2601         reset file offset to zero when we hit LOAD_SEG, and then do a second
2602         loop over the segments before LOAD_SEG to reassign offsets after
2603         addresses have been determined.  Handle target->rosegment_gap().
2604         (Layout::attach_section_to_segment): Take new const Target* argument;
2605         pass it to attach_allocated_section_to_segment.
2606         (Layout::make_output_section): Update caller.
2607         (Layout::attach_sections_to_segments): Take new const Target* argument;
2608         pass it to attach_section_to_segment.
2609         * gold.cc (queue_middle_tasks): Update caller.
2610         * layout.h (Layout): Update method decls with new arguments.
2611
2612         * arm.cc (Target_arm::Target_arm): Take optional argument for the
2613         Target_info pointer to use.
2614         (Target_arm::do_make_data_plt): New virtual method.
2615         (Target_arm::make_data_plt): New method that calls it.
2616         (Target_arm::make_plt_entry): Use it.
2617         (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
2618         for the section alignment.
2619         (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
2620         method.
2621         (Output_data_plt_arm::first_plt_entry_offset): Call it.
2622         (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
2623         method.
2624         (Output_data_plt_arm::get_plt_entry_size): Call it.
2625         (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
2626         (Output_data_plt_arm::fill_plt_entry): New method that calls it.
2627         (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
2628         method.
2629         (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
2630         (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
2631         method instead of sizeof(plt_entry).
2632         (Output_data_plt_arm::add_entry): Likewise.
2633         Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
2634         (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
2635         than static method.
2636         (Target_arm::plt_entry_size): Likewise.
2637         (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
2638         Move to ...
2639         (Output_data_plt_arm_standard): ... here, new class.
2640         (Output_data_plt_arm::do_write): Move guts of PLT filling to...
2641         (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
2642         (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
2643
2644         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
2645         Take additional argument for the PLT entry size.
2646         (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
2647         Use get_plt_entry_size method rather than plt_entry_size variable.
2648         (Output_data_plt_x86_64::reserve_slot): Likewise.
2649         (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
2650         (Output_data_plt_x86_64::add_entry): Likewise.
2651         (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
2652         (Output_data_plt_x86_64::address_for_global): Likewise.
2653         (Output_data_plt_x86_64::address_for_local): Likewise.
2654         (Output_data_plt_x86_64::set_final_data_size): Likewise.
2655         (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
2656         Make method non-static.
2657         (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
2658         method.
2659         (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
2660         (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
2661         (Output_data_plt_x86_64::add_eh_frame): New method to call it.
2662         (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
2663         virtual method.
2664         (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
2665         (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
2666         virtual method.
2667         (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
2668         (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
2669         virtual method.
2670         (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
2671         (Output_data_plt_x86_64::plt_entry_size)
2672         (Output_data_plt_x86_64::first_plt_entry)
2673         (Output_data_plt_x86_64::plt_entry)
2674         (Output_data_plt_x86_64::tlsdesc_plt_entry)
2675         (Output_data_plt_x86_64::plt_eh_frame_fde_size)
2676         (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
2677         (Output_data_plt_x86_64_standard): ... here, new class.
2678         (Target_x86_64::Target_x86_64): Take optional argument for the
2679         Target_info pointer to use.
2680         (Target_x86_64::do_make_data_plt): New virtual method.
2681         (Target_x86_64::make_data_plt): New method to call it.
2682         (Target_x86_64::init_got_plt_for_update): Use that.
2683         Call this->plt_->add_eh_frame method here.
2684         (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
2685         (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
2686         rather than static method.
2687         (Target_x86_64::plt_entry_size): Likewise.
2688         (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
2689         rather than plt_entry_size variable.  Move guts of PLT filling to...
2690         (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
2691         (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
2692         (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
2693
2694         * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
2695         additional argument for the section alignment.
2696         Don't do add_eh_frame_for_plt here.
2697         (Output_data_plt_i386::first_plt_entry_offset): Make the method
2698         non-static.  Use get_plt_entry_size method rather than plt_entry_size
2699         variable.
2700         (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
2701         method.
2702         (Output_data_plt_i386::get_plt_entry_size): Call it.
2703         (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
2704         (Output_data_plt_i386::add_eh_frame): New method to call it.
2705         (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
2706         method.
2707         (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
2708         (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
2709         method.
2710         (Output_data_plt_i386::fill_plt_entry): New method to call it.
2711         (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
2712         method instead of plt_entry_size.
2713         (Output_data_plt_i386::plt_entry_size)
2714         (Output_data_plt_i386::plt_eh_frame_fde_size)
2715         (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
2716         (Output_data_plt_i386_standard): ... here, new class.
2717         (Output_data_plt_i386_exec): New class.
2718         (Output_data_plt_i386::exec_first_plt_entry): Move to ...
2719         (Output_data_plt_i386_exec::first_plt_entry): ... here.
2720         (Output_data_plt_i386::exec_plt_entry): Move to ...
2721         (Output_data_plt_i386_exec::plt_entry): ... here.
2722         (Output_data_plt_i386_dyn): New class.
2723         (Output_data_plt_i386::first_plt_entry): Move to ...
2724         (Output_data_plt_i386_dyn::first_plt_entry): ... here.
2725         (Output_data_plt_i386::dyn_plt_entry): Move to ...
2726         (Output_data_plt_i386_dyn::plt_entry): ... here.
2727         (Target_i386::Target_i386): Take optional argument for the Target_info
2728         pointer to use.
2729         (Target_i386::do_make_data_plt): New virtual method.
2730         (Target_i386::make_data_plt): New method to call it.
2731         (Target_i386::make_plt_section): Use that.
2732         Call this->plt_->add_eh_frame method here.
2733         (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
2734         rather than plt_entry_size variable.
2735         (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
2736         (Output_data_plt_i386::address_for_local): Likewise.
2737         (Output_data_plt_i386::do_write): Likewise.
2738         Move guts of PLT filling to...
2739         (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
2740         (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
2741         (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
2742         (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
2743
2744 2012-05-01  Cary Coutant  <ccoutant@google.com>
2745
2746         * dwarf_reader.cc (Dwarf_die::read_attributes)
2747         (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
2748         (Dwarf_die::uint_attribute): Remove DW_FORM_null.
2749         * reduced_debug_output.cc
2750         (Output_reduced_debug_info_section::get_die_end): Remove
2751         DW_FORM_GNU_ref_index.  Add default case.
2752
2753 2012-04-26  Mark Wielaard  <mjw@redhat.com>
2754
2755         * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
2756         * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
2757         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
2758         DW_AT_high_pc as offset from DW_AT_low_pc.
2759
2760         * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
2761         * testsuite/Makefile.in: Regenerate.
2762         * testsuite/gdb_index_test_3.c: New test source file.
2763         * testsuite/gdb_index_test_3.sh: New test source file.
2764
2765 2012-04-25  Ian Lance Taylor  <iant@google.com>
2766
2767         * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
2768         pointer.
2769         (Stub_addend_reader::operator()): Declare Arm_relocate_functions
2770         as a class, not a struct.
2771         (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
2772         (Target_arm::apply_cortex_a8_workaround): Likewise.
2773         * gc.h: Declare Reloc_types as a struct, not a class.
2774         * object.h: Declare Symbols_data as a struct.
2775         * reloc.h: Declare Read_relocs_data as a struct.
2776         * target.h: Declare Relocate_info as a struct.
2777
2778 2012-04-24  David S. Miller  <davem@davemloft.net>
2779
2780         * sparc.cc (Target_sparc::Relocate::relax_call): New function.
2781         (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
2782         and R_SPARC_WPLT30.
2783
2784 2012-04-24  Cary Coutant  <ccoutant@google.com>
2785
2786         * incremental-dump.cc (find_input_containing_global): Replace
2787         magic number with symbolic constant.
2788         (dump_incremental_inputs): Update version number.
2789         * incremental.cc (Output_section_incremental_inputs): Update version
2790         number; import symbolic constants from Incremental_inputs_reader.
2791         (Incremental_inputs::create_data_sections): Align relocations
2792         section correctly for 64-bit targets.
2793         (Output_section_incremental_inputs::set_final_data_size): Use symbolic
2794         constants; add padding.
2795         (Output_section_incremental_inputs::write_header): Add assert for
2796         header_size.
2797         (Output_section_incremental_inputs::write_input_files): Add assert
2798         for input_entry_size.
2799         (Output_section_incremental_inputs::write_info_blocks): Add padding;
2800         add assert for object_info_size, input_section_entry_size,
2801         global_sym_entry_size.
2802         * incremental.h (Incremental_inputs_reader): Add symbolic constants
2803         for data structure sizes; use them.
2804         (Incremental_input_entry_reader): Import symbolic constants from
2805         Incremental_inputs_reader; use them.
2806
2807 2012-04-23  David S. Miller  <davem@davemloft.net>
2808
2809         * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
2810         and elf_flags_set_.
2811         (Target_sparc::Target_sparc): Initialize new fields.
2812         (Target_sparc::do_make_elf_object): New function.
2813         (Target_sparc::do_adjust_elf_header): New function.
2814
2815 2012-04-23  Cary Coutant  <ccoutant@google.com>
2816
2817         * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
2818         CU range table of gdb index.
2819
2820 2012-04-20  David S. Miller  <davem@davemloft.net>
2821
2822         * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
2823         instead of false.
2824
2825 2012-04-16  David S. Miller  <davem@davemloft.net>
2826
2827         * sparc.cc (Target_sparc::got_address): New function.
2828         (Sparc_relocate_functions::gdop_hix22): New function.
2829         (Sparc_relocate_functions::gdop_lox10): New function.
2830         (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
2831         relocs.
2832         (Target_sparc::Scan::local): Likewise if the global symbol is not
2833         preemptible and is not IFUNC.
2834         (Target_sparc::Relocate::relocate): Perform GOTDATA code
2835         transformations for local and non-preemptible non-IFUNC global
2836         symbols.
2837
2838         * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
2839         writing out 64-bit part of ranges.
2840
2841         * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
2842         -fpic and -fpie respectively.
2843         * Makefile.in: Regenerate.
2844
2845         * sparc.cc (class Target_sparc): Add rela_ifunc_.
2846         (Target_sparc::Target_sparc): Initialize new field.
2847         (Target_sparc::do_plt_section_for_global): New function.
2848         (Target_sparc::do_plt_section_for_local): New function.
2849         (Target_sparc::reloc_needs_plt_for_ifunc): New function.
2850         (Target_sparc::make_plt_section): New function, broken out of
2851         make_plt_entry.  Use ORDER_NON_RELRO_FIRST for ".plt".
2852         (Target_sparc::make_plt_entry): Call make_plt_section.
2853         (Target_sparc::make_local_ifunc_plt_entry): New function.
2854         (Target_sparc::rela_ifunc_section): New function.
2855         (Target_sparc::plt_section): Remove const.
2856         (Output_data_plt_sparc): Update declarations.  Define Global_ifunc
2857         and Local_ifunc types.  Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
2858         and ifunc_count_ fields.
2859         (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
2860         (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
2861         (Output_data_plt_sparc::add_local_ifunc_entry): New function.
2862         (Output_data_plt_sparc::rela_ifunc): New function.
2863         (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
2864         (Output_data_plt_sparc::has_ifunc_section): New function.
2865         (Output_data_plt_sparc::entry_count): Include ifunc_count_.
2866         (Output_data_plt_sparc::address_for_global): New function.
2867         (Output_data_plt_sparc::address_for_local): New function.
2868         (Output_data_plt_sparc::plt_index_to_offset): New function.
2869         (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
2870         and entry_count.
2871         (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
2872         entry_count.
2873         (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
2874         R_SPARC_JMP_IREL to switch.
2875         (Target_sparc::Scan::check_non_pic): Likewise.
2876         (Target_sparc::Scan::local): Handle IFUNC symbols.
2877         (Target_sparc::Scan::local): Likewise.
2878         (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
2879         and plt_address_for_local.
2880         (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
2881         Define __rel_iplt_start and __rel_iplt_end if doing a static link.
2882
2883         * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
2884         (class Output_data_reloc): Adjust calls to Output_reloc_type.
2885         (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
2886         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
2887         global relocs too.
2888         (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
2889         * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
2890         calls.
2891         * sparc.cc (Target_sparc::Scan::global): Likewise.
2892         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
2893
2894 2012-04-16  Cary Coutant  <ccoutant@google.com>
2895
2896         * archive.cc (Library_base::should_include_member): Check for
2897         --export-dynamic-symbol.
2898         * options.h (class General_options): Add --export-dynamic-symbol.
2899         * symtab.cc (Symbol::should_add_dynsym_entry): Check for
2900         --export-dynamic-symbol.
2901         (Symbol_table::gc_mark_undef_symbols): Likewise.
2902         (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
2903
2904 2012-04-12  David S. Miller  <davem@davemloft.net>
2905
2906         * sparc.cc (Reloc::wdisp10): New relocation method.
2907         (Reloc::h34): Likewise.
2908         (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
2909         (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
2910         R_SPARC_WDISP10.
2911         (Target_sparc::Scan::local): Likewise.
2912         (Target_sparc::Scan::global): Likewise.
2913         (Target_sparc::Relocate::relocate): Likewise.
2914
2915 2012-04-09  Cary Coutant  <ccoutant@google.com>
2916
2917         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
2918         low_pc == 0.
2919
2920 2012-04-06  Ian Lance Taylor  <iant@google.com>
2921
2922         * timer.cc: #include <unistd.h>.
2923
2924 2012-04-06  Roland McGrath  <mcgrathr@google.com>
2925
2926         * configure.in (AC_CHECK_HEADERS): Add locale.h.
2927         * config.in: Regenerate.
2928         * configure: Regenerate.
2929
2930 2012-04-05  Nick Clifton  <nickc@redhat.com>
2931
2932         * configure.ac (AC_CHECK_FUNCS): Add setlocale.
2933         (AM_LC_MESSAGES): Add.
2934         * aclocal.m4: Regenerate.
2935         * config.in: Regenerate.
2936         * configure: Regenerate.
2937
2938 2012-03-21  Cary Coutant  <ccoutant@google.com>
2939
2940         * Makefile.am: Add gdb-index.cc, gdb-index.h.
2941         * Makefile.in: Regenerate.
2942         * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
2943         (Sized_elf_reloc_mapper::symbol_section): New function.
2944         (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
2945         (make_elf_reloc_mapper): New function.
2946         (Dwarf_abbrev_table::clear_abbrev_codes): New function.
2947         (Dwarf_abbrev_table::do_read_abbrevs): New function.
2948         (Dwarf_abbrev_table::do_get_abbrev): New function.
2949         (Dwarf_ranges_table::read_ranges_table): New function.
2950         (Dwarf_ranges_table::read_range_list): New function.
2951         (Dwarf_pubnames_table::read_section): New function.
2952         (Dwarf_pubnames_table::read_header): New function.
2953         (Dwarf_pubnames_table::next_name): New function.
2954         (Dwarf_die::Dwarf_die): New function.
2955         (Dwarf_die::read_attributes): New function.
2956         (Dwarf_die::skip_attributes): New function.
2957         (Dwarf_die::set_name): New function.
2958         (Dwarf_die::set_linkage_name): New function.
2959         (Dwarf_die::attribute): New function.
2960         (Dwarf_die::string_attribute): New function.
2961         (Dwarf_die::int_attribute): New function.
2962         (Dwarf_die::uint_attribute): New function.
2963         (Dwarf_die::ref_attribute): New function.
2964         (Dwarf_die::child_offset): New function.
2965         (Dwarf_die::sibling_offset): New function.
2966         (Dwarf_info_reader::check_buffer): New function.
2967         (Dwarf_info_reader::parse): New function.
2968         (Dwarf_info_reader::do_parse): New function.
2969         (Dwarf_info_reader::do_read_string_table): New function.
2970         (Dwarf_info_reader::lookup_reloc): New function.
2971         (Dwarf_info_reader::get_string): New function.
2972         (Dwarf_info_reader::visit_compilation_unit): New function.
2973         (Dwarf_info_reader::visit_type_unit): New function.
2974         (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
2975         Sized_elf_reloc_mapper.
2976         (Sized_dwarf_line_info::symbol_section): Remove function.
2977         (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
2978         (Sized_dwarf_line_info::read_line_mappings): Remove object
2979         parameter, adjust callers.
2980         (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
2981         * dwarf_reader.h: Include <sys/types.h>.
2982         (class Track_relocs): Remove forward declaration.
2983         (class Elf_reloc_mapper): New class.
2984         (class Sized_elf_reloc_mapper): New class.
2985         (class Dwarf_abbrev_table): New class.
2986         (class Dwarf_range_list): New class.
2987         (class Dwarf_ranges_table): New class.
2988         (class Dwarf_pubnames_table): New class.
2989         (class Dwarf_die): New class.
2990         (class Dwarf_info_reader): New class.
2991         (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
2992         (Sized_dwarf_line_info::symbol_section): Remove member function.
2993         * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
2994         base class.
2995         * gdb-index.cc: New source file.
2996         * gdb-index.h: New source file.
2997         * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
2998         and .debug_types sections, call Layout::add_to_gdb_index.
2999         (Sized_relobj_incr::do_section_name): Implement.
3000         (Sized_relobj_incr::do_section_contents): Adjust parameter list and
3001         return type; Implement.
3002         (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
3003         return type.
3004         * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
3005         parameter list and return type.
3006         (Sized_incr_dynobj::do_section_contents): Likewise.
3007         * layout.cc: Include gdb-index.h.
3008         (Layout::Layout): Initialize gdb_index_data_.
3009         (Layout::init_fixed_output_section): Check for .gdb_index section.
3010         (Layout::add_to_gdb_index): New function. Instantiate.
3011         * layout.h: Add forward declaration for class Gdb_index.
3012         (Layout::add_to_gdb_index): New member function.
3013         (Layout::gdb_index_data_): New data member.
3014         * main.cc: Include gdb-index.h.
3015         (main): Print statistics for gdb index.
3016         * object.cc (Object::section_contents): Move code into
3017         do_section_contents.
3018         (need_decompressed_section): Check for sections needed when building
3019         gdb index.
3020         (build_compressed_section_map): Likewise.
3021         (Sized_relobj_file::do_read_symbols): Need local symbols when building
3022         gdb index.
3023         (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
3024         sections; call Layout::add_to_gdb_index.
3025         (Sized_relobj_file::do_decompressed_section_contents): Call
3026         do_section_contents directly.
3027         * object.h (Object::do_section_contents): Adjust parameter list and
3028         return type.
3029         (Object::do_decompressed_section_contents): Call do_section_contents
3030         directly.
3031         (Sized_relobj_file::do_section_contents): Adjust parameter list and
3032         return type.
3033         * options.h (class General_options): Add --gdb-index option.
3034         * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
3035         list and return type.
3036         * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
3037         * reloc.h (Track_relocs::checkpoint): New function.
3038         (Track_relocs::reset): New function.
3039
3040         * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
3041         New test cases.
3042         * testsuite/Makefile.in: Regenerate.
3043         * testsuite/gdb_index_test.cc: New test source file.
3044         * testsuite/gdb_index_test_1.sh: New test source file.
3045         * testsuite/gdb_index_test_2.sh: New test source file.
3046
3047 2012-03-19  Doug Kwan  <dougkwan@google.com>
3048
3049         * arm.cc (Target_arm::do_define_standard_symbols): New method.
3050         (Target_arm::do_finalize_sections): Remove code which defines
3051         __exidx_start and __exidx_end.  Make symbol table parameter
3052         anonymous as it is not used.
3053         * gold.cc (queue_middle_tasks): Call target hook to define any
3054         target-specific symbols.
3055         * target.h (Target::define_standard_symbols): New method.
3056         (Target::do_define_standard_symbols): Same.
3057         * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
3058         * testsuite/Makefile.in: Regenerate.
3059         * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
3060         and __exidx_end.
3061         * testsuite/arm_exidx_test.sh: Check that no unused dynamic
3062         relocations are generated for __exidx_start and __exidx_end.
3063
3064 2012-03-16  Doug Kwan  <dougkwan@google.com>
3065
3066         * testsuite/Makefile.am: Disable test initpri3b.
3067         * testsuite/Makefile.in: Regenerate.
3068
3069 2012-03-15  Doug Kwan  <dougkwan@google.com>
3070
3071         * arm.cc (Target_arm::got_section): Make .got section read-only
3072         if -z now is given.
3073
3074 2012-03-15  Ian Lance Taylor  <iant@google.com>
3075
3076         PR gold/13850
3077         * layout.cc (Layout::make_output_section): Correctly mark
3078         SHT_INIT_ARRAY, et. al., as relro.
3079
3080 2012-03-14  Doug Kwan  <dougkwan@google.com>
3081
3082         * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
3083         dynamic relocations for protected symbols in shared objects.
3084
3085 2012-03-13  Ian Lance Taylor  <iant@google.com>
3086
3087         * resolve.cc (Symbol_table::resolve): When merging common symbols,
3088         keep the larger alignment.
3089
3090 2012-03-12  Cary Coutant  <ccoutant@google.com>
3091
3092         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
3093         handling of DW_LNE_define_file.
3094
3095 2012-03-12  Cary Coutant  <ccoutant@google.com>
3096
3097         * reduced_debug_output.cc
3098         (Output_reduced_debug_info_section::get_die_end): Add new FORM
3099         codes to switch.
3100
3101 2012-02-29  Cary Coutant  <ccoutant@google.com>
3102
3103         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
3104
3105 2012-02-29  Cary Coutant  <ccoutant@google.com>
3106
3107         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
3108         Call Object::decompressed_section_contents.
3109         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
3110         New dtor.
3111         (Sized_dwarf_line_info::buffer_start_): New data member.
3112         * merge.cc (Output_merge_data::do_add_input_section): Call
3113         Object::decompressed_section_contents.
3114         (Output_merge_string::do_add_input_section): Likewise.
3115         * object.cc (need_decompressed_section): New function.
3116         (build_compressed_section_map): Decompress sections needed later.
3117         (Sized_relobj_file::do_decompressed_section_contents): New function.
3118         (Sized_relobj_file::do_discard_decompressed_sections): New function.
3119         * object.h (Object::decompressed_section_contents): New function.
3120         (Object::discard_decompressed_sections): New function.
3121         (Object::do_decompressed_section_contents): New function.
3122         (Object::do_discard_decompressed_sections): New function.
3123         (Compressed_section_info): New type.
3124         (Compressed_section_map): Include decompressed section contents.
3125         (Sized_relobj_file::do_decompressed_section_contents): New function.
3126         (Sized_relobj_file::do_discard_decompressed_sections): New function.
3127
3128 2012-02-16  Cary Coutant  <ccoutant@google.com>
3129
3130         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
3131         * testsuite/Makefile.in: Regenerate.
3132
3133 2012-02-14  Cary Coutant  <ccoutant@google.com>
3134
3135         * options.cc (General_options::finalize): Disallow -pie and -static.
3136
3137 2012-02-03  Doug Kwan  <dougkwan@google.com>
3138
3139         * arm.cc (Arm_relocate_functions::abs8,
3140         Arm_relocate_functions::abs16): Use
3141         Bits::has_signed_unsigned_overflow32.
3142         (Arm_relocate_functions::thm_abs8): Correct range of
3143         overflow check.
3144         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
3145         in assertions.
3146
3147 2012-02-02  Doug Kwan  <dougkwan@google.com>
3148
3149         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
3150         position independent outputs, not just shared objects.
3151
3152 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
3153
3154         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
3155         * configure: Regenerated.
3156
3157 2012-01-27  Ian Lance Taylor  <iant@google.com>
3158
3159         * reloc.h (Bits): New class with static functions, copied from
3160         namespace utils in arm.cc.
3161         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
3162         instead.
3163
3164 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
3165
3166         * incremental.cc (write_info_blocks): Correct relocation offset.
3167
3168 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
3169
3170         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
3171         (Relocate::tls_gd_to_le): Likewise.
3172
3173 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
3174
3175         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
3176
3177 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
3178
3179         * configure.ac: Check if -mcmodel=medium works.
3180         * configure: Regenerated.
3181
3182 2012-01-24  Cary Coutant  <ccoutant@google.com>
3183
3184         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
3185         definition and ...
3186         (read_unsigned_LEB_128_x): ... this new function.
3187         (read_signed_LEB_128): Replaced with inline definition and ...
3188         (read_signed_LEB_128_x): ... this new function.
3189         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
3190         (read_unsigned_LEB_128): Add inline definition.
3191         (read_signed_LEB_128_x): New function.
3192         (read_signed_LEB_128): Add inline definition.
3193         * testsuite/Makefile.am (leb128_unittest): New unit test.
3194         * testsuite/Makefile.in: Regenerate.
3195         * testsuite/leb128_unittest.cc: New unit test.
3196
3197 2012-01-23  Ian Lance Taylor  <iant@google.com>
3198
3199         PR gold/13617
3200         * i386.cc (Target_i386::do_code_fill): When using a jmp
3201         instruction, pad with nop instructions.
3202         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
3203
3204 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
3205
3206         * x86_64.cc (gc_process_relocs): Add typename on types used in
3207         template.
3208         (scan_relocs): Likewise.
3209         (relocate_section): Likewise.
3210         (apply_relocation): Likewise.
3211
3212 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
3213
3214         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
3215         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
3216         under x32.
3217
3218 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
3219
3220         * x86_64.cc: Initial support for x32.
3221
3222 2012-01-03  Cary Coutant  <ccoutant@google.com>
3223
3224         * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
3225         Use abstract base class for GOT.
3226         * gold/output.h (class Output_data_got_base): New abstract base class.
3227         (class Output_data_got): Derive from new base class, adjust ctors.
3228         (Output_data_got::reserve_slot): Make virtual; rename to
3229         do_reserve_slot; Adjust callers.
3230         * gold/target.h (Sized_target::init_got_plt_for_update): Return
3231         pointer to abstract base class.
3232         * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
3233
3234 2011-12-18  Ian Lance Taylor  <iant@google.com>
3235
3236         * object.h (Relobj::local_symbol_value): New function.
3237         (Relobj::local_plt_offset): New function.
3238         (Relobj::local_has_got_offset): New function.
3239         (Relobj::local_got_offset): New function.
3240         (Relobj::set_local_got_offset): New function.
3241         (Relobj::do_local_symbol_value): New pure virtual function.
3242         (Relobj::do_local_plt_offset): Likewise.
3243         (Relobj::do_local_has_got_offset): Likewise.
3244         (Relobj::do_local_got_offset): Likewise.
3245         (Relobj::do_set_local_got_offset): Likewise.
3246         (Sized_relobj::do_local_has_got_offset): Rename from
3247         local_has_got_offset.
3248         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
3249         (Sized_relobj::do_set_local_got_offset): Rename from
3250         set_local_got_offset.
3251         (Sized_relobj_file::do_local_plt_offset): Rename from
3252         local_plt_offset.
3253         (Sized_relobj_file::do_local_symbol_value): New function.
3254         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
3255         local_plt_offset.
3256         * output.cc (Output_data_got::Got_entry::write): Change object to
3257         Relobj.  Use local_symbol_value.
3258         (Output_data_got::add_global_with_rel): Change rel_dyn to
3259         Output_data_reloc_generic*.  Use add_global_generic.
3260         (Output_data_got::add_global_with_rela): Remove.  Change all
3261         callers to use add_global_with_rel.
3262         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
3263         Output_data_reloc_generic*.  Use add_global_generic.
3264         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
3265         callers to use add_global_pair_with_rel.
3266         (Output_data_got::add_local): Change object to Relobj*.
3267         (Output_data_got::add_local_plt): Likewise.
3268         (Output_data_got::add_local_with_rel): Change object to Relobj*,
3269         change rel_dyn to Output_data_reloc_generic*.  Use
3270         add_local_generic.
3271         (Output_data_got::add_local_with_rela): Remove.  Change all
3272         callers to use all_local_with_rel.
3273         (Output_data_got::add_local_pair_with_rel): Change object to
3274         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
3275         add_output_section_generic.
3276         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
3277         callers to use add_local_pair_with_rel.
3278         (Output_data_got::reserve_local): Change object to Relobj*.
3279         * output.h: (class Output_data_reloc_generic): Add pure virtual
3280         declarations for add_global_generic, add_local_generic,
3281         add_output_section_generic.
3282         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
3283         functions for Output_data_reloc_generic.  Update declarations for
3284         changes listed in output.cc.
3285         (class Output_data_got): Change template parameter to got_size.
3286         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
3287         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
3288         function.
3289         (Sized_relobj_incr::do_local_plt_offset): New function.
3290         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
3291         add_global_generic.
3292
3293 2011-12-17  Cary Coutant  <ccoutant@google.com>
3294
3295         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
3296         * resolve.cc (Symbol_table::resolve): Likewise.
3297         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
3298         arrays.
3299         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
3300
3301 2011-12-16  Ian Lance Taylor  <iant@google.com>
3302
3303         * output.h (Output_data_reloc_generic::add): Only call
3304         add_dynamic_reloc if this is a dynamic reloc section.
3305
3306 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
3307
3308         PR gold/13505
3309         * target-reloc.h (apply_relocation): Replace <64, false> with
3310         <size, big_endian>.
3311
3312 2011-11-25  Nick Clifton  <nickc@redhat.com>
3313
3314         * po/it.po: New Italian translation.
3315
3316 2011-11-17  Sterling Augustine  <saugustine@google.com>
3317
3318         * script.cc (script_include_directive): Implement.
3319         (read_script_file): New local variables name and search_path. Update
3320         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
3321         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
3322         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
3323
3324 2011-11-11  Sterling Augustine  <saugustine@google.com>
3325
3326         * yyscript.y (section_cmd): Add support for INCLUDE directive.
3327         (file_or_sections_cmd): Likewise.
3328
3329 2011-11-11  Doug Kwan  <dougkwan@google.com>
3330
3331         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
3332         if --just-symbols is given.
3333
3334 2011-11-10  Doug Kwan  <dougkwan@google.com>
3335
3336         PR gold/13362
3337         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
3338         when processing data relocs.
3339         * reloc.h (Relocate_functions::rel_unaligned): New method.
3340         (Relocate_functions::pcrel_unaligned): Ditto.
3341         (Relocate_functions::rel32_unaligned): Ditto.
3342         (Relocate_functions::pcrel32_unaligned): Ditto.
3343
3344 2011-11-09  Doug Kwan  <dougkwan@google.com>
3345
3346         PR gold/13362
3347         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
3348         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
3349         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
3350         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
3351         (Relocate_functions::rel_unaligned): New.
3352         (Relocate_functions::rel32_unaligned): New.
3353         * target-reloc.h (relocate_for_relocatable): Add code to handle
3354         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
3355         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
3356         arm_unaligned_reloc_r): New targets.
3357         * testsuite/Makefile.in: Regenerate.
3358         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
3359         linking.
3360
3361 2011-11-02  Ian Lance Taylor  <iant@google.com>
3362
3363         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
3364         NATIVE_LINKER.
3365         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
3366         * options.cc (General_options::finalize): Use library search path
3367         from configure script if specified.  If not native and no sysroot,
3368         only search TOOLLIBDIR.
3369         * options.h (Search_directory::Search_directory): Change name to
3370         const std::string&.
3371         (General_options::add_to_library_path_with_sysroot): Change arg to
3372         const std::string&.
3373         * configure, Makefile.in, config.in: Rebuild.
3374
3375 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
3376
3377         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
3378         we are working around the ARM1176 Erratum.
3379         * options.h (General_options::fix_arm1176): Add option.
3380         * testsuite/Makefile.am: Add testcases, and keep current ones
3381         working.
3382         * testsuite/Makefile.in: Regenerate.
3383         * testsuite/arm_fix_1176.s: New file.
3384         * testsuite/arm_fix_1176.sh: Likewise.
3385
3386 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
3387
3388         * arm.cc (Target_arm::Target_arm): Remove initialisation of
3389         may_use_blx_.
3390         (Target_arm::may_use_blx): Remove method.
3391         (Target_arm::set_may_use_blx): Likewise.
3392         (Target_arm::may_use_v4t_interworking): New method.
3393         (Target_arm::may_use_v5t_interworking): Likewise.
3394         (Target_arm::may_use_blx_): Remove member variable.
3395         (Arm_relocate_functions::arm_branch_common): Check for v5T
3396         interworking.
3397         (Arm_relocate_functions::thumb_branch_common): Likewise.
3398         (Reloc_stub::stub_type_for_reloc): Likewise.
3399         (Target_arm::do_finalize_sections): Correct interworking checks.
3400         * testsuite/Makefile.am: Add new tests.
3401         * testsuite/Makefile.in: Regenerate.
3402         * testsuite/arm_farcall_arm_arm.s: New test.
3403         * testsuite/arm_farcall_arm_arm.sh: Likewise.
3404         * testsuite/arm_farcall_arm_thumb.s: Likewise.
3405         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
3406         * testsuite/arm_farcall_thumb_arm.s: Likewise.
3407         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
3408         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
3409         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
3410
3411 2011-10-31  Cary Coutant  <ccoutant@google.com>
3412
3413         PR gold/13023
3414         * expression.cc (Expression::eval_with_dot): Add
3415         is_section_dot_assignment parameter.
3416         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
3417         absolute and assigning to dot within a section.
3418         * script-sections.cc
3419         (Output_section_element_assignment::set_section_addresses): Pass
3420         dot_section to set_if_absolute.
3421         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
3422         as is_section_dot_assignment flag to eval_with_dot.
3423         (Output_section_element_dot_assignment::set_section_addresses):
3424         Likewise.
3425         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
3426         parameter.  Also set value if relative to dot_section; set the
3427         symbol's output_section.
3428         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
3429         parameter.  Adjust all callers.
3430         (Expression::eval_maybe_dot): Likewise.
3431         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
3432         Adjust all callers.
3433         * testsuite/script_test_2.t: Test assignment of an absolute value
3434         to dot within an output section element.
3435
3436 2011-10-31  Cary Coutant  <ccoutant@google.com>
3437
3438         * options.h (class General_options): Add --[no-]gnu-unique options.
3439         * symtab.cc (Symbol_table::sized_write_globals): Convert
3440         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
3441
3442 2011-10-31  Cary Coutant  <ccoutant@google.com>
3443
3444         PR gold/13359
3445         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
3446         unnecessary assertion.
3447         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
3448
3449 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
3450
3451         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
3452         gc_mark_symbol.
3453         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
3454         gc_mark_symbol.
3455         Change to just keep the section associated with symbol.
3456         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
3457         they are externally visible and --export-dynamic is turned on.
3458         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
3459
3460 2011-10-19  Ian Lance Taylor  <iant@google.com>
3461
3462         PR gold/13163
3463         * script-sections.cc
3464         (Output_section_element_dot_assignment::needs_output_section): New
3465         function.
3466
3467 2011-10-19  Ian Lance Taylor  <iant@google.com>
3468
3469         PR gold/13204
3470         * layout.cc (Layout::segment_precedes): Don't assert failure if a
3471         --section-start option was seen.
3472         * options.h (General_options::any_section_start): New function.
3473
3474 2011-10-18  David S. Miller  <davem@davemloft.net>
3475
3476         PR binutils/13301
3477         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
3478         member to track relocation locations that have moved during TLS
3479         reloc optimizations.
3480         (Target_sparc::Relocate::Relocate): Initialize to NULL.
3481         (Target_sparc::Relocate::relocate): Adjust view down by 4
3482         bytes if it matches reloc_adjust_addr_.
3483         (Target_sparc::Relocate::relocate_tls): Always move the
3484         __tls_get_addr call delay slot instruction forward 4 bytes when
3485         performing relaxation.
3486
3487 2011-10-18  Cary Coutant  <ccoutant@google.com>
3488
3489         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
3490         (Output_file::map_no_anonymous): Check for non-zero
3491         return code from posix_fallocate.
3492
3493 2011-10-17  Cary Coutant  <ccoutant@google.com>
3494
3495         PR gold/13245
3496         * plugin.cc (is_visible_from_outside): Check for symbols
3497         referenced from dynamic objects.
3498         * resolve.cc (Symbol_table::resolve): Don't count references
3499         from dynamic objects as references from real ELF files.
3500         * testsuite/plugin_test_2.sh: Adjust expected result.
3501
3502 2011-10-17  Cary Coutant  <ccoutant@google.com>
3503
3504         * gold.cc: Include timer.h.
3505         (queue_middle_tasks): Stamp time.
3506         (queue_final_tasks): Likewise.
3507         * main.cc (main): Store timer in parameters.  Print timers
3508         for each pass.
3509         * parameters.cc (Parameters::Parameters): Initialize timer_.
3510         (Parameters::set_timer): New function.
3511         (set_parameters_timer): New function.
3512         * parameters.h (Parameters::set_timer): New function.
3513         (Parameters::timer): New function.
3514         (Parameters::timer_): New data member.
3515         (set_parameters_timer): New function.
3516         * timer.cc (Timer::stamp): New function.
3517         (Timer::get_pass_time): New function.
3518         * timer.h (Timer::stamp): New function.
3519         (Timer::get_pass_time): New function.
3520         (Timer::pass_times_): New data member.
3521
3522 2011-10-17  Cary Coutant  <ccoutant@google.com>
3523
3524         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
3525         task for members of lib groups.
3526
3527 2011-10-17  Cary Coutant  <ccoutant@google.com>
3528
3529         PR gold/13288
3530         * fileread.cc (File_read::find_view): Add assert.
3531         (File_read::make_view): Move bounds check (replace with assert)...
3532         (File_read::find_or_make_view): ... to here.
3533
3534 2011-10-12  Cary Coutant  <ccoutant@google.com>
3535
3536         * output.cc (Output_file::open_base_file): Handle case where
3537         ::read returns less than requested size.
3538
3539 2011-10-10  Cary Coutant  <ccoutant@google.com>
3540
3541         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
3542         Initialize defined_count_.
3543         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
3544         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
3545         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
3546         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
3547         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
3548         * incremental.h (Sized_relobj_incr::defined_count_): New data
3549         member.
3550         (Sized_incr_dynobj::defined_count_): New data member.
3551         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
3552         Return zeroes instead of internal error.
3553
3554 2011-10-10  Cary Coutant  <ccoutant@google.com>
3555
3556         PR gold/13249
3557         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
3558         (Output_reloc::symbol_value): Return PLT offset if flag is set.
3559         * output.h (class Output_reloc): Add use_plt_offset flag.
3560         (Output_reloc::type_): Adjust size of bit field.
3561         (Output_reloc::use_plt_offset_): New bit field.
3562         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
3563         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
3564         flag.  Adjust all callers.
3565         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
3566         creating RELATIVE relocations.
3567
3568 2011-10-10  Nick Clifton  <nickc@redhat.com>
3569
3570         * po/es.po: Updated Spanish translation.
3571         * po/fi.po: Updated Finnish translation.
3572
3573 2011-10-03   Diego Novillo  <dnovillo@google.com>
3574
3575         * options.cc (parse_uint): Fix dereference of RETVAL.
3576
3577 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
3578
3579         * layout.h (section_order_map_): New member.
3580         (get_section_order_map): New member function.
3581         * output.cc (Output_section::add_input_section): Check for patterns
3582         only when --section-ordering-file is specified.
3583         * gold.cc (queue_middle_tasks): Delay updating order of sections till
3584         output_sections have been formed.
3585         * layout.cc (Layout_Layout): Initialize section_order_map_.
3586         * plugin.cc (update_section_order): Store order in order_map. Do not
3587         update the order.
3588         * testsuite/Makefile.am: Add test case for plugin_final_layout.
3589         * testsuite/Makefile.in: Regenerate.
3590         * testsuite/plugin_section_order.c: New file.
3591         * testsuite/plugin_final_layout.cc: New file.
3592         * testsuite/plugin_final_layout.sh: New file.
3593
3594 2011-09-29  Cary Coutant  <ccoutant@google.com>
3595
3596         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
3597         Check for NULL.
3598         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
3599         symbols during incremental update.
3600         (Symbol_table::add_from_dynobj): Likewise.
3601
3602 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3603             Ian Lance Taylor  <iant@google.com>
3604
3605         * symtab.cc (Symbol_table::define_special_symbol): Always
3606         canonicalize version string.
3607
3608 2011-09-26  Cary Coutant  <ccoutant@google.com>
3609
3610         * gold.cc (queue_initial_tasks): Move option checks ...
3611         * options.cc (General_options::finalize): ... to here. Disable
3612         some options; make others fatal.
3613
3614 2011-09-26  Cary Coutant  <ccoutant@google.com>
3615
3616         gcc PR lto/47247
3617         * plugin.cc (get_symbols_v2): New function.
3618         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
3619         (is_referenced_from_outside): New function.
3620         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
3621         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
3622         (get_symbols): Pass version parameter.
3623         (get_symbols_v2): New function.
3624         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
3625         parameter.
3626         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
3627         (onload): Add LDPT_GET_SYMBOLS_V2.
3628         (all_symbols_read_hook): Use get_symbols_v2; check for
3629         LDPR_PREVAILING_DEF_IRONLY_EXP.
3630         * testsuite/plugin_test_3.sh: Update expected results.
3631
3632 2011-09-23  Simon Baldwin  <simonb@google.com>
3633
3634         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
3635         configuration options.
3636         * configure: Regenerate.
3637         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
3638         * Makefile.in: Regenerate.
3639         * testsuite/Makefile.in: Regenerate.
3640
3641 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
3642
3643         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
3644
3645 2011-09-19  Cary Coutant  <ccoutant@google.com>
3646
3647         * incremental.cc (can_incremental_update): Fix typo in comment.
3648         * incremental.h (can_incremental_update): Likewise.
3649
3650 2011-09-18  Cary Coutant  <ccoutant@google.com>
3651
3652         * incremental.cc (can_incremental_update): New function.
3653         * incremental.h (can_incremental_update): New function.
3654         * layout.cc (Layout::init_fixed_output_section): Call it.
3655         (Layout::make_output_section): Don't allow patch space in .eh_frame.
3656         * object.cc (Sized_relobj_file::do_layout): Call
3657         can_incremental_update.
3658
3659 2011-09-13  Cary Coutant  <ccoutant@google.com>
3660
3661         * configure.ac: Check for glibc support for gnu_indirect_function
3662         support with static linking, setting automake conditional
3663         IFUNC_STATIC.
3664         * Makefile.in: Regenerate.
3665         * configure: Regenerate.
3666
3667         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
3668         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
3669         for IFUNC_STATIC.
3670         * testsuite/Makefile.in: Regenerate.
3671
3672 2011-09-13  Cary Coutant  <ccoutant@google.com>
3673
3674         * incremental.cc (Sized_relobj_incr::do_layout): Call
3675         report_comdat_group for kept comdat sections.
3676         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
3677         * testsuite/Makefile.in: Regenerate.
3678         * testsuite/incr_comdat_test_1.cc: New source file.
3679         * testsuite/incr_comdat_test_2_v1.cc: New source file.
3680         * testsuite/incr_comdat_test_2_v2.cc: New source file.
3681         * testsuite/incr_comdat_test_2_v3.cc: New source file.
3682
3683 2011-09-13  Ian Lance Taylor  <iant@google.com>
3684
3685         * object.cc (Sized_relobj_file::do_layout): Remove unused local
3686         variable external_symbols_offset.
3687
3688 2011-09-12  Ian Lance Taylor  <iant@google.com>
3689
3690         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
3691         triggered if object has no symbols.
3692
3693 2011-09-09  David S. Miller  <davem@davemloft.net>
3694
3695         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
3696         (Output_fill_debug_line::do_write): Likewise.
3697
3698 2011-08-29  Cary Coutant  <ccoutant@google.com>
3699
3700         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
3701         casts to match formatting specs.
3702         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
3703
3704 2011-08-26  Cary Coutant  <ccoutant@google.com>
3705
3706         * layout.cc (Free_list::allocate): Provide guarantee of minimum
3707         remaining hole size when allocating.
3708         (Layout::make_output_section): Set fill methods for debug sections.
3709         * layout.h (Free_list::Free_list_node): Move from private to
3710         public.
3711         (Free_list::set_min_hole_size): New function.
3712         (Free_list::begin, Free_list::end): New functions.
3713         (Free_list::min_hole_): New data member.
3714         * output.cc: Include dwarf.h.
3715         (Output_fill_debug_info::do_minimum_hole_size): New function.
3716         (Output_fill_debug_info::do_write): New function.
3717         (Output_fill_debug_line::do_minimum_hole_size): New function.
3718         (Output_fill_debug_line::do_write): New function.
3719         (Output_section::Output_section): Initialize new data member.
3720         (Output_section::set_final_data_size): Ensure patch space is larger
3721         than minimum hole size.
3722         (Output_section::do_write): Fill holes in debug sections.
3723         * output.h (Output_fill): New class.
3724         (Output_fill_debug_info): New class.
3725         (Output_fill_debug_line): New class.
3726         (Output_section::set_free_space_fill): New function.
3727         (Output_section::free_space_fill_): New data member.
3728         * testsuite/Makefile.am (incremental_test_3): Add
3729         --incremental-patch option.
3730         (incremental_test_4): Likewise.
3731         (incremental_test_5): Likewise.
3732         (incremental_test_6): Likewise.
3733         (incremental_copy_test): Likewise.
3734         (incremental_common_test_1): Likewise.
3735         * testsuite/Makefile.in: Regenerate.
3736
3737 2011-08-26  Nick Clifton  <nickc@redhat.com>
3738
3739         * po/es.po: Updated Spanish translation.
3740
3741 2011-08-01  Cary Coutant  <ccoutant@google.com>
3742
3743         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
3744         * gold/testsuite/Makefile.in: Regenerate.
3745         * gold/testsuite/justsyms_exec.c: New source file.
3746         * gold/testsuite/justsyms_lib.c: New source file.
3747
3748 2011-08-01  Cary Coutant  <ccoutant@google.com>
3749
3750         * layout.cc (Layout::set_segment_offsets): Don't realign text
3751         segment if -Ttext was specified.
3752         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
3753         file type.
3754         * object.h (Sized_relobj_file::e_type): New function.
3755         (Sized_relobj_file::e_type_): New data member.
3756         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
3757         base address for ET_EXEC files.
3758         * target.cc (Target::do_make_elf_object_implementation): Allow
3759         ET_EXEC files with --just-symbols option.
3760
3761 2011-07-28  Cary Coutant  <ccoutant@google.com>
3762
3763         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
3764         Add thread_number parameter.
3765         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
3766         * workqueue-threads.cc
3767         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
3768         current thread if its thread number is greater than desired thread
3769         count.
3770         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
3771         Add thread_number parameter.
3772         (Workqueue::should_cancel_thread): Likewise.
3773         (Workqueue::find_runnable_or_wait): Pass thread_number to
3774         should_cancel_thread.
3775         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
3776         parameter.
3777
3778 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
3779
3780         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
3781         only after checking if it cannot be forced local.
3782         * symtab.h (is_externally_visible): Check if the symbol is not forced
3783         local.
3784
3785 2011-07-15  Ian Lance Taylor  <iant@google.com>
3786
3787         * options.h (class General_options): Add --print-output-format.
3788         Move -EL next to -EB, for  better --help output.
3789         * target-select.cc: Include <cstdio>, "options.h", and
3790         "parameters.h".
3791         (Target_selector::do_target_bfd_name): New function.
3792         (print_output_format): New function.
3793         * target-select.h (class Target_selector): Update declarations.
3794         (Target_selector::target_bfd_name): New function.
3795         (print_output_format): Declare.
3796         * main.cc: Include "target-select.h".
3797         (main): Handle --print-output-format.
3798         * gold.cc: Include "target-select.h".
3799         (queue_initial_tasks): Handle --print-output-format when there are
3800         no input files.
3801         * parameters.cc (parameters_force_valid_target): Give a better
3802         error message if -EB/-EL does not match target.
3803         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
3804         function.
3805
3806 2011-07-15  Ian Lance Taylor  <iant@google.com>
3807
3808         * i386.cc (class Output_data_plt_i386): Add layout_ field.
3809         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
3810         (Output_data_plt_i386::do_write): Write address of .dynamic
3811         section to first entry in .got.plt section.
3812         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
3813         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
3814         Initialize layout_.
3815         (Output_data_plt_x86_64::do_write): Write address of .dynamic
3816         section to first entry in .got.plt section.
3817         * layout.h (Layout::dynamic_section): New function.
3818
3819 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
3820
3821         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
3822         to claim_file call.
3823         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
3824         input_section_position_, and input_section_glob_.
3825         (read_layout_from_file): Call function section_ordering_specified.
3826         * layout.h (is_section_ordering_specified): New function.
3827         (section_ordering_specified): New function.
3828         (section_ordering_specified_): New boolean member.
3829         * main.cc(main): Call load_plugins after layout object is defined.
3830         * output.cc (Output_section::add_input_section): Use
3831         function section_ordering_specified to check if section ordering is
3832         needed.
3833         * output.cc (Output_section::add_relaxed_input_section): Use
3834         function section_ordering_specified to check if section ordering is
3835         needed.
3836         (Output_section::update_section_layout): New function.
3837         (Output_section::sort_attached_input_sections): Check if input section
3838         must be reordered.
3839         * output.h (Output_section::update_section_layout): New function.
3840         * plugin.cc (get_section_count): New function.
3841         (get_section_type): New function.
3842         (get_section_name): New function.
3843         (get_section_contents): New function.
3844         (update_section_order): New function.
3845         (allow_section_ordering): New function.
3846         (Plugin::load): Add the new interfaces to the transfer vector.
3847         (Plugin_manager::load_plugins): New parameter.
3848         (Plugin_manager::all_symbols_read): New parameter.
3849         (Plugin_manager::claim_file): New parameter. Save the elf object for
3850         unclaimed objects.
3851         (Plugin_manager::get_elf_object): New function.
3852         (Plugin_manager::get_view): Change to directly use the bool to check
3853         if get_view is called from claim_file_hook.
3854         * plugin.h (input_objects): New function
3855         (Plugin__manager::load_plugins): New parameter.
3856         (Plugin_manager::claim_file): New parameter.
3857         (Plugin_manager::get_elf_object): New function.
3858         (Plugin_manager::in_claim_file_handler): New function.
3859         (Plugin_manager::in_claim_file_handler_): New member.
3860         (layout): New function.
3861         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
3862         handler with an extra parameter. Make the elf object before calling
3863         claim_file handler.
3864         * testsuite/plugin_test.c (get_section_count): New function pointer.
3865         (get_section_type): New function pointer.
3866         (get_section_name): New function pointer.
3867         (get_section_contents): New function pointer.
3868         (update_section_order): New function pointer.
3869         (allow_section_ordering): New function pointer.
3870         (onload): Check if the new interfaces exist.
3871
3872 2011-07-13  Ian Lance Taylor  <iant@google.com>
3873
3874         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
3875         relro section.
3876         * x86_64.cc (Target_x86_64::got_section): Likewise.
3877         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
3878         (relro_now_test_SOURCES): New variable.
3879         (relro_now_test_DEPENDENCIES): New variable.
3880         (relro_now_test_LDFLAGS): New variable.
3881         (relro_now_test_LDADD): New variable.
3882         (relro_now_test.so): New target.
3883         * testsuite/Makefile.in: Rebuild.
3884
3885 2011-07-12  Ian Lance Taylor  <iant@google.com>
3886
3887         PR gold/12980
3888         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
3889         GLOB_DAT relocation rather than a RELATIVE relocation for a
3890         protected symbol when creating a shared library.
3891         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
3892         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
3893         * testsuite/protected_main_1.cc (main): Test that protected
3894         function has same address.
3895
3896 2011-07-11  Ian Lance Taylor  <iant@google.com>
3897
3898         PR gold/12979
3899         * options.h (class General_options): Add -Bgroup.
3900         * options.cc (General_options::finalize): If -Bgroup is set,
3901         default to --unresolved-symbols=report-all.
3902         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
3903         * target-reloc.h (issue_undefined_symbol_error): Handle
3904         --unresolved-symbols=report-all.
3905
3906 2011-07-08  Ian Lance Taylor  <iant@google.com>
3907
3908         PR gold/11985
3909         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
3910         if linker script discards key sections.
3911         (Layout::create_dynamic_symtab): Likewise.
3912         (Layout::assign_local_dynsym_offsets): Likewise.
3913         (Layout::sized_create_version_sections): Likewise.
3914         (Layout::create_interp): Likewise.
3915         (Layout::finish_dynamic_section): Likewise.
3916         (Layout::set_dynamic_symbol_size): Likewise.
3917
3918 2011-07-08  Ian Lance Taylor  <iant@google.com>
3919
3920         PR gold/12386
3921         * options.h (class General_options): Add --unresolved-symbols.
3922         * target-reloc.h (issue_undefined_symbol_error): Check
3923         --unresolved-symbols.  Add comments.
3924
3925 2011-07-08  Ian Lance Taylor  <iant@google.com>
3926
3927         * testsuite/odr_violation2.cc (Ordering::operator()): Make
3928         expression more complex.
3929
3930 2011-07-08  Ian Lance Taylor  <iant@google.com>
3931
3932         PR gold/11317
3933         * target-reloc.h (issue_undefined_symbol_error): New inline
3934         function, broken out of relocate_section.
3935         (relocate_section): Call issue_undefined_symbol_error.
3936         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
3937         there is no TLS segment if we are about to issue an undefined
3938         symbol error.
3939         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
3940
3941 2011-07-08  Ian Lance Taylor  <iant@google.com>
3942
3943         PR gold/12279
3944         * resolve.cc (Symbol_table::should_override): Add fromtype
3945         parameter.  Change all callers.  Give error when linking together
3946         TLS and non-TLS symbol.
3947         (Symbol_table::should_override_with_special): Add fromtype
3948         parameter.  Change all callers.
3949         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
3950         there is no TLS segment if we have reported some errors.
3951         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
3952
3953 2011-07-08  Ian Lance Taylor  <iant@google.com>
3954
3955         PR gold/12372
3956         * target.h (Target::plt_address_for_global): New function.
3957         (Target::plt_address_for_local): New function.
3958         (Target::plt_section_for_global): Remove.
3959         (Target::plt_section_for_local): Remove.
3960         (Target::do_plt_address_for_global): New virtual function.
3961         (Target::do_plt_address_for_local): New virtual function.
3962         (Target::do_plt_section_for_global): Remove.
3963         (Target::do_plt_section_for_local): Remove.
3964         (Target::register_global_plt_entry): Add Symbol_table and Layout
3965         parameters.
3966         * output.cc (Output_data_got::Got_entry::write): Use
3967         plt_address_for_global and plt_address_for_local.
3968         * layout.cc (Layout::add_target_dynamic_tags): Use size and
3969         address of output section.
3970         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
3971         got_irelative_, and irelative_count_ fields.  Update
3972         declarations.
3973         (Output_data_plt_i386::has_irelative_section): New function.
3974         (Output_data_plt_i386::entry_count): Add irelative_count_.
3975         (Output_data_plt_i386::set_final_data_size): Likewise.
3976         (class Target_i386): Add got_irelative_ and rel_irelative_
3977         fields.  Update declarations.
3978         (Target_i386::Target_i386): Initialize new fields.
3979         (Target_i386::do_plt_address_for_global): New function replacing
3980         do_plt_section_for_global.
3981         (Target_i386::do_plt_address_for_local): New function replacing
3982         do_plt_section_for_local.
3983         (Target_i386::got_section): Create got_irelative_.
3984         (Target_i386::rel_irelative_section): New function.
3985         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
3986         fields.  Don't define __rel_iplt_{start,end}.
3987         (Output_data_plt_i386::add_entry): Add symtab and layout
3988         parameters.  Change all callers.  Use different PLT and GOT for
3989         IFUNC symbols.
3990         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
3991         layout parameters.  Change all callers.  Use different PLT and
3992         GOT.
3993         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
3994         (Output_data_plt_i386::rel_irelative): New function.
3995         (Output_data_plt_i386::address_for_global): New function.
3996         (Output_data_plt_i386::address_for_local): New function.
3997         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
3998         IRELATIVE GOT when changing IFUNC GOT entries.
3999         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
4000         reloc.
4001         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
4002         if we didn't create an IRELATIVE GOT.
4003         (Target_i386::Relocate::relocate): Use plt_address_for_global and
4004         plt_address_for_local.
4005         (Target_i386::do_dynsym_value): Use plt_address_for_global.
4006         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
4007         got_irelative_, and irelative_count_ fields.  Update
4008         declarations.
4009         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
4010         Initialize new fields.  Remove symtab parameter.  Change all
4011         callers.
4012         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
4013         irelative_count_.
4014         (Output_data_plt_x86_64::has_irelative_section): New function.
4015         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
4016         (class Target_x86_64): Add got_irelative_ and rel_irelative_
4017         fields.  Update declarations.
4018         (Target_x86_64::Target_x86_64): Initialize new fields.
4019         (Target_x86_64::do_plt_address_for_global): New function replacing
4020         do_plt_section_for_global.
4021         (Target_x86_64::do_plt_address_for_local): New function replacing
4022         do_plt_section_for_local.
4023         (Target_x86_64::got_section): Create got_irelative_.
4024         (Target_x86_64::rela_irelative_section): New function.
4025         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
4026         all callers.  Don't create __rel_iplt_{start,end}.
4027         (Output_data_plt_x86_64::add_entry): Add symtab and layout
4028         parameters.  Change all callers.  Use different PLT and GOT for
4029         IFUNC symbols.
4030         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
4031         layout parameters.  Change all callers.  Use different PLT and
4032         GOT.
4033         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
4034         parameters.  Change all callers.  Use different PLT and GOT for
4035         IFUNC symbols.
4036         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
4037         (Output_data_plt_x86_64::rela_irelative): New function.
4038         (Output_data_plt_x86_64::address_for_global): New function.
4039         (Output_data_plt_x86_64::address_for_local): New function.
4040         (Output_data_plt_x86_64::set_final_data_size): Likewise.
4041         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
4042         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
4043         (Target_x86_64::register_global_plt_entry): Add symtab and layout
4044         parameters.
4045         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
4046         reloc.
4047         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
4048         symbols if we didn't create an IRELATIVE GOT.
4049         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
4050         plt_address_for_local.
4051         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
4052         * testsuite/ifuncvar1.c: New test file.
4053         * testsuite/ifuncvar2.c: New test file.
4054         * testsuite/ifuncvar3.c: New test file.
4055         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
4056         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
4057         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
4058         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
4059         * testsuite/Makefile.in: Rebuild.
4060
4061 2011-07-07  Cary Coutant  <ccoutant@google.com>
4062
4063         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
4064         (two_file_test_1_ndebug.o): Likewise.
4065         (two_file_test_1b_ndebug.o): Likewise.
4066         (two_file_test_2_ndebug.o): Likewise.
4067         (two_file_test_main_ndebug.o): Likewise.
4068         (incremental_test_2): Link with no-debug versions.
4069
4070 2011-07-06  Cary Coutant  <ccoutant@google.com>
4071
4072         * gold/incremental.cc
4073         (Output_section_incremental_inputs::write_info_blocks): Check for
4074         hidden and internal symbols.
4075
4076 2011-07-06  Cary Coutant  <ccoutant@google.com>
4077
4078         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
4079         Check disposition for startup file.
4080         (Incremental_inputs::report_command_line): Ignore
4081         --incremental-startup-unchanged option.
4082         * options.cc (General_options::parse_incremental_startup_unchanged):
4083         New function.
4084         (General_options::General_options): Initialize new data member.
4085         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
4086         (General_options): Add --incremental-startup-unchanged option.
4087         (General_options::incremental_startup_disposition): New function.
4088         (General_options::incremental_startup_disposition_): New data member.
4089
4090 2011-07-06  Cary Coutant  <ccoutant@google.com>
4091
4092         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
4093         input file index to Script_info ctor.
4094         (Sized_incremental_binary::do_file_has_changed): Find the
4095         command-line argument for files named in scripts.
4096         * incremental.h (Script_info::Script_info): New ctor
4097         with input file index.
4098         (Script_info::input_file_index): New function.
4099         (Script_info::input_file_index_): New data member.
4100         (Incremental_binary::get_library): Add const.
4101         (Incremental_binary::get_script_info): Add const.
4102         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
4103         * testsuite/Makefile.am (incremental_test_5): New test case.
4104         (incremental_test_6): New test case.
4105         * testsuite/Makefile.in: Regenerate.
4106
4107 2011-07-06  Cary Coutant  <ccoutant@google.com>
4108
4109         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
4110         debug output when command lines differ.
4111
4112 2011-07-06  Cary Coutant  <ccoutant@google.com>
4113
4114         * incremental.cc (Incremental_inputs::report_command_line): Ignore
4115         --incremental-patch option.
4116         * layout.cc (Free_list::allocate): Extend allocation beyond original
4117         end if enabled.
4118         (Layout::make_output_section): Mark sections that should get
4119         patch space.
4120         * options.cc (parse_percent): New function.
4121         * options.h (parse_percent): New function.
4122         (DEFINE_percent): New macro.
4123         (General_options): Add --incremental-patch option.
4124         * output.cc (Output_section::Output_section): Initialize new data
4125         members.
4126         (Output_section::add_input_section): Print section name when out
4127         of patch space.
4128         (Output_section::add_output_section_data): Likewise.
4129         (Output_section::set_final_data_size): Add patch space when
4130         doing --incremental-full.
4131         (Output_section::do_reset_address_and_file_offset): Remove patch
4132         space.
4133         (Output_segment::set_section_list_addresses): Print debug output
4134         only if --incremental-update.
4135         * output.h (Output_section::set_is_patch_space_allowed): New function.
4136         (Output_section::is_patch_space_allowed_): New data member.
4137         (Output_section::patch_space_): New data member.
4138         * parameters.cc (Parameters::incremental_full): New function.
4139         * parameters.h (Parameters::incremental_full): New function
4140         * testsuite/Makefile.am (incremental_test_2): Add test for
4141         --incremental-patch option.
4142         * testsuite/Makefile.in: Regenerate.
4143         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
4144         (t18): Remove function body.
4145
4146 2011-07-05  Doug Kwan  <dougkwan@google.com>
4147
4148         PR gold/12771
4149         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
4150         Arm_Address type for relocation result.
4151         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
4152         overflow check.
4153         (Arm_relocate_functions::abs32): Use unaligned access.
4154         (Arm_relocate_functions::rel32): Ditto.
4155         (Arm_relocate_functions::prel31): Ditto.
4156         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
4157         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
4158         static data relocations.
4159         * testsuite/Makefile.in: Regnerate.
4160         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
4161
4162 2011-07-05  Ian Lance Taylor  <iant@google.com>
4163
4164         PR gold/12392
4165         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
4166         symbols if necessary.
4167         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
4168
4169 2011-07-05  Ian Lance Taylor  <iant@google.com>
4170
4171         PR gold/12952
4172         * resolve.cc (Symbol::override_base_with_special): Simply override
4173         version with special symbol version, ignoring previous version.
4174
4175 2011-07-05  Ian Lance Taylor  <iant@google.com>
4176
4177         * object.cc (Sized_relobj_file::include_section_group): Add
4178         information to comment about signature location.
4179
4180 2011-07-02  Ian Lance Taylor  <iant@google.com>
4181
4182         PR gold/12957
4183         * options.h (class General_options): Add -f and -F.
4184         * options.cc (General_options::finalize): Fatal error if -f/-F
4185         are used without -shared.
4186         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
4187
4188 2011-07-02  Ian Lance Taylor  <iant@google.com>
4189
4190         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
4191
4192 2011-07-01  Ian Lance Taylor  <iant@google.com>
4193
4194         PR gold/12525
4195         PR gold/12952
4196         * resolve.cc (Symbol::override_base_with_special): Don't override
4197         the version if the overriding symbol has a different name.
4198         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
4199         all callers.  If we give an error about an undefined version,
4200         define the base version if necessary.
4201         * dynobj.h (class Versions): Update declaration.
4202         * testsuite/weak_alias_test_5.cc: New file.
4203         * testsuite/weak_alias_test.script: New file.
4204         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
4205         and versioned_alias have the right value, and call t2.
4206         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
4207         weak_alias_test_5.so.
4208         (weak_alias_test_LDADD): Likewise.
4209         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
4210         * testsuite/Makefile.in: Rebuild.
4211
4212 2011-07-01  Ian Lance Taylor  <iant@google.com>
4213
4214         PR gold/12525
4215         * options.h (class General_options): Support -z notext.
4216         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
4217         -Wl,-z,notext.
4218         (two_file_shared_nonpic.so): Likewise.
4219         (two_file_shared_mixed.so): Likewise.
4220         (two_file_shared_mixed_1.so): Likewise.
4221         (weak_undef_lib_nonpic.so): Likewise.
4222         (alt/weak_undef_lib_nonpic.so): Likewise.
4223         (tls_test_shared_nonpic.so): Likewise.
4224         * testsuite/Makefile.in: Rebuild.
4225
4226 2011-07-01  Ian Lance Taylor  <iant@google.com>
4227
4228         PR gold/12525
4229         * configure.ac: Test whether static linking works, setting
4230         the automake conditional HAVE_STATIC.
4231         * testsuite/Makefile.am: Disable tests using -static if
4232         HAVE_STATIC is not true.
4233         * configure, testsuite/Makefile.in: Rebuild.
4234
4235 2011-07-01  Ian Lance Taylor  <iant@google.com>
4236
4237         PR gold/12525
4238         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
4239         Assert if we see DW_EH_PE_indirect.
4240         * target.h (Target::ehframe_datarel_base): New function.
4241         (Target::do_ehframe_datarel_base): New target function.
4242         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
4243         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
4244         function.
4245
4246 2011-07-01  Ian Lance Taylor  <iant@google.com>
4247
4248         PR gold/12571
4249         * options.h (class General_options): Add
4250         --ld-generated-unwind-info.
4251         * ehframe.cc (Fde::write): Add address parameter.  Change all
4252         callers.  If associated with PLT, fill in address and size.
4253         (Cie::set_output_offset): Only add merge mapping if there is an
4254         object.
4255         (Cie::write): Add address parameter.  Change all callers.
4256         (Eh_frame::add_ehframe_for_plt): New function.
4257         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
4258         input_offset_ fields into union u_, with new plt field.
4259         (Fde::Fde): Adjust for new union field.
4260         (Fde::Fde) [Output_data version]: New constructor.
4261         (Fde::add_mapping): Only add merge mapping if there is an object.
4262         (class Cie): Update declarations.
4263         (class Eh_frame): Declare add_ehframe_for_plt.
4264         * layout.cc (Layout::layout_eh_frame): Break out code into
4265         make_eh_frame_section, and call it.
4266         (Layout::make_eh_frame_section): New function.
4267         (Layout::add_eh_frame_for_plt): New function.
4268         * layout.h (class Layout): Update declarations.
4269         * merge.cc (Merge_map::add_mapping): Add assertion.
4270         * i386.cc: Include "dwarf.h".
4271         (class Output_data_plt_i386): Make first_plt_entry,
4272         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
4273         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
4274         and plt_eh_frame_fde.
4275         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
4276         boundary.  Call add_eh_frame_for_plt if appropriate.
4277         * x86_64.cc: Include "dwarf.h".
4278         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
4279         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
4280         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
4281         and plt_eh_frame_fde.
4282         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
4283         appropriate.
4284
4285 2011-06-29  Ian Lance Taylor  <iant@google.com>
4286
4287         PR gold/12629
4288         * object.cc (Sized_relobj_file::layout_section): Change shdr
4289         parameter to be const.
4290         (Sized_relobj_file::layout_eh_frame_section): New function, broken
4291         out of do_layout.
4292         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
4293         appropriate.  Call layout_eh_frame_section.
4294         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
4295         sections.
4296         * object.h (class Sized_relobj_file): Update declarations.
4297
4298 2011-06-29  Ian Lance Taylor  <iant@google.com>
4299
4300         PR gold/12652
4301         * script.cc (Token::integer_value): Accept trailing M/m/K/k
4302         modifier.
4303         (Lex::gather_token): Accept trailing M/m/K/k for integers.
4304
4305 2011-06-29  Ian Lance Taylor  <iant@google.com>
4306
4307         PR gold/12675
4308         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
4309         SHT_X86_64_UNWIND.
4310         * layout.cc (Layout::layout_eh_frame): Likewise.
4311
4312 2011-06-29  Ian Lance Taylor  <iant@google.com>
4313
4314         PR gold/12695
4315         * layout.cc (Layout::symtab_section_shndx): New function.
4316         * layout.h (class Layout): Declare symtab_section_shndx.
4317         * output.cc (Output_section::write_header): Call it.
4318
4319 2011-06-29  Ian Lance Taylor  <iant@google.com>
4320
4321         PR gold/12818
4322         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
4323         symbols which are not used in a relocation.
4324
4325 2011-06-28  Ian Lance Taylor  <iant@google.com>
4326
4327         PR gold/12898
4328         * layout.cc (Layout::segment_precedes): Don't crash if a linker
4329         script create indistinguishable segments.
4330         (Layout::set_segment_offsets): Use stable_sort when sorting
4331         segments.  Pass this to Compare_segments constructor.
4332         * layout.h (class Layout): Make segment_precedes non-static.
4333         (class Compare_segments): Change from struct to class.  Add
4334         layout_ field.  Add constructor.
4335         * script-sections.cc
4336         (Script_sections::attach_sections_using_phdrs_clause): Rename
4337         local orphan to is_orphan.  Don't report failure to put empty
4338         section in segment.  On attachment failure, report name of
4339         section, and attach to first PT_LOAD segment.
4340
4341 2011-06-28  Ian Lance Taylor  <iant@google.com>
4342
4343         PR gold/12934
4344         * target-select.cc (Target_selector::Target_selector): Add
4345         emulation parameter.  Change all callers.
4346         (select_target_by_bfd_name): Rename from select_target_by_name.
4347         Change all callers.
4348         (select_target_by_emulation): New function.
4349         (supported_emulation_names): New function.
4350         * target-select.h (class Target_selector): Add emulation_ field.
4351         Update declarations.
4352         (Target_selector::recognize_by_bfd_name): Rename from
4353         recognize_by_name.  Change all callers.
4354         (Target_selector::supported_bfd_names): Rename from
4355         supported_names.  Change all callers.
4356         (Target_selector::recognize_by_emulation): New function.
4357         (Target_selector::supported_emulations): New function.
4358         (Target_selector::emulation): New function.
4359         (Target_selector::do_recognize_by_bfd_name): Rename from
4360         do_recognize_by_name.  Change all callers.
4361         (Target_selector::do_supported_bfd_names): Rename from
4362         do_supported_names.  Change all callers.
4363         (Target_selector::do_recognize_by_emulation): New function.
4364         (Target_selector::do_supported_emulations): New function.
4365         (select_target_by_bfd_name): Change name in declaration.
4366         (select_target_by_emulation): Declare.
4367         (supported_emulation_names): Declare.
4368         * parameters.cc (parameters_force_valid_target): Try to find
4369         target based on emulation from -m option.
4370         * options.h (class General_options): Change doc string for -m.
4371         * options.cc (help): Print emulations.
4372         (General_options::parse_V): Likewise.
4373         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
4374         Add emulation parameter.  Change all callers.
4375
4376 2011-06-28  Ian Lance Taylor  <iant@google.com>
4377
4378         * target.h (class Target): Add osabi_ field.
4379         (Target::osabi): New function.
4380         (Target::set_osabi): New function.
4381         (Target::Target): Initialize osabi_.
4382         (Target::do_adjust_elf_header): Make pure virtual.
4383         (Sized_target::do_adjust_elf_header): Declare.
4384         * target.cc (Sized_target::do_adjust_elf_header): New function.
4385         (class Sized_target): Instantiate all versions.
4386         * freebsd.h (class Target_freebsd): Remove.
4387         (Target_selector_freebsd::do_recognize): Call set_osabi on
4388         Target.
4389         (Target_selector_freebsd::do_recognize_by_name): Likewise.
4390         (Target_selector_freebsd::set_osabi): Remove.
4391         * i386.cc (class Target_i386): Inherit from Sized_target rather
4392         than Target_freebsd.
4393         * x86_64.cc (class Target_x86_64): Likewise.
4394
4395 2011-06-28  Ian Lance Taylor  <iant@google.com>
4396
4397         * target.h (Target::can_check_for_function_pointers): Rewrite.
4398         Make non-virtual.
4399         (Target::can_icf_inline_merge_sections): Likewise.
4400         (Target::section_may_have_icf_unsafe_poineters): Likewise.
4401         (Target::Target_info): Add can_icf_inline_merge_sections field.
4402         (Target::do_can_check_for_function_pointers): New virtual
4403         function.
4404         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
4405         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
4406         from can_check_for_function_pointers, move in file.
4407         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
4408         section_may_have_icf_unsafe_poineters, move in file.
4409         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
4410         * i386.cc (Target_i386::do_can_check_for_function_pointers):
4411         Rename from can_check_for_function_pointers, move in file.
4412         (Target_i386::can_icf_inline_merge_sections): Remove.
4413         (Target_i386::i386_info): Initialize
4414         can_icf_inline_merge_sections.
4415         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
4416         Initialize can_icf_inline_merge_sections.
4417         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
4418         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
4419         Rename from can_check_for_function_pointers, move in file.
4420         (Target_x86_64::can_icf_inline_merge_sections): Remove.
4421         (Target_x86_64::x86_64_info): Initialize
4422         can_icf_inline_merge_sections.
4423         * testsuite/testfile.cc (Target_test::test_target_info):
4424         Likewise.
4425         * icf.cc (get_section_contents): Correct formatting.
4426
4427 2011-06-27  Ian Lance Taylor  <iant@google.com>
4428
4429         * symtab.cc (Symbol::versioned_name): New function.
4430         (Symbol_table::add_to_final_symtab): Use versioned_name when
4431         appropriate.
4432         (Symbol_table::sized_write_symbol): Likewise.
4433         * symtab.h (class Symbol): Declare versioned_name.
4434         * stringpool.h (class Stringpool_template): Add variant of add
4435         which takes a std::basic_string.
4436         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
4437         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
4438         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
4439         (ver_test_12.o): New target.
4440         * testsuite/Makefile.in: Rebuild.
4441
4442 2011-06-27  Doug Kwan  <dougkwan@google.com>
4443
4444         * arm.cc (Arm_relocate_functions::thm_jump8,
4445         Arm_relocate_functions::thm_jump11): Use a wider signed
4446         type to compute offset.
4447         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
4448         arm_thm_jump8.
4449         * testsuite/Makefile.in: Regenerate.
4450         * testsuite/arm_branch_in_range.sh: Check test results of
4451         arm_thm_jump11 and arm_thm_jump8.
4452         * testsuite/arm_thm_jump11.s: New test source file.
4453         * testsuite/arm_thm_jump11.t: New linker script.
4454         * testsuite/arm_thm_jump8.s: New test source file.
4455         * testsuite/arm_thm_jump8.t: New linker script.
4456
4457 2011-06-24  Ian Lance Taylor  <iant@google.com>
4458
4459         * layout.cc: Include "object.h".
4460         (ctors_sections_in_init_array): New static variable.
4461         (Layout::is_ctors_in_init_array): New function.
4462         (Layout::layout): Add entry to ctors_sections_in_init_array if
4463         appropriate.
4464         * layout.h (class Layout): Declare is_ctors_in_init_array.
4465         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
4466         is_ctors_reverse_view is set.
4467         (Sized_relobj_file::write_sections): Add layout parameter.  Change
4468         all callers.  Set is_ctors_reverse_view field of View_size.
4469         (Sized_relobj_file::reverse_words): New function.
4470         * object.h (Sized_relobj_file::View_size): Add
4471         is_ctors_reverse_view field.
4472         (class Sized_relobj_file): Update declarations.
4473         * testsuite/initpri3.c: New test.
4474         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
4475         initpri3b.
4476         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
4477         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
4478         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
4479         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
4480         * testsuite/Makefile.in: Rebuild.
4481
4482 2011-06-24  Cary Coutant  <ccoutant@google.com>
4483
4484         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
4485         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
4486         (debug_msg_cdebug.err): New targets.
4487         * testsuite/Makefile.in: Regenerate.
4488         * testsuite/debug_msg.sh: Check output of link with compressed debug.
4489         Fix checks for link with shared library.
4490
4491 2011-06-24  Doug Kwan  <dougkwan@google.com>
4492
4493         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
4494         skip empty text sections.
4495         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
4496
4497 2011-06-22  Ian Lance Taylor  <iant@google.com>
4498
4499         PR gold/12910
4500         * options.h (class General_options): Add --ctors-in-init-array.
4501         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
4502         friends as SHT_PROGBITS for merging sections.
4503         (Layout::layout): Remove special handling of .init_array and
4504         friends.  Don't sort if doing relocatable link.  Sort for .ctors
4505         and .dtors if ctors_in_init_array.
4506         (Layout::make_output_section): Force correct section types for
4507         .init_array and friends.  Don't sort if doing relocatable link,
4508         Don't sort .ctors and .dtors if ctors_in_init_array.
4509         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
4510         (Layout::output_section_name): Add relobj parameter.  Change all
4511         callers.  Handle .ctors. and .dtors. in code rather than table.
4512         Handle .ctors and .dtors if ctors_in_init_array.
4513         (Layout::match_file_name): New function, moved from output.cc.
4514         * layout.h (class Layout): Update declarations.
4515         * output.cc: Include "layout.h".
4516         (Input_section_sort_entry::get_priority): New function.
4517         (Input_section_sort_entry::match_file_name): Just call
4518         Layout::match_file_name.
4519         (Output_section::Input_section_sort_init_fini_compare::operator()):
4520         Handle .ctors and .dtors.  Sort by explicit priority rather than
4521         by name.
4522         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
4523         * testsuite/initpri2.c: New test.
4524         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
4525         (check_PROGRAMS): Add initpri2.
4526         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
4527         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
4528         * configure, testsuite/Makefile.in: Rebuild.
4529
4530 2011-06-19  Ian Lance Taylor  <iant@google.com>
4531
4532         PR gold/12880
4533         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
4534         .interp section to a PT_INTERP segment even if we have seen a
4535         --dynamic-linker option.  Don't do it if we have seen a PHDRS
4536         clause in a linker script.
4537         (Layout::finalize): Don't create a .interp section if we've
4538         already create a PT_INTERP segment.
4539         (Layout::create_interp): Always call choose_output_section (revert
4540         patch of 2011-06-17).  Don't create PT_INTERP segment.
4541         * script-sections.cc
4542         (Script_sections::create_note_and_tls_segments): Add a .interp
4543         section to a PT_INTERP segment even if we have seen a
4544         --dynamic-linker option.
4545
4546 2011-06-18  Ian Lance Taylor  <iant@google.com>
4547
4548         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
4549         merely because a non-PT_LOAD segment has a dynamic reloc.
4550
4551 2011-06-18  Ian Lance Taylor  <iant@google.com>
4552
4553         * layout.cc (Layout::finish_dynamic_section): Don't create
4554         DT_FLAGS entry if not needed.
4555
4556 2011-06-18  Ian Lance Taylor  <iant@google.com>
4557
4558         PR gold/12745
4559         * layout.cc (Layout::layout_eh_frame): Correct handling of
4560         writable .eh_frame section.
4561
4562 2011-06-17  Ian Lance Taylor  <iant@google.com>
4563
4564         PR gold/12893
4565         * resolve.cc (Symbol_table::resolve): Don't give an error if a
4566         symbol is redefined with the exact same object and value.
4567
4568 2011-06-17  Ian Lance Taylor  <iant@google.com>
4569
4570         PR gold/12880
4571         * layout.h (class Layout): Add interp_segment_ field.
4572         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
4573         (Layout::attach_allocated_section_to_segment): If making shared
4574         library, put .interp section in PT_INTERP segment.
4575         (Layout::finalize): Also call create_interp if -dynamic-linker
4576         option was used.
4577         (Layout::create_interp): Assert that there is no PT_INTERP
4578         segment.  If not using a SECTIONS clause, use make_output_section.
4579         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
4580         * script-sections.cc
4581         (Script_sections::create_note_and_tls_segments): If making shared
4582         library, put .interp section in PT_INTERP segment.
4583
4584 2011-06-17  Ian Lance Taylor  <iant@google.com>
4585
4586         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
4587         when making a shared library.
4588
4589 2011-06-17  Ian Lance Taylor  <iant@google.com>
4590
4591         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
4592         parameter.  Change all callers.  Don't issue warning about PC32
4593         against locally defined symbol.
4594
4595 2011-06-16  Ian Lance Taylor  <iant@google.com>
4596
4597         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
4598         occurs in same object.
4599
4600 2011-06-14  Alan Modra  <amodra@gmail.com>
4601
4602         * po/POTFILES.in: Regenerate.
4603
4604 2011-06-09  Ian Lance Taylor  <iant@google.com>
4605
4606         * script-sections.cc
4607         (Orphan_output_section::set_section_addresses): For a relocatable
4608         link set address to 0.
4609
4610 2011-06-09  Cary Coutant  <ccoutant@google.com>
4611
4612         PR gold/12804
4613         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
4614         used with --compress-debug-sections.
4615         * gold/object.cc (Sized_relobj_file::do_layout): Report
4616         uncompressed size of compressed input sections.
4617
4618 2011-06-08  Cary Coutant  <ccoutant@google.com>
4619
4620         PR gold/12804
4621         * testsuite/two_file_test_2_v1.cc: Change initialization of
4622         v2 to keep it in .data.
4623
4624 2011-06-07  Cary Coutant  <ccoutant@google.com>
4625
4626         * common.cc (Symbol_table::do_allocate_commons_list): Call
4627         gold_fallback.
4628         * errors.cc (Errors::fatal): Adjust call to gold_exit.
4629         (Errors::fallback): New function.
4630         (gold_fallback): New function.
4631         * errors.h (Errors::fallback): New function.
4632         * gold.cc (gold_exit): Change status parameter to enum; adjust
4633         all callers.
4634         (queue_initial_tasks): Call gold_fallback.
4635         * gold.h: Include cstdlib.
4636         (Exit_status): New enum type.
4637         (gold_exit): Change status parameter to enum.
4638         (gold_fallback): New function.
4639         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
4640         (Layout::create_symtab_sections): Likewise.
4641         (Layout::create_shdrs): Likewise.
4642         * main.cc (main): Adjust call to gold_exit.
4643         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
4644         (Output_data_got::add_got_entry_pair): Likewise.
4645         (Output_section::add_input_section): Likewise.
4646         (Output_section::add_output_section_data): Likewise.
4647         (Output_segment::set_section_list_addresses): Likewise.
4648         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
4649
4650 2011-06-07  Cary Coutant  <ccoutant@google.com>
4651
4652         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
4653         for incremental links.
4654         * output.cc (Output_segment::set_section_list_addresses): Remove
4655         FIXME and test for TLS or BSS.
4656
4657 2011-06-07  Cary Coutant  <ccoutant@google.com>
4658
4659         * testsuite/Makefile.am: Add incremental_copy_test,
4660         incremental_common_test_1.
4661         * testsuite/Makefile.in: Regenerate.
4662         * testsuite/common_test_1_v1.c: New source file.
4663         * testsuite/common_test_1_v2.c: New source file.
4664         * testsuite/copy_test_v1.cc: New source file.
4665
4666 2011-06-07  Cary Coutant  <ccoutant@google.com>
4667
4668         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
4669         update, allocate common from bss section's free list.
4670         * incremental-dump.cc (dump_incremental_inputs): Print flag for
4671         linker-defined symbols.
4672         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
4673         Skip GOT and PLT entries that are no longer referenced.
4674         (Output_section_incremental_inputs::write_info_blocks): Mark
4675         linker-defined symbols.
4676         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
4677         * output.cc (Output_section::allocate): New function.
4678         * output.h (Output_section::allocate): New function.
4679         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
4680         linker-defined symbols.
4681         (Symbol::override_base_with_special): Copy is_predefined_ flag.
4682         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
4683         (Symbol::init_base_output_data): Likewise.
4684         (Symbol::init_base_output_segment): Likewise.
4685         (Symbol::init_base_constant): Likewise.
4686         (Sized_symbol::init_output_data): Likewise.
4687         (Sized_symbol::init_output_segment): Likewise.
4688         (Sized_symbol::init_constant): Likewise.
4689         (Symbol_table::do_define_in_output_data): Likewise.
4690         (Symbol_table::do_define_in_output_segment): Likewise.
4691         (Symbol_table::do_define_as_constant): Likewise.
4692         * symtab.h (Symbol::is_predefined): New function.
4693         (Symbol::init_base_output_data): Add is_predefined parameter.
4694         (Symbol::init_base_output_segment): Likewise.
4695         (Symbol::init_base_constant): Likewise.
4696         (Symbol::is_predefined_): New data member.
4697         (Sized_symbol::init_output_data): Add is_predefined parameter.
4698         (Sized_symbol::init_output_segment): Likewise.
4699         (Sized_symbol::init_constant): Likewise.
4700         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
4701
4702 2011-06-07  Cary Coutant  <ccoutant@google.com>
4703
4704         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
4705         instead of emit_copy_reloc.
4706         (Copy_relocs::emit_copy_reloc): Refactor.
4707         (Copy_relocs::make_copy_reloc): New function.
4708         (Copy_relocs::add_copy_reloc): Remove.
4709         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
4710         section.
4711         (Copy_relocs::make_copy_reloc): New function.
4712         (Copy_relocs::add_copy_reloc): Remove.
4713         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
4714         unchanged input files.
4715         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
4716         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
4717         Reserve BSS space for COPY relocations.
4718         (Sized_incremental_binary::do_emit_copy_relocs): New function.
4719         (Output_section_incremental_inputs::write_info_blocks): Record
4720         whether a symbol is copied from a shared object.
4721         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
4722         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
4723         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
4724         (Incremental_input_entry_reader::get_output_symbol_index): Add
4725         is_copy parameter.
4726         (Incremental_binary::emit_copy_relocs): New function.
4727         (Incremental_binary::do_emit_copy_relocs): New function.
4728         (Sized_incremental_binary::Sized_incremental_binary): Initialize
4729         new data member.
4730         (Sized_incremental_binary::add_copy_reloc): New function.
4731         (Sized_incremental_binary::do_emit_copy_relocs): New function.
4732         (Sized_incremental_binary::Copy_reloc): New struct.
4733         (Sized_incremental_binary::Copy_relocs): New typedef.
4734         (Sized_incremental_binary::copy_relocs_): New data member.
4735         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
4736         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
4737         * target.h (Sized_target::emit_copy_reloc): New function.
4738         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
4739
4740 2011-06-02  Cary Coutant  <ccoutant@google.com>
4741
4742         PR gold/12163
4743         * gold/archive.cc (Archive::Archive): Initialize new data member.
4744         (Archive::include_all_members): Return if archive has already been
4745         included.
4746         * gold/archive.h (Archive::include_all_members_): New data member.
4747
4748 2011-06-02  Nick Clifton  <nickc@redhat.com>
4749
4750         * dynobj.h: Fix spelling mistake in comment.
4751         * output.cc: Likewise.
4752
4753 2011-05-31  Doug Kwan  <dougkwan@google.com>
4754             Asier Llano
4755
4756         PR gold/12826
4757         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
4758         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
4759         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
4760         redundant arm_exidx_test.so.
4761         * testsuite/Makefile.in: Regenerate.
4762         (check_SCRIPTS): Add pr12826.sh
4763         (check_DATA): Add pr12826.stdout
4764         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
4765         * testsuite/pr12826.sh: New file.
4766         * testsuite/pr12826_1.s: Ditto.
4767         * testsuite/pr12826_1.s: Ditto.
4768
4769 2011-05-30  Ian Lance Taylor  <iant@google.com>
4770
4771         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
4772         sections.
4773
4774 2011-05-29  Ian Lance Taylor  <iant@google.com>
4775
4776         PR gold/12804
4777         * testsuite/Makefile.am: Use different file name for two_file_test
4778         temporary file for each incremental test.
4779         * testsuite/Makefile.in: Rebuild.
4780
4781 2011-05-29  Ian Lance Taylor  <iant@google.com>
4782
4783         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
4784         binary input file is empty.
4785
4786 2011-05-27  Ian Lance Taylor  <iant@google.com>
4787
4788         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
4789         (ver_test_9.so): Likewise.
4790         * testsuite/Makefile.in: Rebuild.
4791
4792 2011-05-26 Cary Coutant  <ccoutant@google.com>
4793
4794         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
4795         * incremental.cc (Incremental_inputs::report_input_section): Fix
4796         comment, indentation.
4797         (Incremental_inputs::report_comdat_group): New function.
4798         (Output_section_incremental_inputs::set_final_data_size): Adjust size
4799         of data for incremental input file entry.
4800         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
4801         group count, COMDAT group signatures.
4802         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
4803         an unchanged input file.
4804         * incremental.h (Incremental_object_entry::Incremental_object_entry):
4805         Initialize new data member.
4806         (Incremental_object_entry::add_comdat_group): New function.
4807         (Incremental_object_entry::get_comdat_group_count): New function.
4808         (Incremental_object_entry::get_comdat_signature_key): New function.
4809         (Incremental_object_entry::groups_): New data member.
4810         (Incremental_inputs::report_comdat_group): New function.
4811         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
4812         data for incremental input file entry.
4813         (Incremental_input_entry_reader::get_comdat_group_count): New function.
4814         (Incremental_input_entry_reader::get_input_section): Adjust size of
4815         data for incremental input file entry.
4816         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
4817         (Incremental_input_entry_reader::get_comdat_group_signature): New
4818         function.
4819         * object.cc (Sized_relobj::include_section_group): Report kept
4820         COMDAT groups for incremental links.
4821
4822 2011-05-24  David Meyer  <pdox@google.com>
4823
4824         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
4825         with name parameter.  Add found_name parameter.
4826         * fileread.cc (Input_file::find_file): Adjust code accordingly.
4827         * dirsearch.h (class Dirsearch): Update declaration.
4828
4829 2011-05-24  Ian Lance Taylor  <iant@google.com>
4830
4831         * archive.cc (Library_base::should_include_member): Pull in object
4832         from archive if it defines the entry symbol.
4833         * parameters.cc (Parameters::entry): New function.
4834         * parameters.h (class Parameters): Declare entry.
4835         * output.h (class Output_file_header): Remove entry_ field.
4836         * output.cc (Output_file_header::Output_file_header): Remove entry
4837         parameter.  Change all callers.
4838         (Output_file_header::entry): Use parameters->entry.
4839         * gold.cc (queue_middle_tasks): Likewise.
4840         * plugin.cc (Plugin_hook::run): Likewise.
4841
4842 2011-05-24 Cary Coutant  <ccoutant@google.com>
4843
4844         * gold.cc (queue_initial_tasks): Pass incremental base filename
4845         to Output_file::open_base_file; don't print error message.
4846         * incremental-dump.cc (main): Adjust call to
4847         Output_file::open_for_modification.
4848         * incremental-dump.cc (main): Likewise.
4849         * incremental.cc (Incremental_inputs::report_command_line):
4850         Ignore --incremental-base option when comparing command lines.
4851         Ignore parameter when given as separate argument.
4852         * options.h (class General_options): Add --incremental-base.
4853         * output.cc (Output_file::Output_file):
4854         (Output_file::open_base_file): Add base_name and writable parameters;
4855         read base file into new file; print error message here.
4856         (Output_file::map_no_anonymous): Add writable parameter; adjust all
4857         callers.
4858         * output.h (Output_file::open_for_modification): Rename to...
4859         (Output_file::open_base_file): ...this; add base_name and
4860         writable parameters; adjust all callers.
4861         (Output_file::map_no_anonymous): Add writable parameter; adjust all
4862         callers.
4863         * testsuite/Makefile.am (incremental_test_4): Test
4864         --incremental-base.
4865         * testsuite/Makefile.in: Regenerate.
4866
4867 2011-05-24 Cary Coutant  <ccoutant@google.com>
4868
4869         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
4870         incremental_test_4.
4871         * testsuite/Makefile.in: Regenerate.
4872         * testsuite/two_file_test_1_v1.cc: New test source file.
4873         * testsuite/two_file_test_1b_v1.cc: New test source file.
4874         * testsuite/two_file_test_2_v1.cc: New test source file.
4875
4876 2011-05-24 Cary Coutant  <ccoutant@google.com>
4877
4878         * dynobj.h (Dynobj::do_dynobj): New function.
4879         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
4880         flag and soname for shared objects.
4881         * incremental.cc (Incremental_inputs::report_object): Make
4882         either Incremental_object_entry or Incremental_dynobj_entry; add
4883         soname to string table.
4884         (Incremental_inputs::report_input_section): Add assertion.
4885         (Output_section_incremental_inputs::set_final_data_size): Adjust
4886         type of input file entry for shared libraries; adjust size of
4887         shared library info entry.
4888         (Output_section_incremental_inputs::write_input_files): Write
4889         as_needed flag for shared libraries.
4890         (Output_section_incremental_inputs::write_info_blocks): Adjust type
4891         of input file entry for shared libraries; write soname.
4892         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
4893         soname from incremental info.
4894         * incremental.h (enum Incremental_input_flags): Add
4895         INCREMENTAL_INPUT_AS_NEEDED.
4896         (Incremental_input_entry::Incremental_input_entry): Initialize new
4897         data member.
4898         (Incremental_input_entry::set_as_needed): New function.
4899         (Incremental_input_entry::as_needed): New function.
4900         (Incremental_input_entry::do_dynobj_entry): New function.
4901         (Incremental_input_entry::as_needed_): New data member.
4902         (Incremental_object_entry::Incremental_object_entry): Don't check
4903         for shared library.
4904         (Incremental_object_entry::do_type): Likewise.
4905         (class Incremental_dynobj_entry): New class.
4906         (Incremental_input_entry_reader::as_needed): New function.
4907         (Incremental_input_entry_reader::get_soname): New function.
4908         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
4909         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
4910         size of shared library info entry.
4911         * layout.cc (Layout::finish_dynamic_section): Don't test for
4912         incremental link when adding DT_NEEDED entries.
4913         * object.h (Object::Object): Initialize new data member.
4914         (Object::dynobj): New function.
4915         (Object::set_as_needed): New function.
4916         (Object::as_needed): New function.
4917         (Object::do_dynobj): New function.
4918         (Object::as_needed_): New data member.
4919
4920 2011-05-24 Cary Coutant  <ccoutant@google.com>
4921
4922         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
4923         info; adjust display of GOT entries.
4924         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
4925         vector of input objects; remove file_status_.
4926         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
4927         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
4928         got_plt reader; call target hooks to reserve GOT entries.
4929         (Output_section_incremental_inputs::set_final_data_size): Adjust size
4930         of input file info header and GOT info entry.
4931         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
4932         relocation info.
4933         (Got_plt_view_info::got_descriptor): Remove.
4934         (Got_plt_view_info::sym_index): New data member.
4935         (Got_plt_view_info::input_index): New data member.
4936         (Local_got_offset_visitor::visit): Write input file index.
4937         (Global_got_offset_visitor::visit): Write 0 for input file index.
4938         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
4939         with sym_index and input_index.
4940         (Output_section_incremental_inputs::write_got_plt): Adjust size of
4941         incremental info GOT entry; replace got_descriptor with input_index.
4942         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
4943         map from input file index to object.
4944         (Sized_relobj_incr::do_layout): Replace direct data member reference
4945         with accessor function.
4946         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
4947         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
4948         Adjust size of input file info header.
4949         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
4950         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
4951         (Incremental_input_entry_reader::get_input_section): Adjust size of
4952         input file info header.
4953         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
4954         of incremental info GOT entry.
4955         (Incremental_got_plt_reader::get_got_desc): Remove.
4956         (Incremental_got_plt_reader::get_got_symndx): New function.
4957         (Incremental_got_plt_reader::get_got_input_index): New function.
4958         (Sized_incremental_binary::Sized_incremental_binary): Remove
4959         file_status_; add input_objects_.
4960         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
4961         (Sized_incremental_binary::set_file_is_unchanged): Remove.
4962         (Sized_incremental_binary::file_is_unchanged): Remove.
4963         (Sized_incremental_binary::set_input_object): New function.
4964         (Sized_incremental_binary::input_object): New function.
4965         (Sized_incremental_binary::file_status_): Remove.
4966         (Sized_incremental_binary::input_objects_): New data member.
4967         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
4968         references.
4969         (Sized_relobj_incr::invalid_address): Move to base class.
4970         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
4971         class.
4972         (Sized_relobj_incr::do_output_section_offset): Likewise.
4973         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
4974         (Sized_relobj_incr::section_offsets_): Likewise.
4975         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
4976         function.
4977         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
4978         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
4979         with accessor function.
4980         (Sized_relobj_file::do_layout): Likewise.
4981         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
4982         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
4983         (Sized_relobj_file::compute_final_local_value): Replace refs to
4984         section_offsets_ with accessor function.
4985         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
4986         * object.h (Relobj::Relobj): Initialize new data members.
4987         (Relobj::add_dyn_reloc): New function.
4988         (Relobj::first_dyn_reloc): New function.
4989         (Relobj::dyn_reloc_count): New function.
4990         (Relobj::first_dyn_reloc_): New data member.
4991         (Relobj::dyn_reloc_count_): New data member.
4992         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
4993         references.
4994         (Sized_relobj::Address): New typedef.
4995         (Sized_relobj::invalid_address): Move here from child class.
4996         (Sized_relobj::Sized_relobj): Initialize new data members.
4997         (Sized_relobj::sized_relobj): New function.
4998         (Sized_relobj::is_output_section_offset_invalid): Move here from
4999         child class.
5000         (Sized_relobj::get_output_section_offset): Likewise.
5001         (Sized_relobj::local_has_got_offset): Likewise.
5002         (Sized_relobj::local_got_offset): Likewise.
5003         (Sized_relobj::set_local_got_offset): Likewise.
5004         (Sized_relobj::do_for_all_local_got_entries): Likewise.
5005         (Sized_relobj::clear_got_offsets): New function.
5006         (Sized_relobj::section_offsets): Move here from child class.
5007         (Sized_relobj::do_output_section_offset): Likewise.
5008         (Sized_relobj::do_set_section_offset): Likewise.
5009         (Sized_relobj::Local_got_offsets): Likewise.
5010         (Sized_relobj::local_got_offsets_): Likewise.
5011         (Sized_relobj::section_offsets_): Likewise.
5012         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
5013         references.
5014         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
5015         class.
5016         (Sized_relobj_file::sized_relobj): New function
5017         (Sized_relobj_file::local_has_got_offset): Move to base class.
5018         (Sized_relobj_file::local_got_offset): Likewise.
5019         (Sized_relobj_file::set_local_got_offset): Likewise.
5020         (Sized_relobj_file::get_output_section_offset): Likewise.
5021         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
5022         (Sized_relobj_file::do_output_section_offset): Likewise.
5023         (Sized_relobj_file::do_set_section_offset): Likewise.
5024         (Sized_relobj_file::Local_got_offsets): Likewise.
5025         (Sized_relobj_file::local_got_offsets_): Likewise.
5026         (Sized_relobj_file::section_offsets_): Likewise.
5027         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
5028         (all constructors).
5029         (set_needs_dynsym_index): Convert relobj to derived class pointer.
5030         (Output_reloc::get_symbol_index): Likewise.
5031         (Output_reloc::local_section_offset): Likewise.
5032         (Output_reloc::get_address): Likewise.
5033         (Output_reloc::symbol_value): Likewise.
5034         (Output_data_got::reserve_slot): Move to class definition.
5035         (Output_data_got::reserve_local): New function.
5036         (Output_data_got::reserve_slot_for_global): Remove.
5037         (Output_data_got::reserve_global): New function.
5038         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
5039         (all constructors, two instantiations).
5040         (Output_reloc::get_relobj): New function (two instantiations).
5041         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
5042         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
5043         (Output_data_reloc::add_global): Adjust type of relobj.
5044         (Output_data_reloc::add_global_relative): Likewise.
5045         (Output_data_reloc::add_symbolless_global_addend): Likewise.
5046         (Output_data_reloc::add_local): Likewise.
5047         (Output_data_reloc::add_local_relative): Likewise.
5048         (Output_data_reloc::add_symbolless_local_addend): Likewise.
5049         (Output_data_reloc::add_local_section): Likewise.
5050         (Output_data_reloc::add_output_section): Likewise.
5051         (Output_data_reloc::add_absolute): Likewise.
5052         (Output_data_reloc::add_target_specific): Likewise.
5053         (Output_data_got::reserve_slot): Move definition here.
5054         (Output_data_got::reserve_local): New function.
5055         (Output_data_got::reserve_global): New function.
5056         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
5057         section_offsets_ with accessor function.
5058         (Sized_relobj_file::write_sections): Likewise.
5059         (Sized_relobj_file::do_relocate_sections): Likewise.
5060         * target.h (Sized_target::reserve_local_got_entry): New function.
5061         (Sized_target::reserve_global_got_entry): New function.
5062         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
5063         (Target_x86_64::reserve_global_got_entry): New function.
5064         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
5065
5066 2011-05-23 Cary Coutant  <ccoutant@google.com>
5067
5068         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
5069         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
5070         bit when checking got_type.
5071         * incremental.cc (Sized_incremental_binary::setup_readers):
5072         Store symbol table and string table locations; initialize bit vector
5073         of file status flags.
5074         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
5075         unchanged files.
5076         (Sized_incremental_binary::do_process_got_plt): New function.
5077         (Sized_incremental_binary::get_symtab_view): Use stored locations.
5078         (Output_section_incremental_inputs::set_final_data_size): Record
5079         file index for each input file.
5080         (Output_section_incremental_inputs::write_got_plt): Store file index
5081         instead of input entry offset for each GOT entry.
5082         * incremental.h
5083         (Incremental_input_entry::Incremental_input_entry): Initialize new
5084         data member.
5085         (Incremental_input_entry::set_offset): Store file index.
5086         (Incremental_input_entry::get_file_index): New function.
5087         (Incremental_input_entry::file_index_): New data member.
5088         (Incremental_binary::process_got_plt): New function.
5089         (Incremental_binary::do_process_got_plt): New function.
5090         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
5091         data members.
5092         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
5093         (Sized_incremental_binary::set_file_is_unchanged): New function.
5094         (Sized_incremental_binary::file_is_unchanged): New function.
5095         (Sized_incremental_binary::do_process_got_plt): New function.
5096         (Sized_incremental_binary::file_status_): New data member.
5097         (Sized_incremental_binary::main_symtab_loc_): New data member.
5098         (Sized_incremental_binary::main_strtab_loc_): New data member.
5099         * output.cc (Output_data_got::Got_entry::write): Add case
5100         RESERVED_CODE.
5101         (Output_data_got::add_global): Call add_got_entry.
5102         (Output_data_got::add_global_plt): Likewise.
5103         (Output_data_got::add_global_with_rel): Likewise.
5104         (Output_data_got::add_global_with_rela): Likewise.
5105         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
5106         (Output_data_got::add_global_pair_with_rela): Likewise.
5107         (Output_data_got::add_local): Call add_got_entry.
5108         (Output_data_got::add_local_plt): Likewise.
5109         (Output_data_got::add_local_with_rel): Likewise.
5110         (Output_data_got::add_local_with_rela): Likewise.
5111         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
5112         (Output_data_got::add_local_pair_with_rela): Likewise.
5113         (Output_data_got::reserve_slot): New function.
5114         (Output_data_got::reserve_slot_for_global): New function.
5115         (Output_data_got::add_got_entry): New function.
5116         (Output_data_got::add_got_entry_pair): New function.
5117         (Output_section::add_output_section_data): Edit FIXME.
5118         * output.h
5119         (Output_section_data_build::Output_section_data_build): New
5120         constructor with size parameter.
5121         (Output_data_space::Output_data_space): Likewise.
5122         (Output_data_got::Output_data_got): Initialize new data member; new
5123         constructor with size parameter.
5124         (Output_data_got::add_constant): Call add_got_entry.
5125         (Output_data_got::reserve_slot): New function.
5126         (Output_data_got::reserve_slot_for_global): New function.
5127         (class Output_data_got::Got_entry): Add RESERVED_CODE.
5128         (Output_data_got::add_got_entry): New function.
5129         (Output_data_got::add_got_entry_pair): New function.
5130         (Output_data_got::free_list_): New data member.
5131         * target.h (Sized_target::init_got_plt_for_update): New function.
5132         (Sized_target::register_global_plt_entry): New function.
5133         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
5134         Initialize new data member; call init; add constructor with PLT count.
5135         (Output_data_plt_x86_64::init): New function.
5136         (Output_data_plt_x86_64::add_relocation): New function.
5137         (Output_data_plt_x86_64::reserve_slot): New function.
5138         (Output_data_plt_x86_64::free_list_): New data member.
5139         (Target_x86_64::init_got_plt_for_update): New function.
5140         (Target_x86_64::register_global_plt_entry): New function.
5141         (Output_data_plt_x86_64::add_entry): Allocate from free list for
5142         incremental updates.
5143         (Output_data_plt_x86_64::add_relocation): New function.
5144         * testsuite/object_unittest.cc (Object_test): Set default options.
5145
5146 2011-05-16  Ian Lance Taylor  <iant@google.com>
5147
5148         * options.h (class General_options): Make -i a synonym for -r.
5149
5150 2011-05-16  Ian Lance Taylor  <iant@google.com>
5151
5152         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
5153
5154 2011-05-10 Cary Coutant  <ccoutant@google.com>
5155
5156         * object.cc (Sized_relobj::do_count_local_symbols): Check for
5157         strip_all (-s).
5158
5159 2011-05-06  Ian Lance Taylor  <iant@google.com>
5160
5161         * layout.cc (Layout::layout): If the output section flags change,
5162         update the ordering.
5163
5164 2011-04-25 Cary Coutant  <ccoutant@google.com>
5165
5166         * incremental-dump.cc (dump_incremental_inputs): Print local
5167         symbol info for each input file.
5168         * incremental.cc
5169         (Output_section_incremental_inputs::set_final_data_size): Add local
5170         symbol info to input file entries in incremental info.
5171         (Output_section_incremental_inputs::write_info_blocks): Likewise.
5172         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
5173         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
5174         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
5175         implementation.
5176         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
5177         (Sized_incr_relobj::do_relocate): Write the local symbols.
5178         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
5179         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
5180         Adjust size of input file header.
5181         (Incremental_inputs_reader::get_local_symbol_offset): New function.
5182         (Incremental_inputs_reader::get_local_symbol_count): New function.
5183         (Incremental_inputs_reader::get_input_section): Adjust size of input
5184         file header.
5185         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
5186         (Sized_incr_relobj::This): New typedef.
5187         (Sized_incr_relobj::sym_size): New const data member.
5188         (Sized_incr_relobj::Local_symbol): New struct.
5189         (Sized_incr_relobj::do_output_local_symbol_count): New function.
5190         (Sized_incr_relobj::do_local_symbol_offset): New function.
5191         (Sized_incr_relobj::local_symbol_count_): New data member.
5192         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
5193         (Sized_incr_relobj::local_symbol_index_): New data member.
5194         (Sized_incr_relobj::local_symbol_offset_): New data member.
5195         (Sized_incr_relobj::local_dynsym_offset_): New data member.
5196         (Sized_incr_relobj::local_symbols_): New data member.
5197         * object.h (Relobj::output_local_symbol_count): New function.
5198         (Relobj::local_symbol_offset): New function.
5199         (Relobj::do_output_local_symbol_count): New function.
5200         (Relobj::do_local_symbol_offset): New function.
5201         (Sized_relobj::do_output_local_symbol_count): New function.
5202         (Sized_relobj::do_local_symbol_offset): New function.
5203
5204 2011-04-22  Vladimir Simonov  <sv@sw.ru>
5205
5206         * descriptors.cc (set_close_on_exec): New function.
5207         (Descriptors::open): Use set_close_on_exec.
5208         * output.cc (S_ISLNK): Define if not defined.
5209
5210 2011-04-22 Cary Coutant  <ccoutant@google.com>
5211
5212         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
5213         global symbol map.
5214         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
5215         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
5216         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
5217         relocations.
5218         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
5219         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
5220         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
5221         * incremental.h
5222         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
5223         function.
5224         (Incremental_binary::apply_incremental_relocs): New function.
5225         (Incremental_binary::do_apply_incremental_relocs): New function.
5226         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
5227         data member.
5228         (Sized_incremental_binary::add_global_symbol): New function.
5229         (Sized_incremental_binary::global_symbol): New function.
5230         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
5231         (Sized_incremental_binary::symbol_map_): New data member.
5232         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
5233         * target.h (Sized_target::apply_relocation): New function.
5234         * target-reloc.h (apply_relocation): New function.
5235         * x86_64.cc (Target_x86_64::apply_relocation): New function.
5236
5237 2011-04-22  Doug Kwan  <dougkwan@google.com>
5238
5239         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
5240         flag of a SHT_ARM_EXIDX section.
5241         * testsuite/Makefile.am (arm_exidx_test): New test rules.
5242         * testsuite/Makefile.in: Regenerate.
5243         * testsuite/arm_exidx_test.s: New file.
5244         * testsuite/arm_exidx_test.sh: Same.
5245
5246 2011-04-20 Cary Coutant  <ccoutant@google.com>
5247
5248         PR gold/12689
5249         * archive.h (Incremental_archive_entry::Archive_member):
5250         Initialize arg_serial_ (second constructor).
5251
5252 2011-04-17  Ian Lance Taylor  <iant@google.com>
5253
5254         * object.cc (Relocate_info::location): Simplify location string.
5255         * errors.cc (Errors::error_at_location): Don't print program
5256         name.
5257         (Errors::warning_at_location): Likewise.
5258         (Errors::undefined_symbol): Likewise.
5259         * testsuite/debug_msg.sh: Update accordingly.
5260
5261 2011-04-14 Cary Coutant  <ccoutant@google.com>
5262
5263         * gold/layout.cc (Layout::symtab_section_offset): New function.
5264         * gold/layout.h (Layout::symtab_section_offset): New function.
5265         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
5266
5267 2011-04-12  Ian Lance Taylor  <iant@google.com>
5268
5269         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
5270         with MREMAP_MAYMOVE.
5271         * output.h (class Output_file): Add map_is_allocated_ field.
5272         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
5273         not available, provide stubs.  If mremap is not available, #define
5274         it to gold_mremap.
5275         (MREMAP_MAYMOVE): Define if not defined.
5276         (Output_file::Output_file): Initialize map_is_allocated_.
5277         (Output_file::resize): Check map_is_allocated_.
5278         (Output_file::map_anonymous): If mmap fails, use malloc.
5279         (Output_file::unmap): Don't do anything for an anonymous map.
5280         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
5281         is not available, provide stubs.
5282         (File_read::View::~View): Use free rather than delete[].
5283         (File_read::make_view): Use malloc rather than new[].  If mmap
5284         fails, use malloc.
5285         (File_read::find_or_make_view): Use malloc rather than new[].
5286         * gold.h: Remove HAVE_REMAP code.
5287         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
5288         exists.  Rename mremap to gold_mremap.  If mmap is not available
5289         don't do anything.
5290         * configure, config.in: Rebuild.
5291
5292 2011-04-11  Ian Lance Taylor  <iant@google.com>
5293
5294         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
5295         initialize local variable v.
5296
5297 2011-04-11  Cary Coutant  <ccoutant@google.com>
5298
5299         * archive.cc (Archive::include_member): Adjust call to
5300         report_object.
5301         (Add_archive_symbols::run): Track argument serial numbers.
5302         (Lib_group::include_member): Likewise.
5303         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
5304         * archive.h (Incremental_archive_entry::Archive_member):
5305         Initialize arg_serial_.
5306         (Archive_member::arg_serial_): New data member.
5307         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
5308         (Sized_dynobj::do_add_symbols): Track symbols when doing an
5309         incremental link.
5310         (Sized_dynobj::do_for_all_local_got_entries): New function.
5311         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
5312         function.
5313         * fileread.cc (get_mtime): New function.
5314         * fileread.h (get_mtime): New function.
5315         * gold.cc (queue_initial_tasks): Check for incremental update.
5316         (process_incremental_input): New function.
5317         (queue_middle_tasks): Don't force valid target for incremental
5318         update.
5319         * incremental-dump.cc (find_input_containing_global): Adjust
5320         size of symbol info entry.
5321         (dump_incremental_inputs): Dump argument serial number and
5322         in_system_directory flag; bias shndx by 1; print symbol names
5323         when dumping per-file symbol lists; use new symbol info readers.
5324         * incremental.cc
5325         (Output_section_incremental_inputs:update_data_size): New function.
5326         (Sized_incremental_binary::setup_readers): Setup input readers
5327         for each input file; build maps for files added from libraries
5328         and scripts.
5329         (Sized_incremental_binary::check_input_args): New function.
5330         (Sized_incremental_binary::do_check_inputs): Build map of argument
5331         serial numbers to input arguments.
5332         (Sized_incremental_binary::do_file_has_changed): Rename
5333         do_file_is_unchanged to this; compare file modification times.
5334         (Sized_incremental_binary::do_init_layout): New function.
5335         (Sized_incremental_binary::do_reserve_layout): New function.
5336         (Sized_incremental_binary::do_get_input_reader): Remove.
5337         (Sized_incremental_binary::get_symtab_view): New function.
5338         (Incremental_checker::can_incrementally_link_output_file): Remove.
5339         (Incremental_inputs::report_command_line): Exclude --debug options.
5340         (Incremental_inputs::report_archive_begin): Add parameter; track
5341         argument serial numbers; don't put input file entry for archive
5342         before archive members.
5343         (Incremental_inputs::report_archive_end): Put input file entry
5344         for archive after archive members.
5345         (Incremental_inputs::report_object): Add parameter; track argument
5346         serial numbers and in_system_directory flag.
5347         (Incremental_inputs::report_script): Add parameter; track argument
5348         serial numbers.
5349         (Output_section_incremental_inputs::set_final_data_size): Adjust
5350         size of symbol info entry; check for forwarding symbols.
5351         (Output_section_incremental_inputs::write_input_files): Write
5352         in_system_directory flag and argument serial number.
5353         (Output_section_incremental_inputs::write_info_blocks): Map section
5354         indices between incremental info and original input file; store
5355         input section index for each symbol.
5356         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
5357         change operator() to visit().
5358         (class Global_got_offset_visitor): Likewise.
5359         (class Global_symbol_visitor_got_plt):
5360         (Output_section_incremental_inputs::write_got_plt): Use new visitor
5361         classes.
5362         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
5363         (Sized_incr_relobj::do_read_symbols): New function.
5364         (Sized_incr_relobj::do_layout): New function.
5365         (Sized_incr_relobj::do_layout_deferred_sections): New function.
5366         (Sized_incr_relobj::do_add_symbols): New function.
5367         (Sized_incr_relobj::do_should_include_member): New function.
5368         (Sized_incr_relobj::do_for_all_global_symbols): New function.
5369         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
5370         (Sized_incr_relobj::do_section_size): New function.
5371         (Sized_incr_relobj::do_section_name): New function.
5372         (Sized_incr_relobj::do_section_contents): New function.
5373         (Sized_incr_relobj::do_section_flags): New function.
5374         (Sized_incr_relobj::do_section_entsize): New function.
5375         (Sized_incr_relobj::do_section_address): New function.
5376         (Sized_incr_relobj::do_section_type): New function.
5377         (Sized_incr_relobj::do_section_link): New function.
5378         (Sized_incr_relobj::do_section_info): New function.
5379         (Sized_incr_relobj::do_section_addralign): New function.
5380         (Sized_incr_relobj::do_initialize_xindex): New function.
5381         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
5382         (Sized_incr_relobj::do_read_relocs): New function.
5383         (Sized_incr_relobj::do_gc_process_relocs): New function.
5384         (Sized_incr_relobj::do_scan_relocs): New function.
5385         (Sized_incr_relobj::do_count_local_symbols): New function.
5386         (Sized_incr_relobj::do_finalize_local_symbols): New function.
5387         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
5388         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
5389         (Sized_incr_relobj::do_relocate): New function.
5390         (Sized_incr_relobj::do_set_section_offset): New function.
5391         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
5392         (Sized_incr_dynobj::do_read_symbols): New function.
5393         (Sized_incr_dynobj::do_layout): New function.
5394         (Sized_incr_dynobj::do_add_symbols): New function.
5395         (Sized_incr_dynobj::do_should_include_member): New function.
5396         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
5397         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
5398         (Sized_incr_dynobj::do_section_size): New function.
5399         (Sized_incr_dynobj::do_section_name): New function.
5400         (Sized_incr_dynobj::do_section_contents): New function.
5401         (Sized_incr_dynobj::do_section_flags): New function.
5402         (Sized_incr_dynobj::do_section_entsize): New function.
5403         (Sized_incr_dynobj::do_section_address): New function.
5404         (Sized_incr_dynobj::do_section_type): New function.
5405         (Sized_incr_dynobj::do_section_link): New function.
5406         (Sized_incr_dynobj::do_section_info): New function.
5407         (Sized_incr_dynobj::do_section_addralign): New function.
5408         (Sized_incr_dynobj::do_initialize_xindex): New function.
5409         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
5410         (make_sized_incremental_object): New function.
5411         (Incremental_library::copy_unused_symbols): New function.
5412         (Incremental_library::do_for_all_unused_symbols): New function.
5413         * incremental.h (enum Incremental_input_flags): New type.
5414         (class Incremental_checker): Remove.
5415         (Incremental_input_entry::Incremental_input_entry): Add argument
5416         serial number.
5417         (Incremental_input_entry::arg_serial): New function.
5418         (Incremental_input_entry::set_is_in_system_directory): New function.
5419         (Incremental_input_entry::is_in_system_directory): New function.
5420         (Incremental_input_entry::arg_serial_): New data member.
5421         (Incremental_input_entry::is_in_system_directory_): New data member.
5422         (class Script_info): Move here from script.h.
5423         (Script_info::Script_info): Add filename parameter.
5424         (Script_info::filename): New function.
5425         (Script_info::filename_): New data member.
5426         (Incremental_script_entry::Incremental_script_entry): Add argument
5427         serial number.
5428         (Incremental_object_entry::Incremental_object_entry): Likewise.
5429         (Incremental_object_entry::add_input_section): Build list of input
5430         sections with map to original shndx.
5431         (Incremental_object_entry::get_input_section_index): New function.
5432         (Incremental_object_entry::shndx_): New data member.
5433         (Incremental_object_entry::name_key_): Rename; adjust all refs.
5434         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
5435         (Incremental_archive_entry::Incremental_archive_entry): Add argument
5436         serial number.
5437         (Incremental_inputs::report_archive_begin): Likewise.
5438         (Incremental_inputs::report_object): Likewise.
5439         (Incremental_inputs::report_script): Likewise.
5440         (class Incremental_global_symbol_reader): New class.
5441         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
5442         and store flags and input file type.
5443         (Incremental_input_entry_reader::arg_serial): New function.
5444         (Incremental_input_entry_reader::type): Extract type from flags.
5445         (Incremental_input_entry_reader::is_in_system_directory): New function.
5446         (Incremental_input_entry_reader::get_input_section_count): Call
5447         accessor function for type.
5448         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
5449         function for type; adjust size of global symbol entry.
5450         (Incremental_input_entry_reader::get_global_symbol_count): Call
5451         accessor function for type.
5452         (Incremental_input_entry_reader::get_object_count): Likewise.
5453         (Incremental_input_entry_reader::get_object_offset): Likewise.
5454         (Incremental_input_entry_reader::get_member_count): Likewise.
5455         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
5456         (Incremental_input_entry_reader::get_member_offset): Likewise.
5457         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
5458         (Incremental_input_entry_reader::Global_symbol_info): Remove.
5459         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
5460         (Incremental_input_entry_reader::get_global_symbol_reader): New
5461         function.
5462         (Incremental_input_entry_reader::get_output_symbol_index): New
5463         function.
5464         (Incremental_input_entry_reader::type_): Remove.
5465         (Incremental_input_entry_reader::flags_): New data member.
5466         (Incremental_inputs_reader::input_file_offset): New function.
5467         (Incremental_inputs_reader::input_file_index): New function.
5468         (Incremental_inputs_reader::input_file): Call input_file_offset.
5469         (Incremental_inputs_reader::input_file_at_offset): New function.
5470         (Incremental_relocs_reader::get_r_type): Reformat.
5471         (Incremental_relocs_reader::get_r_shndx): Reformat.
5472         (Incremental_relocs_reader::get_r_offset): Reformat.
5473         (Incremental_relocs_reader::data): New function.
5474         (Incremental_binary::Incremental_binary): Initialize new data members.
5475         (Incremental_binary::check_inputs): Add cmdline parameter.
5476         (Incremental_binary::file_is_unchanged): Remove.
5477         (Input_reader::arg_serial): New function.
5478         (Input_reader::get_unused_symbol_count): New function.
5479         (Input_reader::get_unused_symbol): New function.
5480         (Input_reader::do_arg_serial): New function.
5481         (Input_reader::do_get_unused_symbol_count): New function.
5482         (Input_reader::do_get_unused_symbol): New function.
5483         (Incremental_binary::input_file_count): New function.
5484         (Incremental_binary::get_input_reader): Change signature to use
5485         index instead of filename.
5486         (Incremental_binary::file_has_changed): New function.
5487         (Incremental_binary::get_input_argument): New function.
5488         (Incremental_binary::get_library): New function.
5489         (Incremental_binary::get_script_info): New function.
5490         (Incremental_binary::init_layout): New function.
5491         (Incremental_binary::reserve_layout): New function.
5492         (Incremental_binary::output_file): New function.
5493         (Incremental_binary::do_check_inputs): New function.
5494         (Incremental_binary::do_file_is_unchanged): Remove.
5495         (Incremental_binary::do_file_has_changed): New function.
5496         (Incremental_binary::do_init_layout): New function.
5497         (Incremental_binary::do_reserve_layout): New function.
5498         (Incremental_binary::do_input_file_count): New function.
5499         (Incremental_binary::do_get_input_reader): Change signature.
5500         (Incremental_binary::input_args_map_): New data member.
5501         (Incremental_binary::library_map_): New data member.
5502         (Incremental_binary::script_map_): New data member.
5503         (Sized_incremental_binary::Sized_incremental_binary): Initialize
5504         new data members.
5505         (Sized_incremental_binary::output_section): New function.
5506         (Sized_incremental_binary::inputs_reader): Add const.
5507         (Sized_incremental_binary::symtab_reader): Add const.
5508         (Sized_incremental_binary::relocs_reader): Add const.
5509         (Sized_incremental_binary::got_plt_reader): Add const.
5510         (Sized_incremental_binary::get_symtab_view): New function.
5511         (Sized_incremental_binary::Inputs_reader): New typedef.
5512         (Sized_incremental_binary::Input_entry_reader): New typedef.
5513         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
5514         (Sized_incremental_binary::do_file_is_unchanged): Remove.
5515         (Sized_incremental_binary::do_file_has_changed): New function.
5516         (Sized_incremental_binary::do_init_layout): New function.
5517         (Sized_incremental_binary::do_reserve_layout): New function.
5518         (Sized_input_reader::Inputs_reader): Remove.
5519         (Sized_input_reader::Input_entry_reader): Remove.
5520         (Sized_input_reader::do_arg_serial): New function.
5521         (Sized_input_reader::do_get_unused_symbol_count): New function.
5522         (Sized_input_reader::do_get_unused_symbol): New function.
5523         (Sized_incremental_binary::do_input_file_count): New function.
5524         (Sized_incremental_binary::do_get_input_reader): Change signature;
5525         use index instead of filename.
5526         (Sized_incremental_binary::section_map_): New data member.
5527         (Sized_incremental_binary::input_entry_readers_): New data member.
5528         (class Sized_incr_relobj): New class.
5529         (class Sized_incr_dynobj): New class.
5530         (make_sized_incremental_object): New function.
5531         (class Incremental_library): New class.
5532         * layout.cc (Free_list::num_lists): New static data member.
5533         (Free_list::num_nodes): New static data member.
5534         (Free_list::num_removes): New static data member.
5535         (Free_list::num_remove_visits): New static data member.
5536         (Free_list::num_allocates): New static data member.
5537         (Free_list::num_allocate_visits): New static data member.
5538         (Free_list::init): New function.
5539         (Free_list::remove): New function.
5540         (Free_list::allocate): New function.
5541         (Free_list::dump): New function.
5542         (Free_list::print_stats): New function.
5543         (Layout_task_runner::run): Resize output file for incremental updates.
5544         (Layout::Layout): Initialize new data members.
5545         (Layout::set_incremental_base): New function.
5546         (Layout::init_fixed_output_section): New function.
5547         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
5548         incremental updates.
5549         (Layout::create_gold_note): Do not create gold note section for
5550         incremental updates.
5551         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
5552         for incremental updates.
5553         (Layout::set_section_offsets): For incremental updates, allocate space
5554         from free list.
5555         (Layout::create_symtab_sections): Layout with offsets relative to
5556         start of section; for incremental updates, allocate space from free
5557         list.
5558         (Layout::create_shdrs): For incremental updates, allocate space from
5559         free list.
5560         (Layout::finish_dynamic_section): For incremental updates, do not
5561         check --as-needed (fixed in subsequent patch).
5562         * layout.h (class Free_list): New class.
5563         (Layout::set_incremental_base): New function.
5564         (Layout::incremental_base): New function.
5565         (Layout::init_fixed_output_section): New function.
5566         (Layout::allocate): New function.
5567         (Layout::incremental_base_): New data member.
5568         (Layout::free_list_): New data member.
5569         * main.cc (main): Print Free_list statistics.
5570         * object.cc (Relobj::finalize_incremental_relocs): Add
5571         clear_counts parameter; clear counts only when clear_counts is set.
5572         (Sized_relobj::Sized_relobj): Initialize new base class.
5573         (Sized_relobj::do_layout): Don't report special sections.
5574         (Sized_relobj::do_for_all_local_got_entries): New function.
5575         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
5576         symtab_off to all symbol table offsets.
5577         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
5578         * object.h (class Got_offset_list): Move to top of file.
5579         (Object::Object): Allow case where input_file == NULL.
5580         (Object::~Object): Likewise.
5581         (Object::input_file): Assert that input_file != NULL.
5582         (Object::lock): Allow case where input_file == NULL.
5583         (Object::unlock): Likewise.
5584         (Object::is_locked): Likewise.
5585         (Object::token): Likewise.
5586         (Object::release): Likewise.
5587         (Object::is_incremental): New function.
5588         (Object::get_mtime): New function.
5589         (Object::for_all_local_got_entries): New function.
5590         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
5591         (Object::set_is_in_system_directory): New function.
5592         (Object::is_in_system_directory): New function.
5593         (Object::do_is_incremental): New function.
5594         (Object::do_get_mtime): New function.
5595         (Object::do_for_all_local_got_entries): New function.
5596         (Object::is_in_system_directory_): New data member.
5597         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
5598         (class Sized_relobj_base): New class.
5599         (class Sized_relobj): Derive from Sized_relobj_base.
5600         (class Sized_relobj::Symbols): Redeclare from base class.
5601         (class Sized_relobj::local_got_offset_list): Remove.
5602         (class Sized_relobj::Output_sections): Redeclare from base class.
5603         (class Sized_relobj::do_for_all_local_got_entries): New function.
5604         (class Sized_relobj::write_local_symbols): Add offset parameter.
5605         (class Sized_relobj::local_symbol_offset_): Update comment.
5606         (class Sized_relobj::local_dynsym_offset_): Update comment.
5607         * options.cc (Input_arguments::add_file): Remove const.
5608         * options.h (Input_file_argument::Input_file_argument):
5609         Initialize arg_serial_ (all constructors).
5610         (Input_file_argument::set_arg_serial): New function.
5611         (Input_file_argument::arg_serial): New function.
5612         (Input_file_argument::arg_serial_): New data member.
5613         (Input_arguments::Input_arguments): Initialize file_count_.
5614         (Input_arguments::add_file): Remove const.
5615         (Input_arguments::number_of_input_files): New function.
5616         (Input_arguments::file_count_): New data member.
5617         (Command_line::number_of_input_files): Call
5618         Input_arguments::number_of_input_files.
5619         * output.cc (Output_segment_headers::Output_segment_headers):
5620         Set current size.
5621         (Output_section::Input_section::current_data_size): New function.
5622         (Output_section::Output_section): Initialize new data members.
5623         (Output_section::add_input_section): Don't do merge sections for
5624         an incremental link; allocate space from free list for an
5625         incremental update.
5626         (Output_section::add_output_section_data): Allocate space from
5627         free list for an incremental update.
5628         (Output_section::update_data_size): New function.
5629         (Output_section::set_fixed_layout): New function.
5630         (Output_section::reserve): New function.
5631         (Output_segment::set_section_addresses): Remove const.
5632         (Output_segment::set_section_list_addresses): Remove const; allocate
5633         space from free list for an incremental update.
5634         (Output_segment::set_offset): Adjust size of RELRO segment for an
5635         incremental update.
5636         * output.h (Output_data::current_data_size): Move here from
5637         child classes.
5638         (Output_data::pre_finalize_data_size): New function.
5639         (Output_data::update_data_size): New function.
5640         (Output_section_headers::update_data_size): new function.
5641         (Output_section_data_build::current_data_size): Move to Output_data.
5642         (Output_data_strtab::update_data_size): New function.
5643         (Output_section::current_data_size): Move to Output_data.
5644         (Output_section::set_fixed_layout): New function.
5645         (Output_section::has_fixed_layout): New function.
5646         (Output_section::reserve): New function.
5647         (Output_section::update_data_size): New function.
5648         (Output_section::has_fixed_layout_): New data member.
5649         (Output_section::free_list_): New data member.
5650         (Output_segment::set_section_addresses): Remove const.
5651         (Output_segment::set_section_list_addresses): Remove const.
5652         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
5653         New function.
5654         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
5655         New function.
5656         * readsyms.cc (Read_symbols::do_read_symbols): Add library
5657         parameter when calling Add_symbols constructor; store argument
5658         serial number for members of a lib group.
5659         (Add_symbols::locks): Allow case where token == NULL.
5660         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
5661         (Read_member::~Read_member): New function.
5662         (Read_member::is_runnable): New function.
5663         (Read_member::locks): New function.
5664         (Read_member::run): New function.
5665         (Check_script::~Check_script): New function.
5666         (Check_script::is_runnable): New function.
5667         (Check_script::locks): New function.
5668         (Check_script::run): New function.
5669         (Check_library::~Check_library): New function.
5670         (Check_library::is_runnable): New function.
5671         (Check_library::locks): New function.
5672         (Check_library::run): New function.
5673         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
5674         (Add_symbols::library_): New data member.
5675         (class Read_member): New class.
5676         (class Check_script): New class.
5677         (class Check_library): New class.
5678         * reloc.cc (Read_relocs::is_runnable): Allow case where
5679         token == NULL.
5680         (Read_relocs::locks): Likewise.
5681         (Scan_relocs::locks): Likewise.
5682         (Relocate_task::locks): Likewise.
5683         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
5684         to clear counters.
5685         (Sized_relobj::incremental_relocs_scan): Fix comment.
5686         (Sized_relobj::do_relocate): Pass output file offset to
5687         write_local_symbols.
5688         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
5689         from class declaration.
5690         * script.cc (read_input_script): Allocate Script_info; pass
5691         argument serial number to report_script.
5692         * script.h (class Script_info): Move to incremental.h.
5693         * symtab.cc (Symbol_table::add_from_incrobj): New function.
5694         * symtab.h (Symbol_table::add_from_incrobj): New function.
5695         (Symbol_table::set_file_offset): New function.
5696
5697 2011-04-05  Cary Coutant  <ccoutant@google.com>
5698
5699         * incremental-dump.cc (dump_incremental_inputs): Change signature
5700         to take a Sized_incremental_binary; change caller.  Use readers
5701         in Sized_incremental_binary.
5702         * incremental.cc
5703         (Sized_incremental_binary::find_incremental_inputs_sections):
5704         Rename do_find_incremental_inputs_sections to this.
5705         (Sized_incremental_binary::setup_readers): New function.
5706         (Sized_incremental_binary::do_check_inputs): Check
5707         has_incremental_info_ flag; move setup code to setup_readers;
5708         use input readers.
5709         (Sized_incremental_binary::do_file_is_unchanged): New function.
5710         (Sized_incremental_binary::do_get_input_reader): New function.
5711         * incremental.h (class Incremental_binary): Move to end of file.
5712         (Incremental_binary::file_is_unchanged): New function.
5713         (Incremental_binary::do_file_is_unchanged): New function.
5714         (Incremental_binary::Input_reader): New class.
5715         (Incremental_binary::get_input_reader): New function.
5716         (class Sized_incremental_binary): Move to end of file.
5717         (Sized_incremental_binary::Sized_incremental_binary): Setup the
5718         input section reader classes.
5719         (Sized_incremental_binary::has_incremental_info): New function.
5720         (Sized_incremental_binary::inputs_reader): New function.
5721         (Sized_incremental_binary::symtab_reader): New function.
5722         (Sized_incremental_binary::relocs_reader): New function.
5723         (Sized_incremental_binary::got_plt_reader): New function.
5724         (Sized_incremental_binary::do_file_is_unchanged): New function.
5725         (Sized_incremental_binary::Sized_input_reader): New class.
5726         (Sized_incremental_binary::get_input_reader): New function.
5727         (Sized_incremental_binary::find_incremental_inputs_sections):
5728         Rename do_find_incremental_inputs_sections to this.
5729         (Sized_incremental_binary::setup_readers): New function.
5730         (Sized_incremental_binary::has_incremental_info_): New data member.
5731         (Sized_incremental_binary::inputs_reader_): New data member.
5732         (Sized_incremental_binary::symtab_reader_): New data member.
5733         (Sized_incremental_binary::relocs_reader_): New data member.
5734         (Sized_incremental_binary::got_plt_reader_): New data member.
5735         (Sized_incremental_binary::current_input_file_): New data member.
5736
5737 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
5738
5739         PR gold/12640
5740         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
5741         violation.
5742
5743 2011-03-30  Cary Coutant  <ccoutant@google.com>
5744
5745         * archive.cc (Archive::include_member): Adjust call to report_object.
5746         (Add_archive_symbols::run): Add script_info to call to
5747         report_archive_begin.
5748         (Lib_group::include_member): Adjust call to report_object.
5749         (Add_lib_group_symbols::run): Adjust call to report_object.
5750         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
5751         blocks.  Add object count for script input files.
5752         * incremental.cc (Incremental_inputs::report_archive_begin): Add
5753         script_info parameter; change all callers.
5754         (Incremental_inputs::report_object): Add script_info parameter;
5755         change all callers.
5756         (Incremental_inputs::report_script): Store backpointer to
5757         incremental info entry.
5758         (Output_section_incremental_inputs::set_final_data_size): Record
5759         additional information for scripts.
5760         (Output_section_incremental_inputs::write_info_blocks): Likewise.
5761         * incremental.h (Incremental_script_entry::add_object): New function.
5762         (Incremental_script_entry::get_object_count): New function.
5763         (Incremental_script_entry::get_object): New function.
5764         (Incremental_script_entry::objects_): New data member; adjust
5765         constructor.
5766         (Incremental_inputs::report_archive_begin): Add script_info parameter.
5767         (Incremental_inputs::report_object): Add script_info parameter.
5768         (Incremental_inputs_reader::get_object_count): New function.
5769         (Incremental_inputs_reader::get_object_offset): New function.
5770         * options.cc (Input_arguments::add_file): Return reference to
5771         new input argument.
5772         * options.h (Input_argument::set_script_info): New function.
5773         (Input_argument::script_info): New function.
5774         (Input_argument::script_info_): New data member; adjust all
5775         constructors.
5776         (Input_file_group::add_file): Return reference to new input argument.
5777         (Input_file_lib::add_file): Likewise.
5778         (Input_arguments::add_file): Likewise.
5779         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
5780         * script.cc (Parser_closure::Parser_closure): Add script_info
5781         parameter; adjust all callers.
5782         (Parser_closure::script_info): New function.
5783         (Parser_closure::script_info_): New data member.
5784         (read_input_script): Report scripts earlier to incremental info.
5785         (script_add_file): Set script_info in Input_argument.
5786         (script_add_library): Likewise.
5787         * script.h (Script_options::Script_info): Rewrite class.
5788
5789 2011-03-29  Cary Coutant  <ccoutant@google.com>
5790
5791         * archive.cc (Library_base::should_include_member): Move
5792         method here from class Archive.
5793         (Archive::Archive): Initialize base class.
5794         (Archive::should_include_member): Move to base class.
5795         (Archive::do_for_all_unused_symbols): New function.
5796         (Add_archive_symbols::run): Remove redundant access to
5797         incremental_inputs.
5798         (Lib_group::Lib_group): Initialize base class.
5799         (Lib_group::do_filename): New function.
5800         (Lib_group::include_member): Pass pointer to Lib_group to
5801         report_object.
5802         (Lib_group::do_for_all_unused_symbols): New function.
5803         (Add_lib_group_symbols::run): Report archive information for
5804         incremental links.
5805         * archive.h (class Library_base): New base class.
5806         (class Archive): Derive from Library_base.
5807         (Archive::filename): Move to base class.
5808         (Archive::set_incremental_info): Likewise.
5809         (Archive::incremental_info): Likewise.
5810         (Archive::Should_include): Likewise.
5811         (Archive::should_include_member): Likewise.
5812         (Archive::Armap_entry): Remove.
5813         (Archive::Unused_symbol_iterator): Remove.
5814         (Archive::unused_symbols_begin): Remove.
5815         (Archive::unused_symbols_end): Remove.
5816         (Archive::do_filename): New function.
5817         (Archive::do_get_mtime): New function.
5818         (Archive::do_for_all_unused_symbols): New function.
5819         (Archive::task_): Move to base class.
5820         (Archive::incremental_info_): Likewise.
5821         (class Lib_group): Derive from Library_base.
5822         (Lib_group::do_filename): New function.
5823         (Lib_group::do_get_mtime): New function.
5824         (Lib_group::do_for_all_unused_symbols): New function.
5825         (Lib_group::task_): Move to base class.
5826         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
5827         function.
5828         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
5829         function.
5830         * incremental.cc (Incremental_inputs::report_archive_begin):
5831         Use Library_base; call library's get_mtime; add incremental inputs
5832         entry before members.
5833         (class Unused_symbol_visitor): New class.
5834         (Incremental_inputs::report_archive_end): Use Library_base; use
5835         visitor class to record unused symbols; don't add incremental inputs
5836         entry after members.
5837         (Incremental_inputs::report_object): Use Library_base.
5838         * incremental.h
5839         (Incremental_archive_entry::Incremental_archive_entry): Remove
5840         unused Archive parameter.
5841         (Incremental_inputs::report_archive_begin): Use Library_base.
5842         (Incremental_inputs::report_archive_end): Likewise.
5843         (Incremental_inputs::report_object): Likewise.
5844         * object.cc (Sized_relobj::do_for_all_global_symbols): New
5845         function.
5846         * object.h (Object::for_all_global_symbols): New function.
5847         (Object::do_for_all_global_symbols): New function.
5848         (Sized_relobj::do_for_all_global_symbols): New function.
5849         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
5850         function.
5851         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
5852         function.
5853
5854 2011-03-27  Ian Lance Taylor  <iant@google.com>
5855
5856         * archive.cc (Archive::interpret_header): Return -1 if something
5857         goes wrong.  Change callers accordingly.
5858
5859 2011-03-25  Cary Coutant  <ccoutant@google.com>
5860
5861         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
5862         * testsuite/Makefile.in: Regenerate.
5863
5864 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
5865
5866         * plugin.cc (get_view): New.
5867         (Plugin::load): Pass get_view to the plugin.
5868         (Plugin_manager::get_view): New.
5869
5870 2011-03-21  Ian Lance Taylor  <iant@google.com>
5871
5872         * testsuite/final_layout.sh: Rewrite to not use dc.
5873         * testsuite/relro_test.sh: Fail if dc is not present.
5874
5875 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
5876
5877         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
5878         Change == to -eq.
5879         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
5880         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
5881         Change == to -eq.
5882         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
5883         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
5884
5885 2011-03-14  Ian Lance Taylor  <iant@google.com>
5886
5887         * script-sections.cc (Sort_output_sections::script_compare):
5888         Rename from is_before, change return type.
5889         (Sort_output_sections::operator()): Adjust accordingly.
5890
5891 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
5892
5893         PR gold/12572
5894         * testsuite/odr_violation2.cc: Add comment to make all error line
5895         numbers double digits.
5896         * testsuite/debug_msg.sh: Adjust expected errors.
5897
5898 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
5899
5900         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
5901         but mark earlier ones as non-canonical
5902         (offset_to_iterator): Update search target and example
5903         (do_addr2line): Return extra lines in a vector*
5904         (format_file_lineno): Extract from do_addr2line
5905         (one_addr2line): Add vector* out-param
5906         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
5907         when a lineno entry appeared last for its instruction
5908         (Dwarf_line_info): Add vector* out-param
5909         * object.cc (Relocate_info): Pass NULL for the vector* out-param
5910         * symtab.cc (Odr_violation_compare): Include the lineno in the
5911         comparison again.
5912         (linenos_from_loc): New. Combine the canonical line for an
5913         address with its other lines.
5914         (True_if_intersect): New. Helper functor to make
5915         std::set_intersection a query.
5916         (detect_odr_violations): Compare sets of lines instead of just
5917         one line for each function. This became less deterministic, but
5918         has fewer false positives.
5919         * symtab.h: Declarations.
5920         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
5921         mix an optimized and non-optimized object in the same binary
5922         (odr_violation2.so): Same.
5923         * testsuite/Makefile.in: Regenerate from Makefile.am.
5924         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
5925         * testsuite/debug_msg.sh: Update line numbers and add
5926         assertions.
5927         * testsuite/odr_violation1.cc: Use OdrDerived, in a
5928         non-optimized context.
5929         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
5930         isn't inlined, and use OdrDerived in an optimized context.
5931         * testsuite/odr_header1.h: Defines OdrDerived, where
5932         optimization will change the
5933         first-instruction-in-the-destructor's file and line number.
5934         * testsuite/odr_header2.h: Defines OdrBase.
5935
5936 2011-03-09  Ian Lance Taylor  <iant@google.com>
5937
5938         * fileread.cc (File_read::clear_views): Don't delete the whole
5939         file view.
5940
5941 2011-03-08  Ian Lance Taylor  <iant@google.com>
5942
5943         PR gold/12525
5944         * fileread.cc: #include <climits>.
5945         (GOLD_IOV_MAX): Define.
5946         (File_read::read_multiple): Limit number of entries by iov_max.
5947         * fileread.h (class File_read): Always set max_readv_entries to
5948         128.
5949
5950 2011-03-07  Ian Lance Taylor  <iant@google.com>
5951
5952         PR gold/12525
5953         * options.h (class General_options): Add -dy and -dn.
5954
5955 2011-03-02  Cary Coutant  <ccoutant@google.com>
5956
5957         * testsuite/script_test_9.t: Add TLS segment.
5958
5959 2011-03-02  Simon Baldwin  <simonb@google.com>
5960
5961         * configure.ac: Add check for gnu_indirect_function support in
5962         the toolchain building binutils.
5963         * configure: Rebuild.
5964
5965 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
5966
5967         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
5968         plugin only symbols.
5969         (Symbol_table::sized_finalize_symbol) Mark symbol only present
5970         in plugin files as not needed in the symbol table.
5971
5972 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
5973
5974         * output.cc (Output_section::add_input_section): Delay fill
5975         generation for section ordering.
5976
5977 2011-02-09  Ian Lance Taylor  <iant@google.com>
5978
5979         PR gold/12316
5980         * object.h (class Sized_relobj): Remove clear_local_symbols.
5981         * reloc.cc (Sized_relobj::do_relocate): Don't call
5982         clear_local_symbols.
5983
5984 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
5985
5986         * plugin.cc (is_visible_from_outside): Return true for symbols
5987         in the -u option.
5988
5989 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
5990
5991         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
5992         filename.
5993
5994 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
5995
5996         * icf.h (is_section_foldable_candidate): Change type of parameter
5997         to std::string.
5998         * icf.cc (Icf::find_identical_sections): Change type of local variable
5999         section_name to be std::string.
6000         (is_function_ctor_or_dtor): Change type of parameter to std::string.
6001
6002 2011-01-25  Ian Lance Taylor  <iant@google.com>
6003
6004         * script.cc (script_add_extern): Rewrite to use
6005         add_symbol_reference.
6006
6007 2011-01-25  Doug Kwan  <dougkwan@google.com>
6008
6009         * icf.cc (get_section_contents): Always lock section's object.
6010
6011 2011-01-24  Ian Lance Taylor  <iant@google.com>
6012
6013         * options.h (class General_options): Accept
6014         --no-detect-odr-violations.
6015
6016 2011-01-24  Ian Lance Taylor  <iant@google.com>
6017
6018         * version.cc (version_string): Bump to 1.11.
6019
6020 2011-01-24  Ian Lance Taylor  <iant@google.com>
6021
6022         * plugin.cc (class Plugin_rescan): Define new class.
6023         (Plugin_manager::claim_file): Set any_claimed_.
6024         (Plugin_manager::save_archive): New function.
6025         (Plugin_manager::save_input_group): New function.
6026         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
6027         necessary.
6028         (Plugin_manager::new_undefined_symbol): New function.
6029         (Plugin_manager::rescan): New function.
6030         (Plugin_manager::rescannable_defines): New function.
6031         (Plugin_manager::add_input_file): Set any_added_.
6032         * plugin.h (class Plugin_manager): define new fields rescannable_,
6033         undefined_symbols_, any_claimed_, and any_added_.  Declare
6034         Plugin_rescan as friend.  Declare new functions.
6035         (Plugin_manager::Rescannable): Define type.
6036         (Plugin_manager::Rescannable_list): Define type.
6037         (Plugin_manager::Undefined_symbol_list): Define type.
6038         (Plugin_manager::Plugin_manager): Initialize new fields.
6039         * archive.cc (Archive::defines_symbol): New function.
6040         (Add_archive_symbols::run): Pass archive to plugins if any.
6041         * archive.h (class Archive): Declare defines_symbol.
6042         * readsyms.cc (Input_group::~Input_group): New function.
6043         (Finish_group::run): Pass input_group to plugins if any.
6044         * readsyms.h (class Input_group): Declare destructor.
6045         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
6046         any.
6047
6048 2011-01-10  Ian Lance Taylor  <iant@google.com>
6049
6050         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
6051         section as relro.
6052         (Layout::set_segment_offsets): Reset increase_relro before calling
6053         set_section_addresses a second time.
6054
6055 2011-01-04  Cary Coutant  <ccoutant@google.com>
6056
6057         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
6058         sections before NOBITS sections.
6059
6060 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
6061
6062         * version.cc (print_version): Update copyright to 2011.
6063
6064 2010-12-23  Cary Coutant  <ccoutant@google.com>
6065
6066         * output.h (Output_data_reloc::add_output_section): Pass OD instead
6067         of OS to this->add.  Add OD parameter to second form of the function.
6068
6069 2010-12-20  Ian Lance Taylor  <iant@google.com>
6070
6071         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
6072         second of two consecutive entries with same offset.
6073
6074 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6075
6076         * testsuite/Makefile.am (ifuncmain2static_LDADD)
6077         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
6078         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
6079         to avoid unneeded links against $(LDADD).
6080         * testsuite/Makefile.in: Regenerate.
6081
6082 2010-12-15  Ian Lance Taylor  <iant@google.com>
6083
6084         PR gold/12324
6085         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
6086         for R_X86_64_32 and R_X86_64_PC32.
6087         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
6088         ver_matching_def_pic.o.
6089         (ver_matching_def_pic.o): New target.
6090
6091 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6092
6093         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
6094         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
6095         Move definition before File_read::View member definitions.
6096         (File_read::View::~View): Initialize and hold lock before
6097         updating current_mapped_bytes.
6098
6099 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6100
6101         * dwarf_reader.cc: Remove outdated comment.
6102         * gold-threads.cc: Fix typo in error message.
6103         * archive.cc: Fix typos in comments.
6104         * archive.h: Likewise.
6105         * arm-reloc-property.cc: Likewise.
6106         * arm-reloc-property.h: Likewise.
6107         * arm-reloc.def: Likewise.
6108         * arm.cc: Likewise.
6109         * attributes.h: Likewise.
6110         * cref.cc: Likewise.
6111         * ehframe.cc: Likewise.
6112         * fileread.h: Likewise.
6113         * gold.h: Likewise.
6114         * i386.cc: Likewise.
6115         * icf.cc: Likewise.
6116         * incremental.h: Likewise.
6117         * int_encoding.cc: Likewise.
6118         * layout.h: Likewise.
6119         * main.cc: Likewise.
6120         * merge.h: Likewise.
6121         * object.cc: Likewise.
6122         * object.h: Likewise.
6123         * options.cc: Likewise.
6124         * readsyms.cc: Likewise.
6125         * reduced_debug_output.cc: Likewise.
6126         * reloc.cc: Likewise.
6127         * script-sections.cc: Likewise.
6128         * sparc.cc: Likewise.
6129         * symtab.h: Likewise.
6130         * target-reloc.h: Likewise.
6131         * target.cc: Likewise.
6132         * target.h: Likewise.
6133         * timer.cc: Likewise.
6134         * timer.h: Likewise.
6135         * x86_64.cc: Likewise.
6136
6137 2010-12-09  Cary Coutant  <ccoutant@google.com>
6138
6139         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
6140         stack.
6141         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
6142         parameter; change all callers.
6143         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
6144         * options.h (warn_execstack): New option.
6145
6146 2010-12-07  Doug Kwan  <dougkwan@google.com>
6147
6148         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
6149         like function call relocations.
6150
6151 2010-12-07  Ian Lance Taylor  <iant@google.com>
6152
6153         * archive.cc (Archive::get_elf_object_for_member): Permit
6154         punconfigured to be NULL.
6155         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
6156         (Archive::include_member): Pass NULL to get_elf_object_for_member
6157         if we searched for the archive and this is the first included
6158         object.
6159
6160 2010-12-01  Ian Lance Taylor  <iant@google.com>
6161
6162         * dwarf_reader.h (class Sized_dwarf_line_info): Add
6163         track_relocs_type_ field.
6164         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
6165         Set track_relocs_type_.
6166         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
6167         contents when using RELA relocs.
6168         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
6169         reloc_map_.
6170         * reloc.cc (Track_relocs::next_addend): New function.
6171         * reloc.h (class Track_relocs): Declare next_addend.
6172
6173 2010-12-01  Ian Lance Taylor  <iant@google.com>
6174
6175         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
6176         virtual destructor.
6177
6178 2010-12-01  Ian Lance Taylor  <iant@google.com>
6179
6180         * README: Update compilers known to work and fail.
6181
6182 2010-11-23  Matthias Klose  <doko@ubuntu.com>
6183
6184         * configure.in: For --enable-gold, handle value `default' instead of
6185         `both*'.  Always install ld as ld.bfd, install as ld if gold is
6186         not the default.
6187         * configure: Regenerate.
6188
6189 2010-11-18  Doug Kwan  <dougkwan@google.com>
6190
6191         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
6192         and right_alignment to be zero.  Store result alignment only if it is
6193         greater than existing alignment.
6194
6195 2010-11-16  Cary Coutant  <ccoutant@google.com>
6196
6197         PR gold/12220
6198         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
6199         Check for ".zdebug_line".
6200
6201 2010-11-16  Doug Kwan  <dougkwan@google.com>
6202             Cary Coutant  <ccoutant@google.com>
6203
6204         * output.h (Output_segment::set_section_addresses): Pass increase_relro
6205         by reference; adjust all callers.
6206         * output.cc (Output_segment::set_section_addresses): Adjust references
6207         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
6208         list is empty.
6209         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
6210         end at page boundary.
6211
6212 2010-11-16  Cary Coutant  <ccoutant@google.com>
6213
6214         PR gold/12220
6215         * layout.cc (Layout::choose_output_section): Transform names of
6216         compressed sections even when using a script with a SECTIONS clause.
6217         (Layout::output_section_name): Remove code to transform
6218         compressed debug section names.
6219         * output.cc (Output_section::add_input_section): Use uncompressed
6220         section size when tracking input sections.
6221
6222 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
6223
6224         * symtab.h (Symbol::NON_PIC_REF): Remove.
6225         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
6226         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
6227         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
6228         (Symbol::use_plt_offset): Take a flags argument and pass it
6229         directly to needs_dynamic_reloc.  Restrict check for undefined
6230         weak symbols to function calls.
6231         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
6232         (Target_arm::Scan::global): Use it.
6233         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
6234         (Target_arm::Relocate::relocate): Likewise.
6235         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
6236         parameter with an r_type parameter.  Use get_reference_flags
6237         to get the flags.
6238         (Target_arm::Relocate::relocate): Update accordingly.
6239         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
6240         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
6241         (Target_i386::Scan::global): Likewise.
6242         (Target_i386::Relocate::relocate): Likewise.
6243         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
6244         parameter with an r_type parameter.  Use get_reference_flags
6245         to get the flags.
6246         (Target_i386::Relocate::relocate): Update accordingly.
6247         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
6248         (Target_powerpc::Scan::global): Use it.
6249         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
6250         (Target_powerpc::Relocate::relocate): Likewise.
6251         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
6252         (Target_sparc::Scan::global): Use it.
6253         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
6254         (Target_sparc::Relocate::relocate): Likewise.
6255         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
6256         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
6257         (Target_x86_64::Scan::global): Likewise.
6258         (Target_x86_64::Relocate::relocate): Likewise.
6259
6260 2010-11-08  Doug Kwan  <dougkwan@google.com>
6261             Cary Coutant  <ccoutant@google.com>
6262
6263         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
6264         (Arm_exidx_merge_section::section_contents_): New data member.
6265         (Arm_input_section::Arm_input_section): Initialize original_contents_.
6266         (Arm_input_section::~Arm_input_section): De-allocate memory.
6267         (Arm_input_section::original_contents_): New data member.
6268         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
6269         in parameters instead of calling Object::section_contents without
6270         locking.
6271         (Arm_output_section::group_section): New parameter TASK.  Pass it
6272         to callees that need locking objects.
6273         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
6274         to lock EXIDX input sections.  Fix a formatting issue.  Call
6275         Arm_exidx_merged_section::build_contents to create merged section
6276         contents.
6277         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
6278         to lock object of stub table owner.
6279         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
6280         TEXT_SIZE to initialize data member TEXT_SIZE_.
6281         (Arm_exidx_input_section::addralign): Fix typo in comment.
6282         (Arm_exidx_input_section::text_size): New method.
6283         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
6284         that require locking objects.  Lock objects before scanning for stubs
6285         and updating local symbols.
6286         (Arm_input_section<big_endian>::init): Copy contents of original
6287         input section.
6288         (Arm_input_section<big_endian>::do_write): Use saved contents of
6289         original input section instead of calling Object::section_contents
6290         without locking.
6291         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
6292         size without calling Object::section_size().
6293         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
6294         for size.  Allocate a buffer for merged EXIDX entries.
6295         (Arm_exidx_merged_section::build_contents): New method.
6296         (Arm_exidx_merged_section::do_write): Move merge section contents
6297         building code to Arm_exidx_merged_section::build_contetns.  Write
6298         out contetns in buffer instead of building it on the fly.
6299         (Arm_relobj::make_exidx_input_section): Also pass text section size
6300         to Arm_exidx_input_section constructor.
6301         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
6302         (Arm_dynobj::do_read_symbols): Fix memory leak.
6303         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
6304         * target.h: (class Task): Add forward declaration.
6305         (Target::relax): Add new parameter TASK and pass it to
6306         Target::do_relax().
6307         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
6308
6309 2010-11-05  Cary Coutant  <ccoutant@google.com>
6310
6311         PR gold/10708
6312         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
6313         object when reading from the file.
6314         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
6315         second layout pass.
6316         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
6317         when reading section contents.
6318         (get_section_contents): Likewise.
6319         (icf::find_identical_sections): Likewise.
6320         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
6321         object when reading from the file.
6322         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
6323         the object when doing deferred section layout.
6324
6325 2010-11-03  Nick Clifton  <nickc@redhat.com>
6326
6327         PR gold/12001
6328         * script.h (class Symbol_assignment: name): New member.  Returns
6329         the name of the symbol.
6330         * scrfipt.cc (Script_options::is_pending_assignment): New member.
6331         Returns true if the given symbol name is on the list of
6332         assignments wating to be processed.
6333         * archive.cc (should_incldue_member): If the symbol is undefined,
6334         check to see if it is on the list of symbols pending assignment.
6335
6336 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
6337
6338         * script-sections.cc (Script_sections::find_memory_region): Check
6339         for a NULL output section pointer.
6340
6341 2010-10-29  Doug Kwan  <dougkwan@google.com>
6342
6343         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
6344         Output_section::add_relaxed_input_section.
6345         * output.cc (Output_section::add_relaxed_input_section): Add new
6346         arguments LAYOUT and NAME.  Set section order index.
6347         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
6348         Copy section order index.
6349         * output.h (Output_section::add_relaxed_input_section): Add new
6350         arguments LAYOUT and NAME.
6351
6352 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6353
6354         * testsuite/Makefile.am: Move gcctestdir/ld rule to
6355         NATIVE_OR_CROSS_LINKER.
6356         * testsuite/Makefile.in: Regenerate.
6357
6358 2010-10-20  Doug Kwan  <dougkwan@google.com>
6359
6360         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
6361         without SHF_LINK_ORDER flags.
6362         * layout.cc (Layout::choose_output_section): Do not filter
6363         SHF_LINK_ORDER flag in a relocatable link.
6364
6365 2010-10-17  Cary Coutant  <ccoutant@google.com>
6366
6367         * output.h (Output_segment::set_section_addresses): Change function
6368         signature.  Update all callers.
6369         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
6370         sections.
6371         (Output_segment::set_section_addresses): Align after last TLS
6372         section.  Add padding before last relro section instead of after.
6373
6374 2010-10-17  Doug Kwan  <dougkwan@google.com>
6375
6376         * gold/arm.cc (Target_arm::got_section): Use correct order and set
6377         GOT output section to be writable.
6378
6379 2010-10-14  Cary Coutant  <ccoutant@google.com>
6380
6381         * debug.h (DEBUG_INCREMENTAL): New flag.
6382         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
6383         * gold.cc (queue_initial_tasks): Check parameters for incremental link
6384         mode.
6385         * incremental.cc (report_command_line): Ignore all forms of
6386         --incremental.
6387         * layout.cc (Layout::Layout): Check parameters for incremental link
6388         mode.
6389         * options.cc (General_options::parse_incremental): New function.
6390         (General_options::parse_no_incremental): New function.
6391         (General_options::parse_incremental_full): New function.
6392         (General_options::parse_incremental_update): New function.
6393         (General_options::incremental_mode_): New data member.
6394         (General_options::finalize): Check incremental_mode_.
6395         * options.h (General_options): Update help text for --incremental.
6396         Add --no-incremental, --incremental-full, --incremental-update.
6397         (General_options::Incremental_mode): New enum type.
6398         (General_options::incremental_mode): New function.
6399         (General_options::incremental_mode_): New data member.
6400         * parameters.cc (Parameters::incremental_mode_): New data member.
6401         (Parameters::set_options): Set incremental_mode_.
6402         (Parameters::set_incremental_full): New function.
6403         (Parameters::incremental): New function.
6404         (Parameters::incremental_update): New function.
6405         (set_parameters_incremental_full): New function.
6406         * parameters.h (Parameters::set_incremental_full): New function.
6407         (Parameters::incremental): New function.
6408         (Parameters::incremental_update): New function.
6409         (Parameters::incremental_mode_): New data member.
6410         (set_parameters_incremental_full): New function.
6411         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
6412         incremental link mode.
6413         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
6414         (Sized_relobj::do_relocate_sections): Likewise.
6415         * testsuite/Makefile.am (incremental_test): Use --incremental-full
6416         option.
6417         * testsuite/Makefile.in: Regenerate.
6418         * testsuite/incremental_test.sh: Filter all forms of --incremental.
6419
6420 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6421
6422         * script-sections.h (class Script_sections): Make
6423         Sections_elements typedef public.
6424         * script-sections.cc (class Sort_output_sections): Add elements_
6425         field.  Add constructor which sets it; change all callers.
6426         (Sort_output_sections::is_before): New function.
6427         (Sort_output_sections::operator()): Call is_before.
6428         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
6429         conditional.
6430         * testsuite/script_test_10.sh: New test. Test script section
6431         order.
6432         * testsuite/script_test_10.t: Likewise.
6433         * testsuite/script_test_10.s: Likewise.
6434         * testsuite/Makefile.am: Wrap the cross linker tests and the
6435         common tests into NATIVE_OR_CROSS_LINKER.
6436         (check_SCRIPTS): Add script_test_10.sh.
6437         (check_DATA): Add script_test_10.stdout.
6438         (script_test_10.o, script_test_10): New targets.
6439         (script_test_10.stdout): New target.
6440         * configure, testsuite/Makefile.in: Regenerate.
6441
6442 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6443
6444         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
6445         error for the deprecated relocations.
6446         (Target_arm::Scan::global): Likewise.
6447         (Target_arm::Relocate::relocate): Likewise.
6448
6449 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
6450
6451         * fileread.cc (Input_file::find_file): Initialize *found_name
6452         and *namep when using the fallback search for case 4.
6453
6454 2010-10-11  Cary Coutant  <ccoutant@google.com>
6455
6456         * options.h (class General_options): Redefine -z lazy as an alias for
6457         the negation of -z now.
6458
6459 2010-10-11  Ian Lance Taylor  <iant@google.com>
6460
6461         * resolve.cc (symbol_to_bits): Report the value of the unsupported
6462         binding.
6463
6464 2010-10-06  Nick Clifton  <nickc@redhat.com>
6465
6466         * script-sections.cc(class Memory_region): Remove
6467         current_lma_offset_ field.  Rename current_vma_offset_ to
6468         current_offset_.  Add last_section_ field.
6469         (Memory_region::get_current_vma_address): Rename to
6470         get_current_address.
6471         (Memory_region::get_current_lma_address): Delete.
6472         (Memory_region::increment_vma_offset): Rename to
6473         increment_offset.
6474         (Memory_region::increment_lma_offset): Delete.
6475         (Memory_region::attributes_compatible): New method.  Returns
6476         true if the provided section is compatible with the region.
6477         (Memory_region::get_last_section): New method.  Returns the last
6478         section to use the region.
6479         (Memory_region::set_last_section): New method.  Stores the last
6480         section to use the region.
6481         (Script_sections::block_in_region): New method.  Returns true if
6482         a block of memory is contained within a region.
6483         (Script_sections::find_memory_region): New method.  Locates a
6484         memory region to be used to set a VMA or LMA address.
6485         (Output_section_definition::set_section_addresses): Add code to
6486         check for addresses set by memory regions.
6487         (Output_segment::set_section_addresses): Remove memory region
6488         walking code.
6489         (Script_sections::create_segment): Add a warning if a header
6490         segment is created outside of any region.
6491         * script-sections.h (class Script_sections): Add prototypes for
6492         find_memory_region and block_in_region methods.
6493         * testsuite/memory_test.s: Use .long instead of .word.
6494         * testsuite/memory_test.t: Add some more output sections.
6495         * testsuite/memory_test.sh: Update expected output.
6496
6497 2010-10-02  Doug Kwan  <dougkwan@google.com>
6498
6499         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
6500         defintion to symtab.h
6501         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
6502         declaration to defintion.
6503
6504 2010-10-01  Nick Clifton  <nickc@redhat.com>
6505
6506         * expression.cc (eval): Replace dummy argument with NULL.
6507         (eval_maybe_dot): Check for a NULL result section pointer.
6508         (Symbol_expression::value): Likewise.
6509         (Dot_expression::value): Likewise.
6510         (BINARY_EXPRESSION): Likewise.
6511         (Max_expression::value): Likewise.
6512         (Min_expression::value): Likewise.
6513         (Absolute_expression::value): Likewise.
6514         (Addr_expression::value_from_output_section): Likewise.
6515         (Loaddddr_expression::value_from_output_section): Likewise.
6516         (Segment_start_expression::value): Likewise.
6517         * script-sections.cc
6518         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
6519         argument with NULL.
6520         (Sections_elememt_dot_assignment::set_section_addresses):
6521         Likewise.
6522         (Output_data_expression::do_write_to_buffer): Likewise.
6523         (Output_section_definition::finalize_symbols): Likewise.
6524         (Output_section_definition::set_section_addresses): Likewise.
6525
6526 2010-09-30  Doug Kwan  <dougkwan@google.com>
6527
6528         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
6529
6530 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
6531
6532         * target.h (Target::can_icf_inline_merge_sections): New virtual
6533         function.
6534         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
6535         virtual function.
6536         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
6537         virtual function.
6538         * icf.cc (get_section_contents): Inline merge sections only when
6539         target allows it.
6540
6541 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6542
6543         * configure: Regenerate.
6544
6545 2010-09-17  Ian Lance Taylor  <iant@google.com>
6546
6547         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
6548         * testsuite/Makefile.am (memory_test.o): New target.
6549         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
6550         memory_test.t.
6551         * testsuite/Makefile.in: Rebuild.
6552
6553 2010-09-17  Doug Kwan  <dougkwan@google.com>
6554
6555         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
6556         defintion if relocation uses GOT entries of the symbol.
6557         * testsuite/icf_safe_test.sh: Fix test.
6558         * testsuite/icf_safe_so_test.sh: Fix test.
6559
6560 2010-09-16  Cary Coutant  <ccoutant@google.com>
6561
6562         * script_sections.cc (class Memory_region): Remove "NULL" from
6563         vector initializations.
6564
6565 2010-09-15  Cary Coutant  <ccoutant@google.com>
6566
6567         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
6568         Resolve forwarding symbols.
6569
6570 2010-09-15  Doug Kwan  <dougkwan@google.com>
6571
6572         * gold/testsuite/script_test_3.t: Add ARM special sections.
6573         * gold/testsuite/script_test_4.t: Same.
6574         * gold/testsuite/script_test_5.t: Same.
6575         * gold/testsuite/script_test_6.t: Same.
6576         * gold/testsuite/script_test_7.t: Same.
6577         * gold/testsuite/script_test_7.t: Same.
6578         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
6579
6580 2010-09-14  Cary Coutant  <ccoutant@google.com>
6581
6582         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
6583         (Target_x86_64::Relocate::relocate_tls): Replace check for
6584         saw_tls_block_reloc_ with test for executable section.
6585
6586 2010-09-12  Cary Coutant  <ccoutant@google.com>
6587
6588         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
6589         position-independent executables to shared libraries need dynamic
6590         relocations.
6591         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
6592         position-independent executables.
6593         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
6594         * testsuite/Makefile.in: Regenerate.
6595
6596 2010-09-10  Nick Clifton  <nickc@redhat.com>
6597
6598         PR gold/11997
6599         * testsuite/memory_test.t: Discard any sections that are not
6600         needed.
6601
6602 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
6603
6604         PR gold/11996
6605         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
6606         "This::" to work around a bug in gcc 4.2.
6607
6608         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
6609
6610 2010-09-09  Rafael Espindola  <espindola@google.com>
6611
6612         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
6613         sections with different PF_X flags in the same segment.
6614         (Layout::find_first_load_seg): Search all segments to find the first
6615         one.
6616         * options.h (rosegment): New.
6617
6618 2010-09-08  Rafael Espindola  <espindola@google.com>
6619
6620         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
6621
6622 2010-09-08  Doug Kwan  <dougkwan@google.com>
6623
6624         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
6625         (Arm_relobj::do_relocate_sections): Add new parameter for output
6626         file to match the parent.
6627         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
6628         of local symbols instead of input values.  Update code to track
6629         changes in gold::relocate_section.
6630         * object.cc (Sized_relobj::compute_final_local_value): New methods.
6631         (Sized_relobj::compute_final_local_value_internal): New methods.
6632         (Sized_relobj::do_finalize_local_symbols): Move code from loop
6633         body into private version of Sized_relobj::compute_final_local_value.
6634         Call the inline method.
6635         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
6636         merged symbol value if there is one.
6637         (Symbol_value::has_output_value): New method defintiion.
6638         (Sized_relobj::Compute_final_local_value_status): New enum type.
6639         (Sized_relobj::compute_final_local_value): New methods.
6640         (Sized_relobj::compute_final_local_value_internal): New methods.
6641         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
6642         and arm_cortex_a8.sh.
6643         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
6644         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
6645         New tests.
6646         * Makefile.in: Regenerate.
6647         * testsuite/arm_bl_out_of_range.s: Update test.
6648         * testsuite/thumb_bl_out_of_range.s: Ditto.
6649         * testsuite/thumb_blx_out_of_range.s: Ditto.
6650         * testsuite/arm_branch_out_of_range.sh: New file.
6651         * testsuite/arm_cortex_a8.sh: Ditto.
6652         * testsuite/arm_cortex_a8_b.s: Ditto.
6653         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
6654         * testsuite/arm_cortex_a8_b_local.s: Ditto.
6655         * testsuite/arm_cortex_a8_bl.s: Ditto.
6656         * testsuite/arm_cortex_a8_blx.s: Ditto.
6657         * testsuite/arm_cortex_a8_local.s: Ditto.
6658         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
6659         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
6660
6661 2010-09-08  Rafael Espindola  <espindola@google.com>
6662
6663         * Makefile.am (memory_test.stdout): Run readelf with -W.
6664         * Makefile.in: Regenerate.
6665         * testsuite/memory_test.sh: Make the regexps accept both 32 and
6666         64 bit output.
6667
6668 2010-09-08  Rafael Espindola  <espindola@google.com>
6669
6670         * script-sections.cc (Script_sections::add_memory_region): Convert
6671         field precision to int.
6672         * script.cc (script_set_section_region, script_set_section_region):
6673         Convert field precision to int.
6674
6675 2010-09-08  Rafael Espindola  <espindola@google.com>
6676
6677         * arm.cc (do_finalize_sections): Create the __exidx_start and
6678         __exdix_end symbols even when the section is missing.
6679
6680 2010-09-08  Nick Clifton  <nickc@redhat.com>
6681
6682         * README: Remove claim that MEMORY is not supported.
6683         * expression.cc (script_exp_function_origin)
6684         (script_exp_function_length): Move from here to ...
6685         * script.cc: ... here.
6686         (script_set_section_region, script_add_memory)
6687         (script_parse_memory_attr, script_include_directive): New
6688         functions.
6689         * script-sections.cc
6690         (class Memory_region): New class.
6691         (class Output_section_definition): Add set_memory_region,
6692         set_section_vma, set_section_lma and get_section_name methods.
6693         (class Script_Sections): Add add_memory_region,
6694         find_memory_region, find_memory_region_origin,
6695         find_memory_region_length and set_memory_region methods.
6696         Have set_section_addresses method walk the list of set memory
6697         regions.
6698         Extend the print methos to display memory regions.
6699         * script-sections.h: Add prototypes for new methods.
6700         Add enum for MEMORY region attributes.
6701         * yyscript.y: Add support for parsing MEMORY regions.
6702         * script-c.h: Add prototypes for new functions.
6703         * testsuite/Makefile.am: Add test of MEMORY region functionality.
6704         * testsuite/Makefile.in: Regenerate.
6705         * testsuite/memory_test.sh: New script.
6706         * testsuite/memory_test.s: New assembler source file.
6707         * testsuite/memory_test.t: New linker script.
6708
6709 2010-08-27  Doug Kwan  <dougkwan@google.com>
6710
6711         * gold/resolve.cc (Symbol_table::should_override): Let a weak
6712         reference override an existing dynamic weak reference.
6713         * testsuite/Makefile.am: Add new test dyn_weak_ref.
6714         * testsuite/Makefile.in: Regenerate.
6715         * testsuite/dyn_weak_ref.sh: New file.
6716         * testsuite/dyn_weak_ref_1.c: Ditto.
6717         * testsuite/dyn_weak_ref_2.c: Ditto.
6718
6719 2010-08-27  Ian Lance Taylor  <iant@google.com>
6720
6721         * incremental.h (class Incremental_input_entry): Add virtual
6722         destructor.
6723
6724 2010-08-27  Ian Lance Taylor  <iant@google.com>
6725
6726         * testsuite/start_lib_test_3.c: Mark t3 as used.
6727
6728 2010-08-27  Nick Clifton  <nickc@redhat.com>
6729
6730         * options.cc (version_script): Fix small typo in previous
6731         whitespace tidyup.
6732
6733 2010-08-25  Nick Clifton  <nickc@redhat.com>
6734
6735         * archive.cc: Formatting fixes: Remove whitespace between
6736         typename and following asterisk.  Remove whitespace between
6737         function name and opening parenthesis.
6738         * archive.h: Likewise.
6739         * arm.cc: Likewise.
6740         * attributes.cc: Likewise.
6741         * attributes.h: Likewise.
6742         * common.cc: Likewise.
6743         * copy-relocs.cc: Likewise.
6744         * dirsearch.h: Likewise.
6745         * dynobj.cc: Likewise.
6746         * ehframe.cc: Likewise.
6747         * ehframe.h: Likewise.
6748         * expression.cc: Likewise.
6749         * fileread.cc: Likewise.
6750         * fileread.h: Likewise.
6751         * gc.h: Likewise.
6752         * gold-threads.cc: Likewise.
6753         * gold.cc: Likewise.
6754         * i386.cc: Likewise.
6755         * icf.h: Likewise.
6756         * incremental-dump.cc: Likewise.
6757         * incremental.cc: Likewise.
6758         * layout.cc: Likewise.
6759         * layout.h: Likewise.
6760         * main.cc: Likewise.
6761         * merge.cc: Likewise.
6762         * merge.h: Likewise.
6763         * object.cc: Likewise.
6764         * object.h: Likewise.
6765         * options.cc: Likewise.
6766         * options.h: Likewise.
6767         * output.cc: Likewise.
6768         * output.h: Likewise.
6769         * plugin.cc: Likewise.
6770         * plugin.h: Likewise.
6771         * powerpc.cc: Likewise.
6772         * reloc.cc: Likewise.
6773         * script-c.h: Likewise.
6774         * script-sections.cc: Likewise.
6775         * script.cc: Likewise.
6776         * stringpool.cc: Likewise.
6777         * symtab.cc: Likewise.
6778         * symtab.h: Likewise.
6779         * target.cc: Likewise.
6780         * timer.cc: Likewise.
6781         * timer.h: Likewise.
6782         * version.cc: Likewise.
6783         * x86_64.cc: Likewise.
6784
6785 2010-08-24  Nick Clifton  <nickc@redhat.com>
6786
6787         PR 11899
6788         * layout.cc (segment_precedes): Sort segments by their physical
6789         addresses, if they have been set.
6790
6791 2010-08-23  Cary Coutant  <ccoutant@google.com>
6792
6793         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
6794         symbols data.
6795         (Lib_group::include_member): Unlock object after deleting its
6796         symbols data.
6797         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
6798         the bug fixed here.
6799
6800 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
6801             Cary Coutant  <ccoutant@google.com>
6802
6803         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
6804         constructor, and set_blocker.
6805         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
6806         readsyms_blocker_.
6807         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
6808         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
6809         * testsuite/Makefile.am (start_lib_test): New test case.
6810         * testsuite/Makefile.in: Regenerate.
6811         * testsuite/start_lib_test_main.c: New file.
6812         * testsuite/start_lib_test_1.c: New file.
6813         * testsuite/start_lib_test_2.c: New file.
6814         * testsuite/start_lib_test_3.c: New file.
6815
6816 2010-08-19  Ian Lance Taylor  <iant@google.com>
6817
6818         * Makefile.in: Rebuild with automake 1.11.1.
6819         * aclocal.m4: Likewise.
6820         * testsuite/Makefile.in: Likewise.
6821
6822 2010-08-19  Ian Lance Taylor  <iant@google.com>
6823
6824         PR 10893
6825         * i386.cc (class Output_data_plt_i386): Update declarations.
6826         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
6827         local_ifuncs_ fields.
6828         (Target_i386::do_plt_section_for_global): New function.
6829         (Target_i386::do_plt_section_for_local): New function.
6830         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
6831         parameter; change all callers.  Initialize global_ifuncs_ and
6832         local_ifuncs_.  If doing a static link define __rel_iplt_start and
6833         __rel_iplt_end.
6834         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
6835         (Output_data_plt_i386::add_local_ifunc_entry): New function.
6836         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
6837         symbols.
6838         (Target_i386::make_plt_section): New function, broken out of
6839         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
6840         (Target_i386::make_plt_entry): Call make_plt_section.
6841         (Target_i386::make_local_ifunc_plt_entry): New function.
6842         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
6843         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
6844         R_386_IRELATIVE to switch.
6845         (Target_i386::Scan::global): Likewise.
6846         (Target_i386::Relocate::relocate): Likewise.
6847         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
6848         switch.
6849         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
6850         (Target_x86_64::do_plt_section_for_global): New function.
6851         (Target_x86_64::do_plt_section_for_local): New function.
6852         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
6853         parameter; change all callers.  If doing a static link define
6854         __rela_iplt_start and __rela_iplt_end.
6855         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
6856         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
6857         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
6858         to point to .plt.
6859         (Target_x86_64::make_local_ifunc_plt_entry): New function.
6860         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
6861         switch.
6862         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
6863         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
6864         R_X86_64_IRELATIVE to switch.
6865         (Target_x86_64::Scan::global): Likewise.
6866         (Target_x86_64::Relocate::relocate): Likewise.
6867         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
6868         switch.
6869         * target.h (class Target): Add plt_section_for_global and
6870         plt_section_for_local functions.  Add do_plt_section_for_global
6871         and do_plt_section_for_local virtual functions.
6872         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
6873         clarifying comments.
6874         (Symbol::use_plt_offset): Handle IFUNC symbol.
6875         * object.cc (Sized_relobj::Sized_relobj): Initialize
6876         local_plt_offsets_.
6877         (Sized_relobj::local_has_plt_offset): New function.
6878         (Sized_relobj::local_plt_offset): New function.
6879         (Sized_relobj::set_local_plt_offset): New function.
6880         (Sized_relobj::do_count): Handle IFUNC symbol.
6881         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
6882         a bit away from input_shndx_ field.  Add set_is_func_symbol and
6883         is_ifunc_symbol functions.
6884         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
6885         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
6886         local_plt_offsets_ field.
6887         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
6888         * output.h (class Output_section_data): Add non-const
6889         output_section function.
6890         (class Output_data_got): Update declarations.
6891         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
6892         Add use_plt_offset parameter to global and local constructors.
6893         Change all callers.  Change local_sym_index_ field to 31 bits.
6894         Change GSYM_CODE and CONSTANT_CODE accordingly.
6895         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
6896         doing a static link don't set sh_link field.
6897         (Output_data_got::Got_entry::write): Use PLT offset if
6898         appropriate.
6899         (Output_data_got::add_global_plt): New function.
6900         (Output_data_got::add_local_plt): New function.
6901         * target-reloc.h (relocate_section): Handle IFUNC symbol.
6902         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
6903         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
6904         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
6905         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
6906         IFUNC conditional.
6907         * testsuite/ifunc-sel.h: New file.
6908         * testsuite/ifuncmain1.c: New file.
6909         * testsuite/ifuncmain1vis.c: New file.
6910         * testsuite/ifuncmod1.c: New file.
6911         * testsuite/ifuncdep2.c: New file.
6912         * testsuite/ifuncmain2.c: New file.
6913         * testsuite/ifuncmain3.c: New file.
6914         * testsuite/ifuncmod3.c: New file.
6915         * testsuite/ifuncmain4.c: New file.
6916         * testsuite/ifuncmain5.c: New file.
6917         * testsuite/ifuncmod5.c: New file.
6918         * testsuite/ifuncmain6pie.c: New file.
6919         * testsuite/ifuncmod6.c: New file.
6920         * testsuite/ifuncmain7.c: New file.
6921         * configure, testsuite/Makefile.in: Rebuild.
6922
6923 2010-08-18  Ian Lance Taylor  <iant@google.com>
6924
6925         * incremental.cc
6926         (Output_section_incremental_inputs::write_input_files): Add cast
6927         to avoid signed/unsigned comparison warning.
6928         (Output_section_incremental_inputs::write_info_blocks): Likewise.
6929
6930 2010-08-12  Cary Coutant  <ccoutant@google.com>
6931
6932         * common.cc (Sort_commons::operator()): Remove unnecessary code.
6933
6934 2010-08-13  Ian Lance Taylor  <iant@google.com>
6935
6936         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
6937
6938 2010-08-12  Cary Coutant  <ccoutant@google.com>
6939             Doug Kwan  <dougkwan@google.com>
6940
6941         * resolve.cc (Symbol_table::should_override): When a weak dynamic
6942         defintion overrides non-weak undef, remember that the original undef
6943         is not weak.
6944         * symtab.cc (Symbol_table::sized_write_global): For undef without
6945         an original weak binding, set binding to global in output.
6946         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
6947         * testsuite/Makefile.in: Regenerate.
6948         * testsuite/strong_ref_weak_def.sh: New file.
6949         * testsuite/strong_ref_weak_def_1.c: Ditto.
6950         * testsuite/strong_ref_weak_def_2.c: Ditto.
6951
6952 2010-08-12  Cary Coutant  <ccoutant@google.com>
6953
6954         * testsuite/incremental_test.sh: Rewrite.
6955         * testsuite/incremental_test_1.c: Rewrite.
6956         * testsuite/incremental_test_2.c: Rewrite.
6957
6958 2010-08-12  Cary Coutant  <ccoutant@google.com>
6959
6960         * arm.cc (Target_arm::got_size): Add const.
6961         (Target_arm::got_entry_count): New function.
6962         (Target_arm::plt_entry_count): New function.
6963         (Target_arm::first_plt_entry_offset): New function.
6964         (Target_arm::plt_entry_size): New function.
6965         (Output_data_plt_arm::entry_count): New function.
6966         (Output_data_plt_arm::first_plt_entry_offset): New function.
6967         (Output_data_plt_arm::get_plt_entry_size): New function.
6968         * i386.cc (Target_i386::got_size): Add const.
6969         (Target_i386::got_entry_count): New function.
6970         (Target_i386::plt_entry_count): New function.
6971         (Target_i386::first_plt_entry_offset): New function.
6972         (Target_i386::plt_entry_size): New function.
6973         (Output_data_plt_i386::entry_count): New function.
6974         (Output_data_plt_i386::first_plt_entry_offset): New function.
6975         (Output_data_plt_i386::get_plt_entry_size): New function.
6976         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
6977         find_incremental_inputs_sections.  Dump incremental_got_plt section.
6978         * incremental.cc: Include target.h.
6979         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
6980         parameter.  Adjust all callers.  Find incremental_got_plt section.
6981         (Incremental_inputs::create_data_sections): Create incremental_got_plt
6982         section.
6983         (Output_section_incremental_inputs::set_final_data_size): Calculate
6984         size of incremental_got_plt section.
6985         (Output_section_incremental_inputs::do_write): Write the
6986         incremental_got_plt section.
6987         (Got_plt_view_info): New struct.
6988         (Local_got_offset_visitor): New class.
6989         (Global_got_offset_visitor): New class.
6990         (Global_symbol_visitor_got_plt): New class.
6991         (Output_section_incremental_inputs::write_got_plt): New function.
6992         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
6993         Add parameter.  Adjust all callers.
6994         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
6995         (Incremental_inputs::got_plt_section): New function.
6996         (Incremental_inputs::got_plt_section_): New data member.
6997         (Incremental_got_plt_reader): New class.
6998         * layout.cc (Layout::create_incremental_info_sections): Add the
6999         incremental_got_plt section.
7000         * object.h (Got_offset_list::get_list): New function.
7001         (Got offset_list::for_all_got_offsets): New function.
7002         (Sized_relobj::local_got_offset_list): New function.
7003         * powerpc.cc (Target_powerpc::got_size): Add const.
7004         (Target_powerpc::got_entry_count): New function.
7005         (Target_powerpc::plt_entry_count): New function.
7006         (Target_powerpc::first_plt_entry_offset): New function.
7007         (Target_powerpc::plt_entry_size): New function.
7008         (Output_data_plt_powerpc::entry_count): New function.
7009         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
7010         (Output_data_plt_powerpc::get_plt_entry_size): New function.
7011         * sparc.cc (Target_sparc::got_size): Add const.
7012         (Target_sparc::got_entry_count): New function.
7013         (Target_sparc::plt_entry_count): New function.
7014         (Target_sparc::first_plt_entry_offset): New function.
7015         (Target_sparc::plt_entry_size): New function.
7016         (Output_data_plt_sparc::entry_count): New function.
7017         (Output_data_plt_sparc::first_plt_entry_offset): New function.
7018         (Output_data_plt_sparc::get_plt_entry_size): New function.
7019         * symtab.h (Symbol::got_offset_list): New function.
7020         (Symbol_table::for_all_symbols): New function.
7021         * target.h (Sized_target::got_entry_count): New function.
7022         (Sized_target::plt_entry_count): New function.
7023         (Sized_target::plt_entry_size): New function.
7024         * x86_64.cc (Target_x86_64::got_size): Add const.
7025         (Target_x86_64::got_entry_count): New function.
7026         (Target_x86_64::plt_entry_count): New function.
7027         (Target_x86_64::first_plt_entry_offset): New function.
7028         (Target_x86_64::plt_entry_size): New function.
7029         (Output_data_plt_x86_64::entry_count): New function.
7030         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
7031         (Output_data_plt_x86_64::get_plt_entry_size): New function.
7032
7033 2010-08-12  Cary Coutant  <ccoutant@google.com>
7034
7035         * archive.cc: Include incremental.h.
7036         (Archive::Archive): Initialize incremental_info_.
7037         (Archive::include_member): Record archive members in incremental info.
7038         (Add_archive_symbols::run): Record begin and end of an archive in
7039         incremental info.
7040         (Lib_group::include_member): Record objects in incremental info.
7041         * archive.h (Incremental_archive_entry): Forward declaration.
7042         (Archive::set_incremental_info): New member function.
7043         (Archive::incremental_info): New member function.
7044         (Archive::Unused_symbol_iterator): New class.
7045         (Archive::unused_symbols_begin): New member function.
7046         (Archive::unused_symbols_end): New member function.
7047         (Archive::incremental_info_): New data member.
7048         * incremental-dump.cc (find_input_containing_global): New function.
7049         (dump_incremental_inputs): Dump new incremental info sections.
7050         * incremental.cc: Include symtab.h.
7051         (Output_section_incremental_inputs): New class.
7052         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
7053         new incremental info sections.
7054         (Sized_incremental_binary::do_check_inputs): Likewise.
7055         (Incremental_inputs::report_archive): Remove.
7056         (Incremental_inputs::report_archive_begin): New function.
7057         (Incremental_inputs::report_archive_end): New function.
7058         (Incremental_inputs::report_object): New function.
7059         (Incremental_inputs::finalize_inputs): Remove.
7060         (Incremental_inputs::report_input_section): New function.
7061         (Incremental_inputs::report_script): Rewrite.
7062         (Incremental_inputs::finalize): Do nothing but finalize string table.
7063         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
7064         (Incremental_inputs::sized_create_inputs_section_data): Remove.
7065         (Incremental_inputs::create_data_sections): New function.
7066         (Incremental_inputs::relocs_entsize): New function.
7067         (Output_section_incremental_inputs::set_final_data_size): New function.
7068         (Output_section_incremental_inputs::do_write): New function.
7069         (Output_section_incremental_inputs::write_header): New function.
7070         (Output_section_incremental_inputs::write_input_files): New function.
7071         (Output_section_incremental_inputs::write_info_blocks): New function.
7072         (Output_section_incremental_inputs::write_symtab): New function.
7073         * incremental.h (Incremental_script_entry): Forward declaration.
7074         (Incremental_object_entry): Forward declaration.
7075         (Incremental_archive_entry): Forward declaration.
7076         (Incremental_inputs): Forward declaration.
7077         (Incremental_inputs_header_data): Remove.
7078         (Incremental_inputs_header): Remove.
7079         (Incremental_inputs_header_write): Remove.
7080         (Incremental_inputs_entry_data): Remove.
7081         (Incremental_inputs_entry): Remove.
7082         (Incremental_inputs_entry_write): Remove.
7083         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
7084         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
7085         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
7086         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
7087         Likewise.
7088         (Incremental_input_entry): New class.
7089         (Incremental_script_entry): New class.
7090         (Incremental_object_entry): New class.
7091         (Incremental_archive_entry): New class.
7092         (Incremental_inputs::Incremental_inputs): Initialize new data members.
7093         (Incremental_inputs::report_inputs): Remove.
7094         (Incremental_inputs::report_archive): Remove.
7095         (Incremental_inputs::report_archive_begin): New function.
7096         (Incremental_inputs::report_archive_end): New function.
7097         (Incremental_inputs::report_object): Change prototype.
7098         (Incremental_inputs::report_input_section): New function.
7099         (Incremental_inputs::report_script): Change prototype.
7100         (Incremental_inputs::get_reloc_count): New function.
7101         (Incremental_inputs::set_reloc_count): New function.
7102         (Incremental_inputs::create_data_sections): New function.
7103         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
7104         (Incremental_inputs::inputs_section): New function.
7105         (Incremental_inputs::symtab_section): New function.
7106         (Incremental_inputs::relocs_section): New function.
7107         (Incremental_inputs::get_stringpool): Add const.
7108         (Incremental_inputs::command_line): Add const.
7109         (Incremental_inputs::inputs): Remove.
7110         (Incremental_inputs::command_line_key): New function.
7111         (Incremental_inputs::input_file_count): New function.
7112         (Incremental_inputs::input_files): New function.
7113         (Incremental_inputs::relocs_entsize): New function.
7114         (Incremental_inputs::sized_create_inputs_section_data): Remove.
7115         (Incremental_inputs::finalize_inputs): Remove.
7116         (Incremental_inputs::Input_info): Remove.
7117         (Incremental_inputs::lock_): Remove.
7118         (Incremental_inputs::inputs_): Change type.
7119         (Incremental_inputs::inputs_map_): Remove.
7120         (Incremental_inputs::current_object_entry_): New data member.
7121         (Incremental_inputs::inputs_section_): New data member.
7122         (Incremental_inputs::symtab_section_): New data member.
7123         (Incremental_inputs::relocs_section_): New data member.
7124         (Incremental_inputs::reloc_count_): New data member.
7125         (Incremental_inputs_reader): New class.
7126         (Incremental_symtab_reader): New class.
7127         (Incremental_relocs_reader): New class.
7128         * layout.cc (Layout::finalize): Move finalization of incremental info
7129         and creation of incremental info sections to follow finalization of
7130         symbol table.  Set offsets for postprocessing sections.
7131         (Layout::create_incremental_info_sections): Call
7132         Incremental_inputs::create_data_sections.  Add incremental symtab
7133         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
7134         sections to layout after input sections.
7135         * layout.h (struct Timespec): Forward declaration.
7136         (Layout::incremental_inputs): Add const.
7137         (Layout::create_incremental_info_sections): Add parameter.
7138         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
7139         * object.cc: Include incremental.h.
7140         (Relobj::finalize_incremental_relocs): New function.
7141         (Sized_relobj::do_layout): Record input sections in incremental info.
7142         * object.h (Object::output_section): New function.
7143         (Object::output_section_offset): Moved from Relobj.
7144         (Object::get_incremental_reloc_base): New function.
7145         (Object::get_incremental_reloc_count): New function.
7146         (Object::do_output_section): New function.
7147         (Object::do_output_section_offset): Moved from Relobj.
7148         (Object::do_get_incremental_reloc_base): New function.
7149         (Object::do_get_incremental_reloc_count): New function.
7150         (Object::Object): Initialize new data members.
7151         (Relobj::output_section): Renamed do_output_section and moved to
7152         protected.
7153         (Relobj::output_section_offset): Moved to Object.
7154         (Relobj::do_get_incremental_reloc_base): New function.
7155         (Relobj::do_get_incremental_reloc_count): New function.
7156         (Relobj::allocate_incremental_reloc_counts): New function.
7157         (Relobj::count_incremental_reloc): New function.
7158         (Relobj::finalize_incremental_relocs): New function.
7159         (Relobj::next_incremental_reloc_index): New function.
7160         (Relobj::reloc_counts_): New data member.
7161         (Relobj::reloc_bases_): New data member.
7162         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
7163         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
7164         (Sized_relobj::incremental_relocs_scan): New function.
7165         (Sized_relobj::incremental_relocs_scan_reltype): New function.
7166         (Sized_relobj::incremental_relocs_write): New function.
7167         (Sized_relobj::incremental_relocs_write_reltype): New function.
7168         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
7169         incremental link.
7170         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
7171         archives and object files elsewhere.
7172         (Add_symbols::run): Report object files here.
7173         (Finish_group::run): Report end of archive at end of group.
7174         * reloc.cc: Include layout.h, incremental.h.
7175         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
7176         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
7177         (Sized_relobj::incremental_relocs_scan): New function.
7178         (Sized_relobj::incremental_relocs_scan_reltype): New function.
7179         (Sized_relobj::do_relocate_sections): Write incremental relocations.
7180         (Sized_relobj::incremental_relocs_write): New function.
7181         (Sized_relobj::incremental_relocs_write_reltype): New function.
7182         * script.cc (read_input_script): Rewrite test for incremental link.
7183         Change call to Incremental_inputs::report_script.
7184         * symtab.h (Symbol_table::first_global_index): New function.
7185         (Symbol_table::output_count): New function.
7186
7187 2010-08-12  Doug Kwan  <dougkwan@google.com>
7188
7189         * arm.cc (Target_arm::merge_object_attributes): Check command line
7190         options --no-wchar-size-warning and --no-enum-size-warning.
7191         * options.h (General_options): Add ld-compatible options
7192         --no-enum-size-warning and --no-wchar-size-warning.
7193
7194 2010-08-04  Ian Lance Taylor  <iant@google.com>
7195
7196         * x86_64.cc (Target_x86_64::Scan::local): Use
7197         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
7198         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
7199         (Target_x86_64::Scan::global): Likewise.
7200         (Target_x86_64::Relocate::relocate): Likewise.
7201         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
7202         Likewise.
7203
7204 2010-08-03  Cary Coutant  <ccoutant@google.com>
7205
7206         * merge.cc (Output_merge_string::do_add_input_section): Count strings
7207         to reserve space in merged_strings vector. Keep total input size
7208         for stats.
7209         (Output_merge_string::do_print_merge_stats): Print total input size.
7210         * merge.h (Output_merge_string): Add input_size_ field.
7211         * stringpool.cc (Stringpool_template::string_length): Move
7212         implementations out of Stringpool_template class and place in
7213         stringpool.h.
7214         * stringpool.h (string_length): Move out of Stringpool_template.
7215
7216 2010-08-03  Ian Lance Taylor  <iant@google.com>
7217
7218         PR 11712
7219         * layout.cc (relaxation_loop_body): If address of load segment is
7220         set, adjust address to include headers if possible.
7221
7222 2010-08-03  Ian Lance Taylor  <iant@google.com>
7223
7224         * version.cc (version_string): Bump to 1.10.
7225
7226 2010-08-03  Ian Lance Taylor  <iant@google.com>
7227
7228         PR 11805
7229         * layout.h (enum Output_section_order): Define.
7230         (class Layout): Update declarations.
7231         * layout.cc (Layout::get_output_section): Add order parameter.
7232         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
7233         is_first_non_relro parameters.  Change all callers.
7234         (Layout::choose_output_section): Likewise.
7235         (Layout::add_output_section_data): Likewise.
7236         (Layout::make_output_section): Likewise.  Set order.
7237         (Layout::default_section_order): New function.
7238         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
7239         * output.cc (Output_section::Output_section): Initialize order_.
7240         Don't initialize deleted fields.
7241         (Output_segment::Output_segment): Don't initialize deleted
7242         fields.
7243         (Output_segment::add_output_section_to_load): New function
7244         replacing add_output_section.  Change all callers to call this or
7245         add_output_section_to_nonload.
7246         (Output_segment::add_output_section_to_nonload): New function.
7247         (Output_segment::remove_output_section): Rewrite.
7248         (Output_segment::add_initial_output_data): Likewise.
7249         (Output_segment::has_any_data_sections): Likewise.
7250         (Output_segment::is_first_section_relro): Likewise.
7251         (Output_segment::maximum_alignment): Likewise.
7252         (Output_segment::has_dynamic_reloc): New function replacing
7253         dynamic_reloc_count.  Change all callers.
7254         (Output_segment::has_dynamic_reloc_list): New function replacing
7255         dynamic_reloc_count_list.  Change all callers.
7256         (Output_segment::set_section_addresses): Rewrite.
7257         (Output_segment::set_offset): Rewrite.
7258         (Output_segment::find_first_and_last_list): Remove.
7259         (Output_segment::set_tls_offsets): Rewrite.
7260         (Output_segment::first_section_load_address): Likewise.
7261         (Output_segment::output_section_count): Likewise.
7262         (Output_segment::section_with_lowest_load_address): Likewise.
7263         (Output_segment::write_section_headers): Likewise.
7264         (Output_segment::print_sections_to_map): Likewise.
7265         * output.h (class Output_data): Remove dynamic_reloc_count_
7266         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
7267         (Output_data::add_dynamic_reloc): Rewrite.
7268         (Output_data::has_dynamic_reloc): New function.
7269         (Output_data::dynamic_reloc_count): Remove.
7270         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
7271         is_last_relro_, is_first_non_relro_, is_interp_,
7272         is_dynamic_linker_section_ fields.  Add order and set_order
7273         functions.  Remove is_relro_local, set_is_relro_local,
7274         is_last_relro, set_is_last_relro, is_first_non_relro,
7275         set_is_first_non_relro functions, is_interp, set_is_interp,
7276         is_dynamic_linker_section, and set_is_dynamic_linker_section
7277         functions.
7278         (class Output_segment): Change Output_data_list from std::list to
7279         std:;vector.  Add output_lists_ field.  Remove output_data_ and
7280         output_bss_ fields.  Update declarations.
7281
7282 2010-08-02  Ian Lance Taylor  <iant@google.com>
7283
7284         * arm.cc (Target_arm::gc_process_relocs): Use typename.
7285         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
7286         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
7287
7288 2010-08-02  Ian Lance Taylor  <iant@google.com>
7289
7290         PR 11855
7291         * script.cc (Script_options::Script_options): Initialize
7292         symbol_definitions_ and symbol_references_.
7293         (Script_options::add_symbol_assignment): Update
7294         symbol_definitions_ and symbol_references_.
7295         (Script_options::add_symbol_reference): New function.
7296         (script_symbol): New function.
7297         * script.h (class Script_options): Add symbol_definitions_ and
7298         symbol_references_ fields.
7299         (Script_options::referenced_const_iterator): New type.
7300         (Script_options::referenced_begin): New function.
7301         (Script_options::referenced_end): New function.
7302         (Script_options::is_referenced): New function.
7303         (Script_options::any_unreferenced): New function.
7304         * script-c.h (script_symbol): Declare.
7305         * yyscript.y (exp): Call script_symbol.
7306         * symtab.cc: Include "script.h".
7307         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
7308         Change all callers.  Check symbols referenced by scripts.
7309         (Symbol_table::add_undefined_symbols_from_command_line): Add
7310         layout parameter.  Change all callers.
7311         (Symbol_table::do_add_undefined_symbols_from_command_line):
7312         Likewise.  Break out loop body.  Check symbols referenced by
7313         scripts.
7314         (Symbol_table::add_undefined_symbol_from_command_line): New
7315         function broken out of
7316         do_add_undefined_symbols_from_command_line.
7317         * symtab.h (class Symbol_table): Update declarations.
7318         * archive.cc: Include "layout.h".
7319         (Archive::should_include_member): Add layout parameter.  Change
7320         all callers.  Check for symbol mentioned in expression.
7321         * archive.h (class Archive): Update declaration.
7322         * object.cc (Sized_relobj::do_should_include_member): Add layout
7323         parameter.
7324         * object.h (Object::should_include_member): Add layout parameter.
7325         Change all callers.
7326         (Object::do_should_include_member): Add layout parameter.
7327         (class Sized_relobj): Update declaration.
7328         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
7329         parameter.
7330         * dynobj.h (class Sized_dynobj): Update declaration.
7331         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
7332         layout parameter.
7333         * plugin.h (class Sized_pluginobj): Update declaration.
7334
7335 2010-08-02  Ian Lance Taylor  <iant@google.com>
7336
7337         PR 11866
7338         * output.cc (Output_segment::set_offset): Search for the first and
7339         last sections rather than assuming that the list is in order.
7340         (Output_segment::find_first_and_last_list): New function.
7341         * output.h (class Output_segment): Update declarations.
7342         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
7343         (relro_strip_test_SOURCES): New variable.
7344         (relro_strip_test_DEPENDENCIES): New variable.
7345         (relro_strip_test_LDFLAGS): New variable.
7346         (relro_strip_test_LDADD): New variable.
7347         (relro_strip_test.so): New target.
7348
7349 2010-08-02  Ian Lance Taylor  <iant@google.com>
7350
7351         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
7352         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
7353         (Target_i386::got_tlsdesc_section): New function.
7354         (Target_i386::got_section): Create space for GOT entries for
7355         TLSDESC relocations.
7356         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
7357         R_386_TLS_GOTDESC.
7358         (Target_i386::Scan::global): Likewise.
7359         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
7360         using TLSDESC GOT.
7361         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
7362         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
7363         (Target_x86_64::got_tlsdesc_section): New function.
7364         (Target_x86_64::got_section): Create space for GOT entries for
7365         TLSDESC relocations.
7366         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
7367         R_386_TLS_GOTDESC.
7368         (Target_x86_64::Scan::global): Likewise.
7369         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
7370         using TLSDESC GOT.
7371
7372 2010-08-02  Ian Lance Taylor  <iant@google.com>
7373
7374         * testsuite/final_layout.sh: Use dc to convert from hex to
7375         decimal.
7376
7377 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
7378
7379         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
7380         paramter to the call to gold::gc_process_relocs.
7381         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
7382         paramter to the call to gold::gc_process_relocs.
7383         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
7384         parameter to the call to gold::gc_process_relocs.
7385         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
7386         template parameter to the call to gold::gc_process_relocs.
7387         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
7388         paramter to the call to gold::gc_process_relocs.
7389         * gc.h (get_embedded_addend_size): New function.
7390         (gc_process_relocs): Save the size of the reloc for use by ICF.
7391         * icf.cc (get_section_contents): Get the addend from the text section
7392         for SHT_REL relocation sections.
7393         * icf.h (Icf::Reloc_addend_size_info): New typedef.
7394         (Icf::Reloc_info): Add new member reloc_addend_size_info.
7395         * int_encoding.h (read_from_pointer): New overloaded function.
7396         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
7397         * testsuite/icf_sht_rel_addend_test.sh: New file.
7398         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
7399         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
7400
7401 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7402
7403         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
7404         * Makefile.in: Regenerate.
7405         * testsuite/Makefile.in: Regenerate.
7406
7407 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
7408
7409         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
7410         * gold/testsuite/debug_msg.cc: Likewise.
7411         * gold/testsuite/odr_violation1.cc
7412         * gold/testsuite/odr_violation2.cc
7413
7414 2010-07-21  Cary Coutant  <ccoutant@google.com>
7415
7416         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
7417         string, and length fields.
7418         (Output_merge_string::Merged_strings_list): New type.
7419         (Output_merge_string::Merged_strings_lists): New typedef.
7420         (Output_merge_string): Replace merged_strings_ with
7421         merged_strings_lists_.
7422         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
7423         Merged_strings_list per input object and section.  Don't store pointer
7424         to the string.  Don't store length with each merged string entry.
7425         (Output_merge_string::finalize_merged_data): Loop over list of merged
7426         strings lists.  Recompute length of each merged string.
7427
7428 2010-07-15  Cary Coutant  <ccoutant@google.com>
7429
7430         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
7431         here.
7432
7433 2010-07-14  Ian Lance Taylor  <iant@google.com>
7434
7435         * descriptors.cc (Descriptors::open): Report correct name in error
7436         message.
7437
7438 2010-07-13  Doug Kwan  <dougkwan@google.com>
7439
7440         * arm.cc (Arm_input_section::Arm_input_section): For a
7441         SHT_ARM_EXIDX section, always keeps the input sections.
7442         (Arm_input_section::set_exidx_section_link): New method.
7443         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
7444         has_errors_ to false.
7445         (Arm_exidx_input_section::has_errors,
7446         Arm_exidx_input_section::set_has_errors): New methods.
7447         (Arm_exidx_input_section::has_errors_): New data member.
7448         (Arm_relobj::get_exidx_shndx_list): New method.
7449         (Arm_output_section::append_text_sections_to_list): Do not skip
7450         section without SHF_EXECINSTR.
7451         (Arm_output_section::fix_exidx_coverage): Skip input sections with
7452         errors.
7453         (Arm_relobj::make_exidx_input_section): Add new parameter for text
7454         section header.  Make error messages more verbose.  Check for
7455         a non-executable section linked to an EXIDX section.
7456         (Arm_relobj::do_read_symbols): Remove error checking, which has been
7457         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
7458         check that there is no deferred EXIDX section if we exit early.
7459         Instead of not making an EXIDX section in case of an error, make one
7460         and set the has_errors flag of it.
7461         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
7462         in a relocatable link.
7463         (Target_arm::do_relax): Look for the EXIDX output section instead of
7464         assuming that it is called .ARM.exidx.
7465         (Target_arm::fix_exidx_coverage): Add a new parameter for input
7466         section list.  Do not check for SHF_EXECINSTR section flags but
7467         skip any input section with errors.
7468         * output.cc (Output_section::Output_section): Initialize
7469         always_keeps_input_sections_ to false.
7470         (Output_section::add_input_section): Check for
7471         always_keeps_input_sections_.
7472         *  output.h (Output_section::always_keeps_input_sections,
7473         Output_section::set_always_keeps_input_sections): New methods.
7474         (Output_section::always_keeps_input_sections): New data member.
7475
7476 2010-07-13  Rafael Espindola  <espindola@google.com>
7477
7478         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
7479         * fileread.h (Input_file): Add try_extra_search_path and find_file.
7480
7481 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
7482             Ian Lance Taylor  <iant@google.com>
7483
7484         * output.h (Output_section_lookup_maps::add_merge_section):
7485         Correct check of whether value was inserted.
7486         (Output_section_lookup_maps::add_merge_input_section): Likewise.
7487         (Output_section_lookup_maps::add_relaxed_input_section):
7488         Likewise.
7489         * arm.cc (Target_arm::got_section): Remove used local os.
7490         * i386.cc (Target_i386::got_section): Likewise.
7491         * x86_64.cc (Target_x86_64::got_section): Likewise.
7492         * sparc.cc (Target_sparc::got_section): Likewise.
7493         (Target_sparc::relocate): Remove unused local have_got_offset.
7494         * powerpc.cc (Target_powerpc::relocate): Likewise.
7495
7496 2010-07-13  Ian Lance Taylor  <iant@google.com>
7497
7498         * compressed_output.cc (zlib_decompress): Fix signature in
7499         !HAVE_ZLIB_H case.
7500
7501         * archive.cc (Archive::include_member): Unlock an external member
7502         of a thin archive.  Don't bother to delete an object we know is
7503         NULL.
7504
7505 2010-07-12  Cary Coutant  <ccoutant@google.com>
7506
7507         * compressed_output.cc (zlib_decompress): New function.
7508         (get_uncompressed_size): New function.
7509         (decompress_input_section): New function.
7510         * compressed_output.h (get_uncompressed_size): New function.
7511         (decompress_input_section): New function.
7512         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
7513         Handle compressed debug sections.
7514         * layout.cc (is_compressed_debug_section): New function.
7515         (Layout::output_section_name): Map compressed section names to
7516         canonical names.
7517         * layout.h (is_compressed_debug_section): New function.
7518         (is_debug_info_section): Recognize compressed debug sections.
7519         * merge.cc: Include compressed_output.h.
7520         (Output_merge_data::do_add_input_section): Handle compressed
7521         debug sections.
7522         (Output_merge_string::do_add_input_section): Handle compressed
7523         debug sections.
7524         * object.cc: Include compressed_output.h.
7525         (Sized_relobj::Sized_relobj): Initialize new data members.
7526         (build_compressed_section_map): New function.
7527         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
7528         * object.h (Object::section_is_compressed): New method.
7529         (Object::do_section_is_compressed): New method.
7530         (Sized_relobj::Compressed_section_map): New type.
7531         (Sized_relobj::do_section_is_compressed): New method.
7532         (Sized_relobj::compressed_sections_): New data member.
7533         * output.cc (Output_section::add_input_section): Handle compressed
7534         debug sections.
7535         * reloc.cc: Include compressed_output.h.
7536         (Sized_relobj::write_sections): Handle compressed debug sections.
7537
7538 2010-07-08  Cary Coutant  <ccoutant@google.com>
7539
7540         * resolve.cc (Symbol_table::resolve): Remember whether undef was
7541         weak when resolving to a dynamic def.
7542         (Symbol_table::should_override): Add adjust_dyndef flag; set it
7543         for weak undef/dynamic def cases. Adjust callers.
7544         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
7545         undef_binding_weak_.
7546         (Symbol_table::sized_write_globals): Adjust symbol binding.
7547         (Symbol_table::sized_write_symbol): Add binding parameter.
7548         * symtab.h (Symbol::set_undef_binding): New method.
7549         (Symbol::is_undef_binding_weak): New method.
7550         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
7551         (Symbol_table::should_override): Add new parameter.
7552         (Symbol_table::sized_write_symbol): Add new parameter.
7553
7554         * testsuite/weak_undef_file1.cc: Add new test case.
7555         * testsuite/weak_undef_file2.cc: Fix header comment.
7556         * testsuite/weak_undef_test.cc: Add new test case.
7557
7558 2010-06-29  Doug Kwan  <dougkwan@google.com>
7559
7560         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
7561         Initialize USE_SYMBOL_.
7562         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
7563         definition.
7564         (Arm_reloc_property::uses_symbol_): New data member declaration.
7565         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
7566         uses symbol value and symbol is undefined but not weakly undefined.
7567
7568 2010-06-28  Rafael Espindola  <espindola@google.com>
7569
7570         * plugin.cc (Plugin::load): Use dlerror.
7571
7572 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
7573
7574         * symtab.cc (detect_odr_violations): When reporting an ODR
7575         violation, report an object where the symbol is defined.
7576
7577 2010-06-25  Doug Kwan  <dougkwan@google.com>
7578
7579         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
7580         (Target_arm::section_may_have_icf_unsafe_pointers): New method
7581         definition.
7582         (Target_arm::Scan::local_reloc_may_be_function_pointer,
7583         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
7584         target hook to detect function points.
7585         (Target_arm::Scan::possible_function_pointer_reloc): New method.
7586         * icf.h (Icf::check_section_for_function_pointers): Change type of
7587         parameter SECTION_NAME to const reference to std::string.  Use
7588         target hook to determine if section may have unsafe pointers.
7589         * target.h (Target::section_may_have_icf_unsafe_pointers): New
7590         method definition.
7591
7592 2010-06-21  Rafael Espindola  <espindola@google.com>
7593
7594         * fileread.cc (Input_file::find_fie): New
7595         (Input_file::open): Use Input_file::find_fie.
7596         * fileread.h (Input_file::find_fie): New
7597         * plugin.cc (set_extra_library_path): New.
7598         (Plugin::load): Add set_extra_library_path to the transfer vector.
7599         (Plugin_manager::set_extra_library_path): New.
7600         (Plugin_manager::add_input_file): Use the extra search path if set.
7601         (set_extra_library_path(): New.
7602         * plugin.h (Plugin_manager): Add set_extra_library_path and
7603         extra_search_path_.
7604
7605 2010-06-19  Cary Coutant  <ccoutant@google.com>
7606
7607         * layout.cc (gdb_sections): Add .debug_types.
7608         (lines_only_debug_sections): Likewise.
7609
7610 2010-06-18  Rafael Espindola  <espindola@google.com>
7611
7612         * plugin.cc (add_input_file,add_input_library)
7613         (Plugin_manager::add_input_file): Make filename arguments const.
7614         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
7615         const.
7616
7617 2010-06-16  Doug Kwan  <dougkwan@google.com>
7618
7619         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
7620         .ARM.attributes section if we have not merged any input
7621         attributes sections.
7622
7623 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7624
7625         * arm.cc: Allow combining objects with no EABI version
7626         information.
7627
7628 2010-06-15  Rafael Espindola  <espindola@google.com>
7629
7630         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
7631
7632 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7633
7634         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
7635         (struct iovec): Correct !HAVE_READV definition.
7636
7637 2010-06-10  Cary Coutant  <ccoutant@google.com>
7638
7639         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
7640         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
7641         reloc sections.
7642         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
7643
7644         PR 11683
7645         * symtab.h (Symbol::is_placeholder): New member function.
7646         * target-reloc.h (relocate_section): Check for placeholder symbols.
7647
7648         * testsuite/Makefile.am (plugin_test_8): New test.
7649         (plugin_test_9): New test.
7650         * testsuite/Makefile.in: Regenerate.
7651
7652 2010-06-09  Nick Clifton  <nickc@redhat.com>
7653
7654         * yyscript.y (input_list_element): Allow strings prefixed with
7655         the '-' character.  Treat these as libraries.
7656         * script.cc (script_add_library): New function.  Adds a library
7657         specified by "-l<name>" found in an input script.
7658         * script-c.h: Add prototype for script_add_library.
7659
7660 2010-06-07  Doug Kwan  <dougkwan@google.com>
7661
7662         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
7663         Restrict stub-group size to be within long conditional branch
7664         range when working around cortex-A8 erratum.
7665
7666 2010-06-07  Damien Diederen  <dd@crosstwine.com>
7667
7668         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
7669         #ifdef typo.
7670
7671 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
7672
7673         PR gold/11658
7674         * output.cc
7675         (Output_section::Input_section_sort_entry::compare_section_ordering):
7676         Change to return non-zero correctly.
7677         (Output_section::Input_section_sort_section_order_index_compare
7678         ::operator()): Change to fix ambiguity in comparisons.
7679
7680 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
7681
7682         * gold.h (is_wildcard_string): New function.
7683         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
7684         (Layout::layout_eh_frame): Ditto.
7685         (Layout::find_section_order_index): New method.
7686         (Layout::read_layout_from_file): New method.
7687         * layout.h (Layout::find_section_order_index): New method.
7688         (Layout::read_layout_from_file): New method.
7689         (Layout::input_section_position_): New private member.
7690         (Layout::input_section_glob_): New private member.
7691         * main.cc (main): Call read_layout_from_file here.
7692         * options.h (--section-ordering-file): New option.
7693         * output.cc (Output_section::input_section_order_specified_): New
7694         member.
7695         (Output_section::Output_section): Initialize new member.
7696         (Output_section::add_input_section): Add new parameter.
7697         Keep input sections when --section-ordering-file is used.
7698         (Output_section::set_final_data_size): Sort input sections when
7699         section ordering file is specified.
7700         (Output_section::Input_section_sort_entry): Add new parameter.
7701         Check sorting type.
7702         (Output_section::Input_section_sort_entry::compare_section_ordering):
7703         New method.
7704         (Output_section::Input_section_sort_compare::operator()): Change to
7705         consider section_order_index.
7706         (Output_section::Input_section_sort_init_fini_compare::operator()):
7707         Change to consider section_order_index.
7708         (Output_section::Input_section_sort_section_order_index_compare
7709         ::operator()): New method.
7710         (Output_section::sort_attached_input_sections): Change to sort
7711         according to section order when specified.
7712         (Output_section::add_input_section<32, true>): Add new parameter.
7713         (Output_section::add_input_section<64, true>): Add new parameter.
7714         (Output_section::add_input_section<32, false>): Add new parameter.
7715         (Output_section::add_input_section<64, false>): Add new parameter.
7716         * output.h (Output_section::add_input_section): Add new parameter.
7717         (Output_section::input_section_order_specified): New
7718         method.
7719         (Output_section::set_input_section_order_specified): New method.
7720         (Input_section::Input_section): Initialize section_order_index_.
7721         (Input_section::section_order_index): New method.
7722         (Input_section::set_section_order_index): New method.
7723         (Input_section::section_order_index_): New member.
7724         (Input_section::Input_section_sort_section_order_index_compare): New
7725         struct.
7726         (Output_section::input_section_order_specified_): New member.
7727         * script-sections.cc (is_wildcard_string): Delete and move modified
7728         method to gold.h.
7729         (Output_section_element_input::Output_section_element_input): Modify
7730         call to is_wildcard_string.
7731         (Output_section_element_input::Input_section_pattern
7732         ::Input_section_pattern): Ditto.
7733         (Output_section_element_input::Output_section_element_input): Ditto.
7734         * testsuite/Makefile.am (final_layout): New test case.
7735         * testsuite/Makefile.in: Regenerate.
7736         * testsuite/final_layout.cc: New file.
7737         * testsuite/final_layout.sh: New file.
7738
7739 2010-06-01  Rafael Espindola  <espindola@google.com>
7740
7741         * plugin.cc (Plugin::load): Pass the output name to the plugin.
7742
7743 2010-06-01  Rafael Espindola  <espindola@google.com>
7744
7745         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
7746         visibility of symbols.
7747
7748 2010-05-27  Doug Kwan  <dougkwan@google.com>
7749
7750         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
7751         from start of output section instead of address for a local symbol
7752         in a merged or relaxed section when doing a relocatable link.
7753
7754 2010-05-26  Rafael Espindola  <espindola@google.com>
7755
7756         PR 11604
7757         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
7758         adding sections the garbage collector removed.
7759         * gold/testsuite/Makefile.am: Add test.
7760         * gold/testsuite/Makefile.in: Regenerate.
7761         * gold/testsuite/plugin_test_7.sh: New.
7762         * gold/testsuite/plugin_test_7_1.c: New.
7763         * gold/testsuite/plugin_test_7_2.c: New.
7764
7765 2010-05-26  Rafael Espindola  <espindola@google.com>
7766
7767         * script-sections.cc (Output_section_definition::set_section_addresses):
7768         Check for --section-start.
7769
7770 2010-05-26  Doug Kwan  <dougkwan@google.com>
7771
7772         * arm.cc (Arm_scan_relocatable_relocs): New class.
7773         (Target_arm::relocate_special_relocatable): New method.
7774         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
7775         (Arm_relocate_functions::thumb_branch_common): Same.
7776         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
7777         instead of Default_scan_relocatable_relocs.
7778         * target-reloc.h (relocate_for_relocatable): Let target handle
7779         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
7780         * target.h (Sized_target::relocate_special_relocatable): New method.
7781
7782 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7783
7784         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
7785
7786 2010-05-23  Doug Kwan  <dougkwan@google.com>
7787
7788         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
7789         instead of a cast.
7790         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
7791         with a direct branch, not a conditional branch, to a stub.
7792         * merge.cc (Output_merge_base::record_input_section): New method
7793         defintion.
7794         (Output_merge_data::do_add_input_section): Record input section if
7795         keeps-input-sections flag is set.
7796         (Output_merge_string::do_add_input_section): Ditto.
7797         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
7798         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
7799         INPUT_SECTIONS_.
7800         (Output_merge_base::keeps_input_sections,
7801         Output_merge_base::set_keeps_input_sections,
7802         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
7803         method definitions.
7804         (Output_merge_base::Input_sections): New type declaration.
7805         (Output_merge_base::input_sections_begin,
7806         Output_merge_base::input_sections_end,
7807         Output_merge_base::do_set_keeps_input_sections): New method definitions.
7808         (Output_merge_base::bool keeps_input_sections_,
7809         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
7810         Output_merge_base::input_sections_): New data members.
7811         (Output_merge_data::do_set_keeps_input_sections): New method
7812         defintion.
7813         (Output_merge_string::do_set_keeps_input_sections): Ditto.
7814         * output.cc (Output_section::Input_section::relobj): Move method
7815         defintion from class declaration to here and handle merge sections.
7816         (Output_section::Input_section::shndx): Ditto.
7817         (Output_section::Output_section): Remove initializations of removed
7818         data members and initialize new data member LOOKUP_MAPS_.
7819         (Output_section::add_input_section): Set keeps-input-sections flag
7820         for a newly created merge output section as appropriate.  Adjust code
7821         to use Output_section_lookup_maps class.
7822         (Output_section::add_relaxed_input_section): Adjst code for lookup
7823         maps code refactoring.
7824         (Output_section::add_merge_input_section): Add a new parameter
7825         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
7826         class.  If adding input section to a newly created merge output
7827         section fails, remove the new merge section.
7828         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
7829         Adjust code for use of the Output_section_lookup_maps class.
7830         (Output_section::find_merge_section): Ditto.
7831         (Output_section::build_lookup_maps): New method defintion.
7832         (Output_section::find_relaxed_input_section): Adjust code to use
7833         Output_section_lookup_maps class.
7834         (Output_section::get_input_sections): Export merge sections.  Adjust
7835         code to use Output_section_lookup_maps class.
7836         (Output_section:::add_script_input_section): Adjust code to use
7837         Output_section_lookup_maps class.  Update lookup maps for merge
7838         sections also.
7839         (Output_section::discard_states): Use Output_section_lookup_maps.
7840         (Output_section::restore_states): Same.
7841         * output.h (Merge_section_properties): Move class defintion out of
7842         Output_section.
7843         (Output_section_lookup_maps): New class.
7844         (Output_section::Input_section::is_merge_section): New method
7845         defintion.
7846         (Output_section::Input_section::relobj): Move defintion out of class
7847         defintion.  Declare method only.
7848         (Output_section::Input_section::shndx): Ditto.
7849         (Output_section::Input_section::output_merge_base): New method defintion.
7850         (Output_section::Input_section::u2_.pomb): New union field.
7851         (Output_section::Merge_section_by_properties_map,
7852         Output_section::Output_section_data_by_input_section_map,
7853         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
7854         Remove types.
7855         (Output_section::add_merge_input_section): Add new parameter
7856         KEEPS_INPUT_SECTIONS.
7857         (Output_section::build_lookup_maps): New method declaration.
7858         (Output_section::merge_section_map_,
7859         Output_section::merge_section_by_properties_map_,
7860         Output_section::relaxed_input_section_map_,
7861         Output_section::is_relaxed_input_section_map_valid_): Remove data
7862         members.
7863         (Output_section::lookup_maps_): New data member.
7864
7865 2010-05-21  Doug Kwan  <dougkwan@google.com>
7866
7867         PR gold/11619
7868         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
7869         avoid a compilation error.
7870
7871 2010-05-19  Rafael Espindola  <espindola@google.com>
7872
7873         * script-sections.cc (Output_section_definition::allocate_to_segment):
7874         Update the phdrs_list even when the output section is NULL.
7875         * testsuite/Makefile.am: Add test.
7876         * testsuite/Makefile.in: Regenerate.
7877         * testsuite/script_test_9.cc: New.
7878         * testsuite/script_test_9.sh: New.
7879         * testsuite/script_test_9.t: New.
7880
7881 2010-05-19  Doug Kwan  <dougkwan@google.com>
7882
7883         * arm.cc (Arm_input_section::original_size): New method.
7884         (Arm_input_section::do_addralign): Add a cast.
7885         (Arm_input_section::do_output_offset): Remove static cast.
7886         (Arm_input_section::original_addralign,
7887          Arm_input_section::original_size_): Change type to uint32_t.
7888         (Arm_input_section::init): Add safe casts for section alignment
7889         and size.
7890         (Arm_input_section::set_final_data_size): Do not set address and
7891         offset of stub table.
7892         (Arm_output_section::fix_exidx_coverage): Change use of of
7893         Output_section::Simple_input_section to that of
7894         Output_section::Input_section.
7895         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
7896         except for the first pass.
7897         * output.cc (Output_section::get_input_sections): Change type of
7898         input_sections to std::list<Input_section>.
7899         (Output_section::add_script_input_section): Rename from
7900         Output_section::add_simple_input_section.  Change type of SIS
7901         parameter from Simple_input_section to Input_section.
7902         * output.h (Output_section::Simple_input_section): Remove class.
7903         (Output_section::Input_section): Change class visibility to public.
7904         (Output_section::Input_section::addralign): Use stored alignments
7905         for special input sections if set.
7906         (Output_section::Input_section::set_addralign): New method.
7907         (Output_section::get_input_sections): Change parameter type from
7908         list of Simple_input_section to list of Input_section.
7909         (Output_section::add_script_input_section): Rename from
7910         Output_section::add_simple_input_section. Change first parameter's
7911         type from Simple_input_section to Input_section and remove the
7912         second and third parameters.
7913         * script-sections.cc (Input_section::Input_section_list): Change
7914         type to list of Output_section::Input_section/
7915         (Input_section_info::Input_section_info): Change parameter type of
7916         INPUT_SECTION to Output_section::Input_section.
7917         (Input_section_info::input_section): Change return type.
7918         (Input_section_info::input_section_): Change type to
7919         Output_section::Input_section.
7920         (Output_section_element_input::set_section_addresses): Adjust code
7921         to use Output_section::Input_section instead of
7922         Output_section::Simple_input_section.  Adjust code for renaming
7923         of Output_section::add_simple_input_section.
7924         (Orphan_output_section::set_section_addresses): Ditto.
7925
7926 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7927
7928         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
7929         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
7930
7931 2010-05-18  Rafael Espindola  <espindola@google.com>
7932
7933         * options.cc (General_options::finalize): Handle -nostdlib.
7934         * options.h (nostdlib): New option.
7935         * script.cc (script_add_search_dir): Handle -nostdlib.
7936
7937 2010-05-12  Doug Kwan  <dougkwan@google.com>
7938
7939         * arm.cc (Target_arm::do_finalize_sections): Create an empty
7940         attributes section only if there no attributes section after merging.
7941         (Target_arm::merge_object_attributes): Move value of
7942         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
7943         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
7944         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
7945         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
7946         and arm_attr_merge_7.stdout.
7947         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
7948         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
7949         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
7950         arm_attr_merge_7b.o): New rules.
7951         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
7952         arm_attr_merge_7
7953         * testsuite/Makefile.in: Regenerate.
7954         * testsuite/arm_attr_merge.sh: New file.
7955         * testsuite/arm_attr_merge_[67][ab].s: Same.
7956
7957 2010-05-05  Nick Clifton  <nickc@redhat.com>
7958
7959         * po/es.po: Updated Spanish translation.
7960
7961 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
7962
7963         * Makefile.am (install-exec-local): Properly install gold as
7964         default cross linker.
7965         * Makefile.in: Regenerated.
7966
7967 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
7968             Nick Clifton  <nickc@redhat.com>
7969
7970         * configure.ac (install_as_default): Define and set to false
7971         unless --enable-gold or --enable-gold=both/gold has been
7972         specified.
7973         * configure: Regenerate.
7974
7975         * Makefile.am (install-exec-local): Install the executable as
7976         'ld.gold'.  If install_as_default is true then also install it as
7977         'ld'.
7978         * Makefile.in: Regenerated.
7979
7980 2010-04-24  Ian Lance Taylor  <iant@google.com>
7981
7982         * layout.cc (Layout::layout_reloc): In relocatable link don't
7983         combine reloc sections for grouped sections.
7984
7985 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
7986
7987         * gc.h (gc_process_relocs): Pass information on relocs pointing to
7988         sections that are not ordinary to icf.
7989         * icf.cc (get_section_contents): Handle relocation pointing to section
7990         with no object or shndx information.
7991         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
7992         * testsuite/Makefile.in: Regenerate.
7993         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
7994         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
7995
7996 2010-04-22  Ian Lance Taylor  <iant@google.com>
7997
7998         * expression.cc (Expression::Expression_eval_info): Add
7999         result_alignment_pointer field.
8000         (Expression::eval_with_dot): Add result_alignment_pointer
8001         parameter.  Change all callers.
8002         (Expression::eval_maybe_dot): Likewise.
8003         (class Binary_expression): Add alignment_pointer parameter to
8004         left_value and right_value.  Change all callers.
8005         (BINARY_EXPRESSION): Set result alignment.
8006         (class Trinary_expression): Add alignment_pointer parameter to
8007         arg2_value and arg3_value.  Change all callers.
8008         (Trinary_cond::value): Set result alignment.
8009         (Max_expression::value, Min_expression::value): Likewise.
8010         (Align_expression::value): Likewise.
8011         * script-sections.cc (class Sections_element): Add dot_alignment
8012         parameter to set_section_addresses virtual function.  Update
8013         instantiations.
8014         (class Output_section_element): Likewise.
8015         (Script_sections::create_segments): Add dot_alignment parameter.
8016         Change all callers.
8017         (Script_sections::create_segments_from_phdrs_clause): Likewise.
8018         (Script_sections::set_phdrs_clause_addresses): Likewise.
8019         * script-sections.h: Update declarations.
8020         * script.h: Update declarations.
8021         * output.h (Output_segment::set_minimum_p_align): Don't decrease
8022         min_p_align.
8023         * testsuite/script_test_3.t: Set large alignment.
8024         * testsuite/script_test_3.sh: Make sure that at least one LOAD
8025         segment has expected alignment.
8026
8027 2010-04-22  Nick Clifton  <nickc@redhat.com>
8028
8029         * po/gold.pot: Updated by the Translation project.
8030         * po/vi.po: Updated Vietnamese translation.
8031
8032 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
8033
8034         * testsuite/Makefile.am (check_PROGRAMS): Add
8035         icf_virtual_function_folding_test.
8036         * testsuite/Makefile.in: Regenerated.
8037
8038 2010-04-15  Andrew Haley  <aph@redhat.com>
8039
8040         * options.h (merge_exidx_entries): New option.
8041         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
8042         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
8043         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
8044         (Target_arm::merge_exidx_entries): New function.
8045         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
8046         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
8047         to Arm_exidx_fixup constructor.
8048         Add new arg, merge_exidx_entries.
8049         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
8050         Arm_output_section::fix_exidx_coverage.
8051
8052 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
8053
8054         * icf.cc (get_section_contents): Check for preemptible functions.
8055         Ignore addend when appropriate.
8056         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
8057         section folded.
8058         (add_from_relobj): Check for section folded.
8059         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
8060         * symtab.h (should_add_dynsym_entry): Add new parameter.
8061         * target-reloc.h (scan_relocs): Check for section folded.
8062         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
8063         Check reloc types for function pointers in shared objects.
8064         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
8065         case.
8066         (icf_preemptible_functions_test): New test case.
8067         (icf_string_merge_test): New test case.
8068         * testsuite.Makefile.in: Regenerate.
8069         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
8070         bar_glob.  Refactor code.
8071         * testsuite/icf_preemptible_functions_test.cc: New file.
8072         * testsuite/icf_preemptible_functions_test.sh: New file.
8073         * testsuite/icf_string_merge_test.cc: New file.
8074         * testsuite/icf_string_merge_test.sh: New file.
8075         * testsuite/icf_virtual_function_folding_test.cc: New file.
8076         * testsuite/icf_virtual_function_folding_test.sh: New file.
8077
8078 2010-04-14  Doug Kwan  <dougkwan@google.com>
8079
8080         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
8081         for local symbol recounting if we remove a section due to ICF.
8082         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
8083         there are no regular objects in input.
8084
8085 2010-04-13  Doug Kwan  <dougkwan@google.com>
8086
8087         * arm.cc (Arm_input_section::set_final_data_size): Compute
8088         accurate final data size instead of using current data size.
8089
8090 2010-04-09  Doug Kwan  <dougkwan@google.com>
8091
8092         * layout.cc (Layout::choose_output_section): Handle script section
8093         types.
8094         (Layout::make_output_section_for_script): Add section type parameter.
8095         Handle script section types.
8096         * layout.h (Layout::make_output_section_for_script): Add section
8097         type parameter.
8098         * output.cc (Output_section::Output_section): Initialize data member
8099         is_noload_.
8100         (Output_section::do_reset_address_and_file_offset): Do not set address
8101         to 0 if section is a NOLOAD section.
8102         * output.h (Output_section::is_noload): New method.
8103         (Output_section::set_is_noload): Ditto.
8104         (Output_section::is_noload_): New data member.
8105         * script-c.h (Script_section_type): New enum type.
8106         (struct Parser_output_section_header): Add new file section_type.
8107         * script-sections.cc (Sections_element::output_section_name): Add
8108         parameter for returning script section type.
8109         (Output_section_definition::output_section_name): Ditto.
8110         (Output_section_definition::section_type)P; New method.
8111         (Output_section_definiton::script_section_type_name): Ditto.
8112         (Output_section_definition::script_section_type_): New data member.
8113         (Output_section_definition::Output_section_definition): Initialize
8114         data member Output_section_definition::script_section_type_.
8115         (Output_section_definition::create_sections): Pass script section type
8116         to Layout::make_output_section_for_script.
8117         (Output_section_definition::output_section_name): Return script
8118         section type to caller.
8119         (Output_section_definition::set_section_address): Do not advance
8120         dot value and load address if section type is NOLOAD.  Set address
8121         of NOLOAD sections regardless of section flags.
8122         (Output_section_definition::print): Print section type if it is
8123         not SCRIPT_SECTION_TYPE_NONE.
8124         (Output_section_definition::section_type): New method.
8125         (Output_section_definition::script_section_type_name): Ditto.
8126         (Script_sections::output_section_name): Add new parameter
8127         PSECTION_TYPE for returning script section type.  Pass it to
8128         section elements.  Handle discard sections.
8129         (Sort_output_sections::operator()): Handle NOLOAD sections.
8130         * script-sections.h (Script_sections::Section_type): New enum type.
8131         (Script_sections::output_section_name): Add a new parameter for
8132         returning script section type.
8133         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
8134         INFO and NOLOAD.
8135         * yyscript.y (union): Add new field SECTION_TYPE.
8136         (COPY, DSECT, INFO, NOLOAD): New tokens.
8137         (opt_address_and_section_type): Change type to output_section_header.
8138         (section_type): New non-terminal
8139         (section_header): Handle section type.
8140         (opt_address_and_section_type): Return section type value.
8141
8142 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
8143
8144         * testsuite/plugin_common_test_1.c (foo): Add prototype.
8145         * testsuite/plugin_common_test_2.c (foo): Likewise.
8146
8147 2010-04-08  Doug Kwan  <dougkwan@google.com>
8148
8149         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
8150         Output_merge_data.
8151         * output.cc (Output_section::add_merge_input_section): Simplify
8152         code and return status of Output_merge_base::add_input_section.
8153         Update merge section map only if Output_merge_base::add_input_section
8154         returns true.
8155
8156 2010-04-07  Doug Kwan  <dougkwan@google.com>
8157
8158         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
8159         if section is marked as containing instructions but has no mapping
8160         symbols.
8161         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
8162         correct section index.
8163         (Arm_relobj::find_linked_text_section): Ditto.
8164
8165 2010-04-07  Cary Coutant  <ccoutant@google.com>
8166
8167         * archive.cc (include_member): Destroy Read_symbols_data object before
8168         releasing file.
8169         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
8170         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
8171         (Read_symbols_data::~Read_symbols_data) New destructor.
8172         (Section_relocs::Section_relocs) New constructor.
8173         (Section_relocs::~Section_relocs) New destructor.
8174         (Read_relocs_data::Read_relocs_data) New constructor.
8175         (Read_relocs_data::~Read_relocs_data) New destructor.
8176         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
8177         pointers to NULL after deleting.
8178
8179 2010-04-07  Doug Kwan  <dougkwan@google.com>
8180
8181         * arm.cc: Replace "endianity" with "endianness" in comments.
8182         (Arm_exidx_cantunwind): Ditto.
8183         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
8184         (Arm_relobj::merge_flags_and_attributes): New method.
8185         (Arm_relobj::merge_flags_and_attributes_): New data member.
8186         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
8187         (Arm_relobj::scan_sections_for_stubs): Ditto.
8188         (Arm_relobj::do_read_symbols): Check to see if we really want to
8189         merge processor-specific flags and attributes.  Exit early if
8190         an object is empty except for section names and the undefined symbol.
8191         (Target_arm::do_finalize_sections): Move check for ELF format to
8192         Arm_relobj::do_read_symbols.  Merge processor specific flags and
8193         attributes from a regular object only when we have determined that
8194         it is aapropriate.  Do not create an .ARM.attributes section in
8195         output if there is no regular input object.
8196         (Target_arm::merge_processor_specific_flags): Check
8197         --warn-mismatch before printing any error.
8198         (Target_arm::merge_object_attributes): Ditto.
8199         * gold.cc (queue_middle_tasks): Handle the case in which there is
8200         no regular object in input.
8201         * options.cc (General_options::parse_EB): New method.
8202         (General_options::parse_EL): Same.
8203         (General_options::General_options): Initialize endianness_.
8204         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
8205         New options.
8206         (General_options::Endianness): New enum.
8207         (General_options::endianness): New method.
8208         (General_options::endianness_): New data member.
8209         * parameters.cc (Parameters::set_options): Check target endianness.
8210         (Parameters::set_target_once): Ditto.
8211         (Parameters::check_target_endianness): New method.
8212         (parameters_force_valid_target): If either -EL or -EB is specified,
8213         use it to define endianness of default target.
8214         * parameters.h (Parameters::check_target_endianness): New method
8215         declaration.
8216         * target.h (class Target): Change "endianity" to "endianness"
8217         in comments.
8218
8219 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8220
8221         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
8222         * configure: Regenerate.
8223         * Makefile.in: Regenerate.
8224         * testsuite/Makefile.in: Regenerate.
8225
8226 2010-04-06  Cary Coutant  <ccoutant@google.com>
8227
8228         gcc PR lto/42757
8229         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
8230         prevailing definitions of common symbols.
8231         * testsuite/plugin_test_6.sh: New test case.
8232         * testsuite/plugin_common_test_1.c: New test case.
8233         * testsuite/plugin_common_test_2.c: New test case.
8234         * testsuite/Makefile.am (plugin_test_6): New test case.
8235         * testsuite/Makefile.in: Regenerate.
8236
8237 2010-04-06  Nick Clifton  <nickc@redhat.com>
8238
8239         * po/vi.po: New Vietnamese translation.
8240
8241 2010-03-30  Doug Kwan  <dougkwan@google.com>
8242
8243         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
8244
8245 2010-03-25  Doug Kwan  <dougkwan@google.com>
8246
8247         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
8248         to avoid a conversion warning on a 32-bit host.
8249
8250 2010-03-24  Ian Lance Taylor  <iant@google.com>
8251
8252         * testsuite/script_test_3.t: Add a TLS segment.
8253         * testsuite/Makefile.am (check_PROGRAMS): Add
8254         tls_phdrs_script_test.
8255         (tls_phdrs_script_test_SOURCES): Define.
8256         (tls_phdrs_script_test_DEPENDENCIES): Define.
8257         (tls_phdrs_script_test_LDFLAGS): Define.
8258         (tls_phdrs_script_test_LDADD): Define.
8259         * testsuite/Makefile.in: Rebuild.
8260
8261 2010-03-23  Cary Coutant  <ccoutant@google.com>
8262
8263         * fileread.cc (find_or_make_view): Fix comment.
8264
8265 2010-03-23  Ian Lance Taylor  <iant@google.com>
8266
8267         * script-sections.cc (class Orphan_section_placement): Define
8268         PLACE_TLS and PLACE_TLS_BSS.
8269         (Orphan_section_placement::Orphan_section_placement): Initialize
8270         new places.
8271         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
8272         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
8273         (tls_script_test_SOURCES): Define.
8274         (tls_script_test_DEPENDENCIES): Define.
8275         (tls_script_test_LDFLAGS): Define.
8276         (tls_script_test_LDADD): Define.
8277         * testsuite/Makefile.in: Rebuild.
8278
8279 2010-03-22  Doug Kwan  <dougkwan@google.com>
8280
8281         * arm.cc (Arm_relocate_functions::abs8,
8282         Arm_relocate_functions::abs16): Use correct check for overflow
8283         specified in the ARM ELF specs.
8284         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
8285         target of a BLX instruction specially.
8286         (Reloc_stub::stub_type_for_reloc): Ditto.
8287         (Relocate::relocate): Use symbolic names instead of numeric relocation
8288         codes to report error.
8289         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
8290         workaround.
8291         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
8292         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
8293         thumb2_blx_out_of_range.stdout
8294         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
8295         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
8296         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
8297         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
8298         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
8299         thumb2_blx_in_range, thumb2_blx_in_range.o,
8300         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
8301         thumb2_blx_out_of_range.o): New rules.
8302         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
8303         thumb2_blx_in_range and thumb2_blx_out_of_range.
8304         * testsuite/Makefile.in: Regenerate.
8305         * arm_branch_in_range.sh: Add tests for THUMB BLX.
8306         * testsuite/thumb_blx_in_range.s: New file.
8307         * testsuite/thumb_blx_out_of_range.s: New file.
8308
8309 2010-03-22  Rafael Espindola  <espindola@google.com>
8310
8311         * archive.cc (Should_include): Move to archive.h.
8312         (should_include_member): Make it a member of Archive.
8313         (Lib_group): New.
8314         (Add_lib_group_symbols): New.
8315         * archive.h: Include options.h.
8316         (Archive_member): Moved from Archive.
8317         (Should_include): Moved from archive.cc.
8318         (Lib_group): New.
8319         (Add_lib_group_symbols): New.
8320         * dynobj.cc (do_should_include_member): New.
8321         * dynobj.h (do_should_include_member): New.
8322         * gold.cc (queue_initial_tasks): Update call to queue.
8323         * main.cc (main): Print lib group stats.
8324         * object.cc (do_should_include_member): New.
8325         * object.h: Include archive.h.
8326         (Object::should_include_member): New.
8327         (Object::do_should_include_member): New.
8328         (Sized_relobj::do_should_include_member): New.
8329         * options.cc (General_options::parse_start_lib): New.
8330         (General_options::parse_end_lib): New.
8331         (Input_arguments::add_file): Handle lib groups.
8332         (Input_arguments::start_group): Check we are not in a lib.
8333         (Input_arguments::start_lib): New.
8334         (Input_arguments::end_lib): New.
8335         * options.h (General_options): Add start_lib and end_lib.
8336         (Input_argument::lib_): New.
8337         (Input_argument::lib): New.
8338         (Input_argument::is_lib): New.
8339         (Input_file_lib): New.
8340         (Input_arguments::in_lib_): New.
8341         (Input_arguments::in_lib): New.
8342         (Input_arguments::start_lib): New.
8343         (Input_arguments::end_lib_): New.
8344         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
8345         in unused members as preempted.
8346         (Sized_pluginobj::do_should_include_member): New.
8347         * plugin.h (Sized_pluginobj::do_should_include_member): New.
8348         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
8349         return the blocker.
8350         (Read_symbols::do_whole_lib_group): New.
8351         (Read_symbols::do_lib_group): New.
8352         (Read_symbols::do_read_symbols): Handle lib groups.
8353         (Read_symbols::get_name): Handle lib groups.
8354         * readsyms.h (Read_symbols): Add an archive member pointer.
8355         (Read_symbols::do_whole_lib_group): New.
8356         (Read_symbols::do_lib_group): New.
8357         (Read_symbols::member_): New.
8358         * script.cc (read_input_script): Update call to queue_soon.
8359
8360 2010-03-19  Doug Kwan  <dougkwan@google.com>
8361
8362         * arm.cc (Stub_table::Stub_table): Initialize new data members
8363         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
8364         (Stub_table::add_reloc_stub): Assign stub offset and update
8365         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
8366         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
8367         New data members.
8368         (Stub_table::update_data_size_and_addralign): Use
8369         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
8370         instead of going over all reloc stubs.
8371         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
8372         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
8373         Stringpool_template::offset_ to size of Stringpool_char.
8374         (Stringpool_template::new_key_offset): Remove code to initialize
8375         Stringpool_template::offset_.
8376         * stringpool.h (Stringpool_template::set_no_zero_null): Set
8377         Stringpool_template::offset_ to zero.
8378
8379 2010-03-15  Doug Kwan  <dougkwan@google.com>
8380
8381         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
8382         offset_.
8383         (Stringpool_template::new_key_offset): New method.
8384         (Stringpool_template::add_string): Assign offsets when adding new
8385         strings.
8386         (Stringpool_template::set_string_offsets): Do not set string offsets
8387         when not optimizing.
8388         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
8389         member size_.
8390         (Chunked_vector::clear): Clear size_.
8391         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
8392         (Chunked_vector::size): Return size_.
8393         (Chunked_vector::push_back): Use size_ to find insert position.
8394         (Chunked_vector::size_): New data member.
8395         (Stringpool_template::set_no_zero_null): Assert string set is empty.
8396         (Stringpool_template::new_key_offset): New method declaration.
8397         (Stringpool_template::offset_): New data member.
8398
8399 2010-03-15   Rafael Espindola  <espindola@google.com>
8400
8401         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
8402         Add_symbols' constructor.
8403         * readsyms.h (Add_symbols): Remove the input_group member.
8404
8405 2010-03-10  Ian Lance Taylor  <iant@google.com>
8406
8407         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
8408         target to ask whether a reference to a symbol requires a stack
8409         split.
8410         * target.h (Target::is_call_to_non_split): New function.
8411         (Target::do_is_call_to_non_split): Declare virtual function.
8412         * target.cc: Include "symtab.h".
8413         (Target::do_is_call_to_non_split): New function.
8414         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
8415
8416 2010-03-10  Cary Coutant  <ccoutant@google.com>
8417
8418         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
8419         (File_read::open[1]): Remove initial mapping of whole_file_view_.
8420         (File_read::open[2]): Add whole_file_view_ to list of views.
8421         (File_read::make_view): Remove test of whole_file_view_.
8422         (File_read::find_or_make_view): Create whole_file_view_ if
8423         necessary.
8424         (File_read::clear_views): Replace bool parameter with enum;
8425         adjust all callers.  Don't delete views with permanent data;
8426         do delete cached views and views from archives if
8427         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
8428         if clearing the corresponding view.
8429         * fileread.h (File_read::Clear_views_mode): New enum.
8430         (File_read::View::is_permanent_view): New method.
8431         (File_read::clear_views): Replace bool parameter
8432         with enum; adjust all callers.
8433         * options.h (General_options): Change keep_files_mapped option;
8434         add map_whole_files.
8435         * readsyms.cc (Add_symbols::run): Delete sd_ object before
8436         releasing the file.
8437         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
8438         the file.
8439
8440 2010-03-10  David S. Miller  <davem@davemloft.net>
8441
8442         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
8443
8444 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
8445
8446         * icf.cc (get_section_contents): Add '@' marker after processing the
8447         merge reloc.
8448
8449 2010-03-08  Doug Kwan  <dougkwan@google.com>
8450
8451         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
8452         due to a conversion warning.
8453         (Arm_relobj::update_output_local_symbol_count): Check for local
8454         symbol with unset output index.
8455
8456 2010-03-05  Ian Lance Taylor  <iant@google.com>
8457
8458         * options.h (class General_options): Add --spare-dynamic-tags.
8459         * output.cc (Output_data_dynamic::set_final_data_size): Implement
8460         --spare-dynamic-tags.
8461
8462 2010-03-05  Ian Lance Taylor  <iant@google.com>
8463
8464         * incremental.cc: Include "libiberty.h".
8465
8466 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
8467
8468         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
8469         function, is_info_ member.
8470         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
8471         (Versions::Versions): Update caller.
8472         (Versions::define_base_version): Likewise.
8473         (Versions::add_def): Likewise.
8474
8475 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
8476
8477         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
8478         (Scan::possible_function_pointer_reloc): New function.
8479         (Scan::local_reloc_may_be_function_pointer): Change to call
8480         possible_function_pointer_reloc.
8481         (Scan::global_reloc_may_be_function_pointer): Ditto.
8482         * icf.h (Icf::check_section_for_function_pointers): Change to reject
8483         relocations in ".data.rel.ro._ZTV" section.
8484         * testsuite/icf_safe_so_test.sh: Change to pass i386.
8485         * testsuite/icf_safe_so_test.cc: Ditto.
8486         * testsuite/icf_safe_test.cc: Ditto.
8487         * testsuite/icf_safe_test.sh: Ditto.
8488
8489 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8490             Ian Lance Taylor  <iant@google.com>
8491
8492         * target-reloc.h (relocate_section): Check the symbol table index
8493         for -1U before setting the local symbol index.
8494         (scan_relocatable_relocs): If copying the relocation, record that
8495         the local symbol is required.
8496         * object.h (Symbol_value::is_output_symtab_index_set): New
8497         function.
8498         (Symbol_value::may_be_discarded_from_output_symtab): New
8499         function.
8500         (Symbol_value::has_output_symtab_entry): New function.
8501         (Symbol_value::needs_output_symtab_entry): Remove.
8502         (Symbol_value::output_symtab_index): Make sure the symbol index is
8503         set.
8504         (Symbol_value::set_output_symtab_index): Make sure the symbol
8505         index is not set.  Make sure the new index is valid.
8506         (Symbol_value::set_must_have_output_symtab_entry): New function.
8507         (Symbol_value::has_output_dynsym_entry): New function.
8508         (Symbol_value::set_output_dynsym_index): Make sure the new index
8509         is valid.
8510         (Sized_relobj::set_must_have_output_symtab_entry): New function.
8511         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
8512         local symbol if permitted.
8513         (Sized_relobj::do_finalize_local_symbols): Call
8514         is_output_symtab_index_set rather than needs_output_symtab_entry.
8515         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
8516         rather than needs_output_symtab_entry.  Call
8517         has_output_dynsym_entry rather than needs_output_dynsym_entry.
8518         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
8519         is_output_symtab_index_set rather than needs_output_symtab_entry.
8520         * testsuite/discard_locals_relocatable_test.c: New file.
8521         * testsuite/discard_locals_test.sh: Test -r.
8522         * testsuite/Makefile.am (check_DATA): Add
8523         discard_locals_relocatable_test1.syms,
8524         discard_local_relocatable_test2.syms.
8525         (MOSTLYCLEANFILES): Likewise.  Also add
8526         discard_locals_relocatable_test1.lout and
8527         discard_locals_relocatable_test2.out.
8528         (discard_locals_relocatable_test1.syms): New target.
8529         (discard_locals_relocatable_test.o): New target.
8530         (discard_locals_relocatable_test1.out): New target.
8531         (discard_locals_relocatable_test2.syms): New target.
8532         (discard_locals_relocatable_test2.out): New target.
8533         (various): Add missing ../ld-new dependencies.
8534         * testsuite/Makefile.in: Rebuild.
8535
8536 2010-03-03  Nick Clifton  <nickc@redhat.com>
8537
8538         * po/fi.po: New Finnish translation.
8539
8540 2010-03-01  Doug Kwan  <dougkwan@google.com>
8541
8542         * layout.cc (Layout::Layout): Force section types of .init_array*,
8543         .preinit_array* and .fini_array* sections.
8544         * output.cc (Output_section::Input_section_sort_entry::has_priority):
8545         Fix check of return value of std::string::find.().
8546         (Output_section::Input_section_sort_compare::operator()): Remove
8547         comment about .init_array.
8548         (Output_section::Input_section_sort_init_fini_compare::operator()):
8549         New method.
8550         (Output_section::sort_attached_input_sections): Handle .init_array
8551         and .fini_array specially.
8552         * output.h (Output_section::Inut_section_sort_compare): Update
8553         comment.
8554         (Output_section::Input_section_sort_init_fini_compare): New struct.
8555
8556 2010-02-26  Doug Kwan  <dougkwan@google.com>
8557
8558         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
8559         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
8560         * testsuite/debug_msg.sh: Avoid matching source line number for
8561         use of global variable undef_int.
8562
8563 2010-02-26  Doug Kwan  <dougkwan@google.com>
8564
8565         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
8566         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
8567         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
8568         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
8569         * options.cc (General_options::General_options): Initialize member
8570         fix_v4bx_.
8571         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
8572         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
8573         and rm_no_fix_v4bx.stdout
8574         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
8575         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
8576         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
8577         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
8578         and arm_no_fix_v4bx.
8579         * Makefile.in: Regenerate.
8580         * testsuite/arm_fix_v4bx.s: New file.
8581         * testsuite/arm_fix_v4bx.sh: Ditto.
8582
8583 2010-02-24  Doug Kwan  <dougkwan@google.com>
8584
8585         * arm.cc (Target_arm::got_section): Make the .got section the first
8586         non RELRO section in the data segment.
8587         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
8588         suffixes of section names.
8589
8590 2010-02-24  Doug Kwan  <dougkwan@google.com>
8591
8592         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
8593         flags and attributes merging if an input file is a binary file.
8594         * fileread.cc (Input_file::open): Record format of original file.
8595         * fileread.h (Input_file::Format): New enum type.
8596         (Input_file::Input_file): Initialize data member format_.
8597         (Input_file::format): New method definition.
8598         (Input_file::format_):: New data member.
8599
8600 2010-02-24  Doug Kwan  <dougkwan@google.com>
8601
8602         * arm.cc (Arm_output_data_got): New class.
8603         (ARM_TCB_SIZE): New constant
8604         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
8605         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
8606         If user uses a script with a SECTIONS clause, issue only a warning
8607         for a misplaced EXIDX input section.  Otherwise, issue an error.
8608         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
8609         garbage collection.
8610         (Target_arm::got_mode_index_entry): Handle static linking.
8611         (Target_arm::Scan::local): Ditto.
8612         (Target_arm::Scan::global): Ditto.
8613         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
8614         all incorrectly implemented relocations.
8615         (Target_arm::fix_exidx_coverage): Pass layout to
8616         Arm_output_section::fix_exidx_coverage.
8617         * layout.cc (Layout::section_name_mapping): Remove trailing dots
8618         from ".ARM.exidx." and ".ARM.extab.".
8619
8620 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8621
8622         * arm.cc (Target_arm::do_finalize_sections): Create attribute
8623         section if it does not already exist.
8624         * attributes.cc (Attributes_section_data::Attributes_section_data):
8625         Don't crash if size is zero.
8626
8627 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8628             Ian Lance Taylor  <iant@google.com>
8629
8630         * gold.cc (queue_middle_tasks): If no input files were opened,
8631         exit.
8632         * workqueue.h (Task_function::Task_function): Assert that there is
8633         a blocker.
8634
8635 2010-02-22  Doug Kwan  <dougkwan@google.com>
8636
8637         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
8638         * icf.cc (get_section_contents): Cast snprintf arguments to long long
8639         types to avoid warnings due to different uint64_t implementations
8640         on different hosts.
8641
8642 2010-02-21  Doug Kwan  <dougkwan@google.com>
8643
8644         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
8645         handling of the maximum backward branch offset.
8646         (Arm_relocate_functions::thumb_branch_common): Ditto.
8647         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
8648         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
8649         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
8650         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
8651         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
8652         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
8653         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
8654         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
8655         thumb_bl_out_of_range thumb_bl_out_of_range.o,
8656         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
8657         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
8658         thumb2_bl_out_of_range.o): New rules.
8659         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
8660         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
8661         thumb2_bl_out_of_range
8662         * testsuite/Makefile.in: Regenerate.
8663         * testsuite/arm_bl_in_range.s: New file.
8664         * testsuite/arm_bl_out_of_range.s: Ditto.
8665         * testsuite/arm_branch_in_range.sh: Ditto.
8666         * testsuite/arm_branch_range.t: Ditto.
8667         * testsuite/thumb2_branch_range.t: Ditto.
8668         * testsuite/thumb_bl_in_range.s: Ditto.
8669         * testsuite/thumb_bl_out_of_range.s: Ditto.
8670         * testsuite/thumb_branch_range.t: Ditto.
8671
8672 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
8673
8674         * gc.h (gc_process_relocs): Change vectors to point to the new list.
8675         Add reloc offset information.
8676         * icf.cc (get_section_contents): Change iterators to point to the new
8677         vectors. Add reloc offset information to the contents.
8678         * icf.h (Icf::Sections_reachable_info): New typedef.
8679         (Icf::Sections_reachable_list): New typedef.
8680         (Icf::Offset_info): New typedef.
8681         (Icf::Reloc_info): New struct typedef.
8682         (Icf::Reloc_info_list): New typedef.
8683         (Icf::symbol_reloc_list): Delete method.
8684         (Icf::addend_reloc_list): Delete method.
8685         (Icf::section_reloc_list): Delete method.
8686         (Icf::reloc_info_list): New method.
8687         (Icf::reloc_info_list_): New member.
8688
8689 2010-02-19  Doug Kwan  <dougkwan@google.com>
8690
8691         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
8692         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
8693         * arm.cc (Arm_relocation_functions): New forward declaration.
8694         (Target_arm::Target_arm): Initialize new data members
8695         got_mod_index_offset_ and tls_base_symbol_defined_.
8696         (Target_arm::Relocate::relocate_tls): New method.
8697         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
8698          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
8699         New methods.
8700         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
8701         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
8702         (Target_arm::got_mod_index_offset_,
8703         Target_arm::tls_base_symbol_defined_): New data members.
8704         (Target_arm::Scan::local, Target::Scan::global,
8705         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
8706         relocations.
8707
8708 2010-02-18  Doug Kwan  <dougkwan@google.com>
8709
8710         * arm.cc (Arm_relobj::find_linked_text_section): New method.
8711         (Arm_relobj::make_exidx_input_section): Pass section index of linked
8712         text section as a parameter becuase some broken tools may not set
8713         the link in section header.
8714         (Target_arm::has_got_section): New method.
8715         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
8716         without any mapping symbol as data only.  Remove warning.
8717         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
8718         link in its section header, try to discover the link by inspecting the
8719         REL31 relocation at the beginning of the section.
8720         (Target_arm::Scan::check_non_pic): Report name of offending relocation
8721         in error message.
8722         (Target_arm::Scan::global): Treat any reference to the symbol
8723         _GLOBAL_OFFSET_TABLE_ as a GOT access.
8724
8725 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
8726
8727         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
8728         (Scan::global_reloc_may_be_function_pointer): New function.
8729         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
8730         (Scan::global_reloc_may_be_function_pointer): New function.
8731         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
8732         (Scan::global_reloc_may_be_function_pointer): New function.
8733         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
8734         (Scan::global_reloc_may_be_function_pointer): New function.
8735         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
8736         (Scan::global_reloc_may_be_function_pointer): New function.
8737         (Scan::possible_function_pointer_reloc): New function.
8738         (Target_x86_64::can_check_for_function_pointers): New function.
8739         * gc.h (gc_process_relocs): Scan relocation types to determine if
8740         function pointers were taken for targets that support it.
8741         * icf.cc (Icf::find_identical_sections): Include functions for
8742         folding in safe ICF whose pointer is not taken.
8743         * icf.h (Secn_fptr_taken_set): New typedef.
8744         (fptr_section_id_): New member.
8745         (section_has_function_pointers): New function.
8746         (set_section_has_function_pointers): New function.
8747         (check_section_for_function_pointers): New function.
8748         * options.h: Fix comment for safe ICF option.
8749         * target.h (can_check_for_function_pointers): New function.
8750         * testsuite/Makefile.am: Add icf_safe_so_test test case.
8751         Modify icf_safe_test for X86-64.
8752         * testsuite/Makefile.in: Regenerate.
8753         * testsuite/icf_safe_so_test.cc: New file.
8754         * testsuite/icf_safe_so_test.sh: New file.
8755         * testsuite/icf_safe_test.cc (kept_func_3): New function.
8756         (main): Change to take pointer to function kept_func_3.
8757         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
8758         folding is done correctly for X86-64.
8759
8760 2010-02-12  David S. Miller  <davem@davemloft.net>
8761
8762         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
8763         is_symbolless parameter.
8764         (Output_reloc<SHT_REL>::is_symbolless): New.
8765         (Output_reloc<SHT_REL>::is_symbolless_): New.
8766         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
8767         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
8768         (Output_reloc<SHT_RELA>::is_symbolless): New.
8769         (Output_data_reloc::add_global): Handle is_symbolless.
8770         (Output_data_reloc::add_global_relative): Likewise.
8771         (Output_data_reloc::add_local): Likewise.
8772         (Output_data_reloc::add_local_relative): Likewise.
8773         (Output_data_reloc::add_symbolless_global_addend): New.
8774         (Output_data_reloc::add_symbolless_local_addend): New.
8775         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
8776         is_symbolless.
8777         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
8778         instead of ->is_relative_
8779         (Output_reloc::write): Likewise.
8780         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
8781         (Output_reloc::write_rel): Simplify.
8782
8783         * sparc.cc (Target_sparc::Scan::local): Use
8784         ->add_symbolless_local_addend as needed.
8785         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
8786         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
8787         based upon relocation offset.
8788
8789 2010-02-11  Doug Kwan  <dougkwan@google.com>
8790
8791         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
8792         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
8793         beginning of function.
8794         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
8795         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
8796         parameter is_32bit in calls to should_apply_static_reloc.
8797         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
8798         (check_DATA): Add arm_abs_global.stdout.
8799         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
8800         arm_abs_global.stdout): New rules.
8801         (MOSTLLYCLEANFILES): Add arm_abs_global
8802         * Makefile.in: Regenerate.
8803         * testsuite/arm_abs_global.s: New file.
8804         * testsuite/arm_abs_global.sh: Ditto.
8805         * testsuite/arm_abs_lib.s: Ditto.
8806
8807 2010-02-11  Ian Lance Taylor  <iant@google.com>
8808
8809         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
8810         Read_relocs task.
8811         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
8812         Allocate_commons_task first.
8813         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
8814         task, rather than symtab_lock_.
8815         (Gc_process_relocs::~Gc_process_relocs): New function.
8816         (Gc_process_relocs::is_runnable): Check this_blocker_.
8817         (Gc_process_relocs::locks): Use next_blocker_ rather than
8818         blocker_.
8819         (Scan_relocs::~Scan_relocs): New function.
8820         (Scan_relocs::is_runnable): Check this_blocker_ rather than
8821         symtab_lock_.
8822         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
8823         next_blocker_.
8824         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
8825         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
8826         constructor accordingly.
8827         (class Gc_process_relocs): Likewise.
8828         (class Scan_relocs): Likewise.
8829         * common.h (class Allocate_commons_task): Remove symtab_lock_
8830         field, and corresponding constructor parameter.
8831         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
8832         symtab_lock_.
8833         (Allocate_commons_task::locks): Likewise.
8834
8835 2010-02-11  Ian Lance Taylor  <iant@google.com>
8836
8837         * gold-threads.h (class Once): Define.
8838         (class Initialize_lock): Rewrite as child of Once.
8839         * gold-threads.cc (class Once_initialize): Define.
8840         (once_pointer_control): New static variable.
8841         (once_pointer, once_arg): New static variables.
8842         (c_run_once): New static function.
8843         (Once::Once, Once::run_once, Once::internal_run): New functions.
8844         (class Initialize_lock_once): Remove.
8845         (initialize_lock_control): Remove.
8846         (initialize_lock_pointer): Remove.
8847         (initialize_lock_once): Remove.
8848         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
8849         (Initialize_lock::initialize): Rewrite.
8850         (Initialize_lock::do_run_once): New function.
8851         * archive.cc (Archive::interpret_header): Only clear name if it is
8852         not already empty.
8853         * fileread.cc: Include "gold-threads.h"
8854         (file_counts_lock): New static variable.
8855         (file_counts_initialize_lock): Likewise.
8856         (File_read::release): Only increment counts when using --stats.
8857         Use a lock around the increment.
8858         * parameters.cc (class Set_parameters_target_once): Define.
8859         (set_parameters_target_once): New static variable.
8860         (Parameters::Parameters): Move here from parameters.h.
8861         (Parameters::set_target): Rewrite.
8862         (Parameters::set_target_once): New function.
8863         (Parameters::clear_target): Move here and rewrite.
8864         * parameters.h (class Parameters): Update declarations.  Add
8865         set_parameters_target_once_ field.
8866         (Parameters::Parameters): Move to parameters.cc.
8867         (Parameters::clear_target): Likewise.
8868         * readsyms.cc (Read_symbols::do_group): Create a Start_group
8869         task.
8870         (Start_group::~Start_group): New function.
8871         (Start_group::is_runnable): New function.
8872         (Start_group::locks, Start_group::run): New functions.
8873         (Finish_group::run): Change saw_undefined to size_t.
8874         * readsyms.h (class Start_group): Define.
8875         (class Finish_group): Change saw_undefined_ field to size_t.
8876         (Finish_group::Finish_group): Remove saw_undefined and
8877         this_blocker parameters.  Change all callers.
8878         (Finish_group::set_saw_undefined): New function.
8879         (Finish_group::set_blocker): New function.
8880         * symtab.h (class Symbol_table): Change saw_undefined to return
8881         size_t.  Change saw_undefined_ field to size_t.
8882         * target-select.cc (Set_target_once::do_run_once): New function.
8883         (Target_selector::Target_selector): Initialize set_target_once_
8884         field.  Don't initialize lock_ and initialize_lock_ fields.
8885         (Target_selector::instantiate_target): Rewrite.
8886         (Target_selector::set_target): New function.
8887         * target-select.h (class Set_target_once): Define.
8888         (class Target_selector): Update declarations.  Make
8889         Set_target_once a friend.  Remove lock_ and initialize_lock_
8890         fields.  Add set_target_once_ field.
8891
8892 2010-02-10  Ian Lance Taylor  <iant@google.com>
8893
8894         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
8895         queueing any tasks.
8896         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
8897         (queue_middle_tasks): Add all blockers before queueing any tasks.
8898         (queue_final_tasks): Likewise.
8899         * token.h (Task_token::add_blockers): New function.
8900         * object.h (Input_objects::number_of_relobjs): New function.
8901
8902 2010-02-10  Ian Lance Taylor  <iant@google.com>
8903
8904         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
8905         shared, not if not position independent.
8906         * x86_64.cc (Relocate::relocate_tls): Likewise.
8907         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
8908         (tls_pie_pic_test): New target.
8909         * testsuite/Makefile.in: Rebuild.
8910
8911         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
8912         (tls_test_main_pie.o, tls_test_pie.o): New targets.
8913         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
8914         * testsuite/Makefile.in: Rebuild.
8915
8916 2010-02-09  David S. Miller  <davem@davemloft.net>
8917
8918         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
8919         R_SPARC_RELATIVE using ->add_local_relative().
8920         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
8921
8922         * output.h (Output_data_dynamic::add_section_size): New method
8923         that takes two Output_data objects.
8924         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
8925         entry param.  Handle it in initializers.
8926         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
8927         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
8928         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
8929         arg.
8930         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
8931         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
8932         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
8933         for dynrel_includes_plt.
8934         * i386.cc (Target_i386::do_finalize_sections): Likewise.
8935         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8936         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
8937         before .rela.plt
8938         (Target_sparc::do_finalize_sections): Update to pass true for
8939         dynrel_includes_plt.
8940         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
8941         output before .rela.plt
8942         (Target_powerpc::do_finalize_sections): Update to pass true for
8943         dynrel_includes_plt when 32-bit.
8944
8945 2010-02-08  Doug Kwan  <dougkwan@google.com>
8946
8947         * arm.cc (Arm_relobj::simple_input_section_output_address): New
8948         method.
8949         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
8950         Arm_relobj::scan_section_for_cortex_a8_stubs,
8951         Arm_relobj::do_relocation_section): Instead of calling
8952         Output_section::output_address, use faster
8953         Arm_relobj::simple_input_section_output_address.
8954
8955 2010-02-08  David S. Miller  <davem@davemloft.net>
8956
8957         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
8958         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
8959         relocation helper function.
8960
8961         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
8962         just like R_SPARC_GOT{10,13,22}.
8963         (Target_sparc::Scan::local): Likewise.
8964         (Target_sparc::Relocate:relocate): Likewise.
8965
8966 2010-02-06  Ian Lance Taylor  <iant@google.com>
8967
8968         * configure.ac: Rewrite targetobjs duplicate removal code to use
8969         only shell constructs.
8970         * configure: Rebuild.
8971
8972 2010-02-05  Doug Kwan  <dougkwan@google.com>
8973
8974         PR 11247
8975         * arm.cc (Arm_relobj::section_is_scannable): New method.
8976         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
8977         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
8978
8979 2010-02-04  Doug Kwan  <dougkwan@google.com>
8980
8981         PR 11247
8982         * arm-reloc-property.cc (cstdio): Include.
8983         * configure.ac (targetobjs): Remove duplicates.
8984         * configure: Regenerate.
8985         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
8986         big and little endian version for a given address size.
8987
8988 2010-02-03  Doug Kwan  <dougkwan@google.com>
8989
8990         * arm-reloc-property.cc
8991         (Arm_reloc_property_table::reloc_name_in_error_message): New method
8992         definition.
8993         * arm-reloc-property.h
8994         (Arm_reloc_property_table::get_implemented_static_reloc_property):
8995         New method definition.
8996         (Arm_reloc_property_table::reloc_name_in_error_message): New method
8997         declaration.
8998         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
8999         overflow to N.
9000         (GOT_PREL): Change implemented to Y.
9001         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
9002         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
9003         (Arm_relocate_functions::movw_abs_nc): Remove method.
9004         (Arm_relocate_functions::movt_abs): Ditto.
9005         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
9006         (Arm_relocate_functions::thm_movt_abs): Ditto.
9007         (Arm_relocate_functions::movw_rel_nc): Ditto.
9008         (Arm_relocate_functions::movw_rel): Ditto.
9009         (Arm_relocate_functions::movt_rel): Ditto.
9010         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
9011         (Arm_relocate_functions:thm_movw_rel): Ditto.
9012         (Arm_relocate_functions:thm_movt_rel): Ditto.
9013         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
9014         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
9015         New method definitions.
9016         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
9017         (Arm_relocation_functions::arm_grp_ldr): Ditto.
9018         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
9019         (Arm_relocation_functions::arm_grp_ldc): Ditto.
9020         (Target_arm::Relocate::relocate): Check for non-static or
9021         unimplemented relocation code and exit early.  Change calls to
9022         Target_arm::reloc_uses_thumb_bit and
9023         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
9024         instead.  Refactor code to handle similar relocations to increase
9025         code sharing.  Remove check for unsupported relocation code in switch
9026         statement.
9027         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
9028         relocation property table to find out size.  Change error message to
9029         print out the name of a relocation code instead of the numeric value.
9030         (Target_arm::scan_reloc_for_stub): Use relocation property table
9031         instead of calling Target_arm::reloc_uses_thumb_bit().
9032
9033 2010-02-02  Doug Kwan  <dougkwan@google.com>
9034
9035         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
9036         types of relaxed input section.
9037
9038 2010-02-02  Doug Kwan  <dougkwan@google.com>
9039
9040         * Makefile.am (HFILES): Add arm-reloc-property.h.
9041         (DEFFILES): New.
9042         (TARGETSOURCES): Add arm-reloc-property.cc
9043         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
9044         (libgold_a_SOURCES): $(DEFFILES)
9045         * Makefile.in: Regenerate.
9046         * arm-reloc-property.cc: New file.
9047         * arm-reloc-property.h: New file.
9048         * arm-reloc.def: New file.
9049         * arm.cc: Update comments.
9050         (arm-reloc-property.h): New included header.
9051         (arm_reloc_property_table): New global variable.
9052         (Target_arm::do_select_as_default_target): New method definition.
9053         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
9054         arm-reloc-property to targ_extra_obj.
9055         * parameters.cc (set_parameters_target): Call
9056         Target::select_as_default_target().
9057         * target.h (Target::select_as_default_target): New method definition.
9058         (Target::do_select_as_default_target): Same.
9059
9060 2010-02-01  Doug Kwan  <dougkwan@google.com>
9061
9062         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
9063         first_output_text_section_.
9064         (Arm_exidx_fixup::first_output_text_section): New method definition.
9065         (Arm_exidx_fixup::first_output_text_section_): New data member.
9066         (Arm_exidx_fixup::process_exidx_section): Record the first text
9067         output section seen.
9068         (Arm_output_section::fix_exidx_coverage): Set correct linked section
9069         and entsize in output section header.
9070
9071 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9072
9073         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
9074         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
9075         (Arm_relocate_functions::thm_alu11): New Method.
9076         (Arm_relocate_functions::thm_pc8): New Method.
9077         (Arm_relocate_functions::thm_pc12): New Method.
9078         (Target_arm::Scan::local): Handle the relocations.
9079         (Target_arm::Scan::global): Likewise.
9080         (Target_arm::Relocate::relocate): Likewise.
9081         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9082
9083 2010-01-29  Doug Kwan  <dougkwan@google.com>
9084
9085         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
9086         of relocation types as ld.
9087
9088 2010-01-29  Doug Kwan  <dougkwan@google.com>
9089
9090         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
9091         to public.
9092         (Arm_relocate_functions::thumb_branch_common): Ditto.
9093         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
9094         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
9095         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
9096         Arm_relocate_functions::jump24): Remove.
9097         (Target_arm::Relocate::relocate): Adjust code to call
9098         Arm_relocation_functions::arm_branch_common and
9099         Arm_relocation_functions::thumb_branch_common instead of their removed
9100         wrappers.  Merge switch-cases together to reduce source code size.
9101
9102 2010-01-29  Doug Kwan  <dougkwan@google.com>
9103
9104         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
9105         output_local_symbol_count_needs_update_.
9106         (Arm_relobj::output_local_symbol_count_needs_update,
9107          Arm_relobj::set_output_local_symbol_count_needs_update,
9108          Arm_relobj::update_output_local_symbol_count): New methods.
9109         (Arm_relobj::output_local_symbol_count_needs_update_): New data
9110         member.
9111         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
9112         of pointed function as in a R_ARM_PREL31 relocation.
9113         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
9114         for output local symbol count updating.
9115         (Target_arm::do_relax): Update output local symbol counts in objects
9116         if necessary.
9117         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
9118
9119 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9120
9121         * arm.cc: Added support for the ARM relocations:
9122         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
9123         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
9124         (Arm_relocate_functions::movw_rel_nc): Renamed (was
9125         movw_prel_nc).
9126         (Arm_relocate_functions::movw_rel): New method.
9127         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
9128         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
9129         thm_movw_prel_nc).
9130         (Arm_relocate_functions::thm_movw_rel): New method.
9131         (Arm_relocate_functions::thm_movt_rel): Renamed (was
9132         thm_movt_prel).
9133         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
9134         relocations.
9135         (Target_arm::Scan::global): Likewise.
9136         (Target_arm::Relocate::relocate): Likewise.
9137         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9138         Likewise.
9139
9140 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9141
9142         * arm.cc: Added support for ARM group relocations.
9143         (Target_arm::reloc_needs_sym_origin): New method.
9144         (Arm_relocate_functions::calc_grp_kn): New method.
9145         (Arm_relocate_functions::calc_grp_residual): New method.
9146         (Arm_relocate_functions::calc_grp_gn): New method.
9147         (Arm_relocate_functions::arm_grp_alu): New Method.
9148         (Arm_relocate_functions::arm_grp_ldr): New Method.
9149         (Arm_relocate_functions::arm_grp_ldrs): New Method.
9150         (Arm_relocate_functions::arm_grp_ldc): New Method.
9151         (Target_arm::Scan::local): Handle the ARM group relocations.
9152         (Target_arm::Scan::global): Likewise.
9153         (Target_arm::Relocate::relocate): Likewise.
9154         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9155         Likewise.
9156
9157 2010-01-26  Doug Kwan  <dougkwan@google.com>
9158
9159         * arm.cc (set): Include.
9160         (class Arm_exidx_fixup): Change type of last_input_section_ to const
9161         pointer type.
9162         (Arm_output_section::Text_section_list): New type.
9163         (Arm_output_section::append_text_sections_to_list): New method.
9164         (Arm_output_section::fix_exidx_coverage): Ditto.
9165         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
9166         (Arm_relobj::convert_input_section_to_relaxed_section): Use
9167         Relobj::set_section_offset() instead of
9168         Sized_relobj::invalidate_section_offset().
9169         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
9170         parameter for section headers. Ignore relocation sections for
9171         unallocated sections and EXIDX sections.
9172         (Target_arm::fix_exidx_coverage): New method.
9173         (Target_arm::output_section_address_less_than): New type.
9174         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
9175         linked text section instead of the EXIDX section.
9176         (Arm_output_section::create_stub_group): Add an assertion to check
9177         that this is not an EXIDX output section.
9178         (Arm_output_section::append_text_sections_to_list): New method.
9179         (Arm_output_section::fix_exidx_coverage): Ditto.
9180         (Arm_relobj::scan_sections_for_stubs): Adjust call to
9181         Arm_relobj::section_needs_reloc_stub_scanning.
9182         (Target_arm::do_relax): Fix EXIDX output section coverage in the
9183         first pass.
9184         (Target_arm::fix_exidx_coverage): New method.
9185         * object.h (Relobj::set_output_section): New method.
9186         (Sized_relobj::invalidate_section_offset): Remove method.
9187         (Sized_relobj::do_invalidate_section_offset): Remove method.
9188         (Sized_relobj::do_set_section_offset): Handle offset value -1.
9189
9190 2010-01-25  Doug Kwan  <dougkwan@google.com>
9191
9192         * arm.cc (Arm_exidx_merged_section::do_output_offset):
9193         Fix warning due to signed and unsigned comparison on a 32-bit host.
9194
9195 2010-01-22  Doug Kwan  <dougkwan@google.com>
9196
9197         * arm.cc (Target_arm::do_relax): Record an output section for section
9198         offset adjustment it contains any stub table that has changed.
9199         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
9200         offsets in an output section if necessary.
9201         * output.cc (Output_section::Output_section): Initialize
9202         section_offsets_need_adjustments_.
9203         (Output_section::add_input_section_for_script): Renamed to
9204         Output_section::add_simple_input_section.
9205         (Output_section::save_states): Add a comment.
9206         (Output_section::discard_states): New method defintion.
9207         (Output_section::adjust_section_offsets): Same.
9208         * output.h (Output_section::add_input_section_for_script): Renamed to
9209         Output_section::add_simple_input_section.
9210         (Output_section::discard_states): New method declaration.
9211         (Output_section::adjust_section_offsets): Same.
9212         (Output_section::section_offsets_need_adjustment,
9213         Output_section::set_section_offsets_need_adjustment): New method
9214         definitions.
9215         (Output_section::section_offsets_need_adjustment_): New data member.
9216         * script-sections.cc
9217         (Output_section_element_input::set_section_address): Adjust code for
9218         renaming of Output_section::add_input_section_for_script.
9219         (Orphan_output_section::set_section_address): Same.
9220
9221 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9222
9223         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
9224         Fix_v4bx enum values .
9225         * gold/options.h (General_options): New option definitions.
9226         (General_options::fix_v4bx): New method.
9227         (General_options::Fix_v4bx): New enum.
9228         * gold/options.cc (General_options::parse_fix_v4bx): New method.
9229         (General_options::parse_fix_v4bx_interworking): New method.
9230
9231 2010-01-22  Doug Kwan  <dougkwan@google.com>
9232
9233         * arm.cc (Arm_exidx_fixup): New class.
9234
9235 2010-01-21  Doug Kwan  <dougkwan@google.com>
9236
9237         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
9238         classes.
9239         (Arm_exidx_section_offset_map): New type.
9240
9241 2010-01-21  Doug Kwan  <dougkwan@google.com>
9242
9243         * arm.cc (Arm_exidx_input_section): New class.
9244         (Arm_relobj::exidx_input_section_by_link,
9245         Arm_relobj::exidx_input_section_by_shndx,
9246         Arm_relobj::make_exidx_input_section): New methods.
9247         (read_arm_attributes_section): Remove.
9248         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
9249         information about them.
9250         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
9251         to here.
9252
9253 2010-01-20  Doug Kwan  <dougkwan@google.com>
9254
9255         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
9256         Input_section_specifier to Section_id.
9257         (Target_arm::new_arm_input_section: Adjust code for change of key
9258         type.
9259         (Target_arm::find_arm_input_section): Ditto.
9260         * gc.h (object.h): Include for Section_id nand Section_id_hash.
9261         (Section_id): Remove.
9262         (Garbage_collection::Section_id_hash): Remove.
9263         * icf.h (object.h): Include for Section_id nand Section_id_hash.
9264         (Section_id): Remove.
9265         (Icf::Section_id_hash): Remove.
9266         * object.h (Section_id, Const_section_id, Section_id_hash,
9267         Const_section_id_hash): New type definitions.
9268         * output.cc (Output_section::add_relaxed_input_section): Change to
9269         use Const_section_id instead of Input_section_specifier as key type.
9270         (Output_section::add_merge_input_section): Ditto.
9271         (Output_section::build_relaxation_map): Change to use Section_id
9272         instead of Input_section_specifier as key type.
9273         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
9274         Ditto.
9275         (Output_section::convert_input_sections_to_relaxed_sections): Change
9276         to use Const_section_id instead of Input_section_specifier as key type.
9277         (Output_section::find_merge_section): Ditto.
9278         (Output_section::find_relaxed_input_section): Ditto.
9279         * output.h (Input_section_specifier): Remove class.
9280         (Output_section::Output_section_data_by_input_section_map): Change
9281         key type to Const_section_id.
9282         (Output_section::Output_relaxed_input_section_by_input_section_map):
9283         Ditto.
9284         (Output_section::Relaxation_map): Change key type to Section_id.
9285
9286 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9287
9288         * gold/arm.cc: Added support for R_ARM_V4BX relocation
9289         (class Arm_v4bx_stub): New class.
9290         (DEF_STUBS): Updated definition to support v4_veneer_bx.
9291         (Stub_factory::make_arm_v4bx_stub): New method.
9292         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
9293         (Stub_table::empty): Handle v4bx stubs.
9294         (Stub_table::add_arm_v4bx_stub): New method.
9295         (Stub_table::find_arm_v4bx_stub): New method.
9296         (Arm_relocate_functions::v4bx): New method.
9297         (Target_arm::fix_v4bx): New method.
9298         (Target_arm::Target_arm): Handle R_ARM_V4BX.
9299         (Stub_table::relocate_stubs): Likewise.
9300         (Stub_table::do_write): Likewise.
9301         (Stub_table::update_data_size_and_addralign): Likewise.
9302         (Stub_table::finalize_stubs):  Likewise.
9303         (Target_arm::Scan::local): Likewise.
9304         (Target_arm::Scan::global): Likewise.
9305         (Target_arm::do_finalize_sections): Likewise.
9306         (Target_arm::Relocate::relocate): Likewise.
9307         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9308         Likewise.
9309         (Target_arm::scan_reloc_for_stub): Likewise.
9310         (Target_arm::scan_reloc_section_for_stubs): Likewise.
9311
9312 2010-01-19  Ian Lance Taylor  <iant@google.com>
9313
9314         * output.cc (Output_section_headers::do_sized_write): Write large
9315         segment count to sh_info field.
9316         (Output_file_header::do_sized_write): For large segment count,
9317         write PN_XNUM to e_phnum field.
9318
9319 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9320
9321         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
9322         (Arm_relocate_functions::thm_jump8): New function.
9323         (Arm_relocate_functions::thm_jump11): New function.
9324         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
9325         R_ARM_THM_JUMP11.
9326         (Target_arm::Scan::global): Likewise.
9327         (Target_arm::Relocate::relocate): Likewise.
9328         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9329         Likewise.
9330
9331 2010-01-14  Doug Kwan  <dougkwan@google.com>
9332
9333         * arm.cc (map, utility): Include headers.
9334         (Target_arm::apply_cortex_a8_workaround): New method.
9335         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
9336         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
9337         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
9338         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
9339         the --[no-]fix-cortex-a8 command line options.
9340         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
9341         (Target_arm::relocate_stub): Use addend in instruction template.
9342         * options.h (DEFINE_bool): Set the user-set flag.
9343         (General_options): Add --[no-]-fix-cortex options.
9344         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
9345         : Update fast look-up map after conversion.
9346
9347 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
9348
9349         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
9350         in the first pass of do_layout.
9351
9352 2010-01-13  Doug Kwan  <dougkwan@google.com>
9353
9354         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
9355         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
9356         apparent compiler problem of not folding static constant integral
9357         data members of elfcpp::Elf_sizes<32>.
9358
9359 2010-01-13  Doug Kwan  <dougkwan@google.com>
9360
9361         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
9362         Arm_relobj::section_needs_cortex_a8_stub_scanning,
9363         Arm_relobj::scan_section_for_cortex_a8_erratum,
9364         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
9365         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
9366         sections to scan for relocation stubs into a new method
9367         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
9368         relocation and Cortex-A8 stub scanning.
9369         (Target_arm::do_relax): Force stubs to be after stubbed sections
9370         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
9371         the beginning of a new relaxation pass.  Update a comment.
9372         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
9373
9374 2010-01-12  Ian Lance Taylor  <iant@google.com>
9375
9376         * target-reloc.h (visibility_error): New inline function.
9377         (relocate_section): Call visibility_error.
9378         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
9379         (MOSTLYCLEANFILES): Likewise.
9380         (protected_4_pic.o, protected_3.err): New targets.
9381         * testsuite/protected_4.cc: New file.
9382
9383 2010-01-12  Doug Kwan  <dougkwan@google.com>
9384
9385         * arm.cc (Cortex_a8_reloc): New class.
9386         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
9387         and cortex_a8_relocs_info_.
9388         (Target_arm::fix_cortex_a8): New method definition.
9389         (Target_arm::Cortex_a8_relocs_info): New type.
9390         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
9391         New data member declarations.
9392         (Target_arm::scan_reloc_for_stub): Record information about
9393         relocations for THUMB branches that might be exempted from the
9394         Cortex-A8 workaround.
9395         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
9396         at the beginning of a relaxation pass.
9397
9398 2010-01-12  Doug Kwan  <dougkwan@google.com>
9399
9400         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
9401         (Arm_relobj::Mapping_symbol_position,
9402          Arm_reloj::Mapping_symbol_position_less,
9403          Arm_relobj::Mapping_symbols_info): New types.
9404         (Target_arm::is_mapping_symbol_name): New method definition.
9405         (Arm_relobj::do_count_local_symbols): Save information about mapping
9406         symbols.
9407
9408 2010-01-11  Doug Kwan  <dougkwan@google.com>
9409
9410         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
9411         Arm_relocate_functions::thumb32_branch_upper,
9412         Arm_relocate_functions::thumb32_branch_lower,
9413         Arm_relocate_functions::thumb32_cond_branch_offset,
9414         Arm_relocate_functions::thumb32_cond_branch_upper,
9415         Arm_relocate_functions::thumb32_cond_branch_lower,
9416         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
9417         branch offset encoding.
9418         (Arm_relocate_functions::thumb_branch_common): Use new branch
9419         offset encoding methods to avoid code duplication.
9420         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
9421         (Stub_addend_reader::operator()): Use new branch encoding method
9422         to avoid code duplication.
9423
9424 2010-01-11  Doug Kwan  <dougkwan@google.com>
9425
9426         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
9427         (Target_arm::do_finalize_sections): Define special EXIDX section
9428         symbols only if referenced.
9429         * gc.h (Garbage_collection::add_reference): New method.
9430         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
9431         code duplication.
9432
9433 2010-01-11  Ian Lance Taylor  <iant@google.com>
9434
9435         * script.cc (Version_script_info::build_expression_list_lookup):
9436         Change complaing about duplicate wildcard match from error to
9437         warning.
9438
9439         * script.cc (class Lazy_demangler): Recreate--revert part of patch
9440         of 2009-12-30.
9441         (Version_script_info::Version_script_info): Initialize globs_,
9442         default_version_, default_is_global_, and exact_.  Don't
9443         initialize globals_ or locals_.
9444         (Version_script_info::build_lookup_tables): Build local symbols
9445         first.
9446         (Version_script_info::unquote): New function.
9447         (Version_script_info::add_exact_match): New function.
9448         (Version_script_info::build_expression_list_lookup): Remove lookup
9449         parameter.  Add is_global parameter.  Change all callers.  Handle
9450         wildcard pattern specially.  Unquote pattern.  Call
9451         add_exact_match.
9452         (Version_script_info::get_name_to_match): New function.
9453         (Version_script_info::get_symbol_version): New function.
9454         (Version_script_info::get_symbol_version_helper): Remove.
9455         (Version_script_info::check_unmatched_names): Call unquote.
9456         * script.h (class Version_script_info): Change get_symbol_version
9457         to be non-inline and add is_global parameter; change all callers.
9458         Rewrite symbol_is_local.  Update declarations.  Define struct
9459         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
9460         Remove globals_ and locals_ members.  Add exact_, globs_,
9461         default_version_, is_global_.
9462         (Version_script_info::Glob): Remove pattern, add expression and
9463         is_global.  Update constructor.  Change all callers.
9464         * dynobj.cc (Versions::finalize): Mark the version symbol as the
9465         default version.
9466         (Versions::symbol_section_contents): If a symbol is undefined, or
9467         defined in a dynamic object, set the version index to
9468         VER_NDX_LOCAL.
9469         * symtab.cc (Symbol_table::add_from_relobj): Don't call
9470         symbol_is_local.
9471         (Symbol_table::add_from_pluginobj): Likewise.
9472         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
9473
9474 2010-01-11  Doug Kwan  <dougkwan@google.com>
9475
9476         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
9477         (incremental_dump_LDADD): Add linking option for libintl.
9478         * Makefile.in: Regenerate.
9479
9480 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
9481
9482         PR gold/11144
9483         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
9484         instead of -Ds.
9485         * testsuite/Makefile.in: Regenerated.
9486
9487 2010-01-10  Doug Kwan  <dougkwan@google.com>
9488
9489         * options.h (DEFINE_var): Use parentheses around argument varname__
9490         in macro body to avoid any unintended subsequent substitutions.
9491
9492 2010-01-10  Ian Lance Taylor  <iant@google.com>
9493
9494         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
9495         candidates before doing symbol resolution.
9496
9497         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
9498         ODR candidates if only one is weak.
9499
9500 2010-01-08  Ian Lance Taylor  <iant@google.com>
9501
9502         * script.cc (Version_script_info::build_expression_list_lookup):
9503         Don't warn about ambiguous version, just record the ambiguity.
9504         (Version_script_info::get_symbol_version_helper): Give error if
9505         version is ambiguous.
9506
9507 2010-01-08  Doug Kwan  <dougkwan@google.com>
9508
9509         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
9510         prev_data_size_ and prev_addralign_.  Remove initializer for
9511         deleted data member has_been_changed_.
9512         (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
9513         to determine if the table is empty.
9514         (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
9515         Remove.
9516         (Stub_table::add_reloc_stub): Define method in class definition
9517         instead of just declaring it there.
9518         (Stub_table::add_cortex_a8_stub): New method definition.
9519         (Stub_table::update_data_size_and_addralign): Ditto.
9520         (Stub_table::finalize_stubs): Ditto.
9521         (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
9522         (Stub_table::do_addralign_): Return address alignment in the
9523         (Stub_table::do_reset_address_and_file_offset): Define method in
9524         class definition instead of declaring it there.  Set current data
9525         size to be the data size of the previous pass.
9526         (Stub_table::set_final_data_size): Use current data size as the
9527         final data size.
9528         (Stub_table::relocate_stub): Change parameter type of stub from
9529         Reloc_stub pointer to Stub pointer.
9530         (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
9531         (Stub_table::Cortex_a8_stub_list): New typedef.
9532         (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
9533          Stub_table::prev_addralign_): New data member.
9534         (Arm_relobj::Arm_relobj): Initialize data member
9535         section_has_cortex_a8_workaround_.
9536         (Arm_relobj::section_has_cortex_a8_workaround,
9537          Arm_relobj::mark_section_for_cortex_a8_workaround): New method
9538          definitions.
9539         (Arm_relobj::section_has_cortex_a8_workaround_): New data member
9540         declarations.
9541         (Target_arm::relocate_stub): Change parameter type of stub from
9542         Reloc_stub pointer to Stub pointer.
9543         (Insn_template::size, Insn_template::alignment): Handle
9544         THUMB16_SPECIAL_TYPE.
9545         (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
9546          Stub_table::update_data_size_and_addralign,
9547          Stub_table::apply_cortex_a8_workaround_to_address_range): New method
9548         definitions.
9549         (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
9550         (Stub_table::do_write): Ditto.
9551         (Target_arm::do_relax): Adjust code for changes in Stub_table.
9552
9553 2010-01-08  Ian Lance Taylor  <iant@google.com>
9554
9555         PR 11108
9556         * symtab.h (class Symbol): Remove fields is_target_special_ and
9557         has_plt_offset_.  Add field is_defined_in_discarded_section_.
9558         (Symbol::is_defined_in_discarded_section): New function.
9559         (Symbol::set_is_defined_in_discarded_section): New function.
9560         (Symbol::has_plt_offset): Rewrite.
9561         (Symbol::set_plt_offset): Verify that new offset is not -1U.
9562         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
9563         Don't initialize is_target_special_ or has_plt_offset_.
9564         Initialize is_defined_in_discarded_section_.
9565         (Symbol_table::add_from_relobj): If appropriate, set
9566         is_defined_in_discarded_section.
9567         * resolve.cc (Symbol::override_base_with_special): Don't test
9568         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
9569         * target-reloc.h (relocate_section): Do special handling for
9570         symbols defined in discarded sections for global symbols as well
9571         as local symbols.
9572
9573 2010-01-08  Ian Lance Taylor  <iant@google.com>
9574
9575         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
9576         the SHT_SYMTAB case.
9577
9578 2010-01-08  Ian Lance Taylor  <iant@google.com>
9579
9580         * object.cc (Sized_relobj::do_layout): Don't get confused if
9581         layout_eh_frame returns NULL.
9582
9583 2010-01-08  Ian Lance Taylor  <iant@google.com>
9584
9585         PR 11084
9586         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
9587         dynamic symbol table, use the normal symbol table.
9588         (Sized_dynobj::do_read_symbols): Remove assertion about type of
9589         symbol table.
9590
9591 2010-01-08  Ian Lance Taylor  <iant@google.com>
9592
9593         PR 11072
9594         * layout.cc (Layout::include_section): Remove .gnu_debuglink
9595         sections.
9596
9597 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
9598
9599         * version.cc (print_version): Change to "Copyright 2010".
9600
9601 2010-01-08  Ian Lance Taylor  <iant@google.com>
9602
9603         PR 10287
9604         PR 11063
9605         * i386.cc (class Target_i386): Change return type of plt_section
9606         to be non-const.
9607         (class Output_data_plt_i386): Add tls_desc_rel_ field.
9608         (Output_data_plt_i386::Output_data_plt_i386): Initialize
9609         tls_desc_rel_ field.
9610         (Output_data_plt_i386::rel_tls_desc): New function.
9611         (Target_i386::rel_tls_desc_section): New function.
9612         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
9613         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
9614         R_386_TLS_DESC reloc in rel_tls_desc_section.
9615         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
9616         Define struct Tlsdesc_info.
9617         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
9618         (Target_x86_64::do_reloc_symbol_index): New function.
9619         (Target_x86_64::add_tlsdesc_info): New function.
9620         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
9621         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
9622         tlsdesc_rel_ field.
9623         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
9624         all callers.
9625         (Output_data_plt_x86_64::rela_tlsdesc): New function.
9626         (Target_x86_64::rela_tlsdesc_section): New function.
9627         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
9628         handling.
9629         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
9630         (Target_x86_64::do_reloc_addend): New function.
9631         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
9632         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
9633         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
9634         (Output_reloc::type): New function.
9635         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
9636         (Output_reloc::is_target_specific): New function.
9637         (Output_reloc::target_arg): New function.
9638         (class Output_reloc) [SHT_RELA]: Add four new constructors for
9639         absolute relocs and target specific relocs.
9640         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
9641         add_target_specific.
9642         (class Output_data_reloc) [SHT_RELA]: Likewise.
9643         * output.cc (Output_reloc::Output_reloc): Add four new versions
9644         for absolute relocs and target specific relocs.
9645         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
9646         (Output_reloc::get_symbol_index): Likewise.
9647         (Output_reloc::local_section_offset): Check that local_sym_index_
9648         is not TARGET_CODE or 0.
9649         (Output_reloc::symbol_value): Likewise.
9650         (Output_reloc::write) [SHT_RELA]: Call target for target specific
9651         reloc.
9652         * target.h (class Target): Add reloc_symbol_index and reloc_addend
9653         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
9654         functions.
9655         * layout.cc (add_target_dynamic_tags): Use output section for
9656         DT_PLTRELSZ and DT_JMPREL.
9657
9658 2010-01-07  Ian Lance Taylor  <iant@google.com>
9659
9660         PR 11061
9661         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
9662         function.
9663         (class Output_data_reloc_generic): Define.
9664         (class Output_data_reloc_base): Change base class to
9665         Output_data_reloc_generic.  Change add() method to call
9666         bump_relative_reloc_count for a relative reloc.  Remove
9667         sort_relocs_ field.
9668         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
9669         to sort_relocs().
9670         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
9671         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
9672         appropriate.
9673         * layout.h (class Layout): Update declaration.
9674
9675 2010-01-07  Ian Lance Taylor  <iant@google.com>
9676
9677         * output.h (class Output_data): Add const version of
9678         output_section and do_output_section.
9679         (class Output_section_data): Add const version of
9680         do_output_section.
9681         (class Output_section): Likewise.
9682         * layout.cc (Layout::add_target_dynamic_tags): New function.
9683         * layout.h (class Layout): Update declarations.
9684         * arm.cc (Target_arm::do_finalize_sections): Use
9685         add_target_dynamic_tags.
9686         * i386.cc (Target_i386::do_finalize_sections): Likewise.
9687         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
9688         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
9689         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
9690
9691 2010-01-07  Ian Lance Taylor  <iant@google.com>
9692
9693         PR 11042
9694         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
9695         object as needed.
9696
9697 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
9698             Ian Lance Taylor  <iant@google.com>
9699
9700         PR 11019
9701         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
9702         Xindex::read_symtab_xindex.
9703
9704 2010-01-07  Doug Kwan  <dougkwan@google.com>
9705
9706         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
9707         (Insn_template::thumb16_bcond_insn): New method declaration.
9708         (Insn_template): Fix spelling.
9709         (Stub::thumb16_special): New method declaration.
9710         (Stub::do_write): Define virtual method which was previously pure
9711         virtual.
9712         (Stub::do_thumb16_special): New method declaration.
9713         (Stub::do_fixed_endian_write): New template member.
9714         (Reloc_stub::do_write): Remove.
9715         (Reloc_stub::do_fixed_endian_write): Remove.
9716         (Cortex_a8_stub): New class definition.
9717         (Stub_factory::make_cortex_a8_stub): New method definition.
9718         (Stub_factory::Stub_factory): Add missing static storage class
9719         qualifier for elf32_arm_stub_a8_veneer_blx.
9720
9721 2010-01-07  Ian Lance Taylor  <iant@google.com>
9722
9723         PR 10980
9724         * options.h (class General_options): Add --warn-unresolved-symbols
9725         and --error-unresolved-symbols.
9726         * errors.cc (Errors::undefined_symbol): Implement
9727         --warn-unresolved-symbols.
9728
9729         * options.h (class General_options): Add -z text and -z textoff.
9730         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
9731
9732 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
9733
9734         * gc.h (Garbage_collection::Cident_section_map): New typedef.
9735         (Garbage_collection::cident_sections): New function.
9736         (Garbage_collection::add_cident_section): New function.
9737         (Garbage_collection::cident_sections_): New member.
9738         (gc_process_relocs): Add references to sections whose names are C
9739         identifiers.
9740         * gold.h (cident_section_start_prefix): New constant.
9741         (cident_section_stop_prefix): New constant.
9742         (is_cident): New function.
9743         * layout.cc (Layout::define_section_symbols): Replace string constants
9744         with the newly defined constants.
9745         * object.cc (Sized_relobj::do_layout): Track sections whose names are
9746         C identifiers.
9747         * testsuite/Makefile.am: Add gc_orphan_section_test.
9748         * testsuite/Makefile.in: Regenerate.
9749         * testsuite/gc_orphan_section_test.cc: New file.
9750         * testsuite/gc_orphan_section_test.sh: New file.
9751
9752 2010-01-06  Ian Lance Taylor  <iant@google.com>
9753
9754         PR 10980
9755         * options.h (class General_options): Add --warn-shared-textrel.
9756         * layout.cc (Layout::finish_dynamic_section): Implement
9757         --warn-shared-textrel.
9758
9759         PR 10980
9760         * options.h (class General_options): Add --warn-multiple-gp.
9761
9762 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9763
9764         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
9765         $(THREADSLIB) and $(LIBDL).
9766         * Makefile.in: Rebuild.
9767
9768 2010-01-06  Ian Lance Taylor  <iant@google.com>
9769
9770         PR 10980
9771         * options.cc (General_options::parse_section_start): New function.
9772         (General_options::section_start): New function.
9773         (General_options::General_options): Initialize all members.
9774         * options.h: Include <map>
9775         (class General_options): Add --section-start.  Add section_starts_
9776         member.
9777         * layout.cc (Layout::attach_allocated_section_to_segment): If
9778         --section-start was used, set the address of the segment.  Remove
9779         local sort_sections.
9780         (Layout::relaxation_loop_body): If the address of the load segment
9781         has been set by --section-start, don't use it.
9782         * output.h (Output_segment::update_flags_for_output_section): New
9783         function.
9784         * output.cc (Output_segment::add_output_section): Call
9785         update_flags_for_output_section.
9786
9787 2010-01-05  Ian Lance Taylor  <iant@google.com>
9788
9789         PR 10980
9790         * options.h (class General_options): Add --undefined-version.
9791         * script.cc (struct Version_expression): Add was_matched_by_symbol
9792         field.
9793         (Version_script_info::matched_symbol): New function.
9794         (Version_script_info::get_symbol_version_helper): Call
9795         matched_symbol.
9796         (Version_script_info::check_unmatched_names): New function.
9797         * script.h (class Version_script_info): Update declarations.
9798         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
9799
9800         * options.h (class General_options): Use DEFINE_bool_alias for
9801         allow_multiple_definition.
9802         * resolve.cc (Symbol_table::should_override): Don't test
9803         allow_multiple_definition.
9804
9805         PR 10980
9806         * options.h (class General_options): Add --cref.
9807         * main.cc (main): Print cref table if --cref.  Don't close mapfile
9808         until after printing cref table.
9809         * cref.cc: Include "symtab.h".
9810         (class Cref_inputs): Define Cref_table_compare and Cref_table.
9811         (Cref_table_compare::operator()): New function.
9812         (Cref_inputs::gather_cref): New function.
9813         (filecol): New static const.
9814         (Cref_inputs::print_cref): New function.
9815         (Cref::print_cref): New function.
9816         * cref.h: Include <cstdio>.
9817         (class Cref): Update declarations.
9818         * mapfile.h (Mapfile::file): New function.
9819         * object.h (class Object): Define Symbols.  Declare virtual
9820         do_get_global_symbols.
9821         (Object::get_global_symbols): New function.
9822         * object.cc (Input_objects::add_object): Pass object to cref_ if
9823         --cref.
9824         (Input_objects::archive_start): Likewise.
9825         (Input_objects::archive_stop): Likewise.
9826         (Input_objects::print_cref): New function.
9827         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
9828         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
9829         --cref.
9830         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
9831         function.
9832         * plugin.h (class Sized_pluginobj): Update declarations.
9833
9834 2010-01-05  Ian Lance Taylor  <iant@google.com>
9835
9836         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
9837         to is_default_version.  Rename insdef to insdefault.
9838         (Symbol_table::add_from_relobj): Rename def to is_default_version
9839         and local to is_forced_local.
9840         (Symbol_table::add_from_pluginobj): Likewise.
9841         (Symbol_table::add_from_dynobj): Likewise.
9842         (Symbol_table::define_special_symbol): Rename insdef to
9843         insdefault.
9844
9845 2010-01-04  Ian Lance Taylor  <iant@google.com>
9846
9847         PR 10980
9848         * options.h (class General_options): Add
9849         --allow-multiple-definition and -z muldefs.
9850         * resolve.cc (Symbol_table::should_override): Don't warn about a
9851         multiple symbol definition if --allow-multiple-definition or -z
9852         muldefs.
9853
9854         PR 10980
9855         * options.h (class General_options): Add --add-needed and
9856         --copy-dt-needed-entries.  Tweak --as-needed help entry.
9857         * object.cc (Input_objects::check_dynamic_dependencies): Give an
9858         error if --copy-dt-needed-entries aka --add-needed is used and
9859         would cause a change in behaviour.
9860
9861         PR 10980
9862         * options.h (class General_options): Add -G as a short version of
9863         --shared.  Add no-op options -assert, -g, and -i.
9864
9865 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
9866
9867         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
9868         check for .text or .gnu.linkonce.t sections.
9869         * icf.cc (Icf::find_identical_sections): Ditto.
9870         Change the detection for mangled function name within the section
9871         name.
9872         * icf.h (is_section_foldable_candidate): New function.
9873
9874 2009-12-30  Ian Lance Taylor  <iant@google.com>
9875
9876         PR 10980
9877         * options.h (class General_options): Permit two dashes with
9878         --retain-symbols-file.
9879
9880 2009-12-30  Ian Lance Taylor  <iant@google.com>
9881
9882         PR 10979
9883         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
9884         don't put the file header and segment headers in the text
9885         segment.
9886
9887         PR 10979
9888         * common.cc (Sort_commons::operator()): Stabilize sort when both
9889         entries are NULL.
9890         (Symbol_table::do_allocate_commons_list): When allocating common
9891         symbols, skip a symbol which is no longer common.
9892         * symtab.h (Symbol::is_common): Test whether the symbol comes from
9893         an object before checking its type.
9894         * testsuite/common_test_2.c: New file.
9895         * testsuite/common_test_3.c: New file.
9896         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
9897         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
9898         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
9899         (common_test_2_pic.o, common_test_2.so): New targets.
9900         (common_test_3_pic.o, common_test_3.so): New targets.
9901         * testsuite/Makefile.in: Rebuild.
9902
9903         PR 10979
9904         * script.cc (read_input_script): If we see a new SECTIONS clause,
9905         and we have added an input section, give an error.
9906         * layout.h (class Layout): Add have_added_input_section function.
9907         Add have_added_input_section_ field.
9908         * layout.cc (Layout::Layout): Initialize
9909         have_added_input_section_.
9910         (Layout::layout): Set have_added_input_section_.
9911         (Layout::layout_eh_frame): Likewise.
9912
9913 2009-12-30  Ian Lance Taylor  <iant@google.com>
9914
9915         PR 10931
9916         * options.h (class General_options): Add --sort-common option.
9917         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
9918         * common.cc (Sort_common): Add sort_order parameter to
9919         constructor.  Add sort_order_ field.
9920         (Sort_commons::operator): Check sort_order_.
9921         (Symbol_table::allocate_commons): Determine the sort order.
9922         (Symbol_table::do_allocate_commons): Add sort_order parameter.
9923         Change all callers.
9924         (Symbol_table::do_allocate_commons_list): Likewise.
9925
9926 2009-12-30  Ian Lance Taylor  <iant@google.com>
9927
9928         PR 10916
9929         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
9930         symbols from this object, don't change the visibility of an
9931         undefined symbol.
9932         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
9933
9934 2009-12-30  Ian Lance Taylor  <iant@google.com>
9935
9936         PR 10861
9937         * script.h (class Version_script_info): Define Language enum.
9938         Update declarations.  Define Glob, Exact, and Lookup types.  Add
9939         new fields globals_, locals_, and is_finalized_.
9940         * script.cc: Various formatting fixes.
9941         (class Parser_closure): Change language_stack_ from a vector of
9942         std::string to one of Version_script_info::Language.  Adjust all
9943         uses accordingly.
9944         (class Lazy_demangler): Remove.
9945         (struct Version_expression): Change language from std::string to
9946         Version_script_info::Language.
9947         (Version_script_info::Version_script_info): New function.
9948         (Version_script_info::~Version_script_info): Don't call clear.
9949         (Version_script_info::finalize): New function.
9950         (Version_script_info::build_lookup_tables): New function.
9951         (Version_script_info::build_expression_list_lookup): New
9952         function.
9953         (Version_script_info::get_symbol_version_helper): Rewrite to use
9954         lookup tables.
9955         (Version_script_info::print_expression_list): Adjust to use
9956         Version_script_info::Language.
9957         (script_push_lex_into_version_mode): Check that the version script
9958         has not been finalized.
9959         (version_script_push_lang): Change language string to
9960         Version_script_info::Language.
9961         * options.cc (Command_line::version_script): New function.
9962         * options.h (class General_options): Add finalize_dynamic_list
9963         function.  Change version_script from declaration to definition.
9964         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
9965         * testsuite/version_script.map: Remove duplicate def of foo.
9966         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
9967         version_script.map.
9968         * testsuite/Makefile.in: Rebuild.
9969
9970 2009-12-30  Ian Lance Taylor  <iant@google.com>
9971
9972         PR 10843
9973         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
9974         if the input symbol index is 0, make the output symbol index 0.
9975
9976 2009-12-30  Ian Lance Taylor  <iant@google.com>
9977
9978         PR 10670
9979         * options.h (class General_options): Add -x/--discard-all.
9980         * object.cc (Sized_relobj::do_count_local_symbols): Handle
9981         --discard-all.  If the local symbol needs a dynamic entry, check
9982         that before handling --discard-locals.
9983
9984 2009-12-30  Ian Lance Taylor  <iant@google.com>
9985
9986         PR 10450
9987         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
9988         flags to PF_R.
9989         (Output_segment::add_output_section): Don't change the flags if
9990         the type is PT_TLS.
9991
9992         PR 10450
9993         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
9994         GNU hash table if they need a dynamic value.  Otherwise, don't add
9995         them if they are defined in a dynamic object or are forced local.
9996
9997 2009-12-29  Ian Lance Taylor  <iant@google.com>
9998
9999         PR 10450
10000         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
10001         .gnu.hash table for a 32-bit target.
10002
10003         PR 10450
10004         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
10005         regular and a dynamic object only needs a dynamic symbol table
10006         entry if it is externally visible.
10007
10008         PR 10450
10009         * i386.cc (class Target_i386): Initialize global_offset_table_ in
10010         constructor.  Add global_offset_table_ field.
10011         (Target_i386::got_section): Set global_offset_table_.
10012         (Target_i386::do_finalize_sections): Set global_offset_table_
10013         size.
10014         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
10015         in constructor.  Add global_offset_table_ field.
10016         (Target_x86_64::got_section): Set global_offset_table_.
10017         (Target_x86_64::do_finalize_sections): Set global_offset_table_
10018         size.
10019
10020         * layout.cc (Layout::Layout): Initialize increase_relro_.
10021         (Layout::get_output_section): Add is_relro, is_last_relro, and
10022         is_first_non_relro parameters.  Change all callers.
10023         (Layout::choose_output_section): Likewise.
10024         (Layout::add_output_section_data): Likewise.
10025         (Layout::make_output_section): Likewise.
10026         (Layout::set_segment_offsets): Clear increase_relro when using a
10027         linker script.
10028         * layout.h (class Layout): Add increase_relro method.  Add
10029         increase_relro_ field.  Update declarations.
10030         * output.cc (Output_section::Output_section): Initialize
10031         is_last_relro_ and is_first_non_relro_.
10032         (Output_segment::add_output_section): Group relro sections is
10033         do_sort is true.  Handle is_last_relro and is_first_non_relro.
10034         (Output_segment::maximum_alignment): Remove relro handling.
10035         (Output_segment::set_section_addresses): Add increase_relro
10036         parameter.  Change all callers.  Add initial alignment to align
10037         relro sections on separate page.  Remove old relro handling.
10038         (Output_segment::set_section_list_addresses): Remove in_relro
10039         parameter.  Change all callers.
10040         (Output_segment::set_offset): Add increase parameter.  Change all
10041         callers.  Remove old relro handling.
10042         * output.h (class Output_section): Add new methods: is_last_relro,
10043         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
10044         Add is_last_relro_ and is_first_non_relro_ fields.
10045         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
10046         Create separate .got.plt section.  Call increase_relro.
10047         * x86_64.cc (Target_x86_64::got_section): Likewise.
10048         * testsuite/relro_script_test.t: Add .got.plt.
10049
10050         PR 10450
10051         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
10052         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
10053         (Layout::finalize): Call set_dynamic_symbol_size.
10054         (Layout::set_dynamic_symbol_size): New function.
10055         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
10056         set_dynamic_symbol_size.
10057
10058         PR 10450
10059         * output.h (class Output_section): Add is_entsize_zero_ field.
10060         * output.cc (Output_section::Output_section): Initialize
10061         is_entsize_zero_.
10062         (Output_section::set_entsize): If two different entsizes are
10063         requested, force it to zero.
10064         (Output_section::add_input_section): Set flags for .debug_str
10065         before updating section flags.  Set entsize.
10066         (Output_section::update_flags_for_input_section): Set SHF_MERGE
10067         and SHF_STRING if all input sections have those flags.
10068
10069 2009-12-29   Rafael Espindola  <espindola@google.com>
10070
10071         * main.cc (main): Fix the sys time reporting.
10072         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
10073         reporting.
10074
10075 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
10076
10077         * options.cc (General_options::parse_version): Allow -v to exit
10078         without an error if there is nothing to link.
10079
10080 2009-12-29  Ian Lance Taylor  <iant@google.com>
10081
10082         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
10083         using a version of gcc before 4.1.
10084         * configure: Rebuild.
10085
10086 2009-12-28  Chris Demetriou  <cgd@google.com>
10087
10088         * attributes.cc (Output_attributes_section_data::do_write): Use
10089         std::vector::front rather than std::vector::data.
10090
10091 2009-12-28  Ian Lance Taylor  <iant@google.com>
10092
10093         * symtab.h (class Symbol_table): Add enum Defined.
10094         * resolve.cc (Symbol_table::should_override): Add defined
10095         parameter.  Change all callers.  Test whether object is NULL
10096         before calling a method on it.
10097         (Symbol_table::report_resolve_problem): Add defined parameter.
10098         Change all callers.
10099         (Symbol_table::should_override_with_special): Likewise.
10100         * symtab.cc (Symbol_table::define_in_output_data): Add defined
10101         parameter.  Change all callers.
10102         (Symbol_table::do_define_in_output_data): Likewise.
10103         (Symbol_table::define_in_output_segment): Likewise.
10104         (Symbol_table::do_define_in_output_segment): Likewise.
10105         (Symbol_table::define_as_constant): Likewise.
10106         (Symbol_table::do_define_as_constant): Likewise.
10107         * script.h (class Symbol_assignment): Add is_defsym parameter to
10108         constructor; change all callers.
10109         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
10110         parameter.  Change all callers.  Add is_defsym_ field.
10111         (class Parser_closure): Add parsing_defsym parameter to
10112         constructor; change all callers.  Add parsing_defsym accessor
10113         function.  Add parsing_defsym_ field.
10114
10115 2009-12-28  Ian Lance Taylor  <iant@google.com>
10116
10117         * gold.cc (queue_middle_tasks): Fix formatting.
10118         * object.cc (Relobj::is_section_name_included): Likewise.
10119
10120 2009-12-23  Ian Lance Taylor  <iant@google.com>
10121
10122         * i386.cc (Target_i386::do_calls_non_split): Recognize
10123         -fsplit-stack prologue for a function with a static chain.
10124         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
10125         -fsplit-stack prologue when using %r11.
10126
10127 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
10128
10129         * options.cc (General_options::parse_version): Make -v continue and do
10130         the link like GNU ld does.
10131
10132 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
10133
10134         * Makefile.am (CCFILES): Add timer.cc.
10135         (HFILES): Add timer.h.
10136         * configure.ac: Check for sysconf and times.
10137         * main.cc: include timer.h.
10138         (main): Use Timer instead of get_run_time.
10139         * timer.cc: New.
10140         * timer.h: New.
10141         * workqueue.cc: include timer.h.
10142         (Workqueue::find_and_run_task):
10143         Report user, sys and wall time.
10144         * Makefile.in: Regenerate.
10145         * config.in: Regenerate.
10146         * configure: Regenerate.
10147
10148 2009-12-16  Doug Kwan  <dougkwan@google.com>
10149
10150         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
10151         sections.
10152         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
10153         relaxed input sections.
10154         * output.cc (Output_section::find_relaxed_input_section): Change
10155         return type to Output_relaxed_input_section pointer.  Adjust code
10156         for new type of relaxed_input_section_map_.
10157         * output.h (Output_section::find_relaxed_input_section): Change
10158         return type to Output_relaxed_input_section pointer.
10159         (Output_section::Output_relaxed_input_section_by_input_section_map):
10160         New type.
10161         (Output_section::relaxed_input_section_map_): Change type to
10162         Output_section::Output_relaxed_input_section_by_input_section_map.
10163         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
10164         input section.
10165
10166 2009-12-15  Ian Lance Taylor  <iant@google.com>
10167
10168         * layout.cc (Layout::create_shstrtab): Only write out after input
10169         sections if we are compressing debug sections.
10170
10171 2009-12-15  Ian Lance Taylor  <iant@google.com>
10172
10173         * archive.cc (Archive::add_symbols): Only look up a symbol without
10174         a version if there is, in fact, a version.
10175
10176 2009-12-14  Ian Lance Taylor  <iant@google.com>
10177
10178         Revert -Wshadow changes, all changes from:
10179         2009-12-11  Doug Kwan  <dougkwan@google.com>
10180         2009-12-11  Nick Clifton  <nickc@redhat.com>
10181         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
10182
10183 2009-12-11  Doug Kwan  <dougkwan@google.com>
10184
10185         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
10186         due to -Wshadow.
10187         * attributes.cc (Object_attribute::size): Ditto.
10188         (Attributes_section_data::size): Ditto.
10189         (Attributes_section_data::Attributes_section_data): Ditto.
10190         (Output_attributes_section_data::do_write): Ditto.
10191         * attributes.h (Object_attribute::set_type): Ditto.
10192         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
10193
10194 2009-12-11  Nick Clifton  <nickc@redhat.com>
10195
10196         * archive.cc: Fix shadowed variable warnings.
10197         * arm.cc: Likewise.
10198         * compressed_output.cc: Likewise.
10199         * compressed_output.h: Likewise.
10200         * configure: Likewise.
10201         * dwarf_reader.cc: Likewise.
10202         * dynobj.cc: Likewise.
10203         * dynobj.h: Likewise.
10204         * ehframe.cc: Likewise.
10205         * ehframe.h: Likewise.
10206         * errors.cc: Likewise.
10207         * expression.cc: Likewise.
10208         * fileread.cc: Likewise.
10209         * fileread.h: Likewise.
10210         * freebsd.h: Likewise.
10211         * i386.cc: Likewise.
10212         * icf.cc: Likewise.
10213         * incremental.h: Likewise.
10214         * layout.cc: Likewise.
10215         * layout.h: Likewise.
10216         * mapfile.cc: Likewise.
10217         * merge.cc: Likewise.
10218         * merge.h: Likewise.
10219         * object.cc: Likewise.
10220         * object.h: Likewise.
10221         * options.h: Likewise.
10222         * output.cc: Likewise.
10223         * output.h: Likewise.
10224         * parameters.cc: Likewise.
10225         * plugin.cc: Likewise.
10226         * powerpc.cc: Likewise.
10227         * reduced_debug_output.cc: Likewise.
10228         * reduced_debug_output.h: Likewise.
10229         * reloc.cc: Likewise.
10230         * reloc.h: Likewise.
10231         * resolve.cc: Likewise.
10232         * script-sections.cc: Likewise.
10233         * script.cc: Likewise.
10234         * script.h: Likewise.
10235         * sparc.cc: Likewise.
10236         * symtab.cc: Likewise.
10237         * symtab.h: Likewise.
10238         * target-select.cc: Likewise.
10239         * target-select.h: Likewise.
10240         * token.h: Likewise.
10241         * workqueue.cc: Likewise.
10242         * workqueue.h: Likewise.
10243         * x86_64.cc: Likewise.
10244
10245 2009-12-10  Doug Kwan  <dougkwan@google.com>
10246
10247         * arm.cc (attributes.h): New include.
10248         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
10249         (Arm_relobj::~Arm_relobj): Delete object pointed by
10250         attributes_section_data_.
10251         (Arm_relobj::attributes_section_data): New method definition.
10252         (Arm_relobj::attributes_section_data_): New data member declaration.
10253         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
10254         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
10255         attributes_section_data_.
10256         (Arm_dynobj::attributes_section_data): New method definition.
10257         (Arm_dynobj::attributes_section_data_): New data member declaration.
10258         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
10259         initialization value of may_use_blx_ to false.
10260         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
10261         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
10262         object attributes to compute results instead of hard-coding.
10263         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
10264         Target_arm::get_secondary_compatible_arch,
10265         Target_arm::set_secondary_compatible_arch
10266         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
10267         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
10268         New method declarations.
10269         (Target_arm::get_aeabi_object_attribute): New method definition.
10270         (Target_arm::attributes_section_data_): New data member declaration.
10271         (read_arm_attributes_section): New template definition.
10272         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
10273         (Arm_dynobj::do_read_symbols): Ditto.
10274         (Target_arm::do_finalize_sections): Merge attributes sections from
10275         input.  Check for BLX use after attributes section merging.
10276         Fix __exidx_start and __exidx_end visibility.  Create an
10277         .ARM.attributes section if necessary.
10278         (Target_arm::get_secondary_compatible_arch,
10279         Target_arm::set_secondary_compatible_arch,
10280         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
10281         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
10282         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
10283         New method definitions.
10284
10285 2009-12-09  Ian Lance Taylor  <iant@google.com>
10286
10287         * plugin.cc (Plugin::load): Don't cast from void* to a function
10288         pointer.
10289
10290 2009-12-09  Ian Lance Taylor  <iant@google.com>
10291
10292         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
10293         information fields.
10294
10295 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
10296
10297         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
10298         Replace two_file_shared_1.so with two_file_shared_2.so.
10299         * testsuite/Makefile.in: Regenerated.
10300
10301 2009-12-08  Doug Kwan  <dougkwan@google.com>
10302
10303         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
10304         (HFILES): Add attributes.h and int_encoding.h.
10305         * Makefile.in: Regenerate.
10306         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
10307         function definitions to int_encoding.cc
10308         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
10309         prototypes to int_encoding.h
10310         * reduced_debug_output.cc (int_encoding.h): New include.
10311         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
10312         function definitions to int_encoding.cc
10313         (insert_into_vector, read_from_pointer): Move template definitions to
10314         int_encoding.h
10315         * attributes.cc: New file.
10316         * attributes.h: New file.
10317         * int_encoding.cc: New file.
10318         * int_encoding.h: New file.
10319
10320 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
10321
10322         PR gold/11055
10323         * incremental-dump.cc (dump_incremental_inputs): New.
10324         (main): Use dump_incremental_inputs.
10325
10326 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
10327
10328         PR gold/10893
10329         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
10330         checking elfcpp::STT_FUNC.
10331         (Target_i386::Relocate::relocate): Likewise.
10332         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
10333
10334         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
10335         symbols from shared libraries into normal FUNC symbols.
10336
10337         * symtab.h (Symbol): Add is_func and use it.
10338
10339 2009-12-05  Doug Kwan  <dougkwan@google.com>
10340
10341         * arm.cc (Target_arm::arm_info): Initialize new fields
10342         attributes_section and attributes_vendor.
10343         * i386.cc (Target_i386::i386_info): Same.
10344         * object.cc (Sized_relobj::do_layout): Skip attribute section.
10345         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
10346         fields attributes_section and attributes_vendor.
10347         * sparc.cc (Target_sparc::sparc_info): Same.
10348         * target.h (Target::attributes_section, Target::attributes_vendor,
10349         Target::is_attributes_section, Target::attribute_arg_type,
10350         Target::attributes_order): New method definitions.
10351         (Target::Target_info::attributes_section,
10352         Target::Target_info::attributes_vendor): New fields.
10353         (Target::do_attribute_arg_type, Target::do_attributes_order): New
10354         virtual method definitions.
10355         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
10356         attributes_section and attributes_vendor.
10357         * testsuite/testfile.cc (Target_test::test_target_info): Same.
10358
10359 2009-12-05  Doug Kwan  <dougkwan@google.com>
10360
10361         * arm.cc: Update comments about interworking and stub generation.
10362         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
10363         considered as non-PIC.
10364         (Arm_relocate_functions::base_abs): Fix formatting.
10365         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
10366         of function to use GOT entry address instead of offset.
10367         (Target_arm::Scan::global): Issue an error if a symbol would need a
10368         PLT does not get one because it is untyped.  Remove code to create
10369         dynamic symbols for relative branches.
10370         (Target_arm::Relocate::relocate: Use 0 instead of false since function
10371         takes unsigned integer instead of boolean.
10372
10373 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
10374
10375         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
10376         (two_file_test_LDADD): Likewise.
10377         (common_test_1_LDADD): Likewise.
10378         (exception_test_LDADD) Likewise.
10379         (weak_test_LDADD): Likewise.
10380         (many_sections_test_LDADD): Likewise.
10381         (initpri1_LDADD): Likewise.
10382         (script_test_1_LDADD): Likewise.
10383         (script_test_2_LDADD): Likewise.
10384         (justsyms_LDADD): Likewise.
10385         (binary_test_LDADD): Likewise.
10386         (large_LDADD): Likewise.
10387         * testsuite/Makefile.in: Regenerated.
10388
10389 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
10390
10391         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
10392         (Symbol_table::override_with_special): Likewise.
10393         (Symbol_table::add_from_object): Likewise.
10394
10395 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
10396
10397         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
10398         Don't set the data_offset twice.
10399
10400 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
10401
10402         * testsuite/Makefile.in: Regenerate.
10403
10404 2009-12-03  Doug Kwan  <dougkwan@google.com>
10405
10406         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
10407         (Target_arm::do_finalize_sections): Add parameter for symbol table
10408         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
10409         * i386.cc (Target_i386::do_finalize_sections): Add an additional
10410         parameter for symbol table pointer.
10411         * layout.cc (Layout::finalize): Call Target::finalize_sections with
10412         an additional parameter for a pointer to symbol table.
10413         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
10414         parameter for a symbol table pointer.
10415         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
10416         * target.h (Target::finalize_sections, Target::do_finalize_sections):
10417         Ditto.
10418         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
10419         parameter for a symbol table pointer.
10420
10421 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
10422
10423         * incremental.cc (Incremental_inputs_header)
10424         (Incremental_inputs_header_write, Incremental_inputs_entry)
10425         (Incremental_inputs_entry_write): Move ...
10426         * incremental.h (Incremental_inputs_header)
10427         (Incremental_inputs_header_write, Incremental_inputs_entry)
10428         (Incremental_inputs_entry_write): here.
10429
10430 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10431
10432         * incremental.cc (make_sized_incremental_binary): Set the target.
10433         Error if it is incompatible.
10434         * output.h (Output_file): Add filename method.
10435
10436 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10437
10438         * incremental.cc (Incremental_inputs_entry): Remove unused argument
10439         from the get_* methods.
10440
10441 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10442
10443         * incremental-dump.cc (main): Check that the offeset of a script is 0.
10444         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
10445         Write 0 for the data_offset of scripts.
10446
10447 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10448
10449         * testsuite/Makefile.am: Add the incremental_test.sh test.
10450         * testsuite/incremental_test.sh: New.
10451         * testsuite/incremental_test_1.c: New.
10452         * testsuite/incremental_test_2.c: New.
10453
10454 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
10455
10456         * incremental-dump.cc (main): Fix typos.
10457
10458 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
10459
10460         PR gold/11025
10461         * incremental-dump.cc (main): Use llu to print 64 bit values.
10462
10463 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
10464             H.J. Lu  <hongjiu.lu@intel.com>
10465
10466         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
10467         $(LIBDL).
10468         (incremental_dump_LDADD): Likewise.
10469         * Makefile.in: Regenerated.
10470
10471 2009-11-25  Doug Kwan  <dougkwan@google.com>
10472
10473         Revert:
10474
10475         2009-11-25  Doug Kwan  <dougkwan@google.com>
10476
10477                 * arm.cc (Target_arm::Target_arm): Move method definition
10478                 outside of class definition.  Add code to handle
10479                 --target1-rel, --target1-abs and --target2= options.
10480                 (Target_arm::get_reloc_reloc_type): Change method to be
10481                 non-static and const.
10482                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
10483                 New data member declaration.
10484                 (Target_arm::Scan::local, Target_arm::Scan::global,
10485                 Target_arm::Relocate::relocate,
10486                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10487                 Adjust call to Target_arm::get_real_reloc_type.
10488                 (Target_arm::get_real_reloc_type): Use command line options
10489                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
10490                 * options.h (--target1-rel, --target1-abs, --target2): New
10491                 ARM-only options.
10492
10493 2009-11-25  Doug Kwan  <dougkwan@google.com>
10494
10495         * arm.cc (Target_arm::Target_arm): Move method definition outside of
10496         class definition.  Add code to handle --target1-rel, --target1-abs
10497         and --target2= options.
10498         (Target_arm::get_reloc_reloc_type): Change method to be non-static
10499         and const.
10500         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
10501         member declaration.
10502         (Target_arm::Scan::local, Target_arm::Scan::global,
10503         Target_arm::Relocate::relocate,
10504         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
10505         call to Target_arm::get_real_reloc_type.
10506         (Target_arm::get_real_reloc_type): Use command line options to
10507         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
10508         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
10509         options.
10510
10511 2009-11-25  Doug Kwan  <dougkwan@google.com>
10512
10513         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
10514         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
10515         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
10516         formatting.
10517         (Arm_relocate_functions::thm_call): Replace body with a call to
10518         Arm_relocate_functions::thumb_branch_common.
10519         (Arm_relocate_functions::thm_jump24,
10520         Arm_relocate_functions::thm_xpc22): New method definitions.
10521         (Arm_relocate_functions::thumb_branch_common): New method definition.
10522         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
10523         operator.
10524         (Target_arm::Relocate::relocate): Adjust call to thm_call.
10525         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
10526
10527 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
10528
10529         * Makefile.am: Build incremental-dump
10530         * Makefile.in: Regenerate.
10531         * incremental-dump.cc: New.
10532         * incremental.cc (Incremental_inputs_header_data,
10533         Incremental_inputs_entry_data): Move to incremental.h
10534         * incremental.h: (Incremental_inputs_header_data,
10535         Incremental_inputs_entry_data): Move from incremental.cc
10536
10537 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
10538
10539         * incremental.cc (Incremental_inputs_header,
10540         Incremental_inputs_header_write, Incremental_inputs_entry,
10541         Incremental_inputs_entry_write): Add a typedef with the data type.
10542
10543 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
10544
10545         * incremental.cc (Incremental_inputs_header,
10546         Incremental_inputs_header_write, Incremental_inputs_entry,
10547         Incremental_inputs_entry_write): Update comment about which
10548         type has the filed descriptions.
10549
10550 2009-11-15  Doug Kwan  <dougkwan@google.com>
10551
10552         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
10553         (Arm_relocate_functions::arm_branch_common): Change method defintion
10554         in class definition to a method declaration and update list of formal
10555         parameters.
10556         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
10557         Arm_relocation_functions::jump24): Adjust call to
10558         Arm_relocate_functions::arm_branch_common.  Update list of formal
10559         parameters.
10560         (Arm_relocate_functions::xpc25): New method definition.
10561         (Arm_relocate_functions::arm_branch_common): Move method defintion
10562         out from class definition.  Use stubs for mode-switching and extending
10563         branch ranges.
10564         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
10565         specially.  Change code to enable use of stubs in ARM branches.
10566
10567 2009-11-10  Doug Kwan  <dougkwan@google.com>
10568
10569         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
10570         in method declaration.
10571         (Target_arm::relocate_stub): New method declaration.
10572         (Target_arm::default_target): Change to return a pointer instead of
10573         a const reference.
10574         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
10575         Target_arm::default_target.
10576         (Arm_Relobj::do_relocate_sections): Remove options paramater in
10577         method definition.
10578         (Target_arm::relocate_section): Adjust view.
10579         (Target_arm::relocate_stub): New method definition.
10580
10581 2009-11-10  Doug Kwan  <dougkwan@google.com>
10582
10583         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
10584         a format warning.
10585         * incremental.cc (open_incremental_binary): Initialized local
10586         variables to avoid warnings.
10587         * object.cc (make_elf_object): Ditto.
10588         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
10589         a format warning.
10590
10591 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
10592
10593         PR gold/10930
10594         * testsuite/plugin_test.c: Include "config.h".
10595
10596 2009-11-09  Doug Kwan  <dougkwan@google.com>
10597
10598         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
10599         (arm_symbol_value): Remove.
10600         (Arm_relocate_functions::arm_branch_common,
10601         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
10602         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
10603         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
10604         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
10605         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
10606         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
10607         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
10608         Arm_relocate_functions::thm_mobw_abs_nc,
10609         Arm_relocate_functions::thm_mov_abs,
10610         Arm_relocate_functions::movw_prel_nc,
10611         Arm_relocate_functions::thm_movt_abs,
10612         Arm_relocate_functions::movt_prel,
10613         Arm_relocate_functions::thm_movw_prel_nc,
10614         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
10615         (Target_arm::Relocate::relocate): Only decompose address into two
10616         parts if relocation type uses the thumb-bit and pass the actual
10617         bit instead of a flag indicating that the thumb-bit is used.  Adjust
10618         calls to methods in Arm_relocate_functions for this change.
10619
10620 2009-11-08  Ian Lance Taylor  <iant@google.com>
10621
10622         PR 10925
10623         * reloc.cc: Instantiate
10624         Sized_relobj::initialize_input_to_output_maps and
10625         Sized_relobj:free_input_to_output_maps.
10626
10627 2009-11-06  Ian Lance Taylor  <iant@google.com>
10628
10629         PR 10876
10630         * defstd.cc (in_segment): Set only_if_ref true for "end".
10631
10632 2009-11-06  Doug Kwan  <dougkwan@google.com>
10633
10634         * arm.cc (class Reloc_stub): Correct a comment.
10635         (Target_arm::Target_arm): Initialize arm_input_section_map_.
10636         (Target_arm::scan_section_for_stubs): New method declaration.
10637         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
10638         Change methods from private to protected.
10639         (Target_arm::do_may_relax): New method definition.
10640         (Target_arm::do_relax, Target_arm::group_sections,
10641         Target_arm::scan_reloc_for_stub,
10642         Target_arm::scan_reloc_section_for_stubs): New method declarations.
10643         (Target_arm::arm_input_section_map_): New data member declaration.
10644         (Target_arm::scan_reloc_for_stub,
10645         Target_arm::scan_reloc_section_for_stubs,
10646         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
10647         Target_arm::do_relax): New method definitions.
10648
10649 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
10650
10651         * configure.ac: Check for (struct stat)::st_mtim
10652         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
10653         * config.in: Regenerate.
10654         * configure: Regenerate.
10655
10656 2009-11-05  Ian Lance Taylor  <iant@google.com>
10657
10658         PR 10910
10659         * output.cc (Output_segment::add_output_section): Add missing
10660         return statement.
10661
10662 2009-11-04  Ian Lance Taylor  <iant@google.com>
10663
10664         PR 10880
10665         * object.h (class Object): Add is_needed and set_is_needed
10666         methods.  Add is_needed_ field.  Make bool fields into bitfields.
10667         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
10668         defined in a dynamic object and referenced by a regular object,
10669         set is_needed for the dynamic object.
10670         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
10671         if the file is marked with as_needed and it is not needed.
10672
10673 2009-11-04  Ian Lance Taylor  <iant@google.com>
10674
10675         PR 10887
10676         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
10677         tags if data is discarded by linker script.
10678         * i386.cc (Target_i386::do_finalize_sections): Likewise.
10679         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
10680         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
10681         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
10682
10683 2009-11-04  Ian Lance Taylor  <iant@google.com>
10684
10685         * layout.cc (Layout::get_output_section): Add is_interp and
10686         is_dynamic_linker_section parameters.  Change all callers.
10687         (Layout::choose_output_section): Likewise.
10688         (Layout::make_output_section): Likewise.
10689         (Layout::add_output_section_data): Add is_dynamic_linker_section
10690         parameter.  Change all callers.
10691         * layout.h (class Layout): Update declarations.
10692         * output.h (class Output_section): Add is_interp, set_is_interp,
10693         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
10694         Add is_interp_, is_dynamic_linker_section_ fields.  Change
10695         generate_code_fills_at_write_ to a bitfield.
10696         * output.cc (Output_section::Output_sections): Initialize new
10697         fields.
10698         (Output_segment::add_output_section): Add do_sort parameter.
10699         Change all callers.
10700
10701 2009-11-03  Ian Lance Taylor  <iant@google.com>
10702
10703         PR 10860
10704         * options.h (class General_options): Add --warn-common.
10705         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
10706         merging two common symbols.
10707         (Symbol_table::should_override): Handle --warn-common when merging
10708         a common symbol with a defined symbol.  Use report_resolve_problem
10709         for multiple definitions.
10710         (Symbol_table::report_resolve_problem): New function.
10711         * symtab.h (class Symbol_table): Declare report_resolve_problem.
10712
10713 2009-11-03  Doug Kwan  <dougkwan@google.com>
10714
10715         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
10716         stub_factory_.
10717         (Target_arm::stub_factory): New method definition.
10718         (Target_arm::new_arm_input_section,
10719         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
10720         Target_arm::reloc_uses_thumb_bit): New method declarations.
10721         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
10722         New type definitions.
10723         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
10724         member declarations.
10725         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
10726         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
10727         New method definitions.
10728
10729 2009-11-03  Ian Lance Taylor  <iant@google.com>
10730
10731         * options.h (class General_options): Add --warn_constructors.
10732
10733 2009-11-03  Ian Lance Taylor  <iant@google.com>
10734
10735         PR 10893
10736         * defstd.cc (in_section): Add entries for __rel_iplt_start,
10737         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
10738
10739 2009-11-03  Ian Lance Taylor  <iant@google.com>
10740
10741         PR 10895
10742         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
10743         --msgid-bugs-address.
10744         (install-pdf): New target.
10745         (install-data_yes): Look up one directory to find mkinstalldirs.
10746
10747 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
10748
10749         * po/Make-in (.po.gmo): Don't generate .gmo files in source
10750         tree.
10751
10752 2009-10-30  Doug Kwan  <dougkwan@google.com>
10753
10754         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
10755
10756 2009-10-30  Doug Kwan  <dougkwan@google.com>
10757
10758         * arm.cc (Stub_addend_reader): New struct template definition
10759         and partial specializations.
10760         (Stub_addend_reader::operator()): New method definition for a
10761         partially specialized template.
10762
10763 2009-10-30  Doug Kwan  <dougkwan@google.com>
10764
10765         * arm.cc (Arm_relobj::processor_specific_flags): New method
10766         definition.
10767         (Arm_relobj::do_read_symbols): New method declaration.
10768         (Arm_relobj::processor_specific_flags_): New data member declaration.
10769         (Arm_dynobj): New class definition.
10770         (Target_arm::do_finalize_sections): Add input_objects parameter.
10771         (Target_arm::do_adjust_elf_header): New method declaration.
10772         (Target_arm::are_eabi_versions_compatible,
10773         (Target_arm::merge_processor_specific_flags): New method declaration.
10774         (Target_arm::do_make_elf_object): New overloaded method definitions
10775         and declaration.
10776         (Arm_relobj::do_read_symbols): New method definition.
10777         (Arm_dynobj::do_read_symbols): Ditto.
10778         (Target_arm::do_finalize_sections): Add input_objects parameters.
10779         Merge processor-specific flags from all input objects.
10780         (Target_arm::are_eabi_versions_compatible,
10781         Target_arm::merge_processor_specific_flags,
10782         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
10783         New method definitions.
10784         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
10785         Input_objects pointer type parameter.
10786         * layout.cc (Layout::finalize): Pass input objects to target's.
10787         finalize_sections function.
10788         * output.cc (Output_file_header::do_sized_write): Set ELF file
10789         header's processor-specific flags.
10790         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
10791         Input_objects pointer type parameter.
10792         * sparc.cc (Target_sparc::do_finalize_sections): Same.
10793         * target.h (Input_objects): New forward class declaration.
10794         (Target::processor_specific_flags,
10795         Target::are_processor_specific_flags_sect): New method definitions.
10796         (Target::finalize_sections): Add input_objects parameter.
10797         (Target::Target): Initialize processor_specific_flags_ and
10798         are_processor_specific_flags_set_.
10799         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
10800         parameter.
10801         (Target::set_processor_specific_flags): New method definition.
10802         (Target::processor_specific_flags_,
10803         Target::are_processor_specific_flags_set_): New data member
10804         declarations.
10805         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
10806         Input_objects pointer type parameter.
10807
10808 2009-10-30  Doug Kwan  <dougkwan@google.com>
10809
10810         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
10811
10812 2009-10-28  Ian Lance Taylor  <iant@google.com>
10813
10814         * object.h (class Relobj): Drop options parameter from
10815         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
10816         do_scan_relocs, do_relocate.  Change all callers.
10817         (class Sized_relobj): Drop options parameters from
10818         do_gc_process_relocs, do_scan_relocs, do_relocate,
10819         do_relocate_sections, relocate_sections, emit_relocs_scan,
10820         emit_relocs_scan_reltype.  Change all callers.
10821         (struct Relocate_info): Remove options field and all references to
10822         it.
10823         * reloc.h (class Read_relocs): Remove options constructor
10824         parameter and options_ field.  Change all callers.
10825         (class Gc_process_relocs, class Scan_relocs): Likewise.
10826         (class Relocate_task): Likewise.
10827         * target-reloc.h (scan_relocs): Remove options parameter.  Change
10828         all callers.
10829         (scan_relocatable_relocs): Likewise.
10830         * target.h (class Sized_target): Remove options parameter from
10831         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
10832         all callers.
10833         * gc.h (gc_process_relocs): Remove options parameter.  Change all
10834         callers.
10835         * arm.cc: Update functions to remove options parameters.
10836         * i386.cc: Likewise.
10837         * powerpc.cc: Likewise.
10838         * sparc.cc: Likewise.
10839         * x86_64.cc: Likewise.
10840         * testsuite/testfile.cc: Likewise.
10841
10842 2009-10-28  Doug Kwan  <dougkwan@google.com>
10843
10844         * arm.cc (Arm_relobj): New class definition.
10845         (Arm_relobj::scan_sections_for_stubs,
10846         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
10847         New method definitions.
10848
10849 2009-10-28  Cary Coutant  <ccoutant@google.com>
10850
10851         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
10852         (Plugin::cleanup_done_): New member.
10853         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
10854         (Plugin_manager::cleanup_done_): Remove.
10855         (Plugin_manager::add_input_file): Edit error message.
10856         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
10857         (Plugin_manager::cleanup): Remove use of cleanup_done_.
10858
10859 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
10860
10861         * fileread.cc: (File_read::View::~View): Use the new
10862         data_ownership_ filed.
10863         (File_read::~File_read): Dispose the new whole_file_view_.
10864         (File_read::open): Mmap the whole file if needed.
10865         (File_read::open): Use whole_file_view_ instead of contents_.
10866         (File_read::find_view): Use whole_file_view_ if applicable.
10867         (File_read::do_read): Use whole_file_view_ instead of contents_.
10868         (File_read::make_view): Use whole_file_view_ instead of contents_,
10869         update File_read::View::View call.
10870         (File_read::find_or_make_view): Update File_read::View::View
10871         call.
10872         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
10873         remove contents_
10874         (File_read::View::Data_ownership): New enum.
10875         (File_read::View::View): Replace bool mapped_ with Data_ownership
10876         argument.
10877         (File_read::View::mapped_): Remove (replaced by data_ownership_).
10878         (File_read::View::data_ownership_): New field.
10879         (File_read::contents_): Remove (replaced by whole_file_view_).
10880         (File_read::whole_file_view_): New field.
10881         * options.h (class General_options): Add --keep-files-mapped.
10882
10883 2009-10-27  Cary Coutant  <ccoutant@google.com>
10884
10885         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
10886         * testsuite/Makefile.am (plugin_test_5): New test case.
10887         * testsuite/Makefile.in: Regenerate.
10888
10889 2009-10-25  Doug Kwan  <dougkwan@google.com>
10890
10891         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
10892         from private to protected to allow access by child class.
10893         (Sized_relobj::do_relocate_sections): New method declaration.
10894         (Sized_relobj::relocate_sections): Virtualize.
10895         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
10896         Sized_relobj::relocate_sections.  Instantiate template explicitly
10897         for different target sizes and endianity.
10898
10899 2009-10-24  Doug Kwan  <dougkwan@google.com>
10900
10901         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
10902         (Arm_input_section::as_arm_input_section): New method.
10903         (Arm_output_section): New class definition.
10904         (Arm_output_section::create_stub_group,
10905         Arm_output_section::group_sections): New method definitions.
10906
10907 2009-10-22  Doug Kwan  <dougkwan@google.com>
10908
10909         * arm.cc (Arm_input_section): New class definition.
10910         (Arm_input_section::init, Arm_input_section:do_write,
10911         Arm_input_section::set_final_data_size,
10912         Arm_input_section::do_reset_address_and_file_offset): New method
10913         definitions.
10914
10915 2009-10-21  Doug Kwan  <dougkwan@google.com>
10916
10917         * arm.cc (Stub_table, Arm_input_section): New forward class
10918         declarations.
10919         (Stub_table): New class defintion.
10920         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
10921         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
10922         New method definition.
10923
10924 2009-10-21  Doug Kwan  <dougkwan@google.com>
10925
10926         * arm.cc: Update copyright comments.
10927         (Target_arm): New forward class template declaration.
10928         (Arm_address): New type.
10929         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
10930         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
10931         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
10932         constants.
10933         (Insn_template): Same.
10934         (DEF_STUBS): New macro.
10935         (Stub_type): New enum type.
10936         (Stub_template): New class definition.
10937         (Stub): Same.
10938         (Reloc_stub): Same.
10939         (Stub_factory): Same.
10940         (Target_arm::Target_arm): Initialize may_use_blx_ and
10941         should_force_pic_veneer_.
10942         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
10943         Target_arm::should_force_pic_veneer,
10944         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
10945         Target_arm::using_thumb_only, Target_arm:;default_target): New
10946         method defintions.
10947         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
10948         New data member declarations.
10949         (Insn_template::size, Insn_template::alignment): New method defintions.
10950         (Stub_template::Stub_template): New method definition.
10951         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
10952         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
10953         (Stub_factory::Stub_factory): New method definition.
10954         * gold.h (string_hash): New template.
10955         * output.h (Input_section_specifier::hash_value): Use
10956         gold::string_hash.
10957         (Input_section_specifier::string_hash): Remove.
10958         * stringpool.cc (Stringpool_template::string_hash): Use
10959         gold::string_hash.
10960
10961 2009-10-20  Doug Kwan  <dougkwan@google.com>
10962
10963         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
10964         symbols of relaxed input sections.
10965         * output.h (Output_section::find_relaxed_input_section): Make
10966         method public.
10967
10968 2009-10-16  Doug Kwan  <dougkwan@google.com>
10969
10970         * dynobj.cc (Versions::Versions): Initialize version_script_.
10971         Only insert base version symbol definition for a shared object
10972         if version script defines any version versions.
10973         (Versions::define_base_version): New method definition.
10974         (Versions::add_def): Check that base version is not needed.
10975         (Versions::add_need): Define base version lazily.
10976         * dynobj.h (Versions::define_base_version): New method declaration.
10977         (Versions::needs_base_version_): New data member declaration.
10978         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
10979         (check_DATA): Add no_version_test.stdout.
10980         (libno_version_test.so, no_version_test.o no_version_test.stdout):
10981         New make rules.
10982         * testsuite/Makefile.in: Regenerate.
10983         * testsuite/no_version_test.c: New file.
10984         * testsuite/no_version_test.sh: Ditto.
10985
10986 2009-10-16  Doug Kwan  <dougkwan@google.com>
10987
10988         * expression.cc (class Segment_start_expression): New class definition.
10989         (Segment_start_expression::value): New method definition.
10990         (script_exp_function_segment_start): Return a new
10991         Segment_start_expression.
10992         * gold/script-c.h (script_saw_segment_start_expression): New function
10993         prototype.
10994         * script-sections.cc (Script_sections::Script_sections): Initialize
10995         SAW_SEGMENT_START_EXPRESSION_ to false.
10996         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
10997         and -Tbbs options to specify section addresses if given in
10998         command line and no SEGMENT_START expression is seen in a script.
10999         * script-sections.h (Script_sections::saw_segment_start_expression,
11000         Script_sections::set_saw_segment_start_expression): New method
11001         definition.
11002         (Script_sections::saw_segment_start_expression_): New data member
11003         declaration.
11004         * script.cc (script_saw_segment_start_expression): New function.
11005         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
11006         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
11007         script_test_7.sh and script_test_8.sh.
11008         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
11009         script_test_8.stdout.
11010         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
11011         (script_test_6, script_test_6.stdout, script_test_7,
11012         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
11013         * Makefile.in: Regenerate.
11014         * testsuite/script_test_6.sh: New file.
11015         * testsuite/script_test_6.t: Same.
11016         * testsuite/script_test_7.sh: Same.
11017         * testsuite/script_test_7.t: Same.
11018         * testsuite/script_test_8.sh: Same.
11019
11020 2009-10-16  Doug Kwan  <dougkwan@google.com>
11021
11022         * output.cc (Output_segment::set_section_list_address): Cast
11023         expressions to unsigned long long type to avoid format warnings.
11024
11025 2009-10-15  Ian Lance Taylor  <iant@google.com>
11026
11027         * script.cc (Script_options::add_symbol_assignment): Always add a
11028         dot assignment to script_sections_.
11029         * script-sections.cc (Script_sections::add_dot_assignment):
11030         Initialize if necessary.
11031
11032         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
11033         program headers with no load segment if there is a linker script.
11034
11035         * layout.cc (Layout::set_segment_offsets): Align the file offset
11036         to the segment aligment for -N or -n with no load segment.
11037         * output.cc (Output_segment::add_output_section): Don't crash if
11038         the first section is a TLS section.
11039         (Output_segment::set_section_list_addresses): Print an error
11040         message if the address moves backward in a linker script.
11041         * script-sections.cc
11042         (Output_section_element_input::set_section_addresses): Don't
11043         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
11044         (Orphan_output_section::set_section_addresses): Likewise.
11045
11046 2009-10-15  Doug Kwan  <dougkwan@google.com>
11047
11048         * layout.cc (Layout::finish_dynamic_section): Generate tags
11049         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
11050         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
11051         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
11052
11053 2009-10-14  Ian Lance Taylor  <iant@google.com>
11054
11055         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
11056         fields.
11057         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
11058         data_shdr fields of relinfo.
11059         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
11060         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
11061         R_386_TLS_LDO_32, adjust based on section flags.
11062         (Target_i386::Relocate::fix_up_ldo): Remove.
11063
11064 2009-10-13  Ian Lance Taylor  <iant@google.com>
11065
11066         Add support for -pie.
11067         * options.h (class General_options): Add -pie and
11068         --pic-executable.
11069         (General_options::output_is_position_independent): Test -pie.
11070         (General_options::output_is_executable): Return true if not shared
11071         and not relocatable.
11072         (General_options::output_is_pie): Remove.
11073         * options.cc (General_options::finalize): Reject incompatible uses
11074         of -pie.
11075         * gold.cc (queue_middle_tasks): A -pie link is not static.
11076         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
11077         * symtab.cc (Symbol::final_value_is_known): Return false if
11078         output_is_position_independent.
11079         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
11080         output_is_position_independent.
11081         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
11082         output_is_position_independent.
11083         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
11084         output_is_position_independent.
11085         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
11086         two_file_pie_test.
11087         (basic_pie_test.o, basic_pie_test): New targets.
11088         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
11089         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
11090         (two_file_pie_test): New target.
11091         * testsuite/Makefile.in: Rebuild.
11092         * README: Remove note saying that -pie is not supported.
11093
11094 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
11095
11096         * options.h (class General_options): Add -init and -fini.
11097         * layout.cc (Layout::finish_dynamic_section): Emit
11098         given init and fini functions.
11099
11100 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
11101
11102         * gc.h (gc_process_relocs): Check if icf is enabled using new
11103         function.
11104         * gold.cc (queue_initial_tasks): Likewise.
11105         (queue_middle_tasks): Likewise.
11106         * object.cc (do_layout): Likewise.
11107         * symtab.cc (is_section_folded): Likewise.
11108         * main.cc (main): Likewise.
11109         * reloc.cc (Read_relocs::run): Likewise.
11110         (Sized_relobj::do_scan_relocs): Likewise.
11111         * icf.cc (is_function_ctor_or_dtor): New function.
11112         (Icf::find_identical_sections): Check if function is ctor or dtor when
11113         safe icf is chosen.
11114         * options.h (General_options::icf): Change option to be an enum.
11115         (Icf_status): New enum.
11116         (icf_enabled): New method.
11117         (icf_safe_folding): New method.
11118         (set_icf_status): New method.
11119         (icf_status_): New variable.
11120         * (options.cc) (General_options::finalize): Set icf_status_.
11121         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
11122         icf_test and icf_keep_unique_test to use the --icf enum flag.
11123         * testsuite/icf_safe_test.sh: New file.
11124         * testsuite/icf_safe_test.cc: New file.
11125
11126 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
11127
11128         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
11129         includes to gc.h and icf.h.
11130         * arm.cc: Include gc.h.
11131         * gold.cc: Likewise.
11132         * i386.cc: Likewise.
11133         * powerpc.cc: Likewise.
11134         * sparc.cc: Likewise.
11135         * x86_64.cc: Likewise.
11136         * gc.h: Include icf.h.
11137
11138 2009-10-11  Ian Lance Taylor  <iant@google.com>
11139
11140         * plugin.cc: Include "gold.h" before other header files.
11141
11142 2009-10-10  Chris Demetriou  <cgd@google.com>
11143
11144         * options.h (Input_file_argument::Input_file_type): New enum.
11145         (Input_file_argument::is_lib_): Replace with...
11146         (Input_file_argument::type_): New member.
11147         (Input_file_argument::Input_file_argument): Take Input_file_type
11148         'type' rather than boolean 'is_lib' as second argument.
11149         (Input_file_argument::is_lib): Use type_.
11150         (Input_file_argument::is_searched_file): New function.
11151         (Input_file_argument::may_need_search): Handle is_searched_file.
11152         * options.cc (General_options::parse_library): Support -l:filename.
11153         (General_options::parse_just_symbols): Update for Input_file_argument
11154         changes.
11155         (Command_line::process): Likewise.
11156         * archive.cc (Archive::get_file_and_offset): Likewise.
11157         * plugin.cc (Plugin_manager::release_input_file): Likewise.
11158         * script.cc (read_script_file, script_add_file): Likewise.
11159         * fileread.cc (Input_file::Input_file): Likewise.
11160         (Input_file::will_search_for): Handle is_searched_file.
11161         (Input_file::open): Likewise.
11162         * readsyms.cc (Read_symbols::get_name): Likewise.
11163         * testsuite/Makefile.am (searched_file_test): New test.
11164         * testsuite/Makefile.in: Regenerate.
11165         * testsuite/searched_file_test.cc: New file.
11166         * testsuite/searched_file_test_lib.cc: New file.
11167
11168 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11169             Ian Lance Taylor  <iant@google.com>
11170
11171         * descriptor.cc: Include <cstdio> and "binary-io.h".
11172         (Descriptors::open): Open the files in binary mode always.
11173         * script.cc (Lex::get_token): Treat \r as whitespace.
11174
11175 2009-10-09  Ian Lance Taylor  <iant@google.com>
11176
11177         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
11178
11179 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11180             Ian Lance Taylor  <iant@google.com>
11181
11182         * configure.ac: Check for readv function also.
11183         * fileread.cc (readv): Define if not HAVE_READV.
11184         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
11185         does not exist.
11186         * config.in: Regenerate.
11187         * configure: Regenerate.
11188
11189 2009-10-09  Doug Kwan  <dougkwan@google.com>
11190
11191         * layout.cc (Layout::make_output_section): Call target hook to make
11192         ordinary output section.
11193         (Layout::finalize): Adjust parameter list of call the
11194         Target::may_relax().
11195         * layout.h (class Layout::section_list): New method.
11196         * merge.h (Output_merge_base::entsize): Change visibility to public.
11197         (Output_merge_base::is_string, Output_merge_base::do_is_string):
11198         New methods.
11199         (Output_merge_string::do_is_string): New method.
11200         * object.cc (Sized_relobj::do_setup): renamed from
11201         Sized_relobj::set_up.
11202         * object.h (Sized_relobj::adjust_shndx,
11203         Sized_relobj::initializ_input_to_output_maps,
11204         Sized_relobj::free_input_to_output_maps): Change visibilities to
11205         protected.
11206         (Sized_relobj::setup): Virtualize.
11207         (Sized_relobj::do_setup): New method declaration.
11208         (Sized_relobj::invalidate_section_offset,
11209         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
11210         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
11211         * options.cc (parse_int): New function.
11212         * options.h (parse_int): New declaration.
11213         (DEFINE_int): New macro.
11214         (stub_group_size): New option.
11215         * output.cc (Output_section::Output_section): Initialize memebers
11216         merge_section_map_, merge_section_by_properties_map_,
11217         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
11218         (Output_section::add_input_section): Handled deferred code-fill
11219         generation and remove an old comment.
11220         (Output_section::add_relaxed_input_section): New method definition.
11221         (Output_section::add_merge_input_section): Use merge section by
11222         properties map to speed to search.  Update merge section maps
11223         as appropriate.
11224         (Output_section::build_relaxation_map): New method definition.
11225         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
11226         Same.
11227         (Output_section::relax_input_section): Renamed to
11228         Output_section::convert_input_sections_to_relaxed_sections and change
11229         interface to take a vector of pointers to relaxed sections.
11230         (Output_section::find_merge_section,
11231         Output_section::find_relaxed_input_section): New method definitions.
11232         (Output_section::is_input_address_mapped,
11233         Output_section::output_offset, Output_section::output_address):
11234         Use output section data maps to speed up searching.
11235         (Output_section::find_starting_output_address): Add comments.
11236         (Output_section::do_write,
11237         Output_section::write_to_postprocessing_buffer): Do code-fill
11238         generation as appropriate.
11239         (Output_section::get_input_sections): Invalidate relaxed input section
11240         map.
11241         (Output_section::restore_states): Adjust type of checkpoint .
11242         Invalidate relaxed input section map.
11243         * output.h (Output_merge_base): New class declaration.
11244         (Input_section_specifier): New class defintion.
11245         (class Output_relaxed_input_section) Change base class to
11246         Output_section_data_build.
11247         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
11248         base class initializer.
11249         (Output_section::add_relaxed_input_section): New method declaration.
11250         (Output_section::Input_section): Change visibility to protected.
11251         (Output_section::Input_section::relobj,
11252         Output_section::Input_section::shndx): Handle relaxed input sections.
11253         Output_section::input_sections) Change visibility to protected.  Also
11254         define overload to return a non-const pointer.
11255         (Output_section::Merge_section_properties): New class defintion.
11256         (Output_section::Merge_section_by_properties_map,
11257         Output_section::Output_section_data_by_input_section_map,
11258         Output_section::Relaxation_map): New types.
11259         (Output_section::relax_input_section): Rename method to
11260         Output_section::convert_input_sections_to_relaxed_sections and change
11261         interface to take a vector of relaxed section pointers.
11262         (Output_section::find_merge_section,
11263         Output_section::find_relaxed_input_section,
11264         Output_section::build_relaxation_map,
11265         Output_section::convert_input_sections_in_list_to_relaxed_sections):
11266         New method declarations.
11267         (Output_section::merge_section_map_
11268         Output_section::merge_section_by_properties_map_,
11269         Output_section::relaxed_input_section_map_,
11270         Output_section::is_relaxed_input_section_map_valid_,
11271         Output_section::generate_code_fills_at_write_): New data members.
11272         * script-sections.cc
11273         (Output_section_element_input::set_section_addresses): Call
11274         current_data_size and addralign methods of relaxed input sections.
11275         (Orphan_output_section::set_section_addresses): Call current_data_size
11276         and addralign methods of relaxed input sections.
11277         * symtab.cc (Symbol_table::compute_final_value): Extract template
11278         from the body of Symbol_table::sized_finalize_symbol.
11279         (Symbol_table::sized_finalized_symbol): Call
11280         Symbol_table::compute_final_value.
11281         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
11282         (Symbol_table::compute_final_value): New templated method declaration.
11283         * target.cc (Target::do_make_output_section): New method defintion.
11284         * target.h (Target::make_output_section): New method declaration.
11285         (Target::relax): Add more parameters for input objects, symbol table
11286         and layout.  Adjust call to do_relax.
11287         (Target::do_make_output_section): New method declaration.
11288         (Target::do_relax): Add parameters for input objects, symbol table
11289         and layout.
11290
11291 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11292
11293         * pread.c: Include stdio.h.
11294
11295 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11296
11297         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
11298         defined.
11299
11300 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11301
11302         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
11303         Change read_shndx type to unsigned int.
11304         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
11305         int.
11306         (Sized_dwarf_line_info::read_line_mappings): Likewise.
11307         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
11308         Change read_shndx type to unsigned int.
11309         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
11310         int.
11311         (Sized_dwarf_line_info::read_line_mappings): Likewise.
11312         * layout.cc (Layout::create_symtab_sections): Cast the result of
11313         local_symcount * symsize to off_t in the gold_assert.
11314
11315 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11316
11317         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
11318         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
11319         R_ARM_BASE_ABS.
11320         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
11321         (Arm_relocate_functions::thm_abs5): New function.
11322         (Arm_relocate_functions::abs12): New function.
11323         (Arm_relocate_functions::abs16): New function.
11324         (Arm_relocate_functions::base_abs): New function.
11325         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
11326         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
11327         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
11328         R_ARM_BASE_ABS.
11329         (Scan::global): Likewise.
11330         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
11331         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
11332         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
11333         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
11334         R_ARM_BASE_ABS.
11335
11336 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11337
11338         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
11339         (Arm_relocate_functions::movt_prel): New function.
11340         (Arm_relocate_functions::thm_movw_prel_nc): New function.
11341         (Arm_relocate_functions::thm_movt_prel): New function.
11342         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
11343         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
11344         (Scan::global, Relocate::relocate): Likewise.
11345         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11346
11347 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
11348
11349         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
11350         Incremental_checker.
11351         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
11352         unsigned int.
11353         (class Incremental_inputs_header): New class.
11354         (Incremental_inputs_header_writer): Edit comment.
11355         (Incremental_inputs_entry): New class.
11356         (Incremental_inputs_entry_writer): Edit comment.
11357         (Sized_incremental_binary::do_find_incremental_inputs_section):
11358         Add *strtab_shndx parameter, fill it.
11359         (Sized_incremental_binary::do_check_inputs): New method.
11360         (Incremental_checker::can_incrementally_link_output_file): Use
11361         Sized_incremental_binary::check_inputs.
11362         (Incremental_inputs::report_command_line): Save command line in
11363         command_line_.
11364         * incremental.h:
11365         (Incremental_binary::find_incremental_inputs_section): New
11366         method.
11367         (Incremental_binary::do_find_incremental_inputs_section): Add
11368         strtab_shndx parameter.
11369         (Incremental_binary::do_check_inputs): New pure virtual method.
11370         (Sized_incremental_binary::do_check_inputs): Declare.
11371         (Incremental_checker::Incremental_checker): Add incremental_inputs
11372         parameter, use it to initialize incremental_inputs_.
11373         (Incremental_checker::incremental_inputs_): New field.
11374         (Incremental_checker::command_line): New method.
11375         (Incremental_checker::inputs): New method.
11376         (Incremental_checker::command_line_): New field.
11377
11378 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
11379
11380         * incremental.cc: Include <cstdarg> and "target-select.h".
11381         (vexplain_no_incremental): New function.
11382         (explain_no_incremental): New function.
11383         (Incremental_binary::error): New method.
11384         (Sized_incremental_binary::do_find_incremental_inputs_section): New
11385         method.
11386         (make_sized_incremental_binary): New function.
11387         (open_incremental_binary): New function.
11388         (can_incrementally_link_file): Add checks if output is ELF and has
11389         inputs section.
11390         * incremental.h: Include "elfcpp_file.h" and "output.h".
11391         (Incremental_binary): New class.
11392         (Sized_incremental_binary): New class.
11393         (open_incremental_binary): Declare.
11394         * object.cc (is_elf_object): Use
11395         elfcpp::Elf_recognizer::is_elf_file.
11396         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
11397         * output.h (Output_file::filesize): New method.
11398
11399 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11400
11401         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
11402         New function.
11403         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
11404         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
11405         function.
11406         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
11407         function.
11408         (Arm_relocate_functions::movw_abs_nc): New function.
11409         (Arm_relocate_functions::movt_abs): New function.
11410         (Arm_relocate_functions::thm_movw_abs_nc): New function.
11411         (Arm_relocate_functions::thm_movt_abs): New function.
11412         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
11413         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
11414         (Scan::global): Likewise.
11415         (Relocate::relocate): Likewise.
11416         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11417
11418 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11419
11420         * arm.cc (Arm_relocate_functions::got_prel) New function.
11421         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
11422         (Relocate::relocate): Likewise.
11423         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11424
11425 2009-10-06  Ian Lance Taylor  <iant@google.com>
11426
11427         * options.h (class General_options): Define
11428         split_stack_adjust_size parameter.
11429         * object.h (class Object): Add uses_split_stack_ and
11430         has_no_split_stack_ fields.  Add uses_split_stack and
11431         has_no_split_stack accessor functions.  Declare
11432         handle_split_stack_section.
11433         (class Reloc_symbol_changes): Define.
11434         (class Sized_relobj): Define Function_offsets.  Declare
11435         split_stack_adjust, split_stack_adjust_reltype, and
11436         find_functions.
11437         * object.cc (Object::handle_split_stack_section): New function.
11438         (Sized_relobj::do_layout): Call handle_split_stack_section.
11439         * dynobj.cc (Sized_dynobj::do_layout): Call
11440         handle_split_stack_section.
11441         * reloc.cc (Sized_relobj::relocate_sections): Call
11442         split_stack_adjust for executable sections in split_stack
11443         objects.  Pass reloc_map to relocate_section.
11444         (Sized_relobj::split_stack_adjust): New function.
11445         (Sized_relobj::split_stack_adjust_reltype): New function.
11446         (Sized_relobj::find_functions): New function.
11447         * target-reloc.h: Include "object.h".
11448         (relocate_section): Add reloc_symbol_changes parameter.  Change
11449         all callers.
11450         * target.h (class Target): Add calls_non_split method.  Declare
11451         do_calls_non_split virtual method.  Declare match_view and
11452         set_view_to_nop.
11453         * target.cc: Include "elfcpp.h".
11454         (Target::do_calls_non_split): New function.
11455         (Target::match_view): New function.
11456         (Target::set_view_to_nop): New function.
11457         * gold.cc (queue_middle_tasks): Give an error if mixing
11458         split-stack and non-split-stack objects with -r.
11459         * i386.cc (Target_i386::relocate_section): Add
11460         reloc_symbol_changes parameter.
11461         (Target_i386::do_calls_non_split): New function.
11462         * x86_64.cc (Target_x86_64::relocate_section): Add
11463         reloc_symbol_changes parameter.
11464         (Target_x86_64::do_calls_non_split): New function.
11465         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
11466         parameter.
11467         * powerpc.cc (Target_powerpc::relocate_section): Add
11468         reloc_symbol_changes parameter.
11469         * sparc.cc (Target_sparc::relocate_section): Add
11470         reloc_symbol_changes parameter.
11471         * configure.ac: Call AM_CONDITIONAL for the default target.
11472         * configure: Rebuild.
11473         * testsuite/Makefile.am (TEST_AS): New variable.
11474         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
11475         (check_DATA): Add split_i386 and split_x86_64 files.
11476         (SPLIT_DEFSYMS): Define.
11477         (split_i386_[1234n].o): New targets.
11478         (split_i386_[124]): New targets.
11479         (split_i386_[1234r].stdout): New targets.
11480         (split_x86_64_[1234n].o): New targets.
11481         (split_x86_64_[124]): New targets.
11482         (split_x86_64_[1234r].stdout): New targets.
11483         (MOSTLYCLEANFILES): Add new executables.
11484         * testsuite/split_i386.sh: New file.
11485         * testsuite/split_x86_64.sh: New file.
11486         * testsuite/split_i386_1.s: New file.
11487         * testsuite/split_i386_2.s: New file.
11488         * testsuite/split_i386_3.s: New file.
11489         * testsuite/split_i386_4.s: New file.
11490         * testsuite/split_i386_n.s: New file.
11491         * testsuite/split_x86_64_1.s: New file.
11492         * testsuite/split_x86_64_2.s: New file.
11493         * testsuite/split_x86_64_3.s: New file.
11494         * testsuite/split_x86_64_4.s: New file.
11495         * testsuite/split_x86_64_n.s: New file.
11496         * testsuite/testfile.cc (Target_test): Update relocation_section
11497         function.
11498         * testsuite/Makefile.in: Rebuild.
11499
11500 2009-10-06  Ian Lance Taylor  <iant@google.com>
11501
11502         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
11503         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
11504         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
11505         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
11506         the address on ldo_addrs_.
11507         (Target_i386::Relocate::fix_up_ldo): New function.
11508
11509 2009-10-06   Rafael Espindola  <espindola@google.com>
11510
11511         * plugin.cc (add_input_library): New.
11512         (Plugin::load): Add add_input_library to tv.
11513         (Plugin_manager::add_input_file): Add the is_lib argument.
11514         (add_input_file): Update call to Plugin_manager::add_input_file.
11515         (add_input_library): New.
11516         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
11517
11518 2009-09-30  Doug Kwan  <dougkwan@google.com>
11519
11520         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
11521         symbol and call Symbol::may_need_copy_reloc to determine if
11522         a copy reloc is needed.
11523         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
11524         nocopyreloc is given in command line.
11525         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
11526         given in command line.
11527         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
11528         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
11529         of the removed Target_i386::may_need_copy_reloc.
11530         * options.h (copyreloc): New option with default value false.
11531         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
11532         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
11533         instead of the removed Target_powerpc::may_need_copy_reloc.
11534         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
11535         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
11536         instead of the removed Target_sparc::may_need_copy_reloc.
11537         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
11538         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
11539         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
11540         instead of the removed Target_x86_64::may_need_copy_reloc.
11541
11542 2009-09-30  Ian Lance Taylor  <iant@google.com>
11543
11544         * object.h (class Object): Remove target_ field, and target,
11545         sized_target, and set_target methods.
11546         (Object::sized_target): Remove.
11547         (class Sized_relobj): Update declarations.  Remove sized_target.
11548         * object.cc (Sized_relobj::setup): Remove target parameter.
11549         Change all callers.
11550         (Input_objects::add_object): Don't do anything with the target.
11551         (make_elf_sized_object): Add punconfigured parameter.  Change all
11552         callers.  Set or test parameter target.
11553         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
11554         Change all callers.
11555         * parameters.cc (Parameters::set_target): Change parameter type to
11556         be non-const.
11557         (Parameters::default_target): Remove.
11558         (set_parameters_target): Change parameter type to be non-const.
11559         (parameters_force_valid_target): New function.
11560         (parameters_clear_target): New function.
11561         * parameters.h (class Parameters): Update declarations.  Remove
11562         default_target method.  Add sized_target and clear_target
11563         methods.  Change target_ to be non-const.
11564         (set_parameters_target): Update declaration.
11565         (parameters_force_valid_target): Declare.
11566         (parameters_clear_target): Declare.
11567         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
11568         as NULL if we aren't searching.
11569         (Add_symbols::run): Don't check for compatible target.
11570         * fileread.cc (Input_file::open_binary): Call
11571         parameters_force_valid_target.
11572         * gold.cc (queue_middle_tasks): Likewise.
11573         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
11574         set_target on object.
11575         * dynobj.h (class Sized_dynobj): Update declarations.
11576         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
11577         make_elf_object returns NULL.
11578         (Archive::include_member): Don't check whether object target is
11579         compatible.
11580         * output.cc (Output_section::add_input_section): Get target from
11581         parameters.
11582         (Output_section::relax_input_section): Likewise.
11583         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
11584         parameters.
11585         (Sized_relobj::do_scan_relocs): Likewise.
11586         (Sized_relobj::relocate_sections): Likewise.
11587         * resolve.cc (Symbol_table::resolve): Likewise.
11588         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
11589         parameter.  Change all callers.
11590         (Symbol_table::add_from_object): Get target from parameters.
11591         (Symbol_table::add_from_relobj): Don't check object target.
11592         (Symbol_table::add_from_dynobj): Likewise.
11593         (Symbol_table::define_special_symbol): Get target from
11594         parameters.
11595         * symtab.h (class Symbol_table): Update declaration.
11596         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
11597         parameter.  Change all callers.  Clear parameter target.
11598         (Binary_test): Test target here.
11599         * testsuite/object_unittest.cc (gold_testsuite): Remove
11600         target_test_pointer parameter.  Change all callers.
11601         (Object_test): Test target here.
11602
11603 2009-09-26  Ian Lance Taylor  <iant@google.com>
11604
11605         * testsuite/initpri1.c: Don't try to use constructor priorities if
11606         compiling with gcc before 4.3.
11607
11608 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
11609
11610         * testsuite/retain_symbols_file_test.sh (check_present): Change
11611         output file name to retain_symbols_file_test.stdout.
11612         (check_absent): Likewise.
11613
11614 2009-09-18  Craig Silverstein  <csilvers@google.com>
11615
11616         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
11617         * options.cc: Include <cerrno> and <fstream>.
11618         (General_options::finalize): Parse -retain-symbols-file tag.
11619         * options.h: New flag.
11620         (General_options): New method should_retain_symbol, new
11621         variable symbols_to_retain.
11622         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
11623         should_retain_symbol map.
11624         * testsuite/Makefile.am (retain_symbols_file_test): New test.
11625         * testsuite/Makefile.in: Regenerate.
11626         * testsuite/retain_symbols_file_test.sh: New file.
11627
11628 2009-09-18  Nick Clifton  <nickc@redhat.com>
11629
11630         * po/es.po: Updated Spanish translation.
11631
11632 2009-09-17  Doug Kwan  <dougkwan@google.com>
11633
11634         * debug.h (DEBUG_RELAXATION): New constant.
11635         (DEBUG_ALL): Add DEBUG_RELAXATION.
11636         (debug_string_to_enum): Add relaxation debug option.
11637         * layout.cc
11638         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
11639         Layout::Relaxation_debug_check::read_sections,
11640         Layout::Relaxation_debug_check::read_sections): New method definitions.
11641         (Layout::Layout): Initialize data members
11642         record_output_section_data_from_scrips_,
11643         script_output_section_data_list_ and relaxation_debug_check_.
11644         (Layout::save_segments, Layout::restore_segments,
11645         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
11646         Layout::relaxation_loop_body): New method definitions.
11647         (Layout::finalize): Support relaxation.  Move section layout code to
11648         Layout::relaxation_loop_body.
11649         (Layout::set_asection_address_from_script): Move code for orphan
11650         section placement out.
11651         (Layout::place_orphan_sections_in_script): New method definition.
11652         * layout.h (Output_segment_headers, Output_file_header):
11653         New forward class declarations.
11654         (Layout::~Layout): Define.
11655         (Layout::new_output_section_data_from_script): New method definition.
11656         (Layout::place_orphan_sections_in_script): New method declaration.
11657         (Layout::Segment_states): New type declaration.
11658         (Layout::save_segments, Layout::restore_segments,
11659         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
11660         Layout::relaxation_loop_body): New method declarations.
11661         (Layout::Output_section_data_list): New type declaration.
11662         (Layout::Relaxation_debug_check): New class definition.
11663         (Layout::record_output_section_data_from_script_,
11664         Layout::script_output_section_data_list_, Layout::segment_states_,
11665         Layout::relaxation_debug_check_): New data members.
11666         * output.cc: (Output_section_headers::do_size): New method definition.
11667         (Output_section_headers::Output_section_headers): Move size
11668         computation to Output_section_headers::do_size.
11669         (Output_segment_headers::do_size): New method definition.
11670         (Output_file_header::Output_file_header): Move size computation to
11671         Output_file_header::do_size and call it.
11672         (Output_file_header::do_size): New method definition.
11673         (Output_data_group::Output_data_group): Adjust call to
11674         Output_section_data.
11675         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
11676         (Output_symtab_xindex::do_write): Add array bound check.
11677         (Output_section::Input_section::print_to_mapfile): Handle
11678         RELAXED_INPUT_SECTION_CODE.
11679         (Output_section::Output_section): Initialize data member checkpoint_.
11680         (Output_section::~Output_section): Delete checkpoint object pointed
11681         by checkpoint_.
11682         (Output_section::add_input_section): Always add an Input_section if
11683         relaxing.
11684         (Output_section::add_merge_input_section): Add assert.
11685         (Output_section::relax_input_section): New method definition.
11686         (Output_section::set_final_data_size): Set load address to zero for
11687         an unallocated section.
11688         (Output_section::do_address_and_file_offset_have_reset_values):
11689         New method definition.
11690         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
11691         Handle relaxed input section.
11692         (Output_section::sort_attached_input_sections): Checkpoint input
11693         section list lazily.
11694         (Output_section::get_input_sections): Change type of input_sections to
11695         list of Simple_input_section pointers.  Checkpoint input section list
11696         lazily.  Also handle relaxed input sections.
11697         (Output_section::add_input_section_for_script): Take a reference to
11698         a Simple_input_section object instead of Relobj pointer and section
11699         index as parameter.  Handle relaxed input sections.
11700         (Output_section::save_states, Output_section::restore_states): New
11701         method definitions.
11702         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
11703         (Output_data::is_data_size_fixed): New method definition.
11704         (Output_data::reset_addresss_and_file_offset): Do not reset data size
11705         if it is fixed.
11706         (Output_data::address_and_file_offset_have_reset_values): New method
11707         definition.
11708         (Output_data::do_address_and_file_offset_have_reset_values): New method
11709         definition.
11710         (Output_data::set_data_size): Check that data size is not fixed.
11711         (Output_data::fix_data_size): New method definition.
11712         (Output_data::is_data_size_fixed_): New data member.
11713         (Output_section_headers::set_final_data_size): New method definition.
11714         (Output_section_headers::do_size): New method declaration.
11715         (Output_segment_headers::set_final_data_size): New method definition.
11716         (Output_segment_headers::do_size): New method declaration.
11717         (Output_file_header::set_final_data_size)::New method definition.
11718         (Output_file_header::do_size)::New method declaration.
11719         (Output_section_data::Output_section_data): Add new parameter
11720         is_data_size_fixed and use it to fix data size.
11721         (Output_data_const::Output_data_const): Adjust call to base class
11722         constructor and fix data size.
11723         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
11724         base class constructor and fix data size.
11725         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
11726         base class constructor and fix data size.
11727         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
11728         class constructor and fix data size.
11729         (Output_data_group::set_final_data_size): New method definition.
11730         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
11731         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
11732         class constructor and fix data size.
11733         (Output_relaxed_input_section): New class definition.
11734         (Output_section::Simple_input_section): New class definition.
11735         (Output_section::get_input_sections): Adjust parameter list.
11736         (Output_section::add_input_section_for_script): Same.
11737         (Output_section::save_states, Output_section::restore_states,
11738         Output_section::do_address_and_file_offset_have_reset_values,
11739         (Output_section::Input_section::Input_section): Handle
11740         RELAXED_INPUT_SECTION_CODE.  Add new overload for
11741         Output_relaxed_input_section.
11742         (Output_section::Input_section::is_input_section,
11743         Output_section::Input_section::set_output_section): Handle relaxed
11744         input section.
11745         (Output_section::Input_section::is_relaxed_input_section,
11746         Output_section::Input_section::output_section_data,
11747         Output_section::Input_section::relaxed_input_section): New method
11748         definitions.
11749         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
11750         value.
11751         (Output_section::Input_section::u1_): Update comments.
11752         (Output_section::Input_section::u2_): Add new union member poris.
11753         (Output_section::Checkpoint_output_section): New classs definition.
11754         (Output_section::relax_input_section): New method declaration.
11755         (Output_section::checkpoint_): New data member.
11756         (Output_segment): Update comments.
11757         (Output_segment::Output_segment): Un-privatize copy constructor.
11758         (Output_segment::operator=): Un-privatize.
11759         * script-sections.cc (Output_section_element::Input_section_list):
11760         Change element type to Output_section::Simple_input_section.
11761         (Output_section_element_dot_assignment::set_section_addresses):
11762         Register output section data for relaxation clean up.
11763         (Output_data_exression::Output_data_expression): Adjust call to base
11764         constructor to fix data size.
11765         (Output_section_element_data::set_section_addresses): Register
11766         Output_data_expression object for relaxation clean up.
11767         (struct Input_section_info): Replace Relobj pointer and section index
11768         pair with Output_section::Simple_input_section and Convert struct to a
11769         class.
11770         (Input_section_sorter::operator()): Adjust access to
11771         Input_section_info data member to use accessors.
11772         (Output_section_element_input::set_section_addresses): Use layout
11773         parameter.  Adjust code to use Output_section::Simple_input_section
11774         and Input_secction_info classes.  Register filler for relaxation
11775         clean up.
11776         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
11777         and section index pair with Output_section::Simple_input_section
11778         class.  Adjust code accordingly.
11779         (Phdrs_element::release_segment): New method definition.
11780         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
11781         segment list.
11782         (Script_sections::release_segments): New method definition.
11783         * gold/script-sections.h (Script_sections::release_segments): New
11784         method declaration.
11785         * gold/target.h (Target::may_relax, Target::relax,
11786         Target::do_may_relax, Target::do_relax): New method definitions.
11787
11788 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11789
11790         * arm.cc (has_signed_unsigned_overflow): New function.
11791         (Arm_relocate_functions::abs8): New function.
11792         (Target_arm::Scan::local): Handle R_ARM_ABS8.
11793         (Target_arm::Scan::global): Likewise.
11794         (Target_arm::relocate::relocate): Likewise.
11795         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
11796         Likewise.
11797
11798 2009-09-16  Cary Coutant  <ccoutant@google.com>
11799
11800         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
11801         * testsuite/Makefile.in: Regenerate.
11802
11803 2009-09-11  Nick Clifton  <nickc@redhat.com>
11804
11805         * po/gold.pot: Updated by the Translation project.
11806
11807 2009-09-08  Cary Coutant  <ccoutant@google.com>
11808
11809         * output.cc (Output_file::open): Add execute permission to empty file.
11810         * testsuite/Makefile.am (permission_test): New test.
11811         * testsuite/Makefile.in: Regenerate.
11812
11813 2009-09-02  Ian Lance Taylor  <iant@google.com>
11814
11815         * output.cc (Output_file::resize): Call map_no_anonymous rather
11816         than map.
11817
11818 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
11819
11820         * gold.cc: Include "incremental.h".
11821         (queue_initial_tasks): Call Incremental_checker methods.
11822         * incremental.cc: Include "output.h".
11823         (Incremental_checker::can_incrementally_link_output_file): New
11824         method.
11825         * incremental.h (Incremental_checker): New class.
11826
11827         * output.cc (Output_file::open_for_modification): New method.
11828         (Output_file::map_anonymous): Changed return type to bool.  Record
11829         map in base_ field.
11830         (Output_file::map_no_anonymous): New method, broken out of map.
11831         (Output_file::map): Use map_no_anonymous and map_anonymous.
11832         * output.h (class Output_file): Update declarations.
11833
11834 2009-08-24  Cary Coutant  <ccoutant@google.com>
11835
11836         * options.h (Command_line::Pre_options): New class.
11837         (Command_line::pre_options): New member.
11838         * options.cc (gold::options::ready_to_register): New variable.
11839         (One_option::register_option): Do nothing if not registering options.
11840         Assert if same short option registered twice.
11841         (General_options::General_options): Turn off option registration when
11842         done constructing.
11843         (Command_line::Pre_options::Pre_options): New constructor.
11844
11845 2009-08-24  Cary Coutant  <ccoutant@google.com>
11846
11847         * options.h (General_options::no_keep_memory): Remove incorrect
11848         short option.
11849
11850 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
11851
11852         * Makefile.am (am__skiplex, am__skipyacc): New.
11853         * Makefile.in: Regenerate.
11854
11855 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
11856
11857         * Makefile.am (AM_CPPFLAGS): Renamed from ...
11858         (INCLUDES): ... this.
11859         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
11860         (AM_CPPFLAGS): Renamed from ...
11861         (INCLUDE): ... this.
11862         * Makefile.in, testsuite/Makefile.in: Regenerate.
11863
11864         * Makefile.in: Regenerate.
11865         * aclocal.m4: Likewise.
11866         * config.in: Likewise.
11867         * configure: Likewise.
11868         * testsuite/Makefile.in: Likewise.
11869
11870         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
11871         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
11872         * Makefile.in: Regenerate.
11873         * testsuite/Makefile.in: Regenerate.
11874
11875 2009-08-19  Cary Coutant  <ccoutant@google.com>
11876
11877         * resolve.cc (Symbol_table::resolve): Don't complain about defined
11878         symbols in shared libraries overridden by hidden or internal symbols
11879         in the main program.
11880
11881 2009-08-19  Chris Demetriou  <cgd@google.com>
11882
11883         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
11884         checking source file names in error messages.
11885
11886 2009-08-18  Doug Kwan  <dougkwan@google.com>
11887
11888         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
11889         an elcpp::Ehdr as parameter.  Adjust call to set_target.
11890         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
11891         an elfcpp::Ehdr as parameter.
11892         * object.cc (Object::set_target): Remove the version that looks up
11893         a target and sets it.
11894         (Sized_relobj::setup): Take a Target object instead of
11895         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
11896         (make_elf_sized_object): Find target and ask target to
11897         make an ELF object.
11898         * object.h: (Object::set_target): Remove the version that looks up
11899         a target and sets it.
11900         (Sized_relobj::setup): Take a Target object instead of
11901         an elfcpp:Ehdr as parameter.
11902         * target.cc: Include dynobj.h.
11903         (Target::do_make_elf_object_implementation): New.
11904         (Target::do_make_elf_object): New.
11905         * target.h (Target::make_elf_object): New template declaration.
11906         (Target::do_make_elf_object): New method declarations.
11907         (Target::do_make_elf_object_implementation): New template declaration.
11908
11909 2009-08-14  Ian Lance Taylor  <iant@google.com>
11910
11911         * gold.h (FUNCTION_NAME): Define.
11912         (gold_unreachable): Use FUNCTION_NAME.
11913
11914 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
11915
11916         * icf.cc (Icf::find_identical_sections): Issue a warning when a
11917         symbol in the --keep-unique list is not found.
11918
11919 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
11920
11921         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
11922         been maked as --keep-unique.
11923         (Icf::unfold_section): New function.
11924         * icf.h (Icf::unfold_section): New function.
11925         * options.h (General_options::keep_unique): New option.
11926         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
11927         * testsuite/Makefile.in: Regenerate.
11928         * testsuite/icf_keep_unique_test.sh: New file.
11929         * testsuite/icf_keep_unique_test.cc: New file.
11930
11931 2009-08-12  Cary Coutant  <ccoutant@google.com>
11932
11933         PR 10471
11934         * resolve.cc (Symbol_table::resolve): Check for references from
11935         dynamic objects to hidden and internal symbols.
11936         * testsuite/Makefile.am (hidden_test.sh): New test.
11937         * testsuite/Makefile.in: Regenerate.
11938         * testsuite/hidden_test.sh: New script.
11939         * testsuite/hidden_test_1.c: New test source.
11940         * testsuite/hidden_test_main.c: New test source.
11941
11942 2009-08-11  Doug Kwan  <dougkwan@google.com>
11943
11944         * arm.cc: Update comments.
11945         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
11946         segment to locate the .ARM.exidx section if present.
11947
11948 2009-08-09  Doug Kwan  <dougkwan@google.com>
11949
11950         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
11951         patch.
11952
11953 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
11954         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
11955         compiler warnings.
11956
11957 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
11958
11959         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
11960         valid tls_segment only for non-debug-section relocations.
11961         * testsuite/Makefile.am: Add gc_tls_test.
11962         * testsuite/Makefile.in: Regenerate.
11963         * testsuite/gc_tls_test.cc: New file.
11964         * testsuite/gc_tls_test.sh: New file.
11965
11966 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
11967
11968         * icf.cc: New file.
11969         * icf.h: New file.
11970         * Makefile.am (CCFILES): Add icf.cc.
11971         (HFILES): Add icf.h
11972         * Makefile.in: Regenerate.
11973         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
11974         * gc.h (gc_process_relocs): Populate lists used by icf to contain
11975         section, symbol and addend information for the relocs.
11976         * gold.cc (queue_middle_tasks): Call identical code folding.
11977         * gold.h: Add defines for multimap.
11978         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
11979         to the call of finalize_local_symbols.
11980         * main.cc (main): Create object of class Icf.
11981         * object.cc (Sized_relobj::do_layout): Allow this function to be
11982         called twice during icf.
11983         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
11984         to sections marked as identical by icf.
11985         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
11986         when available.
11987         (Sized_relobj::do_section_entsize): New function.
11988         * object.h (Object::section_entsize): New function.
11989         (Object::do_section_entsize): New pure virtual function.
11990         (Relobj::finalize_local_symbols): Add new parameter.
11991         (Relobj::do_section_entsize): New function.
11992         * options.h (General_options::icf): New option.
11993         (General_options::icf_iterations): New option.
11994         (General_options::print_icf_sections): New option.
11995         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
11996         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
11997         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
11998         icf.
11999         * symtab.cc (Symbol_table::is_section_folded): New function.
12000         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
12001         to sections marked as identical by icf.
12002         * symtab.h (Symbol_table::set_icf): New function.
12003         (Symbol_table::icf): New function.
12004         (Symbol_table::is_section_folded): New function.
12005         (Symbol_table::icf_): New data member.
12006         * target-reloc.h (relocate_section): Ignore sections folded by icf.
12007         * testsuite/Makefile.am: Add commands to build icf_test.
12008         * testsuite/Makefile.in: Regenerate.
12009         * testsuite/icf_test.sh: New file.
12010         * testsuite/icf_test.cc: New file.
12011
12012 2009-07-24  Chris Demetriou  <cgd@google.com>
12013
12014         * layout.cc (is_compressible_debug_section): Fix incorrect
12015         comment about compressed section names.
12016
12017 2009-07-20  Ian Lance Taylor  <ian@airs.com>
12018
12019         PR 10419
12020         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
12021
12022 2009-07-16  Ian Lance Taylor  <iant@google.com>
12023
12024         PR 10400
12025         * layout.h: #include <map>.
12026         (class Kept_section): Change from struct to class.  Add accessors
12027         and setters.  Add section size to Comdat_group mapping.  Change
12028         Comdat_group to std::map.  Add is_comdat_ field.  Add
12029         linkonce_size field in union.
12030         (class Layout): Update declaration of find_or_add_kept_section.
12031         Don't declare find_kept_object.
12032         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
12033         parameter.  Add object, shndx, is_comdat, and is_group_name
12034         parameters.  Change all callers.  Adjust for new Kept_section.
12035         (Layout::find_kept_object): Remove.
12036         * object.cc (Sized_relobj::include_section_group): Update use of
12037         Kept_section.  Rename secnum to shndx.  Only record
12038         Kept_comdat_section if sections are the same size.
12039         (Sized_relobj::include_linkonce_section): Update use of
12040         Kept_section.  Only record Kept_comdat_section if sections are the
12041         same size.  Set size of linkonce section.
12042         (Sized_relobj::map_to_kept_section): Update call to
12043         get_kept_comdat_section.
12044         * object.h (class Sized_relobj): Rename fields in
12045         Kept_comdat_section to drop trailing underscores; change object
12046         field to Relobj*.  Change Kept_comdat_section_table to store
12047         struct rather than pointer.
12048         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
12049         Add kept_object and kept_shndx parameters.  Change all callers.
12050         (Sized_relobj::get_kept_comdat_section): Change return type to
12051         bool.  Add kept_object and kept_shndx parameters.  Change all
12052         callers.
12053         * plugin.cc (Pluginobj::include_comdat_group): Update call to
12054         Layout::find_or_add_kept_section.
12055
12056 2009-07-09  Ian Lance Taylor  <iant@google.com>
12057
12058         * merge.cc (Object_merge_map::initialize_input_to_output_map):
12059         Reserve space in the hash table.
12060
12061 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
12062
12063         * fileread.cc (File_read::get_mtime): New method.
12064         * fileread.h (Timespec): New structure.
12065         (File_read::get_mtime): New method.
12066         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
12067         Renamed from timestamp_nsec.
12068         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
12069         Elf_Xword.
12070         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
12071         timestamp_nsec.
12072         (Incremental_inputs::report_archive): Save mtime; style fix.
12073         (Incremental_inputs::report_obejct): Save mtime; style fix.
12074         (Incremental_inputs::report_script): Save mtime; style fix.
12075         (Incremental_inputs::finalize_inputs): Style fix.
12076         (Incremental_inputs::finalize): Style fix.
12077         (Incremental_inputs::create_input_section_data): Store inputs
12078         mtime.
12079         * incremental.h (Incremental_inputs::report_script): Add mtime
12080         argument.
12081         (Incremental_inputs::Input_info::Input_info): Intialize only one
12082         union member.
12083         (Incremental_inputs::Input_info::archive): Move to nameless
12084         union.
12085         (Incremental_inputs::Input_info::obejct): Move to nameless union.
12086         (Incremental_inputs::Input_info::script): Move to nameless union.
12087         (Incremental_inputs::mtime): New field.
12088         * script.cc (read_input_script): Pass file mtime to
12089         Incremental_input.
12090         * script.h (Script_info::inputs): Style fix.
12091
12092 2009-07-01  Ian Lance Taylor  <ian@airs.com>
12093
12094         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
12095         instead of 32.
12096
12097 2009-06-24  Ian Lance Taylor  <iant@google.com>
12098
12099         PR 10156
12100         * layout.cc (Layout::choose_output_section): If we find an
12101         existing section, update the flags.
12102         (Layout::create_notes): New function, broken out of
12103         Layout::finalize.
12104         (Layout::finalize): Don't create note sections.
12105         (Layout::create_note): Don't crash if linker script discards
12106         section.
12107         (Layout::create_gold_note): Likewise.
12108         (Layout::create_build_id): Likewise.  Don't set
12109         after_input_sections on the section.
12110         (Layout::create_executable_stack_info): Remove target parameter.
12111         Change caller.
12112         * layout.h (class Layout): Declare create_notes.  Update
12113         declaration of create_executable_stack_info.
12114         * gold.cc (queue_middle_tasks): Call create_notes.
12115         * output.cc (Output_section::update_flags_for_input_section): Move
12116         here from output.h.  If SHF_ALLOC flag is newly set, mark address
12117         invalid.
12118         * output.h (Output_data::mark_address_invalid): New function.
12119         (class Output_section): Only declare, not define,
12120         update_flags_for_input_section.  Remove set_flags.
12121
12122 2009-06-24  Ian Lance Taylor  <iant@google.com>
12123
12124         * script-sections.cc (Output_section_definition::
12125         set_section_addresses): Rename shadowing local load_address to
12126         laddr.
12127
12128 2009-06-24  Ian Lance Taylor  <iant@google.com>
12129
12130         PR 10244
12131         * reloc.cc (relocate_sections): Skip empty relocation sections.
12132
12133 2009-06-23  Ian Lance Taylor  <iant@google.com>
12134
12135         PR 10156
12136         * layout.cc (Layout::create_note): Use choose_output_section
12137         rather than make_output_section.
12138
12139 2009-06-23  Ian Lance Taylor  <iant@google.com>
12140
12141         PR 10237
12142         * options.cc (General_options::parse_V): Set printed_version_.
12143         (General_options::General_options): Initialize printed_version_.
12144         * options.h (class General_options): Add printed_version_ field.
12145         * gold.cc (queue_initial_tasks): If there are no input files,
12146         don't give a fatal error if we printed the version information.
12147         (queue_middle_tasks): If using -r with a shared object, give a
12148         fatal error rather than an ordinary error.
12149
12150 2009-06-23  Ian Lance Taylor  <iant@google.com>
12151
12152         PR 10219
12153         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
12154         (Layout::make_output_section): Set have_stabstr_section_ if we see
12155         a .stab*str section.
12156         (Layout::finalize): Call link_stabs_sections.
12157         (Layout::link_stabs_sections): New file.
12158         * layout.h (class Layout): Add have_stabstr_section_ field.
12159         Declare link_stabs_sections.
12160
12161 2009-06-23  Doug Kwan  <dougkwan@google.com>
12162
12163         * Makefile.am (libgold_a_LIBADD): New.
12164         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
12165         * Makefile.in: Regenerate.
12166         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
12167         * configure: Regenerate.
12168         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
12169         * fileread.cc: Include sys/state.h
12170         * gold.h: Declare memmem and strndup if found missing.
12171         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
12172
12173 2009-06-23  Ian Lance Taylor  <iant@google.com>
12174
12175         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
12176         * configure: Rebuild.
12177
12178 2009-06-23  Ian Lance Taylor  <iant@google.com>
12179
12180         PR 10147
12181         * object.cc (Object::section_contents): Don't try to get a view if
12182         the section has length zero.
12183         (Object::handle_gnu_warning_section): If the section is empty, use
12184         the name of the section as the warning.
12185
12186 2009-06-23  Ian Lance Taylor  <iant@google.com>
12187
12188         PR 10133
12189         * stringpool.h (class Stringpool_template): Add optimize_ field.
12190         (Stringpool_template::set_optimize): New function.
12191         * stringpool.cc (Stringpool_template::Stringpool_template):
12192         Initialize optimize_ field.
12193         (Stringpool_template::set_string_offsets): Test local optimize
12194         fild rather than parameter.
12195         * layout.cc (Layout::Layout): Call set_optimize on the section
12196         name stringpool.
12197
12198 2009-06-22  Ian Lance Taylor  <iant@google.com>
12199
12200         PR 10030
12201         * yyscript.y: Parse TARGET.
12202         * script.cc (script_set_target): New function.
12203         * script-c.h (script_set_target): Declare.
12204         * options.cc (General_options::string_to_object_format): Rename
12205         from string_to_object_format in anonymous namespace.  Change
12206         callers.
12207         * options.h (class General_options): Declare
12208         string_to_object_format.
12209
12210 2009-06-22  Ian Lance Taylor  <iant@google.com>
12211
12212         * script-sections.cc (Script_sections::create_segments): Don't put
12213         program headers in a PT_LOAD segment if -n or -N.
12214
12215 2009-06-22  Ian Lance Taylor  <iant@google.com>
12216
12217         PR 10141
12218         * options.h (class General_options): Add -z lazy and -z now.  Sort
12219         -z options into alphabetical order.
12220         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
12221
12222 2009-06-21  Ian Lance Taylor  <iant@google.com>
12223
12224         * layout.cc (Layout::make_output_section): Call
12225         Target::new_output_section.
12226         (Layout::attach_allocated_section_to_segment): Put large section
12227         sections in a separate load segment with the large segment flag
12228         set.
12229         (Layout::segment_precedes): Sort large data segments after other
12230         load segments.
12231         (align_file_offset): New static function.
12232         (Layout::set_segment_offsets): Use align_file_offset.
12233         * output.h (class Output_section): Add is_small_section_ and
12234         is_large_section_ fields.
12235         (Output_section::is_small_section): New function.
12236         (Output_section::set_is_small_section):  New function.
12237         (Output_section::is_large_section): New function.
12238         (Output_section::set_is_large_section): New function.
12239         (Output_section::is_large_data_section): New function.
12240         (class Output_segment): Add is_large_data_segment_ field.
12241         (Output_segment::is_large_data_segment): New function.
12242         (Output_segment::set_is_large_data_segment): New function.
12243         * output.cc (Output_section::Output_section): Initialize new
12244         fields.
12245         (Output_segment::Output_segment): Likewise.
12246         (Output_segment::add_output_section): Add assertion that large
12247         data sections always go in large data segments.  Force small data
12248         sections to the end of the list of data sections.  Force small BSS
12249         sections to the start of the list of BSS sections.  For large BSS
12250         sections to the end of the list of BSS sections.
12251         * symtab.h (class Symbol): Declare is_common_shndx.
12252         (Symbol::is_defined): Check Symbol::is_common_shndx.
12253         (Symbol::is_common): Likewise.
12254         (class Symbol_table): Define enum Commons_section_type.  Update
12255         declarations.  Add small_commons_ and large_commons_ fields.
12256         * symtab.cc (Symbol::is_common_shndx): New function.
12257         (Symbol_table::Symbol_table): Initialize new fields.
12258         (Symbol_table::add_from_object): Put small and large common
12259         symbols in the right list.
12260         (Symbol_table::sized_finalized_symbol): Check
12261         Symbol::is_common_shndx.
12262         (Symbol_table::sized_write_globals): Likewise.
12263         * common.cc (Symbol_table::do_allocate_commons): Allocate new
12264         common symbol lists.  Don't call do_allocate_commons_list if the
12265         list is empty.
12266         (Symbol_table::do_allocate_commons_list): Remove is_tls
12267         parameter.  Add comons_section_type parameter.  Change all
12268         callers.  Handle small and large common symbols.
12269         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
12270         Symbol::is_common_shndx.
12271         * resolve.cc (symbol_to_bits): Likewise.
12272         * target.h (Target::small_common_shndx): New function.
12273         (Target::small_common_section_flags): New function.
12274         (Target::large_common_shndx): New function.
12275         (Target::large_common_section_flags): New function.
12276         (Target::new_output_section): New function.
12277         (Target::Target_info): Add small_common_shndx, large_common_shndx,
12278         small_common_section_flags, and large_common_section_flags
12279         fields.
12280         (Target::do_new_output_section): New virtual function.
12281         * arm.cc (Target_arm::arm_info): Initialize new fields.
12282         * i386.cc (Target_i386::i386_info): Likewise.
12283         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
12284         Likewise.
12285         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
12286         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
12287         (Target_x86_64::do_new_output_section): New function.
12288         * configure.ac: Define conditional MCMODEL_MEDIUM.
12289         * testsuite/Makefile.am (check_PROGRAMS): Add large.
12290         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
12291         (large_LDFLAGS): Define.
12292         * testsuite/large.c: New file.
12293         * testsuite/testfile.cc (Target_test::test_target_info):
12294         Initialize new fields.
12295         * configure, testsuite/Makefile.in: Rebuild.
12296
12297 2009-06-05  Doug Kwan  <dougkwan@google.com>
12298
12299         * Makefile.am (CCFILES): Add target.cc.
12300         * Makefile.in: Regenerate.
12301         * i386.cc (class Target_i386): Define new virtual method to
12302         override do_is_local_label_name in parent.
12303         * object.cc (Sized_relobj::do_count_local_symbols): Discard
12304         local symbols if --discard-locals or -X is given.
12305         * options.h (class General_options): Declare new options
12306         '--discard-locals' and '-X' for discarding locals.
12307         * target.h (class Target): Define new methods is_local_label_name.
12308         Declare new virtual method do_is_local_label_name.
12309         * target.cc: New file.
12310         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
12311         (check_SCRIPTS): Add discard_locals_test.sh.
12312         (check_DATA): Add discard_local_tests.syms.
12313         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
12314         (discard_local_tests.syms, discard_locals_test.o): New make rules.
12315         * testsuite/Makefile.in: Regenerate.
12316         * testsuite/discard_locals_test.c: New file.
12317         * testsuite/discard_locals_test.sh: Same.
12318
12319 2009-06-05  Doug Kwan  <dougkwan@google.com>
12320
12321         * object.cc (Sized_relobj::Sized_relobj): Initialize
12322         discarded_eh_frame_shndx_ to -1U.
12323         (Sized_relobj::do_layout): Record index of a discard .eh_frame
12324         section.
12325         (Sized_relobj::do_count_local_symbols): Skip local symbols in
12326         a discarded .eh_frame section.
12327         (Sized_relobj::do_finalize_local_symbols): Ditto.
12328         * object.h (class Sized_relobj): Declare new member
12329         discarded_eh_frame_shndx_.
12330         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
12331         (local_labels_test.o, local_labels_test): New rules.
12332         * testsuite/Makefile.in: Regenerate.
12333
12334 2009-06-04  Doug Kwan  <dougkwan@google.com>
12335
12336         * layout.cc (Layout::section_name_mapping): Add mapping for
12337         special ARM sections.
12338
12339 2009-06-03  Doug Kwan  <dougkwan@google.com>
12340
12341         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
12342         (utils::has_overflow): Same.
12343
12344 2009-06-03  Ian Lance Taylor  <iant@google.com>
12345
12346         * layout.cc (Layout::section_name_mapping): New array, replacing
12347         Layout::linkonce_mapping.
12348         (Layout::section_name_mapping_count): New variable, replacing
12349         Layout::linkonce_mapping_count.
12350         (Layout::linkonce_output_name): Remove.
12351         (Layout::output_section_name): Rewrite.
12352         * layout.h (class Layout): Rename Linkonce_mapping to
12353         Section_name_mapping, linkonce_mapping to section_name_mapping,
12354         linkonce_mapping_count to section_name_mapping_count.  Don't
12355         declare linkonce_output_name.
12356
12357 2009-06-03  Doug Kwan  <dougkwan@google.com>
12358
12359         * gold/arm.cc (namespace utils): New.
12360         (Target_arm::reloc_is_non_pic): Define new method.
12361         (class Arm_relocate_functions): New.
12362         (Target_arm::Relocate::relocate): Handle relocation types used by
12363         Android.
12364
12365 2009-06-03  Ian Lance Taylor  <iant@google.com>
12366
12367         * arm.cc (Target_arm::scan::global): Use || instead of |.
12368
12369 2009-06-02  Doug Kwan  <dougkwan@google.com>
12370
12371         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
12372         issued_non_pic_error_.
12373         (class Target_arm::Scan): Declare new method check_non_pic.
12374         Define new method symbol_needs_plt_entry.
12375         Declare new data member issued_non_pic_error_.
12376         (class Target_arm::Relocate): Declare new method
12377         should_apply_static_reloc.
12378         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
12379         (Target_arm::Scan::check_non_pic): Define new method.
12380         (Target_arm::Scan::local): Handle a small subset of reloc types used
12381         by Android.
12382         (Target_arm::Scan::local): Same.
12383         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
12384
12385 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
12386
12387         * incremental.cc (Incremental_inputs::report_command_line): Filter
12388         out --incremental-* options.
12389
12390 2009-05-29  Doug Kwan  <dougkwan@google.com>
12391
12392         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
12393         template class.
12394         (class Target_arm): Update comment.
12395         (Target_arm::Target_arm): Initialize new data members GOT_,
12396         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
12397         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
12398         and Target_arm::rel_dyn_section.
12399         Declare new_enum Target_arm::Got_type.
12400         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
12401         and DYNBSS_.
12402         Update commments for member do_dynsym_value.
12403         (Target_arm::got_size, Target_arm::plt_section,
12404         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
12405         new methods inside class defintion.
12406         (Target_arm::got_section): Define new method.
12407         (Target_arm::rel_dyn_section): Same.
12408         (Output_data_plt_arm): New template class.
12409         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
12410         (Output_data_plt_arm:do_adjust_output_section): Define new method.
12411         (Output_data_plt_arm::add_entry): Same.
12412         (Output_data_plt_arm::first_plt_entry): Define new
12413         static data member for PLT instruction template.
12414         (Output_data_plt_arm::plt_entry): Same.
12415         (Output_data_plt_arm::do_write): Define new method.
12416         (Target_arm::make_plt_entry): Same.
12417         (Target_arm::do_finalize_sections): Same.
12418         (Target_arm::do_dynsym_value): Same.
12419
12420 2009-05-28  Doug Kwan  <dougkwan@google.com>
12421
12422         * Makefile.am (TARGETSOURCES): Add arm.cc.
12423         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
12424         * Makefile.in: Regenerate.
12425         * arm.cc: New file.
12426         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
12427
12428 2009-05-26  Doug Kwan  <dougkwan@google.com>
12429
12430         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
12431         (General_options::check_excluded_libs): Strip off directories in
12432         archive name before matching like GNU ld does.
12433         * testsuite/Makefile.am (MOSTLYCLEANFILES,
12434         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
12435         (exclude_libs_test_LDFLAGS): Add linker option
12436         -Wl,--exclude-libs,libexclude_libs_test_3
12437         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
12438         an explicit archive without using -l.
12439         (alt/libexclude_libs_test_3.a): New make rule.
12440         * testsuite/Makefile.in: Regenerate.
12441         * testsuite/exclude_libs_test.c : Declare lib3_default().
12442         (main): Call it.
12443         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
12444         * exclude_libs_test_3.c: New file.
12445
12446 2009-05-26  Nick Clifton  <nickc@redhat.com>
12447
12448         * po/id.po: New Indonesian translation.
12449         * po/gold.pot: Updated template file.
12450
12451 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
12452
12453         * testsuite/Makefile.am: Add -ffunction-sections to compile
12454         gc_comdat_test files.  Add -Wl,--gc-sections to build
12455         gc_comdat_test.
12456         * testsuite/Makefile.in: Regenerate.
12457         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
12458
12459 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
12460
12461         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
12462         kept comdat section was garbage collected.
12463         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
12464         * testsuite/Makefile.in: Regenerate.
12465         * testsuite/gc_comdat_test.sh: New file.
12466         * testsuite/gc_comdat_test_1.cc: New file.
12467         * testsuite/gc_comdat_test_2.cc: New file.
12468
12469 2009-05-19  Doug Kwan  <dougkwan@google.com>
12470
12471         * archive.cc (Archive::Archive): Move constructor from archive.h
12472         to here.  Initialize no_export_.
12473         (Archive::get_elf_object_for_member): Set no_export flag of object.
12474         * archive.h (Archive::Archive): Move constructor body to
12475         archive.cc.
12476         (Archive::no_export): New method.
12477         (Archive::no_export_): New field.
12478         * object.h (Object::Object): Initialize no_export_ to false.
12479         (Object::no_export, Object::set_no_export): New methods.
12480         (Object::no_export_): New field.
12481         * options.cc (General_options::parse_exclude_libs): New method.
12482         (General_options::check_excluded_libs) Same.
12483         * options.h (exclude_libs): New option.
12484         (General_options::check_excluded_libs): New method declaration.
12485         (General_options::excluded_libs_): New field.
12486         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
12487         default or protected visibility if an object has no-export flag set.
12488         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
12489         (check_SCRIPTS): Add exclude_libs_test.sh.
12490         (check_DATA): Add exclude_libs_test.syms.
12491         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
12492         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
12493         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
12494         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
12495         (exclude_libs_test.syms, libexclude_libs_test_1.a,
12496         libexclude_libs_test_2.a): New rules.
12497         * testsuite/Makefile.in: Regenerate.
12498         * testsuite/exclude_libs_test.c: New file.
12499         * testsuite/exclude_libs_test.sh: Ditto.
12500         * testsuite/exclude_libs_test_1.c: Ditto.
12501         * testsuite/exclude_libs_test_2.c: Ditto.
12502
12503 2009-05-15  Ian Lance Taylor  <iant@google.com>
12504
12505         * configure.ac: Check for declarations for cases where libiberty.h
12506         checks HAVE_DECL_xxx.
12507         * configure, config.in: Rebuild.
12508
12509 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
12510
12511         * gold.h (Incremental_argument_list): Remove (invalid) forward
12512         declaration.
12513         * incremental.cc (Incremental_inputs::report_achive): New method.
12514         (Incremental_inputs::report_object): New method.
12515         (Incremental_inputs::report_script): New method.
12516         (Incremental_inputs::finalize_inputs): New method.
12517         (Incremental_inputs::finalize): Call finalize_inputs().
12518         (Incremental_inputs::sized_create_incremental_inputs_section_data):
12519         Create inputs entries.
12520         * incremental.h (Incremental_input_type): New enum.
12521         (Incremental_inputs::Incremental_input): Initialize new fields.
12522         (Incremental_inputs::report_inputs): New method.
12523         (Incremental_inputs::report_achive): New method.
12524         (Incremental_inputs::report_object): New method.
12525         (Incremental_inputs::report_script): New method.
12526         (Incremental_inputs::finalize_inputs): New method.
12527         (Incremental_inputs::Input_info): New struct.
12528         (Incremental_inputs::Input_info_map): New typedef.
12529         (Incremental_inputs::lock_): New field.
12530         (Incremental_inputs::Inputs_): New field.
12531         (Incremental_inputs::Inputs_map): New field.
12532         * main.cc (main): Call Incremental_input::report_inputs.
12533         * options.h (Input_argument_list): Typedef moved from
12534         Input_arguments.
12535         (Input_file_group::Files): Remove, use ::Input_argument_list.
12536         (Input_file_group::Input_argument_list): Remove, use
12537         ::Input_argument_list.
12538         * plugin.cc (Plugin_manager::add_input_file): Add error in
12539         incremental build.
12540         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
12541         functions.
12542         * script.cc (read_input_script): Call
12543         Incremental_input::report_script.
12544         * script.h (Script_info): New class.
12545
12546 2009-04-27  Ian Lance Taylor  <iant@google.com>
12547
12548         * x86_64.cc (do_adjust_output_section): Set entsize to
12549         plt_entry_size.
12550
12551 2009-04-23  Elliott Hughes  <enh@google.com>
12552
12553         * output.cc (Output_file::close): After short writes, continue
12554         writing from the correct offset in the buffer being written.
12555
12556 2009-04-23  Chris Demetriou  <cgd@google.com>
12557
12558         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
12559         * configure: Regenerate.
12560         * config.in: Regenerate.
12561         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
12562         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
12563
12564 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
12565
12566         * incremental.cc (Incremental_inputs_header_data): Renamed from
12567         Incremental_input_header_data.
12568         (Incremental_inputs_header_data::data_size): New field.
12569         (Incremental_inputs_header_data::put_input_file_count): Renamed
12570         from input_file_count.
12571         (Incremental_inputs_header_data::put_command_line_offset): Renamed
12572         from command_line_offset.
12573         (Incremental_inputs_header_data::put_reserved): Renamed from
12574         put_reserved.
12575         (Incremental_inputs_entry_data): Renamed from
12576         Incremental_input_entry_data.
12577         (Incremental_inputs_entry_data::data_size): New field.
12578         (Incremental_inputs::report_command_line): New method.
12579         (Incremental_inputs::finalize): New method.
12580         (Incremental_inputs::create_incremental_inputs_data): New method.
12581         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
12582         * incremental.h: New file.
12583         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
12584         (Layout::finalize): Create incremental inputs section in
12585         incremental builds.
12586         (Layout::create_incremental_info_sections): New method.
12587         * layout.h (Layout::incremental_inputs): New method.
12588         (Layout::create_incremental_info_sections): New method.
12589         (Layout::incremental_inputs_): New field.
12590         * main.cc (main): Notify Incremental_input of the command line.
12591
12592 2009-04-01  Ian Lance Taylor  <iant@google.com>
12593             Mikolaj Zalewski  <mikolajz@google.com>
12594
12595         * gold.h (reserve_unordered_map): Define, three versions, one for
12596         each version of Unordered_map.
12597         * layout.cc (Layout::Layout): Remove options parameter.  Add
12598         number_of_input_files parameter.  Don't initialize options_.
12599         Initialize number_of_input_files_ and resized_signatures_.  Move
12600         sections_are_attached_.
12601         (Layout::layout_group): Reserve space for group_signatures_.
12602         (Layout::find_or_add_kept_section): Change name parameter to be a
12603         reference.  Resize signatures_ map when it gets large enough.
12604         (Layout::layout_eh_frame): Use parameters->options() instead of
12605         this->options_.
12606         (Layout::make_output_section): Likewise.
12607         (Layout::attach_allocated_section_to_segment): Likewise.
12608         (Layout::finalize, Layout::create_executable_stack): Likewise.
12609         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
12610         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
12611         * layout.h (class Layout): Update declarations.  Remove options_
12612         field.  Add number_of_input_files_ and resized_signatures_
12613         fields.  Move sections_are_attached_ field.
12614         * main.cc (main): Pass number of input files to Layout
12615         constructor.  Don't pass options.
12616
12617 2009-03-30  Ian Lance Taylor  <iant@google.com>
12618
12619         * ffsll.c (ffsll): Correct implementation.
12620
12621 2009-03-27  Ian Lance Taylor  <iant@google.com>
12622
12623         * ffsll.c: New file.
12624         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
12625         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
12626         * ftruncate.c (ftruncate): Declare before definition.
12627         * mremap.c (mremap): Likewise.
12628         * pread.c (pread): Likewise.
12629         * configure, Makefile.in, config.in: Rebuild.
12630
12631         * mremap.c: New file.
12632         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
12633         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
12634         (mremap): Declare if HAVE_MREMAP is not defined.
12635         * configure, Makefile.in, config.in: Rebuild.
12636
12637 2009-03-27  Cary Coutant  <ccoutant@google.com>
12638
12639         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
12640         position independent.
12641         * sparc.cc (Target_sparc::check_non_pic): Likewise.
12642         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
12643
12644 2009-03-24  Cary Coutant  <ccoutant@google.com>
12645
12646         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
12647         an executable.
12648         (needs_dynamic_reloc): Likewise.
12649
12650 2009-03-24  Ian Lance Taylor  <iant@google.com>
12651
12652         * yyscript.y (file_cmd): Recognize EXTERN.
12653         (extern_name_list, extern_name_list_body): New nonterminals.
12654         * script.cc (script_add_extern): Define.
12655         * script-c.h (script_add_extern): Declare.
12656
12657 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
12658
12659         * object.cc (is_elf_object): Define.
12660         * object.h (is_elf_object): Declare.
12661         * archive.cc (Archive::get_elf_object_for_member): Call
12662         is_elf_object.
12663         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
12664
12665 2009-03-24  Elliott Hughes  <enh@google.com>
12666
12667         * output.cc (Output_file::map_anonymous): Define.
12668         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
12669         try an anonymous one.  Report the size if the mmap fails.
12670         * output.h (class Output_file): Declare map_anonymous.
12671
12672 2009-03-24  Ian Lance Taylor  <iant@google.com>
12673
12674         * target-select.cc (instantiate_target): Don't acquire the lock if
12675         the instantiated_target_ field has already been set.
12676
12677 2009-03-23  Ian Lance Taylor  <iant@google.com>
12678
12679         * gold-threads.h (class Initialize_lock): Define.
12680         * gold-threads.cc (class Initialize_lock_once): Define.
12681         (initialize_lock_control): New static variable.
12682         (initialize_lock_pointer): New static variable.
12683         (initialize_lock_once): New static function.
12684         (Initialize_lock::Initialize_lock): Define.
12685         (Initialize_lock::initialize): Define.
12686         * target-select.h: Include "gold-threads.h".
12687         (class Target_selector): Add lock_ and initialize_lock_ fields.
12688         Don't define instantiate_target, just declare it.
12689         * target-select.cc (Target_selector::Target_selector): Initialize
12690         new fields.
12691         (Target_selector::instantiate_target): Define.
12692         * descriptors.h: Include "gold-threads.h".
12693         (class Descriptors): Add initialize_lock_ field.
12694         * descriptors.cc (Descriptors::Descriptors): Initialize new
12695         field.
12696         (Descriptors::open): Use initialize_lock_ field
12697         * errors.h (class Errors): Add initialize_lock_ field.
12698         * errors.cc (Errors::Errors): Initialize new field.
12699         (Errors::initialize_lock): Use initialize_lock_ field.
12700         * powerpc.cc (class Target_selector_powerpc): Remove
12701         instantiated_target_ field.  In do_recognize call
12702         instantiate_target rather than do_instantiate_target.  In
12703         do_instantiate_target just allocate a new target.
12704         * sparc.cc (class Target_selector_sparc): Likewise.
12705
12706         * freebsd.h: New file.
12707         * i386.cc: Include "freebsd.h".
12708         (Target_i386): Derive from Target_freebsd rather than
12709         Sized_target.
12710         (Target_selector_i386): Derive from Target_selector_freebsd rather
12711         than Target_selector.
12712         * x86_64.cc: Include "freebsd.h".
12713         (Target_x86_64): Derive from Target_freebsd rather than
12714         Sized_target.
12715         (Target_selector_x86_64): Derive from Target_selector_freebsd
12716         rather than Target_selector.
12717         * target.h (class Target): Add adjust_elf_header and
12718         do_adjust_elf_header.
12719         * output.cc (Output_file_header:: do_sized_write): Call target
12720         adjust_elf_header routine.
12721         * configure.tgt: Set targ_osabi.
12722         * configure.ac: Define GOLD_DEFAULT_OSABI.
12723         * parameters.cc (Parameters::default_target): Pass
12724         GOLD_DEFAULT_OSABI to select_target.
12725         * target-select.h (class Target_selector): Make instantiate_target
12726         protected rather than private.
12727         * Makefile.am (HFILES): Add freebsd.h.
12728         * configure, Makefile.in, config.in: Rebuild.
12729
12730         * merge.cc (do_add_input_section): Correct pend value.  Change
12731         message about last entry not being null terminated from error to
12732         warning.
12733
12734 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
12735
12736         * incremental.cc: New file.
12737         * Makefile.am (CCFILES): Add incremental.cc.
12738         * Makefile.in: Rebuild.
12739
12740 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
12741
12742         * layout.cc (Layout::output_section_name): Preserve names
12743         of '.note.' sections.
12744
12745 2009-03-19  Ian Lance Taylor  <iant@google.com>
12746
12747         * descriptors.cc (Descriptors::open): Check that the options are
12748         valid before using them.
12749
12750 2009-03-18  Ian Lance Taylor  <iant@google.com>
12751
12752         * script-sections.h: Include <list>.
12753         (class Script_sections): Change Sections_elements from std::vector
12754         to std::list.  Typedef public Elements_iterator.  Add
12755         orphan_section_placement_, data_segment_align_start_, and
12756         saw_data_segment_align_ fields.  Remove data_segment_align_index_
12757         field.
12758         * script-sections.cc (class Orphan_section_placement): New class.
12759         (class Sections_element): Add virtual functions is_relro and
12760         orphan_section_init.  Remove virtual function place_orphan_here.
12761         (class Output_section_definition): Add is_relro and
12762         orphan_section_init.  Remove place_orphan_here.
12763         (class Orphan_output_section): Likewise.
12764         (Script_sections::Script_sections): Update for field changes.
12765         (Script_sections::data_segment_align): Set saw_data_segment_align_
12766         and data_segment_align_start_, not data_segment_align_index.
12767         (Script_sections::data_segment_relro_end): Check
12768         saw_data_segment_align_.  Use data_segment_align_start_ rather
12769         than data_segment_align_index_.
12770         (Script_sections::place_orphan): Rewrite to use
12771         Orphan_section_placement.
12772
12773 2009-03-17  Ian Lance Taylor  <iant@google.com>
12774
12775         * archive.cc (Archive::add_symbols): Check for a version attached
12776         to the symbol name in the archive map.
12777         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
12778         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
12779         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
12780         (ver_test_11.a): New target.
12781         * testsuite/Makefile.in: Rebuild.
12782
12783         * configure.ac: Check for chsize and posix_fallocate.  Replace
12784         ftruncate.
12785         * ftruncate.c: New file, from gnulib.
12786         * output.cc (posix_fallocate): Define dummy version if not
12787         HAVE_POSIX_FALLOCATE.
12788         (Output_file::map): Call posix_fallocate rather than lseek and
12789         write.
12790         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
12791         * configure, Makefile.in, config.in: Rebuild.
12792
12793 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
12794
12795         * layout.h (Layout::create_note): Add section_name parameter.
12796         * layout.cc (Layout::create_note): Likewise.
12797         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
12798
12799 2009-03-17  Ian Lance Taylor  <iant@google.com>
12800
12801         * descriptors.cc: Include "options.h".
12802         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
12803         (Descriptors::open): Always use O_CLOEXEC when opening a new
12804         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
12805         then set FD_CLOEXEC.
12806
12807         * sparc.cc (class Target_sparc): Add has_got_section.
12808         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
12809         make sure we have a GOT section.
12810
12811         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
12812         (Target_sparc::Scan::local): Likewise.
12813         (Target_sparc::Scan::global): Likewise.
12814         (Target_sparc::Relocate::relocate): Likewise.
12815         (Target_sparc::Relocate::relocate_tls): Likewise.
12816
12817         * symtab.cc (Symbol_table::define_default_version): New function,
12818         broken out of add_from_object.
12819         (Symbol_table::add_from_object): Call define_default_version.
12820         (Symbol_table::define_special_symbol): Add resolve_oldsym
12821         parameter.  Change all callers.  If the version for a symbol comes
12822         from a version script, resolve it with the symbol with the same
12823         name with no version.  Also add the symbol without a version if
12824         appropriate.
12825         (do_define_in_output_data): If resolving with oldsym, don't delete
12826         sym.
12827         (do_define_in_output_segment): Likewise.
12828         (do_define_as_constant): Likewise.
12829         * symtab.h (class Symbol_table): Update declarations.
12830
12831 2009-03-13  Ian Lance Taylor  <iant@google.com>
12832
12833         * readsyms.cc (Read_symbols::incompatible_warning): New function.
12834         (Read_symbols::requeue): New function.
12835         (Read_symbols::do_read_symbols): If make_elf_object fails because
12836         the target type is not configured, and the file was searched for,
12837         issue a warning and retry with the next directory.
12838         (Add_symbols::run): If the file has an incompatible format, and
12839         it was searched for, requeue the Read_symbols task.  On error,
12840         release the object.
12841         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
12842         dirindex parameter to constructor.  Change all callers.  Declare
12843         incompatible_warning and requeue.
12844         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
12845         input_argument_ and input_group_ fields.  Add them to
12846         constructor.  Change all callers.
12847         (class Read_script): Add dirindex_ field.  Add it to constructor.
12848         Change all callers.
12849         * archive.cc (Archive::setup): Remove input_objects parameter.
12850         Change all callers.
12851         (Archive::get_file_and_offset): Likewise.
12852         (Archive::read_all_symbols): Likewise.
12853         (Archive::read_symbols): Likewise.
12854         (Archive::get_elf_object_for_member): Remove input_objects
12855         parameter.  Add punconfigured parameter.  Change all callers.
12856         (Archive::add_symbols): Change return type to bool.  Check return
12857         value of include_member.
12858         (Archive::include_all_members): Likewise.
12859         (Archive::include_member): Change return type to bool.  Return
12860         false if first included object has incompatible target.  Set
12861         included_member_ field.
12862         (Add_archive_symbols::run): If add_symbols returns false, requeue
12863         Read_symbols task.
12864         * archive.h (class Archive): Add included_member_ field.
12865         Initialize it in constructor.  Add input_file and searched_for
12866         methods.  Update declarations.
12867         (class Add_archive_symbols): Add dirpath_, dirindex_, and
12868         input_argument_ fields.  Add them to constructor.  Change all
12869         callers.
12870         * script.cc: Include "target-select.h".
12871         (class Parser_closure): Add skip_on_incompatible_target_ and
12872         found_incompatible_target_ fields.  Add
12873         skip_on_incompatible_target parameter to constructor.  Change all
12874         callers.  Add methods skip_on_incompatible_target,
12875         clear_skip_on_incompatible_target, found_incompatible_target, and
12876         set_found_incompatible_target.
12877         (read_input_script): Add dirindex parameter.  Change all callers.
12878         If parser finds an incompatible target, requeue Read_symbols
12879         task.
12880         (script_set_symbol): Clear skip_on_incompatible_target in
12881         closure.
12882         (script_add_assertion, script_parse_option): Likewise.
12883         (script_start_sections, script_add_phdr): Likewise.
12884         (script_check_output_format): New function.
12885         * script.h (read_input_script): Update declaration.
12886         * script-c.h (script_check_output_format): Declare.
12887         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
12888         (ignore_cmd): Remove OUTPUT_FORMAT.
12889         * fileread.cc (Input_file::Input_file): Add explicit this.
12890         (Input_file::will_search_for): New function.
12891         (Input_file::open): Add pindex parameter.  Change all callers.
12892         * fileread.h (class Input_file): Add input_file_argument method.
12893         Declare will_search_for.  Update declarations.
12894         * object.cc (make_elf_object): Add punconfigured parameter.
12895         Change all callers.
12896         * object.h (class Object): Make input_file public.  Add
12897         searched_for method.
12898         (make_elf_object): Update declaration.
12899         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
12900         restart search.
12901         * dirsearch.h (class Dirsearch): Update declaration.
12902         * options.h (class General_options): Add --warn-search-mismatch.
12903         * parameters.cc (Parameters::is_compatible_target): New function.
12904         * parameters.h (class Parameters): Declare is_compatible_target.
12905         * workqueue.cc (Workqueue::add_blocker): New function.
12906         * workqueue.h (class Workqueue): Declare add_blocker.
12907
12908         * fileread.cc (Input_file::open): Remove options parameter.
12909         Change all callers.
12910         (Input_file::open_binary): Likewise.
12911         * script.cc (read_input_script): Likewise.
12912         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
12913         options parameter from constructor.  Change all callers.
12914         (class Read_script): Likewise.
12915         * fileread.h (class Input_file): Update declarations.
12916         * script.h (read_input_script): Update declaration.
12917
12918 2009-03-10  Nick Clifton  <nickc@redhat.com>
12919
12920         * po/es.po: New Spanish translation.
12921
12922 2009-03-06  Cary Coutant  <ccoutant@google.com>
12923
12924         * options.cc (parse_short_option): Keep dash_z from registering itself.
12925
12926 2009-03-03  Ian Lance Taylor  <iant@google.com>
12927
12928         PR 9918
12929         * target-reloc.h (relocate_section): Pass output_section to
12930         relocate.
12931         * i386.cc (Target_i386::should_apply_static_reloc): Add
12932         output_section parameter.  Change all callers.
12933         (Target_i386::Relocate::relocate): Add output_section parameter.
12934         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
12935         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
12936         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
12937         * testsuite/two_file_shared.sh: New script.
12938         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
12939         (check_DATA): Add two_file_shared.dbg.
12940         (two_file_shared.dbg): New target.
12941         * testsuite/Makefile.in: Rebuild.
12942
12943 2009-03-01  Ian Lance Taylor  <iant@google.com>
12944
12945         * configure.ac: Check for byteswap.h.
12946         * configure: Rebuild.
12947         * config.in: Rebuild.
12948
12949 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
12950
12951         * layout.cc (Layout::find_or_add_kept_section): New function.
12952         (Layout::add_comdat): Removed.
12953         * layout.h (struct Kept_section): Move out of class Layout.
12954         Remove trailing underscores from field names.  Add group_sections
12955         field.  Rename group_ field to is_group.  Change all uses.
12956         (class Layout): Declare find_or_add_kept_section, not add_comdat.
12957         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
12958         comdat_groups_ field.
12959         (Sized_relobj::include_section_group): Use
12960         find_or_add_kept_section and Kept_section::group_sections.
12961         (Sized_relobj::include_linkonce_section): Likewise.
12962         * object.cc (class Sized_relobj): Don't define Comdat_group or
12963         Comdat_group_table.  Remove find_comdat_group and
12964         add_comdat_group.  Remove comdat_groups_ field.
12965         * plugin.cc (include_comdat_group): Use
12966         Layout::find_or_add_kept_section.
12967
12968 2009-02-28  Ian Lance Taylor  <iant@google.com>
12969
12970         * README: --gc-sections and map files are now supported.  Document
12971         some build requirements.
12972
12973         PR 6992
12974         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
12975         relocatable link set the value of the section symbol to zero.
12976         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
12977         relocatable link don't include the section address in the local
12978         symbol value.
12979
12980 2009-02-27  Ian Lance Taylor  <iant@google.com>
12981
12982         PR 6811
12983         * options.h (class Search_directory): Add is_system_directory.
12984         (class General_options): Declare is_in_system_directory.
12985         * options.cc (get_relative_sysroot): Make static.
12986         (get_default_sysroot): Make static.
12987         (General_optoins::is_in_system_directory): New function.
12988         * fileread.cc (Input_file::is_in_system_directory): New function.
12989         * fileread.h (class Input_file): Declare is_in_system_directory.
12990         * object.h (class Object): Add is_in_system_directory.
12991         (class Input_objects): Remove system_library_directory_ field.
12992         * object.cc (Input_objects::add_object): Don't set
12993         system_library_directory_.
12994         (input_objects::found_in_system_library_directory): Remove.
12995         * symtab.cc (Symbol_table::write_globals): Remove input_objects
12996         parameter.  Change all callers.
12997         (Symbol_table::sized_write_globals): Likewise.
12998         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
12999         Call Object::is_in_system_directory.
13000         * symtab.h (class Symbol_table): Update declarations.
13001
13002         PR 5990
13003         * descriptors.h (Open_descriptor): Add is_on_stack field.
13004         * descriptors.cc (Descriptors::open): If the descriptor is on the
13005         top of the stack, remove it.  Initialize is_on_stack field.
13006         (Descriptors::release): Only add pod to stack if it is not on the
13007         stack already.
13008         (Descriptors::close_some_descriptor): Clear stack_next and
13009         is_on_stack fields.
13010
13011         PR 7091
13012         * output.cc (Output_section::find_starting_output_address): Rename
13013         from starting_output_address; add PADDR parameter; change return
13014         type.
13015         * output.h (class Output_section): Declare
13016         find_starting_output_address instead of starting_output_address.
13017         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
13018         section symbol for which we can't find a merge section.
13019
13020         PR 9836
13021         * symtab.cc (Symbol_table::add_from_object): If the visibility is
13022         hidden or internal, force the symbol to be local.
13023         * resolve.cc (Symbol::override_visibility): Define.
13024         (Symbol::override_base): Use override_visibility.
13025         (Symbol_table::resolve): Likewise.
13026         (Symbol::override_base_with_special): Likewise.
13027         (Symbol_table::override_with_special): If the visibility is hidden
13028         or internal, force the symbol to be local.
13029         * symtab.h (class Symbol): Add set_visibility and
13030         override_visibility.
13031         * testsuite/ver_test_1.sh: New file.
13032         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
13033         (check_DATA): Add ver_test_1.syms.
13034         (ver_test_1.syms): New target.
13035         * testsuite/Makefile.in: Rebuild.
13036
13037 2009-02-25  Cary Coutant  <ccoutant@google.com>
13038
13039         * layout.cc (Layout::choose_output_section): Don't rename sections
13040         when using a linker script that has a SECTIONS clause.
13041         * Makefile.in: Regenerate.
13042
13043         * testsuite/Makefile.am (script_test_5.sh): New test case.
13044         * testsuite/Makefile.in: Regenerate.
13045         * testsuite/script_test_5.cc: New file.
13046         * testsuite/script_test_5.sh: New file.
13047         * testsuite/script_test_5.t: New file.
13048
13049 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
13050
13051         * archive.cc (Archive::include_member): Update calls to add_symbols.
13052         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
13053         the Layout argument.
13054         * dynobj.h (do_add_symbols): Add the Layout argument.
13055         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
13056         Layout argument.
13057         * object.h (Object::add_symbols): Add the Layout argument.
13058         (Object::do_add_symbols): Add the Layout argument.
13059         (Sized_relobj::do_add_symbols): Add the Layout argument.
13060         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
13061         Unify the two versions.
13062         (Add_plugin_symbols): Remove.
13063         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
13064         (Sized_pluginobj::do_add_symbols): Unify the two versions.
13065         (Add_plugin_symbols): Remove.
13066         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
13067         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
13068         (Add_symbols::run): Make it work with Pulginobj.
13069
13070 2009-02-06  Ian Lance Taylor  <iant@google.com>
13071
13072         * object.cc (Sized_relobj::do_layout): Make info message start
13073         with lower case letter.
13074
13075 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
13076
13077         * binary.cc: Fix file comment.
13078
13079         * options.h (enum Incremental_disposition): Define.
13080         (class General_options): Add new options: --incremental,
13081         --incremental_changed, --incremental_unchanged,
13082         --incremental_unknown.  Add incremental_disposition_ and
13083         implicit_incremental_ fields.
13084         (General_options::incremental_disposition): New function.
13085         (class Position_dependent_options): Add incremental_disposition
13086         option.
13087         (Position_dependent_options::copy_from_options): Set incremental
13088         dispositions.
13089         * options.cc (General_options::parse_incremental_changed): New
13090         function.
13091         (General_options::parse_incremental_unchanged): New function.
13092         (General_options::parse_incremental_unknown): New function.
13093         (General_options::General_options): Initialize new fields
13094         incremental_disposition_ and implicit_incremental_.
13095         (General_options::finalize): Check for uasge of --incremental-*
13096         without --incremental.
13097
13098 2009-02-06  Chris Demetriou  <cgd@google.com>
13099
13100         * gold.h (gold_undefined_symbol): Change to take only a Symbol
13101         pointer and to report location as the file name associated with
13102         the symbol.
13103         (gold_undefined_symbol_at_location): New function to replace the
13104         old gold_undefined_symbol functionality.
13105         * target-reloc.h (relocate_section): Update to use
13106         gold_undefined_symbol_at_location.
13107         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
13108         Call gold_undefined_symbol function rather than gold_error.
13109         * errors.h (Errors::undefined_symbol): Take location as a
13110         string, rather than calculating it from a relocation.
13111         * errors.cc (Errors::fatal): Print "fatal error:" before the
13112         formatted message.
13113         (Errors::error, Errors::error_at_location): Print "error: "
13114         before the formatted message.
13115         (Errors::undefined_symbol): Take location as a string, rather
13116         than calculating it from a relocation.
13117         (gold_undefined_symbol_at_location): New function akin to
13118         old gold_undefined_symbol, calculates location from relocation.
13119         (gold_undefined_symbol): Change to take only a Symbol pointer
13120         and to report location as the file name associated with the symbol.
13121         * testsuite/debug_msg.sh: Update for changed error messages.
13122         * testsuite/undef_symbol.sh: Likewise.
13123
13124 2009-02-04  Duncan Sands  <baldrick@free.fr>
13125
13126         PR 9812
13127         * reduced_debug_output.h
13128         (Output_reduced_debug_abbrev_section::failed): Use format for
13129         gold_warning.
13130         (Output_reduced_debug_info_section::faild): Likewise.
13131
13132 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
13133
13134         * script.cc (Lazy_demangler): New class.
13135         (Version_script_info::get_symbol_version_helper): Demangle a
13136         symbol only once.
13137
13138 2009-01-29  Cary Coutant  <ccoutant@google.com>
13139
13140         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
13141         to __tls_get_addr.
13142         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
13143
13144 2009-01-28  Ian Lance Taylor  <iant@google.com>
13145
13146         * version.cc (version_string): Bump to 1.9.
13147
13148         * gold.h: Include <cstring> and <stdint.h>.
13149         * version.cc: Include <cstdio>.
13150         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
13151         warning.
13152         * reduced_debug_output.cc (insert_into_vector): Rename from
13153         Insert_into_vector; change all callers.  Use Swap_unaligned to
13154         avoid aliasing issue; remove union since it is unnecessary.
13155
13156 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
13157
13158         * Makefile.am (CCFILES): Add gc.cc.
13159         (HFILES): Add gc.h.
13160         * Makefile.in: Regenerate.
13161         * gold.cc (Gc_runner): New class.
13162         (queue_initial_tasks): Call garbage collection related tasks
13163         when corresponding options are invoked.
13164         (queue_middle_gc_tasks): New function.
13165         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
13166         processed early before laying out sections during garbage collection.
13167         * gold.h (queue_middle_gc_tasks): New function.
13168         (is_prefix_of): Move from "layout.cc".
13169         * i386.cc (Target_i386::gc_process_relocs): New function.
13170         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
13171         * main.cc (main): Create object of class "Garbage_collection".
13172         * object.cc (Relobj::copy_symbols_data): New function.
13173         (Relobj::is_section_name_included): New function.
13174         (Sized_relobj::do_layout): Allow this function to be called twice
13175         during garbage collection and defer layout of section during the
13176         first call.
13177         * object.h (Relobj::get_symbols_data): New function.
13178         (Relobj::is_section_name_included): New function.
13179         (Relobj::copy_symbols_data): New function.
13180         (Relobj::set_symbols_data): New function.
13181         (Relobj::get_relocs_data): New function.
13182         (Relobj::set_relocs_data): New function.
13183         (Relobj::is_output_section_offset_invalid): New pure virtual function.
13184         (Relobj::gc_process_relocs): New function.
13185         (Relobj::do_gc_process_relocs): New pure virtual function.
13186         (Relobj::sd_): New data member.
13187         (Sized_relobj::is_output_section_offset_invalid): New function.
13188         (Sized_relobj::do_gc_process_relocs): New function.
13189         * options.h (General_options::gc_sections): Modify to not be a no-op.
13190         (General_options::print_gc_sections): New option.
13191         * plugin.cc (Plugin_finish::run): Remove function call to
13192         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
13193         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
13194         * reloc.cc (Read_relocs::run): Add task to process relocs and
13195         determine unreferenced sections when doing garbage collection.
13196         (Gc_process_relocs): New class.
13197         (Sized_relobj::do_gc_process_relocs): New function.
13198         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
13199         sections that are garbage collected.
13200         * reloc.h (Gc_process_relocs): New class.
13201         * sparc.cc (Target_sparc::gc_process_relocs): New function.
13202         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
13203         symbols whose corresponding sections are garbage collected.
13204         (Symbol_table::Symbol_table): Add new parameter for the garbage
13205         collection object.
13206         (Symbol_table::gc_mark_undef_symbols): New function.
13207         (Symbol_table::gc_mark_symbol_for_shlib): New function.
13208         (Symbol_table::gc_mark_dyn_syms): New function.
13209         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
13210         as garbage.
13211         (Symbol_table::add_from_object): Likewise.
13212         (Symbol_table::add_from_relobj): When building shared objects, do not
13213         treat externally visible symbols as garbage.
13214         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
13215         table information for static and relocatable links.
13216         * symtab.h (Symbol_table::set_gc): New function.
13217         (Symbol_table::gc): New function.
13218         (Symbol_table::gc_mark_undef_symbols): New function.
13219         (Symbol_table::gc_mark_symbol_for_shlib): New function.
13220         (Symbol_table::gc_mark_dyn_syms): New function.
13221         (Symbol_table::gc_): New data member.
13222         * target.h (Sized_target::gc_process_relocs): New pure virtual
13223         function.
13224         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
13225         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
13226
13227 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
13228
13229         * options.h (General_options::gc_sections): Define as a no-op for now.
13230         (General_options::no_keep_memory): Ditto.
13231         (General_options::Bshareable): Define.
13232         * options.cc (General_options::finalize): Honor -Bshareable.
13233
13234 2009-01-20  Andreas Schwab  <schwab@suse.de>
13235
13236         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
13237         read the value in the contents, since we don't use it.  Use the
13238         template endianness when writing.
13239         (Relocate::relocate): Use it for R_PPC_REL16_HA.
13240
13241 2009-01-19  Andreas Schwab  <schwab@suse.de>
13242
13243         * configure.tgt (powerpc64-*): Fix targ_obj.
13244
13245 2009-01-15  Ian Lance Taylor  <iant@google.com>
13246
13247         * object.cc (Sized_relobj::write_local_symbols): Don't write out
13248         local symbols when stripping all symbols.
13249
13250 2009-01-14  Cary Coutant  <ccoutant@google.com>
13251
13252         * output.cc (Output_reloc): Add explicit instantiations.
13253
13254 2009-01-14  Cary Coutant  <ccoutant@google.com>
13255
13256         * archive.cc (Archive::get_elf_object_for_member): Remove call
13257         to File_read::claim_for_plugin.
13258         * descriptors.cc (Descriptors::open): Remove reference to
13259         is_claimed.
13260         (Descriptors::claim_for_plugin): Remove.
13261         * descriptors.h (Descriptors::claim_for_plugin): Remove.
13262         (Descriptors::is_claimed): Remove.
13263         (claim_descriptor_for_plugin): Remove.
13264         * fileread.cc (File_read::claim_for_plugin): Remove.
13265         * fileread.h (File_read::claim_for_plugin): Remove.
13266         (File_read::descriptor): Reopen descriptor if necessary.
13267         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
13268         (Plugin_manager::all_symbols_read): Add task parameter. Change
13269         all callers.
13270         (Plugin_manager::get_input_file): New function.
13271         (Plugin_manager::release_input_file): New function.
13272         (Pluginobj::Pluginobj): Add filesize parameter and initialize
13273         corresponding data member.
13274         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
13275         and pass to base constructor. Change all callers.
13276         (get_input_file, release_input_file): New functions.
13277         (make_sized_plugin_object): Add filesize parameter. Change all callers.
13278         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
13279         (Plugin_manager::all_symbols_read): Add task parameter.
13280         (Plugin_manager::get_input_file): New function.
13281         (Plugin_manager::release_input_file): New function.
13282         (Plugin_manager::task_): New data member.
13283         (Pluginobj::Pluginobj): Add filesize parameter.
13284         (Pluginobj::filename): New function.
13285         (Pluginobj::descriptor): New function.
13286         (Pluginobj::filesize): New function.
13287         (Pluginobj::filesize_): New data member.
13288         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
13289         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
13290         File_read::claim_for_plugin; use Object::unlock to unlock the file.
13291
13292         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
13293         with archive libraries.
13294         * testsuite/Makefile.in: Regenerate.
13295         * testsuite/plugin_test.c (struct sym_info): New type.
13296         (get_input_file, release_input_file): New static variables.
13297         (onload): Capture new transfer vector entries.
13298         (claim_file_hook): Stop reading at end of file according to filesize.
13299         Factor out parsing of readelf output into separate function.
13300         (all_symbols_read_hook): Exercise get_input_file and release_input_file
13301         APIs and get the source file name from the symbol table.  Convert
13302         source file name to corresponding object file name.  Print info
13303         message when adding new input files.
13304         (parse_readelf_line): New function.
13305         * testsuite/plugin_test_1.sh: Add checks for new info messages.
13306         * testsuite/plugin_test_2.sh: Likewise.
13307         * testsuite/plugin_test_3.sh: Likewise.
13308         * testsuite/plugin_test_4.sh: New test case.
13309
13310 2009-01-07  Ian Lance Taylor  <iant@google.com>
13311
13312         * version.cc (version_string): Bump to 1.8.
13313
13314 2008-12-23  Cary Coutant  <ccoutant@google.com>
13315
13316         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
13317         * plugin.cc (Plugin_manager::finish): Rename as
13318         layout_deferred_objects.  Move cleanup to separate function.
13319         (Plugin_manager::cleanup): New function.
13320         (Plugin_finish::run): Call layout_deferred_objects and cleanup
13321         separately.
13322         * plugin.h (Plugin_manager::finish): Rename as
13323         layout_deferred_objects.
13324         (Plugin_manager::cleanup): New function.
13325         (Plugin_manager::cleanup_done): New field.
13326
13327 2008-12-23  Cary Coutant  <ccoutant@google.com>
13328
13329         * plugin.cc (is_visible_from_outside): New function.
13330         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
13331         so we don't return "IR only" status for exported symbols or -r links.
13332
13333         * testsuite/Makefile.am (plugin_test_3): New test case.
13334         * testsuite/Makefile.in: Regenerate.
13335         * testsuite/plugin_test_3.sh: New file.
13336
13337 2008-12-22  Cary Coutant  <ccoutant@google.com>
13338
13339         * object.cc (Sized_relobj::layout_section): New function.
13340         (Sized_relobj::do_layout): Defer layout of input sections until after
13341         plugin has provided replacement files.
13342         (Sized_relobj::do_layout_deferred_sections): New function.
13343         * object.h (Relobj::set_section_offset): Remove virtual keyword.
13344         (Relobj::layout_deferred_sections): New function.
13345         (Relobj::do_layout_deferred_sections): New function.
13346         (Sized_relobj::do_layout_deferred_sections): New function.
13347         (Sized_relobj::layout_section): New function.
13348         (Sized_relobj::Deferred_layout): New structure.
13349         (Sized_relobj::deferred_layout_): New field.
13350         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
13351         Change all callers.  Layout deferred sections.
13352         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
13353         references.
13354         (Plugin_hook::run): Move code from do_plugin_hook inline.
13355         (Plugin_hook::do_plugin_hook): Remove.
13356         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
13357         (Plugin_manager::finish): Renamed, was cleanup.
13358         (Plugin_manager::should_defer_layout): New function.
13359         (Plugin_manager::add_deferred_layout_object): New function.
13360         (Plugin_manager::Deferred_layout_list): New type.
13361         (Plugin_manager::deferred_layout_objects_): New field.
13362         (Plugin_hook::do_plugin_hook): Remove.
13363
13364 2008-12-17  Ian Lance Taylor  <iant@google.com>
13365
13366         * options.h (class General_options): Add --no case for
13367         --export-dynamic.
13368
13369 2008-12-16  Cary Coutant  <ccoutant@google.com>
13370
13371         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
13372         vector.
13373         (Plugin_manager::claim_file): Create plugin object even if
13374         plugin did not call the add_symbols callback.
13375         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
13376         asking for more symbols than were added.
13377         * testsuite/Makefile.am (plugin_test_1): Add test case with
13378         no global symbols.
13379         (empty.syms): New target.
13380         * testsuite/Makefile.in: Regenerate.
13381         * testsuite/plugin_test.c (claim_file_hook): Add new debug
13382         message. Don't call add_symbols if no globals.
13383         (all_symbols_read_hook): Don't provide replacement for empty
13384         claimed file.
13385
13386 2008-12-12  Ian Lance Taylor  <iant@google.com>
13387
13388         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
13389         r_type == 0 for a local symbol with r_sym == 0.
13390         (scan_relocatable_relocs): Pass r_sym to
13391         local_non_section_strategy.
13392         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
13393         r_sym parameter.
13394
13395         * configure.ac: Update test for TLS descriptors: they are
13396         supported as of glibc 2.9.
13397         * configure: Rebuild.
13398
13399 2008-12-11  Ian Lance Taylor  <iant@google.com>
13400
13401         PR 7091
13402         * target-reloc.h (Default_scan_relocatable_relocs): For each
13403         function, map r_type == 0 to RELOC_DISCARD.
13404
13405 2008-12-10  Cary Coutant  <ccoutant@google.com>
13406
13407         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
13408         object to override a kept COMDAT group from a plugin object.
13409
13410 2008-12-09  Ian Lance Taylor  <iant@google.com>
13411
13412         PR 7088
13413         * yyscript.y (file_cmd): Handle INPUT.
13414
13415         * testsuite/initpri1.c: Change all declarations to be full
13416         prototypes by adding void, to avoid compiler warnings.
13417
13418 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
13419
13420         * options.cc (General_options::parse_plugin_opt): New.
13421         (General_options::add_plugin): The argument now is just the filename.
13422         (General_options::add_plugin_option): New.
13423         * options.h (plugin_opt): New.
13424         (add_plugin): Change argument name.
13425         (add_plugin_option): New.
13426         * plugin.cc (Plugin::load): Don't parse the plugin option.
13427         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
13428         (Plugin::add_option): New.
13429         (Plugin::args_): Change type.
13430         (Plugin::filename_): New.
13431         (Plugin_manager::add_plugin_option): New.
13432         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
13433         * testsuite/Makefile.in: Regenerate.
13434
13435 2008-12-05  Cary Coutant  <ccoutant@google.com>
13436
13437         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
13438         Handle --strip-lto-sections option.
13439         * options.h (strip_lto_sections): New option.
13440
13441 2008-12-01  Cary Coutant  <ccoutant@google.com>
13442
13443         * plugin.cc (ld_plugin_message): Change format parameter to const.
13444         Fix mismatch between new[] and delete.
13445
13446 2008-11-14  Cary Coutant  <ccoutant@google.com>
13447
13448         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
13449         instead of -1U.
13450
13451 2008-11-05  Craig Silverstein  <csilvers@google.com>
13452
13453         * options.cc (General_options::parse_dynamic_list): New function.
13454         * options.h (General_options): New flags dynamic_list,
13455         dynamic_list_data, dynamic_list_cpp_new, and
13456         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
13457         (General_options::in_dynamic_list): New function.
13458         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
13459         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
13460         (Lex::can_continue_name): Likewise.
13461         (yylex): Likewise.
13462         (read_script_file): New parameter script_options.
13463         (read_dynamic_list): New function.
13464         (Script_options::define_dynamic_list): New function.
13465         (dynamic_list_keyword_parsecodes): New variable.
13466         (dynamic_list_keywords): New variable.
13467         * script.h (Script_options::define_dynamic_list): New function
13468         prototype.
13469         (read_dynamic_list): New function prototype.
13470         * symtab.cc (strprefix): New macro.
13471         (Symbol::should_add_dynsym_entry): Support dynamic_list,
13472         dynamic_list_data, dynamic_list_cpp_new, and
13473         dynamic_list_cpp_typeinfo.
13474         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
13475         (dynamic_list_expr): New rule.
13476         (dynamic_list_nodes): Likewise.
13477         (dynamic_list_node): Likewise.
13478         * testsuite/Makefile.am (dynamic_list): New test.
13479         * testsuite/Makefile.in: Regenerated.
13480         * testsuite/dynamic_list.t: New file.
13481         * testsuite/dynamic_list.sh: New file.
13482
13483 2008-11-05  Craig Silverstein  <csilvers@google.com>
13484
13485         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
13486         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
13487         (t11_last): Likewise.
13488         * testsuite/ver_test_6.c (main): Likewise.
13489
13490 2008-10-07  Cary Coutant  <ccoutant@google.com>
13491
13492         * options.c (General_options::finalize): Add check for -static and
13493         -shared.
13494         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
13495         is not empty.
13496
13497 2008-10-02  Cary Coutant  <ccoutant@google.com>
13498
13499         * plugin.cc (make_sized_plugin_object): Fix conditional
13500         compilation to work when not all targets are enabled.
13501
13502 2008-09-29  Cary Coutant  <ccoutant@google.com>
13503
13504         * archive.cc (Archive::get_file_and_offset): Use filename instead
13505         of name to get library path.
13506         (Archive::include_member): Unlock external member of a thin archive.
13507
13508         * testsuite/Makefile.am (TEST_AR): New variable.
13509         (thin_archive_test_1): New test.
13510         (thin_archive_test_2): New test.
13511         * testsuite/Makefile.in: Regenerate.
13512         * testsuite/thin_archive_main.cc: New file.
13513         * testsuite/thin_archive_test_1.cc: New file.
13514         * testsuite/thin_archive_test_2.cc: New file.
13515         * testsuite/thin_archive_test_3.cc: New file.
13516         * testsuite/thin_archive_test_4.cc: New file.
13517
13518 2008-09-29  Cary Coutant  <ccoutant@google.com>
13519
13520         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
13521         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
13522         instead of -1U.
13523         (Sized_relobj::do_finalize_local_symbols): Likewise.
13524         (Sized_relobj::map_to_kept_section): Likewise.
13525         * object.h (Sized_relobj::invalid_address): New constant.
13526         (Sized_relobj::do_output_section_offset): Check for invalid_address
13527         and return -1ULL.
13528         * output.cc (Output_reloc::local_section_offset): Use constant
13529         invalid_address instead of -1U.
13530         (Output_reloc::get_address): Likewise.
13531         (Output_section::output_address): Change -1U to -1ULL.
13532         * output.h (Output_reloc::invalid_address): New constant.
13533         * reloc.cc (Sized_relobj::write_sections): Use constant
13534         invalid_address instead of -1U.
13535         (Sized_relobj::relocate_sections): Likewise.
13536         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
13537         values for merge sections.
13538         * target-reloc.h (relocate_for_relocatable): Use constant
13539         invalid_address instead of -1U.
13540
13541 2008-09-19  Cary Coutant  <ccoutant@google.com>
13542
13543         Add plugin functionality for link-time optimization (LTO).
13544         * configure.ac (plugins): Add --enable-plugins option.
13545         * configure: Regenerate.
13546         * config.in: Regenerate.
13547         * Makefile.am (LIBDL): New variable.
13548         (CCFILES): Add plugin.cc.
13549         (HFILES): Add plugin.h.
13550         (ldadd_var): Add LIBDL.
13551         * Makefile.in: Regenerate.
13552
13553         * archive.cc: Include "plugin.h".
13554         (Archive::setup): Don't preread archive symbols when using a plugin.
13555         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
13556         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
13557         files.
13558         (Archive::include_member): Add symbols from plugin objects.
13559         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
13560         * descriptors.cc (Descriptors::open): Check for file descriptors
13561         abandoned by plugins.
13562         (Descriptors::claim_for_plugin): New function.
13563         * descriptors.h (Descriptors::claim_for_plugin): New function.
13564         (Open_descriptor::is_claimed): New field.
13565         (claim_descriptor_for_plugin): New function.
13566         * fileread.cc (File_read::claim_for_plugin): New function.
13567         * fileread.h (File_read::claim_for_plugin): New function.
13568         (File_read::descriptor): New function.
13569         * gold.cc: Include "plugin.h".
13570         (queue_initial_tasks): Add task to call plugin hooks for generating
13571         new object files.
13572         * main.cc: Include "plugin.h".
13573         (main): Load plugin libraries.
13574         * object.h (Pluginobj): Declare.
13575         (Object::pluginobj): New function.
13576         (Object::do_pluginobj): New function.
13577         (Object::set_target): New function.
13578         * options.cc: Include "plugin.h".
13579         (General_options::parse_plugin): New function.
13580         (General_options::General_options): Initialize plugins_ field.
13581         (General_options::add_plugin): New function.
13582         * options.h (Plugin_manager): Declare.
13583         (General_options): Add --plugin option.
13584         (General_options::has_plugins): New function.
13585         (General_options::plugins): New function.
13586         (General_options::add_plugin): New function.
13587         (General_options::plugins_): New field.
13588         * plugin.cc: New file.
13589         * plugin.h: New file.
13590         * readsyms.cc: Include "plugin.h".
13591         (Read_symbols::do_read_symbols): Check for archive before checking
13592         for ELF file.  Call plugin hooks to claim files.
13593         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
13594         from a real object file; force override when processing replacement
13595         files.
13596         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
13597         (Symbol::init_base_object): Likewise.
13598         (Symbol::init_base_output_data): Likewise.
13599         (Symbol::init_base_output_segment): Likewise.
13600         (Symbol::init_base_constant): Likewise.
13601         (Symbol::init_base_undefined): Likewise.
13602         (Symbol::output_section): Assert that object is not a plugin.
13603         (Symbol_table::add_from_pluginobj): New function.
13604         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
13605         undefined.
13606         (Symbol_table::sized_write_globals): Likewise.
13607         (Symbol_table::add_from_pluginobj): Instantiate template.
13608         * symtab.h (Sized_pluginobj): Declare.
13609         (Symbol::in_real_elf): New function.
13610         (Symbol::set_in_real_elf): New function.
13611         (Symbol::in_real_elf_): New field.
13612         (Symbol_table::add_from_pluginobj): New function.
13613
13614         * testsuite/Makefile.am (AM_CFLAGS): New variable.
13615         (LIBDL): New variable.
13616         (LDADD): Add LIBDL.
13617         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
13618         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
13619         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
13620         (MOSTLYCLEANFILES): Likewise.
13621         * testsuite/Makefile.in: Regenerate.
13622         * testsuite/plugin_test.c: New file.
13623         * testsuite/plugin_test_1.sh: New file.
13624         * testsuite/plugin_test_2.sh: New file.
13625
13626 2008-09-16  Ian Lance Taylor  <iant@google.com>
13627
13628         * target-reloc.h (relocate_section): Check whether a symbol is
13629         defined by the ABI before reporting an undefined symbol error.
13630         * target.h (Target::is_defined_by_abi): Make parameter const.
13631         (Target::do_is_defined_by_abi): Likewise.
13632         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
13633         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
13634         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
13635         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
13636         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
13637         * testsuite/Makefile.in: Rebuild.
13638
13639         * fileread.cc (make_view): Add casts to avoid warning.
13640
13641 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
13642
13643         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
13644         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
13645
13646 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
13647
13648         * options.h (General_options::output_is_executable): New.
13649         (General_options::output_is_pie): New.
13650         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
13651         for shared libraries.
13652         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
13653
13654 2008-09-11  Chris Demetriou  <cgd@google.com>
13655
13656         * options.h (origin): New -z option.
13657         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
13658         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
13659         in DT_FLAGS_1.
13660
13661 2008-09-05  Cary Coutant  <ccoutant@google.com>
13662
13663         * fileread.cc (File_read::make_view): Add check for attempt to map
13664         beyond end of file.
13665
13666 2008-09-05  Cary Coutant  <ccoutant@google.com>
13667
13668         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
13669         explicit instantiations.
13670
13671 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
13672
13673         PR gold/6858
13674         * options.cc (General_options::finalize): Allow undefined symbols
13675         in shlibs if linking -shared.
13676
13677         PR gold/6859
13678         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
13679         symbols as not needing a dynsym entry.
13680
13681 2008-08-20  Craig Silverstein  <csilvers@google.com>
13682
13683         * fileread.cc (File_read::open): Do not lock the file unless it
13684         was successfully opened.
13685
13686 2008-08-14  Cary Coutant  <ccoutant@google.com>
13687
13688         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
13689         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
13690         * testsuite/tls_test.cc (struct int128): 128-bit struct
13691         for testing TLS relocs with non-zero addend.
13692         (v12): New TLS variable.
13693         (t12): New test.
13694         (t_last): Add check for v12.
13695         * testsuite/tls_test.h (t12): New function.
13696         * testsuite/tls_test_main.cc (thread_routine): Call new test.
13697
13698 2008-08-13  Ian Lance Taylor  <iant@google.com>
13699
13700         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
13701         set tls_segment_ or relro_segment_.
13702         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
13703         when appropriate.
13704         * output.h (Output_section::clear_is_relro): New function.
13705         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
13706         sections specially even when output_data_ is empty.
13707         (Output_segment::maximum_alignment): When first section is relro,
13708         only force alignment for PT_LOAD segments.
13709         * script.cc (script_data_segment_align): New function.
13710         (script_data_segment_relro_end): New function.
13711         * script-c.h (script_data_segment_align): Declare.
13712         (script_data_segment_relro_end): Declare.
13713         * script-sections.h (class Script_sections): Declare
13714         data_segment_align and data_segment_relro_end.  Add fields
13715         segment_align_index_ and saw_relro_end_.
13716         * script-sections.cc (class Sections_element): Add set_is_relro
13717         virtual function.  Add new bool* parameter to place_orphan_here.
13718         Add get_output_section virtual function.
13719         (class Output_section_definition): Add set_is_relro.  Add new
13720         bool* parameter to place_orphan_here.  Add get_output_section.
13721         Add is_relro_ field.
13722         (Output_section_definition::Output_section_definition): Initialize
13723         evaluated_address_, evaluated_load_address, evaluated_addralign_,
13724         and is_relro_ fields.
13725         (Output_section_definition::place_orphan_here): Add is_relro
13726         parameter.
13727         (Output_section_definition::set_section_addresses): Set relro for
13728         output section.
13729         (Output_section_definition::alternate_constraint): Likewise.
13730         (class Orphan_output_section): Add new bool* parameter to
13731         place_orphan_here.  Add get_output_section.
13732         (Orphan_output_section::place_orphan_here): Add is_relro
13733         parameter.
13734         (Script_sections::Script_sections): Initialize
13735         data_segment_align_index_ and saw_relro_end_.
13736         (Script_sections::data_segment_align): New function.
13737         (Script_sections::data_segment_relro_end): New function.
13738         (Script_sections::place_orphan): Set or clear is_relro.
13739         (Script_sections::set_section_addresses): Force alignment of first
13740         TLS section.
13741         * yyscript.y (exp): Call script_data_segment_align and
13742         script_data_segment_relro_end.
13743         * testsuite/relro_script_test.t: New file.
13744         * testsuite/relro_test.cc (using_script): Declare.
13745         (t1, t2): Test using_script.
13746         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
13747         (relro_script_test_SOURCES): Define.
13748         (relro_script_test_DEPENDENCIES): Define.
13749         (relro_script_test_LDFLAGS): Define.
13750         (relro_script_test_LDADD): Define.
13751         (relro_script_test.so): New target.
13752         * testsuite/Makefile.in: Rebuild.
13753
13754 2008-08-06  Cary Coutant <ccoutant@google.com>
13755
13756         * archive.cc (Archive::total_archives, Archive::total_members)
13757         (Archive::total_members_loaded): New variables.
13758         (Archive::setup): Add parameter.  Add option to preread
13759         archive symbols.
13760         (Archive::read_armap): Add counter.
13761         (Archive::get_file_and_offset): New function.
13762         (Archive::get_elf_object_for_member): New function.
13763         (Archive::read_all_symbols): New function.
13764         (Archive::read_symbols): New function.
13765         (Archive::add_symbols): Add counters.
13766         (Archive::include_all_members): Use armap to find members if it's
13767         already built.
13768         (Archive::include_member): Skip reading symbols if already read.
13769         Factored code into Archive::get_file_and_offset and
13770         Archive::get_elf_object_for_member.  Changed call to
13771         Mapfile::report_include_archive_member.
13772         (Archive::print_stats): New function.
13773         * archive.h: Declare Object and Read_symbols_data classes.
13774         (Archive::Archive): Add initializers for new members.
13775         (Archive::setup): Add parameter.
13776         (Archive::print_stats): New function.
13777         (Archive::total_archives, Archive::total_members)
13778         (Archive::total_members_loaded): New variables.
13779         (Archive::get_file_and_offset): New function.
13780         (Archive::get_elf_object_for_member): New function.
13781         (Archive::read_all_symbols): New function.
13782         (Archive::read_symbols): New function.
13783         (Archive::Archive_member): New class.
13784         (Archive::members_): New member.
13785         (Archive::num_members_): New member.
13786         * main.cc: Include archive.h.
13787         (main): Call Archive::print_stats.
13788         * mapfile.cc (Mapfile::report_include_archive_member): Delete
13789         archive parameter; member_name is now the fully-decorated name.
13790         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
13791         * options.h: (General_options): Add --preread-archive-symbols option.
13792         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
13793         Archive::setup.
13794
13795 2008-08-04  Ian Lance Taylor  <iant@google.com>
13796
13797         * symtab.h (Symbol::use_plt_offset): New function.
13798         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
13799         * powerpc.cc (Relocate::relocate): Likewise.
13800         * sparc.cc (Relocate::relocate): Likewise.
13801         * x86_64.cc (Relocate::relocate): Likewise.
13802         * testsuite/weak_plt.sh: New test.
13803         * testsuite/weak_plt_main.cc: New test.
13804         * testsuite/weak_plt_shared.cc: New test.
13805         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
13806         (check_PROGRAMS): Add weak_plt.
13807         (check_DATA): Add weak_plt_shared.so.
13808         (weak_plt_main_pic.o, weak_plt): New targets.
13809         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
13810         * testsuite/Makefile.in: Rebuild.
13811
13812         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
13813         gcctestdir/ld.
13814         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
13815         * testsuite/Makefile.in: Rebuild.
13816
13817 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
13818
13819         * Makefile.am (POTFILES.in): Set LC_ALL=C.
13820         * Makefile.in: Regenerate.
13821         * po/POTFILES.in: Regenerate.
13822
13823 2008-07-29  Ian Lance Taylor  <iant@google.com>
13824
13825         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
13826         symbols before other symbols.
13827         * testsuite/script_test_2.cc (test_addr): Declare.
13828         (test_addr_alias): Declare.
13829         (main): Check that test_addr and test_addr_alias have the right
13830         values.
13831         * testsuite/script_test_2.t: Define test_addr_alias and
13832         test_addr.
13833
13834 2008-07-24  Ian Lance Taylor  <iant@google.com>
13835
13836         PR 5990
13837         * descriptors.cc: New file.
13838         * descriptors.h: New file.
13839         * gold-threads.h (class Hold_optional_lock): New class.
13840         * fileread.cc: Include "descriptors.h".
13841         (File_read::~File_read): Release descriptor rather than closing
13842         it.
13843         (File_read::open) [file]: Call open_descriptor rather than open.
13844         Set is_descriptor_opened_.
13845         (File_read::open) [memory]: Assert that descriptor is not open.
13846         (File_read::reopen_descriptor): New function.
13847         (File_read::release): Release descriptor.
13848         (File_read::do_read): Make non-const.  Reopen descriptor.
13849         (File_read::read): Make non-const.
13850         (File_read::make_view): Reopen descriptor.
13851         (File_read::do_readv): Likewise.
13852         * fileread.h (class File_read): Add is_descriptor_opened_ field.
13853         Update declarations.
13854         * layout.cc: Include "descriptors.h".
13855         (Layout::create_build_id): Use open_descriptor rather than open.
13856         * output.cc: Include "descriptors.h".
13857         (Output_file::open): Use open_descriptor rather than open.
13858         * archive.cc (Archive::const_iterator): Change Archive to be
13859         non-const.
13860         (Archive::begin, Archive::end): Make non-const.
13861         (Archive::count_members): Likewise.
13862         * archive.h (class Archive): Update declarations.
13863         * object.h (Object::read): Make non-const.
13864         * Makefile.am (CCFILES): Add descriptors.cc.
13865         (HFILES): Add descriptors.h.
13866         * Makefile.in: Rebuild.
13867
13868         PR 6716
13869         * gold.h: Always include <clocale>.  Add Solaris workarounds
13870         following code in binutils/sysdep.h.
13871
13872         PR 6048
13873         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
13874         this->eh_frame_hdr_ is NULL before using it.
13875
13876         * dynobj.cc (Versions::Versions): Update comment.
13877
13878         * dynobj.cc (Versions::Versions): If there is an soname, use it as
13879         the base version name.
13880
13881         * stringpool.cc (Stringpool_template::add_with_length): Set key to
13882         array size plus one.
13883         (Stringpool_template::set_string_offsets): Subtract one from key
13884         before using it as an array index.
13885         (Stringpool_template::get_offset_with_length): Likewise.
13886         (Stringpool_template::write_to_buffer): Likewise.
13887         * stringpool.h (Stringpool_template::get_offset_from_key):
13888         Likewise.
13889
13890 2008-07-23  Ian Lance Taylor  <iant@google.com>
13891
13892         PR 6658
13893         * object.h (Merged_symbol_value::value): Do our best to handle a
13894         negative addend.
13895
13896         PR 6647
13897         * script.cc (Version_script_info::get_versions): Don't add empty
13898         version tag to return value.
13899         (Version_script_info::get_symbol_version_helper): Change return
13900         type to bool.  Add pversion parameter.  Change all callers.
13901         (script_register_vers_node): Don't require a non-NULL tag.
13902         * script.h (class Version_script_info): Update declarations.
13903         (Version_script_info::get_symbol_version): Change return type to
13904         bool.  Add version parameter.  Change all callers.
13905         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
13906         handling.  Handle an empty version from a version script.
13907         (Symbol_table::define_special_symbol): Likewise.
13908         * testsuite/ver_test_10.script: New file.
13909         * testsuite/ver_test_10.sh: New file.
13910         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
13911         (check_DATA): Add ver_test_10.syms.
13912         (ver_test_10.syms, ver_test_10.so): New target.
13913         * testsuite/Makefile.in: Rebuild.
13914
13915 2008-07-23  Simon Baldwin  <simonb@google.com>
13916
13917         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
13918         to zero for undefined symbols from dynamic libraries.
13919
13920 2008-07-23  Ian Lance Taylor  <iant@google.com>
13921
13922         * symtab.cc (Symbol_table::resolve): Remove version parameter.
13923         Change all callers.
13924         * symtab.h (class Symbol_table): Update declaration.
13925         * testsuite/ver_test_9.cc: New file.
13926         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
13927         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
13928         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
13929         (ver_test_9.so, ver_test_9.o): New targets.
13930         * testsuite/Makefile.in: Rebuild.
13931
13932 2008-07-22  Ian Lance Taylor  <iant@google.com>
13933
13934         * options.h (class General_options): Define --check-sections.
13935         * layout.cc (Layout::set_segment_offsets): Handle
13936         --check-sections.
13937
13938         * options.h (class General_options): Define -n/--nmagic and
13939         -N/--omagic.
13940         * options.cc (General_options::finalize): For -n/--nmagic or
13941         -N/--omagic, set -static.
13942         * layout.cc (Layout::attach_allocated_section_to_segment): If
13943         -N/--omagic, don't put read-only and read-write sections in
13944         different segments.
13945         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
13946         finding a read-only segment.
13947         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
13948         don't set the minimum segment alignment to the common page size,
13949         and don't set the file offset to the address modulo the page size.
13950         * script-sections.cc (Script_sections::create_segments): If
13951         -n/--omagic, don't put read-only and read-write sections in
13952         different segments.
13953
13954         * cref.cc: New file.
13955         * cref.h: New file.
13956         * options.h (class General_options): Add --print-symbol-counts.
13957         * main.cc (main): Issue defined symbol report if requested.
13958         * archive.cc (Archive::interpret_header): Make into a const member
13959         function.
13960         (Archive::add_symbols): Call Input_objects::archive_start and
13961         archive_stop.
13962         (Archive::const_iterator): Define new class.
13963         (Archive::begin, Archive::end): New functions.
13964         (Archive::include_all_members): Rewrite to use iterator.
13965         (Archive::count_members): New function.
13966         * archive.h (class Archive): Update declarations.
13967         (Archive::filename): New function.
13968         * object.cc: Include "cref.h".
13969         (Sized_relobj::Sized_relobj): Initialize defined_count_.
13970         (Sized_relobj::do_get_global_symbol_counts): New function.
13971         (Input_objects::add_object): Add object to cross-referencer.
13972         (Input_objects::archive_start): New function.
13973         (Input_objects::archive_stop): New function.
13974         (Input_objects::print_symbol_counts): New function.
13975         * object.h: Declare Cref and Archive.
13976         (Object::get_global_symbol_counts): New function.
13977         (Object::do_get_global_symbol_counts): New pure virtual function.
13978         (class Sized_relobj): Add defined_count_ field.  Update
13979         declarations.
13980         (class Input_objects): Add cref_ field.  Update constructor.
13981         Update declarations.
13982         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
13983         defined_count_.
13984         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
13985         symbol counts.
13986         (Sized_dynobj::do_get_global_symbol_counts): New function.
13987         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
13988         defined_count_.  Update declarations.  Define Symbols typedef.
13989         * symtab.cc (Symbol_table::add_from_relobj): Add defined
13990         parameter.  Change all callers.
13991         (Symbol_table::add_from_dynobj): Add sympointers and defined
13992         parameters.  Change all callers.
13993         * symtab.h (class Symbol_table): Update declarations.
13994         * Makefile.am (CCFILES): Add cref.cc.
13995         (HFILES): Add cref.h.
13996         * Makefile.in: Rebuild.
13997
13998 2008-07-22  Simon Baldwin  <simonb@google.com>
13999
14000         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
14001         to zero when writing undefined symbols.
14002
14003 2008-07-22  Ian Lance Taylor  <iant@google.com>
14004
14005         * output.cc (Output_section::add_input_section): Don't try to
14006         merge empty merge sections.
14007
14008 2008-07-21  Craig Silverstein  <csilvers@google.com>
14009
14010         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
14011         Include symbol version in error message.
14012
14013 2008-07-20  Chris Demetriou  <cgd@google.com>
14014
14015         * configure.ac (gold_cv_c_random_seed): New configured variable.
14016         (RANDOM_SEED_CFLAGS): New substituted variable.
14017         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
14018         * configure: Rebuild.
14019         * Makefile.in: Likewise.
14020         * testsuite/Makefile.in: Likewise.
14021
14022 2008-07-18  Ian Lance Taylor  <iant@google.com>
14023
14024         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
14025         where we see NAME/NULL and NAME/VERSION  as separate symbols.
14026         * testsuite/ver_test_main.cc (main): Call t4.
14027         (t4, t4_2a): Define.
14028         * testsuite/ver_test_2.cc (t4_2): Define.
14029         * testsuite/ver_test_2.script: Put t4_2a in VER2.
14030         * testsuite/ver_test_4.cc (t4_2a): Define.
14031         * testsuite/ver_test_4.script: Put t4_2a in VER2.
14032         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
14033
14034 2008-07-17  Ian Lance Taylor  <iant@google.com>
14035
14036         * dynobj.cc (Versions::add_def): If we give an error about a
14037         missing version, go ahead and create the version anyhow.
14038
14039 2008-07-10  Ian Lance Taylor  <iant@google.com>
14040
14041         Handle output sections with more than 0x7fffffff bytes.
14042         * object.h (class Relobj): Change map_to_output_ to
14043         output_sections_, and just keep a section pointer.  Change all
14044         uses.  Move comdat group support to Sized_relobj.
14045         (Relobj::is_section_specially_mapped): Remove.
14046         (Relobj::output_section): Remove poff parameter.  Change all
14047         callers.
14048         (Relobj::output_section_offset): New function.
14049         (Relobj::set_section_offset): Rewrite.
14050         (Relobj::map_to_output): Remove.
14051         (Relobj::output_sections): New function.
14052         (Relobj::do_output_section_offset): New pure virtual function.
14053         (Relobj::do_set_section_offset): Likewise.
14054         (class Sized_relobj): Add section_offsets_ field.  Add comdat
14055         group support from Relobj.  Update declarations.
14056         (Sized_relobj::get_output_section_offset): New function.
14057         (Sized_relobj::do_output_section_offset): New function.
14058         (Sized_relobj::do_set_section_offset): New function.
14059         * object.cc (Relobj::output_section_address): Remove.
14060         (Sized_relobj::Sized_relobj): Initialize new fields.
14061         (Sized_relobj::include_section_group): Cast find_kept_object to
14062         Sized_relobj.
14063         (Sized_relobj::include_linkonce_section): Likewise.
14064         (Sized_relobj::do_layout): Use separate arrays for output section
14065         and output offset.
14066         (Sized_relobj::do_count_local_symbols): Change map_to_output to
14067         output_sections.
14068         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
14069         output_sections and section_offsets.
14070         (Sized_relobj::write_local_symbols): Likewise.
14071         (map_to_kept_section): Compute output address directly.
14072         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
14073         output_sections and section_offsets.
14074         (Sized_relobj::write_sections): Likewise.
14075         (Sized_relobj::relocate_sections): Likewise.
14076         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
14077         * output.h (class Output_reloc): Update declarations.  Change
14078         u2_.relobj to Sized_relobj*.
14079         (class Output_data_reloc): Change add functions to use
14080         Sized_relobj*.
14081         * output.cc (Output_reloc::Output_reloc): Change relobj to
14082         Sized_relobj*.
14083         (Output_reloc::local_section_offset): Change return type to
14084         Elf_Addr.  Use get_output_section_offset.
14085         (Output_reloc::get_address): Likewise.
14086         (Output_section::is_input_address_mapped): Don't call
14087         is_section_specially_mapped.
14088         (Output_section::output_offset): Likewise.
14089         (Output_section::output_address): Likewise.
14090         (Output_section::starting_output_address): Likewise.
14091         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
14092         parameter to Sized_relobj*.
14093         (Copy_relocs::need_copy_reloc): Likewise.
14094         (Copy_relocs::save): Likewise.
14095         * copy-relocs.h (class Copy_relocs): Update declarations.
14096         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
14097         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
14098         * target-reloc.h (relocate_for_relocatable): Change
14099         offset_in_output_section type to Elf_Addr.  Change code that uses
14100         it as well.
14101         * layout.cc (Layout::layout): Always set *off.
14102         * mapfile.cc (Mapfile::print_input_section): Use
14103         output_section_offset.
14104         * i386.cc (Target_i386::copy_reloc): Change object parameter to
14105         Sized_relobj*.
14106         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
14107         * sparc.cc (Target_sparc::copy_reloc): Likewise.
14108         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
14109
14110 2008-07-03  Ian Lance Taylor  <iant@google.com>
14111
14112         * layout.cc (Layout::include_section): Do not discard unrecognized
14113         SHT_STRTAB sections.
14114
14115 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
14116
14117         * script.cc (Lex::can_continue_name): Make '?' allowable in
14118         version-script names.
14119         * testsuite/version_script.map: Change glob pattern to use '?'
14120
14121 2008-06-30  Manish Singh  <yosh@gimp.org>
14122
14123         PR 6585
14124         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
14125         Correct typo.
14126
14127 2008-06-30  Ian Lance Taylor  <iant@google.com>
14128
14129         PR 6660
14130         PR 6682
14131         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
14132         versions]: Don't try to read the value in the contents, since we
14133         don't use it.  Use the template endianness when writing.
14134
14135 2008-06-25  Cary Coutant  <ccoutant@google.com>
14136
14137         * fileread.cc (File_read::make_view): Assert on zero-length view.
14138         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
14139         symbol table when there are no symbols to read.
14140
14141 2008-06-23  Craig Silverstein  <csilvers@google.com>
14142
14143         * version.cc (version_string): Bump to 1.7
14144
14145 2008-06-18  Craig Silverstein  <csilvers@google.com>
14146
14147         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
14148         constant 0xFFFF to type Valtype.
14149         (Powerpc_relocate_functions::rel16_ha): Likewise.
14150
14151 2008-06-17  Ian Lance Taylor  <iant@google.com>
14152
14153         * output.h (Output_section::Input_section): Initialize p2align_ to
14154         zero for Output_section_data constructors.
14155         (Output_section::Input_section::addralign): If not an input
14156         section, return the alignment of the Output_section_data.
14157         * testsuite/copy_test.cc: New file.
14158         * testsuite/copy_test_1.cc: New file.
14159         * testsuite/copy_test_2.cc: New file.
14160         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
14161         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
14162         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
14163         (copy_test_1_pic.o, copy_test_1.so): New targets.
14164         (copy_test_2_pic.o, copy_test_2.so): New targets.
14165         * testsuite/Makefile.in: Rebuild.
14166
14167         * script-sections.cc (Script_sections::place_orphan): Initialize
14168         local variable exact.
14169
14170 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
14171
14172         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
14173
14174 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
14175             David S. Miller  <davem@davemloft.net>
14176
14177         * powerpc.cc: New file.
14178         * Makefile.am (TARGETSOURCES): Add powerpc.cc
14179         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
14180         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
14181         * Makefile.in: Rebuild.
14182
14183 2008-06-09  Ian Lance Taylor  <iant@google.com>
14184
14185         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
14186         <exception>.
14187         (throwing, orig_terminate): New static variables.
14188         (terminate_handler): New static function.
14189         (t2): Set terminate handler.
14190
14191 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
14192
14193         PR 6584
14194         * binary.cc (Binary_to_elf::sized_convert): Fix .data
14195         alignment.
14196
14197 2008-05-30  Cary Coutant  <ccoutant@google.com>
14198
14199         * archive.cc (Archive::include_all_members) Correct to step
14200         over symbol table and extended name table in thin archives.
14201
14202 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
14203
14204         PR 6407
14205         * target-reloc.h (relocate_for_relocatable): Fix new_offset
14206         calculation.
14207
14208 2008-05-28  Caleb Howe  <cshowe@google.com>
14209
14210         * reduced_debug_output.cc: New file.
14211         * reduced_debug_output.h: New file.
14212         * options.h (class General_options): Add --strip-debug-non-line.
14213         * options.cc (General_options::finalize): Add strip_debug_non_line
14214         to the strip heirarchy.
14215         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
14216         fields.
14217         * layout.cc: Include "reduced_debug_output.h".
14218         (Layout::Layout): Initialize new fields.
14219         (line_only_debug_sections): New static array.
14220         (is_lines_only_debug_sections): New static inline function.
14221         (Layout::include_section): Handle --strip-debug-non-line.
14222         (Layout::make_output_section): If --strip-debug-non-line, build
14223         new output sections for .debug_abbrev and .debug_info.
14224         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
14225         gold.  Warn about possible overflow.
14226         (read_signed_LEB_128): Likewise.
14227         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
14228         (read_signed_LEB_128): Declare.
14229         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
14230         (HFILES): Add reduced_debug_output.h.
14231         * Makefile.in: Rebuild.
14232
14233 2008-05-21  Ian Lance Taylor  <iant@google.com>
14234
14235         * mapfile.cc: New file.
14236         * mapfile.h: New file.
14237         * options.h (class General_options): Add -M/--print-map and -Map.
14238         * options.cc (General_options::finalize): Make -M equivalent to
14239         -Map -.
14240         * main.cc: Include <cstdio> and "mapfile.h".
14241         (main): Open mapfile if requested.
14242         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
14243         constructor.  Change caller.
14244         (queue_initial_tasks): Add mapfile parameter.  Change caller.
14245         (queue_middle_tasks): Likewise.
14246         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
14247         declarations.
14248         * archive.cc: Include "mapfile.h".
14249         (Archive::add_symbols): Add mapfile parameter.  Change all
14250         callers.  Pass mapfile, symbol, and reason to include_member.
14251         (Archive::include_all_members): Add mapfile parameter.  Change all
14252         callers.
14253         (Archive::include_member): Add mapfile, sym, and why parameters.
14254         Change all callers.  Report inclusion to map file.
14255         * archive.h: Include "fileread.h".
14256         (class Archive): Update declarations.
14257         (Archive::file): New const method.
14258         (class Add_archive_symbols): Add mapfile_ field.  Update
14259         constructor.  Change all callers.
14260         * readsyms.h (class Read_symbols): Likewise.
14261         (class Finish_group): Likewise.
14262         (class Read_script): Likewise.
14263         * common.cc: Include "mapfile.h".
14264         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
14265         all callers.
14266         (Symbol_table::do_allocate_commons): Likewise.
14267         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
14268         symbol allocation to mapfile.
14269         * common.h (class Allocate_commons_task): Add mapfile_ field.
14270         Update constructor.  Change all callers.
14271         * symtab.h (class Symbol_table): Update declarations.
14272         * layout.cc: Include "mapfile.h".
14273         (Layout_task_runner::run): Print information to mapfile.
14274         (Layout::create_gold_note): Change Output_data_fixed_space to
14275         Output_data_zero_fill.
14276         (Layout::create_build_id): Likewise.
14277         (Layout::print_to_mapfile): New function.
14278         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
14279         constructor.  Change caller.
14280         (class Layout): Declare print_to_mapfile.
14281         * output.cc (Output_section::Input_section::print_to_mapfile): New
14282         function.
14283         (Output_section::add_input_section): If producing a map, always
14284         add to input_sections_ list.
14285         (Output_section::do_print_to_mapfile): New function.
14286         (Output_segment::print_sections_to_mapfile): New function.
14287         (Output_segment::print_section_list_to_mapfile): New function.
14288         * output.h: Include "mapfile.h".
14289         (Output_data::print_to_mapfile): New function.
14290         (Output_data::do_print_to_mapfile): New virtual function.
14291         (Output_segment_headers::do_print_to_mapfile): New function.
14292         (Output_file_header::do_print_to_mapfile): New function.
14293         (Output_data_const::do_print_to_mapfile): New function.
14294         (class Output_data_const_buffer): Add map_name_ field.  Update
14295         constructor.  Change all callers.  Add do_print_to_mapfile
14296         function.
14297         (class Output_data_fixed_space): Likewise.
14298         (class Output_data_space): Likewise.
14299         (class Output_data_zero_fill): New class.
14300         (Output_data_strtab::do_print_to_mapfile): New function.
14301         (Output_data_reloc_base::do_print_to_mapfile): New function.
14302         (Output_relocatable_relocs::do_print_to_mapfile): New function.
14303         (Output_data_group::do_print_to_mapfile): New function.
14304         (Output_data_got::do_print_to_mapfile): New function.
14305         (Output_data_dynamic::do_print_to_mapfile): New function.
14306         (Output_symtab_xindex::do_print_to_mapfile): New function.
14307         (class Output_section): Declare do_print_to_mapflie.  Declare
14308         print_to_mapfile in Input_section.
14309         (class Output_segment): Declare new functions.
14310         * object.h (Sized_relobj::symbol_count): New function.
14311         * script-sections.cc
14312         (Output_section_element_dot_assignment::set_section_addresses):
14313         Change Output_data_fixed_space to Output_data_zero_fill.
14314         (Output_data_expression::do_print_to_mapfile): New function.
14315         * script.cc (read_input_script): Add mapfile parameter.  Change
14316         all callers.
14317         * script.h (read_input_script): Update declaration.
14318         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
14319         (Eh_frame::do_print_to_mapfile): New function.
14320         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
14321         (Output_merge_string::do_print_to_mapfile): New function.
14322         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
14323         function.
14324         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
14325         function.
14326         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
14327         function.
14328         * Makefile.am (CCFILES): Add mapfile.cc.
14329         (HFILES): Add mapfile.h.
14330         * Makefile.in: Rebuild.
14331
14332 2008-05-19  Ian Lance Taylor  <iant@google.com>
14333
14334         * options.h (class General_options): Add -z relro.
14335         * layout.cc (Layout::Layout): Initialize relro_segment_.
14336         (Layout::add_output_section_data): Return the output section.
14337         (Layout::make_output_section): Rcognize relro sections and mark
14338         them appropriately.
14339         (Layout::attach_allocated_section_to_segment): Put relro sections
14340         in a PT_GNU_RELRO segment.
14341         (Layout::create_initial_dynamic_sections): Mark the .dynamic
14342         section as relro.
14343         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
14344         PT_TLS segments.
14345         (Layout::linkonce_mapping): Map d.rel.ro.local to
14346         .data.rel.ro.local.
14347         (Layout::output_section_name): Us .data.rel.ro.local for any
14348         section which begins with that.
14349         * layout.h (class Layout): Update add_output_section_data
14350         declaration.  Add relro_segment_ field.
14351         * output.cc (Output_section::Output_section): Initialize is_relro_
14352         and is_relro_local_ fields.
14353         (Output_segment::add_output_section): Group relro sections.
14354         (Output_segment::is_first_section_relro): New function.
14355         (Output_segment::maximum_alignment): If there is a relro section,
14356         align the segment to the common page size.
14357         (Output_segment::set_section_addresses): Track whether we are
14358         looking at relro sections.  If the last section is a relro
14359         section, align to the common page size.
14360         (Output_segment::set_section_list_addresses): Add in_relro
14361         parameter.  Change all callers.  Align to the page size when
14362         moving from relro to non-relro section.
14363         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
14364         segment.
14365         * output.h (class Output_section): Add is_relro_ and
14366         is_relro_local_ fields.
14367         (Output_section::is_relro): New function.
14368         (Output_section::set_is_relro): New function.
14369         (Output_section::is_relro_local): New function.
14370         (Output_section::set_is_relro_local): New function.
14371         (class Output_segment): Update declarations.
14372         * i386.cc (Target_i386::got_section): Mark .got section as relro.
14373         * sparc.cc (Target_sparc::got_section): Likewise.
14374         * x86_64.cc (Target_x86_64::got_section): Likewise.
14375         * testsuite/relro_test_main.cc: New file.
14376         * testsuite/relro_test.cc: New file.
14377         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
14378         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
14379         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
14380         (relro_test.so, relro_test_pic.o): New targets.
14381         * testsuite/Makefile.in: Rebuild.
14382
14383 2008-05-16  Ian Lance Taylor  <iant@google.com>
14384
14385         * output.cc (Output_segment::add_output_section): Remove front
14386         parameter.
14387         * output.h (class Output_segment): Remove
14388         add_initial_output_section and overloaded add_output_section.
14389         Update declaration of remaining add_output_section.
14390         * layout.cc (Layout::create_interp): Call add_output_section
14391         rather than add_initial_output_section.
14392         (Layout::finish_dynamic_section): Likewise.
14393
14394         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
14395         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
14396         know the dynamic type.
14397         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
14398         field.  Initialize it in constructor.
14399         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
14400         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
14401         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
14402         reloc.
14403
14404         * output.cc (Output_reloc::get_address): Change return type to
14405         Elf_Addr.
14406         * output.h (class Output_reloc): Update get_address declaration.
14407         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
14408         for section addresses.
14409
14410 2008-05-09  Ian Lance Taylor  <iant@google.com>
14411
14412         PR 6493
14413         * gold.cc (gold_nomem): Use return value of write.
14414
14415 2008-05-08  Ian Lance Taylor  <iant@google.com>
14416
14417         * symtab.c (Symbol::init_base_output_data): Add version
14418         parameter.  Change all callers.
14419         (Symbol::init_base_output_segment): Likewise.
14420         (Symbol::init_base_constant): Likewise.
14421         (Symbol::init_base_undefined): Likewise.
14422         (Sized_symbol::init_output_data): Likewise.
14423         (Sized_symbol::init_output_segment): Likewise.
14424         (Sized_symbol::init_constant): Likewise.
14425         (Sized_symbol::init_undefined): Likewise.
14426         (Symbol_table::do_define_in_output_data): If the new symbol has a
14427         version, mark it as the default.
14428         (Symbol_table::do_define_in_output_segment): Likewise.
14429         (Symbol_table::do_define_as_constant): Likewise.
14430         * symtab.h (class Symbol): Update declarations.
14431         (class Sized_symbol): Likewise.
14432         * resolve.cc (Symbol::override_version): New function.
14433         (Symbol::override_base): Call override_version.
14434         (Symbol::override_base_with_special): Likewise.
14435         * testsuite/ver_script_8.script: New file.
14436         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
14437         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
14438         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
14439         (ver_test_8_1.so, ver_test_8_2.so): New targets.
14440
14441 2008-05-06  Ian Lance Taylor  <iant@google.com>
14442
14443         PR 6049
14444         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
14445         functions.
14446         (class General_options): Remove existing --undefined, and add
14447         --no-undefined instead.  Add new --undefined as synonym for -u.
14448         * archive.cc (Archive::add_symbols): Check whether symbol was
14449         named with -u.
14450         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
14451         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
14452         all uses.  Add IS_UNDEFINED.  Update declarations to split
14453         different versions of init_base.  Declare init_base_undefined.
14454         (Symbol::is_defined): Handle IS_UNDEFINED.
14455         (Symbol::is_undefined): Likewise.
14456         (Symbol::is_weak_undefined): Call is_undefined.
14457         (Symbol::is_absolute): Handle IS_CONSTANT.
14458         (class Sized_symbol): Update declarations to split different
14459         versions of init.  Declare init_undefined.
14460         (class Symbol_table): Declare new functions.
14461         * symtab.cc (Symbol::init_base_object): Rename from init_base.
14462         Change all callers.
14463         (Symbol::init_base_output_data): Likewise.
14464         (Symbol::init_base_output_segment): Likewise.
14465         (Symbol::init_base_constant): Likewise.
14466         (Symbol::init_base_undefined): New function.
14467         (Sized_symbol::init_object): Rename from init.  Change all
14468         callers.
14469         (Sized_symbol::init_output_data): Likewise.
14470         (Sized_symbol::init_output_segment): Likewise.
14471         (Sized_symbol::init_constant): Likewise.
14472         (Sized_symbol::init_undefined): New function.
14473         (Symbol_table::add_undefined_symbols_from_command_line): New
14474         function.
14475         (Symbol_table::do_add_undefined_symbols_from_command_line): New
14476         function.
14477         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
14478         (Symbol::output_section): Likewise.
14479         (Symbol::set_output_section): Likewise.
14480         (Symbol_table::sized_finalize_symbol): Likewise.
14481         (Symbol_table::sized_write_globals): Likewise.
14482         * resolve.cc (Symbol_table::should_override): Likewise.
14483         (Symbol::override_base_with_special): Likewise.
14484
14485         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
14486         symbol, change it to have default visibility.
14487         * testsuite/protected_1.cc: New file.
14488         * testsuite/protected_2.cc: New file.
14489         * testsuite/protected_3.cc: New file.
14490         * testsuite/protected_main_1.cc: New file.
14491         * testsuite/protected_main_2.cc: New file.
14492         * testsuite/protected_main_3.cc: New file.
14493         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
14494         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
14495         (protected_1_LDFLAGS, protected_1_LDADD): Define.
14496         (protected_1.so): New target.
14497         (protected_1_pic.o, protected_2_pic.o): New targets.
14498         (protected_3_pic.o): New target.
14499         (check_PROGRAMS): Add protected_2.
14500         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
14501         (protected_2_LDFLAGS, protected_2_LDADD): Define.
14502         * testsuite/Makefile.in: Rebuild.
14503
14504         * options.h (DEFINE_var): Add set_user_set_##varname__.
14505         (DEFINE_bool_alias): New macro.
14506         (class General_options): Define -Bstatic using DEFINE_bool_alias
14507         rather than DEFINE_special.  Add --undefined as an alias for -z
14508         defs.
14509         * options.cc (General_options::parse_Bstatic): Remove.
14510
14511         * options.h (class General_options): Add --fatal-warnings.
14512         * main.cc (main): Implement --fatal-warnings.
14513         * errors.h (Errors::warning_count): New function.
14514
14515         * options.h (class General_options): Add -Bsymbolic-functions.
14516         * symtab.h (Symbol::is_preemptible): Check for
14517         -Bsymbolic-functions.
14518
14519 2008-05-05  Ian Lance Taylor  <iant@google.com>
14520
14521         * options.h (DEFINE_bool): For DASH_Z, create the negative option
14522         as noVARNAME rather than no-VARNAME.
14523         (class General_options): Add option -z combreloc.
14524         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
14525         get_address.
14526         (Output_reloc::sort_before) [SHT_REL]: New function.
14527         (Output_reloc::sort_before) [SHT_RELA]: New function.
14528         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
14529         Sort_relocs_comparison.
14530         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
14531         parameter.  Change all callers.
14532         (Output_data_reloc::Output_data_reloc) [both versions]: Add
14533         sort_relocs parameter.  Change all callers.
14534         * output.cc (Output_reloc::get_address): New function, broken out
14535         of write_rel.
14536         (Output_reloc::write_rel): Call it.
14537         (Output_reloc::compare): New function.
14538         (Output_data_reloc_base::do_write): Optionally sort relocs.
14539
14540         * configure.ac: If targ_extra_obj is set, link it in.
14541         * configure.tgt: Initialize all variables.
14542         (x86_64*): Set targ_extra_obj and targ_extra_size.
14543         * configure: Rebuild.
14544
14545         * object.cc (Sized_relobj::include_section_group): Adjust section
14546         indexes read from group data.  Build vector to pass to
14547         layout_group.
14548         * layout.cc (Layout::layout_group): Add flags and shndxes
14549         parameters.  Remove contents parameter.  Change caller.  Update
14550         explicit instantiations.
14551         * layout.h (class Layout): Update layout_group declaration.
14552         * output.cc (Output_data_group::Output_data_group): Add flags and
14553         input_shndxes parameters.  Remove contents parameter.  Change
14554         caller.
14555         (Output_data_group::do_write): Change input_sections_ to
14556         input_shndxes_.
14557         * output.h (class Output_data_group): Update constructor
14558         declaration.  Rename input_sections_ to input_shndxes_.
14559         * testsuite/many_sections_test.cc: Add template.
14560
14561 2008-04-30  Cary Coutant  <ccoutant@google.com>
14562
14563         * target-reloc.h (relocate_section): Fix dead-pointer bug.
14564
14565         * layout.cc (Layout::include_section): Refactored check for debug
14566         info section.
14567         (Layout::add_comdat): Add new parameters.  Change type
14568         of signature parameter.  Add object and shndx to signatures table.
14569         (Layout::find_kept_object): New function.
14570         * layout.h: Include <cstring>.
14571         (Layout::is_debug_info_section): New function.
14572         (Layout::add_comdat): Add new parameters.
14573         (Layout::find_kept_object): New function.
14574         (Layout::Kept_section): New struct.
14575         (Layout::Signatures): Change type of map range.
14576         * object.cc (Relobj::output_section_address): New function.
14577         (Sized_relobj::include_section_group): Add new parameters.  Change
14578         calls to Layout::add_comdat.  Change to build table of kept comdat
14579         groups and table mapping discarded sections to kept sections.
14580         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
14581         (Sized_relobj::do_layout): Change calls to include_section_group and
14582         include_linkonce_section.
14583         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
14584         value to zero when section is discarded.
14585         (Sized_relobj::map_to_kept_section): New function.
14586         * object.h (Relobj::output_section_address): New function.
14587         (Relobj::Comdat_group): New type.
14588         (Relobj::find_comdat_group): New function.
14589         (Relobj::Comdat_group_table): New type.
14590         (Relobj::Kept_comdat_section): New type.
14591         (Relobj::Kept_comdat_section_table): New type.
14592         (Relobj::add_comdat_group): New function.
14593         (Relobj::set_kept_comdat_section): New function.
14594         (Relobj::get_kept_comdat_section): New function.
14595         (Relobj::comdat_groups_): New field.
14596         (Relobj::kept_comdat_sections_): New field.
14597         (Symbol_value::input_value): Update comment.
14598         (Sized_relobj::map_to_kept_section) New function.
14599         (Sized_relobj::include_linkonce_section): Add new parameter.
14600         * target-reloc.h (Comdat_behavior): New type.
14601         (get_comdat_behavior): New function.
14602         (relocate_section): Add code to map a discarded section to the
14603         corresponding kept section when applying a relocation.
14604
14605 2008-04-30  Craig Silverstein  <csilvers@google.com>
14606
14607         * dwarf_reader.cc (next_generation_count): New static var.
14608         (Addr2line_cache_entry): New struct.
14609         (addr2line_cache): New static var.
14610         (Dwarf_line_info::one_addr2line): Added caching.
14611         (Dwarf_line_info::clear_addr2line_cache): New function.
14612         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
14613         cache-size parameter.
14614         (Dwarf_line_info::one_addr2line_cache): New function.
14615         * symtab.cc (Symbol_table::detect_odr_violations): Pass
14616         new cache-size argument to one_addr2line(), and clear cache.
14617
14618 2008-04-28  Cary Coutant  <ccoutant@google.com>
14619
14620         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
14621         R_386_PC8 relocations.
14622
14623 2008-04-23  Ian Lance Taylor  <iant@google.com>
14624
14625         * object.cc (Sized_relobj::include_section_group): Check for
14626         invalid section group.
14627
14628         * object.cc (make_elf_object): Correct test for 64-bit ELF file
14629         header size.
14630
14631         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
14632         than read for file header.
14633         * archive.cc (Archive::include_member): Likewise.
14634
14635 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
14636
14637         * aclocal.m4: Regenerate.
14638         * configure: Regenerate.
14639
14640 2008-04-19  Ian Lance Taylor  <iant@google.com>
14641
14642         * version.cc (version_string): Bump to 1.6.
14643
14644         * testsuite/Makefile.am (many_sections_r_test): New target.
14645         (many_sections_r_test_SOURCES): Remove.
14646         (many_sections_r_test_DEPENDENCIES): Remove.
14647         (many_sections_r_test_LDFLAGS): Remove.
14648         (many_sections_r_test_LDADD): Remove.
14649
14650         * object.cc (Sized_relobj::do_add_symbols): Always pass
14651         local_symbol_count_ to add_from_relobj.
14652
14653         * testsuite/Makefile.am (many_sections_check.h): Only check one in
14654         every thousand variables.
14655         * testsuite/Makefile.in: Rebuild.
14656
14657         * object.cc (Xindex::initialize_symtab_xindex): New function.
14658         (Xindex::read_symtab_xindex): New function.
14659         (Xindex::sym_xindex_to_shndx): New function.
14660         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
14661         available.
14662         (Sized_relobj::do_initialize_xindex): New function.
14663         (Sized_relobj::do_read_symbols): Adjust section links.
14664         (Sized_relobj::symbol_section_and_value): Add is_ordinary
14665         parameter.  Change all callers.
14666         (Sized_relobj::include_section_group): Adjust section links and
14667         symbol section indexes.
14668         (Sized_relobj::do_layout): Adjust section links.
14669         (Sized_relobj::do_count_local_symbols): Adjust section links and
14670         symbol section indexes.
14671         (Sized_relobj::do_finalize_local_symbols): Distinguish between
14672         ordinary and special symbols.
14673         (Sized_relobj::write_local_symbols): Add symtab_xindex and
14674         dynsym_xindex parameters.  Change all callers.  Adjust section
14675         links.  Use SHN_XINDEX when needed.
14676         (Sized_relobj::get_symbol_location_info): Adjust section links.
14677         Don't get fooled by special symbols.
14678         * object.h (class Xindex): Define.
14679         (class Object): Add xindex_ parameter.  Declare virtual functoin
14680         do_initialize_xindex.
14681         (Object::adjust_sym_shndx): New function.
14682         (Object::set_xindex): New protected function.
14683         (class Symbol_value): Add is_ordinary_shndx_ field.
14684         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
14685         (Symbol_value::value): Assert ordinary section.
14686         (Symbol_value::initialize_input_to_output_map): Likewise.
14687         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
14688         Change all callers.
14689         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
14690         all callers.
14691         (class Sized_relobj): Update declarations.
14692         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
14693         parameter.  Change all callers.
14694         (Sized_relobj::adjust_shndx): New function.
14695         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
14696         field.
14697         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
14698         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
14699         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
14700         (Sized_dynobj::read_dynsym_section): Adjust section links.
14701         (Sized_dynobj::read_dynamic): Likewise.
14702         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
14703         section links.
14704         (Sized_dynobj::do_initialize_xindex): New function.
14705         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
14706         do_initialize_xindex.
14707         (Sized_dynobj::adjust_shndx): New function.
14708         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
14709         dynsym_xindex_ fields.
14710         (Layout::finalize): Add a call to set_section_indexes before
14711         creating the symtab sections.
14712         (Layout::set_section_indexes): Don't do anything if the section
14713         already has a section index.
14714         (Layout::create_symtab_sections): Add shnum parameter.  Change
14715         caller.  Create .symtab_shndx section if needed.
14716         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
14717         caller.
14718         (Layout::allocated_output_section_count): New function.
14719         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
14720         needed.
14721         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
14722         fields.  Update declarations.
14723         (Layout::symtab_xindex): New function.
14724         (Layout::dynsym_xindex): New function.
14725         (class Write_symbols_task): Add layout_ field.
14726         (Write_symbols_task::Write_symbols_task): Add layout parameter.
14727         Change caller.
14728         * output.cc (Output_section_headers::Output_section_headers): Add
14729         shstrtab_section parameter.  Change all callers.
14730         (Output_section_headers::do_sized_write): Store overflow values
14731         for section count and section string table section index in
14732         section header zero.
14733         (Output_file_header::do_sized_write): Check for overflow of
14734         section count and section string table section index.
14735         (Output_symtab_xindex::do_write): New function.
14736         (Output_symtab_xindex::endian_do_write): New function.
14737         * output.h (class Output_section_headers): Add shstrtab_section_.
14738         Update declarations.
14739         (class Output_symtab_xindex): Define.
14740         (Output_section::has_out_shndx): New function.
14741         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
14742         field.
14743         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
14744         Change all callers.
14745         (Sized_symbol::init): Likewise.
14746         (Symbol::output_section): Check for ordinary symbol.
14747         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
14748         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
14749         callers.
14750         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
14751         Change all callers.  Simplify handling of symbols from sections
14752         not included in the link.
14753         (Symbol_table::add_from_dynobj): Handle ordinary symbol
14754         distinction.
14755         (Weak_alias_sorter::operator()): Assert that symbols are
14756         ordinary.
14757         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
14758         distinction.
14759         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
14760         parameters.  Change all callers.
14761         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
14762         symbol distinction.  Use SHN_XINDEX when needed.
14763         (Symbol_table::write_section_symbol): Add symtab_xindex
14764         parameter.  Change all callers.
14765         (Symbol_table::sized_write_section_symbol): Likewise.  Use
14766         SHN_XINDEX when needed.
14767         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
14768         declarations.
14769         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
14770         (Symbol::is_defined): Check is_ordinary.
14771         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
14772         (Symbol::is_absolute, Symbol::is_common): Likewise.
14773         (class Sized_symbol): Update declarations.
14774         (class Symbol_table): Update declarations.
14775         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
14776         parameters.  Change all callers.
14777         (Sized_symbol::override): Likewise.
14778         (Symbol_table::override): Likewise.
14779         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
14780         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
14781         is_ordinary, and orig_st_shndx parameters.  Change all callers.
14782         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
14783         to be in an ordinary section.
14784         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
14785         object and is_ordinary parameters.  Change all callers.
14786         (Sized_dwarf_line_info::read_relocs): Add object parameter.
14787         Change all callers.  Don't add undefined or non-ordinary symbols
14788         to reloc_map_.
14789         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
14790         Change all callers.
14791         * dwarf_reader.h (class Sized_dwarf_line_info): Update
14792         declarations.
14793         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
14794         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
14795         (Sized_relobj::relocate_sections): Likewise.
14796         * target-reloc.h (scan_relocs): Adjust section symbol index.
14797         (scan_relocatable_relocs): Likewise.
14798         * i386.cc (Scan::local): Check for ordinary symbols.
14799         * sparc.cc (Scan::local): Likewise.
14800         * x86_64.cc (Scan::local): Likewise.
14801         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
14802         to symbol_section_and_value.
14803         * testsuite/many_sections_test.cc: New file.
14804         * testsuite/Makefile.am (BUILT_SOURCES): Define.
14805         (check_PROGRAMS): Add many_sections_test.
14806         (many_sections_test_SOURCES): Define.
14807         (many_sections_test_DEPENDENCIES): Define.
14808         (many_sections_test_LDFLAGS): Define.
14809         (BUILT_SOURCES): Add many_sections_define.h.
14810         (many_sections_define.h): New target.
14811         (BUILT_SOURCES): Add many_sections_check.h.
14812         (many_sections_check.h): New target.
14813         (check_PROGRAMS): Add many_sections_r_test.
14814         (many_sections_r_test_SOURCES): Define.
14815         (many_sections_r_test_DEPENDENCIES): Define.
14816         (many_sections_r_test_LDFLAGS): Define.
14817         (many_sections_r_test_LDADD): Define.
14818         (many_sections_r_test.o): New target.
14819         * testsuite/Makefile.in: Rebuild.
14820
14821 2008-04-17  Cary Coutant  <ccoutant@google.com>
14822
14823         * errors.cc (Errors::info): New function.
14824         (gold_info): New function.
14825         * errors.h (Errors::info): New function.
14826         * gold.h (gold_info): New function.
14827         * object.cc (Input_objects::add_object): Print trace output.
14828         * options.cc (options::parse_set): New function.
14829         (General_options::parse_wrap): Deleted.
14830         (General_options::General_options): Deleted initializer.
14831         * options.h (options::String_set): New typedef.
14832         (options::parse_set): New function.
14833         (DEFINE_set): New macro.
14834         (General_options::wrap): Changed to use DEFINE_set. Changed
14835         callers of any_wrap_symbols and is_wrap_symbol.
14836         (General_options::trace, General_options::trace_symbol):
14837         New options.
14838         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
14839         (General_options::wrap_symbols_): Deleted.
14840         * symtab.cc (Symbol_table::add_from_object): Print trace output.
14841
14842 2008-04-17  David S. Miller  <davem@davemloft.net>
14843
14844         * options.cc (General_options::parse_V): New function.
14845         * options.h: Add entries for -V and -Qy.
14846
14847 2008-04-17  Ian Lance Taylor  <iant@google.com>
14848
14849         * common.cc (Symbol_table::allocate_commons): Remove options
14850         parameter.  Change caller.
14851         (Symbol_table::do_allocate_commons): Remove options parameter.
14852         Change caller.  Just call do_allocate_commons_list twice.
14853         (Symbol_table::do_allocate_commons_list): New function, broken out
14854         of do_allocate_commons.
14855         * common.h (class Allocate_commons_task): Remove options_ field.
14856         Update constructor.
14857         * symtab.cc (Symbol_table::Symbol_table): Initialize
14858         tls_commons_.
14859         (Symbol_table::add_from_object): Put TLS common symbols on
14860         tls_commons_ list.
14861         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
14862         which are IN_OUTPUT_DATA.
14863         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
14864         allocate_commons and do_allocate_commons declarations.  Declare
14865         do_allocate_commons_list.
14866         * gold.cc (queue_middle_tasks): Update creation of
14867         Allocate_commons_task to not pass options.
14868         * testsuite/Makefile.am (INCLUDES): Add -I.. .
14869         (TLS_TEST_C_FLAGS): New variable.
14870         (tls_test_c_pic.o): New target.
14871         (tls_test_shared.so): Link in tls_test_c_pic.o.
14872         (tls_test_c_pic_ie.o): New target.
14873         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
14874         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
14875         (tls_test_c.o): New target.
14876         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
14877         (tls_pic_test_LDADD): Likewise.
14878         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
14879         (tls_shared_gd_to_ie_test_LDADD): Likewise.
14880         (tls_test_c_gnu2.o): New target.
14881         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
14882         tls_test_c_gnu2.o.
14883         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
14884         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
14885         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
14886         * testsuite/tls_test.cc: Include "config.h".
14887         (t_last): Call t11_last.
14888         * testsuite/tls_test.h (t11, t11_last): Declare.
14889         * testsuite/tls_test_c.c: New file.
14890         * testsuite/tls_test_main.cc (thread_routine): Call t11.
14891         * configure.ac: Check for OpenMP support.
14892         * configure, config.in, Makefile.in: Rebuild.
14893         * testsuite/Makefile.in: Rebuild.
14894
14895 2008-04-16  Cary Coutant  <ccoutant@google.com>
14896
14897         * i386.cc (Target_i386::define_tls_base_symbol): New function.
14898         (Target_i386::tls_base_symbol_defined_): New field.
14899         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
14900         (Target_i386::Scan::global): Likewise.
14901         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
14902         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
14903         (Target_x86_64::tls_base_symbol_defined_): New field.
14904         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
14905         (Target_x86_64::Scan::global): Likewise.
14906
14907 2008-04-16  Cary Coutant  <ccoutant@google.com>
14908
14909         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
14910         (Symbol::needs_plt_entry): Allow weak undefined symbols.
14911         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
14912         building shared libraries.
14913         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
14914         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
14915         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
14916         * testsuite/Makefile.in: Rebuild.
14917         * testsuite/weak_undef.h: New file.
14918         * testsuite/weak_undef_file1.cc: Add extra test cases.
14919         * testsuite/weak_undef_file2.cc: Likewise.
14920         * testsuite/weak_undef_test.cc: Likewise.
14921
14922 2008-04-16  David S. Miller  <davem@davemloft.net>
14923
14924         * sparc.cc (Target_sparc::Scan): Change from struct to class.
14925         Add issued_non_pic_error_ field.  Declare check_non_pic.
14926         (Target_sparc::Scan::check_non_pic): New function.
14927         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
14928         (Target_sparc::Scan::global): Likewise.
14929
14930         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
14931         * configure: Rebuild.
14932
14933         * options.h (DEFINE_enable): New macro.
14934         (new_dtags): New enable option.
14935         (initfirst, interpose, loadfltr, nodefaultlib,
14936         nodelete, nodlopen, nodump): New -z options.
14937         * layout.cc (Layout:finish_dynamic_section): If new
14938         dtags enabled, emit DT_RUNPATH.  Also, emit a
14939         DT_FLAGS_1 containing any specified -z flags.
14940
14941 2008-04-16  Ian Lance Taylor  <iant@google.com>
14942
14943         * copy-relocs.cc: New file.
14944         * copy-relocs.h: New file.
14945         * reloc.cc: Remove Copy_relocs code.
14946         * reloc.h: Likewise.
14947         * reloc-types.h (struct Reloc_types) [both versions]: Add
14948         get_reloc_addend_noerror.
14949         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
14950         variants of add_global which take an addend which must be zero.
14951         * i386.cc: Include "copy-relocs.h".
14952         (class Target_i386): Change type of copy_relocs_ to variable,
14953         update initializer.
14954         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
14955         Change all callers.
14956         (Target_i386::do_finalize_sections): Change handling of
14957         copy_relocs_.
14958         * sparc.cc: Include "copy-relocs.h".
14959         (class Target_sparc): Change type of copy_relocs_ to variable,
14960         update initializer.
14961         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
14962         Change all callers.
14963         (Target_sparc::do_finalize_sections): Change handling of
14964         copy_relocs_.
14965         * x86_64.cc: Include "copy-relocs.h".
14966         (class Target_x86_64): Change type of copy_relocs_ to variable,
14967         update initializer.
14968         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
14969         class.  Change all callers.
14970         (Target_x86_64::do_finalize_sections): Change handling of
14971         copy_relocs_.
14972         * Makefile.am (CCFILES): Add copy-relocs.cc.
14973         (HFILES): Add copy-relocs.h.
14974
14975         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
14976
14977         * testsuite/script_test_4.sh: Permit leading zeroes.
14978
14979 2008-04-15  Ian Lance Taylor  <iant@google.com>
14980
14981         * script-sections.cc (Script_sections::create_segments): Use
14982         header_size_adjustment even when there is enough room for the
14983         headers.
14984         * testsuite/script_test_4.sh: New file.
14985         * testsuite/script_test_4.t: New file.
14986         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
14987         (check_DATA): Add script_test_4.stdout.
14988         (MOSTLYCLEANFILES): Likewise.
14989         (script_test_4): New target.
14990         (script_test_4.stdout): New target.
14991         * testsuite/Makefile.in: Rebuild.
14992
14993         * sparc.cc: Add definitions for Output_data_plt_sparc class
14994         constants.
14995
14996 2008-04-14  David S. Miller  <davem@davemloft.net>
14997
14998         * sparc.cc: New file.
14999         * Makefile.am (TARGETSOURCES): Add sparc.cc
15000         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
15001         * configure.tgt: Document targ_extra_size and
15002         targ_extra_big_endian.  Add entries for sparc-* and
15003         sparc64-*.
15004         * configure.ac: Handle targ_extra_size and
15005         targ_extra_big_endian.
15006         * Makefile.in: Rebuild.
15007         * configure: Likewise.
15008         * po/POTFILES.in: Likewise.
15009         * po/gold.pot: Likewise.
15010
15011 2008-04-14  Ian Lance Taylor  <iant@google.com>
15012
15013         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
15014         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
15015         in the name/type/flags to section mapping.  Don't call
15016         allocate_output_section.
15017         (Layout::choose_output_section): Change parameter from adjust_name
15018         to is_input_section.  Don't permit input sections after sections
15019         are attached to segments.  Don't call allocate_output_section.
15020         (Layout::layout_eh_frame): Call update_flags_for_input_section,
15021         not write_enable_output_section.
15022         (Layout::make_output_section): Don't push to
15023         unattached_section_list_ nor call attach_to_segment.  Call
15024         attach_section_to_segment if sections are attached.
15025         (Layout::attach_sections_to_segments): New function.
15026         (Layout::attach_section_to_segment): New function.
15027         (Layout::attach_allocated_section_to_segment): Rename from
15028         attach_to_segment.  Remove flags parameter.
15029         (Layout::allocate_output_section): Remove function.
15030         (Layout::write_enable_output_section): Remove function.
15031         * layout.h (class Layout): Update for above changes.  Add new
15032         field sections_are_attached_.
15033         * output.h (Output_section::update_flags_for_input_section): New
15034         function.
15035         * output.cc (Output_section::add_input_section): Call
15036         update_flags_for_input_section.
15037         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
15038
15039 2008-04-11  Cary Coutant  <ccoutant@google.com>
15040
15041         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
15042         thought unnecessary.
15043         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
15044
15045 2008-04-11  Ian Lance Taylor  <iant@google.com>
15046
15047         * output.h (class Output_section_data): Remove inline definition
15048         of set_addralign.
15049         * output.cc (Output_section_data::set_addralign): New function.
15050
15051 2008-04-11  Cary Coutant  <ccoutant@google.com>
15052
15053         Add support for TLS descriptors for i386 and x86_64.
15054         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
15055         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
15056         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
15057         GOT_TYPE_TLS_DESC.
15058         (Target_i386::got_mod_index_entry): Remove unnecessary code.
15059         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
15060         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
15061         relocations.
15062         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
15063         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
15064         Fix problem with initial-exec relocations.
15065         (Target_i386::Relocate::relocate_tls): Likewise.
15066         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
15067         relaxation.
15068         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
15069         support for section-plus-offset dynamic table entries.
15070         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
15071         (Output_data_dynamic::Dynamic_entry): Add support for
15072         section-plus-offset dynamic table entries.
15073         (Output_data_dynamic::Classification): Likewise.
15074         (Output_data_dynamic::classification_): Renamed offset_.
15075         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
15076         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
15077         (Target_x86_64::make_plt_section): New function.
15078         (Target_x86_64::reserve_tlsdesc_entries): New function.
15079         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
15080         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
15081         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
15082         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
15083         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
15084         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
15085         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
15086         add extra PLT entry for TLS descriptors.
15087         (Output_data_plt_x86_64::got_): New field.
15088         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
15089         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
15090         fields.
15091         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
15092         descriptors.
15093         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
15094         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
15095         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
15096         R_386_TLS_DESC_CALL relocations.
15097         (Target_x86_64::Scan::global): Likewise.
15098         (Target_x86_64::do_finalize_sections): Add dynamic table entries
15099         for TLS descriptors.
15100         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
15101         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
15102         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
15103         GD-to-IE relaxation.
15104         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
15105         and TLS_DESCRIPTORS.
15106         * Makefile.in: Rebuild.
15107         * configure: Rebuild.
15108         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
15109         (tls_test_shared2.so): New target.
15110         (tls_shared_gd_to_ie_test_SOURCES): New variable.
15111         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
15112         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
15113         (tls_shared_gd_to_ie_test_LDADD): New variable.
15114         (tls_shared_gnu2_gd_to_ie_test): New target.
15115         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
15116         New targets.
15117         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
15118         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
15119         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
15120         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
15121         (tls_shared_gnu2_test): New target.
15122         (tls_test_gnu2_shared.so): New target.
15123         (tls_shared_gnu2_test_SOURCES): New variable.
15124         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
15125         (tls_shared_gnu2_test_LDFLAGS): New variable.
15126         (tls_shared_gnu2_test_LDADD): New variable.
15127         * testsuite/Makefile.in: Rebuild.
15128         * testsuite/Makefile.
15129
15130 2008-04-11  Ian Lance Taylor  <iant@google.com>
15131
15132         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
15133         justsyms.t.
15134         * testsuite/Makefile.in: Rebuild.
15135
15136         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
15137         long.
15138         * testsuite/script_test_2.cc (main): Adjust test.
15139
15140 2008-04-11  David S. Miller  <davem@davemloft.net>
15141             Ian Lance Taylor  <iant@google.com>
15142
15143         * options.h (General_options): Add entries for '-Y' and
15144         '-relax'.
15145         * options.cc (General_options:finalize): If -Y was used, add those
15146         entries to the library path instead of the default "/lib" and
15147         "/usr/lib".
15148
15149 2008-04-11  David S. Miller  <davem@davemloft.net>
15150
15151         * testsuite/justsyms.t: Start at 0x100.
15152         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
15153         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
15154         long.
15155         * testsuite/script_test_2.cc: Adjust string and section length
15156         checks.
15157
15158 2008-04-09  Ian Lance Taylor  <iant@google.com>
15159
15160         PR gold/5996
15161         * script-sections.cc (Sections_element::allocate_to_segment): Add
15162         orphan parameter.
15163         (Output_section_definition::allocate_to_segment): Likewise.
15164         (Orphan_output_section::allocate_to_segment): Likewise.
15165         (Script_sections::attach_sections_using_phdrs_clause): Don't
15166         propagate non-PT_LOAD segments to orphan sections.
15167         * testsuite/Makefile.am (script_test_3.stdout): Generate using
15168         readelf rather than objdump.
15169         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
15170         .interp section and PT_INTERP segment are the same size.
15171         * testsuite/Makefile.in: Rebuild.
15172
15173         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
15174         aliases for symbols defined in the same object.
15175         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
15176         (weak_alias_test_SOURCES): New variable.
15177         (weak_alias_test_DEPENDENCIES): New variable.
15178         (weak_alias_test_LDFLAGS): New variable.
15179         (weak_alias_test_LDADD): New variable.
15180         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
15181         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
15182         (weak_alias_test_3.o): New target.
15183         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
15184         * testsuite/weak_alias_test_main.cc: New file.
15185         * testsuite/weak_alias_test_1.cc: New file.
15186         * testsuite/weak_alias_test_2.cc: New file.
15187         * testsuite/weak_alias_test_3.cc: New file.
15188
15189 2008-04-08  Ian Lance Taylor  <iant@google.com>
15190
15191         * options.h (class General_options): Add --noinhibit-exec option.
15192         * main.cc (main): Check --noinhibit-exec.
15193
15194         * options.h (class General_options): Define --wrap as a special
15195         option.  Add wrap_symbols_ field.
15196         (General_options::any_wrap_symbols): New function.
15197         (General_options::is_wrap_symbol): New function.
15198         * options.cc (General_options::parse_wrap): New function.
15199         (General_options::General_options): Initialize wrap_symbols_.
15200         * symtab.cc (Symbol_table::wrap_symbol): New function.
15201         (Symbol_table::add_from_object): Handle --wrap.
15202         * symtab.h (class Symbol_table): Declare wrap_symbol.
15203         * target.h (Target::wrap_char): New function.
15204         (Target::Target_info): Add wrap_char field.
15205         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
15206         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
15207         * testsuite/testfile.cc (Target_test::test_target_info):
15208         Likewise.
15209
15210         * errors.cc (Errors::undefined_symbol): Mention symbol version if
15211         there is one.
15212
15213         * layout.h (class Layout): Add added_eh_frame_data_ field.
15214         * layout.cc (Layout::Layout): Initialize new field.
15215         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
15216         output section until we find a section we merged successfully.
15217         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
15218         that the size be non-zero.
15219
15220         * merge.cc (Object_merge_map::get_output_offset): Remove inline
15221         qualifier.
15222
15223 2008-04-08  Craig Silverstein  <csilvers@google.com>
15224
15225         * configure.ac: Export new conditional variable HAVE_ZLIB.
15226         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
15227         on HAVE_ZLIB.
15228         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
15229         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15230
15231 2008-04-07  Ian Lance Taylor  <iant@google.com>
15232
15233         * version.cc (version_string): Set to "1.5".
15234
15235         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
15236         Add issued_non_pic_error_ field.  Declare check_non_pic.
15237         (Target_x86_64::Scan::check_non_pic): New function.
15238         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
15239         (Target_x86_64::Scan::global): Likewise.
15240
15241         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
15242         addend parameter.  Change caller.  Handle merge sections.
15243         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
15244         Address to Addend.  Don't add in the result of
15245         local_section_offset, pass down the addend and use the returned
15246         value.
15247         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
15248         Update declarations of local_section_offset and symbol_value.
15249         * testsuite/two_file_test_1.cc (t18): New function.
15250         * testsuite/two_file_test_2.cc (f18): New function.
15251         * testsuite/two_file_test_main.cc (main): Call t18.
15252         * testsuite/two_file_test.h (t18, f18): Declare.
15253
15254         * configure.ac: Don't test for objdump, c++filt, or readelf.
15255         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
15256         conditionals.
15257         (TEST_READELF): New variable.
15258         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
15259         (check_PROGRAMS): Add two_file_strip_test.
15260         (two_file_strip_test): New target.
15261         (check_PROGRAMS): Add two_file_same_shared_strip_test.
15262         (two_file_same_shared_strip_test_SOURCES): New variable.
15263         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
15264         (two_file_same_shared_strip_test_LDFLAGS): New variable.
15265         (two_file_same_shared_strip_test_LDADD): New variable.
15266         (two_file_shared_strip.so): New target.
15267         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
15268         (ver_test_5.syms, ver_test_7.syms): Likewise.
15269         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
15270         (strip_test_3.stdout): Use TEST_OBJDUMP.
15271         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15272
15273 2008-04-04  Cary Coutant  <ccoutant@google.com>
15274
15275         * symtab.h (Symbol::is_weak_undefined): New function.
15276         (Symbol::is_strong_undefined): New function.
15277         (Symbol::is_absolute): New function.
15278         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
15279         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
15280         absolute symbols.
15281         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
15282         (weak_undef_test): New target.
15283         * testsuite/Makefile.in: Rebuild.
15284         * testsuite/weak_undef_file1.cc: New file.
15285         * testsuite/weak_undef_file2.cc: New file.
15286         * testsuite/weak_undef_test.cc: New file.
15287
15288 2008-04-03  Craig Silverstein  <csilvers@google.com>
15289
15290         * compressed_output.h (class Output_compressed_section): Use
15291         unsigned buffer.
15292         * compressed_output.cc (zlib_compress): Use unsigned buffers,
15293         add zlib header.
15294         (zlib_compressed_suffix): Removed.
15295         (Output_compressed_section::set_final_data_size): Use unsigned
15296         buffers.
15297         * testsuite/Makefile.am (flagstest_compress_debug_sections):
15298         Fix linker invocation.
15299         (flagstest_o_specialfile_and_compress_debug_sections):
15300         Likewise.
15301         * testsuite/Makefile.in: Regenerated.
15302
15303 2008-04-02  David S. Miller  <davem@davemloft.net>
15304
15305         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
15306         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
15307
15308 2008-04-02  Craig Silverstein  <csilvers@google.com>
15309
15310         * TODO: New file.
15311
15312 2008-04-02  Ian Lance Taylor  <iant@google.com>
15313
15314         * fileread.cc (File_read::find_view): Add byteshift and vshifted
15315         parameters.  Update for new key type to views_.  Change all
15316         callers.
15317         (File_read::read): Adjust for byteshift in returned view.
15318         (File_read::add_view): New function, broken out of
15319         find_and_make_view.
15320         (File_read::make_view): New function, broken out of
15321         find_and_make_view.
15322         (File_read::find_or_make_view): Add offset and aligned
15323         parameters.  Rewrite accordingly.  Change all callers.
15324         (File_read::get_view): Add offset and aligned parameters.  Adjust
15325         for byteshift in return value.
15326         (File_read::get_lasting_view): Likewise.
15327         * fileread.h (class File_read): Update declarations.
15328         (class File_read::View): Add byteshift_ field.  Add byteshift to
15329         constructor.  Add byteshift method.
15330         * archive.h (Archive::clear_uncached_views): New function.
15331         (Archive::get_view): Add aligned parameter.  Change all callers.
15332         * object.h (Object::get_view): Add aligned parameter.  Change all
15333         callers.
15334         (Object::get_lasting_view): Likewise.
15335
15336         * fileread.cc (File_read::release): Don't call clear_views if
15337         there are multiple objects.
15338         * fileread.h (File_read::clear_uncached_views): New function.
15339         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
15340         on the archive.
15341
15342 2008-03-31  Cary Coutant  <ccoutant@google.com>
15343
15344         Add thin archive support.
15345         * archive.cc (Archive::armagt): New const.
15346         (Archive::setup): Remove task parameter and calls to unlock.
15347         (Archive::unlock_nested_archives): New function.
15348         (Archive::read_header): Add nested_off parameter. Change
15349         all callers.
15350         (Archive::interpret_header): Likewise.
15351         (Archive::include_all_members): Change to handle thin
15352         archives.
15353         (Archive::include_member): Likewise.
15354         * archive.h (Archive::Archive): Add new parameters and
15355         initializers.
15356         (Archive::armagt): New const.
15357         (Archive::setup): Remove task parameter.
15358         (Archive::unlock_nested_archives): New function.
15359         (Archive::read_header): Add nested_off parameter.
15360         (Archive::interpret_header): Likewise.
15361         (Archive::Nested_archive_table): New typedef.
15362         (Archive::is_thin_archive_): New field.
15363         (Archive::nested_archives_): New field.
15364         (Archive::options_): New field.
15365         (Archive::dirpath_): New field.
15366         (Archive::task_): New field.
15367         * readsyms.cc (Read_symbols::do_read_symbols): Add check
15368         for thin archives.  Pass additional parameters to
15369         Archive::Archive.  Unlock the archive file after calling
15370         Archive::setup.
15371
15372 2008-03-29  Ian Lance Taylor  <iant@google.com>
15373
15374         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
15375         version symbol to be local.
15376         * testsuite/ver_test_4.sh: New file.
15377         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
15378         (check_DATA): Add ver_test_4.syms.
15379         (ver_test_4.syms): New target.
15380         * testsuite/Makefile.in: Rebuild.
15381
15382         * output.cc
15383         (Output_section::Input_section_sort_entry::has_priority): New
15384         function.
15385         (Output_section::Input_section_sort_entry::match_file_name): New
15386         function.
15387         (Output_section::Input_section_sort_entry::match_section_name):
15388         Remove.
15389         (Output_section::Input_section_sort_entry::match_section_name_prefix):
15390         Remove.
15391         (Output_section::Input_section_sort_entry::match_section_file):
15392         Remove.
15393         (Output_section::Input_section_sort_compare::operator()): Rewrite
15394         using new Input_section_sort_entry functions.  Sort crtbegin and
15395         crtend first.  Sort sections with no priority before sections with
15396         a priority.
15397         * testsuite/initpri1.c (d3): Check j != 4.
15398         (cd5): New constructor/destructor function.
15399         (main): Check j != 2.
15400
15401         * symtab.cc (Symbol_table::add_from_object): If we don't use the
15402         new symbol when resolving, don't call set_is_default.
15403         * testsuite/ver_test_7.cc: New file.
15404         * testsuite/ver_test_7.sh: New file.
15405         * testsuite/Makefile.am (ver_test_7.so): New target.
15406         (ver_test_7.o): New target.
15407         (check_SCRIPTS): Add ver_test_7.sh.
15408         (check_DATA): Add ver_test_7.syms.
15409         (ver_test_7.syms): New target.
15410
15411 2008-03-28  Ian Lance Taylor  <iant@google.com>
15412
15413         * layout.cc (Layout::layout): If we see an input section with a
15414         name that needs sorting, set the must_sort flag for the output
15415         section.
15416         (Layout::make_output_section): If the name of the output section
15417         indicates that it might require sorting, set the may_sort flag.
15418         * output.h (Output_section::may_sort_attached_input_sections): New
15419         function.
15420         (Output_section::set_may_sort_attached_input_sections): New
15421         function.
15422         (Output_section::must_sort_attached_input_sections): New
15423         function.
15424         (Output_section::set_must_sort_attached_input_sections): New
15425         function.
15426         (class Output_section): Declare Input_section_sort_entry.  Define
15427         Input_section_sort_compare.  Declare
15428         sort_attached_input_sections.  Add new fields:
15429         may_sort_attached_input_sections_,
15430         must_sort_attached_input_sections_,
15431         attached_input_sections_are_sorted_.
15432         * output.cc (Output_section::Output_section): Initialize new
15433         fields.
15434         (Output_section::add_input_section): Add an entry to
15435         input_sections_ if may_sort or must_sort are true.
15436         (Output_section::set_final_data_size): Call
15437         sort_attached_input_sections if necessary.
15438         (Output_section::Input_section_sort_entry): Define new class.
15439         (Output_section::Input_section_sort_compare::operator()): New
15440         function.
15441         (Output_section::sort_attached_input_sections): New function.
15442         * configure.ac: Check whether the compiler supports constructor
15443         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
15444         * testsuite/initpri1.c: New file.
15445         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
15446         CONSTRUCTOR_PRIORITY.
15447         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
15448         (initpri1_LDFLAGS): New variable.
15449         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15450
15451 2008-03-27  Ian Lance Taylor  <iant@google.com>
15452
15453         * common.cc (Sort_commons::operator): Correct sorting algorithm.
15454         * testsuite/common_test_1.c: New file.
15455         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
15456         (common_test_1_SOURCES): New variable.
15457         (common_test_1_DEPENDENCIES): New variable.
15458         (common_test_1_LDFLAGS): New variable.
15459
15460         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
15461         and commons_ correctly when NAME/VERSION does not override
15462         NAME/NULL.
15463         * testsuite/ver_test_6.c: New file.
15464         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
15465         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
15466         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
15467
15468 2008-03-26  Ian Lance Taylor  <iant@google.com>
15469
15470         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
15471         of an undefined symbol from a version script.
15472         * testsuite/Makefile.am (ver_test_5.so): New target.
15473         (ver_test_5.o): New target.
15474         (check_SCRIPTS): Add ver_test_5.sh.
15475         (check_DATA): Add ver_test_5.syms.
15476         (ver_test_5.syms): New target.
15477         * testsuite/ver_test_5.cc: New file.
15478         * testsuite/ver_test_5.script: New file.
15479         * testsuite/ver_test_5.sh: New file.
15480         * Makefile.in, testsuite/Makefile.in: Rebuild.
15481
15482         PR gold/5986
15483         Fix problems building gold with gcc 4.3.0.
15484         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
15485         (gold_error_at_location, gold_warning_at_location): Use it.
15486         * configure.ac: Check whether we can compile and use a template
15487         function with a printf attribute.
15488         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
15489         when jumping over bytes.
15490         * object.cc: Instantiate Object::read_section_data.
15491         * debug.h: Include <cstring>
15492         * dwarf_reader.cc: Include <algorithm>
15493         * main.cc: Include <cstring>.
15494         * options.cc: Include <cstring>.
15495         * output.cc: Include <cstring>.
15496         * script.cc: Include <cstring>.
15497         * script.h: Include <string>.
15498         * symtab.cc: Include <cstring> and <algorithm>.
15499         * target-select.cc: Include <cstring>.
15500         * version.cc: Include <string>.
15501         * testsuite/testmain.cc: Include <cstdlib>.
15502         * configure, config.in: Rebuild.
15503
15504 2008-03-25  Ian Lance Taylor  <iant@google.com>
15505
15506         * options.cc: Include "../bfd/bfdver.h".
15507         (options::help): Print bug reporting address.
15508
15509         * version.cc (print_version): Adjust output for current value of
15510         BFD_VERSION_STRING.
15511
15512         * NEWS: New file.
15513
15514         * options.cc (options::help): Print list of supported targets.
15515         * target-select.h: Include <vector>.
15516         (class Target_selector): Make machine_, size_, and is_big_endian_
15517         fields const.  Add bfd_name_ and instantiated_target_ fields.
15518         (Target_selector::Target_selector): Add bfd_name parameter.
15519         (Target_selector::recognize): Make non-virtual, call
15520         do_recognize.
15521         (Target_selector::recognize_by_name): Make non-virtual, call
15522         do_recognize_by_name.
15523         (Target_selector::supported_names): New function.
15524         (Target_selector::bfd_name): New function.
15525         (Target_selector::do_instantiate_target): New pure virtual
15526         function.
15527         (Target_selector::do_recognize): New virtual function.
15528         (Target_selector::do_recognize_by_name): New virtual function.
15529         (Target_selector::instantiate_target): New private function.
15530         (supported_target_names): Declare.
15531         * target-select.cc (Target_selector::Target_selector): Update for
15532         new parameter and fields.
15533         (select_target_by_name): Check that the name matches before
15534         calling recognize_by_name.
15535         (supported_target_names): New function.
15536         * i386.cc (class Target_selector_i386): Update Target_selector
15537         constructor call.  Remove recognize and recognize_by_name.  Add
15538         do_instantiate_target.
15539         * x86_64.cc (class Target_selector_x86_64): Likewise.
15540         * testsuite/testfile.cc (class Target_selector_test): Update for
15541         changes to Target_selector.
15542
15543         * README: Rewrite, with some notes on unsupported features.
15544
15545 2008-03-24  Cary Coutant  <ccoutant@google.com>
15546
15547         * i386.cc (Target_i386::Got_type): New enum declaration.
15548         (Target_i386::Scan::local): Updated callers of Output_data_got
15549         member functions.
15550         (Target_i386::Scan::global): Likewise.
15551         (Target_i386::Relocate::relocate): Likewise.
15552         (Target_i386::Relocate::relocate_tls): Likewise.
15553         * object.h (Got_offset_list): New class.
15554         (Sized_relobj::local_has_got_offset): Added got_type parameter.
15555         (Sized_relobj::local_got_offset): Likewise.
15556         (Sized_relobj::set_local_got_offset): Likewise.
15557         (Sized_relobj::local_has_tls_got_offset): Removed.
15558         (Sized_relobj::local_tls_got_offset): Removed.
15559         (Sized_relobj::set_local_tls_got_offset): Removed.
15560         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
15561         * output.cc (Output_data_got::add_global): Added got_type parameter.
15562         (Output_data_got::add_global_with_rel): Likewise.
15563         (Output_data_got::add_global_with_rela): Likewise.
15564         (Output_data_got::add_global_pair_with_rel): New function.
15565         (Output_data_got::add_global_pair_with_rela): New function.
15566         (Output_data_got::add_local): Added got_type parameter.
15567         (Output_data_got::add_local_with_rel): Likewise.
15568         (Output_data_got::add_local_with_rela): Likewise.
15569         (Output_data_got::add_local_pair_with_rel): New function.
15570         (Output_data_got::add_local_pair_with_rela): New function.
15571         (Output_data_got::add_global_tls): Removed.
15572         (Output_data_got::add_global_tls_with_rel): Removed.
15573         (Output_data_got::add_global_tls_with_rela): Removed.
15574         (Output_data_got::add_local_tls): Removed.
15575         (Output_data_got::add_local_tls_with_rel): Removed.
15576         (Output_data_got::add_local_tls_with_rela): Removed.
15577         * output.h (Output_data_got::add_global): Added got_type parameter.
15578         (Output_data_got::add_global_with_rel): Likewise.
15579         (Output_data_got::add_global_with_rela): Likewise.
15580         (Output_data_got::add_global_pair_with_rel): New function.
15581         (Output_data_got::add_global_pair_with_rela): New function.
15582         (Output_data_got::add_local): Added got_type parameter.
15583         (Output_data_got::add_local_with_rel): Likewise.
15584         (Output_data_got::add_local_with_rela): Likewise.
15585         (Output_data_got::add_local_pair_with_rel): New function.
15586         (Output_data_got::add_local_pair_with_rela): New function.
15587         (Output_data_got::add_global_tls): Removed.
15588         (Output_data_got::add_global_tls_with_rel): Removed.
15589         (Output_data_got::add_global_tls_with_rela): Removed.
15590         (Output_data_got::add_local_tls): Removed.
15591         (Output_data_got::add_local_tls_with_rel): Removed.
15592         (Output_data_got::add_local_tls_with_rela): Removed.
15593         * resolve.cc (Symbol::override_base_with_special): Removed
15594         reference to has_got_offset_ field.
15595         * symtab.cc (Symbol::init_fields): Replaced initialization
15596         of got_offset_ with got_offsets_.  Removed initialization
15597         of has_got_offset_
15598         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
15599         (Symbol::got_offset): Likewise.
15600         (Symbol::set_got_offset): Likewise.
15601         (Symbol::has_tls_got_offset): Removed.
15602         (Symbol::tls_got_offset): Removed.
15603         (Symbol::set_tls_got_offset): Removed.
15604         (Symbol::got_offset_): Removed.
15605         (Symbol::tls_mod_got_offset_): Removed.
15606         (Symbol::tls_pair_got_offset_): Removed.
15607         (Symbol::got_offsets_): New field.
15608         (Symbol::has_got_offset): Removed.
15609         (Symbol::has_tls_mod_got_offset): Removed.
15610         (Symbol::has_tls_pair_got_offset): Removed.
15611         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
15612         (Target_x86_64::Scan::local): Updated callers of Output_data_got
15613         member functions.
15614         (Target_x86_64::Scan::global): Likewise.
15615         (Target_x86_64::Relocate::relocate): Likewise.
15616         (Target_x86_64::Relocate::relocate_tls): Likewise.
15617
15618 2008-03-25  Ben Elliston  <bje@au.ibm.com>
15619
15620         * yyscript.y: Fix spelling error in comment.
15621
15622 2008-03-24  Ian Lance Taylor  <iant@google.com>
15623
15624         * options.h (class General_options): Define build_id option.
15625         * layout.h (class Layout): Declare write_build_id, create_note,
15626         create_build_id.  Add build_id_note_ member.
15627         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
15628         "libiberty.h", "md5.h", "sha1.h".
15629         (Layout::Layout): Initialize eh_frame_data_,
15630         eh_frame_hdr_section_, and build_id_note_.
15631         (Layout::finalize): Call create_build_id.
15632         (Layout::create_note): New function, broken out of
15633         Layout::create_gold_note.
15634         (Layout::create_gold_note): Call create_note.
15635         (Layout::create_build_id): New function.
15636         (Layout::write_build_id): New function.
15637         (Close_task_runner::run): Call write_build_id.
15638
15639         * x86_64.cc: Correct license to GPLv3.
15640
15641 2008-03-23  Ian Lance Taylor  <iant@google.com>
15642
15643         * options.cc: Include "demangle.h".
15644         (parse_optional_string): New function.
15645         (parse_long_option): Handle takes_optional_argument.
15646         (parse_short_option): Update dash_z initializer.  Handle
15647         takes_optional_argument.
15648         (General_options::General_options): Initialize do_demangle_.
15649         (General_options::finalize): Set do_demangle_.  Handle demangling
15650         style.
15651         * options.h (parse_optional_string): Declare.
15652         (struct One_option): Add optional_arg field.  Update constructor.
15653         Update call constructor calls.  Add takes_optional_argument
15654         function.
15655         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
15656         (DEFINE_optional_string): Define.
15657         (General_options::demangle): Change from DEFINE_bool to
15658         DEFINE_optional_string.
15659         (General_options::no_demangle): New function.
15660         (General_options::do_demangle): New function.
15661         (General_options::set_do_demangle): New function.
15662         (General_options::execstack_status_): Move definition to end of
15663         class definition.
15664         (General_options::static_): Likewise.
15665         (General_options::do_demangle_): New field.
15666         * object.cc (big_endian>::get_symbol_location_info): Call
15667         Options::do_demangle, not Options::demangle.
15668         * symtab.cc (demangle): Likewise.
15669
15670 2008-03-22  Ian Lance Taylor  <iant@google.com>
15671
15672         * gold.h: Include <cstddef> and <sys/types.h>
15673         * options.h: Include <cstring>.
15674
15675 2008-03-21  Ian Lance Taylor  <iant@google.com>
15676
15677         * Added source code to GNU binutils.
15678 \f
15679 Copyright (C) 2008-2014 Free Software Foundation, Inc.
15680
15681 Copying and distribution of this file, with or without modification,
15682 are permitted in any medium without royalty provided the copyright
15683 notice and this notice are preserved.
15684
15685 Local Variables:
15686 mode: change-log
15687 left-margin: 8
15688 fill-column: 74
15689 version-control: never
15690 End: