Update copyright years
[external/binutils.git] / gold / ChangeLog
1 2014-03-05  Alan Modra  <amodra@gmail.com>
2
3         Update copyright years.
4
5 2014-03-05  Alan Modra  <amodra@gmail.com>
6
7         * powerpc.cc (Target_powerpc::Scan::local, global): Support
8         R_PPC64_ADDR64_LOCAL.
9         (Target_powerpc::Relocate::relocate): Likewise.
10
11 2014-03-03  Alan Modra  <amodra@gmail.com>
12
13         * dwp.cc (print_version): Update copyright year to current.
14
15 2014-02-10  Alan Modra  <amodra@gmail.com>
16
17         * po/gold.pot: Regenerate.
18
19 2014-02-06  Cary Coutant  <ccoutant@google.com>
20
21         Fix problem where -u is ignored when a weak undef is seen.
22
23         * archive.cc (Library_base::should_include_member): Reorder
24         code to check for -u option if a weak undef has already been seen.
25         * testsuite/Makefile.am (weak_undef_test_2): New test case.
26         * testsuite/Makefile.in: Regenerate.
27         * testsuite/weak_undef_file3.cc: New file.
28         * testsuite/weak_undef_file4.cc: New file.
29         * testsuite/weak_undef_test_2.cc: New file.
30
31 2014-02-05  Cary Coutant  <ccoutant@google.com>
32
33         Fix issues with gold undefined symbol diagnostics.
34
35         PR binutils/15435
36         * errors.cc (Errors::undefined_symbol): Move undef vtable symbol
37         check to here.
38         * target-reloc.h (is_strong_undefined): New function.
39         (relocate_section): Move undef vtable symbol check from here.
40         Check for is_strong_undefined.
41
42 2014-02-05  Cary Coutant  <ccoutant@google.com>
43     
44         Fix problems with the --dynamic-list option.
45
46         PR gold/13577
47         * options.cc (General_options::parse_dynamic_list):
48         Set have_dynamic_list_.
49         (General_options::General_options): Initialize have_dynamic_list_.
50         (General_options::finalize): Turn off -Bsymbolic and
51         -Bsymbolic-functions if --dynamic-list provided.
52         * options.h (General_options::have_dynamic_list): New function.
53         (General_options::have_dynamic_list_): New data member.
54         * symtab.h (Symbol::is_preemptible): Handle --dynamic-list
55         correctly.
56    
57         PR gold/16530
58         * symtab.cc (Symbol_table::add_from_relobj): If symbol is named
59         in --dynamic-list, mark it.
60    
61         * testsuite/Makefile.am (gc_dynamic_list_test.sh): New test case.
62         (dynamic_list_2): New test case.
63         * testsuite/Makefile.in: Regenerate.
64         * testsuite/dynamic_list_2.cc: New file.
65         * testsuite/dynamic_list_2.t: New file.
66         * testsuite/dynamic_list_lib1.cc: New file.
67         * testsuite/dynamic_list_lib2.cc: New file.
68         * testsuite/gc_dynamic_list_test.c: New file.
69         * testsuite/gc_dynamic_list_test.sh: New file.
70         * testsuite/gc_dynamic_list_test.t: New file.
71
72 2014-01-28  Cary Coutant  <ccoutant@google.com>
73
74         Add .gdb_index version 7 support.
75
76         * gold/dwarf_reader.cc: include <utility> (for make_pair).
77         (Dwarf_abbrev_table::do_read_abbrevs): Check for compressed
78         debug sections.
79         (Dwarf_ranges_table::read_ranges_table): Likewise.
80         (Dwarf_pubnames_table::read_section): Check for GNU-style
81         sections, and for compressed debug sections.
82         (Dwarf_pubnames_table::read_header): Compute end address of table.
83         (Dwarf_pubnames_table::next_name): Return flag_byte.  Check
84         for end of list by offset, not by offset == 0.
85         (Dwarf_info_reader::do_read_string_table): Check for compressed
86         debug sections.
87         * gold/dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
88         Initialize new data members.
89         (Dwarf_pubnames_table::next_name): return flag_byte.
90         (Dwarf_pubnames_table::end_of_table_): New data member.
91         (Dwarf_pubnames_table::is_gnu_style_): New data member.
92         * gold/gdb-index.cc (gdb_index_version): Update to version 7.
93         (Gdb_index_info_reader::read_pubtable): Read flag_byte.
94         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Don't
95         read skeleton type unit DIEs.
96         (Gdb_index::add_symbol): Add flag_byte; adjust all callers.
97         (Gdb_index::do_write): Write flag_byte.
98         * gold/gdb-index.h (Gdb_index::add_symbol): Add flags parameter.
99         (Gdb_index::Cu_vector): Store flags along with cu indexes.
100         * gold/testsuite/gdb_index_test_3.sh: Allow versions 4-7.
101         * gold/testsuite/gdb_index_test_comm.sh: Likewise.
102
103 2014-01-08  H.J. Lu  <hongjiu.lu@intel.com>
104
105         * version.cc (print_version): Update copyright year to 2014.
106
107 2013-12-19  Dimitry Andric  <dimitry@andric.com>
108
109         * stringpool.cc (Stringpool_template::reserve): Add
110         HAVE_UNORDERED_MAP case.
111         * stringpool.cc (Stringpool_template::print_stats): Likewise.
112
113 2013-12-18  Cary Coutant  <ccoutant@google.com>
114
115         * configure.ac: Check for <unordered_set> and <unordered_map>.
116         * config.in: Regenerate.
117         * configure: Regenerate.
118         * system.h: Use <unordered_set> and <unordered_map> if available.
119
120 2013-12-10  Roland McGrath  <mcgrathr@google.com>
121
122         * Makefile.am (install-exec-local): Prefix $(INSTALL_PROGRAM) uses
123         with $(INSTALL_PROGRAM_ENV).
124         * Makefile.in: Regenerate.
125
126 2013-11-22  Cary Coutant  <ccoutant@google.com>
127
128         * configure.ac: Add check for which library is needed for
129         dlopen.
130         * configure: Regenerate.
131
132 2013-11-22  Cary Coutant  <ccoutant@google.com>
133
134         * testsuite/Makefile.am (exception_x86_64_bnd_test): Use in-tree
135         assembler.
136         * testsuite/Makefile.in: Regenerate.
137
138 2013-11-17  H.J. Lu  <hongjiu.lu@intel.com>
139
140         * x86_64.cc (Target_x86_64<size>::Scan::get_reference_flags):
141         Handle R_X86_64_PC32_BND and R_X86_64_PLT32_BND just like
142         R_X86_64_PC32 and R_X86_64_PLT32, respectively.
143         (Target_x86_64<size>::Scan::local): Likewise.
144         (Target_x86_64<size>::Scan::global): Likewise.
145         (Target_x86_64<size>::Relocate::relocate): Likewise.
146         (Target_x86_64<size>::Relocatable_size_for_reloc::get_size_for_reloc):
147         Likewise.
148         (Target_x86_64<size>::Scan::check_non_pic(): Handle
149         R_X86_64_PC32_BND.
150
151         * testsuite/Makefile.am (check_PROGRAMS): Add
152         exception_x86_64_bnd_test.
153         (exception_x86_64_bnd_test_SOURCES): New macro.
154         (exception_x86_64_bnd_test_DEPENDENCIES): Likewise.
155         (exception_x86_64_bnd_test_LDFLAGS): Likewise.
156         (exception_x86_64_bnd_test_LDADD): Likewise.
157         (exception_x86_64_bnd_1.o): New rule.
158         (exception_x86_64_bnd_2.o): Likewise.
159         * testsuite/Makefile.in: Regenerated.
160
161 2013-11-15  Alan Modra  <amodra@gmail.com>
162
163         * powerpc.cc (Target_powerpc::glink_section): Provide non-const
164         accessor.
165         (Target_powerpc::Branch_info::make_stub): Make global entry stubs.
166         Only call ppc64_local_entry_offset for 64-bit.  Restrict
167         symval_for_branch lookup to ELFv1.
168         (Stub_table::add_plt_call_entry): Use unsigned int off.
169         (Output_data_glink::Address, invalid_address): New.
170         (Output_data_glink::add_eh_frame): Move out of line.  Add
171         support for ELFv2.
172         (Output_data_glink::add_global_entry, find_global_entry,
173         global_entry_address): New functions.
174         (Output_data_glink::global_entry_stubs_, end_branch_table_,
175         ge_size): New variables.
176         (Output_data_glink::set_final_data_size): Add global entry
177         stub sizing.
178         (Output_data_glink::do_write): Write global entry stubs.
179         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Add target
180         parameter.  Return true for ELFv2.  Adjust callers.
181         (Target_powerpc::Scan::local, global): Restrict opd lookup to
182         ELFv1.  Similarly for ifunc and dynamic relocation processing
183         specific to ELFv1.  Recognize that symbols are defined on
184         their plt entries for ELFv2.
185         (Target_powerpc::symval_for_branch): Assert if called for
186         ELFv2 or ppc32.
187         (Target_powerpc::Relocate::relocate): Use global entry plt
188         stub for symbol value if such exists on ELFv2.
189         (Target_powerpc::Relocate::relocate): Don't call
190         symval_for_branch when ELFv2.  Do adjust for local entry
191         offset when ELFv2.
192         (Target_powerpc::do_dynsym_value): Set symbols to global entry
193         plt stub for ELFv2.
194         (Target_powerpc::do_plt_address_for_global): Similarly.
195
196 2013-11-14  Cary Coutant  <ccoutant@google.com>
197
198         Revert patch -- this did not fix the problem, and there is
199         no race there.
200
201         2013-11-14  Cary Coutant  <ccoutant@google.com>
202
203             PR gold/14860
204             * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
205             (Ehframe_hdr::set_final_data_size): Allocate a Lock.
206             * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
207             updating fde_offsets_.
208             (Eh_frame_hdr::lock_): New data member.
209
210 2013-11-14  Cary Coutant  <ccoutant@google.com>
211
212         * dwp.cc (Dwo_file_entry): New type.
213         (File_list): Use Dwo_file_entry.
214         (Dwo_file::verify): New function.
215         (Dwo_file::verify_dwo_list): New function.
216         (Dwo_file::sized_verify_dwo_list): New function.
217         (Dwo_name_info_reader::visit_compilation_unit): Add dwo_id to file
218         list.
219         (Dwp_options): New enum type.
220         (dwp_options): Add --verify-only.
221         (usage): Likewise.
222         (main): Likewise.
223         * dwp.h (gold_info): Add declaration.
224
225 2013-11-14  Cary Coutant  <ccoutant@google.com>
226
227         PR gold/14860
228         * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
229         (Ehframe_hdr::set_final_data_size): Allocate a Lock.
230         * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
231         updating fde_offsets_.
232         (Eh_frame_hdr::lock_): New data member.
233
234 2013-11-06  Cary Coutant  <ccoutant@google.com>
235
236         PR gold/15758
237         * object.cc (Sized_relobj_file::do_layout): Handle .eh_frame sections
238         before reloc sections.
239
240 2013-11-04  Alan Modra  <amodra@gmail.com>
241
242         * symtab.h (Symbol::Reference_flags): Add FUNC_DESC_ABI.
243         (Symbol::needs_dynamic_reloc): Test new flag.
244         * powerpc.cc (needs_dynamic_reloc, use_plt_offset): Delete.
245         (Target_powerpc::Scan::get_reference_flags): Add target param.
246         Return FUNC_DESC_ABI for 64-bit ELFv1.
247         (Target_powerpc::Branch_info::make_stub): Adjust get_reference_flags
248         call.
249         (Target_powerpc::Scan::global): Use Symbol::needs_dynamic_reloc.
250         (Target_powerpc::Relocate::relocate): Use Symbol::use_plt_offset.
251
252 2013-10-31  Cary Coutant  <ccoutant@google.com>
253
254         Restore support for dwp v2 DWARF package file format.
255
256         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
257         tu_length parameter.  Adjust all callers.
258         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
259         * dwp.cc: Include dwarf.h.
260         (Section_bounds): New struct type.
261         (Unit_set): New struct type.
262         (Dwo_file::Dwo_file): Initialize new data member.
263         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
264         Combine and rename to...
265         (Dwo_file::read_unit_index): ...this.
266         (Dwo_file::sized_read_compunit_index)
267         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
268         (Dwo_file::sized_read_unit_index): ...this.
269         (Dwo_file::copy_section): Remove section_name, is_str_offsets
270         parameters; add section_id parameter.
271         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
272         (Dwo_file::add_unit_set): ...this.
273         (Dwo_file::shndx_map_): Remove.
274         (Dwo_file::sect_offsets_): New data member.
275         (Dwp_output_file::Dwp_output_file): Initialize new data members.
276         (Dwp_output_file::add_section): Rename to...
277         (Dwp_output_file::add_contribution): ...this.
278         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
279         (Dwp_output_file::add_tu_set): Likewise.
280         (Dwp_output_file::Contribution): New type.
281         (Dwp_output_file::Section::contributions): New data member.
282         (Dwp_output_file::Cu_or_tu_set): Remove.
283         (Dwp_output_file::Section::Section): New ctor.
284         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
285         (Dwp_output_file::Dwp_index::Section_table): New type.
286         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
287         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
288         parameter.
289         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
290         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
291         (Dwp_output_file::Dwp_index::section_table): New member function.
292         (Dwp_output_file::Dwp_index::section_table_end): New member function.
293         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
294         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
295         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
296         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
297         (Dwp_output_file::Dwp_index::section_table_): New data member.
298         (Dwp_output_file::Dwp_index::section_mask_): New data member.
299         (Dwp_output_file::add_output_section): New member function.
300         (Dwp_output_file::write_new_section): New member function.
301         (Dwp_output_file::write_contributions): New member function.
302         (Dwp_output_file::section_id_map_): New data member.
303         (class Dwo_id_info_reader): Remove.
304         (class Unit_reader): New class.
305         (get_dwarf_section_name): New function.
306         (Dwo_file::read_executable): Adjust initializations of class data.
307         (Dwo_file::read): Add support for v2 package file format.
308         (Dwo_file::read_unit_index): Likewise.
309         (Dwo_file::sized_read_unit_index): Likewise.
310         (Dwo_file::copy_section): Likewise.
311         (Dwo_file::add_unit_set): Likewise.
312         (Dwp_output_file::add_output_section): Likewise.
313         (Dwp_output_file::add_contribution): Likewise.
314         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
315         for empty slot.
316         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
317         file format.
318         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
319         slot.
320         (Dwp_output_file::initialize): Remove unused function.
321         (Dwp_output_file::finalize): Add support for v2 package file format.
322         (Dwp_output_file::write_index): Likewise.
323         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
324         function prototype.
325
326 2013-10-31  Cary Coutant  <ccoutant@google.com>
327
328         * configure.ac: Fix check for -fmerge-constants.
329         * configure.ac: Regenerate.
330
331 2013-10-30  Roland McGrath  <mcgrathr@google.com>
332
333         * x86_64.cc (Output_data_plt_x86_64_nacl::first_plt_entry):
334         Correct 9-byte nop sequence to match what the assembler generates.
335
336 2013-10-30  Alan Modra  <amodra@gmail.com>
337
338         * powerpc.cc (Powerpc_relobj::abiversion, set_abiversion,
339         ppc64_local_entry_offset, ppc64_local_entry_offset,
340         do_read_symbols): New functions.
341         (Powerpc_relobj::e_flags_, st_other_): New vars.
342         (Powerpc_relobj::Powerpc_relobj): Call set_abiversion.
343         (Powerpc_dynobj::abiversion, set_abiversion): New functions.
344         (Powerpc_relobj::e_flags_): New var.
345         (Target_powerpc::first_plt_entry_offset, plt_entry_size): Inline
346         and adjust for ELFv2.
347         (Target_powerpc::abiversion, set_abiversion, stk_toc): New functions.
348         (Powerpc_relobj::do_find_special_sections): Check no .opd in ELFv2.
349         (Powerpc_dynobj::do_find_special_sections): Likewise.
350         (Target_powerpc::do_define_standard_symbols): Define ".TOC.".
351         (Target_powerpc::Branch_info::make_stub): Adjust stub destination
352         to ELFv2 local entry.
353         (Target_powerpc::do_relax): No thread safe barriers needed for
354         ELFv2.
355         (Output_data_plt_powerpc::initial_plt_entry_size_,
356         plt_entry_size): Delete.  Replace all uses with
357         first_plt_entry_offset() and plt_entry_size().
358         (Output_data_plt_powerpc::Output_data_plt_powerpc): Remove
359         reserved_size parm.  Update callers.
360         (Output_data_plt_powerpc::entry_count): Update.
361         (Output_data_plt_powerpc::first_plt_entry_offset): Make private
362         and use Target_powerpc::first_plt_entry_offset().
363         (Output_data_plt_powerpc::get_plt_entry_size): Similarly and
364         rename to plt_entry_size.
365         (Output_data_plt_powerpc::add_ifunc_entry,
366         add_local_ifunc_entry): Adjust reloc for ELFv2.
367         (glink_eh_frame_fde_64): Rename to glink_eh_frame_fde_64v1.
368         (glink_eh_frame_fde_64v2): New.
369         (Stub_table::plt_call_size): Support ELFv2 sizing.
370         (Output_data_glink::add_eh_frame): Use the new FDE.
371         (Output_data_glink::set_final_data_size): Adjust for ELFv2 glink.
372         (Stub_table::do_write): Write ELFv2 stubs and glink.
373         (Target_powerpc::Relocate::relocate): Replaces nop after call
374         with ld 2,24(1) and adjust local offset destination for ELFv2.
375
376 2013-10-30  Alan Modra  <amodra@gmail.com>
377
378         * powerpc.cc (Target_powerpc::Scan::check_non_pic): Handle new relocs.
379         (Target_powerpc::Scan::global, local): Likewise.
380         (Target_powerpc::Relocate::relocate): Likewise.  Check for overflow
381         on all ppc64 @h and @ha relocs.
382
383 2013-10-14  Alan Modra  <amodra@gmail.com>
384
385         * output.h (Output_data_got::add_constant): Tidy.
386         (Output_data_got::add_constant_pair): New function.
387         * powerpc.cc (Output_data_got_powerpc): Override all Output_data_got
388         methods used so as to first call reserve_ent().
389
390 2013-10-11  Roland McGrath  <mcgrathr@google.com>
391
392         * powerpc.cc (Output_data_got_powerpc): Remove unused methods
393         add_got_entry and add_got_entry_pair.
394
395         * configure.ac (TLS_GNU2_DIALECT): Use -Werror in test.
396         (HAVE_PUBNAMES): Likewise.
397         * configure: Regenerate.
398
399         * testsuite/Makefile.am: Replace '-T foo' with '-Wl,-T,foo' throughout.
400         * testsuite/Makefile.in: Regenerate.
401
402         * target.h (Target::adjust_elf_header, Target::do_adjust_elf_header):
403         Remove const from declaration.
404         * target.cc (Sized_target::do_adjust_elf_header): Update definition.
405         * sparc.cc (Target_sparc::do_adjust_elf_header): Likewise.
406         * output.h (Output_file_header): Remove const from member target_
407         and corresponding constructor argument.
408         * output.cc (Output_file_header::Output_file_header): Update prototype.
409         (Output_file_header::do_sized_write): Use this->target_ in place
410         of parameters()->target().
411
412         * testsuite/undef_symbol.cc (Foo::get_a): New method.
413
414         * configure.ac (MERGE_CONSTANTS_FLAG): New check.
415         * configure: Regenerate.
416         * Makefile.in: Regenerate.
417         * testsuite/merge_string_literals_1.c: Renamed to have .cc suffix.
418         * testsuite/merge_string_literals_2.c: Likewise.
419         * testsuite/Makefile.am
420         (merge_string_literals_1.o, merge_string_literals_2.o): Update deps.
421         (AM_CFLAGS, AM_CXXFLAGS): Use $(MERGE_CONSTANTS_FLAG) in place of
422         literal -fmerge-constants.
423         * testsuite/Makefile.in: Regenerate.
424
425         * i386.cc (Target_i386): Remove unused member dynbss_.
426         * arm.cc (Target_arm): Likewise.
427         * powerpc.cc (Target_powerpc): Likewise.
428         * sparc.cc (Target_sparc): Likewise.
429         * tilegx.cc (Target_tilegx): Likewise.
430         * x86_64.cc (Target_x86_64): Likewise.
431         * dwarf_reader.h (Dwarf_info_reader): Remove unused members
432         type_signature_, type_offset_.
433         * plugin.h (Plugin_hook): Remove unused member layout_.
434         * readsyms.h (Add_symbols): Remove unused members dirpath_, dirindex_,
435         mapfile_.
436         (Read_member): Remove unused members input_objects_, symtab_,
437         mapfile_, layout_.
438         (Check_library): Remove unused member symtab_.
439         * archive.h (Lib_group): Remove unused member lib_.
440         * archive.cc (Lib_group::Lib_group): Update initializer.
441         * incremental.h (Incremental_binary): Remove unused member target_.
442         (Incremental_script_entry): Removed unused member script_.
443         * layout.h (Write_symbols_task): Remove unused member input_objects_.
444         * icf.h (Icf): Remove unused member num_tracked_relocs.
445
446         * gold-threads.h (Once): Conditionalize member was_run_lock_ on
447         [ENABLE_THREADS && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4], matching
448         its only use.
449         * gold-threads.cc (Once::Once): Likewise conditionalize initializer.
450
451         * archive.h: Use struct rather than class for forward declaration
452         of Read_symbols_data.
453
454 2013-10-07  Cary Coutant  <ccoutant@google.com>
455
456         PR gold/16010
457         * testsuite/Makefile.am (icf_test): Fix dependencies.
458         (icf_safe_test): Likewise.
459         (icf_safe_so_test): Likewise.
460         (large_symbol_alignment): Add empty _LDADD rule.
461         * testsuite/Makefile.in: Regenerate.
462
463 2013-09-03  Pavel Chupin  <pavel.v.chupin@intel.com>
464
465         PR gold/15927
466         * x86_64.cc (Target_x86_64<size>::Scan::global): Use relative
467         relocation for R_X86_64_32 on x32.
468
469 2013-08-27  Roland McGrath  <mcgrathr@google.com>
470
471         * output.cc (Output_segment::set_section_addresses): Take new
472         Target* argument.  If target->isolate_execinstr() and the segment
473         is executable and starts at a target->abi_pagesize() boundary,
474         pad its end out to a target->abi_pagesize() boundary with code fill.
475         * output.h (Output_segment::set_section_addresses): Update decl.
476         * layout.h (Layout::check_output_data_for_reset_values): Take new
477         argument RELAX_OUTPUTS.
478         (Layout): New member relax_output_list_.
479         (Layout::add_relax_output): New method.
480         * layout.cc (Layout::Layout): Update constructor.
481         (Layout::reset_relax_output): New method.
482         (Layout::clean_up_after_relaxation): Call it.
483         (Layout::prepare_for_relaxation): Update caller.
484         (Layout::set_segment_offsets): Update callers of set_section_addresses.
485         Call reset_relax_output before re-processing segments for
486         isolate_execinstr case.
487         (Layout::write_data): Handle relax_output_list_.
488         (Layout::Relaxation_debug_check::check_output_data_for_reset_values):
489         Take new argument RELAX_OUTPUTS.  Assert it's an empty collection.
490
491 2013-08-23  Yuri Chornoivan  <yurchor@ukr.net>
492
493         PR binutils/15834
494         * object.h: Fix typos.
495
496 2013-08-16  Roland McGrath  <mcgrathr@google.com>
497
498         * i386.cc (Target_i386_nacl::do_code_fill): New virtual function.
499         * x86_64.cc (Target_x86_64_nacl::do_code_fill): New virtual function.
500
501 2013-08-07  Cary Coutant  <ccoutant@google.com>
502
503         Revert support for v2 DWP files:
504
505         2013-03-01  Cary Coutant  <ccoutant@google.com>
506
507             Add dwp support for v2 DWARF package file format.
508             * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
509             tu_length parameter.  Adjust all callers.
510             * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
511             * dwp.cc: Include dwarf.h.
512             (Section_bounds): New struct type.
513             (Unit_set): New struct type.
514             (Dwo_file::Dwo_file): Initialize new data member.
515             (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
516             Combine and rename to...
517             (Dwo_file::read_unit_index): ...this.
518             (Dwo_file::sized_read_compunit_index)
519             (Dwo_file::sized_read_typeunit_index): Combine and rename to...
520             (Dwo_file::sized_read_unit_index): ...this.
521             (Dwo_file::copy_section): Remove section_name, is_str_offsets
522             parameters; add section_id parameter.
523             (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
524             (Dwo_file::add_unit_set): ...this.
525             (Dwo_file::shndx_map_): Remove.
526             (Dwo_file::sect_offsets_): New data member.
527             (Dwp_output_file::Dwp_output_file): Initialize new data members.
528             (Dwp_output_file::add_section): Rename to...
529             (Dwp_output_file::add_contribution): ...this.
530             (Dwp_output_file::add_cu_set): Combine parameters into a struct.
531             (Dwp_output_file::add_tu_set): Likewise.
532             (Dwp_output_file::Contribution): New type.
533             (Dwp_output_file::Section::contributions): New data member.
534             (Dwp_output_file::Cu_or_tu_set): Remove.
535             (Dwp_output_file::Section::Section): New ctor.
536             (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
537             (Dwp_output_file::Dwp_index::Section_table): New type.
538             (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
539             (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
540             parameter.
541             (Dwp_output_file::Dwp_index::shndx_pool): Remove.
542             (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
543             (Dwp_output_file::Dwp_index::section_table): New member function.
544             (Dwp_output_file::Dwp_index::section_table_end): New member function.
545             (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
546             (Dwp_output_file::Dwp_index::section_table_rows): New member function.
547             (Dwp_output_file::Dwp_index::section_table_cols): New member function.
548             (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
549             (Dwp_output_file::Dwp_index::section_table_): New data member.
550             (Dwp_output_file::Dwp_index::section_mask_): New data member.
551             (Dwp_output_file::add_output_section): New member function.
552             (Dwp_output_file::write_new_section): New member function.
553             (Dwp_output_file::write_contributions): New member function.
554             (Dwp_output_file::section_id_map_): New data member.
555             (class Dwo_id_info_reader): Remove.
556             (class Unit_reader): New class.
557             (get_dwarf_section_name): New function.
558             (Dwo_file::read_executable): Adjust initializations of class data.
559             (Dwo_file::read): Add support for v2 package file format.
560             (Dwo_file::read_unit_index): Likewise.
561             (Dwo_file::sized_read_unit_index): Likewise.
562             (Dwo_file::copy_section): Likewise.
563             (Dwo_file::add_unit_set): Likewise.
564             (Dwp_output_file::add_output_section): Likewise.
565             (Dwp_output_file::add_contribution): Likewise.
566             (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
567             for empty slot.
568             (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
569             file format.
570             (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
571             slot.
572             (Dwp_output_file::initialize): Remove unused function.
573             (Dwp_output_file::finalize): Add support for v2 package file format.
574             (Dwp_output_file::write_index): Likewise.
575             * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
576             function prototype.
577
578 2013-07-31  Cary Coutant  <ccoutant@google.com>
579
580         * object.cc (Sized_relobj::do_output_section_address): New function.
581         (Sized_relobj): Instantiate explicitly.
582         * object.h (Object::output_section_address): New function.
583         (Object::do_output_section_address): New function.
584         (Sized_relobj::do_output_section_address): New function.
585         * powerpc.cc (Target_powerpc::symval_for_branch): Use it.
586
587 2013-07-30  Cary Coutant  <ccoutant@google.com>
588             Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
589
590         * parameters.cc (Parameters::entry): Return target-specific entry
591         symbol name.
592         * target.h (Target::entry_symbol_name): New function.
593         (Target_info::entry_symbol_name): New data member.
594
595         * arm.cc (Target_arm::arm_info): Add entry_symbol_name.
596         * i386.cc (Target_i386::i386_info): Likewise.
597         (Target_i386_nacl::i386_nacl_info): Likewise.
598         * sparc.cc (Target_sparc::sparc_info): Likewise.
599         * tilegx.cc (Target_tilegx::tilegx_info): Likewise.
600         * x86_64.cc: (Target_x86_64::x86_64_info) Likewise.
601         (Target_x86_64_nacl::x86_64_nacl_info) Likewise.
602         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
603
604 2013-07-22  Sterling Augustine  <saugustine@google.com>
605
606         * dwarf_reader.cc (Dwarf_pubnames_table::read_section):
607         Convert parameter shndx to local variable. Add parameters symtab
608         and symtab_size.  Scan over section names.  Find relocation
609         section corresponding to current section.  Create and initialize
610         reloc_mapper_ and reloc_type_.
611         (Dwarf_pubnames_table::read_header):  Add assertion.  Change
612         unit_length to off_t.  Initialize member unit_length_.  Fill in field
613         cu_offset_.
614         * dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
615         Initialize new fields unit_length_ and cu_offset_.
616         (Dwarf_pubnames_table::read_section): Update prototype.
617         (Dwarf_pubnames_table::cu_offset): New member function.
618         (Dwarf_pubnames_table::subsection_size): Likewise.
619         (Dwarf_pubnames_table::cu_offset_, Dwarf_pubnames_table::unit_length):
620         New fields.
621         (Dwarf_info_reader::symtab, Dwarf_info_reader::symtab_size): Make
622         member functions public.
623         * gdb_index.cc (Gdb_index_info_reader::read_pubnames_and_pubtypes):
624         Update comment.  Rework logic.  Move repeated parts to...
625         (Gdb_index_info_reader::read_pubtable): ...here. New function.
626         (Gdb_index::Gdb_index): Initialize new fields, pubnames_table_,
627         pubtypes_table_, and stmt_list_offset.
628         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
629         Gdb_index::find_pubtype_offset,
630         Gdb_index::map_pubnames_and_types_to_dies): Define new functions.
631         (Gdb_index::pubnames_read): Update prototype and rework logic.
632         * gdb_index.h (Gdb_index_info_reader, Dwarf_pubnames_table):
633         Forward declare.
634         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
635         Gdb_index::find_pubtype_offset, Gdb_index::pubnames_table)
636         Gdb_index::pubtypes_table, Gdb_index::map_pubnames_and_types_to_dies,
637         Gdb_index::map_pubtable_to_dies):
638         Declare functions.
639         (Gdb_index::pubnames_read): Update declaration.
640         (Gdb_index::Pubname_offset_map): New type.
641         (Gdb_index::cu_pubname_map_, Gdb_index::cu_pubtype_map_,
642         Gdb_index::pubnames_table_, Gdb_index::pubtypes_table_,
643         Gdb_index::stmt_list_offset): Declare.
644         (Gdb_index::pubnames_shndx_, Gdb_index::pubnames_offet_,
645         Gdb_index::pubtypes_object_, Gdb_index::pubtypes_shndx_)
646         Gdb_index::pubtypes_offset_): Remove.
647
648 2013-07-19  Roland McGrath  <mcgrathr@google.com>
649
650         * options.h (General_options): Add -Trodata-segment option.
651         * parameters.cc (Parameters::check_rodata_segment): New function.
652         (Parameters::set_target_once): Call it.
653         * parameters.h (Parameters): Declare it (private member function).
654         * layout.cc (load_seg_unusable_for_headers): New function, broken
655         out of Layout::relaxation_loop_body.  If TARGET->isolate_execinstr()
656         then validate rodata segment rather than text segment.
657         (relaxation_loop_body): Call that.
658         (is_text_segment): New function.  Don't admit a non-executable
659         segment if TARGET->isolate_execinstr().
660         (set_segment_offsets): Call it.  Honor -Trodata-segment option.
661
662 2013-07-15  Shawn Landden  <shawnlandden@gmail.com>
663
664         PR gold/15070
665         * fileread.h (File_read::get_view): Clarify comment about ALIGNED.
666         * nacl.h (Sniff_file::View::View): Request aligned view.
667
668 2013-07-11  Cary Coutant  <ccoutant@google.com>
669
670         * powerpc.cc (Target_powerpc::write_branch_lookup_table): Use
671         correct BRLT entry size.
672
673 2013-07-03  Alan Modra  <amodra@gmail.com>
674
675         * powerpc.cc (Target_powerpc::Relocate::relocate): Update self-call
676         comment.
677
678 2013-07-01  Cary Coutant  <ccoutant@google.com>
679
680         * dwarf_reader.cc (Dwarf_ranges_table::read_ranges_table): Save
681         reloc_type_.
682         (Dwarf_ranges_table::read_range_list): Call lookup_reloc.
683         (Dwarf_ranges_table::lookup_reloc): New function.
684         * dwarf_reader.h (Dwarf_ranges_table::Dwarf_ranges_table): Initialize
685         reloc_type_.
686         (Dwarf_ranges_table::lookup_reloc): New function.
687         (Dwarf_ranges_table::reloc_type_): New data member.
688
689 2013-06-27  Jing Yu  <jingyu@google.com>
690
691         PR gold/15662
692         * powerpc.cc (Output_data_brlt_powerpc::reset_brlt_sizes): New
693         function.
694         (Output_data_brlt_powerpc::finalize_brlt_sizes): New function.
695         (Target_powerpc::do_relax): Call the above.
696
697 2013-06-27  Cary Coutant  <ccoutant@google.com>
698
699         * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
700         on garbage collected .opd section.
701
702 2013-06-27  Alan Modra  <amodra@gmail.com>
703
704         * powerpc.cc (Target_powerpc::do_gc_add_reference): Test dst_shndx
705         is non-zero.
706         (Target_powerpc::do_gc_mark_symbols): Likewise for sym->shndx().
707         (Target_powerpc::do_function_location): Likewise for loc->shndx.
708
709 2013-06-14  Cary Coutant  <ccoutant@google.com>
710
711         * resolve.cc (Symbol::override_base): Don't override st_type
712         from plugin placeholder symbols.
713         (Symbol_table::resolve): Likewise.
714         (Symbol_table::should_override): Don't complain about TLS mismatch
715         if the TO symbol is a plugin placeholder.
716         * testsuite/Makefile.am (plugin_test_tls): New test.
717         * testsuite/Makefile.in: Regenerate.
718         * testsuite/plugin_test_tls.sh: New test script.
719         * testsuite/two_file_test_2_tls.cc: New test source.
720         * testsuite/two_file_test_tls.cc: New test source.
721
722 2013-06-05  Alexander Ivchenko  <alexander.ivchenko@intel.com>
723
724         * layout.cc (Layout::set_segment_offsets): Taking care of the case when
725         the maximum segment alignment is larger than the page size.
726         * testsuite/Makefile.am (large_symbol_alignment): Test that Gold
727         correctly aligns the symbols with large alignemnt.
728         * testsuite/Makefile.in: Regenerate.
729         * testsuite/large_symbol_alignment.cc: New file.
730
731 2013-05-30  Alexander Ivchenko  <alexander.ivchenko@intel.com>
732             Sriraman Tallam  <tmsriram@google.com>
733
734         * options.h (sort_section): New option.
735         * output.h (Input_section_sort_section_prefix_special_ordering_compare):
736         Rename from Input_section_sort_section_name_special_ordering_compare.
737         (Input_section_sort_section_name_compare): New struct.
738         * output.cc (Output_section::Input_section_sort_section_name_compare::
739         operator()): New function.
740         (Output_section::sort_attached_input_sections): Use new sort function
741         for .text if --sort-section=name is specified.
742         * layout.cc (Layout::make_output_section):
743         Add sorting by name when --sort-section=name is specified.
744         * testsuite/Makefile.am (text_section_grouping): Test option
745         --sort-section=name.
746         * testsuite/Makefile.in: Regenerate.
747         * testsuite/section_sorting_name.cc: New file.
748         * testsuite/section_sorting_name.sh: New file.
749
750 2013-05-21  Cary Coutant  <ccoutant@google.com>
751
752         * symtab.h (Symbol::is_cxx_vtable): New function.
753         * target-reloc.h (relocate_section): Check for vtable symbol.
754         * testsuite/Makefile.am (missing_key_func.sh): New test case.
755         * testsuite/Makefile.in: Regenerate.
756         * testsuite/missing_key_func.cc: New test source.
757         * testsuite/missing_key_func.sh: New test script.
758
759 2013-05-21  Cary Coutant  <ccoutant@google.com>
760
761         * object.cc (Sized_relobj_file::get_symbol_location_info): Set
762         type of enclosing symbol.
763         (Relocate_info::location): Check symbol type when describing symbol.
764         * object.h (Symbol_location_info): Remove unused line_number;
765         add enclosing_symbol_type.
766         * testsuite/debug_msg.sh: Adjust expected output.
767
768 2013-05-13  Cary Coutant  <ccoutant@google.com>
769
770         * configure.ac: Export DEFAULT_TARGET.
771         * configure: Regenerate.
772         * Makefile.in: Regenerate.
773         * testsuite/Makefile.am: Add .EXPORT_ALL_VARIABLES.
774         * testsuite/Makefile.in: Regenerate.
775         * testsuite/debug_msg.sh: Delete duplicate tests.
776         Don't check undef_int error message match for powerpc where the
777         source file and line number aren't available.
778
779 2013-05-10  Roland McGrath  <mcgrathr@google.com>
780
781         * options.h (General_options): Add --rosegment-gap option.
782         * options.cc (finalize): --rosegment-gap implies --rosegment.
783         * layout.cc (set_segment_offsets): Let user option override
784         target->rosegment_gap().
785
786 2013-05-10  Roland McGrath  <mcgrathr@google.com>
787
788         * options.h (General_options): Remove leading space from help
789         messages for -nostdlib and --rosegment.
790
791 2013-05-03  Maciej W. Rozycki  <macro@codesourcery.com>
792
793         PR ld/15365
794         * layout.cc (Layout::finalize): Make __ehdr_start STV_HIDDEN.
795
796 2013-05-03  Alan Modra  <amodra@gmail.com>
797
798         * merge.cc (Output_merge_string::do_add_input_section): Correct
799         scan for number of strings.  Rename vars to avoid shadowing.
800         Include missing terminator in input_size_.
801
802 2013-05-01  H.J. Lu  <hongjiu.lu@intel.com>
803
804         * merge.cc (Output_merge_string<Char_type>::do_add_input_section):
805         Restore empty string handling.
806
807 2013-05-01  Cary Coutant  <ccoutant@google.com>
808
809         * stringpool.cc (Stringpool_template::new_key_offset): Fix
810         uninitialized warning.
811
812 2013-04-29  Alexander Ivchenko  <alexander.ivchenko@intel.com>
813
814         * output.cc (Output_section::add_merge_input_section): Allow
815         to merge sections if the alignment is more than character size.
816         * merge.h (Output_merge_string::Output_merge_string): Remove
817         assert.
818         * merge.cc (Output_merge_string<Char_type>::do_add_input_section): Count
819         only not-null strings. Check the alignment of strings.
820         * stringpool.h
821         (Stringpool_template<Stringpool_char>::Stringpool_template): Add
822         alignment as the argument.
823         (Stringpool_template<Stringpool_char>::addralign_): New class member.
824         * stringpool.cc (Stringpool_template<Stringpool_char>::new_key_offset):
825         Align non-zero length strings according to the addralign_.
826         (Stringpool_template<Stringpool_char>::set_string_offsets):
827         Updating offsets according to the given alignment.
828         * testsuite/Makefile.am (text_section_grouping): Test if string
829         literals are getting merged.
830         * testsuite/Makefile.in: Regenerate.
831         * testsuite/merge_string_literals_1.c: New file.
832         * testsuite/merge_string_literals_2.c: Ditto.
833         * testsuite/merge_string_literals.sh: Ditto.
834
835 2013-04-26  Ian Lance Taylor  <iant@google.com>
836
837         * target-reloc.h (relocate_section): If the reloc offset is out of
838         range, pass VIEW as NULL to relocate.relocate.
839         * arm.cc (Target_arm:Relocate::relocate): Check for a NULL view.
840         * i386.cc (Target_i386::Relocate::relocate): Likewise.
841         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
842         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
843         * tilegx.cc (Target_tilegx::Relocate::relocate): Likewise.
844         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
845
846 2013-04-26  Geoff Pike  <gpike@chromium.org>
847
848         * gold.cc (queue_final_tasks): invoke layout->queue_build_id_tasks().
849         * layout.cc (Hash_task): New class.
850         (Layout::queue_build_id_tasks): New function.
851         (Layout::write_build_id): Handle single-thread portion of build ID
852         computation.  (In some cases, all of it is single-threaded.)  Replace
853         {sha1,md5}_process_bytes with {sha1,md5}_buffer to get the same
854         functionality in fewer lines of code.
855         * layout.h (Layout::queue_build_id_tasks): New function declaration.
856         * options.h (General_options): make "--build-id" default to tree
857         rather than sha1.  Add two new options related to --build-id=tree:
858         --build-id-chunk-size-for-treehash and
859         --build-id-min-file-size-for-treehash.
860         * Makefile.am: add testing of --build-id=tree and related new options
861         (these tests will be invoked by "make check").
862         * Makefile.in: Regenerate.
863
864 2013-04-25  Alan Modra  <amodra@gmail.com>
865
866         * configure.tgt: Add powerpcle and powerpc64le.
867
868 2013-04-22  Alan Modra  <amodra@gmail.com>
869
870         PR gold/15355
871         * layout.cc (Layout::segment_precedes): Allow more than one
872         segment with the same type and flags.
873
874 2013-04-15  Cary Coutant  <ccoutant@google.com>
875
876         * layout.cc (Layout::set_relocatable_section_offsets): Don't
877         allocate space in file for BSS sections.
878
879 2013-04-15  Cary Coutant  <ccoutant@google.com>
880
881         * script-sections.cc (Orphan_output_section): Reset address
882         to zero after each orphaned section for relocatable links.
883
884 2013-04-15  Cary Coutant  <ccoutant@google.com>
885
886         * symtab.cc (Symbol_table::sized_write_globals): Subtract
887         section starting address for relocatable link.
888         * testsuite/Makefile.am (script_test_11): New test.
889         * testsuite/Makefile.in: Regenerate.
890         * testsuite/script_test_11.c: New source file.
891         * testsuite/script_test_11.t: New linker script.
892
893 2013-04-13  Alan Modra  <amodra@gmail.com>
894
895         * powerpc.cc (Stub_control::can_add_to_stub_group): Don't set
896         owner when sections are not adjacent and exceed group size.
897         (Target_powerpc::group_sections): Handle corner case.
898         (Target_powerpc::Branch_info::make_stub): Handle case where
899         stub table doesn't exist due to branches in non-exec sections.
900         (Target_powerpc::Relocate::relocate): Likewise.
901
902 2013-04-11  Alan Modra  <amodra@gmail.com>
903
904         PR gold/15354
905         * powerpc.cc (Target_powerpc::make_brlt_section): Name section
906         .branch_lt to match bfd ld.  Adjust comments throughout file.
907
908 2013-04-04  Ian Lance Taylor  <iant@google.com>
909
910         GCC PR c++/56840
911         * object.cc (do_layout_deferred_sections): Handle .eh_frame
912         sections before checking whether they are included in the link.
913
914 2013-03-29  Sriraman Tallam  <tmsriram@google.com>
915
916         * archive.cc (Archive::get_elf_object_for_member):  Create the elf
917         object before calling the plugin claim_file handler.  Pass the elf
918         object of the archive to the plugin. Delete the elf object if the
919         plugin claims the file.
920
921 2013-03-21  Alan Modra  <amodra@gmail.com>
922
923         * layout.cc (Layout::set_segment_offsets): Accept writable .text
924         segment when omagic.
925
926 2013-03-21  Alan Modra  <amodra@gmail.com>
927
928         * dwp.cc (Dwp_output_file::add_contribution): Avoid signed/unsigned
929         comparison warning.
930         * layout.cc (Layout::create_dynamic_symtab): Avoid "may be used
931         uninitialized" warning.
932
933 2013-03-20  Alan Modra  <amodra@gmail.com>
934
935         * symtab.h (Symbol::clear_version): New function.
936         * symtab.cc (Symbol_table::set_dynsym_indexes): Don't set object
937         is_needed by weak references.  Clear version for symbols defined
938         in as-needed objects that are not needed.
939
940 2013-03-15  Alan Modra  <amodra@gmail.com>
941
942         * powerpc.cc (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Make
943         static and public.  Add report_err param.  Return false for data refs.
944         (Target_powerpc::rela_dyn_section): New overloaded function.
945         (Target_powerpc::plt_, iplt_): Elucidate.
946         (Output_data_plt_powerpc::entry_count): Handle current_data_size()==0.
947         (Output_data_plt_powerpc::do_write): Don't write .iplt.
948         (Output_data_plt_powerpc::plt_entry_count): Don't add .iplt entries.
949         (Target_powerpc::Scan::local, global): Adjust reloc_needs_plt_for_ifunc
950         calls.  Put ifunc dynamic relocs in irela_dyn_section.  Only
951         push_branch and make_plt_entry for ifunc syms when
952         reloc_needs_plt_for_ifunc.
953         (Target_powerpc::Relocate::relocate): Don't use plt entry value
954         for ifunc unless reloc_needs_plt_for_ifunc.
955
956 2013-03-15  Alan Modra  <amodra@gmail.com>
957
958         * gc.h (gc_process_relocs): Don't look through function descriptors.
959         * icf.cc (get_section_contents): Do so here instead.
960
961 2013-03-13  Alan Modra  <amodra@gmail.com>
962
963         * powerpc.cc (is_branch_reloc): Forward declare.
964         (Target_powerpc::do_can_check_for_function_pointers): New predicate.
965         (Target_powerpc::Scan::local_reloc_may_be_function_pointer): Return
966         false for 64-bit, true for 32-bit non-branch relocs.
967         (Target_powerpc::Scan::global_reloc_may_be_function_pointer): Likewise.
968         * testsuite/Makefile.am (icf_test): Use linker map file instead of
969         nm output.
970         (icf_safe_test): Generate linker map file as well as nm output.
971         (icf_safe_so_test): Likewise.
972         * testsuite/Makefile.in: Regenerate.
973         * testsuite/icf_test.sh: Parse linker map file to determine
974         section folding.
975         * testsuite/icf_safe_test.sh: Likewise.  Expect folding for PowerPC.
976         * testsuite/icf_safe_so_test.sh: Likewise.
977         (X86_32_or_ARM_specific_safe_fold): Merge into..
978         (arch_specific_safe_fold): ..this.
979         (X86_64_specific_safe_fold): Delete unused function.
980
981 2013-03-12  Alan Modra  <amodra@gmail.com>
982
983         * gc.h (gc_process_relocs): Look through function descriptors
984         to determine shndx, symvalue and addend used by ICF.  Tidy
985         variable duplication.
986
987 2013-03-11  Alan Modra  <amodra@gmail.com>
988
989         * gold.cc (queue_middle_tasks): Move detect_odr_violations..
990         * layout.cc (Layout_task_runner::run): ..to here.
991         * symtab.h (struct Symbol_location): Extract from..
992         (class Symbol_table): ..here.
993         * symtab.cc (Symbol_table::linenos_from_loc): Invoke function_location.
994         * target.h (class Target): Add function_location and
995         do_function_location functions.
996         (class Sized_target): Add do_function_location.
997         * object.h (class Sized_relobj_file): Move find_shdr..
998         (class Object): ..to here.
999         * object.cc: Likewise.  Update to suit.  Instantiate.
1000         (Sized_relobj_file::find_eh_frame): Update find_shdr call.
1001         * powerpc.cc (class Powerpc_dynobj): New.
1002         (Target_powerpc::do_function_location): New function.
1003         (Powerpc_relobj::do_find_special_sections): Update find_shdr call.
1004         (Powerpc_dynobj::do_read_symbols): New function.
1005         (Target_powerpc::do_make_elf_object): Make a Powerpc_dynobj.
1006
1007 2013-03-08  Ian Lance Taylor  <iant@google.com>
1008
1009         * options.cc (General_options::string_to_object_format): Accept
1010         "default".
1011
1012 2013-03-08  Alan Modra  <amodra@gmail.com>
1013
1014         * ehframe.h (Post_fdes) Make it a vector of Post_fde rather than
1015         pointer to Post_fde.
1016         (struct Post_fde): Move definition to here..
1017         * ehframe.cc (struct Post_fde): ..from here.
1018         (Cie::write): Don't alloc Post_fde.
1019         (Eh_frame::do_sized_write): Update.  Don't free Post_fde.
1020
1021 2013-03-07  Alan Modra  <amodra@gmail.com>
1022
1023         * testsuite/discard_locals_relocatable_test.c: Add a powerpc
1024         relocation referencing .LC0.
1025         * testsuite/discard_locals_test.sh: Remove FIXMEs.
1026
1027 2013-03-07  Alan Modra  <amodra@gmail.com>
1028
1029         * testsuite/ifunc-sel.h (ifunc_sel, ifunc_one): Mark
1030         always_inline.  Add assembly for powerpc to avoid GOT.
1031
1032 2013-03-07  Alan Modra  <amodra@gmail.com>
1033
1034         * testsuite/script_test_10.sh: Don't test .bss section
1035         header number.
1036
1037 2013-03-06  Alan Modra  <amodra@gmail.com>
1038
1039         * powerpc.cc (class Powerpc_relobj): Move some member functions.
1040         (Target_powerpc::symval_for_branch):  Add symtab param.  Update
1041         all callers.  Handle folded sections.
1042         (Target_powerpc::do_gc_add_reference): Don't cast dynamic object
1043         to Powerpc_relobj.
1044         (Global_symbol_visitor_opd::operator()): Likewise.
1045
1046 2013-03-04  Alan Modra  <amodra@gmail.com>
1047
1048         * testsuite/Makefile.am (final_layout_script.lds): Add .sbss.
1049         * testsuite/Makefile.in: Regenerate.
1050
1051 2013-03-01  Cary Coutant  <ccoutant@google.com>
1052
1053         Add dwp support for v2 DWARF package file format.
1054         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
1055         tu_length parameter.  Adjust all callers.
1056         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
1057         * dwp.cc: Include dwarf.h.
1058         (Section_bounds): New struct type.
1059         (Unit_set): New struct type.
1060         (Dwo_file::Dwo_file): Initialize new data member.
1061         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
1062         Combine and rename to...
1063         (Dwo_file::read_unit_index): ...this.
1064         (Dwo_file::sized_read_compunit_index)
1065         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
1066         (Dwo_file::sized_read_unit_index): ...this.
1067         (Dwo_file::copy_section): Remove section_name, is_str_offsets
1068         parameters; add section_id parameter.
1069         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
1070         (Dwo_file::add_unit_set): ...this.
1071         (Dwo_file::shndx_map_): Remove.
1072         (Dwo_file::sect_offsets_): New data member.
1073         (Dwp_output_file::Dwp_output_file): Initialize new data members.
1074         (Dwp_output_file::add_section): Rename to...
1075         (Dwp_output_file::add_contribution): ...this.
1076         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
1077         (Dwp_output_file::add_tu_set): Likewise.
1078         (Dwp_output_file::Contribution): New type.
1079         (Dwp_output_file::Section::contributions): New data member.
1080         (Dwp_output_file::Cu_or_tu_set): Remove.
1081         (Dwp_output_file::Section::Section): New ctor.
1082         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
1083         (Dwp_output_file::Dwp_index::Section_table): New type.
1084         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
1085         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
1086         parameter.
1087         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
1088         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
1089         (Dwp_output_file::Dwp_index::section_table): New member function.
1090         (Dwp_output_file::Dwp_index::section_table_end): New member function.
1091         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
1092         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
1093         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
1094         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
1095         (Dwp_output_file::Dwp_index::section_table_): New data member.
1096         (Dwp_output_file::Dwp_index::section_mask_): New data member.
1097         (Dwp_output_file::add_output_section): New member function.
1098         (Dwp_output_file::write_new_section): New member function.
1099         (Dwp_output_file::write_contributions): New member function.
1100         (Dwp_output_file::section_id_map_): New data member.
1101         (class Dwo_id_info_reader): Remove.
1102         (class Unit_reader): New class.
1103         (get_dwarf_section_name): New function.
1104         (Dwo_file::read_executable): Adjust initializations of class data.
1105         (Dwo_file::read): Add support for v2 package file format.
1106         (Dwo_file::read_unit_index): Likewise.
1107         (Dwo_file::sized_read_unit_index): Likewise.
1108         (Dwo_file::copy_section): Likewise.
1109         (Dwo_file::add_unit_set): Likewise.
1110         (Dwp_output_file::add_output_section): Likewise.
1111         (Dwp_output_file::add_contribution): Likewise.
1112         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
1113         for empty slot.
1114         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
1115         file format.
1116         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
1117         slot.
1118         (Dwp_output_file::initialize): Remove unused function.
1119         (Dwp_output_file::finalize): Add support for v2 package file format.
1120         (Dwp_output_file::write_index): Likewise.
1121         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
1122         function prototype.
1123
1124 2013-03-01  Cary Coutant  <ccoutant@google.com>
1125
1126         * dwarf_reader.cc (Dwarf_info_reader::check_buffer): Move
1127         function into class definition in header file.
1128         (Dwarf_info_reader::warn_corrupt_debug_section): New function.
1129         * dwarf_reader.h (Dwarf_info_reader::warn_corrupt_debug_section):
1130         New function.
1131         (Dwarf_info_reader::check_buffer): Move here from .cc file.
1132
1133 2013-02-28  Alan Modra  <amodra@gmail.com>
1134
1135         * target.h (Target::plt_fde_location, do_plt_fde_location): Declare.
1136         * target.cc (Target::do_plt_fde_location): New function.
1137         * ehframe.h (class FDE): Add post_map field to u_.from_linker,
1138         accessor function, and constructor param.
1139         (struct Post_fde, Post_fdes): Declare.
1140         (Cie::write): Add post_fdes param.
1141         * ehframe.cc (Fde::write): Use plt_fde_location.
1142         (struct Post_fde): Define.
1143         (Cie::write): Stash FDEs added post merge mapping.
1144         (Eh_frame::add_ehframe_for_plt): Assert no new CIEs after mapping.
1145         Adjust Fde constructor call.  Bump final_data_size_ for post map FDEs.
1146         (Eh_frame::do_sized_write): Arrange to write post map FDES after
1147         other FDEs.
1148         * powerpc.cc (Target_powerpc::do_plt_fde_location): New function.
1149         (Target_powerpc::has_glink): New function.
1150         (Target_powerpc::do_relax): Add eh_frame info for stubs.
1151         (struct Eh_cie, eh_frame_cie, glink_eh_frame_fde_64,
1152         glink_eh_frame_fde_32, default_fde): New data.
1153         (Stub_table::eh_frame_added_): New var.
1154         (Stub_table::find_long_branch_entry, stub_address, stub_offset):
1155         Make const.
1156         (Stub_table::add_eh_frame): New function.
1157         (Output_data_glink::add_eh_frame): New function.
1158         (Target_powerpc::make_glink_section): Call add_eh_frame.
1159
1160 2013-02-15  Ian Lance Taylor  <iant@google.com>
1161
1162         * options.h (DEFINE_uint64_alias): Define.
1163         (class General_options): Add -Ttext-segment as an alias for
1164         -Ttext.
1165
1166 2013-02-15  Alan Modra  <amodra@gmail.com>
1167
1168         * powerpc.cc (Stub_table::plt_off): New function, extracted from..
1169         (Stub_table::do_write): ..here, two places.
1170         (Stub_table::plt_call_size): Use it here too.
1171
1172 2013-02-11  Ian Lance Taylor  <iant@google.com>
1173
1174         * descriptors.cc (Descriptors::close_all): New function.
1175         * descriptors.h (class Descriptors): Declare close_all.
1176         (close_all_descriptors): New inline function.
1177         * plugin.cc: Include "descriptors.h".
1178         (Plugin_manager::cleanup): Call close_all_descriptors.
1179
1180 2013-02-06  Alan Modra  <amodra@gmail.com>
1181
1182         * README: Update coding style link.
1183
1184 2013-01-28  Cary Coutant  <ccoutant@google.com>
1185
1186         * dwp.cc (File_list): New typedef.
1187         (Dwo_name_info_reader): New class.
1188         (Dwo_id_info_reader::Dwo_id_info_reader): Remove unused parameters.
1189         (Dwo_id_info_reader::visit_top_die): Remove unused member function.
1190         (Dwo_file::~Dwo_file): Delete input_file_ after obj_.
1191         (Dwo_file::read_executable): New function.
1192         (Dwo_file::read): Move common setup code to ...
1193         (Dwo_file::make_object): ... here.
1194         (dwp_options): Add --exec/-e.
1195         (usage): Likewise.
1196         (main): Likewise.
1197
1198 2013-01-24  Sriraman Tallam  <tmsriram@google.com>
1199
1200         * layout.cc (Layout::layout): Check for option text_reorder.
1201         (Layout::make_output_section): Ditto.
1202         * options.h (text_reorder): New option.
1203         * output.cc (Input_section_sort_compare): Remove special ordering
1204         of section names.
1205         (Output_section::
1206          Input_section_sort_section_name_special_ordering_compare::
1207          operator()): New function.
1208         (Output_section::sort_attached_input_sections): Use new sort function
1209         for .text.
1210         * output.h (Input_section_sort_section_name_special_ordering_compare):
1211         New struct.
1212         * testsuite/Makefile.am (text_section_grouping): Test option
1213         --no-text-reorder
1214         * testsuite/Makefile.in: Regenerate.
1215         * testsuite/text_section_grouping.sh: Check order of functions without
1216         default text reordering.
1217
1218 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
1219
1220         * options.h (General_options): Change default to true for new_dtags.
1221
1222 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
1223
1224         * layout.cc (Layout::finish_dynamic_section): Only add DT_RPATH
1225         when enable_new_dtags is false.  Only add DT_RUNPATH when
1226         enable_new_dtags is true.
1227
1228 2013-01-17  Serge Pavlov  <serge.v.pavlov@gmail.com>
1229
1230         * powerpc.cc (Stub_table::find_plt_call_entry): Make types
1231         used in declaration and definition consistent.
1232         (Target_powerpc::symval_for_branch): Ditto.
1233
1234 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
1235
1236         * testsuite/plugin_final_layout.cc: Fix comment.
1237
1238 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
1239
1240         * layout.cc (Layout::layout): Do not do default sorting for
1241         text sections when section ordering is specified.
1242         (make_output_section): Ditto.
1243         * testsuite/plugin_final_layout.cc: Name the function sections
1244         to catch reordering issues.
1245
1246 2013-01-15  Alan Modra  <amodra@gmail.com>
1247
1248         * powerpc.cc (Target_powerpc::do_relax): Default shared libs to
1249         plt-thread-safe.
1250
1251 2013-01-15  Alan Modra  <amodra@gmail.com>
1252
1253         * testsuite/Makefile.am (final_layout_script.lds): Handle .got section.
1254         * testsuite/Makefile.in: Regenerate.
1255
1256 2013-01-14  Alan Modra  <amodra@gmail.com>
1257
1258         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add various output files.
1259         * testsuite/Makefile.in: Regenerate.
1260
1261 2013-01-11  Pavel Chupin  <pavel.v.chupin@intel.com>
1262
1263         PR bfd/14430
1264         Fix mingw gold build with plugins enabled
1265         * Makefile.am: Replace -ldl with @DLOPEN_LIBS@.
1266         * configure.ac: Export DLOPEN_LIBS and add headers check.
1267         * plugin.cc: Handle non-dlfcn case.
1268         * Makefile.in: Regenerate.
1269         * config.in: Regenerate.
1270         * configure: Regenerate.
1271         * testsuite/Makefile.in: Regenerate.
1272
1273 2013-01-09  Sriraman Tallam  <tmsriram@google.com>
1274
1275         * output.h (sort_attached_input_sections): Change to be public.
1276         * script-sections.cc
1277         (Output_section_definition::set_section_addresses): Sort
1278         attached input sections according to section order before linker
1279         script assigns section addresses.
1280         (Orphan_output_section::set_section_addresses): Sort
1281         attached input sections according to section order before linker
1282         script assigns section addresses.
1283         * Makefile.am (final_layout.sh): Use a simple linker script to
1284         check if section ordering still works.
1285         * Makefile.in: Regenerate.
1286
1287 2013-01-09  Ben Cheng  <bccheng@google.com>
1288
1289         * arm.cc (Target_arm::attributes_accept_div): New function.
1290         (Target_arm::attributes_forbid_div): New function.
1291         (Target_arm::merge_object_attributes): Merge the Tag_DIV_use
1292         attribute using the same new functions as what bfd/elf32_arm.c
1293         does.
1294
1295 2013-01-07  Cary Coutant  <ccoutant@google.com>
1296
1297         PR gold/14993
1298         * output.cc (Output_section::add_input_section): For incremental
1299         updates, don't track input sections that are allocated from patch
1300         space.
1301
1302 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
1303             Ian Lance Taylor  <iant@google.com>
1304
1305         PR gold/14897
1306         * configure.ac (--enable-ld): Removed.
1307         (install_as_default): Set to yes only for --enable-gold=default
1308         or --disable-ld.
1309         * configure: Regenerated.
1310
1311 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
1312
1313         * options.h (General_options): Add -fuse-ld= for GCC linker
1314         option compatibility.
1315
1316 2013-01-04  Cary Coutant  <ccoutant@google.com>
1317
1318         * configure.ac: Fix typo restoring CXXFLAGS.
1319         * configure: Regenerate.
1320
1321 2013-01-04  Cary Coutant  <ccoutant@google.com>
1322
1323         * testsuite/Makefile.am (CXXLINK_S): New macro.
1324         (debug_msg_so.err, debug_msg_ndebug.err): Use CXXLINK_S.
1325         * testsuite/Makefile.in: Regenerate.
1326
1327 2013-01-02  H.J. Lu  <hongjiu.lu@intel.com>
1328
1329         * version.cc (print_version): Update copyright year to 2013.
1330
1331 2012-12-20  Ian Lance Taylor  <iant@google.com>
1332
1333         * layout.cc (Layout::special_ordering_of_input_section): New
1334         function.
1335         (Layout::layout): If input section requires special ordering, must
1336         sort input sections.
1337         (Layout::make_output_section): May sort .text input sections.
1338         (Layout::is_section_name_prefix_grouped): Remove.
1339         * layout.h (class Layout): Declare
1340         special_ordering_of_input_section.  Don't declare
1341         is_section_name_prefix_grouped.
1342         * output.cc (Output_section::add_input_section): Revert last
1343         change.
1344         (Output_section::Input_section_sort::match_file_name): Don't crash
1345         if called on output section data.
1346         (Output_section::Input_section_sort_compare): Sort based on
1347         special ordering.
1348         (Output_section::Input_section_sort_section_order_index_compare):
1349         Revert last patch.
1350         (Output_section::sort_attached_input_sections): Likewise.
1351
1352 2012-12-18  Sriraman Tallam  <tmsriram@google.com>
1353
1354         * layout.cc (Layout::is_section_name_prefix_grouped): New function.
1355         * layout.h (Layout::is_section_name_prefix_grouped): New function.
1356         * output.cc (Output_section::add_input_section): Check if section
1357         name contains special prefix.  Keep input sections to sort such
1358         sections.
1359         (Output_section::Input_section_sort_section_order_index_compare
1360          ::operator()): Group sections according to prefixes.
1361         (Output_section::sort_attached_input_sections): Add condition to
1362         Input_section_entry constructor call.
1363         * testsuite/Makefile.am (text_section_grouping): New test.
1364         * testsuite/Makefile.in: Regenerate.
1365         * testsuite/text_section_grouping.cc: New file.
1366         * testsuite/text_section_grouping.sh: New file.
1367
1368 2012-12-17  Nick Clifton  <nickc@redhat.com>
1369
1370         * Makefile.am: Add copyright notice.
1371         * NEWS: Likewise.
1372         * README: Likewise.
1373         * configure.ac: Likewise.
1374         * ftruncate.c: Likewise.
1375         * Makefile.in: Regenerate.
1376
1377 2012-12-14  Cary Coutant  <ccoutant@google.com>
1378
1379         * testsuite/Makefile.am (exception_separate_shared_12_test): Add
1380         --no-as-needed flag.
1381         (exception_separate_shared_12_test): Likewise.
1382         (incremental_copy_test): Likewise.
1383         * testsuite/Makefile.in: Regenerate.
1384
1385 2012-12-14  Cary Coutant  <ccoutant@google.com>
1386
1387         * dwp.cc (Dwp_output_file::add_cu_set): Check for duplicate CUs.
1388         (Dwp_output_file::Dwp_index::enter_set): Add assert.
1389
1390 2012-12-12  Alan Modra  <amodra@gmail.com>
1391
1392         * powerpc.cc (class Track_tls): New.
1393         (class Relocate, class Scan): Inherit Track_tls.
1394         (Target_powerpc::Scan::local, global): Track tls optimization
1395         and avoid creating plt entry for __tls_get_addr if all uses
1396         are optimized away.
1397         (Target_powerpc::Relocate::relocate): Update to use Track_tls.
1398
1399 2012-12-12  Alan Modra  <amodra@gmail.com>
1400
1401         * options.h (General_options): Add --toc-sort/--no-toc-sort.
1402         Replace no_toc_optimize with toc_optimize.
1403         * output.h (Output_section::input_sections): Provide non-const variant.
1404         * powerpc.cc (Powerpc_relobj::has_small_toc_reloc_,
1405         set_has_small_toc_reloc, has_small_toc_reloc): New variable and
1406         accessors.
1407         (Target_powerpc::Scan::local, global): Call set_has_small_toc_reloc.
1408         (class Sort_toc_sections): New.
1409         (Target_powerpc::do_finalize_sections): Sort toc sections.
1410         (Target_powerpc::Relocate::relocate): Update toc_optimize test.
1411
1412 2012-12-10  Roland McGrath  <mcgrathr@google.com>
1413
1414         * testsuite/binary_unittest.cc (read_all): New function.
1415         (Sized_binary_test): Use it instead of ::read.
1416         * fileread.cc (do_read): Don't assume pread always reads the whole
1417         amount in a single call.
1418
1419 2012-12-10  Alan Modra  <amodra@gmail.com>
1420
1421         * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
1422         Set EM_PPC64 or EM_PPC here.
1423         (Target_selector_powerpc::do_recognize): Delete.
1424
1425 2012-12-10  Alan Modra  <amodra@gmail.com>
1426
1427         * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
1428         stub_table_.
1429         (Target_powerpc::Branch_info::make_stub): Don't omit addend.
1430
1431 2012-12-07  Roland McGrath  <mcgrathr@google.com>
1432
1433         * testsuite/binary_unittest.cc (Sized_binary_test):
1434         Use open_descriptor rather than ::open.
1435
1436 2012-12-07  Alan Modra  <amodra@gmail.com>
1437
1438         * powerpc.cc (Stub_table::do_write): Delete redundant Address
1439         typedef and invalid_address constant.
1440         (Output_data_glink, Stub_table, Target_powerpc): Explicitly
1441         instantiate constants.
1442
1443 2012-12-06  Roland McGrath  <mcgrathr@google.com>
1444
1445         * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
1446         Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
1447         * aclocal.m4: Regenerate.
1448         * configure: Regenerate.
1449         * Makefile.in: Regenerate.
1450         * testsuite/Makefile.in: Regenerate.
1451
1452 2012-12-07  Alan Modra  <amodra@gmail.com>
1453
1454         * options.h (General_options): Add no_toc_optimize.
1455         * powerpc.cc (ok_lo_toc_insn): New function.
1456         (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
1457
1458 2012-12-06  Alan Modra  <amodra@gmail.com>
1459
1460         * options.h (General_options): Add plt_align, plt_static_chain,
1461         plt_thread_safe.  Update stub_group_size help text.
1462         * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
1463         for new plt_thread_safe_ var.
1464         (use_plt_offset): Correct comments.
1465         (Target_powerpc::do_relax): Look for thread creation symbols to
1466         determine default plt_thread_safe value.  Clear plt call stubs
1467         as well as branch stubs each iteration.
1468         (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
1469         insn constants.
1470         (l, hi, ha, write_insn): Move earlier.
1471         (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
1472         (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
1473         plt stubs too.
1474         (Stub_table::update_size): Adjust.
1475         (Stub_table::prev_size, set_prev_size): Delete.
1476         (Stub_table::stub_align): Let --plt-align affect result.
1477         (Stub_table::plt_call_size): Calculate sizes for various stubs.
1478         (Stub_table::branch_stub_size): Use last_plt_size in address calc.
1479         (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
1480         (Stub_table::do_write): Support more stub variants.
1481
1482 2012-12-04  Alan Modra  <amodra@gmail.com>
1483
1484         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
1485         (Target_powerpc::do_define_standard_symbols): New function.
1486
1487 2012-12-03  Alan Modra  <amodra@gmail.com>
1488
1489         * output.h: Formatting, whitespace.
1490
1491 2012-12-03  Alan Modra  <amodra@gmail.com>
1492
1493         * layout.h (Layout::get_executable_sections): Declare.
1494         * layout.cc (Layout::get_executable_sections): New function.
1495         * arm.cc (Target_arm::group_sections): Use it.
1496         (Arm_output_section::group_sections): Delete now redundant test.
1497         * output.cc (Output_reloc::Output_reloc): Add is_relative.
1498         param to handle relative relocs.
1499         * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
1500         (Output_data_reloc::add_absolute): Adjust.
1501         (Output_data_reloc::add_relative): New function.
1502         (Output_data::reset_data_size): New function.
1503         (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
1504         (Output_section::set_addralign): New function.
1505         (Output_section::checkpoint_set_addralign): New function.
1506         (Output_section::clear_section_offsets_need_adjustment): New function.
1507         (Output_section::input_sections): Make public.
1508         * powerpc.cc (class Output_data_brlt_powerpc): New.
1509         (class Stub_table, class Stub_control): New.
1510         (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
1511         stub_table_, set_stub_table, stub_table): New vectors and accessor
1512         functions.
1513         (Target_powerpc::do_may_relax, do_relax, push_branch,
1514         new_stub_table, stub_tables, brlt_section, group_sections,
1515         add_branch_lookup_table, find_branch_lookup_table,
1516         write_branch_lookup_table, make_brlt_section): New functions.
1517         (Target_powerpc::struct Sort_sections, class Branch_info): New.
1518         (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
1519         branch_info_): New vars.
1520         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
1521         make call stubs here.
1522         (Output_data_glink): Remove all call stub handling from this class.
1523         (Target_powerpc::Scan::local, global): Save interesting branch
1524         relocs and relocs for ifunc.  Adjust calls to plt entry functions.
1525         (Target_powerpc::do_finalize_sections): Only make reg save/restore
1526         functions on final link.
1527         (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
1528         Handle long branch destinations too.
1529         (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
1530         do_plt_address_for_local): Adjust lookup of plt call stubs.
1531
1532 2012-11-30  Alan Modra  <amodra@gmail.com>
1533
1534         * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
1535         relocs against protected symbols when building 32-bit shared libs.
1536
1537 2012-11-30  Alan Modra  <amodra@gmail.com>
1538
1539         * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
1540         param.  Call got_section() to make .got.  Update all callers
1541         and their callers and so on.
1542
1543 2012-11-30  Alan Modra  <amodra@gmail.com>
1544
1545         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
1546         _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
1547         (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
1548         value if it already exists.
1549
1550 2012-11-19  H.J. Lu  <hongjiu.lu@intel.com>
1551
1552         PR gold/14858
1553         * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
1554
1555 2012-11-14  Roland McGrath  <mcgrathr@google.com>
1556
1557         * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
1558         than bfc instruction for data sandboxing.
1559
1560 2012-11-08  Alan Modra  <amodra@gmail.com>
1561
1562         * po/POTFILES.in: Regenerate.
1563
1564 2012-11-05  Alan Modra  <amodra@gmail.com>
1565
1566         * configure.ac: Apply 2012-09-10 change to config.in here.
1567         * configure: Regenerate.
1568
1569 2012-11-05  Alan Modra  <amodra@gmail.com>
1570
1571         * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
1572         (struct Opd_ent): Use "Address" rather than "Offset".
1573         (Output_data_got_powerpc::got_base_offset): Return Valtype.
1574         (Target_powerpc::got_section): Make public.
1575         (Target_powerpc::scan_relocs): Move code setting symbols..
1576         (Powerpc_relobj::do_scan_relocs): ..to here, new function.
1577         Create _SDA_BASE_ only when referenced.
1578
1579 2012-11-02  Roland McGrath  <mcgrathr@google.com>
1580
1581         * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
1582         from last change.
1583
1584 2012-11-01  Roland McGrath  <mcgrathr@google.com>
1585
1586         * target.h (Sized_target::relocate_relocs): Use Elf_Off
1587         for offset_in_output_section parameter.
1588         (Sized_target::relocate_special_relocatable): Likewise.
1589         * arm.cc (Target_arm::relocate_relocs): Likewise.
1590         (Target_arm::relocate_special_relocatable): Likewise.
1591         * i386.cc (Target_i386::relocate_relocs): Likewise.
1592         * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
1593         * sparc.cc (Target_sparc::relocate_relocs): Likewise.
1594         * target-reloc.h (relocate_relocs): Likewise.
1595         * testsuite/testfile.cc (Target_test): Likewise.
1596         * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
1597         * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
1598
1599         * system.h: Move inclusion of <clocale> to after <libintl.h> in
1600         [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
1601
1602         * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
1603         parameter, which is unused in the [!F_SETFD] case.
1604
1605         * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
1606         SYMNDX to off_t before comparing it to this->data_size().
1607         * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
1608         * incremental.cc (Output_section_incremental_inputs::do_write):
1609         Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
1610
1611         * nacl.cc: Include "libiberty.h" for vasprintf declaration.
1612
1613 2012-10-30  Steve McIntyre  <steve.mcintyre@linaro.org>
1614
1615         * gold.cc (Target_arm::do_adjust_elf_header): Add the
1616         hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
1617         in EABI_VER5.
1618
1619 2012-10-29  Cary Coutant  <ccoutant@google.com>
1620
1621         * dwp.cc (usage): Add file and exit status parameters;
1622         add --help and --version options.
1623         (print_version): New function.
1624         (main): Add --help and --version options.
1625
1626 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1627
1628         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
1629         final_layout_sequence.txt.
1630         * testsuite/Makefile.in: Regenerated.
1631
1632 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1633
1634         * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
1635         COMPILE generated by automake.
1636         (LINK1): Likewise.
1637         (CXXCOMPILE1): Likewise.
1638         (CXXLINK1): Likewise.
1639         (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
1640         (LINK): Likewise.
1641         (CXXCOMPILE): Likewise.
1642         (CXXLINK): Likewise.
1643         * testsuite/Makefile.in: Regenerated.
1644
1645 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1646
1647         * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
1648         on bad fwrite return.
1649
1650 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1651
1652         * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
1653         on val.
1654
1655 2012-10-23  Cary Coutant  <ccoutant@google.com>
1656
1657         * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
1658         * testsuite/Makefile.in: Regenerate.
1659         * testsuite/dwp_test.h: New source file.
1660         * testsuite/dwp_test_1.cc: New source file.
1661         * testsuite/dwp_test_1.s: New source file.
1662         * testsuite/dwp_test_1.sh: New source file.
1663         * testsuite/dwp_test_1b.cc: New source file.
1664         * testsuite/dwp_test_1b.s: New source file.
1665         * testsuite/dwp_test_2.cc: New source file.
1666         * testsuite/dwp_test_2.s: New source file.
1667         * testsuite/dwp_test_2.sh: New source file.
1668         * testsuite/dwp_test_main.cc: New source file.
1669         * testsuite/dwp_test_main.s: New source file.
1670
1671 2012-10-23  Cary Coutant  <ccoutant@google.com>
1672
1673         * dwp.h: New header file.
1674         * dwp.cc: New source file.
1675         * gold.h: Move shared declarations to system.h.
1676         * system.h: New header file.
1677         * Makefile.am: Add dwp.
1678         * Makefile.in: Regenerate.
1679
1680 2012-10-23  Cary Coutant  <ccoutant@google.com>
1681
1682         * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
1683         Dwarf_info_reader::read_from_pointer.
1684         (Dwarf_pubnames_table::read_header): Likewise.
1685         (Dwarf_pubnames_table::next_name): Likewise.
1686         (Dwarf_die::read_attributes): Likewise.
1687         (Dwarf_die::skip_attributes): Likewise.
1688         (Dwarf_info_reader::read_from_pointer): New function template.
1689         * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
1690         (Dwarf_pubnames_table): Likewise.
1691         (Dwarf_info_reader::read_from_pointer): New function template.
1692         * gdb-index.cc (Gdb_index_info_reader): Adjust call to
1693         Dwarf_pubnames_table ctor.
1694
1695 2012-10-23  Cary Coutant  <ccoutant@google.com>
1696
1697         * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
1698         abbrev_shndx.
1699         * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
1700         abbrev_shndx_.
1701         (Dwarf_info_reader::set_abbrev_shndx): New method.
1702         (Dwarf_info_reader::abbrev_shndx_): New data member.
1703
1704 2012-10-23  Cary Coutant  <ccoutant@google.com>
1705
1706         * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
1707         from object, not parameters.
1708         (Dwarf_info_reader::parse): Likewise.
1709         * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
1710         (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
1711         (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
1712         methods.
1713
1714 2012-10-23  Cary Coutant  <ccoutant@google.com>
1715
1716         * fileread.cc (Input_file::Input_file): New constructor.
1717         * fileread.h (class Input_file): Add new constructor.
1718
1719 2012-10-18  Alan Modra  <amodra@gmail.com>
1720
1721         PR gold/14727
1722         * object.cc (Relobj::is_section_name_included): Also match
1723         .sdata personality section.
1724
1725 2012-10-18  Alan Modra  <amodra@gmail.com>
1726
1727         * target-reloc.h (class Default_comdat_behavior): New, package up..
1728         (get_comdat_behaviour): ..this.
1729         (relocate_section): Add Relocate_comdat_behavior template arg,
1730         adjust code to suit.
1731         * arm.cc (Target_arm::relocate_section): Adjust to suit.
1732         (Target_arm::scan_reloc_section): Likewise.
1733         * i386.cc (Target_i386::relocate_section): Likewise.
1734         * sparc.cc (Target_sparc::relocate_section): Likewise.
1735         * tilegx.cc (Target_tilegx::relocate_section): Likewise.
1736         * x86_64.cc (Target_x86_64::relocate_section): Likewise.
1737         * powerpc.cc (class Relocate_comdat_behavior): New.
1738         (Target_powerpc::relocate_section): Don't zap opd relocs.  Supply
1739         gold::relocate_section with new template arg.
1740
1741 2012-10-18  Alan Modra  <amodra@gmail.com>
1742
1743         * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
1744         dynamic relocs for GOT_TPREL got entries, without symbol if
1745         resolving locally.
1746         (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
1747         (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
1748         (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
1749
1750 2012-10-17  Alan Modra  <amodra@gmail.com>
1751
1752         PR gold/14726
1753         * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
1754
1755 2012-10-16  Sriraman Tallam  <tmsriram@google.com>
1756
1757         * layout.cc (Layout::include_section): Keep sections marked
1758         SHF_EXCLUDE when doing relocatable links.
1759
1760 2012-10-16  Alan Modra  <amodra@gmail.com>
1761
1762         * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
1763         (Target_powerpc::do_finalize_sections): Call it.
1764         (Output_data_save_res): New class and supporting functions.
1765         (Target_powerpc::symval_for_branch): Only look up .opd entry for
1766         normal symbols defined in object files.
1767
1768 2012-10-12  Alan Modra  <amodra@gmail.com>
1769
1770         * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
1771         (struct Opd_ent): Make "discard" a bit field.  Add "gc_mark".
1772         (Target_powerpc::do_gc_mark_symbol): Delay marking function code
1773         section if scan_opd_relocs not yet called.
1774         (Target_powerpc::gc_process_relocs): Call process_gc_mark.
1775
1776 2012-10-12  Alan Modra  <amodra@gmail.com>
1777
1778         * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
1779         add_local_ifunc_entry): Revert last change.
1780         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
1781
1782 2012-10-05  Alan Modra  <amodra@gmail.com>
1783
1784         * powerpc.cc (Target_powerpc::do_plt_address_for_local,
1785         do_plt_address_for_global): New functions.
1786         (Output_data_got_powerpc::do_write): Don't segfault when linking
1787         statically.
1788         (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
1789         add_local_ifunc_entry): Return true on adding entry..
1790         (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
1791         glink->add_entry call.  Remove unused symtab param.  Adjust calls.
1792         (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
1793         (Target_powerpc::make_iplt_section): Remove symtab param.  Don't
1794         set up symbols here.
1795         (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
1796         syms here.  Do so even when no .iplt.  Don't segfault when linking
1797         statically.
1798         (Output_data_glink::add_entry, find_entry): Rearrange params.  Add
1799         new variants without reloc param.
1800         (Glink_sym_ent::Glink_sym_ent): Likewise.
1801         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
1802         reloc when refs will resolve to plt call stub.
1803         (Target_powerpc::Scan::local): Correct ifunc handling.  Allow
1804         R_PPC_PLTREL24 to resolve locally.
1805         (Target_powerpc::Scan::global): Correct ifunc handling.
1806         (Target_powerpc::Relocate::relocate): Correct local sym glink
1807         lookup.  Don't destroy "value" when we have a plt call stub,
1808         and when checking plt call validity.
1809         (Target_powerpc::do_dynsym_value): Simplify.
1810
1811 2012-10-05  Alan Modra  <amodra@gmail.com>
1812
1813         * i386.cc (Output_data_plt_i386::address_for_global,
1814         address_for_local): Add plt offset to returned value.  Adjust uses.
1815         * sparc.cc (Output_data_plt_sparc::address_for_global,
1816         address_for_local): Likewise.
1817         * tilegx.cc (Output_data_plt_tilegx::address_for_global,
1818         address_for_local): Likewise.
1819         * x86_64.cc (Output_data_plt_x86_64::address_for_global,
1820         address_for_local): Likewise.
1821         * target.h (Target::plt_address_for_global, plt_address_for_local):
1822         Update comment.
1823         * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
1824         (Output_data_got::Got_entry::write): Nor here.
1825         * output.h: Comment fix.
1826
1827 2012-10-02  Jiong Wang  <jiwang@tilera.com>
1828
1829         * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
1830         global_offset_table_ value for larget got.
1831         (Target_tilegx::Relocate::relocate): Handle adjusted got value.
1832
1833 2012-09-29  Alan Modra  <amodra@gmail.com>
1834
1835         * powerpc.cc (Target_powerpc::iplt_): New output section.
1836         (Target_powerpc::iplt_section, make_iplt_section,
1837         reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
1838         (Target_powerpc::make_plt_entry): Handle ifunc syms.
1839         Target_powerpc::plt_entry_count): Count iplt entries too.
1840         (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
1841         reloc section in constructor.  New params.
1842         (Target_powerpc::make_plt_section): Create reloc section here instead.
1843         (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
1844         functions.
1845         (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
1846         (Output_data_glink::add_entry, find_entry): New functions to
1847         deal with local syms.
1848         (Glink_sym_ent): Add support for local syms.
1849         (Output_data_glink::do_write): Handle ifunc plt entries.
1850         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1851         (Target_powerpc::Scan::local, global): Handle ifunc syms.
1852         (Target_powerpc::Relocate::relocate): Likewise.
1853         (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
1854
1855 2012-09-25  Alan Modra  <amodra@gmail.com>
1856
1857         * object.h (Sized_relobj_file::adjust_local_symbol,
1858         do_adjust_local_symbol): New functions.
1859         * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
1860         * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
1861         (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
1862         and irregular opd entry spacing.
1863         (Powerpc_relobj::do_read_relocs): Add opd size checks.
1864         (Global_symbol_visitor_opd): New functor.
1865         (Target_powerpc::do_finalize_sections): Omit global symbols defined
1866         on deleted opd entries.
1867
1868 2012-09-15  Jiong Wang  <jiwang@tilera.com>
1869
1870         * tilegx.cc: New file.
1871         * Makefile.am (TARGETSOURCES): Add tilegx.cc
1872         (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
1873         * configure.tgt: Add entries for tilegx*.
1874         * configure.ac: Likewise.
1875         * Makefile.in: Rebuild.
1876         * configure: Likewise.
1877         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
1878         tilegx.
1879
1880 2012-09-13  Alan Modra  <amodra@gmail.com>
1881
1882         * target-reloc.h (scan_relocs): Call scan.local for relocs
1883         against symbols in discarded sections.  Pass is_discarded
1884         param.
1885         * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
1886         Add is_discarded param.
1887         * powerpc (Target_powerpc::Scan::local): Likewise.  Use
1888         is_discarded to flag opd entry as discarded.  Don't emit dyn
1889         relocs on such entries.
1890         (Target_powerpc::Scan::global): Similarly detect and handle
1891         such opd entries.
1892         (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
1893         opd_ent_.  Update all uses.
1894         (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
1895         (Target_powerpc::relocate_section): Zero out discarded opd
1896         entry relocs.
1897
1898 2012-09-12  Ian Lance Taylor  <iant@google.com>
1899
1900         PR gold/14570
1901         * output.cc: Rename Output_data_got template parameter from size
1902         to got_size for all functions.  Compile all variants of
1903         Output_data_got.
1904         (Output_data_got::Got_entry::write): Correct use of size for
1905         symbol value.  Use local_is_tls rather than casting to
1906         Sized_relobj_file.
1907         * object.h (class Object): Add local_is_tls and do_local_is_tls.
1908         (class Sized_relobj_file): Add do_local_is_tls.
1909         * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
1910
1911 2012-09-11  Alan Modra  <amodra@gmail.com>
1912
1913         PR gold/14566
1914         * layout.cc (Layout::set_segment_offsets): When using
1915         common-page-size alignment, ensure we are on a new max-page-size
1916         page.
1917         * output.cc (Output_segment::set_section_addresses): Use
1918         abi_pagesize, not common_pagesize for relro boundary.
1919         (Output_segment::set_offset): Likewise.
1920
1921 2012-09-11  Alan Modra  <amodra@gmail.com>
1922
1923         * output.h (Output_data_got::add_global_tls, add_local_tls,
1924         add_local_tls_pair): New functions.
1925         (Output_data_got::add_local_pair_with_rel): Remove second
1926         reloc param.  Expand comment.
1927         (Output_data_got::Got_entry): Rename use_plt_offset_ to
1928         use_plt_or_tls_offset_, similarly for constructor param.
1929         (Output_data_got::Got_entry::write): Add got_index param.
1930         * output.cc (Output_data_got::add_global_tls, add_local_tls,
1931         add_local_tls_pair): New functions.
1932         (Output_data_got::Got_entry::write): Handle tls symbols
1933         with use_plt_or_tls_offset_ set specially.
1934         (Output_data_got::add_local_pair_with_rel): Only one reloc.
1935         (Output_data_got::do_write): Replace iterator with index, pass
1936         index to entry write function.
1937         * target.h (Target::tls_offset_for_local, tls_offset_for_global,
1938         do_tls_offset_for_local, do_tls_offset_for_global): New functions.
1939         * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
1940         call.
1941         * i386.cc (Target_i386::Scan::local): Likewise.
1942         * sparc.cc (Target_sparc::Scan::local): Likewise.
1943         * x86_64.cc (Target_x86_64::Scan::local): Likewise.
1944         * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
1945         do_tls_offset_for_global): New functions.
1946         (Target_powerpc::Scan::local): Correct TLS relocations and got
1947         entry values.
1948         (Target_powerpc::Scan::global): Don't emit unnecessary
1949         dynamic relocations on TLS GOT entries.
1950
1951 2012-09-10  Matthias Klose  <doko@ubuntu.com>
1952
1953         * config.in: Disable sanity check for kfreebsd.
1954
1955 2012-09-10  Sterling Augustine  <saugustine@google.com>
1956
1957         * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
1958         (Gdb_index::pubtypes_read): New parameter.
1959         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
1960         to calls.
1961         * gdb-index.h (Gdb_index): New fields pubnames_object_ and
1962         pubtypes_object_.
1963
1964 2012-09-09  Alan Modra  <amodra@gmail.com>
1965
1966         * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
1967         (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
1968         * gc.h (gc_process_relocs): Call target gc_add_reference.
1969         * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
1970         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
1971         (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
1972         unnecessary cast.
1973         * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
1974         to cater for when we don't need code offset.  Update use.
1975         (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
1976         (Powerpc_relobj::access_from_map, add_reference, opd_valid,
1977         set_opd_valid): New functions.
1978         (Target_powerpc::do_gc_add_reference): New function.
1979         (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
1980         stashed refs.
1981         (Target_powerpc::do_gc_mark_symbol): New function.
1982
1983 2012-09-06  Cary Coutant  <ccoutant@google.com>
1984
1985         * dwarf_reader.cc (Dwarf_die::read_attributes): Add
1986         DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
1987         (Dwarf_die::skip_attributes): Likewise.
1988         * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
1989         * testsuite/gdb_index_test.cc (inline_func_1): New function.
1990         (main): Call it.
1991         * testsuite/gdb_index_test_comm.sh: Check index for inline function.
1992
1993 2012-09-05  H.J. Lu  <hongjiu.lu@intel.com>
1994
1995         * testsuite/script_test_3.t: Add .got.plt output section
1996         statement.
1997         * testsuite/script_test_4.t: Likewise.
1998
1999 2012-09-05  Alan Modra  <amodra@gmail.com>
2000
2001         * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
2002         update all uses and lose "enum" when using type.
2003
2004 2012-09-05  Alan Modra  <amodra@gmail.com>
2005
2006         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
2007         * configure: Regenerate.
2008         * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
2009         (plugin_final_layout.stdout): Likewise.
2010         (memory_test): Set page sizes to 0x1000.
2011         * testsuite/Makefile.in: Regenerate.
2012         * testsuite/discard_locals_test.sh: Add FIXME comment.
2013         * testsuite/justsyms_exec.c: Disable function test for powerpc64.
2014         * testsuite/pr14265.t: Add .got output section statement.
2015         * testsuite/script_test_2.t: Likewise.
2016         * testsuite/script_test_3.t: Likewise.
2017         * testsuite/script_test_4.t: Likewise.
2018         * testsuite/script_test_5.t: Likewise.
2019         * testsuite/script_test_6.t: Likewise.
2020         * testsuite/script_test_7.t: Likewise.
2021         * testsuite/script_test_9.t: Likewise.
2022
2023 2012-09-05  Alan Modra  <amodra@gmail.com>
2024
2025         * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
2026         (Powerpc_relocate_functions::Status): New typedef.
2027         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
2028         (Target_powerpc::Scan::local): Handle REL64.
2029         (Target_powerpc::Scan::global): Likewise, and dynamic relocs
2030         for REL32 and REL64.
2031         (Target_powerpc::symval_for_branch): New function, extracted from..
2032         (Target_powerpc::Relocate::relocate): ..here.  Correct plt call
2033         checks.  Report overflow errors.
2034
2035 2012-09-05  Alan Modra  <amodra@gmail.com>
2036
2037         * object.h (Sized_relobj_file::emit_relocs): Delete.
2038         (Sized_relobj_file::emit_relocs_reltype): Delete.
2039         * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
2040         relocate_relocs for --emit-relocs.
2041         (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
2042         * output.h: Update comment.
2043         (Output_segment::first_section): New function.
2044         (Output_segment::first_section_load_address): Use first_section.
2045         * output.cc (Output_segment::first_section): New function extracted..
2046         (Output_segment::first_section_load_address): ..from here.  Delete.
2047         * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
2048         * target.h (Sized_target::relocate_for_relocatable): Likewise.
2049         * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
2050         adjust call to target.h function.
2051         * i386.cc (Target_i386): Likewise.
2052         * sparc.cc (Target_sparc): Likewise.
2053         * x86_64.cc (Target_x86_64): Likewise.
2054         * powerpc.cc (Target_powerpc): Likewise.
2055         (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS.  Ensure
2056         first tls section has section symbol for optimised local dynamic
2057         output relocs.
2058         (Target_powerpc::Relocate::relocate): Correct local dynamic value.
2059         (Target_powerpc::relocate_relocs): Adjust relocs emitted for
2060         optimised tls code.
2061         * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
2062         Rename to relocate_relocs.  Update error message.
2063
2064 2012-09-04  Andreas Schwab  <schwab@linux-m68k.org>
2065
2066         * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
2067         --just-symbols.
2068
2069 2012-08-31  Alan Modra  <amodra@gmail.com>
2070
2071         * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
2072         (Powerpc_relobj::toc_base_offset): New stub function.
2073         (Target_powerpc): Add tp_offset, dtp_offset.  Rename
2074         got_mod_index_offset to tlsld_got_offset.  Update all refs.
2075         (Target_powerpc::Relocate::enum skip_tls): New.
2076         (Target_powerpc::call_tls_get_addr_): New var.
2077         (Target_powerpc::is_branch_reloc): Move to file scope.
2078         (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
2079         (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
2080         New functions.
2081         (Target_powerpc::enum Got_type): Delete old values, add new ones.
2082         (powerpc_info): Correct common_pagesize for ppc64.
2083         (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
2084         (Powerpc_relocate_functions): Add overflow check enums and functions.
2085         Add non-shift version of rela, rela_ua.  Delete all rel public
2086         functions.  Delete addr16_lo.  Add addr64, addr64_u, addr32,
2087         addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
2088         addr16_ha3, addr14 functions.
2089         (Output_data_got_powerpc::add_constant_pair): New function.
2090         (Output_data_got_powerpc::got_base_offset): Likewise.
2091         (Output_data_got_powerpc::do_write): Correct 64-bit got header.
2092         (instruction constants): Sort, add some more.
2093         (Output_data_glink::do_write): Add and use Address typedef.  Use
2094         object->toc_base_offset() stub for 64-bit.
2095         (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
2096         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
2097         (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
2098         for R_PPC64_TOC.  Handle more relocs.  Generate got entries for TLS.
2099         Always treat .opd relocs as against locally defined symbol.
2100         Correct condition for RELATIVE relocs.
2101         (Target_powerpc::do_finalize_sections): Test for NULL sections.
2102         (Target_powerpc::Relocate::relocate): Use plt call stub as value
2103         for 32-bit syms with a plt entry.  Correct ppc64 toc base
2104         calculations.  Handle TLS relocs, and more.  Add overflow
2105         checking and adjust for Powerpc_relocate_functions changes.
2106         (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
2107         Reinstate --emit-relocs code with FIXME.
2108
2109 2012-08-30  Alan Modra  <amodra@gmail.com>
2110
2111         * layout.cc (Layout::set_segment_offsets): Set p_align to
2112         abi_pagesize, not common_pagesize.
2113         (Layout::relaxation_loop_body): Similarly use abi_pagesize
2114         to determine whether file header can go in segment.
2115
2116 2012-08-30  Alan Modra  <amodra@gmail.com>
2117
2118         * output.h (Output_reloc::Output_reloc <output section>): Add
2119         is_relative param.  Adjust calls.
2120         (Output_reloc::add_output_section_relative): New functions.
2121         * output.cc (Output_reloc::Output_reloc <output section>): Handle
2122         is_relative.
2123         (Output_reloc::symbol_value): Handle SECTION_CODE.
2124
2125 2012-08-24  Sriraman Tallam  <tmsriram@google.com>
2126
2127         * gold.cc (queue_middle_tasks): Call layout again when unique
2128         segments for sections is desired.
2129         * layout.cc (Layout::Layout): Initialize new members.
2130         (Layout::get_output_section_flags): New function.
2131         (Layout::choose_output_section): Call get_output_section_flags.
2132         (Layout::layout): Make output section for mapping to a unique segment.
2133         (Layout::insert_section_segment_map): New function.
2134         (Layout::attach_allocated_section_to_segment): Make unique segment for
2135         output sections marked so.
2136         (Layout::segment_precedes): Check for unique segments when sorting.
2137         * layout.h (Layout::Unique_segment_info): New struct.
2138         (Layout::Section_segment_map): New typedef.
2139         (Layout::insert_section_segment_map): New function.
2140         (Layout::get_output_section_flags): New function.
2141         (Layout::is_unique_segment_for_sections_specified): New function.
2142         (Layout::set_unique_segment_for_sections_specified): New function.
2143         (Layout::unique_segment_for_sections_specified_): New member.
2144         (Layout::section_segment_map_): New member.
2145         * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
2146         Rename is_gc_pass_one to is_pass_one.
2147         Rename is_gc_pass_two to is_pass_two.
2148         Rename is_gc_or_icf to is_two_pass.
2149         Check for which pass based on whether symbols data is present.
2150         Make it two pass when unique segments for sections is desired.
2151         * output.cc (Output_section::Output_section): Initialize new
2152         members.
2153         * output.h (Output_section::is_unique_segment): New function.
2154         (Output_section::set_is_unique_segment): New function.
2155         (Output_section::is_unique_segment_): New member.
2156         (Output_section::extra_segment_flags): New function.
2157         (Output_section::set_extra_segment_flags): New function.
2158         (Output_section::extra_segment_flags_): New member.
2159         (Output_section::segment_alignment): New function.
2160         (Output_section::set_segment_alignment): New function.
2161         (Output_section::segment_alignment_): New member.
2162         (Output_segment::Output_segment): Initialize is_unique_segment_.
2163         (Output_segment::is_unique_segment): New function.
2164         (Output_segment::set_is_unique_segment): New function.
2165         (Output_segment::is_unique_segment_): New member.
2166         * plugin.cc (allow_unique_segment_for_sections): New function.
2167         (unique_segment_for_sections): New function.
2168         (Plugin::load): Add new functions to transfer vector.
2169         * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
2170         * Makefile.in: Regenerate.
2171         * testsuite/plugin_final_layout.sh: Check if unique segment
2172         functionality works.
2173         * testsuite/plugin_section_order.c (onload): Check if new interfaces
2174         are available.
2175         (allow_unique_segment_for_sections): New global.
2176         (unique_segment_for_sections): New global.
2177         (claim_file_hook): Call allow_unique_segment_for_sections.
2178         (all_symbols_read_hook): Call unique_segment_for_sections.
2179
2180 2012-08-22  Cary Coutant  <ccoutant@google.com>
2181
2182         * layout.cc (Layout::include_section): Don't assert on GROUP
2183         sections with --emit-relocs.
2184
2185 2012-08-21  Cary Coutant  <ccoutant@google.com>
2186
2187         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
2188         if --export-dynamic-symbol names an undef symbol.
2189
2190 2012-08-18  Alan Modra  <amodra@gmail.com>
2191
2192         * powerpc.cc: Formatting and white space.
2193         (Powerpc_relobj): Rename got2_section_ to special_.
2194         Add opd_ent_shndx_ and opd_ent_off_ vectors.
2195         (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
2196         scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
2197         (Target_powerpc): Add Address typedef and invalid_address.  Use
2198         throughout.
2199         (Target_powerpc::is_branch_reloc): New function.
2200         (Powerpc_relocate_functions): Add Address typedef, use throughout.
2201         (Powerpc_relocate_functions:rela, rela_ua): Correct type used
2202         for dst_mask, value and addend.
2203         (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
2204         (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
2205         (Output_data_glink::do_write): Correct toc base.  Don't try to use
2206         uint16_t for 24-bit offset.  Use get_output_section_offset and
2207         check return.
2208         (Target_powerpc::Scan::local): Handle more relocs.
2209         (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
2210         (Target_powerpc::Relocate::relocate): Correct toc base calculation.
2211         Plug in toc restoring insn after plt calls.  Translate branches
2212         to function descriptor symbols to corresponding entry point.
2213         (Target_powerpc::relocate_for_relocatable): Check return from
2214         get_output_section_offset.
2215         * symtab.h: Comment typo.
2216
2217 2012-08-14  Ian Lance Taylor  <iant@google.com>
2218
2219         * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
2220         unsupported_relocal_local to call unsupported_reloc_global.
2221
2222 2012-08-14  Nick Clifton  <nickc@redhat.com>
2223
2224         PR ld/14265
2225         * script-sections.cc (Sections_element::output_section_name): Add
2226         keep return parameter.
2227         (Output_section_element::match_name): Add keep return parameter.
2228         Return the value of the keep_ member.
2229         * script-sections.h (class Output_section): Update
2230         output_section_name prototype.
2231         * layout.cc (Layout::keep_input_section): New public member
2232         function.
2233         (Layout::choose_output_section): Pass keep parameter to
2234         output_section_name.
2235         * layout.h (class Layout): Add keep_input_section.
2236         * object.cc (Sized_relobj_file::do_layout): Check for kept input
2237         sections.
2238         * testsuite/Makefile.am: Add a test.
2239         * testsuite/Makefile.in: Regenerate.
2240         * testsuite/pr14265.c: Source file for the test.
2241         * testsuite/pr14265.t: Linker script for the test.
2242         * testsuite/pr14265.sh: Shell script for the test.
2243
2244 2012-08-14  Alan Modra  <amodra@gmail.com>
2245
2246         * target.h (Target::output_section_name): New function.
2247         (Target::do_output_section_name): New function.
2248         * layout.cc (Layout::choose_output_section): Call the above.
2249         * powerpc.cc (Target_powerpc::do_output_section_name): New function.
2250
2251 2012-08-14  Alan Modra  <amodra@gmail.com>
2252
2253         * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
2254         (Output_data_got_powerpc::do_write): Don't rely on base class lookup
2255         for replace_constant call.
2256         (Output_data_plt_powerpc::do_print_to_mapfile): New function.
2257         (Output_data_glink::do_print_to_mapfile): New function.
2258         (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
2259         (Target_powerpc::Relocate::relocate): Likewise.
2260
2261 2012-08-14  Alan Modra  <amodra@gmail.com>
2262
2263         * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
2264         (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
2265         (Output_data_glink::add_entry,find_entry): Remove shndx param.
2266         (class Glink_sym_ent): Rename from struct Glink_sym_ent.  Remove
2267         all references to shndx_.  Handle special case for R_PPC_PLTREL24
2268         here.
2269         (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
2270         (Output_data_glink::do_write): Retrieve got2_shdnx from object.
2271         (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
2272         here.
2273         (Target_powerpc::Scan::global): Nor on make_plt_entry call.
2274         (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
2275
2276 2012-08-12  Alan Modra  <amodra@gmail.com>
2277
2278         * powerpc.cc: Whitespace fixes.  Wrap overly long lines.
2279         (glink insn constants): Use uint32_t.
2280         (Output_data_glink::add_entry): Use insert, not [] operator.
2281
2282 2012-08-11  Alan Modra  <amodra@gmail.com>
2283
2284         * object.h (Sized_relobj_file::find_shdr): New function.
2285         (Sized_relobj_file::find_special_sections): New function.
2286         * object.cc (Sized_relobj_file::find_shdr): New function.
2287         (Sized_relobj_file::find_eh_frame): Use find_shdr.
2288         (Sized_relobj_file::find_special_sections): New function, split out..
2289         (Sized_relobj_file::do_read_symbols): ..from here.
2290         * output.h (Output_data_got::replace_constant): New function.
2291         (Output_data_got::num_entries): New function.
2292         (Output_data_got::last_got_offset,set_got_size): Use num_entries.
2293         (Output_data_got::got_offset): Protected rather than private.
2294         (Output_data_got::replace_got_entry): New function.
2295         * output.cc (Output_data_got::replace_got_entry): New function.
2296         * powerpc.cc (class Powerpc_relobj): New.
2297         (class Powerpc_relocate_functions): Delete all psymval variants or
2298         convert to value,addend type.  Delete pcrela, pcrela_unaligned.
2299         Implement _ha functions using corresponding _hi function.
2300         (Powerpc_relobj::find_special_sections): New function.
2301         (Target_powerpc::do_make_elf_object): New function.
2302         (class Output_data_got_powerpc): New.
2303         (class Output_data_glink): New.
2304         (class Powerpc_scan_relocatable_reloc): New.
2305         Many more changes througout file.
2306
2307 2012-08-09  Nick Clifton  <nickc@redhat.com>
2308
2309         * po/vi.po: Updated Vietnamese translation.
2310
2311 2012-08-07  Ian Lance Taylor  <iant@google.com>
2312
2313         * layout.cc (Layout::add_target_dynamic_tags): If
2314         dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
2315         plt_rel.
2316
2317 2012-07-30  Nick Clifton  <nickc@redhat.com>
2318
2319         * po/gold.pot: Updated template.
2320         * po/es.po: Updated Spanish translation.
2321
2322 2012-07-18  Cary Coutant  <ccoutant@google.com>
2323
2324         PR gold/14344
2325         * configure.ac: Add check for -gpubnames support.
2326         * configure: Regenerate.
2327         * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
2328         support; force -gno-pubnames.
2329         (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
2330         support.
2331         (gdb_index_test_4): New test.
2332         * testsuite/Makefile.in: Regenerate.
2333         * testsuite/gdb_index_test_1.sh: Refactor code into common file.
2334         * testsuite/gdb_index_test_2.sh: Likewise.
2335         * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
2336         * testsuite/gdb_index_test_4.sh: New script.
2337         * testsuite/gdb_index_test_comm.sh: New script with common code;
2338         don't look for space after colon.
2339
2340 2012-07-16  Sriraman Tallam  <tmsriram@google.com>
2341
2342         * gold.cc (queue_middle_tasks): Update function order only after
2343         deferred objects due to plugins are processed.
2344
2345 2012-07-11  Ian Lance Taylor  <iant@google.com>
2346
2347         * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
2348         (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
2349         (Target_arm::scan_reloc_for_stub): Likewise.
2350         * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
2351         * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
2352         * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
2353         * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
2354         * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
2355
2356 2012-07-10  Dodji Seketeli  <dodji@redhat.com>
2357             Ian Lance Taylor  <iant@google.com>
2358
2359         PR gold/14309
2360         * configure.ac: Test whether std::tr1::hash<off_t> works.
2361         * gold.h: Add a specialization for std::tr1::hash<off_t> if
2362         needed.
2363         * output.h (class Output_fill): Add virtual destructor.
2364         * configure, config.in: Rebuild.
2365
2366 2012-06-22  Roland McGrath  <mcgrathr@google.com>
2367
2368         * layout.cc (finalize): Define __ehdr_start symbol if applicable.
2369
2370 2012-06-12  Rafael Ávila de Espíndola <respindola@mozilla.com>
2371
2372         * plugin.cc (Plugin::load): Handle position independent executables.
2373
2374 2012-06-06  Cary Coutant  <ccoutant@google.com>
2375
2376         * layout.cc (gdb_sections): Remove ".debug_" prefixes,
2377         add .debug_macro.
2378         (lines_only_debug_sections): Likewise.
2379         (gdb_fast_lookup_sections): New static array.
2380         (is_gdb_debug_section): Rename formal parameter.
2381         (is_lines_only_debug_section): Likewise.
2382         (is_gdb_fast_lookup_section): New function.
2383         (Layout::include_section): Check for ".zdebug_" prefix; pass
2384         section name suffix to is_gdb_debug_section, et al.; check for
2385         fast-lookup sections when building .gdb_index.
2386         * options.h (--strip-debug-gdb): Update GDB version number.
2387
2388 2012-06-06  Cary Coutant  <ccoutant@google.com>
2389
2390         * configure.ac: Add check for fallocate.
2391         * configure: Regenerate.
2392         * config.in: Regenerate.
2393
2394         * options.h (class General_options): Add --mmap-output-file and
2395         --posix-fallocate options.
2396         * output.cc: (posix_fallocate): Remove; replace with...
2397         (gold_fallocate): New function.
2398         (Output_file::map_no_anonymous): Call gold_fallocate.
2399         (Output_file::map): Check --mmap-output-file option.
2400
2401 2012-06-05  Jing Yu  <jingyu@google.com>
2402
2403         * gold.h (textdomain): Add do {} to empty while(0).
2404         (bindtextdomain): Likewise.
2405
2406 2012-06-04  Cary Coutant  <ccoutant@google.com>
2407
2408         * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
2409         has_dynsym_index.
2410
2411 2012-05-25  Sriraman Tallam  <tmsriram@google.com>
2412
2413         * symtab.cc (Symbol_table::define_special_symbol):
2414         Initialize *poldsym to prevent uninitialized variable errors.
2415
2416 2012-05-23  Cary Coutant  <ccoutant@google.com>
2417
2418         * layout.cc (Layout::section_name_mapping): Add rules to handle
2419         exact match on .data.rel.ro.local or .data.rel.ro.
2420         (Layout::output_section_name): Check for exact matches.
2421
2422 2012-05-23  Cary Coutant  <ccoutant@google.com>
2423
2424         * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
2425         more carefully.
2426
2427 2012-05-22  Cary Coutant  <ccoutant@google.com>
2428
2429         * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
2430         object before exporting symbol.
2431
2432 2012-05-21  H.J. Lu  <hongjiu.lu@intel.com>
2433
2434         * testsuite/tls_test.cc: Include "config.h" first.
2435         * testsuite/tls_test_c.c: Likewise.
2436
2437 2012-05-17  Daniel Richard G.  <skunk@iskunk.org>
2438             Nick Clifton  <nickc@redhat.com>
2439
2440         PR 14072
2441         * configure.in: Add check that sysdep.h has been included before
2442         any system header files.
2443         * configure: Regenerate.
2444         * config.in: Regenerate.
2445
2446 2012-05-14  Cary Coutant  <ccoutant@google.com>
2447
2448         * layout.cc (Layout::make_output_section): Mark .tdata section
2449         as RELRO.
2450         * testsuite/relro_test.cc: Add a TLS variable.
2451
2452 2012-05-10  H.J. Lu  <hongjiu.lu@intel.com>
2453
2454         PR gold/14091
2455         * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
2456         R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
2457         R_X86_64_64.
2458
2459 2012-05-08  Cary Coutant  <ccoutant@google.com>
2460
2461         * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
2462         (lines_only_debug_sections): Likewise.
2463
2464 2012-05-02  Roland McGrath  <mcgrathr@google.com>
2465
2466         * nacl.cc: New file.
2467         * nacl.h: New file.
2468         * Makefile.am (CCFILES, HFILES): Add them.
2469         * Makefile.in: Regenerate.
2470         * i386.cc (Output_data_plt_i386_nacl): New class.
2471         (Output_data_plt_i386_nacl_exec): New class.
2472         (Output_data_plt_i386_nacl_dyn): New class.
2473         (Target_i386_nacl): New class.
2474         (Target_selector_i386_nacl): New class.
2475         (target_selector_i386): Use it instead of Target_selector_i386.
2476         * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
2477         (Target_x86_64_nacl): New class.
2478         (Target_selector_x86_64_nacl): New class.
2479         (target_selector_x86_64, target_selector_x32): Use it instead of
2480         Target_selector_x86_64.
2481         * arm.cc (Output_data_plt_arm_nacl): New class.
2482         (Target_arm_nacl): New class.
2483         (Target_selector_arm_nacl): New class.
2484         (target_selector_arm, target_selector_armbe): Use it instead of
2485         Target_selector_arm.
2486
2487         * target-select.cc (select_target): Take new Input_file* and off_t
2488         arguments, pass them on to recognize method of selector.
2489         * object.cc (make_elf_sized_object): Update caller.
2490         * parameters.cc (parameters_force_valid_target): Likewise.
2491         * incremental.cc (make_sized_incremental_binary): Likewise.
2492         * target-select.h: Update decl.
2493         (Target_selector::recognize): Take new Input_file* argument,
2494         pass it on to do_recognize.
2495         (Target_selector::do_recognize): Take new Input_file* argument.
2496         * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
2497         * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
2498         * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
2499         * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
2500
2501         * target.h (Target::Target_info): New members isolate_execinstr
2502         and rosegment_gap.
2503         (Target::isolate_execinstr, Target::rosegment_gap): New methods.
2504         * arm.cc (Target_arm::arm_info): Update initializer.
2505         * i386.cc (Target_i386::i386_info): Likewise.
2506         * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
2507         * sparc.cc (Target_sparc::sparc_info): Likewise.
2508         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
2509         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
2510         * layout.cc (Layout::attach_allocated_section_to_segment):
2511         Take new const Target* argument.  If target->isolate_execinstr(), act
2512         like --rosegment.
2513         (Layout::find_first_load_seg): Take new const Target* argument;
2514         if target->isolate_execinstr(), reject PF_X segments.
2515         (Layout::relaxation_loop_body): Update caller.
2516         (Layout::set_segment_offsets): If target->isolate_execinstr(),
2517         reset file offset to zero when we hit LOAD_SEG, and then do a second
2518         loop over the segments before LOAD_SEG to reassign offsets after
2519         addresses have been determined.  Handle target->rosegment_gap().
2520         (Layout::attach_section_to_segment): Take new const Target* argument;
2521         pass it to attach_allocated_section_to_segment.
2522         (Layout::make_output_section): Update caller.
2523         (Layout::attach_sections_to_segments): Take new const Target* argument;
2524         pass it to attach_section_to_segment.
2525         * gold.cc (queue_middle_tasks): Update caller.
2526         * layout.h (Layout): Update method decls with new arguments.
2527
2528         * arm.cc (Target_arm::Target_arm): Take optional argument for the
2529         Target_info pointer to use.
2530         (Target_arm::do_make_data_plt): New virtual method.
2531         (Target_arm::make_data_plt): New method that calls it.
2532         (Target_arm::make_plt_entry): Use it.
2533         (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
2534         for the section alignment.
2535         (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
2536         method.
2537         (Output_data_plt_arm::first_plt_entry_offset): Call it.
2538         (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
2539         method.
2540         (Output_data_plt_arm::get_plt_entry_size): Call it.
2541         (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
2542         (Output_data_plt_arm::fill_plt_entry): New method that calls it.
2543         (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
2544         method.
2545         (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
2546         (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
2547         method instead of sizeof(plt_entry).
2548         (Output_data_plt_arm::add_entry): Likewise.
2549         Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
2550         (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
2551         than static method.
2552         (Target_arm::plt_entry_size): Likewise.
2553         (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
2554         Move to ...
2555         (Output_data_plt_arm_standard): ... here, new class.
2556         (Output_data_plt_arm::do_write): Move guts of PLT filling to...
2557         (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
2558         (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
2559
2560         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
2561         Take additional argument for the PLT entry size.
2562         (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
2563         Use get_plt_entry_size method rather than plt_entry_size variable.
2564         (Output_data_plt_x86_64::reserve_slot): Likewise.
2565         (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
2566         (Output_data_plt_x86_64::add_entry): Likewise.
2567         (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
2568         (Output_data_plt_x86_64::address_for_global): Likewise.
2569         (Output_data_plt_x86_64::address_for_local): Likewise.
2570         (Output_data_plt_x86_64::set_final_data_size): Likewise.
2571         (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
2572         Make method non-static.
2573         (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
2574         method.
2575         (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
2576         (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
2577         (Output_data_plt_x86_64::add_eh_frame): New method to call it.
2578         (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
2579         virtual method.
2580         (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
2581         (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
2582         virtual method.
2583         (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
2584         (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
2585         virtual method.
2586         (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
2587         (Output_data_plt_x86_64::plt_entry_size)
2588         (Output_data_plt_x86_64::first_plt_entry)
2589         (Output_data_plt_x86_64::plt_entry)
2590         (Output_data_plt_x86_64::tlsdesc_plt_entry)
2591         (Output_data_plt_x86_64::plt_eh_frame_fde_size)
2592         (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
2593         (Output_data_plt_x86_64_standard): ... here, new class.
2594         (Target_x86_64::Target_x86_64): Take optional argument for the
2595         Target_info pointer to use.
2596         (Target_x86_64::do_make_data_plt): New virtual method.
2597         (Target_x86_64::make_data_plt): New method to call it.
2598         (Target_x86_64::init_got_plt_for_update): Use that.
2599         Call this->plt_->add_eh_frame method here.
2600         (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
2601         (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
2602         rather than static method.
2603         (Target_x86_64::plt_entry_size): Likewise.
2604         (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
2605         rather than plt_entry_size variable.  Move guts of PLT filling to...
2606         (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
2607         (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
2608         (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
2609
2610         * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
2611         additional argument for the section alignment.
2612         Don't do add_eh_frame_for_plt here.
2613         (Output_data_plt_i386::first_plt_entry_offset): Make the method
2614         non-static.  Use get_plt_entry_size method rather than plt_entry_size
2615         variable.
2616         (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
2617         method.
2618         (Output_data_plt_i386::get_plt_entry_size): Call it.
2619         (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
2620         (Output_data_plt_i386::add_eh_frame): New method to call it.
2621         (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
2622         method.
2623         (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
2624         (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
2625         method.
2626         (Output_data_plt_i386::fill_plt_entry): New method to call it.
2627         (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
2628         method instead of plt_entry_size.
2629         (Output_data_plt_i386::plt_entry_size)
2630         (Output_data_plt_i386::plt_eh_frame_fde_size)
2631         (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
2632         (Output_data_plt_i386_standard): ... here, new class.
2633         (Output_data_plt_i386_exec): New class.
2634         (Output_data_plt_i386::exec_first_plt_entry): Move to ...
2635         (Output_data_plt_i386_exec::first_plt_entry): ... here.
2636         (Output_data_plt_i386::exec_plt_entry): Move to ...
2637         (Output_data_plt_i386_exec::plt_entry): ... here.
2638         (Output_data_plt_i386_dyn): New class.
2639         (Output_data_plt_i386::first_plt_entry): Move to ...
2640         (Output_data_plt_i386_dyn::first_plt_entry): ... here.
2641         (Output_data_plt_i386::dyn_plt_entry): Move to ...
2642         (Output_data_plt_i386_dyn::plt_entry): ... here.
2643         (Target_i386::Target_i386): Take optional argument for the Target_info
2644         pointer to use.
2645         (Target_i386::do_make_data_plt): New virtual method.
2646         (Target_i386::make_data_plt): New method to call it.
2647         (Target_i386::make_plt_section): Use that.
2648         Call this->plt_->add_eh_frame method here.
2649         (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
2650         rather than plt_entry_size variable.
2651         (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
2652         (Output_data_plt_i386::address_for_local): Likewise.
2653         (Output_data_plt_i386::do_write): Likewise.
2654         Move guts of PLT filling to...
2655         (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
2656         (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
2657         (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
2658         (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
2659
2660 2012-05-01  Cary Coutant  <ccoutant@google.com>
2661
2662         * dwarf_reader.cc (Dwarf_die::read_attributes)
2663         (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
2664         (Dwarf_die::uint_attribute): Remove DW_FORM_null.
2665         * reduced_debug_output.cc
2666         (Output_reduced_debug_info_section::get_die_end): Remove
2667         DW_FORM_GNU_ref_index.  Add default case.
2668
2669 2012-04-26  Mark Wielaard  <mjw@redhat.com>
2670
2671         * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
2672         * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
2673         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
2674         DW_AT_high_pc as offset from DW_AT_low_pc.
2675
2676         * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
2677         * testsuite/Makefile.in: Regenerate.
2678         * testsuite/gdb_index_test_3.c: New test source file.
2679         * testsuite/gdb_index_test_3.sh: New test source file.
2680
2681 2012-04-25  Ian Lance Taylor  <iant@google.com>
2682
2683         * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
2684         pointer.
2685         (Stub_addend_reader::operator()): Declare Arm_relocate_functions
2686         as a class, not a struct.
2687         (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
2688         (Target_arm::apply_cortex_a8_workaround): Likewise.
2689         * gc.h: Declare Reloc_types as a struct, not a class.
2690         * object.h: Declare Symbols_data as a struct.
2691         * reloc.h: Declare Read_relocs_data as a struct.
2692         * target.h: Declare Relocate_info as a struct.
2693
2694 2012-04-24  David S. Miller  <davem@davemloft.net>
2695
2696         * sparc.cc (Target_sparc::Relocate::relax_call): New function.
2697         (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
2698         and R_SPARC_WPLT30.
2699
2700 2012-04-24  Cary Coutant  <ccoutant@google.com>
2701
2702         * incremental-dump.cc (find_input_containing_global): Replace
2703         magic number with symbolic constant.
2704         (dump_incremental_inputs): Update version number.
2705         * incremental.cc (Output_section_incremental_inputs): Update version
2706         number; import symbolic constants from Incremental_inputs_reader.
2707         (Incremental_inputs::create_data_sections): Align relocations
2708         section correctly for 64-bit targets.
2709         (Output_section_incremental_inputs::set_final_data_size): Use symbolic
2710         constants; add padding.
2711         (Output_section_incremental_inputs::write_header): Add assert for
2712         header_size.
2713         (Output_section_incremental_inputs::write_input_files): Add assert
2714         for input_entry_size.
2715         (Output_section_incremental_inputs::write_info_blocks): Add padding;
2716         add assert for object_info_size, input_section_entry_size,
2717         global_sym_entry_size.
2718         * incremental.h (Incremental_inputs_reader): Add symbolic constants
2719         for data structure sizes; use them.
2720         (Incremental_input_entry_reader): Import symbolic constants from
2721         Incremental_inputs_reader; use them.
2722
2723 2012-04-23  David S. Miller  <davem@davemloft.net>
2724
2725         * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
2726         and elf_flags_set_.
2727         (Target_sparc::Target_sparc): Initialize new fields.
2728         (Target_sparc::do_make_elf_object): New function.
2729         (Target_sparc::do_adjust_elf_header): New function.
2730
2731 2012-04-23  Cary Coutant  <ccoutant@google.com>
2732
2733         * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
2734         CU range table of gdb index.
2735
2736 2012-04-20  David S. Miller  <davem@davemloft.net>
2737
2738         * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
2739         instead of false.
2740
2741 2012-04-16  David S. Miller  <davem@davemloft.net>
2742
2743         * sparc.cc (Target_sparc::got_address): New function.
2744         (Sparc_relocate_functions::gdop_hix22): New function.
2745         (Sparc_relocate_functions::gdop_lox10): New function.
2746         (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
2747         relocs.
2748         (Target_sparc::Scan::local): Likewise if the global symbol is not
2749         preemptible and is not IFUNC.
2750         (Target_sparc::Relocate::relocate): Perform GOTDATA code
2751         transformations for local and non-preemptible non-IFUNC global
2752         symbols.
2753
2754         * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
2755         writing out 64-bit part of ranges.
2756
2757         * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
2758         -fpic and -fpie respectively.
2759         * Makefile.in: Regenerate.
2760
2761         * sparc.cc (class Target_sparc): Add rela_ifunc_.
2762         (Target_sparc::Target_sparc): Initialize new field.
2763         (Target_sparc::do_plt_section_for_global): New function.
2764         (Target_sparc::do_plt_section_for_local): New function.
2765         (Target_sparc::reloc_needs_plt_for_ifunc): New function.
2766         (Target_sparc::make_plt_section): New function, broken out of
2767         make_plt_entry.  Use ORDER_NON_RELRO_FIRST for ".plt".
2768         (Target_sparc::make_plt_entry): Call make_plt_section.
2769         (Target_sparc::make_local_ifunc_plt_entry): New function.
2770         (Target_sparc::rela_ifunc_section): New function.
2771         (Target_sparc::plt_section): Remove const.
2772         (Output_data_plt_sparc): Update declarations.  Define Global_ifunc
2773         and Local_ifunc types.  Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
2774         and ifunc_count_ fields.
2775         (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
2776         (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
2777         (Output_data_plt_sparc::add_local_ifunc_entry): New function.
2778         (Output_data_plt_sparc::rela_ifunc): New function.
2779         (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
2780         (Output_data_plt_sparc::has_ifunc_section): New function.
2781         (Output_data_plt_sparc::entry_count): Include ifunc_count_.
2782         (Output_data_plt_sparc::address_for_global): New function.
2783         (Output_data_plt_sparc::address_for_local): New function.
2784         (Output_data_plt_sparc::plt_index_to_offset): New function.
2785         (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
2786         and entry_count.
2787         (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
2788         entry_count.
2789         (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
2790         R_SPARC_JMP_IREL to switch.
2791         (Target_sparc::Scan::check_non_pic): Likewise.
2792         (Target_sparc::Scan::local): Handle IFUNC symbols.
2793         (Target_sparc::Scan::local): Likewise.
2794         (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
2795         and plt_address_for_local.
2796         (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
2797         Define __rel_iplt_start and __rel_iplt_end if doing a static link.
2798
2799         * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
2800         (class Output_data_reloc): Adjust calls to Output_reloc_type.
2801         (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
2802         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
2803         global relocs too.
2804         (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
2805         * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
2806         calls.
2807         * sparc.cc (Target_sparc::Scan::global): Likewise.
2808         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
2809
2810 2012-04-16  Cary Coutant  <ccoutant@google.com>
2811
2812         * archive.cc (Library_base::should_include_member): Check for
2813         --export-dynamic-symbol.
2814         * options.h (class General_options): Add --export-dynamic-symbol.
2815         * symtab.cc (Symbol::should_add_dynsym_entry): Check for
2816         --export-dynamic-symbol.
2817         (Symbol_table::gc_mark_undef_symbols): Likewise.
2818         (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
2819
2820 2012-04-12  David S. Miller  <davem@davemloft.net>
2821
2822         * sparc.cc (Reloc::wdisp10): New relocation method.
2823         (Reloc::h34): Likewise.
2824         (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
2825         (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
2826         R_SPARC_WDISP10.
2827         (Target_sparc::Scan::local): Likewise.
2828         (Target_sparc::Scan::global): Likewise.
2829         (Target_sparc::Relocate::relocate): Likewise.
2830
2831 2012-04-09  Cary Coutant  <ccoutant@google.com>
2832
2833         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
2834         low_pc == 0.
2835
2836 2012-04-06  Ian Lance Taylor  <iant@google.com>
2837
2838         * timer.cc: #include <unistd.h>.
2839
2840 2012-04-06  Roland McGrath  <mcgrathr@google.com>
2841
2842         * configure.in (AC_CHECK_HEADERS): Add locale.h.
2843         * config.in: Regenerate.
2844         * configure: Regenerate.
2845
2846 2012-04-05  Nick Clifton  <nickc@redhat.com>
2847
2848         * configure.ac (AC_CHECK_FUNCS): Add setlocale.
2849         (AM_LC_MESSAGES): Add.
2850         * aclocal.m4: Regenerate.
2851         * config.in: Regenerate.
2852         * configure: Regenerate.
2853
2854 2012-03-21  Cary Coutant  <ccoutant@google.com>
2855
2856         * Makefile.am: Add gdb-index.cc, gdb-index.h.
2857         * Makefile.in: Regenerate.
2858         * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
2859         (Sized_elf_reloc_mapper::symbol_section): New function.
2860         (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
2861         (make_elf_reloc_mapper): New function.
2862         (Dwarf_abbrev_table::clear_abbrev_codes): New function.
2863         (Dwarf_abbrev_table::do_read_abbrevs): New function.
2864         (Dwarf_abbrev_table::do_get_abbrev): New function.
2865         (Dwarf_ranges_table::read_ranges_table): New function.
2866         (Dwarf_ranges_table::read_range_list): New function.
2867         (Dwarf_pubnames_table::read_section): New function.
2868         (Dwarf_pubnames_table::read_header): New function.
2869         (Dwarf_pubnames_table::next_name): New function.
2870         (Dwarf_die::Dwarf_die): New function.
2871         (Dwarf_die::read_attributes): New function.
2872         (Dwarf_die::skip_attributes): New function.
2873         (Dwarf_die::set_name): New function.
2874         (Dwarf_die::set_linkage_name): New function.
2875         (Dwarf_die::attribute): New function.
2876         (Dwarf_die::string_attribute): New function.
2877         (Dwarf_die::int_attribute): New function.
2878         (Dwarf_die::uint_attribute): New function.
2879         (Dwarf_die::ref_attribute): New function.
2880         (Dwarf_die::child_offset): New function.
2881         (Dwarf_die::sibling_offset): New function.
2882         (Dwarf_info_reader::check_buffer): New function.
2883         (Dwarf_info_reader::parse): New function.
2884         (Dwarf_info_reader::do_parse): New function.
2885         (Dwarf_info_reader::do_read_string_table): New function.
2886         (Dwarf_info_reader::lookup_reloc): New function.
2887         (Dwarf_info_reader::get_string): New function.
2888         (Dwarf_info_reader::visit_compilation_unit): New function.
2889         (Dwarf_info_reader::visit_type_unit): New function.
2890         (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
2891         Sized_elf_reloc_mapper.
2892         (Sized_dwarf_line_info::symbol_section): Remove function.
2893         (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
2894         (Sized_dwarf_line_info::read_line_mappings): Remove object
2895         parameter, adjust callers.
2896         (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
2897         * dwarf_reader.h: Include <sys/types.h>.
2898         (class Track_relocs): Remove forward declaration.
2899         (class Elf_reloc_mapper): New class.
2900         (class Sized_elf_reloc_mapper): New class.
2901         (class Dwarf_abbrev_table): New class.
2902         (class Dwarf_range_list): New class.
2903         (class Dwarf_ranges_table): New class.
2904         (class Dwarf_pubnames_table): New class.
2905         (class Dwarf_die): New class.
2906         (class Dwarf_info_reader): New class.
2907         (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
2908         (Sized_dwarf_line_info::symbol_section): Remove member function.
2909         * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
2910         base class.
2911         * gdb-index.cc: New source file.
2912         * gdb-index.h: New source file.
2913         * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
2914         and .debug_types sections, call Layout::add_to_gdb_index.
2915         (Sized_relobj_incr::do_section_name): Implement.
2916         (Sized_relobj_incr::do_section_contents): Adjust parameter list and
2917         return type; Implement.
2918         (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
2919         return type.
2920         * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
2921         parameter list and return type.
2922         (Sized_incr_dynobj::do_section_contents): Likewise.
2923         * layout.cc: Include gdb-index.h.
2924         (Layout::Layout): Initialize gdb_index_data_.
2925         (Layout::init_fixed_output_section): Check for .gdb_index section.
2926         (Layout::add_to_gdb_index): New function. Instantiate.
2927         * layout.h: Add forward declaration for class Gdb_index.
2928         (Layout::add_to_gdb_index): New member function.
2929         (Layout::gdb_index_data_): New data member.
2930         * main.cc: Include gdb-index.h.
2931         (main): Print statistics for gdb index.
2932         * object.cc (Object::section_contents): Move code into
2933         do_section_contents.
2934         (need_decompressed_section): Check for sections needed when building
2935         gdb index.
2936         (build_compressed_section_map): Likewise.
2937         (Sized_relobj_file::do_read_symbols): Need local symbols when building
2938         gdb index.
2939         (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
2940         sections; call Layout::add_to_gdb_index.
2941         (Sized_relobj_file::do_decompressed_section_contents): Call
2942         do_section_contents directly.
2943         * object.h (Object::do_section_contents): Adjust parameter list and
2944         return type.
2945         (Object::do_decompressed_section_contents): Call do_section_contents
2946         directly.
2947         (Sized_relobj_file::do_section_contents): Adjust parameter list and
2948         return type.
2949         * options.h (class General_options): Add --gdb-index option.
2950         * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
2951         list and return type.
2952         * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
2953         * reloc.h (Track_relocs::checkpoint): New function.
2954         (Track_relocs::reset): New function.
2955
2956         * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
2957         New test cases.
2958         * testsuite/Makefile.in: Regenerate.
2959         * testsuite/gdb_index_test.cc: New test source file.
2960         * testsuite/gdb_index_test_1.sh: New test source file.
2961         * testsuite/gdb_index_test_2.sh: New test source file.
2962
2963 2012-03-19  Doug Kwan  <dougkwan@google.com>
2964
2965         * arm.cc (Target_arm::do_define_standard_symbols): New method.
2966         (Target_arm::do_finalize_sections): Remove code which defines
2967         __exidx_start and __exidx_end.  Make symbol table parameter
2968         anonymous as it is not used.
2969         * gold.cc (queue_middle_tasks): Call target hook to define any
2970         target-specific symbols.
2971         * target.h (Target::define_standard_symbols): New method.
2972         (Target::do_define_standard_symbols): Same.
2973         * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
2974         * testsuite/Makefile.in: Regenerate.
2975         * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
2976         and __exidx_end.
2977         * testsuite/arm_exidx_test.sh: Check that no unused dynamic
2978         relocations are generated for __exidx_start and __exidx_end.
2979
2980 2012-03-16  Doug Kwan  <dougkwan@google.com>
2981
2982         * testsuite/Makefile.am: Disable test initpri3b.
2983         * testsuite/Makefile.in: Regenerate.
2984
2985 2012-03-15  Doug Kwan  <dougkwan@google.com>
2986
2987         * arm.cc (Target_arm::got_section): Make .got section read-only
2988         if -z now is given.
2989
2990 2012-03-15  Ian Lance Taylor  <iant@google.com>
2991
2992         PR gold/13850
2993         * layout.cc (Layout::make_output_section): Correctly mark
2994         SHT_INIT_ARRAY, et. al., as relro.
2995
2996 2012-03-14  Doug Kwan  <dougkwan@google.com>
2997
2998         * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
2999         dynamic relocations for protected symbols in shared objects.
3000
3001 2012-03-13  Ian Lance Taylor  <iant@google.com>
3002
3003         * resolve.cc (Symbol_table::resolve): When merging common symbols,
3004         keep the larger alignment.
3005
3006 2012-03-12  Cary Coutant  <ccoutant@google.com>
3007
3008         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
3009         handling of DW_LNE_define_file.
3010
3011 2012-03-12  Cary Coutant  <ccoutant@google.com>
3012
3013         * reduced_debug_output.cc
3014         (Output_reduced_debug_info_section::get_die_end): Add new FORM
3015         codes to switch.
3016
3017 2012-02-29  Cary Coutant  <ccoutant@google.com>
3018
3019         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
3020
3021 2012-02-29  Cary Coutant  <ccoutant@google.com>
3022
3023         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
3024         Call Object::decompressed_section_contents.
3025         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
3026         New dtor.
3027         (Sized_dwarf_line_info::buffer_start_): New data member.
3028         * merge.cc (Output_merge_data::do_add_input_section): Call
3029         Object::decompressed_section_contents.
3030         (Output_merge_string::do_add_input_section): Likewise.
3031         * object.cc (need_decompressed_section): New function.
3032         (build_compressed_section_map): Decompress sections needed later.
3033         (Sized_relobj_file::do_decompressed_section_contents): New function.
3034         (Sized_relobj_file::do_discard_decompressed_sections): New function.
3035         * object.h (Object::decompressed_section_contents): New function.
3036         (Object::discard_decompressed_sections): New function.
3037         (Object::do_decompressed_section_contents): New function.
3038         (Object::do_discard_decompressed_sections): New function.
3039         (Compressed_section_info): New type.
3040         (Compressed_section_map): Include decompressed section contents.
3041         (Sized_relobj_file::do_decompressed_section_contents): New function.
3042         (Sized_relobj_file::do_discard_decompressed_sections): New function.
3043
3044 2012-02-16  Cary Coutant  <ccoutant@google.com>
3045
3046         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
3047         * testsuite/Makefile.in: Regenerate.
3048
3049 2012-02-14  Cary Coutant  <ccoutant@google.com>
3050
3051         * options.cc (General_options::finalize): Disallow -pie and -static.
3052
3053 2012-02-03  Doug Kwan  <dougkwan@google.com>
3054
3055         * arm.cc (Arm_relocate_functions::abs8,
3056         Arm_relocate_functions::abs16): Use
3057         Bits::has_signed_unsigned_overflow32.
3058         (Arm_relocate_functions::thm_abs8): Correct range of
3059         overflow check.
3060         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
3061         in assertions.
3062
3063 2012-02-02  Doug Kwan  <dougkwan@google.com>
3064
3065         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
3066         position independent outputs, not just shared objects.
3067
3068 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
3069
3070         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
3071         * configure: Regenerated.
3072
3073 2012-01-27  Ian Lance Taylor  <iant@google.com>
3074
3075         * reloc.h (Bits): New class with static functions, copied from
3076         namespace utils in arm.cc.
3077         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
3078         instead.
3079
3080 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
3081
3082         * incremental.cc (write_info_blocks): Correct relocation offset.
3083
3084 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
3085
3086         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
3087         (Relocate::tls_gd_to_le): Likewise.
3088
3089 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
3090
3091         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
3092
3093 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
3094
3095         * configure.ac: Check if -mcmodel=medium works.
3096         * configure: Regenerated.
3097
3098 2012-01-24  Cary Coutant  <ccoutant@google.com>
3099
3100         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
3101         definition and ...
3102         (read_unsigned_LEB_128_x): ... this new function.
3103         (read_signed_LEB_128): Replaced with inline definition and ...
3104         (read_signed_LEB_128_x): ... this new function.
3105         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
3106         (read_unsigned_LEB_128): Add inline definition.
3107         (read_signed_LEB_128_x): New function.
3108         (read_signed_LEB_128): Add inline definition.
3109         * testsuite/Makefile.am (leb128_unittest): New unit test.
3110         * testsuite/Makefile.in: Regenerate.
3111         * testsuite/leb128_unittest.cc: New unit test.
3112
3113 2012-01-23  Ian Lance Taylor  <iant@google.com>
3114
3115         PR gold/13617
3116         * i386.cc (Target_i386::do_code_fill): When using a jmp
3117         instruction, pad with nop instructions.
3118         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
3119
3120 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
3121
3122         * x86_64.cc (gc_process_relocs): Add typename on types used in
3123         template.
3124         (scan_relocs): Likewise.
3125         (relocate_section): Likewise.
3126         (apply_relocation): Likewise.
3127
3128 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
3129
3130         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
3131         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
3132         under x32.
3133
3134 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
3135
3136         * x86_64.cc: Initial support for x32.
3137
3138 2012-01-03  Cary Coutant  <ccoutant@google.com>
3139
3140         * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
3141         Use abstract base class for GOT.
3142         * gold/output.h (class Output_data_got_base): New abstract base class.
3143         (class Output_data_got): Derive from new base class, adjust ctors.
3144         (Output_data_got::reserve_slot): Make virtual; rename to
3145         do_reserve_slot; Adjust callers.
3146         * gold/target.h (Sized_target::init_got_plt_for_update): Return
3147         pointer to abstract base class.
3148         * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
3149
3150 2011-12-18  Ian Lance Taylor  <iant@google.com>
3151
3152         * object.h (Relobj::local_symbol_value): New function.
3153         (Relobj::local_plt_offset): New function.
3154         (Relobj::local_has_got_offset): New function.
3155         (Relobj::local_got_offset): New function.
3156         (Relobj::set_local_got_offset): New function.
3157         (Relobj::do_local_symbol_value): New pure virtual function.
3158         (Relobj::do_local_plt_offset): Likewise.
3159         (Relobj::do_local_has_got_offset): Likewise.
3160         (Relobj::do_local_got_offset): Likewise.
3161         (Relobj::do_set_local_got_offset): Likewise.
3162         (Sized_relobj::do_local_has_got_offset): Rename from
3163         local_has_got_offset.
3164         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
3165         (Sized_relobj::do_set_local_got_offset): Rename from
3166         set_local_got_offset.
3167         (Sized_relobj_file::do_local_plt_offset): Rename from
3168         local_plt_offset.
3169         (Sized_relobj_file::do_local_symbol_value): New function.
3170         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
3171         local_plt_offset.
3172         * output.cc (Output_data_got::Got_entry::write): Change object to
3173         Relobj.  Use local_symbol_value.
3174         (Output_data_got::add_global_with_rel): Change rel_dyn to
3175         Output_data_reloc_generic*.  Use add_global_generic.
3176         (Output_data_got::add_global_with_rela): Remove.  Change all
3177         callers to use add_global_with_rel.
3178         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
3179         Output_data_reloc_generic*.  Use add_global_generic.
3180         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
3181         callers to use add_global_pair_with_rel.
3182         (Output_data_got::add_local): Change object to Relobj*.
3183         (Output_data_got::add_local_plt): Likewise.
3184         (Output_data_got::add_local_with_rel): Change object to Relobj*,
3185         change rel_dyn to Output_data_reloc_generic*.  Use
3186         add_local_generic.
3187         (Output_data_got::add_local_with_rela): Remove.  Change all
3188         callers to use all_local_with_rel.
3189         (Output_data_got::add_local_pair_with_rel): Change object to
3190         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
3191         add_output_section_generic.
3192         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
3193         callers to use add_local_pair_with_rel.
3194         (Output_data_got::reserve_local): Change object to Relobj*.
3195         * output.h: (class Output_data_reloc_generic): Add pure virtual
3196         declarations for add_global_generic, add_local_generic,
3197         add_output_section_generic.
3198         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
3199         functions for Output_data_reloc_generic.  Update declarations for
3200         changes listed in output.cc.
3201         (class Output_data_got): Change template parameter to got_size.
3202         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
3203         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
3204         function.
3205         (Sized_relobj_incr::do_local_plt_offset): New function.
3206         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
3207         add_global_generic.
3208
3209 2011-12-17  Cary Coutant  <ccoutant@google.com>
3210
3211         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
3212         * resolve.cc (Symbol_table::resolve): Likewise.
3213         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
3214         arrays.
3215         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
3216
3217 2011-12-16  Ian Lance Taylor  <iant@google.com>
3218
3219         * output.h (Output_data_reloc_generic::add): Only call
3220         add_dynamic_reloc if this is a dynamic reloc section.
3221
3222 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
3223
3224         PR gold/13505
3225         * target-reloc.h (apply_relocation): Replace <64, false> with
3226         <size, big_endian>.
3227
3228 2011-11-25  Nick Clifton  <nickc@redhat.com>
3229
3230         * po/it.po: New Italian translation.
3231
3232 2011-11-17  Sterling Augustine  <saugustine@google.com>
3233
3234         * script.cc (script_include_directive): Implement.
3235         (read_script_file): New local variables name and search_path. Update
3236         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
3237         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
3238         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
3239
3240 2011-11-11  Sterling Augustine  <saugustine@google.com>
3241
3242         * yyscript.y (section_cmd): Add support for INCLUDE directive.
3243         (file_or_sections_cmd): Likewise.
3244
3245 2011-11-11  Doug Kwan  <dougkwan@google.com>
3246
3247         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
3248         if --just-symbols is given.
3249
3250 2011-11-10  Doug Kwan  <dougkwan@google.com>
3251
3252         PR gold/13362
3253         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
3254         when processing data relocs.
3255         * reloc.h (Relocate_functions::rel_unaligned): New method.
3256         (Relocate_functions::pcrel_unaligned): Ditto.
3257         (Relocate_functions::rel32_unaligned): Ditto.
3258         (Relocate_functions::pcrel32_unaligned): Ditto.
3259
3260 2011-11-09  Doug Kwan  <dougkwan@google.com>
3261
3262         PR gold/13362
3263         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
3264         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
3265         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
3266         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
3267         (Relocate_functions::rel_unaligned): New.
3268         (Relocate_functions::rel32_unaligned): New.
3269         * target-reloc.h (relocate_for_relocatable): Add code to handle
3270         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
3271         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
3272         arm_unaligned_reloc_r): New targets.
3273         * testsuite/Makefile.in: Regenerate.
3274         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
3275         linking.
3276
3277 2011-11-02  Ian Lance Taylor  <iant@google.com>
3278
3279         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
3280         NATIVE_LINKER.
3281         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
3282         * options.cc (General_options::finalize): Use library search path
3283         from configure script if specified.  If not native and no sysroot,
3284         only search TOOLLIBDIR.
3285         * options.h (Search_directory::Search_directory): Change name to
3286         const std::string&.
3287         (General_options::add_to_library_path_with_sysroot): Change arg to
3288         const std::string&.
3289         * configure, Makefile.in, config.in: Rebuild.
3290
3291 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
3292
3293         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
3294         we are working around the ARM1176 Erratum.
3295         * options.h (General_options::fix_arm1176): Add option.
3296         * testsuite/Makefile.am: Add testcases, and keep current ones
3297         working.
3298         * testsuite/Makefile.in: Regenerate.
3299         * testsuite/arm_fix_1176.s: New file.
3300         * testsuite/arm_fix_1176.sh: Likewise.
3301
3302 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
3303
3304         * arm.cc (Target_arm::Target_arm): Remove initialisation of
3305         may_use_blx_.
3306         (Target_arm::may_use_blx): Remove method.
3307         (Target_arm::set_may_use_blx): Likewise.
3308         (Target_arm::may_use_v4t_interworking): New method.
3309         (Target_arm::may_use_v5t_interworking): Likewise.
3310         (Target_arm::may_use_blx_): Remove member variable.
3311         (Arm_relocate_functions::arm_branch_common): Check for v5T
3312         interworking.
3313         (Arm_relocate_functions::thumb_branch_common): Likewise.
3314         (Reloc_stub::stub_type_for_reloc): Likewise.
3315         (Target_arm::do_finalize_sections): Correct interworking checks.
3316         * testsuite/Makefile.am: Add new tests.
3317         * testsuite/Makefile.in: Regenerate.
3318         * testsuite/arm_farcall_arm_arm.s: New test.
3319         * testsuite/arm_farcall_arm_arm.sh: Likewise.
3320         * testsuite/arm_farcall_arm_thumb.s: Likewise.
3321         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
3322         * testsuite/arm_farcall_thumb_arm.s: Likewise.
3323         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
3324         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
3325         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
3326
3327 2011-10-31  Cary Coutant  <ccoutant@google.com>
3328
3329         PR gold/13023
3330         * expression.cc (Expression::eval_with_dot): Add
3331         is_section_dot_assignment parameter.
3332         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
3333         absolute and assigning to dot within a section.
3334         * script-sections.cc
3335         (Output_section_element_assignment::set_section_addresses): Pass
3336         dot_section to set_if_absolute.
3337         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
3338         as is_section_dot_assignment flag to eval_with_dot.
3339         (Output_section_element_dot_assignment::set_section_addresses):
3340         Likewise.
3341         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
3342         parameter.  Also set value if relative to dot_section; set the
3343         symbol's output_section.
3344         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
3345         parameter.  Adjust all callers.
3346         (Expression::eval_maybe_dot): Likewise.
3347         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
3348         Adjust all callers.
3349         * testsuite/script_test_2.t: Test assignment of an absolute value
3350         to dot within an output section element.
3351
3352 2011-10-31  Cary Coutant  <ccoutant@google.com>
3353
3354         * options.h (class General_options): Add --[no-]gnu-unique options.
3355         * symtab.cc (Symbol_table::sized_write_globals): Convert
3356         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
3357
3358 2011-10-31  Cary Coutant  <ccoutant@google.com>
3359
3360         PR gold/13359
3361         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
3362         unnecessary assertion.
3363         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
3364
3365 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
3366
3367         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
3368         gc_mark_symbol.
3369         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
3370         gc_mark_symbol.
3371         Change to just keep the section associated with symbol.
3372         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
3373         they are externally visible and --export-dynamic is turned on.
3374         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
3375
3376 2011-10-19  Ian Lance Taylor  <iant@google.com>
3377
3378         PR gold/13163
3379         * script-sections.cc
3380         (Output_section_element_dot_assignment::needs_output_section): New
3381         function.
3382
3383 2011-10-19  Ian Lance Taylor  <iant@google.com>
3384
3385         PR gold/13204
3386         * layout.cc (Layout::segment_precedes): Don't assert failure if a
3387         --section-start option was seen.
3388         * options.h (General_options::any_section_start): New function.
3389
3390 2011-10-18  David S. Miller  <davem@davemloft.net>
3391
3392         PR binutils/13301
3393         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
3394         member to track relocation locations that have moved during TLS
3395         reloc optimizations.
3396         (Target_sparc::Relocate::Relocate): Initialize to NULL.
3397         (Target_sparc::Relocate::relocate): Adjust view down by 4
3398         bytes if it matches reloc_adjust_addr_.
3399         (Target_sparc::Relocate::relocate_tls): Always move the
3400         __tls_get_addr call delay slot instruction forward 4 bytes when
3401         performing relaxation.
3402
3403 2011-10-18  Cary Coutant  <ccoutant@google.com>
3404
3405         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
3406         (Output_file::map_no_anonymous): Check for non-zero
3407         return code from posix_fallocate.
3408
3409 2011-10-17  Cary Coutant  <ccoutant@google.com>
3410
3411         PR gold/13245
3412         * plugin.cc (is_visible_from_outside): Check for symbols
3413         referenced from dynamic objects.
3414         * resolve.cc (Symbol_table::resolve): Don't count references
3415         from dynamic objects as references from real ELF files.
3416         * testsuite/plugin_test_2.sh: Adjust expected result.
3417
3418 2011-10-17  Cary Coutant  <ccoutant@google.com>
3419
3420         * gold.cc: Include timer.h.
3421         (queue_middle_tasks): Stamp time.
3422         (queue_final_tasks): Likewise.
3423         * main.cc (main): Store timer in parameters.  Print timers
3424         for each pass.
3425         * parameters.cc (Parameters::Parameters): Initialize timer_.
3426         (Parameters::set_timer): New function.
3427         (set_parameters_timer): New function.
3428         * parameters.h (Parameters::set_timer): New function.
3429         (Parameters::timer): New function.
3430         (Parameters::timer_): New data member.
3431         (set_parameters_timer): New function.
3432         * timer.cc (Timer::stamp): New function.
3433         (Timer::get_pass_time): New function.
3434         * timer.h (Timer::stamp): New function.
3435         (Timer::get_pass_time): New function.
3436         (Timer::pass_times_): New data member.
3437
3438 2011-10-17  Cary Coutant  <ccoutant@google.com>
3439
3440         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
3441         task for members of lib groups.
3442
3443 2011-10-17  Cary Coutant  <ccoutant@google.com>
3444
3445         PR gold/13288
3446         * fileread.cc (File_read::find_view): Add assert.
3447         (File_read::make_view): Move bounds check (replace with assert)...
3448         (File_read::find_or_make_view): ... to here.
3449
3450 2011-10-12  Cary Coutant  <ccoutant@google.com>
3451
3452         * output.cc (Output_file::open_base_file): Handle case where
3453         ::read returns less than requested size.
3454
3455 2011-10-10  Cary Coutant  <ccoutant@google.com>
3456
3457         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
3458         Initialize defined_count_.
3459         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
3460         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
3461         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
3462         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
3463         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
3464         * incremental.h (Sized_relobj_incr::defined_count_): New data
3465         member.
3466         (Sized_incr_dynobj::defined_count_): New data member.
3467         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
3468         Return zeroes instead of internal error.
3469
3470 2011-10-10  Cary Coutant  <ccoutant@google.com>
3471
3472         PR gold/13249
3473         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
3474         (Output_reloc::symbol_value): Return PLT offset if flag is set.
3475         * output.h (class Output_reloc): Add use_plt_offset flag.
3476         (Output_reloc::type_): Adjust size of bit field.
3477         (Output_reloc::use_plt_offset_): New bit field.
3478         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
3479         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
3480         flag.  Adjust all callers.
3481         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
3482         creating RELATIVE relocations.
3483
3484 2011-10-10  Nick Clifton  <nickc@redhat.com>
3485
3486         * po/es.po: Updated Spanish translation.
3487         * po/fi.po: Updated Finnish translation.
3488
3489 2011-10-03   Diego Novillo  <dnovillo@google.com>
3490
3491         * options.cc (parse_uint): Fix dereference of RETVAL.
3492
3493 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
3494
3495         * layout.h (section_order_map_): New member.
3496         (get_section_order_map): New member function.
3497         * output.cc (Output_section::add_input_section): Check for patterns
3498         only when --section-ordering-file is specified.
3499         * gold.cc (queue_middle_tasks): Delay updating order of sections till
3500         output_sections have been formed.
3501         * layout.cc (Layout_Layout): Initialize section_order_map_.
3502         * plugin.cc (update_section_order): Store order in order_map. Do not
3503         update the order.
3504         * testsuite/Makefile.am: Add test case for plugin_final_layout.
3505         * testsuite/Makefile.in: Regenerate.
3506         * testsuite/plugin_section_order.c: New file.
3507         * testsuite/plugin_final_layout.cc: New file.
3508         * testsuite/plugin_final_layout.sh: New file.
3509
3510 2011-09-29  Cary Coutant  <ccoutant@google.com>
3511
3512         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
3513         Check for NULL.
3514         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
3515         symbols during incremental update.
3516         (Symbol_table::add_from_dynobj): Likewise.
3517
3518 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3519             Ian Lance Taylor  <iant@google.com>
3520
3521         * symtab.cc (Symbol_table::define_special_symbol): Always
3522         canonicalize version string.
3523
3524 2011-09-26  Cary Coutant  <ccoutant@google.com>
3525
3526         * gold.cc (queue_initial_tasks): Move option checks ...
3527         * options.cc (General_options::finalize): ... to here. Disable
3528         some options; make others fatal.
3529
3530 2011-09-26  Cary Coutant  <ccoutant@google.com>
3531
3532         gcc PR lto/47247
3533         * plugin.cc (get_symbols_v2): New function.
3534         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
3535         (is_referenced_from_outside): New function.
3536         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
3537         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
3538         (get_symbols): Pass version parameter.
3539         (get_symbols_v2): New function.
3540         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
3541         parameter.
3542         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
3543         (onload): Add LDPT_GET_SYMBOLS_V2.
3544         (all_symbols_read_hook): Use get_symbols_v2; check for
3545         LDPR_PREVAILING_DEF_IRONLY_EXP.
3546         * testsuite/plugin_test_3.sh: Update expected results.
3547
3548 2011-09-23  Simon Baldwin  <simonb@google.com>
3549
3550         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
3551         configuration options.
3552         * configure: Regenerate.
3553         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
3554         * Makefile.in: Regenerate.
3555         * testsuite/Makefile.in: Regenerate.
3556
3557 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
3558
3559         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
3560
3561 2011-09-19  Cary Coutant  <ccoutant@google.com>
3562
3563         * incremental.cc (can_incremental_update): Fix typo in comment.
3564         * incremental.h (can_incremental_update): Likewise.
3565
3566 2011-09-18  Cary Coutant  <ccoutant@google.com>
3567
3568         * incremental.cc (can_incremental_update): New function.
3569         * incremental.h (can_incremental_update): New function.
3570         * layout.cc (Layout::init_fixed_output_section): Call it.
3571         (Layout::make_output_section): Don't allow patch space in .eh_frame.
3572         * object.cc (Sized_relobj_file::do_layout): Call
3573         can_incremental_update.
3574
3575 2011-09-13  Cary Coutant  <ccoutant@google.com>
3576
3577         * configure.ac: Check for glibc support for gnu_indirect_function
3578         support with static linking, setting automake conditional
3579         IFUNC_STATIC.
3580         * Makefile.in: Regenerate.
3581         * configure: Regenerate.
3582
3583         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
3584         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
3585         for IFUNC_STATIC.
3586         * testsuite/Makefile.in: Regenerate.
3587
3588 2011-09-13  Cary Coutant  <ccoutant@google.com>
3589
3590         * incremental.cc (Sized_relobj_incr::do_layout): Call
3591         report_comdat_group for kept comdat sections.
3592         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
3593         * testsuite/Makefile.in: Regenerate.
3594         * testsuite/incr_comdat_test_1.cc: New source file.
3595         * testsuite/incr_comdat_test_2_v1.cc: New source file.
3596         * testsuite/incr_comdat_test_2_v2.cc: New source file.
3597         * testsuite/incr_comdat_test_2_v3.cc: New source file.
3598
3599 2011-09-13  Ian Lance Taylor  <iant@google.com>
3600
3601         * object.cc (Sized_relobj_file::do_layout): Remove unused local
3602         variable external_symbols_offset.
3603
3604 2011-09-12  Ian Lance Taylor  <iant@google.com>
3605
3606         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
3607         triggered if object has no symbols.
3608
3609 2011-09-09  David S. Miller  <davem@davemloft.net>
3610
3611         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
3612         (Output_fill_debug_line::do_write): Likewise.
3613
3614 2011-08-29  Cary Coutant  <ccoutant@google.com>
3615
3616         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
3617         casts to match formatting specs.
3618         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
3619
3620 2011-08-26  Cary Coutant  <ccoutant@google.com>
3621
3622         * layout.cc (Free_list::allocate): Provide guarantee of minimum
3623         remaining hole size when allocating.
3624         (Layout::make_output_section): Set fill methods for debug sections.
3625         * layout.h (Free_list::Free_list_node): Move from private to
3626         public.
3627         (Free_list::set_min_hole_size): New function.
3628         (Free_list::begin, Free_list::end): New functions.
3629         (Free_list::min_hole_): New data member.
3630         * output.cc: Include dwarf.h.
3631         (Output_fill_debug_info::do_minimum_hole_size): New function.
3632         (Output_fill_debug_info::do_write): New function.
3633         (Output_fill_debug_line::do_minimum_hole_size): New function.
3634         (Output_fill_debug_line::do_write): New function.
3635         (Output_section::Output_section): Initialize new data member.
3636         (Output_section::set_final_data_size): Ensure patch space is larger
3637         than minimum hole size.
3638         (Output_section::do_write): Fill holes in debug sections.
3639         * output.h (Output_fill): New class.
3640         (Output_fill_debug_info): New class.
3641         (Output_fill_debug_line): New class.
3642         (Output_section::set_free_space_fill): New function.
3643         (Output_section::free_space_fill_): New data member.
3644         * testsuite/Makefile.am (incremental_test_3): Add
3645         --incremental-patch option.
3646         (incremental_test_4): Likewise.
3647         (incremental_test_5): Likewise.
3648         (incremental_test_6): Likewise.
3649         (incremental_copy_test): Likewise.
3650         (incremental_common_test_1): Likewise.
3651         * testsuite/Makefile.in: Regenerate.
3652
3653 2011-08-26  Nick Clifton  <nickc@redhat.com>
3654
3655         * po/es.po: Updated Spanish translation.
3656
3657 2011-08-01  Cary Coutant  <ccoutant@google.com>
3658
3659         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
3660         * gold/testsuite/Makefile.in: Regenerate.
3661         * gold/testsuite/justsyms_exec.c: New source file.
3662         * gold/testsuite/justsyms_lib.c: New source file.
3663
3664 2011-08-01  Cary Coutant  <ccoutant@google.com>
3665
3666         * layout.cc (Layout::set_segment_offsets): Don't realign text
3667         segment if -Ttext was specified.
3668         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
3669         file type.
3670         * object.h (Sized_relobj_file::e_type): New function.
3671         (Sized_relobj_file::e_type_): New data member.
3672         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
3673         base address for ET_EXEC files.
3674         * target.cc (Target::do_make_elf_object_implementation): Allow
3675         ET_EXEC files with --just-symbols option.
3676
3677 2011-07-28  Cary Coutant  <ccoutant@google.com>
3678
3679         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
3680         Add thread_number parameter.
3681         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
3682         * workqueue-threads.cc
3683         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
3684         current thread if its thread number is greater than desired thread
3685         count.
3686         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
3687         Add thread_number parameter.
3688         (Workqueue::should_cancel_thread): Likewise.
3689         (Workqueue::find_runnable_or_wait): Pass thread_number to
3690         should_cancel_thread.
3691         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
3692         parameter.
3693
3694 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
3695
3696         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
3697         only after checking if it cannot be forced local.
3698         * symtab.h (is_externally_visible): Check if the symbol is not forced
3699         local.
3700
3701 2011-07-15  Ian Lance Taylor  <iant@google.com>
3702
3703         * options.h (class General_options): Add --print-output-format.
3704         Move -EL next to -EB, for  better --help output.
3705         * target-select.cc: Include <cstdio>, "options.h", and
3706         "parameters.h".
3707         (Target_selector::do_target_bfd_name): New function.
3708         (print_output_format): New function.
3709         * target-select.h (class Target_selector): Update declarations.
3710         (Target_selector::target_bfd_name): New function.
3711         (print_output_format): Declare.
3712         * main.cc: Include "target-select.h".
3713         (main): Handle --print-output-format.
3714         * gold.cc: Include "target-select.h".
3715         (queue_initial_tasks): Handle --print-output-format when there are
3716         no input files.
3717         * parameters.cc (parameters_force_valid_target): Give a better
3718         error message if -EB/-EL does not match target.
3719         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
3720         function.
3721
3722 2011-07-15  Ian Lance Taylor  <iant@google.com>
3723
3724         * i386.cc (class Output_data_plt_i386): Add layout_ field.
3725         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
3726         (Output_data_plt_i386::do_write): Write address of .dynamic
3727         section to first entry in .got.plt section.
3728         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
3729         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
3730         Initialize layout_.
3731         (Output_data_plt_x86_64::do_write): Write address of .dynamic
3732         section to first entry in .got.plt section.
3733         * layout.h (Layout::dynamic_section): New function.
3734
3735 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
3736
3737         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
3738         to claim_file call.
3739         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
3740         input_section_position_, and input_section_glob_.
3741         (read_layout_from_file): Call function section_ordering_specified.
3742         * layout.h (is_section_ordering_specified): New function.
3743         (section_ordering_specified): New function.
3744         (section_ordering_specified_): New boolean member.
3745         * main.cc(main): Call load_plugins after layout object is defined.
3746         * output.cc (Output_section::add_input_section): Use
3747         function section_ordering_specified to check if section ordering is
3748         needed.
3749         * output.cc (Output_section::add_relaxed_input_section): Use
3750         function section_ordering_specified to check if section ordering is
3751         needed.
3752         (Output_section::update_section_layout): New function.
3753         (Output_section::sort_attached_input_sections): Check if input section
3754         must be reordered.
3755         * output.h (Output_section::update_section_layout): New function.
3756         * plugin.cc (get_section_count): New function.
3757         (get_section_type): New function.
3758         (get_section_name): New function.
3759         (get_section_contents): New function.
3760         (update_section_order): New function.
3761         (allow_section_ordering): New function.
3762         (Plugin::load): Add the new interfaces to the transfer vector.
3763         (Plugin_manager::load_plugins): New parameter.
3764         (Plugin_manager::all_symbols_read): New parameter.
3765         (Plugin_manager::claim_file): New parameter. Save the elf object for
3766         unclaimed objects.
3767         (Plugin_manager::get_elf_object): New function.
3768         (Plugin_manager::get_view): Change to directly use the bool to check
3769         if get_view is called from claim_file_hook.
3770         * plugin.h (input_objects): New function
3771         (Plugin__manager::load_plugins): New parameter.
3772         (Plugin_manager::claim_file): New parameter.
3773         (Plugin_manager::get_elf_object): New function.
3774         (Plugin_manager::in_claim_file_handler): New function.
3775         (Plugin_manager::in_claim_file_handler_): New member.
3776         (layout): New function.
3777         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
3778         handler with an extra parameter. Make the elf object before calling
3779         claim_file handler.
3780         * testsuite/plugin_test.c (get_section_count): New function pointer.
3781         (get_section_type): New function pointer.
3782         (get_section_name): New function pointer.
3783         (get_section_contents): New function pointer.
3784         (update_section_order): New function pointer.
3785         (allow_section_ordering): New function pointer.
3786         (onload): Check if the new interfaces exist.
3787
3788 2011-07-13  Ian Lance Taylor  <iant@google.com>
3789
3790         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
3791         relro section.
3792         * x86_64.cc (Target_x86_64::got_section): Likewise.
3793         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
3794         (relro_now_test_SOURCES): New variable.
3795         (relro_now_test_DEPENDENCIES): New variable.
3796         (relro_now_test_LDFLAGS): New variable.
3797         (relro_now_test_LDADD): New variable.
3798         (relro_now_test.so): New target.
3799         * testsuite/Makefile.in: Rebuild.
3800
3801 2011-07-12  Ian Lance Taylor  <iant@google.com>
3802
3803         PR gold/12980
3804         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
3805         GLOB_DAT relocation rather than a RELATIVE relocation for a
3806         protected symbol when creating a shared library.
3807         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
3808         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
3809         * testsuite/protected_main_1.cc (main): Test that protected
3810         function has same address.
3811
3812 2011-07-11  Ian Lance Taylor  <iant@google.com>
3813
3814         PR gold/12979
3815         * options.h (class General_options): Add -Bgroup.
3816         * options.cc (General_options::finalize): If -Bgroup is set,
3817         default to --unresolved-symbols=report-all.
3818         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
3819         * target-reloc.h (issue_undefined_symbol_error): Handle
3820         --unresolved-symbols=report-all.
3821
3822 2011-07-08  Ian Lance Taylor  <iant@google.com>
3823
3824         PR gold/11985
3825         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
3826         if linker script discards key sections.
3827         (Layout::create_dynamic_symtab): Likewise.
3828         (Layout::assign_local_dynsym_offsets): Likewise.
3829         (Layout::sized_create_version_sections): Likewise.
3830         (Layout::create_interp): Likewise.
3831         (Layout::finish_dynamic_section): Likewise.
3832         (Layout::set_dynamic_symbol_size): Likewise.
3833
3834 2011-07-08  Ian Lance Taylor  <iant@google.com>
3835
3836         PR gold/12386
3837         * options.h (class General_options): Add --unresolved-symbols.
3838         * target-reloc.h (issue_undefined_symbol_error): Check
3839         --unresolved-symbols.  Add comments.
3840
3841 2011-07-08  Ian Lance Taylor  <iant@google.com>
3842
3843         * testsuite/odr_violation2.cc (Ordering::operator()): Make
3844         expression more complex.
3845
3846 2011-07-08  Ian Lance Taylor  <iant@google.com>
3847
3848         PR gold/11317
3849         * target-reloc.h (issue_undefined_symbol_error): New inline
3850         function, broken out of relocate_section.
3851         (relocate_section): Call issue_undefined_symbol_error.
3852         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
3853         there is no TLS segment if we are about to issue an undefined
3854         symbol error.
3855         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
3856
3857 2011-07-08  Ian Lance Taylor  <iant@google.com>
3858
3859         PR gold/12279
3860         * resolve.cc (Symbol_table::should_override): Add fromtype
3861         parameter.  Change all callers.  Give error when linking together
3862         TLS and non-TLS symbol.
3863         (Symbol_table::should_override_with_special): Add fromtype
3864         parameter.  Change all callers.
3865         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
3866         there is no TLS segment if we have reported some errors.
3867         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
3868
3869 2011-07-08  Ian Lance Taylor  <iant@google.com>
3870
3871         PR gold/12372
3872         * target.h (Target::plt_address_for_global): New function.
3873         (Target::plt_address_for_local): New function.
3874         (Target::plt_section_for_global): Remove.
3875         (Target::plt_section_for_local): Remove.
3876         (Target::do_plt_address_for_global): New virtual function.
3877         (Target::do_plt_address_for_local): New virtual function.
3878         (Target::do_plt_section_for_global): Remove.
3879         (Target::do_plt_section_for_local): Remove.
3880         (Target::register_global_plt_entry): Add Symbol_table and Layout
3881         parameters.
3882         * output.cc (Output_data_got::Got_entry::write): Use
3883         plt_address_for_global and plt_address_for_local.
3884         * layout.cc (Layout::add_target_dynamic_tags): Use size and
3885         address of output section.
3886         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
3887         got_irelative_, and irelative_count_ fields.  Update
3888         declarations.
3889         (Output_data_plt_i386::has_irelative_section): New function.
3890         (Output_data_plt_i386::entry_count): Add irelative_count_.
3891         (Output_data_plt_i386::set_final_data_size): Likewise.
3892         (class Target_i386): Add got_irelative_ and rel_irelative_
3893         fields.  Update declarations.
3894         (Target_i386::Target_i386): Initialize new fields.
3895         (Target_i386::do_plt_address_for_global): New function replacing
3896         do_plt_section_for_global.
3897         (Target_i386::do_plt_address_for_local): New function replacing
3898         do_plt_section_for_local.
3899         (Target_i386::got_section): Create got_irelative_.
3900         (Target_i386::rel_irelative_section): New function.
3901         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
3902         fields.  Don't define __rel_iplt_{start,end}.
3903         (Output_data_plt_i386::add_entry): Add symtab and layout
3904         parameters.  Change all callers.  Use different PLT and GOT for
3905         IFUNC symbols.
3906         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
3907         layout parameters.  Change all callers.  Use different PLT and
3908         GOT.
3909         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
3910         (Output_data_plt_i386::rel_irelative): New function.
3911         (Output_data_plt_i386::address_for_global): New function.
3912         (Output_data_plt_i386::address_for_local): New function.
3913         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
3914         IRELATIVE GOT when changing IFUNC GOT entries.
3915         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
3916         reloc.
3917         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
3918         if we didn't create an IRELATIVE GOT.
3919         (Target_i386::Relocate::relocate): Use plt_address_for_global and
3920         plt_address_for_local.
3921         (Target_i386::do_dynsym_value): Use plt_address_for_global.
3922         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
3923         got_irelative_, and irelative_count_ fields.  Update
3924         declarations.
3925         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
3926         Initialize new fields.  Remove symtab parameter.  Change all
3927         callers.
3928         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
3929         irelative_count_.
3930         (Output_data_plt_x86_64::has_irelative_section): New function.
3931         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
3932         (class Target_x86_64): Add got_irelative_ and rel_irelative_
3933         fields.  Update declarations.
3934         (Target_x86_64::Target_x86_64): Initialize new fields.
3935         (Target_x86_64::do_plt_address_for_global): New function replacing
3936         do_plt_section_for_global.
3937         (Target_x86_64::do_plt_address_for_local): New function replacing
3938         do_plt_section_for_local.
3939         (Target_x86_64::got_section): Create got_irelative_.
3940         (Target_x86_64::rela_irelative_section): New function.
3941         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
3942         all callers.  Don't create __rel_iplt_{start,end}.
3943         (Output_data_plt_x86_64::add_entry): Add symtab and layout
3944         parameters.  Change all callers.  Use different PLT and GOT for
3945         IFUNC symbols.
3946         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
3947         layout parameters.  Change all callers.  Use different PLT and
3948         GOT.
3949         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
3950         parameters.  Change all callers.  Use different PLT and GOT for
3951         IFUNC symbols.
3952         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
3953         (Output_data_plt_x86_64::rela_irelative): New function.
3954         (Output_data_plt_x86_64::address_for_global): New function.
3955         (Output_data_plt_x86_64::address_for_local): New function.
3956         (Output_data_plt_x86_64::set_final_data_size): Likewise.
3957         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
3958         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
3959         (Target_x86_64::register_global_plt_entry): Add symtab and layout
3960         parameters.
3961         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
3962         reloc.
3963         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
3964         symbols if we didn't create an IRELATIVE GOT.
3965         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
3966         plt_address_for_local.
3967         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
3968         * testsuite/ifuncvar1.c: New test file.
3969         * testsuite/ifuncvar2.c: New test file.
3970         * testsuite/ifuncvar3.c: New test file.
3971         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
3972         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
3973         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
3974         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
3975         * testsuite/Makefile.in: Rebuild.
3976
3977 2011-07-07  Cary Coutant  <ccoutant@google.com>
3978
3979         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
3980         (two_file_test_1_ndebug.o): Likewise.
3981         (two_file_test_1b_ndebug.o): Likewise.
3982         (two_file_test_2_ndebug.o): Likewise.
3983         (two_file_test_main_ndebug.o): Likewise.
3984         (incremental_test_2): Link with no-debug versions.
3985
3986 2011-07-06  Cary Coutant  <ccoutant@google.com>
3987
3988         * gold/incremental.cc
3989         (Output_section_incremental_inputs::write_info_blocks): Check for
3990         hidden and internal symbols.
3991
3992 2011-07-06  Cary Coutant  <ccoutant@google.com>
3993
3994         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
3995         Check disposition for startup file.
3996         (Incremental_inputs::report_command_line): Ignore
3997         --incremental-startup-unchanged option.
3998         * options.cc (General_options::parse_incremental_startup_unchanged):
3999         New function.
4000         (General_options::General_options): Initialize new data member.
4001         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
4002         (General_options): Add --incremental-startup-unchanged option.
4003         (General_options::incremental_startup_disposition): New function.
4004         (General_options::incremental_startup_disposition_): New data member.
4005
4006 2011-07-06  Cary Coutant  <ccoutant@google.com>
4007
4008         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
4009         input file index to Script_info ctor.
4010         (Sized_incremental_binary::do_file_has_changed): Find the
4011         command-line argument for files named in scripts.
4012         * incremental.h (Script_info::Script_info): New ctor
4013         with input file index.
4014         (Script_info::input_file_index): New function.
4015         (Script_info::input_file_index_): New data member.
4016         (Incremental_binary::get_library): Add const.
4017         (Incremental_binary::get_script_info): Add const.
4018         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
4019         * testsuite/Makefile.am (incremental_test_5): New test case.
4020         (incremental_test_6): New test case.
4021         * testsuite/Makefile.in: Regenerate.
4022
4023 2011-07-06  Cary Coutant  <ccoutant@google.com>
4024
4025         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
4026         debug output when command lines differ.
4027
4028 2011-07-06  Cary Coutant  <ccoutant@google.com>
4029
4030         * incremental.cc (Incremental_inputs::report_command_line): Ignore
4031         --incremental-patch option.
4032         * layout.cc (Free_list::allocate): Extend allocation beyond original
4033         end if enabled.
4034         (Layout::make_output_section): Mark sections that should get
4035         patch space.
4036         * options.cc (parse_percent): New function.
4037         * options.h (parse_percent): New function.
4038         (DEFINE_percent): New macro.
4039         (General_options): Add --incremental-patch option.
4040         * output.cc (Output_section::Output_section): Initialize new data
4041         members.
4042         (Output_section::add_input_section): Print section name when out
4043         of patch space.
4044         (Output_section::add_output_section_data): Likewise.
4045         (Output_section::set_final_data_size): Add patch space when
4046         doing --incremental-full.
4047         (Output_section::do_reset_address_and_file_offset): Remove patch
4048         space.
4049         (Output_segment::set_section_list_addresses): Print debug output
4050         only if --incremental-update.
4051         * output.h (Output_section::set_is_patch_space_allowed): New function.
4052         (Output_section::is_patch_space_allowed_): New data member.
4053         (Output_section::patch_space_): New data member.
4054         * parameters.cc (Parameters::incremental_full): New function.
4055         * parameters.h (Parameters::incremental_full): New function
4056         * testsuite/Makefile.am (incremental_test_2): Add test for
4057         --incremental-patch option.
4058         * testsuite/Makefile.in: Regenerate.
4059         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
4060         (t18): Remove function body.
4061
4062 2011-07-05  Doug Kwan  <dougkwan@google.com>
4063
4064         PR gold/12771
4065         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
4066         Arm_Address type for relocation result.
4067         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
4068         overflow check.
4069         (Arm_relocate_functions::abs32): Use unaligned access.
4070         (Arm_relocate_functions::rel32): Ditto.
4071         (Arm_relocate_functions::prel31): Ditto.
4072         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
4073         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
4074         static data relocations.
4075         * testsuite/Makefile.in: Regnerate.
4076         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
4077
4078 2011-07-05  Ian Lance Taylor  <iant@google.com>
4079
4080         PR gold/12392
4081         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
4082         symbols if necessary.
4083         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
4084
4085 2011-07-05  Ian Lance Taylor  <iant@google.com>
4086
4087         PR gold/12952
4088         * resolve.cc (Symbol::override_base_with_special): Simply override
4089         version with special symbol version, ignoring previous version.
4090
4091 2011-07-05  Ian Lance Taylor  <iant@google.com>
4092
4093         * object.cc (Sized_relobj_file::include_section_group): Add
4094         information to comment about signature location.
4095
4096 2011-07-02  Ian Lance Taylor  <iant@google.com>
4097
4098         PR gold/12957
4099         * options.h (class General_options): Add -f and -F.
4100         * options.cc (General_options::finalize): Fatal error if -f/-F
4101         are used without -shared.
4102         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
4103
4104 2011-07-02  Ian Lance Taylor  <iant@google.com>
4105
4106         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
4107
4108 2011-07-01  Ian Lance Taylor  <iant@google.com>
4109
4110         PR gold/12525
4111         PR gold/12952
4112         * resolve.cc (Symbol::override_base_with_special): Don't override
4113         the version if the overriding symbol has a different name.
4114         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
4115         all callers.  If we give an error about an undefined version,
4116         define the base version if necessary.
4117         * dynobj.h (class Versions): Update declaration.
4118         * testsuite/weak_alias_test_5.cc: New file.
4119         * testsuite/weak_alias_test.script: New file.
4120         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
4121         and versioned_alias have the right value, and call t2.
4122         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
4123         weak_alias_test_5.so.
4124         (weak_alias_test_LDADD): Likewise.
4125         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
4126         * testsuite/Makefile.in: Rebuild.
4127
4128 2011-07-01  Ian Lance Taylor  <iant@google.com>
4129
4130         PR gold/12525
4131         * options.h (class General_options): Support -z notext.
4132         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
4133         -Wl,-z,notext.
4134         (two_file_shared_nonpic.so): Likewise.
4135         (two_file_shared_mixed.so): Likewise.
4136         (two_file_shared_mixed_1.so): Likewise.
4137         (weak_undef_lib_nonpic.so): Likewise.
4138         (alt/weak_undef_lib_nonpic.so): Likewise.
4139         (tls_test_shared_nonpic.so): Likewise.
4140         * testsuite/Makefile.in: Rebuild.
4141
4142 2011-07-01  Ian Lance Taylor  <iant@google.com>
4143
4144         PR gold/12525
4145         * configure.ac: Test whether static linking works, setting
4146         the automake conditional HAVE_STATIC.
4147         * testsuite/Makefile.am: Disable tests using -static if
4148         HAVE_STATIC is not true.
4149         * configure, testsuite/Makefile.in: Rebuild.
4150
4151 2011-07-01  Ian Lance Taylor  <iant@google.com>
4152
4153         PR gold/12525
4154         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
4155         Assert if we see DW_EH_PE_indirect.
4156         * target.h (Target::ehframe_datarel_base): New function.
4157         (Target::do_ehframe_datarel_base): New target function.
4158         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
4159         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
4160         function.
4161
4162 2011-07-01  Ian Lance Taylor  <iant@google.com>
4163
4164         PR gold/12571
4165         * options.h (class General_options): Add
4166         --ld-generated-unwind-info.
4167         * ehframe.cc (Fde::write): Add address parameter.  Change all
4168         callers.  If associated with PLT, fill in address and size.
4169         (Cie::set_output_offset): Only add merge mapping if there is an
4170         object.
4171         (Cie::write): Add address parameter.  Change all callers.
4172         (Eh_frame::add_ehframe_for_plt): New function.
4173         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
4174         input_offset_ fields into union u_, with new plt field.
4175         (Fde::Fde): Adjust for new union field.
4176         (Fde::Fde) [Output_data version]: New constructor.
4177         (Fde::add_mapping): Only add merge mapping if there is an object.
4178         (class Cie): Update declarations.
4179         (class Eh_frame): Declare add_ehframe_for_plt.
4180         * layout.cc (Layout::layout_eh_frame): Break out code into
4181         make_eh_frame_section, and call it.
4182         (Layout::make_eh_frame_section): New function.
4183         (Layout::add_eh_frame_for_plt): New function.
4184         * layout.h (class Layout): Update declarations.
4185         * merge.cc (Merge_map::add_mapping): Add assertion.
4186         * i386.cc: Include "dwarf.h".
4187         (class Output_data_plt_i386): Make first_plt_entry,
4188         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
4189         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
4190         and plt_eh_frame_fde.
4191         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
4192         boundary.  Call add_eh_frame_for_plt if appropriate.
4193         * x86_64.cc: Include "dwarf.h".
4194         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
4195         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
4196         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
4197         and plt_eh_frame_fde.
4198         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
4199         appropriate.
4200
4201 2011-06-29  Ian Lance Taylor  <iant@google.com>
4202
4203         PR gold/12629
4204         * object.cc (Sized_relobj_file::layout_section): Change shdr
4205         parameter to be const.
4206         (Sized_relobj_file::layout_eh_frame_section): New function, broken
4207         out of do_layout.
4208         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
4209         appropriate.  Call layout_eh_frame_section.
4210         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
4211         sections.
4212         * object.h (class Sized_relobj_file): Update declarations.
4213
4214 2011-06-29  Ian Lance Taylor  <iant@google.com>
4215
4216         PR gold/12652
4217         * script.cc (Token::integer_value): Accept trailing M/m/K/k
4218         modifier.
4219         (Lex::gather_token): Accept trailing M/m/K/k for integers.
4220
4221 2011-06-29  Ian Lance Taylor  <iant@google.com>
4222
4223         PR gold/12675
4224         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
4225         SHT_X86_64_UNWIND.
4226         * layout.cc (Layout::layout_eh_frame): Likewise.
4227
4228 2011-06-29  Ian Lance Taylor  <iant@google.com>
4229
4230         PR gold/12695
4231         * layout.cc (Layout::symtab_section_shndx): New function.
4232         * layout.h (class Layout): Declare symtab_section_shndx.
4233         * output.cc (Output_section::write_header): Call it.
4234
4235 2011-06-29  Ian Lance Taylor  <iant@google.com>
4236
4237         PR gold/12818
4238         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
4239         symbols which are not used in a relocation.
4240
4241 2011-06-28  Ian Lance Taylor  <iant@google.com>
4242
4243         PR gold/12898
4244         * layout.cc (Layout::segment_precedes): Don't crash if a linker
4245         script create indistinguishable segments.
4246         (Layout::set_segment_offsets): Use stable_sort when sorting
4247         segments.  Pass this to Compare_segments constructor.
4248         * layout.h (class Layout): Make segment_precedes non-static.
4249         (class Compare_segments): Change from struct to class.  Add
4250         layout_ field.  Add constructor.
4251         * script-sections.cc
4252         (Script_sections::attach_sections_using_phdrs_clause): Rename
4253         local orphan to is_orphan.  Don't report failure to put empty
4254         section in segment.  On attachment failure, report name of
4255         section, and attach to first PT_LOAD segment.
4256
4257 2011-06-28  Ian Lance Taylor  <iant@google.com>
4258
4259         PR gold/12934
4260         * target-select.cc (Target_selector::Target_selector): Add
4261         emulation parameter.  Change all callers.
4262         (select_target_by_bfd_name): Rename from select_target_by_name.
4263         Change all callers.
4264         (select_target_by_emulation): New function.
4265         (supported_emulation_names): New function.
4266         * target-select.h (class Target_selector): Add emulation_ field.
4267         Update declarations.
4268         (Target_selector::recognize_by_bfd_name): Rename from
4269         recognize_by_name.  Change all callers.
4270         (Target_selector::supported_bfd_names): Rename from
4271         supported_names.  Change all callers.
4272         (Target_selector::recognize_by_emulation): New function.
4273         (Target_selector::supported_emulations): New function.
4274         (Target_selector::emulation): New function.
4275         (Target_selector::do_recognize_by_bfd_name): Rename from
4276         do_recognize_by_name.  Change all callers.
4277         (Target_selector::do_supported_bfd_names): Rename from
4278         do_supported_names.  Change all callers.
4279         (Target_selector::do_recognize_by_emulation): New function.
4280         (Target_selector::do_supported_emulations): New function.
4281         (select_target_by_bfd_name): Change name in declaration.
4282         (select_target_by_emulation): Declare.
4283         (supported_emulation_names): Declare.
4284         * parameters.cc (parameters_force_valid_target): Try to find
4285         target based on emulation from -m option.
4286         * options.h (class General_options): Change doc string for -m.
4287         * options.cc (help): Print emulations.
4288         (General_options::parse_V): Likewise.
4289         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
4290         Add emulation parameter.  Change all callers.
4291
4292 2011-06-28  Ian Lance Taylor  <iant@google.com>
4293
4294         * target.h (class Target): Add osabi_ field.
4295         (Target::osabi): New function.
4296         (Target::set_osabi): New function.
4297         (Target::Target): Initialize osabi_.
4298         (Target::do_adjust_elf_header): Make pure virtual.
4299         (Sized_target::do_adjust_elf_header): Declare.
4300         * target.cc (Sized_target::do_adjust_elf_header): New function.
4301         (class Sized_target): Instantiate all versions.
4302         * freebsd.h (class Target_freebsd): Remove.
4303         (Target_selector_freebsd::do_recognize): Call set_osabi on
4304         Target.
4305         (Target_selector_freebsd::do_recognize_by_name): Likewise.
4306         (Target_selector_freebsd::set_osabi): Remove.
4307         * i386.cc (class Target_i386): Inherit from Sized_target rather
4308         than Target_freebsd.
4309         * x86_64.cc (class Target_x86_64): Likewise.
4310
4311 2011-06-28  Ian Lance Taylor  <iant@google.com>
4312
4313         * target.h (Target::can_check_for_function_pointers): Rewrite.
4314         Make non-virtual.
4315         (Target::can_icf_inline_merge_sections): Likewise.
4316         (Target::section_may_have_icf_unsafe_poineters): Likewise.
4317         (Target::Target_info): Add can_icf_inline_merge_sections field.
4318         (Target::do_can_check_for_function_pointers): New virtual
4319         function.
4320         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
4321         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
4322         from can_check_for_function_pointers, move in file.
4323         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
4324         section_may_have_icf_unsafe_poineters, move in file.
4325         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
4326         * i386.cc (Target_i386::do_can_check_for_function_pointers):
4327         Rename from can_check_for_function_pointers, move in file.
4328         (Target_i386::can_icf_inline_merge_sections): Remove.
4329         (Target_i386::i386_info): Initialize
4330         can_icf_inline_merge_sections.
4331         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
4332         Initialize can_icf_inline_merge_sections.
4333         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
4334         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
4335         Rename from can_check_for_function_pointers, move in file.
4336         (Target_x86_64::can_icf_inline_merge_sections): Remove.
4337         (Target_x86_64::x86_64_info): Initialize
4338         can_icf_inline_merge_sections.
4339         * testsuite/testfile.cc (Target_test::test_target_info):
4340         Likewise.
4341         * icf.cc (get_section_contents): Correct formatting.
4342
4343 2011-06-27  Ian Lance Taylor  <iant@google.com>
4344
4345         * symtab.cc (Symbol::versioned_name): New function.
4346         (Symbol_table::add_to_final_symtab): Use versioned_name when
4347         appropriate.
4348         (Symbol_table::sized_write_symbol): Likewise.
4349         * symtab.h (class Symbol): Declare versioned_name.
4350         * stringpool.h (class Stringpool_template): Add variant of add
4351         which takes a std::basic_string.
4352         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
4353         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
4354         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
4355         (ver_test_12.o): New target.
4356         * testsuite/Makefile.in: Rebuild.
4357
4358 2011-06-27  Doug Kwan  <dougkwan@google.com>
4359
4360         * arm.cc (Arm_relocate_functions::thm_jump8,
4361         Arm_relocate_functions::thm_jump11): Use a wider signed
4362         type to compute offset.
4363         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
4364         arm_thm_jump8.
4365         * testsuite/Makefile.in: Regenerate.
4366         * testsuite/arm_branch_in_range.sh: Check test results of
4367         arm_thm_jump11 and arm_thm_jump8.
4368         * testsuite/arm_thm_jump11.s: New test source file.
4369         * testsuite/arm_thm_jump11.t: New linker script.
4370         * testsuite/arm_thm_jump8.s: New test source file.
4371         * testsuite/arm_thm_jump8.t: New linker script.
4372
4373 2011-06-24  Ian Lance Taylor  <iant@google.com>
4374
4375         * layout.cc: Include "object.h".
4376         (ctors_sections_in_init_array): New static variable.
4377         (Layout::is_ctors_in_init_array): New function.
4378         (Layout::layout): Add entry to ctors_sections_in_init_array if
4379         appropriate.
4380         * layout.h (class Layout): Declare is_ctors_in_init_array.
4381         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
4382         is_ctors_reverse_view is set.
4383         (Sized_relobj_file::write_sections): Add layout parameter.  Change
4384         all callers.  Set is_ctors_reverse_view field of View_size.
4385         (Sized_relobj_file::reverse_words): New function.
4386         * object.h (Sized_relobj_file::View_size): Add
4387         is_ctors_reverse_view field.
4388         (class Sized_relobj_file): Update declarations.
4389         * testsuite/initpri3.c: New test.
4390         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
4391         initpri3b.
4392         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
4393         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
4394         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
4395         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
4396         * testsuite/Makefile.in: Rebuild.
4397
4398 2011-06-24  Cary Coutant  <ccoutant@google.com>
4399
4400         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
4401         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
4402         (debug_msg_cdebug.err): New targets.
4403         * testsuite/Makefile.in: Regenerate.
4404         * testsuite/debug_msg.sh: Check output of link with compressed debug.
4405         Fix checks for link with shared library.
4406
4407 2011-06-24  Doug Kwan  <dougkwan@google.com>
4408
4409         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
4410         skip empty text sections.
4411         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
4412
4413 2011-06-22  Ian Lance Taylor  <iant@google.com>
4414
4415         PR gold/12910
4416         * options.h (class General_options): Add --ctors-in-init-array.
4417         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
4418         friends as SHT_PROGBITS for merging sections.
4419         (Layout::layout): Remove special handling of .init_array and
4420         friends.  Don't sort if doing relocatable link.  Sort for .ctors
4421         and .dtors if ctors_in_init_array.
4422         (Layout::make_output_section): Force correct section types for
4423         .init_array and friends.  Don't sort if doing relocatable link,
4424         Don't sort .ctors and .dtors if ctors_in_init_array.
4425         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
4426         (Layout::output_section_name): Add relobj parameter.  Change all
4427         callers.  Handle .ctors. and .dtors. in code rather than table.
4428         Handle .ctors and .dtors if ctors_in_init_array.
4429         (Layout::match_file_name): New function, moved from output.cc.
4430         * layout.h (class Layout): Update declarations.
4431         * output.cc: Include "layout.h".
4432         (Input_section_sort_entry::get_priority): New function.
4433         (Input_section_sort_entry::match_file_name): Just call
4434         Layout::match_file_name.
4435         (Output_section::Input_section_sort_init_fini_compare::operator()):
4436         Handle .ctors and .dtors.  Sort by explicit priority rather than
4437         by name.
4438         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
4439         * testsuite/initpri2.c: New test.
4440         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
4441         (check_PROGRAMS): Add initpri2.
4442         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
4443         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
4444         * configure, testsuite/Makefile.in: Rebuild.
4445
4446 2011-06-19  Ian Lance Taylor  <iant@google.com>
4447
4448         PR gold/12880
4449         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
4450         .interp section to a PT_INTERP segment even if we have seen a
4451         --dynamic-linker option.  Don't do it if we have seen a PHDRS
4452         clause in a linker script.
4453         (Layout::finalize): Don't create a .interp section if we've
4454         already create a PT_INTERP segment.
4455         (Layout::create_interp): Always call choose_output_section (revert
4456         patch of 2011-06-17).  Don't create PT_INTERP segment.
4457         * script-sections.cc
4458         (Script_sections::create_note_and_tls_segments): Add a .interp
4459         section to a PT_INTERP segment even if we have seen a
4460         --dynamic-linker option.
4461
4462 2011-06-18  Ian Lance Taylor  <iant@google.com>
4463
4464         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
4465         merely because a non-PT_LOAD segment has a dynamic reloc.
4466
4467 2011-06-18  Ian Lance Taylor  <iant@google.com>
4468
4469         * layout.cc (Layout::finish_dynamic_section): Don't create
4470         DT_FLAGS entry if not needed.
4471
4472 2011-06-18  Ian Lance Taylor  <iant@google.com>
4473
4474         PR gold/12745
4475         * layout.cc (Layout::layout_eh_frame): Correct handling of
4476         writable .eh_frame section.
4477
4478 2011-06-17  Ian Lance Taylor  <iant@google.com>
4479
4480         PR gold/12893
4481         * resolve.cc (Symbol_table::resolve): Don't give an error if a
4482         symbol is redefined with the exact same object and value.
4483
4484 2011-06-17  Ian Lance Taylor  <iant@google.com>
4485
4486         PR gold/12880
4487         * layout.h (class Layout): Add interp_segment_ field.
4488         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
4489         (Layout::attach_allocated_section_to_segment): If making shared
4490         library, put .interp section in PT_INTERP segment.
4491         (Layout::finalize): Also call create_interp if -dynamic-linker
4492         option was used.
4493         (Layout::create_interp): Assert that there is no PT_INTERP
4494         segment.  If not using a SECTIONS clause, use make_output_section.
4495         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
4496         * script-sections.cc
4497         (Script_sections::create_note_and_tls_segments): If making shared
4498         library, put .interp section in PT_INTERP segment.
4499
4500 2011-06-17  Ian Lance Taylor  <iant@google.com>
4501
4502         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
4503         when making a shared library.
4504
4505 2011-06-17  Ian Lance Taylor  <iant@google.com>
4506
4507         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
4508         parameter.  Change all callers.  Don't issue warning about PC32
4509         against locally defined symbol.
4510
4511 2011-06-16  Ian Lance Taylor  <iant@google.com>
4512
4513         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
4514         occurs in same object.
4515
4516 2011-06-14  Alan Modra  <amodra@gmail.com>
4517
4518         * po/POTFILES.in: Regenerate.
4519
4520 2011-06-09  Ian Lance Taylor  <iant@google.com>
4521
4522         * script-sections.cc
4523         (Orphan_output_section::set_section_addresses): For a relocatable
4524         link set address to 0.
4525
4526 2011-06-09  Cary Coutant  <ccoutant@google.com>
4527
4528         PR gold/12804
4529         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
4530         used with --compress-debug-sections.
4531         * gold/object.cc (Sized_relobj_file::do_layout): Report
4532         uncompressed size of compressed input sections.
4533
4534 2011-06-08  Cary Coutant  <ccoutant@google.com>
4535
4536         PR gold/12804
4537         * testsuite/two_file_test_2_v1.cc: Change initialization of
4538         v2 to keep it in .data.
4539
4540 2011-06-07  Cary Coutant  <ccoutant@google.com>
4541
4542         * common.cc (Symbol_table::do_allocate_commons_list): Call
4543         gold_fallback.
4544         * errors.cc (Errors::fatal): Adjust call to gold_exit.
4545         (Errors::fallback): New function.
4546         (gold_fallback): New function.
4547         * errors.h (Errors::fallback): New function.
4548         * gold.cc (gold_exit): Change status parameter to enum; adjust
4549         all callers.
4550         (queue_initial_tasks): Call gold_fallback.
4551         * gold.h: Include cstdlib.
4552         (Exit_status): New enum type.
4553         (gold_exit): Change status parameter to enum.
4554         (gold_fallback): New function.
4555         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
4556         (Layout::create_symtab_sections): Likewise.
4557         (Layout::create_shdrs): Likewise.
4558         * main.cc (main): Adjust call to gold_exit.
4559         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
4560         (Output_data_got::add_got_entry_pair): Likewise.
4561         (Output_section::add_input_section): Likewise.
4562         (Output_section::add_output_section_data): Likewise.
4563         (Output_segment::set_section_list_addresses): Likewise.
4564         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
4565
4566 2011-06-07  Cary Coutant  <ccoutant@google.com>
4567
4568         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
4569         for incremental links.
4570         * output.cc (Output_segment::set_section_list_addresses): Remove
4571         FIXME and test for TLS or BSS.
4572
4573 2011-06-07  Cary Coutant  <ccoutant@google.com>
4574
4575         * testsuite/Makefile.am: Add incremental_copy_test,
4576         incremental_common_test_1.
4577         * testsuite/Makefile.in: Regenerate.
4578         * testsuite/common_test_1_v1.c: New source file.
4579         * testsuite/common_test_1_v2.c: New source file.
4580         * testsuite/copy_test_v1.cc: New source file.
4581
4582 2011-06-07  Cary Coutant  <ccoutant@google.com>
4583
4584         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
4585         update, allocate common from bss section's free list.
4586         * incremental-dump.cc (dump_incremental_inputs): Print flag for
4587         linker-defined symbols.
4588         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
4589         Skip GOT and PLT entries that are no longer referenced.
4590         (Output_section_incremental_inputs::write_info_blocks): Mark
4591         linker-defined symbols.
4592         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
4593         * output.cc (Output_section::allocate): New function.
4594         * output.h (Output_section::allocate): New function.
4595         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
4596         linker-defined symbols.
4597         (Symbol::override_base_with_special): Copy is_predefined_ flag.
4598         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
4599         (Symbol::init_base_output_data): Likewise.
4600         (Symbol::init_base_output_segment): Likewise.
4601         (Symbol::init_base_constant): Likewise.
4602         (Sized_symbol::init_output_data): Likewise.
4603         (Sized_symbol::init_output_segment): Likewise.
4604         (Sized_symbol::init_constant): Likewise.
4605         (Symbol_table::do_define_in_output_data): Likewise.
4606         (Symbol_table::do_define_in_output_segment): Likewise.
4607         (Symbol_table::do_define_as_constant): Likewise.
4608         * symtab.h (Symbol::is_predefined): New function.
4609         (Symbol::init_base_output_data): Add is_predefined parameter.
4610         (Symbol::init_base_output_segment): Likewise.
4611         (Symbol::init_base_constant): Likewise.
4612         (Symbol::is_predefined_): New data member.
4613         (Sized_symbol::init_output_data): Add is_predefined parameter.
4614         (Sized_symbol::init_output_segment): Likewise.
4615         (Sized_symbol::init_constant): Likewise.
4616         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
4617
4618 2011-06-07  Cary Coutant  <ccoutant@google.com>
4619
4620         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
4621         instead of emit_copy_reloc.
4622         (Copy_relocs::emit_copy_reloc): Refactor.
4623         (Copy_relocs::make_copy_reloc): New function.
4624         (Copy_relocs::add_copy_reloc): Remove.
4625         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
4626         section.
4627         (Copy_relocs::make_copy_reloc): New function.
4628         (Copy_relocs::add_copy_reloc): Remove.
4629         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
4630         unchanged input files.
4631         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
4632         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
4633         Reserve BSS space for COPY relocations.
4634         (Sized_incremental_binary::do_emit_copy_relocs): New function.
4635         (Output_section_incremental_inputs::write_info_blocks): Record
4636         whether a symbol is copied from a shared object.
4637         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
4638         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
4639         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
4640         (Incremental_input_entry_reader::get_output_symbol_index): Add
4641         is_copy parameter.
4642         (Incremental_binary::emit_copy_relocs): New function.
4643         (Incremental_binary::do_emit_copy_relocs): New function.
4644         (Sized_incremental_binary::Sized_incremental_binary): Initialize
4645         new data member.
4646         (Sized_incremental_binary::add_copy_reloc): New function.
4647         (Sized_incremental_binary::do_emit_copy_relocs): New function.
4648         (Sized_incremental_binary::Copy_reloc): New struct.
4649         (Sized_incremental_binary::Copy_relocs): New typedef.
4650         (Sized_incremental_binary::copy_relocs_): New data member.
4651         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
4652         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
4653         * target.h (Sized_target::emit_copy_reloc): New function.
4654         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
4655
4656 2011-06-02  Cary Coutant  <ccoutant@google.com>
4657
4658         PR gold/12163
4659         * gold/archive.cc (Archive::Archive): Initialize new data member.
4660         (Archive::include_all_members): Return if archive has already been
4661         included.
4662         * gold/archive.h (Archive::include_all_members_): New data member.
4663
4664 2011-06-02  Nick Clifton  <nickc@redhat.com>
4665
4666         * dynobj.h: Fix spelling mistake in comment.
4667         * output.cc: Likewise.
4668
4669 2011-05-31  Doug Kwan  <dougkwan@google.com>
4670             Asier Llano
4671
4672         PR gold/12826
4673         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
4674         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
4675         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
4676         redundant arm_exidx_test.so.
4677         * testsuite/Makefile.in: Regenerate.
4678         (check_SCRIPTS): Add pr12826.sh
4679         (check_DATA): Add pr12826.stdout
4680         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
4681         * testsuite/pr12826.sh: New file.
4682         * testsuite/pr12826_1.s: Ditto.
4683         * testsuite/pr12826_1.s: Ditto.
4684
4685 2011-05-30  Ian Lance Taylor  <iant@google.com>
4686
4687         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
4688         sections.
4689
4690 2011-05-29  Ian Lance Taylor  <iant@google.com>
4691
4692         PR gold/12804
4693         * testsuite/Makefile.am: Use different file name for two_file_test
4694         temporary file for each incremental test.
4695         * testsuite/Makefile.in: Rebuild.
4696
4697 2011-05-29  Ian Lance Taylor  <iant@google.com>
4698
4699         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
4700         binary input file is empty.
4701
4702 2011-05-27  Ian Lance Taylor  <iant@google.com>
4703
4704         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
4705         (ver_test_9.so): Likewise.
4706         * testsuite/Makefile.in: Rebuild.
4707
4708 2011-05-26 Cary Coutant  <ccoutant@google.com>
4709
4710         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
4711         * incremental.cc (Incremental_inputs::report_input_section): Fix
4712         comment, indentation.
4713         (Incremental_inputs::report_comdat_group): New function.
4714         (Output_section_incremental_inputs::set_final_data_size): Adjust size
4715         of data for incremental input file entry.
4716         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
4717         group count, COMDAT group signatures.
4718         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
4719         an unchanged input file.
4720         * incremental.h (Incremental_object_entry::Incremental_object_entry):
4721         Initialize new data member.
4722         (Incremental_object_entry::add_comdat_group): New function.
4723         (Incremental_object_entry::get_comdat_group_count): New function.
4724         (Incremental_object_entry::get_comdat_signature_key): New function.
4725         (Incremental_object_entry::groups_): New data member.
4726         (Incremental_inputs::report_comdat_group): New function.
4727         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
4728         data for incremental input file entry.
4729         (Incremental_input_entry_reader::get_comdat_group_count): New function.
4730         (Incremental_input_entry_reader::get_input_section): Adjust size of
4731         data for incremental input file entry.
4732         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
4733         (Incremental_input_entry_reader::get_comdat_group_signature): New
4734         function.
4735         * object.cc (Sized_relobj::include_section_group): Report kept
4736         COMDAT groups for incremental links.
4737
4738 2011-05-24  David Meyer  <pdox@google.com>
4739
4740         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
4741         with name parameter.  Add found_name parameter.
4742         * fileread.cc (Input_file::find_file): Adjust code accordingly.
4743         * dirsearch.h (class Dirsearch): Update declaration.
4744
4745 2011-05-24  Ian Lance Taylor  <iant@google.com>
4746
4747         * archive.cc (Library_base::should_include_member): Pull in object
4748         from archive if it defines the entry symbol.
4749         * parameters.cc (Parameters::entry): New function.
4750         * parameters.h (class Parameters): Declare entry.
4751         * output.h (class Output_file_header): Remove entry_ field.
4752         * output.cc (Output_file_header::Output_file_header): Remove entry
4753         parameter.  Change all callers.
4754         (Output_file_header::entry): Use parameters->entry.
4755         * gold.cc (queue_middle_tasks): Likewise.
4756         * plugin.cc (Plugin_hook::run): Likewise.
4757
4758 2011-05-24 Cary Coutant  <ccoutant@google.com>
4759
4760         * gold.cc (queue_initial_tasks): Pass incremental base filename
4761         to Output_file::open_base_file; don't print error message.
4762         * incremental-dump.cc (main): Adjust call to
4763         Output_file::open_for_modification.
4764         * incremental-dump.cc (main): Likewise.
4765         * incremental.cc (Incremental_inputs::report_command_line):
4766         Ignore --incremental-base option when comparing command lines.
4767         Ignore parameter when given as separate argument.
4768         * options.h (class General_options): Add --incremental-base.
4769         * output.cc (Output_file::Output_file):
4770         (Output_file::open_base_file): Add base_name and writable parameters;
4771         read base file into new file; print error message here.
4772         (Output_file::map_no_anonymous): Add writable parameter; adjust all
4773         callers.
4774         * output.h (Output_file::open_for_modification): Rename to...
4775         (Output_file::open_base_file): ...this; add base_name and
4776         writable parameters; adjust all callers.
4777         (Output_file::map_no_anonymous): Add writable parameter; adjust all
4778         callers.
4779         * testsuite/Makefile.am (incremental_test_4): Test
4780         --incremental-base.
4781         * testsuite/Makefile.in: Regenerate.
4782
4783 2011-05-24 Cary Coutant  <ccoutant@google.com>
4784
4785         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
4786         incremental_test_4.
4787         * testsuite/Makefile.in: Regenerate.
4788         * testsuite/two_file_test_1_v1.cc: New test source file.
4789         * testsuite/two_file_test_1b_v1.cc: New test source file.
4790         * testsuite/two_file_test_2_v1.cc: New test source file.
4791
4792 2011-05-24 Cary Coutant  <ccoutant@google.com>
4793
4794         * dynobj.h (Dynobj::do_dynobj): New function.
4795         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
4796         flag and soname for shared objects.
4797         * incremental.cc (Incremental_inputs::report_object): Make
4798         either Incremental_object_entry or Incremental_dynobj_entry; add
4799         soname to string table.
4800         (Incremental_inputs::report_input_section): Add assertion.
4801         (Output_section_incremental_inputs::set_final_data_size): Adjust
4802         type of input file entry for shared libraries; adjust size of
4803         shared library info entry.
4804         (Output_section_incremental_inputs::write_input_files): Write
4805         as_needed flag for shared libraries.
4806         (Output_section_incremental_inputs::write_info_blocks): Adjust type
4807         of input file entry for shared libraries; write soname.
4808         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
4809         soname from incremental info.
4810         * incremental.h (enum Incremental_input_flags): Add
4811         INCREMENTAL_INPUT_AS_NEEDED.
4812         (Incremental_input_entry::Incremental_input_entry): Initialize new
4813         data member.
4814         (Incremental_input_entry::set_as_needed): New function.
4815         (Incremental_input_entry::as_needed): New function.
4816         (Incremental_input_entry::do_dynobj_entry): New function.
4817         (Incremental_input_entry::as_needed_): New data member.
4818         (Incremental_object_entry::Incremental_object_entry): Don't check
4819         for shared library.
4820         (Incremental_object_entry::do_type): Likewise.
4821         (class Incremental_dynobj_entry): New class.
4822         (Incremental_input_entry_reader::as_needed): New function.
4823         (Incremental_input_entry_reader::get_soname): New function.
4824         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
4825         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
4826         size of shared library info entry.
4827         * layout.cc (Layout::finish_dynamic_section): Don't test for
4828         incremental link when adding DT_NEEDED entries.
4829         * object.h (Object::Object): Initialize new data member.
4830         (Object::dynobj): New function.
4831         (Object::set_as_needed): New function.
4832         (Object::as_needed): New function.
4833         (Object::do_dynobj): New function.
4834         (Object::as_needed_): New data member.
4835
4836 2011-05-24 Cary Coutant  <ccoutant@google.com>
4837
4838         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
4839         info; adjust display of GOT entries.
4840         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
4841         vector of input objects; remove file_status_.
4842         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
4843         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
4844         got_plt reader; call target hooks to reserve GOT entries.
4845         (Output_section_incremental_inputs::set_final_data_size): Adjust size
4846         of input file info header and GOT info entry.
4847         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
4848         relocation info.
4849         (Got_plt_view_info::got_descriptor): Remove.
4850         (Got_plt_view_info::sym_index): New data member.
4851         (Got_plt_view_info::input_index): New data member.
4852         (Local_got_offset_visitor::visit): Write input file index.
4853         (Global_got_offset_visitor::visit): Write 0 for input file index.
4854         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
4855         with sym_index and input_index.
4856         (Output_section_incremental_inputs::write_got_plt): Adjust size of
4857         incremental info GOT entry; replace got_descriptor with input_index.
4858         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
4859         map from input file index to object.
4860         (Sized_relobj_incr::do_layout): Replace direct data member reference
4861         with accessor function.
4862         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
4863         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
4864         Adjust size of input file info header.
4865         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
4866         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
4867         (Incremental_input_entry_reader::get_input_section): Adjust size of
4868         input file info header.
4869         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
4870         of incremental info GOT entry.
4871         (Incremental_got_plt_reader::get_got_desc): Remove.
4872         (Incremental_got_plt_reader::get_got_symndx): New function.
4873         (Incremental_got_plt_reader::get_got_input_index): New function.
4874         (Sized_incremental_binary::Sized_incremental_binary): Remove
4875         file_status_; add input_objects_.
4876         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
4877         (Sized_incremental_binary::set_file_is_unchanged): Remove.
4878         (Sized_incremental_binary::file_is_unchanged): Remove.
4879         (Sized_incremental_binary::set_input_object): New function.
4880         (Sized_incremental_binary::input_object): New function.
4881         (Sized_incremental_binary::file_status_): Remove.
4882         (Sized_incremental_binary::input_objects_): New data member.
4883         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
4884         references.
4885         (Sized_relobj_incr::invalid_address): Move to base class.
4886         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
4887         class.
4888         (Sized_relobj_incr::do_output_section_offset): Likewise.
4889         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
4890         (Sized_relobj_incr::section_offsets_): Likewise.
4891         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
4892         function.
4893         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
4894         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
4895         with accessor function.
4896         (Sized_relobj_file::do_layout): Likewise.
4897         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
4898         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
4899         (Sized_relobj_file::compute_final_local_value): Replace refs to
4900         section_offsets_ with accessor function.
4901         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
4902         * object.h (Relobj::Relobj): Initialize new data members.
4903         (Relobj::add_dyn_reloc): New function.
4904         (Relobj::first_dyn_reloc): New function.
4905         (Relobj::dyn_reloc_count): New function.
4906         (Relobj::first_dyn_reloc_): New data member.
4907         (Relobj::dyn_reloc_count_): New data member.
4908         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
4909         references.
4910         (Sized_relobj::Address): New typedef.
4911         (Sized_relobj::invalid_address): Move here from child class.
4912         (Sized_relobj::Sized_relobj): Initialize new data members.
4913         (Sized_relobj::sized_relobj): New function.
4914         (Sized_relobj::is_output_section_offset_invalid): Move here from
4915         child class.
4916         (Sized_relobj::get_output_section_offset): Likewise.
4917         (Sized_relobj::local_has_got_offset): Likewise.
4918         (Sized_relobj::local_got_offset): Likewise.
4919         (Sized_relobj::set_local_got_offset): Likewise.
4920         (Sized_relobj::do_for_all_local_got_entries): Likewise.
4921         (Sized_relobj::clear_got_offsets): New function.
4922         (Sized_relobj::section_offsets): Move here from child class.
4923         (Sized_relobj::do_output_section_offset): Likewise.
4924         (Sized_relobj::do_set_section_offset): Likewise.
4925         (Sized_relobj::Local_got_offsets): Likewise.
4926         (Sized_relobj::local_got_offsets_): Likewise.
4927         (Sized_relobj::section_offsets_): Likewise.
4928         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
4929         references.
4930         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
4931         class.
4932         (Sized_relobj_file::sized_relobj): New function
4933         (Sized_relobj_file::local_has_got_offset): Move to base class.
4934         (Sized_relobj_file::local_got_offset): Likewise.
4935         (Sized_relobj_file::set_local_got_offset): Likewise.
4936         (Sized_relobj_file::get_output_section_offset): Likewise.
4937         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
4938         (Sized_relobj_file::do_output_section_offset): Likewise.
4939         (Sized_relobj_file::do_set_section_offset): Likewise.
4940         (Sized_relobj_file::Local_got_offsets): Likewise.
4941         (Sized_relobj_file::local_got_offsets_): Likewise.
4942         (Sized_relobj_file::section_offsets_): Likewise.
4943         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
4944         (all constructors).
4945         (set_needs_dynsym_index): Convert relobj to derived class pointer.
4946         (Output_reloc::get_symbol_index): Likewise.
4947         (Output_reloc::local_section_offset): Likewise.
4948         (Output_reloc::get_address): Likewise.
4949         (Output_reloc::symbol_value): Likewise.
4950         (Output_data_got::reserve_slot): Move to class definition.
4951         (Output_data_got::reserve_local): New function.
4952         (Output_data_got::reserve_slot_for_global): Remove.
4953         (Output_data_got::reserve_global): New function.
4954         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
4955         (all constructors, two instantiations).
4956         (Output_reloc::get_relobj): New function (two instantiations).
4957         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
4958         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
4959         (Output_data_reloc::add_global): Adjust type of relobj.
4960         (Output_data_reloc::add_global_relative): Likewise.
4961         (Output_data_reloc::add_symbolless_global_addend): Likewise.
4962         (Output_data_reloc::add_local): Likewise.
4963         (Output_data_reloc::add_local_relative): Likewise.
4964         (Output_data_reloc::add_symbolless_local_addend): Likewise.
4965         (Output_data_reloc::add_local_section): Likewise.
4966         (Output_data_reloc::add_output_section): Likewise.
4967         (Output_data_reloc::add_absolute): Likewise.
4968         (Output_data_reloc::add_target_specific): Likewise.
4969         (Output_data_got::reserve_slot): Move definition here.
4970         (Output_data_got::reserve_local): New function.
4971         (Output_data_got::reserve_global): New function.
4972         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
4973         section_offsets_ with accessor function.
4974         (Sized_relobj_file::write_sections): Likewise.
4975         (Sized_relobj_file::do_relocate_sections): Likewise.
4976         * target.h (Sized_target::reserve_local_got_entry): New function.
4977         (Sized_target::reserve_global_got_entry): New function.
4978         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
4979         (Target_x86_64::reserve_global_got_entry): New function.
4980         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
4981
4982 2011-05-23 Cary Coutant  <ccoutant@google.com>
4983
4984         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
4985         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
4986         bit when checking got_type.
4987         * incremental.cc (Sized_incremental_binary::setup_readers):
4988         Store symbol table and string table locations; initialize bit vector
4989         of file status flags.
4990         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
4991         unchanged files.
4992         (Sized_incremental_binary::do_process_got_plt): New function.
4993         (Sized_incremental_binary::get_symtab_view): Use stored locations.
4994         (Output_section_incremental_inputs::set_final_data_size): Record
4995         file index for each input file.
4996         (Output_section_incremental_inputs::write_got_plt): Store file index
4997         instead of input entry offset for each GOT entry.
4998         * incremental.h
4999         (Incremental_input_entry::Incremental_input_entry): Initialize new
5000         data member.
5001         (Incremental_input_entry::set_offset): Store file index.
5002         (Incremental_input_entry::get_file_index): New function.
5003         (Incremental_input_entry::file_index_): New data member.
5004         (Incremental_binary::process_got_plt): New function.
5005         (Incremental_binary::do_process_got_plt): New function.
5006         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
5007         data members.
5008         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
5009         (Sized_incremental_binary::set_file_is_unchanged): New function.
5010         (Sized_incremental_binary::file_is_unchanged): New function.
5011         (Sized_incremental_binary::do_process_got_plt): New function.
5012         (Sized_incremental_binary::file_status_): New data member.
5013         (Sized_incremental_binary::main_symtab_loc_): New data member.
5014         (Sized_incremental_binary::main_strtab_loc_): New data member.
5015         * output.cc (Output_data_got::Got_entry::write): Add case
5016         RESERVED_CODE.
5017         (Output_data_got::add_global): Call add_got_entry.
5018         (Output_data_got::add_global_plt): Likewise.
5019         (Output_data_got::add_global_with_rel): Likewise.
5020         (Output_data_got::add_global_with_rela): Likewise.
5021         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
5022         (Output_data_got::add_global_pair_with_rela): Likewise.
5023         (Output_data_got::add_local): Call add_got_entry.
5024         (Output_data_got::add_local_plt): Likewise.
5025         (Output_data_got::add_local_with_rel): Likewise.
5026         (Output_data_got::add_local_with_rela): Likewise.
5027         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
5028         (Output_data_got::add_local_pair_with_rela): Likewise.
5029         (Output_data_got::reserve_slot): New function.
5030         (Output_data_got::reserve_slot_for_global): New function.
5031         (Output_data_got::add_got_entry): New function.
5032         (Output_data_got::add_got_entry_pair): New function.
5033         (Output_section::add_output_section_data): Edit FIXME.
5034         * output.h
5035         (Output_section_data_build::Output_section_data_build): New
5036         constructor with size parameter.
5037         (Output_data_space::Output_data_space): Likewise.
5038         (Output_data_got::Output_data_got): Initialize new data member; new
5039         constructor with size parameter.
5040         (Output_data_got::add_constant): Call add_got_entry.
5041         (Output_data_got::reserve_slot): New function.
5042         (Output_data_got::reserve_slot_for_global): New function.
5043         (class Output_data_got::Got_entry): Add RESERVED_CODE.
5044         (Output_data_got::add_got_entry): New function.
5045         (Output_data_got::add_got_entry_pair): New function.
5046         (Output_data_got::free_list_): New data member.
5047         * target.h (Sized_target::init_got_plt_for_update): New function.
5048         (Sized_target::register_global_plt_entry): New function.
5049         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
5050         Initialize new data member; call init; add constructor with PLT count.
5051         (Output_data_plt_x86_64::init): New function.
5052         (Output_data_plt_x86_64::add_relocation): New function.
5053         (Output_data_plt_x86_64::reserve_slot): New function.
5054         (Output_data_plt_x86_64::free_list_): New data member.
5055         (Target_x86_64::init_got_plt_for_update): New function.
5056         (Target_x86_64::register_global_plt_entry): New function.
5057         (Output_data_plt_x86_64::add_entry): Allocate from free list for
5058         incremental updates.
5059         (Output_data_plt_x86_64::add_relocation): New function.
5060         * testsuite/object_unittest.cc (Object_test): Set default options.
5061
5062 2011-05-16  Ian Lance Taylor  <iant@google.com>
5063
5064         * options.h (class General_options): Make -i a synonym for -r.
5065
5066 2011-05-16  Ian Lance Taylor  <iant@google.com>
5067
5068         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
5069
5070 2011-05-10 Cary Coutant  <ccoutant@google.com>
5071
5072         * object.cc (Sized_relobj::do_count_local_symbols): Check for
5073         strip_all (-s).
5074
5075 2011-05-06  Ian Lance Taylor  <iant@google.com>
5076
5077         * layout.cc (Layout::layout): If the output section flags change,
5078         update the ordering.
5079
5080 2011-04-25 Cary Coutant  <ccoutant@google.com>
5081
5082         * incremental-dump.cc (dump_incremental_inputs): Print local
5083         symbol info for each input file.
5084         * incremental.cc
5085         (Output_section_incremental_inputs::set_final_data_size): Add local
5086         symbol info to input file entries in incremental info.
5087         (Output_section_incremental_inputs::write_info_blocks): Likewise.
5088         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
5089         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
5090         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
5091         implementation.
5092         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
5093         (Sized_incr_relobj::do_relocate): Write the local symbols.
5094         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
5095         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
5096         Adjust size of input file header.
5097         (Incremental_inputs_reader::get_local_symbol_offset): New function.
5098         (Incremental_inputs_reader::get_local_symbol_count): New function.
5099         (Incremental_inputs_reader::get_input_section): Adjust size of input
5100         file header.
5101         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
5102         (Sized_incr_relobj::This): New typedef.
5103         (Sized_incr_relobj::sym_size): New const data member.
5104         (Sized_incr_relobj::Local_symbol): New struct.
5105         (Sized_incr_relobj::do_output_local_symbol_count): New function.
5106         (Sized_incr_relobj::do_local_symbol_offset): New function.
5107         (Sized_incr_relobj::local_symbol_count_): New data member.
5108         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
5109         (Sized_incr_relobj::local_symbol_index_): New data member.
5110         (Sized_incr_relobj::local_symbol_offset_): New data member.
5111         (Sized_incr_relobj::local_dynsym_offset_): New data member.
5112         (Sized_incr_relobj::local_symbols_): New data member.
5113         * object.h (Relobj::output_local_symbol_count): New function.
5114         (Relobj::local_symbol_offset): New function.
5115         (Relobj::do_output_local_symbol_count): New function.
5116         (Relobj::do_local_symbol_offset): New function.
5117         (Sized_relobj::do_output_local_symbol_count): New function.
5118         (Sized_relobj::do_local_symbol_offset): New function.
5119
5120 2011-04-22  Vladimir Simonov  <sv@sw.ru>
5121
5122         * descriptors.cc (set_close_on_exec): New function.
5123         (Descriptors::open): Use set_close_on_exec.
5124         * output.cc (S_ISLNK): Define if not defined.
5125
5126 2011-04-22 Cary Coutant  <ccoutant@google.com>
5127
5128         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
5129         global symbol map.
5130         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
5131         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
5132         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
5133         relocations.
5134         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
5135         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
5136         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
5137         * incremental.h
5138         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
5139         function.
5140         (Incremental_binary::apply_incremental_relocs): New function.
5141         (Incremental_binary::do_apply_incremental_relocs): New function.
5142         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
5143         data member.
5144         (Sized_incremental_binary::add_global_symbol): New function.
5145         (Sized_incremental_binary::global_symbol): New function.
5146         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
5147         (Sized_incremental_binary::symbol_map_): New data member.
5148         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
5149         * target.h (Sized_target::apply_relocation): New function.
5150         * target-reloc.h (apply_relocation): New function.
5151         * x86_64.cc (Target_x86_64::apply_relocation): New function.
5152
5153 2011-04-22  Doug Kwan  <dougkwan@google.com>
5154
5155         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
5156         flag of a SHT_ARM_EXIDX section.
5157         * testsuite/Makefile.am (arm_exidx_test): New test rules.
5158         * testsuite/Makefile.in: Regenerate.
5159         * testsuite/arm_exidx_test.s: New file.
5160         * testsuite/arm_exidx_test.sh: Same.
5161
5162 2011-04-20 Cary Coutant  <ccoutant@google.com>
5163
5164         PR gold/12689
5165         * archive.h (Incremental_archive_entry::Archive_member):
5166         Initialize arg_serial_ (second constructor).
5167
5168 2011-04-17  Ian Lance Taylor  <iant@google.com>
5169
5170         * object.cc (Relocate_info::location): Simplify location string.
5171         * errors.cc (Errors::error_at_location): Don't print program
5172         name.
5173         (Errors::warning_at_location): Likewise.
5174         (Errors::undefined_symbol): Likewise.
5175         * testsuite/debug_msg.sh: Update accordingly.
5176
5177 2011-04-14 Cary Coutant  <ccoutant@google.com>
5178
5179         * gold/layout.cc (Layout::symtab_section_offset): New function.
5180         * gold/layout.h (Layout::symtab_section_offset): New function.
5181         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
5182
5183 2011-04-12  Ian Lance Taylor  <iant@google.com>
5184
5185         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
5186         with MREMAP_MAYMOVE.
5187         * output.h (class Output_file): Add map_is_allocated_ field.
5188         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
5189         not available, provide stubs.  If mremap is not available, #define
5190         it to gold_mremap.
5191         (MREMAP_MAYMOVE): Define if not defined.
5192         (Output_file::Output_file): Initialize map_is_allocated_.
5193         (Output_file::resize): Check map_is_allocated_.
5194         (Output_file::map_anonymous): If mmap fails, use malloc.
5195         (Output_file::unmap): Don't do anything for an anonymous map.
5196         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
5197         is not available, provide stubs.
5198         (File_read::View::~View): Use free rather than delete[].
5199         (File_read::make_view): Use malloc rather than new[].  If mmap
5200         fails, use malloc.
5201         (File_read::find_or_make_view): Use malloc rather than new[].
5202         * gold.h: Remove HAVE_REMAP code.
5203         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
5204         exists.  Rename mremap to gold_mremap.  If mmap is not available
5205         don't do anything.
5206         * configure, config.in: Rebuild.
5207
5208 2011-04-11  Ian Lance Taylor  <iant@google.com>
5209
5210         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
5211         initialize local variable v.
5212
5213 2011-04-11  Cary Coutant  <ccoutant@google.com>
5214
5215         * archive.cc (Archive::include_member): Adjust call to
5216         report_object.
5217         (Add_archive_symbols::run): Track argument serial numbers.
5218         (Lib_group::include_member): Likewise.
5219         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
5220         * archive.h (Incremental_archive_entry::Archive_member):
5221         Initialize arg_serial_.
5222         (Archive_member::arg_serial_): New data member.
5223         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
5224         (Sized_dynobj::do_add_symbols): Track symbols when doing an
5225         incremental link.
5226         (Sized_dynobj::do_for_all_local_got_entries): New function.
5227         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
5228         function.
5229         * fileread.cc (get_mtime): New function.
5230         * fileread.h (get_mtime): New function.
5231         * gold.cc (queue_initial_tasks): Check for incremental update.
5232         (process_incremental_input): New function.
5233         (queue_middle_tasks): Don't force valid target for incremental
5234         update.
5235         * incremental-dump.cc (find_input_containing_global): Adjust
5236         size of symbol info entry.
5237         (dump_incremental_inputs): Dump argument serial number and
5238         in_system_directory flag; bias shndx by 1; print symbol names
5239         when dumping per-file symbol lists; use new symbol info readers.
5240         * incremental.cc
5241         (Output_section_incremental_inputs:update_data_size): New function.
5242         (Sized_incremental_binary::setup_readers): Setup input readers
5243         for each input file; build maps for files added from libraries
5244         and scripts.
5245         (Sized_incremental_binary::check_input_args): New function.
5246         (Sized_incremental_binary::do_check_inputs): Build map of argument
5247         serial numbers to input arguments.
5248         (Sized_incremental_binary::do_file_has_changed): Rename
5249         do_file_is_unchanged to this; compare file modification times.
5250         (Sized_incremental_binary::do_init_layout): New function.
5251         (Sized_incremental_binary::do_reserve_layout): New function.
5252         (Sized_incremental_binary::do_get_input_reader): Remove.
5253         (Sized_incremental_binary::get_symtab_view): New function.
5254         (Incremental_checker::can_incrementally_link_output_file): Remove.
5255         (Incremental_inputs::report_command_line): Exclude --debug options.
5256         (Incremental_inputs::report_archive_begin): Add parameter; track
5257         argument serial numbers; don't put input file entry for archive
5258         before archive members.
5259         (Incremental_inputs::report_archive_end): Put input file entry
5260         for archive after archive members.
5261         (Incremental_inputs::report_object): Add parameter; track argument
5262         serial numbers and in_system_directory flag.
5263         (Incremental_inputs::report_script): Add parameter; track argument
5264         serial numbers.
5265         (Output_section_incremental_inputs::set_final_data_size): Adjust
5266         size of symbol info entry; check for forwarding symbols.
5267         (Output_section_incremental_inputs::write_input_files): Write
5268         in_system_directory flag and argument serial number.
5269         (Output_section_incremental_inputs::write_info_blocks): Map section
5270         indices between incremental info and original input file; store
5271         input section index for each symbol.
5272         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
5273         change operator() to visit().
5274         (class Global_got_offset_visitor): Likewise.
5275         (class Global_symbol_visitor_got_plt):
5276         (Output_section_incremental_inputs::write_got_plt): Use new visitor
5277         classes.
5278         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
5279         (Sized_incr_relobj::do_read_symbols): New function.
5280         (Sized_incr_relobj::do_layout): New function.
5281         (Sized_incr_relobj::do_layout_deferred_sections): New function.
5282         (Sized_incr_relobj::do_add_symbols): New function.
5283         (Sized_incr_relobj::do_should_include_member): New function.
5284         (Sized_incr_relobj::do_for_all_global_symbols): New function.
5285         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
5286         (Sized_incr_relobj::do_section_size): New function.
5287         (Sized_incr_relobj::do_section_name): New function.
5288         (Sized_incr_relobj::do_section_contents): New function.
5289         (Sized_incr_relobj::do_section_flags): New function.
5290         (Sized_incr_relobj::do_section_entsize): New function.
5291         (Sized_incr_relobj::do_section_address): New function.
5292         (Sized_incr_relobj::do_section_type): New function.
5293         (Sized_incr_relobj::do_section_link): New function.
5294         (Sized_incr_relobj::do_section_info): New function.
5295         (Sized_incr_relobj::do_section_addralign): New function.
5296         (Sized_incr_relobj::do_initialize_xindex): New function.
5297         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
5298         (Sized_incr_relobj::do_read_relocs): New function.
5299         (Sized_incr_relobj::do_gc_process_relocs): New function.
5300         (Sized_incr_relobj::do_scan_relocs): New function.
5301         (Sized_incr_relobj::do_count_local_symbols): New function.
5302         (Sized_incr_relobj::do_finalize_local_symbols): New function.
5303         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
5304         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
5305         (Sized_incr_relobj::do_relocate): New function.
5306         (Sized_incr_relobj::do_set_section_offset): New function.
5307         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
5308         (Sized_incr_dynobj::do_read_symbols): New function.
5309         (Sized_incr_dynobj::do_layout): New function.
5310         (Sized_incr_dynobj::do_add_symbols): New function.
5311         (Sized_incr_dynobj::do_should_include_member): New function.
5312         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
5313         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
5314         (Sized_incr_dynobj::do_section_size): New function.
5315         (Sized_incr_dynobj::do_section_name): New function.
5316         (Sized_incr_dynobj::do_section_contents): New function.
5317         (Sized_incr_dynobj::do_section_flags): New function.
5318         (Sized_incr_dynobj::do_section_entsize): New function.
5319         (Sized_incr_dynobj::do_section_address): New function.
5320         (Sized_incr_dynobj::do_section_type): New function.
5321         (Sized_incr_dynobj::do_section_link): New function.
5322         (Sized_incr_dynobj::do_section_info): New function.
5323         (Sized_incr_dynobj::do_section_addralign): New function.
5324         (Sized_incr_dynobj::do_initialize_xindex): New function.
5325         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
5326         (make_sized_incremental_object): New function.
5327         (Incremental_library::copy_unused_symbols): New function.
5328         (Incremental_library::do_for_all_unused_symbols): New function.
5329         * incremental.h (enum Incremental_input_flags): New type.
5330         (class Incremental_checker): Remove.
5331         (Incremental_input_entry::Incremental_input_entry): Add argument
5332         serial number.
5333         (Incremental_input_entry::arg_serial): New function.
5334         (Incremental_input_entry::set_is_in_system_directory): New function.
5335         (Incremental_input_entry::is_in_system_directory): New function.
5336         (Incremental_input_entry::arg_serial_): New data member.
5337         (Incremental_input_entry::is_in_system_directory_): New data member.
5338         (class Script_info): Move here from script.h.
5339         (Script_info::Script_info): Add filename parameter.
5340         (Script_info::filename): New function.
5341         (Script_info::filename_): New data member.
5342         (Incremental_script_entry::Incremental_script_entry): Add argument
5343         serial number.
5344         (Incremental_object_entry::Incremental_object_entry): Likewise.
5345         (Incremental_object_entry::add_input_section): Build list of input
5346         sections with map to original shndx.
5347         (Incremental_object_entry::get_input_section_index): New function.
5348         (Incremental_object_entry::shndx_): New data member.
5349         (Incremental_object_entry::name_key_): Rename; adjust all refs.
5350         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
5351         (Incremental_archive_entry::Incremental_archive_entry): Add argument
5352         serial number.
5353         (Incremental_inputs::report_archive_begin): Likewise.
5354         (Incremental_inputs::report_object): Likewise.
5355         (Incremental_inputs::report_script): Likewise.
5356         (class Incremental_global_symbol_reader): New class.
5357         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
5358         and store flags and input file type.
5359         (Incremental_input_entry_reader::arg_serial): New function.
5360         (Incremental_input_entry_reader::type): Extract type from flags.
5361         (Incremental_input_entry_reader::is_in_system_directory): New function.
5362         (Incremental_input_entry_reader::get_input_section_count): Call
5363         accessor function for type.
5364         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
5365         function for type; adjust size of global symbol entry.
5366         (Incremental_input_entry_reader::get_global_symbol_count): Call
5367         accessor function for type.
5368         (Incremental_input_entry_reader::get_object_count): Likewise.
5369         (Incremental_input_entry_reader::get_object_offset): Likewise.
5370         (Incremental_input_entry_reader::get_member_count): Likewise.
5371         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
5372         (Incremental_input_entry_reader::get_member_offset): Likewise.
5373         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
5374         (Incremental_input_entry_reader::Global_symbol_info): Remove.
5375         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
5376         (Incremental_input_entry_reader::get_global_symbol_reader): New
5377         function.
5378         (Incremental_input_entry_reader::get_output_symbol_index): New
5379         function.
5380         (Incremental_input_entry_reader::type_): Remove.
5381         (Incremental_input_entry_reader::flags_): New data member.
5382         (Incremental_inputs_reader::input_file_offset): New function.
5383         (Incremental_inputs_reader::input_file_index): New function.
5384         (Incremental_inputs_reader::input_file): Call input_file_offset.
5385         (Incremental_inputs_reader::input_file_at_offset): New function.
5386         (Incremental_relocs_reader::get_r_type): Reformat.
5387         (Incremental_relocs_reader::get_r_shndx): Reformat.
5388         (Incremental_relocs_reader::get_r_offset): Reformat.
5389         (Incremental_relocs_reader::data): New function.
5390         (Incremental_binary::Incremental_binary): Initialize new data members.
5391         (Incremental_binary::check_inputs): Add cmdline parameter.
5392         (Incremental_binary::file_is_unchanged): Remove.
5393         (Input_reader::arg_serial): New function.
5394         (Input_reader::get_unused_symbol_count): New function.
5395         (Input_reader::get_unused_symbol): New function.
5396         (Input_reader::do_arg_serial): New function.
5397         (Input_reader::do_get_unused_symbol_count): New function.
5398         (Input_reader::do_get_unused_symbol): New function.
5399         (Incremental_binary::input_file_count): New function.
5400         (Incremental_binary::get_input_reader): Change signature to use
5401         index instead of filename.
5402         (Incremental_binary::file_has_changed): New function.
5403         (Incremental_binary::get_input_argument): New function.
5404         (Incremental_binary::get_library): New function.
5405         (Incremental_binary::get_script_info): New function.
5406         (Incremental_binary::init_layout): New function.
5407         (Incremental_binary::reserve_layout): New function.
5408         (Incremental_binary::output_file): New function.
5409         (Incremental_binary::do_check_inputs): New function.
5410         (Incremental_binary::do_file_is_unchanged): Remove.
5411         (Incremental_binary::do_file_has_changed): New function.
5412         (Incremental_binary::do_init_layout): New function.
5413         (Incremental_binary::do_reserve_layout): New function.
5414         (Incremental_binary::do_input_file_count): New function.
5415         (Incremental_binary::do_get_input_reader): Change signature.
5416         (Incremental_binary::input_args_map_): New data member.
5417         (Incremental_binary::library_map_): New data member.
5418         (Incremental_binary::script_map_): New data member.
5419         (Sized_incremental_binary::Sized_incremental_binary): Initialize
5420         new data members.
5421         (Sized_incremental_binary::output_section): New function.
5422         (Sized_incremental_binary::inputs_reader): Add const.
5423         (Sized_incremental_binary::symtab_reader): Add const.
5424         (Sized_incremental_binary::relocs_reader): Add const.
5425         (Sized_incremental_binary::got_plt_reader): Add const.
5426         (Sized_incremental_binary::get_symtab_view): New function.
5427         (Sized_incremental_binary::Inputs_reader): New typedef.
5428         (Sized_incremental_binary::Input_entry_reader): New typedef.
5429         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
5430         (Sized_incremental_binary::do_file_is_unchanged): Remove.
5431         (Sized_incremental_binary::do_file_has_changed): New function.
5432         (Sized_incremental_binary::do_init_layout): New function.
5433         (Sized_incremental_binary::do_reserve_layout): New function.
5434         (Sized_input_reader::Inputs_reader): Remove.
5435         (Sized_input_reader::Input_entry_reader): Remove.
5436         (Sized_input_reader::do_arg_serial): New function.
5437         (Sized_input_reader::do_get_unused_symbol_count): New function.
5438         (Sized_input_reader::do_get_unused_symbol): New function.
5439         (Sized_incremental_binary::do_input_file_count): New function.
5440         (Sized_incremental_binary::do_get_input_reader): Change signature;
5441         use index instead of filename.
5442         (Sized_incremental_binary::section_map_): New data member.
5443         (Sized_incremental_binary::input_entry_readers_): New data member.
5444         (class Sized_incr_relobj): New class.
5445         (class Sized_incr_dynobj): New class.
5446         (make_sized_incremental_object): New function.
5447         (class Incremental_library): New class.
5448         * layout.cc (Free_list::num_lists): New static data member.
5449         (Free_list::num_nodes): New static data member.
5450         (Free_list::num_removes): New static data member.
5451         (Free_list::num_remove_visits): New static data member.
5452         (Free_list::num_allocates): New static data member.
5453         (Free_list::num_allocate_visits): New static data member.
5454         (Free_list::init): New function.
5455         (Free_list::remove): New function.
5456         (Free_list::allocate): New function.
5457         (Free_list::dump): New function.
5458         (Free_list::print_stats): New function.
5459         (Layout_task_runner::run): Resize output file for incremental updates.
5460         (Layout::Layout): Initialize new data members.
5461         (Layout::set_incremental_base): New function.
5462         (Layout::init_fixed_output_section): New function.
5463         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
5464         incremental updates.
5465         (Layout::create_gold_note): Do not create gold note section for
5466         incremental updates.
5467         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
5468         for incremental updates.
5469         (Layout::set_section_offsets): For incremental updates, allocate space
5470         from free list.
5471         (Layout::create_symtab_sections): Layout with offsets relative to
5472         start of section; for incremental updates, allocate space from free
5473         list.
5474         (Layout::create_shdrs): For incremental updates, allocate space from
5475         free list.
5476         (Layout::finish_dynamic_section): For incremental updates, do not
5477         check --as-needed (fixed in subsequent patch).
5478         * layout.h (class Free_list): New class.
5479         (Layout::set_incremental_base): New function.
5480         (Layout::incremental_base): New function.
5481         (Layout::init_fixed_output_section): New function.
5482         (Layout::allocate): New function.
5483         (Layout::incremental_base_): New data member.
5484         (Layout::free_list_): New data member.
5485         * main.cc (main): Print Free_list statistics.
5486         * object.cc (Relobj::finalize_incremental_relocs): Add
5487         clear_counts parameter; clear counts only when clear_counts is set.
5488         (Sized_relobj::Sized_relobj): Initialize new base class.
5489         (Sized_relobj::do_layout): Don't report special sections.
5490         (Sized_relobj::do_for_all_local_got_entries): New function.
5491         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
5492         symtab_off to all symbol table offsets.
5493         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
5494         * object.h (class Got_offset_list): Move to top of file.
5495         (Object::Object): Allow case where input_file == NULL.
5496         (Object::~Object): Likewise.
5497         (Object::input_file): Assert that input_file != NULL.
5498         (Object::lock): Allow case where input_file == NULL.
5499         (Object::unlock): Likewise.
5500         (Object::is_locked): Likewise.
5501         (Object::token): Likewise.
5502         (Object::release): Likewise.
5503         (Object::is_incremental): New function.
5504         (Object::get_mtime): New function.
5505         (Object::for_all_local_got_entries): New function.
5506         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
5507         (Object::set_is_in_system_directory): New function.
5508         (Object::is_in_system_directory): New function.
5509         (Object::do_is_incremental): New function.
5510         (Object::do_get_mtime): New function.
5511         (Object::do_for_all_local_got_entries): New function.
5512         (Object::is_in_system_directory_): New data member.
5513         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
5514         (class Sized_relobj_base): New class.
5515         (class Sized_relobj): Derive from Sized_relobj_base.
5516         (class Sized_relobj::Symbols): Redeclare from base class.
5517         (class Sized_relobj::local_got_offset_list): Remove.
5518         (class Sized_relobj::Output_sections): Redeclare from base class.
5519         (class Sized_relobj::do_for_all_local_got_entries): New function.
5520         (class Sized_relobj::write_local_symbols): Add offset parameter.
5521         (class Sized_relobj::local_symbol_offset_): Update comment.
5522         (class Sized_relobj::local_dynsym_offset_): Update comment.
5523         * options.cc (Input_arguments::add_file): Remove const.
5524         * options.h (Input_file_argument::Input_file_argument):
5525         Initialize arg_serial_ (all constructors).
5526         (Input_file_argument::set_arg_serial): New function.
5527         (Input_file_argument::arg_serial): New function.
5528         (Input_file_argument::arg_serial_): New data member.
5529         (Input_arguments::Input_arguments): Initialize file_count_.
5530         (Input_arguments::add_file): Remove const.
5531         (Input_arguments::number_of_input_files): New function.
5532         (Input_arguments::file_count_): New data member.
5533         (Command_line::number_of_input_files): Call
5534         Input_arguments::number_of_input_files.
5535         * output.cc (Output_segment_headers::Output_segment_headers):
5536         Set current size.
5537         (Output_section::Input_section::current_data_size): New function.
5538         (Output_section::Output_section): Initialize new data members.
5539         (Output_section::add_input_section): Don't do merge sections for
5540         an incremental link; allocate space from free list for an
5541         incremental update.
5542         (Output_section::add_output_section_data): Allocate space from
5543         free list for an incremental update.
5544         (Output_section::update_data_size): New function.
5545         (Output_section::set_fixed_layout): New function.
5546         (Output_section::reserve): New function.
5547         (Output_segment::set_section_addresses): Remove const.
5548         (Output_segment::set_section_list_addresses): Remove const; allocate
5549         space from free list for an incremental update.
5550         (Output_segment::set_offset): Adjust size of RELRO segment for an
5551         incremental update.
5552         * output.h (Output_data::current_data_size): Move here from
5553         child classes.
5554         (Output_data::pre_finalize_data_size): New function.
5555         (Output_data::update_data_size): New function.
5556         (Output_section_headers::update_data_size): new function.
5557         (Output_section_data_build::current_data_size): Move to Output_data.
5558         (Output_data_strtab::update_data_size): New function.
5559         (Output_section::current_data_size): Move to Output_data.
5560         (Output_section::set_fixed_layout): New function.
5561         (Output_section::has_fixed_layout): New function.
5562         (Output_section::reserve): New function.
5563         (Output_section::update_data_size): New function.
5564         (Output_section::has_fixed_layout_): New data member.
5565         (Output_section::free_list_): New data member.
5566         (Output_segment::set_section_addresses): Remove const.
5567         (Output_segment::set_section_list_addresses): Remove const.
5568         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
5569         New function.
5570         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
5571         New function.
5572         * readsyms.cc (Read_symbols::do_read_symbols): Add library
5573         parameter when calling Add_symbols constructor; store argument
5574         serial number for members of a lib group.
5575         (Add_symbols::locks): Allow case where token == NULL.
5576         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
5577         (Read_member::~Read_member): New function.
5578         (Read_member::is_runnable): New function.
5579         (Read_member::locks): New function.
5580         (Read_member::run): New function.
5581         (Check_script::~Check_script): New function.
5582         (Check_script::is_runnable): New function.
5583         (Check_script::locks): New function.
5584         (Check_script::run): New function.
5585         (Check_library::~Check_library): New function.
5586         (Check_library::is_runnable): New function.
5587         (Check_library::locks): New function.
5588         (Check_library::run): New function.
5589         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
5590         (Add_symbols::library_): New data member.
5591         (class Read_member): New class.
5592         (class Check_script): New class.
5593         (class Check_library): New class.
5594         * reloc.cc (Read_relocs::is_runnable): Allow case where
5595         token == NULL.
5596         (Read_relocs::locks): Likewise.
5597         (Scan_relocs::locks): Likewise.
5598         (Relocate_task::locks): Likewise.
5599         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
5600         to clear counters.
5601         (Sized_relobj::incremental_relocs_scan): Fix comment.
5602         (Sized_relobj::do_relocate): Pass output file offset to
5603         write_local_symbols.
5604         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
5605         from class declaration.
5606         * script.cc (read_input_script): Allocate Script_info; pass
5607         argument serial number to report_script.
5608         * script.h (class Script_info): Move to incremental.h.
5609         * symtab.cc (Symbol_table::add_from_incrobj): New function.
5610         * symtab.h (Symbol_table::add_from_incrobj): New function.
5611         (Symbol_table::set_file_offset): New function.
5612
5613 2011-04-05  Cary Coutant  <ccoutant@google.com>
5614
5615         * incremental-dump.cc (dump_incremental_inputs): Change signature
5616         to take a Sized_incremental_binary; change caller.  Use readers
5617         in Sized_incremental_binary.
5618         * incremental.cc
5619         (Sized_incremental_binary::find_incremental_inputs_sections):
5620         Rename do_find_incremental_inputs_sections to this.
5621         (Sized_incremental_binary::setup_readers): New function.
5622         (Sized_incremental_binary::do_check_inputs): Check
5623         has_incremental_info_ flag; move setup code to setup_readers;
5624         use input readers.
5625         (Sized_incremental_binary::do_file_is_unchanged): New function.
5626         (Sized_incremental_binary::do_get_input_reader): New function.
5627         * incremental.h (class Incremental_binary): Move to end of file.
5628         (Incremental_binary::file_is_unchanged): New function.
5629         (Incremental_binary::do_file_is_unchanged): New function.
5630         (Incremental_binary::Input_reader): New class.
5631         (Incremental_binary::get_input_reader): New function.
5632         (class Sized_incremental_binary): Move to end of file.
5633         (Sized_incremental_binary::Sized_incremental_binary): Setup the
5634         input section reader classes.
5635         (Sized_incremental_binary::has_incremental_info): New function.
5636         (Sized_incremental_binary::inputs_reader): New function.
5637         (Sized_incremental_binary::symtab_reader): New function.
5638         (Sized_incremental_binary::relocs_reader): New function.
5639         (Sized_incremental_binary::got_plt_reader): New function.
5640         (Sized_incremental_binary::do_file_is_unchanged): New function.
5641         (Sized_incremental_binary::Sized_input_reader): New class.
5642         (Sized_incremental_binary::get_input_reader): New function.
5643         (Sized_incremental_binary::find_incremental_inputs_sections):
5644         Rename do_find_incremental_inputs_sections to this.
5645         (Sized_incremental_binary::setup_readers): New function.
5646         (Sized_incremental_binary::has_incremental_info_): New data member.
5647         (Sized_incremental_binary::inputs_reader_): New data member.
5648         (Sized_incremental_binary::symtab_reader_): New data member.
5649         (Sized_incremental_binary::relocs_reader_): New data member.
5650         (Sized_incremental_binary::got_plt_reader_): New data member.
5651         (Sized_incremental_binary::current_input_file_): New data member.
5652
5653 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
5654
5655         PR gold/12640
5656         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
5657         violation.
5658
5659 2011-03-30  Cary Coutant  <ccoutant@google.com>
5660
5661         * archive.cc (Archive::include_member): Adjust call to report_object.
5662         (Add_archive_symbols::run): Add script_info to call to
5663         report_archive_begin.
5664         (Lib_group::include_member): Adjust call to report_object.
5665         (Add_lib_group_symbols::run): Adjust call to report_object.
5666         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
5667         blocks.  Add object count for script input files.
5668         * incremental.cc (Incremental_inputs::report_archive_begin): Add
5669         script_info parameter; change all callers.
5670         (Incremental_inputs::report_object): Add script_info parameter;
5671         change all callers.
5672         (Incremental_inputs::report_script): Store backpointer to
5673         incremental info entry.
5674         (Output_section_incremental_inputs::set_final_data_size): Record
5675         additional information for scripts.
5676         (Output_section_incremental_inputs::write_info_blocks): Likewise.
5677         * incremental.h (Incremental_script_entry::add_object): New function.
5678         (Incremental_script_entry::get_object_count): New function.
5679         (Incremental_script_entry::get_object): New function.
5680         (Incremental_script_entry::objects_): New data member; adjust
5681         constructor.
5682         (Incremental_inputs::report_archive_begin): Add script_info parameter.
5683         (Incremental_inputs::report_object): Add script_info parameter.
5684         (Incremental_inputs_reader::get_object_count): New function.
5685         (Incremental_inputs_reader::get_object_offset): New function.
5686         * options.cc (Input_arguments::add_file): Return reference to
5687         new input argument.
5688         * options.h (Input_argument::set_script_info): New function.
5689         (Input_argument::script_info): New function.
5690         (Input_argument::script_info_): New data member; adjust all
5691         constructors.
5692         (Input_file_group::add_file): Return reference to new input argument.
5693         (Input_file_lib::add_file): Likewise.
5694         (Input_arguments::add_file): Likewise.
5695         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
5696         * script.cc (Parser_closure::Parser_closure): Add script_info
5697         parameter; adjust all callers.
5698         (Parser_closure::script_info): New function.
5699         (Parser_closure::script_info_): New data member.
5700         (read_input_script): Report scripts earlier to incremental info.
5701         (script_add_file): Set script_info in Input_argument.
5702         (script_add_library): Likewise.
5703         * script.h (Script_options::Script_info): Rewrite class.
5704
5705 2011-03-29  Cary Coutant  <ccoutant@google.com>
5706
5707         * archive.cc (Library_base::should_include_member): Move
5708         method here from class Archive.
5709         (Archive::Archive): Initialize base class.
5710         (Archive::should_include_member): Move to base class.
5711         (Archive::do_for_all_unused_symbols): New function.
5712         (Add_archive_symbols::run): Remove redundant access to
5713         incremental_inputs.
5714         (Lib_group::Lib_group): Initialize base class.
5715         (Lib_group::do_filename): New function.
5716         (Lib_group::include_member): Pass pointer to Lib_group to
5717         report_object.
5718         (Lib_group::do_for_all_unused_symbols): New function.
5719         (Add_lib_group_symbols::run): Report archive information for
5720         incremental links.
5721         * archive.h (class Library_base): New base class.
5722         (class Archive): Derive from Library_base.
5723         (Archive::filename): Move to base class.
5724         (Archive::set_incremental_info): Likewise.
5725         (Archive::incremental_info): Likewise.
5726         (Archive::Should_include): Likewise.
5727         (Archive::should_include_member): Likewise.
5728         (Archive::Armap_entry): Remove.
5729         (Archive::Unused_symbol_iterator): Remove.
5730         (Archive::unused_symbols_begin): Remove.
5731         (Archive::unused_symbols_end): Remove.
5732         (Archive::do_filename): New function.
5733         (Archive::do_get_mtime): New function.
5734         (Archive::do_for_all_unused_symbols): New function.
5735         (Archive::task_): Move to base class.
5736         (Archive::incremental_info_): Likewise.
5737         (class Lib_group): Derive from Library_base.
5738         (Lib_group::do_filename): New function.
5739         (Lib_group::do_get_mtime): New function.
5740         (Lib_group::do_for_all_unused_symbols): New function.
5741         (Lib_group::task_): Move to base class.
5742         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
5743         function.
5744         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
5745         function.
5746         * incremental.cc (Incremental_inputs::report_archive_begin):
5747         Use Library_base; call library's get_mtime; add incremental inputs
5748         entry before members.
5749         (class Unused_symbol_visitor): New class.
5750         (Incremental_inputs::report_archive_end): Use Library_base; use
5751         visitor class to record unused symbols; don't add incremental inputs
5752         entry after members.
5753         (Incremental_inputs::report_object): Use Library_base.
5754         * incremental.h
5755         (Incremental_archive_entry::Incremental_archive_entry): Remove
5756         unused Archive parameter.
5757         (Incremental_inputs::report_archive_begin): Use Library_base.
5758         (Incremental_inputs::report_archive_end): Likewise.
5759         (Incremental_inputs::report_object): Likewise.
5760         * object.cc (Sized_relobj::do_for_all_global_symbols): New
5761         function.
5762         * object.h (Object::for_all_global_symbols): New function.
5763         (Object::do_for_all_global_symbols): New function.
5764         (Sized_relobj::do_for_all_global_symbols): New function.
5765         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
5766         function.
5767         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
5768         function.
5769
5770 2011-03-27  Ian Lance Taylor  <iant@google.com>
5771
5772         * archive.cc (Archive::interpret_header): Return -1 if something
5773         goes wrong.  Change callers accordingly.
5774
5775 2011-03-25  Cary Coutant  <ccoutant@google.com>
5776
5777         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
5778         * testsuite/Makefile.in: Regenerate.
5779
5780 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
5781
5782         * plugin.cc (get_view): New.
5783         (Plugin::load): Pass get_view to the plugin.
5784         (Plugin_manager::get_view): New.
5785
5786 2011-03-21  Ian Lance Taylor  <iant@google.com>
5787
5788         * testsuite/final_layout.sh: Rewrite to not use dc.
5789         * testsuite/relro_test.sh: Fail if dc is not present.
5790
5791 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
5792
5793         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
5794         Change == to -eq.
5795         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
5796         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
5797         Change == to -eq.
5798         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
5799         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
5800
5801 2011-03-14  Ian Lance Taylor  <iant@google.com>
5802
5803         * script-sections.cc (Sort_output_sections::script_compare):
5804         Rename from is_before, change return type.
5805         (Sort_output_sections::operator()): Adjust accordingly.
5806
5807 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
5808
5809         PR gold/12572
5810         * testsuite/odr_violation2.cc: Add comment to make all error line
5811         numbers double digits.
5812         * testsuite/debug_msg.sh: Adjust expected errors.
5813
5814 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
5815
5816         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
5817         but mark earlier ones as non-canonical
5818         (offset_to_iterator): Update search target and example
5819         (do_addr2line): Return extra lines in a vector*
5820         (format_file_lineno): Extract from do_addr2line
5821         (one_addr2line): Add vector* out-param
5822         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
5823         when a lineno entry appeared last for its instruction
5824         (Dwarf_line_info): Add vector* out-param
5825         * object.cc (Relocate_info): Pass NULL for the vector* out-param
5826         * symtab.cc (Odr_violation_compare): Include the lineno in the
5827         comparison again.
5828         (linenos_from_loc): New. Combine the canonical line for an
5829         address with its other lines.
5830         (True_if_intersect): New. Helper functor to make
5831         std::set_intersection a query.
5832         (detect_odr_violations): Compare sets of lines instead of just
5833         one line for each function. This became less deterministic, but
5834         has fewer false positives.
5835         * symtab.h: Declarations.
5836         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
5837         mix an optimized and non-optimized object in the same binary
5838         (odr_violation2.so): Same.
5839         * testsuite/Makefile.in: Regenerate from Makefile.am.
5840         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
5841         * testsuite/debug_msg.sh: Update line numbers and add
5842         assertions.
5843         * testsuite/odr_violation1.cc: Use OdrDerived, in a
5844         non-optimized context.
5845         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
5846         isn't inlined, and use OdrDerived in an optimized context.
5847         * testsuite/odr_header1.h: Defines OdrDerived, where
5848         optimization will change the
5849         first-instruction-in-the-destructor's file and line number.
5850         * testsuite/odr_header2.h: Defines OdrBase.
5851
5852 2011-03-09  Ian Lance Taylor  <iant@google.com>
5853
5854         * fileread.cc (File_read::clear_views): Don't delete the whole
5855         file view.
5856
5857 2011-03-08  Ian Lance Taylor  <iant@google.com>
5858
5859         PR gold/12525
5860         * fileread.cc: #include <climits>.
5861         (GOLD_IOV_MAX): Define.
5862         (File_read::read_multiple): Limit number of entries by iov_max.
5863         * fileread.h (class File_read): Always set max_readv_entries to
5864         128.
5865
5866 2011-03-07  Ian Lance Taylor  <iant@google.com>
5867
5868         PR gold/12525
5869         * options.h (class General_options): Add -dy and -dn.
5870
5871 2011-03-02  Cary Coutant  <ccoutant@google.com>
5872
5873         * testsuite/script_test_9.t: Add TLS segment.
5874
5875 2011-03-02  Simon Baldwin  <simonb@google.com>
5876
5877         * configure.ac: Add check for gnu_indirect_function support in
5878         the toolchain building binutils.
5879         * configure: Rebuild.
5880
5881 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
5882
5883         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
5884         plugin only symbols.
5885         (Symbol_table::sized_finalize_symbol) Mark symbol only present
5886         in plugin files as not needed in the symbol table.
5887
5888 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
5889
5890         * output.cc (Output_section::add_input_section): Delay fill
5891         generation for section ordering.
5892
5893 2011-02-09  Ian Lance Taylor  <iant@google.com>
5894
5895         PR gold/12316
5896         * object.h (class Sized_relobj): Remove clear_local_symbols.
5897         * reloc.cc (Sized_relobj::do_relocate): Don't call
5898         clear_local_symbols.
5899
5900 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
5901
5902         * plugin.cc (is_visible_from_outside): Return true for symbols
5903         in the -u option.
5904
5905 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
5906
5907         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
5908         filename.
5909
5910 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
5911
5912         * icf.h (is_section_foldable_candidate): Change type of parameter
5913         to std::string.
5914         * icf.cc (Icf::find_identical_sections): Change type of local variable
5915         section_name to be std::string.
5916         (is_function_ctor_or_dtor): Change type of parameter to std::string.
5917
5918 2011-01-25  Ian Lance Taylor  <iant@google.com>
5919
5920         * script.cc (script_add_extern): Rewrite to use
5921         add_symbol_reference.
5922
5923 2011-01-25  Doug Kwan  <dougkwan@google.com>
5924
5925         * icf.cc (get_section_contents): Always lock section's object.
5926
5927 2011-01-24  Ian Lance Taylor  <iant@google.com>
5928
5929         * options.h (class General_options): Accept
5930         --no-detect-odr-violations.
5931
5932 2011-01-24  Ian Lance Taylor  <iant@google.com>
5933
5934         * version.cc (version_string): Bump to 1.11.
5935
5936 2011-01-24  Ian Lance Taylor  <iant@google.com>
5937
5938         * plugin.cc (class Plugin_rescan): Define new class.
5939         (Plugin_manager::claim_file): Set any_claimed_.
5940         (Plugin_manager::save_archive): New function.
5941         (Plugin_manager::save_input_group): New function.
5942         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
5943         necessary.
5944         (Plugin_manager::new_undefined_symbol): New function.
5945         (Plugin_manager::rescan): New function.
5946         (Plugin_manager::rescannable_defines): New function.
5947         (Plugin_manager::add_input_file): Set any_added_.
5948         * plugin.h (class Plugin_manager): define new fields rescannable_,
5949         undefined_symbols_, any_claimed_, and any_added_.  Declare
5950         Plugin_rescan as friend.  Declare new functions.
5951         (Plugin_manager::Rescannable): Define type.
5952         (Plugin_manager::Rescannable_list): Define type.
5953         (Plugin_manager::Undefined_symbol_list): Define type.
5954         (Plugin_manager::Plugin_manager): Initialize new fields.
5955         * archive.cc (Archive::defines_symbol): New function.
5956         (Add_archive_symbols::run): Pass archive to plugins if any.
5957         * archive.h (class Archive): Declare defines_symbol.
5958         * readsyms.cc (Input_group::~Input_group): New function.
5959         (Finish_group::run): Pass input_group to plugins if any.
5960         * readsyms.h (class Input_group): Declare destructor.
5961         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
5962         any.
5963
5964 2011-01-10  Ian Lance Taylor  <iant@google.com>
5965
5966         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
5967         section as relro.
5968         (Layout::set_segment_offsets): Reset increase_relro before calling
5969         set_section_addresses a second time.
5970
5971 2011-01-04  Cary Coutant  <ccoutant@google.com>
5972
5973         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
5974         sections before NOBITS sections.
5975
5976 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
5977
5978         * version.cc (print_version): Update copyright to 2011.
5979
5980 2010-12-23  Cary Coutant  <ccoutant@google.com>
5981
5982         * output.h (Output_data_reloc::add_output_section): Pass OD instead
5983         of OS to this->add.  Add OD parameter to second form of the function.
5984
5985 2010-12-20  Ian Lance Taylor  <iant@google.com>
5986
5987         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
5988         second of two consecutive entries with same offset.
5989
5990 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5991
5992         * testsuite/Makefile.am (ifuncmain2static_LDADD)
5993         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
5994         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
5995         to avoid unneeded links against $(LDADD).
5996         * testsuite/Makefile.in: Regenerate.
5997
5998 2010-12-15  Ian Lance Taylor  <iant@google.com>
5999
6000         PR gold/12324
6001         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
6002         for R_X86_64_32 and R_X86_64_PC32.
6003         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
6004         ver_matching_def_pic.o.
6005         (ver_matching_def_pic.o): New target.
6006
6007 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6008
6009         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
6010         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
6011         Move definition before File_read::View member definitions.
6012         (File_read::View::~View): Initialize and hold lock before
6013         updating current_mapped_bytes.
6014
6015 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6016
6017         * dwarf_reader.cc: Remove outdated comment.
6018         * gold-threads.cc: Fix typo in error message.
6019         * archive.cc: Fix typos in comments.
6020         * archive.h: Likewise.
6021         * arm-reloc-property.cc: Likewise.
6022         * arm-reloc-property.h: Likewise.
6023         * arm-reloc.def: Likewise.
6024         * arm.cc: Likewise.
6025         * attributes.h: Likewise.
6026         * cref.cc: Likewise.
6027         * ehframe.cc: Likewise.
6028         * fileread.h: Likewise.
6029         * gold.h: Likewise.
6030         * i386.cc: Likewise.
6031         * icf.cc: Likewise.
6032         * incremental.h: Likewise.
6033         * int_encoding.cc: Likewise.
6034         * layout.h: Likewise.
6035         * main.cc: Likewise.
6036         * merge.h: Likewise.
6037         * object.cc: Likewise.
6038         * object.h: Likewise.
6039         * options.cc: Likewise.
6040         * readsyms.cc: Likewise.
6041         * reduced_debug_output.cc: Likewise.
6042         * reloc.cc: Likewise.
6043         * script-sections.cc: Likewise.
6044         * sparc.cc: Likewise.
6045         * symtab.h: Likewise.
6046         * target-reloc.h: Likewise.
6047         * target.cc: Likewise.
6048         * target.h: Likewise.
6049         * timer.cc: Likewise.
6050         * timer.h: Likewise.
6051         * x86_64.cc: Likewise.
6052
6053 2010-12-09  Cary Coutant  <ccoutant@google.com>
6054
6055         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
6056         stack.
6057         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
6058         parameter; change all callers.
6059         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
6060         * options.h (warn_execstack): New option.
6061
6062 2010-12-07  Doug Kwan  <dougkwan@google.com>
6063
6064         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
6065         like function call relocations.
6066
6067 2010-12-07  Ian Lance Taylor  <iant@google.com>
6068
6069         * archive.cc (Archive::get_elf_object_for_member): Permit
6070         punconfigured to be NULL.
6071         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
6072         (Archive::include_member): Pass NULL to get_elf_object_for_member
6073         if we searched for the archive and this is the first included
6074         object.
6075
6076 2010-12-01  Ian Lance Taylor  <iant@google.com>
6077
6078         * dwarf_reader.h (class Sized_dwarf_line_info): Add
6079         track_relocs_type_ field.
6080         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
6081         Set track_relocs_type_.
6082         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
6083         contents when using RELA relocs.
6084         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
6085         reloc_map_.
6086         * reloc.cc (Track_relocs::next_addend): New function.
6087         * reloc.h (class Track_relocs): Declare next_addend.
6088
6089 2010-12-01  Ian Lance Taylor  <iant@google.com>
6090
6091         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
6092         virtual destructor.
6093
6094 2010-12-01  Ian Lance Taylor  <iant@google.com>
6095
6096         * README: Update compilers known to work and fail.
6097
6098 2010-11-23  Matthias Klose  <doko@ubuntu.com>
6099
6100         * configure.in: For --enable-gold, handle value `default' instead of
6101         `both*'.  Always install ld as ld.bfd, install as ld if gold is
6102         not the default.
6103         * configure: Regenerate.
6104
6105 2010-11-18  Doug Kwan  <dougkwan@google.com>
6106
6107         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
6108         and right_alignment to be zero.  Store result alignment only if it is
6109         greater than existing alignment.
6110
6111 2010-11-16  Cary Coutant  <ccoutant@google.com>
6112
6113         PR gold/12220
6114         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
6115         Check for ".zdebug_line".
6116
6117 2010-11-16  Doug Kwan  <dougkwan@google.com>
6118             Cary Coutant  <ccoutant@google.com>
6119
6120         * output.h (Output_segment::set_section_addresses): Pass increase_relro
6121         by reference; adjust all callers.
6122         * output.cc (Output_segment::set_section_addresses): Adjust references
6123         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
6124         list is empty.
6125         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
6126         end at page boundary.
6127
6128 2010-11-16  Cary Coutant  <ccoutant@google.com>
6129
6130         PR gold/12220
6131         * layout.cc (Layout::choose_output_section): Transform names of
6132         compressed sections even when using a script with a SECTIONS clause.
6133         (Layout::output_section_name): Remove code to transform
6134         compressed debug section names.
6135         * output.cc (Output_section::add_input_section): Use uncompressed
6136         section size when tracking input sections.
6137
6138 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
6139
6140         * symtab.h (Symbol::NON_PIC_REF): Remove.
6141         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
6142         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
6143         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
6144         (Symbol::use_plt_offset): Take a flags argument and pass it
6145         directly to needs_dynamic_reloc.  Restrict check for undefined
6146         weak symbols to function calls.
6147         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
6148         (Target_arm::Scan::global): Use it.
6149         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
6150         (Target_arm::Relocate::relocate): Likewise.
6151         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
6152         parameter with an r_type parameter.  Use get_reference_flags
6153         to get the flags.
6154         (Target_arm::Relocate::relocate): Update accordingly.
6155         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
6156         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
6157         (Target_i386::Scan::global): Likewise.
6158         (Target_i386::Relocate::relocate): Likewise.
6159         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
6160         parameter with an r_type parameter.  Use get_reference_flags
6161         to get the flags.
6162         (Target_i386::Relocate::relocate): Update accordingly.
6163         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
6164         (Target_powerpc::Scan::global): Use it.
6165         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
6166         (Target_powerpc::Relocate::relocate): Likewise.
6167         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
6168         (Target_sparc::Scan::global): Use it.
6169         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
6170         (Target_sparc::Relocate::relocate): Likewise.
6171         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
6172         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
6173         (Target_x86_64::Scan::global): Likewise.
6174         (Target_x86_64::Relocate::relocate): Likewise.
6175
6176 2010-11-08  Doug Kwan  <dougkwan@google.com>
6177             Cary Coutant  <ccoutant@google.com>
6178
6179         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
6180         (Arm_exidx_merge_section::section_contents_): New data member.
6181         (Arm_input_section::Arm_input_section): Initialize original_contents_.
6182         (Arm_input_section::~Arm_input_section): De-allocate memory.
6183         (Arm_input_section::original_contents_): New data member.
6184         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
6185         in parameters instead of calling Object::section_contents without
6186         locking.
6187         (Arm_output_section::group_section): New parameter TASK.  Pass it
6188         to callees that need locking objects.
6189         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
6190         to lock EXIDX input sections.  Fix a formatting issue.  Call
6191         Arm_exidx_merged_section::build_contents to create merged section
6192         contents.
6193         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
6194         to lock object of stub table owner.
6195         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
6196         TEXT_SIZE to initialize data member TEXT_SIZE_.
6197         (Arm_exidx_input_section::addralign): Fix typo in comment.
6198         (Arm_exidx_input_section::text_size): New method.
6199         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
6200         that require locking objects.  Lock objects before scanning for stubs
6201         and updating local symbols.
6202         (Arm_input_section<big_endian>::init): Copy contents of original
6203         input section.
6204         (Arm_input_section<big_endian>::do_write): Use saved contents of
6205         original input section instead of calling Object::section_contents
6206         without locking.
6207         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
6208         size without calling Object::section_size().
6209         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
6210         for size.  Allocate a buffer for merged EXIDX entries.
6211         (Arm_exidx_merged_section::build_contents): New method.
6212         (Arm_exidx_merged_section::do_write): Move merge section contents
6213         building code to Arm_exidx_merged_section::build_contetns.  Write
6214         out contetns in buffer instead of building it on the fly.
6215         (Arm_relobj::make_exidx_input_section): Also pass text section size
6216         to Arm_exidx_input_section constructor.
6217         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
6218         (Arm_dynobj::do_read_symbols): Fix memory leak.
6219         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
6220         * target.h: (class Task): Add forward declaration.
6221         (Target::relax): Add new parameter TASK and pass it to
6222         Target::do_relax().
6223         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
6224
6225 2010-11-05  Cary Coutant  <ccoutant@google.com>
6226
6227         PR gold/10708
6228         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
6229         object when reading from the file.
6230         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
6231         second layout pass.
6232         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
6233         when reading section contents.
6234         (get_section_contents): Likewise.
6235         (icf::find_identical_sections): Likewise.
6236         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
6237         object when reading from the file.
6238         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
6239         the object when doing deferred section layout.
6240
6241 2010-11-03  Nick Clifton  <nickc@redhat.com>
6242
6243         PR gold/12001
6244         * script.h (class Symbol_assignment: name): New member.  Returns
6245         the name of the symbol.
6246         * scrfipt.cc (Script_options::is_pending_assignment): New member.
6247         Returns true if the given symbol name is on the list of
6248         assignments wating to be processed.
6249         * archive.cc (should_incldue_member): If the symbol is undefined,
6250         check to see if it is on the list of symbols pending assignment.
6251
6252 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
6253
6254         * script-sections.cc (Script_sections::find_memory_region): Check
6255         for a NULL output section pointer.
6256
6257 2010-10-29  Doug Kwan  <dougkwan@google.com>
6258
6259         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
6260         Output_section::add_relaxed_input_section.
6261         * output.cc (Output_section::add_relaxed_input_section): Add new
6262         arguments LAYOUT and NAME.  Set section order index.
6263         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
6264         Copy section order index.
6265         * output.h (Output_section::add_relaxed_input_section): Add new
6266         arguments LAYOUT and NAME.
6267
6268 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6269
6270         * testsuite/Makefile.am: Move gcctestdir/ld rule to
6271         NATIVE_OR_CROSS_LINKER.
6272         * testsuite/Makefile.in: Regenerate.
6273
6274 2010-10-20  Doug Kwan  <dougkwan@google.com>
6275
6276         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
6277         without SHF_LINK_ORDER flags.
6278         * layout.cc (Layout::choose_output_section): Do not filter
6279         SHF_LINK_ORDER flag in a relocatable link.
6280
6281 2010-10-17  Cary Coutant  <ccoutant@google.com>
6282
6283         * output.h (Output_segment::set_section_addresses): Change function
6284         signature.  Update all callers.
6285         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
6286         sections.
6287         (Output_segment::set_section_addresses): Align after last TLS
6288         section.  Add padding before last relro section instead of after.
6289
6290 2010-10-17  Doug Kwan  <dougkwan@google.com>
6291
6292         * gold/arm.cc (Target_arm::got_section): Use correct order and set
6293         GOT output section to be writable.
6294
6295 2010-10-14  Cary Coutant  <ccoutant@google.com>
6296
6297         * debug.h (DEBUG_INCREMENTAL): New flag.
6298         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
6299         * gold.cc (queue_initial_tasks): Check parameters for incremental link
6300         mode.
6301         * incremental.cc (report_command_line): Ignore all forms of
6302         --incremental.
6303         * layout.cc (Layout::Layout): Check parameters for incremental link
6304         mode.
6305         * options.cc (General_options::parse_incremental): New function.
6306         (General_options::parse_no_incremental): New function.
6307         (General_options::parse_incremental_full): New function.
6308         (General_options::parse_incremental_update): New function.
6309         (General_options::incremental_mode_): New data member.
6310         (General_options::finalize): Check incremental_mode_.
6311         * options.h (General_options): Update help text for --incremental.
6312         Add --no-incremental, --incremental-full, --incremental-update.
6313         (General_options::Incremental_mode): New enum type.
6314         (General_options::incremental_mode): New function.
6315         (General_options::incremental_mode_): New data member.
6316         * parameters.cc (Parameters::incremental_mode_): New data member.
6317         (Parameters::set_options): Set incremental_mode_.
6318         (Parameters::set_incremental_full): New function.
6319         (Parameters::incremental): New function.
6320         (Parameters::incremental_update): New function.
6321         (set_parameters_incremental_full): New function.
6322         * parameters.h (Parameters::set_incremental_full): New function.
6323         (Parameters::incremental): New function.
6324         (Parameters::incremental_update): New function.
6325         (Parameters::incremental_mode_): New data member.
6326         (set_parameters_incremental_full): New function.
6327         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
6328         incremental link mode.
6329         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
6330         (Sized_relobj::do_relocate_sections): Likewise.
6331         * testsuite/Makefile.am (incremental_test): Use --incremental-full
6332         option.
6333         * testsuite/Makefile.in: Regenerate.
6334         * testsuite/incremental_test.sh: Filter all forms of --incremental.
6335
6336 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6337
6338         * script-sections.h (class Script_sections): Make
6339         Sections_elements typedef public.
6340         * script-sections.cc (class Sort_output_sections): Add elements_
6341         field.  Add constructor which sets it; change all callers.
6342         (Sort_output_sections::is_before): New function.
6343         (Sort_output_sections::operator()): Call is_before.
6344         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
6345         conditional.
6346         * testsuite/script_test_10.sh: New test. Test script section
6347         order.
6348         * testsuite/script_test_10.t: Likewise.
6349         * testsuite/script_test_10.s: Likewise.
6350         * testsuite/Makefile.am: Wrap the cross linker tests and the
6351         common tests into NATIVE_OR_CROSS_LINKER.
6352         (check_SCRIPTS): Add script_test_10.sh.
6353         (check_DATA): Add script_test_10.stdout.
6354         (script_test_10.o, script_test_10): New targets.
6355         (script_test_10.stdout): New target.
6356         * configure, testsuite/Makefile.in: Regenerate.
6357
6358 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6359
6360         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
6361         error for the deprecated relocations.
6362         (Target_arm::Scan::global): Likewise.
6363         (Target_arm::Relocate::relocate): Likewise.
6364
6365 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
6366
6367         * fileread.cc (Input_file::find_file): Initialize *found_name
6368         and *namep when using the fallback search for case 4.
6369
6370 2010-10-11  Cary Coutant  <ccoutant@google.com>
6371
6372         * options.h (class General_options): Redefine -z lazy as an alias for
6373         the negation of -z now.
6374
6375 2010-10-11  Ian Lance Taylor  <iant@google.com>
6376
6377         * resolve.cc (symbol_to_bits): Report the value of the unsupported
6378         binding.
6379
6380 2010-10-06  Nick Clifton  <nickc@redhat.com>
6381
6382         * script-sections.cc(class Memory_region): Remove
6383         current_lma_offset_ field.  Rename current_vma_offset_ to
6384         current_offset_.  Add last_section_ field.
6385         (Memory_region::get_current_vma_address): Rename to
6386         get_current_address.
6387         (Memory_region::get_current_lma_address): Delete.
6388         (Memory_region::increment_vma_offset): Rename to
6389         increment_offset.
6390         (Memory_region::increment_lma_offset): Delete.
6391         (Memory_region::attributes_compatible): New method.  Returns
6392         true if the provided section is compatible with the region.
6393         (Memory_region::get_last_section): New method.  Returns the last
6394         section to use the region.
6395         (Memory_region::set_last_section): New method.  Stores the last
6396         section to use the region.
6397         (Script_sections::block_in_region): New method.  Returns true if
6398         a block of memory is contained within a region.
6399         (Script_sections::find_memory_region): New method.  Locates a
6400         memory region to be used to set a VMA or LMA address.
6401         (Output_section_definition::set_section_addresses): Add code to
6402         check for addresses set by memory regions.
6403         (Output_segment::set_section_addresses): Remove memory region
6404         walking code.
6405         (Script_sections::create_segment): Add a warning if a header
6406         segment is created outside of any region.
6407         * script-sections.h (class Script_sections): Add prototypes for
6408         find_memory_region and block_in_region methods.
6409         * testsuite/memory_test.s: Use .long instead of .word.
6410         * testsuite/memory_test.t: Add some more output sections.
6411         * testsuite/memory_test.sh: Update expected output.
6412
6413 2010-10-02  Doug Kwan  <dougkwan@google.com>
6414
6415         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
6416         defintion to symtab.h
6417         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
6418         declaration to defintion.
6419
6420 2010-10-01  Nick Clifton  <nickc@redhat.com>
6421
6422         * expression.cc (eval): Replace dummy argument with NULL.
6423         (eval_maybe_dot): Check for a NULL result section pointer.
6424         (Symbol_expression::value): Likewise.
6425         (Dot_expression::value): Likewise.
6426         (BINARY_EXPRESSION): Likewise.
6427         (Max_expression::value): Likewise.
6428         (Min_expression::value): Likewise.
6429         (Absolute_expression::value): Likewise.
6430         (Addr_expression::value_from_output_section): Likewise.
6431         (Loaddddr_expression::value_from_output_section): Likewise.
6432         (Segment_start_expression::value): Likewise.
6433         * script-sections.cc
6434         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
6435         argument with NULL.
6436         (Sections_elememt_dot_assignment::set_section_addresses):
6437         Likewise.
6438         (Output_data_expression::do_write_to_buffer): Likewise.
6439         (Output_section_definition::finalize_symbols): Likewise.
6440         (Output_section_definition::set_section_addresses): Likewise.
6441
6442 2010-09-30  Doug Kwan  <dougkwan@google.com>
6443
6444         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
6445
6446 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
6447
6448         * target.h (Target::can_icf_inline_merge_sections): New virtual
6449         function.
6450         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
6451         virtual function.
6452         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
6453         virtual function.
6454         * icf.cc (get_section_contents): Inline merge sections only when
6455         target allows it.
6456
6457 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6458
6459         * configure: Regenerate.
6460
6461 2010-09-17  Ian Lance Taylor  <iant@google.com>
6462
6463         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
6464         * testsuite/Makefile.am (memory_test.o): New target.
6465         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
6466         memory_test.t.
6467         * testsuite/Makefile.in: Rebuild.
6468
6469 2010-09-17  Doug Kwan  <dougkwan@google.com>
6470
6471         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
6472         defintion if relocation uses GOT entries of the symbol.
6473         * testsuite/icf_safe_test.sh: Fix test.
6474         * testsuite/icf_safe_so_test.sh: Fix test.
6475
6476 2010-09-16  Cary Coutant  <ccoutant@google.com>
6477
6478         * script_sections.cc (class Memory_region): Remove "NULL" from
6479         vector initializations.
6480
6481 2010-09-15  Cary Coutant  <ccoutant@google.com>
6482
6483         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
6484         Resolve forwarding symbols.
6485
6486 2010-09-15  Doug Kwan  <dougkwan@google.com>
6487
6488         * gold/testsuite/script_test_3.t: Add ARM special sections.
6489         * gold/testsuite/script_test_4.t: Same.
6490         * gold/testsuite/script_test_5.t: Same.
6491         * gold/testsuite/script_test_6.t: Same.
6492         * gold/testsuite/script_test_7.t: Same.
6493         * gold/testsuite/script_test_7.t: Same.
6494         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
6495
6496 2010-09-14  Cary Coutant  <ccoutant@google.com>
6497
6498         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
6499         (Target_x86_64::Relocate::relocate_tls): Replace check for
6500         saw_tls_block_reloc_ with test for executable section.
6501
6502 2010-09-12  Cary Coutant  <ccoutant@google.com>
6503
6504         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
6505         position-independent executables to shared libraries need dynamic
6506         relocations.
6507         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
6508         position-independent executables.
6509         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
6510         * testsuite/Makefile.in: Regenerate.
6511
6512 2010-09-10  Nick Clifton  <nickc@redhat.com>
6513
6514         PR gold/11997
6515         * testsuite/memory_test.t: Discard any sections that are not
6516         needed.
6517
6518 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
6519
6520         PR gold/11996
6521         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
6522         "This::" to work around a bug in gcc 4.2.
6523
6524         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
6525
6526 2010-09-09  Rafael Espindola  <espindola@google.com>
6527
6528         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
6529         sections with different PF_X flags in the same segment.
6530         (Layout::find_first_load_seg): Search all segments to find the first
6531         one.
6532         * options.h (rosegment): New.
6533
6534 2010-09-08  Rafael Espindola  <espindola@google.com>
6535
6536         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
6537
6538 2010-09-08  Doug Kwan  <dougkwan@google.com>
6539
6540         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
6541         (Arm_relobj::do_relocate_sections): Add new parameter for output
6542         file to match the parent.
6543         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
6544         of local symbols instead of input values.  Update code to track
6545         changes in gold::relocate_section.
6546         * object.cc (Sized_relobj::compute_final_local_value): New methods.
6547         (Sized_relobj::compute_final_local_value_internal): New methods.
6548         (Sized_relobj::do_finalize_local_symbols): Move code from loop
6549         body into private version of Sized_relobj::compute_final_local_value.
6550         Call the inline method.
6551         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
6552         merged symbol value if there is one.
6553         (Symbol_value::has_output_value): New method defintiion.
6554         (Sized_relobj::Compute_final_local_value_status): New enum type.
6555         (Sized_relobj::compute_final_local_value): New methods.
6556         (Sized_relobj::compute_final_local_value_internal): New methods.
6557         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
6558         and arm_cortex_a8.sh.
6559         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
6560         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
6561         New tests.
6562         * Makefile.in: Regenerate.
6563         * testsuite/arm_bl_out_of_range.s: Update test.
6564         * testsuite/thumb_bl_out_of_range.s: Ditto.
6565         * testsuite/thumb_blx_out_of_range.s: Ditto.
6566         * testsuite/arm_branch_out_of_range.sh: New file.
6567         * testsuite/arm_cortex_a8.sh: Ditto.
6568         * testsuite/arm_cortex_a8_b.s: Ditto.
6569         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
6570         * testsuite/arm_cortex_a8_b_local.s: Ditto.
6571         * testsuite/arm_cortex_a8_bl.s: Ditto.
6572         * testsuite/arm_cortex_a8_blx.s: Ditto.
6573         * testsuite/arm_cortex_a8_local.s: Ditto.
6574         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
6575         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
6576
6577 2010-09-08  Rafael Espindola  <espindola@google.com>
6578
6579         * Makefile.am (memory_test.stdout): Run readelf with -W.
6580         * Makefile.in: Regenerate.
6581         * testsuite/memory_test.sh: Make the regexps accept both 32 and
6582         64 bit output.
6583
6584 2010-09-08  Rafael Espindola  <espindola@google.com>
6585
6586         * script-sections.cc (Script_sections::add_memory_region): Convert
6587         field precision to int.
6588         * script.cc (script_set_section_region, script_set_section_region):
6589         Convert field precision to int.
6590
6591 2010-09-08  Rafael Espindola  <espindola@google.com>
6592
6593         * arm.cc (do_finalize_sections): Create the __exidx_start and
6594         __exdix_end symbols even when the section is missing.
6595
6596 2010-09-08  Nick Clifton  <nickc@redhat.com>
6597
6598         * README: Remove claim that MEMORY is not supported.
6599         * expression.cc (script_exp_function_origin)
6600         (script_exp_function_length): Move from here to ...
6601         * script.cc: ... here.
6602         (script_set_section_region, script_add_memory)
6603         (script_parse_memory_attr, script_include_directive): New
6604         functions.
6605         * script-sections.cc
6606         (class Memory_region): New class.
6607         (class Output_section_definition): Add set_memory_region,
6608         set_section_vma, set_section_lma and get_section_name methods.
6609         (class Script_Sections): Add add_memory_region,
6610         find_memory_region, find_memory_region_origin,
6611         find_memory_region_length and set_memory_region methods.
6612         Have set_section_addresses method walk the list of set memory
6613         regions.
6614         Extend the print methos to display memory regions.
6615         * script-sections.h: Add prototypes for new methods.
6616         Add enum for MEMORY region attributes.
6617         * yyscript.y: Add support for parsing MEMORY regions.
6618         * script-c.h: Add prototypes for new functions.
6619         * testsuite/Makefile.am: Add test of MEMORY region functionality.
6620         * testsuite/Makefile.in: Regenerate.
6621         * testsuite/memory_test.sh: New script.
6622         * testsuite/memory_test.s: New assembler source file.
6623         * testsuite/memory_test.t: New linker script.
6624
6625 2010-08-27  Doug Kwan  <dougkwan@google.com>
6626
6627         * gold/resolve.cc (Symbol_table::should_override): Let a weak
6628         reference override an existing dynamic weak reference.
6629         * testsuite/Makefile.am: Add new test dyn_weak_ref.
6630         * testsuite/Makefile.in: Regenerate.
6631         * testsuite/dyn_weak_ref.sh: New file.
6632         * testsuite/dyn_weak_ref_1.c: Ditto.
6633         * testsuite/dyn_weak_ref_2.c: Ditto.
6634
6635 2010-08-27  Ian Lance Taylor  <iant@google.com>
6636
6637         * incremental.h (class Incremental_input_entry): Add virtual
6638         destructor.
6639
6640 2010-08-27  Ian Lance Taylor  <iant@google.com>
6641
6642         * testsuite/start_lib_test_3.c: Mark t3 as used.
6643
6644 2010-08-27  Nick Clifton  <nickc@redhat.com>
6645
6646         * options.cc (version_script): Fix small typo in previous
6647         whitespace tidyup.
6648
6649 2010-08-25  Nick Clifton  <nickc@redhat.com>
6650
6651         * archive.cc: Formatting fixes: Remove whitespace between
6652         typename and following asterisk.  Remove whitespace between
6653         function name and opening parenthesis.
6654         * archive.h: Likewise.
6655         * arm.cc: Likewise.
6656         * attributes.cc: Likewise.
6657         * attributes.h: Likewise.
6658         * common.cc: Likewise.
6659         * copy-relocs.cc: Likewise.
6660         * dirsearch.h: Likewise.
6661         * dynobj.cc: Likewise.
6662         * ehframe.cc: Likewise.
6663         * ehframe.h: Likewise.
6664         * expression.cc: Likewise.
6665         * fileread.cc: Likewise.
6666         * fileread.h: Likewise.
6667         * gc.h: Likewise.
6668         * gold-threads.cc: Likewise.
6669         * gold.cc: Likewise.
6670         * i386.cc: Likewise.
6671         * icf.h: Likewise.
6672         * incremental-dump.cc: Likewise.
6673         * incremental.cc: Likewise.
6674         * layout.cc: Likewise.
6675         * layout.h: Likewise.
6676         * main.cc: Likewise.
6677         * merge.cc: Likewise.
6678         * merge.h: Likewise.
6679         * object.cc: Likewise.
6680         * object.h: Likewise.
6681         * options.cc: Likewise.
6682         * options.h: Likewise.
6683         * output.cc: Likewise.
6684         * output.h: Likewise.
6685         * plugin.cc: Likewise.
6686         * plugin.h: Likewise.
6687         * powerpc.cc: Likewise.
6688         * reloc.cc: Likewise.
6689         * script-c.h: Likewise.
6690         * script-sections.cc: Likewise.
6691         * script.cc: Likewise.
6692         * stringpool.cc: Likewise.
6693         * symtab.cc: Likewise.
6694         * symtab.h: Likewise.
6695         * target.cc: Likewise.
6696         * timer.cc: Likewise.
6697         * timer.h: Likewise.
6698         * version.cc: Likewise.
6699         * x86_64.cc: Likewise.
6700
6701 2010-08-24  Nick Clifton  <nickc@redhat.com>
6702
6703         PR 11899
6704         * layout.cc (segment_precedes): Sort segments by their physical
6705         addresses, if they have been set.
6706
6707 2010-08-23  Cary Coutant  <ccoutant@google.com>
6708
6709         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
6710         symbols data.
6711         (Lib_group::include_member): Unlock object after deleting its
6712         symbols data.
6713         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
6714         the bug fixed here.
6715
6716 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
6717             Cary Coutant  <ccoutant@google.com>
6718
6719         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
6720         constructor, and set_blocker.
6721         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
6722         readsyms_blocker_.
6723         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
6724         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
6725         * testsuite/Makefile.am (start_lib_test): New test case.
6726         * testsuite/Makefile.in: Regenerate.
6727         * testsuite/start_lib_test_main.c: New file.
6728         * testsuite/start_lib_test_1.c: New file.
6729         * testsuite/start_lib_test_2.c: New file.
6730         * testsuite/start_lib_test_3.c: New file.
6731
6732 2010-08-19  Ian Lance Taylor  <iant@google.com>
6733
6734         * Makefile.in: Rebuild with automake 1.11.1.
6735         * aclocal.m4: Likewise.
6736         * testsuite/Makefile.in: Likewise.
6737
6738 2010-08-19  Ian Lance Taylor  <iant@google.com>
6739
6740         PR 10893
6741         * i386.cc (class Output_data_plt_i386): Update declarations.
6742         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
6743         local_ifuncs_ fields.
6744         (Target_i386::do_plt_section_for_global): New function.
6745         (Target_i386::do_plt_section_for_local): New function.
6746         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
6747         parameter; change all callers.  Initialize global_ifuncs_ and
6748         local_ifuncs_.  If doing a static link define __rel_iplt_start and
6749         __rel_iplt_end.
6750         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
6751         (Output_data_plt_i386::add_local_ifunc_entry): New function.
6752         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
6753         symbols.
6754         (Target_i386::make_plt_section): New function, broken out of
6755         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
6756         (Target_i386::make_plt_entry): Call make_plt_section.
6757         (Target_i386::make_local_ifunc_plt_entry): New function.
6758         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
6759         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
6760         R_386_IRELATIVE to switch.
6761         (Target_i386::Scan::global): Likewise.
6762         (Target_i386::Relocate::relocate): Likewise.
6763         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
6764         switch.
6765         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
6766         (Target_x86_64::do_plt_section_for_global): New function.
6767         (Target_x86_64::do_plt_section_for_local): New function.
6768         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
6769         parameter; change all callers.  If doing a static link define
6770         __rela_iplt_start and __rela_iplt_end.
6771         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
6772         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
6773         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
6774         to point to .plt.
6775         (Target_x86_64::make_local_ifunc_plt_entry): New function.
6776         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
6777         switch.
6778         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
6779         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
6780         R_X86_64_IRELATIVE to switch.
6781         (Target_x86_64::Scan::global): Likewise.
6782         (Target_x86_64::Relocate::relocate): Likewise.
6783         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
6784         switch.
6785         * target.h (class Target): Add plt_section_for_global and
6786         plt_section_for_local functions.  Add do_plt_section_for_global
6787         and do_plt_section_for_local virtual functions.
6788         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
6789         clarifying comments.
6790         (Symbol::use_plt_offset): Handle IFUNC symbol.
6791         * object.cc (Sized_relobj::Sized_relobj): Initialize
6792         local_plt_offsets_.
6793         (Sized_relobj::local_has_plt_offset): New function.
6794         (Sized_relobj::local_plt_offset): New function.
6795         (Sized_relobj::set_local_plt_offset): New function.
6796         (Sized_relobj::do_count): Handle IFUNC symbol.
6797         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
6798         a bit away from input_shndx_ field.  Add set_is_func_symbol and
6799         is_ifunc_symbol functions.
6800         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
6801         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
6802         local_plt_offsets_ field.
6803         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
6804         * output.h (class Output_section_data): Add non-const
6805         output_section function.
6806         (class Output_data_got): Update declarations.
6807         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
6808         Add use_plt_offset parameter to global and local constructors.
6809         Change all callers.  Change local_sym_index_ field to 31 bits.
6810         Change GSYM_CODE and CONSTANT_CODE accordingly.
6811         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
6812         doing a static link don't set sh_link field.
6813         (Output_data_got::Got_entry::write): Use PLT offset if
6814         appropriate.
6815         (Output_data_got::add_global_plt): New function.
6816         (Output_data_got::add_local_plt): New function.
6817         * target-reloc.h (relocate_section): Handle IFUNC symbol.
6818         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
6819         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
6820         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
6821         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
6822         IFUNC conditional.
6823         * testsuite/ifunc-sel.h: New file.
6824         * testsuite/ifuncmain1.c: New file.
6825         * testsuite/ifuncmain1vis.c: New file.
6826         * testsuite/ifuncmod1.c: New file.
6827         * testsuite/ifuncdep2.c: New file.
6828         * testsuite/ifuncmain2.c: New file.
6829         * testsuite/ifuncmain3.c: New file.
6830         * testsuite/ifuncmod3.c: New file.
6831         * testsuite/ifuncmain4.c: New file.
6832         * testsuite/ifuncmain5.c: New file.
6833         * testsuite/ifuncmod5.c: New file.
6834         * testsuite/ifuncmain6pie.c: New file.
6835         * testsuite/ifuncmod6.c: New file.
6836         * testsuite/ifuncmain7.c: New file.
6837         * configure, testsuite/Makefile.in: Rebuild.
6838
6839 2010-08-18  Ian Lance Taylor  <iant@google.com>
6840
6841         * incremental.cc
6842         (Output_section_incremental_inputs::write_input_files): Add cast
6843         to avoid signed/unsigned comparison warning.
6844         (Output_section_incremental_inputs::write_info_blocks): Likewise.
6845
6846 2010-08-12  Cary Coutant  <ccoutant@google.com>
6847
6848         * common.cc (Sort_commons::operator()): Remove unnecessary code.
6849
6850 2010-08-13  Ian Lance Taylor  <iant@google.com>
6851
6852         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
6853
6854 2010-08-12  Cary Coutant  <ccoutant@google.com>
6855             Doug Kwan  <dougkwan@google.com>
6856
6857         * resolve.cc (Symbol_table::should_override): When a weak dynamic
6858         defintion overrides non-weak undef, remember that the original undef
6859         is not weak.
6860         * symtab.cc (Symbol_table::sized_write_global): For undef without
6861         an original weak binding, set binding to global in output.
6862         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
6863         * testsuite/Makefile.in: Regenerate.
6864         * testsuite/strong_ref_weak_def.sh: New file.
6865         * testsuite/strong_ref_weak_def_1.c: Ditto.
6866         * testsuite/strong_ref_weak_def_2.c: Ditto.
6867
6868 2010-08-12  Cary Coutant  <ccoutant@google.com>
6869
6870         * testsuite/incremental_test.sh: Rewrite.
6871         * testsuite/incremental_test_1.c: Rewrite.
6872         * testsuite/incremental_test_2.c: Rewrite.
6873
6874 2010-08-12  Cary Coutant  <ccoutant@google.com>
6875
6876         * arm.cc (Target_arm::got_size): Add const.
6877         (Target_arm::got_entry_count): New function.
6878         (Target_arm::plt_entry_count): New function.
6879         (Target_arm::first_plt_entry_offset): New function.
6880         (Target_arm::plt_entry_size): New function.
6881         (Output_data_plt_arm::entry_count): New function.
6882         (Output_data_plt_arm::first_plt_entry_offset): New function.
6883         (Output_data_plt_arm::get_plt_entry_size): New function.
6884         * i386.cc (Target_i386::got_size): Add const.
6885         (Target_i386::got_entry_count): New function.
6886         (Target_i386::plt_entry_count): New function.
6887         (Target_i386::first_plt_entry_offset): New function.
6888         (Target_i386::plt_entry_size): New function.
6889         (Output_data_plt_i386::entry_count): New function.
6890         (Output_data_plt_i386::first_plt_entry_offset): New function.
6891         (Output_data_plt_i386::get_plt_entry_size): New function.
6892         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
6893         find_incremental_inputs_sections.  Dump incremental_got_plt section.
6894         * incremental.cc: Include target.h.
6895         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
6896         parameter.  Adjust all callers.  Find incremental_got_plt section.
6897         (Incremental_inputs::create_data_sections): Create incremental_got_plt
6898         section.
6899         (Output_section_incremental_inputs::set_final_data_size): Calculate
6900         size of incremental_got_plt section.
6901         (Output_section_incremental_inputs::do_write): Write the
6902         incremental_got_plt section.
6903         (Got_plt_view_info): New struct.
6904         (Local_got_offset_visitor): New class.
6905         (Global_got_offset_visitor): New class.
6906         (Global_symbol_visitor_got_plt): New class.
6907         (Output_section_incremental_inputs::write_got_plt): New function.
6908         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
6909         Add parameter.  Adjust all callers.
6910         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
6911         (Incremental_inputs::got_plt_section): New function.
6912         (Incremental_inputs::got_plt_section_): New data member.
6913         (Incremental_got_plt_reader): New class.
6914         * layout.cc (Layout::create_incremental_info_sections): Add the
6915         incremental_got_plt section.
6916         * object.h (Got_offset_list::get_list): New function.
6917         (Got offset_list::for_all_got_offsets): New function.
6918         (Sized_relobj::local_got_offset_list): New function.
6919         * powerpc.cc (Target_powerpc::got_size): Add const.
6920         (Target_powerpc::got_entry_count): New function.
6921         (Target_powerpc::plt_entry_count): New function.
6922         (Target_powerpc::first_plt_entry_offset): New function.
6923         (Target_powerpc::plt_entry_size): New function.
6924         (Output_data_plt_powerpc::entry_count): New function.
6925         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
6926         (Output_data_plt_powerpc::get_plt_entry_size): New function.
6927         * sparc.cc (Target_sparc::got_size): Add const.
6928         (Target_sparc::got_entry_count): New function.
6929         (Target_sparc::plt_entry_count): New function.
6930         (Target_sparc::first_plt_entry_offset): New function.
6931         (Target_sparc::plt_entry_size): New function.
6932         (Output_data_plt_sparc::entry_count): New function.
6933         (Output_data_plt_sparc::first_plt_entry_offset): New function.
6934         (Output_data_plt_sparc::get_plt_entry_size): New function.
6935         * symtab.h (Symbol::got_offset_list): New function.
6936         (Symbol_table::for_all_symbols): New function.
6937         * target.h (Sized_target::got_entry_count): New function.
6938         (Sized_target::plt_entry_count): New function.
6939         (Sized_target::plt_entry_size): New function.
6940         * x86_64.cc (Target_x86_64::got_size): Add const.
6941         (Target_x86_64::got_entry_count): New function.
6942         (Target_x86_64::plt_entry_count): New function.
6943         (Target_x86_64::first_plt_entry_offset): New function.
6944         (Target_x86_64::plt_entry_size): New function.
6945         (Output_data_plt_x86_64::entry_count): New function.
6946         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
6947         (Output_data_plt_x86_64::get_plt_entry_size): New function.
6948
6949 2010-08-12  Cary Coutant  <ccoutant@google.com>
6950
6951         * archive.cc: Include incremental.h.
6952         (Archive::Archive): Initialize incremental_info_.
6953         (Archive::include_member): Record archive members in incremental info.
6954         (Add_archive_symbols::run): Record begin and end of an archive in
6955         incremental info.
6956         (Lib_group::include_member): Record objects in incremental info.
6957         * archive.h (Incremental_archive_entry): Forward declaration.
6958         (Archive::set_incremental_info): New member function.
6959         (Archive::incremental_info): New member function.
6960         (Archive::Unused_symbol_iterator): New class.
6961         (Archive::unused_symbols_begin): New member function.
6962         (Archive::unused_symbols_end): New member function.
6963         (Archive::incremental_info_): New data member.
6964         * incremental-dump.cc (find_input_containing_global): New function.
6965         (dump_incremental_inputs): Dump new incremental info sections.
6966         * incremental.cc: Include symtab.h.
6967         (Output_section_incremental_inputs): New class.
6968         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
6969         new incremental info sections.
6970         (Sized_incremental_binary::do_check_inputs): Likewise.
6971         (Incremental_inputs::report_archive): Remove.
6972         (Incremental_inputs::report_archive_begin): New function.
6973         (Incremental_inputs::report_archive_end): New function.
6974         (Incremental_inputs::report_object): New function.
6975         (Incremental_inputs::finalize_inputs): Remove.
6976         (Incremental_inputs::report_input_section): New function.
6977         (Incremental_inputs::report_script): Rewrite.
6978         (Incremental_inputs::finalize): Do nothing but finalize string table.
6979         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
6980         (Incremental_inputs::sized_create_inputs_section_data): Remove.
6981         (Incremental_inputs::create_data_sections): New function.
6982         (Incremental_inputs::relocs_entsize): New function.
6983         (Output_section_incremental_inputs::set_final_data_size): New function.
6984         (Output_section_incremental_inputs::do_write): New function.
6985         (Output_section_incremental_inputs::write_header): New function.
6986         (Output_section_incremental_inputs::write_input_files): New function.
6987         (Output_section_incremental_inputs::write_info_blocks): New function.
6988         (Output_section_incremental_inputs::write_symtab): New function.
6989         * incremental.h (Incremental_script_entry): Forward declaration.
6990         (Incremental_object_entry): Forward declaration.
6991         (Incremental_archive_entry): Forward declaration.
6992         (Incremental_inputs): Forward declaration.
6993         (Incremental_inputs_header_data): Remove.
6994         (Incremental_inputs_header): Remove.
6995         (Incremental_inputs_header_write): Remove.
6996         (Incremental_inputs_entry_data): Remove.
6997         (Incremental_inputs_entry): Remove.
6998         (Incremental_inputs_entry_write): Remove.
6999         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
7000         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
7001         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
7002         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
7003         Likewise.
7004         (Incremental_input_entry): New class.
7005         (Incremental_script_entry): New class.
7006         (Incremental_object_entry): New class.
7007         (Incremental_archive_entry): New class.
7008         (Incremental_inputs::Incremental_inputs): Initialize new data members.
7009         (Incremental_inputs::report_inputs): Remove.
7010         (Incremental_inputs::report_archive): Remove.
7011         (Incremental_inputs::report_archive_begin): New function.
7012         (Incremental_inputs::report_archive_end): New function.
7013         (Incremental_inputs::report_object): Change prototype.
7014         (Incremental_inputs::report_input_section): New function.
7015         (Incremental_inputs::report_script): Change prototype.
7016         (Incremental_inputs::get_reloc_count): New function.
7017         (Incremental_inputs::set_reloc_count): New function.
7018         (Incremental_inputs::create_data_sections): New function.
7019         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
7020         (Incremental_inputs::inputs_section): New function.
7021         (Incremental_inputs::symtab_section): New function.
7022         (Incremental_inputs::relocs_section): New function.
7023         (Incremental_inputs::get_stringpool): Add const.
7024         (Incremental_inputs::command_line): Add const.
7025         (Incremental_inputs::inputs): Remove.
7026         (Incremental_inputs::command_line_key): New function.
7027         (Incremental_inputs::input_file_count): New function.
7028         (Incremental_inputs::input_files): New function.
7029         (Incremental_inputs::relocs_entsize): New function.
7030         (Incremental_inputs::sized_create_inputs_section_data): Remove.
7031         (Incremental_inputs::finalize_inputs): Remove.
7032         (Incremental_inputs::Input_info): Remove.
7033         (Incremental_inputs::lock_): Remove.
7034         (Incremental_inputs::inputs_): Change type.
7035         (Incremental_inputs::inputs_map_): Remove.
7036         (Incremental_inputs::current_object_entry_): New data member.
7037         (Incremental_inputs::inputs_section_): New data member.
7038         (Incremental_inputs::symtab_section_): New data member.
7039         (Incremental_inputs::relocs_section_): New data member.
7040         (Incremental_inputs::reloc_count_): New data member.
7041         (Incremental_inputs_reader): New class.
7042         (Incremental_symtab_reader): New class.
7043         (Incremental_relocs_reader): New class.
7044         * layout.cc (Layout::finalize): Move finalization of incremental info
7045         and creation of incremental info sections to follow finalization of
7046         symbol table.  Set offsets for postprocessing sections.
7047         (Layout::create_incremental_info_sections): Call
7048         Incremental_inputs::create_data_sections.  Add incremental symtab
7049         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
7050         sections to layout after input sections.
7051         * layout.h (struct Timespec): Forward declaration.
7052         (Layout::incremental_inputs): Add const.
7053         (Layout::create_incremental_info_sections): Add parameter.
7054         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
7055         * object.cc: Include incremental.h.
7056         (Relobj::finalize_incremental_relocs): New function.
7057         (Sized_relobj::do_layout): Record input sections in incremental info.
7058         * object.h (Object::output_section): New function.
7059         (Object::output_section_offset): Moved from Relobj.
7060         (Object::get_incremental_reloc_base): New function.
7061         (Object::get_incremental_reloc_count): New function.
7062         (Object::do_output_section): New function.
7063         (Object::do_output_section_offset): Moved from Relobj.
7064         (Object::do_get_incremental_reloc_base): New function.
7065         (Object::do_get_incremental_reloc_count): New function.
7066         (Object::Object): Initialize new data members.
7067         (Relobj::output_section): Renamed do_output_section and moved to
7068         protected.
7069         (Relobj::output_section_offset): Moved to Object.
7070         (Relobj::do_get_incremental_reloc_base): New function.
7071         (Relobj::do_get_incremental_reloc_count): New function.
7072         (Relobj::allocate_incremental_reloc_counts): New function.
7073         (Relobj::count_incremental_reloc): New function.
7074         (Relobj::finalize_incremental_relocs): New function.
7075         (Relobj::next_incremental_reloc_index): New function.
7076         (Relobj::reloc_counts_): New data member.
7077         (Relobj::reloc_bases_): New data member.
7078         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
7079         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
7080         (Sized_relobj::incremental_relocs_scan): New function.
7081         (Sized_relobj::incremental_relocs_scan_reltype): New function.
7082         (Sized_relobj::incremental_relocs_write): New function.
7083         (Sized_relobj::incremental_relocs_write_reltype): New function.
7084         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
7085         incremental link.
7086         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
7087         archives and object files elsewhere.
7088         (Add_symbols::run): Report object files here.
7089         (Finish_group::run): Report end of archive at end of group.
7090         * reloc.cc: Include layout.h, incremental.h.
7091         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
7092         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
7093         (Sized_relobj::incremental_relocs_scan): New function.
7094         (Sized_relobj::incremental_relocs_scan_reltype): New function.
7095         (Sized_relobj::do_relocate_sections): Write incremental relocations.
7096         (Sized_relobj::incremental_relocs_write): New function.
7097         (Sized_relobj::incremental_relocs_write_reltype): New function.
7098         * script.cc (read_input_script): Rewrite test for incremental link.
7099         Change call to Incremental_inputs::report_script.
7100         * symtab.h (Symbol_table::first_global_index): New function.
7101         (Symbol_table::output_count): New function.
7102
7103 2010-08-12  Doug Kwan  <dougkwan@google.com>
7104
7105         * arm.cc (Target_arm::merge_object_attributes): Check command line
7106         options --no-wchar-size-warning and --no-enum-size-warning.
7107         * options.h (General_options): Add ld-compatible options
7108         --no-enum-size-warning and --no-wchar-size-warning.
7109
7110 2010-08-04  Ian Lance Taylor  <iant@google.com>
7111
7112         * x86_64.cc (Target_x86_64::Scan::local): Use
7113         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
7114         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
7115         (Target_x86_64::Scan::global): Likewise.
7116         (Target_x86_64::Relocate::relocate): Likewise.
7117         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
7118         Likewise.
7119
7120 2010-08-03  Cary Coutant  <ccoutant@google.com>
7121
7122         * merge.cc (Output_merge_string::do_add_input_section): Count strings
7123         to reserve space in merged_strings vector. Keep total input size
7124         for stats.
7125         (Output_merge_string::do_print_merge_stats): Print total input size.
7126         * merge.h (Output_merge_string): Add input_size_ field.
7127         * stringpool.cc (Stringpool_template::string_length): Move
7128         implementations out of Stringpool_template class and place in
7129         stringpool.h.
7130         * stringpool.h (string_length): Move out of Stringpool_template.
7131
7132 2010-08-03  Ian Lance Taylor  <iant@google.com>
7133
7134         PR 11712
7135         * layout.cc (relaxation_loop_body): If address of load segment is
7136         set, adjust address to include headers if possible.
7137
7138 2010-08-03  Ian Lance Taylor  <iant@google.com>
7139
7140         * version.cc (version_string): Bump to 1.10.
7141
7142 2010-08-03  Ian Lance Taylor  <iant@google.com>
7143
7144         PR 11805
7145         * layout.h (enum Output_section_order): Define.
7146         (class Layout): Update declarations.
7147         * layout.cc (Layout::get_output_section): Add order parameter.
7148         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
7149         is_first_non_relro parameters.  Change all callers.
7150         (Layout::choose_output_section): Likewise.
7151         (Layout::add_output_section_data): Likewise.
7152         (Layout::make_output_section): Likewise.  Set order.
7153         (Layout::default_section_order): New function.
7154         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
7155         * output.cc (Output_section::Output_section): Initialize order_.
7156         Don't initialize deleted fields.
7157         (Output_segment::Output_segment): Don't initialize deleted
7158         fields.
7159         (Output_segment::add_output_section_to_load): New function
7160         replacing add_output_section.  Change all callers to call this or
7161         add_output_section_to_nonload.
7162         (Output_segment::add_output_section_to_nonload): New function.
7163         (Output_segment::remove_output_section): Rewrite.
7164         (Output_segment::add_initial_output_data): Likewise.
7165         (Output_segment::has_any_data_sections): Likewise.
7166         (Output_segment::is_first_section_relro): Likewise.
7167         (Output_segment::maximum_alignment): Likewise.
7168         (Output_segment::has_dynamic_reloc): New function replacing
7169         dynamic_reloc_count.  Change all callers.
7170         (Output_segment::has_dynamic_reloc_list): New function replacing
7171         dynamic_reloc_count_list.  Change all callers.
7172         (Output_segment::set_section_addresses): Rewrite.
7173         (Output_segment::set_offset): Rewrite.
7174         (Output_segment::find_first_and_last_list): Remove.
7175         (Output_segment::set_tls_offsets): Rewrite.
7176         (Output_segment::first_section_load_address): Likewise.
7177         (Output_segment::output_section_count): Likewise.
7178         (Output_segment::section_with_lowest_load_address): Likewise.
7179         (Output_segment::write_section_headers): Likewise.
7180         (Output_segment::print_sections_to_map): Likewise.
7181         * output.h (class Output_data): Remove dynamic_reloc_count_
7182         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
7183         (Output_data::add_dynamic_reloc): Rewrite.
7184         (Output_data::has_dynamic_reloc): New function.
7185         (Output_data::dynamic_reloc_count): Remove.
7186         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
7187         is_last_relro_, is_first_non_relro_, is_interp_,
7188         is_dynamic_linker_section_ fields.  Add order and set_order
7189         functions.  Remove is_relro_local, set_is_relro_local,
7190         is_last_relro, set_is_last_relro, is_first_non_relro,
7191         set_is_first_non_relro functions, is_interp, set_is_interp,
7192         is_dynamic_linker_section, and set_is_dynamic_linker_section
7193         functions.
7194         (class Output_segment): Change Output_data_list from std::list to
7195         std:;vector.  Add output_lists_ field.  Remove output_data_ and
7196         output_bss_ fields.  Update declarations.
7197
7198 2010-08-02  Ian Lance Taylor  <iant@google.com>
7199
7200         * arm.cc (Target_arm::gc_process_relocs): Use typename.
7201         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
7202         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
7203
7204 2010-08-02  Ian Lance Taylor  <iant@google.com>
7205
7206         PR 11855
7207         * script.cc (Script_options::Script_options): Initialize
7208         symbol_definitions_ and symbol_references_.
7209         (Script_options::add_symbol_assignment): Update
7210         symbol_definitions_ and symbol_references_.
7211         (Script_options::add_symbol_reference): New function.
7212         (script_symbol): New function.
7213         * script.h (class Script_options): Add symbol_definitions_ and
7214         symbol_references_ fields.
7215         (Script_options::referenced_const_iterator): New type.
7216         (Script_options::referenced_begin): New function.
7217         (Script_options::referenced_end): New function.
7218         (Script_options::is_referenced): New function.
7219         (Script_options::any_unreferenced): New function.
7220         * script-c.h (script_symbol): Declare.
7221         * yyscript.y (exp): Call script_symbol.
7222         * symtab.cc: Include "script.h".
7223         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
7224         Change all callers.  Check symbols referenced by scripts.
7225         (Symbol_table::add_undefined_symbols_from_command_line): Add
7226         layout parameter.  Change all callers.
7227         (Symbol_table::do_add_undefined_symbols_from_command_line):
7228         Likewise.  Break out loop body.  Check symbols referenced by
7229         scripts.
7230         (Symbol_table::add_undefined_symbol_from_command_line): New
7231         function broken out of
7232         do_add_undefined_symbols_from_command_line.
7233         * symtab.h (class Symbol_table): Update declarations.
7234         * archive.cc: Include "layout.h".
7235         (Archive::should_include_member): Add layout parameter.  Change
7236         all callers.  Check for symbol mentioned in expression.
7237         * archive.h (class Archive): Update declaration.
7238         * object.cc (Sized_relobj::do_should_include_member): Add layout
7239         parameter.
7240         * object.h (Object::should_include_member): Add layout parameter.
7241         Change all callers.
7242         (Object::do_should_include_member): Add layout parameter.
7243         (class Sized_relobj): Update declaration.
7244         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
7245         parameter.
7246         * dynobj.h (class Sized_dynobj): Update declaration.
7247         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
7248         layout parameter.
7249         * plugin.h (class Sized_pluginobj): Update declaration.
7250
7251 2010-08-02  Ian Lance Taylor  <iant@google.com>
7252
7253         PR 11866
7254         * output.cc (Output_segment::set_offset): Search for the first and
7255         last sections rather than assuming that the list is in order.
7256         (Output_segment::find_first_and_last_list): New function.
7257         * output.h (class Output_segment): Update declarations.
7258         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
7259         (relro_strip_test_SOURCES): New variable.
7260         (relro_strip_test_DEPENDENCIES): New variable.
7261         (relro_strip_test_LDFLAGS): New variable.
7262         (relro_strip_test_LDADD): New variable.
7263         (relro_strip_test.so): New target.
7264
7265 2010-08-02  Ian Lance Taylor  <iant@google.com>
7266
7267         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
7268         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
7269         (Target_i386::got_tlsdesc_section): New function.
7270         (Target_i386::got_section): Create space for GOT entries for
7271         TLSDESC relocations.
7272         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
7273         R_386_TLS_GOTDESC.
7274         (Target_i386::Scan::global): Likewise.
7275         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
7276         using TLSDESC GOT.
7277         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
7278         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
7279         (Target_x86_64::got_tlsdesc_section): New function.
7280         (Target_x86_64::got_section): Create space for GOT entries for
7281         TLSDESC relocations.
7282         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
7283         R_386_TLS_GOTDESC.
7284         (Target_x86_64::Scan::global): Likewise.
7285         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
7286         using TLSDESC GOT.
7287
7288 2010-08-02  Ian Lance Taylor  <iant@google.com>
7289
7290         * testsuite/final_layout.sh: Use dc to convert from hex to
7291         decimal.
7292
7293 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
7294
7295         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
7296         paramter to the call to gold::gc_process_relocs.
7297         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
7298         paramter to the call to gold::gc_process_relocs.
7299         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
7300         parameter to the call to gold::gc_process_relocs.
7301         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
7302         template parameter to the call to gold::gc_process_relocs.
7303         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
7304         paramter to the call to gold::gc_process_relocs.
7305         * gc.h (get_embedded_addend_size): New function.
7306         (gc_process_relocs): Save the size of the reloc for use by ICF.
7307         * icf.cc (get_section_contents): Get the addend from the text section
7308         for SHT_REL relocation sections.
7309         * icf.h (Icf::Reloc_addend_size_info): New typedef.
7310         (Icf::Reloc_info): Add new member reloc_addend_size_info.
7311         * int_encoding.h (read_from_pointer): New overloaded function.
7312         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
7313         * testsuite/icf_sht_rel_addend_test.sh: New file.
7314         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
7315         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
7316
7317 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7318
7319         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
7320         * Makefile.in: Regenerate.
7321         * testsuite/Makefile.in: Regenerate.
7322
7323 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
7324
7325         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
7326         * gold/testsuite/debug_msg.cc: Likewise.
7327         * gold/testsuite/odr_violation1.cc
7328         * gold/testsuite/odr_violation2.cc
7329
7330 2010-07-21  Cary Coutant  <ccoutant@google.com>
7331
7332         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
7333         string, and length fields.
7334         (Output_merge_string::Merged_strings_list): New type.
7335         (Output_merge_string::Merged_strings_lists): New typedef.
7336         (Output_merge_string): Replace merged_strings_ with
7337         merged_strings_lists_.
7338         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
7339         Merged_strings_list per input object and section.  Don't store pointer
7340         to the string.  Don't store length with each merged string entry.
7341         (Output_merge_string::finalize_merged_data): Loop over list of merged
7342         strings lists.  Recompute length of each merged string.
7343
7344 2010-07-15  Cary Coutant  <ccoutant@google.com>
7345
7346         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
7347         here.
7348
7349 2010-07-14  Ian Lance Taylor  <iant@google.com>
7350
7351         * descriptors.cc (Descriptors::open): Report correct name in error
7352         message.
7353
7354 2010-07-13  Doug Kwan  <dougkwan@google.com>
7355
7356         * arm.cc (Arm_input_section::Arm_input_section): For a
7357         SHT_ARM_EXIDX section, always keeps the input sections.
7358         (Arm_input_section::set_exidx_section_link): New method.
7359         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
7360         has_errors_ to false.
7361         (Arm_exidx_input_section::has_errors,
7362         Arm_exidx_input_section::set_has_errors): New methods.
7363         (Arm_exidx_input_section::has_errors_): New data member.
7364         (Arm_relobj::get_exidx_shndx_list): New method.
7365         (Arm_output_section::append_text_sections_to_list): Do not skip
7366         section without SHF_EXECINSTR.
7367         (Arm_output_section::fix_exidx_coverage): Skip input sections with
7368         errors.
7369         (Arm_relobj::make_exidx_input_section): Add new parameter for text
7370         section header.  Make error messages more verbose.  Check for
7371         a non-executable section linked to an EXIDX section.
7372         (Arm_relobj::do_read_symbols): Remove error checking, which has been
7373         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
7374         check that there is no deferred EXIDX section if we exit early.
7375         Instead of not making an EXIDX section in case of an error, make one
7376         and set the has_errors flag of it.
7377         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
7378         in a relocatable link.
7379         (Target_arm::do_relax): Look for the EXIDX output section instead of
7380         assuming that it is called .ARM.exidx.
7381         (Target_arm::fix_exidx_coverage): Add a new parameter for input
7382         section list.  Do not check for SHF_EXECINSTR section flags but
7383         skip any input section with errors.
7384         * output.cc (Output_section::Output_section): Initialize
7385         always_keeps_input_sections_ to false.
7386         (Output_section::add_input_section): Check for
7387         always_keeps_input_sections_.
7388         *  output.h (Output_section::always_keeps_input_sections,
7389         Output_section::set_always_keeps_input_sections): New methods.
7390         (Output_section::always_keeps_input_sections): New data member.
7391
7392 2010-07-13  Rafael Espindola  <espindola@google.com>
7393
7394         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
7395         * fileread.h (Input_file): Add try_extra_search_path and find_file.
7396
7397 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
7398             Ian Lance Taylor  <iant@google.com>
7399
7400         * output.h (Output_section_lookup_maps::add_merge_section):
7401         Correct check of whether value was inserted.
7402         (Output_section_lookup_maps::add_merge_input_section): Likewise.
7403         (Output_section_lookup_maps::add_relaxed_input_section):
7404         Likewise.
7405         * arm.cc (Target_arm::got_section): Remove used local os.
7406         * i386.cc (Target_i386::got_section): Likewise.
7407         * x86_64.cc (Target_x86_64::got_section): Likewise.
7408         * sparc.cc (Target_sparc::got_section): Likewise.
7409         (Target_sparc::relocate): Remove unused local have_got_offset.
7410         * powerpc.cc (Target_powerpc::relocate): Likewise.
7411
7412 2010-07-13  Ian Lance Taylor  <iant@google.com>
7413
7414         * compressed_output.cc (zlib_decompress): Fix signature in
7415         !HAVE_ZLIB_H case.
7416
7417         * archive.cc (Archive::include_member): Unlock an external member
7418         of a thin archive.  Don't bother to delete an object we know is
7419         NULL.
7420
7421 2010-07-12  Cary Coutant  <ccoutant@google.com>
7422
7423         * compressed_output.cc (zlib_decompress): New function.
7424         (get_uncompressed_size): New function.
7425         (decompress_input_section): New function.
7426         * compressed_output.h (get_uncompressed_size): New function.
7427         (decompress_input_section): New function.
7428         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
7429         Handle compressed debug sections.
7430         * layout.cc (is_compressed_debug_section): New function.
7431         (Layout::output_section_name): Map compressed section names to
7432         canonical names.
7433         * layout.h (is_compressed_debug_section): New function.
7434         (is_debug_info_section): Recognize compressed debug sections.
7435         * merge.cc: Include compressed_output.h.
7436         (Output_merge_data::do_add_input_section): Handle compressed
7437         debug sections.
7438         (Output_merge_string::do_add_input_section): Handle compressed
7439         debug sections.
7440         * object.cc: Include compressed_output.h.
7441         (Sized_relobj::Sized_relobj): Initialize new data members.
7442         (build_compressed_section_map): New function.
7443         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
7444         * object.h (Object::section_is_compressed): New method.
7445         (Object::do_section_is_compressed): New method.
7446         (Sized_relobj::Compressed_section_map): New type.
7447         (Sized_relobj::do_section_is_compressed): New method.
7448         (Sized_relobj::compressed_sections_): New data member.
7449         * output.cc (Output_section::add_input_section): Handle compressed
7450         debug sections.
7451         * reloc.cc: Include compressed_output.h.
7452         (Sized_relobj::write_sections): Handle compressed debug sections.
7453
7454 2010-07-08  Cary Coutant  <ccoutant@google.com>
7455
7456         * resolve.cc (Symbol_table::resolve): Remember whether undef was
7457         weak when resolving to a dynamic def.
7458         (Symbol_table::should_override): Add adjust_dyndef flag; set it
7459         for weak undef/dynamic def cases. Adjust callers.
7460         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
7461         undef_binding_weak_.
7462         (Symbol_table::sized_write_globals): Adjust symbol binding.
7463         (Symbol_table::sized_write_symbol): Add binding parameter.
7464         * symtab.h (Symbol::set_undef_binding): New method.
7465         (Symbol::is_undef_binding_weak): New method.
7466         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
7467         (Symbol_table::should_override): Add new parameter.
7468         (Symbol_table::sized_write_symbol): Add new parameter.
7469
7470         * testsuite/weak_undef_file1.cc: Add new test case.
7471         * testsuite/weak_undef_file2.cc: Fix header comment.
7472         * testsuite/weak_undef_test.cc: Add new test case.
7473
7474 2010-06-29  Doug Kwan  <dougkwan@google.com>
7475
7476         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
7477         Initialize USE_SYMBOL_.
7478         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
7479         definition.
7480         (Arm_reloc_property::uses_symbol_): New data member declaration.
7481         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
7482         uses symbol value and symbol is undefined but not weakly undefined.
7483
7484 2010-06-28  Rafael Espindola  <espindola@google.com>
7485
7486         * plugin.cc (Plugin::load): Use dlerror.
7487
7488 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
7489
7490         * symtab.cc (detect_odr_violations): When reporting an ODR
7491         violation, report an object where the symbol is defined.
7492
7493 2010-06-25  Doug Kwan  <dougkwan@google.com>
7494
7495         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
7496         (Target_arm::section_may_have_icf_unsafe_pointers): New method
7497         definition.
7498         (Target_arm::Scan::local_reloc_may_be_function_pointer,
7499         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
7500         target hook to detect function points.
7501         (Target_arm::Scan::possible_function_pointer_reloc): New method.
7502         * icf.h (Icf::check_section_for_function_pointers): Change type of
7503         parameter SECTION_NAME to const reference to std::string.  Use
7504         target hook to determine if section may have unsafe pointers.
7505         * target.h (Target::section_may_have_icf_unsafe_pointers): New
7506         method definition.
7507
7508 2010-06-21  Rafael Espindola  <espindola@google.com>
7509
7510         * fileread.cc (Input_file::find_fie): New
7511         (Input_file::open): Use Input_file::find_fie.
7512         * fileread.h (Input_file::find_fie): New
7513         * plugin.cc (set_extra_library_path): New.
7514         (Plugin::load): Add set_extra_library_path to the transfer vector.
7515         (Plugin_manager::set_extra_library_path): New.
7516         (Plugin_manager::add_input_file): Use the extra search path if set.
7517         (set_extra_library_path(): New.
7518         * plugin.h (Plugin_manager): Add set_extra_library_path and
7519         extra_search_path_.
7520
7521 2010-06-19  Cary Coutant  <ccoutant@google.com>
7522
7523         * layout.cc (gdb_sections): Add .debug_types.
7524         (lines_only_debug_sections): Likewise.
7525
7526 2010-06-18  Rafael Espindola  <espindola@google.com>
7527
7528         * plugin.cc (add_input_file,add_input_library)
7529         (Plugin_manager::add_input_file): Make filename arguments const.
7530         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
7531         const.
7532
7533 2010-06-16  Doug Kwan  <dougkwan@google.com>
7534
7535         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
7536         .ARM.attributes section if we have not merged any input
7537         attributes sections.
7538
7539 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7540
7541         * arm.cc: Allow combining objects with no EABI version
7542         information.
7543
7544 2010-06-15  Rafael Espindola  <espindola@google.com>
7545
7546         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
7547
7548 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7549
7550         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
7551         (struct iovec): Correct !HAVE_READV definition.
7552
7553 2010-06-10  Cary Coutant  <ccoutant@google.com>
7554
7555         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
7556         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
7557         reloc sections.
7558         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
7559
7560         PR 11683
7561         * symtab.h (Symbol::is_placeholder): New member function.
7562         * target-reloc.h (relocate_section): Check for placeholder symbols.
7563
7564         * testsuite/Makefile.am (plugin_test_8): New test.
7565         (plugin_test_9): New test.
7566         * testsuite/Makefile.in: Regenerate.
7567
7568 2010-06-09  Nick Clifton  <nickc@redhat.com>
7569
7570         * yyscript.y (input_list_element): Allow strings prefixed with
7571         the '-' character.  Treat these as libraries.
7572         * script.cc (script_add_library): New function.  Adds a library
7573         specified by "-l<name>" found in an input script.
7574         * script-c.h: Add prototype for script_add_library.
7575
7576 2010-06-07  Doug Kwan  <dougkwan@google.com>
7577
7578         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
7579         Restrict stub-group size to be within long conditional branch
7580         range when working around cortex-A8 erratum.
7581
7582 2010-06-07  Damien Diederen  <dd@crosstwine.com>
7583
7584         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
7585         #ifdef typo.
7586
7587 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
7588
7589         PR gold/11658
7590         * output.cc
7591         (Output_section::Input_section_sort_entry::compare_section_ordering):
7592         Change to return non-zero correctly.
7593         (Output_section::Input_section_sort_section_order_index_compare
7594         ::operator()): Change to fix ambiguity in comparisons.
7595
7596 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
7597
7598         * gold.h (is_wildcard_string): New function.
7599         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
7600         (Layout::layout_eh_frame): Ditto.
7601         (Layout::find_section_order_index): New method.
7602         (Layout::read_layout_from_file): New method.
7603         * layout.h (Layout::find_section_order_index): New method.
7604         (Layout::read_layout_from_file): New method.
7605         (Layout::input_section_position_): New private member.
7606         (Layout::input_section_glob_): New private member.
7607         * main.cc (main): Call read_layout_from_file here.
7608         * options.h (--section-ordering-file): New option.
7609         * output.cc (Output_section::input_section_order_specified_): New
7610         member.
7611         (Output_section::Output_section): Initialize new member.
7612         (Output_section::add_input_section): Add new parameter.
7613         Keep input sections when --section-ordering-file is used.
7614         (Output_section::set_final_data_size): Sort input sections when
7615         section ordering file is specified.
7616         (Output_section::Input_section_sort_entry): Add new parameter.
7617         Check sorting type.
7618         (Output_section::Input_section_sort_entry::compare_section_ordering):
7619         New method.
7620         (Output_section::Input_section_sort_compare::operator()): Change to
7621         consider section_order_index.
7622         (Output_section::Input_section_sort_init_fini_compare::operator()):
7623         Change to consider section_order_index.
7624         (Output_section::Input_section_sort_section_order_index_compare
7625         ::operator()): New method.
7626         (Output_section::sort_attached_input_sections): Change to sort
7627         according to section order when specified.
7628         (Output_section::add_input_section<32, true>): Add new parameter.
7629         (Output_section::add_input_section<64, true>): Add new parameter.
7630         (Output_section::add_input_section<32, false>): Add new parameter.
7631         (Output_section::add_input_section<64, false>): Add new parameter.
7632         * output.h (Output_section::add_input_section): Add new parameter.
7633         (Output_section::input_section_order_specified): New
7634         method.
7635         (Output_section::set_input_section_order_specified): New method.
7636         (Input_section::Input_section): Initialize section_order_index_.
7637         (Input_section::section_order_index): New method.
7638         (Input_section::set_section_order_index): New method.
7639         (Input_section::section_order_index_): New member.
7640         (Input_section::Input_section_sort_section_order_index_compare): New
7641         struct.
7642         (Output_section::input_section_order_specified_): New member.
7643         * script-sections.cc (is_wildcard_string): Delete and move modified
7644         method to gold.h.
7645         (Output_section_element_input::Output_section_element_input): Modify
7646         call to is_wildcard_string.
7647         (Output_section_element_input::Input_section_pattern
7648         ::Input_section_pattern): Ditto.
7649         (Output_section_element_input::Output_section_element_input): Ditto.
7650         * testsuite/Makefile.am (final_layout): New test case.
7651         * testsuite/Makefile.in: Regenerate.
7652         * testsuite/final_layout.cc: New file.
7653         * testsuite/final_layout.sh: New file.
7654
7655 2010-06-01  Rafael Espindola  <espindola@google.com>
7656
7657         * plugin.cc (Plugin::load): Pass the output name to the plugin.
7658
7659 2010-06-01  Rafael Espindola  <espindola@google.com>
7660
7661         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
7662         visibility of symbols.
7663
7664 2010-05-27  Doug Kwan  <dougkwan@google.com>
7665
7666         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
7667         from start of output section instead of address for a local symbol
7668         in a merged or relaxed section when doing a relocatable link.
7669
7670 2010-05-26  Rafael Espindola  <espindola@google.com>
7671
7672         PR 11604
7673         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
7674         adding sections the garbage collector removed.
7675         * gold/testsuite/Makefile.am: Add test.
7676         * gold/testsuite/Makefile.in: Regenerate.
7677         * gold/testsuite/plugin_test_7.sh: New.
7678         * gold/testsuite/plugin_test_7_1.c: New.
7679         * gold/testsuite/plugin_test_7_2.c: New.
7680
7681 2010-05-26  Rafael Espindola  <espindola@google.com>
7682
7683         * script-sections.cc (Output_section_definition::set_section_addresses):
7684         Check for --section-start.
7685
7686 2010-05-26  Doug Kwan  <dougkwan@google.com>
7687
7688         * arm.cc (Arm_scan_relocatable_relocs): New class.
7689         (Target_arm::relocate_special_relocatable): New method.
7690         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
7691         (Arm_relocate_functions::thumb_branch_common): Same.
7692         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
7693         instead of Default_scan_relocatable_relocs.
7694         * target-reloc.h (relocate_for_relocatable): Let target handle
7695         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
7696         * target.h (Sized_target::relocate_special_relocatable): New method.
7697
7698 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7699
7700         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
7701
7702 2010-05-23  Doug Kwan  <dougkwan@google.com>
7703
7704         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
7705         instead of a cast.
7706         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
7707         with a direct branch, not a conditional branch, to a stub.
7708         * merge.cc (Output_merge_base::record_input_section): New method
7709         defintion.
7710         (Output_merge_data::do_add_input_section): Record input section if
7711         keeps-input-sections flag is set.
7712         (Output_merge_string::do_add_input_section): Ditto.
7713         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
7714         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
7715         INPUT_SECTIONS_.
7716         (Output_merge_base::keeps_input_sections,
7717         Output_merge_base::set_keeps_input_sections,
7718         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
7719         method definitions.
7720         (Output_merge_base::Input_sections): New type declaration.
7721         (Output_merge_base::input_sections_begin,
7722         Output_merge_base::input_sections_end,
7723         Output_merge_base::do_set_keeps_input_sections): New method definitions.
7724         (Output_merge_base::bool keeps_input_sections_,
7725         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
7726         Output_merge_base::input_sections_): New data members.
7727         (Output_merge_data::do_set_keeps_input_sections): New method
7728         defintion.
7729         (Output_merge_string::do_set_keeps_input_sections): Ditto.
7730         * output.cc (Output_section::Input_section::relobj): Move method
7731         defintion from class declaration to here and handle merge sections.
7732         (Output_section::Input_section::shndx): Ditto.
7733         (Output_section::Output_section): Remove initializations of removed
7734         data members and initialize new data member LOOKUP_MAPS_.
7735         (Output_section::add_input_section): Set keeps-input-sections flag
7736         for a newly created merge output section as appropriate.  Adjust code
7737         to use Output_section_lookup_maps class.
7738         (Output_section::add_relaxed_input_section): Adjst code for lookup
7739         maps code refactoring.
7740         (Output_section::add_merge_input_section): Add a new parameter
7741         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
7742         class.  If adding input section to a newly created merge output
7743         section fails, remove the new merge section.
7744         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
7745         Adjust code for use of the Output_section_lookup_maps class.
7746         (Output_section::find_merge_section): Ditto.
7747         (Output_section::build_lookup_maps): New method defintion.
7748         (Output_section::find_relaxed_input_section): Adjust code to use
7749         Output_section_lookup_maps class.
7750         (Output_section::get_input_sections): Export merge sections.  Adjust
7751         code to use Output_section_lookup_maps class.
7752         (Output_section:::add_script_input_section): Adjust code to use
7753         Output_section_lookup_maps class.  Update lookup maps for merge
7754         sections also.
7755         (Output_section::discard_states): Use Output_section_lookup_maps.
7756         (Output_section::restore_states): Same.
7757         * output.h (Merge_section_properties): Move class defintion out of
7758         Output_section.
7759         (Output_section_lookup_maps): New class.
7760         (Output_section::Input_section::is_merge_section): New method
7761         defintion.
7762         (Output_section::Input_section::relobj): Move defintion out of class
7763         defintion.  Declare method only.
7764         (Output_section::Input_section::shndx): Ditto.
7765         (Output_section::Input_section::output_merge_base): New method defintion.
7766         (Output_section::Input_section::u2_.pomb): New union field.
7767         (Output_section::Merge_section_by_properties_map,
7768         Output_section::Output_section_data_by_input_section_map,
7769         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
7770         Remove types.
7771         (Output_section::add_merge_input_section): Add new parameter
7772         KEEPS_INPUT_SECTIONS.
7773         (Output_section::build_lookup_maps): New method declaration.
7774         (Output_section::merge_section_map_,
7775         Output_section::merge_section_by_properties_map_,
7776         Output_section::relaxed_input_section_map_,
7777         Output_section::is_relaxed_input_section_map_valid_): Remove data
7778         members.
7779         (Output_section::lookup_maps_): New data member.
7780
7781 2010-05-21  Doug Kwan  <dougkwan@google.com>
7782
7783         PR gold/11619
7784         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
7785         avoid a compilation error.
7786
7787 2010-05-19  Rafael Espindola  <espindola@google.com>
7788
7789         * script-sections.cc (Output_section_definition::allocate_to_segment):
7790         Update the phdrs_list even when the output section is NULL.
7791         * testsuite/Makefile.am: Add test.
7792         * testsuite/Makefile.in: Regenerate.
7793         * testsuite/script_test_9.cc: New.
7794         * testsuite/script_test_9.sh: New.
7795         * testsuite/script_test_9.t: New.
7796
7797 2010-05-19  Doug Kwan  <dougkwan@google.com>
7798
7799         * arm.cc (Arm_input_section::original_size): New method.
7800         (Arm_input_section::do_addralign): Add a cast.
7801         (Arm_input_section::do_output_offset): Remove static cast.
7802         (Arm_input_section::original_addralign,
7803          Arm_input_section::original_size_): Change type to uint32_t.
7804         (Arm_input_section::init): Add safe casts for section alignment
7805         and size.
7806         (Arm_input_section::set_final_data_size): Do not set address and
7807         offset of stub table.
7808         (Arm_output_section::fix_exidx_coverage): Change use of of
7809         Output_section::Simple_input_section to that of
7810         Output_section::Input_section.
7811         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
7812         except for the first pass.
7813         * output.cc (Output_section::get_input_sections): Change type of
7814         input_sections to std::list<Input_section>.
7815         (Output_section::add_script_input_section): Rename from
7816         Output_section::add_simple_input_section.  Change type of SIS
7817         parameter from Simple_input_section to Input_section.
7818         * output.h (Output_section::Simple_input_section): Remove class.
7819         (Output_section::Input_section): Change class visibility to public.
7820         (Output_section::Input_section::addralign): Use stored alignments
7821         for special input sections if set.
7822         (Output_section::Input_section::set_addralign): New method.
7823         (Output_section::get_input_sections): Change parameter type from
7824         list of Simple_input_section to list of Input_section.
7825         (Output_section::add_script_input_section): Rename from
7826         Output_section::add_simple_input_section. Change first parameter's
7827         type from Simple_input_section to Input_section and remove the
7828         second and third parameters.
7829         * script-sections.cc (Input_section::Input_section_list): Change
7830         type to list of Output_section::Input_section/
7831         (Input_section_info::Input_section_info): Change parameter type of
7832         INPUT_SECTION to Output_section::Input_section.
7833         (Input_section_info::input_section): Change return type.
7834         (Input_section_info::input_section_): Change type to
7835         Output_section::Input_section.
7836         (Output_section_element_input::set_section_addresses): Adjust code
7837         to use Output_section::Input_section instead of
7838         Output_section::Simple_input_section.  Adjust code for renaming
7839         of Output_section::add_simple_input_section.
7840         (Orphan_output_section::set_section_addresses): Ditto.
7841
7842 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7843
7844         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
7845         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
7846
7847 2010-05-18  Rafael Espindola  <espindola@google.com>
7848
7849         * options.cc (General_options::finalize): Handle -nostdlib.
7850         * options.h (nostdlib): New option.
7851         * script.cc (script_add_search_dir): Handle -nostdlib.
7852
7853 2010-05-12  Doug Kwan  <dougkwan@google.com>
7854
7855         * arm.cc (Target_arm::do_finalize_sections): Create an empty
7856         attributes section only if there no attributes section after merging.
7857         (Target_arm::merge_object_attributes): Move value of
7858         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
7859         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
7860         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
7861         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
7862         and arm_attr_merge_7.stdout.
7863         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
7864         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
7865         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
7866         arm_attr_merge_7b.o): New rules.
7867         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
7868         arm_attr_merge_7
7869         * testsuite/Makefile.in: Regenerate.
7870         * testsuite/arm_attr_merge.sh: New file.
7871         * testsuite/arm_attr_merge_[67][ab].s: Same.
7872
7873 2010-05-05  Nick Clifton  <nickc@redhat.com>
7874
7875         * po/es.po: Updated Spanish translation.
7876
7877 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
7878
7879         * Makefile.am (install-exec-local): Properly install gold as
7880         default cross linker.
7881         * Makefile.in: Regenerated.
7882
7883 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
7884             Nick Clifton  <nickc@redhat.com>
7885
7886         * configure.ac (install_as_default): Define and set to false
7887         unless --enable-gold or --enable-gold=both/gold has been
7888         specified.
7889         * configure: Regenerate.
7890
7891         * Makefile.am (install-exec-local): Install the executable as
7892         'ld.gold'.  If install_as_default is true then also install it as
7893         'ld'.
7894         * Makefile.in: Regenerated.
7895
7896 2010-04-24  Ian Lance Taylor  <iant@google.com>
7897
7898         * layout.cc (Layout::layout_reloc): In relocatable link don't
7899         combine reloc sections for grouped sections.
7900
7901 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
7902
7903         * gc.h (gc_process_relocs): Pass information on relocs pointing to
7904         sections that are not ordinary to icf.
7905         * icf.cc (get_section_contents): Handle relocation pointing to section
7906         with no object or shndx information.
7907         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
7908         * testsuite/Makefile.in: Regenerate.
7909         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
7910         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
7911
7912 2010-04-22  Ian Lance Taylor  <iant@google.com>
7913
7914         * expression.cc (Expression::Expression_eval_info): Add
7915         result_alignment_pointer field.
7916         (Expression::eval_with_dot): Add result_alignment_pointer
7917         parameter.  Change all callers.
7918         (Expression::eval_maybe_dot): Likewise.
7919         (class Binary_expression): Add alignment_pointer parameter to
7920         left_value and right_value.  Change all callers.
7921         (BINARY_EXPRESSION): Set result alignment.
7922         (class Trinary_expression): Add alignment_pointer parameter to
7923         arg2_value and arg3_value.  Change all callers.
7924         (Trinary_cond::value): Set result alignment.
7925         (Max_expression::value, Min_expression::value): Likewise.
7926         (Align_expression::value): Likewise.
7927         * script-sections.cc (class Sections_element): Add dot_alignment
7928         parameter to set_section_addresses virtual function.  Update
7929         instantiations.
7930         (class Output_section_element): Likewise.
7931         (Script_sections::create_segments): Add dot_alignment parameter.
7932         Change all callers.
7933         (Script_sections::create_segments_from_phdrs_clause): Likewise.
7934         (Script_sections::set_phdrs_clause_addresses): Likewise.
7935         * script-sections.h: Update declarations.
7936         * script.h: Update declarations.
7937         * output.h (Output_segment::set_minimum_p_align): Don't decrease
7938         min_p_align.
7939         * testsuite/script_test_3.t: Set large alignment.
7940         * testsuite/script_test_3.sh: Make sure that at least one LOAD
7941         segment has expected alignment.
7942
7943 2010-04-22  Nick Clifton  <nickc@redhat.com>
7944
7945         * po/gold.pot: Updated by the Translation project.
7946         * po/vi.po: Updated Vietnamese translation.
7947
7948 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
7949
7950         * testsuite/Makefile.am (check_PROGRAMS): Add
7951         icf_virtual_function_folding_test.
7952         * testsuite/Makefile.in: Regenerated.
7953
7954 2010-04-15  Andrew Haley  <aph@redhat.com>
7955
7956         * options.h (merge_exidx_entries): New option.
7957         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
7958         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
7959         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
7960         (Target_arm::merge_exidx_entries): New function.
7961         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
7962         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
7963         to Arm_exidx_fixup constructor.
7964         Add new arg, merge_exidx_entries.
7965         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
7966         Arm_output_section::fix_exidx_coverage.
7967
7968 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
7969
7970         * icf.cc (get_section_contents): Check for preemptible functions.
7971         Ignore addend when appropriate.
7972         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
7973         section folded.
7974         (add_from_relobj): Check for section folded.
7975         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
7976         * symtab.h (should_add_dynsym_entry): Add new parameter.
7977         * target-reloc.h (scan_relocs): Check for section folded.
7978         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
7979         Check reloc types for function pointers in shared objects.
7980         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
7981         case.
7982         (icf_preemptible_functions_test): New test case.
7983         (icf_string_merge_test): New test case.
7984         * testsuite.Makefile.in: Regenerate.
7985         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
7986         bar_glob.  Refactor code.
7987         * testsuite/icf_preemptible_functions_test.cc: New file.
7988         * testsuite/icf_preemptible_functions_test.sh: New file.
7989         * testsuite/icf_string_merge_test.cc: New file.
7990         * testsuite/icf_string_merge_test.sh: New file.
7991         * testsuite/icf_virtual_function_folding_test.cc: New file.
7992         * testsuite/icf_virtual_function_folding_test.sh: New file.
7993
7994 2010-04-14  Doug Kwan  <dougkwan@google.com>
7995
7996         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
7997         for local symbol recounting if we remove a section due to ICF.
7998         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
7999         there are no regular objects in input.
8000
8001 2010-04-13  Doug Kwan  <dougkwan@google.com>
8002
8003         * arm.cc (Arm_input_section::set_final_data_size): Compute
8004         accurate final data size instead of using current data size.
8005
8006 2010-04-09  Doug Kwan  <dougkwan@google.com>
8007
8008         * layout.cc (Layout::choose_output_section): Handle script section
8009         types.
8010         (Layout::make_output_section_for_script): Add section type parameter.
8011         Handle script section types.
8012         * layout.h (Layout::make_output_section_for_script): Add section
8013         type parameter.
8014         * output.cc (Output_section::Output_section): Initialize data member
8015         is_noload_.
8016         (Output_section::do_reset_address_and_file_offset): Do not set address
8017         to 0 if section is a NOLOAD section.
8018         * output.h (Output_section::is_noload): New method.
8019         (Output_section::set_is_noload): Ditto.
8020         (Output_section::is_noload_): New data member.
8021         * script-c.h (Script_section_type): New enum type.
8022         (struct Parser_output_section_header): Add new file section_type.
8023         * script-sections.cc (Sections_element::output_section_name): Add
8024         parameter for returning script section type.
8025         (Output_section_definition::output_section_name): Ditto.
8026         (Output_section_definition::section_type)P; New method.
8027         (Output_section_definiton::script_section_type_name): Ditto.
8028         (Output_section_definition::script_section_type_): New data member.
8029         (Output_section_definition::Output_section_definition): Initialize
8030         data member Output_section_definition::script_section_type_.
8031         (Output_section_definition::create_sections): Pass script section type
8032         to Layout::make_output_section_for_script.
8033         (Output_section_definition::output_section_name): Return script
8034         section type to caller.
8035         (Output_section_definition::set_section_address): Do not advance
8036         dot value and load address if section type is NOLOAD.  Set address
8037         of NOLOAD sections regardless of section flags.
8038         (Output_section_definition::print): Print section type if it is
8039         not SCRIPT_SECTION_TYPE_NONE.
8040         (Output_section_definition::section_type): New method.
8041         (Output_section_definition::script_section_type_name): Ditto.
8042         (Script_sections::output_section_name): Add new parameter
8043         PSECTION_TYPE for returning script section type.  Pass it to
8044         section elements.  Handle discard sections.
8045         (Sort_output_sections::operator()): Handle NOLOAD sections.
8046         * script-sections.h (Script_sections::Section_type): New enum type.
8047         (Script_sections::output_section_name): Add a new parameter for
8048         returning script section type.
8049         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
8050         INFO and NOLOAD.
8051         * yyscript.y (union): Add new field SECTION_TYPE.
8052         (COPY, DSECT, INFO, NOLOAD): New tokens.
8053         (opt_address_and_section_type): Change type to output_section_header.
8054         (section_type): New non-terminal
8055         (section_header): Handle section type.
8056         (opt_address_and_section_type): Return section type value.
8057
8058 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
8059
8060         * testsuite/plugin_common_test_1.c (foo): Add prototype.
8061         * testsuite/plugin_common_test_2.c (foo): Likewise.
8062
8063 2010-04-08  Doug Kwan  <dougkwan@google.com>
8064
8065         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
8066         Output_merge_data.
8067         * output.cc (Output_section::add_merge_input_section): Simplify
8068         code and return status of Output_merge_base::add_input_section.
8069         Update merge section map only if Output_merge_base::add_input_section
8070         returns true.
8071
8072 2010-04-07  Doug Kwan  <dougkwan@google.com>
8073
8074         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
8075         if section is marked as containing instructions but has no mapping
8076         symbols.
8077         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
8078         correct section index.
8079         (Arm_relobj::find_linked_text_section): Ditto.
8080
8081 2010-04-07  Cary Coutant  <ccoutant@google.com>
8082
8083         * archive.cc (include_member): Destroy Read_symbols_data object before
8084         releasing file.
8085         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
8086         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
8087         (Read_symbols_data::~Read_symbols_data) New destructor.
8088         (Section_relocs::Section_relocs) New constructor.
8089         (Section_relocs::~Section_relocs) New destructor.
8090         (Read_relocs_data::Read_relocs_data) New constructor.
8091         (Read_relocs_data::~Read_relocs_data) New destructor.
8092         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
8093         pointers to NULL after deleting.
8094
8095 2010-04-07  Doug Kwan  <dougkwan@google.com>
8096
8097         * arm.cc: Replace "endianity" with "endianness" in comments.
8098         (Arm_exidx_cantunwind): Ditto.
8099         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
8100         (Arm_relobj::merge_flags_and_attributes): New method.
8101         (Arm_relobj::merge_flags_and_attributes_): New data member.
8102         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
8103         (Arm_relobj::scan_sections_for_stubs): Ditto.
8104         (Arm_relobj::do_read_symbols): Check to see if we really want to
8105         merge processor-specific flags and attributes.  Exit early if
8106         an object is empty except for section names and the undefined symbol.
8107         (Target_arm::do_finalize_sections): Move check for ELF format to
8108         Arm_relobj::do_read_symbols.  Merge processor specific flags and
8109         attributes from a regular object only when we have determined that
8110         it is aapropriate.  Do not create an .ARM.attributes section in
8111         output if there is no regular input object.
8112         (Target_arm::merge_processor_specific_flags): Check
8113         --warn-mismatch before printing any error.
8114         (Target_arm::merge_object_attributes): Ditto.
8115         * gold.cc (queue_middle_tasks): Handle the case in which there is
8116         no regular object in input.
8117         * options.cc (General_options::parse_EB): New method.
8118         (General_options::parse_EL): Same.
8119         (General_options::General_options): Initialize endianness_.
8120         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
8121         New options.
8122         (General_options::Endianness): New enum.
8123         (General_options::endianness): New method.
8124         (General_options::endianness_): New data member.
8125         * parameters.cc (Parameters::set_options): Check target endianness.
8126         (Parameters::set_target_once): Ditto.
8127         (Parameters::check_target_endianness): New method.
8128         (parameters_force_valid_target): If either -EL or -EB is specified,
8129         use it to define endianness of default target.
8130         * parameters.h (Parameters::check_target_endianness): New method
8131         declaration.
8132         * target.h (class Target): Change "endianity" to "endianness"
8133         in comments.
8134
8135 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8136
8137         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
8138         * configure: Regenerate.
8139         * Makefile.in: Regenerate.
8140         * testsuite/Makefile.in: Regenerate.
8141
8142 2010-04-06  Cary Coutant  <ccoutant@google.com>
8143
8144         gcc PR lto/42757
8145         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
8146         prevailing definitions of common symbols.
8147         * testsuite/plugin_test_6.sh: New test case.
8148         * testsuite/plugin_common_test_1.c: New test case.
8149         * testsuite/plugin_common_test_2.c: New test case.
8150         * testsuite/Makefile.am (plugin_test_6): New test case.
8151         * testsuite/Makefile.in: Regenerate.
8152
8153 2010-04-06  Nick Clifton  <nickc@redhat.com>
8154
8155         * po/vi.po: New Vietnamese translation.
8156
8157 2010-03-30  Doug Kwan  <dougkwan@google.com>
8158
8159         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
8160
8161 2010-03-25  Doug Kwan  <dougkwan@google.com>
8162
8163         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
8164         to avoid a conversion warning on a 32-bit host.
8165
8166 2010-03-24  Ian Lance Taylor  <iant@google.com>
8167
8168         * testsuite/script_test_3.t: Add a TLS segment.
8169         * testsuite/Makefile.am (check_PROGRAMS): Add
8170         tls_phdrs_script_test.
8171         (tls_phdrs_script_test_SOURCES): Define.
8172         (tls_phdrs_script_test_DEPENDENCIES): Define.
8173         (tls_phdrs_script_test_LDFLAGS): Define.
8174         (tls_phdrs_script_test_LDADD): Define.
8175         * testsuite/Makefile.in: Rebuild.
8176
8177 2010-03-23  Cary Coutant  <ccoutant@google.com>
8178
8179         * fileread.cc (find_or_make_view): Fix comment.
8180
8181 2010-03-23  Ian Lance Taylor  <iant@google.com>
8182
8183         * script-sections.cc (class Orphan_section_placement): Define
8184         PLACE_TLS and PLACE_TLS_BSS.
8185         (Orphan_section_placement::Orphan_section_placement): Initialize
8186         new places.
8187         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
8188         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
8189         (tls_script_test_SOURCES): Define.
8190         (tls_script_test_DEPENDENCIES): Define.
8191         (tls_script_test_LDFLAGS): Define.
8192         (tls_script_test_LDADD): Define.
8193         * testsuite/Makefile.in: Rebuild.
8194
8195 2010-03-22  Doug Kwan  <dougkwan@google.com>
8196
8197         * arm.cc (Arm_relocate_functions::abs8,
8198         Arm_relocate_functions::abs16): Use correct check for overflow
8199         specified in the ARM ELF specs.
8200         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
8201         target of a BLX instruction specially.
8202         (Reloc_stub::stub_type_for_reloc): Ditto.
8203         (Relocate::relocate): Use symbolic names instead of numeric relocation
8204         codes to report error.
8205         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
8206         workaround.
8207         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
8208         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
8209         thumb2_blx_out_of_range.stdout
8210         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
8211         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
8212         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
8213         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
8214         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
8215         thumb2_blx_in_range, thumb2_blx_in_range.o,
8216         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
8217         thumb2_blx_out_of_range.o): New rules.
8218         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
8219         thumb2_blx_in_range and thumb2_blx_out_of_range.
8220         * testsuite/Makefile.in: Regenerate.
8221         * arm_branch_in_range.sh: Add tests for THUMB BLX.
8222         * testsuite/thumb_blx_in_range.s: New file.
8223         * testsuite/thumb_blx_out_of_range.s: New file.
8224
8225 2010-03-22  Rafael Espindola  <espindola@google.com>
8226
8227         * archive.cc (Should_include): Move to archive.h.
8228         (should_include_member): Make it a member of Archive.
8229         (Lib_group): New.
8230         (Add_lib_group_symbols): New.
8231         * archive.h: Include options.h.
8232         (Archive_member): Moved from Archive.
8233         (Should_include): Moved from archive.cc.
8234         (Lib_group): New.
8235         (Add_lib_group_symbols): New.
8236         * dynobj.cc (do_should_include_member): New.
8237         * dynobj.h (do_should_include_member): New.
8238         * gold.cc (queue_initial_tasks): Update call to queue.
8239         * main.cc (main): Print lib group stats.
8240         * object.cc (do_should_include_member): New.
8241         * object.h: Include archive.h.
8242         (Object::should_include_member): New.
8243         (Object::do_should_include_member): New.
8244         (Sized_relobj::do_should_include_member): New.
8245         * options.cc (General_options::parse_start_lib): New.
8246         (General_options::parse_end_lib): New.
8247         (Input_arguments::add_file): Handle lib groups.
8248         (Input_arguments::start_group): Check we are not in a lib.
8249         (Input_arguments::start_lib): New.
8250         (Input_arguments::end_lib): New.
8251         * options.h (General_options): Add start_lib and end_lib.
8252         (Input_argument::lib_): New.
8253         (Input_argument::lib): New.
8254         (Input_argument::is_lib): New.
8255         (Input_file_lib): New.
8256         (Input_arguments::in_lib_): New.
8257         (Input_arguments::in_lib): New.
8258         (Input_arguments::start_lib): New.
8259         (Input_arguments::end_lib_): New.
8260         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
8261         in unused members as preempted.
8262         (Sized_pluginobj::do_should_include_member): New.
8263         * plugin.h (Sized_pluginobj::do_should_include_member): New.
8264         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
8265         return the blocker.
8266         (Read_symbols::do_whole_lib_group): New.
8267         (Read_symbols::do_lib_group): New.
8268         (Read_symbols::do_read_symbols): Handle lib groups.
8269         (Read_symbols::get_name): Handle lib groups.
8270         * readsyms.h (Read_symbols): Add an archive member pointer.
8271         (Read_symbols::do_whole_lib_group): New.
8272         (Read_symbols::do_lib_group): New.
8273         (Read_symbols::member_): New.
8274         * script.cc (read_input_script): Update call to queue_soon.
8275
8276 2010-03-19  Doug Kwan  <dougkwan@google.com>
8277
8278         * arm.cc (Stub_table::Stub_table): Initialize new data members
8279         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
8280         (Stub_table::add_reloc_stub): Assign stub offset and update
8281         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
8282         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
8283         New data members.
8284         (Stub_table::update_data_size_and_addralign): Use
8285         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
8286         instead of going over all reloc stubs.
8287         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
8288         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
8289         Stringpool_template::offset_ to size of Stringpool_char.
8290         (Stringpool_template::new_key_offset): Remove code to initialize
8291         Stringpool_template::offset_.
8292         * stringpool.h (Stringpool_template::set_no_zero_null): Set
8293         Stringpool_template::offset_ to zero.
8294
8295 2010-03-15  Doug Kwan  <dougkwan@google.com>
8296
8297         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
8298         offset_.
8299         (Stringpool_template::new_key_offset): New method.
8300         (Stringpool_template::add_string): Assign offsets when adding new
8301         strings.
8302         (Stringpool_template::set_string_offsets): Do not set string offsets
8303         when not optimizing.
8304         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
8305         member size_.
8306         (Chunked_vector::clear): Clear size_.
8307         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
8308         (Chunked_vector::size): Return size_.
8309         (Chunked_vector::push_back): Use size_ to find insert position.
8310         (Chunked_vector::size_): New data member.
8311         (Stringpool_template::set_no_zero_null): Assert string set is empty.
8312         (Stringpool_template::new_key_offset): New method declaration.
8313         (Stringpool_template::offset_): New data member.
8314
8315 2010-03-15   Rafael Espindola  <espindola@google.com>
8316
8317         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
8318         Add_symbols' constructor.
8319         * readsyms.h (Add_symbols): Remove the input_group member.
8320
8321 2010-03-10  Ian Lance Taylor  <iant@google.com>
8322
8323         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
8324         target to ask whether a reference to a symbol requires a stack
8325         split.
8326         * target.h (Target::is_call_to_non_split): New function.
8327         (Target::do_is_call_to_non_split): Declare virtual function.
8328         * target.cc: Include "symtab.h".
8329         (Target::do_is_call_to_non_split): New function.
8330         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
8331
8332 2010-03-10  Cary Coutant  <ccoutant@google.com>
8333
8334         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
8335         (File_read::open[1]): Remove initial mapping of whole_file_view_.
8336         (File_read::open[2]): Add whole_file_view_ to list of views.
8337         (File_read::make_view): Remove test of whole_file_view_.
8338         (File_read::find_or_make_view): Create whole_file_view_ if
8339         necessary.
8340         (File_read::clear_views): Replace bool parameter with enum;
8341         adjust all callers.  Don't delete views with permanent data;
8342         do delete cached views and views from archives if
8343         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
8344         if clearing the corresponding view.
8345         * fileread.h (File_read::Clear_views_mode): New enum.
8346         (File_read::View::is_permanent_view): New method.
8347         (File_read::clear_views): Replace bool parameter
8348         with enum; adjust all callers.
8349         * options.h (General_options): Change keep_files_mapped option;
8350         add map_whole_files.
8351         * readsyms.cc (Add_symbols::run): Delete sd_ object before
8352         releasing the file.
8353         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
8354         the file.
8355
8356 2010-03-10  David S. Miller  <davem@davemloft.net>
8357
8358         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
8359
8360 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
8361
8362         * icf.cc (get_section_contents): Add '@' marker after processing the
8363         merge reloc.
8364
8365 2010-03-08  Doug Kwan  <dougkwan@google.com>
8366
8367         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
8368         due to a conversion warning.
8369         (Arm_relobj::update_output_local_symbol_count): Check for local
8370         symbol with unset output index.
8371
8372 2010-03-05  Ian Lance Taylor  <iant@google.com>
8373
8374         * options.h (class General_options): Add --spare-dynamic-tags.
8375         * output.cc (Output_data_dynamic::set_final_data_size): Implement
8376         --spare-dynamic-tags.
8377
8378 2010-03-05  Ian Lance Taylor  <iant@google.com>
8379
8380         * incremental.cc: Include "libiberty.h".
8381
8382 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
8383
8384         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
8385         function, is_info_ member.
8386         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
8387         (Versions::Versions): Update caller.
8388         (Versions::define_base_version): Likewise.
8389         (Versions::add_def): Likewise.
8390
8391 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
8392
8393         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
8394         (Scan::possible_function_pointer_reloc): New function.
8395         (Scan::local_reloc_may_be_function_pointer): Change to call
8396         possible_function_pointer_reloc.
8397         (Scan::global_reloc_may_be_function_pointer): Ditto.
8398         * icf.h (Icf::check_section_for_function_pointers): Change to reject
8399         relocations in ".data.rel.ro._ZTV" section.
8400         * testsuite/icf_safe_so_test.sh: Change to pass i386.
8401         * testsuite/icf_safe_so_test.cc: Ditto.
8402         * testsuite/icf_safe_test.cc: Ditto.
8403         * testsuite/icf_safe_test.sh: Ditto.
8404
8405 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8406             Ian Lance Taylor  <iant@google.com>
8407
8408         * target-reloc.h (relocate_section): Check the symbol table index
8409         for -1U before setting the local symbol index.
8410         (scan_relocatable_relocs): If copying the relocation, record that
8411         the local symbol is required.
8412         * object.h (Symbol_value::is_output_symtab_index_set): New
8413         function.
8414         (Symbol_value::may_be_discarded_from_output_symtab): New
8415         function.
8416         (Symbol_value::has_output_symtab_entry): New function.
8417         (Symbol_value::needs_output_symtab_entry): Remove.
8418         (Symbol_value::output_symtab_index): Make sure the symbol index is
8419         set.
8420         (Symbol_value::set_output_symtab_index): Make sure the symbol
8421         index is not set.  Make sure the new index is valid.
8422         (Symbol_value::set_must_have_output_symtab_entry): New function.
8423         (Symbol_value::has_output_dynsym_entry): New function.
8424         (Symbol_value::set_output_dynsym_index): Make sure the new index
8425         is valid.
8426         (Sized_relobj::set_must_have_output_symtab_entry): New function.
8427         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
8428         local symbol if permitted.
8429         (Sized_relobj::do_finalize_local_symbols): Call
8430         is_output_symtab_index_set rather than needs_output_symtab_entry.
8431         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
8432         rather than needs_output_symtab_entry.  Call
8433         has_output_dynsym_entry rather than needs_output_dynsym_entry.
8434         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
8435         is_output_symtab_index_set rather than needs_output_symtab_entry.
8436         * testsuite/discard_locals_relocatable_test.c: New file.
8437         * testsuite/discard_locals_test.sh: Test -r.
8438         * testsuite/Makefile.am (check_DATA): Add
8439         discard_locals_relocatable_test1.syms,
8440         discard_local_relocatable_test2.syms.
8441         (MOSTLYCLEANFILES): Likewise.  Also add
8442         discard_locals_relocatable_test1.lout and
8443         discard_locals_relocatable_test2.out.
8444         (discard_locals_relocatable_test1.syms): New target.
8445         (discard_locals_relocatable_test.o): New target.
8446         (discard_locals_relocatable_test1.out): New target.
8447         (discard_locals_relocatable_test2.syms): New target.
8448         (discard_locals_relocatable_test2.out): New target.
8449         (various): Add missing ../ld-new dependencies.
8450         * testsuite/Makefile.in: Rebuild.
8451
8452 2010-03-03  Nick Clifton  <nickc@redhat.com>
8453
8454         * po/fi.po: New Finnish translation.
8455
8456 2010-03-01  Doug Kwan  <dougkwan@google.com>
8457
8458         * layout.cc (Layout::Layout): Force section types of .init_array*,
8459         .preinit_array* and .fini_array* sections.
8460         * output.cc (Output_section::Input_section_sort_entry::has_priority):
8461         Fix check of return value of std::string::find.().
8462         (Output_section::Input_section_sort_compare::operator()): Remove
8463         comment about .init_array.
8464         (Output_section::Input_section_sort_init_fini_compare::operator()):
8465         New method.
8466         (Output_section::sort_attached_input_sections): Handle .init_array
8467         and .fini_array specially.
8468         * output.h (Output_section::Inut_section_sort_compare): Update
8469         comment.
8470         (Output_section::Input_section_sort_init_fini_compare): New struct.
8471
8472 2010-02-26  Doug Kwan  <dougkwan@google.com>
8473
8474         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
8475         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
8476         * testsuite/debug_msg.sh: Avoid matching source line number for
8477         use of global variable undef_int.
8478
8479 2010-02-26  Doug Kwan  <dougkwan@google.com>
8480
8481         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
8482         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
8483         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
8484         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
8485         * options.cc (General_options::General_options): Initialize member
8486         fix_v4bx_.
8487         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
8488         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
8489         and rm_no_fix_v4bx.stdout
8490         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
8491         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
8492         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
8493         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
8494         and arm_no_fix_v4bx.
8495         * Makefile.in: Regenerate.
8496         * testsuite/arm_fix_v4bx.s: New file.
8497         * testsuite/arm_fix_v4bx.sh: Ditto.
8498
8499 2010-02-24  Doug Kwan  <dougkwan@google.com>
8500
8501         * arm.cc (Target_arm::got_section): Make the .got section the first
8502         non RELRO section in the data segment.
8503         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
8504         suffixes of section names.
8505
8506 2010-02-24  Doug Kwan  <dougkwan@google.com>
8507
8508         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
8509         flags and attributes merging if an input file is a binary file.
8510         * fileread.cc (Input_file::open): Record format of original file.
8511         * fileread.h (Input_file::Format): New enum type.
8512         (Input_file::Input_file): Initialize data member format_.
8513         (Input_file::format): New method definition.
8514         (Input_file::format_):: New data member.
8515
8516 2010-02-24  Doug Kwan  <dougkwan@google.com>
8517
8518         * arm.cc (Arm_output_data_got): New class.
8519         (ARM_TCB_SIZE): New constant
8520         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
8521         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
8522         If user uses a script with a SECTIONS clause, issue only a warning
8523         for a misplaced EXIDX input section.  Otherwise, issue an error.
8524         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
8525         garbage collection.
8526         (Target_arm::got_mode_index_entry): Handle static linking.
8527         (Target_arm::Scan::local): Ditto.
8528         (Target_arm::Scan::global): Ditto.
8529         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
8530         all incorrectly implemented relocations.
8531         (Target_arm::fix_exidx_coverage): Pass layout to
8532         Arm_output_section::fix_exidx_coverage.
8533         * layout.cc (Layout::section_name_mapping): Remove trailing dots
8534         from ".ARM.exidx." and ".ARM.extab.".
8535
8536 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8537
8538         * arm.cc (Target_arm::do_finalize_sections): Create attribute
8539         section if it does not already exist.
8540         * attributes.cc (Attributes_section_data::Attributes_section_data):
8541         Don't crash if size is zero.
8542
8543 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8544             Ian Lance Taylor  <iant@google.com>
8545
8546         * gold.cc (queue_middle_tasks): If no input files were opened,
8547         exit.
8548         * workqueue.h (Task_function::Task_function): Assert that there is
8549         a blocker.
8550
8551 2010-02-22  Doug Kwan  <dougkwan@google.com>
8552
8553         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
8554         * icf.cc (get_section_contents): Cast snprintf arguments to long long
8555         types to avoid warnings due to different uint64_t implementations
8556         on different hosts.
8557
8558 2010-02-21  Doug Kwan  <dougkwan@google.com>
8559
8560         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
8561         handling of the maximum backward branch offset.
8562         (Arm_relocate_functions::thumb_branch_common): Ditto.
8563         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
8564         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
8565         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
8566         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
8567         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
8568         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
8569         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
8570         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
8571         thumb_bl_out_of_range thumb_bl_out_of_range.o,
8572         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
8573         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
8574         thumb2_bl_out_of_range.o): New rules.
8575         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
8576         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
8577         thumb2_bl_out_of_range
8578         * testsuite/Makefile.in: Regenerate.
8579         * testsuite/arm_bl_in_range.s: New file.
8580         * testsuite/arm_bl_out_of_range.s: Ditto.
8581         * testsuite/arm_branch_in_range.sh: Ditto.
8582         * testsuite/arm_branch_range.t: Ditto.
8583         * testsuite/thumb2_branch_range.t: Ditto.
8584         * testsuite/thumb_bl_in_range.s: Ditto.
8585         * testsuite/thumb_bl_out_of_range.s: Ditto.
8586         * testsuite/thumb_branch_range.t: Ditto.
8587
8588 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
8589
8590         * gc.h (gc_process_relocs): Change vectors to point to the new list.
8591         Add reloc offset information.
8592         * icf.cc (get_section_contents): Change iterators to point to the new
8593         vectors. Add reloc offset information to the contents.
8594         * icf.h (Icf::Sections_reachable_info): New typedef.
8595         (Icf::Sections_reachable_list): New typedef.
8596         (Icf::Offset_info): New typedef.
8597         (Icf::Reloc_info): New struct typedef.
8598         (Icf::Reloc_info_list): New typedef.
8599         (Icf::symbol_reloc_list): Delete method.
8600         (Icf::addend_reloc_list): Delete method.
8601         (Icf::section_reloc_list): Delete method.
8602         (Icf::reloc_info_list): New method.
8603         (Icf::reloc_info_list_): New member.
8604
8605 2010-02-19  Doug Kwan  <dougkwan@google.com>
8606
8607         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
8608         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
8609         * arm.cc (Arm_relocation_functions): New forward declaration.
8610         (Target_arm::Target_arm): Initialize new data members
8611         got_mod_index_offset_ and tls_base_symbol_defined_.
8612         (Target_arm::Relocate::relocate_tls): New method.
8613         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
8614          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
8615         New methods.
8616         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
8617         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
8618         (Target_arm::got_mod_index_offset_,
8619         Target_arm::tls_base_symbol_defined_): New data members.
8620         (Target_arm::Scan::local, Target::Scan::global,
8621         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
8622         relocations.
8623
8624 2010-02-18  Doug Kwan  <dougkwan@google.com>
8625
8626         * arm.cc (Arm_relobj::find_linked_text_section): New method.
8627         (Arm_relobj::make_exidx_input_section): Pass section index of linked
8628         text section as a parameter becuase some broken tools may not set
8629         the link in section header.
8630         (Target_arm::has_got_section): New method.
8631         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
8632         without any mapping symbol as data only.  Remove warning.
8633         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
8634         link in its section header, try to discover the link by inspecting the
8635         REL31 relocation at the beginning of the section.
8636         (Target_arm::Scan::check_non_pic): Report name of offending relocation
8637         in error message.
8638         (Target_arm::Scan::global): Treat any reference to the symbol
8639         _GLOBAL_OFFSET_TABLE_ as a GOT access.
8640
8641 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
8642
8643         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
8644         (Scan::global_reloc_may_be_function_pointer): New function.
8645         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
8646         (Scan::global_reloc_may_be_function_pointer): New function.
8647         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
8648         (Scan::global_reloc_may_be_function_pointer): New function.
8649         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
8650         (Scan::global_reloc_may_be_function_pointer): New function.
8651         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
8652         (Scan::global_reloc_may_be_function_pointer): New function.
8653         (Scan::possible_function_pointer_reloc): New function.
8654         (Target_x86_64::can_check_for_function_pointers): New function.
8655         * gc.h (gc_process_relocs): Scan relocation types to determine if
8656         function pointers were taken for targets that support it.
8657         * icf.cc (Icf::find_identical_sections): Include functions for
8658         folding in safe ICF whose pointer is not taken.
8659         * icf.h (Secn_fptr_taken_set): New typedef.
8660         (fptr_section_id_): New member.
8661         (section_has_function_pointers): New function.
8662         (set_section_has_function_pointers): New function.
8663         (check_section_for_function_pointers): New function.
8664         * options.h: Fix comment for safe ICF option.
8665         * target.h (can_check_for_function_pointers): New function.
8666         * testsuite/Makefile.am: Add icf_safe_so_test test case.
8667         Modify icf_safe_test for X86-64.
8668         * testsuite/Makefile.in: Regenerate.
8669         * testsuite/icf_safe_so_test.cc: New file.
8670         * testsuite/icf_safe_so_test.sh: New file.
8671         * testsuite/icf_safe_test.cc (kept_func_3): New function.
8672         (main): Change to take pointer to function kept_func_3.
8673         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
8674         folding is done correctly for X86-64.
8675
8676 2010-02-12  David S. Miller  <davem@davemloft.net>
8677
8678         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
8679         is_symbolless parameter.
8680         (Output_reloc<SHT_REL>::is_symbolless): New.
8681         (Output_reloc<SHT_REL>::is_symbolless_): New.
8682         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
8683         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
8684         (Output_reloc<SHT_RELA>::is_symbolless): New.
8685         (Output_data_reloc::add_global): Handle is_symbolless.
8686         (Output_data_reloc::add_global_relative): Likewise.
8687         (Output_data_reloc::add_local): Likewise.
8688         (Output_data_reloc::add_local_relative): Likewise.
8689         (Output_data_reloc::add_symbolless_global_addend): New.
8690         (Output_data_reloc::add_symbolless_local_addend): New.
8691         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
8692         is_symbolless.
8693         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
8694         instead of ->is_relative_
8695         (Output_reloc::write): Likewise.
8696         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
8697         (Output_reloc::write_rel): Simplify.
8698
8699         * sparc.cc (Target_sparc::Scan::local): Use
8700         ->add_symbolless_local_addend as needed.
8701         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
8702         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
8703         based upon relocation offset.
8704
8705 2010-02-11  Doug Kwan  <dougkwan@google.com>
8706
8707         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
8708         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
8709         beginning of function.
8710         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
8711         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
8712         parameter is_32bit in calls to should_apply_static_reloc.
8713         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
8714         (check_DATA): Add arm_abs_global.stdout.
8715         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
8716         arm_abs_global.stdout): New rules.
8717         (MOSTLLYCLEANFILES): Add arm_abs_global
8718         * Makefile.in: Regenerate.
8719         * testsuite/arm_abs_global.s: New file.
8720         * testsuite/arm_abs_global.sh: Ditto.
8721         * testsuite/arm_abs_lib.s: Ditto.
8722
8723 2010-02-11  Ian Lance Taylor  <iant@google.com>
8724
8725         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
8726         Read_relocs task.
8727         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
8728         Allocate_commons_task first.
8729         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
8730         task, rather than symtab_lock_.
8731         (Gc_process_relocs::~Gc_process_relocs): New function.
8732         (Gc_process_relocs::is_runnable): Check this_blocker_.
8733         (Gc_process_relocs::locks): Use next_blocker_ rather than
8734         blocker_.
8735         (Scan_relocs::~Scan_relocs): New function.
8736         (Scan_relocs::is_runnable): Check this_blocker_ rather than
8737         symtab_lock_.
8738         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
8739         next_blocker_.
8740         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
8741         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
8742         constructor accordingly.
8743         (class Gc_process_relocs): Likewise.
8744         (class Scan_relocs): Likewise.
8745         * common.h (class Allocate_commons_task): Remove symtab_lock_
8746         field, and corresponding constructor parameter.
8747         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
8748         symtab_lock_.
8749         (Allocate_commons_task::locks): Likewise.
8750
8751 2010-02-11  Ian Lance Taylor  <iant@google.com>
8752
8753         * gold-threads.h (class Once): Define.
8754         (class Initialize_lock): Rewrite as child of Once.
8755         * gold-threads.cc (class Once_initialize): Define.
8756         (once_pointer_control): New static variable.
8757         (once_pointer, once_arg): New static variables.
8758         (c_run_once): New static function.
8759         (Once::Once, Once::run_once, Once::internal_run): New functions.
8760         (class Initialize_lock_once): Remove.
8761         (initialize_lock_control): Remove.
8762         (initialize_lock_pointer): Remove.
8763         (initialize_lock_once): Remove.
8764         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
8765         (Initialize_lock::initialize): Rewrite.
8766         (Initialize_lock::do_run_once): New function.
8767         * archive.cc (Archive::interpret_header): Only clear name if it is
8768         not already empty.
8769         * fileread.cc: Include "gold-threads.h"
8770         (file_counts_lock): New static variable.
8771         (file_counts_initialize_lock): Likewise.
8772         (File_read::release): Only increment counts when using --stats.
8773         Use a lock around the increment.
8774         * parameters.cc (class Set_parameters_target_once): Define.
8775         (set_parameters_target_once): New static variable.
8776         (Parameters::Parameters): Move here from parameters.h.
8777         (Parameters::set_target): Rewrite.
8778         (Parameters::set_target_once): New function.
8779         (Parameters::clear_target): Move here and rewrite.
8780         * parameters.h (class Parameters): Update declarations.  Add
8781         set_parameters_target_once_ field.
8782         (Parameters::Parameters): Move to parameters.cc.
8783         (Parameters::clear_target): Likewise.
8784         * readsyms.cc (Read_symbols::do_group): Create a Start_group
8785         task.
8786         (Start_group::~Start_group): New function.
8787         (Start_group::is_runnable): New function.
8788         (Start_group::locks, Start_group::run): New functions.
8789         (Finish_group::run): Change saw_undefined to size_t.
8790         * readsyms.h (class Start_group): Define.
8791         (class Finish_group): Change saw_undefined_ field to size_t.
8792         (Finish_group::Finish_group): Remove saw_undefined and
8793         this_blocker parameters.  Change all callers.
8794         (Finish_group::set_saw_undefined): New function.
8795         (Finish_group::set_blocker): New function.
8796         * symtab.h (class Symbol_table): Change saw_undefined to return
8797         size_t.  Change saw_undefined_ field to size_t.
8798         * target-select.cc (Set_target_once::do_run_once): New function.
8799         (Target_selector::Target_selector): Initialize set_target_once_
8800         field.  Don't initialize lock_ and initialize_lock_ fields.
8801         (Target_selector::instantiate_target): Rewrite.
8802         (Target_selector::set_target): New function.
8803         * target-select.h (class Set_target_once): Define.
8804         (class Target_selector): Update declarations.  Make
8805         Set_target_once a friend.  Remove lock_ and initialize_lock_
8806         fields.  Add set_target_once_ field.
8807
8808 2010-02-10  Ian Lance Taylor  <iant@google.com>
8809
8810         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
8811         queueing any tasks.
8812         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
8813         (queue_middle_tasks): Add all blockers before queueing any tasks.
8814         (queue_final_tasks): Likewise.
8815         * token.h (Task_token::add_blockers): New function.
8816         * object.h (Input_objects::number_of_relobjs): New function.
8817
8818 2010-02-10  Ian Lance Taylor  <iant@google.com>
8819
8820         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
8821         shared, not if not position independent.
8822         * x86_64.cc (Relocate::relocate_tls): Likewise.
8823         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
8824         (tls_pie_pic_test): New target.
8825         * testsuite/Makefile.in: Rebuild.
8826
8827         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
8828         (tls_test_main_pie.o, tls_test_pie.o): New targets.
8829         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
8830         * testsuite/Makefile.in: Rebuild.
8831
8832 2010-02-09  David S. Miller  <davem@davemloft.net>
8833
8834         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
8835         R_SPARC_RELATIVE using ->add_local_relative().
8836         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
8837
8838         * output.h (Output_data_dynamic::add_section_size): New method
8839         that takes two Output_data objects.
8840         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
8841         entry param.  Handle it in initializers.
8842         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
8843         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
8844         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
8845         arg.
8846         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
8847         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
8848         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
8849         for dynrel_includes_plt.
8850         * i386.cc (Target_i386::do_finalize_sections): Likewise.
8851         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8852         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
8853         before .rela.plt
8854         (Target_sparc::do_finalize_sections): Update to pass true for
8855         dynrel_includes_plt.
8856         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
8857         output before .rela.plt
8858         (Target_powerpc::do_finalize_sections): Update to pass true for
8859         dynrel_includes_plt when 32-bit.
8860
8861 2010-02-08  Doug Kwan  <dougkwan@google.com>
8862
8863         * arm.cc (Arm_relobj::simple_input_section_output_address): New
8864         method.
8865         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
8866         Arm_relobj::scan_section_for_cortex_a8_stubs,
8867         Arm_relobj::do_relocation_section): Instead of calling
8868         Output_section::output_address, use faster
8869         Arm_relobj::simple_input_section_output_address.
8870
8871 2010-02-08  David S. Miller  <davem@davemloft.net>
8872
8873         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
8874         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
8875         relocation helper function.
8876
8877         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
8878         just like R_SPARC_GOT{10,13,22}.
8879         (Target_sparc::Scan::local): Likewise.
8880         (Target_sparc::Relocate:relocate): Likewise.
8881
8882 2010-02-06  Ian Lance Taylor  <iant@google.com>
8883
8884         * configure.ac: Rewrite targetobjs duplicate removal code to use
8885         only shell constructs.
8886         * configure: Rebuild.
8887
8888 2010-02-05  Doug Kwan  <dougkwan@google.com>
8889
8890         PR 11247
8891         * arm.cc (Arm_relobj::section_is_scannable): New method.
8892         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
8893         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
8894
8895 2010-02-04  Doug Kwan  <dougkwan@google.com>
8896
8897         PR 11247
8898         * arm-reloc-property.cc (cstdio): Include.
8899         * configure.ac (targetobjs): Remove duplicates.
8900         * configure: Regenerate.
8901         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
8902         big and little endian version for a given address size.
8903
8904 2010-02-03  Doug Kwan  <dougkwan@google.com>
8905
8906         * arm-reloc-property.cc
8907         (Arm_reloc_property_table::reloc_name_in_error_message): New method
8908         definition.
8909         * arm-reloc-property.h
8910         (Arm_reloc_property_table::get_implemented_static_reloc_property):
8911         New method definition.
8912         (Arm_reloc_property_table::reloc_name_in_error_message): New method
8913         declaration.
8914         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
8915         overflow to N.
8916         (GOT_PREL): Change implemented to Y.
8917         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
8918         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
8919         (Arm_relocate_functions::movw_abs_nc): Remove method.
8920         (Arm_relocate_functions::movt_abs): Ditto.
8921         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
8922         (Arm_relocate_functions::thm_movt_abs): Ditto.
8923         (Arm_relocate_functions::movw_rel_nc): Ditto.
8924         (Arm_relocate_functions::movw_rel): Ditto.
8925         (Arm_relocate_functions::movt_rel): Ditto.
8926         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
8927         (Arm_relocate_functions:thm_movw_rel): Ditto.
8928         (Arm_relocate_functions:thm_movt_rel): Ditto.
8929         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
8930         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
8931         New method definitions.
8932         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
8933         (Arm_relocation_functions::arm_grp_ldr): Ditto.
8934         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
8935         (Arm_relocation_functions::arm_grp_ldc): Ditto.
8936         (Target_arm::Relocate::relocate): Check for non-static or
8937         unimplemented relocation code and exit early.  Change calls to
8938         Target_arm::reloc_uses_thumb_bit and
8939         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
8940         instead.  Refactor code to handle similar relocations to increase
8941         code sharing.  Remove check for unsupported relocation code in switch
8942         statement.
8943         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
8944         relocation property table to find out size.  Change error message to
8945         print out the name of a relocation code instead of the numeric value.
8946         (Target_arm::scan_reloc_for_stub): Use relocation property table
8947         instead of calling Target_arm::reloc_uses_thumb_bit().
8948
8949 2010-02-02  Doug Kwan  <dougkwan@google.com>
8950
8951         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
8952         types of relaxed input section.
8953
8954 2010-02-02  Doug Kwan  <dougkwan@google.com>
8955
8956         * Makefile.am (HFILES): Add arm-reloc-property.h.
8957         (DEFFILES): New.
8958         (TARGETSOURCES): Add arm-reloc-property.cc
8959         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
8960         (libgold_a_SOURCES): $(DEFFILES)
8961         * Makefile.in: Regenerate.
8962         * arm-reloc-property.cc: New file.
8963         * arm-reloc-property.h: New file.
8964         * arm-reloc.def: New file.
8965         * arm.cc: Update comments.
8966         (arm-reloc-property.h): New included header.
8967         (arm_reloc_property_table): New global variable.
8968         (Target_arm::do_select_as_default_target): New method definition.
8969         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
8970         arm-reloc-property to targ_extra_obj.
8971         * parameters.cc (set_parameters_target): Call
8972         Target::select_as_default_target().
8973         * target.h (Target::select_as_default_target): New method definition.
8974         (Target::do_select_as_default_target): Same.
8975
8976 2010-02-01  Doug Kwan  <dougkwan@google.com>
8977
8978         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
8979         first_output_text_section_.
8980         (Arm_exidx_fixup::first_output_text_section): New method definition.
8981         (Arm_exidx_fixup::first_output_text_section_): New data member.
8982         (Arm_exidx_fixup::process_exidx_section): Record the first text
8983         output section seen.
8984         (Arm_output_section::fix_exidx_coverage): Set correct linked section
8985         and entsize in output section header.
8986
8987 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8988
8989         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
8990         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
8991         (Arm_relocate_functions::thm_alu11): New Method.
8992         (Arm_relocate_functions::thm_pc8): New Method.
8993         (Arm_relocate_functions::thm_pc12): New Method.
8994         (Target_arm::Scan::local): Handle the relocations.
8995         (Target_arm::Scan::global): Likewise.
8996         (Target_arm::Relocate::relocate): Likewise.
8997         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8998
8999 2010-01-29  Doug Kwan  <dougkwan@google.com>
9000
9001         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
9002         of relocation types as ld.
9003
9004 2010-01-29  Doug Kwan  <dougkwan@google.com>
9005
9006         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
9007         to public.
9008         (Arm_relocate_functions::thumb_branch_common): Ditto.
9009         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
9010         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
9011         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
9012         Arm_relocate_functions::jump24): Remove.
9013         (Target_arm::Relocate::relocate): Adjust code to call
9014         Arm_relocation_functions::arm_branch_common and
9015         Arm_relocation_functions::thumb_branch_common instead of their removed
9016         wrappers.  Merge switch-cases together to reduce source code size.
9017
9018 2010-01-29  Doug Kwan  <dougkwan@google.com>
9019
9020         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
9021         output_local_symbol_count_needs_update_.
9022         (Arm_relobj::output_local_symbol_count_needs_update,
9023          Arm_relobj::set_output_local_symbol_count_needs_update,
9024          Arm_relobj::update_output_local_symbol_count): New methods.
9025         (Arm_relobj::output_local_symbol_count_needs_update_): New data
9026         member.
9027         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
9028         of pointed function as in a R_ARM_PREL31 relocation.
9029         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
9030         for output local symbol count updating.
9031         (Target_arm::do_relax): Update output local symbol counts in objects
9032         if necessary.
9033         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
9034
9035 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9036
9037         * arm.cc: Added support for the ARM relocations:
9038         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
9039         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
9040         (Arm_relocate_functions::movw_rel_nc): Renamed (was
9041         movw_prel_nc).
9042         (Arm_relocate_functions::movw_rel): New method.
9043         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
9044         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
9045         thm_movw_prel_nc).
9046         (Arm_relocate_functions::thm_movw_rel): New method.
9047         (Arm_relocate_functions::thm_movt_rel): Renamed (was
9048         thm_movt_prel).
9049         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
9050         relocations.
9051         (Target_arm::Scan::global): Likewise.
9052         (Target_arm::Relocate::relocate): Likewise.
9053         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9054         Likewise.
9055
9056 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9057
9058         * arm.cc: Added support for ARM group relocations.
9059         (Target_arm::reloc_needs_sym_origin): New method.
9060         (Arm_relocate_functions::calc_grp_kn): New method.
9061         (Arm_relocate_functions::calc_grp_residual): New method.
9062         (Arm_relocate_functions::calc_grp_gn): New method.
9063         (Arm_relocate_functions::arm_grp_alu): New Method.
9064         (Arm_relocate_functions::arm_grp_ldr): New Method.
9065         (Arm_relocate_functions::arm_grp_ldrs): New Method.
9066         (Arm_relocate_functions::arm_grp_ldc): New Method.
9067         (Target_arm::Scan::local): Handle the ARM group relocations.
9068         (Target_arm::Scan::global): Likewise.
9069         (Target_arm::Relocate::relocate): Likewise.
9070         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9071         Likewise.
9072
9073 2010-01-26  Doug Kwan  <dougkwan@google.com>
9074
9075         * arm.cc (set): Include.
9076         (class Arm_exidx_fixup): Change type of last_input_section_ to const
9077         pointer type.
9078         (Arm_output_section::Text_section_list): New type.
9079         (Arm_output_section::append_text_sections_to_list): New method.
9080         (Arm_output_section::fix_exidx_coverage): Ditto.
9081         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
9082         (Arm_relobj::convert_input_section_to_relaxed_section): Use
9083         Relobj::set_section_offset() instead of
9084         Sized_relobj::invalidate_section_offset().
9085         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
9086         parameter for section headers. Ignore relocation sections for
9087         unallocated sections and EXIDX sections.
9088         (Target_arm::fix_exidx_coverage): New method.
9089         (Target_arm::output_section_address_less_than): New type.
9090         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
9091         linked text section instead of the EXIDX section.
9092         (Arm_output_section::create_stub_group): Add an assertion to check
9093         that this is not an EXIDX output section.
9094         (Arm_output_section::append_text_sections_to_list): New method.
9095         (Arm_output_section::fix_exidx_coverage): Ditto.
9096         (Arm_relobj::scan_sections_for_stubs): Adjust call to
9097         Arm_relobj::section_needs_reloc_stub_scanning.
9098         (Target_arm::do_relax): Fix EXIDX output section coverage in the
9099         first pass.
9100         (Target_arm::fix_exidx_coverage): New method.
9101         * object.h (Relobj::set_output_section): New method.
9102         (Sized_relobj::invalidate_section_offset): Remove method.
9103         (Sized_relobj::do_invalidate_section_offset): Remove method.
9104         (Sized_relobj::do_set_section_offset): Handle offset value -1.
9105
9106 2010-01-25  Doug Kwan  <dougkwan@google.com>
9107
9108         * arm.cc (Arm_exidx_merged_section::do_output_offset):
9109         Fix warning due to signed and unsigned comparison on a 32-bit host.
9110
9111 2010-01-22  Doug Kwan  <dougkwan@google.com>
9112
9113         * arm.cc (Target_arm::do_relax): Record an output section for section
9114         offset adjustment it contains any stub table that has changed.
9115         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
9116         offsets in an output section if necessary.
9117         * output.cc (Output_section::Output_section): Initialize
9118         section_offsets_need_adjustments_.
9119         (Output_section::add_input_section_for_script): Renamed to
9120         Output_section::add_simple_input_section.
9121         (Output_section::save_states): Add a comment.
9122         (Output_section::discard_states): New method defintion.
9123         (Output_section::adjust_section_offsets): Same.
9124         * output.h (Output_section::add_input_section_for_script): Renamed to
9125         Output_section::add_simple_input_section.
9126         (Output_section::discard_states): New method declaration.
9127         (Output_section::adjust_section_offsets): Same.
9128         (Output_section::section_offsets_need_adjustment,
9129         Output_section::set_section_offsets_need_adjustment): New method
9130         definitions.
9131         (Output_section::section_offsets_need_adjustment_): New data member.
9132         * script-sections.cc
9133         (Output_section_element_input::set_section_address): Adjust code for
9134         renaming of Output_section::add_input_section_for_script.
9135         (Orphan_output_section::set_section_address): Same.
9136
9137 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9138
9139         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
9140         Fix_v4bx enum values .
9141         * gold/options.h (General_options): New option definitions.
9142         (General_options::fix_v4bx): New method.
9143         (General_options::Fix_v4bx): New enum.
9144         * gold/options.cc (General_options::parse_fix_v4bx): New method.
9145         (General_options::parse_fix_v4bx_interworking): New method.
9146
9147 2010-01-22  Doug Kwan  <dougkwan@google.com>
9148
9149         * arm.cc (Arm_exidx_fixup): New class.
9150
9151 2010-01-21  Doug Kwan  <dougkwan@google.com>
9152
9153         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
9154         classes.
9155         (Arm_exidx_section_offset_map): New type.
9156
9157 2010-01-21  Doug Kwan  <dougkwan@google.com>
9158
9159         * arm.cc (Arm_exidx_input_section): New class.
9160         (Arm_relobj::exidx_input_section_by_link,
9161         Arm_relobj::exidx_input_section_by_shndx,
9162         Arm_relobj::make_exidx_input_section): New methods.
9163         (read_arm_attributes_section): Remove.
9164         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
9165         information about them.
9166         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
9167         to here.
9168
9169 2010-01-20  Doug Kwan  <dougkwan@google.com>
9170
9171         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
9172         Input_section_specifier to Section_id.
9173         (Target_arm::new_arm_input_section: Adjust code for change of key
9174         type.
9175         (Target_arm::find_arm_input_section): Ditto.
9176         * gc.h (object.h): Include for Section_id nand Section_id_hash.
9177         (Section_id): Remove.
9178         (Garbage_collection::Section_id_hash): Remove.
9179         * icf.h (object.h): Include for Section_id nand Section_id_hash.
9180         (Section_id): Remove.
9181         (Icf::Section_id_hash): Remove.
9182         * object.h (Section_id, Const_section_id, Section_id_hash,
9183         Const_section_id_hash): New type definitions.
9184         * output.cc (Output_section::add_relaxed_input_section): Change to
9185         use Const_section_id instead of Input_section_specifier as key type.
9186         (Output_section::add_merge_input_section): Ditto.
9187         (Output_section::build_relaxation_map): Change to use Section_id
9188         instead of Input_section_specifier as key type.
9189         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
9190         Ditto.
9191         (Output_section::convert_input_sections_to_relaxed_sections): Change
9192         to use Const_section_id instead of Input_section_specifier as key type.
9193         (Output_section::find_merge_section): Ditto.
9194         (Output_section::find_relaxed_input_section): Ditto.
9195         * output.h (Input_section_specifier): Remove class.
9196         (Output_section::Output_section_data_by_input_section_map): Change
9197         key type to Const_section_id.
9198         (Output_section::Output_relaxed_input_section_by_input_section_map):
9199         Ditto.
9200         (Output_section::Relaxation_map): Change key type to Section_id.
9201
9202 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9203
9204         * gold/arm.cc: Added support for R_ARM_V4BX relocation
9205         (class Arm_v4bx_stub): New class.
9206         (DEF_STUBS): Updated definition to support v4_veneer_bx.
9207         (Stub_factory::make_arm_v4bx_stub): New method.
9208         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
9209         (Stub_table::empty): Handle v4bx stubs.
9210         (Stub_table::add_arm_v4bx_stub): New method.
9211         (Stub_table::find_arm_v4bx_stub): New method.
9212         (Arm_relocate_functions::v4bx): New method.
9213         (Target_arm::fix_v4bx): New method.
9214         (Target_arm::Target_arm): Handle R_ARM_V4BX.
9215         (Stub_table::relocate_stubs): Likewise.
9216         (Stub_table::do_write): Likewise.
9217         (Stub_table::update_data_size_and_addralign): Likewise.
9218         (Stub_table::finalize_stubs):  Likewise.
9219         (Target_arm::Scan::local): Likewise.
9220         (Target_arm::Scan::global): Likewise.
9221         (Target_arm::do_finalize_sections): Likewise.
9222         (Target_arm::Relocate::relocate): Likewise.
9223         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9224         Likewise.
9225         (Target_arm::scan_reloc_for_stub): Likewise.
9226         (Target_arm::scan_reloc_section_for_stubs): Likewise.
9227
9228 2010-01-19  Ian Lance Taylor  <iant@google.com>
9229
9230         * output.cc (Output_section_headers::do_sized_write): Write large
9231         segment count to sh_info field.
9232         (Output_file_header::do_sized_write): For large segment count,
9233         write PN_XNUM to e_phnum field.
9234
9235 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9236
9237         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
9238         (Arm_relocate_functions::thm_jump8): New function.
9239         (Arm_relocate_functions::thm_jump11): New function.
9240         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
9241         R_ARM_THM_JUMP11.
9242         (Target_arm::Scan::global): Likewise.
9243         (Target_arm::Relocate::relocate): Likewise.
9244         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9245         Likewise.
9246
9247 2010-01-14  Doug Kwan  <dougkwan@google.com>
9248
9249         * arm.cc (map, utility): Include headers.
9250         (Target_arm::apply_cortex_a8_workaround): New method.
9251         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
9252         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
9253         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
9254         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
9255         the --[no-]fix-cortex-a8 command line options.
9256         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
9257         (Target_arm::relocate_stub): Use addend in instruction template.
9258         * options.h (DEFINE_bool): Set the user-set flag.
9259         (General_options): Add --[no-]-fix-cortex options.
9260         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
9261         : Update fast look-up map after conversion.
9262
9263 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
9264
9265         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
9266         in the first pass of do_layout.
9267
9268 2010-01-13  Doug Kwan  <dougkwan@google.com>
9269
9270         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
9271         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
9272         apparent compiler problem of not folding static constant integral
9273         data members of elfcpp::Elf_sizes<32>.
9274
9275 2010-01-13  Doug Kwan  <dougkwan@google.com>
9276
9277         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
9278         Arm_relobj::section_needs_cortex_a8_stub_scanning,
9279         Arm_relobj::scan_section_for_cortex_a8_erratum,
9280         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
9281         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
9282         sections to scan for relocation stubs into a new method
9283         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
9284         relocation and Cortex-A8 stub scanning.
9285         (Target_arm::do_relax): Force stubs to be after stubbed sections
9286         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
9287         the beginning of a new relaxation pass.  Update a comment.
9288         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
9289
9290 2010-01-12  Ian Lance Taylor  <iant@google.com>
9291
9292         * target-reloc.h (visibility_error): New inline function.
9293         (relocate_section): Call visibility_error.
9294         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
9295         (MOSTLYCLEANFILES): Likewise.
9296         (protected_4_pic.o, protected_3.err): New targets.
9297         * testsuite/protected_4.cc: New file.
9298
9299 2010-01-12  Doug Kwan  <dougkwan@google.com>
9300
9301         * arm.cc (Cortex_a8_reloc): New class.
9302         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
9303         and cortex_a8_relocs_info_.
9304         (Target_arm::fix_cortex_a8): New method definition.
9305         (Target_arm::Cortex_a8_relocs_info): New type.
9306         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
9307         New data member declarations.
9308         (Target_arm::scan_reloc_for_stub): Record information about
9309         relocations for THUMB branches that might be exempted from the
9310         Cortex-A8 workaround.
9311         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
9312         at the beginning of a relaxation pass.
9313
9314 2010-01-12  Doug Kwan  <dougkwan@google.com>
9315
9316         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
9317         (Arm_relobj::Mapping_symbol_position,
9318          Arm_reloj::Mapping_symbol_position_less,
9319          Arm_relobj::Mapping_symbols_info): New types.
9320         (Target_arm::is_mapping_symbol_name): New method definition.
9321         (Arm_relobj::do_count_local_symbols): Save information about mapping
9322         symbols.
9323
9324 2010-01-11  Doug Kwan  <dougkwan@google.com>
9325
9326         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
9327         Arm_relocate_functions::thumb32_branch_upper,
9328         Arm_relocate_functions::thumb32_branch_lower,
9329         Arm_relocate_functions::thumb32_cond_branch_offset,
9330         Arm_relocate_functions::thumb32_cond_branch_upper,
9331         Arm_relocate_functions::thumb32_cond_branch_lower,
9332         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
9333         branch offset encoding.
9334         (Arm_relocate_functions::thumb_branch_common): Use new branch
9335         offset encoding methods to avoid code duplication.
9336         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
9337         (Stub_addend_reader::operator()): Use new branch encoding method
9338         to avoid code duplication.
9339
9340 2010-01-11  Doug Kwan  <dougkwan@google.com>
9341
9342         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
9343         (Target_arm::do_finalize_sections): Define special EXIDX section
9344         symbols only if referenced.
9345         * gc.h (Garbage_collection::add_reference): New method.
9346         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
9347         code duplication.
9348
9349 2010-01-11  Ian Lance Taylor  <iant@google.com>
9350
9351         * script.cc (Version_script_info::build_expression_list_lookup):
9352         Change complaing about duplicate wildcard match from error to
9353         warning.
9354
9355         * script.cc (class Lazy_demangler): Recreate--revert part of patch
9356         of 2009-12-30.
9357         (Version_script_info::Version_script_info): Initialize globs_,
9358         default_version_, default_is_global_, and exact_.  Don't
9359         initialize globals_ or locals_.
9360         (Version_script_info::build_lookup_tables): Build local symbols
9361         first.
9362         (Version_script_info::unquote): New function.
9363         (Version_script_info::add_exact_match): New function.
9364         (Version_script_info::build_expression_list_lookup): Remove lookup
9365         parameter.  Add is_global parameter.  Change all callers.  Handle
9366         wildcard pattern specially.  Unquote pattern.  Call
9367         add_exact_match.
9368         (Version_script_info::get_name_to_match): New function.
9369         (Version_script_info::get_symbol_version): New function.
9370         (Version_script_info::get_symbol_version_helper): Remove.
9371         (Version_script_info::check_unmatched_names): Call unquote.
9372         * script.h (class Version_script_info): Change get_symbol_version
9373         to be non-inline and add is_global parameter; change all callers.
9374         Rewrite symbol_is_local.  Update declarations.  Define struct
9375         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
9376         Remove globals_ and locals_ members.  Add exact_, globs_,
9377         default_version_, is_global_.
9378         (Version_script_info::Glob): Remove pattern, add expression and
9379         is_global.  Update constructor.  Change all callers.
9380         * dynobj.cc (Versions::finalize): Mark the version symbol as the
9381         default version.
9382         (Versions::symbol_section_contents): If a symbol is undefined, or
9383         defined in a dynamic object, set the version index to
9384         VER_NDX_LOCAL.
9385         * symtab.cc (Symbol_table::add_from_relobj): Don't call
9386         symbol_is_local.
9387         (Symbol_table::add_from_pluginobj): Likewise.
9388         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
9389
9390 2010-01-11  Doug Kwan  <dougkwan@google.com>
9391
9392         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
9393         (incremental_dump_LDADD): Add linking option for libintl.
9394         * Makefile.in: Regenerate.
9395
9396 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
9397
9398         PR gold/11144
9399         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
9400         instead of -Ds.
9401         * testsuite/Makefile.in: Regenerated.
9402
9403 2010-01-10  Doug Kwan  <dougkwan@google.com>
9404
9405         * options.h (DEFINE_var): Use parentheses around argument varname__
9406         in macro body to avoid any unintended subsequent substitutions.
9407
9408 2010-01-10  Ian Lance Taylor  <iant@google.com>
9409
9410         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
9411         candidates before doing symbol resolution.
9412
9413         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
9414         ODR candidates if only one is weak.
9415
9416 2010-01-08  Ian Lance Taylor  <iant@google.com>
9417
9418         * script.cc (Version_script_info::build_expression_list_lookup):
9419         Don't warn about ambiguous version, just record the ambiguity.
9420         (Version_script_info::get_symbol_version_helper): Give error if
9421         version is ambiguous.
9422
9423 2010-01-08  Doug Kwan  <dougkwan@google.com>
9424
9425         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
9426         prev_data_size_ and prev_addralign_.  Remove initializer for
9427         deleted data member has_been_changed_.
9428         (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
9429         to determine if the table is empty.
9430         (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
9431         Remove.
9432         (Stub_table::add_reloc_stub): Define method in class definition
9433         instead of just declaring it there.
9434         (Stub_table::add_cortex_a8_stub): New method definition.
9435         (Stub_table::update_data_size_and_addralign): Ditto.
9436         (Stub_table::finalize_stubs): Ditto.
9437         (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
9438         (Stub_table::do_addralign_): Return address alignment in the
9439         (Stub_table::do_reset_address_and_file_offset): Define method in
9440         class definition instead of declaring it there.  Set current data
9441         size to be the data size of the previous pass.
9442         (Stub_table::set_final_data_size): Use current data size as the
9443         final data size.
9444         (Stub_table::relocate_stub): Change parameter type of stub from
9445         Reloc_stub pointer to Stub pointer.
9446         (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
9447         (Stub_table::Cortex_a8_stub_list): New typedef.
9448         (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
9449          Stub_table::prev_addralign_): New data member.
9450         (Arm_relobj::Arm_relobj): Initialize data member
9451         section_has_cortex_a8_workaround_.
9452         (Arm_relobj::section_has_cortex_a8_workaround,
9453          Arm_relobj::mark_section_for_cortex_a8_workaround): New method
9454          definitions.
9455         (Arm_relobj::section_has_cortex_a8_workaround_): New data member
9456         declarations.
9457         (Target_arm::relocate_stub): Change parameter type of stub from
9458         Reloc_stub pointer to Stub pointer.
9459         (Insn_template::size, Insn_template::alignment): Handle
9460         THUMB16_SPECIAL_TYPE.
9461         (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
9462          Stub_table::update_data_size_and_addralign,
9463          Stub_table::apply_cortex_a8_workaround_to_address_range): New method
9464         definitions.
9465         (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
9466         (Stub_table::do_write): Ditto.
9467         (Target_arm::do_relax): Adjust code for changes in Stub_table.
9468
9469 2010-01-08  Ian Lance Taylor  <iant@google.com>
9470
9471         PR 11108
9472         * symtab.h (class Symbol): Remove fields is_target_special_ and
9473         has_plt_offset_.  Add field is_defined_in_discarded_section_.
9474         (Symbol::is_defined_in_discarded_section): New function.
9475         (Symbol::set_is_defined_in_discarded_section): New function.
9476         (Symbol::has_plt_offset): Rewrite.
9477         (Symbol::set_plt_offset): Verify that new offset is not -1U.
9478         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
9479         Don't initialize is_target_special_ or has_plt_offset_.
9480         Initialize is_defined_in_discarded_section_.
9481         (Symbol_table::add_from_relobj): If appropriate, set
9482         is_defined_in_discarded_section.
9483         * resolve.cc (Symbol::override_base_with_special): Don't test
9484         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
9485         * target-reloc.h (relocate_section): Do special handling for
9486         symbols defined in discarded sections for global symbols as well
9487         as local symbols.
9488
9489 2010-01-08  Ian Lance Taylor  <iant@google.com>
9490
9491         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
9492         the SHT_SYMTAB case.
9493
9494 2010-01-08  Ian Lance Taylor  <iant@google.com>
9495
9496         * object.cc (Sized_relobj::do_layout): Don't get confused if
9497         layout_eh_frame returns NULL.
9498
9499 2010-01-08  Ian Lance Taylor  <iant@google.com>
9500
9501         PR 11084
9502         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
9503         dynamic symbol table, use the normal symbol table.
9504         (Sized_dynobj::do_read_symbols): Remove assertion about type of
9505         symbol table.
9506
9507 2010-01-08  Ian Lance Taylor  <iant@google.com>
9508
9509         PR 11072
9510         * layout.cc (Layout::include_section): Remove .gnu_debuglink
9511         sections.
9512
9513 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
9514
9515         * version.cc (print_version): Change to "Copyright 2010".
9516
9517 2010-01-08  Ian Lance Taylor  <iant@google.com>
9518
9519         PR 10287
9520         PR 11063
9521         * i386.cc (class Target_i386): Change return type of plt_section
9522         to be non-const.
9523         (class Output_data_plt_i386): Add tls_desc_rel_ field.
9524         (Output_data_plt_i386::Output_data_plt_i386): Initialize
9525         tls_desc_rel_ field.
9526         (Output_data_plt_i386::rel_tls_desc): New function.
9527         (Target_i386::rel_tls_desc_section): New function.
9528         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
9529         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
9530         R_386_TLS_DESC reloc in rel_tls_desc_section.
9531         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
9532         Define struct Tlsdesc_info.
9533         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
9534         (Target_x86_64::do_reloc_symbol_index): New function.
9535         (Target_x86_64::add_tlsdesc_info): New function.
9536         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
9537         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
9538         tlsdesc_rel_ field.
9539         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
9540         all callers.
9541         (Output_data_plt_x86_64::rela_tlsdesc): New function.
9542         (Target_x86_64::rela_tlsdesc_section): New function.
9543         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
9544         handling.
9545         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
9546         (Target_x86_64::do_reloc_addend): New function.
9547         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
9548         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
9549         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
9550         (Output_reloc::type): New function.
9551         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
9552         (Output_reloc::is_target_specific): New function.
9553         (Output_reloc::target_arg): New function.
9554         (class Output_reloc) [SHT_RELA]: Add four new constructors for
9555         absolute relocs and target specific relocs.
9556         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
9557         add_target_specific.
9558         (class Output_data_reloc) [SHT_RELA]: Likewise.
9559         * output.cc (Output_reloc::Output_reloc): Add four new versions
9560         for absolute relocs and target specific relocs.
9561         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
9562         (Output_reloc::get_symbol_index): Likewise.
9563         (Output_reloc::local_section_offset): Check that local_sym_index_
9564         is not TARGET_CODE or 0.
9565         (Output_reloc::symbol_value): Likewise.
9566         (Output_reloc::write) [SHT_RELA]: Call target for target specific
9567         reloc.
9568         * target.h (class Target): Add reloc_symbol_index and reloc_addend
9569         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
9570         functions.
9571         * layout.cc (add_target_dynamic_tags): Use output section for
9572         DT_PLTRELSZ and DT_JMPREL.
9573
9574 2010-01-07  Ian Lance Taylor  <iant@google.com>
9575
9576         PR 11061
9577         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
9578         function.
9579         (class Output_data_reloc_generic): Define.
9580         (class Output_data_reloc_base): Change base class to
9581         Output_data_reloc_generic.  Change add() method to call
9582         bump_relative_reloc_count for a relative reloc.  Remove
9583         sort_relocs_ field.
9584         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
9585         to sort_relocs().
9586         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
9587         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
9588         appropriate.
9589         * layout.h (class Layout): Update declaration.
9590
9591 2010-01-07  Ian Lance Taylor  <iant@google.com>
9592
9593         * output.h (class Output_data): Add const version of
9594         output_section and do_output_section.
9595         (class Output_section_data): Add const version of
9596         do_output_section.
9597         (class Output_section): Likewise.
9598         * layout.cc (Layout::add_target_dynamic_tags): New function.
9599         * layout.h (class Layout): Update declarations.
9600         * arm.cc (Target_arm::do_finalize_sections): Use
9601         add_target_dynamic_tags.
9602         * i386.cc (Target_i386::do_finalize_sections): Likewise.
9603         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
9604         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
9605         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
9606
9607 2010-01-07  Ian Lance Taylor  <iant@google.com>
9608
9609         PR 11042
9610         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
9611         object as needed.
9612
9613 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
9614             Ian Lance Taylor  <iant@google.com>
9615
9616         PR 11019
9617         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
9618         Xindex::read_symtab_xindex.
9619
9620 2010-01-07  Doug Kwan  <dougkwan@google.com>
9621
9622         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
9623         (Insn_template::thumb16_bcond_insn): New method declaration.
9624         (Insn_template): Fix spelling.
9625         (Stub::thumb16_special): New method declaration.
9626         (Stub::do_write): Define virtual method which was previously pure
9627         virtual.
9628         (Stub::do_thumb16_special): New method declaration.
9629         (Stub::do_fixed_endian_write): New template member.
9630         (Reloc_stub::do_write): Remove.
9631         (Reloc_stub::do_fixed_endian_write): Remove.
9632         (Cortex_a8_stub): New class definition.
9633         (Stub_factory::make_cortex_a8_stub): New method definition.
9634         (Stub_factory::Stub_factory): Add missing static storage class
9635         qualifier for elf32_arm_stub_a8_veneer_blx.
9636
9637 2010-01-07  Ian Lance Taylor  <iant@google.com>
9638
9639         PR 10980
9640         * options.h (class General_options): Add --warn-unresolved-symbols
9641         and --error-unresolved-symbols.
9642         * errors.cc (Errors::undefined_symbol): Implement
9643         --warn-unresolved-symbols.
9644
9645         * options.h (class General_options): Add -z text and -z textoff.
9646         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
9647
9648 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
9649
9650         * gc.h (Garbage_collection::Cident_section_map): New typedef.
9651         (Garbage_collection::cident_sections): New function.
9652         (Garbage_collection::add_cident_section): New function.
9653         (Garbage_collection::cident_sections_): New member.
9654         (gc_process_relocs): Add references to sections whose names are C
9655         identifiers.
9656         * gold.h (cident_section_start_prefix): New constant.
9657         (cident_section_stop_prefix): New constant.
9658         (is_cident): New function.
9659         * layout.cc (Layout::define_section_symbols): Replace string constants
9660         with the newly defined constants.
9661         * object.cc (Sized_relobj::do_layout): Track sections whose names are
9662         C identifiers.
9663         * testsuite/Makefile.am: Add gc_orphan_section_test.
9664         * testsuite/Makefile.in: Regenerate.
9665         * testsuite/gc_orphan_section_test.cc: New file.
9666         * testsuite/gc_orphan_section_test.sh: New file.
9667
9668 2010-01-06  Ian Lance Taylor  <iant@google.com>
9669
9670         PR 10980
9671         * options.h (class General_options): Add --warn-shared-textrel.
9672         * layout.cc (Layout::finish_dynamic_section): Implement
9673         --warn-shared-textrel.
9674
9675         PR 10980
9676         * options.h (class General_options): Add --warn-multiple-gp.
9677
9678 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9679
9680         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
9681         $(THREADSLIB) and $(LIBDL).
9682         * Makefile.in: Rebuild.
9683
9684 2010-01-06  Ian Lance Taylor  <iant@google.com>
9685
9686         PR 10980
9687         * options.cc (General_options::parse_section_start): New function.
9688         (General_options::section_start): New function.
9689         (General_options::General_options): Initialize all members.
9690         * options.h: Include <map>
9691         (class General_options): Add --section-start.  Add section_starts_
9692         member.
9693         * layout.cc (Layout::attach_allocated_section_to_segment): If
9694         --section-start was used, set the address of the segment.  Remove
9695         local sort_sections.
9696         (Layout::relaxation_loop_body): If the address of the load segment
9697         has been set by --section-start, don't use it.
9698         * output.h (Output_segment::update_flags_for_output_section): New
9699         function.
9700         * output.cc (Output_segment::add_output_section): Call
9701         update_flags_for_output_section.
9702
9703 2010-01-05  Ian Lance Taylor  <iant@google.com>
9704
9705         PR 10980
9706         * options.h (class General_options): Add --undefined-version.
9707         * script.cc (struct Version_expression): Add was_matched_by_symbol
9708         field.
9709         (Version_script_info::matched_symbol): New function.
9710         (Version_script_info::get_symbol_version_helper): Call
9711         matched_symbol.
9712         (Version_script_info::check_unmatched_names): New function.
9713         * script.h (class Version_script_info): Update declarations.
9714         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
9715
9716         * options.h (class General_options): Use DEFINE_bool_alias for
9717         allow_multiple_definition.
9718         * resolve.cc (Symbol_table::should_override): Don't test
9719         allow_multiple_definition.
9720
9721         PR 10980
9722         * options.h (class General_options): Add --cref.
9723         * main.cc (main): Print cref table if --cref.  Don't close mapfile
9724         until after printing cref table.
9725         * cref.cc: Include "symtab.h".
9726         (class Cref_inputs): Define Cref_table_compare and Cref_table.
9727         (Cref_table_compare::operator()): New function.
9728         (Cref_inputs::gather_cref): New function.
9729         (filecol): New static const.
9730         (Cref_inputs::print_cref): New function.
9731         (Cref::print_cref): New function.
9732         * cref.h: Include <cstdio>.
9733         (class Cref): Update declarations.
9734         * mapfile.h (Mapfile::file): New function.
9735         * object.h (class Object): Define Symbols.  Declare virtual
9736         do_get_global_symbols.
9737         (Object::get_global_symbols): New function.
9738         * object.cc (Input_objects::add_object): Pass object to cref_ if
9739         --cref.
9740         (Input_objects::archive_start): Likewise.
9741         (Input_objects::archive_stop): Likewise.
9742         (Input_objects::print_cref): New function.
9743         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
9744         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
9745         --cref.
9746         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
9747         function.
9748         * plugin.h (class Sized_pluginobj): Update declarations.
9749
9750 2010-01-05  Ian Lance Taylor  <iant@google.com>
9751
9752         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
9753         to is_default_version.  Rename insdef to insdefault.
9754         (Symbol_table::add_from_relobj): Rename def to is_default_version
9755         and local to is_forced_local.
9756         (Symbol_table::add_from_pluginobj): Likewise.
9757         (Symbol_table::add_from_dynobj): Likewise.
9758         (Symbol_table::define_special_symbol): Rename insdef to
9759         insdefault.
9760
9761 2010-01-04  Ian Lance Taylor  <iant@google.com>
9762
9763         PR 10980
9764         * options.h (class General_options): Add
9765         --allow-multiple-definition and -z muldefs.
9766         * resolve.cc (Symbol_table::should_override): Don't warn about a
9767         multiple symbol definition if --allow-multiple-definition or -z
9768         muldefs.
9769
9770         PR 10980
9771         * options.h (class General_options): Add --add-needed and
9772         --copy-dt-needed-entries.  Tweak --as-needed help entry.
9773         * object.cc (Input_objects::check_dynamic_dependencies): Give an
9774         error if --copy-dt-needed-entries aka --add-needed is used and
9775         would cause a change in behaviour.
9776
9777         PR 10980
9778         * options.h (class General_options): Add -G as a short version of
9779         --shared.  Add no-op options -assert, -g, and -i.
9780
9781 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
9782
9783         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
9784         check for .text or .gnu.linkonce.t sections.
9785         * icf.cc (Icf::find_identical_sections): Ditto.
9786         Change the detection for mangled function name within the section
9787         name.
9788         * icf.h (is_section_foldable_candidate): New function.
9789
9790 2009-12-30  Ian Lance Taylor  <iant@google.com>
9791
9792         PR 10980
9793         * options.h (class General_options): Permit two dashes with
9794         --retain-symbols-file.
9795
9796 2009-12-30  Ian Lance Taylor  <iant@google.com>
9797
9798         PR 10979
9799         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
9800         don't put the file header and segment headers in the text
9801         segment.
9802
9803         PR 10979
9804         * common.cc (Sort_commons::operator()): Stabilize sort when both
9805         entries are NULL.
9806         (Symbol_table::do_allocate_commons_list): When allocating common
9807         symbols, skip a symbol which is no longer common.
9808         * symtab.h (Symbol::is_common): Test whether the symbol comes from
9809         an object before checking its type.
9810         * testsuite/common_test_2.c: New file.
9811         * testsuite/common_test_3.c: New file.
9812         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
9813         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
9814         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
9815         (common_test_2_pic.o, common_test_2.so): New targets.
9816         (common_test_3_pic.o, common_test_3.so): New targets.
9817         * testsuite/Makefile.in: Rebuild.
9818
9819         PR 10979
9820         * script.cc (read_input_script): If we see a new SECTIONS clause,
9821         and we have added an input section, give an error.
9822         * layout.h (class Layout): Add have_added_input_section function.
9823         Add have_added_input_section_ field.
9824         * layout.cc (Layout::Layout): Initialize
9825         have_added_input_section_.
9826         (Layout::layout): Set have_added_input_section_.
9827         (Layout::layout_eh_frame): Likewise.
9828
9829 2009-12-30  Ian Lance Taylor  <iant@google.com>
9830
9831         PR 10931
9832         * options.h (class General_options): Add --sort-common option.
9833         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
9834         * common.cc (Sort_common): Add sort_order parameter to
9835         constructor.  Add sort_order_ field.
9836         (Sort_commons::operator): Check sort_order_.
9837         (Symbol_table::allocate_commons): Determine the sort order.
9838         (Symbol_table::do_allocate_commons): Add sort_order parameter.
9839         Change all callers.
9840         (Symbol_table::do_allocate_commons_list): Likewise.
9841
9842 2009-12-30  Ian Lance Taylor  <iant@google.com>
9843
9844         PR 10916
9845         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
9846         symbols from this object, don't change the visibility of an
9847         undefined symbol.
9848         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
9849
9850 2009-12-30  Ian Lance Taylor  <iant@google.com>
9851
9852         PR 10861
9853         * script.h (class Version_script_info): Define Language enum.
9854         Update declarations.  Define Glob, Exact, and Lookup types.  Add
9855         new fields globals_, locals_, and is_finalized_.
9856         * script.cc: Various formatting fixes.
9857         (class Parser_closure): Change language_stack_ from a vector of
9858         std::string to one of Version_script_info::Language.  Adjust all
9859         uses accordingly.
9860         (class Lazy_demangler): Remove.
9861         (struct Version_expression): Change language from std::string to
9862         Version_script_info::Language.
9863         (Version_script_info::Version_script_info): New function.
9864         (Version_script_info::~Version_script_info): Don't call clear.
9865         (Version_script_info::finalize): New function.
9866         (Version_script_info::build_lookup_tables): New function.
9867         (Version_script_info::build_expression_list_lookup): New
9868         function.
9869         (Version_script_info::get_symbol_version_helper): Rewrite to use
9870         lookup tables.
9871         (Version_script_info::print_expression_list): Adjust to use
9872         Version_script_info::Language.
9873         (script_push_lex_into_version_mode): Check that the version script
9874         has not been finalized.
9875         (version_script_push_lang): Change language string to
9876         Version_script_info::Language.
9877         * options.cc (Command_line::version_script): New function.
9878         * options.h (class General_options): Add finalize_dynamic_list
9879         function.  Change version_script from declaration to definition.
9880         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
9881         * testsuite/version_script.map: Remove duplicate def of foo.
9882         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
9883         version_script.map.
9884         * testsuite/Makefile.in: Rebuild.
9885
9886 2009-12-30  Ian Lance Taylor  <iant@google.com>
9887
9888         PR 10843
9889         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
9890         if the input symbol index is 0, make the output symbol index 0.
9891
9892 2009-12-30  Ian Lance Taylor  <iant@google.com>
9893
9894         PR 10670
9895         * options.h (class General_options): Add -x/--discard-all.
9896         * object.cc (Sized_relobj::do_count_local_symbols): Handle
9897         --discard-all.  If the local symbol needs a dynamic entry, check
9898         that before handling --discard-locals.
9899
9900 2009-12-30  Ian Lance Taylor  <iant@google.com>
9901
9902         PR 10450
9903         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
9904         flags to PF_R.
9905         (Output_segment::add_output_section): Don't change the flags if
9906         the type is PT_TLS.
9907
9908         PR 10450
9909         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
9910         GNU hash table if they need a dynamic value.  Otherwise, don't add
9911         them if they are defined in a dynamic object or are forced local.
9912
9913 2009-12-29  Ian Lance Taylor  <iant@google.com>
9914
9915         PR 10450
9916         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
9917         .gnu.hash table for a 32-bit target.
9918
9919         PR 10450
9920         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
9921         regular and a dynamic object only needs a dynamic symbol table
9922         entry if it is externally visible.
9923
9924         PR 10450
9925         * i386.cc (class Target_i386): Initialize global_offset_table_ in
9926         constructor.  Add global_offset_table_ field.
9927         (Target_i386::got_section): Set global_offset_table_.
9928         (Target_i386::do_finalize_sections): Set global_offset_table_
9929         size.
9930         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
9931         in constructor.  Add global_offset_table_ field.
9932         (Target_x86_64::got_section): Set global_offset_table_.
9933         (Target_x86_64::do_finalize_sections): Set global_offset_table_
9934         size.
9935
9936         * layout.cc (Layout::Layout): Initialize increase_relro_.
9937         (Layout::get_output_section): Add is_relro, is_last_relro, and
9938         is_first_non_relro parameters.  Change all callers.
9939         (Layout::choose_output_section): Likewise.
9940         (Layout::add_output_section_data): Likewise.
9941         (Layout::make_output_section): Likewise.
9942         (Layout::set_segment_offsets): Clear increase_relro when using a
9943         linker script.
9944         * layout.h (class Layout): Add increase_relro method.  Add
9945         increase_relro_ field.  Update declarations.
9946         * output.cc (Output_section::Output_section): Initialize
9947         is_last_relro_ and is_first_non_relro_.
9948         (Output_segment::add_output_section): Group relro sections is
9949         do_sort is true.  Handle is_last_relro and is_first_non_relro.
9950         (Output_segment::maximum_alignment): Remove relro handling.
9951         (Output_segment::set_section_addresses): Add increase_relro
9952         parameter.  Change all callers.  Add initial alignment to align
9953         relro sections on separate page.  Remove old relro handling.
9954         (Output_segment::set_section_list_addresses): Remove in_relro
9955         parameter.  Change all callers.
9956         (Output_segment::set_offset): Add increase parameter.  Change all
9957         callers.  Remove old relro handling.
9958         * output.h (class Output_section): Add new methods: is_last_relro,
9959         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
9960         Add is_last_relro_ and is_first_non_relro_ fields.
9961         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
9962         Create separate .got.plt section.  Call increase_relro.
9963         * x86_64.cc (Target_x86_64::got_section): Likewise.
9964         * testsuite/relro_script_test.t: Add .got.plt.
9965
9966         PR 10450
9967         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
9968         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
9969         (Layout::finalize): Call set_dynamic_symbol_size.
9970         (Layout::set_dynamic_symbol_size): New function.
9971         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
9972         set_dynamic_symbol_size.
9973
9974         PR 10450
9975         * output.h (class Output_section): Add is_entsize_zero_ field.
9976         * output.cc (Output_section::Output_section): Initialize
9977         is_entsize_zero_.
9978         (Output_section::set_entsize): If two different entsizes are
9979         requested, force it to zero.
9980         (Output_section::add_input_section): Set flags for .debug_str
9981         before updating section flags.  Set entsize.
9982         (Output_section::update_flags_for_input_section): Set SHF_MERGE
9983         and SHF_STRING if all input sections have those flags.
9984
9985 2009-12-29   Rafael Espindola  <espindola@google.com>
9986
9987         * main.cc (main): Fix the sys time reporting.
9988         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
9989         reporting.
9990
9991 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
9992
9993         * options.cc (General_options::parse_version): Allow -v to exit
9994         without an error if there is nothing to link.
9995
9996 2009-12-29  Ian Lance Taylor  <iant@google.com>
9997
9998         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
9999         using a version of gcc before 4.1.
10000         * configure: Rebuild.
10001
10002 2009-12-28  Chris Demetriou  <cgd@google.com>
10003
10004         * attributes.cc (Output_attributes_section_data::do_write): Use
10005         std::vector::front rather than std::vector::data.
10006
10007 2009-12-28  Ian Lance Taylor  <iant@google.com>
10008
10009         * symtab.h (class Symbol_table): Add enum Defined.
10010         * resolve.cc (Symbol_table::should_override): Add defined
10011         parameter.  Change all callers.  Test whether object is NULL
10012         before calling a method on it.
10013         (Symbol_table::report_resolve_problem): Add defined parameter.
10014         Change all callers.
10015         (Symbol_table::should_override_with_special): Likewise.
10016         * symtab.cc (Symbol_table::define_in_output_data): Add defined
10017         parameter.  Change all callers.
10018         (Symbol_table::do_define_in_output_data): Likewise.
10019         (Symbol_table::define_in_output_segment): Likewise.
10020         (Symbol_table::do_define_in_output_segment): Likewise.
10021         (Symbol_table::define_as_constant): Likewise.
10022         (Symbol_table::do_define_as_constant): Likewise.
10023         * script.h (class Symbol_assignment): Add is_defsym parameter to
10024         constructor; change all callers.
10025         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
10026         parameter.  Change all callers.  Add is_defsym_ field.
10027         (class Parser_closure): Add parsing_defsym parameter to
10028         constructor; change all callers.  Add parsing_defsym accessor
10029         function.  Add parsing_defsym_ field.
10030
10031 2009-12-28  Ian Lance Taylor  <iant@google.com>
10032
10033         * gold.cc (queue_middle_tasks): Fix formatting.
10034         * object.cc (Relobj::is_section_name_included): Likewise.
10035
10036 2009-12-23  Ian Lance Taylor  <iant@google.com>
10037
10038         * i386.cc (Target_i386::do_calls_non_split): Recognize
10039         -fsplit-stack prologue for a function with a static chain.
10040         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
10041         -fsplit-stack prologue when using %r11.
10042
10043 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
10044
10045         * options.cc (General_options::parse_version): Make -v continue and do
10046         the link like GNU ld does.
10047
10048 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
10049
10050         * Makefile.am (CCFILES): Add timer.cc.
10051         (HFILES): Add timer.h.
10052         * configure.ac: Check for sysconf and times.
10053         * main.cc: include timer.h.
10054         (main): Use Timer instead of get_run_time.
10055         * timer.cc: New.
10056         * timer.h: New.
10057         * workqueue.cc: include timer.h.
10058         (Workqueue::find_and_run_task):
10059         Report user, sys and wall time.
10060         * Makefile.in: Regenerate.
10061         * config.in: Regenerate.
10062         * configure: Regenerate.
10063
10064 2009-12-16  Doug Kwan  <dougkwan@google.com>
10065
10066         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
10067         sections.
10068         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
10069         relaxed input sections.
10070         * output.cc (Output_section::find_relaxed_input_section): Change
10071         return type to Output_relaxed_input_section pointer.  Adjust code
10072         for new type of relaxed_input_section_map_.
10073         * output.h (Output_section::find_relaxed_input_section): Change
10074         return type to Output_relaxed_input_section pointer.
10075         (Output_section::Output_relaxed_input_section_by_input_section_map):
10076         New type.
10077         (Output_section::relaxed_input_section_map_): Change type to
10078         Output_section::Output_relaxed_input_section_by_input_section_map.
10079         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
10080         input section.
10081
10082 2009-12-15  Ian Lance Taylor  <iant@google.com>
10083
10084         * layout.cc (Layout::create_shstrtab): Only write out after input
10085         sections if we are compressing debug sections.
10086
10087 2009-12-15  Ian Lance Taylor  <iant@google.com>
10088
10089         * archive.cc (Archive::add_symbols): Only look up a symbol without
10090         a version if there is, in fact, a version.
10091
10092 2009-12-14  Ian Lance Taylor  <iant@google.com>
10093
10094         Revert -Wshadow changes, all changes from:
10095         2009-12-11  Doug Kwan  <dougkwan@google.com>
10096         2009-12-11  Nick Clifton  <nickc@redhat.com>
10097         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
10098
10099 2009-12-11  Doug Kwan  <dougkwan@google.com>
10100
10101         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
10102         due to -Wshadow.
10103         * attributes.cc (Object_attribute::size): Ditto.
10104         (Attributes_section_data::size): Ditto.
10105         (Attributes_section_data::Attributes_section_data): Ditto.
10106         (Output_attributes_section_data::do_write): Ditto.
10107         * attributes.h (Object_attribute::set_type): Ditto.
10108         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
10109
10110 2009-12-11  Nick Clifton  <nickc@redhat.com>
10111
10112         * archive.cc: Fix shadowed variable warnings.
10113         * arm.cc: Likewise.
10114         * compressed_output.cc: Likewise.
10115         * compressed_output.h: Likewise.
10116         * configure: Likewise.
10117         * dwarf_reader.cc: Likewise.
10118         * dynobj.cc: Likewise.
10119         * dynobj.h: Likewise.
10120         * ehframe.cc: Likewise.
10121         * ehframe.h: Likewise.
10122         * errors.cc: Likewise.
10123         * expression.cc: Likewise.
10124         * fileread.cc: Likewise.
10125         * fileread.h: Likewise.
10126         * freebsd.h: Likewise.
10127         * i386.cc: Likewise.
10128         * icf.cc: Likewise.
10129         * incremental.h: Likewise.
10130         * layout.cc: Likewise.
10131         * layout.h: Likewise.
10132         * mapfile.cc: Likewise.
10133         * merge.cc: Likewise.
10134         * merge.h: Likewise.
10135         * object.cc: Likewise.
10136         * object.h: Likewise.
10137         * options.h: Likewise.
10138         * output.cc: Likewise.
10139         * output.h: Likewise.
10140         * parameters.cc: Likewise.
10141         * plugin.cc: Likewise.
10142         * powerpc.cc: Likewise.
10143         * reduced_debug_output.cc: Likewise.
10144         * reduced_debug_output.h: Likewise.
10145         * reloc.cc: Likewise.
10146         * reloc.h: Likewise.
10147         * resolve.cc: Likewise.
10148         * script-sections.cc: Likewise.
10149         * script.cc: Likewise.
10150         * script.h: Likewise.
10151         * sparc.cc: Likewise.
10152         * symtab.cc: Likewise.
10153         * symtab.h: Likewise.
10154         * target-select.cc: Likewise.
10155         * target-select.h: Likewise.
10156         * token.h: Likewise.
10157         * workqueue.cc: Likewise.
10158         * workqueue.h: Likewise.
10159         * x86_64.cc: Likewise.
10160
10161 2009-12-10  Doug Kwan  <dougkwan@google.com>
10162
10163         * arm.cc (attributes.h): New include.
10164         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
10165         (Arm_relobj::~Arm_relobj): Delete object pointed by
10166         attributes_section_data_.
10167         (Arm_relobj::attributes_section_data): New method definition.
10168         (Arm_relobj::attributes_section_data_): New data member declaration.
10169         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
10170         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
10171         attributes_section_data_.
10172         (Arm_dynobj::attributes_section_data): New method definition.
10173         (Arm_dynobj::attributes_section_data_): New data member declaration.
10174         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
10175         initialization value of may_use_blx_ to false.
10176         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
10177         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
10178         object attributes to compute results instead of hard-coding.
10179         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
10180         Target_arm::get_secondary_compatible_arch,
10181         Target_arm::set_secondary_compatible_arch
10182         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
10183         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
10184         New method declarations.
10185         (Target_arm::get_aeabi_object_attribute): New method definition.
10186         (Target_arm::attributes_section_data_): New data member declaration.
10187         (read_arm_attributes_section): New template definition.
10188         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
10189         (Arm_dynobj::do_read_symbols): Ditto.
10190         (Target_arm::do_finalize_sections): Merge attributes sections from
10191         input.  Check for BLX use after attributes section merging.
10192         Fix __exidx_start and __exidx_end visibility.  Create an
10193         .ARM.attributes section if necessary.
10194         (Target_arm::get_secondary_compatible_arch,
10195         Target_arm::set_secondary_compatible_arch,
10196         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
10197         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
10198         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
10199         New method definitions.
10200
10201 2009-12-09  Ian Lance Taylor  <iant@google.com>
10202
10203         * plugin.cc (Plugin::load): Don't cast from void* to a function
10204         pointer.
10205
10206 2009-12-09  Ian Lance Taylor  <iant@google.com>
10207
10208         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
10209         information fields.
10210
10211 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
10212
10213         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
10214         Replace two_file_shared_1.so with two_file_shared_2.so.
10215         * testsuite/Makefile.in: Regenerated.
10216
10217 2009-12-08  Doug Kwan  <dougkwan@google.com>
10218
10219         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
10220         (HFILES): Add attributes.h and int_encoding.h.
10221         * Makefile.in: Regenerate.
10222         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
10223         function definitions to int_encoding.cc
10224         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
10225         prototypes to int_encoding.h
10226         * reduced_debug_output.cc (int_encoding.h): New include.
10227         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
10228         function definitions to int_encoding.cc
10229         (insert_into_vector, read_from_pointer): Move template definitions to
10230         int_encoding.h
10231         * attributes.cc: New file.
10232         * attributes.h: New file.
10233         * int_encoding.cc: New file.
10234         * int_encoding.h: New file.
10235
10236 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
10237
10238         PR gold/11055
10239         * incremental-dump.cc (dump_incremental_inputs): New.
10240         (main): Use dump_incremental_inputs.
10241
10242 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
10243
10244         PR gold/10893
10245         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
10246         checking elfcpp::STT_FUNC.
10247         (Target_i386::Relocate::relocate): Likewise.
10248         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
10249
10250         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
10251         symbols from shared libraries into normal FUNC symbols.
10252
10253         * symtab.h (Symbol): Add is_func and use it.
10254
10255 2009-12-05  Doug Kwan  <dougkwan@google.com>
10256
10257         * arm.cc (Target_arm::arm_info): Initialize new fields
10258         attributes_section and attributes_vendor.
10259         * i386.cc (Target_i386::i386_info): Same.
10260         * object.cc (Sized_relobj::do_layout): Skip attribute section.
10261         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
10262         fields attributes_section and attributes_vendor.
10263         * sparc.cc (Target_sparc::sparc_info): Same.
10264         * target.h (Target::attributes_section, Target::attributes_vendor,
10265         Target::is_attributes_section, Target::attribute_arg_type,
10266         Target::attributes_order): New method definitions.
10267         (Target::Target_info::attributes_section,
10268         Target::Target_info::attributes_vendor): New fields.
10269         (Target::do_attribute_arg_type, Target::do_attributes_order): New
10270         virtual method definitions.
10271         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
10272         attributes_section and attributes_vendor.
10273         * testsuite/testfile.cc (Target_test::test_target_info): Same.
10274
10275 2009-12-05  Doug Kwan  <dougkwan@google.com>
10276
10277         * arm.cc: Update comments about interworking and stub generation.
10278         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
10279         considered as non-PIC.
10280         (Arm_relocate_functions::base_abs): Fix formatting.
10281         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
10282         of function to use GOT entry address instead of offset.
10283         (Target_arm::Scan::global): Issue an error if a symbol would need a
10284         PLT does not get one because it is untyped.  Remove code to create
10285         dynamic symbols for relative branches.
10286         (Target_arm::Relocate::relocate: Use 0 instead of false since function
10287         takes unsigned integer instead of boolean.
10288
10289 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
10290
10291         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
10292         (two_file_test_LDADD): Likewise.
10293         (common_test_1_LDADD): Likewise.
10294         (exception_test_LDADD) Likewise.
10295         (weak_test_LDADD): Likewise.
10296         (many_sections_test_LDADD): Likewise.
10297         (initpri1_LDADD): Likewise.
10298         (script_test_1_LDADD): Likewise.
10299         (script_test_2_LDADD): Likewise.
10300         (justsyms_LDADD): Likewise.
10301         (binary_test_LDADD): Likewise.
10302         (large_LDADD): Likewise.
10303         * testsuite/Makefile.in: Regenerated.
10304
10305 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
10306
10307         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
10308         (Symbol_table::override_with_special): Likewise.
10309         (Symbol_table::add_from_object): Likewise.
10310
10311 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
10312
10313         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
10314         Don't set the data_offset twice.
10315
10316 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
10317
10318         * testsuite/Makefile.in: Regenerate.
10319
10320 2009-12-03  Doug Kwan  <dougkwan@google.com>
10321
10322         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
10323         (Target_arm::do_finalize_sections): Add parameter for symbol table
10324         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
10325         * i386.cc (Target_i386::do_finalize_sections): Add an additional
10326         parameter for symbol table pointer.
10327         * layout.cc (Layout::finalize): Call Target::finalize_sections with
10328         an additional parameter for a pointer to symbol table.
10329         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
10330         parameter for a symbol table pointer.
10331         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
10332         * target.h (Target::finalize_sections, Target::do_finalize_sections):
10333         Ditto.
10334         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
10335         parameter for a symbol table pointer.
10336
10337 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
10338
10339         * incremental.cc (Incremental_inputs_header)
10340         (Incremental_inputs_header_write, Incremental_inputs_entry)
10341         (Incremental_inputs_entry_write): Move ...
10342         * incremental.h (Incremental_inputs_header)
10343         (Incremental_inputs_header_write, Incremental_inputs_entry)
10344         (Incremental_inputs_entry_write): here.
10345
10346 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10347
10348         * incremental.cc (make_sized_incremental_binary): Set the target.
10349         Error if it is incompatible.
10350         * output.h (Output_file): Add filename method.
10351
10352 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10353
10354         * incremental.cc (Incremental_inputs_entry): Remove unused argument
10355         from the get_* methods.
10356
10357 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10358
10359         * incremental-dump.cc (main): Check that the offeset of a script is 0.
10360         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
10361         Write 0 for the data_offset of scripts.
10362
10363 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10364
10365         * testsuite/Makefile.am: Add the incremental_test.sh test.
10366         * testsuite/incremental_test.sh: New.
10367         * testsuite/incremental_test_1.c: New.
10368         * testsuite/incremental_test_2.c: New.
10369
10370 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
10371
10372         * incremental-dump.cc (main): Fix typos.
10373
10374 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
10375
10376         PR gold/11025
10377         * incremental-dump.cc (main): Use llu to print 64 bit values.
10378
10379 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
10380             H.J. Lu  <hongjiu.lu@intel.com>
10381
10382         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
10383         $(LIBDL).
10384         (incremental_dump_LDADD): Likewise.
10385         * Makefile.in: Regenerated.
10386
10387 2009-11-25  Doug Kwan  <dougkwan@google.com>
10388
10389         Revert:
10390
10391         2009-11-25  Doug Kwan  <dougkwan@google.com>
10392
10393                 * arm.cc (Target_arm::Target_arm): Move method definition
10394                 outside of class definition.  Add code to handle
10395                 --target1-rel, --target1-abs and --target2= options.
10396                 (Target_arm::get_reloc_reloc_type): Change method to be
10397                 non-static and const.
10398                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
10399                 New data member declaration.
10400                 (Target_arm::Scan::local, Target_arm::Scan::global,
10401                 Target_arm::Relocate::relocate,
10402                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10403                 Adjust call to Target_arm::get_real_reloc_type.
10404                 (Target_arm::get_real_reloc_type): Use command line options
10405                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
10406                 * options.h (--target1-rel, --target1-abs, --target2): New
10407                 ARM-only options.
10408
10409 2009-11-25  Doug Kwan  <dougkwan@google.com>
10410
10411         * arm.cc (Target_arm::Target_arm): Move method definition outside of
10412         class definition.  Add code to handle --target1-rel, --target1-abs
10413         and --target2= options.
10414         (Target_arm::get_reloc_reloc_type): Change method to be non-static
10415         and const.
10416         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
10417         member declaration.
10418         (Target_arm::Scan::local, Target_arm::Scan::global,
10419         Target_arm::Relocate::relocate,
10420         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
10421         call to Target_arm::get_real_reloc_type.
10422         (Target_arm::get_real_reloc_type): Use command line options to
10423         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
10424         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
10425         options.
10426
10427 2009-11-25  Doug Kwan  <dougkwan@google.com>
10428
10429         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
10430         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
10431         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
10432         formatting.
10433         (Arm_relocate_functions::thm_call): Replace body with a call to
10434         Arm_relocate_functions::thumb_branch_common.
10435         (Arm_relocate_functions::thm_jump24,
10436         Arm_relocate_functions::thm_xpc22): New method definitions.
10437         (Arm_relocate_functions::thumb_branch_common): New method definition.
10438         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
10439         operator.
10440         (Target_arm::Relocate::relocate): Adjust call to thm_call.
10441         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
10442
10443 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
10444
10445         * Makefile.am: Build incremental-dump
10446         * Makefile.in: Regenerate.
10447         * incremental-dump.cc: New.
10448         * incremental.cc (Incremental_inputs_header_data,
10449         Incremental_inputs_entry_data): Move to incremental.h
10450         * incremental.h: (Incremental_inputs_header_data,
10451         Incremental_inputs_entry_data): Move from incremental.cc
10452
10453 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
10454
10455         * incremental.cc (Incremental_inputs_header,
10456         Incremental_inputs_header_write, Incremental_inputs_entry,
10457         Incremental_inputs_entry_write): Add a typedef with the data type.
10458
10459 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
10460
10461         * incremental.cc (Incremental_inputs_header,
10462         Incremental_inputs_header_write, Incremental_inputs_entry,
10463         Incremental_inputs_entry_write): Update comment about which
10464         type has the filed descriptions.
10465
10466 2009-11-15  Doug Kwan  <dougkwan@google.com>
10467
10468         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
10469         (Arm_relocate_functions::arm_branch_common): Change method defintion
10470         in class definition to a method declaration and update list of formal
10471         parameters.
10472         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
10473         Arm_relocation_functions::jump24): Adjust call to
10474         Arm_relocate_functions::arm_branch_common.  Update list of formal
10475         parameters.
10476         (Arm_relocate_functions::xpc25): New method definition.
10477         (Arm_relocate_functions::arm_branch_common): Move method defintion
10478         out from class definition.  Use stubs for mode-switching and extending
10479         branch ranges.
10480         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
10481         specially.  Change code to enable use of stubs in ARM branches.
10482
10483 2009-11-10  Doug Kwan  <dougkwan@google.com>
10484
10485         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
10486         in method declaration.
10487         (Target_arm::relocate_stub): New method declaration.
10488         (Target_arm::default_target): Change to return a pointer instead of
10489         a const reference.
10490         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
10491         Target_arm::default_target.
10492         (Arm_Relobj::do_relocate_sections): Remove options paramater in
10493         method definition.
10494         (Target_arm::relocate_section): Adjust view.
10495         (Target_arm::relocate_stub): New method definition.
10496
10497 2009-11-10  Doug Kwan  <dougkwan@google.com>
10498
10499         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
10500         a format warning.
10501         * incremental.cc (open_incremental_binary): Initialized local
10502         variables to avoid warnings.
10503         * object.cc (make_elf_object): Ditto.
10504         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
10505         a format warning.
10506
10507 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
10508
10509         PR gold/10930
10510         * testsuite/plugin_test.c: Include "config.h".
10511
10512 2009-11-09  Doug Kwan  <dougkwan@google.com>
10513
10514         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
10515         (arm_symbol_value): Remove.
10516         (Arm_relocate_functions::arm_branch_common,
10517         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
10518         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
10519         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
10520         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
10521         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
10522         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
10523         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
10524         Arm_relocate_functions::thm_mobw_abs_nc,
10525         Arm_relocate_functions::thm_mov_abs,
10526         Arm_relocate_functions::movw_prel_nc,
10527         Arm_relocate_functions::thm_movt_abs,
10528         Arm_relocate_functions::movt_prel,
10529         Arm_relocate_functions::thm_movw_prel_nc,
10530         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
10531         (Target_arm::Relocate::relocate): Only decompose address into two
10532         parts if relocation type uses the thumb-bit and pass the actual
10533         bit instead of a flag indicating that the thumb-bit is used.  Adjust
10534         calls to methods in Arm_relocate_functions for this change.
10535
10536 2009-11-08  Ian Lance Taylor  <iant@google.com>
10537
10538         PR 10925
10539         * reloc.cc: Instantiate
10540         Sized_relobj::initialize_input_to_output_maps and
10541         Sized_relobj:free_input_to_output_maps.
10542
10543 2009-11-06  Ian Lance Taylor  <iant@google.com>
10544
10545         PR 10876
10546         * defstd.cc (in_segment): Set only_if_ref true for "end".
10547
10548 2009-11-06  Doug Kwan  <dougkwan@google.com>
10549
10550         * arm.cc (class Reloc_stub): Correct a comment.
10551         (Target_arm::Target_arm): Initialize arm_input_section_map_.
10552         (Target_arm::scan_section_for_stubs): New method declaration.
10553         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
10554         Change methods from private to protected.
10555         (Target_arm::do_may_relax): New method definition.
10556         (Target_arm::do_relax, Target_arm::group_sections,
10557         Target_arm::scan_reloc_for_stub,
10558         Target_arm::scan_reloc_section_for_stubs): New method declarations.
10559         (Target_arm::arm_input_section_map_): New data member declaration.
10560         (Target_arm::scan_reloc_for_stub,
10561         Target_arm::scan_reloc_section_for_stubs,
10562         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
10563         Target_arm::do_relax): New method definitions.
10564
10565 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
10566
10567         * configure.ac: Check for (struct stat)::st_mtim
10568         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
10569         * config.in: Regenerate.
10570         * configure: Regenerate.
10571
10572 2009-11-05  Ian Lance Taylor  <iant@google.com>
10573
10574         PR 10910
10575         * output.cc (Output_segment::add_output_section): Add missing
10576         return statement.
10577
10578 2009-11-04  Ian Lance Taylor  <iant@google.com>
10579
10580         PR 10880
10581         * object.h (class Object): Add is_needed and set_is_needed
10582         methods.  Add is_needed_ field.  Make bool fields into bitfields.
10583         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
10584         defined in a dynamic object and referenced by a regular object,
10585         set is_needed for the dynamic object.
10586         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
10587         if the file is marked with as_needed and it is not needed.
10588
10589 2009-11-04  Ian Lance Taylor  <iant@google.com>
10590
10591         PR 10887
10592         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
10593         tags if data is discarded by linker script.
10594         * i386.cc (Target_i386::do_finalize_sections): Likewise.
10595         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
10596         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
10597         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
10598
10599 2009-11-04  Ian Lance Taylor  <iant@google.com>
10600
10601         * layout.cc (Layout::get_output_section): Add is_interp and
10602         is_dynamic_linker_section parameters.  Change all callers.
10603         (Layout::choose_output_section): Likewise.
10604         (Layout::make_output_section): Likewise.
10605         (Layout::add_output_section_data): Add is_dynamic_linker_section
10606         parameter.  Change all callers.
10607         * layout.h (class Layout): Update declarations.
10608         * output.h (class Output_section): Add is_interp, set_is_interp,
10609         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
10610         Add is_interp_, is_dynamic_linker_section_ fields.  Change
10611         generate_code_fills_at_write_ to a bitfield.
10612         * output.cc (Output_section::Output_sections): Initialize new
10613         fields.
10614         (Output_segment::add_output_section): Add do_sort parameter.
10615         Change all callers.
10616
10617 2009-11-03  Ian Lance Taylor  <iant@google.com>
10618
10619         PR 10860
10620         * options.h (class General_options): Add --warn-common.
10621         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
10622         merging two common symbols.
10623         (Symbol_table::should_override): Handle --warn-common when merging
10624         a common symbol with a defined symbol.  Use report_resolve_problem
10625         for multiple definitions.
10626         (Symbol_table::report_resolve_problem): New function.
10627         * symtab.h (class Symbol_table): Declare report_resolve_problem.
10628
10629 2009-11-03  Doug Kwan  <dougkwan@google.com>
10630
10631         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
10632         stub_factory_.
10633         (Target_arm::stub_factory): New method definition.
10634         (Target_arm::new_arm_input_section,
10635         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
10636         Target_arm::reloc_uses_thumb_bit): New method declarations.
10637         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
10638         New type definitions.
10639         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
10640         member declarations.
10641         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
10642         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
10643         New method definitions.
10644
10645 2009-11-03  Ian Lance Taylor  <iant@google.com>
10646
10647         * options.h (class General_options): Add --warn_constructors.
10648
10649 2009-11-03  Ian Lance Taylor  <iant@google.com>
10650
10651         PR 10893
10652         * defstd.cc (in_section): Add entries for __rel_iplt_start,
10653         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
10654
10655 2009-11-03  Ian Lance Taylor  <iant@google.com>
10656
10657         PR 10895
10658         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
10659         --msgid-bugs-address.
10660         (install-pdf): New target.
10661         (install-data_yes): Look up one directory to find mkinstalldirs.
10662
10663 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
10664
10665         * po/Make-in (.po.gmo): Don't generate .gmo files in source
10666         tree.
10667
10668 2009-10-30  Doug Kwan  <dougkwan@google.com>
10669
10670         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
10671
10672 2009-10-30  Doug Kwan  <dougkwan@google.com>
10673
10674         * arm.cc (Stub_addend_reader): New struct template definition
10675         and partial specializations.
10676         (Stub_addend_reader::operator()): New method definition for a
10677         partially specialized template.
10678
10679 2009-10-30  Doug Kwan  <dougkwan@google.com>
10680
10681         * arm.cc (Arm_relobj::processor_specific_flags): New method
10682         definition.
10683         (Arm_relobj::do_read_symbols): New method declaration.
10684         (Arm_relobj::processor_specific_flags_): New data member declaration.
10685         (Arm_dynobj): New class definition.
10686         (Target_arm::do_finalize_sections): Add input_objects parameter.
10687         (Target_arm::do_adjust_elf_header): New method declaration.
10688         (Target_arm::are_eabi_versions_compatible,
10689         (Target_arm::merge_processor_specific_flags): New method declaration.
10690         (Target_arm::do_make_elf_object): New overloaded method definitions
10691         and declaration.
10692         (Arm_relobj::do_read_symbols): New method definition.
10693         (Arm_dynobj::do_read_symbols): Ditto.
10694         (Target_arm::do_finalize_sections): Add input_objects parameters.
10695         Merge processor-specific flags from all input objects.
10696         (Target_arm::are_eabi_versions_compatible,
10697         Target_arm::merge_processor_specific_flags,
10698         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
10699         New method definitions.
10700         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
10701         Input_objects pointer type parameter.
10702         * layout.cc (Layout::finalize): Pass input objects to target's.
10703         finalize_sections function.
10704         * output.cc (Output_file_header::do_sized_write): Set ELF file
10705         header's processor-specific flags.
10706         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
10707         Input_objects pointer type parameter.
10708         * sparc.cc (Target_sparc::do_finalize_sections): Same.
10709         * target.h (Input_objects): New forward class declaration.
10710         (Target::processor_specific_flags,
10711         Target::are_processor_specific_flags_sect): New method definitions.
10712         (Target::finalize_sections): Add input_objects parameter.
10713         (Target::Target): Initialize processor_specific_flags_ and
10714         are_processor_specific_flags_set_.
10715         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
10716         parameter.
10717         (Target::set_processor_specific_flags): New method definition.
10718         (Target::processor_specific_flags_,
10719         Target::are_processor_specific_flags_set_): New data member
10720         declarations.
10721         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
10722         Input_objects pointer type parameter.
10723
10724 2009-10-30  Doug Kwan  <dougkwan@google.com>
10725
10726         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
10727
10728 2009-10-28  Ian Lance Taylor  <iant@google.com>
10729
10730         * object.h (class Relobj): Drop options parameter from
10731         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
10732         do_scan_relocs, do_relocate.  Change all callers.
10733         (class Sized_relobj): Drop options parameters from
10734         do_gc_process_relocs, do_scan_relocs, do_relocate,
10735         do_relocate_sections, relocate_sections, emit_relocs_scan,
10736         emit_relocs_scan_reltype.  Change all callers.
10737         (struct Relocate_info): Remove options field and all references to
10738         it.
10739         * reloc.h (class Read_relocs): Remove options constructor
10740         parameter and options_ field.  Change all callers.
10741         (class Gc_process_relocs, class Scan_relocs): Likewise.
10742         (class Relocate_task): Likewise.
10743         * target-reloc.h (scan_relocs): Remove options parameter.  Change
10744         all callers.
10745         (scan_relocatable_relocs): Likewise.
10746         * target.h (class Sized_target): Remove options parameter from
10747         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
10748         all callers.
10749         * gc.h (gc_process_relocs): Remove options parameter.  Change all
10750         callers.
10751         * arm.cc: Update functions to remove options parameters.
10752         * i386.cc: Likewise.
10753         * powerpc.cc: Likewise.
10754         * sparc.cc: Likewise.
10755         * x86_64.cc: Likewise.
10756         * testsuite/testfile.cc: Likewise.
10757
10758 2009-10-28  Doug Kwan  <dougkwan@google.com>
10759
10760         * arm.cc (Arm_relobj): New class definition.
10761         (Arm_relobj::scan_sections_for_stubs,
10762         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
10763         New method definitions.
10764
10765 2009-10-28  Cary Coutant  <ccoutant@google.com>
10766
10767         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
10768         (Plugin::cleanup_done_): New member.
10769         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
10770         (Plugin_manager::cleanup_done_): Remove.
10771         (Plugin_manager::add_input_file): Edit error message.
10772         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
10773         (Plugin_manager::cleanup): Remove use of cleanup_done_.
10774
10775 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
10776
10777         * fileread.cc: (File_read::View::~View): Use the new
10778         data_ownership_ filed.
10779         (File_read::~File_read): Dispose the new whole_file_view_.
10780         (File_read::open): Mmap the whole file if needed.
10781         (File_read::open): Use whole_file_view_ instead of contents_.
10782         (File_read::find_view): Use whole_file_view_ if applicable.
10783         (File_read::do_read): Use whole_file_view_ instead of contents_.
10784         (File_read::make_view): Use whole_file_view_ instead of contents_,
10785         update File_read::View::View call.
10786         (File_read::find_or_make_view): Update File_read::View::View
10787         call.
10788         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
10789         remove contents_
10790         (File_read::View::Data_ownership): New enum.
10791         (File_read::View::View): Replace bool mapped_ with Data_ownership
10792         argument.
10793         (File_read::View::mapped_): Remove (replaced by data_ownership_).
10794         (File_read::View::data_ownership_): New field.
10795         (File_read::contents_): Remove (replaced by whole_file_view_).
10796         (File_read::whole_file_view_): New field.
10797         * options.h (class General_options): Add --keep-files-mapped.
10798
10799 2009-10-27  Cary Coutant  <ccoutant@google.com>
10800
10801         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
10802         * testsuite/Makefile.am (plugin_test_5): New test case.
10803         * testsuite/Makefile.in: Regenerate.
10804
10805 2009-10-25  Doug Kwan  <dougkwan@google.com>
10806
10807         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
10808         from private to protected to allow access by child class.
10809         (Sized_relobj::do_relocate_sections): New method declaration.
10810         (Sized_relobj::relocate_sections): Virtualize.
10811         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
10812         Sized_relobj::relocate_sections.  Instantiate template explicitly
10813         for different target sizes and endianity.
10814
10815 2009-10-24  Doug Kwan  <dougkwan@google.com>
10816
10817         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
10818         (Arm_input_section::as_arm_input_section): New method.
10819         (Arm_output_section): New class definition.
10820         (Arm_output_section::create_stub_group,
10821         Arm_output_section::group_sections): New method definitions.
10822
10823 2009-10-22  Doug Kwan  <dougkwan@google.com>
10824
10825         * arm.cc (Arm_input_section): New class definition.
10826         (Arm_input_section::init, Arm_input_section:do_write,
10827         Arm_input_section::set_final_data_size,
10828         Arm_input_section::do_reset_address_and_file_offset): New method
10829         definitions.
10830
10831 2009-10-21  Doug Kwan  <dougkwan@google.com>
10832
10833         * arm.cc (Stub_table, Arm_input_section): New forward class
10834         declarations.
10835         (Stub_table): New class defintion.
10836         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
10837         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
10838         New method definition.
10839
10840 2009-10-21  Doug Kwan  <dougkwan@google.com>
10841
10842         * arm.cc: Update copyright comments.
10843         (Target_arm): New forward class template declaration.
10844         (Arm_address): New type.
10845         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
10846         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
10847         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
10848         constants.
10849         (Insn_template): Same.
10850         (DEF_STUBS): New macro.
10851         (Stub_type): New enum type.
10852         (Stub_template): New class definition.
10853         (Stub): Same.
10854         (Reloc_stub): Same.
10855         (Stub_factory): Same.
10856         (Target_arm::Target_arm): Initialize may_use_blx_ and
10857         should_force_pic_veneer_.
10858         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
10859         Target_arm::should_force_pic_veneer,
10860         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
10861         Target_arm::using_thumb_only, Target_arm:;default_target): New
10862         method defintions.
10863         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
10864         New data member declarations.
10865         (Insn_template::size, Insn_template::alignment): New method defintions.
10866         (Stub_template::Stub_template): New method definition.
10867         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
10868         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
10869         (Stub_factory::Stub_factory): New method definition.
10870         * gold.h (string_hash): New template.
10871         * output.h (Input_section_specifier::hash_value): Use
10872         gold::string_hash.
10873         (Input_section_specifier::string_hash): Remove.
10874         * stringpool.cc (Stringpool_template::string_hash): Use
10875         gold::string_hash.
10876
10877 2009-10-20  Doug Kwan  <dougkwan@google.com>
10878
10879         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
10880         symbols of relaxed input sections.
10881         * output.h (Output_section::find_relaxed_input_section): Make
10882         method public.
10883
10884 2009-10-16  Doug Kwan  <dougkwan@google.com>
10885
10886         * dynobj.cc (Versions::Versions): Initialize version_script_.
10887         Only insert base version symbol definition for a shared object
10888         if version script defines any version versions.
10889         (Versions::define_base_version): New method definition.
10890         (Versions::add_def): Check that base version is not needed.
10891         (Versions::add_need): Define base version lazily.
10892         * dynobj.h (Versions::define_base_version): New method declaration.
10893         (Versions::needs_base_version_): New data member declaration.
10894         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
10895         (check_DATA): Add no_version_test.stdout.
10896         (libno_version_test.so, no_version_test.o no_version_test.stdout):
10897         New make rules.
10898         * testsuite/Makefile.in: Regenerate.
10899         * testsuite/no_version_test.c: New file.
10900         * testsuite/no_version_test.sh: Ditto.
10901
10902 2009-10-16  Doug Kwan  <dougkwan@google.com>
10903
10904         * expression.cc (class Segment_start_expression): New class definition.
10905         (Segment_start_expression::value): New method definition.
10906         (script_exp_function_segment_start): Return a new
10907         Segment_start_expression.
10908         * gold/script-c.h (script_saw_segment_start_expression): New function
10909         prototype.
10910         * script-sections.cc (Script_sections::Script_sections): Initialize
10911         SAW_SEGMENT_START_EXPRESSION_ to false.
10912         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
10913         and -Tbbs options to specify section addresses if given in
10914         command line and no SEGMENT_START expression is seen in a script.
10915         * script-sections.h (Script_sections::saw_segment_start_expression,
10916         Script_sections::set_saw_segment_start_expression): New method
10917         definition.
10918         (Script_sections::saw_segment_start_expression_): New data member
10919         declaration.
10920         * script.cc (script_saw_segment_start_expression): New function.
10921         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
10922         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
10923         script_test_7.sh and script_test_8.sh.
10924         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
10925         script_test_8.stdout.
10926         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
10927         (script_test_6, script_test_6.stdout, script_test_7,
10928         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
10929         * Makefile.in: Regenerate.
10930         * testsuite/script_test_6.sh: New file.
10931         * testsuite/script_test_6.t: Same.
10932         * testsuite/script_test_7.sh: Same.
10933         * testsuite/script_test_7.t: Same.
10934         * testsuite/script_test_8.sh: Same.
10935
10936 2009-10-16  Doug Kwan  <dougkwan@google.com>
10937
10938         * output.cc (Output_segment::set_section_list_address): Cast
10939         expressions to unsigned long long type to avoid format warnings.
10940
10941 2009-10-15  Ian Lance Taylor  <iant@google.com>
10942
10943         * script.cc (Script_options::add_symbol_assignment): Always add a
10944         dot assignment to script_sections_.
10945         * script-sections.cc (Script_sections::add_dot_assignment):
10946         Initialize if necessary.
10947
10948         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
10949         program headers with no load segment if there is a linker script.
10950
10951         * layout.cc (Layout::set_segment_offsets): Align the file offset
10952         to the segment aligment for -N or -n with no load segment.
10953         * output.cc (Output_segment::add_output_section): Don't crash if
10954         the first section is a TLS section.
10955         (Output_segment::set_section_list_addresses): Print an error
10956         message if the address moves backward in a linker script.
10957         * script-sections.cc
10958         (Output_section_element_input::set_section_addresses): Don't
10959         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
10960         (Orphan_output_section::set_section_addresses): Likewise.
10961
10962 2009-10-15  Doug Kwan  <dougkwan@google.com>
10963
10964         * layout.cc (Layout::finish_dynamic_section): Generate tags
10965         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
10966         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
10967         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
10968
10969 2009-10-14  Ian Lance Taylor  <iant@google.com>
10970
10971         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
10972         fields.
10973         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
10974         data_shdr fields of relinfo.
10975         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
10976         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
10977         R_386_TLS_LDO_32, adjust based on section flags.
10978         (Target_i386::Relocate::fix_up_ldo): Remove.
10979
10980 2009-10-13  Ian Lance Taylor  <iant@google.com>
10981
10982         Add support for -pie.
10983         * options.h (class General_options): Add -pie and
10984         --pic-executable.
10985         (General_options::output_is_position_independent): Test -pie.
10986         (General_options::output_is_executable): Return true if not shared
10987         and not relocatable.
10988         (General_options::output_is_pie): Remove.
10989         * options.cc (General_options::finalize): Reject incompatible uses
10990         of -pie.
10991         * gold.cc (queue_middle_tasks): A -pie link is not static.
10992         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
10993         * symtab.cc (Symbol::final_value_is_known): Return false if
10994         output_is_position_independent.
10995         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
10996         output_is_position_independent.
10997         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
10998         output_is_position_independent.
10999         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
11000         output_is_position_independent.
11001         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
11002         two_file_pie_test.
11003         (basic_pie_test.o, basic_pie_test): New targets.
11004         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
11005         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
11006         (two_file_pie_test): New target.
11007         * testsuite/Makefile.in: Rebuild.
11008         * README: Remove note saying that -pie is not supported.
11009
11010 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
11011
11012         * options.h (class General_options): Add -init and -fini.
11013         * layout.cc (Layout::finish_dynamic_section): Emit
11014         given init and fini functions.
11015
11016 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
11017
11018         * gc.h (gc_process_relocs): Check if icf is enabled using new
11019         function.
11020         * gold.cc (queue_initial_tasks): Likewise.
11021         (queue_middle_tasks): Likewise.
11022         * object.cc (do_layout): Likewise.
11023         * symtab.cc (is_section_folded): Likewise.
11024         * main.cc (main): Likewise.
11025         * reloc.cc (Read_relocs::run): Likewise.
11026         (Sized_relobj::do_scan_relocs): Likewise.
11027         * icf.cc (is_function_ctor_or_dtor): New function.
11028         (Icf::find_identical_sections): Check if function is ctor or dtor when
11029         safe icf is chosen.
11030         * options.h (General_options::icf): Change option to be an enum.
11031         (Icf_status): New enum.
11032         (icf_enabled): New method.
11033         (icf_safe_folding): New method.
11034         (set_icf_status): New method.
11035         (icf_status_): New variable.
11036         * (options.cc) (General_options::finalize): Set icf_status_.
11037         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
11038         icf_test and icf_keep_unique_test to use the --icf enum flag.
11039         * testsuite/icf_safe_test.sh: New file.
11040         * testsuite/icf_safe_test.cc: New file.
11041
11042 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
11043
11044         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
11045         includes to gc.h and icf.h.
11046         * arm.cc: Include gc.h.
11047         * gold.cc: Likewise.
11048         * i386.cc: Likewise.
11049         * powerpc.cc: Likewise.
11050         * sparc.cc: Likewise.
11051         * x86_64.cc: Likewise.
11052         * gc.h: Include icf.h.
11053
11054 2009-10-11  Ian Lance Taylor  <iant@google.com>
11055
11056         * plugin.cc: Include "gold.h" before other header files.
11057
11058 2009-10-10  Chris Demetriou  <cgd@google.com>
11059
11060         * options.h (Input_file_argument::Input_file_type): New enum.
11061         (Input_file_argument::is_lib_): Replace with...
11062         (Input_file_argument::type_): New member.
11063         (Input_file_argument::Input_file_argument): Take Input_file_type
11064         'type' rather than boolean 'is_lib' as second argument.
11065         (Input_file_argument::is_lib): Use type_.
11066         (Input_file_argument::is_searched_file): New function.
11067         (Input_file_argument::may_need_search): Handle is_searched_file.
11068         * options.cc (General_options::parse_library): Support -l:filename.
11069         (General_options::parse_just_symbols): Update for Input_file_argument
11070         changes.
11071         (Command_line::process): Likewise.
11072         * archive.cc (Archive::get_file_and_offset): Likewise.
11073         * plugin.cc (Plugin_manager::release_input_file): Likewise.
11074         * script.cc (read_script_file, script_add_file): Likewise.
11075         * fileread.cc (Input_file::Input_file): Likewise.
11076         (Input_file::will_search_for): Handle is_searched_file.
11077         (Input_file::open): Likewise.
11078         * readsyms.cc (Read_symbols::get_name): Likewise.
11079         * testsuite/Makefile.am (searched_file_test): New test.
11080         * testsuite/Makefile.in: Regenerate.
11081         * testsuite/searched_file_test.cc: New file.
11082         * testsuite/searched_file_test_lib.cc: New file.
11083
11084 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11085             Ian Lance Taylor  <iant@google.com>
11086
11087         * descriptor.cc: Include <cstdio> and "binary-io.h".
11088         (Descriptors::open): Open the files in binary mode always.
11089         * script.cc (Lex::get_token): Treat \r as whitespace.
11090
11091 2009-10-09  Ian Lance Taylor  <iant@google.com>
11092
11093         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
11094
11095 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11096             Ian Lance Taylor  <iant@google.com>
11097
11098         * configure.ac: Check for readv function also.
11099         * fileread.cc (readv): Define if not HAVE_READV.
11100         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
11101         does not exist.
11102         * config.in: Regenerate.
11103         * configure: Regenerate.
11104
11105 2009-10-09  Doug Kwan  <dougkwan@google.com>
11106
11107         * layout.cc (Layout::make_output_section): Call target hook to make
11108         ordinary output section.
11109         (Layout::finalize): Adjust parameter list of call the
11110         Target::may_relax().
11111         * layout.h (class Layout::section_list): New method.
11112         * merge.h (Output_merge_base::entsize): Change visibility to public.
11113         (Output_merge_base::is_string, Output_merge_base::do_is_string):
11114         New methods.
11115         (Output_merge_string::do_is_string): New method.
11116         * object.cc (Sized_relobj::do_setup): renamed from
11117         Sized_relobj::set_up.
11118         * object.h (Sized_relobj::adjust_shndx,
11119         Sized_relobj::initializ_input_to_output_maps,
11120         Sized_relobj::free_input_to_output_maps): Change visibilities to
11121         protected.
11122         (Sized_relobj::setup): Virtualize.
11123         (Sized_relobj::do_setup): New method declaration.
11124         (Sized_relobj::invalidate_section_offset,
11125         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
11126         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
11127         * options.cc (parse_int): New function.
11128         * options.h (parse_int): New declaration.
11129         (DEFINE_int): New macro.
11130         (stub_group_size): New option.
11131         * output.cc (Output_section::Output_section): Initialize memebers
11132         merge_section_map_, merge_section_by_properties_map_,
11133         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
11134         (Output_section::add_input_section): Handled deferred code-fill
11135         generation and remove an old comment.
11136         (Output_section::add_relaxed_input_section): New method definition.
11137         (Output_section::add_merge_input_section): Use merge section by
11138         properties map to speed to search.  Update merge section maps
11139         as appropriate.
11140         (Output_section::build_relaxation_map): New method definition.
11141         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
11142         Same.
11143         (Output_section::relax_input_section): Renamed to
11144         Output_section::convert_input_sections_to_relaxed_sections and change
11145         interface to take a vector of pointers to relaxed sections.
11146         (Output_section::find_merge_section,
11147         Output_section::find_relaxed_input_section): New method definitions.
11148         (Output_section::is_input_address_mapped,
11149         Output_section::output_offset, Output_section::output_address):
11150         Use output section data maps to speed up searching.
11151         (Output_section::find_starting_output_address): Add comments.
11152         (Output_section::do_write,
11153         Output_section::write_to_postprocessing_buffer): Do code-fill
11154         generation as appropriate.
11155         (Output_section::get_input_sections): Invalidate relaxed input section
11156         map.
11157         (Output_section::restore_states): Adjust type of checkpoint .
11158         Invalidate relaxed input section map.
11159         * output.h (Output_merge_base): New class declaration.
11160         (Input_section_specifier): New class defintion.
11161         (class Output_relaxed_input_section) Change base class to
11162         Output_section_data_build.
11163         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
11164         base class initializer.
11165         (Output_section::add_relaxed_input_section): New method declaration.
11166         (Output_section::Input_section): Change visibility to protected.
11167         (Output_section::Input_section::relobj,
11168         Output_section::Input_section::shndx): Handle relaxed input sections.
11169         Output_section::input_sections) Change visibility to protected.  Also
11170         define overload to return a non-const pointer.
11171         (Output_section::Merge_section_properties): New class defintion.
11172         (Output_section::Merge_section_by_properties_map,
11173         Output_section::Output_section_data_by_input_section_map,
11174         Output_section::Relaxation_map): New types.
11175         (Output_section::relax_input_section): Rename method to
11176         Output_section::convert_input_sections_to_relaxed_sections and change
11177         interface to take a vector of relaxed section pointers.
11178         (Output_section::find_merge_section,
11179         Output_section::find_relaxed_input_section,
11180         Output_section::build_relaxation_map,
11181         Output_section::convert_input_sections_in_list_to_relaxed_sections):
11182         New method declarations.
11183         (Output_section::merge_section_map_
11184         Output_section::merge_section_by_properties_map_,
11185         Output_section::relaxed_input_section_map_,
11186         Output_section::is_relaxed_input_section_map_valid_,
11187         Output_section::generate_code_fills_at_write_): New data members.
11188         * script-sections.cc
11189         (Output_section_element_input::set_section_addresses): Call
11190         current_data_size and addralign methods of relaxed input sections.
11191         (Orphan_output_section::set_section_addresses): Call current_data_size
11192         and addralign methods of relaxed input sections.
11193         * symtab.cc (Symbol_table::compute_final_value): Extract template
11194         from the body of Symbol_table::sized_finalize_symbol.
11195         (Symbol_table::sized_finalized_symbol): Call
11196         Symbol_table::compute_final_value.
11197         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
11198         (Symbol_table::compute_final_value): New templated method declaration.
11199         * target.cc (Target::do_make_output_section): New method defintion.
11200         * target.h (Target::make_output_section): New method declaration.
11201         (Target::relax): Add more parameters for input objects, symbol table
11202         and layout.  Adjust call to do_relax.
11203         (Target::do_make_output_section): New method declaration.
11204         (Target::do_relax): Add parameters for input objects, symbol table
11205         and layout.
11206
11207 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11208
11209         * pread.c: Include stdio.h.
11210
11211 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11212
11213         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
11214         defined.
11215
11216 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11217
11218         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
11219         Change read_shndx type to unsigned int.
11220         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
11221         int.
11222         (Sized_dwarf_line_info::read_line_mappings): Likewise.
11223         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
11224         Change read_shndx type to unsigned int.
11225         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
11226         int.
11227         (Sized_dwarf_line_info::read_line_mappings): Likewise.
11228         * layout.cc (Layout::create_symtab_sections): Cast the result of
11229         local_symcount * symsize to off_t in the gold_assert.
11230
11231 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11232
11233         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
11234         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
11235         R_ARM_BASE_ABS.
11236         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
11237         (Arm_relocate_functions::thm_abs5): New function.
11238         (Arm_relocate_functions::abs12): New function.
11239         (Arm_relocate_functions::abs16): New function.
11240         (Arm_relocate_functions::base_abs): New function.
11241         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
11242         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
11243         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
11244         R_ARM_BASE_ABS.
11245         (Scan::global): Likewise.
11246         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
11247         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
11248         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
11249         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
11250         R_ARM_BASE_ABS.
11251
11252 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11253
11254         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
11255         (Arm_relocate_functions::movt_prel): New function.
11256         (Arm_relocate_functions::thm_movw_prel_nc): New function.
11257         (Arm_relocate_functions::thm_movt_prel): New function.
11258         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
11259         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
11260         (Scan::global, Relocate::relocate): Likewise.
11261         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11262
11263 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
11264
11265         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
11266         Incremental_checker.
11267         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
11268         unsigned int.
11269         (class Incremental_inputs_header): New class.
11270         (Incremental_inputs_header_writer): Edit comment.
11271         (Incremental_inputs_entry): New class.
11272         (Incremental_inputs_entry_writer): Edit comment.
11273         (Sized_incremental_binary::do_find_incremental_inputs_section):
11274         Add *strtab_shndx parameter, fill it.
11275         (Sized_incremental_binary::do_check_inputs): New method.
11276         (Incremental_checker::can_incrementally_link_output_file): Use
11277         Sized_incremental_binary::check_inputs.
11278         (Incremental_inputs::report_command_line): Save command line in
11279         command_line_.
11280         * incremental.h:
11281         (Incremental_binary::find_incremental_inputs_section): New
11282         method.
11283         (Incremental_binary::do_find_incremental_inputs_section): Add
11284         strtab_shndx parameter.
11285         (Incremental_binary::do_check_inputs): New pure virtual method.
11286         (Sized_incremental_binary::do_check_inputs): Declare.
11287         (Incremental_checker::Incremental_checker): Add incremental_inputs
11288         parameter, use it to initialize incremental_inputs_.
11289         (Incremental_checker::incremental_inputs_): New field.
11290         (Incremental_checker::command_line): New method.
11291         (Incremental_checker::inputs): New method.
11292         (Incremental_checker::command_line_): New field.
11293
11294 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
11295
11296         * incremental.cc: Include <cstdarg> and "target-select.h".
11297         (vexplain_no_incremental): New function.
11298         (explain_no_incremental): New function.
11299         (Incremental_binary::error): New method.
11300         (Sized_incremental_binary::do_find_incremental_inputs_section): New
11301         method.
11302         (make_sized_incremental_binary): New function.
11303         (open_incremental_binary): New function.
11304         (can_incrementally_link_file): Add checks if output is ELF and has
11305         inputs section.
11306         * incremental.h: Include "elfcpp_file.h" and "output.h".
11307         (Incremental_binary): New class.
11308         (Sized_incremental_binary): New class.
11309         (open_incremental_binary): Declare.
11310         * object.cc (is_elf_object): Use
11311         elfcpp::Elf_recognizer::is_elf_file.
11312         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
11313         * output.h (Output_file::filesize): New method.
11314
11315 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11316
11317         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
11318         New function.
11319         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
11320         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
11321         function.
11322         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
11323         function.
11324         (Arm_relocate_functions::movw_abs_nc): New function.
11325         (Arm_relocate_functions::movt_abs): New function.
11326         (Arm_relocate_functions::thm_movw_abs_nc): New function.
11327         (Arm_relocate_functions::thm_movt_abs): New function.
11328         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
11329         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
11330         (Scan::global): Likewise.
11331         (Relocate::relocate): Likewise.
11332         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11333
11334 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11335
11336         * arm.cc (Arm_relocate_functions::got_prel) New function.
11337         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
11338         (Relocate::relocate): Likewise.
11339         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11340
11341 2009-10-06  Ian Lance Taylor  <iant@google.com>
11342
11343         * options.h (class General_options): Define
11344         split_stack_adjust_size parameter.
11345         * object.h (class Object): Add uses_split_stack_ and
11346         has_no_split_stack_ fields.  Add uses_split_stack and
11347         has_no_split_stack accessor functions.  Declare
11348         handle_split_stack_section.
11349         (class Reloc_symbol_changes): Define.
11350         (class Sized_relobj): Define Function_offsets.  Declare
11351         split_stack_adjust, split_stack_adjust_reltype, and
11352         find_functions.
11353         * object.cc (Object::handle_split_stack_section): New function.
11354         (Sized_relobj::do_layout): Call handle_split_stack_section.
11355         * dynobj.cc (Sized_dynobj::do_layout): Call
11356         handle_split_stack_section.
11357         * reloc.cc (Sized_relobj::relocate_sections): Call
11358         split_stack_adjust for executable sections in split_stack
11359         objects.  Pass reloc_map to relocate_section.
11360         (Sized_relobj::split_stack_adjust): New function.
11361         (Sized_relobj::split_stack_adjust_reltype): New function.
11362         (Sized_relobj::find_functions): New function.
11363         * target-reloc.h: Include "object.h".
11364         (relocate_section): Add reloc_symbol_changes parameter.  Change
11365         all callers.
11366         * target.h (class Target): Add calls_non_split method.  Declare
11367         do_calls_non_split virtual method.  Declare match_view and
11368         set_view_to_nop.
11369         * target.cc: Include "elfcpp.h".
11370         (Target::do_calls_non_split): New function.
11371         (Target::match_view): New function.
11372         (Target::set_view_to_nop): New function.
11373         * gold.cc (queue_middle_tasks): Give an error if mixing
11374         split-stack and non-split-stack objects with -r.
11375         * i386.cc (Target_i386::relocate_section): Add
11376         reloc_symbol_changes parameter.
11377         (Target_i386::do_calls_non_split): New function.
11378         * x86_64.cc (Target_x86_64::relocate_section): Add
11379         reloc_symbol_changes parameter.
11380         (Target_x86_64::do_calls_non_split): New function.
11381         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
11382         parameter.
11383         * powerpc.cc (Target_powerpc::relocate_section): Add
11384         reloc_symbol_changes parameter.
11385         * sparc.cc (Target_sparc::relocate_section): Add
11386         reloc_symbol_changes parameter.
11387         * configure.ac: Call AM_CONDITIONAL for the default target.
11388         * configure: Rebuild.
11389         * testsuite/Makefile.am (TEST_AS): New variable.
11390         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
11391         (check_DATA): Add split_i386 and split_x86_64 files.
11392         (SPLIT_DEFSYMS): Define.
11393         (split_i386_[1234n].o): New targets.
11394         (split_i386_[124]): New targets.
11395         (split_i386_[1234r].stdout): New targets.
11396         (split_x86_64_[1234n].o): New targets.
11397         (split_x86_64_[124]): New targets.
11398         (split_x86_64_[1234r].stdout): New targets.
11399         (MOSTLYCLEANFILES): Add new executables.
11400         * testsuite/split_i386.sh: New file.
11401         * testsuite/split_x86_64.sh: New file.
11402         * testsuite/split_i386_1.s: New file.
11403         * testsuite/split_i386_2.s: New file.
11404         * testsuite/split_i386_3.s: New file.
11405         * testsuite/split_i386_4.s: New file.
11406         * testsuite/split_i386_n.s: New file.
11407         * testsuite/split_x86_64_1.s: New file.
11408         * testsuite/split_x86_64_2.s: New file.
11409         * testsuite/split_x86_64_3.s: New file.
11410         * testsuite/split_x86_64_4.s: New file.
11411         * testsuite/split_x86_64_n.s: New file.
11412         * testsuite/testfile.cc (Target_test): Update relocation_section
11413         function.
11414         * testsuite/Makefile.in: Rebuild.
11415
11416 2009-10-06  Ian Lance Taylor  <iant@google.com>
11417
11418         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
11419         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
11420         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
11421         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
11422         the address on ldo_addrs_.
11423         (Target_i386::Relocate::fix_up_ldo): New function.
11424
11425 2009-10-06   Rafael Espindola  <espindola@google.com>
11426
11427         * plugin.cc (add_input_library): New.
11428         (Plugin::load): Add add_input_library to tv.
11429         (Plugin_manager::add_input_file): Add the is_lib argument.
11430         (add_input_file): Update call to Plugin_manager::add_input_file.
11431         (add_input_library): New.
11432         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
11433
11434 2009-09-30  Doug Kwan  <dougkwan@google.com>
11435
11436         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
11437         symbol and call Symbol::may_need_copy_reloc to determine if
11438         a copy reloc is needed.
11439         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
11440         nocopyreloc is given in command line.
11441         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
11442         given in command line.
11443         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
11444         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
11445         of the removed Target_i386::may_need_copy_reloc.
11446         * options.h (copyreloc): New option with default value false.
11447         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
11448         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
11449         instead of the removed Target_powerpc::may_need_copy_reloc.
11450         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
11451         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
11452         instead of the removed Target_sparc::may_need_copy_reloc.
11453         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
11454         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
11455         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
11456         instead of the removed Target_x86_64::may_need_copy_reloc.
11457
11458 2009-09-30  Ian Lance Taylor  <iant@google.com>
11459
11460         * object.h (class Object): Remove target_ field, and target,
11461         sized_target, and set_target methods.
11462         (Object::sized_target): Remove.
11463         (class Sized_relobj): Update declarations.  Remove sized_target.
11464         * object.cc (Sized_relobj::setup): Remove target parameter.
11465         Change all callers.
11466         (Input_objects::add_object): Don't do anything with the target.
11467         (make_elf_sized_object): Add punconfigured parameter.  Change all
11468         callers.  Set or test parameter target.
11469         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
11470         Change all callers.
11471         * parameters.cc (Parameters::set_target): Change parameter type to
11472         be non-const.
11473         (Parameters::default_target): Remove.
11474         (set_parameters_target): Change parameter type to be non-const.
11475         (parameters_force_valid_target): New function.
11476         (parameters_clear_target): New function.
11477         * parameters.h (class Parameters): Update declarations.  Remove
11478         default_target method.  Add sized_target and clear_target
11479         methods.  Change target_ to be non-const.
11480         (set_parameters_target): Update declaration.
11481         (parameters_force_valid_target): Declare.
11482         (parameters_clear_target): Declare.
11483         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
11484         as NULL if we aren't searching.
11485         (Add_symbols::run): Don't check for compatible target.
11486         * fileread.cc (Input_file::open_binary): Call
11487         parameters_force_valid_target.
11488         * gold.cc (queue_middle_tasks): Likewise.
11489         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
11490         set_target on object.
11491         * dynobj.h (class Sized_dynobj): Update declarations.
11492         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
11493         make_elf_object returns NULL.
11494         (Archive::include_member): Don't check whether object target is
11495         compatible.
11496         * output.cc (Output_section::add_input_section): Get target from
11497         parameters.
11498         (Output_section::relax_input_section): Likewise.
11499         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
11500         parameters.
11501         (Sized_relobj::do_scan_relocs): Likewise.
11502         (Sized_relobj::relocate_sections): Likewise.
11503         * resolve.cc (Symbol_table::resolve): Likewise.
11504         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
11505         parameter.  Change all callers.
11506         (Symbol_table::add_from_object): Get target from parameters.
11507         (Symbol_table::add_from_relobj): Don't check object target.
11508         (Symbol_table::add_from_dynobj): Likewise.
11509         (Symbol_table::define_special_symbol): Get target from
11510         parameters.
11511         * symtab.h (class Symbol_table): Update declaration.
11512         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
11513         parameter.  Change all callers.  Clear parameter target.
11514         (Binary_test): Test target here.
11515         * testsuite/object_unittest.cc (gold_testsuite): Remove
11516         target_test_pointer parameter.  Change all callers.
11517         (Object_test): Test target here.
11518
11519 2009-09-26  Ian Lance Taylor  <iant@google.com>
11520
11521         * testsuite/initpri1.c: Don't try to use constructor priorities if
11522         compiling with gcc before 4.3.
11523
11524 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
11525
11526         * testsuite/retain_symbols_file_test.sh (check_present): Change
11527         output file name to retain_symbols_file_test.stdout.
11528         (check_absent): Likewise.
11529
11530 2009-09-18  Craig Silverstein  <csilvers@google.com>
11531
11532         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
11533         * options.cc: Include <cerrno> and <fstream>.
11534         (General_options::finalize): Parse -retain-symbols-file tag.
11535         * options.h: New flag.
11536         (General_options): New method should_retain_symbol, new
11537         variable symbols_to_retain.
11538         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
11539         should_retain_symbol map.
11540         * testsuite/Makefile.am (retain_symbols_file_test): New test.
11541         * testsuite/Makefile.in: Regenerate.
11542         * testsuite/retain_symbols_file_test.sh: New file.
11543
11544 2009-09-18  Nick Clifton  <nickc@redhat.com>
11545
11546         * po/es.po: Updated Spanish translation.
11547
11548 2009-09-17  Doug Kwan  <dougkwan@google.com>
11549
11550         * debug.h (DEBUG_RELAXATION): New constant.
11551         (DEBUG_ALL): Add DEBUG_RELAXATION.
11552         (debug_string_to_enum): Add relaxation debug option.
11553         * layout.cc
11554         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
11555         Layout::Relaxation_debug_check::read_sections,
11556         Layout::Relaxation_debug_check::read_sections): New method definitions.
11557         (Layout::Layout): Initialize data members
11558         record_output_section_data_from_scrips_,
11559         script_output_section_data_list_ and relaxation_debug_check_.
11560         (Layout::save_segments, Layout::restore_segments,
11561         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
11562         Layout::relaxation_loop_body): New method definitions.
11563         (Layout::finalize): Support relaxation.  Move section layout code to
11564         Layout::relaxation_loop_body.
11565         (Layout::set_asection_address_from_script): Move code for orphan
11566         section placement out.
11567         (Layout::place_orphan_sections_in_script): New method definition.
11568         * layout.h (Output_segment_headers, Output_file_header):
11569         New forward class declarations.
11570         (Layout::~Layout): Define.
11571         (Layout::new_output_section_data_from_script): New method definition.
11572         (Layout::place_orphan_sections_in_script): New method declaration.
11573         (Layout::Segment_states): New type declaration.
11574         (Layout::save_segments, Layout::restore_segments,
11575         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
11576         Layout::relaxation_loop_body): New method declarations.
11577         (Layout::Output_section_data_list): New type declaration.
11578         (Layout::Relaxation_debug_check): New class definition.
11579         (Layout::record_output_section_data_from_script_,
11580         Layout::script_output_section_data_list_, Layout::segment_states_,
11581         Layout::relaxation_debug_check_): New data members.
11582         * output.cc: (Output_section_headers::do_size): New method definition.
11583         (Output_section_headers::Output_section_headers): Move size
11584         computation to Output_section_headers::do_size.
11585         (Output_segment_headers::do_size): New method definition.
11586         (Output_file_header::Output_file_header): Move size computation to
11587         Output_file_header::do_size and call it.
11588         (Output_file_header::do_size): New method definition.
11589         (Output_data_group::Output_data_group): Adjust call to
11590         Output_section_data.
11591         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
11592         (Output_symtab_xindex::do_write): Add array bound check.
11593         (Output_section::Input_section::print_to_mapfile): Handle
11594         RELAXED_INPUT_SECTION_CODE.
11595         (Output_section::Output_section): Initialize data member checkpoint_.
11596         (Output_section::~Output_section): Delete checkpoint object pointed
11597         by checkpoint_.
11598         (Output_section::add_input_section): Always add an Input_section if
11599         relaxing.
11600         (Output_section::add_merge_input_section): Add assert.
11601         (Output_section::relax_input_section): New method definition.
11602         (Output_section::set_final_data_size): Set load address to zero for
11603         an unallocated section.
11604         (Output_section::do_address_and_file_offset_have_reset_values):
11605         New method definition.
11606         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
11607         Handle relaxed input section.
11608         (Output_section::sort_attached_input_sections): Checkpoint input
11609         section list lazily.
11610         (Output_section::get_input_sections): Change type of input_sections to
11611         list of Simple_input_section pointers.  Checkpoint input section list
11612         lazily.  Also handle relaxed input sections.
11613         (Output_section::add_input_section_for_script): Take a reference to
11614         a Simple_input_section object instead of Relobj pointer and section
11615         index as parameter.  Handle relaxed input sections.
11616         (Output_section::save_states, Output_section::restore_states): New
11617         method definitions.
11618         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
11619         (Output_data::is_data_size_fixed): New method definition.
11620         (Output_data::reset_addresss_and_file_offset): Do not reset data size
11621         if it is fixed.
11622         (Output_data::address_and_file_offset_have_reset_values): New method
11623         definition.
11624         (Output_data::do_address_and_file_offset_have_reset_values): New method
11625         definition.
11626         (Output_data::set_data_size): Check that data size is not fixed.
11627         (Output_data::fix_data_size): New method definition.
11628         (Output_data::is_data_size_fixed_): New data member.
11629         (Output_section_headers::set_final_data_size): New method definition.
11630         (Output_section_headers::do_size): New method declaration.
11631         (Output_segment_headers::set_final_data_size): New method definition.
11632         (Output_segment_headers::do_size): New method declaration.
11633         (Output_file_header::set_final_data_size)::New method definition.
11634         (Output_file_header::do_size)::New method declaration.
11635         (Output_section_data::Output_section_data): Add new parameter
11636         is_data_size_fixed and use it to fix data size.
11637         (Output_data_const::Output_data_const): Adjust call to base class
11638         constructor and fix data size.
11639         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
11640         base class constructor and fix data size.
11641         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
11642         base class constructor and fix data size.
11643         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
11644         class constructor and fix data size.
11645         (Output_data_group::set_final_data_size): New method definition.
11646         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
11647         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
11648         class constructor and fix data size.
11649         (Output_relaxed_input_section): New class definition.
11650         (Output_section::Simple_input_section): New class definition.
11651         (Output_section::get_input_sections): Adjust parameter list.
11652         (Output_section::add_input_section_for_script): Same.
11653         (Output_section::save_states, Output_section::restore_states,
11654         Output_section::do_address_and_file_offset_have_reset_values,
11655         (Output_section::Input_section::Input_section): Handle
11656         RELAXED_INPUT_SECTION_CODE.  Add new overload for
11657         Output_relaxed_input_section.
11658         (Output_section::Input_section::is_input_section,
11659         Output_section::Input_section::set_output_section): Handle relaxed
11660         input section.
11661         (Output_section::Input_section::is_relaxed_input_section,
11662         Output_section::Input_section::output_section_data,
11663         Output_section::Input_section::relaxed_input_section): New method
11664         definitions.
11665         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
11666         value.
11667         (Output_section::Input_section::u1_): Update comments.
11668         (Output_section::Input_section::u2_): Add new union member poris.
11669         (Output_section::Checkpoint_output_section): New classs definition.
11670         (Output_section::relax_input_section): New method declaration.
11671         (Output_section::checkpoint_): New data member.
11672         (Output_segment): Update comments.
11673         (Output_segment::Output_segment): Un-privatize copy constructor.
11674         (Output_segment::operator=): Un-privatize.
11675         * script-sections.cc (Output_section_element::Input_section_list):
11676         Change element type to Output_section::Simple_input_section.
11677         (Output_section_element_dot_assignment::set_section_addresses):
11678         Register output section data for relaxation clean up.
11679         (Output_data_exression::Output_data_expression): Adjust call to base
11680         constructor to fix data size.
11681         (Output_section_element_data::set_section_addresses): Register
11682         Output_data_expression object for relaxation clean up.
11683         (struct Input_section_info): Replace Relobj pointer and section index
11684         pair with Output_section::Simple_input_section and Convert struct to a
11685         class.
11686         (Input_section_sorter::operator()): Adjust access to
11687         Input_section_info data member to use accessors.
11688         (Output_section_element_input::set_section_addresses): Use layout
11689         parameter.  Adjust code to use Output_section::Simple_input_section
11690         and Input_secction_info classes.  Register filler for relaxation
11691         clean up.
11692         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
11693         and section index pair with Output_section::Simple_input_section
11694         class.  Adjust code accordingly.
11695         (Phdrs_element::release_segment): New method definition.
11696         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
11697         segment list.
11698         (Script_sections::release_segments): New method definition.
11699         * gold/script-sections.h (Script_sections::release_segments): New
11700         method declaration.
11701         * gold/target.h (Target::may_relax, Target::relax,
11702         Target::do_may_relax, Target::do_relax): New method definitions.
11703
11704 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11705
11706         * arm.cc (has_signed_unsigned_overflow): New function.
11707         (Arm_relocate_functions::abs8): New function.
11708         (Target_arm::Scan::local): Handle R_ARM_ABS8.
11709         (Target_arm::Scan::global): Likewise.
11710         (Target_arm::relocate::relocate): Likewise.
11711         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
11712         Likewise.
11713
11714 2009-09-16  Cary Coutant  <ccoutant@google.com>
11715
11716         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
11717         * testsuite/Makefile.in: Regenerate.
11718
11719 2009-09-11  Nick Clifton  <nickc@redhat.com>
11720
11721         * po/gold.pot: Updated by the Translation project.
11722
11723 2009-09-08  Cary Coutant  <ccoutant@google.com>
11724
11725         * output.cc (Output_file::open): Add execute permission to empty file.
11726         * testsuite/Makefile.am (permission_test): New test.
11727         * testsuite/Makefile.in: Regenerate.
11728
11729 2009-09-02  Ian Lance Taylor  <iant@google.com>
11730
11731         * output.cc (Output_file::resize): Call map_no_anonymous rather
11732         than map.
11733
11734 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
11735
11736         * gold.cc: Include "incremental.h".
11737         (queue_initial_tasks): Call Incremental_checker methods.
11738         * incremental.cc: Include "output.h".
11739         (Incremental_checker::can_incrementally_link_output_file): New
11740         method.
11741         * incremental.h (Incremental_checker): New class.
11742
11743         * output.cc (Output_file::open_for_modification): New method.
11744         (Output_file::map_anonymous): Changed return type to bool.  Record
11745         map in base_ field.
11746         (Output_file::map_no_anonymous): New method, broken out of map.
11747         (Output_file::map): Use map_no_anonymous and map_anonymous.
11748         * output.h (class Output_file): Update declarations.
11749
11750 2009-08-24  Cary Coutant  <ccoutant@google.com>
11751
11752         * options.h (Command_line::Pre_options): New class.
11753         (Command_line::pre_options): New member.
11754         * options.cc (gold::options::ready_to_register): New variable.
11755         (One_option::register_option): Do nothing if not registering options.
11756         Assert if same short option registered twice.
11757         (General_options::General_options): Turn off option registration when
11758         done constructing.
11759         (Command_line::Pre_options::Pre_options): New constructor.
11760
11761 2009-08-24  Cary Coutant  <ccoutant@google.com>
11762
11763         * options.h (General_options::no_keep_memory): Remove incorrect
11764         short option.
11765
11766 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
11767
11768         * Makefile.am (am__skiplex, am__skipyacc): New.
11769         * Makefile.in: Regenerate.
11770
11771 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
11772
11773         * Makefile.am (AM_CPPFLAGS): Renamed from ...
11774         (INCLUDES): ... this.
11775         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
11776         (AM_CPPFLAGS): Renamed from ...
11777         (INCLUDE): ... this.
11778         * Makefile.in, testsuite/Makefile.in: Regenerate.
11779
11780         * Makefile.in: Regenerate.
11781         * aclocal.m4: Likewise.
11782         * config.in: Likewise.
11783         * configure: Likewise.
11784         * testsuite/Makefile.in: Likewise.
11785
11786         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
11787         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
11788         * Makefile.in: Regenerate.
11789         * testsuite/Makefile.in: Regenerate.
11790
11791 2009-08-19  Cary Coutant  <ccoutant@google.com>
11792
11793         * resolve.cc (Symbol_table::resolve): Don't complain about defined
11794         symbols in shared libraries overridden by hidden or internal symbols
11795         in the main program.
11796
11797 2009-08-19  Chris Demetriou  <cgd@google.com>
11798
11799         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
11800         checking source file names in error messages.
11801
11802 2009-08-18  Doug Kwan  <dougkwan@google.com>
11803
11804         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
11805         an elcpp::Ehdr as parameter.  Adjust call to set_target.
11806         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
11807         an elfcpp::Ehdr as parameter.
11808         * object.cc (Object::set_target): Remove the version that looks up
11809         a target and sets it.
11810         (Sized_relobj::setup): Take a Target object instead of
11811         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
11812         (make_elf_sized_object): Find target and ask target to
11813         make an ELF object.
11814         * object.h: (Object::set_target): Remove the version that looks up
11815         a target and sets it.
11816         (Sized_relobj::setup): Take a Target object instead of
11817         an elfcpp:Ehdr as parameter.
11818         * target.cc: Include dynobj.h.
11819         (Target::do_make_elf_object_implementation): New.
11820         (Target::do_make_elf_object): New.
11821         * target.h (Target::make_elf_object): New template declaration.
11822         (Target::do_make_elf_object): New method declarations.
11823         (Target::do_make_elf_object_implementation): New template declaration.
11824
11825 2009-08-14  Ian Lance Taylor  <iant@google.com>
11826
11827         * gold.h (FUNCTION_NAME): Define.
11828         (gold_unreachable): Use FUNCTION_NAME.
11829
11830 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
11831
11832         * icf.cc (Icf::find_identical_sections): Issue a warning when a
11833         symbol in the --keep-unique list is not found.
11834
11835 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
11836
11837         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
11838         been maked as --keep-unique.
11839         (Icf::unfold_section): New function.
11840         * icf.h (Icf::unfold_section): New function.
11841         * options.h (General_options::keep_unique): New option.
11842         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
11843         * testsuite/Makefile.in: Regenerate.
11844         * testsuite/icf_keep_unique_test.sh: New file.
11845         * testsuite/icf_keep_unique_test.cc: New file.
11846
11847 2009-08-12  Cary Coutant  <ccoutant@google.com>
11848
11849         PR 10471
11850         * resolve.cc (Symbol_table::resolve): Check for references from
11851         dynamic objects to hidden and internal symbols.
11852         * testsuite/Makefile.am (hidden_test.sh): New test.
11853         * testsuite/Makefile.in: Regenerate.
11854         * testsuite/hidden_test.sh: New script.
11855         * testsuite/hidden_test_1.c: New test source.
11856         * testsuite/hidden_test_main.c: New test source.
11857
11858 2009-08-11  Doug Kwan  <dougkwan@google.com>
11859
11860         * arm.cc: Update comments.
11861         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
11862         segment to locate the .ARM.exidx section if present.
11863
11864 2009-08-09  Doug Kwan  <dougkwan@google.com>
11865
11866         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
11867         patch.
11868
11869 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
11870         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
11871         compiler warnings.
11872
11873 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
11874
11875         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
11876         valid tls_segment only for non-debug-section relocations.
11877         * testsuite/Makefile.am: Add gc_tls_test.
11878         * testsuite/Makefile.in: Regenerate.
11879         * testsuite/gc_tls_test.cc: New file.
11880         * testsuite/gc_tls_test.sh: New file.
11881
11882 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
11883
11884         * icf.cc: New file.
11885         * icf.h: New file.
11886         * Makefile.am (CCFILES): Add icf.cc.
11887         (HFILES): Add icf.h
11888         * Makefile.in: Regenerate.
11889         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
11890         * gc.h (gc_process_relocs): Populate lists used by icf to contain
11891         section, symbol and addend information for the relocs.
11892         * gold.cc (queue_middle_tasks): Call identical code folding.
11893         * gold.h: Add defines for multimap.
11894         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
11895         to the call of finalize_local_symbols.
11896         * main.cc (main): Create object of class Icf.
11897         * object.cc (Sized_relobj::do_layout): Allow this function to be
11898         called twice during icf.
11899         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
11900         to sections marked as identical by icf.
11901         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
11902         when available.
11903         (Sized_relobj::do_section_entsize): New function.
11904         * object.h (Object::section_entsize): New function.
11905         (Object::do_section_entsize): New pure virtual function.
11906         (Relobj::finalize_local_symbols): Add new parameter.
11907         (Relobj::do_section_entsize): New function.
11908         * options.h (General_options::icf): New option.
11909         (General_options::icf_iterations): New option.
11910         (General_options::print_icf_sections): New option.
11911         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
11912         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
11913         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
11914         icf.
11915         * symtab.cc (Symbol_table::is_section_folded): New function.
11916         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
11917         to sections marked as identical by icf.
11918         * symtab.h (Symbol_table::set_icf): New function.
11919         (Symbol_table::icf): New function.
11920         (Symbol_table::is_section_folded): New function.
11921         (Symbol_table::icf_): New data member.
11922         * target-reloc.h (relocate_section): Ignore sections folded by icf.
11923         * testsuite/Makefile.am: Add commands to build icf_test.
11924         * testsuite/Makefile.in: Regenerate.
11925         * testsuite/icf_test.sh: New file.
11926         * testsuite/icf_test.cc: New file.
11927
11928 2009-07-24  Chris Demetriou  <cgd@google.com>
11929
11930         * layout.cc (is_compressible_debug_section): Fix incorrect
11931         comment about compressed section names.
11932
11933 2009-07-20  Ian Lance Taylor  <ian@airs.com>
11934
11935         PR 10419
11936         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
11937
11938 2009-07-16  Ian Lance Taylor  <iant@google.com>
11939
11940         PR 10400
11941         * layout.h: #include <map>.
11942         (class Kept_section): Change from struct to class.  Add accessors
11943         and setters.  Add section size to Comdat_group mapping.  Change
11944         Comdat_group to std::map.  Add is_comdat_ field.  Add
11945         linkonce_size field in union.
11946         (class Layout): Update declaration of find_or_add_kept_section.
11947         Don't declare find_kept_object.
11948         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
11949         parameter.  Add object, shndx, is_comdat, and is_group_name
11950         parameters.  Change all callers.  Adjust for new Kept_section.
11951         (Layout::find_kept_object): Remove.
11952         * object.cc (Sized_relobj::include_section_group): Update use of
11953         Kept_section.  Rename secnum to shndx.  Only record
11954         Kept_comdat_section if sections are the same size.
11955         (Sized_relobj::include_linkonce_section): Update use of
11956         Kept_section.  Only record Kept_comdat_section if sections are the
11957         same size.  Set size of linkonce section.
11958         (Sized_relobj::map_to_kept_section): Update call to
11959         get_kept_comdat_section.
11960         * object.h (class Sized_relobj): Rename fields in
11961         Kept_comdat_section to drop trailing underscores; change object
11962         field to Relobj*.  Change Kept_comdat_section_table to store
11963         struct rather than pointer.
11964         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
11965         Add kept_object and kept_shndx parameters.  Change all callers.
11966         (Sized_relobj::get_kept_comdat_section): Change return type to
11967         bool.  Add kept_object and kept_shndx parameters.  Change all
11968         callers.
11969         * plugin.cc (Pluginobj::include_comdat_group): Update call to
11970         Layout::find_or_add_kept_section.
11971
11972 2009-07-09  Ian Lance Taylor  <iant@google.com>
11973
11974         * merge.cc (Object_merge_map::initialize_input_to_output_map):
11975         Reserve space in the hash table.
11976
11977 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
11978
11979         * fileread.cc (File_read::get_mtime): New method.
11980         * fileread.h (Timespec): New structure.
11981         (File_read::get_mtime): New method.
11982         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
11983         Renamed from timestamp_nsec.
11984         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
11985         Elf_Xword.
11986         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
11987         timestamp_nsec.
11988         (Incremental_inputs::report_archive): Save mtime; style fix.
11989         (Incremental_inputs::report_obejct): Save mtime; style fix.
11990         (Incremental_inputs::report_script): Save mtime; style fix.
11991         (Incremental_inputs::finalize_inputs): Style fix.
11992         (Incremental_inputs::finalize): Style fix.
11993         (Incremental_inputs::create_input_section_data): Store inputs
11994         mtime.
11995         * incremental.h (Incremental_inputs::report_script): Add mtime
11996         argument.
11997         (Incremental_inputs::Input_info::Input_info): Intialize only one
11998         union member.
11999         (Incremental_inputs::Input_info::archive): Move to nameless
12000         union.
12001         (Incremental_inputs::Input_info::obejct): Move to nameless union.
12002         (Incremental_inputs::Input_info::script): Move to nameless union.
12003         (Incremental_inputs::mtime): New field.
12004         * script.cc (read_input_script): Pass file mtime to
12005         Incremental_input.
12006         * script.h (Script_info::inputs): Style fix.
12007
12008 2009-07-01  Ian Lance Taylor  <ian@airs.com>
12009
12010         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
12011         instead of 32.
12012
12013 2009-06-24  Ian Lance Taylor  <iant@google.com>
12014
12015         PR 10156
12016         * layout.cc (Layout::choose_output_section): If we find an
12017         existing section, update the flags.
12018         (Layout::create_notes): New function, broken out of
12019         Layout::finalize.
12020         (Layout::finalize): Don't create note sections.
12021         (Layout::create_note): Don't crash if linker script discards
12022         section.
12023         (Layout::create_gold_note): Likewise.
12024         (Layout::create_build_id): Likewise.  Don't set
12025         after_input_sections on the section.
12026         (Layout::create_executable_stack_info): Remove target parameter.
12027         Change caller.
12028         * layout.h (class Layout): Declare create_notes.  Update
12029         declaration of create_executable_stack_info.
12030         * gold.cc (queue_middle_tasks): Call create_notes.
12031         * output.cc (Output_section::update_flags_for_input_section): Move
12032         here from output.h.  If SHF_ALLOC flag is newly set, mark address
12033         invalid.
12034         * output.h (Output_data::mark_address_invalid): New function.
12035         (class Output_section): Only declare, not define,
12036         update_flags_for_input_section.  Remove set_flags.
12037
12038 2009-06-24  Ian Lance Taylor  <iant@google.com>
12039
12040         * script-sections.cc (Output_section_definition::
12041         set_section_addresses): Rename shadowing local load_address to
12042         laddr.
12043
12044 2009-06-24  Ian Lance Taylor  <iant@google.com>
12045
12046         PR 10244
12047         * reloc.cc (relocate_sections): Skip empty relocation sections.
12048
12049 2009-06-23  Ian Lance Taylor  <iant@google.com>
12050
12051         PR 10156
12052         * layout.cc (Layout::create_note): Use choose_output_section
12053         rather than make_output_section.
12054
12055 2009-06-23  Ian Lance Taylor  <iant@google.com>
12056
12057         PR 10237
12058         * options.cc (General_options::parse_V): Set printed_version_.
12059         (General_options::General_options): Initialize printed_version_.
12060         * options.h (class General_options): Add printed_version_ field.
12061         * gold.cc (queue_initial_tasks): If there are no input files,
12062         don't give a fatal error if we printed the version information.
12063         (queue_middle_tasks): If using -r with a shared object, give a
12064         fatal error rather than an ordinary error.
12065
12066 2009-06-23  Ian Lance Taylor  <iant@google.com>
12067
12068         PR 10219
12069         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
12070         (Layout::make_output_section): Set have_stabstr_section_ if we see
12071         a .stab*str section.
12072         (Layout::finalize): Call link_stabs_sections.
12073         (Layout::link_stabs_sections): New file.
12074         * layout.h (class Layout): Add have_stabstr_section_ field.
12075         Declare link_stabs_sections.
12076
12077 2009-06-23  Doug Kwan  <dougkwan@google.com>
12078
12079         * Makefile.am (libgold_a_LIBADD): New.
12080         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
12081         * Makefile.in: Regenerate.
12082         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
12083         * configure: Regenerate.
12084         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
12085         * fileread.cc: Include sys/state.h
12086         * gold.h: Declare memmem and strndup if found missing.
12087         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
12088
12089 2009-06-23  Ian Lance Taylor  <iant@google.com>
12090
12091         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
12092         * configure: Rebuild.
12093
12094 2009-06-23  Ian Lance Taylor  <iant@google.com>
12095
12096         PR 10147
12097         * object.cc (Object::section_contents): Don't try to get a view if
12098         the section has length zero.
12099         (Object::handle_gnu_warning_section): If the section is empty, use
12100         the name of the section as the warning.
12101
12102 2009-06-23  Ian Lance Taylor  <iant@google.com>
12103
12104         PR 10133
12105         * stringpool.h (class Stringpool_template): Add optimize_ field.
12106         (Stringpool_template::set_optimize): New function.
12107         * stringpool.cc (Stringpool_template::Stringpool_template):
12108         Initialize optimize_ field.
12109         (Stringpool_template::set_string_offsets): Test local optimize
12110         fild rather than parameter.
12111         * layout.cc (Layout::Layout): Call set_optimize on the section
12112         name stringpool.
12113
12114 2009-06-22  Ian Lance Taylor  <iant@google.com>
12115
12116         PR 10030
12117         * yyscript.y: Parse TARGET.
12118         * script.cc (script_set_target): New function.
12119         * script-c.h (script_set_target): Declare.
12120         * options.cc (General_options::string_to_object_format): Rename
12121         from string_to_object_format in anonymous namespace.  Change
12122         callers.
12123         * options.h (class General_options): Declare
12124         string_to_object_format.
12125
12126 2009-06-22  Ian Lance Taylor  <iant@google.com>
12127
12128         * script-sections.cc (Script_sections::create_segments): Don't put
12129         program headers in a PT_LOAD segment if -n or -N.
12130
12131 2009-06-22  Ian Lance Taylor  <iant@google.com>
12132
12133         PR 10141
12134         * options.h (class General_options): Add -z lazy and -z now.  Sort
12135         -z options into alphabetical order.
12136         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
12137
12138 2009-06-21  Ian Lance Taylor  <iant@google.com>
12139
12140         * layout.cc (Layout::make_output_section): Call
12141         Target::new_output_section.
12142         (Layout::attach_allocated_section_to_segment): Put large section
12143         sections in a separate load segment with the large segment flag
12144         set.
12145         (Layout::segment_precedes): Sort large data segments after other
12146         load segments.
12147         (align_file_offset): New static function.
12148         (Layout::set_segment_offsets): Use align_file_offset.
12149         * output.h (class Output_section): Add is_small_section_ and
12150         is_large_section_ fields.
12151         (Output_section::is_small_section): New function.
12152         (Output_section::set_is_small_section):  New function.
12153         (Output_section::is_large_section): New function.
12154         (Output_section::set_is_large_section): New function.
12155         (Output_section::is_large_data_section): New function.
12156         (class Output_segment): Add is_large_data_segment_ field.
12157         (Output_segment::is_large_data_segment): New function.
12158         (Output_segment::set_is_large_data_segment): New function.
12159         * output.cc (Output_section::Output_section): Initialize new
12160         fields.
12161         (Output_segment::Output_segment): Likewise.
12162         (Output_segment::add_output_section): Add assertion that large
12163         data sections always go in large data segments.  Force small data
12164         sections to the end of the list of data sections.  Force small BSS
12165         sections to the start of the list of BSS sections.  For large BSS
12166         sections to the end of the list of BSS sections.
12167         * symtab.h (class Symbol): Declare is_common_shndx.
12168         (Symbol::is_defined): Check Symbol::is_common_shndx.
12169         (Symbol::is_common): Likewise.
12170         (class Symbol_table): Define enum Commons_section_type.  Update
12171         declarations.  Add small_commons_ and large_commons_ fields.
12172         * symtab.cc (Symbol::is_common_shndx): New function.
12173         (Symbol_table::Symbol_table): Initialize new fields.
12174         (Symbol_table::add_from_object): Put small and large common
12175         symbols in the right list.
12176         (Symbol_table::sized_finalized_symbol): Check
12177         Symbol::is_common_shndx.
12178         (Symbol_table::sized_write_globals): Likewise.
12179         * common.cc (Symbol_table::do_allocate_commons): Allocate new
12180         common symbol lists.  Don't call do_allocate_commons_list if the
12181         list is empty.
12182         (Symbol_table::do_allocate_commons_list): Remove is_tls
12183         parameter.  Add comons_section_type parameter.  Change all
12184         callers.  Handle small and large common symbols.
12185         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
12186         Symbol::is_common_shndx.
12187         * resolve.cc (symbol_to_bits): Likewise.
12188         * target.h (Target::small_common_shndx): New function.
12189         (Target::small_common_section_flags): New function.
12190         (Target::large_common_shndx): New function.
12191         (Target::large_common_section_flags): New function.
12192         (Target::new_output_section): New function.
12193         (Target::Target_info): Add small_common_shndx, large_common_shndx,
12194         small_common_section_flags, and large_common_section_flags
12195         fields.
12196         (Target::do_new_output_section): New virtual function.
12197         * arm.cc (Target_arm::arm_info): Initialize new fields.
12198         * i386.cc (Target_i386::i386_info): Likewise.
12199         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
12200         Likewise.
12201         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
12202         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
12203         (Target_x86_64::do_new_output_section): New function.
12204         * configure.ac: Define conditional MCMODEL_MEDIUM.
12205         * testsuite/Makefile.am (check_PROGRAMS): Add large.
12206         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
12207         (large_LDFLAGS): Define.
12208         * testsuite/large.c: New file.
12209         * testsuite/testfile.cc (Target_test::test_target_info):
12210         Initialize new fields.
12211         * configure, testsuite/Makefile.in: Rebuild.
12212
12213 2009-06-05  Doug Kwan  <dougkwan@google.com>
12214
12215         * Makefile.am (CCFILES): Add target.cc.
12216         * Makefile.in: Regenerate.
12217         * i386.cc (class Target_i386): Define new virtual method to
12218         override do_is_local_label_name in parent.
12219         * object.cc (Sized_relobj::do_count_local_symbols): Discard
12220         local symbols if --discard-locals or -X is given.
12221         * options.h (class General_options): Declare new options
12222         '--discard-locals' and '-X' for discarding locals.
12223         * target.h (class Target): Define new methods is_local_label_name.
12224         Declare new virtual method do_is_local_label_name.
12225         * target.cc: New file.
12226         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
12227         (check_SCRIPTS): Add discard_locals_test.sh.
12228         (check_DATA): Add discard_local_tests.syms.
12229         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
12230         (discard_local_tests.syms, discard_locals_test.o): New make rules.
12231         * testsuite/Makefile.in: Regenerate.
12232         * testsuite/discard_locals_test.c: New file.
12233         * testsuite/discard_locals_test.sh: Same.
12234
12235 2009-06-05  Doug Kwan  <dougkwan@google.com>
12236
12237         * object.cc (Sized_relobj::Sized_relobj): Initialize
12238         discarded_eh_frame_shndx_ to -1U.
12239         (Sized_relobj::do_layout): Record index of a discard .eh_frame
12240         section.
12241         (Sized_relobj::do_count_local_symbols): Skip local symbols in
12242         a discarded .eh_frame section.
12243         (Sized_relobj::do_finalize_local_symbols): Ditto.
12244         * object.h (class Sized_relobj): Declare new member
12245         discarded_eh_frame_shndx_.
12246         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
12247         (local_labels_test.o, local_labels_test): New rules.
12248         * testsuite/Makefile.in: Regenerate.
12249
12250 2009-06-04  Doug Kwan  <dougkwan@google.com>
12251
12252         * layout.cc (Layout::section_name_mapping): Add mapping for
12253         special ARM sections.
12254
12255 2009-06-03  Doug Kwan  <dougkwan@google.com>
12256
12257         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
12258         (utils::has_overflow): Same.
12259
12260 2009-06-03  Ian Lance Taylor  <iant@google.com>
12261
12262         * layout.cc (Layout::section_name_mapping): New array, replacing
12263         Layout::linkonce_mapping.
12264         (Layout::section_name_mapping_count): New variable, replacing
12265         Layout::linkonce_mapping_count.
12266         (Layout::linkonce_output_name): Remove.
12267         (Layout::output_section_name): Rewrite.
12268         * layout.h (class Layout): Rename Linkonce_mapping to
12269         Section_name_mapping, linkonce_mapping to section_name_mapping,
12270         linkonce_mapping_count to section_name_mapping_count.  Don't
12271         declare linkonce_output_name.
12272
12273 2009-06-03  Doug Kwan  <dougkwan@google.com>
12274
12275         * gold/arm.cc (namespace utils): New.
12276         (Target_arm::reloc_is_non_pic): Define new method.
12277         (class Arm_relocate_functions): New.
12278         (Target_arm::Relocate::relocate): Handle relocation types used by
12279         Android.
12280
12281 2009-06-03  Ian Lance Taylor  <iant@google.com>
12282
12283         * arm.cc (Target_arm::scan::global): Use || instead of |.
12284
12285 2009-06-02  Doug Kwan  <dougkwan@google.com>
12286
12287         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
12288         issued_non_pic_error_.
12289         (class Target_arm::Scan): Declare new method check_non_pic.
12290         Define new method symbol_needs_plt_entry.
12291         Declare new data member issued_non_pic_error_.
12292         (class Target_arm::Relocate): Declare new method
12293         should_apply_static_reloc.
12294         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
12295         (Target_arm::Scan::check_non_pic): Define new method.
12296         (Target_arm::Scan::local): Handle a small subset of reloc types used
12297         by Android.
12298         (Target_arm::Scan::local): Same.
12299         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
12300
12301 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
12302
12303         * incremental.cc (Incremental_inputs::report_command_line): Filter
12304         out --incremental-* options.
12305
12306 2009-05-29  Doug Kwan  <dougkwan@google.com>
12307
12308         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
12309         template class.
12310         (class Target_arm): Update comment.
12311         (Target_arm::Target_arm): Initialize new data members GOT_,
12312         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
12313         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
12314         and Target_arm::rel_dyn_section.
12315         Declare new_enum Target_arm::Got_type.
12316         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
12317         and DYNBSS_.
12318         Update commments for member do_dynsym_value.
12319         (Target_arm::got_size, Target_arm::plt_section,
12320         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
12321         new methods inside class defintion.
12322         (Target_arm::got_section): Define new method.
12323         (Target_arm::rel_dyn_section): Same.
12324         (Output_data_plt_arm): New template class.
12325         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
12326         (Output_data_plt_arm:do_adjust_output_section): Define new method.
12327         (Output_data_plt_arm::add_entry): Same.
12328         (Output_data_plt_arm::first_plt_entry): Define new
12329         static data member for PLT instruction template.
12330         (Output_data_plt_arm::plt_entry): Same.
12331         (Output_data_plt_arm::do_write): Define new method.
12332         (Target_arm::make_plt_entry): Same.
12333         (Target_arm::do_finalize_sections): Same.
12334         (Target_arm::do_dynsym_value): Same.
12335
12336 2009-05-28  Doug Kwan  <dougkwan@google.com>
12337
12338         * Makefile.am (TARGETSOURCES): Add arm.cc.
12339         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
12340         * Makefile.in: Regenerate.
12341         * arm.cc: New file.
12342         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
12343
12344 2009-05-26  Doug Kwan  <dougkwan@google.com>
12345
12346         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
12347         (General_options::check_excluded_libs): Strip off directories in
12348         archive name before matching like GNU ld does.
12349         * testsuite/Makefile.am (MOSTLYCLEANFILES,
12350         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
12351         (exclude_libs_test_LDFLAGS): Add linker option
12352         -Wl,--exclude-libs,libexclude_libs_test_3
12353         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
12354         an explicit archive without using -l.
12355         (alt/libexclude_libs_test_3.a): New make rule.
12356         * testsuite/Makefile.in: Regenerate.
12357         * testsuite/exclude_libs_test.c : Declare lib3_default().
12358         (main): Call it.
12359         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
12360         * exclude_libs_test_3.c: New file.
12361
12362 2009-05-26  Nick Clifton  <nickc@redhat.com>
12363
12364         * po/id.po: New Indonesian translation.
12365         * po/gold.pot: Updated template file.
12366
12367 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
12368
12369         * testsuite/Makefile.am: Add -ffunction-sections to compile
12370         gc_comdat_test files.  Add -Wl,--gc-sections to build
12371         gc_comdat_test.
12372         * testsuite/Makefile.in: Regenerate.
12373         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
12374
12375 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
12376
12377         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
12378         kept comdat section was garbage collected.
12379         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
12380         * testsuite/Makefile.in: Regenerate.
12381         * testsuite/gc_comdat_test.sh: New file.
12382         * testsuite/gc_comdat_test_1.cc: New file.
12383         * testsuite/gc_comdat_test_2.cc: New file.
12384
12385 2009-05-19  Doug Kwan  <dougkwan@google.com>
12386
12387         * archive.cc (Archive::Archive): Move constructor from archive.h
12388         to here.  Initialize no_export_.
12389         (Archive::get_elf_object_for_member): Set no_export flag of object.
12390         * archive.h (Archive::Archive): Move constructor body to
12391         archive.cc.
12392         (Archive::no_export): New method.
12393         (Archive::no_export_): New field.
12394         * object.h (Object::Object): Initialize no_export_ to false.
12395         (Object::no_export, Object::set_no_export): New methods.
12396         (Object::no_export_): New field.
12397         * options.cc (General_options::parse_exclude_libs): New method.
12398         (General_options::check_excluded_libs) Same.
12399         * options.h (exclude_libs): New option.
12400         (General_options::check_excluded_libs): New method declaration.
12401         (General_options::excluded_libs_): New field.
12402         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
12403         default or protected visibility if an object has no-export flag set.
12404         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
12405         (check_SCRIPTS): Add exclude_libs_test.sh.
12406         (check_DATA): Add exclude_libs_test.syms.
12407         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
12408         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
12409         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
12410         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
12411         (exclude_libs_test.syms, libexclude_libs_test_1.a,
12412         libexclude_libs_test_2.a): New rules.
12413         * testsuite/Makefile.in: Regenerate.
12414         * testsuite/exclude_libs_test.c: New file.
12415         * testsuite/exclude_libs_test.sh: Ditto.
12416         * testsuite/exclude_libs_test_1.c: Ditto.
12417         * testsuite/exclude_libs_test_2.c: Ditto.
12418
12419 2009-05-15  Ian Lance Taylor  <iant@google.com>
12420
12421         * configure.ac: Check for declarations for cases where libiberty.h
12422         checks HAVE_DECL_xxx.
12423         * configure, config.in: Rebuild.
12424
12425 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
12426
12427         * gold.h (Incremental_argument_list): Remove (invalid) forward
12428         declaration.
12429         * incremental.cc (Incremental_inputs::report_achive): New method.
12430         (Incremental_inputs::report_object): New method.
12431         (Incremental_inputs::report_script): New method.
12432         (Incremental_inputs::finalize_inputs): New method.
12433         (Incremental_inputs::finalize): Call finalize_inputs().
12434         (Incremental_inputs::sized_create_incremental_inputs_section_data):
12435         Create inputs entries.
12436         * incremental.h (Incremental_input_type): New enum.
12437         (Incremental_inputs::Incremental_input): Initialize new fields.
12438         (Incremental_inputs::report_inputs): New method.
12439         (Incremental_inputs::report_achive): New method.
12440         (Incremental_inputs::report_object): New method.
12441         (Incremental_inputs::report_script): New method.
12442         (Incremental_inputs::finalize_inputs): New method.
12443         (Incremental_inputs::Input_info): New struct.
12444         (Incremental_inputs::Input_info_map): New typedef.
12445         (Incremental_inputs::lock_): New field.
12446         (Incremental_inputs::Inputs_): New field.
12447         (Incremental_inputs::Inputs_map): New field.
12448         * main.cc (main): Call Incremental_input::report_inputs.
12449         * options.h (Input_argument_list): Typedef moved from
12450         Input_arguments.
12451         (Input_file_group::Files): Remove, use ::Input_argument_list.
12452         (Input_file_group::Input_argument_list): Remove, use
12453         ::Input_argument_list.
12454         * plugin.cc (Plugin_manager::add_input_file): Add error in
12455         incremental build.
12456         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
12457         functions.
12458         * script.cc (read_input_script): Call
12459         Incremental_input::report_script.
12460         * script.h (Script_info): New class.
12461
12462 2009-04-27  Ian Lance Taylor  <iant@google.com>
12463
12464         * x86_64.cc (do_adjust_output_section): Set entsize to
12465         plt_entry_size.
12466
12467 2009-04-23  Elliott Hughes  <enh@google.com>
12468
12469         * output.cc (Output_file::close): After short writes, continue
12470         writing from the correct offset in the buffer being written.
12471
12472 2009-04-23  Chris Demetriou  <cgd@google.com>
12473
12474         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
12475         * configure: Regenerate.
12476         * config.in: Regenerate.
12477         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
12478         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
12479
12480 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
12481
12482         * incremental.cc (Incremental_inputs_header_data): Renamed from
12483         Incremental_input_header_data.
12484         (Incremental_inputs_header_data::data_size): New field.
12485         (Incremental_inputs_header_data::put_input_file_count): Renamed
12486         from input_file_count.
12487         (Incremental_inputs_header_data::put_command_line_offset): Renamed
12488         from command_line_offset.
12489         (Incremental_inputs_header_data::put_reserved): Renamed from
12490         put_reserved.
12491         (Incremental_inputs_entry_data): Renamed from
12492         Incremental_input_entry_data.
12493         (Incremental_inputs_entry_data::data_size): New field.
12494         (Incremental_inputs::report_command_line): New method.
12495         (Incremental_inputs::finalize): New method.
12496         (Incremental_inputs::create_incremental_inputs_data): New method.
12497         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
12498         * incremental.h: New file.
12499         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
12500         (Layout::finalize): Create incremental inputs section in
12501         incremental builds.
12502         (Layout::create_incremental_info_sections): New method.
12503         * layout.h (Layout::incremental_inputs): New method.
12504         (Layout::create_incremental_info_sections): New method.
12505         (Layout::incremental_inputs_): New field.
12506         * main.cc (main): Notify Incremental_input of the command line.
12507
12508 2009-04-01  Ian Lance Taylor  <iant@google.com>
12509             Mikolaj Zalewski  <mikolajz@google.com>
12510
12511         * gold.h (reserve_unordered_map): Define, three versions, one for
12512         each version of Unordered_map.
12513         * layout.cc (Layout::Layout): Remove options parameter.  Add
12514         number_of_input_files parameter.  Don't initialize options_.
12515         Initialize number_of_input_files_ and resized_signatures_.  Move
12516         sections_are_attached_.
12517         (Layout::layout_group): Reserve space for group_signatures_.
12518         (Layout::find_or_add_kept_section): Change name parameter to be a
12519         reference.  Resize signatures_ map when it gets large enough.
12520         (Layout::layout_eh_frame): Use parameters->options() instead of
12521         this->options_.
12522         (Layout::make_output_section): Likewise.
12523         (Layout::attach_allocated_section_to_segment): Likewise.
12524         (Layout::finalize, Layout::create_executable_stack): Likewise.
12525         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
12526         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
12527         * layout.h (class Layout): Update declarations.  Remove options_
12528         field.  Add number_of_input_files_ and resized_signatures_
12529         fields.  Move sections_are_attached_ field.
12530         * main.cc (main): Pass number of input files to Layout
12531         constructor.  Don't pass options.
12532
12533 2009-03-30  Ian Lance Taylor  <iant@google.com>
12534
12535         * ffsll.c (ffsll): Correct implementation.
12536
12537 2009-03-27  Ian Lance Taylor  <iant@google.com>
12538
12539         * ffsll.c: New file.
12540         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
12541         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
12542         * ftruncate.c (ftruncate): Declare before definition.
12543         * mremap.c (mremap): Likewise.
12544         * pread.c (pread): Likewise.
12545         * configure, Makefile.in, config.in: Rebuild.
12546
12547         * mremap.c: New file.
12548         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
12549         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
12550         (mremap): Declare if HAVE_MREMAP is not defined.
12551         * configure, Makefile.in, config.in: Rebuild.
12552
12553 2009-03-27  Cary Coutant  <ccoutant@google.com>
12554
12555         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
12556         position independent.
12557         * sparc.cc (Target_sparc::check_non_pic): Likewise.
12558         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
12559
12560 2009-03-24  Cary Coutant  <ccoutant@google.com>
12561
12562         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
12563         an executable.
12564         (needs_dynamic_reloc): Likewise.
12565
12566 2009-03-24  Ian Lance Taylor  <iant@google.com>
12567
12568         * yyscript.y (file_cmd): Recognize EXTERN.
12569         (extern_name_list, extern_name_list_body): New nonterminals.
12570         * script.cc (script_add_extern): Define.
12571         * script-c.h (script_add_extern): Declare.
12572
12573 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
12574
12575         * object.cc (is_elf_object): Define.
12576         * object.h (is_elf_object): Declare.
12577         * archive.cc (Archive::get_elf_object_for_member): Call
12578         is_elf_object.
12579         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
12580
12581 2009-03-24  Elliott Hughes  <enh@google.com>
12582
12583         * output.cc (Output_file::map_anonymous): Define.
12584         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
12585         try an anonymous one.  Report the size if the mmap fails.
12586         * output.h (class Output_file): Declare map_anonymous.
12587
12588 2009-03-24  Ian Lance Taylor  <iant@google.com>
12589
12590         * target-select.cc (instantiate_target): Don't acquire the lock if
12591         the instantiated_target_ field has already been set.
12592
12593 2009-03-23  Ian Lance Taylor  <iant@google.com>
12594
12595         * gold-threads.h (class Initialize_lock): Define.
12596         * gold-threads.cc (class Initialize_lock_once): Define.
12597         (initialize_lock_control): New static variable.
12598         (initialize_lock_pointer): New static variable.
12599         (initialize_lock_once): New static function.
12600         (Initialize_lock::Initialize_lock): Define.
12601         (Initialize_lock::initialize): Define.
12602         * target-select.h: Include "gold-threads.h".
12603         (class Target_selector): Add lock_ and initialize_lock_ fields.
12604         Don't define instantiate_target, just declare it.
12605         * target-select.cc (Target_selector::Target_selector): Initialize
12606         new fields.
12607         (Target_selector::instantiate_target): Define.
12608         * descriptors.h: Include "gold-threads.h".
12609         (class Descriptors): Add initialize_lock_ field.
12610         * descriptors.cc (Descriptors::Descriptors): Initialize new
12611         field.
12612         (Descriptors::open): Use initialize_lock_ field
12613         * errors.h (class Errors): Add initialize_lock_ field.
12614         * errors.cc (Errors::Errors): Initialize new field.
12615         (Errors::initialize_lock): Use initialize_lock_ field.
12616         * powerpc.cc (class Target_selector_powerpc): Remove
12617         instantiated_target_ field.  In do_recognize call
12618         instantiate_target rather than do_instantiate_target.  In
12619         do_instantiate_target just allocate a new target.
12620         * sparc.cc (class Target_selector_sparc): Likewise.
12621
12622         * freebsd.h: New file.
12623         * i386.cc: Include "freebsd.h".
12624         (Target_i386): Derive from Target_freebsd rather than
12625         Sized_target.
12626         (Target_selector_i386): Derive from Target_selector_freebsd rather
12627         than Target_selector.
12628         * x86_64.cc: Include "freebsd.h".
12629         (Target_x86_64): Derive from Target_freebsd rather than
12630         Sized_target.
12631         (Target_selector_x86_64): Derive from Target_selector_freebsd
12632         rather than Target_selector.
12633         * target.h (class Target): Add adjust_elf_header and
12634         do_adjust_elf_header.
12635         * output.cc (Output_file_header:: do_sized_write): Call target
12636         adjust_elf_header routine.
12637         * configure.tgt: Set targ_osabi.
12638         * configure.ac: Define GOLD_DEFAULT_OSABI.
12639         * parameters.cc (Parameters::default_target): Pass
12640         GOLD_DEFAULT_OSABI to select_target.
12641         * target-select.h (class Target_selector): Make instantiate_target
12642         protected rather than private.
12643         * Makefile.am (HFILES): Add freebsd.h.
12644         * configure, Makefile.in, config.in: Rebuild.
12645
12646         * merge.cc (do_add_input_section): Correct pend value.  Change
12647         message about last entry not being null terminated from error to
12648         warning.
12649
12650 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
12651
12652         * incremental.cc: New file.
12653         * Makefile.am (CCFILES): Add incremental.cc.
12654         * Makefile.in: Rebuild.
12655
12656 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
12657
12658         * layout.cc (Layout::output_section_name): Preserve names
12659         of '.note.' sections.
12660
12661 2009-03-19  Ian Lance Taylor  <iant@google.com>
12662
12663         * descriptors.cc (Descriptors::open): Check that the options are
12664         valid before using them.
12665
12666 2009-03-18  Ian Lance Taylor  <iant@google.com>
12667
12668         * script-sections.h: Include <list>.
12669         (class Script_sections): Change Sections_elements from std::vector
12670         to std::list.  Typedef public Elements_iterator.  Add
12671         orphan_section_placement_, data_segment_align_start_, and
12672         saw_data_segment_align_ fields.  Remove data_segment_align_index_
12673         field.
12674         * script-sections.cc (class Orphan_section_placement): New class.
12675         (class Sections_element): Add virtual functions is_relro and
12676         orphan_section_init.  Remove virtual function place_orphan_here.
12677         (class Output_section_definition): Add is_relro and
12678         orphan_section_init.  Remove place_orphan_here.
12679         (class Orphan_output_section): Likewise.
12680         (Script_sections::Script_sections): Update for field changes.
12681         (Script_sections::data_segment_align): Set saw_data_segment_align_
12682         and data_segment_align_start_, not data_segment_align_index.
12683         (Script_sections::data_segment_relro_end): Check
12684         saw_data_segment_align_.  Use data_segment_align_start_ rather
12685         than data_segment_align_index_.
12686         (Script_sections::place_orphan): Rewrite to use
12687         Orphan_section_placement.
12688
12689 2009-03-17  Ian Lance Taylor  <iant@google.com>
12690
12691         * archive.cc (Archive::add_symbols): Check for a version attached
12692         to the symbol name in the archive map.
12693         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
12694         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
12695         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
12696         (ver_test_11.a): New target.
12697         * testsuite/Makefile.in: Rebuild.
12698
12699         * configure.ac: Check for chsize and posix_fallocate.  Replace
12700         ftruncate.
12701         * ftruncate.c: New file, from gnulib.
12702         * output.cc (posix_fallocate): Define dummy version if not
12703         HAVE_POSIX_FALLOCATE.
12704         (Output_file::map): Call posix_fallocate rather than lseek and
12705         write.
12706         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
12707         * configure, Makefile.in, config.in: Rebuild.
12708
12709 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
12710
12711         * layout.h (Layout::create_note): Add section_name parameter.
12712         * layout.cc (Layout::create_note): Likewise.
12713         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
12714
12715 2009-03-17  Ian Lance Taylor  <iant@google.com>
12716
12717         * descriptors.cc: Include "options.h".
12718         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
12719         (Descriptors::open): Always use O_CLOEXEC when opening a new
12720         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
12721         then set FD_CLOEXEC.
12722
12723         * sparc.cc (class Target_sparc): Add has_got_section.
12724         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
12725         make sure we have a GOT section.
12726
12727         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
12728         (Target_sparc::Scan::local): Likewise.
12729         (Target_sparc::Scan::global): Likewise.
12730         (Target_sparc::Relocate::relocate): Likewise.
12731         (Target_sparc::Relocate::relocate_tls): Likewise.
12732
12733         * symtab.cc (Symbol_table::define_default_version): New function,
12734         broken out of add_from_object.
12735         (Symbol_table::add_from_object): Call define_default_version.
12736         (Symbol_table::define_special_symbol): Add resolve_oldsym
12737         parameter.  Change all callers.  If the version for a symbol comes
12738         from a version script, resolve it with the symbol with the same
12739         name with no version.  Also add the symbol without a version if
12740         appropriate.
12741         (do_define_in_output_data): If resolving with oldsym, don't delete
12742         sym.
12743         (do_define_in_output_segment): Likewise.
12744         (do_define_as_constant): Likewise.
12745         * symtab.h (class Symbol_table): Update declarations.
12746
12747 2009-03-13  Ian Lance Taylor  <iant@google.com>
12748
12749         * readsyms.cc (Read_symbols::incompatible_warning): New function.
12750         (Read_symbols::requeue): New function.
12751         (Read_symbols::do_read_symbols): If make_elf_object fails because
12752         the target type is not configured, and the file was searched for,
12753         issue a warning and retry with the next directory.
12754         (Add_symbols::run): If the file has an incompatible format, and
12755         it was searched for, requeue the Read_symbols task.  On error,
12756         release the object.
12757         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
12758         dirindex parameter to constructor.  Change all callers.  Declare
12759         incompatible_warning and requeue.
12760         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
12761         input_argument_ and input_group_ fields.  Add them to
12762         constructor.  Change all callers.
12763         (class Read_script): Add dirindex_ field.  Add it to constructor.
12764         Change all callers.
12765         * archive.cc (Archive::setup): Remove input_objects parameter.
12766         Change all callers.
12767         (Archive::get_file_and_offset): Likewise.
12768         (Archive::read_all_symbols): Likewise.
12769         (Archive::read_symbols): Likewise.
12770         (Archive::get_elf_object_for_member): Remove input_objects
12771         parameter.  Add punconfigured parameter.  Change all callers.
12772         (Archive::add_symbols): Change return type to bool.  Check return
12773         value of include_member.
12774         (Archive::include_all_members): Likewise.
12775         (Archive::include_member): Change return type to bool.  Return
12776         false if first included object has incompatible target.  Set
12777         included_member_ field.
12778         (Add_archive_symbols::run): If add_symbols returns false, requeue
12779         Read_symbols task.
12780         * archive.h (class Archive): Add included_member_ field.
12781         Initialize it in constructor.  Add input_file and searched_for
12782         methods.  Update declarations.
12783         (class Add_archive_symbols): Add dirpath_, dirindex_, and
12784         input_argument_ fields.  Add them to constructor.  Change all
12785         callers.
12786         * script.cc: Include "target-select.h".
12787         (class Parser_closure): Add skip_on_incompatible_target_ and
12788         found_incompatible_target_ fields.  Add
12789         skip_on_incompatible_target parameter to constructor.  Change all
12790         callers.  Add methods skip_on_incompatible_target,
12791         clear_skip_on_incompatible_target, found_incompatible_target, and
12792         set_found_incompatible_target.
12793         (read_input_script): Add dirindex parameter.  Change all callers.
12794         If parser finds an incompatible target, requeue Read_symbols
12795         task.
12796         (script_set_symbol): Clear skip_on_incompatible_target in
12797         closure.
12798         (script_add_assertion, script_parse_option): Likewise.
12799         (script_start_sections, script_add_phdr): Likewise.
12800         (script_check_output_format): New function.
12801         * script.h (read_input_script): Update declaration.
12802         * script-c.h (script_check_output_format): Declare.
12803         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
12804         (ignore_cmd): Remove OUTPUT_FORMAT.
12805         * fileread.cc (Input_file::Input_file): Add explicit this.
12806         (Input_file::will_search_for): New function.
12807         (Input_file::open): Add pindex parameter.  Change all callers.
12808         * fileread.h (class Input_file): Add input_file_argument method.
12809         Declare will_search_for.  Update declarations.
12810         * object.cc (make_elf_object): Add punconfigured parameter.
12811         Change all callers.
12812         * object.h (class Object): Make input_file public.  Add
12813         searched_for method.
12814         (make_elf_object): Update declaration.
12815         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
12816         restart search.
12817         * dirsearch.h (class Dirsearch): Update declaration.
12818         * options.h (class General_options): Add --warn-search-mismatch.
12819         * parameters.cc (Parameters::is_compatible_target): New function.
12820         * parameters.h (class Parameters): Declare is_compatible_target.
12821         * workqueue.cc (Workqueue::add_blocker): New function.
12822         * workqueue.h (class Workqueue): Declare add_blocker.
12823
12824         * fileread.cc (Input_file::open): Remove options parameter.
12825         Change all callers.
12826         (Input_file::open_binary): Likewise.
12827         * script.cc (read_input_script): Likewise.
12828         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
12829         options parameter from constructor.  Change all callers.
12830         (class Read_script): Likewise.
12831         * fileread.h (class Input_file): Update declarations.
12832         * script.h (read_input_script): Update declaration.
12833
12834 2009-03-10  Nick Clifton  <nickc@redhat.com>
12835
12836         * po/es.po: New Spanish translation.
12837
12838 2009-03-06  Cary Coutant  <ccoutant@google.com>
12839
12840         * options.cc (parse_short_option): Keep dash_z from registering itself.
12841
12842 2009-03-03  Ian Lance Taylor  <iant@google.com>
12843
12844         PR 9918
12845         * target-reloc.h (relocate_section): Pass output_section to
12846         relocate.
12847         * i386.cc (Target_i386::should_apply_static_reloc): Add
12848         output_section parameter.  Change all callers.
12849         (Target_i386::Relocate::relocate): Add output_section parameter.
12850         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
12851         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
12852         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
12853         * testsuite/two_file_shared.sh: New script.
12854         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
12855         (check_DATA): Add two_file_shared.dbg.
12856         (two_file_shared.dbg): New target.
12857         * testsuite/Makefile.in: Rebuild.
12858
12859 2009-03-01  Ian Lance Taylor  <iant@google.com>
12860
12861         * configure.ac: Check for byteswap.h.
12862         * configure: Rebuild.
12863         * config.in: Rebuild.
12864
12865 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
12866
12867         * layout.cc (Layout::find_or_add_kept_section): New function.
12868         (Layout::add_comdat): Removed.
12869         * layout.h (struct Kept_section): Move out of class Layout.
12870         Remove trailing underscores from field names.  Add group_sections
12871         field.  Rename group_ field to is_group.  Change all uses.
12872         (class Layout): Declare find_or_add_kept_section, not add_comdat.
12873         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
12874         comdat_groups_ field.
12875         (Sized_relobj::include_section_group): Use
12876         find_or_add_kept_section and Kept_section::group_sections.
12877         (Sized_relobj::include_linkonce_section): Likewise.
12878         * object.cc (class Sized_relobj): Don't define Comdat_group or
12879         Comdat_group_table.  Remove find_comdat_group and
12880         add_comdat_group.  Remove comdat_groups_ field.
12881         * plugin.cc (include_comdat_group): Use
12882         Layout::find_or_add_kept_section.
12883
12884 2009-02-28  Ian Lance Taylor  <iant@google.com>
12885
12886         * README: --gc-sections and map files are now supported.  Document
12887         some build requirements.
12888
12889         PR 6992
12890         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
12891         relocatable link set the value of the section symbol to zero.
12892         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
12893         relocatable link don't include the section address in the local
12894         symbol value.
12895
12896 2009-02-27  Ian Lance Taylor  <iant@google.com>
12897
12898         PR 6811
12899         * options.h (class Search_directory): Add is_system_directory.
12900         (class General_options): Declare is_in_system_directory.
12901         * options.cc (get_relative_sysroot): Make static.
12902         (get_default_sysroot): Make static.
12903         (General_optoins::is_in_system_directory): New function.
12904         * fileread.cc (Input_file::is_in_system_directory): New function.
12905         * fileread.h (class Input_file): Declare is_in_system_directory.
12906         * object.h (class Object): Add is_in_system_directory.
12907         (class Input_objects): Remove system_library_directory_ field.
12908         * object.cc (Input_objects::add_object): Don't set
12909         system_library_directory_.
12910         (input_objects::found_in_system_library_directory): Remove.
12911         * symtab.cc (Symbol_table::write_globals): Remove input_objects
12912         parameter.  Change all callers.
12913         (Symbol_table::sized_write_globals): Likewise.
12914         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
12915         Call Object::is_in_system_directory.
12916         * symtab.h (class Symbol_table): Update declarations.
12917
12918         PR 5990
12919         * descriptors.h (Open_descriptor): Add is_on_stack field.
12920         * descriptors.cc (Descriptors::open): If the descriptor is on the
12921         top of the stack, remove it.  Initialize is_on_stack field.
12922         (Descriptors::release): Only add pod to stack if it is not on the
12923         stack already.
12924         (Descriptors::close_some_descriptor): Clear stack_next and
12925         is_on_stack fields.
12926
12927         PR 7091
12928         * output.cc (Output_section::find_starting_output_address): Rename
12929         from starting_output_address; add PADDR parameter; change return
12930         type.
12931         * output.h (class Output_section): Declare
12932         find_starting_output_address instead of starting_output_address.
12933         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
12934         section symbol for which we can't find a merge section.
12935
12936         PR 9836
12937         * symtab.cc (Symbol_table::add_from_object): If the visibility is
12938         hidden or internal, force the symbol to be local.
12939         * resolve.cc (Symbol::override_visibility): Define.
12940         (Symbol::override_base): Use override_visibility.
12941         (Symbol_table::resolve): Likewise.
12942         (Symbol::override_base_with_special): Likewise.
12943         (Symbol_table::override_with_special): If the visibility is hidden
12944         or internal, force the symbol to be local.
12945         * symtab.h (class Symbol): Add set_visibility and
12946         override_visibility.
12947         * testsuite/ver_test_1.sh: New file.
12948         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
12949         (check_DATA): Add ver_test_1.syms.
12950         (ver_test_1.syms): New target.
12951         * testsuite/Makefile.in: Rebuild.
12952
12953 2009-02-25  Cary Coutant  <ccoutant@google.com>
12954
12955         * layout.cc (Layout::choose_output_section): Don't rename sections
12956         when using a linker script that has a SECTIONS clause.
12957         * Makefile.in: Regenerate.
12958
12959         * testsuite/Makefile.am (script_test_5.sh): New test case.
12960         * testsuite/Makefile.in: Regenerate.
12961         * testsuite/script_test_5.cc: New file.
12962         * testsuite/script_test_5.sh: New file.
12963         * testsuite/script_test_5.t: New file.
12964
12965 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
12966
12967         * archive.cc (Archive::include_member): Update calls to add_symbols.
12968         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
12969         the Layout argument.
12970         * dynobj.h (do_add_symbols): Add the Layout argument.
12971         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
12972         Layout argument.
12973         * object.h (Object::add_symbols): Add the Layout argument.
12974         (Object::do_add_symbols): Add the Layout argument.
12975         (Sized_relobj::do_add_symbols): Add the Layout argument.
12976         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
12977         Unify the two versions.
12978         (Add_plugin_symbols): Remove.
12979         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
12980         (Sized_pluginobj::do_add_symbols): Unify the two versions.
12981         (Add_plugin_symbols): Remove.
12982         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
12983         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
12984         (Add_symbols::run): Make it work with Pulginobj.
12985
12986 2009-02-06  Ian Lance Taylor  <iant@google.com>
12987
12988         * object.cc (Sized_relobj::do_layout): Make info message start
12989         with lower case letter.
12990
12991 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
12992
12993         * binary.cc: Fix file comment.
12994
12995         * options.h (enum Incremental_disposition): Define.
12996         (class General_options): Add new options: --incremental,
12997         --incremental_changed, --incremental_unchanged,
12998         --incremental_unknown.  Add incremental_disposition_ and
12999         implicit_incremental_ fields.
13000         (General_options::incremental_disposition): New function.
13001         (class Position_dependent_options): Add incremental_disposition
13002         option.
13003         (Position_dependent_options::copy_from_options): Set incremental
13004         dispositions.
13005         * options.cc (General_options::parse_incremental_changed): New
13006         function.
13007         (General_options::parse_incremental_unchanged): New function.
13008         (General_options::parse_incremental_unknown): New function.
13009         (General_options::General_options): Initialize new fields
13010         incremental_disposition_ and implicit_incremental_.
13011         (General_options::finalize): Check for uasge of --incremental-*
13012         without --incremental.
13013
13014 2009-02-06  Chris Demetriou  <cgd@google.com>
13015
13016         * gold.h (gold_undefined_symbol): Change to take only a Symbol
13017         pointer and to report location as the file name associated with
13018         the symbol.
13019         (gold_undefined_symbol_at_location): New function to replace the
13020         old gold_undefined_symbol functionality.
13021         * target-reloc.h (relocate_section): Update to use
13022         gold_undefined_symbol_at_location.
13023         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
13024         Call gold_undefined_symbol function rather than gold_error.
13025         * errors.h (Errors::undefined_symbol): Take location as a
13026         string, rather than calculating it from a relocation.
13027         * errors.cc (Errors::fatal): Print "fatal error:" before the
13028         formatted message.
13029         (Errors::error, Errors::error_at_location): Print "error: "
13030         before the formatted message.
13031         (Errors::undefined_symbol): Take location as a string, rather
13032         than calculating it from a relocation.
13033         (gold_undefined_symbol_at_location): New function akin to
13034         old gold_undefined_symbol, calculates location from relocation.
13035         (gold_undefined_symbol): Change to take only a Symbol pointer
13036         and to report location as the file name associated with the symbol.
13037         * testsuite/debug_msg.sh: Update for changed error messages.
13038         * testsuite/undef_symbol.sh: Likewise.
13039
13040 2009-02-04  Duncan Sands  <baldrick@free.fr>
13041
13042         PR 9812
13043         * reduced_debug_output.h
13044         (Output_reduced_debug_abbrev_section::failed): Use format for
13045         gold_warning.
13046         (Output_reduced_debug_info_section::faild): Likewise.
13047
13048 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
13049
13050         * script.cc (Lazy_demangler): New class.
13051         (Version_script_info::get_symbol_version_helper): Demangle a
13052         symbol only once.
13053
13054 2009-01-29  Cary Coutant  <ccoutant@google.com>
13055
13056         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
13057         to __tls_get_addr.
13058         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
13059
13060 2009-01-28  Ian Lance Taylor  <iant@google.com>
13061
13062         * version.cc (version_string): Bump to 1.9.
13063
13064         * gold.h: Include <cstring> and <stdint.h>.
13065         * version.cc: Include <cstdio>.
13066         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
13067         warning.
13068         * reduced_debug_output.cc (insert_into_vector): Rename from
13069         Insert_into_vector; change all callers.  Use Swap_unaligned to
13070         avoid aliasing issue; remove union since it is unnecessary.
13071
13072 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
13073
13074         * Makefile.am (CCFILES): Add gc.cc.
13075         (HFILES): Add gc.h.
13076         * Makefile.in: Regenerate.
13077         * gold.cc (Gc_runner): New class.
13078         (queue_initial_tasks): Call garbage collection related tasks
13079         when corresponding options are invoked.
13080         (queue_middle_gc_tasks): New function.
13081         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
13082         processed early before laying out sections during garbage collection.
13083         * gold.h (queue_middle_gc_tasks): New function.
13084         (is_prefix_of): Move from "layout.cc".
13085         * i386.cc (Target_i386::gc_process_relocs): New function.
13086         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
13087         * main.cc (main): Create object of class "Garbage_collection".
13088         * object.cc (Relobj::copy_symbols_data): New function.
13089         (Relobj::is_section_name_included): New function.
13090         (Sized_relobj::do_layout): Allow this function to be called twice
13091         during garbage collection and defer layout of section during the
13092         first call.
13093         * object.h (Relobj::get_symbols_data): New function.
13094         (Relobj::is_section_name_included): New function.
13095         (Relobj::copy_symbols_data): New function.
13096         (Relobj::set_symbols_data): New function.
13097         (Relobj::get_relocs_data): New function.
13098         (Relobj::set_relocs_data): New function.
13099         (Relobj::is_output_section_offset_invalid): New pure virtual function.
13100         (Relobj::gc_process_relocs): New function.
13101         (Relobj::do_gc_process_relocs): New pure virtual function.
13102         (Relobj::sd_): New data member.
13103         (Sized_relobj::is_output_section_offset_invalid): New function.
13104         (Sized_relobj::do_gc_process_relocs): New function.
13105         * options.h (General_options::gc_sections): Modify to not be a no-op.
13106         (General_options::print_gc_sections): New option.
13107         * plugin.cc (Plugin_finish::run): Remove function call to
13108         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
13109         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
13110         * reloc.cc (Read_relocs::run): Add task to process relocs and
13111         determine unreferenced sections when doing garbage collection.
13112         (Gc_process_relocs): New class.
13113         (Sized_relobj::do_gc_process_relocs): New function.
13114         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
13115         sections that are garbage collected.
13116         * reloc.h (Gc_process_relocs): New class.
13117         * sparc.cc (Target_sparc::gc_process_relocs): New function.
13118         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
13119         symbols whose corresponding sections are garbage collected.
13120         (Symbol_table::Symbol_table): Add new parameter for the garbage
13121         collection object.
13122         (Symbol_table::gc_mark_undef_symbols): New function.
13123         (Symbol_table::gc_mark_symbol_for_shlib): New function.
13124         (Symbol_table::gc_mark_dyn_syms): New function.
13125         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
13126         as garbage.
13127         (Symbol_table::add_from_object): Likewise.
13128         (Symbol_table::add_from_relobj): When building shared objects, do not
13129         treat externally visible symbols as garbage.
13130         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
13131         table information for static and relocatable links.
13132         * symtab.h (Symbol_table::set_gc): New function.
13133         (Symbol_table::gc): New function.
13134         (Symbol_table::gc_mark_undef_symbols): New function.
13135         (Symbol_table::gc_mark_symbol_for_shlib): New function.
13136         (Symbol_table::gc_mark_dyn_syms): New function.
13137         (Symbol_table::gc_): New data member.
13138         * target.h (Sized_target::gc_process_relocs): New pure virtual
13139         function.
13140         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
13141         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
13142
13143 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
13144
13145         * options.h (General_options::gc_sections): Define as a no-op for now.
13146         (General_options::no_keep_memory): Ditto.
13147         (General_options::Bshareable): Define.
13148         * options.cc (General_options::finalize): Honor -Bshareable.
13149
13150 2009-01-20  Andreas Schwab  <schwab@suse.de>
13151
13152         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
13153         read the value in the contents, since we don't use it.  Use the
13154         template endianness when writing.
13155         (Relocate::relocate): Use it for R_PPC_REL16_HA.
13156
13157 2009-01-19  Andreas Schwab  <schwab@suse.de>
13158
13159         * configure.tgt (powerpc64-*): Fix targ_obj.
13160
13161 2009-01-15  Ian Lance Taylor  <iant@google.com>
13162
13163         * object.cc (Sized_relobj::write_local_symbols): Don't write out
13164         local symbols when stripping all symbols.
13165
13166 2009-01-14  Cary Coutant  <ccoutant@google.com>
13167
13168         * output.cc (Output_reloc): Add explicit instantiations.
13169
13170 2009-01-14  Cary Coutant  <ccoutant@google.com>
13171
13172         * archive.cc (Archive::get_elf_object_for_member): Remove call
13173         to File_read::claim_for_plugin.
13174         * descriptors.cc (Descriptors::open): Remove reference to
13175         is_claimed.
13176         (Descriptors::claim_for_plugin): Remove.
13177         * descriptors.h (Descriptors::claim_for_plugin): Remove.
13178         (Descriptors::is_claimed): Remove.
13179         (claim_descriptor_for_plugin): Remove.
13180         * fileread.cc (File_read::claim_for_plugin): Remove.
13181         * fileread.h (File_read::claim_for_plugin): Remove.
13182         (File_read::descriptor): Reopen descriptor if necessary.
13183         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
13184         (Plugin_manager::all_symbols_read): Add task parameter. Change
13185         all callers.
13186         (Plugin_manager::get_input_file): New function.
13187         (Plugin_manager::release_input_file): New function.
13188         (Pluginobj::Pluginobj): Add filesize parameter and initialize
13189         corresponding data member.
13190         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
13191         and pass to base constructor. Change all callers.
13192         (get_input_file, release_input_file): New functions.
13193         (make_sized_plugin_object): Add filesize parameter. Change all callers.
13194         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
13195         (Plugin_manager::all_symbols_read): Add task parameter.
13196         (Plugin_manager::get_input_file): New function.
13197         (Plugin_manager::release_input_file): New function.
13198         (Plugin_manager::task_): New data member.
13199         (Pluginobj::Pluginobj): Add filesize parameter.
13200         (Pluginobj::filename): New function.
13201         (Pluginobj::descriptor): New function.
13202         (Pluginobj::filesize): New function.
13203         (Pluginobj::filesize_): New data member.
13204         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
13205         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
13206         File_read::claim_for_plugin; use Object::unlock to unlock the file.
13207
13208         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
13209         with archive libraries.
13210         * testsuite/Makefile.in: Regenerate.
13211         * testsuite/plugin_test.c (struct sym_info): New type.
13212         (get_input_file, release_input_file): New static variables.
13213         (onload): Capture new transfer vector entries.
13214         (claim_file_hook): Stop reading at end of file according to filesize.
13215         Factor out parsing of readelf output into separate function.
13216         (all_symbols_read_hook): Exercise get_input_file and release_input_file
13217         APIs and get the source file name from the symbol table.  Convert
13218         source file name to corresponding object file name.  Print info
13219         message when adding new input files.
13220         (parse_readelf_line): New function.
13221         * testsuite/plugin_test_1.sh: Add checks for new info messages.
13222         * testsuite/plugin_test_2.sh: Likewise.
13223         * testsuite/plugin_test_3.sh: Likewise.
13224         * testsuite/plugin_test_4.sh: New test case.
13225
13226 2009-01-07  Ian Lance Taylor  <iant@google.com>
13227
13228         * version.cc (version_string): Bump to 1.8.
13229
13230 2008-12-23  Cary Coutant  <ccoutant@google.com>
13231
13232         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
13233         * plugin.cc (Plugin_manager::finish): Rename as
13234         layout_deferred_objects.  Move cleanup to separate function.
13235         (Plugin_manager::cleanup): New function.
13236         (Plugin_finish::run): Call layout_deferred_objects and cleanup
13237         separately.
13238         * plugin.h (Plugin_manager::finish): Rename as
13239         layout_deferred_objects.
13240         (Plugin_manager::cleanup): New function.
13241         (Plugin_manager::cleanup_done): New field.
13242
13243 2008-12-23  Cary Coutant  <ccoutant@google.com>
13244
13245         * plugin.cc (is_visible_from_outside): New function.
13246         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
13247         so we don't return "IR only" status for exported symbols or -r links.
13248
13249         * testsuite/Makefile.am (plugin_test_3): New test case.
13250         * testsuite/Makefile.in: Regenerate.
13251         * testsuite/plugin_test_3.sh: New file.
13252
13253 2008-12-22  Cary Coutant  <ccoutant@google.com>
13254
13255         * object.cc (Sized_relobj::layout_section): New function.
13256         (Sized_relobj::do_layout): Defer layout of input sections until after
13257         plugin has provided replacement files.
13258         (Sized_relobj::do_layout_deferred_sections): New function.
13259         * object.h (Relobj::set_section_offset): Remove virtual keyword.
13260         (Relobj::layout_deferred_sections): New function.
13261         (Relobj::do_layout_deferred_sections): New function.
13262         (Sized_relobj::do_layout_deferred_sections): New function.
13263         (Sized_relobj::layout_section): New function.
13264         (Sized_relobj::Deferred_layout): New structure.
13265         (Sized_relobj::deferred_layout_): New field.
13266         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
13267         Change all callers.  Layout deferred sections.
13268         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
13269         references.
13270         (Plugin_hook::run): Move code from do_plugin_hook inline.
13271         (Plugin_hook::do_plugin_hook): Remove.
13272         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
13273         (Plugin_manager::finish): Renamed, was cleanup.
13274         (Plugin_manager::should_defer_layout): New function.
13275         (Plugin_manager::add_deferred_layout_object): New function.
13276         (Plugin_manager::Deferred_layout_list): New type.
13277         (Plugin_manager::deferred_layout_objects_): New field.
13278         (Plugin_hook::do_plugin_hook): Remove.
13279
13280 2008-12-17  Ian Lance Taylor  <iant@google.com>
13281
13282         * options.h (class General_options): Add --no case for
13283         --export-dynamic.
13284
13285 2008-12-16  Cary Coutant  <ccoutant@google.com>
13286
13287         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
13288         vector.
13289         (Plugin_manager::claim_file): Create plugin object even if
13290         plugin did not call the add_symbols callback.
13291         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
13292         asking for more symbols than were added.
13293         * testsuite/Makefile.am (plugin_test_1): Add test case with
13294         no global symbols.
13295         (empty.syms): New target.
13296         * testsuite/Makefile.in: Regenerate.
13297         * testsuite/plugin_test.c (claim_file_hook): Add new debug
13298         message. Don't call add_symbols if no globals.
13299         (all_symbols_read_hook): Don't provide replacement for empty
13300         claimed file.
13301
13302 2008-12-12  Ian Lance Taylor  <iant@google.com>
13303
13304         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
13305         r_type == 0 for a local symbol with r_sym == 0.
13306         (scan_relocatable_relocs): Pass r_sym to
13307         local_non_section_strategy.
13308         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
13309         r_sym parameter.
13310
13311         * configure.ac: Update test for TLS descriptors: they are
13312         supported as of glibc 2.9.
13313         * configure: Rebuild.
13314
13315 2008-12-11  Ian Lance Taylor  <iant@google.com>
13316
13317         PR 7091
13318         * target-reloc.h (Default_scan_relocatable_relocs): For each
13319         function, map r_type == 0 to RELOC_DISCARD.
13320
13321 2008-12-10  Cary Coutant  <ccoutant@google.com>
13322
13323         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
13324         object to override a kept COMDAT group from a plugin object.
13325
13326 2008-12-09  Ian Lance Taylor  <iant@google.com>
13327
13328         PR 7088
13329         * yyscript.y (file_cmd): Handle INPUT.
13330
13331         * testsuite/initpri1.c: Change all declarations to be full
13332         prototypes by adding void, to avoid compiler warnings.
13333
13334 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
13335
13336         * options.cc (General_options::parse_plugin_opt): New.
13337         (General_options::add_plugin): The argument now is just the filename.
13338         (General_options::add_plugin_option): New.
13339         * options.h (plugin_opt): New.
13340         (add_plugin): Change argument name.
13341         (add_plugin_option): New.
13342         * plugin.cc (Plugin::load): Don't parse the plugin option.
13343         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
13344         (Plugin::add_option): New.
13345         (Plugin::args_): Change type.
13346         (Plugin::filename_): New.
13347         (Plugin_manager::add_plugin_option): New.
13348         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
13349         * testsuite/Makefile.in: Regenerate.
13350
13351 2008-12-05  Cary Coutant  <ccoutant@google.com>
13352
13353         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
13354         Handle --strip-lto-sections option.
13355         * options.h (strip_lto_sections): New option.
13356
13357 2008-12-01  Cary Coutant  <ccoutant@google.com>
13358
13359         * plugin.cc (ld_plugin_message): Change format parameter to const.
13360         Fix mismatch between new[] and delete.
13361
13362 2008-11-14  Cary Coutant  <ccoutant@google.com>
13363
13364         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
13365         instead of -1U.
13366
13367 2008-11-05  Craig Silverstein  <csilvers@google.com>
13368
13369         * options.cc (General_options::parse_dynamic_list): New function.
13370         * options.h (General_options): New flags dynamic_list,
13371         dynamic_list_data, dynamic_list_cpp_new, and
13372         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
13373         (General_options::in_dynamic_list): New function.
13374         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
13375         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
13376         (Lex::can_continue_name): Likewise.
13377         (yylex): Likewise.
13378         (read_script_file): New parameter script_options.
13379         (read_dynamic_list): New function.
13380         (Script_options::define_dynamic_list): New function.
13381         (dynamic_list_keyword_parsecodes): New variable.
13382         (dynamic_list_keywords): New variable.
13383         * script.h (Script_options::define_dynamic_list): New function
13384         prototype.
13385         (read_dynamic_list): New function prototype.
13386         * symtab.cc (strprefix): New macro.
13387         (Symbol::should_add_dynsym_entry): Support dynamic_list,
13388         dynamic_list_data, dynamic_list_cpp_new, and
13389         dynamic_list_cpp_typeinfo.
13390         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
13391         (dynamic_list_expr): New rule.
13392         (dynamic_list_nodes): Likewise.
13393         (dynamic_list_node): Likewise.
13394         * testsuite/Makefile.am (dynamic_list): New test.
13395         * testsuite/Makefile.in: Regenerated.
13396         * testsuite/dynamic_list.t: New file.
13397         * testsuite/dynamic_list.sh: New file.
13398
13399 2008-11-05  Craig Silverstein  <csilvers@google.com>
13400
13401         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
13402         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
13403         (t11_last): Likewise.
13404         * testsuite/ver_test_6.c (main): Likewise.
13405
13406 2008-10-07  Cary Coutant  <ccoutant@google.com>
13407
13408         * options.c (General_options::finalize): Add check for -static and
13409         -shared.
13410         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
13411         is not empty.
13412
13413 2008-10-02  Cary Coutant  <ccoutant@google.com>
13414
13415         * plugin.cc (make_sized_plugin_object): Fix conditional
13416         compilation to work when not all targets are enabled.
13417
13418 2008-09-29  Cary Coutant  <ccoutant@google.com>
13419
13420         * archive.cc (Archive::get_file_and_offset): Use filename instead
13421         of name to get library path.
13422         (Archive::include_member): Unlock external member of a thin archive.
13423
13424         * testsuite/Makefile.am (TEST_AR): New variable.
13425         (thin_archive_test_1): New test.
13426         (thin_archive_test_2): New test.
13427         * testsuite/Makefile.in: Regenerate.
13428         * testsuite/thin_archive_main.cc: New file.
13429         * testsuite/thin_archive_test_1.cc: New file.
13430         * testsuite/thin_archive_test_2.cc: New file.
13431         * testsuite/thin_archive_test_3.cc: New file.
13432         * testsuite/thin_archive_test_4.cc: New file.
13433
13434 2008-09-29  Cary Coutant  <ccoutant@google.com>
13435
13436         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
13437         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
13438         instead of -1U.
13439         (Sized_relobj::do_finalize_local_symbols): Likewise.
13440         (Sized_relobj::map_to_kept_section): Likewise.
13441         * object.h (Sized_relobj::invalid_address): New constant.
13442         (Sized_relobj::do_output_section_offset): Check for invalid_address
13443         and return -1ULL.
13444         * output.cc (Output_reloc::local_section_offset): Use constant
13445         invalid_address instead of -1U.
13446         (Output_reloc::get_address): Likewise.
13447         (Output_section::output_address): Change -1U to -1ULL.
13448         * output.h (Output_reloc::invalid_address): New constant.
13449         * reloc.cc (Sized_relobj::write_sections): Use constant
13450         invalid_address instead of -1U.
13451         (Sized_relobj::relocate_sections): Likewise.
13452         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
13453         values for merge sections.
13454         * target-reloc.h (relocate_for_relocatable): Use constant
13455         invalid_address instead of -1U.
13456
13457 2008-09-19  Cary Coutant  <ccoutant@google.com>
13458
13459         Add plugin functionality for link-time optimization (LTO).
13460         * configure.ac (plugins): Add --enable-plugins option.
13461         * configure: Regenerate.
13462         * config.in: Regenerate.
13463         * Makefile.am (LIBDL): New variable.
13464         (CCFILES): Add plugin.cc.
13465         (HFILES): Add plugin.h.
13466         (ldadd_var): Add LIBDL.
13467         * Makefile.in: Regenerate.
13468
13469         * archive.cc: Include "plugin.h".
13470         (Archive::setup): Don't preread archive symbols when using a plugin.
13471         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
13472         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
13473         files.
13474         (Archive::include_member): Add symbols from plugin objects.
13475         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
13476         * descriptors.cc (Descriptors::open): Check for file descriptors
13477         abandoned by plugins.
13478         (Descriptors::claim_for_plugin): New function.
13479         * descriptors.h (Descriptors::claim_for_plugin): New function.
13480         (Open_descriptor::is_claimed): New field.
13481         (claim_descriptor_for_plugin): New function.
13482         * fileread.cc (File_read::claim_for_plugin): New function.
13483         * fileread.h (File_read::claim_for_plugin): New function.
13484         (File_read::descriptor): New function.
13485         * gold.cc: Include "plugin.h".
13486         (queue_initial_tasks): Add task to call plugin hooks for generating
13487         new object files.
13488         * main.cc: Include "plugin.h".
13489         (main): Load plugin libraries.
13490         * object.h (Pluginobj): Declare.
13491         (Object::pluginobj): New function.
13492         (Object::do_pluginobj): New function.
13493         (Object::set_target): New function.
13494         * options.cc: Include "plugin.h".
13495         (General_options::parse_plugin): New function.
13496         (General_options::General_options): Initialize plugins_ field.
13497         (General_options::add_plugin): New function.
13498         * options.h (Plugin_manager): Declare.
13499         (General_options): Add --plugin option.
13500         (General_options::has_plugins): New function.
13501         (General_options::plugins): New function.
13502         (General_options::add_plugin): New function.
13503         (General_options::plugins_): New field.
13504         * plugin.cc: New file.
13505         * plugin.h: New file.
13506         * readsyms.cc: Include "plugin.h".
13507         (Read_symbols::do_read_symbols): Check for archive before checking
13508         for ELF file.  Call plugin hooks to claim files.
13509         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
13510         from a real object file; force override when processing replacement
13511         files.
13512         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
13513         (Symbol::init_base_object): Likewise.
13514         (Symbol::init_base_output_data): Likewise.
13515         (Symbol::init_base_output_segment): Likewise.
13516         (Symbol::init_base_constant): Likewise.
13517         (Symbol::init_base_undefined): Likewise.
13518         (Symbol::output_section): Assert that object is not a plugin.
13519         (Symbol_table::add_from_pluginobj): New function.
13520         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
13521         undefined.
13522         (Symbol_table::sized_write_globals): Likewise.
13523         (Symbol_table::add_from_pluginobj): Instantiate template.
13524         * symtab.h (Sized_pluginobj): Declare.
13525         (Symbol::in_real_elf): New function.
13526         (Symbol::set_in_real_elf): New function.
13527         (Symbol::in_real_elf_): New field.
13528         (Symbol_table::add_from_pluginobj): New function.
13529
13530         * testsuite/Makefile.am (AM_CFLAGS): New variable.
13531         (LIBDL): New variable.
13532         (LDADD): Add LIBDL.
13533         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
13534         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
13535         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
13536         (MOSTLYCLEANFILES): Likewise.
13537         * testsuite/Makefile.in: Regenerate.
13538         * testsuite/plugin_test.c: New file.
13539         * testsuite/plugin_test_1.sh: New file.
13540         * testsuite/plugin_test_2.sh: New file.
13541
13542 2008-09-16  Ian Lance Taylor  <iant@google.com>
13543
13544         * target-reloc.h (relocate_section): Check whether a symbol is
13545         defined by the ABI before reporting an undefined symbol error.
13546         * target.h (Target::is_defined_by_abi): Make parameter const.
13547         (Target::do_is_defined_by_abi): Likewise.
13548         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
13549         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
13550         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
13551         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
13552         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
13553         * testsuite/Makefile.in: Rebuild.
13554
13555         * fileread.cc (make_view): Add casts to avoid warning.
13556
13557 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
13558
13559         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
13560         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
13561
13562 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
13563
13564         * options.h (General_options::output_is_executable): New.
13565         (General_options::output_is_pie): New.
13566         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
13567         for shared libraries.
13568         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
13569
13570 2008-09-11  Chris Demetriou  <cgd@google.com>
13571
13572         * options.h (origin): New -z option.
13573         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
13574         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
13575         in DT_FLAGS_1.
13576
13577 2008-09-05  Cary Coutant  <ccoutant@google.com>
13578
13579         * fileread.cc (File_read::make_view): Add check for attempt to map
13580         beyond end of file.
13581
13582 2008-09-05  Cary Coutant  <ccoutant@google.com>
13583
13584         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
13585         explicit instantiations.
13586
13587 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
13588
13589         PR gold/6858
13590         * options.cc (General_options::finalize): Allow undefined symbols
13591         in shlibs if linking -shared.
13592
13593         PR gold/6859
13594         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
13595         symbols as not needing a dynsym entry.
13596
13597 2008-08-20  Craig Silverstein  <csilvers@google.com>
13598
13599         * fileread.cc (File_read::open): Do not lock the file unless it
13600         was successfully opened.
13601
13602 2008-08-14  Cary Coutant  <ccoutant@google.com>
13603
13604         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
13605         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
13606         * testsuite/tls_test.cc (struct int128): 128-bit struct
13607         for testing TLS relocs with non-zero addend.
13608         (v12): New TLS variable.
13609         (t12): New test.
13610         (t_last): Add check for v12.
13611         * testsuite/tls_test.h (t12): New function.
13612         * testsuite/tls_test_main.cc (thread_routine): Call new test.
13613
13614 2008-08-13  Ian Lance Taylor  <iant@google.com>
13615
13616         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
13617         set tls_segment_ or relro_segment_.
13618         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
13619         when appropriate.
13620         * output.h (Output_section::clear_is_relro): New function.
13621         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
13622         sections specially even when output_data_ is empty.
13623         (Output_segment::maximum_alignment): When first section is relro,
13624         only force alignment for PT_LOAD segments.
13625         * script.cc (script_data_segment_align): New function.
13626         (script_data_segment_relro_end): New function.
13627         * script-c.h (script_data_segment_align): Declare.
13628         (script_data_segment_relro_end): Declare.
13629         * script-sections.h (class Script_sections): Declare
13630         data_segment_align and data_segment_relro_end.  Add fields
13631         segment_align_index_ and saw_relro_end_.
13632         * script-sections.cc (class Sections_element): Add set_is_relro
13633         virtual function.  Add new bool* parameter to place_orphan_here.
13634         Add get_output_section virtual function.
13635         (class Output_section_definition): Add set_is_relro.  Add new
13636         bool* parameter to place_orphan_here.  Add get_output_section.
13637         Add is_relro_ field.
13638         (Output_section_definition::Output_section_definition): Initialize
13639         evaluated_address_, evaluated_load_address, evaluated_addralign_,
13640         and is_relro_ fields.
13641         (Output_section_definition::place_orphan_here): Add is_relro
13642         parameter.
13643         (Output_section_definition::set_section_addresses): Set relro for
13644         output section.
13645         (Output_section_definition::alternate_constraint): Likewise.
13646         (class Orphan_output_section): Add new bool* parameter to
13647         place_orphan_here.  Add get_output_section.
13648         (Orphan_output_section::place_orphan_here): Add is_relro
13649         parameter.
13650         (Script_sections::Script_sections): Initialize
13651         data_segment_align_index_ and saw_relro_end_.
13652         (Script_sections::data_segment_align): New function.
13653         (Script_sections::data_segment_relro_end): New function.
13654         (Script_sections::place_orphan): Set or clear is_relro.
13655         (Script_sections::set_section_addresses): Force alignment of first
13656         TLS section.
13657         * yyscript.y (exp): Call script_data_segment_align and
13658         script_data_segment_relro_end.
13659         * testsuite/relro_script_test.t: New file.
13660         * testsuite/relro_test.cc (using_script): Declare.
13661         (t1, t2): Test using_script.
13662         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
13663         (relro_script_test_SOURCES): Define.
13664         (relro_script_test_DEPENDENCIES): Define.
13665         (relro_script_test_LDFLAGS): Define.
13666         (relro_script_test_LDADD): Define.
13667         (relro_script_test.so): New target.
13668         * testsuite/Makefile.in: Rebuild.
13669
13670 2008-08-06  Cary Coutant <ccoutant@google.com>
13671
13672         * archive.cc (Archive::total_archives, Archive::total_members)
13673         (Archive::total_members_loaded): New variables.
13674         (Archive::setup): Add parameter.  Add option to preread
13675         archive symbols.
13676         (Archive::read_armap): Add counter.
13677         (Archive::get_file_and_offset): New function.
13678         (Archive::get_elf_object_for_member): New function.
13679         (Archive::read_all_symbols): New function.
13680         (Archive::read_symbols): New function.
13681         (Archive::add_symbols): Add counters.
13682         (Archive::include_all_members): Use armap to find members if it's
13683         already built.
13684         (Archive::include_member): Skip reading symbols if already read.
13685         Factored code into Archive::get_file_and_offset and
13686         Archive::get_elf_object_for_member.  Changed call to
13687         Mapfile::report_include_archive_member.
13688         (Archive::print_stats): New function.
13689         * archive.h: Declare Object and Read_symbols_data classes.
13690         (Archive::Archive): Add initializers for new members.
13691         (Archive::setup): Add parameter.
13692         (Archive::print_stats): New function.
13693         (Archive::total_archives, Archive::total_members)
13694         (Archive::total_members_loaded): New variables.
13695         (Archive::get_file_and_offset): New function.
13696         (Archive::get_elf_object_for_member): New function.
13697         (Archive::read_all_symbols): New function.
13698         (Archive::read_symbols): New function.
13699         (Archive::Archive_member): New class.
13700         (Archive::members_): New member.
13701         (Archive::num_members_): New member.
13702         * main.cc: Include archive.h.
13703         (main): Call Archive::print_stats.
13704         * mapfile.cc (Mapfile::report_include_archive_member): Delete
13705         archive parameter; member_name is now the fully-decorated name.
13706         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
13707         * options.h: (General_options): Add --preread-archive-symbols option.
13708         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
13709         Archive::setup.
13710
13711 2008-08-04  Ian Lance Taylor  <iant@google.com>
13712
13713         * symtab.h (Symbol::use_plt_offset): New function.
13714         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
13715         * powerpc.cc (Relocate::relocate): Likewise.
13716         * sparc.cc (Relocate::relocate): Likewise.
13717         * x86_64.cc (Relocate::relocate): Likewise.
13718         * testsuite/weak_plt.sh: New test.
13719         * testsuite/weak_plt_main.cc: New test.
13720         * testsuite/weak_plt_shared.cc: New test.
13721         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
13722         (check_PROGRAMS): Add weak_plt.
13723         (check_DATA): Add weak_plt_shared.so.
13724         (weak_plt_main_pic.o, weak_plt): New targets.
13725         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
13726         * testsuite/Makefile.in: Rebuild.
13727
13728         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
13729         gcctestdir/ld.
13730         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
13731         * testsuite/Makefile.in: Rebuild.
13732
13733 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
13734
13735         * Makefile.am (POTFILES.in): Set LC_ALL=C.
13736         * Makefile.in: Regenerate.
13737         * po/POTFILES.in: Regenerate.
13738
13739 2008-07-29  Ian Lance Taylor  <iant@google.com>
13740
13741         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
13742         symbols before other symbols.
13743         * testsuite/script_test_2.cc (test_addr): Declare.
13744         (test_addr_alias): Declare.
13745         (main): Check that test_addr and test_addr_alias have the right
13746         values.
13747         * testsuite/script_test_2.t: Define test_addr_alias and
13748         test_addr.
13749
13750 2008-07-24  Ian Lance Taylor  <iant@google.com>
13751
13752         PR 5990
13753         * descriptors.cc: New file.
13754         * descriptors.h: New file.
13755         * gold-threads.h (class Hold_optional_lock): New class.
13756         * fileread.cc: Include "descriptors.h".
13757         (File_read::~File_read): Release descriptor rather than closing
13758         it.
13759         (File_read::open) [file]: Call open_descriptor rather than open.
13760         Set is_descriptor_opened_.
13761         (File_read::open) [memory]: Assert that descriptor is not open.
13762         (File_read::reopen_descriptor): New function.
13763         (File_read::release): Release descriptor.
13764         (File_read::do_read): Make non-const.  Reopen descriptor.
13765         (File_read::read): Make non-const.
13766         (File_read::make_view): Reopen descriptor.
13767         (File_read::do_readv): Likewise.
13768         * fileread.h (class File_read): Add is_descriptor_opened_ field.
13769         Update declarations.
13770         * layout.cc: Include "descriptors.h".
13771         (Layout::create_build_id): Use open_descriptor rather than open.
13772         * output.cc: Include "descriptors.h".
13773         (Output_file::open): Use open_descriptor rather than open.
13774         * archive.cc (Archive::const_iterator): Change Archive to be
13775         non-const.
13776         (Archive::begin, Archive::end): Make non-const.
13777         (Archive::count_members): Likewise.
13778         * archive.h (class Archive): Update declarations.
13779         * object.h (Object::read): Make non-const.
13780         * Makefile.am (CCFILES): Add descriptors.cc.
13781         (HFILES): Add descriptors.h.
13782         * Makefile.in: Rebuild.
13783
13784         PR 6716
13785         * gold.h: Always include <clocale>.  Add Solaris workarounds
13786         following code in binutils/sysdep.h.
13787
13788         PR 6048
13789         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
13790         this->eh_frame_hdr_ is NULL before using it.
13791
13792         * dynobj.cc (Versions::Versions): Update comment.
13793
13794         * dynobj.cc (Versions::Versions): If there is an soname, use it as
13795         the base version name.
13796
13797         * stringpool.cc (Stringpool_template::add_with_length): Set key to
13798         array size plus one.
13799         (Stringpool_template::set_string_offsets): Subtract one from key
13800         before using it as an array index.
13801         (Stringpool_template::get_offset_with_length): Likewise.
13802         (Stringpool_template::write_to_buffer): Likewise.
13803         * stringpool.h (Stringpool_template::get_offset_from_key):
13804         Likewise.
13805
13806 2008-07-23  Ian Lance Taylor  <iant@google.com>
13807
13808         PR 6658
13809         * object.h (Merged_symbol_value::value): Do our best to handle a
13810         negative addend.
13811
13812         PR 6647
13813         * script.cc (Version_script_info::get_versions): Don't add empty
13814         version tag to return value.
13815         (Version_script_info::get_symbol_version_helper): Change return
13816         type to bool.  Add pversion parameter.  Change all callers.
13817         (script_register_vers_node): Don't require a non-NULL tag.
13818         * script.h (class Version_script_info): Update declarations.
13819         (Version_script_info::get_symbol_version): Change return type to
13820         bool.  Add version parameter.  Change all callers.
13821         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
13822         handling.  Handle an empty version from a version script.
13823         (Symbol_table::define_special_symbol): Likewise.
13824         * testsuite/ver_test_10.script: New file.
13825         * testsuite/ver_test_10.sh: New file.
13826         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
13827         (check_DATA): Add ver_test_10.syms.
13828         (ver_test_10.syms, ver_test_10.so): New target.
13829         * testsuite/Makefile.in: Rebuild.
13830
13831 2008-07-23  Simon Baldwin  <simonb@google.com>
13832
13833         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
13834         to zero for undefined symbols from dynamic libraries.
13835
13836 2008-07-23  Ian Lance Taylor  <iant@google.com>
13837
13838         * symtab.cc (Symbol_table::resolve): Remove version parameter.
13839         Change all callers.
13840         * symtab.h (class Symbol_table): Update declaration.
13841         * testsuite/ver_test_9.cc: New file.
13842         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
13843         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
13844         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
13845         (ver_test_9.so, ver_test_9.o): New targets.
13846         * testsuite/Makefile.in: Rebuild.
13847
13848 2008-07-22  Ian Lance Taylor  <iant@google.com>
13849
13850         * options.h (class General_options): Define --check-sections.
13851         * layout.cc (Layout::set_segment_offsets): Handle
13852         --check-sections.
13853
13854         * options.h (class General_options): Define -n/--nmagic and
13855         -N/--omagic.
13856         * options.cc (General_options::finalize): For -n/--nmagic or
13857         -N/--omagic, set -static.
13858         * layout.cc (Layout::attach_allocated_section_to_segment): If
13859         -N/--omagic, don't put read-only and read-write sections in
13860         different segments.
13861         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
13862         finding a read-only segment.
13863         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
13864         don't set the minimum segment alignment to the common page size,
13865         and don't set the file offset to the address modulo the page size.
13866         * script-sections.cc (Script_sections::create_segments): If
13867         -n/--omagic, don't put read-only and read-write sections in
13868         different segments.
13869
13870         * cref.cc: New file.
13871         * cref.h: New file.
13872         * options.h (class General_options): Add --print-symbol-counts.
13873         * main.cc (main): Issue defined symbol report if requested.
13874         * archive.cc (Archive::interpret_header): Make into a const member
13875         function.
13876         (Archive::add_symbols): Call Input_objects::archive_start and
13877         archive_stop.
13878         (Archive::const_iterator): Define new class.
13879         (Archive::begin, Archive::end): New functions.
13880         (Archive::include_all_members): Rewrite to use iterator.
13881         (Archive::count_members): New function.
13882         * archive.h (class Archive): Update declarations.
13883         (Archive::filename): New function.
13884         * object.cc: Include "cref.h".
13885         (Sized_relobj::Sized_relobj): Initialize defined_count_.
13886         (Sized_relobj::do_get_global_symbol_counts): New function.
13887         (Input_objects::add_object): Add object to cross-referencer.
13888         (Input_objects::archive_start): New function.
13889         (Input_objects::archive_stop): New function.
13890         (Input_objects::print_symbol_counts): New function.
13891         * object.h: Declare Cref and Archive.
13892         (Object::get_global_symbol_counts): New function.
13893         (Object::do_get_global_symbol_counts): New pure virtual function.
13894         (class Sized_relobj): Add defined_count_ field.  Update
13895         declarations.
13896         (class Input_objects): Add cref_ field.  Update constructor.
13897         Update declarations.
13898         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
13899         defined_count_.
13900         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
13901         symbol counts.
13902         (Sized_dynobj::do_get_global_symbol_counts): New function.
13903         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
13904         defined_count_.  Update declarations.  Define Symbols typedef.
13905         * symtab.cc (Symbol_table::add_from_relobj): Add defined
13906         parameter.  Change all callers.
13907         (Symbol_table::add_from_dynobj): Add sympointers and defined
13908         parameters.  Change all callers.
13909         * symtab.h (class Symbol_table): Update declarations.
13910         * Makefile.am (CCFILES): Add cref.cc.
13911         (HFILES): Add cref.h.
13912         * Makefile.in: Rebuild.
13913
13914 2008-07-22  Simon Baldwin  <simonb@google.com>
13915
13916         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
13917         to zero when writing undefined symbols.
13918
13919 2008-07-22  Ian Lance Taylor  <iant@google.com>
13920
13921         * output.cc (Output_section::add_input_section): Don't try to
13922         merge empty merge sections.
13923
13924 2008-07-21  Craig Silverstein  <csilvers@google.com>
13925
13926         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
13927         Include symbol version in error message.
13928
13929 2008-07-20  Chris Demetriou  <cgd@google.com>
13930
13931         * configure.ac (gold_cv_c_random_seed): New configured variable.
13932         (RANDOM_SEED_CFLAGS): New substituted variable.
13933         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
13934         * configure: Rebuild.
13935         * Makefile.in: Likewise.
13936         * testsuite/Makefile.in: Likewise.
13937
13938 2008-07-18  Ian Lance Taylor  <iant@google.com>
13939
13940         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
13941         where we see NAME/NULL and NAME/VERSION  as separate symbols.
13942         * testsuite/ver_test_main.cc (main): Call t4.
13943         (t4, t4_2a): Define.
13944         * testsuite/ver_test_2.cc (t4_2): Define.
13945         * testsuite/ver_test_2.script: Put t4_2a in VER2.
13946         * testsuite/ver_test_4.cc (t4_2a): Define.
13947         * testsuite/ver_test_4.script: Put t4_2a in VER2.
13948         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
13949
13950 2008-07-17  Ian Lance Taylor  <iant@google.com>
13951
13952         * dynobj.cc (Versions::add_def): If we give an error about a
13953         missing version, go ahead and create the version anyhow.
13954
13955 2008-07-10  Ian Lance Taylor  <iant@google.com>
13956
13957         Handle output sections with more than 0x7fffffff bytes.
13958         * object.h (class Relobj): Change map_to_output_ to
13959         output_sections_, and just keep a section pointer.  Change all
13960         uses.  Move comdat group support to Sized_relobj.
13961         (Relobj::is_section_specially_mapped): Remove.
13962         (Relobj::output_section): Remove poff parameter.  Change all
13963         callers.
13964         (Relobj::output_section_offset): New function.
13965         (Relobj::set_section_offset): Rewrite.
13966         (Relobj::map_to_output): Remove.
13967         (Relobj::output_sections): New function.
13968         (Relobj::do_output_section_offset): New pure virtual function.
13969         (Relobj::do_set_section_offset): Likewise.
13970         (class Sized_relobj): Add section_offsets_ field.  Add comdat
13971         group support from Relobj.  Update declarations.
13972         (Sized_relobj::get_output_section_offset): New function.
13973         (Sized_relobj::do_output_section_offset): New function.
13974         (Sized_relobj::do_set_section_offset): New function.
13975         * object.cc (Relobj::output_section_address): Remove.
13976         (Sized_relobj::Sized_relobj): Initialize new fields.
13977         (Sized_relobj::include_section_group): Cast find_kept_object to
13978         Sized_relobj.
13979         (Sized_relobj::include_linkonce_section): Likewise.
13980         (Sized_relobj::do_layout): Use separate arrays for output section
13981         and output offset.
13982         (Sized_relobj::do_count_local_symbols): Change map_to_output to
13983         output_sections.
13984         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
13985         output_sections and section_offsets.
13986         (Sized_relobj::write_local_symbols): Likewise.
13987         (map_to_kept_section): Compute output address directly.
13988         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
13989         output_sections and section_offsets.
13990         (Sized_relobj::write_sections): Likewise.
13991         (Sized_relobj::relocate_sections): Likewise.
13992         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
13993         * output.h (class Output_reloc): Update declarations.  Change
13994         u2_.relobj to Sized_relobj*.
13995         (class Output_data_reloc): Change add functions to use
13996         Sized_relobj*.
13997         * output.cc (Output_reloc::Output_reloc): Change relobj to
13998         Sized_relobj*.
13999         (Output_reloc::local_section_offset): Change return type to
14000         Elf_Addr.  Use get_output_section_offset.
14001         (Output_reloc::get_address): Likewise.
14002         (Output_section::is_input_address_mapped): Don't call
14003         is_section_specially_mapped.
14004         (Output_section::output_offset): Likewise.
14005         (Output_section::output_address): Likewise.
14006         (Output_section::starting_output_address): Likewise.
14007         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
14008         parameter to Sized_relobj*.
14009         (Copy_relocs::need_copy_reloc): Likewise.
14010         (Copy_relocs::save): Likewise.
14011         * copy-relocs.h (class Copy_relocs): Update declarations.
14012         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
14013         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
14014         * target-reloc.h (relocate_for_relocatable): Change
14015         offset_in_output_section type to Elf_Addr.  Change code that uses
14016         it as well.
14017         * layout.cc (Layout::layout): Always set *off.
14018         * mapfile.cc (Mapfile::print_input_section): Use
14019         output_section_offset.
14020         * i386.cc (Target_i386::copy_reloc): Change object parameter to
14021         Sized_relobj*.
14022         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
14023         * sparc.cc (Target_sparc::copy_reloc): Likewise.
14024         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
14025
14026 2008-07-03  Ian Lance Taylor  <iant@google.com>
14027
14028         * layout.cc (Layout::include_section): Do not discard unrecognized
14029         SHT_STRTAB sections.
14030
14031 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
14032
14033         * script.cc (Lex::can_continue_name): Make '?' allowable in
14034         version-script names.
14035         * testsuite/version_script.map: Change glob pattern to use '?'
14036
14037 2008-06-30  Manish Singh  <yosh@gimp.org>
14038
14039         PR 6585
14040         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
14041         Correct typo.
14042
14043 2008-06-30  Ian Lance Taylor  <iant@google.com>
14044
14045         PR 6660
14046         PR 6682
14047         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
14048         versions]: Don't try to read the value in the contents, since we
14049         don't use it.  Use the template endianness when writing.
14050
14051 2008-06-25  Cary Coutant  <ccoutant@google.com>
14052
14053         * fileread.cc (File_read::make_view): Assert on zero-length view.
14054         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
14055         symbol table when there are no symbols to read.
14056
14057 2008-06-23  Craig Silverstein  <csilvers@google.com>
14058
14059         * version.cc (version_string): Bump to 1.7
14060
14061 2008-06-18  Craig Silverstein  <csilvers@google.com>
14062
14063         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
14064         constant 0xFFFF to type Valtype.
14065         (Powerpc_relocate_functions::rel16_ha): Likewise.
14066
14067 2008-06-17  Ian Lance Taylor  <iant@google.com>
14068
14069         * output.h (Output_section::Input_section): Initialize p2align_ to
14070         zero for Output_section_data constructors.
14071         (Output_section::Input_section::addralign): If not an input
14072         section, return the alignment of the Output_section_data.
14073         * testsuite/copy_test.cc: New file.
14074         * testsuite/copy_test_1.cc: New file.
14075         * testsuite/copy_test_2.cc: New file.
14076         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
14077         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
14078         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
14079         (copy_test_1_pic.o, copy_test_1.so): New targets.
14080         (copy_test_2_pic.o, copy_test_2.so): New targets.
14081         * testsuite/Makefile.in: Rebuild.
14082
14083         * script-sections.cc (Script_sections::place_orphan): Initialize
14084         local variable exact.
14085
14086 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
14087
14088         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
14089
14090 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
14091             David S. Miller  <davem@davemloft.net>
14092
14093         * powerpc.cc: New file.
14094         * Makefile.am (TARGETSOURCES): Add powerpc.cc
14095         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
14096         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
14097         * Makefile.in: Rebuild.
14098
14099 2008-06-09  Ian Lance Taylor  <iant@google.com>
14100
14101         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
14102         <exception>.
14103         (throwing, orig_terminate): New static variables.
14104         (terminate_handler): New static function.
14105         (t2): Set terminate handler.
14106
14107 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
14108
14109         PR 6584
14110         * binary.cc (Binary_to_elf::sized_convert): Fix .data
14111         alignment.
14112
14113 2008-05-30  Cary Coutant  <ccoutant@google.com>
14114
14115         * archive.cc (Archive::include_all_members) Correct to step
14116         over symbol table and extended name table in thin archives.
14117
14118 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
14119
14120         PR 6407
14121         * target-reloc.h (relocate_for_relocatable): Fix new_offset
14122         calculation.
14123
14124 2008-05-28  Caleb Howe  <cshowe@google.com>
14125
14126         * reduced_debug_output.cc: New file.
14127         * reduced_debug_output.h: New file.
14128         * options.h (class General_options): Add --strip-debug-non-line.
14129         * options.cc (General_options::finalize): Add strip_debug_non_line
14130         to the strip heirarchy.
14131         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
14132         fields.
14133         * layout.cc: Include "reduced_debug_output.h".
14134         (Layout::Layout): Initialize new fields.
14135         (line_only_debug_sections): New static array.
14136         (is_lines_only_debug_sections): New static inline function.
14137         (Layout::include_section): Handle --strip-debug-non-line.
14138         (Layout::make_output_section): If --strip-debug-non-line, build
14139         new output sections for .debug_abbrev and .debug_info.
14140         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
14141         gold.  Warn about possible overflow.
14142         (read_signed_LEB_128): Likewise.
14143         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
14144         (read_signed_LEB_128): Declare.
14145         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
14146         (HFILES): Add reduced_debug_output.h.
14147         * Makefile.in: Rebuild.
14148
14149 2008-05-21  Ian Lance Taylor  <iant@google.com>
14150
14151         * mapfile.cc: New file.
14152         * mapfile.h: New file.
14153         * options.h (class General_options): Add -M/--print-map and -Map.
14154         * options.cc (General_options::finalize): Make -M equivalent to
14155         -Map -.
14156         * main.cc: Include <cstdio> and "mapfile.h".
14157         (main): Open mapfile if requested.
14158         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
14159         constructor.  Change caller.
14160         (queue_initial_tasks): Add mapfile parameter.  Change caller.
14161         (queue_middle_tasks): Likewise.
14162         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
14163         declarations.
14164         * archive.cc: Include "mapfile.h".
14165         (Archive::add_symbols): Add mapfile parameter.  Change all
14166         callers.  Pass mapfile, symbol, and reason to include_member.
14167         (Archive::include_all_members): Add mapfile parameter.  Change all
14168         callers.
14169         (Archive::include_member): Add mapfile, sym, and why parameters.
14170         Change all callers.  Report inclusion to map file.
14171         * archive.h: Include "fileread.h".
14172         (class Archive): Update declarations.
14173         (Archive::file): New const method.
14174         (class Add_archive_symbols): Add mapfile_ field.  Update
14175         constructor.  Change all callers.
14176         * readsyms.h (class Read_symbols): Likewise.
14177         (class Finish_group): Likewise.
14178         (class Read_script): Likewise.
14179         * common.cc: Include "mapfile.h".
14180         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
14181         all callers.
14182         (Symbol_table::do_allocate_commons): Likewise.
14183         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
14184         symbol allocation to mapfile.
14185         * common.h (class Allocate_commons_task): Add mapfile_ field.
14186         Update constructor.  Change all callers.
14187         * symtab.h (class Symbol_table): Update declarations.
14188         * layout.cc: Include "mapfile.h".
14189         (Layout_task_runner::run): Print information to mapfile.
14190         (Layout::create_gold_note): Change Output_data_fixed_space to
14191         Output_data_zero_fill.
14192         (Layout::create_build_id): Likewise.
14193         (Layout::print_to_mapfile): New function.
14194         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
14195         constructor.  Change caller.
14196         (class Layout): Declare print_to_mapfile.
14197         * output.cc (Output_section::Input_section::print_to_mapfile): New
14198         function.
14199         (Output_section::add_input_section): If producing a map, always
14200         add to input_sections_ list.
14201         (Output_section::do_print_to_mapfile): New function.
14202         (Output_segment::print_sections_to_mapfile): New function.
14203         (Output_segment::print_section_list_to_mapfile): New function.
14204         * output.h: Include "mapfile.h".
14205         (Output_data::print_to_mapfile): New function.
14206         (Output_data::do_print_to_mapfile): New virtual function.
14207         (Output_segment_headers::do_print_to_mapfile): New function.
14208         (Output_file_header::do_print_to_mapfile): New function.
14209         (Output_data_const::do_print_to_mapfile): New function.
14210         (class Output_data_const_buffer): Add map_name_ field.  Update
14211         constructor.  Change all callers.  Add do_print_to_mapfile
14212         function.
14213         (class Output_data_fixed_space): Likewise.
14214         (class Output_data_space): Likewise.
14215         (class Output_data_zero_fill): New class.
14216         (Output_data_strtab::do_print_to_mapfile): New function.
14217         (Output_data_reloc_base::do_print_to_mapfile): New function.
14218         (Output_relocatable_relocs::do_print_to_mapfile): New function.
14219         (Output_data_group::do_print_to_mapfile): New function.
14220         (Output_data_got::do_print_to_mapfile): New function.
14221         (Output_data_dynamic::do_print_to_mapfile): New function.
14222         (Output_symtab_xindex::do_print_to_mapfile): New function.
14223         (class Output_section): Declare do_print_to_mapflie.  Declare
14224         print_to_mapfile in Input_section.
14225         (class Output_segment): Declare new functions.
14226         * object.h (Sized_relobj::symbol_count): New function.
14227         * script-sections.cc
14228         (Output_section_element_dot_assignment::set_section_addresses):
14229         Change Output_data_fixed_space to Output_data_zero_fill.
14230         (Output_data_expression::do_print_to_mapfile): New function.
14231         * script.cc (read_input_script): Add mapfile parameter.  Change
14232         all callers.
14233         * script.h (read_input_script): Update declaration.
14234         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
14235         (Eh_frame::do_print_to_mapfile): New function.
14236         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
14237         (Output_merge_string::do_print_to_mapfile): New function.
14238         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
14239         function.
14240         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
14241         function.
14242         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
14243         function.
14244         * Makefile.am (CCFILES): Add mapfile.cc.
14245         (HFILES): Add mapfile.h.
14246         * Makefile.in: Rebuild.
14247
14248 2008-05-19  Ian Lance Taylor  <iant@google.com>
14249
14250         * options.h (class General_options): Add -z relro.
14251         * layout.cc (Layout::Layout): Initialize relro_segment_.
14252         (Layout::add_output_section_data): Return the output section.
14253         (Layout::make_output_section): Rcognize relro sections and mark
14254         them appropriately.
14255         (Layout::attach_allocated_section_to_segment): Put relro sections
14256         in a PT_GNU_RELRO segment.
14257         (Layout::create_initial_dynamic_sections): Mark the .dynamic
14258         section as relro.
14259         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
14260         PT_TLS segments.
14261         (Layout::linkonce_mapping): Map d.rel.ro.local to
14262         .data.rel.ro.local.
14263         (Layout::output_section_name): Us .data.rel.ro.local for any
14264         section which begins with that.
14265         * layout.h (class Layout): Update add_output_section_data
14266         declaration.  Add relro_segment_ field.
14267         * output.cc (Output_section::Output_section): Initialize is_relro_
14268         and is_relro_local_ fields.
14269         (Output_segment::add_output_section): Group relro sections.
14270         (Output_segment::is_first_section_relro): New function.
14271         (Output_segment::maximum_alignment): If there is a relro section,
14272         align the segment to the common page size.
14273         (Output_segment::set_section_addresses): Track whether we are
14274         looking at relro sections.  If the last section is a relro
14275         section, align to the common page size.
14276         (Output_segment::set_section_list_addresses): Add in_relro
14277         parameter.  Change all callers.  Align to the page size when
14278         moving from relro to non-relro section.
14279         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
14280         segment.
14281         * output.h (class Output_section): Add is_relro_ and
14282         is_relro_local_ fields.
14283         (Output_section::is_relro): New function.
14284         (Output_section::set_is_relro): New function.
14285         (Output_section::is_relro_local): New function.
14286         (Output_section::set_is_relro_local): New function.
14287         (class Output_segment): Update declarations.
14288         * i386.cc (Target_i386::got_section): Mark .got section as relro.
14289         * sparc.cc (Target_sparc::got_section): Likewise.
14290         * x86_64.cc (Target_x86_64::got_section): Likewise.
14291         * testsuite/relro_test_main.cc: New file.
14292         * testsuite/relro_test.cc: New file.
14293         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
14294         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
14295         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
14296         (relro_test.so, relro_test_pic.o): New targets.
14297         * testsuite/Makefile.in: Rebuild.
14298
14299 2008-05-16  Ian Lance Taylor  <iant@google.com>
14300
14301         * output.cc (Output_segment::add_output_section): Remove front
14302         parameter.
14303         * output.h (class Output_segment): Remove
14304         add_initial_output_section and overloaded add_output_section.
14305         Update declaration of remaining add_output_section.
14306         * layout.cc (Layout::create_interp): Call add_output_section
14307         rather than add_initial_output_section.
14308         (Layout::finish_dynamic_section): Likewise.
14309
14310         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
14311         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
14312         know the dynamic type.
14313         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
14314         field.  Initialize it in constructor.
14315         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
14316         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
14317         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
14318         reloc.
14319
14320         * output.cc (Output_reloc::get_address): Change return type to
14321         Elf_Addr.
14322         * output.h (class Output_reloc): Update get_address declaration.
14323         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
14324         for section addresses.
14325
14326 2008-05-09  Ian Lance Taylor  <iant@google.com>
14327
14328         PR 6493
14329         * gold.cc (gold_nomem): Use return value of write.
14330
14331 2008-05-08  Ian Lance Taylor  <iant@google.com>
14332
14333         * symtab.c (Symbol::init_base_output_data): Add version
14334         parameter.  Change all callers.
14335         (Symbol::init_base_output_segment): Likewise.
14336         (Symbol::init_base_constant): Likewise.
14337         (Symbol::init_base_undefined): Likewise.
14338         (Sized_symbol::init_output_data): Likewise.
14339         (Sized_symbol::init_output_segment): Likewise.
14340         (Sized_symbol::init_constant): Likewise.
14341         (Sized_symbol::init_undefined): Likewise.
14342         (Symbol_table::do_define_in_output_data): If the new symbol has a
14343         version, mark it as the default.
14344         (Symbol_table::do_define_in_output_segment): Likewise.
14345         (Symbol_table::do_define_as_constant): Likewise.
14346         * symtab.h (class Symbol): Update declarations.
14347         (class Sized_symbol): Likewise.
14348         * resolve.cc (Symbol::override_version): New function.
14349         (Symbol::override_base): Call override_version.
14350         (Symbol::override_base_with_special): Likewise.
14351         * testsuite/ver_script_8.script: New file.
14352         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
14353         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
14354         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
14355         (ver_test_8_1.so, ver_test_8_2.so): New targets.
14356
14357 2008-05-06  Ian Lance Taylor  <iant@google.com>
14358
14359         PR 6049
14360         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
14361         functions.
14362         (class General_options): Remove existing --undefined, and add
14363         --no-undefined instead.  Add new --undefined as synonym for -u.
14364         * archive.cc (Archive::add_symbols): Check whether symbol was
14365         named with -u.
14366         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
14367         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
14368         all uses.  Add IS_UNDEFINED.  Update declarations to split
14369         different versions of init_base.  Declare init_base_undefined.
14370         (Symbol::is_defined): Handle IS_UNDEFINED.
14371         (Symbol::is_undefined): Likewise.
14372         (Symbol::is_weak_undefined): Call is_undefined.
14373         (Symbol::is_absolute): Handle IS_CONSTANT.
14374         (class Sized_symbol): Update declarations to split different
14375         versions of init.  Declare init_undefined.
14376         (class Symbol_table): Declare new functions.
14377         * symtab.cc (Symbol::init_base_object): Rename from init_base.
14378         Change all callers.
14379         (Symbol::init_base_output_data): Likewise.
14380         (Symbol::init_base_output_segment): Likewise.
14381         (Symbol::init_base_constant): Likewise.
14382         (Symbol::init_base_undefined): New function.
14383         (Sized_symbol::init_object): Rename from init.  Change all
14384         callers.
14385         (Sized_symbol::init_output_data): Likewise.
14386         (Sized_symbol::init_output_segment): Likewise.
14387         (Sized_symbol::init_constant): Likewise.
14388         (Sized_symbol::init_undefined): New function.
14389         (Symbol_table::add_undefined_symbols_from_command_line): New
14390         function.
14391         (Symbol_table::do_add_undefined_symbols_from_command_line): New
14392         function.
14393         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
14394         (Symbol::output_section): Likewise.
14395         (Symbol::set_output_section): Likewise.
14396         (Symbol_table::sized_finalize_symbol): Likewise.
14397         (Symbol_table::sized_write_globals): Likewise.
14398         * resolve.cc (Symbol_table::should_override): Likewise.
14399         (Symbol::override_base_with_special): Likewise.
14400
14401         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
14402         symbol, change it to have default visibility.
14403         * testsuite/protected_1.cc: New file.
14404         * testsuite/protected_2.cc: New file.
14405         * testsuite/protected_3.cc: New file.
14406         * testsuite/protected_main_1.cc: New file.
14407         * testsuite/protected_main_2.cc: New file.
14408         * testsuite/protected_main_3.cc: New file.
14409         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
14410         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
14411         (protected_1_LDFLAGS, protected_1_LDADD): Define.
14412         (protected_1.so): New target.
14413         (protected_1_pic.o, protected_2_pic.o): New targets.
14414         (protected_3_pic.o): New target.
14415         (check_PROGRAMS): Add protected_2.
14416         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
14417         (protected_2_LDFLAGS, protected_2_LDADD): Define.
14418         * testsuite/Makefile.in: Rebuild.
14419
14420         * options.h (DEFINE_var): Add set_user_set_##varname__.
14421         (DEFINE_bool_alias): New macro.
14422         (class General_options): Define -Bstatic using DEFINE_bool_alias
14423         rather than DEFINE_special.  Add --undefined as an alias for -z
14424         defs.
14425         * options.cc (General_options::parse_Bstatic): Remove.
14426
14427         * options.h (class General_options): Add --fatal-warnings.
14428         * main.cc (main): Implement --fatal-warnings.
14429         * errors.h (Errors::warning_count): New function.
14430
14431         * options.h (class General_options): Add -Bsymbolic-functions.
14432         * symtab.h (Symbol::is_preemptible): Check for
14433         -Bsymbolic-functions.
14434
14435 2008-05-05  Ian Lance Taylor  <iant@google.com>
14436
14437         * options.h (DEFINE_bool): For DASH_Z, create the negative option
14438         as noVARNAME rather than no-VARNAME.
14439         (class General_options): Add option -z combreloc.
14440         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
14441         get_address.
14442         (Output_reloc::sort_before) [SHT_REL]: New function.
14443         (Output_reloc::sort_before) [SHT_RELA]: New function.
14444         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
14445         Sort_relocs_comparison.
14446         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
14447         parameter.  Change all callers.
14448         (Output_data_reloc::Output_data_reloc) [both versions]: Add
14449         sort_relocs parameter.  Change all callers.
14450         * output.cc (Output_reloc::get_address): New function, broken out
14451         of write_rel.
14452         (Output_reloc::write_rel): Call it.
14453         (Output_reloc::compare): New function.
14454         (Output_data_reloc_base::do_write): Optionally sort relocs.
14455
14456         * configure.ac: If targ_extra_obj is set, link it in.
14457         * configure.tgt: Initialize all variables.
14458         (x86_64*): Set targ_extra_obj and targ_extra_size.
14459         * configure: Rebuild.
14460
14461         * object.cc (Sized_relobj::include_section_group): Adjust section
14462         indexes read from group data.  Build vector to pass to
14463         layout_group.
14464         * layout.cc (Layout::layout_group): Add flags and shndxes
14465         parameters.  Remove contents parameter.  Change caller.  Update
14466         explicit instantiations.
14467         * layout.h (class Layout): Update layout_group declaration.
14468         * output.cc (Output_data_group::Output_data_group): Add flags and
14469         input_shndxes parameters.  Remove contents parameter.  Change
14470         caller.
14471         (Output_data_group::do_write): Change input_sections_ to
14472         input_shndxes_.
14473         * output.h (class Output_data_group): Update constructor
14474         declaration.  Rename input_sections_ to input_shndxes_.
14475         * testsuite/many_sections_test.cc: Add template.
14476
14477 2008-04-30  Cary Coutant  <ccoutant@google.com>
14478
14479         * target-reloc.h (relocate_section): Fix dead-pointer bug.
14480
14481         * layout.cc (Layout::include_section): Refactored check for debug
14482         info section.
14483         (Layout::add_comdat): Add new parameters.  Change type
14484         of signature parameter.  Add object and shndx to signatures table.
14485         (Layout::find_kept_object): New function.
14486         * layout.h: Include <cstring>.
14487         (Layout::is_debug_info_section): New function.
14488         (Layout::add_comdat): Add new parameters.
14489         (Layout::find_kept_object): New function.
14490         (Layout::Kept_section): New struct.
14491         (Layout::Signatures): Change type of map range.
14492         * object.cc (Relobj::output_section_address): New function.
14493         (Sized_relobj::include_section_group): Add new parameters.  Change
14494         calls to Layout::add_comdat.  Change to build table of kept comdat
14495         groups and table mapping discarded sections to kept sections.
14496         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
14497         (Sized_relobj::do_layout): Change calls to include_section_group and
14498         include_linkonce_section.
14499         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
14500         value to zero when section is discarded.
14501         (Sized_relobj::map_to_kept_section): New function.
14502         * object.h (Relobj::output_section_address): New function.
14503         (Relobj::Comdat_group): New type.
14504         (Relobj::find_comdat_group): New function.
14505         (Relobj::Comdat_group_table): New type.
14506         (Relobj::Kept_comdat_section): New type.
14507         (Relobj::Kept_comdat_section_table): New type.
14508         (Relobj::add_comdat_group): New function.
14509         (Relobj::set_kept_comdat_section): New function.
14510         (Relobj::get_kept_comdat_section): New function.
14511         (Relobj::comdat_groups_): New field.
14512         (Relobj::kept_comdat_sections_): New field.
14513         (Symbol_value::input_value): Update comment.
14514         (Sized_relobj::map_to_kept_section) New function.
14515         (Sized_relobj::include_linkonce_section): Add new parameter.
14516         * target-reloc.h (Comdat_behavior): New type.
14517         (get_comdat_behavior): New function.
14518         (relocate_section): Add code to map a discarded section to the
14519         corresponding kept section when applying a relocation.
14520
14521 2008-04-30  Craig Silverstein  <csilvers@google.com>
14522
14523         * dwarf_reader.cc (next_generation_count): New static var.
14524         (Addr2line_cache_entry): New struct.
14525         (addr2line_cache): New static var.
14526         (Dwarf_line_info::one_addr2line): Added caching.
14527         (Dwarf_line_info::clear_addr2line_cache): New function.
14528         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
14529         cache-size parameter.
14530         (Dwarf_line_info::one_addr2line_cache): New function.
14531         * symtab.cc (Symbol_table::detect_odr_violations): Pass
14532         new cache-size argument to one_addr2line(), and clear cache.
14533
14534 2008-04-28  Cary Coutant  <ccoutant@google.com>
14535
14536         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
14537         R_386_PC8 relocations.
14538
14539 2008-04-23  Ian Lance Taylor  <iant@google.com>
14540
14541         * object.cc (Sized_relobj::include_section_group): Check for
14542         invalid section group.
14543
14544         * object.cc (make_elf_object): Correct test for 64-bit ELF file
14545         header size.
14546
14547         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
14548         than read for file header.
14549         * archive.cc (Archive::include_member): Likewise.
14550
14551 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
14552
14553         * aclocal.m4: Regenerate.
14554         * configure: Regenerate.
14555
14556 2008-04-19  Ian Lance Taylor  <iant@google.com>
14557
14558         * version.cc (version_string): Bump to 1.6.
14559
14560         * testsuite/Makefile.am (many_sections_r_test): New target.
14561         (many_sections_r_test_SOURCES): Remove.
14562         (many_sections_r_test_DEPENDENCIES): Remove.
14563         (many_sections_r_test_LDFLAGS): Remove.
14564         (many_sections_r_test_LDADD): Remove.
14565
14566         * object.cc (Sized_relobj::do_add_symbols): Always pass
14567         local_symbol_count_ to add_from_relobj.
14568
14569         * testsuite/Makefile.am (many_sections_check.h): Only check one in
14570         every thousand variables.
14571         * testsuite/Makefile.in: Rebuild.
14572
14573         * object.cc (Xindex::initialize_symtab_xindex): New function.
14574         (Xindex::read_symtab_xindex): New function.
14575         (Xindex::sym_xindex_to_shndx): New function.
14576         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
14577         available.
14578         (Sized_relobj::do_initialize_xindex): New function.
14579         (Sized_relobj::do_read_symbols): Adjust section links.
14580         (Sized_relobj::symbol_section_and_value): Add is_ordinary
14581         parameter.  Change all callers.
14582         (Sized_relobj::include_section_group): Adjust section links and
14583         symbol section indexes.
14584         (Sized_relobj::do_layout): Adjust section links.
14585         (Sized_relobj::do_count_local_symbols): Adjust section links and
14586         symbol section indexes.
14587         (Sized_relobj::do_finalize_local_symbols): Distinguish between
14588         ordinary and special symbols.
14589         (Sized_relobj::write_local_symbols): Add symtab_xindex and
14590         dynsym_xindex parameters.  Change all callers.  Adjust section
14591         links.  Use SHN_XINDEX when needed.
14592         (Sized_relobj::get_symbol_location_info): Adjust section links.
14593         Don't get fooled by special symbols.
14594         * object.h (class Xindex): Define.
14595         (class Object): Add xindex_ parameter.  Declare virtual functoin
14596         do_initialize_xindex.
14597         (Object::adjust_sym_shndx): New function.
14598         (Object::set_xindex): New protected function.
14599         (class Symbol_value): Add is_ordinary_shndx_ field.
14600         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
14601         (Symbol_value::value): Assert ordinary section.
14602         (Symbol_value::initialize_input_to_output_map): Likewise.
14603         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
14604         Change all callers.
14605         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
14606         all callers.
14607         (class Sized_relobj): Update declarations.
14608         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
14609         parameter.  Change all callers.
14610         (Sized_relobj::adjust_shndx): New function.
14611         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
14612         field.
14613         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
14614         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
14615         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
14616         (Sized_dynobj::read_dynsym_section): Adjust section links.
14617         (Sized_dynobj::read_dynamic): Likewise.
14618         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
14619         section links.
14620         (Sized_dynobj::do_initialize_xindex): New function.
14621         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
14622         do_initialize_xindex.
14623         (Sized_dynobj::adjust_shndx): New function.
14624         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
14625         dynsym_xindex_ fields.
14626         (Layout::finalize): Add a call to set_section_indexes before
14627         creating the symtab sections.
14628         (Layout::set_section_indexes): Don't do anything if the section
14629         already has a section index.
14630         (Layout::create_symtab_sections): Add shnum parameter.  Change
14631         caller.  Create .symtab_shndx section if needed.
14632         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
14633         caller.
14634         (Layout::allocated_output_section_count): New function.
14635         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
14636         needed.
14637         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
14638         fields.  Update declarations.
14639         (Layout::symtab_xindex): New function.
14640         (Layout::dynsym_xindex): New function.
14641         (class Write_symbols_task): Add layout_ field.
14642         (Write_symbols_task::Write_symbols_task): Add layout parameter.
14643         Change caller.
14644         * output.cc (Output_section_headers::Output_section_headers): Add
14645         shstrtab_section parameter.  Change all callers.
14646         (Output_section_headers::do_sized_write): Store overflow values
14647         for section count and section string table section index in
14648         section header zero.
14649         (Output_file_header::do_sized_write): Check for overflow of
14650         section count and section string table section index.
14651         (Output_symtab_xindex::do_write): New function.
14652         (Output_symtab_xindex::endian_do_write): New function.
14653         * output.h (class Output_section_headers): Add shstrtab_section_.
14654         Update declarations.
14655         (class Output_symtab_xindex): Define.
14656         (Output_section::has_out_shndx): New function.
14657         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
14658         field.
14659         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
14660         Change all callers.
14661         (Sized_symbol::init): Likewise.
14662         (Symbol::output_section): Check for ordinary symbol.
14663         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
14664         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
14665         callers.
14666         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
14667         Change all callers.  Simplify handling of symbols from sections
14668         not included in the link.
14669         (Symbol_table::add_from_dynobj): Handle ordinary symbol
14670         distinction.
14671         (Weak_alias_sorter::operator()): Assert that symbols are
14672         ordinary.
14673         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
14674         distinction.
14675         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
14676         parameters.  Change all callers.
14677         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
14678         symbol distinction.  Use SHN_XINDEX when needed.
14679         (Symbol_table::write_section_symbol): Add symtab_xindex
14680         parameter.  Change all callers.
14681         (Symbol_table::sized_write_section_symbol): Likewise.  Use
14682         SHN_XINDEX when needed.
14683         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
14684         declarations.
14685         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
14686         (Symbol::is_defined): Check is_ordinary.
14687         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
14688         (Symbol::is_absolute, Symbol::is_common): Likewise.
14689         (class Sized_symbol): Update declarations.
14690         (class Symbol_table): Update declarations.
14691         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
14692         parameters.  Change all callers.
14693         (Sized_symbol::override): Likewise.
14694         (Symbol_table::override): Likewise.
14695         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
14696         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
14697         is_ordinary, and orig_st_shndx parameters.  Change all callers.
14698         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
14699         to be in an ordinary section.
14700         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
14701         object and is_ordinary parameters.  Change all callers.
14702         (Sized_dwarf_line_info::read_relocs): Add object parameter.
14703         Change all callers.  Don't add undefined or non-ordinary symbols
14704         to reloc_map_.
14705         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
14706         Change all callers.
14707         * dwarf_reader.h (class Sized_dwarf_line_info): Update
14708         declarations.
14709         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
14710         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
14711         (Sized_relobj::relocate_sections): Likewise.
14712         * target-reloc.h (scan_relocs): Adjust section symbol index.
14713         (scan_relocatable_relocs): Likewise.
14714         * i386.cc (Scan::local): Check for ordinary symbols.
14715         * sparc.cc (Scan::local): Likewise.
14716         * x86_64.cc (Scan::local): Likewise.
14717         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
14718         to symbol_section_and_value.
14719         * testsuite/many_sections_test.cc: New file.
14720         * testsuite/Makefile.am (BUILT_SOURCES): Define.
14721         (check_PROGRAMS): Add many_sections_test.
14722         (many_sections_test_SOURCES): Define.
14723         (many_sections_test_DEPENDENCIES): Define.
14724         (many_sections_test_LDFLAGS): Define.
14725         (BUILT_SOURCES): Add many_sections_define.h.
14726         (many_sections_define.h): New target.
14727         (BUILT_SOURCES): Add many_sections_check.h.
14728         (many_sections_check.h): New target.
14729         (check_PROGRAMS): Add many_sections_r_test.
14730         (many_sections_r_test_SOURCES): Define.
14731         (many_sections_r_test_DEPENDENCIES): Define.
14732         (many_sections_r_test_LDFLAGS): Define.
14733         (many_sections_r_test_LDADD): Define.
14734         (many_sections_r_test.o): New target.
14735         * testsuite/Makefile.in: Rebuild.
14736
14737 2008-04-17  Cary Coutant  <ccoutant@google.com>
14738
14739         * errors.cc (Errors::info): New function.
14740         (gold_info): New function.
14741         * errors.h (Errors::info): New function.
14742         * gold.h (gold_info): New function.
14743         * object.cc (Input_objects::add_object): Print trace output.
14744         * options.cc (options::parse_set): New function.
14745         (General_options::parse_wrap): Deleted.
14746         (General_options::General_options): Deleted initializer.
14747         * options.h (options::String_set): New typedef.
14748         (options::parse_set): New function.
14749         (DEFINE_set): New macro.
14750         (General_options::wrap): Changed to use DEFINE_set. Changed
14751         callers of any_wrap_symbols and is_wrap_symbol.
14752         (General_options::trace, General_options::trace_symbol):
14753         New options.
14754         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
14755         (General_options::wrap_symbols_): Deleted.
14756         * symtab.cc (Symbol_table::add_from_object): Print trace output.
14757
14758 2008-04-17  David S. Miller  <davem@davemloft.net>
14759
14760         * options.cc (General_options::parse_V): New function.
14761         * options.h: Add entries for -V and -Qy.
14762
14763 2008-04-17  Ian Lance Taylor  <iant@google.com>
14764
14765         * common.cc (Symbol_table::allocate_commons): Remove options
14766         parameter.  Change caller.
14767         (Symbol_table::do_allocate_commons): Remove options parameter.
14768         Change caller.  Just call do_allocate_commons_list twice.
14769         (Symbol_table::do_allocate_commons_list): New function, broken out
14770         of do_allocate_commons.
14771         * common.h (class Allocate_commons_task): Remove options_ field.
14772         Update constructor.
14773         * symtab.cc (Symbol_table::Symbol_table): Initialize
14774         tls_commons_.
14775         (Symbol_table::add_from_object): Put TLS common symbols on
14776         tls_commons_ list.
14777         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
14778         which are IN_OUTPUT_DATA.
14779         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
14780         allocate_commons and do_allocate_commons declarations.  Declare
14781         do_allocate_commons_list.
14782         * gold.cc (queue_middle_tasks): Update creation of
14783         Allocate_commons_task to not pass options.
14784         * testsuite/Makefile.am (INCLUDES): Add -I.. .
14785         (TLS_TEST_C_FLAGS): New variable.
14786         (tls_test_c_pic.o): New target.
14787         (tls_test_shared.so): Link in tls_test_c_pic.o.
14788         (tls_test_c_pic_ie.o): New target.
14789         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
14790         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
14791         (tls_test_c.o): New target.
14792         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
14793         (tls_pic_test_LDADD): Likewise.
14794         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
14795         (tls_shared_gd_to_ie_test_LDADD): Likewise.
14796         (tls_test_c_gnu2.o): New target.
14797         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
14798         tls_test_c_gnu2.o.
14799         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
14800         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
14801         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
14802         * testsuite/tls_test.cc: Include "config.h".
14803         (t_last): Call t11_last.
14804         * testsuite/tls_test.h (t11, t11_last): Declare.
14805         * testsuite/tls_test_c.c: New file.
14806         * testsuite/tls_test_main.cc (thread_routine): Call t11.
14807         * configure.ac: Check for OpenMP support.
14808         * configure, config.in, Makefile.in: Rebuild.
14809         * testsuite/Makefile.in: Rebuild.
14810
14811 2008-04-16  Cary Coutant  <ccoutant@google.com>
14812
14813         * i386.cc (Target_i386::define_tls_base_symbol): New function.
14814         (Target_i386::tls_base_symbol_defined_): New field.
14815         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
14816         (Target_i386::Scan::global): Likewise.
14817         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
14818         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
14819         (Target_x86_64::tls_base_symbol_defined_): New field.
14820         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
14821         (Target_x86_64::Scan::global): Likewise.
14822
14823 2008-04-16  Cary Coutant  <ccoutant@google.com>
14824
14825         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
14826         (Symbol::needs_plt_entry): Allow weak undefined symbols.
14827         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
14828         building shared libraries.
14829         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
14830         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
14831         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
14832         * testsuite/Makefile.in: Rebuild.
14833         * testsuite/weak_undef.h: New file.
14834         * testsuite/weak_undef_file1.cc: Add extra test cases.
14835         * testsuite/weak_undef_file2.cc: Likewise.
14836         * testsuite/weak_undef_test.cc: Likewise.
14837
14838 2008-04-16  David S. Miller  <davem@davemloft.net>
14839
14840         * sparc.cc (Target_sparc::Scan): Change from struct to class.
14841         Add issued_non_pic_error_ field.  Declare check_non_pic.
14842         (Target_sparc::Scan::check_non_pic): New function.
14843         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
14844         (Target_sparc::Scan::global): Likewise.
14845
14846         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
14847         * configure: Rebuild.
14848
14849         * options.h (DEFINE_enable): New macro.
14850         (new_dtags): New enable option.
14851         (initfirst, interpose, loadfltr, nodefaultlib,
14852         nodelete, nodlopen, nodump): New -z options.
14853         * layout.cc (Layout:finish_dynamic_section): If new
14854         dtags enabled, emit DT_RUNPATH.  Also, emit a
14855         DT_FLAGS_1 containing any specified -z flags.
14856
14857 2008-04-16  Ian Lance Taylor  <iant@google.com>
14858
14859         * copy-relocs.cc: New file.
14860         * copy-relocs.h: New file.
14861         * reloc.cc: Remove Copy_relocs code.
14862         * reloc.h: Likewise.
14863         * reloc-types.h (struct Reloc_types) [both versions]: Add
14864         get_reloc_addend_noerror.
14865         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
14866         variants of add_global which take an addend which must be zero.
14867         * i386.cc: Include "copy-relocs.h".
14868         (class Target_i386): Change type of copy_relocs_ to variable,
14869         update initializer.
14870         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
14871         Change all callers.
14872         (Target_i386::do_finalize_sections): Change handling of
14873         copy_relocs_.
14874         * sparc.cc: Include "copy-relocs.h".
14875         (class Target_sparc): Change type of copy_relocs_ to variable,
14876         update initializer.
14877         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
14878         Change all callers.
14879         (Target_sparc::do_finalize_sections): Change handling of
14880         copy_relocs_.
14881         * x86_64.cc: Include "copy-relocs.h".
14882         (class Target_x86_64): Change type of copy_relocs_ to variable,
14883         update initializer.
14884         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
14885         class.  Change all callers.
14886         (Target_x86_64::do_finalize_sections): Change handling of
14887         copy_relocs_.
14888         * Makefile.am (CCFILES): Add copy-relocs.cc.
14889         (HFILES): Add copy-relocs.h.
14890
14891         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
14892
14893         * testsuite/script_test_4.sh: Permit leading zeroes.
14894
14895 2008-04-15  Ian Lance Taylor  <iant@google.com>
14896
14897         * script-sections.cc (Script_sections::create_segments): Use
14898         header_size_adjustment even when there is enough room for the
14899         headers.
14900         * testsuite/script_test_4.sh: New file.
14901         * testsuite/script_test_4.t: New file.
14902         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
14903         (check_DATA): Add script_test_4.stdout.
14904         (MOSTLYCLEANFILES): Likewise.
14905         (script_test_4): New target.
14906         (script_test_4.stdout): New target.
14907         * testsuite/Makefile.in: Rebuild.
14908
14909         * sparc.cc: Add definitions for Output_data_plt_sparc class
14910         constants.
14911
14912 2008-04-14  David S. Miller  <davem@davemloft.net>
14913
14914         * sparc.cc: New file.
14915         * Makefile.am (TARGETSOURCES): Add sparc.cc
14916         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
14917         * configure.tgt: Document targ_extra_size and
14918         targ_extra_big_endian.  Add entries for sparc-* and
14919         sparc64-*.
14920         * configure.ac: Handle targ_extra_size and
14921         targ_extra_big_endian.
14922         * Makefile.in: Rebuild.
14923         * configure: Likewise.
14924         * po/POTFILES.in: Likewise.
14925         * po/gold.pot: Likewise.
14926
14927 2008-04-14  Ian Lance Taylor  <iant@google.com>
14928
14929         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
14930         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
14931         in the name/type/flags to section mapping.  Don't call
14932         allocate_output_section.
14933         (Layout::choose_output_section): Change parameter from adjust_name
14934         to is_input_section.  Don't permit input sections after sections
14935         are attached to segments.  Don't call allocate_output_section.
14936         (Layout::layout_eh_frame): Call update_flags_for_input_section,
14937         not write_enable_output_section.
14938         (Layout::make_output_section): Don't push to
14939         unattached_section_list_ nor call attach_to_segment.  Call
14940         attach_section_to_segment if sections are attached.
14941         (Layout::attach_sections_to_segments): New function.
14942         (Layout::attach_section_to_segment): New function.
14943         (Layout::attach_allocated_section_to_segment): Rename from
14944         attach_to_segment.  Remove flags parameter.
14945         (Layout::allocate_output_section): Remove function.
14946         (Layout::write_enable_output_section): Remove function.
14947         * layout.h (class Layout): Update for above changes.  Add new
14948         field sections_are_attached_.
14949         * output.h (Output_section::update_flags_for_input_section): New
14950         function.
14951         * output.cc (Output_section::add_input_section): Call
14952         update_flags_for_input_section.
14953         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
14954
14955 2008-04-11  Cary Coutant  <ccoutant@google.com>
14956
14957         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
14958         thought unnecessary.
14959         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
14960
14961 2008-04-11  Ian Lance Taylor  <iant@google.com>
14962
14963         * output.h (class Output_section_data): Remove inline definition
14964         of set_addralign.
14965         * output.cc (Output_section_data::set_addralign): New function.
14966
14967 2008-04-11  Cary Coutant  <ccoutant@google.com>
14968
14969         Add support for TLS descriptors for i386 and x86_64.
14970         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
14971         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
14972         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
14973         GOT_TYPE_TLS_DESC.
14974         (Target_i386::got_mod_index_entry): Remove unnecessary code.
14975         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
14976         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
14977         relocations.
14978         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
14979         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
14980         Fix problem with initial-exec relocations.
14981         (Target_i386::Relocate::relocate_tls): Likewise.
14982         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
14983         relaxation.
14984         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
14985         support for section-plus-offset dynamic table entries.
14986         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
14987         (Output_data_dynamic::Dynamic_entry): Add support for
14988         section-plus-offset dynamic table entries.
14989         (Output_data_dynamic::Classification): Likewise.
14990         (Output_data_dynamic::classification_): Renamed offset_.
14991         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
14992         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
14993         (Target_x86_64::make_plt_section): New function.
14994         (Target_x86_64::reserve_tlsdesc_entries): New function.
14995         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
14996         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
14997         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
14998         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
14999         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
15000         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
15001         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
15002         add extra PLT entry for TLS descriptors.
15003         (Output_data_plt_x86_64::got_): New field.
15004         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
15005         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
15006         fields.
15007         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
15008         descriptors.
15009         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
15010         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
15011         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
15012         R_386_TLS_DESC_CALL relocations.
15013         (Target_x86_64::Scan::global): Likewise.
15014         (Target_x86_64::do_finalize_sections): Add dynamic table entries
15015         for TLS descriptors.
15016         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
15017         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
15018         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
15019         GD-to-IE relaxation.
15020         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
15021         and TLS_DESCRIPTORS.
15022         * Makefile.in: Rebuild.
15023         * configure: Rebuild.
15024         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
15025         (tls_test_shared2.so): New target.
15026         (tls_shared_gd_to_ie_test_SOURCES): New variable.
15027         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
15028         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
15029         (tls_shared_gd_to_ie_test_LDADD): New variable.
15030         (tls_shared_gnu2_gd_to_ie_test): New target.
15031         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
15032         New targets.
15033         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
15034         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
15035         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
15036         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
15037         (tls_shared_gnu2_test): New target.
15038         (tls_test_gnu2_shared.so): New target.
15039         (tls_shared_gnu2_test_SOURCES): New variable.
15040         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
15041         (tls_shared_gnu2_test_LDFLAGS): New variable.
15042         (tls_shared_gnu2_test_LDADD): New variable.
15043         * testsuite/Makefile.in: Rebuild.
15044         * testsuite/Makefile.
15045
15046 2008-04-11  Ian Lance Taylor  <iant@google.com>
15047
15048         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
15049         justsyms.t.
15050         * testsuite/Makefile.in: Rebuild.
15051
15052         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
15053         long.
15054         * testsuite/script_test_2.cc (main): Adjust test.
15055
15056 2008-04-11  David S. Miller  <davem@davemloft.net>
15057             Ian Lance Taylor  <iant@google.com>
15058
15059         * options.h (General_options): Add entries for '-Y' and
15060         '-relax'.
15061         * options.cc (General_options:finalize): If -Y was used, add those
15062         entries to the library path instead of the default "/lib" and
15063         "/usr/lib".
15064
15065 2008-04-11  David S. Miller  <davem@davemloft.net>
15066
15067         * testsuite/justsyms.t: Start at 0x100.
15068         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
15069         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
15070         long.
15071         * testsuite/script_test_2.cc: Adjust string and section length
15072         checks.
15073
15074 2008-04-09  Ian Lance Taylor  <iant@google.com>
15075
15076         PR gold/5996
15077         * script-sections.cc (Sections_element::allocate_to_segment): Add
15078         orphan parameter.
15079         (Output_section_definition::allocate_to_segment): Likewise.
15080         (Orphan_output_section::allocate_to_segment): Likewise.
15081         (Script_sections::attach_sections_using_phdrs_clause): Don't
15082         propagate non-PT_LOAD segments to orphan sections.
15083         * testsuite/Makefile.am (script_test_3.stdout): Generate using
15084         readelf rather than objdump.
15085         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
15086         .interp section and PT_INTERP segment are the same size.
15087         * testsuite/Makefile.in: Rebuild.
15088
15089         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
15090         aliases for symbols defined in the same object.
15091         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
15092         (weak_alias_test_SOURCES): New variable.
15093         (weak_alias_test_DEPENDENCIES): New variable.
15094         (weak_alias_test_LDFLAGS): New variable.
15095         (weak_alias_test_LDADD): New variable.
15096         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
15097         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
15098         (weak_alias_test_3.o): New target.
15099         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
15100         * testsuite/weak_alias_test_main.cc: New file.
15101         * testsuite/weak_alias_test_1.cc: New file.
15102         * testsuite/weak_alias_test_2.cc: New file.
15103         * testsuite/weak_alias_test_3.cc: New file.
15104
15105 2008-04-08  Ian Lance Taylor  <iant@google.com>
15106
15107         * options.h (class General_options): Add --noinhibit-exec option.
15108         * main.cc (main): Check --noinhibit-exec.
15109
15110         * options.h (class General_options): Define --wrap as a special
15111         option.  Add wrap_symbols_ field.
15112         (General_options::any_wrap_symbols): New function.
15113         (General_options::is_wrap_symbol): New function.
15114         * options.cc (General_options::parse_wrap): New function.
15115         (General_options::General_options): Initialize wrap_symbols_.
15116         * symtab.cc (Symbol_table::wrap_symbol): New function.
15117         (Symbol_table::add_from_object): Handle --wrap.
15118         * symtab.h (class Symbol_table): Declare wrap_symbol.
15119         * target.h (Target::wrap_char): New function.
15120         (Target::Target_info): Add wrap_char field.
15121         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
15122         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
15123         * testsuite/testfile.cc (Target_test::test_target_info):
15124         Likewise.
15125
15126         * errors.cc (Errors::undefined_symbol): Mention symbol version if
15127         there is one.
15128
15129         * layout.h (class Layout): Add added_eh_frame_data_ field.
15130         * layout.cc (Layout::Layout): Initialize new field.
15131         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
15132         output section until we find a section we merged successfully.
15133         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
15134         that the size be non-zero.
15135
15136         * merge.cc (Object_merge_map::get_output_offset): Remove inline
15137         qualifier.
15138
15139 2008-04-08  Craig Silverstein  <csilvers@google.com>
15140
15141         * configure.ac: Export new conditional variable HAVE_ZLIB.
15142         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
15143         on HAVE_ZLIB.
15144         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
15145         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15146
15147 2008-04-07  Ian Lance Taylor  <iant@google.com>
15148
15149         * version.cc (version_string): Set to "1.5".
15150
15151         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
15152         Add issued_non_pic_error_ field.  Declare check_non_pic.
15153         (Target_x86_64::Scan::check_non_pic): New function.
15154         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
15155         (Target_x86_64::Scan::global): Likewise.
15156
15157         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
15158         addend parameter.  Change caller.  Handle merge sections.
15159         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
15160         Address to Addend.  Don't add in the result of
15161         local_section_offset, pass down the addend and use the returned
15162         value.
15163         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
15164         Update declarations of local_section_offset and symbol_value.
15165         * testsuite/two_file_test_1.cc (t18): New function.
15166         * testsuite/two_file_test_2.cc (f18): New function.
15167         * testsuite/two_file_test_main.cc (main): Call t18.
15168         * testsuite/two_file_test.h (t18, f18): Declare.
15169
15170         * configure.ac: Don't test for objdump, c++filt, or readelf.
15171         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
15172         conditionals.
15173         (TEST_READELF): New variable.
15174         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
15175         (check_PROGRAMS): Add two_file_strip_test.
15176         (two_file_strip_test): New target.
15177         (check_PROGRAMS): Add two_file_same_shared_strip_test.
15178         (two_file_same_shared_strip_test_SOURCES): New variable.
15179         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
15180         (two_file_same_shared_strip_test_LDFLAGS): New variable.
15181         (two_file_same_shared_strip_test_LDADD): New variable.
15182         (two_file_shared_strip.so): New target.
15183         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
15184         (ver_test_5.syms, ver_test_7.syms): Likewise.
15185         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
15186         (strip_test_3.stdout): Use TEST_OBJDUMP.
15187         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15188
15189 2008-04-04  Cary Coutant  <ccoutant@google.com>
15190
15191         * symtab.h (Symbol::is_weak_undefined): New function.
15192         (Symbol::is_strong_undefined): New function.
15193         (Symbol::is_absolute): New function.
15194         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
15195         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
15196         absolute symbols.
15197         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
15198         (weak_undef_test): New target.
15199         * testsuite/Makefile.in: Rebuild.
15200         * testsuite/weak_undef_file1.cc: New file.
15201         * testsuite/weak_undef_file2.cc: New file.
15202         * testsuite/weak_undef_test.cc: New file.
15203
15204 2008-04-03  Craig Silverstein  <csilvers@google.com>
15205
15206         * compressed_output.h (class Output_compressed_section): Use
15207         unsigned buffer.
15208         * compressed_output.cc (zlib_compress): Use unsigned buffers,
15209         add zlib header.
15210         (zlib_compressed_suffix): Removed.
15211         (Output_compressed_section::set_final_data_size): Use unsigned
15212         buffers.
15213         * testsuite/Makefile.am (flagstest_compress_debug_sections):
15214         Fix linker invocation.
15215         (flagstest_o_specialfile_and_compress_debug_sections):
15216         Likewise.
15217         * testsuite/Makefile.in: Regenerated.
15218
15219 2008-04-02  David S. Miller  <davem@davemloft.net>
15220
15221         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
15222         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
15223
15224 2008-04-02  Craig Silverstein  <csilvers@google.com>
15225
15226         * TODO: New file.
15227
15228 2008-04-02  Ian Lance Taylor  <iant@google.com>
15229
15230         * fileread.cc (File_read::find_view): Add byteshift and vshifted
15231         parameters.  Update for new key type to views_.  Change all
15232         callers.
15233         (File_read::read): Adjust for byteshift in returned view.
15234         (File_read::add_view): New function, broken out of
15235         find_and_make_view.
15236         (File_read::make_view): New function, broken out of
15237         find_and_make_view.
15238         (File_read::find_or_make_view): Add offset and aligned
15239         parameters.  Rewrite accordingly.  Change all callers.
15240         (File_read::get_view): Add offset and aligned parameters.  Adjust
15241         for byteshift in return value.
15242         (File_read::get_lasting_view): Likewise.
15243         * fileread.h (class File_read): Update declarations.
15244         (class File_read::View): Add byteshift_ field.  Add byteshift to
15245         constructor.  Add byteshift method.
15246         * archive.h (Archive::clear_uncached_views): New function.
15247         (Archive::get_view): Add aligned parameter.  Change all callers.
15248         * object.h (Object::get_view): Add aligned parameter.  Change all
15249         callers.
15250         (Object::get_lasting_view): Likewise.
15251
15252         * fileread.cc (File_read::release): Don't call clear_views if
15253         there are multiple objects.
15254         * fileread.h (File_read::clear_uncached_views): New function.
15255         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
15256         on the archive.
15257
15258 2008-03-31  Cary Coutant  <ccoutant@google.com>
15259
15260         Add thin archive support.
15261         * archive.cc (Archive::armagt): New const.
15262         (Archive::setup): Remove task parameter and calls to unlock.
15263         (Archive::unlock_nested_archives): New function.
15264         (Archive::read_header): Add nested_off parameter. Change
15265         all callers.
15266         (Archive::interpret_header): Likewise.
15267         (Archive::include_all_members): Change to handle thin
15268         archives.
15269         (Archive::include_member): Likewise.
15270         * archive.h (Archive::Archive): Add new parameters and
15271         initializers.
15272         (Archive::armagt): New const.
15273         (Archive::setup): Remove task parameter.
15274         (Archive::unlock_nested_archives): New function.
15275         (Archive::read_header): Add nested_off parameter.
15276         (Archive::interpret_header): Likewise.
15277         (Archive::Nested_archive_table): New typedef.
15278         (Archive::is_thin_archive_): New field.
15279         (Archive::nested_archives_): New field.
15280         (Archive::options_): New field.
15281         (Archive::dirpath_): New field.
15282         (Archive::task_): New field.
15283         * readsyms.cc (Read_symbols::do_read_symbols): Add check
15284         for thin archives.  Pass additional parameters to
15285         Archive::Archive.  Unlock the archive file after calling
15286         Archive::setup.
15287
15288 2008-03-29  Ian Lance Taylor  <iant@google.com>
15289
15290         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
15291         version symbol to be local.
15292         * testsuite/ver_test_4.sh: New file.
15293         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
15294         (check_DATA): Add ver_test_4.syms.
15295         (ver_test_4.syms): New target.
15296         * testsuite/Makefile.in: Rebuild.
15297
15298         * output.cc
15299         (Output_section::Input_section_sort_entry::has_priority): New
15300         function.
15301         (Output_section::Input_section_sort_entry::match_file_name): New
15302         function.
15303         (Output_section::Input_section_sort_entry::match_section_name):
15304         Remove.
15305         (Output_section::Input_section_sort_entry::match_section_name_prefix):
15306         Remove.
15307         (Output_section::Input_section_sort_entry::match_section_file):
15308         Remove.
15309         (Output_section::Input_section_sort_compare::operator()): Rewrite
15310         using new Input_section_sort_entry functions.  Sort crtbegin and
15311         crtend first.  Sort sections with no priority before sections with
15312         a priority.
15313         * testsuite/initpri1.c (d3): Check j != 4.
15314         (cd5): New constructor/destructor function.
15315         (main): Check j != 2.
15316
15317         * symtab.cc (Symbol_table::add_from_object): If we don't use the
15318         new symbol when resolving, don't call set_is_default.
15319         * testsuite/ver_test_7.cc: New file.
15320         * testsuite/ver_test_7.sh: New file.
15321         * testsuite/Makefile.am (ver_test_7.so): New target.
15322         (ver_test_7.o): New target.
15323         (check_SCRIPTS): Add ver_test_7.sh.
15324         (check_DATA): Add ver_test_7.syms.
15325         (ver_test_7.syms): New target.
15326
15327 2008-03-28  Ian Lance Taylor  <iant@google.com>
15328
15329         * layout.cc (Layout::layout): If we see an input section with a
15330         name that needs sorting, set the must_sort flag for the output
15331         section.
15332         (Layout::make_output_section): If the name of the output section
15333         indicates that it might require sorting, set the may_sort flag.
15334         * output.h (Output_section::may_sort_attached_input_sections): New
15335         function.
15336         (Output_section::set_may_sort_attached_input_sections): New
15337         function.
15338         (Output_section::must_sort_attached_input_sections): New
15339         function.
15340         (Output_section::set_must_sort_attached_input_sections): New
15341         function.
15342         (class Output_section): Declare Input_section_sort_entry.  Define
15343         Input_section_sort_compare.  Declare
15344         sort_attached_input_sections.  Add new fields:
15345         may_sort_attached_input_sections_,
15346         must_sort_attached_input_sections_,
15347         attached_input_sections_are_sorted_.
15348         * output.cc (Output_section::Output_section): Initialize new
15349         fields.
15350         (Output_section::add_input_section): Add an entry to
15351         input_sections_ if may_sort or must_sort are true.
15352         (Output_section::set_final_data_size): Call
15353         sort_attached_input_sections if necessary.
15354         (Output_section::Input_section_sort_entry): Define new class.
15355         (Output_section::Input_section_sort_compare::operator()): New
15356         function.
15357         (Output_section::sort_attached_input_sections): New function.
15358         * configure.ac: Check whether the compiler supports constructor
15359         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
15360         * testsuite/initpri1.c: New file.
15361         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
15362         CONSTRUCTOR_PRIORITY.
15363         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
15364         (initpri1_LDFLAGS): New variable.
15365         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15366
15367 2008-03-27  Ian Lance Taylor  <iant@google.com>
15368
15369         * common.cc (Sort_commons::operator): Correct sorting algorithm.
15370         * testsuite/common_test_1.c: New file.
15371         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
15372         (common_test_1_SOURCES): New variable.
15373         (common_test_1_DEPENDENCIES): New variable.
15374         (common_test_1_LDFLAGS): New variable.
15375
15376         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
15377         and commons_ correctly when NAME/VERSION does not override
15378         NAME/NULL.
15379         * testsuite/ver_test_6.c: New file.
15380         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
15381         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
15382         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
15383
15384 2008-03-26  Ian Lance Taylor  <iant@google.com>
15385
15386         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
15387         of an undefined symbol from a version script.
15388         * testsuite/Makefile.am (ver_test_5.so): New target.
15389         (ver_test_5.o): New target.
15390         (check_SCRIPTS): Add ver_test_5.sh.
15391         (check_DATA): Add ver_test_5.syms.
15392         (ver_test_5.syms): New target.
15393         * testsuite/ver_test_5.cc: New file.
15394         * testsuite/ver_test_5.script: New file.
15395         * testsuite/ver_test_5.sh: New file.
15396         * Makefile.in, testsuite/Makefile.in: Rebuild.
15397
15398         PR gold/5986
15399         Fix problems building gold with gcc 4.3.0.
15400         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
15401         (gold_error_at_location, gold_warning_at_location): Use it.
15402         * configure.ac: Check whether we can compile and use a template
15403         function with a printf attribute.
15404         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
15405         when jumping over bytes.
15406         * object.cc: Instantiate Object::read_section_data.
15407         * debug.h: Include <cstring>
15408         * dwarf_reader.cc: Include <algorithm>
15409         * main.cc: Include <cstring>.
15410         * options.cc: Include <cstring>.
15411         * output.cc: Include <cstring>.
15412         * script.cc: Include <cstring>.
15413         * script.h: Include <string>.
15414         * symtab.cc: Include <cstring> and <algorithm>.
15415         * target-select.cc: Include <cstring>.
15416         * version.cc: Include <string>.
15417         * testsuite/testmain.cc: Include <cstdlib>.
15418         * configure, config.in: Rebuild.
15419
15420 2008-03-25  Ian Lance Taylor  <iant@google.com>
15421
15422         * options.cc: Include "../bfd/bfdver.h".
15423         (options::help): Print bug reporting address.
15424
15425         * version.cc (print_version): Adjust output for current value of
15426         BFD_VERSION_STRING.
15427
15428         * NEWS: New file.
15429
15430         * options.cc (options::help): Print list of supported targets.
15431         * target-select.h: Include <vector>.
15432         (class Target_selector): Make machine_, size_, and is_big_endian_
15433         fields const.  Add bfd_name_ and instantiated_target_ fields.
15434         (Target_selector::Target_selector): Add bfd_name parameter.
15435         (Target_selector::recognize): Make non-virtual, call
15436         do_recognize.
15437         (Target_selector::recognize_by_name): Make non-virtual, call
15438         do_recognize_by_name.
15439         (Target_selector::supported_names): New function.
15440         (Target_selector::bfd_name): New function.
15441         (Target_selector::do_instantiate_target): New pure virtual
15442         function.
15443         (Target_selector::do_recognize): New virtual function.
15444         (Target_selector::do_recognize_by_name): New virtual function.
15445         (Target_selector::instantiate_target): New private function.
15446         (supported_target_names): Declare.
15447         * target-select.cc (Target_selector::Target_selector): Update for
15448         new parameter and fields.
15449         (select_target_by_name): Check that the name matches before
15450         calling recognize_by_name.
15451         (supported_target_names): New function.
15452         * i386.cc (class Target_selector_i386): Update Target_selector
15453         constructor call.  Remove recognize and recognize_by_name.  Add
15454         do_instantiate_target.
15455         * x86_64.cc (class Target_selector_x86_64): Likewise.
15456         * testsuite/testfile.cc (class Target_selector_test): Update for
15457         changes to Target_selector.
15458
15459         * README: Rewrite, with some notes on unsupported features.
15460
15461 2008-03-24  Cary Coutant  <ccoutant@google.com>
15462
15463         * i386.cc (Target_i386::Got_type): New enum declaration.
15464         (Target_i386::Scan::local): Updated callers of Output_data_got
15465         member functions.
15466         (Target_i386::Scan::global): Likewise.
15467         (Target_i386::Relocate::relocate): Likewise.
15468         (Target_i386::Relocate::relocate_tls): Likewise.
15469         * object.h (Got_offset_list): New class.
15470         (Sized_relobj::local_has_got_offset): Added got_type parameter.
15471         (Sized_relobj::local_got_offset): Likewise.
15472         (Sized_relobj::set_local_got_offset): Likewise.
15473         (Sized_relobj::local_has_tls_got_offset): Removed.
15474         (Sized_relobj::local_tls_got_offset): Removed.
15475         (Sized_relobj::set_local_tls_got_offset): Removed.
15476         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
15477         * output.cc (Output_data_got::add_global): Added got_type parameter.
15478         (Output_data_got::add_global_with_rel): Likewise.
15479         (Output_data_got::add_global_with_rela): Likewise.
15480         (Output_data_got::add_global_pair_with_rel): New function.
15481         (Output_data_got::add_global_pair_with_rela): New function.
15482         (Output_data_got::add_local): Added got_type parameter.
15483         (Output_data_got::add_local_with_rel): Likewise.
15484         (Output_data_got::add_local_with_rela): Likewise.
15485         (Output_data_got::add_local_pair_with_rel): New function.
15486         (Output_data_got::add_local_pair_with_rela): New function.
15487         (Output_data_got::add_global_tls): Removed.
15488         (Output_data_got::add_global_tls_with_rel): Removed.
15489         (Output_data_got::add_global_tls_with_rela): Removed.
15490         (Output_data_got::add_local_tls): Removed.
15491         (Output_data_got::add_local_tls_with_rel): Removed.
15492         (Output_data_got::add_local_tls_with_rela): Removed.
15493         * output.h (Output_data_got::add_global): Added got_type parameter.
15494         (Output_data_got::add_global_with_rel): Likewise.
15495         (Output_data_got::add_global_with_rela): Likewise.
15496         (Output_data_got::add_global_pair_with_rel): New function.
15497         (Output_data_got::add_global_pair_with_rela): New function.
15498         (Output_data_got::add_local): Added got_type parameter.
15499         (Output_data_got::add_local_with_rel): Likewise.
15500         (Output_data_got::add_local_with_rela): Likewise.
15501         (Output_data_got::add_local_pair_with_rel): New function.
15502         (Output_data_got::add_local_pair_with_rela): New function.
15503         (Output_data_got::add_global_tls): Removed.
15504         (Output_data_got::add_global_tls_with_rel): Removed.
15505         (Output_data_got::add_global_tls_with_rela): Removed.
15506         (Output_data_got::add_local_tls): Removed.
15507         (Output_data_got::add_local_tls_with_rel): Removed.
15508         (Output_data_got::add_local_tls_with_rela): Removed.
15509         * resolve.cc (Symbol::override_base_with_special): Removed
15510         reference to has_got_offset_ field.
15511         * symtab.cc (Symbol::init_fields): Replaced initialization
15512         of got_offset_ with got_offsets_.  Removed initialization
15513         of has_got_offset_
15514         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
15515         (Symbol::got_offset): Likewise.
15516         (Symbol::set_got_offset): Likewise.
15517         (Symbol::has_tls_got_offset): Removed.
15518         (Symbol::tls_got_offset): Removed.
15519         (Symbol::set_tls_got_offset): Removed.
15520         (Symbol::got_offset_): Removed.
15521         (Symbol::tls_mod_got_offset_): Removed.
15522         (Symbol::tls_pair_got_offset_): Removed.
15523         (Symbol::got_offsets_): New field.
15524         (Symbol::has_got_offset): Removed.
15525         (Symbol::has_tls_mod_got_offset): Removed.
15526         (Symbol::has_tls_pair_got_offset): Removed.
15527         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
15528         (Target_x86_64::Scan::local): Updated callers of Output_data_got
15529         member functions.
15530         (Target_x86_64::Scan::global): Likewise.
15531         (Target_x86_64::Relocate::relocate): Likewise.
15532         (Target_x86_64::Relocate::relocate_tls): Likewise.
15533
15534 2008-03-25  Ben Elliston  <bje@au.ibm.com>
15535
15536         * yyscript.y: Fix spelling error in comment.
15537
15538 2008-03-24  Ian Lance Taylor  <iant@google.com>
15539
15540         * options.h (class General_options): Define build_id option.
15541         * layout.h (class Layout): Declare write_build_id, create_note,
15542         create_build_id.  Add build_id_note_ member.
15543         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
15544         "libiberty.h", "md5.h", "sha1.h".
15545         (Layout::Layout): Initialize eh_frame_data_,
15546         eh_frame_hdr_section_, and build_id_note_.
15547         (Layout::finalize): Call create_build_id.
15548         (Layout::create_note): New function, broken out of
15549         Layout::create_gold_note.
15550         (Layout::create_gold_note): Call create_note.
15551         (Layout::create_build_id): New function.
15552         (Layout::write_build_id): New function.
15553         (Close_task_runner::run): Call write_build_id.
15554
15555         * x86_64.cc: Correct license to GPLv3.
15556
15557 2008-03-23  Ian Lance Taylor  <iant@google.com>
15558
15559         * options.cc: Include "demangle.h".
15560         (parse_optional_string): New function.
15561         (parse_long_option): Handle takes_optional_argument.
15562         (parse_short_option): Update dash_z initializer.  Handle
15563         takes_optional_argument.
15564         (General_options::General_options): Initialize do_demangle_.
15565         (General_options::finalize): Set do_demangle_.  Handle demangling
15566         style.
15567         * options.h (parse_optional_string): Declare.
15568         (struct One_option): Add optional_arg field.  Update constructor.
15569         Update call constructor calls.  Add takes_optional_argument
15570         function.
15571         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
15572         (DEFINE_optional_string): Define.
15573         (General_options::demangle): Change from DEFINE_bool to
15574         DEFINE_optional_string.
15575         (General_options::no_demangle): New function.
15576         (General_options::do_demangle): New function.
15577         (General_options::set_do_demangle): New function.
15578         (General_options::execstack_status_): Move definition to end of
15579         class definition.
15580         (General_options::static_): Likewise.
15581         (General_options::do_demangle_): New field.
15582         * object.cc (big_endian>::get_symbol_location_info): Call
15583         Options::do_demangle, not Options::demangle.
15584         * symtab.cc (demangle): Likewise.
15585
15586 2008-03-22  Ian Lance Taylor  <iant@google.com>
15587
15588         * gold.h: Include <cstddef> and <sys/types.h>
15589         * options.h: Include <cstring>.
15590
15591 2008-03-21  Ian Lance Taylor  <iant@google.com>
15592
15593         * Added source code to GNU binutils.
15594 \f
15595 Copyright (C) 2008-2014 Free Software Foundation, Inc.
15596
15597 Copying and distribution of this file, with or without modification,
15598 are permitted in any medium without royalty provided the copyright
15599 notice and this notice are preserved.
15600
15601 Local Variables:
15602 mode: change-log
15603 left-margin: 8
15604 fill-column: 74
15605 version-control: never
15606 End: