Fix internal error with LTO on ARM.
[external/binutils.git] / gold / ChangeLog
1 2014-07-08  Cary Coutant  <ccoutant@google.com>
2
3         PR gold/15639
4         * dynobj.h (Sized_dynobj::base_read_symbols): New method.
5         * dynobj.cc (Sized_dynobj::do_read_symbols): Move body to...
6         (Sized_dynobj::base_read_symbols): ...new method.
7         * object.h (Sized_relobj_file::base_read_symbols): New method.
8         * object.cc (Sized_relobj_file::do_read_symbols): Move body to...
9         (Sized_relobj_file::base_read_symbols): ...new method.
10         * arm.cc (Arm_relobj::do_read_symbols): Call base_read_symbols.
11         * mips.cc: (Mips_relobj::do_read_symbols): Likewise.
12         * powerpc.cc (Powerpc_dynobj::do_read_symbols): Likewise.
13
14 2014-07-04  Alan Modra  <amodra@gmail.com>
15
16         * po/POTFILES.in: Regenerate.
17
18 2014-07-02  Jing Yu  <jingyu@google.com>
19
20         * aarch64.cc: New file
21         * Makefile.am (TARGETSOURCES): Add aarch64.cc
22         (ALL_TARGETOBJS): Add aarch64.$(OBJEXT)
23         * Makefile.in: Regenerate.
24         * configure.tgt: Add entries for aarch64*.
25         * configure.ac:  Likewise.
26         * configure: Likewise.
27
28 2014-06-27  Alan Modra  <amodra@gmail.com>
29
30         * symtab.cc (Symbol::should_add_dynsym_entry): Don't make inline.
31
32 2014-06-24  Cary Coutant  <ccoutant@google.com>
33
34         * dwp.cc (Dwo_file::read): Allow files with no .debug_types
35         sections.
36         (Dwo_file::sized_read_unit_index): Likewise.
37
38 2014-06-23  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
39
40         * mips.cc: New file.
41         * Makefile.am (TARGETSOURCES): Add mips.cc
42         (ALL_TARGETOBJS): Add mips.$(OBJEXT)
43         * configure.tgt: Add entries for mips*.
44         * configure.ac: Likewise.
45         * Makefile.in: Regenerate.
46         * configure: Likewise.
47
48 2014-06-09  Cary Coutant  <ccoutant@google.com>
49
50         * dwarf_reader.cc (Dwarf_pubnames_table::read_header): Check that
51         unit_length is within section bounds.
52
53 2014-06-09  Cary Coutant  <ccoutant@google.com>
54
55         PR gold/16980
56         * layout.cc (Layout::print_to_mapfile): Print unattached sections in
57         map.
58
59 2014-06-07  Alan Modra  <amodra@gmail.com>
60
61         * powerpc.cc (relocate): Treat field of cmpli insn as a bitfield.
62
63 2014-06-06  Cary Coutant  <ccoutant@google.com>
64
65         * dwarf_reader.h (Dwarf_pubnames_table): Remove output_section_offset_.
66         * dwarf_reader.cc (Dwarf_pubnames_table::read_section): Likewise.
67         (Dwarf_pubnames_table::read_header): Likewise.
68         * layout.cc (gdb_fast_lookup_sections): Add .debug_gnu_pubnames and
69         .debug_gnu_pubtypes.
70
71 2014-06-05  Joel Brobecker  <brobecker@adacore.com>
72
73         * Makefile.am (CONFIG_STATUS_DEPENDENCIES): New.
74         * Makefile.in, configure: Regenerate.
75
76 2014-06-03  Alan Modra  <amodra@gmail.com>
77
78         * powerpc.cc (addis_12_2): Define.
79         (Stub_table::do_write): Support fusion on ELFv2 stubs.
80
81 2014-06-03  Alan Modra  <amodra@gmail.com>
82
83         * testsuite/plugin_test.c (parse_readelf_line): Skip non-visibility
84         st_other output.
85
86 2014-06-02  Alan Modra  <amodra@gmail.com>
87
88         * powerpc.cc (Target_powerpc::local_reloc_may_be_function_pointer):
89         Only ignore relocs on ELFv1.
90         (Target_powerpc::global_reloc_may_be_function_pointer): Likewise.
91
92 2014-05-30  Cary Coutant  <ccoutant@google.com>
93
94         * testsuite/Makefile.am (ehdr_start_test_4): Fix typo in -B option.
95         * testsuite/Makefile.in: Regenerate.
96         * testsuite/ehdr_start_test_4.sh: Look for "U" instead of "w".
97
98 2014-05-27  H.J. Lu  <hongjiu.lu@intel.com>
99
100         PR gold/16945
101         * x86_64.cc (Target_x86_64::Relocate::relocate): Use signed int
102         for got_offset.  Properly get GOT address for R_X86_64_PLTOFF64.
103
104 2014-05-15  Alan Modra  <amodra@gmail.com>
105
106         * powerpc.cc (do_plt_fde_location): Handle zero length .glink.
107         Compare FDE contents with DW_CFA_nop rather than 0.
108
109 2014-05-13  Sriraman Tallam  <tmsriram@google.com>
110
111         * symtab.h (may_need_copy_reloc): Remove check for position independent
112         code.
113         * x86_64.cc (Target_x86_64<size>::Scan::global): Add check for no
114         position independence before pc absolute may_need_copy_reloc call.
115         Add check for executable output befor pc relative may_need_copy_reloc
116         call.
117         * i386.cc: Ditto.
118         * arm.cc: Ditto.
119         * sparc.cc: Ditto.
120         * tilegx.cc: Ditto.
121         * powerpc.cc: Add check for no position independence before
122         may_need_copy_reloc calls.
123         * testsuite/pie_copyrelocs_test.cc: New file.
124         * testsuite/pie_copyrelocs_shared_test.cc: New file.
125         * Makefile.am (pie_copyrelocs_test): New test.
126         * Makefile.in: Regenerate.
127
128 2014-05-08  Martin Liška  <mliska@suse.cz>
129
130         * output.cc (Sized_relobj_file::do_layout): Fix typo in info message.
131
132 2014-05-06  Cary Coutant  <ccoutant@google.com>
133
134         PR gold/16900
135         * i386.cc (Output_data_got_plt_i386): New class.
136         (Output_data_plt_i386::Output_data_plt_i386): Change type of got_plt
137         parameter. Change all callers.
138         (Output_data_plt_i386::layout_): Remove.
139         (Output_data_plt_i386::got_plt_): Change type.
140         (Target_i386::got_plt_): Change type. Change all references.
141         (Target_i386::got_section): Create instance of new class.
142         (Output_data_got_plt_i386::do_write): New function.
143         * x86_64.cc (Output_data_got_plt_x86_64): New class.
144         (Output_data_plt_x86_64::Output_data_plt_x86_64): Change type of got_plt
145         parameter. Change all callers.
146         (Output_data_plt_x86_64::layout_): Remove.
147         (Output_data_plt_x86_64::got_plt_): Change type.
148         (Target_x86_64::got_plt_): Change type. Change all references.
149         (Target_x86_64::got_section): Create instance of new class.
150         (Output_data_got_plt_x86_64::do_write): New function.
151         (Output_data_plt_x86_64::do_write): Don't write reserved words in GOT.
152         (Target_x86_64<size>::init_got_plt_for_update): Create instance of new
153         class.
154
155 2014-05-05  Cary Coutant  <ccoutant@google.com>
156
157         * gdb-index.cc (Gdb_index_info_reader): Don't complain about language
158         if we have pubnames/pubtypes.
159
160 2014-05-02  Cary Coutant  <ccoutant@google.com>
161
162         * defstd.cc (in_segment): Define __ehdr_start here...
163         * layout.cc (Layout::finalize): ...Instead of here.  Set the
164         output segment when known.
165         * resolve.cc (Symbol::override_base_with_special): Remember
166         the original binding.
167         * symtab.cc (Symbol::set_output_segment): New function.
168         (Symbol::set_undefined): New function.
169         * symtab.h (Symbol::is_weak_undefined): Check original undef
170         binding.
171         (Symbol::is_strong_undefined): New function.
172         (Symbol::set_output_segment): New function.
173         (Symbol::set_undefined): New function.
174         * target-reloc.h (is_strong_undefined): Remove.
175         (issue_undefined_symbol_error): Call Symbol::is_weak_undefined.
176         Check for hidden undefs.
177         (relocate_section): Call Symbol::is_strong_undefined.
178
179         * testsuite/Makefile.am (ehdr_start_test_1)
180         (ehdr_start_test_2, ehdr_start_test_3)
181         (ehdr_start_test_4, ehdr_start_test_5): New test cases.
182         * testsuite/Makefile.in: Regenerate.
183         * testsuite/ehdr_start_def.cc: New source file.
184         * testsuite/ehdr_start_test.cc: New source file.
185         * testsuite/ehdr_start_test.t: New linker script.
186         * testsuite/ehdr_start_test_4.sh: New shell script.
187
188 2014-04-23  Cary Coutant  <ccoutant@google.com>
189
190         PR gold/16870
191         * x86_64.cc (Target_x86_64::Relocate::relocate): Add missing break.
192
193 2014-04-15  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
194
195         * layout.cc (Layout::include_section): Allow a target to decide
196         whether to include a section.
197         * target.h (Target::should_include_section): New function.
198         (Target::do_should_include_section): New function.
199
200 2014-04-15  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
201
202         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Remove and
203         inline into ...
204         (Copy_relocs::emit): ... here.
205         * copy-relocs.h (Copy_reloc_entry): Change from class to struct.
206         (Copy_reloc_entry::make_copy_reloc): Change from private to protected.
207         (Copy_reloc_entry::entries_): Change from private to protected.
208
209 2014-04-02  Sriraman Tallam  <tmsriram@google.com>
210
211         * icf.cc (get_section_contents): Replace copies of reloc
212         vectors with const references.
213
214 2014-04-02  Cary Coutant  <ccoutant@google.com>
215
216         * configure.ac (HAVE_PUBNAMES): Use C instead of C++.
217         (HAVE_NO_USE_LINKER_PLUGIN): Check for -fno-use-linker-plugin.
218         * configure: Regenerate.
219         * testsuite/Makefile.am (OPT_NO_PLUGINS): New macro for
220         -fno-use-linker-plugin.
221         (LINK1, CXXLINK1): Add it to the link command.
222         * testsuite/Makefile.in: Regenerate.
223
224 2014-03-12  Alan Modra  <amodra@gmail.com>
225
226         * Makefile.in: Regenerate.
227
228 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
229
230         * symtab.h (Symbol::set_nonvis): New function.
231
232 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
233
234         * symtab.cc (Sized_symbol<32>::init_output_data):
235         Instantiate the template.
236         (Sized_symbol<64>::init_output_data): Likewise.
237
238 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
239
240         * symtab.cc (Symbol_table::sized_write_globals): Allow a target to
241         adjust dynamic symbol value.
242         * target.h (Target::adjust_dyn_symbol): New function.
243         (Target::do_adjust_dyn_symbol): New function.
244
245 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
246
247         * output.cc (Output_data_dynamic::Dynamic_entry::write):
248         Get the value of DYNAMIC_CUSTOM dynamic entry.
249         * output.h (Output_data_dynamic::add_custom): New function.
250         (Dynamic_entry::Dynamic_entry): New constructor for DYNAMIC_CUSTOM
251         dynamic entry.
252         (enum Dynamic_entry::Classification): Add DYNAMIC_CUSTOM.
253         * target.h (Target::dynamic_tag_custom_value): New function.
254         (Target::do_dynamic_tag_custom_value): New function.
255
256 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
257
258         * symtab.cc (Symbol_table::set_dynsym_indexes): Allow a target to set
259         dynsym indexes.
260         * target.h (Target::has_custom_set_dynsym_indexes): New function.
261         (Target::do_has_custom_set_dynsym_indexes): New function.
262         (Target::set_dynsym_indexes): New function.
263         (Target::do_set_dynsym_indexes): New function.
264
265 2014-03-07  Alan Modra  <amodra@gmail.com>
266
267         * powerpc.cc (Powerpc_relocate_functions::Overflow_check): Add
268         CHECK_UNSIGNED, CHECK_LOW_INSN, CHECK_HIGH_INSN.
269         (Powerpc_relocate_functions::has_overflow_unsigned): New function.
270         (Powerpc_relocate_functions::has_overflow_bitfield,
271         overflowed): Use the above.
272         (Target_powerpc::Relocate::relocate): Correct overflow checking
273         for a number of relocations.  Modify overflow test for 16-bit
274         fields in instructions to signed/unsigned according to whether
275         the field takes a signed or unsigned value.
276
277 2014-03-05  Alan Modra  <amodra@gmail.com>
278
279         Update copyright years.
280
281 2014-03-05  Alan Modra  <amodra@gmail.com>
282
283         * powerpc.cc (Target_powerpc::Scan::local, global): Support
284         R_PPC64_ADDR64_LOCAL.
285         (Target_powerpc::Relocate::relocate): Likewise.
286
287 2014-03-03  Alan Modra  <amodra@gmail.com>
288
289         * dwp.cc (print_version): Update copyright year to current.
290
291 2014-02-10  Alan Modra  <amodra@gmail.com>
292
293         * po/gold.pot: Regenerate.
294
295 2014-02-06  Cary Coutant  <ccoutant@google.com>
296
297         Fix problem where -u is ignored when a weak undef is seen.
298
299         * archive.cc (Library_base::should_include_member): Reorder
300         code to check for -u option if a weak undef has already been seen.
301         * testsuite/Makefile.am (weak_undef_test_2): New test case.
302         * testsuite/Makefile.in: Regenerate.
303         * testsuite/weak_undef_file3.cc: New file.
304         * testsuite/weak_undef_file4.cc: New file.
305         * testsuite/weak_undef_test_2.cc: New file.
306
307 2014-02-05  Cary Coutant  <ccoutant@google.com>
308
309         Fix issues with gold undefined symbol diagnostics.
310
311         PR binutils/15435
312         * errors.cc (Errors::undefined_symbol): Move undef vtable symbol
313         check to here.
314         * target-reloc.h (is_strong_undefined): New function.
315         (relocate_section): Move undef vtable symbol check from here.
316         Check for is_strong_undefined.
317
318 2014-02-05  Cary Coutant  <ccoutant@google.com>
319
320         Fix problems with the --dynamic-list option.
321
322         PR gold/13577
323         * options.cc (General_options::parse_dynamic_list):
324         Set have_dynamic_list_.
325         (General_options::General_options): Initialize have_dynamic_list_.
326         (General_options::finalize): Turn off -Bsymbolic and
327         -Bsymbolic-functions if --dynamic-list provided.
328         * options.h (General_options::have_dynamic_list): New function.
329         (General_options::have_dynamic_list_): New data member.
330         * symtab.h (Symbol::is_preemptible): Handle --dynamic-list
331         correctly.
332
333         PR gold/16530
334         * symtab.cc (Symbol_table::add_from_relobj): If symbol is named
335         in --dynamic-list, mark it.
336
337         * testsuite/Makefile.am (gc_dynamic_list_test.sh): New test case.
338         (dynamic_list_2): New test case.
339         * testsuite/Makefile.in: Regenerate.
340         * testsuite/dynamic_list_2.cc: New file.
341         * testsuite/dynamic_list_2.t: New file.
342         * testsuite/dynamic_list_lib1.cc: New file.
343         * testsuite/dynamic_list_lib2.cc: New file.
344         * testsuite/gc_dynamic_list_test.c: New file.
345         * testsuite/gc_dynamic_list_test.sh: New file.
346         * testsuite/gc_dynamic_list_test.t: New file.
347
348 2014-01-28  Cary Coutant  <ccoutant@google.com>
349
350         Add .gdb_index version 7 support.
351
352         * gold/dwarf_reader.cc: include <utility> (for make_pair).
353         (Dwarf_abbrev_table::do_read_abbrevs): Check for compressed
354         debug sections.
355         (Dwarf_ranges_table::read_ranges_table): Likewise.
356         (Dwarf_pubnames_table::read_section): Check for GNU-style
357         sections, and for compressed debug sections.
358         (Dwarf_pubnames_table::read_header): Compute end address of table.
359         (Dwarf_pubnames_table::next_name): Return flag_byte.  Check
360         for end of list by offset, not by offset == 0.
361         (Dwarf_info_reader::do_read_string_table): Check for compressed
362         debug sections.
363         * gold/dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
364         Initialize new data members.
365         (Dwarf_pubnames_table::next_name): return flag_byte.
366         (Dwarf_pubnames_table::end_of_table_): New data member.
367         (Dwarf_pubnames_table::is_gnu_style_): New data member.
368         * gold/gdb-index.cc (gdb_index_version): Update to version 7.
369         (Gdb_index_info_reader::read_pubtable): Read flag_byte.
370         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Don't
371         read skeleton type unit DIEs.
372         (Gdb_index::add_symbol): Add flag_byte; adjust all callers.
373         (Gdb_index::do_write): Write flag_byte.
374         * gold/gdb-index.h (Gdb_index::add_symbol): Add flags parameter.
375         (Gdb_index::Cu_vector): Store flags along with cu indexes.
376         * gold/testsuite/gdb_index_test_3.sh: Allow versions 4-7.
377         * gold/testsuite/gdb_index_test_comm.sh: Likewise.
378
379 2014-01-08  H.J. Lu  <hongjiu.lu@intel.com>
380
381         * version.cc (print_version): Update copyright year to 2014.
382
383 2013-12-19  Dimitry Andric  <dimitry@andric.com>
384
385         * stringpool.cc (Stringpool_template::reserve): Add
386         HAVE_UNORDERED_MAP case.
387         * stringpool.cc (Stringpool_template::print_stats): Likewise.
388
389 2013-12-18  Cary Coutant  <ccoutant@google.com>
390
391         * configure.ac: Check for <unordered_set> and <unordered_map>.
392         * config.in: Regenerate.
393         * configure: Regenerate.
394         * system.h: Use <unordered_set> and <unordered_map> if available.
395
396 2013-12-10  Roland McGrath  <mcgrathr@google.com>
397
398         * Makefile.am (install-exec-local): Prefix $(INSTALL_PROGRAM) uses
399         with $(INSTALL_PROGRAM_ENV).
400         * Makefile.in: Regenerate.
401
402 2013-11-22  Cary Coutant  <ccoutant@google.com>
403
404         * configure.ac: Add check for which library is needed for
405         dlopen.
406         * configure: Regenerate.
407
408 2013-11-22  Cary Coutant  <ccoutant@google.com>
409
410         * testsuite/Makefile.am (exception_x86_64_bnd_test): Use in-tree
411         assembler.
412         * testsuite/Makefile.in: Regenerate.
413
414 2013-11-17  H.J. Lu  <hongjiu.lu@intel.com>
415
416         * x86_64.cc (Target_x86_64<size>::Scan::get_reference_flags):
417         Handle R_X86_64_PC32_BND and R_X86_64_PLT32_BND just like
418         R_X86_64_PC32 and R_X86_64_PLT32, respectively.
419         (Target_x86_64<size>::Scan::local): Likewise.
420         (Target_x86_64<size>::Scan::global): Likewise.
421         (Target_x86_64<size>::Relocate::relocate): Likewise.
422         (Target_x86_64<size>::Relocatable_size_for_reloc::get_size_for_reloc):
423         Likewise.
424         (Target_x86_64<size>::Scan::check_non_pic(): Handle
425         R_X86_64_PC32_BND.
426
427         * testsuite/Makefile.am (check_PROGRAMS): Add
428         exception_x86_64_bnd_test.
429         (exception_x86_64_bnd_test_SOURCES): New macro.
430         (exception_x86_64_bnd_test_DEPENDENCIES): Likewise.
431         (exception_x86_64_bnd_test_LDFLAGS): Likewise.
432         (exception_x86_64_bnd_test_LDADD): Likewise.
433         (exception_x86_64_bnd_1.o): New rule.
434         (exception_x86_64_bnd_2.o): Likewise.
435         * testsuite/Makefile.in: Regenerated.
436
437 2013-11-15  Alan Modra  <amodra@gmail.com>
438
439         * powerpc.cc (Target_powerpc::glink_section): Provide non-const
440         accessor.
441         (Target_powerpc::Branch_info::make_stub): Make global entry stubs.
442         Only call ppc64_local_entry_offset for 64-bit.  Restrict
443         symval_for_branch lookup to ELFv1.
444         (Stub_table::add_plt_call_entry): Use unsigned int off.
445         (Output_data_glink::Address, invalid_address): New.
446         (Output_data_glink::add_eh_frame): Move out of line.  Add
447         support for ELFv2.
448         (Output_data_glink::add_global_entry, find_global_entry,
449         global_entry_address): New functions.
450         (Output_data_glink::global_entry_stubs_, end_branch_table_,
451         ge_size): New variables.
452         (Output_data_glink::set_final_data_size): Add global entry
453         stub sizing.
454         (Output_data_glink::do_write): Write global entry stubs.
455         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Add target
456         parameter.  Return true for ELFv2.  Adjust callers.
457         (Target_powerpc::Scan::local, global): Restrict opd lookup to
458         ELFv1.  Similarly for ifunc and dynamic relocation processing
459         specific to ELFv1.  Recognize that symbols are defined on
460         their plt entries for ELFv2.
461         (Target_powerpc::symval_for_branch): Assert if called for
462         ELFv2 or ppc32.
463         (Target_powerpc::Relocate::relocate): Use global entry plt
464         stub for symbol value if such exists on ELFv2.
465         (Target_powerpc::Relocate::relocate): Don't call
466         symval_for_branch when ELFv2.  Do adjust for local entry
467         offset when ELFv2.
468         (Target_powerpc::do_dynsym_value): Set symbols to global entry
469         plt stub for ELFv2.
470         (Target_powerpc::do_plt_address_for_global): Similarly.
471
472 2013-11-14  Cary Coutant  <ccoutant@google.com>
473
474         Revert patch -- this did not fix the problem, and there is
475         no race there.
476
477         2013-11-14  Cary Coutant  <ccoutant@google.com>
478
479             PR gold/14860
480             * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
481             (Ehframe_hdr::set_final_data_size): Allocate a Lock.
482             * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
483             updating fde_offsets_.
484             (Eh_frame_hdr::lock_): New data member.
485
486 2013-11-14  Cary Coutant  <ccoutant@google.com>
487
488         * dwp.cc (Dwo_file_entry): New type.
489         (File_list): Use Dwo_file_entry.
490         (Dwo_file::verify): New function.
491         (Dwo_file::verify_dwo_list): New function.
492         (Dwo_file::sized_verify_dwo_list): New function.
493         (Dwo_name_info_reader::visit_compilation_unit): Add dwo_id to file
494         list.
495         (Dwp_options): New enum type.
496         (dwp_options): Add --verify-only.
497         (usage): Likewise.
498         (main): Likewise.
499         * dwp.h (gold_info): Add declaration.
500
501 2013-11-14  Cary Coutant  <ccoutant@google.com>
502
503         PR gold/14860
504         * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
505         (Ehframe_hdr::set_final_data_size): Allocate a Lock.
506         * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
507         updating fde_offsets_.
508         (Eh_frame_hdr::lock_): New data member.
509
510 2013-11-06  Cary Coutant  <ccoutant@google.com>
511
512         PR gold/15758
513         * object.cc (Sized_relobj_file::do_layout): Handle .eh_frame sections
514         before reloc sections.
515
516 2013-11-04  Alan Modra  <amodra@gmail.com>
517
518         * symtab.h (Symbol::Reference_flags): Add FUNC_DESC_ABI.
519         (Symbol::needs_dynamic_reloc): Test new flag.
520         * powerpc.cc (needs_dynamic_reloc, use_plt_offset): Delete.
521         (Target_powerpc::Scan::get_reference_flags): Add target param.
522         Return FUNC_DESC_ABI for 64-bit ELFv1.
523         (Target_powerpc::Branch_info::make_stub): Adjust get_reference_flags
524         call.
525         (Target_powerpc::Scan::global): Use Symbol::needs_dynamic_reloc.
526         (Target_powerpc::Relocate::relocate): Use Symbol::use_plt_offset.
527
528 2013-10-31  Cary Coutant  <ccoutant@google.com>
529
530         Restore support for dwp v2 DWARF package file format.
531
532         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
533         tu_length parameter.  Adjust all callers.
534         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
535         * dwp.cc: Include dwarf.h.
536         (Section_bounds): New struct type.
537         (Unit_set): New struct type.
538         (Dwo_file::Dwo_file): Initialize new data member.
539         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
540         Combine and rename to...
541         (Dwo_file::read_unit_index): ...this.
542         (Dwo_file::sized_read_compunit_index)
543         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
544         (Dwo_file::sized_read_unit_index): ...this.
545         (Dwo_file::copy_section): Remove section_name, is_str_offsets
546         parameters; add section_id parameter.
547         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
548         (Dwo_file::add_unit_set): ...this.
549         (Dwo_file::shndx_map_): Remove.
550         (Dwo_file::sect_offsets_): New data member.
551         (Dwp_output_file::Dwp_output_file): Initialize new data members.
552         (Dwp_output_file::add_section): Rename to...
553         (Dwp_output_file::add_contribution): ...this.
554         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
555         (Dwp_output_file::add_tu_set): Likewise.
556         (Dwp_output_file::Contribution): New type.
557         (Dwp_output_file::Section::contributions): New data member.
558         (Dwp_output_file::Cu_or_tu_set): Remove.
559         (Dwp_output_file::Section::Section): New ctor.
560         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
561         (Dwp_output_file::Dwp_index::Section_table): New type.
562         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
563         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
564         parameter.
565         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
566         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
567         (Dwp_output_file::Dwp_index::section_table): New member function.
568         (Dwp_output_file::Dwp_index::section_table_end): New member function.
569         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
570         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
571         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
572         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
573         (Dwp_output_file::Dwp_index::section_table_): New data member.
574         (Dwp_output_file::Dwp_index::section_mask_): New data member.
575         (Dwp_output_file::add_output_section): New member function.
576         (Dwp_output_file::write_new_section): New member function.
577         (Dwp_output_file::write_contributions): New member function.
578         (Dwp_output_file::section_id_map_): New data member.
579         (class Dwo_id_info_reader): Remove.
580         (class Unit_reader): New class.
581         (get_dwarf_section_name): New function.
582         (Dwo_file::read_executable): Adjust initializations of class data.
583         (Dwo_file::read): Add support for v2 package file format.
584         (Dwo_file::read_unit_index): Likewise.
585         (Dwo_file::sized_read_unit_index): Likewise.
586         (Dwo_file::copy_section): Likewise.
587         (Dwo_file::add_unit_set): Likewise.
588         (Dwp_output_file::add_output_section): Likewise.
589         (Dwp_output_file::add_contribution): Likewise.
590         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
591         for empty slot.
592         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
593         file format.
594         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
595         slot.
596         (Dwp_output_file::initialize): Remove unused function.
597         (Dwp_output_file::finalize): Add support for v2 package file format.
598         (Dwp_output_file::write_index): Likewise.
599         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
600         function prototype.
601
602 2013-10-31  Cary Coutant  <ccoutant@google.com>
603
604         * configure.ac: Fix check for -fmerge-constants.
605         * configure.ac: Regenerate.
606
607 2013-10-30  Roland McGrath  <mcgrathr@google.com>
608
609         * x86_64.cc (Output_data_plt_x86_64_nacl::first_plt_entry):
610         Correct 9-byte nop sequence to match what the assembler generates.
611
612 2013-10-30  Alan Modra  <amodra@gmail.com>
613
614         * powerpc.cc (Powerpc_relobj::abiversion, set_abiversion,
615         ppc64_local_entry_offset, ppc64_local_entry_offset,
616         do_read_symbols): New functions.
617         (Powerpc_relobj::e_flags_, st_other_): New vars.
618         (Powerpc_relobj::Powerpc_relobj): Call set_abiversion.
619         (Powerpc_dynobj::abiversion, set_abiversion): New functions.
620         (Powerpc_relobj::e_flags_): New var.
621         (Target_powerpc::first_plt_entry_offset, plt_entry_size): Inline
622         and adjust for ELFv2.
623         (Target_powerpc::abiversion, set_abiversion, stk_toc): New functions.
624         (Powerpc_relobj::do_find_special_sections): Check no .opd in ELFv2.
625         (Powerpc_dynobj::do_find_special_sections): Likewise.
626         (Target_powerpc::do_define_standard_symbols): Define ".TOC.".
627         (Target_powerpc::Branch_info::make_stub): Adjust stub destination
628         to ELFv2 local entry.
629         (Target_powerpc::do_relax): No thread safe barriers needed for
630         ELFv2.
631         (Output_data_plt_powerpc::initial_plt_entry_size_,
632         plt_entry_size): Delete.  Replace all uses with
633         first_plt_entry_offset() and plt_entry_size().
634         (Output_data_plt_powerpc::Output_data_plt_powerpc): Remove
635         reserved_size parm.  Update callers.
636         (Output_data_plt_powerpc::entry_count): Update.
637         (Output_data_plt_powerpc::first_plt_entry_offset): Make private
638         and use Target_powerpc::first_plt_entry_offset().
639         (Output_data_plt_powerpc::get_plt_entry_size): Similarly and
640         rename to plt_entry_size.
641         (Output_data_plt_powerpc::add_ifunc_entry,
642         add_local_ifunc_entry): Adjust reloc for ELFv2.
643         (glink_eh_frame_fde_64): Rename to glink_eh_frame_fde_64v1.
644         (glink_eh_frame_fde_64v2): New.
645         (Stub_table::plt_call_size): Support ELFv2 sizing.
646         (Output_data_glink::add_eh_frame): Use the new FDE.
647         (Output_data_glink::set_final_data_size): Adjust for ELFv2 glink.
648         (Stub_table::do_write): Write ELFv2 stubs and glink.
649         (Target_powerpc::Relocate::relocate): Replaces nop after call
650         with ld 2,24(1) and adjust local offset destination for ELFv2.
651
652 2013-10-30  Alan Modra  <amodra@gmail.com>
653
654         * powerpc.cc (Target_powerpc::Scan::check_non_pic): Handle new relocs.
655         (Target_powerpc::Scan::global, local): Likewise.
656         (Target_powerpc::Relocate::relocate): Likewise.  Check for overflow
657         on all ppc64 @h and @ha relocs.
658
659 2013-10-14  Alan Modra  <amodra@gmail.com>
660
661         * output.h (Output_data_got::add_constant): Tidy.
662         (Output_data_got::add_constant_pair): New function.
663         * powerpc.cc (Output_data_got_powerpc): Override all Output_data_got
664         methods used so as to first call reserve_ent().
665
666 2013-10-11  Roland McGrath  <mcgrathr@google.com>
667
668         * powerpc.cc (Output_data_got_powerpc): Remove unused methods
669         add_got_entry and add_got_entry_pair.
670
671         * configure.ac (TLS_GNU2_DIALECT): Use -Werror in test.
672         (HAVE_PUBNAMES): Likewise.
673         * configure: Regenerate.
674
675         * testsuite/Makefile.am: Replace '-T foo' with '-Wl,-T,foo' throughout.
676         * testsuite/Makefile.in: Regenerate.
677
678         * target.h (Target::adjust_elf_header, Target::do_adjust_elf_header):
679         Remove const from declaration.
680         * target.cc (Sized_target::do_adjust_elf_header): Update definition.
681         * sparc.cc (Target_sparc::do_adjust_elf_header): Likewise.
682         * output.h (Output_file_header): Remove const from member target_
683         and corresponding constructor argument.
684         * output.cc (Output_file_header::Output_file_header): Update prototype.
685         (Output_file_header::do_sized_write): Use this->target_ in place
686         of parameters()->target().
687
688         * testsuite/undef_symbol.cc (Foo::get_a): New method.
689
690         * configure.ac (MERGE_CONSTANTS_FLAG): New check.
691         * configure: Regenerate.
692         * Makefile.in: Regenerate.
693         * testsuite/merge_string_literals_1.c: Renamed to have .cc suffix.
694         * testsuite/merge_string_literals_2.c: Likewise.
695         * testsuite/Makefile.am
696         (merge_string_literals_1.o, merge_string_literals_2.o): Update deps.
697         (AM_CFLAGS, AM_CXXFLAGS): Use $(MERGE_CONSTANTS_FLAG) in place of
698         literal -fmerge-constants.
699         * testsuite/Makefile.in: Regenerate.
700
701         * i386.cc (Target_i386): Remove unused member dynbss_.
702         * arm.cc (Target_arm): Likewise.
703         * powerpc.cc (Target_powerpc): Likewise.
704         * sparc.cc (Target_sparc): Likewise.
705         * tilegx.cc (Target_tilegx): Likewise.
706         * x86_64.cc (Target_x86_64): Likewise.
707         * dwarf_reader.h (Dwarf_info_reader): Remove unused members
708         type_signature_, type_offset_.
709         * plugin.h (Plugin_hook): Remove unused member layout_.
710         * readsyms.h (Add_symbols): Remove unused members dirpath_, dirindex_,
711         mapfile_.
712         (Read_member): Remove unused members input_objects_, symtab_,
713         mapfile_, layout_.
714         (Check_library): Remove unused member symtab_.
715         * archive.h (Lib_group): Remove unused member lib_.
716         * archive.cc (Lib_group::Lib_group): Update initializer.
717         * incremental.h (Incremental_binary): Remove unused member target_.
718         (Incremental_script_entry): Removed unused member script_.
719         * layout.h (Write_symbols_task): Remove unused member input_objects_.
720         * icf.h (Icf): Remove unused member num_tracked_relocs.
721
722         * gold-threads.h (Once): Conditionalize member was_run_lock_ on
723         [ENABLE_THREADS && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4], matching
724         its only use.
725         * gold-threads.cc (Once::Once): Likewise conditionalize initializer.
726
727         * archive.h: Use struct rather than class for forward declaration
728         of Read_symbols_data.
729
730 2013-10-07  Cary Coutant  <ccoutant@google.com>
731
732         PR gold/16010
733         * testsuite/Makefile.am (icf_test): Fix dependencies.
734         (icf_safe_test): Likewise.
735         (icf_safe_so_test): Likewise.
736         (large_symbol_alignment): Add empty _LDADD rule.
737         * testsuite/Makefile.in: Regenerate.
738
739 2013-09-03  Pavel Chupin  <pavel.v.chupin@intel.com>
740
741         PR gold/15927
742         * x86_64.cc (Target_x86_64<size>::Scan::global): Use relative
743         relocation for R_X86_64_32 on x32.
744
745 2013-08-27  Roland McGrath  <mcgrathr@google.com>
746
747         * output.cc (Output_segment::set_section_addresses): Take new
748         Target* argument.  If target->isolate_execinstr() and the segment
749         is executable and starts at a target->abi_pagesize() boundary,
750         pad its end out to a target->abi_pagesize() boundary with code fill.
751         * output.h (Output_segment::set_section_addresses): Update decl.
752         * layout.h (Layout::check_output_data_for_reset_values): Take new
753         argument RELAX_OUTPUTS.
754         (Layout): New member relax_output_list_.
755         (Layout::add_relax_output): New method.
756         * layout.cc (Layout::Layout): Update constructor.
757         (Layout::reset_relax_output): New method.
758         (Layout::clean_up_after_relaxation): Call it.
759         (Layout::prepare_for_relaxation): Update caller.
760         (Layout::set_segment_offsets): Update callers of set_section_addresses.
761         Call reset_relax_output before re-processing segments for
762         isolate_execinstr case.
763         (Layout::write_data): Handle relax_output_list_.
764         (Layout::Relaxation_debug_check::check_output_data_for_reset_values):
765         Take new argument RELAX_OUTPUTS.  Assert it's an empty collection.
766
767 2013-08-23  Yuri Chornoivan  <yurchor@ukr.net>
768
769         PR binutils/15834
770         * object.h: Fix typos.
771
772 2013-08-16  Roland McGrath  <mcgrathr@google.com>
773
774         * i386.cc (Target_i386_nacl::do_code_fill): New virtual function.
775         * x86_64.cc (Target_x86_64_nacl::do_code_fill): New virtual function.
776
777 2013-08-07  Cary Coutant  <ccoutant@google.com>
778
779         Revert support for v2 DWP files:
780
781         2013-03-01  Cary Coutant  <ccoutant@google.com>
782
783             Add dwp support for v2 DWARF package file format.
784             * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
785             tu_length parameter.  Adjust all callers.
786             * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
787             * dwp.cc: Include dwarf.h.
788             (Section_bounds): New struct type.
789             (Unit_set): New struct type.
790             (Dwo_file::Dwo_file): Initialize new data member.
791             (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
792             Combine and rename to...
793             (Dwo_file::read_unit_index): ...this.
794             (Dwo_file::sized_read_compunit_index)
795             (Dwo_file::sized_read_typeunit_index): Combine and rename to...
796             (Dwo_file::sized_read_unit_index): ...this.
797             (Dwo_file::copy_section): Remove section_name, is_str_offsets
798             parameters; add section_id parameter.
799             (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
800             (Dwo_file::add_unit_set): ...this.
801             (Dwo_file::shndx_map_): Remove.
802             (Dwo_file::sect_offsets_): New data member.
803             (Dwp_output_file::Dwp_output_file): Initialize new data members.
804             (Dwp_output_file::add_section): Rename to...
805             (Dwp_output_file::add_contribution): ...this.
806             (Dwp_output_file::add_cu_set): Combine parameters into a struct.
807             (Dwp_output_file::add_tu_set): Likewise.
808             (Dwp_output_file::Contribution): New type.
809             (Dwp_output_file::Section::contributions): New data member.
810             (Dwp_output_file::Cu_or_tu_set): Remove.
811             (Dwp_output_file::Section::Section): New ctor.
812             (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
813             (Dwp_output_file::Dwp_index::Section_table): New type.
814             (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
815             (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
816             parameter.
817             (Dwp_output_file::Dwp_index::shndx_pool): Remove.
818             (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
819             (Dwp_output_file::Dwp_index::section_table): New member function.
820             (Dwp_output_file::Dwp_index::section_table_end): New member function.
821             (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
822             (Dwp_output_file::Dwp_index::section_table_rows): New member function.
823             (Dwp_output_file::Dwp_index::section_table_cols): New member function.
824             (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
825             (Dwp_output_file::Dwp_index::section_table_): New data member.
826             (Dwp_output_file::Dwp_index::section_mask_): New data member.
827             (Dwp_output_file::add_output_section): New member function.
828             (Dwp_output_file::write_new_section): New member function.
829             (Dwp_output_file::write_contributions): New member function.
830             (Dwp_output_file::section_id_map_): New data member.
831             (class Dwo_id_info_reader): Remove.
832             (class Unit_reader): New class.
833             (get_dwarf_section_name): New function.
834             (Dwo_file::read_executable): Adjust initializations of class data.
835             (Dwo_file::read): Add support for v2 package file format.
836             (Dwo_file::read_unit_index): Likewise.
837             (Dwo_file::sized_read_unit_index): Likewise.
838             (Dwo_file::copy_section): Likewise.
839             (Dwo_file::add_unit_set): Likewise.
840             (Dwp_output_file::add_output_section): Likewise.
841             (Dwp_output_file::add_contribution): Likewise.
842             (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
843             for empty slot.
844             (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
845             file format.
846             (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
847             slot.
848             (Dwp_output_file::initialize): Remove unused function.
849             (Dwp_output_file::finalize): Add support for v2 package file format.
850             (Dwp_output_file::write_index): Likewise.
851             * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
852             function prototype.
853
854 2013-07-31  Cary Coutant  <ccoutant@google.com>
855
856         * object.cc (Sized_relobj::do_output_section_address): New function.
857         (Sized_relobj): Instantiate explicitly.
858         * object.h (Object::output_section_address): New function.
859         (Object::do_output_section_address): New function.
860         (Sized_relobj::do_output_section_address): New function.
861         * powerpc.cc (Target_powerpc::symval_for_branch): Use it.
862
863 2013-07-30  Cary Coutant  <ccoutant@google.com>
864             Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
865
866         * parameters.cc (Parameters::entry): Return target-specific entry
867         symbol name.
868         * target.h (Target::entry_symbol_name): New function.
869         (Target_info::entry_symbol_name): New data member.
870
871         * arm.cc (Target_arm::arm_info): Add entry_symbol_name.
872         * i386.cc (Target_i386::i386_info): Likewise.
873         (Target_i386_nacl::i386_nacl_info): Likewise.
874         * sparc.cc (Target_sparc::sparc_info): Likewise.
875         * tilegx.cc (Target_tilegx::tilegx_info): Likewise.
876         * x86_64.cc: (Target_x86_64::x86_64_info) Likewise.
877         (Target_x86_64_nacl::x86_64_nacl_info) Likewise.
878         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
879
880 2013-07-22  Sterling Augustine  <saugustine@google.com>
881
882         * dwarf_reader.cc (Dwarf_pubnames_table::read_section):
883         Convert parameter shndx to local variable. Add parameters symtab
884         and symtab_size.  Scan over section names.  Find relocation
885         section corresponding to current section.  Create and initialize
886         reloc_mapper_ and reloc_type_.
887         (Dwarf_pubnames_table::read_header):  Add assertion.  Change
888         unit_length to off_t.  Initialize member unit_length_.  Fill in field
889         cu_offset_.
890         * dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
891         Initialize new fields unit_length_ and cu_offset_.
892         (Dwarf_pubnames_table::read_section): Update prototype.
893         (Dwarf_pubnames_table::cu_offset): New member function.
894         (Dwarf_pubnames_table::subsection_size): Likewise.
895         (Dwarf_pubnames_table::cu_offset_, Dwarf_pubnames_table::unit_length):
896         New fields.
897         (Dwarf_info_reader::symtab, Dwarf_info_reader::symtab_size): Make
898         member functions public.
899         * gdb_index.cc (Gdb_index_info_reader::read_pubnames_and_pubtypes):
900         Update comment.  Rework logic.  Move repeated parts to...
901         (Gdb_index_info_reader::read_pubtable): ...here. New function.
902         (Gdb_index::Gdb_index): Initialize new fields, pubnames_table_,
903         pubtypes_table_, and stmt_list_offset.
904         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
905         Gdb_index::find_pubtype_offset,
906         Gdb_index::map_pubnames_and_types_to_dies): Define new functions.
907         (Gdb_index::pubnames_read): Update prototype and rework logic.
908         * gdb_index.h (Gdb_index_info_reader, Dwarf_pubnames_table):
909         Forward declare.
910         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
911         Gdb_index::find_pubtype_offset, Gdb_index::pubnames_table)
912         Gdb_index::pubtypes_table, Gdb_index::map_pubnames_and_types_to_dies,
913         Gdb_index::map_pubtable_to_dies):
914         Declare functions.
915         (Gdb_index::pubnames_read): Update declaration.
916         (Gdb_index::Pubname_offset_map): New type.
917         (Gdb_index::cu_pubname_map_, Gdb_index::cu_pubtype_map_,
918         Gdb_index::pubnames_table_, Gdb_index::pubtypes_table_,
919         Gdb_index::stmt_list_offset): Declare.
920         (Gdb_index::pubnames_shndx_, Gdb_index::pubnames_offet_,
921         Gdb_index::pubtypes_object_, Gdb_index::pubtypes_shndx_)
922         Gdb_index::pubtypes_offset_): Remove.
923
924 2013-07-19  Roland McGrath  <mcgrathr@google.com>
925
926         * options.h (General_options): Add -Trodata-segment option.
927         * parameters.cc (Parameters::check_rodata_segment): New function.
928         (Parameters::set_target_once): Call it.
929         * parameters.h (Parameters): Declare it (private member function).
930         * layout.cc (load_seg_unusable_for_headers): New function, broken
931         out of Layout::relaxation_loop_body.  If TARGET->isolate_execinstr()
932         then validate rodata segment rather than text segment.
933         (relaxation_loop_body): Call that.
934         (is_text_segment): New function.  Don't admit a non-executable
935         segment if TARGET->isolate_execinstr().
936         (set_segment_offsets): Call it.  Honor -Trodata-segment option.
937
938 2013-07-15  Shawn Landden  <shawnlandden@gmail.com>
939
940         PR gold/15070
941         * fileread.h (File_read::get_view): Clarify comment about ALIGNED.
942         * nacl.h (Sniff_file::View::View): Request aligned view.
943
944 2013-07-11  Cary Coutant  <ccoutant@google.com>
945
946         * powerpc.cc (Target_powerpc::write_branch_lookup_table): Use
947         correct BRLT entry size.
948
949 2013-07-03  Alan Modra  <amodra@gmail.com>
950
951         * powerpc.cc (Target_powerpc::Relocate::relocate): Update self-call
952         comment.
953
954 2013-07-01  Cary Coutant  <ccoutant@google.com>
955
956         * dwarf_reader.cc (Dwarf_ranges_table::read_ranges_table): Save
957         reloc_type_.
958         (Dwarf_ranges_table::read_range_list): Call lookup_reloc.
959         (Dwarf_ranges_table::lookup_reloc): New function.
960         * dwarf_reader.h (Dwarf_ranges_table::Dwarf_ranges_table): Initialize
961         reloc_type_.
962         (Dwarf_ranges_table::lookup_reloc): New function.
963         (Dwarf_ranges_table::reloc_type_): New data member.
964
965 2013-06-27  Jing Yu  <jingyu@google.com>
966
967         PR gold/15662
968         * powerpc.cc (Output_data_brlt_powerpc::reset_brlt_sizes): New
969         function.
970         (Output_data_brlt_powerpc::finalize_brlt_sizes): New function.
971         (Target_powerpc::do_relax): Call the above.
972
973 2013-06-27  Cary Coutant  <ccoutant@google.com>
974
975         * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
976         on garbage collected .opd section.
977
978 2013-06-27  Alan Modra  <amodra@gmail.com>
979
980         * powerpc.cc (Target_powerpc::do_gc_add_reference): Test dst_shndx
981         is non-zero.
982         (Target_powerpc::do_gc_mark_symbols): Likewise for sym->shndx().
983         (Target_powerpc::do_function_location): Likewise for loc->shndx.
984
985 2013-06-14  Cary Coutant  <ccoutant@google.com>
986
987         * resolve.cc (Symbol::override_base): Don't override st_type
988         from plugin placeholder symbols.
989         (Symbol_table::resolve): Likewise.
990         (Symbol_table::should_override): Don't complain about TLS mismatch
991         if the TO symbol is a plugin placeholder.
992         * testsuite/Makefile.am (plugin_test_tls): New test.
993         * testsuite/Makefile.in: Regenerate.
994         * testsuite/plugin_test_tls.sh: New test script.
995         * testsuite/two_file_test_2_tls.cc: New test source.
996         * testsuite/two_file_test_tls.cc: New test source.
997
998 2013-06-05  Alexander Ivchenko  <alexander.ivchenko@intel.com>
999
1000         * layout.cc (Layout::set_segment_offsets): Taking care of the case when
1001         the maximum segment alignment is larger than the page size.
1002         * testsuite/Makefile.am (large_symbol_alignment): Test that Gold
1003         correctly aligns the symbols with large alignemnt.
1004         * testsuite/Makefile.in: Regenerate.
1005         * testsuite/large_symbol_alignment.cc: New file.
1006
1007 2013-05-30  Alexander Ivchenko  <alexander.ivchenko@intel.com>
1008             Sriraman Tallam  <tmsriram@google.com>
1009
1010         * options.h (sort_section): New option.
1011         * output.h (Input_section_sort_section_prefix_special_ordering_compare):
1012         Rename from Input_section_sort_section_name_special_ordering_compare.
1013         (Input_section_sort_section_name_compare): New struct.
1014         * output.cc (Output_section::Input_section_sort_section_name_compare::
1015         operator()): New function.
1016         (Output_section::sort_attached_input_sections): Use new sort function
1017         for .text if --sort-section=name is specified.
1018         * layout.cc (Layout::make_output_section):
1019         Add sorting by name when --sort-section=name is specified.
1020         * testsuite/Makefile.am (text_section_grouping): Test option
1021         --sort-section=name.
1022         * testsuite/Makefile.in: Regenerate.
1023         * testsuite/section_sorting_name.cc: New file.
1024         * testsuite/section_sorting_name.sh: New file.
1025
1026 2013-05-21  Cary Coutant  <ccoutant@google.com>
1027
1028         * symtab.h (Symbol::is_cxx_vtable): New function.
1029         * target-reloc.h (relocate_section): Check for vtable symbol.
1030         * testsuite/Makefile.am (missing_key_func.sh): New test case.
1031         * testsuite/Makefile.in: Regenerate.
1032         * testsuite/missing_key_func.cc: New test source.
1033         * testsuite/missing_key_func.sh: New test script.
1034
1035 2013-05-21  Cary Coutant  <ccoutant@google.com>
1036
1037         * object.cc (Sized_relobj_file::get_symbol_location_info): Set
1038         type of enclosing symbol.
1039         (Relocate_info::location): Check symbol type when describing symbol.
1040         * object.h (Symbol_location_info): Remove unused line_number;
1041         add enclosing_symbol_type.
1042         * testsuite/debug_msg.sh: Adjust expected output.
1043
1044 2013-05-13  Cary Coutant  <ccoutant@google.com>
1045
1046         * configure.ac: Export DEFAULT_TARGET.
1047         * configure: Regenerate.
1048         * Makefile.in: Regenerate.
1049         * testsuite/Makefile.am: Add .EXPORT_ALL_VARIABLES.
1050         * testsuite/Makefile.in: Regenerate.
1051         * testsuite/debug_msg.sh: Delete duplicate tests.
1052         Don't check undef_int error message match for powerpc where the
1053         source file and line number aren't available.
1054
1055 2013-05-10  Roland McGrath  <mcgrathr@google.com>
1056
1057         * options.h (General_options): Add --rosegment-gap option.
1058         * options.cc (finalize): --rosegment-gap implies --rosegment.
1059         * layout.cc (set_segment_offsets): Let user option override
1060         target->rosegment_gap().
1061
1062 2013-05-10  Roland McGrath  <mcgrathr@google.com>
1063
1064         * options.h (General_options): Remove leading space from help
1065         messages for -nostdlib and --rosegment.
1066
1067 2013-05-03  Maciej W. Rozycki  <macro@codesourcery.com>
1068
1069         PR ld/15365
1070         * layout.cc (Layout::finalize): Make __ehdr_start STV_HIDDEN.
1071
1072 2013-05-03  Alan Modra  <amodra@gmail.com>
1073
1074         * merge.cc (Output_merge_string::do_add_input_section): Correct
1075         scan for number of strings.  Rename vars to avoid shadowing.
1076         Include missing terminator in input_size_.
1077
1078 2013-05-01  H.J. Lu  <hongjiu.lu@intel.com>
1079
1080         * merge.cc (Output_merge_string<Char_type>::do_add_input_section):
1081         Restore empty string handling.
1082
1083 2013-05-01  Cary Coutant  <ccoutant@google.com>
1084
1085         * stringpool.cc (Stringpool_template::new_key_offset): Fix
1086         uninitialized warning.
1087
1088 2013-04-29  Alexander Ivchenko  <alexander.ivchenko@intel.com>
1089
1090         * output.cc (Output_section::add_merge_input_section): Allow
1091         to merge sections if the alignment is more than character size.
1092         * merge.h (Output_merge_string::Output_merge_string): Remove
1093         assert.
1094         * merge.cc (Output_merge_string<Char_type>::do_add_input_section): Count
1095         only not-null strings. Check the alignment of strings.
1096         * stringpool.h
1097         (Stringpool_template<Stringpool_char>::Stringpool_template): Add
1098         alignment as the argument.
1099         (Stringpool_template<Stringpool_char>::addralign_): New class member.
1100         * stringpool.cc (Stringpool_template<Stringpool_char>::new_key_offset):
1101         Align non-zero length strings according to the addralign_.
1102         (Stringpool_template<Stringpool_char>::set_string_offsets):
1103         Updating offsets according to the given alignment.
1104         * testsuite/Makefile.am (text_section_grouping): Test if string
1105         literals are getting merged.
1106         * testsuite/Makefile.in: Regenerate.
1107         * testsuite/merge_string_literals_1.c: New file.
1108         * testsuite/merge_string_literals_2.c: Ditto.
1109         * testsuite/merge_string_literals.sh: Ditto.
1110
1111 2013-04-26  Ian Lance Taylor  <iant@google.com>
1112
1113         * target-reloc.h (relocate_section): If the reloc offset is out of
1114         range, pass VIEW as NULL to relocate.relocate.
1115         * arm.cc (Target_arm:Relocate::relocate): Check for a NULL view.
1116         * i386.cc (Target_i386::Relocate::relocate): Likewise.
1117         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
1118         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
1119         * tilegx.cc (Target_tilegx::Relocate::relocate): Likewise.
1120         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
1121
1122 2013-04-26  Geoff Pike  <gpike@chromium.org>
1123
1124         * gold.cc (queue_final_tasks): invoke layout->queue_build_id_tasks().
1125         * layout.cc (Hash_task): New class.
1126         (Layout::queue_build_id_tasks): New function.
1127         (Layout::write_build_id): Handle single-thread portion of build ID
1128         computation.  (In some cases, all of it is single-threaded.)  Replace
1129         {sha1,md5}_process_bytes with {sha1,md5}_buffer to get the same
1130         functionality in fewer lines of code.
1131         * layout.h (Layout::queue_build_id_tasks): New function declaration.
1132         * options.h (General_options): make "--build-id" default to tree
1133         rather than sha1.  Add two new options related to --build-id=tree:
1134         --build-id-chunk-size-for-treehash and
1135         --build-id-min-file-size-for-treehash.
1136         * Makefile.am: add testing of --build-id=tree and related new options
1137         (these tests will be invoked by "make check").
1138         * Makefile.in: Regenerate.
1139
1140 2013-04-25  Alan Modra  <amodra@gmail.com>
1141
1142         * configure.tgt: Add powerpcle and powerpc64le.
1143
1144 2013-04-22  Alan Modra  <amodra@gmail.com>
1145
1146         PR gold/15355
1147         * layout.cc (Layout::segment_precedes): Allow more than one
1148         segment with the same type and flags.
1149
1150 2013-04-15  Cary Coutant  <ccoutant@google.com>
1151
1152         * layout.cc (Layout::set_relocatable_section_offsets): Don't
1153         allocate space in file for BSS sections.
1154
1155 2013-04-15  Cary Coutant  <ccoutant@google.com>
1156
1157         * script-sections.cc (Orphan_output_section): Reset address
1158         to zero after each orphaned section for relocatable links.
1159
1160 2013-04-15  Cary Coutant  <ccoutant@google.com>
1161
1162         * symtab.cc (Symbol_table::sized_write_globals): Subtract
1163         section starting address for relocatable link.
1164         * testsuite/Makefile.am (script_test_11): New test.
1165         * testsuite/Makefile.in: Regenerate.
1166         * testsuite/script_test_11.c: New source file.
1167         * testsuite/script_test_11.t: New linker script.
1168
1169 2013-04-13  Alan Modra  <amodra@gmail.com>
1170
1171         * powerpc.cc (Stub_control::can_add_to_stub_group): Don't set
1172         owner when sections are not adjacent and exceed group size.
1173         (Target_powerpc::group_sections): Handle corner case.
1174         (Target_powerpc::Branch_info::make_stub): Handle case where
1175         stub table doesn't exist due to branches in non-exec sections.
1176         (Target_powerpc::Relocate::relocate): Likewise.
1177
1178 2013-04-11  Alan Modra  <amodra@gmail.com>
1179
1180         PR gold/15354
1181         * powerpc.cc (Target_powerpc::make_brlt_section): Name section
1182         .branch_lt to match bfd ld.  Adjust comments throughout file.
1183
1184 2013-04-04  Ian Lance Taylor  <iant@google.com>
1185
1186         GCC PR c++/56840
1187         * object.cc (do_layout_deferred_sections): Handle .eh_frame
1188         sections before checking whether they are included in the link.
1189
1190 2013-03-29  Sriraman Tallam  <tmsriram@google.com>
1191
1192         * archive.cc (Archive::get_elf_object_for_member):  Create the elf
1193         object before calling the plugin claim_file handler.  Pass the elf
1194         object of the archive to the plugin. Delete the elf object if the
1195         plugin claims the file.
1196
1197 2013-03-21  Alan Modra  <amodra@gmail.com>
1198
1199         * layout.cc (Layout::set_segment_offsets): Accept writable .text
1200         segment when omagic.
1201
1202 2013-03-21  Alan Modra  <amodra@gmail.com>
1203
1204         * dwp.cc (Dwp_output_file::add_contribution): Avoid signed/unsigned
1205         comparison warning.
1206         * layout.cc (Layout::create_dynamic_symtab): Avoid "may be used
1207         uninitialized" warning.
1208
1209 2013-03-20  Alan Modra  <amodra@gmail.com>
1210
1211         * symtab.h (Symbol::clear_version): New function.
1212         * symtab.cc (Symbol_table::set_dynsym_indexes): Don't set object
1213         is_needed by weak references.  Clear version for symbols defined
1214         in as-needed objects that are not needed.
1215
1216 2013-03-15  Alan Modra  <amodra@gmail.com>
1217
1218         * powerpc.cc (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Make
1219         static and public.  Add report_err param.  Return false for data refs.
1220         (Target_powerpc::rela_dyn_section): New overloaded function.
1221         (Target_powerpc::plt_, iplt_): Elucidate.
1222         (Output_data_plt_powerpc::entry_count): Handle current_data_size()==0.
1223         (Output_data_plt_powerpc::do_write): Don't write .iplt.
1224         (Output_data_plt_powerpc::plt_entry_count): Don't add .iplt entries.
1225         (Target_powerpc::Scan::local, global): Adjust reloc_needs_plt_for_ifunc
1226         calls.  Put ifunc dynamic relocs in irela_dyn_section.  Only
1227         push_branch and make_plt_entry for ifunc syms when
1228         reloc_needs_plt_for_ifunc.
1229         (Target_powerpc::Relocate::relocate): Don't use plt entry value
1230         for ifunc unless reloc_needs_plt_for_ifunc.
1231
1232 2013-03-15  Alan Modra  <amodra@gmail.com>
1233
1234         * gc.h (gc_process_relocs): Don't look through function descriptors.
1235         * icf.cc (get_section_contents): Do so here instead.
1236
1237 2013-03-13  Alan Modra  <amodra@gmail.com>
1238
1239         * powerpc.cc (is_branch_reloc): Forward declare.
1240         (Target_powerpc::do_can_check_for_function_pointers): New predicate.
1241         (Target_powerpc::Scan::local_reloc_may_be_function_pointer): Return
1242         false for 64-bit, true for 32-bit non-branch relocs.
1243         (Target_powerpc::Scan::global_reloc_may_be_function_pointer): Likewise.
1244         * testsuite/Makefile.am (icf_test): Use linker map file instead of
1245         nm output.
1246         (icf_safe_test): Generate linker map file as well as nm output.
1247         (icf_safe_so_test): Likewise.
1248         * testsuite/Makefile.in: Regenerate.
1249         * testsuite/icf_test.sh: Parse linker map file to determine
1250         section folding.
1251         * testsuite/icf_safe_test.sh: Likewise.  Expect folding for PowerPC.
1252         * testsuite/icf_safe_so_test.sh: Likewise.
1253         (X86_32_or_ARM_specific_safe_fold): Merge into..
1254         (arch_specific_safe_fold): ..this.
1255         (X86_64_specific_safe_fold): Delete unused function.
1256
1257 2013-03-12  Alan Modra  <amodra@gmail.com>
1258
1259         * gc.h (gc_process_relocs): Look through function descriptors
1260         to determine shndx, symvalue and addend used by ICF.  Tidy
1261         variable duplication.
1262
1263 2013-03-11  Alan Modra  <amodra@gmail.com>
1264
1265         * gold.cc (queue_middle_tasks): Move detect_odr_violations..
1266         * layout.cc (Layout_task_runner::run): ..to here.
1267         * symtab.h (struct Symbol_location): Extract from..
1268         (class Symbol_table): ..here.
1269         * symtab.cc (Symbol_table::linenos_from_loc): Invoke function_location.
1270         * target.h (class Target): Add function_location and
1271         do_function_location functions.
1272         (class Sized_target): Add do_function_location.
1273         * object.h (class Sized_relobj_file): Move find_shdr..
1274         (class Object): ..to here.
1275         * object.cc: Likewise.  Update to suit.  Instantiate.
1276         (Sized_relobj_file::find_eh_frame): Update find_shdr call.
1277         * powerpc.cc (class Powerpc_dynobj): New.
1278         (Target_powerpc::do_function_location): New function.
1279         (Powerpc_relobj::do_find_special_sections): Update find_shdr call.
1280         (Powerpc_dynobj::do_read_symbols): New function.
1281         (Target_powerpc::do_make_elf_object): Make a Powerpc_dynobj.
1282
1283 2013-03-08  Ian Lance Taylor  <iant@google.com>
1284
1285         * options.cc (General_options::string_to_object_format): Accept
1286         "default".
1287
1288 2013-03-08  Alan Modra  <amodra@gmail.com>
1289
1290         * ehframe.h (Post_fdes) Make it a vector of Post_fde rather than
1291         pointer to Post_fde.
1292         (struct Post_fde): Move definition to here..
1293         * ehframe.cc (struct Post_fde): ..from here.
1294         (Cie::write): Don't alloc Post_fde.
1295         (Eh_frame::do_sized_write): Update.  Don't free Post_fde.
1296
1297 2013-03-07  Alan Modra  <amodra@gmail.com>
1298
1299         * testsuite/discard_locals_relocatable_test.c: Add a powerpc
1300         relocation referencing .LC0.
1301         * testsuite/discard_locals_test.sh: Remove FIXMEs.
1302
1303 2013-03-07  Alan Modra  <amodra@gmail.com>
1304
1305         * testsuite/ifunc-sel.h (ifunc_sel, ifunc_one): Mark
1306         always_inline.  Add assembly for powerpc to avoid GOT.
1307
1308 2013-03-07  Alan Modra  <amodra@gmail.com>
1309
1310         * testsuite/script_test_10.sh: Don't test .bss section
1311         header number.
1312
1313 2013-03-06  Alan Modra  <amodra@gmail.com>
1314
1315         * powerpc.cc (class Powerpc_relobj): Move some member functions.
1316         (Target_powerpc::symval_for_branch):  Add symtab param.  Update
1317         all callers.  Handle folded sections.
1318         (Target_powerpc::do_gc_add_reference): Don't cast dynamic object
1319         to Powerpc_relobj.
1320         (Global_symbol_visitor_opd::operator()): Likewise.
1321
1322 2013-03-04  Alan Modra  <amodra@gmail.com>
1323
1324         * testsuite/Makefile.am (final_layout_script.lds): Add .sbss.
1325         * testsuite/Makefile.in: Regenerate.
1326
1327 2013-03-01  Cary Coutant  <ccoutant@google.com>
1328
1329         Add dwp support for v2 DWARF package file format.
1330         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
1331         tu_length parameter.  Adjust all callers.
1332         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
1333         * dwp.cc: Include dwarf.h.
1334         (Section_bounds): New struct type.
1335         (Unit_set): New struct type.
1336         (Dwo_file::Dwo_file): Initialize new data member.
1337         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
1338         Combine and rename to...
1339         (Dwo_file::read_unit_index): ...this.
1340         (Dwo_file::sized_read_compunit_index)
1341         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
1342         (Dwo_file::sized_read_unit_index): ...this.
1343         (Dwo_file::copy_section): Remove section_name, is_str_offsets
1344         parameters; add section_id parameter.
1345         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
1346         (Dwo_file::add_unit_set): ...this.
1347         (Dwo_file::shndx_map_): Remove.
1348         (Dwo_file::sect_offsets_): New data member.
1349         (Dwp_output_file::Dwp_output_file): Initialize new data members.
1350         (Dwp_output_file::add_section): Rename to...
1351         (Dwp_output_file::add_contribution): ...this.
1352         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
1353         (Dwp_output_file::add_tu_set): Likewise.
1354         (Dwp_output_file::Contribution): New type.
1355         (Dwp_output_file::Section::contributions): New data member.
1356         (Dwp_output_file::Cu_or_tu_set): Remove.
1357         (Dwp_output_file::Section::Section): New ctor.
1358         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
1359         (Dwp_output_file::Dwp_index::Section_table): New type.
1360         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
1361         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
1362         parameter.
1363         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
1364         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
1365         (Dwp_output_file::Dwp_index::section_table): New member function.
1366         (Dwp_output_file::Dwp_index::section_table_end): New member function.
1367         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
1368         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
1369         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
1370         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
1371         (Dwp_output_file::Dwp_index::section_table_): New data member.
1372         (Dwp_output_file::Dwp_index::section_mask_): New data member.
1373         (Dwp_output_file::add_output_section): New member function.
1374         (Dwp_output_file::write_new_section): New member function.
1375         (Dwp_output_file::write_contributions): New member function.
1376         (Dwp_output_file::section_id_map_): New data member.
1377         (class Dwo_id_info_reader): Remove.
1378         (class Unit_reader): New class.
1379         (get_dwarf_section_name): New function.
1380         (Dwo_file::read_executable): Adjust initializations of class data.
1381         (Dwo_file::read): Add support for v2 package file format.
1382         (Dwo_file::read_unit_index): Likewise.
1383         (Dwo_file::sized_read_unit_index): Likewise.
1384         (Dwo_file::copy_section): Likewise.
1385         (Dwo_file::add_unit_set): Likewise.
1386         (Dwp_output_file::add_output_section): Likewise.
1387         (Dwp_output_file::add_contribution): Likewise.
1388         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
1389         for empty slot.
1390         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
1391         file format.
1392         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
1393         slot.
1394         (Dwp_output_file::initialize): Remove unused function.
1395         (Dwp_output_file::finalize): Add support for v2 package file format.
1396         (Dwp_output_file::write_index): Likewise.
1397         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
1398         function prototype.
1399
1400 2013-03-01  Cary Coutant  <ccoutant@google.com>
1401
1402         * dwarf_reader.cc (Dwarf_info_reader::check_buffer): Move
1403         function into class definition in header file.
1404         (Dwarf_info_reader::warn_corrupt_debug_section): New function.
1405         * dwarf_reader.h (Dwarf_info_reader::warn_corrupt_debug_section):
1406         New function.
1407         (Dwarf_info_reader::check_buffer): Move here from .cc file.
1408
1409 2013-02-28  Alan Modra  <amodra@gmail.com>
1410
1411         * target.h (Target::plt_fde_location, do_plt_fde_location): Declare.
1412         * target.cc (Target::do_plt_fde_location): New function.
1413         * ehframe.h (class FDE): Add post_map field to u_.from_linker,
1414         accessor function, and constructor param.
1415         (struct Post_fde, Post_fdes): Declare.
1416         (Cie::write): Add post_fdes param.
1417         * ehframe.cc (Fde::write): Use plt_fde_location.
1418         (struct Post_fde): Define.
1419         (Cie::write): Stash FDEs added post merge mapping.
1420         (Eh_frame::add_ehframe_for_plt): Assert no new CIEs after mapping.
1421         Adjust Fde constructor call.  Bump final_data_size_ for post map FDEs.
1422         (Eh_frame::do_sized_write): Arrange to write post map FDES after
1423         other FDEs.
1424         * powerpc.cc (Target_powerpc::do_plt_fde_location): New function.
1425         (Target_powerpc::has_glink): New function.
1426         (Target_powerpc::do_relax): Add eh_frame info for stubs.
1427         (struct Eh_cie, eh_frame_cie, glink_eh_frame_fde_64,
1428         glink_eh_frame_fde_32, default_fde): New data.
1429         (Stub_table::eh_frame_added_): New var.
1430         (Stub_table::find_long_branch_entry, stub_address, stub_offset):
1431         Make const.
1432         (Stub_table::add_eh_frame): New function.
1433         (Output_data_glink::add_eh_frame): New function.
1434         (Target_powerpc::make_glink_section): Call add_eh_frame.
1435
1436 2013-02-15  Ian Lance Taylor  <iant@google.com>
1437
1438         * options.h (DEFINE_uint64_alias): Define.
1439         (class General_options): Add -Ttext-segment as an alias for
1440         -Ttext.
1441
1442 2013-02-15  Alan Modra  <amodra@gmail.com>
1443
1444         * powerpc.cc (Stub_table::plt_off): New function, extracted from..
1445         (Stub_table::do_write): ..here, two places.
1446         (Stub_table::plt_call_size): Use it here too.
1447
1448 2013-02-11  Ian Lance Taylor  <iant@google.com>
1449
1450         * descriptors.cc (Descriptors::close_all): New function.
1451         * descriptors.h (class Descriptors): Declare close_all.
1452         (close_all_descriptors): New inline function.
1453         * plugin.cc: Include "descriptors.h".
1454         (Plugin_manager::cleanup): Call close_all_descriptors.
1455
1456 2013-02-06  Alan Modra  <amodra@gmail.com>
1457
1458         * README: Update coding style link.
1459
1460 2013-01-28  Cary Coutant  <ccoutant@google.com>
1461
1462         * dwp.cc (File_list): New typedef.
1463         (Dwo_name_info_reader): New class.
1464         (Dwo_id_info_reader::Dwo_id_info_reader): Remove unused parameters.
1465         (Dwo_id_info_reader::visit_top_die): Remove unused member function.
1466         (Dwo_file::~Dwo_file): Delete input_file_ after obj_.
1467         (Dwo_file::read_executable): New function.
1468         (Dwo_file::read): Move common setup code to ...
1469         (Dwo_file::make_object): ... here.
1470         (dwp_options): Add --exec/-e.
1471         (usage): Likewise.
1472         (main): Likewise.
1473
1474 2013-01-24  Sriraman Tallam  <tmsriram@google.com>
1475
1476         * layout.cc (Layout::layout): Check for option text_reorder.
1477         (Layout::make_output_section): Ditto.
1478         * options.h (text_reorder): New option.
1479         * output.cc (Input_section_sort_compare): Remove special ordering
1480         of section names.
1481         (Output_section::
1482          Input_section_sort_section_name_special_ordering_compare::
1483          operator()): New function.
1484         (Output_section::sort_attached_input_sections): Use new sort function
1485         for .text.
1486         * output.h (Input_section_sort_section_name_special_ordering_compare):
1487         New struct.
1488         * testsuite/Makefile.am (text_section_grouping): Test option
1489         --no-text-reorder
1490         * testsuite/Makefile.in: Regenerate.
1491         * testsuite/text_section_grouping.sh: Check order of functions without
1492         default text reordering.
1493
1494 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
1495
1496         * options.h (General_options): Change default to true for new_dtags.
1497
1498 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
1499
1500         * layout.cc (Layout::finish_dynamic_section): Only add DT_RPATH
1501         when enable_new_dtags is false.  Only add DT_RUNPATH when
1502         enable_new_dtags is true.
1503
1504 2013-01-17  Serge Pavlov  <serge.v.pavlov@gmail.com>
1505
1506         * powerpc.cc (Stub_table::find_plt_call_entry): Make types
1507         used in declaration and definition consistent.
1508         (Target_powerpc::symval_for_branch): Ditto.
1509
1510 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
1511
1512         * testsuite/plugin_final_layout.cc: Fix comment.
1513
1514 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
1515
1516         * layout.cc (Layout::layout): Do not do default sorting for
1517         text sections when section ordering is specified.
1518         (make_output_section): Ditto.
1519         * testsuite/plugin_final_layout.cc: Name the function sections
1520         to catch reordering issues.
1521
1522 2013-01-15  Alan Modra  <amodra@gmail.com>
1523
1524         * powerpc.cc (Target_powerpc::do_relax): Default shared libs to
1525         plt-thread-safe.
1526
1527 2013-01-15  Alan Modra  <amodra@gmail.com>
1528
1529         * testsuite/Makefile.am (final_layout_script.lds): Handle .got section.
1530         * testsuite/Makefile.in: Regenerate.
1531
1532 2013-01-14  Alan Modra  <amodra@gmail.com>
1533
1534         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add various output files.
1535         * testsuite/Makefile.in: Regenerate.
1536
1537 2013-01-11  Pavel Chupin  <pavel.v.chupin@intel.com>
1538
1539         PR bfd/14430
1540         Fix mingw gold build with plugins enabled
1541         * Makefile.am: Replace -ldl with @DLOPEN_LIBS@.
1542         * configure.ac: Export DLOPEN_LIBS and add headers check.
1543         * plugin.cc: Handle non-dlfcn case.
1544         * Makefile.in: Regenerate.
1545         * config.in: Regenerate.
1546         * configure: Regenerate.
1547         * testsuite/Makefile.in: Regenerate.
1548
1549 2013-01-09  Sriraman Tallam  <tmsriram@google.com>
1550
1551         * output.h (sort_attached_input_sections): Change to be public.
1552         * script-sections.cc
1553         (Output_section_definition::set_section_addresses): Sort
1554         attached input sections according to section order before linker
1555         script assigns section addresses.
1556         (Orphan_output_section::set_section_addresses): Sort
1557         attached input sections according to section order before linker
1558         script assigns section addresses.
1559         * Makefile.am (final_layout.sh): Use a simple linker script to
1560         check if section ordering still works.
1561         * Makefile.in: Regenerate.
1562
1563 2013-01-09  Ben Cheng  <bccheng@google.com>
1564
1565         * arm.cc (Target_arm::attributes_accept_div): New function.
1566         (Target_arm::attributes_forbid_div): New function.
1567         (Target_arm::merge_object_attributes): Merge the Tag_DIV_use
1568         attribute using the same new functions as what bfd/elf32_arm.c
1569         does.
1570
1571 2013-01-07  Cary Coutant  <ccoutant@google.com>
1572
1573         PR gold/14993
1574         * output.cc (Output_section::add_input_section): For incremental
1575         updates, don't track input sections that are allocated from patch
1576         space.
1577
1578 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
1579             Ian Lance Taylor  <iant@google.com>
1580
1581         PR gold/14897
1582         * configure.ac (--enable-ld): Removed.
1583         (install_as_default): Set to yes only for --enable-gold=default
1584         or --disable-ld.
1585         * configure: Regenerated.
1586
1587 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
1588
1589         * options.h (General_options): Add -fuse-ld= for GCC linker
1590         option compatibility.
1591
1592 2013-01-04  Cary Coutant  <ccoutant@google.com>
1593
1594         * configure.ac: Fix typo restoring CXXFLAGS.
1595         * configure: Regenerate.
1596
1597 2013-01-04  Cary Coutant  <ccoutant@google.com>
1598
1599         * testsuite/Makefile.am (CXXLINK_S): New macro.
1600         (debug_msg_so.err, debug_msg_ndebug.err): Use CXXLINK_S.
1601         * testsuite/Makefile.in: Regenerate.
1602
1603 2013-01-02  H.J. Lu  <hongjiu.lu@intel.com>
1604
1605         * version.cc (print_version): Update copyright year to 2013.
1606
1607 2012-12-20  Ian Lance Taylor  <iant@google.com>
1608
1609         * layout.cc (Layout::special_ordering_of_input_section): New
1610         function.
1611         (Layout::layout): If input section requires special ordering, must
1612         sort input sections.
1613         (Layout::make_output_section): May sort .text input sections.
1614         (Layout::is_section_name_prefix_grouped): Remove.
1615         * layout.h (class Layout): Declare
1616         special_ordering_of_input_section.  Don't declare
1617         is_section_name_prefix_grouped.
1618         * output.cc (Output_section::add_input_section): Revert last
1619         change.
1620         (Output_section::Input_section_sort::match_file_name): Don't crash
1621         if called on output section data.
1622         (Output_section::Input_section_sort_compare): Sort based on
1623         special ordering.
1624         (Output_section::Input_section_sort_section_order_index_compare):
1625         Revert last patch.
1626         (Output_section::sort_attached_input_sections): Likewise.
1627
1628 2012-12-18  Sriraman Tallam  <tmsriram@google.com>
1629
1630         * layout.cc (Layout::is_section_name_prefix_grouped): New function.
1631         * layout.h (Layout::is_section_name_prefix_grouped): New function.
1632         * output.cc (Output_section::add_input_section): Check if section
1633         name contains special prefix.  Keep input sections to sort such
1634         sections.
1635         (Output_section::Input_section_sort_section_order_index_compare
1636          ::operator()): Group sections according to prefixes.
1637         (Output_section::sort_attached_input_sections): Add condition to
1638         Input_section_entry constructor call.
1639         * testsuite/Makefile.am (text_section_grouping): New test.
1640         * testsuite/Makefile.in: Regenerate.
1641         * testsuite/text_section_grouping.cc: New file.
1642         * testsuite/text_section_grouping.sh: New file.
1643
1644 2012-12-17  Nick Clifton  <nickc@redhat.com>
1645
1646         * Makefile.am: Add copyright notice.
1647         * NEWS: Likewise.
1648         * README: Likewise.
1649         * configure.ac: Likewise.
1650         * ftruncate.c: Likewise.
1651         * Makefile.in: Regenerate.
1652
1653 2012-12-14  Cary Coutant  <ccoutant@google.com>
1654
1655         * testsuite/Makefile.am (exception_separate_shared_12_test): Add
1656         --no-as-needed flag.
1657         (exception_separate_shared_12_test): Likewise.
1658         (incremental_copy_test): Likewise.
1659         * testsuite/Makefile.in: Regenerate.
1660
1661 2012-12-14  Cary Coutant  <ccoutant@google.com>
1662
1663         * dwp.cc (Dwp_output_file::add_cu_set): Check for duplicate CUs.
1664         (Dwp_output_file::Dwp_index::enter_set): Add assert.
1665
1666 2012-12-12  Alan Modra  <amodra@gmail.com>
1667
1668         * powerpc.cc (class Track_tls): New.
1669         (class Relocate, class Scan): Inherit Track_tls.
1670         (Target_powerpc::Scan::local, global): Track tls optimization
1671         and avoid creating plt entry for __tls_get_addr if all uses
1672         are optimized away.
1673         (Target_powerpc::Relocate::relocate): Update to use Track_tls.
1674
1675 2012-12-12  Alan Modra  <amodra@gmail.com>
1676
1677         * options.h (General_options): Add --toc-sort/--no-toc-sort.
1678         Replace no_toc_optimize with toc_optimize.
1679         * output.h (Output_section::input_sections): Provide non-const variant.
1680         * powerpc.cc (Powerpc_relobj::has_small_toc_reloc_,
1681         set_has_small_toc_reloc, has_small_toc_reloc): New variable and
1682         accessors.
1683         (Target_powerpc::Scan::local, global): Call set_has_small_toc_reloc.
1684         (class Sort_toc_sections): New.
1685         (Target_powerpc::do_finalize_sections): Sort toc sections.
1686         (Target_powerpc::Relocate::relocate): Update toc_optimize test.
1687
1688 2012-12-10  Roland McGrath  <mcgrathr@google.com>
1689
1690         * testsuite/binary_unittest.cc (read_all): New function.
1691         (Sized_binary_test): Use it instead of ::read.
1692         * fileread.cc (do_read): Don't assume pread always reads the whole
1693         amount in a single call.
1694
1695 2012-12-10  Alan Modra  <amodra@gmail.com>
1696
1697         * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
1698         Set EM_PPC64 or EM_PPC here.
1699         (Target_selector_powerpc::do_recognize): Delete.
1700
1701 2012-12-10  Alan Modra  <amodra@gmail.com>
1702
1703         * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
1704         stub_table_.
1705         (Target_powerpc::Branch_info::make_stub): Don't omit addend.
1706
1707 2012-12-07  Roland McGrath  <mcgrathr@google.com>
1708
1709         * testsuite/binary_unittest.cc (Sized_binary_test):
1710         Use open_descriptor rather than ::open.
1711
1712 2012-12-07  Alan Modra  <amodra@gmail.com>
1713
1714         * powerpc.cc (Stub_table::do_write): Delete redundant Address
1715         typedef and invalid_address constant.
1716         (Output_data_glink, Stub_table, Target_powerpc): Explicitly
1717         instantiate constants.
1718
1719 2012-12-06  Roland McGrath  <mcgrathr@google.com>
1720
1721         * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
1722         Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
1723         * aclocal.m4: Regenerate.
1724         * configure: Regenerate.
1725         * Makefile.in: Regenerate.
1726         * testsuite/Makefile.in: Regenerate.
1727
1728 2012-12-07  Alan Modra  <amodra@gmail.com>
1729
1730         * options.h (General_options): Add no_toc_optimize.
1731         * powerpc.cc (ok_lo_toc_insn): New function.
1732         (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
1733
1734 2012-12-06  Alan Modra  <amodra@gmail.com>
1735
1736         * options.h (General_options): Add plt_align, plt_static_chain,
1737         plt_thread_safe.  Update stub_group_size help text.
1738         * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
1739         for new plt_thread_safe_ var.
1740         (use_plt_offset): Correct comments.
1741         (Target_powerpc::do_relax): Look for thread creation symbols to
1742         determine default plt_thread_safe value.  Clear plt call stubs
1743         as well as branch stubs each iteration.
1744         (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
1745         insn constants.
1746         (l, hi, ha, write_insn): Move earlier.
1747         (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
1748         (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
1749         plt stubs too.
1750         (Stub_table::update_size): Adjust.
1751         (Stub_table::prev_size, set_prev_size): Delete.
1752         (Stub_table::stub_align): Let --plt-align affect result.
1753         (Stub_table::plt_call_size): Calculate sizes for various stubs.
1754         (Stub_table::branch_stub_size): Use last_plt_size in address calc.
1755         (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
1756         (Stub_table::do_write): Support more stub variants.
1757
1758 2012-12-04  Alan Modra  <amodra@gmail.com>
1759
1760         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
1761         (Target_powerpc::do_define_standard_symbols): New function.
1762
1763 2012-12-03  Alan Modra  <amodra@gmail.com>
1764
1765         * output.h: Formatting, whitespace.
1766
1767 2012-12-03  Alan Modra  <amodra@gmail.com>
1768
1769         * layout.h (Layout::get_executable_sections): Declare.
1770         * layout.cc (Layout::get_executable_sections): New function.
1771         * arm.cc (Target_arm::group_sections): Use it.
1772         (Arm_output_section::group_sections): Delete now redundant test.
1773         * output.cc (Output_reloc::Output_reloc): Add is_relative.
1774         param to handle relative relocs.
1775         * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
1776         (Output_data_reloc::add_absolute): Adjust.
1777         (Output_data_reloc::add_relative): New function.
1778         (Output_data::reset_data_size): New function.
1779         (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
1780         (Output_section::set_addralign): New function.
1781         (Output_section::checkpoint_set_addralign): New function.
1782         (Output_section::clear_section_offsets_need_adjustment): New function.
1783         (Output_section::input_sections): Make public.
1784         * powerpc.cc (class Output_data_brlt_powerpc): New.
1785         (class Stub_table, class Stub_control): New.
1786         (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
1787         stub_table_, set_stub_table, stub_table): New vectors and accessor
1788         functions.
1789         (Target_powerpc::do_may_relax, do_relax, push_branch,
1790         new_stub_table, stub_tables, brlt_section, group_sections,
1791         add_branch_lookup_table, find_branch_lookup_table,
1792         write_branch_lookup_table, make_brlt_section): New functions.
1793         (Target_powerpc::struct Sort_sections, class Branch_info): New.
1794         (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
1795         branch_info_): New vars.
1796         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
1797         make call stubs here.
1798         (Output_data_glink): Remove all call stub handling from this class.
1799         (Target_powerpc::Scan::local, global): Save interesting branch
1800         relocs and relocs for ifunc.  Adjust calls to plt entry functions.
1801         (Target_powerpc::do_finalize_sections): Only make reg save/restore
1802         functions on final link.
1803         (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
1804         Handle long branch destinations too.
1805         (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
1806         do_plt_address_for_local): Adjust lookup of plt call stubs.
1807
1808 2012-11-30  Alan Modra  <amodra@gmail.com>
1809
1810         * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
1811         relocs against protected symbols when building 32-bit shared libs.
1812
1813 2012-11-30  Alan Modra  <amodra@gmail.com>
1814
1815         * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
1816         param.  Call got_section() to make .got.  Update all callers
1817         and their callers and so on.
1818
1819 2012-11-30  Alan Modra  <amodra@gmail.com>
1820
1821         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
1822         _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
1823         (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
1824         value if it already exists.
1825
1826 2012-11-19  H.J. Lu  <hongjiu.lu@intel.com>
1827
1828         PR gold/14858
1829         * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
1830
1831 2012-11-14  Roland McGrath  <mcgrathr@google.com>
1832
1833         * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
1834         than bfc instruction for data sandboxing.
1835
1836 2012-11-08  Alan Modra  <amodra@gmail.com>
1837
1838         * po/POTFILES.in: Regenerate.
1839
1840 2012-11-05  Alan Modra  <amodra@gmail.com>
1841
1842         * configure.ac: Apply 2012-09-10 change to config.in here.
1843         * configure: Regenerate.
1844
1845 2012-11-05  Alan Modra  <amodra@gmail.com>
1846
1847         * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
1848         (struct Opd_ent): Use "Address" rather than "Offset".
1849         (Output_data_got_powerpc::got_base_offset): Return Valtype.
1850         (Target_powerpc::got_section): Make public.
1851         (Target_powerpc::scan_relocs): Move code setting symbols..
1852         (Powerpc_relobj::do_scan_relocs): ..to here, new function.
1853         Create _SDA_BASE_ only when referenced.
1854
1855 2012-11-02  Roland McGrath  <mcgrathr@google.com>
1856
1857         * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
1858         from last change.
1859
1860 2012-11-01  Roland McGrath  <mcgrathr@google.com>
1861
1862         * target.h (Sized_target::relocate_relocs): Use Elf_Off
1863         for offset_in_output_section parameter.
1864         (Sized_target::relocate_special_relocatable): Likewise.
1865         * arm.cc (Target_arm::relocate_relocs): Likewise.
1866         (Target_arm::relocate_special_relocatable): Likewise.
1867         * i386.cc (Target_i386::relocate_relocs): Likewise.
1868         * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
1869         * sparc.cc (Target_sparc::relocate_relocs): Likewise.
1870         * target-reloc.h (relocate_relocs): Likewise.
1871         * testsuite/testfile.cc (Target_test): Likewise.
1872         * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
1873         * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
1874
1875         * system.h: Move inclusion of <clocale> to after <libintl.h> in
1876         [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
1877
1878         * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
1879         parameter, which is unused in the [!F_SETFD] case.
1880
1881         * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
1882         SYMNDX to off_t before comparing it to this->data_size().
1883         * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
1884         * incremental.cc (Output_section_incremental_inputs::do_write):
1885         Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
1886
1887         * nacl.cc: Include "libiberty.h" for vasprintf declaration.
1888
1889 2012-10-30  Steve McIntyre  <steve.mcintyre@linaro.org>
1890
1891         * gold.cc (Target_arm::do_adjust_elf_header): Add the
1892         hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
1893         in EABI_VER5.
1894
1895 2012-10-29  Cary Coutant  <ccoutant@google.com>
1896
1897         * dwp.cc (usage): Add file and exit status parameters;
1898         add --help and --version options.
1899         (print_version): New function.
1900         (main): Add --help and --version options.
1901
1902 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1903
1904         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
1905         final_layout_sequence.txt.
1906         * testsuite/Makefile.in: Regenerated.
1907
1908 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1909
1910         * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
1911         COMPILE generated by automake.
1912         (LINK1): Likewise.
1913         (CXXCOMPILE1): Likewise.
1914         (CXXLINK1): Likewise.
1915         (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
1916         (LINK): Likewise.
1917         (CXXCOMPILE): Likewise.
1918         (CXXLINK): Likewise.
1919         * testsuite/Makefile.in: Regenerated.
1920
1921 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1922
1923         * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
1924         on bad fwrite return.
1925
1926 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1927
1928         * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
1929         on val.
1930
1931 2012-10-23  Cary Coutant  <ccoutant@google.com>
1932
1933         * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
1934         * testsuite/Makefile.in: Regenerate.
1935         * testsuite/dwp_test.h: New source file.
1936         * testsuite/dwp_test_1.cc: New source file.
1937         * testsuite/dwp_test_1.s: New source file.
1938         * testsuite/dwp_test_1.sh: New source file.
1939         * testsuite/dwp_test_1b.cc: New source file.
1940         * testsuite/dwp_test_1b.s: New source file.
1941         * testsuite/dwp_test_2.cc: New source file.
1942         * testsuite/dwp_test_2.s: New source file.
1943         * testsuite/dwp_test_2.sh: New source file.
1944         * testsuite/dwp_test_main.cc: New source file.
1945         * testsuite/dwp_test_main.s: New source file.
1946
1947 2012-10-23  Cary Coutant  <ccoutant@google.com>
1948
1949         * dwp.h: New header file.
1950         * dwp.cc: New source file.
1951         * gold.h: Move shared declarations to system.h.
1952         * system.h: New header file.
1953         * Makefile.am: Add dwp.
1954         * Makefile.in: Regenerate.
1955
1956 2012-10-23  Cary Coutant  <ccoutant@google.com>
1957
1958         * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
1959         Dwarf_info_reader::read_from_pointer.
1960         (Dwarf_pubnames_table::read_header): Likewise.
1961         (Dwarf_pubnames_table::next_name): Likewise.
1962         (Dwarf_die::read_attributes): Likewise.
1963         (Dwarf_die::skip_attributes): Likewise.
1964         (Dwarf_info_reader::read_from_pointer): New function template.
1965         * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
1966         (Dwarf_pubnames_table): Likewise.
1967         (Dwarf_info_reader::read_from_pointer): New function template.
1968         * gdb-index.cc (Gdb_index_info_reader): Adjust call to
1969         Dwarf_pubnames_table ctor.
1970
1971 2012-10-23  Cary Coutant  <ccoutant@google.com>
1972
1973         * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
1974         abbrev_shndx.
1975         * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
1976         abbrev_shndx_.
1977         (Dwarf_info_reader::set_abbrev_shndx): New method.
1978         (Dwarf_info_reader::abbrev_shndx_): New data member.
1979
1980 2012-10-23  Cary Coutant  <ccoutant@google.com>
1981
1982         * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
1983         from object, not parameters.
1984         (Dwarf_info_reader::parse): Likewise.
1985         * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
1986         (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
1987         (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
1988         methods.
1989
1990 2012-10-23  Cary Coutant  <ccoutant@google.com>
1991
1992         * fileread.cc (Input_file::Input_file): New constructor.
1993         * fileread.h (class Input_file): Add new constructor.
1994
1995 2012-10-18  Alan Modra  <amodra@gmail.com>
1996
1997         PR gold/14727
1998         * object.cc (Relobj::is_section_name_included): Also match
1999         .sdata personality section.
2000
2001 2012-10-18  Alan Modra  <amodra@gmail.com>
2002
2003         * target-reloc.h (class Default_comdat_behavior): New, package up..
2004         (get_comdat_behaviour): ..this.
2005         (relocate_section): Add Relocate_comdat_behavior template arg,
2006         adjust code to suit.
2007         * arm.cc (Target_arm::relocate_section): Adjust to suit.
2008         (Target_arm::scan_reloc_section): Likewise.
2009         * i386.cc (Target_i386::relocate_section): Likewise.
2010         * sparc.cc (Target_sparc::relocate_section): Likewise.
2011         * tilegx.cc (Target_tilegx::relocate_section): Likewise.
2012         * x86_64.cc (Target_x86_64::relocate_section): Likewise.
2013         * powerpc.cc (class Relocate_comdat_behavior): New.
2014         (Target_powerpc::relocate_section): Don't zap opd relocs.  Supply
2015         gold::relocate_section with new template arg.
2016
2017 2012-10-18  Alan Modra  <amodra@gmail.com>
2018
2019         * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
2020         dynamic relocs for GOT_TPREL got entries, without symbol if
2021         resolving locally.
2022         (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
2023         (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
2024         (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
2025
2026 2012-10-17  Alan Modra  <amodra@gmail.com>
2027
2028         PR gold/14726
2029         * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
2030
2031 2012-10-16  Sriraman Tallam  <tmsriram@google.com>
2032
2033         * layout.cc (Layout::include_section): Keep sections marked
2034         SHF_EXCLUDE when doing relocatable links.
2035
2036 2012-10-16  Alan Modra  <amodra@gmail.com>
2037
2038         * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
2039         (Target_powerpc::do_finalize_sections): Call it.
2040         (Output_data_save_res): New class and supporting functions.
2041         (Target_powerpc::symval_for_branch): Only look up .opd entry for
2042         normal symbols defined in object files.
2043
2044 2012-10-12  Alan Modra  <amodra@gmail.com>
2045
2046         * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
2047         (struct Opd_ent): Make "discard" a bit field.  Add "gc_mark".
2048         (Target_powerpc::do_gc_mark_symbol): Delay marking function code
2049         section if scan_opd_relocs not yet called.
2050         (Target_powerpc::gc_process_relocs): Call process_gc_mark.
2051
2052 2012-10-12  Alan Modra  <amodra@gmail.com>
2053
2054         * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
2055         add_local_ifunc_entry): Revert last change.
2056         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
2057
2058 2012-10-05  Alan Modra  <amodra@gmail.com>
2059
2060         * powerpc.cc (Target_powerpc::do_plt_address_for_local,
2061         do_plt_address_for_global): New functions.
2062         (Output_data_got_powerpc::do_write): Don't segfault when linking
2063         statically.
2064         (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
2065         add_local_ifunc_entry): Return true on adding entry..
2066         (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
2067         glink->add_entry call.  Remove unused symtab param.  Adjust calls.
2068         (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
2069         (Target_powerpc::make_iplt_section): Remove symtab param.  Don't
2070         set up symbols here.
2071         (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
2072         syms here.  Do so even when no .iplt.  Don't segfault when linking
2073         statically.
2074         (Output_data_glink::add_entry, find_entry): Rearrange params.  Add
2075         new variants without reloc param.
2076         (Glink_sym_ent::Glink_sym_ent): Likewise.
2077         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
2078         reloc when refs will resolve to plt call stub.
2079         (Target_powerpc::Scan::local): Correct ifunc handling.  Allow
2080         R_PPC_PLTREL24 to resolve locally.
2081         (Target_powerpc::Scan::global): Correct ifunc handling.
2082         (Target_powerpc::Relocate::relocate): Correct local sym glink
2083         lookup.  Don't destroy "value" when we have a plt call stub,
2084         and when checking plt call validity.
2085         (Target_powerpc::do_dynsym_value): Simplify.
2086
2087 2012-10-05  Alan Modra  <amodra@gmail.com>
2088
2089         * i386.cc (Output_data_plt_i386::address_for_global,
2090         address_for_local): Add plt offset to returned value.  Adjust uses.
2091         * sparc.cc (Output_data_plt_sparc::address_for_global,
2092         address_for_local): Likewise.
2093         * tilegx.cc (Output_data_plt_tilegx::address_for_global,
2094         address_for_local): Likewise.
2095         * x86_64.cc (Output_data_plt_x86_64::address_for_global,
2096         address_for_local): Likewise.
2097         * target.h (Target::plt_address_for_global, plt_address_for_local):
2098         Update comment.
2099         * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
2100         (Output_data_got::Got_entry::write): Nor here.
2101         * output.h: Comment fix.
2102
2103 2012-10-02  Jiong Wang  <jiwang@tilera.com>
2104
2105         * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
2106         global_offset_table_ value for larget got.
2107         (Target_tilegx::Relocate::relocate): Handle adjusted got value.
2108
2109 2012-09-29  Alan Modra  <amodra@gmail.com>
2110
2111         * powerpc.cc (Target_powerpc::iplt_): New output section.
2112         (Target_powerpc::iplt_section, make_iplt_section,
2113         reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
2114         (Target_powerpc::make_plt_entry): Handle ifunc syms.
2115         Target_powerpc::plt_entry_count): Count iplt entries too.
2116         (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
2117         reloc section in constructor.  New params.
2118         (Target_powerpc::make_plt_section): Create reloc section here instead.
2119         (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
2120         functions.
2121         (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
2122         (Output_data_glink::add_entry, find_entry): New functions to
2123         deal with local syms.
2124         (Glink_sym_ent): Add support for local syms.
2125         (Output_data_glink::do_write): Handle ifunc plt entries.
2126         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
2127         (Target_powerpc::Scan::local, global): Handle ifunc syms.
2128         (Target_powerpc::Relocate::relocate): Likewise.
2129         (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
2130
2131 2012-09-25  Alan Modra  <amodra@gmail.com>
2132
2133         * object.h (Sized_relobj_file::adjust_local_symbol,
2134         do_adjust_local_symbol): New functions.
2135         * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
2136         * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
2137         (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
2138         and irregular opd entry spacing.
2139         (Powerpc_relobj::do_read_relocs): Add opd size checks.
2140         (Global_symbol_visitor_opd): New functor.
2141         (Target_powerpc::do_finalize_sections): Omit global symbols defined
2142         on deleted opd entries.
2143
2144 2012-09-15  Jiong Wang  <jiwang@tilera.com>
2145
2146         * tilegx.cc: New file.
2147         * Makefile.am (TARGETSOURCES): Add tilegx.cc
2148         (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
2149         * configure.tgt: Add entries for tilegx*.
2150         * configure.ac: Likewise.
2151         * Makefile.in: Rebuild.
2152         * configure: Likewise.
2153         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
2154         tilegx.
2155
2156 2012-09-13  Alan Modra  <amodra@gmail.com>
2157
2158         * target-reloc.h (scan_relocs): Call scan.local for relocs
2159         against symbols in discarded sections.  Pass is_discarded
2160         param.
2161         * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
2162         Add is_discarded param.
2163         * powerpc (Target_powerpc::Scan::local): Likewise.  Use
2164         is_discarded to flag opd entry as discarded.  Don't emit dyn
2165         relocs on such entries.
2166         (Target_powerpc::Scan::global): Similarly detect and handle
2167         such opd entries.
2168         (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
2169         opd_ent_.  Update all uses.
2170         (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
2171         (Target_powerpc::relocate_section): Zero out discarded opd
2172         entry relocs.
2173
2174 2012-09-12  Ian Lance Taylor  <iant@google.com>
2175
2176         PR gold/14570
2177         * output.cc: Rename Output_data_got template parameter from size
2178         to got_size for all functions.  Compile all variants of
2179         Output_data_got.
2180         (Output_data_got::Got_entry::write): Correct use of size for
2181         symbol value.  Use local_is_tls rather than casting to
2182         Sized_relobj_file.
2183         * object.h (class Object): Add local_is_tls and do_local_is_tls.
2184         (class Sized_relobj_file): Add do_local_is_tls.
2185         * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
2186
2187 2012-09-11  Alan Modra  <amodra@gmail.com>
2188
2189         PR gold/14566
2190         * layout.cc (Layout::set_segment_offsets): When using
2191         common-page-size alignment, ensure we are on a new max-page-size
2192         page.
2193         * output.cc (Output_segment::set_section_addresses): Use
2194         abi_pagesize, not common_pagesize for relro boundary.
2195         (Output_segment::set_offset): Likewise.
2196
2197 2012-09-11  Alan Modra  <amodra@gmail.com>
2198
2199         * output.h (Output_data_got::add_global_tls, add_local_tls,
2200         add_local_tls_pair): New functions.
2201         (Output_data_got::add_local_pair_with_rel): Remove second
2202         reloc param.  Expand comment.
2203         (Output_data_got::Got_entry): Rename use_plt_offset_ to
2204         use_plt_or_tls_offset_, similarly for constructor param.
2205         (Output_data_got::Got_entry::write): Add got_index param.
2206         * output.cc (Output_data_got::add_global_tls, add_local_tls,
2207         add_local_tls_pair): New functions.
2208         (Output_data_got::Got_entry::write): Handle tls symbols
2209         with use_plt_or_tls_offset_ set specially.
2210         (Output_data_got::add_local_pair_with_rel): Only one reloc.
2211         (Output_data_got::do_write): Replace iterator with index, pass
2212         index to entry write function.
2213         * target.h (Target::tls_offset_for_local, tls_offset_for_global,
2214         do_tls_offset_for_local, do_tls_offset_for_global): New functions.
2215         * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
2216         call.
2217         * i386.cc (Target_i386::Scan::local): Likewise.
2218         * sparc.cc (Target_sparc::Scan::local): Likewise.
2219         * x86_64.cc (Target_x86_64::Scan::local): Likewise.
2220         * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
2221         do_tls_offset_for_global): New functions.
2222         (Target_powerpc::Scan::local): Correct TLS relocations and got
2223         entry values.
2224         (Target_powerpc::Scan::global): Don't emit unnecessary
2225         dynamic relocations on TLS GOT entries.
2226
2227 2012-09-10  Matthias Klose  <doko@ubuntu.com>
2228
2229         * config.in: Disable sanity check for kfreebsd.
2230
2231 2012-09-10  Sterling Augustine  <saugustine@google.com>
2232
2233         * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
2234         (Gdb_index::pubtypes_read): New parameter.
2235         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
2236         to calls.
2237         * gdb-index.h (Gdb_index): New fields pubnames_object_ and
2238         pubtypes_object_.
2239
2240 2012-09-09  Alan Modra  <amodra@gmail.com>
2241
2242         * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
2243         (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
2244         * gc.h (gc_process_relocs): Call target gc_add_reference.
2245         * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
2246         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
2247         (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
2248         unnecessary cast.
2249         * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
2250         to cater for when we don't need code offset.  Update use.
2251         (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
2252         (Powerpc_relobj::access_from_map, add_reference, opd_valid,
2253         set_opd_valid): New functions.
2254         (Target_powerpc::do_gc_add_reference): New function.
2255         (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
2256         stashed refs.
2257         (Target_powerpc::do_gc_mark_symbol): New function.
2258
2259 2012-09-06  Cary Coutant  <ccoutant@google.com>
2260
2261         * dwarf_reader.cc (Dwarf_die::read_attributes): Add
2262         DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
2263         (Dwarf_die::skip_attributes): Likewise.
2264         * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
2265         * testsuite/gdb_index_test.cc (inline_func_1): New function.
2266         (main): Call it.
2267         * testsuite/gdb_index_test_comm.sh: Check index for inline function.
2268
2269 2012-09-05  H.J. Lu  <hongjiu.lu@intel.com>
2270
2271         * testsuite/script_test_3.t: Add .got.plt output section
2272         statement.
2273         * testsuite/script_test_4.t: Likewise.
2274
2275 2012-09-05  Alan Modra  <amodra@gmail.com>
2276
2277         * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
2278         update all uses and lose "enum" when using type.
2279
2280 2012-09-05  Alan Modra  <amodra@gmail.com>
2281
2282         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
2283         * configure: Regenerate.
2284         * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
2285         (plugin_final_layout.stdout): Likewise.
2286         (memory_test): Set page sizes to 0x1000.
2287         * testsuite/Makefile.in: Regenerate.
2288         * testsuite/discard_locals_test.sh: Add FIXME comment.
2289         * testsuite/justsyms_exec.c: Disable function test for powerpc64.
2290         * testsuite/pr14265.t: Add .got output section statement.
2291         * testsuite/script_test_2.t: Likewise.
2292         * testsuite/script_test_3.t: Likewise.
2293         * testsuite/script_test_4.t: Likewise.
2294         * testsuite/script_test_5.t: Likewise.
2295         * testsuite/script_test_6.t: Likewise.
2296         * testsuite/script_test_7.t: Likewise.
2297         * testsuite/script_test_9.t: Likewise.
2298
2299 2012-09-05  Alan Modra  <amodra@gmail.com>
2300
2301         * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
2302         (Powerpc_relocate_functions::Status): New typedef.
2303         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
2304         (Target_powerpc::Scan::local): Handle REL64.
2305         (Target_powerpc::Scan::global): Likewise, and dynamic relocs
2306         for REL32 and REL64.
2307         (Target_powerpc::symval_for_branch): New function, extracted from..
2308         (Target_powerpc::Relocate::relocate): ..here.  Correct plt call
2309         checks.  Report overflow errors.
2310
2311 2012-09-05  Alan Modra  <amodra@gmail.com>
2312
2313         * object.h (Sized_relobj_file::emit_relocs): Delete.
2314         (Sized_relobj_file::emit_relocs_reltype): Delete.
2315         * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
2316         relocate_relocs for --emit-relocs.
2317         (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
2318         * output.h: Update comment.
2319         (Output_segment::first_section): New function.
2320         (Output_segment::first_section_load_address): Use first_section.
2321         * output.cc (Output_segment::first_section): New function extracted..
2322         (Output_segment::first_section_load_address): ..from here.  Delete.
2323         * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
2324         * target.h (Sized_target::relocate_for_relocatable): Likewise.
2325         * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
2326         adjust call to target.h function.
2327         * i386.cc (Target_i386): Likewise.
2328         * sparc.cc (Target_sparc): Likewise.
2329         * x86_64.cc (Target_x86_64): Likewise.
2330         * powerpc.cc (Target_powerpc): Likewise.
2331         (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS.  Ensure
2332         first tls section has section symbol for optimised local dynamic
2333         output relocs.
2334         (Target_powerpc::Relocate::relocate): Correct local dynamic value.
2335         (Target_powerpc::relocate_relocs): Adjust relocs emitted for
2336         optimised tls code.
2337         * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
2338         Rename to relocate_relocs.  Update error message.
2339
2340 2012-09-04  Andreas Schwab  <schwab@linux-m68k.org>
2341
2342         * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
2343         --just-symbols.
2344
2345 2012-08-31  Alan Modra  <amodra@gmail.com>
2346
2347         * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
2348         (Powerpc_relobj::toc_base_offset): New stub function.
2349         (Target_powerpc): Add tp_offset, dtp_offset.  Rename
2350         got_mod_index_offset to tlsld_got_offset.  Update all refs.
2351         (Target_powerpc::Relocate::enum skip_tls): New.
2352         (Target_powerpc::call_tls_get_addr_): New var.
2353         (Target_powerpc::is_branch_reloc): Move to file scope.
2354         (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
2355         (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
2356         New functions.
2357         (Target_powerpc::enum Got_type): Delete old values, add new ones.
2358         (powerpc_info): Correct common_pagesize for ppc64.
2359         (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
2360         (Powerpc_relocate_functions): Add overflow check enums and functions.
2361         Add non-shift version of rela, rela_ua.  Delete all rel public
2362         functions.  Delete addr16_lo.  Add addr64, addr64_u, addr32,
2363         addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
2364         addr16_ha3, addr14 functions.
2365         (Output_data_got_powerpc::add_constant_pair): New function.
2366         (Output_data_got_powerpc::got_base_offset): Likewise.
2367         (Output_data_got_powerpc::do_write): Correct 64-bit got header.
2368         (instruction constants): Sort, add some more.
2369         (Output_data_glink::do_write): Add and use Address typedef.  Use
2370         object->toc_base_offset() stub for 64-bit.
2371         (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
2372         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
2373         (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
2374         for R_PPC64_TOC.  Handle more relocs.  Generate got entries for TLS.
2375         Always treat .opd relocs as against locally defined symbol.
2376         Correct condition for RELATIVE relocs.
2377         (Target_powerpc::do_finalize_sections): Test for NULL sections.
2378         (Target_powerpc::Relocate::relocate): Use plt call stub as value
2379         for 32-bit syms with a plt entry.  Correct ppc64 toc base
2380         calculations.  Handle TLS relocs, and more.  Add overflow
2381         checking and adjust for Powerpc_relocate_functions changes.
2382         (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
2383         Reinstate --emit-relocs code with FIXME.
2384
2385 2012-08-30  Alan Modra  <amodra@gmail.com>
2386
2387         * layout.cc (Layout::set_segment_offsets): Set p_align to
2388         abi_pagesize, not common_pagesize.
2389         (Layout::relaxation_loop_body): Similarly use abi_pagesize
2390         to determine whether file header can go in segment.
2391
2392 2012-08-30  Alan Modra  <amodra@gmail.com>
2393
2394         * output.h (Output_reloc::Output_reloc <output section>): Add
2395         is_relative param.  Adjust calls.
2396         (Output_reloc::add_output_section_relative): New functions.
2397         * output.cc (Output_reloc::Output_reloc <output section>): Handle
2398         is_relative.
2399         (Output_reloc::symbol_value): Handle SECTION_CODE.
2400
2401 2012-08-24  Sriraman Tallam  <tmsriram@google.com>
2402
2403         * gold.cc (queue_middle_tasks): Call layout again when unique
2404         segments for sections is desired.
2405         * layout.cc (Layout::Layout): Initialize new members.
2406         (Layout::get_output_section_flags): New function.
2407         (Layout::choose_output_section): Call get_output_section_flags.
2408         (Layout::layout): Make output section for mapping to a unique segment.
2409         (Layout::insert_section_segment_map): New function.
2410         (Layout::attach_allocated_section_to_segment): Make unique segment for
2411         output sections marked so.
2412         (Layout::segment_precedes): Check for unique segments when sorting.
2413         * layout.h (Layout::Unique_segment_info): New struct.
2414         (Layout::Section_segment_map): New typedef.
2415         (Layout::insert_section_segment_map): New function.
2416         (Layout::get_output_section_flags): New function.
2417         (Layout::is_unique_segment_for_sections_specified): New function.
2418         (Layout::set_unique_segment_for_sections_specified): New function.
2419         (Layout::unique_segment_for_sections_specified_): New member.
2420         (Layout::section_segment_map_): New member.
2421         * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
2422         Rename is_gc_pass_one to is_pass_one.
2423         Rename is_gc_pass_two to is_pass_two.
2424         Rename is_gc_or_icf to is_two_pass.
2425         Check for which pass based on whether symbols data is present.
2426         Make it two pass when unique segments for sections is desired.
2427         * output.cc (Output_section::Output_section): Initialize new
2428         members.
2429         * output.h (Output_section::is_unique_segment): New function.
2430         (Output_section::set_is_unique_segment): New function.
2431         (Output_section::is_unique_segment_): New member.
2432         (Output_section::extra_segment_flags): New function.
2433         (Output_section::set_extra_segment_flags): New function.
2434         (Output_section::extra_segment_flags_): New member.
2435         (Output_section::segment_alignment): New function.
2436         (Output_section::set_segment_alignment): New function.
2437         (Output_section::segment_alignment_): New member.
2438         (Output_segment::Output_segment): Initialize is_unique_segment_.
2439         (Output_segment::is_unique_segment): New function.
2440         (Output_segment::set_is_unique_segment): New function.
2441         (Output_segment::is_unique_segment_): New member.
2442         * plugin.cc (allow_unique_segment_for_sections): New function.
2443         (unique_segment_for_sections): New function.
2444         (Plugin::load): Add new functions to transfer vector.
2445         * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
2446         * Makefile.in: Regenerate.
2447         * testsuite/plugin_final_layout.sh: Check if unique segment
2448         functionality works.
2449         * testsuite/plugin_section_order.c (onload): Check if new interfaces
2450         are available.
2451         (allow_unique_segment_for_sections): New global.
2452         (unique_segment_for_sections): New global.
2453         (claim_file_hook): Call allow_unique_segment_for_sections.
2454         (all_symbols_read_hook): Call unique_segment_for_sections.
2455
2456 2012-08-22  Cary Coutant  <ccoutant@google.com>
2457
2458         * layout.cc (Layout::include_section): Don't assert on GROUP
2459         sections with --emit-relocs.
2460
2461 2012-08-21  Cary Coutant  <ccoutant@google.com>
2462
2463         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
2464         if --export-dynamic-symbol names an undef symbol.
2465
2466 2012-08-18  Alan Modra  <amodra@gmail.com>
2467
2468         * powerpc.cc: Formatting and white space.
2469         (Powerpc_relobj): Rename got2_section_ to special_.
2470         Add opd_ent_shndx_ and opd_ent_off_ vectors.
2471         (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
2472         scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
2473         (Target_powerpc): Add Address typedef and invalid_address.  Use
2474         throughout.
2475         (Target_powerpc::is_branch_reloc): New function.
2476         (Powerpc_relocate_functions): Add Address typedef, use throughout.
2477         (Powerpc_relocate_functions:rela, rela_ua): Correct type used
2478         for dst_mask, value and addend.
2479         (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
2480         (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
2481         (Output_data_glink::do_write): Correct toc base.  Don't try to use
2482         uint16_t for 24-bit offset.  Use get_output_section_offset and
2483         check return.
2484         (Target_powerpc::Scan::local): Handle more relocs.
2485         (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
2486         (Target_powerpc::Relocate::relocate): Correct toc base calculation.
2487         Plug in toc restoring insn after plt calls.  Translate branches
2488         to function descriptor symbols to corresponding entry point.
2489         (Target_powerpc::relocate_for_relocatable): Check return from
2490         get_output_section_offset.
2491         * symtab.h: Comment typo.
2492
2493 2012-08-14  Ian Lance Taylor  <iant@google.com>
2494
2495         * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
2496         unsupported_relocal_local to call unsupported_reloc_global.
2497
2498 2012-08-14  Nick Clifton  <nickc@redhat.com>
2499
2500         PR ld/14265
2501         * script-sections.cc (Sections_element::output_section_name): Add
2502         keep return parameter.
2503         (Output_section_element::match_name): Add keep return parameter.
2504         Return the value of the keep_ member.
2505         * script-sections.h (class Output_section): Update
2506         output_section_name prototype.
2507         * layout.cc (Layout::keep_input_section): New public member
2508         function.
2509         (Layout::choose_output_section): Pass keep parameter to
2510         output_section_name.
2511         * layout.h (class Layout): Add keep_input_section.
2512         * object.cc (Sized_relobj_file::do_layout): Check for kept input
2513         sections.
2514         * testsuite/Makefile.am: Add a test.
2515         * testsuite/Makefile.in: Regenerate.
2516         * testsuite/pr14265.c: Source file for the test.
2517         * testsuite/pr14265.t: Linker script for the test.
2518         * testsuite/pr14265.sh: Shell script for the test.
2519
2520 2012-08-14  Alan Modra  <amodra@gmail.com>
2521
2522         * target.h (Target::output_section_name): New function.
2523         (Target::do_output_section_name): New function.
2524         * layout.cc (Layout::choose_output_section): Call the above.
2525         * powerpc.cc (Target_powerpc::do_output_section_name): New function.
2526
2527 2012-08-14  Alan Modra  <amodra@gmail.com>
2528
2529         * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
2530         (Output_data_got_powerpc::do_write): Don't rely on base class lookup
2531         for replace_constant call.
2532         (Output_data_plt_powerpc::do_print_to_mapfile): New function.
2533         (Output_data_glink::do_print_to_mapfile): New function.
2534         (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
2535         (Target_powerpc::Relocate::relocate): Likewise.
2536
2537 2012-08-14  Alan Modra  <amodra@gmail.com>
2538
2539         * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
2540         (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
2541         (Output_data_glink::add_entry,find_entry): Remove shndx param.
2542         (class Glink_sym_ent): Rename from struct Glink_sym_ent.  Remove
2543         all references to shndx_.  Handle special case for R_PPC_PLTREL24
2544         here.
2545         (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
2546         (Output_data_glink::do_write): Retrieve got2_shdnx from object.
2547         (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
2548         here.
2549         (Target_powerpc::Scan::global): Nor on make_plt_entry call.
2550         (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
2551
2552 2012-08-12  Alan Modra  <amodra@gmail.com>
2553
2554         * powerpc.cc: Whitespace fixes.  Wrap overly long lines.
2555         (glink insn constants): Use uint32_t.
2556         (Output_data_glink::add_entry): Use insert, not [] operator.
2557
2558 2012-08-11  Alan Modra  <amodra@gmail.com>
2559
2560         * object.h (Sized_relobj_file::find_shdr): New function.
2561         (Sized_relobj_file::find_special_sections): New function.
2562         * object.cc (Sized_relobj_file::find_shdr): New function.
2563         (Sized_relobj_file::find_eh_frame): Use find_shdr.
2564         (Sized_relobj_file::find_special_sections): New function, split out..
2565         (Sized_relobj_file::do_read_symbols): ..from here.
2566         * output.h (Output_data_got::replace_constant): New function.
2567         (Output_data_got::num_entries): New function.
2568         (Output_data_got::last_got_offset,set_got_size): Use num_entries.
2569         (Output_data_got::got_offset): Protected rather than private.
2570         (Output_data_got::replace_got_entry): New function.
2571         * output.cc (Output_data_got::replace_got_entry): New function.
2572         * powerpc.cc (class Powerpc_relobj): New.
2573         (class Powerpc_relocate_functions): Delete all psymval variants or
2574         convert to value,addend type.  Delete pcrela, pcrela_unaligned.
2575         Implement _ha functions using corresponding _hi function.
2576         (Powerpc_relobj::find_special_sections): New function.
2577         (Target_powerpc::do_make_elf_object): New function.
2578         (class Output_data_got_powerpc): New.
2579         (class Output_data_glink): New.
2580         (class Powerpc_scan_relocatable_reloc): New.
2581         Many more changes througout file.
2582
2583 2012-08-09  Nick Clifton  <nickc@redhat.com>
2584
2585         * po/vi.po: Updated Vietnamese translation.
2586
2587 2012-08-07  Ian Lance Taylor  <iant@google.com>
2588
2589         * layout.cc (Layout::add_target_dynamic_tags): If
2590         dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
2591         plt_rel.
2592
2593 2012-07-30  Nick Clifton  <nickc@redhat.com>
2594
2595         * po/gold.pot: Updated template.
2596         * po/es.po: Updated Spanish translation.
2597
2598 2012-07-18  Cary Coutant  <ccoutant@google.com>
2599
2600         PR gold/14344
2601         * configure.ac: Add check for -gpubnames support.
2602         * configure: Regenerate.
2603         * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
2604         support; force -gno-pubnames.
2605         (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
2606         support.
2607         (gdb_index_test_4): New test.
2608         * testsuite/Makefile.in: Regenerate.
2609         * testsuite/gdb_index_test_1.sh: Refactor code into common file.
2610         * testsuite/gdb_index_test_2.sh: Likewise.
2611         * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
2612         * testsuite/gdb_index_test_4.sh: New script.
2613         * testsuite/gdb_index_test_comm.sh: New script with common code;
2614         don't look for space after colon.
2615
2616 2012-07-16  Sriraman Tallam  <tmsriram@google.com>
2617
2618         * gold.cc (queue_middle_tasks): Update function order only after
2619         deferred objects due to plugins are processed.
2620
2621 2012-07-11  Ian Lance Taylor  <iant@google.com>
2622
2623         * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
2624         (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
2625         (Target_arm::scan_reloc_for_stub): Likewise.
2626         * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
2627         * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
2628         * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
2629         * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
2630         * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
2631
2632 2012-07-10  Dodji Seketeli  <dodji@redhat.com>
2633             Ian Lance Taylor  <iant@google.com>
2634
2635         PR gold/14309
2636         * configure.ac: Test whether std::tr1::hash<off_t> works.
2637         * gold.h: Add a specialization for std::tr1::hash<off_t> if
2638         needed.
2639         * output.h (class Output_fill): Add virtual destructor.
2640         * configure, config.in: Rebuild.
2641
2642 2012-06-22  Roland McGrath  <mcgrathr@google.com>
2643
2644         * layout.cc (finalize): Define __ehdr_start symbol if applicable.
2645
2646 2012-06-12  Rafael Ávila de Espíndola <respindola@mozilla.com>
2647
2648         * plugin.cc (Plugin::load): Handle position independent executables.
2649
2650 2012-06-06  Cary Coutant  <ccoutant@google.com>
2651
2652         * layout.cc (gdb_sections): Remove ".debug_" prefixes,
2653         add .debug_macro.
2654         (lines_only_debug_sections): Likewise.
2655         (gdb_fast_lookup_sections): New static array.
2656         (is_gdb_debug_section): Rename formal parameter.
2657         (is_lines_only_debug_section): Likewise.
2658         (is_gdb_fast_lookup_section): New function.
2659         (Layout::include_section): Check for ".zdebug_" prefix; pass
2660         section name suffix to is_gdb_debug_section, et al.; check for
2661         fast-lookup sections when building .gdb_index.
2662         * options.h (--strip-debug-gdb): Update GDB version number.
2663
2664 2012-06-06  Cary Coutant  <ccoutant@google.com>
2665
2666         * configure.ac: Add check for fallocate.
2667         * configure: Regenerate.
2668         * config.in: Regenerate.
2669
2670         * options.h (class General_options): Add --mmap-output-file and
2671         --posix-fallocate options.
2672         * output.cc: (posix_fallocate): Remove; replace with...
2673         (gold_fallocate): New function.
2674         (Output_file::map_no_anonymous): Call gold_fallocate.
2675         (Output_file::map): Check --mmap-output-file option.
2676
2677 2012-06-05  Jing Yu  <jingyu@google.com>
2678
2679         * gold.h (textdomain): Add do {} to empty while(0).
2680         (bindtextdomain): Likewise.
2681
2682 2012-06-04  Cary Coutant  <ccoutant@google.com>
2683
2684         * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
2685         has_dynsym_index.
2686
2687 2012-05-25  Sriraman Tallam  <tmsriram@google.com>
2688
2689         * symtab.cc (Symbol_table::define_special_symbol):
2690         Initialize *poldsym to prevent uninitialized variable errors.
2691
2692 2012-05-23  Cary Coutant  <ccoutant@google.com>
2693
2694         * layout.cc (Layout::section_name_mapping): Add rules to handle
2695         exact match on .data.rel.ro.local or .data.rel.ro.
2696         (Layout::output_section_name): Check for exact matches.
2697
2698 2012-05-23  Cary Coutant  <ccoutant@google.com>
2699
2700         * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
2701         more carefully.
2702
2703 2012-05-22  Cary Coutant  <ccoutant@google.com>
2704
2705         * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
2706         object before exporting symbol.
2707
2708 2012-05-21  H.J. Lu  <hongjiu.lu@intel.com>
2709
2710         * testsuite/tls_test.cc: Include "config.h" first.
2711         * testsuite/tls_test_c.c: Likewise.
2712
2713 2012-05-17  Daniel Richard G.  <skunk@iskunk.org>
2714             Nick Clifton  <nickc@redhat.com>
2715
2716         PR 14072
2717         * configure.in: Add check that sysdep.h has been included before
2718         any system header files.
2719         * configure: Regenerate.
2720         * config.in: Regenerate.
2721
2722 2012-05-14  Cary Coutant  <ccoutant@google.com>
2723
2724         * layout.cc (Layout::make_output_section): Mark .tdata section
2725         as RELRO.
2726         * testsuite/relro_test.cc: Add a TLS variable.
2727
2728 2012-05-10  H.J. Lu  <hongjiu.lu@intel.com>
2729
2730         PR gold/14091
2731         * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
2732         R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
2733         R_X86_64_64.
2734
2735 2012-05-08  Cary Coutant  <ccoutant@google.com>
2736
2737         * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
2738         (lines_only_debug_sections): Likewise.
2739
2740 2012-05-02  Roland McGrath  <mcgrathr@google.com>
2741
2742         * nacl.cc: New file.
2743         * nacl.h: New file.
2744         * Makefile.am (CCFILES, HFILES): Add them.
2745         * Makefile.in: Regenerate.
2746         * i386.cc (Output_data_plt_i386_nacl): New class.
2747         (Output_data_plt_i386_nacl_exec): New class.
2748         (Output_data_plt_i386_nacl_dyn): New class.
2749         (Target_i386_nacl): New class.
2750         (Target_selector_i386_nacl): New class.
2751         (target_selector_i386): Use it instead of Target_selector_i386.
2752         * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
2753         (Target_x86_64_nacl): New class.
2754         (Target_selector_x86_64_nacl): New class.
2755         (target_selector_x86_64, target_selector_x32): Use it instead of
2756         Target_selector_x86_64.
2757         * arm.cc (Output_data_plt_arm_nacl): New class.
2758         (Target_arm_nacl): New class.
2759         (Target_selector_arm_nacl): New class.
2760         (target_selector_arm, target_selector_armbe): Use it instead of
2761         Target_selector_arm.
2762
2763         * target-select.cc (select_target): Take new Input_file* and off_t
2764         arguments, pass them on to recognize method of selector.
2765         * object.cc (make_elf_sized_object): Update caller.
2766         * parameters.cc (parameters_force_valid_target): Likewise.
2767         * incremental.cc (make_sized_incremental_binary): Likewise.
2768         * target-select.h: Update decl.
2769         (Target_selector::recognize): Take new Input_file* argument,
2770         pass it on to do_recognize.
2771         (Target_selector::do_recognize): Take new Input_file* argument.
2772         * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
2773         * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
2774         * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
2775         * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
2776
2777         * target.h (Target::Target_info): New members isolate_execinstr
2778         and rosegment_gap.
2779         (Target::isolate_execinstr, Target::rosegment_gap): New methods.
2780         * arm.cc (Target_arm::arm_info): Update initializer.
2781         * i386.cc (Target_i386::i386_info): Likewise.
2782         * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
2783         * sparc.cc (Target_sparc::sparc_info): Likewise.
2784         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
2785         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
2786         * layout.cc (Layout::attach_allocated_section_to_segment):
2787         Take new const Target* argument.  If target->isolate_execinstr(), act
2788         like --rosegment.
2789         (Layout::find_first_load_seg): Take new const Target* argument;
2790         if target->isolate_execinstr(), reject PF_X segments.
2791         (Layout::relaxation_loop_body): Update caller.
2792         (Layout::set_segment_offsets): If target->isolate_execinstr(),
2793         reset file offset to zero when we hit LOAD_SEG, and then do a second
2794         loop over the segments before LOAD_SEG to reassign offsets after
2795         addresses have been determined.  Handle target->rosegment_gap().
2796         (Layout::attach_section_to_segment): Take new const Target* argument;
2797         pass it to attach_allocated_section_to_segment.
2798         (Layout::make_output_section): Update caller.
2799         (Layout::attach_sections_to_segments): Take new const Target* argument;
2800         pass it to attach_section_to_segment.
2801         * gold.cc (queue_middle_tasks): Update caller.
2802         * layout.h (Layout): Update method decls with new arguments.
2803
2804         * arm.cc (Target_arm::Target_arm): Take optional argument for the
2805         Target_info pointer to use.
2806         (Target_arm::do_make_data_plt): New virtual method.
2807         (Target_arm::make_data_plt): New method that calls it.
2808         (Target_arm::make_plt_entry): Use it.
2809         (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
2810         for the section alignment.
2811         (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
2812         method.
2813         (Output_data_plt_arm::first_plt_entry_offset): Call it.
2814         (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
2815         method.
2816         (Output_data_plt_arm::get_plt_entry_size): Call it.
2817         (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
2818         (Output_data_plt_arm::fill_plt_entry): New method that calls it.
2819         (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
2820         method.
2821         (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
2822         (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
2823         method instead of sizeof(plt_entry).
2824         (Output_data_plt_arm::add_entry): Likewise.
2825         Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
2826         (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
2827         than static method.
2828         (Target_arm::plt_entry_size): Likewise.
2829         (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
2830         Move to ...
2831         (Output_data_plt_arm_standard): ... here, new class.
2832         (Output_data_plt_arm::do_write): Move guts of PLT filling to...
2833         (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
2834         (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
2835
2836         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
2837         Take additional argument for the PLT entry size.
2838         (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
2839         Use get_plt_entry_size method rather than plt_entry_size variable.
2840         (Output_data_plt_x86_64::reserve_slot): Likewise.
2841         (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
2842         (Output_data_plt_x86_64::add_entry): Likewise.
2843         (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
2844         (Output_data_plt_x86_64::address_for_global): Likewise.
2845         (Output_data_plt_x86_64::address_for_local): Likewise.
2846         (Output_data_plt_x86_64::set_final_data_size): Likewise.
2847         (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
2848         Make method non-static.
2849         (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
2850         method.
2851         (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
2852         (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
2853         (Output_data_plt_x86_64::add_eh_frame): New method to call it.
2854         (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
2855         virtual method.
2856         (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
2857         (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
2858         virtual method.
2859         (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
2860         (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
2861         virtual method.
2862         (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
2863         (Output_data_plt_x86_64::plt_entry_size)
2864         (Output_data_plt_x86_64::first_plt_entry)
2865         (Output_data_plt_x86_64::plt_entry)
2866         (Output_data_plt_x86_64::tlsdesc_plt_entry)
2867         (Output_data_plt_x86_64::plt_eh_frame_fde_size)
2868         (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
2869         (Output_data_plt_x86_64_standard): ... here, new class.
2870         (Target_x86_64::Target_x86_64): Take optional argument for the
2871         Target_info pointer to use.
2872         (Target_x86_64::do_make_data_plt): New virtual method.
2873         (Target_x86_64::make_data_plt): New method to call it.
2874         (Target_x86_64::init_got_plt_for_update): Use that.
2875         Call this->plt_->add_eh_frame method here.
2876         (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
2877         (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
2878         rather than static method.
2879         (Target_x86_64::plt_entry_size): Likewise.
2880         (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
2881         rather than plt_entry_size variable.  Move guts of PLT filling to...
2882         (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
2883         (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
2884         (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
2885
2886         * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
2887         additional argument for the section alignment.
2888         Don't do add_eh_frame_for_plt here.
2889         (Output_data_plt_i386::first_plt_entry_offset): Make the method
2890         non-static.  Use get_plt_entry_size method rather than plt_entry_size
2891         variable.
2892         (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
2893         method.
2894         (Output_data_plt_i386::get_plt_entry_size): Call it.
2895         (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
2896         (Output_data_plt_i386::add_eh_frame): New method to call it.
2897         (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
2898         method.
2899         (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
2900         (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
2901         method.
2902         (Output_data_plt_i386::fill_plt_entry): New method to call it.
2903         (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
2904         method instead of plt_entry_size.
2905         (Output_data_plt_i386::plt_entry_size)
2906         (Output_data_plt_i386::plt_eh_frame_fde_size)
2907         (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
2908         (Output_data_plt_i386_standard): ... here, new class.
2909         (Output_data_plt_i386_exec): New class.
2910         (Output_data_plt_i386::exec_first_plt_entry): Move to ...
2911         (Output_data_plt_i386_exec::first_plt_entry): ... here.
2912         (Output_data_plt_i386::exec_plt_entry): Move to ...
2913         (Output_data_plt_i386_exec::plt_entry): ... here.
2914         (Output_data_plt_i386_dyn): New class.
2915         (Output_data_plt_i386::first_plt_entry): Move to ...
2916         (Output_data_plt_i386_dyn::first_plt_entry): ... here.
2917         (Output_data_plt_i386::dyn_plt_entry): Move to ...
2918         (Output_data_plt_i386_dyn::plt_entry): ... here.
2919         (Target_i386::Target_i386): Take optional argument for the Target_info
2920         pointer to use.
2921         (Target_i386::do_make_data_plt): New virtual method.
2922         (Target_i386::make_data_plt): New method to call it.
2923         (Target_i386::make_plt_section): Use that.
2924         Call this->plt_->add_eh_frame method here.
2925         (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
2926         rather than plt_entry_size variable.
2927         (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
2928         (Output_data_plt_i386::address_for_local): Likewise.
2929         (Output_data_plt_i386::do_write): Likewise.
2930         Move guts of PLT filling to...
2931         (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
2932         (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
2933         (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
2934         (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
2935
2936 2012-05-01  Cary Coutant  <ccoutant@google.com>
2937
2938         * dwarf_reader.cc (Dwarf_die::read_attributes)
2939         (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
2940         (Dwarf_die::uint_attribute): Remove DW_FORM_null.
2941         * reduced_debug_output.cc
2942         (Output_reduced_debug_info_section::get_die_end): Remove
2943         DW_FORM_GNU_ref_index.  Add default case.
2944
2945 2012-04-26  Mark Wielaard  <mjw@redhat.com>
2946
2947         * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
2948         * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
2949         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
2950         DW_AT_high_pc as offset from DW_AT_low_pc.
2951
2952         * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
2953         * testsuite/Makefile.in: Regenerate.
2954         * testsuite/gdb_index_test_3.c: New test source file.
2955         * testsuite/gdb_index_test_3.sh: New test source file.
2956
2957 2012-04-25  Ian Lance Taylor  <iant@google.com>
2958
2959         * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
2960         pointer.
2961         (Stub_addend_reader::operator()): Declare Arm_relocate_functions
2962         as a class, not a struct.
2963         (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
2964         (Target_arm::apply_cortex_a8_workaround): Likewise.
2965         * gc.h: Declare Reloc_types as a struct, not a class.
2966         * object.h: Declare Symbols_data as a struct.
2967         * reloc.h: Declare Read_relocs_data as a struct.
2968         * target.h: Declare Relocate_info as a struct.
2969
2970 2012-04-24  David S. Miller  <davem@davemloft.net>
2971
2972         * sparc.cc (Target_sparc::Relocate::relax_call): New function.
2973         (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
2974         and R_SPARC_WPLT30.
2975
2976 2012-04-24  Cary Coutant  <ccoutant@google.com>
2977
2978         * incremental-dump.cc (find_input_containing_global): Replace
2979         magic number with symbolic constant.
2980         (dump_incremental_inputs): Update version number.
2981         * incremental.cc (Output_section_incremental_inputs): Update version
2982         number; import symbolic constants from Incremental_inputs_reader.
2983         (Incremental_inputs::create_data_sections): Align relocations
2984         section correctly for 64-bit targets.
2985         (Output_section_incremental_inputs::set_final_data_size): Use symbolic
2986         constants; add padding.
2987         (Output_section_incremental_inputs::write_header): Add assert for
2988         header_size.
2989         (Output_section_incremental_inputs::write_input_files): Add assert
2990         for input_entry_size.
2991         (Output_section_incremental_inputs::write_info_blocks): Add padding;
2992         add assert for object_info_size, input_section_entry_size,
2993         global_sym_entry_size.
2994         * incremental.h (Incremental_inputs_reader): Add symbolic constants
2995         for data structure sizes; use them.
2996         (Incremental_input_entry_reader): Import symbolic constants from
2997         Incremental_inputs_reader; use them.
2998
2999 2012-04-23  David S. Miller  <davem@davemloft.net>
3000
3001         * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
3002         and elf_flags_set_.
3003         (Target_sparc::Target_sparc): Initialize new fields.
3004         (Target_sparc::do_make_elf_object): New function.
3005         (Target_sparc::do_adjust_elf_header): New function.
3006
3007 2012-04-23  Cary Coutant  <ccoutant@google.com>
3008
3009         * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
3010         CU range table of gdb index.
3011
3012 2012-04-20  David S. Miller  <davem@davemloft.net>
3013
3014         * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
3015         instead of false.
3016
3017 2012-04-16  David S. Miller  <davem@davemloft.net>
3018
3019         * sparc.cc (Target_sparc::got_address): New function.
3020         (Sparc_relocate_functions::gdop_hix22): New function.
3021         (Sparc_relocate_functions::gdop_lox10): New function.
3022         (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
3023         relocs.
3024         (Target_sparc::Scan::local): Likewise if the global symbol is not
3025         preemptible and is not IFUNC.
3026         (Target_sparc::Relocate::relocate): Perform GOTDATA code
3027         transformations for local and non-preemptible non-IFUNC global
3028         symbols.
3029
3030         * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
3031         writing out 64-bit part of ranges.
3032
3033         * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
3034         -fpic and -fpie respectively.
3035         * Makefile.in: Regenerate.
3036
3037         * sparc.cc (class Target_sparc): Add rela_ifunc_.
3038         (Target_sparc::Target_sparc): Initialize new field.
3039         (Target_sparc::do_plt_section_for_global): New function.
3040         (Target_sparc::do_plt_section_for_local): New function.
3041         (Target_sparc::reloc_needs_plt_for_ifunc): New function.
3042         (Target_sparc::make_plt_section): New function, broken out of
3043         make_plt_entry.  Use ORDER_NON_RELRO_FIRST for ".plt".
3044         (Target_sparc::make_plt_entry): Call make_plt_section.
3045         (Target_sparc::make_local_ifunc_plt_entry): New function.
3046         (Target_sparc::rela_ifunc_section): New function.
3047         (Target_sparc::plt_section): Remove const.
3048         (Output_data_plt_sparc): Update declarations.  Define Global_ifunc
3049         and Local_ifunc types.  Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
3050         and ifunc_count_ fields.
3051         (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
3052         (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
3053         (Output_data_plt_sparc::add_local_ifunc_entry): New function.
3054         (Output_data_plt_sparc::rela_ifunc): New function.
3055         (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
3056         (Output_data_plt_sparc::has_ifunc_section): New function.
3057         (Output_data_plt_sparc::entry_count): Include ifunc_count_.
3058         (Output_data_plt_sparc::address_for_global): New function.
3059         (Output_data_plt_sparc::address_for_local): New function.
3060         (Output_data_plt_sparc::plt_index_to_offset): New function.
3061         (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
3062         and entry_count.
3063         (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
3064         entry_count.
3065         (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
3066         R_SPARC_JMP_IREL to switch.
3067         (Target_sparc::Scan::check_non_pic): Likewise.
3068         (Target_sparc::Scan::local): Handle IFUNC symbols.
3069         (Target_sparc::Scan::local): Likewise.
3070         (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
3071         and plt_address_for_local.
3072         (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
3073         Define __rel_iplt_start and __rel_iplt_end if doing a static link.
3074
3075         * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
3076         (class Output_data_reloc): Adjust calls to Output_reloc_type.
3077         (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
3078         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
3079         global relocs too.
3080         (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
3081         * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
3082         calls.
3083         * sparc.cc (Target_sparc::Scan::global): Likewise.
3084         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
3085
3086 2012-04-16  Cary Coutant  <ccoutant@google.com>
3087
3088         * archive.cc (Library_base::should_include_member): Check for
3089         --export-dynamic-symbol.
3090         * options.h (class General_options): Add --export-dynamic-symbol.
3091         * symtab.cc (Symbol::should_add_dynsym_entry): Check for
3092         --export-dynamic-symbol.
3093         (Symbol_table::gc_mark_undef_symbols): Likewise.
3094         (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
3095
3096 2012-04-12  David S. Miller  <davem@davemloft.net>
3097
3098         * sparc.cc (Reloc::wdisp10): New relocation method.
3099         (Reloc::h34): Likewise.
3100         (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
3101         (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
3102         R_SPARC_WDISP10.
3103         (Target_sparc::Scan::local): Likewise.
3104         (Target_sparc::Scan::global): Likewise.
3105         (Target_sparc::Relocate::relocate): Likewise.
3106
3107 2012-04-09  Cary Coutant  <ccoutant@google.com>
3108
3109         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
3110         low_pc == 0.
3111
3112 2012-04-06  Ian Lance Taylor  <iant@google.com>
3113
3114         * timer.cc: #include <unistd.h>.
3115
3116 2012-04-06  Roland McGrath  <mcgrathr@google.com>
3117
3118         * configure.in (AC_CHECK_HEADERS): Add locale.h.
3119         * config.in: Regenerate.
3120         * configure: Regenerate.
3121
3122 2012-04-05  Nick Clifton  <nickc@redhat.com>
3123
3124         * configure.ac (AC_CHECK_FUNCS): Add setlocale.
3125         (AM_LC_MESSAGES): Add.
3126         * aclocal.m4: Regenerate.
3127         * config.in: Regenerate.
3128         * configure: Regenerate.
3129
3130 2012-03-21  Cary Coutant  <ccoutant@google.com>
3131
3132         * Makefile.am: Add gdb-index.cc, gdb-index.h.
3133         * Makefile.in: Regenerate.
3134         * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
3135         (Sized_elf_reloc_mapper::symbol_section): New function.
3136         (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
3137         (make_elf_reloc_mapper): New function.
3138         (Dwarf_abbrev_table::clear_abbrev_codes): New function.
3139         (Dwarf_abbrev_table::do_read_abbrevs): New function.
3140         (Dwarf_abbrev_table::do_get_abbrev): New function.
3141         (Dwarf_ranges_table::read_ranges_table): New function.
3142         (Dwarf_ranges_table::read_range_list): New function.
3143         (Dwarf_pubnames_table::read_section): New function.
3144         (Dwarf_pubnames_table::read_header): New function.
3145         (Dwarf_pubnames_table::next_name): New function.
3146         (Dwarf_die::Dwarf_die): New function.
3147         (Dwarf_die::read_attributes): New function.
3148         (Dwarf_die::skip_attributes): New function.
3149         (Dwarf_die::set_name): New function.
3150         (Dwarf_die::set_linkage_name): New function.
3151         (Dwarf_die::attribute): New function.
3152         (Dwarf_die::string_attribute): New function.
3153         (Dwarf_die::int_attribute): New function.
3154         (Dwarf_die::uint_attribute): New function.
3155         (Dwarf_die::ref_attribute): New function.
3156         (Dwarf_die::child_offset): New function.
3157         (Dwarf_die::sibling_offset): New function.
3158         (Dwarf_info_reader::check_buffer): New function.
3159         (Dwarf_info_reader::parse): New function.
3160         (Dwarf_info_reader::do_parse): New function.
3161         (Dwarf_info_reader::do_read_string_table): New function.
3162         (Dwarf_info_reader::lookup_reloc): New function.
3163         (Dwarf_info_reader::get_string): New function.
3164         (Dwarf_info_reader::visit_compilation_unit): New function.
3165         (Dwarf_info_reader::visit_type_unit): New function.
3166         (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
3167         Sized_elf_reloc_mapper.
3168         (Sized_dwarf_line_info::symbol_section): Remove function.
3169         (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
3170         (Sized_dwarf_line_info::read_line_mappings): Remove object
3171         parameter, adjust callers.
3172         (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
3173         * dwarf_reader.h: Include <sys/types.h>.
3174         (class Track_relocs): Remove forward declaration.
3175         (class Elf_reloc_mapper): New class.
3176         (class Sized_elf_reloc_mapper): New class.
3177         (class Dwarf_abbrev_table): New class.
3178         (class Dwarf_range_list): New class.
3179         (class Dwarf_ranges_table): New class.
3180         (class Dwarf_pubnames_table): New class.
3181         (class Dwarf_die): New class.
3182         (class Dwarf_info_reader): New class.
3183         (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
3184         (Sized_dwarf_line_info::symbol_section): Remove member function.
3185         * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
3186         base class.
3187         * gdb-index.cc: New source file.
3188         * gdb-index.h: New source file.
3189         * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
3190         and .debug_types sections, call Layout::add_to_gdb_index.
3191         (Sized_relobj_incr::do_section_name): Implement.
3192         (Sized_relobj_incr::do_section_contents): Adjust parameter list and
3193         return type; Implement.
3194         (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
3195         return type.
3196         * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
3197         parameter list and return type.
3198         (Sized_incr_dynobj::do_section_contents): Likewise.
3199         * layout.cc: Include gdb-index.h.
3200         (Layout::Layout): Initialize gdb_index_data_.
3201         (Layout::init_fixed_output_section): Check for .gdb_index section.
3202         (Layout::add_to_gdb_index): New function. Instantiate.
3203         * layout.h: Add forward declaration for class Gdb_index.
3204         (Layout::add_to_gdb_index): New member function.
3205         (Layout::gdb_index_data_): New data member.
3206         * main.cc: Include gdb-index.h.
3207         (main): Print statistics for gdb index.
3208         * object.cc (Object::section_contents): Move code into
3209         do_section_contents.
3210         (need_decompressed_section): Check for sections needed when building
3211         gdb index.
3212         (build_compressed_section_map): Likewise.
3213         (Sized_relobj_file::do_read_symbols): Need local symbols when building
3214         gdb index.
3215         (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
3216         sections; call Layout::add_to_gdb_index.
3217         (Sized_relobj_file::do_decompressed_section_contents): Call
3218         do_section_contents directly.
3219         * object.h (Object::do_section_contents): Adjust parameter list and
3220         return type.
3221         (Object::do_decompressed_section_contents): Call do_section_contents
3222         directly.
3223         (Sized_relobj_file::do_section_contents): Adjust parameter list and
3224         return type.
3225         * options.h (class General_options): Add --gdb-index option.
3226         * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
3227         list and return type.
3228         * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
3229         * reloc.h (Track_relocs::checkpoint): New function.
3230         (Track_relocs::reset): New function.
3231
3232         * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
3233         New test cases.
3234         * testsuite/Makefile.in: Regenerate.
3235         * testsuite/gdb_index_test.cc: New test source file.
3236         * testsuite/gdb_index_test_1.sh: New test source file.
3237         * testsuite/gdb_index_test_2.sh: New test source file.
3238
3239 2012-03-19  Doug Kwan  <dougkwan@google.com>
3240
3241         * arm.cc (Target_arm::do_define_standard_symbols): New method.
3242         (Target_arm::do_finalize_sections): Remove code which defines
3243         __exidx_start and __exidx_end.  Make symbol table parameter
3244         anonymous as it is not used.
3245         * gold.cc (queue_middle_tasks): Call target hook to define any
3246         target-specific symbols.
3247         * target.h (Target::define_standard_symbols): New method.
3248         (Target::do_define_standard_symbols): Same.
3249         * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
3250         * testsuite/Makefile.in: Regenerate.
3251         * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
3252         and __exidx_end.
3253         * testsuite/arm_exidx_test.sh: Check that no unused dynamic
3254         relocations are generated for __exidx_start and __exidx_end.
3255
3256 2012-03-16  Doug Kwan  <dougkwan@google.com>
3257
3258         * testsuite/Makefile.am: Disable test initpri3b.
3259         * testsuite/Makefile.in: Regenerate.
3260
3261 2012-03-15  Doug Kwan  <dougkwan@google.com>
3262
3263         * arm.cc (Target_arm::got_section): Make .got section read-only
3264         if -z now is given.
3265
3266 2012-03-15  Ian Lance Taylor  <iant@google.com>
3267
3268         PR gold/13850
3269         * layout.cc (Layout::make_output_section): Correctly mark
3270         SHT_INIT_ARRAY, et. al., as relro.
3271
3272 2012-03-14  Doug Kwan  <dougkwan@google.com>
3273
3274         * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
3275         dynamic relocations for protected symbols in shared objects.
3276
3277 2012-03-13  Ian Lance Taylor  <iant@google.com>
3278
3279         * resolve.cc (Symbol_table::resolve): When merging common symbols,
3280         keep the larger alignment.
3281
3282 2012-03-12  Cary Coutant  <ccoutant@google.com>
3283
3284         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
3285         handling of DW_LNE_define_file.
3286
3287 2012-03-12  Cary Coutant  <ccoutant@google.com>
3288
3289         * reduced_debug_output.cc
3290         (Output_reduced_debug_info_section::get_die_end): Add new FORM
3291         codes to switch.
3292
3293 2012-02-29  Cary Coutant  <ccoutant@google.com>
3294
3295         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
3296
3297 2012-02-29  Cary Coutant  <ccoutant@google.com>
3298
3299         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
3300         Call Object::decompressed_section_contents.
3301         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
3302         New dtor.
3303         (Sized_dwarf_line_info::buffer_start_): New data member.
3304         * merge.cc (Output_merge_data::do_add_input_section): Call
3305         Object::decompressed_section_contents.
3306         (Output_merge_string::do_add_input_section): Likewise.
3307         * object.cc (need_decompressed_section): New function.
3308         (build_compressed_section_map): Decompress sections needed later.
3309         (Sized_relobj_file::do_decompressed_section_contents): New function.
3310         (Sized_relobj_file::do_discard_decompressed_sections): New function.
3311         * object.h (Object::decompressed_section_contents): New function.
3312         (Object::discard_decompressed_sections): New function.
3313         (Object::do_decompressed_section_contents): New function.
3314         (Object::do_discard_decompressed_sections): New function.
3315         (Compressed_section_info): New type.
3316         (Compressed_section_map): Include decompressed section contents.
3317         (Sized_relobj_file::do_decompressed_section_contents): New function.
3318         (Sized_relobj_file::do_discard_decompressed_sections): New function.
3319
3320 2012-02-16  Cary Coutant  <ccoutant@google.com>
3321
3322         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
3323         * testsuite/Makefile.in: Regenerate.
3324
3325 2012-02-14  Cary Coutant  <ccoutant@google.com>
3326
3327         * options.cc (General_options::finalize): Disallow -pie and -static.
3328
3329 2012-02-03  Doug Kwan  <dougkwan@google.com>
3330
3331         * arm.cc (Arm_relocate_functions::abs8,
3332         Arm_relocate_functions::abs16): Use
3333         Bits::has_signed_unsigned_overflow32.
3334         (Arm_relocate_functions::thm_abs8): Correct range of
3335         overflow check.
3336         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
3337         in assertions.
3338
3339 2012-02-02  Doug Kwan  <dougkwan@google.com>
3340
3341         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
3342         position independent outputs, not just shared objects.
3343
3344 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
3345
3346         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
3347         * configure: Regenerated.
3348
3349 2012-01-27  Ian Lance Taylor  <iant@google.com>
3350
3351         * reloc.h (Bits): New class with static functions, copied from
3352         namespace utils in arm.cc.
3353         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
3354         instead.
3355
3356 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
3357
3358         * incremental.cc (write_info_blocks): Correct relocation offset.
3359
3360 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
3361
3362         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
3363         (Relocate::tls_gd_to_le): Likewise.
3364
3365 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
3366
3367         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
3368
3369 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
3370
3371         * configure.ac: Check if -mcmodel=medium works.
3372         * configure: Regenerated.
3373
3374 2012-01-24  Cary Coutant  <ccoutant@google.com>
3375
3376         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
3377         definition and ...
3378         (read_unsigned_LEB_128_x): ... this new function.
3379         (read_signed_LEB_128): Replaced with inline definition and ...
3380         (read_signed_LEB_128_x): ... this new function.
3381         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
3382         (read_unsigned_LEB_128): Add inline definition.
3383         (read_signed_LEB_128_x): New function.
3384         (read_signed_LEB_128): Add inline definition.
3385         * testsuite/Makefile.am (leb128_unittest): New unit test.
3386         * testsuite/Makefile.in: Regenerate.
3387         * testsuite/leb128_unittest.cc: New unit test.
3388
3389 2012-01-23  Ian Lance Taylor  <iant@google.com>
3390
3391         PR gold/13617
3392         * i386.cc (Target_i386::do_code_fill): When using a jmp
3393         instruction, pad with nop instructions.
3394         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
3395
3396 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
3397
3398         * x86_64.cc (gc_process_relocs): Add typename on types used in
3399         template.
3400         (scan_relocs): Likewise.
3401         (relocate_section): Likewise.
3402         (apply_relocation): Likewise.
3403
3404 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
3405
3406         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
3407         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
3408         under x32.
3409
3410 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
3411
3412         * x86_64.cc: Initial support for x32.
3413
3414 2012-01-03  Cary Coutant  <ccoutant@google.com>
3415
3416         * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
3417         Use abstract base class for GOT.
3418         * gold/output.h (class Output_data_got_base): New abstract base class.
3419         (class Output_data_got): Derive from new base class, adjust ctors.
3420         (Output_data_got::reserve_slot): Make virtual; rename to
3421         do_reserve_slot; Adjust callers.
3422         * gold/target.h (Sized_target::init_got_plt_for_update): Return
3423         pointer to abstract base class.
3424         * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
3425
3426 2011-12-18  Ian Lance Taylor  <iant@google.com>
3427
3428         * object.h (Relobj::local_symbol_value): New function.
3429         (Relobj::local_plt_offset): New function.
3430         (Relobj::local_has_got_offset): New function.
3431         (Relobj::local_got_offset): New function.
3432         (Relobj::set_local_got_offset): New function.
3433         (Relobj::do_local_symbol_value): New pure virtual function.
3434         (Relobj::do_local_plt_offset): Likewise.
3435         (Relobj::do_local_has_got_offset): Likewise.
3436         (Relobj::do_local_got_offset): Likewise.
3437         (Relobj::do_set_local_got_offset): Likewise.
3438         (Sized_relobj::do_local_has_got_offset): Rename from
3439         local_has_got_offset.
3440         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
3441         (Sized_relobj::do_set_local_got_offset): Rename from
3442         set_local_got_offset.
3443         (Sized_relobj_file::do_local_plt_offset): Rename from
3444         local_plt_offset.
3445         (Sized_relobj_file::do_local_symbol_value): New function.
3446         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
3447         local_plt_offset.
3448         * output.cc (Output_data_got::Got_entry::write): Change object to
3449         Relobj.  Use local_symbol_value.
3450         (Output_data_got::add_global_with_rel): Change rel_dyn to
3451         Output_data_reloc_generic*.  Use add_global_generic.
3452         (Output_data_got::add_global_with_rela): Remove.  Change all
3453         callers to use add_global_with_rel.
3454         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
3455         Output_data_reloc_generic*.  Use add_global_generic.
3456         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
3457         callers to use add_global_pair_with_rel.
3458         (Output_data_got::add_local): Change object to Relobj*.
3459         (Output_data_got::add_local_plt): Likewise.
3460         (Output_data_got::add_local_with_rel): Change object to Relobj*,
3461         change rel_dyn to Output_data_reloc_generic*.  Use
3462         add_local_generic.
3463         (Output_data_got::add_local_with_rela): Remove.  Change all
3464         callers to use all_local_with_rel.
3465         (Output_data_got::add_local_pair_with_rel): Change object to
3466         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
3467         add_output_section_generic.
3468         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
3469         callers to use add_local_pair_with_rel.
3470         (Output_data_got::reserve_local): Change object to Relobj*.
3471         * output.h: (class Output_data_reloc_generic): Add pure virtual
3472         declarations for add_global_generic, add_local_generic,
3473         add_output_section_generic.
3474         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
3475         functions for Output_data_reloc_generic.  Update declarations for
3476         changes listed in output.cc.
3477         (class Output_data_got): Change template parameter to got_size.
3478         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
3479         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
3480         function.
3481         (Sized_relobj_incr::do_local_plt_offset): New function.
3482         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
3483         add_global_generic.
3484
3485 2011-12-17  Cary Coutant  <ccoutant@google.com>
3486
3487         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
3488         * resolve.cc (Symbol_table::resolve): Likewise.
3489         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
3490         arrays.
3491         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
3492
3493 2011-12-16  Ian Lance Taylor  <iant@google.com>
3494
3495         * output.h (Output_data_reloc_generic::add): Only call
3496         add_dynamic_reloc if this is a dynamic reloc section.
3497
3498 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
3499
3500         PR gold/13505
3501         * target-reloc.h (apply_relocation): Replace <64, false> with
3502         <size, big_endian>.
3503
3504 2011-11-25  Nick Clifton  <nickc@redhat.com>
3505
3506         * po/it.po: New Italian translation.
3507
3508 2011-11-17  Sterling Augustine  <saugustine@google.com>
3509
3510         * script.cc (script_include_directive): Implement.
3511         (read_script_file): New local variables name and search_path. Update
3512         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
3513         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
3514         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
3515
3516 2011-11-11  Sterling Augustine  <saugustine@google.com>
3517
3518         * yyscript.y (section_cmd): Add support for INCLUDE directive.
3519         (file_or_sections_cmd): Likewise.
3520
3521 2011-11-11  Doug Kwan  <dougkwan@google.com>
3522
3523         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
3524         if --just-symbols is given.
3525
3526 2011-11-10  Doug Kwan  <dougkwan@google.com>
3527
3528         PR gold/13362
3529         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
3530         when processing data relocs.
3531         * reloc.h (Relocate_functions::rel_unaligned): New method.
3532         (Relocate_functions::pcrel_unaligned): Ditto.
3533         (Relocate_functions::rel32_unaligned): Ditto.
3534         (Relocate_functions::pcrel32_unaligned): Ditto.
3535
3536 2011-11-09  Doug Kwan  <dougkwan@google.com>
3537
3538         PR gold/13362
3539         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
3540         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
3541         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
3542         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
3543         (Relocate_functions::rel_unaligned): New.
3544         (Relocate_functions::rel32_unaligned): New.
3545         * target-reloc.h (relocate_for_relocatable): Add code to handle
3546         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
3547         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
3548         arm_unaligned_reloc_r): New targets.
3549         * testsuite/Makefile.in: Regenerate.
3550         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
3551         linking.
3552
3553 2011-11-02  Ian Lance Taylor  <iant@google.com>
3554
3555         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
3556         NATIVE_LINKER.
3557         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
3558         * options.cc (General_options::finalize): Use library search path
3559         from configure script if specified.  If not native and no sysroot,
3560         only search TOOLLIBDIR.
3561         * options.h (Search_directory::Search_directory): Change name to
3562         const std::string&.
3563         (General_options::add_to_library_path_with_sysroot): Change arg to
3564         const std::string&.
3565         * configure, Makefile.in, config.in: Rebuild.
3566
3567 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
3568
3569         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
3570         we are working around the ARM1176 Erratum.
3571         * options.h (General_options::fix_arm1176): Add option.
3572         * testsuite/Makefile.am: Add testcases, and keep current ones
3573         working.
3574         * testsuite/Makefile.in: Regenerate.
3575         * testsuite/arm_fix_1176.s: New file.
3576         * testsuite/arm_fix_1176.sh: Likewise.
3577
3578 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
3579
3580         * arm.cc (Target_arm::Target_arm): Remove initialisation of
3581         may_use_blx_.
3582         (Target_arm::may_use_blx): Remove method.
3583         (Target_arm::set_may_use_blx): Likewise.
3584         (Target_arm::may_use_v4t_interworking): New method.
3585         (Target_arm::may_use_v5t_interworking): Likewise.
3586         (Target_arm::may_use_blx_): Remove member variable.
3587         (Arm_relocate_functions::arm_branch_common): Check for v5T
3588         interworking.
3589         (Arm_relocate_functions::thumb_branch_common): Likewise.
3590         (Reloc_stub::stub_type_for_reloc): Likewise.
3591         (Target_arm::do_finalize_sections): Correct interworking checks.
3592         * testsuite/Makefile.am: Add new tests.
3593         * testsuite/Makefile.in: Regenerate.
3594         * testsuite/arm_farcall_arm_arm.s: New test.
3595         * testsuite/arm_farcall_arm_arm.sh: Likewise.
3596         * testsuite/arm_farcall_arm_thumb.s: Likewise.
3597         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
3598         * testsuite/arm_farcall_thumb_arm.s: Likewise.
3599         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
3600         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
3601         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
3602
3603 2011-10-31  Cary Coutant  <ccoutant@google.com>
3604
3605         PR gold/13023
3606         * expression.cc (Expression::eval_with_dot): Add
3607         is_section_dot_assignment parameter.
3608         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
3609         absolute and assigning to dot within a section.
3610         * script-sections.cc
3611         (Output_section_element_assignment::set_section_addresses): Pass
3612         dot_section to set_if_absolute.
3613         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
3614         as is_section_dot_assignment flag to eval_with_dot.
3615         (Output_section_element_dot_assignment::set_section_addresses):
3616         Likewise.
3617         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
3618         parameter.  Also set value if relative to dot_section; set the
3619         symbol's output_section.
3620         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
3621         parameter.  Adjust all callers.
3622         (Expression::eval_maybe_dot): Likewise.
3623         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
3624         Adjust all callers.
3625         * testsuite/script_test_2.t: Test assignment of an absolute value
3626         to dot within an output section element.
3627
3628 2011-10-31  Cary Coutant  <ccoutant@google.com>
3629
3630         * options.h (class General_options): Add --[no-]gnu-unique options.
3631         * symtab.cc (Symbol_table::sized_write_globals): Convert
3632         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
3633
3634 2011-10-31  Cary Coutant  <ccoutant@google.com>
3635
3636         PR gold/13359
3637         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
3638         unnecessary assertion.
3639         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
3640
3641 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
3642
3643         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
3644         gc_mark_symbol.
3645         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
3646         gc_mark_symbol.
3647         Change to just keep the section associated with symbol.
3648         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
3649         they are externally visible and --export-dynamic is turned on.
3650         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
3651
3652 2011-10-19  Ian Lance Taylor  <iant@google.com>
3653
3654         PR gold/13163
3655         * script-sections.cc
3656         (Output_section_element_dot_assignment::needs_output_section): New
3657         function.
3658
3659 2011-10-19  Ian Lance Taylor  <iant@google.com>
3660
3661         PR gold/13204
3662         * layout.cc (Layout::segment_precedes): Don't assert failure if a
3663         --section-start option was seen.
3664         * options.h (General_options::any_section_start): New function.
3665
3666 2011-10-18  David S. Miller  <davem@davemloft.net>
3667
3668         PR binutils/13301
3669         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
3670         member to track relocation locations that have moved during TLS
3671         reloc optimizations.
3672         (Target_sparc::Relocate::Relocate): Initialize to NULL.
3673         (Target_sparc::Relocate::relocate): Adjust view down by 4
3674         bytes if it matches reloc_adjust_addr_.
3675         (Target_sparc::Relocate::relocate_tls): Always move the
3676         __tls_get_addr call delay slot instruction forward 4 bytes when
3677         performing relaxation.
3678
3679 2011-10-18  Cary Coutant  <ccoutant@google.com>
3680
3681         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
3682         (Output_file::map_no_anonymous): Check for non-zero
3683         return code from posix_fallocate.
3684
3685 2011-10-17  Cary Coutant  <ccoutant@google.com>
3686
3687         PR gold/13245
3688         * plugin.cc (is_visible_from_outside): Check for symbols
3689         referenced from dynamic objects.
3690         * resolve.cc (Symbol_table::resolve): Don't count references
3691         from dynamic objects as references from real ELF files.
3692         * testsuite/plugin_test_2.sh: Adjust expected result.
3693
3694 2011-10-17  Cary Coutant  <ccoutant@google.com>
3695
3696         * gold.cc: Include timer.h.
3697         (queue_middle_tasks): Stamp time.
3698         (queue_final_tasks): Likewise.
3699         * main.cc (main): Store timer in parameters.  Print timers
3700         for each pass.
3701         * parameters.cc (Parameters::Parameters): Initialize timer_.
3702         (Parameters::set_timer): New function.
3703         (set_parameters_timer): New function.
3704         * parameters.h (Parameters::set_timer): New function.
3705         (Parameters::timer): New function.
3706         (Parameters::timer_): New data member.
3707         (set_parameters_timer): New function.
3708         * timer.cc (Timer::stamp): New function.
3709         (Timer::get_pass_time): New function.
3710         * timer.h (Timer::stamp): New function.
3711         (Timer::get_pass_time): New function.
3712         (Timer::pass_times_): New data member.
3713
3714 2011-10-17  Cary Coutant  <ccoutant@google.com>
3715
3716         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
3717         task for members of lib groups.
3718
3719 2011-10-17  Cary Coutant  <ccoutant@google.com>
3720
3721         PR gold/13288
3722         * fileread.cc (File_read::find_view): Add assert.
3723         (File_read::make_view): Move bounds check (replace with assert)...
3724         (File_read::find_or_make_view): ... to here.
3725
3726 2011-10-12  Cary Coutant  <ccoutant@google.com>
3727
3728         * output.cc (Output_file::open_base_file): Handle case where
3729         ::read returns less than requested size.
3730
3731 2011-10-10  Cary Coutant  <ccoutant@google.com>
3732
3733         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
3734         Initialize defined_count_.
3735         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
3736         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
3737         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
3738         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
3739         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
3740         * incremental.h (Sized_relobj_incr::defined_count_): New data
3741         member.
3742         (Sized_incr_dynobj::defined_count_): New data member.
3743         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
3744         Return zeroes instead of internal error.
3745
3746 2011-10-10  Cary Coutant  <ccoutant@google.com>
3747
3748         PR gold/13249
3749         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
3750         (Output_reloc::symbol_value): Return PLT offset if flag is set.
3751         * output.h (class Output_reloc): Add use_plt_offset flag.
3752         (Output_reloc::type_): Adjust size of bit field.
3753         (Output_reloc::use_plt_offset_): New bit field.
3754         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
3755         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
3756         flag.  Adjust all callers.
3757         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
3758         creating RELATIVE relocations.
3759
3760 2011-10-10  Nick Clifton  <nickc@redhat.com>
3761
3762         * po/es.po: Updated Spanish translation.
3763         * po/fi.po: Updated Finnish translation.
3764
3765 2011-10-03   Diego Novillo  <dnovillo@google.com>
3766
3767         * options.cc (parse_uint): Fix dereference of RETVAL.
3768
3769 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
3770
3771         * layout.h (section_order_map_): New member.
3772         (get_section_order_map): New member function.
3773         * output.cc (Output_section::add_input_section): Check for patterns
3774         only when --section-ordering-file is specified.
3775         * gold.cc (queue_middle_tasks): Delay updating order of sections till
3776         output_sections have been formed.
3777         * layout.cc (Layout_Layout): Initialize section_order_map_.
3778         * plugin.cc (update_section_order): Store order in order_map. Do not
3779         update the order.
3780         * testsuite/Makefile.am: Add test case for plugin_final_layout.
3781         * testsuite/Makefile.in: Regenerate.
3782         * testsuite/plugin_section_order.c: New file.
3783         * testsuite/plugin_final_layout.cc: New file.
3784         * testsuite/plugin_final_layout.sh: New file.
3785
3786 2011-09-29  Cary Coutant  <ccoutant@google.com>
3787
3788         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
3789         Check for NULL.
3790         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
3791         symbols during incremental update.
3792         (Symbol_table::add_from_dynobj): Likewise.
3793
3794 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3795             Ian Lance Taylor  <iant@google.com>
3796
3797         * symtab.cc (Symbol_table::define_special_symbol): Always
3798         canonicalize version string.
3799
3800 2011-09-26  Cary Coutant  <ccoutant@google.com>
3801
3802         * gold.cc (queue_initial_tasks): Move option checks ...
3803         * options.cc (General_options::finalize): ... to here. Disable
3804         some options; make others fatal.
3805
3806 2011-09-26  Cary Coutant  <ccoutant@google.com>
3807
3808         gcc PR lto/47247
3809         * plugin.cc (get_symbols_v2): New function.
3810         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
3811         (is_referenced_from_outside): New function.
3812         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
3813         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
3814         (get_symbols): Pass version parameter.
3815         (get_symbols_v2): New function.
3816         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
3817         parameter.
3818         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
3819         (onload): Add LDPT_GET_SYMBOLS_V2.
3820         (all_symbols_read_hook): Use get_symbols_v2; check for
3821         LDPR_PREVAILING_DEF_IRONLY_EXP.
3822         * testsuite/plugin_test_3.sh: Update expected results.
3823
3824 2011-09-23  Simon Baldwin  <simonb@google.com>
3825
3826         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
3827         configuration options.
3828         * configure: Regenerate.
3829         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
3830         * Makefile.in: Regenerate.
3831         * testsuite/Makefile.in: Regenerate.
3832
3833 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
3834
3835         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
3836
3837 2011-09-19  Cary Coutant  <ccoutant@google.com>
3838
3839         * incremental.cc (can_incremental_update): Fix typo in comment.
3840         * incremental.h (can_incremental_update): Likewise.
3841
3842 2011-09-18  Cary Coutant  <ccoutant@google.com>
3843
3844         * incremental.cc (can_incremental_update): New function.
3845         * incremental.h (can_incremental_update): New function.
3846         * layout.cc (Layout::init_fixed_output_section): Call it.
3847         (Layout::make_output_section): Don't allow patch space in .eh_frame.
3848         * object.cc (Sized_relobj_file::do_layout): Call
3849         can_incremental_update.
3850
3851 2011-09-13  Cary Coutant  <ccoutant@google.com>
3852
3853         * configure.ac: Check for glibc support for gnu_indirect_function
3854         support with static linking, setting automake conditional
3855         IFUNC_STATIC.
3856         * Makefile.in: Regenerate.
3857         * configure: Regenerate.
3858
3859         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
3860         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
3861         for IFUNC_STATIC.
3862         * testsuite/Makefile.in: Regenerate.
3863
3864 2011-09-13  Cary Coutant  <ccoutant@google.com>
3865
3866         * incremental.cc (Sized_relobj_incr::do_layout): Call
3867         report_comdat_group for kept comdat sections.
3868         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
3869         * testsuite/Makefile.in: Regenerate.
3870         * testsuite/incr_comdat_test_1.cc: New source file.
3871         * testsuite/incr_comdat_test_2_v1.cc: New source file.
3872         * testsuite/incr_comdat_test_2_v2.cc: New source file.
3873         * testsuite/incr_comdat_test_2_v3.cc: New source file.
3874
3875 2011-09-13  Ian Lance Taylor  <iant@google.com>
3876
3877         * object.cc (Sized_relobj_file::do_layout): Remove unused local
3878         variable external_symbols_offset.
3879
3880 2011-09-12  Ian Lance Taylor  <iant@google.com>
3881
3882         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
3883         triggered if object has no symbols.
3884
3885 2011-09-09  David S. Miller  <davem@davemloft.net>
3886
3887         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
3888         (Output_fill_debug_line::do_write): Likewise.
3889
3890 2011-08-29  Cary Coutant  <ccoutant@google.com>
3891
3892         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
3893         casts to match formatting specs.
3894         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
3895
3896 2011-08-26  Cary Coutant  <ccoutant@google.com>
3897
3898         * layout.cc (Free_list::allocate): Provide guarantee of minimum
3899         remaining hole size when allocating.
3900         (Layout::make_output_section): Set fill methods for debug sections.
3901         * layout.h (Free_list::Free_list_node): Move from private to
3902         public.
3903         (Free_list::set_min_hole_size): New function.
3904         (Free_list::begin, Free_list::end): New functions.
3905         (Free_list::min_hole_): New data member.
3906         * output.cc: Include dwarf.h.
3907         (Output_fill_debug_info::do_minimum_hole_size): New function.
3908         (Output_fill_debug_info::do_write): New function.
3909         (Output_fill_debug_line::do_minimum_hole_size): New function.
3910         (Output_fill_debug_line::do_write): New function.
3911         (Output_section::Output_section): Initialize new data member.
3912         (Output_section::set_final_data_size): Ensure patch space is larger
3913         than minimum hole size.
3914         (Output_section::do_write): Fill holes in debug sections.
3915         * output.h (Output_fill): New class.
3916         (Output_fill_debug_info): New class.
3917         (Output_fill_debug_line): New class.
3918         (Output_section::set_free_space_fill): New function.
3919         (Output_section::free_space_fill_): New data member.
3920         * testsuite/Makefile.am (incremental_test_3): Add
3921         --incremental-patch option.
3922         (incremental_test_4): Likewise.
3923         (incremental_test_5): Likewise.
3924         (incremental_test_6): Likewise.
3925         (incremental_copy_test): Likewise.
3926         (incremental_common_test_1): Likewise.
3927         * testsuite/Makefile.in: Regenerate.
3928
3929 2011-08-26  Nick Clifton  <nickc@redhat.com>
3930
3931         * po/es.po: Updated Spanish translation.
3932
3933 2011-08-01  Cary Coutant  <ccoutant@google.com>
3934
3935         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
3936         * gold/testsuite/Makefile.in: Regenerate.
3937         * gold/testsuite/justsyms_exec.c: New source file.
3938         * gold/testsuite/justsyms_lib.c: New source file.
3939
3940 2011-08-01  Cary Coutant  <ccoutant@google.com>
3941
3942         * layout.cc (Layout::set_segment_offsets): Don't realign text
3943         segment if -Ttext was specified.
3944         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
3945         file type.
3946         * object.h (Sized_relobj_file::e_type): New function.
3947         (Sized_relobj_file::e_type_): New data member.
3948         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
3949         base address for ET_EXEC files.
3950         * target.cc (Target::do_make_elf_object_implementation): Allow
3951         ET_EXEC files with --just-symbols option.
3952
3953 2011-07-28  Cary Coutant  <ccoutant@google.com>
3954
3955         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
3956         Add thread_number parameter.
3957         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
3958         * workqueue-threads.cc
3959         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
3960         current thread if its thread number is greater than desired thread
3961         count.
3962         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
3963         Add thread_number parameter.
3964         (Workqueue::should_cancel_thread): Likewise.
3965         (Workqueue::find_runnable_or_wait): Pass thread_number to
3966         should_cancel_thread.
3967         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
3968         parameter.
3969
3970 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
3971
3972         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
3973         only after checking if it cannot be forced local.
3974         * symtab.h (is_externally_visible): Check if the symbol is not forced
3975         local.
3976
3977 2011-07-15  Ian Lance Taylor  <iant@google.com>
3978
3979         * options.h (class General_options): Add --print-output-format.
3980         Move -EL next to -EB, for  better --help output.
3981         * target-select.cc: Include <cstdio>, "options.h", and
3982         "parameters.h".
3983         (Target_selector::do_target_bfd_name): New function.
3984         (print_output_format): New function.
3985         * target-select.h (class Target_selector): Update declarations.
3986         (Target_selector::target_bfd_name): New function.
3987         (print_output_format): Declare.
3988         * main.cc: Include "target-select.h".
3989         (main): Handle --print-output-format.
3990         * gold.cc: Include "target-select.h".
3991         (queue_initial_tasks): Handle --print-output-format when there are
3992         no input files.
3993         * parameters.cc (parameters_force_valid_target): Give a better
3994         error message if -EB/-EL does not match target.
3995         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
3996         function.
3997
3998 2011-07-15  Ian Lance Taylor  <iant@google.com>
3999
4000         * i386.cc (class Output_data_plt_i386): Add layout_ field.
4001         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
4002         (Output_data_plt_i386::do_write): Write address of .dynamic
4003         section to first entry in .got.plt section.
4004         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
4005         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
4006         Initialize layout_.
4007         (Output_data_plt_x86_64::do_write): Write address of .dynamic
4008         section to first entry in .got.plt section.
4009         * layout.h (Layout::dynamic_section): New function.
4010
4011 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
4012
4013         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
4014         to claim_file call.
4015         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
4016         input_section_position_, and input_section_glob_.
4017         (read_layout_from_file): Call function section_ordering_specified.
4018         * layout.h (is_section_ordering_specified): New function.
4019         (section_ordering_specified): New function.
4020         (section_ordering_specified_): New boolean member.
4021         * main.cc(main): Call load_plugins after layout object is defined.
4022         * output.cc (Output_section::add_input_section): Use
4023         function section_ordering_specified to check if section ordering is
4024         needed.
4025         * output.cc (Output_section::add_relaxed_input_section): Use
4026         function section_ordering_specified to check if section ordering is
4027         needed.
4028         (Output_section::update_section_layout): New function.
4029         (Output_section::sort_attached_input_sections): Check if input section
4030         must be reordered.
4031         * output.h (Output_section::update_section_layout): New function.
4032         * plugin.cc (get_section_count): New function.
4033         (get_section_type): New function.
4034         (get_section_name): New function.
4035         (get_section_contents): New function.
4036         (update_section_order): New function.
4037         (allow_section_ordering): New function.
4038         (Plugin::load): Add the new interfaces to the transfer vector.
4039         (Plugin_manager::load_plugins): New parameter.
4040         (Plugin_manager::all_symbols_read): New parameter.
4041         (Plugin_manager::claim_file): New parameter. Save the elf object for
4042         unclaimed objects.
4043         (Plugin_manager::get_elf_object): New function.
4044         (Plugin_manager::get_view): Change to directly use the bool to check
4045         if get_view is called from claim_file_hook.
4046         * plugin.h (input_objects): New function
4047         (Plugin__manager::load_plugins): New parameter.
4048         (Plugin_manager::claim_file): New parameter.
4049         (Plugin_manager::get_elf_object): New function.
4050         (Plugin_manager::in_claim_file_handler): New function.
4051         (Plugin_manager::in_claim_file_handler_): New member.
4052         (layout): New function.
4053         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
4054         handler with an extra parameter. Make the elf object before calling
4055         claim_file handler.
4056         * testsuite/plugin_test.c (get_section_count): New function pointer.
4057         (get_section_type): New function pointer.
4058         (get_section_name): New function pointer.
4059         (get_section_contents): New function pointer.
4060         (update_section_order): New function pointer.
4061         (allow_section_ordering): New function pointer.
4062         (onload): Check if the new interfaces exist.
4063
4064 2011-07-13  Ian Lance Taylor  <iant@google.com>
4065
4066         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
4067         relro section.
4068         * x86_64.cc (Target_x86_64::got_section): Likewise.
4069         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
4070         (relro_now_test_SOURCES): New variable.
4071         (relro_now_test_DEPENDENCIES): New variable.
4072         (relro_now_test_LDFLAGS): New variable.
4073         (relro_now_test_LDADD): New variable.
4074         (relro_now_test.so): New target.
4075         * testsuite/Makefile.in: Rebuild.
4076
4077 2011-07-12  Ian Lance Taylor  <iant@google.com>
4078
4079         PR gold/12980
4080         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
4081         GLOB_DAT relocation rather than a RELATIVE relocation for a
4082         protected symbol when creating a shared library.
4083         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
4084         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
4085         * testsuite/protected_main_1.cc (main): Test that protected
4086         function has same address.
4087
4088 2011-07-11  Ian Lance Taylor  <iant@google.com>
4089
4090         PR gold/12979
4091         * options.h (class General_options): Add -Bgroup.
4092         * options.cc (General_options::finalize): If -Bgroup is set,
4093         default to --unresolved-symbols=report-all.
4094         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
4095         * target-reloc.h (issue_undefined_symbol_error): Handle
4096         --unresolved-symbols=report-all.
4097
4098 2011-07-08  Ian Lance Taylor  <iant@google.com>
4099
4100         PR gold/11985
4101         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
4102         if linker script discards key sections.
4103         (Layout::create_dynamic_symtab): Likewise.
4104         (Layout::assign_local_dynsym_offsets): Likewise.
4105         (Layout::sized_create_version_sections): Likewise.
4106         (Layout::create_interp): Likewise.
4107         (Layout::finish_dynamic_section): Likewise.
4108         (Layout::set_dynamic_symbol_size): Likewise.
4109
4110 2011-07-08  Ian Lance Taylor  <iant@google.com>
4111
4112         PR gold/12386
4113         * options.h (class General_options): Add --unresolved-symbols.
4114         * target-reloc.h (issue_undefined_symbol_error): Check
4115         --unresolved-symbols.  Add comments.
4116
4117 2011-07-08  Ian Lance Taylor  <iant@google.com>
4118
4119         * testsuite/odr_violation2.cc (Ordering::operator()): Make
4120         expression more complex.
4121
4122 2011-07-08  Ian Lance Taylor  <iant@google.com>
4123
4124         PR gold/11317
4125         * target-reloc.h (issue_undefined_symbol_error): New inline
4126         function, broken out of relocate_section.
4127         (relocate_section): Call issue_undefined_symbol_error.
4128         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
4129         there is no TLS segment if we are about to issue an undefined
4130         symbol error.
4131         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
4132
4133 2011-07-08  Ian Lance Taylor  <iant@google.com>
4134
4135         PR gold/12279
4136         * resolve.cc (Symbol_table::should_override): Add fromtype
4137         parameter.  Change all callers.  Give error when linking together
4138         TLS and non-TLS symbol.
4139         (Symbol_table::should_override_with_special): Add fromtype
4140         parameter.  Change all callers.
4141         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
4142         there is no TLS segment if we have reported some errors.
4143         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
4144
4145 2011-07-08  Ian Lance Taylor  <iant@google.com>
4146
4147         PR gold/12372
4148         * target.h (Target::plt_address_for_global): New function.
4149         (Target::plt_address_for_local): New function.
4150         (Target::plt_section_for_global): Remove.
4151         (Target::plt_section_for_local): Remove.
4152         (Target::do_plt_address_for_global): New virtual function.
4153         (Target::do_plt_address_for_local): New virtual function.
4154         (Target::do_plt_section_for_global): Remove.
4155         (Target::do_plt_section_for_local): Remove.
4156         (Target::register_global_plt_entry): Add Symbol_table and Layout
4157         parameters.
4158         * output.cc (Output_data_got::Got_entry::write): Use
4159         plt_address_for_global and plt_address_for_local.
4160         * layout.cc (Layout::add_target_dynamic_tags): Use size and
4161         address of output section.
4162         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
4163         got_irelative_, and irelative_count_ fields.  Update
4164         declarations.
4165         (Output_data_plt_i386::has_irelative_section): New function.
4166         (Output_data_plt_i386::entry_count): Add irelative_count_.
4167         (Output_data_plt_i386::set_final_data_size): Likewise.
4168         (class Target_i386): Add got_irelative_ and rel_irelative_
4169         fields.  Update declarations.
4170         (Target_i386::Target_i386): Initialize new fields.
4171         (Target_i386::do_plt_address_for_global): New function replacing
4172         do_plt_section_for_global.
4173         (Target_i386::do_plt_address_for_local): New function replacing
4174         do_plt_section_for_local.
4175         (Target_i386::got_section): Create got_irelative_.
4176         (Target_i386::rel_irelative_section): New function.
4177         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
4178         fields.  Don't define __rel_iplt_{start,end}.
4179         (Output_data_plt_i386::add_entry): Add symtab and layout
4180         parameters.  Change all callers.  Use different PLT and GOT for
4181         IFUNC symbols.
4182         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
4183         layout parameters.  Change all callers.  Use different PLT and
4184         GOT.
4185         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
4186         (Output_data_plt_i386::rel_irelative): New function.
4187         (Output_data_plt_i386::address_for_global): New function.
4188         (Output_data_plt_i386::address_for_local): New function.
4189         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
4190         IRELATIVE GOT when changing IFUNC GOT entries.
4191         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
4192         reloc.
4193         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
4194         if we didn't create an IRELATIVE GOT.
4195         (Target_i386::Relocate::relocate): Use plt_address_for_global and
4196         plt_address_for_local.
4197         (Target_i386::do_dynsym_value): Use plt_address_for_global.
4198         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
4199         got_irelative_, and irelative_count_ fields.  Update
4200         declarations.
4201         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
4202         Initialize new fields.  Remove symtab parameter.  Change all
4203         callers.
4204         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
4205         irelative_count_.
4206         (Output_data_plt_x86_64::has_irelative_section): New function.
4207         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
4208         (class Target_x86_64): Add got_irelative_ and rel_irelative_
4209         fields.  Update declarations.
4210         (Target_x86_64::Target_x86_64): Initialize new fields.
4211         (Target_x86_64::do_plt_address_for_global): New function replacing
4212         do_plt_section_for_global.
4213         (Target_x86_64::do_plt_address_for_local): New function replacing
4214         do_plt_section_for_local.
4215         (Target_x86_64::got_section): Create got_irelative_.
4216         (Target_x86_64::rela_irelative_section): New function.
4217         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
4218         all callers.  Don't create __rel_iplt_{start,end}.
4219         (Output_data_plt_x86_64::add_entry): Add symtab and layout
4220         parameters.  Change all callers.  Use different PLT and GOT for
4221         IFUNC symbols.
4222         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
4223         layout parameters.  Change all callers.  Use different PLT and
4224         GOT.
4225         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
4226         parameters.  Change all callers.  Use different PLT and GOT for
4227         IFUNC symbols.
4228         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
4229         (Output_data_plt_x86_64::rela_irelative): New function.
4230         (Output_data_plt_x86_64::address_for_global): New function.
4231         (Output_data_plt_x86_64::address_for_local): New function.
4232         (Output_data_plt_x86_64::set_final_data_size): Likewise.
4233         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
4234         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
4235         (Target_x86_64::register_global_plt_entry): Add symtab and layout
4236         parameters.
4237         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
4238         reloc.
4239         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
4240         symbols if we didn't create an IRELATIVE GOT.
4241         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
4242         plt_address_for_local.
4243         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
4244         * testsuite/ifuncvar1.c: New test file.
4245         * testsuite/ifuncvar2.c: New test file.
4246         * testsuite/ifuncvar3.c: New test file.
4247         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
4248         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
4249         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
4250         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
4251         * testsuite/Makefile.in: Rebuild.
4252
4253 2011-07-07  Cary Coutant  <ccoutant@google.com>
4254
4255         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
4256         (two_file_test_1_ndebug.o): Likewise.
4257         (two_file_test_1b_ndebug.o): Likewise.
4258         (two_file_test_2_ndebug.o): Likewise.
4259         (two_file_test_main_ndebug.o): Likewise.
4260         (incremental_test_2): Link with no-debug versions.
4261
4262 2011-07-06  Cary Coutant  <ccoutant@google.com>
4263
4264         * gold/incremental.cc
4265         (Output_section_incremental_inputs::write_info_blocks): Check for
4266         hidden and internal symbols.
4267
4268 2011-07-06  Cary Coutant  <ccoutant@google.com>
4269
4270         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
4271         Check disposition for startup file.
4272         (Incremental_inputs::report_command_line): Ignore
4273         --incremental-startup-unchanged option.
4274         * options.cc (General_options::parse_incremental_startup_unchanged):
4275         New function.
4276         (General_options::General_options): Initialize new data member.
4277         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
4278         (General_options): Add --incremental-startup-unchanged option.
4279         (General_options::incremental_startup_disposition): New function.
4280         (General_options::incremental_startup_disposition_): New data member.
4281
4282 2011-07-06  Cary Coutant  <ccoutant@google.com>
4283
4284         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
4285         input file index to Script_info ctor.
4286         (Sized_incremental_binary::do_file_has_changed): Find the
4287         command-line argument for files named in scripts.
4288         * incremental.h (Script_info::Script_info): New ctor
4289         with input file index.
4290         (Script_info::input_file_index): New function.
4291         (Script_info::input_file_index_): New data member.
4292         (Incremental_binary::get_library): Add const.
4293         (Incremental_binary::get_script_info): Add const.
4294         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
4295         * testsuite/Makefile.am (incremental_test_5): New test case.
4296         (incremental_test_6): New test case.
4297         * testsuite/Makefile.in: Regenerate.
4298
4299 2011-07-06  Cary Coutant  <ccoutant@google.com>
4300
4301         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
4302         debug output when command lines differ.
4303
4304 2011-07-06  Cary Coutant  <ccoutant@google.com>
4305
4306         * incremental.cc (Incremental_inputs::report_command_line): Ignore
4307         --incremental-patch option.
4308         * layout.cc (Free_list::allocate): Extend allocation beyond original
4309         end if enabled.
4310         (Layout::make_output_section): Mark sections that should get
4311         patch space.
4312         * options.cc (parse_percent): New function.
4313         * options.h (parse_percent): New function.
4314         (DEFINE_percent): New macro.
4315         (General_options): Add --incremental-patch option.
4316         * output.cc (Output_section::Output_section): Initialize new data
4317         members.
4318         (Output_section::add_input_section): Print section name when out
4319         of patch space.
4320         (Output_section::add_output_section_data): Likewise.
4321         (Output_section::set_final_data_size): Add patch space when
4322         doing --incremental-full.
4323         (Output_section::do_reset_address_and_file_offset): Remove patch
4324         space.
4325         (Output_segment::set_section_list_addresses): Print debug output
4326         only if --incremental-update.
4327         * output.h (Output_section::set_is_patch_space_allowed): New function.
4328         (Output_section::is_patch_space_allowed_): New data member.
4329         (Output_section::patch_space_): New data member.
4330         * parameters.cc (Parameters::incremental_full): New function.
4331         * parameters.h (Parameters::incremental_full): New function
4332         * testsuite/Makefile.am (incremental_test_2): Add test for
4333         --incremental-patch option.
4334         * testsuite/Makefile.in: Regenerate.
4335         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
4336         (t18): Remove function body.
4337
4338 2011-07-05  Doug Kwan  <dougkwan@google.com>
4339
4340         PR gold/12771
4341         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
4342         Arm_Address type for relocation result.
4343         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
4344         overflow check.
4345         (Arm_relocate_functions::abs32): Use unaligned access.
4346         (Arm_relocate_functions::rel32): Ditto.
4347         (Arm_relocate_functions::prel31): Ditto.
4348         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
4349         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
4350         static data relocations.
4351         * testsuite/Makefile.in: Regnerate.
4352         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
4353
4354 2011-07-05  Ian Lance Taylor  <iant@google.com>
4355
4356         PR gold/12392
4357         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
4358         symbols if necessary.
4359         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
4360
4361 2011-07-05  Ian Lance Taylor  <iant@google.com>
4362
4363         PR gold/12952
4364         * resolve.cc (Symbol::override_base_with_special): Simply override
4365         version with special symbol version, ignoring previous version.
4366
4367 2011-07-05  Ian Lance Taylor  <iant@google.com>
4368
4369         * object.cc (Sized_relobj_file::include_section_group): Add
4370         information to comment about signature location.
4371
4372 2011-07-02  Ian Lance Taylor  <iant@google.com>
4373
4374         PR gold/12957
4375         * options.h (class General_options): Add -f and -F.
4376         * options.cc (General_options::finalize): Fatal error if -f/-F
4377         are used without -shared.
4378         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
4379
4380 2011-07-02  Ian Lance Taylor  <iant@google.com>
4381
4382         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
4383
4384 2011-07-01  Ian Lance Taylor  <iant@google.com>
4385
4386         PR gold/12525
4387         PR gold/12952
4388         * resolve.cc (Symbol::override_base_with_special): Don't override
4389         the version if the overriding symbol has a different name.
4390         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
4391         all callers.  If we give an error about an undefined version,
4392         define the base version if necessary.
4393         * dynobj.h (class Versions): Update declaration.
4394         * testsuite/weak_alias_test_5.cc: New file.
4395         * testsuite/weak_alias_test.script: New file.
4396         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
4397         and versioned_alias have the right value, and call t2.
4398         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
4399         weak_alias_test_5.so.
4400         (weak_alias_test_LDADD): Likewise.
4401         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
4402         * testsuite/Makefile.in: Rebuild.
4403
4404 2011-07-01  Ian Lance Taylor  <iant@google.com>
4405
4406         PR gold/12525
4407         * options.h (class General_options): Support -z notext.
4408         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
4409         -Wl,-z,notext.
4410         (two_file_shared_nonpic.so): Likewise.
4411         (two_file_shared_mixed.so): Likewise.
4412         (two_file_shared_mixed_1.so): Likewise.
4413         (weak_undef_lib_nonpic.so): Likewise.
4414         (alt/weak_undef_lib_nonpic.so): Likewise.
4415         (tls_test_shared_nonpic.so): Likewise.
4416         * testsuite/Makefile.in: Rebuild.
4417
4418 2011-07-01  Ian Lance Taylor  <iant@google.com>
4419
4420         PR gold/12525
4421         * configure.ac: Test whether static linking works, setting
4422         the automake conditional HAVE_STATIC.
4423         * testsuite/Makefile.am: Disable tests using -static if
4424         HAVE_STATIC is not true.
4425         * configure, testsuite/Makefile.in: Rebuild.
4426
4427 2011-07-01  Ian Lance Taylor  <iant@google.com>
4428
4429         PR gold/12525
4430         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
4431         Assert if we see DW_EH_PE_indirect.
4432         * target.h (Target::ehframe_datarel_base): New function.
4433         (Target::do_ehframe_datarel_base): New target function.
4434         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
4435         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
4436         function.
4437
4438 2011-07-01  Ian Lance Taylor  <iant@google.com>
4439
4440         PR gold/12571
4441         * options.h (class General_options): Add
4442         --ld-generated-unwind-info.
4443         * ehframe.cc (Fde::write): Add address parameter.  Change all
4444         callers.  If associated with PLT, fill in address and size.
4445         (Cie::set_output_offset): Only add merge mapping if there is an
4446         object.
4447         (Cie::write): Add address parameter.  Change all callers.
4448         (Eh_frame::add_ehframe_for_plt): New function.
4449         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
4450         input_offset_ fields into union u_, with new plt field.
4451         (Fde::Fde): Adjust for new union field.
4452         (Fde::Fde) [Output_data version]: New constructor.
4453         (Fde::add_mapping): Only add merge mapping if there is an object.
4454         (class Cie): Update declarations.
4455         (class Eh_frame): Declare add_ehframe_for_plt.
4456         * layout.cc (Layout::layout_eh_frame): Break out code into
4457         make_eh_frame_section, and call it.
4458         (Layout::make_eh_frame_section): New function.
4459         (Layout::add_eh_frame_for_plt): New function.
4460         * layout.h (class Layout): Update declarations.
4461         * merge.cc (Merge_map::add_mapping): Add assertion.
4462         * i386.cc: Include "dwarf.h".
4463         (class Output_data_plt_i386): Make first_plt_entry,
4464         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
4465         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
4466         and plt_eh_frame_fde.
4467         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
4468         boundary.  Call add_eh_frame_for_plt if appropriate.
4469         * x86_64.cc: Include "dwarf.h".
4470         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
4471         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
4472         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
4473         and plt_eh_frame_fde.
4474         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
4475         appropriate.
4476
4477 2011-06-29  Ian Lance Taylor  <iant@google.com>
4478
4479         PR gold/12629
4480         * object.cc (Sized_relobj_file::layout_section): Change shdr
4481         parameter to be const.
4482         (Sized_relobj_file::layout_eh_frame_section): New function, broken
4483         out of do_layout.
4484         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
4485         appropriate.  Call layout_eh_frame_section.
4486         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
4487         sections.
4488         * object.h (class Sized_relobj_file): Update declarations.
4489
4490 2011-06-29  Ian Lance Taylor  <iant@google.com>
4491
4492         PR gold/12652
4493         * script.cc (Token::integer_value): Accept trailing M/m/K/k
4494         modifier.
4495         (Lex::gather_token): Accept trailing M/m/K/k for integers.
4496
4497 2011-06-29  Ian Lance Taylor  <iant@google.com>
4498
4499         PR gold/12675
4500         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
4501         SHT_X86_64_UNWIND.
4502         * layout.cc (Layout::layout_eh_frame): Likewise.
4503
4504 2011-06-29  Ian Lance Taylor  <iant@google.com>
4505
4506         PR gold/12695
4507         * layout.cc (Layout::symtab_section_shndx): New function.
4508         * layout.h (class Layout): Declare symtab_section_shndx.
4509         * output.cc (Output_section::write_header): Call it.
4510
4511 2011-06-29  Ian Lance Taylor  <iant@google.com>
4512
4513         PR gold/12818
4514         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
4515         symbols which are not used in a relocation.
4516
4517 2011-06-28  Ian Lance Taylor  <iant@google.com>
4518
4519         PR gold/12898
4520         * layout.cc (Layout::segment_precedes): Don't crash if a linker
4521         script create indistinguishable segments.
4522         (Layout::set_segment_offsets): Use stable_sort when sorting
4523         segments.  Pass this to Compare_segments constructor.
4524         * layout.h (class Layout): Make segment_precedes non-static.
4525         (class Compare_segments): Change from struct to class.  Add
4526         layout_ field.  Add constructor.
4527         * script-sections.cc
4528         (Script_sections::attach_sections_using_phdrs_clause): Rename
4529         local orphan to is_orphan.  Don't report failure to put empty
4530         section in segment.  On attachment failure, report name of
4531         section, and attach to first PT_LOAD segment.
4532
4533 2011-06-28  Ian Lance Taylor  <iant@google.com>
4534
4535         PR gold/12934
4536         * target-select.cc (Target_selector::Target_selector): Add
4537         emulation parameter.  Change all callers.
4538         (select_target_by_bfd_name): Rename from select_target_by_name.
4539         Change all callers.
4540         (select_target_by_emulation): New function.
4541         (supported_emulation_names): New function.
4542         * target-select.h (class Target_selector): Add emulation_ field.
4543         Update declarations.
4544         (Target_selector::recognize_by_bfd_name): Rename from
4545         recognize_by_name.  Change all callers.
4546         (Target_selector::supported_bfd_names): Rename from
4547         supported_names.  Change all callers.
4548         (Target_selector::recognize_by_emulation): New function.
4549         (Target_selector::supported_emulations): New function.
4550         (Target_selector::emulation): New function.
4551         (Target_selector::do_recognize_by_bfd_name): Rename from
4552         do_recognize_by_name.  Change all callers.
4553         (Target_selector::do_supported_bfd_names): Rename from
4554         do_supported_names.  Change all callers.
4555         (Target_selector::do_recognize_by_emulation): New function.
4556         (Target_selector::do_supported_emulations): New function.
4557         (select_target_by_bfd_name): Change name in declaration.
4558         (select_target_by_emulation): Declare.
4559         (supported_emulation_names): Declare.
4560         * parameters.cc (parameters_force_valid_target): Try to find
4561         target based on emulation from -m option.
4562         * options.h (class General_options): Change doc string for -m.
4563         * options.cc (help): Print emulations.
4564         (General_options::parse_V): Likewise.
4565         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
4566         Add emulation parameter.  Change all callers.
4567
4568 2011-06-28  Ian Lance Taylor  <iant@google.com>
4569
4570         * target.h (class Target): Add osabi_ field.
4571         (Target::osabi): New function.
4572         (Target::set_osabi): New function.
4573         (Target::Target): Initialize osabi_.
4574         (Target::do_adjust_elf_header): Make pure virtual.
4575         (Sized_target::do_adjust_elf_header): Declare.
4576         * target.cc (Sized_target::do_adjust_elf_header): New function.
4577         (class Sized_target): Instantiate all versions.
4578         * freebsd.h (class Target_freebsd): Remove.
4579         (Target_selector_freebsd::do_recognize): Call set_osabi on
4580         Target.
4581         (Target_selector_freebsd::do_recognize_by_name): Likewise.
4582         (Target_selector_freebsd::set_osabi): Remove.
4583         * i386.cc (class Target_i386): Inherit from Sized_target rather
4584         than Target_freebsd.
4585         * x86_64.cc (class Target_x86_64): Likewise.
4586
4587 2011-06-28  Ian Lance Taylor  <iant@google.com>
4588
4589         * target.h (Target::can_check_for_function_pointers): Rewrite.
4590         Make non-virtual.
4591         (Target::can_icf_inline_merge_sections): Likewise.
4592         (Target::section_may_have_icf_unsafe_poineters): Likewise.
4593         (Target::Target_info): Add can_icf_inline_merge_sections field.
4594         (Target::do_can_check_for_function_pointers): New virtual
4595         function.
4596         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
4597         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
4598         from can_check_for_function_pointers, move in file.
4599         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
4600         section_may_have_icf_unsafe_poineters, move in file.
4601         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
4602         * i386.cc (Target_i386::do_can_check_for_function_pointers):
4603         Rename from can_check_for_function_pointers, move in file.
4604         (Target_i386::can_icf_inline_merge_sections): Remove.
4605         (Target_i386::i386_info): Initialize
4606         can_icf_inline_merge_sections.
4607         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
4608         Initialize can_icf_inline_merge_sections.
4609         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
4610         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
4611         Rename from can_check_for_function_pointers, move in file.
4612         (Target_x86_64::can_icf_inline_merge_sections): Remove.
4613         (Target_x86_64::x86_64_info): Initialize
4614         can_icf_inline_merge_sections.
4615         * testsuite/testfile.cc (Target_test::test_target_info):
4616         Likewise.
4617         * icf.cc (get_section_contents): Correct formatting.
4618
4619 2011-06-27  Ian Lance Taylor  <iant@google.com>
4620
4621         * symtab.cc (Symbol::versioned_name): New function.
4622         (Symbol_table::add_to_final_symtab): Use versioned_name when
4623         appropriate.
4624         (Symbol_table::sized_write_symbol): Likewise.
4625         * symtab.h (class Symbol): Declare versioned_name.
4626         * stringpool.h (class Stringpool_template): Add variant of add
4627         which takes a std::basic_string.
4628         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
4629         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
4630         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
4631         (ver_test_12.o): New target.
4632         * testsuite/Makefile.in: Rebuild.
4633
4634 2011-06-27  Doug Kwan  <dougkwan@google.com>
4635
4636         * arm.cc (Arm_relocate_functions::thm_jump8,
4637         Arm_relocate_functions::thm_jump11): Use a wider signed
4638         type to compute offset.
4639         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
4640         arm_thm_jump8.
4641         * testsuite/Makefile.in: Regenerate.
4642         * testsuite/arm_branch_in_range.sh: Check test results of
4643         arm_thm_jump11 and arm_thm_jump8.
4644         * testsuite/arm_thm_jump11.s: New test source file.
4645         * testsuite/arm_thm_jump11.t: New linker script.
4646         * testsuite/arm_thm_jump8.s: New test source file.
4647         * testsuite/arm_thm_jump8.t: New linker script.
4648
4649 2011-06-24  Ian Lance Taylor  <iant@google.com>
4650
4651         * layout.cc: Include "object.h".
4652         (ctors_sections_in_init_array): New static variable.
4653         (Layout::is_ctors_in_init_array): New function.
4654         (Layout::layout): Add entry to ctors_sections_in_init_array if
4655         appropriate.
4656         * layout.h (class Layout): Declare is_ctors_in_init_array.
4657         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
4658         is_ctors_reverse_view is set.
4659         (Sized_relobj_file::write_sections): Add layout parameter.  Change
4660         all callers.  Set is_ctors_reverse_view field of View_size.
4661         (Sized_relobj_file::reverse_words): New function.
4662         * object.h (Sized_relobj_file::View_size): Add
4663         is_ctors_reverse_view field.
4664         (class Sized_relobj_file): Update declarations.
4665         * testsuite/initpri3.c: New test.
4666         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
4667         initpri3b.
4668         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
4669         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
4670         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
4671         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
4672         * testsuite/Makefile.in: Rebuild.
4673
4674 2011-06-24  Cary Coutant  <ccoutant@google.com>
4675
4676         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
4677         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
4678         (debug_msg_cdebug.err): New targets.
4679         * testsuite/Makefile.in: Regenerate.
4680         * testsuite/debug_msg.sh: Check output of link with compressed debug.
4681         Fix checks for link with shared library.
4682
4683 2011-06-24  Doug Kwan  <dougkwan@google.com>
4684
4685         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
4686         skip empty text sections.
4687         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
4688
4689 2011-06-22  Ian Lance Taylor  <iant@google.com>
4690
4691         PR gold/12910
4692         * options.h (class General_options): Add --ctors-in-init-array.
4693         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
4694         friends as SHT_PROGBITS for merging sections.
4695         (Layout::layout): Remove special handling of .init_array and
4696         friends.  Don't sort if doing relocatable link.  Sort for .ctors
4697         and .dtors if ctors_in_init_array.
4698         (Layout::make_output_section): Force correct section types for
4699         .init_array and friends.  Don't sort if doing relocatable link,
4700         Don't sort .ctors and .dtors if ctors_in_init_array.
4701         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
4702         (Layout::output_section_name): Add relobj parameter.  Change all
4703         callers.  Handle .ctors. and .dtors. in code rather than table.
4704         Handle .ctors and .dtors if ctors_in_init_array.
4705         (Layout::match_file_name): New function, moved from output.cc.
4706         * layout.h (class Layout): Update declarations.
4707         * output.cc: Include "layout.h".
4708         (Input_section_sort_entry::get_priority): New function.
4709         (Input_section_sort_entry::match_file_name): Just call
4710         Layout::match_file_name.
4711         (Output_section::Input_section_sort_init_fini_compare::operator()):
4712         Handle .ctors and .dtors.  Sort by explicit priority rather than
4713         by name.
4714         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
4715         * testsuite/initpri2.c: New test.
4716         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
4717         (check_PROGRAMS): Add initpri2.
4718         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
4719         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
4720         * configure, testsuite/Makefile.in: Rebuild.
4721
4722 2011-06-19  Ian Lance Taylor  <iant@google.com>
4723
4724         PR gold/12880
4725         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
4726         .interp section to a PT_INTERP segment even if we have seen a
4727         --dynamic-linker option.  Don't do it if we have seen a PHDRS
4728         clause in a linker script.
4729         (Layout::finalize): Don't create a .interp section if we've
4730         already create a PT_INTERP segment.
4731         (Layout::create_interp): Always call choose_output_section (revert
4732         patch of 2011-06-17).  Don't create PT_INTERP segment.
4733         * script-sections.cc
4734         (Script_sections::create_note_and_tls_segments): Add a .interp
4735         section to a PT_INTERP segment even if we have seen a
4736         --dynamic-linker option.
4737
4738 2011-06-18  Ian Lance Taylor  <iant@google.com>
4739
4740         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
4741         merely because a non-PT_LOAD segment has a dynamic reloc.
4742
4743 2011-06-18  Ian Lance Taylor  <iant@google.com>
4744
4745         * layout.cc (Layout::finish_dynamic_section): Don't create
4746         DT_FLAGS entry if not needed.
4747
4748 2011-06-18  Ian Lance Taylor  <iant@google.com>
4749
4750         PR gold/12745
4751         * layout.cc (Layout::layout_eh_frame): Correct handling of
4752         writable .eh_frame section.
4753
4754 2011-06-17  Ian Lance Taylor  <iant@google.com>
4755
4756         PR gold/12893
4757         * resolve.cc (Symbol_table::resolve): Don't give an error if a
4758         symbol is redefined with the exact same object and value.
4759
4760 2011-06-17  Ian Lance Taylor  <iant@google.com>
4761
4762         PR gold/12880
4763         * layout.h (class Layout): Add interp_segment_ field.
4764         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
4765         (Layout::attach_allocated_section_to_segment): If making shared
4766         library, put .interp section in PT_INTERP segment.
4767         (Layout::finalize): Also call create_interp if -dynamic-linker
4768         option was used.
4769         (Layout::create_interp): Assert that there is no PT_INTERP
4770         segment.  If not using a SECTIONS clause, use make_output_section.
4771         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
4772         * script-sections.cc
4773         (Script_sections::create_note_and_tls_segments): If making shared
4774         library, put .interp section in PT_INTERP segment.
4775
4776 2011-06-17  Ian Lance Taylor  <iant@google.com>
4777
4778         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
4779         when making a shared library.
4780
4781 2011-06-17  Ian Lance Taylor  <iant@google.com>
4782
4783         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
4784         parameter.  Change all callers.  Don't issue warning about PC32
4785         against locally defined symbol.
4786
4787 2011-06-16  Ian Lance Taylor  <iant@google.com>
4788
4789         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
4790         occurs in same object.
4791
4792 2011-06-14  Alan Modra  <amodra@gmail.com>
4793
4794         * po/POTFILES.in: Regenerate.
4795
4796 2011-06-09  Ian Lance Taylor  <iant@google.com>
4797
4798         * script-sections.cc
4799         (Orphan_output_section::set_section_addresses): For a relocatable
4800         link set address to 0.
4801
4802 2011-06-09  Cary Coutant  <ccoutant@google.com>
4803
4804         PR gold/12804
4805         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
4806         used with --compress-debug-sections.
4807         * gold/object.cc (Sized_relobj_file::do_layout): Report
4808         uncompressed size of compressed input sections.
4809
4810 2011-06-08  Cary Coutant  <ccoutant@google.com>
4811
4812         PR gold/12804
4813         * testsuite/two_file_test_2_v1.cc: Change initialization of
4814         v2 to keep it in .data.
4815
4816 2011-06-07  Cary Coutant  <ccoutant@google.com>
4817
4818         * common.cc (Symbol_table::do_allocate_commons_list): Call
4819         gold_fallback.
4820         * errors.cc (Errors::fatal): Adjust call to gold_exit.
4821         (Errors::fallback): New function.
4822         (gold_fallback): New function.
4823         * errors.h (Errors::fallback): New function.
4824         * gold.cc (gold_exit): Change status parameter to enum; adjust
4825         all callers.
4826         (queue_initial_tasks): Call gold_fallback.
4827         * gold.h: Include cstdlib.
4828         (Exit_status): New enum type.
4829         (gold_exit): Change status parameter to enum.
4830         (gold_fallback): New function.
4831         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
4832         (Layout::create_symtab_sections): Likewise.
4833         (Layout::create_shdrs): Likewise.
4834         * main.cc (main): Adjust call to gold_exit.
4835         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
4836         (Output_data_got::add_got_entry_pair): Likewise.
4837         (Output_section::add_input_section): Likewise.
4838         (Output_section::add_output_section_data): Likewise.
4839         (Output_segment::set_section_list_addresses): Likewise.
4840         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
4841
4842 2011-06-07  Cary Coutant  <ccoutant@google.com>
4843
4844         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
4845         for incremental links.
4846         * output.cc (Output_segment::set_section_list_addresses): Remove
4847         FIXME and test for TLS or BSS.
4848
4849 2011-06-07  Cary Coutant  <ccoutant@google.com>
4850
4851         * testsuite/Makefile.am: Add incremental_copy_test,
4852         incremental_common_test_1.
4853         * testsuite/Makefile.in: Regenerate.
4854         * testsuite/common_test_1_v1.c: New source file.
4855         * testsuite/common_test_1_v2.c: New source file.
4856         * testsuite/copy_test_v1.cc: New source file.
4857
4858 2011-06-07  Cary Coutant  <ccoutant@google.com>
4859
4860         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
4861         update, allocate common from bss section's free list.
4862         * incremental-dump.cc (dump_incremental_inputs): Print flag for
4863         linker-defined symbols.
4864         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
4865         Skip GOT and PLT entries that are no longer referenced.
4866         (Output_section_incremental_inputs::write_info_blocks): Mark
4867         linker-defined symbols.
4868         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
4869         * output.cc (Output_section::allocate): New function.
4870         * output.h (Output_section::allocate): New function.
4871         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
4872         linker-defined symbols.
4873         (Symbol::override_base_with_special): Copy is_predefined_ flag.
4874         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
4875         (Symbol::init_base_output_data): Likewise.
4876         (Symbol::init_base_output_segment): Likewise.
4877         (Symbol::init_base_constant): Likewise.
4878         (Sized_symbol::init_output_data): Likewise.
4879         (Sized_symbol::init_output_segment): Likewise.
4880         (Sized_symbol::init_constant): Likewise.
4881         (Symbol_table::do_define_in_output_data): Likewise.
4882         (Symbol_table::do_define_in_output_segment): Likewise.
4883         (Symbol_table::do_define_as_constant): Likewise.
4884         * symtab.h (Symbol::is_predefined): New function.
4885         (Symbol::init_base_output_data): Add is_predefined parameter.
4886         (Symbol::init_base_output_segment): Likewise.
4887         (Symbol::init_base_constant): Likewise.
4888         (Symbol::is_predefined_): New data member.
4889         (Sized_symbol::init_output_data): Add is_predefined parameter.
4890         (Sized_symbol::init_output_segment): Likewise.
4891         (Sized_symbol::init_constant): Likewise.
4892         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
4893
4894 2011-06-07  Cary Coutant  <ccoutant@google.com>
4895
4896         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
4897         instead of emit_copy_reloc.
4898         (Copy_relocs::emit_copy_reloc): Refactor.
4899         (Copy_relocs::make_copy_reloc): New function.
4900         (Copy_relocs::add_copy_reloc): Remove.
4901         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
4902         section.
4903         (Copy_relocs::make_copy_reloc): New function.
4904         (Copy_relocs::add_copy_reloc): Remove.
4905         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
4906         unchanged input files.
4907         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
4908         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
4909         Reserve BSS space for COPY relocations.
4910         (Sized_incremental_binary::do_emit_copy_relocs): New function.
4911         (Output_section_incremental_inputs::write_info_blocks): Record
4912         whether a symbol is copied from a shared object.
4913         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
4914         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
4915         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
4916         (Incremental_input_entry_reader::get_output_symbol_index): Add
4917         is_copy parameter.
4918         (Incremental_binary::emit_copy_relocs): New function.
4919         (Incremental_binary::do_emit_copy_relocs): New function.
4920         (Sized_incremental_binary::Sized_incremental_binary): Initialize
4921         new data member.
4922         (Sized_incremental_binary::add_copy_reloc): New function.
4923         (Sized_incremental_binary::do_emit_copy_relocs): New function.
4924         (Sized_incremental_binary::Copy_reloc): New struct.
4925         (Sized_incremental_binary::Copy_relocs): New typedef.
4926         (Sized_incremental_binary::copy_relocs_): New data member.
4927         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
4928         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
4929         * target.h (Sized_target::emit_copy_reloc): New function.
4930         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
4931
4932 2011-06-02  Cary Coutant  <ccoutant@google.com>
4933
4934         PR gold/12163
4935         * gold/archive.cc (Archive::Archive): Initialize new data member.
4936         (Archive::include_all_members): Return if archive has already been
4937         included.
4938         * gold/archive.h (Archive::include_all_members_): New data member.
4939
4940 2011-06-02  Nick Clifton  <nickc@redhat.com>
4941
4942         * dynobj.h: Fix spelling mistake in comment.
4943         * output.cc: Likewise.
4944
4945 2011-05-31  Doug Kwan  <dougkwan@google.com>
4946             Asier Llano
4947
4948         PR gold/12826
4949         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
4950         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
4951         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
4952         redundant arm_exidx_test.so.
4953         * testsuite/Makefile.in: Regenerate.
4954         (check_SCRIPTS): Add pr12826.sh
4955         (check_DATA): Add pr12826.stdout
4956         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
4957         * testsuite/pr12826.sh: New file.
4958         * testsuite/pr12826_1.s: Ditto.
4959         * testsuite/pr12826_1.s: Ditto.
4960
4961 2011-05-30  Ian Lance Taylor  <iant@google.com>
4962
4963         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
4964         sections.
4965
4966 2011-05-29  Ian Lance Taylor  <iant@google.com>
4967
4968         PR gold/12804
4969         * testsuite/Makefile.am: Use different file name for two_file_test
4970         temporary file for each incremental test.
4971         * testsuite/Makefile.in: Rebuild.
4972
4973 2011-05-29  Ian Lance Taylor  <iant@google.com>
4974
4975         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
4976         binary input file is empty.
4977
4978 2011-05-27  Ian Lance Taylor  <iant@google.com>
4979
4980         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
4981         (ver_test_9.so): Likewise.
4982         * testsuite/Makefile.in: Rebuild.
4983
4984 2011-05-26 Cary Coutant  <ccoutant@google.com>
4985
4986         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
4987         * incremental.cc (Incremental_inputs::report_input_section): Fix
4988         comment, indentation.
4989         (Incremental_inputs::report_comdat_group): New function.
4990         (Output_section_incremental_inputs::set_final_data_size): Adjust size
4991         of data for incremental input file entry.
4992         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
4993         group count, COMDAT group signatures.
4994         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
4995         an unchanged input file.
4996         * incremental.h (Incremental_object_entry::Incremental_object_entry):
4997         Initialize new data member.
4998         (Incremental_object_entry::add_comdat_group): New function.
4999         (Incremental_object_entry::get_comdat_group_count): New function.
5000         (Incremental_object_entry::get_comdat_signature_key): New function.
5001         (Incremental_object_entry::groups_): New data member.
5002         (Incremental_inputs::report_comdat_group): New function.
5003         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
5004         data for incremental input file entry.
5005         (Incremental_input_entry_reader::get_comdat_group_count): New function.
5006         (Incremental_input_entry_reader::get_input_section): Adjust size of
5007         data for incremental input file entry.
5008         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
5009         (Incremental_input_entry_reader::get_comdat_group_signature): New
5010         function.
5011         * object.cc (Sized_relobj::include_section_group): Report kept
5012         COMDAT groups for incremental links.
5013
5014 2011-05-24  David Meyer  <pdox@google.com>
5015
5016         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
5017         with name parameter.  Add found_name parameter.
5018         * fileread.cc (Input_file::find_file): Adjust code accordingly.
5019         * dirsearch.h (class Dirsearch): Update declaration.
5020
5021 2011-05-24  Ian Lance Taylor  <iant@google.com>
5022
5023         * archive.cc (Library_base::should_include_member): Pull in object
5024         from archive if it defines the entry symbol.
5025         * parameters.cc (Parameters::entry): New function.
5026         * parameters.h (class Parameters): Declare entry.
5027         * output.h (class Output_file_header): Remove entry_ field.
5028         * output.cc (Output_file_header::Output_file_header): Remove entry
5029         parameter.  Change all callers.
5030         (Output_file_header::entry): Use parameters->entry.
5031         * gold.cc (queue_middle_tasks): Likewise.
5032         * plugin.cc (Plugin_hook::run): Likewise.
5033
5034 2011-05-24 Cary Coutant  <ccoutant@google.com>
5035
5036         * gold.cc (queue_initial_tasks): Pass incremental base filename
5037         to Output_file::open_base_file; don't print error message.
5038         * incremental-dump.cc (main): Adjust call to
5039         Output_file::open_for_modification.
5040         * incremental-dump.cc (main): Likewise.
5041         * incremental.cc (Incremental_inputs::report_command_line):
5042         Ignore --incremental-base option when comparing command lines.
5043         Ignore parameter when given as separate argument.
5044         * options.h (class General_options): Add --incremental-base.
5045         * output.cc (Output_file::Output_file):
5046         (Output_file::open_base_file): Add base_name and writable parameters;
5047         read base file into new file; print error message here.
5048         (Output_file::map_no_anonymous): Add writable parameter; adjust all
5049         callers.
5050         * output.h (Output_file::open_for_modification): Rename to...
5051         (Output_file::open_base_file): ...this; add base_name and
5052         writable parameters; adjust all callers.
5053         (Output_file::map_no_anonymous): Add writable parameter; adjust all
5054         callers.
5055         * testsuite/Makefile.am (incremental_test_4): Test
5056         --incremental-base.
5057         * testsuite/Makefile.in: Regenerate.
5058
5059 2011-05-24 Cary Coutant  <ccoutant@google.com>
5060
5061         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
5062         incremental_test_4.
5063         * testsuite/Makefile.in: Regenerate.
5064         * testsuite/two_file_test_1_v1.cc: New test source file.
5065         * testsuite/two_file_test_1b_v1.cc: New test source file.
5066         * testsuite/two_file_test_2_v1.cc: New test source file.
5067
5068 2011-05-24 Cary Coutant  <ccoutant@google.com>
5069
5070         * dynobj.h (Dynobj::do_dynobj): New function.
5071         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
5072         flag and soname for shared objects.
5073         * incremental.cc (Incremental_inputs::report_object): Make
5074         either Incremental_object_entry or Incremental_dynobj_entry; add
5075         soname to string table.
5076         (Incremental_inputs::report_input_section): Add assertion.
5077         (Output_section_incremental_inputs::set_final_data_size): Adjust
5078         type of input file entry for shared libraries; adjust size of
5079         shared library info entry.
5080         (Output_section_incremental_inputs::write_input_files): Write
5081         as_needed flag for shared libraries.
5082         (Output_section_incremental_inputs::write_info_blocks): Adjust type
5083         of input file entry for shared libraries; write soname.
5084         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
5085         soname from incremental info.
5086         * incremental.h (enum Incremental_input_flags): Add
5087         INCREMENTAL_INPUT_AS_NEEDED.
5088         (Incremental_input_entry::Incremental_input_entry): Initialize new
5089         data member.
5090         (Incremental_input_entry::set_as_needed): New function.
5091         (Incremental_input_entry::as_needed): New function.
5092         (Incremental_input_entry::do_dynobj_entry): New function.
5093         (Incremental_input_entry::as_needed_): New data member.
5094         (Incremental_object_entry::Incremental_object_entry): Don't check
5095         for shared library.
5096         (Incremental_object_entry::do_type): Likewise.
5097         (class Incremental_dynobj_entry): New class.
5098         (Incremental_input_entry_reader::as_needed): New function.
5099         (Incremental_input_entry_reader::get_soname): New function.
5100         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
5101         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
5102         size of shared library info entry.
5103         * layout.cc (Layout::finish_dynamic_section): Don't test for
5104         incremental link when adding DT_NEEDED entries.
5105         * object.h (Object::Object): Initialize new data member.
5106         (Object::dynobj): New function.
5107         (Object::set_as_needed): New function.
5108         (Object::as_needed): New function.
5109         (Object::do_dynobj): New function.
5110         (Object::as_needed_): New data member.
5111
5112 2011-05-24 Cary Coutant  <ccoutant@google.com>
5113
5114         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
5115         info; adjust display of GOT entries.
5116         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
5117         vector of input objects; remove file_status_.
5118         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
5119         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
5120         got_plt reader; call target hooks to reserve GOT entries.
5121         (Output_section_incremental_inputs::set_final_data_size): Adjust size
5122         of input file info header and GOT info entry.
5123         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
5124         relocation info.
5125         (Got_plt_view_info::got_descriptor): Remove.
5126         (Got_plt_view_info::sym_index): New data member.
5127         (Got_plt_view_info::input_index): New data member.
5128         (Local_got_offset_visitor::visit): Write input file index.
5129         (Global_got_offset_visitor::visit): Write 0 for input file index.
5130         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
5131         with sym_index and input_index.
5132         (Output_section_incremental_inputs::write_got_plt): Adjust size of
5133         incremental info GOT entry; replace got_descriptor with input_index.
5134         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
5135         map from input file index to object.
5136         (Sized_relobj_incr::do_layout): Replace direct data member reference
5137         with accessor function.
5138         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
5139         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
5140         Adjust size of input file info header.
5141         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
5142         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
5143         (Incremental_input_entry_reader::get_input_section): Adjust size of
5144         input file info header.
5145         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
5146         of incremental info GOT entry.
5147         (Incremental_got_plt_reader::get_got_desc): Remove.
5148         (Incremental_got_plt_reader::get_got_symndx): New function.
5149         (Incremental_got_plt_reader::get_got_input_index): New function.
5150         (Sized_incremental_binary::Sized_incremental_binary): Remove
5151         file_status_; add input_objects_.
5152         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
5153         (Sized_incremental_binary::set_file_is_unchanged): Remove.
5154         (Sized_incremental_binary::file_is_unchanged): Remove.
5155         (Sized_incremental_binary::set_input_object): New function.
5156         (Sized_incremental_binary::input_object): New function.
5157         (Sized_incremental_binary::file_status_): Remove.
5158         (Sized_incremental_binary::input_objects_): New data member.
5159         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
5160         references.
5161         (Sized_relobj_incr::invalid_address): Move to base class.
5162         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
5163         class.
5164         (Sized_relobj_incr::do_output_section_offset): Likewise.
5165         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
5166         (Sized_relobj_incr::section_offsets_): Likewise.
5167         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
5168         function.
5169         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
5170         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
5171         with accessor function.
5172         (Sized_relobj_file::do_layout): Likewise.
5173         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
5174         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
5175         (Sized_relobj_file::compute_final_local_value): Replace refs to
5176         section_offsets_ with accessor function.
5177         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
5178         * object.h (Relobj::Relobj): Initialize new data members.
5179         (Relobj::add_dyn_reloc): New function.
5180         (Relobj::first_dyn_reloc): New function.
5181         (Relobj::dyn_reloc_count): New function.
5182         (Relobj::first_dyn_reloc_): New data member.
5183         (Relobj::dyn_reloc_count_): New data member.
5184         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
5185         references.
5186         (Sized_relobj::Address): New typedef.
5187         (Sized_relobj::invalid_address): Move here from child class.
5188         (Sized_relobj::Sized_relobj): Initialize new data members.
5189         (Sized_relobj::sized_relobj): New function.
5190         (Sized_relobj::is_output_section_offset_invalid): Move here from
5191         child class.
5192         (Sized_relobj::get_output_section_offset): Likewise.
5193         (Sized_relobj::local_has_got_offset): Likewise.
5194         (Sized_relobj::local_got_offset): Likewise.
5195         (Sized_relobj::set_local_got_offset): Likewise.
5196         (Sized_relobj::do_for_all_local_got_entries): Likewise.
5197         (Sized_relobj::clear_got_offsets): New function.
5198         (Sized_relobj::section_offsets): Move here from child class.
5199         (Sized_relobj::do_output_section_offset): Likewise.
5200         (Sized_relobj::do_set_section_offset): Likewise.
5201         (Sized_relobj::Local_got_offsets): Likewise.
5202         (Sized_relobj::local_got_offsets_): Likewise.
5203         (Sized_relobj::section_offsets_): Likewise.
5204         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
5205         references.
5206         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
5207         class.
5208         (Sized_relobj_file::sized_relobj): New function
5209         (Sized_relobj_file::local_has_got_offset): Move to base class.
5210         (Sized_relobj_file::local_got_offset): Likewise.
5211         (Sized_relobj_file::set_local_got_offset): Likewise.
5212         (Sized_relobj_file::get_output_section_offset): Likewise.
5213         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
5214         (Sized_relobj_file::do_output_section_offset): Likewise.
5215         (Sized_relobj_file::do_set_section_offset): Likewise.
5216         (Sized_relobj_file::Local_got_offsets): Likewise.
5217         (Sized_relobj_file::local_got_offsets_): Likewise.
5218         (Sized_relobj_file::section_offsets_): Likewise.
5219         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
5220         (all constructors).
5221         (set_needs_dynsym_index): Convert relobj to derived class pointer.
5222         (Output_reloc::get_symbol_index): Likewise.
5223         (Output_reloc::local_section_offset): Likewise.
5224         (Output_reloc::get_address): Likewise.
5225         (Output_reloc::symbol_value): Likewise.
5226         (Output_data_got::reserve_slot): Move to class definition.
5227         (Output_data_got::reserve_local): New function.
5228         (Output_data_got::reserve_slot_for_global): Remove.
5229         (Output_data_got::reserve_global): New function.
5230         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
5231         (all constructors, two instantiations).
5232         (Output_reloc::get_relobj): New function (two instantiations).
5233         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
5234         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
5235         (Output_data_reloc::add_global): Adjust type of relobj.
5236         (Output_data_reloc::add_global_relative): Likewise.
5237         (Output_data_reloc::add_symbolless_global_addend): Likewise.
5238         (Output_data_reloc::add_local): Likewise.
5239         (Output_data_reloc::add_local_relative): Likewise.
5240         (Output_data_reloc::add_symbolless_local_addend): Likewise.
5241         (Output_data_reloc::add_local_section): Likewise.
5242         (Output_data_reloc::add_output_section): Likewise.
5243         (Output_data_reloc::add_absolute): Likewise.
5244         (Output_data_reloc::add_target_specific): Likewise.
5245         (Output_data_got::reserve_slot): Move definition here.
5246         (Output_data_got::reserve_local): New function.
5247         (Output_data_got::reserve_global): New function.
5248         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
5249         section_offsets_ with accessor function.
5250         (Sized_relobj_file::write_sections): Likewise.
5251         (Sized_relobj_file::do_relocate_sections): Likewise.
5252         * target.h (Sized_target::reserve_local_got_entry): New function.
5253         (Sized_target::reserve_global_got_entry): New function.
5254         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
5255         (Target_x86_64::reserve_global_got_entry): New function.
5256         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
5257
5258 2011-05-23 Cary Coutant  <ccoutant@google.com>
5259
5260         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
5261         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
5262         bit when checking got_type.
5263         * incremental.cc (Sized_incremental_binary::setup_readers):
5264         Store symbol table and string table locations; initialize bit vector
5265         of file status flags.
5266         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
5267         unchanged files.
5268         (Sized_incremental_binary::do_process_got_plt): New function.
5269         (Sized_incremental_binary::get_symtab_view): Use stored locations.
5270         (Output_section_incremental_inputs::set_final_data_size): Record
5271         file index for each input file.
5272         (Output_section_incremental_inputs::write_got_plt): Store file index
5273         instead of input entry offset for each GOT entry.
5274         * incremental.h
5275         (Incremental_input_entry::Incremental_input_entry): Initialize new
5276         data member.
5277         (Incremental_input_entry::set_offset): Store file index.
5278         (Incremental_input_entry::get_file_index): New function.
5279         (Incremental_input_entry::file_index_): New data member.
5280         (Incremental_binary::process_got_plt): New function.
5281         (Incremental_binary::do_process_got_plt): New function.
5282         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
5283         data members.
5284         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
5285         (Sized_incremental_binary::set_file_is_unchanged): New function.
5286         (Sized_incremental_binary::file_is_unchanged): New function.
5287         (Sized_incremental_binary::do_process_got_plt): New function.
5288         (Sized_incremental_binary::file_status_): New data member.
5289         (Sized_incremental_binary::main_symtab_loc_): New data member.
5290         (Sized_incremental_binary::main_strtab_loc_): New data member.
5291         * output.cc (Output_data_got::Got_entry::write): Add case
5292         RESERVED_CODE.
5293         (Output_data_got::add_global): Call add_got_entry.
5294         (Output_data_got::add_global_plt): Likewise.
5295         (Output_data_got::add_global_with_rel): Likewise.
5296         (Output_data_got::add_global_with_rela): Likewise.
5297         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
5298         (Output_data_got::add_global_pair_with_rela): Likewise.
5299         (Output_data_got::add_local): Call add_got_entry.
5300         (Output_data_got::add_local_plt): Likewise.
5301         (Output_data_got::add_local_with_rel): Likewise.
5302         (Output_data_got::add_local_with_rela): Likewise.
5303         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
5304         (Output_data_got::add_local_pair_with_rela): Likewise.
5305         (Output_data_got::reserve_slot): New function.
5306         (Output_data_got::reserve_slot_for_global): New function.
5307         (Output_data_got::add_got_entry): New function.
5308         (Output_data_got::add_got_entry_pair): New function.
5309         (Output_section::add_output_section_data): Edit FIXME.
5310         * output.h
5311         (Output_section_data_build::Output_section_data_build): New
5312         constructor with size parameter.
5313         (Output_data_space::Output_data_space): Likewise.
5314         (Output_data_got::Output_data_got): Initialize new data member; new
5315         constructor with size parameter.
5316         (Output_data_got::add_constant): Call add_got_entry.
5317         (Output_data_got::reserve_slot): New function.
5318         (Output_data_got::reserve_slot_for_global): New function.
5319         (class Output_data_got::Got_entry): Add RESERVED_CODE.
5320         (Output_data_got::add_got_entry): New function.
5321         (Output_data_got::add_got_entry_pair): New function.
5322         (Output_data_got::free_list_): New data member.
5323         * target.h (Sized_target::init_got_plt_for_update): New function.
5324         (Sized_target::register_global_plt_entry): New function.
5325         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
5326         Initialize new data member; call init; add constructor with PLT count.
5327         (Output_data_plt_x86_64::init): New function.
5328         (Output_data_plt_x86_64::add_relocation): New function.
5329         (Output_data_plt_x86_64::reserve_slot): New function.
5330         (Output_data_plt_x86_64::free_list_): New data member.
5331         (Target_x86_64::init_got_plt_for_update): New function.
5332         (Target_x86_64::register_global_plt_entry): New function.
5333         (Output_data_plt_x86_64::add_entry): Allocate from free list for
5334         incremental updates.
5335         (Output_data_plt_x86_64::add_relocation): New function.
5336         * testsuite/object_unittest.cc (Object_test): Set default options.
5337
5338 2011-05-16  Ian Lance Taylor  <iant@google.com>
5339
5340         * options.h (class General_options): Make -i a synonym for -r.
5341
5342 2011-05-16  Ian Lance Taylor  <iant@google.com>
5343
5344         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
5345
5346 2011-05-10 Cary Coutant  <ccoutant@google.com>
5347
5348         * object.cc (Sized_relobj::do_count_local_symbols): Check for
5349         strip_all (-s).
5350
5351 2011-05-06  Ian Lance Taylor  <iant@google.com>
5352
5353         * layout.cc (Layout::layout): If the output section flags change,
5354         update the ordering.
5355
5356 2011-04-25 Cary Coutant  <ccoutant@google.com>
5357
5358         * incremental-dump.cc (dump_incremental_inputs): Print local
5359         symbol info for each input file.
5360         * incremental.cc
5361         (Output_section_incremental_inputs::set_final_data_size): Add local
5362         symbol info to input file entries in incremental info.
5363         (Output_section_incremental_inputs::write_info_blocks): Likewise.
5364         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
5365         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
5366         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
5367         implementation.
5368         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
5369         (Sized_incr_relobj::do_relocate): Write the local symbols.
5370         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
5371         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
5372         Adjust size of input file header.
5373         (Incremental_inputs_reader::get_local_symbol_offset): New function.
5374         (Incremental_inputs_reader::get_local_symbol_count): New function.
5375         (Incremental_inputs_reader::get_input_section): Adjust size of input
5376         file header.
5377         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
5378         (Sized_incr_relobj::This): New typedef.
5379         (Sized_incr_relobj::sym_size): New const data member.
5380         (Sized_incr_relobj::Local_symbol): New struct.
5381         (Sized_incr_relobj::do_output_local_symbol_count): New function.
5382         (Sized_incr_relobj::do_local_symbol_offset): New function.
5383         (Sized_incr_relobj::local_symbol_count_): New data member.
5384         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
5385         (Sized_incr_relobj::local_symbol_index_): New data member.
5386         (Sized_incr_relobj::local_symbol_offset_): New data member.
5387         (Sized_incr_relobj::local_dynsym_offset_): New data member.
5388         (Sized_incr_relobj::local_symbols_): New data member.
5389         * object.h (Relobj::output_local_symbol_count): New function.
5390         (Relobj::local_symbol_offset): New function.
5391         (Relobj::do_output_local_symbol_count): New function.
5392         (Relobj::do_local_symbol_offset): New function.
5393         (Sized_relobj::do_output_local_symbol_count): New function.
5394         (Sized_relobj::do_local_symbol_offset): New function.
5395
5396 2011-04-22  Vladimir Simonov  <sv@sw.ru>
5397
5398         * descriptors.cc (set_close_on_exec): New function.
5399         (Descriptors::open): Use set_close_on_exec.
5400         * output.cc (S_ISLNK): Define if not defined.
5401
5402 2011-04-22 Cary Coutant  <ccoutant@google.com>
5403
5404         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
5405         global symbol map.
5406         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
5407         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
5408         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
5409         relocations.
5410         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
5411         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
5412         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
5413         * incremental.h
5414         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
5415         function.
5416         (Incremental_binary::apply_incremental_relocs): New function.
5417         (Incremental_binary::do_apply_incremental_relocs): New function.
5418         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
5419         data member.
5420         (Sized_incremental_binary::add_global_symbol): New function.
5421         (Sized_incremental_binary::global_symbol): New function.
5422         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
5423         (Sized_incremental_binary::symbol_map_): New data member.
5424         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
5425         * target.h (Sized_target::apply_relocation): New function.
5426         * target-reloc.h (apply_relocation): New function.
5427         * x86_64.cc (Target_x86_64::apply_relocation): New function.
5428
5429 2011-04-22  Doug Kwan  <dougkwan@google.com>
5430
5431         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
5432         flag of a SHT_ARM_EXIDX section.
5433         * testsuite/Makefile.am (arm_exidx_test): New test rules.
5434         * testsuite/Makefile.in: Regenerate.
5435         * testsuite/arm_exidx_test.s: New file.
5436         * testsuite/arm_exidx_test.sh: Same.
5437
5438 2011-04-20 Cary Coutant  <ccoutant@google.com>
5439
5440         PR gold/12689
5441         * archive.h (Incremental_archive_entry::Archive_member):
5442         Initialize arg_serial_ (second constructor).
5443
5444 2011-04-17  Ian Lance Taylor  <iant@google.com>
5445
5446         * object.cc (Relocate_info::location): Simplify location string.
5447         * errors.cc (Errors::error_at_location): Don't print program
5448         name.
5449         (Errors::warning_at_location): Likewise.
5450         (Errors::undefined_symbol): Likewise.
5451         * testsuite/debug_msg.sh: Update accordingly.
5452
5453 2011-04-14 Cary Coutant  <ccoutant@google.com>
5454
5455         * gold/layout.cc (Layout::symtab_section_offset): New function.
5456         * gold/layout.h (Layout::symtab_section_offset): New function.
5457         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
5458
5459 2011-04-12  Ian Lance Taylor  <iant@google.com>
5460
5461         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
5462         with MREMAP_MAYMOVE.
5463         * output.h (class Output_file): Add map_is_allocated_ field.
5464         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
5465         not available, provide stubs.  If mremap is not available, #define
5466         it to gold_mremap.
5467         (MREMAP_MAYMOVE): Define if not defined.
5468         (Output_file::Output_file): Initialize map_is_allocated_.
5469         (Output_file::resize): Check map_is_allocated_.
5470         (Output_file::map_anonymous): If mmap fails, use malloc.
5471         (Output_file::unmap): Don't do anything for an anonymous map.
5472         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
5473         is not available, provide stubs.
5474         (File_read::View::~View): Use free rather than delete[].
5475         (File_read::make_view): Use malloc rather than new[].  If mmap
5476         fails, use malloc.
5477         (File_read::find_or_make_view): Use malloc rather than new[].
5478         * gold.h: Remove HAVE_REMAP code.
5479         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
5480         exists.  Rename mremap to gold_mremap.  If mmap is not available
5481         don't do anything.
5482         * configure, config.in: Rebuild.
5483
5484 2011-04-11  Ian Lance Taylor  <iant@google.com>
5485
5486         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
5487         initialize local variable v.
5488
5489 2011-04-11  Cary Coutant  <ccoutant@google.com>
5490
5491         * archive.cc (Archive::include_member): Adjust call to
5492         report_object.
5493         (Add_archive_symbols::run): Track argument serial numbers.
5494         (Lib_group::include_member): Likewise.
5495         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
5496         * archive.h (Incremental_archive_entry::Archive_member):
5497         Initialize arg_serial_.
5498         (Archive_member::arg_serial_): New data member.
5499         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
5500         (Sized_dynobj::do_add_symbols): Track symbols when doing an
5501         incremental link.
5502         (Sized_dynobj::do_for_all_local_got_entries): New function.
5503         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
5504         function.
5505         * fileread.cc (get_mtime): New function.
5506         * fileread.h (get_mtime): New function.
5507         * gold.cc (queue_initial_tasks): Check for incremental update.
5508         (process_incremental_input): New function.
5509         (queue_middle_tasks): Don't force valid target for incremental
5510         update.
5511         * incremental-dump.cc (find_input_containing_global): Adjust
5512         size of symbol info entry.
5513         (dump_incremental_inputs): Dump argument serial number and
5514         in_system_directory flag; bias shndx by 1; print symbol names
5515         when dumping per-file symbol lists; use new symbol info readers.
5516         * incremental.cc
5517         (Output_section_incremental_inputs:update_data_size): New function.
5518         (Sized_incremental_binary::setup_readers): Setup input readers
5519         for each input file; build maps for files added from libraries
5520         and scripts.
5521         (Sized_incremental_binary::check_input_args): New function.
5522         (Sized_incremental_binary::do_check_inputs): Build map of argument
5523         serial numbers to input arguments.
5524         (Sized_incremental_binary::do_file_has_changed): Rename
5525         do_file_is_unchanged to this; compare file modification times.
5526         (Sized_incremental_binary::do_init_layout): New function.
5527         (Sized_incremental_binary::do_reserve_layout): New function.
5528         (Sized_incremental_binary::do_get_input_reader): Remove.
5529         (Sized_incremental_binary::get_symtab_view): New function.
5530         (Incremental_checker::can_incrementally_link_output_file): Remove.
5531         (Incremental_inputs::report_command_line): Exclude --debug options.
5532         (Incremental_inputs::report_archive_begin): Add parameter; track
5533         argument serial numbers; don't put input file entry for archive
5534         before archive members.
5535         (Incremental_inputs::report_archive_end): Put input file entry
5536         for archive after archive members.
5537         (Incremental_inputs::report_object): Add parameter; track argument
5538         serial numbers and in_system_directory flag.
5539         (Incremental_inputs::report_script): Add parameter; track argument
5540         serial numbers.
5541         (Output_section_incremental_inputs::set_final_data_size): Adjust
5542         size of symbol info entry; check for forwarding symbols.
5543         (Output_section_incremental_inputs::write_input_files): Write
5544         in_system_directory flag and argument serial number.
5545         (Output_section_incremental_inputs::write_info_blocks): Map section
5546         indices between incremental info and original input file; store
5547         input section index for each symbol.
5548         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
5549         change operator() to visit().
5550         (class Global_got_offset_visitor): Likewise.
5551         (class Global_symbol_visitor_got_plt):
5552         (Output_section_incremental_inputs::write_got_plt): Use new visitor
5553         classes.
5554         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
5555         (Sized_incr_relobj::do_read_symbols): New function.
5556         (Sized_incr_relobj::do_layout): New function.
5557         (Sized_incr_relobj::do_layout_deferred_sections): New function.
5558         (Sized_incr_relobj::do_add_symbols): New function.
5559         (Sized_incr_relobj::do_should_include_member): New function.
5560         (Sized_incr_relobj::do_for_all_global_symbols): New function.
5561         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
5562         (Sized_incr_relobj::do_section_size): New function.
5563         (Sized_incr_relobj::do_section_name): New function.
5564         (Sized_incr_relobj::do_section_contents): New function.
5565         (Sized_incr_relobj::do_section_flags): New function.
5566         (Sized_incr_relobj::do_section_entsize): New function.
5567         (Sized_incr_relobj::do_section_address): New function.
5568         (Sized_incr_relobj::do_section_type): New function.
5569         (Sized_incr_relobj::do_section_link): New function.
5570         (Sized_incr_relobj::do_section_info): New function.
5571         (Sized_incr_relobj::do_section_addralign): New function.
5572         (Sized_incr_relobj::do_initialize_xindex): New function.
5573         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
5574         (Sized_incr_relobj::do_read_relocs): New function.
5575         (Sized_incr_relobj::do_gc_process_relocs): New function.
5576         (Sized_incr_relobj::do_scan_relocs): New function.
5577         (Sized_incr_relobj::do_count_local_symbols): New function.
5578         (Sized_incr_relobj::do_finalize_local_symbols): New function.
5579         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
5580         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
5581         (Sized_incr_relobj::do_relocate): New function.
5582         (Sized_incr_relobj::do_set_section_offset): New function.
5583         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
5584         (Sized_incr_dynobj::do_read_symbols): New function.
5585         (Sized_incr_dynobj::do_layout): New function.
5586         (Sized_incr_dynobj::do_add_symbols): New function.
5587         (Sized_incr_dynobj::do_should_include_member): New function.
5588         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
5589         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
5590         (Sized_incr_dynobj::do_section_size): New function.
5591         (Sized_incr_dynobj::do_section_name): New function.
5592         (Sized_incr_dynobj::do_section_contents): New function.
5593         (Sized_incr_dynobj::do_section_flags): New function.
5594         (Sized_incr_dynobj::do_section_entsize): New function.
5595         (Sized_incr_dynobj::do_section_address): New function.
5596         (Sized_incr_dynobj::do_section_type): New function.
5597         (Sized_incr_dynobj::do_section_link): New function.
5598         (Sized_incr_dynobj::do_section_info): New function.
5599         (Sized_incr_dynobj::do_section_addralign): New function.
5600         (Sized_incr_dynobj::do_initialize_xindex): New function.
5601         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
5602         (make_sized_incremental_object): New function.
5603         (Incremental_library::copy_unused_symbols): New function.
5604         (Incremental_library::do_for_all_unused_symbols): New function.
5605         * incremental.h (enum Incremental_input_flags): New type.
5606         (class Incremental_checker): Remove.
5607         (Incremental_input_entry::Incremental_input_entry): Add argument
5608         serial number.
5609         (Incremental_input_entry::arg_serial): New function.
5610         (Incremental_input_entry::set_is_in_system_directory): New function.
5611         (Incremental_input_entry::is_in_system_directory): New function.
5612         (Incremental_input_entry::arg_serial_): New data member.
5613         (Incremental_input_entry::is_in_system_directory_): New data member.
5614         (class Script_info): Move here from script.h.
5615         (Script_info::Script_info): Add filename parameter.
5616         (Script_info::filename): New function.
5617         (Script_info::filename_): New data member.
5618         (Incremental_script_entry::Incremental_script_entry): Add argument
5619         serial number.
5620         (Incremental_object_entry::Incremental_object_entry): Likewise.
5621         (Incremental_object_entry::add_input_section): Build list of input
5622         sections with map to original shndx.
5623         (Incremental_object_entry::get_input_section_index): New function.
5624         (Incremental_object_entry::shndx_): New data member.
5625         (Incremental_object_entry::name_key_): Rename; adjust all refs.
5626         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
5627         (Incremental_archive_entry::Incremental_archive_entry): Add argument
5628         serial number.
5629         (Incremental_inputs::report_archive_begin): Likewise.
5630         (Incremental_inputs::report_object): Likewise.
5631         (Incremental_inputs::report_script): Likewise.
5632         (class Incremental_global_symbol_reader): New class.
5633         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
5634         and store flags and input file type.
5635         (Incremental_input_entry_reader::arg_serial): New function.
5636         (Incremental_input_entry_reader::type): Extract type from flags.
5637         (Incremental_input_entry_reader::is_in_system_directory): New function.
5638         (Incremental_input_entry_reader::get_input_section_count): Call
5639         accessor function for type.
5640         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
5641         function for type; adjust size of global symbol entry.
5642         (Incremental_input_entry_reader::get_global_symbol_count): Call
5643         accessor function for type.
5644         (Incremental_input_entry_reader::get_object_count): Likewise.
5645         (Incremental_input_entry_reader::get_object_offset): Likewise.
5646         (Incremental_input_entry_reader::get_member_count): Likewise.
5647         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
5648         (Incremental_input_entry_reader::get_member_offset): Likewise.
5649         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
5650         (Incremental_input_entry_reader::Global_symbol_info): Remove.
5651         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
5652         (Incremental_input_entry_reader::get_global_symbol_reader): New
5653         function.
5654         (Incremental_input_entry_reader::get_output_symbol_index): New
5655         function.
5656         (Incremental_input_entry_reader::type_): Remove.
5657         (Incremental_input_entry_reader::flags_): New data member.
5658         (Incremental_inputs_reader::input_file_offset): New function.
5659         (Incremental_inputs_reader::input_file_index): New function.
5660         (Incremental_inputs_reader::input_file): Call input_file_offset.
5661         (Incremental_inputs_reader::input_file_at_offset): New function.
5662         (Incremental_relocs_reader::get_r_type): Reformat.
5663         (Incremental_relocs_reader::get_r_shndx): Reformat.
5664         (Incremental_relocs_reader::get_r_offset): Reformat.
5665         (Incremental_relocs_reader::data): New function.
5666         (Incremental_binary::Incremental_binary): Initialize new data members.
5667         (Incremental_binary::check_inputs): Add cmdline parameter.
5668         (Incremental_binary::file_is_unchanged): Remove.
5669         (Input_reader::arg_serial): New function.
5670         (Input_reader::get_unused_symbol_count): New function.
5671         (Input_reader::get_unused_symbol): New function.
5672         (Input_reader::do_arg_serial): New function.
5673         (Input_reader::do_get_unused_symbol_count): New function.
5674         (Input_reader::do_get_unused_symbol): New function.
5675         (Incremental_binary::input_file_count): New function.
5676         (Incremental_binary::get_input_reader): Change signature to use
5677         index instead of filename.
5678         (Incremental_binary::file_has_changed): New function.
5679         (Incremental_binary::get_input_argument): New function.
5680         (Incremental_binary::get_library): New function.
5681         (Incremental_binary::get_script_info): New function.
5682         (Incremental_binary::init_layout): New function.
5683         (Incremental_binary::reserve_layout): New function.
5684         (Incremental_binary::output_file): New function.
5685         (Incremental_binary::do_check_inputs): New function.
5686         (Incremental_binary::do_file_is_unchanged): Remove.
5687         (Incremental_binary::do_file_has_changed): New function.
5688         (Incremental_binary::do_init_layout): New function.
5689         (Incremental_binary::do_reserve_layout): New function.
5690         (Incremental_binary::do_input_file_count): New function.
5691         (Incremental_binary::do_get_input_reader): Change signature.
5692         (Incremental_binary::input_args_map_): New data member.
5693         (Incremental_binary::library_map_): New data member.
5694         (Incremental_binary::script_map_): New data member.
5695         (Sized_incremental_binary::Sized_incremental_binary): Initialize
5696         new data members.
5697         (Sized_incremental_binary::output_section): New function.
5698         (Sized_incremental_binary::inputs_reader): Add const.
5699         (Sized_incremental_binary::symtab_reader): Add const.
5700         (Sized_incremental_binary::relocs_reader): Add const.
5701         (Sized_incremental_binary::got_plt_reader): Add const.
5702         (Sized_incremental_binary::get_symtab_view): New function.
5703         (Sized_incremental_binary::Inputs_reader): New typedef.
5704         (Sized_incremental_binary::Input_entry_reader): New typedef.
5705         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
5706         (Sized_incremental_binary::do_file_is_unchanged): Remove.
5707         (Sized_incremental_binary::do_file_has_changed): New function.
5708         (Sized_incremental_binary::do_init_layout): New function.
5709         (Sized_incremental_binary::do_reserve_layout): New function.
5710         (Sized_input_reader::Inputs_reader): Remove.
5711         (Sized_input_reader::Input_entry_reader): Remove.
5712         (Sized_input_reader::do_arg_serial): New function.
5713         (Sized_input_reader::do_get_unused_symbol_count): New function.
5714         (Sized_input_reader::do_get_unused_symbol): New function.
5715         (Sized_incremental_binary::do_input_file_count): New function.
5716         (Sized_incremental_binary::do_get_input_reader): Change signature;
5717         use index instead of filename.
5718         (Sized_incremental_binary::section_map_): New data member.
5719         (Sized_incremental_binary::input_entry_readers_): New data member.
5720         (class Sized_incr_relobj): New class.
5721         (class Sized_incr_dynobj): New class.
5722         (make_sized_incremental_object): New function.
5723         (class Incremental_library): New class.
5724         * layout.cc (Free_list::num_lists): New static data member.
5725         (Free_list::num_nodes): New static data member.
5726         (Free_list::num_removes): New static data member.
5727         (Free_list::num_remove_visits): New static data member.
5728         (Free_list::num_allocates): New static data member.
5729         (Free_list::num_allocate_visits): New static data member.
5730         (Free_list::init): New function.
5731         (Free_list::remove): New function.
5732         (Free_list::allocate): New function.
5733         (Free_list::dump): New function.
5734         (Free_list::print_stats): New function.
5735         (Layout_task_runner::run): Resize output file for incremental updates.
5736         (Layout::Layout): Initialize new data members.
5737         (Layout::set_incremental_base): New function.
5738         (Layout::init_fixed_output_section): New function.
5739         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
5740         incremental updates.
5741         (Layout::create_gold_note): Do not create gold note section for
5742         incremental updates.
5743         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
5744         for incremental updates.
5745         (Layout::set_section_offsets): For incremental updates, allocate space
5746         from free list.
5747         (Layout::create_symtab_sections): Layout with offsets relative to
5748         start of section; for incremental updates, allocate space from free
5749         list.
5750         (Layout::create_shdrs): For incremental updates, allocate space from
5751         free list.
5752         (Layout::finish_dynamic_section): For incremental updates, do not
5753         check --as-needed (fixed in subsequent patch).
5754         * layout.h (class Free_list): New class.
5755         (Layout::set_incremental_base): New function.
5756         (Layout::incremental_base): New function.
5757         (Layout::init_fixed_output_section): New function.
5758         (Layout::allocate): New function.
5759         (Layout::incremental_base_): New data member.
5760         (Layout::free_list_): New data member.
5761         * main.cc (main): Print Free_list statistics.
5762         * object.cc (Relobj::finalize_incremental_relocs): Add
5763         clear_counts parameter; clear counts only when clear_counts is set.
5764         (Sized_relobj::Sized_relobj): Initialize new base class.
5765         (Sized_relobj::do_layout): Don't report special sections.
5766         (Sized_relobj::do_for_all_local_got_entries): New function.
5767         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
5768         symtab_off to all symbol table offsets.
5769         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
5770         * object.h (class Got_offset_list): Move to top of file.
5771         (Object::Object): Allow case where input_file == NULL.
5772         (Object::~Object): Likewise.
5773         (Object::input_file): Assert that input_file != NULL.
5774         (Object::lock): Allow case where input_file == NULL.
5775         (Object::unlock): Likewise.
5776         (Object::is_locked): Likewise.
5777         (Object::token): Likewise.
5778         (Object::release): Likewise.
5779         (Object::is_incremental): New function.
5780         (Object::get_mtime): New function.
5781         (Object::for_all_local_got_entries): New function.
5782         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
5783         (Object::set_is_in_system_directory): New function.
5784         (Object::is_in_system_directory): New function.
5785         (Object::do_is_incremental): New function.
5786         (Object::do_get_mtime): New function.
5787         (Object::do_for_all_local_got_entries): New function.
5788         (Object::is_in_system_directory_): New data member.
5789         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
5790         (class Sized_relobj_base): New class.
5791         (class Sized_relobj): Derive from Sized_relobj_base.
5792         (class Sized_relobj::Symbols): Redeclare from base class.
5793         (class Sized_relobj::local_got_offset_list): Remove.
5794         (class Sized_relobj::Output_sections): Redeclare from base class.
5795         (class Sized_relobj::do_for_all_local_got_entries): New function.
5796         (class Sized_relobj::write_local_symbols): Add offset parameter.
5797         (class Sized_relobj::local_symbol_offset_): Update comment.
5798         (class Sized_relobj::local_dynsym_offset_): Update comment.
5799         * options.cc (Input_arguments::add_file): Remove const.
5800         * options.h (Input_file_argument::Input_file_argument):
5801         Initialize arg_serial_ (all constructors).
5802         (Input_file_argument::set_arg_serial): New function.
5803         (Input_file_argument::arg_serial): New function.
5804         (Input_file_argument::arg_serial_): New data member.
5805         (Input_arguments::Input_arguments): Initialize file_count_.
5806         (Input_arguments::add_file): Remove const.
5807         (Input_arguments::number_of_input_files): New function.
5808         (Input_arguments::file_count_): New data member.
5809         (Command_line::number_of_input_files): Call
5810         Input_arguments::number_of_input_files.
5811         * output.cc (Output_segment_headers::Output_segment_headers):
5812         Set current size.
5813         (Output_section::Input_section::current_data_size): New function.
5814         (Output_section::Output_section): Initialize new data members.
5815         (Output_section::add_input_section): Don't do merge sections for
5816         an incremental link; allocate space from free list for an
5817         incremental update.
5818         (Output_section::add_output_section_data): Allocate space from
5819         free list for an incremental update.
5820         (Output_section::update_data_size): New function.
5821         (Output_section::set_fixed_layout): New function.
5822         (Output_section::reserve): New function.
5823         (Output_segment::set_section_addresses): Remove const.
5824         (Output_segment::set_section_list_addresses): Remove const; allocate
5825         space from free list for an incremental update.
5826         (Output_segment::set_offset): Adjust size of RELRO segment for an
5827         incremental update.
5828         * output.h (Output_data::current_data_size): Move here from
5829         child classes.
5830         (Output_data::pre_finalize_data_size): New function.
5831         (Output_data::update_data_size): New function.
5832         (Output_section_headers::update_data_size): new function.
5833         (Output_section_data_build::current_data_size): Move to Output_data.
5834         (Output_data_strtab::update_data_size): New function.
5835         (Output_section::current_data_size): Move to Output_data.
5836         (Output_section::set_fixed_layout): New function.
5837         (Output_section::has_fixed_layout): New function.
5838         (Output_section::reserve): New function.
5839         (Output_section::update_data_size): New function.
5840         (Output_section::has_fixed_layout_): New data member.
5841         (Output_section::free_list_): New data member.
5842         (Output_segment::set_section_addresses): Remove const.
5843         (Output_segment::set_section_list_addresses): Remove const.
5844         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
5845         New function.
5846         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
5847         New function.
5848         * readsyms.cc (Read_symbols::do_read_symbols): Add library
5849         parameter when calling Add_symbols constructor; store argument
5850         serial number for members of a lib group.
5851         (Add_symbols::locks): Allow case where token == NULL.
5852         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
5853         (Read_member::~Read_member): New function.
5854         (Read_member::is_runnable): New function.
5855         (Read_member::locks): New function.
5856         (Read_member::run): New function.
5857         (Check_script::~Check_script): New function.
5858         (Check_script::is_runnable): New function.
5859         (Check_script::locks): New function.
5860         (Check_script::run): New function.
5861         (Check_library::~Check_library): New function.
5862         (Check_library::is_runnable): New function.
5863         (Check_library::locks): New function.
5864         (Check_library::run): New function.
5865         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
5866         (Add_symbols::library_): New data member.
5867         (class Read_member): New class.
5868         (class Check_script): New class.
5869         (class Check_library): New class.
5870         * reloc.cc (Read_relocs::is_runnable): Allow case where
5871         token == NULL.
5872         (Read_relocs::locks): Likewise.
5873         (Scan_relocs::locks): Likewise.
5874         (Relocate_task::locks): Likewise.
5875         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
5876         to clear counters.
5877         (Sized_relobj::incremental_relocs_scan): Fix comment.
5878         (Sized_relobj::do_relocate): Pass output file offset to
5879         write_local_symbols.
5880         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
5881         from class declaration.
5882         * script.cc (read_input_script): Allocate Script_info; pass
5883         argument serial number to report_script.
5884         * script.h (class Script_info): Move to incremental.h.
5885         * symtab.cc (Symbol_table::add_from_incrobj): New function.
5886         * symtab.h (Symbol_table::add_from_incrobj): New function.
5887         (Symbol_table::set_file_offset): New function.
5888
5889 2011-04-05  Cary Coutant  <ccoutant@google.com>
5890
5891         * incremental-dump.cc (dump_incremental_inputs): Change signature
5892         to take a Sized_incremental_binary; change caller.  Use readers
5893         in Sized_incremental_binary.
5894         * incremental.cc
5895         (Sized_incremental_binary::find_incremental_inputs_sections):
5896         Rename do_find_incremental_inputs_sections to this.
5897         (Sized_incremental_binary::setup_readers): New function.
5898         (Sized_incremental_binary::do_check_inputs): Check
5899         has_incremental_info_ flag; move setup code to setup_readers;
5900         use input readers.
5901         (Sized_incremental_binary::do_file_is_unchanged): New function.
5902         (Sized_incremental_binary::do_get_input_reader): New function.
5903         * incremental.h (class Incremental_binary): Move to end of file.
5904         (Incremental_binary::file_is_unchanged): New function.
5905         (Incremental_binary::do_file_is_unchanged): New function.
5906         (Incremental_binary::Input_reader): New class.
5907         (Incremental_binary::get_input_reader): New function.
5908         (class Sized_incremental_binary): Move to end of file.
5909         (Sized_incremental_binary::Sized_incremental_binary): Setup the
5910         input section reader classes.
5911         (Sized_incremental_binary::has_incremental_info): New function.
5912         (Sized_incremental_binary::inputs_reader): New function.
5913         (Sized_incremental_binary::symtab_reader): New function.
5914         (Sized_incremental_binary::relocs_reader): New function.
5915         (Sized_incremental_binary::got_plt_reader): New function.
5916         (Sized_incremental_binary::do_file_is_unchanged): New function.
5917         (Sized_incremental_binary::Sized_input_reader): New class.
5918         (Sized_incremental_binary::get_input_reader): New function.
5919         (Sized_incremental_binary::find_incremental_inputs_sections):
5920         Rename do_find_incremental_inputs_sections to this.
5921         (Sized_incremental_binary::setup_readers): New function.
5922         (Sized_incremental_binary::has_incremental_info_): New data member.
5923         (Sized_incremental_binary::inputs_reader_): New data member.
5924         (Sized_incremental_binary::symtab_reader_): New data member.
5925         (Sized_incremental_binary::relocs_reader_): New data member.
5926         (Sized_incremental_binary::got_plt_reader_): New data member.
5927         (Sized_incremental_binary::current_input_file_): New data member.
5928
5929 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
5930
5931         PR gold/12640
5932         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
5933         violation.
5934
5935 2011-03-30  Cary Coutant  <ccoutant@google.com>
5936
5937         * archive.cc (Archive::include_member): Adjust call to report_object.
5938         (Add_archive_symbols::run): Add script_info to call to
5939         report_archive_begin.
5940         (Lib_group::include_member): Adjust call to report_object.
5941         (Add_lib_group_symbols::run): Adjust call to report_object.
5942         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
5943         blocks.  Add object count for script input files.
5944         * incremental.cc (Incremental_inputs::report_archive_begin): Add
5945         script_info parameter; change all callers.
5946         (Incremental_inputs::report_object): Add script_info parameter;
5947         change all callers.
5948         (Incremental_inputs::report_script): Store backpointer to
5949         incremental info entry.
5950         (Output_section_incremental_inputs::set_final_data_size): Record
5951         additional information for scripts.
5952         (Output_section_incremental_inputs::write_info_blocks): Likewise.
5953         * incremental.h (Incremental_script_entry::add_object): New function.
5954         (Incremental_script_entry::get_object_count): New function.
5955         (Incremental_script_entry::get_object): New function.
5956         (Incremental_script_entry::objects_): New data member; adjust
5957         constructor.
5958         (Incremental_inputs::report_archive_begin): Add script_info parameter.
5959         (Incremental_inputs::report_object): Add script_info parameter.
5960         (Incremental_inputs_reader::get_object_count): New function.
5961         (Incremental_inputs_reader::get_object_offset): New function.
5962         * options.cc (Input_arguments::add_file): Return reference to
5963         new input argument.
5964         * options.h (Input_argument::set_script_info): New function.
5965         (Input_argument::script_info): New function.
5966         (Input_argument::script_info_): New data member; adjust all
5967         constructors.
5968         (Input_file_group::add_file): Return reference to new input argument.
5969         (Input_file_lib::add_file): Likewise.
5970         (Input_arguments::add_file): Likewise.
5971         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
5972         * script.cc (Parser_closure::Parser_closure): Add script_info
5973         parameter; adjust all callers.
5974         (Parser_closure::script_info): New function.
5975         (Parser_closure::script_info_): New data member.
5976         (read_input_script): Report scripts earlier to incremental info.
5977         (script_add_file): Set script_info in Input_argument.
5978         (script_add_library): Likewise.
5979         * script.h (Script_options::Script_info): Rewrite class.
5980
5981 2011-03-29  Cary Coutant  <ccoutant@google.com>
5982
5983         * archive.cc (Library_base::should_include_member): Move
5984         method here from class Archive.
5985         (Archive::Archive): Initialize base class.
5986         (Archive::should_include_member): Move to base class.
5987         (Archive::do_for_all_unused_symbols): New function.
5988         (Add_archive_symbols::run): Remove redundant access to
5989         incremental_inputs.
5990         (Lib_group::Lib_group): Initialize base class.
5991         (Lib_group::do_filename): New function.
5992         (Lib_group::include_member): Pass pointer to Lib_group to
5993         report_object.
5994         (Lib_group::do_for_all_unused_symbols): New function.
5995         (Add_lib_group_symbols::run): Report archive information for
5996         incremental links.
5997         * archive.h (class Library_base): New base class.
5998         (class Archive): Derive from Library_base.
5999         (Archive::filename): Move to base class.
6000         (Archive::set_incremental_info): Likewise.
6001         (Archive::incremental_info): Likewise.
6002         (Archive::Should_include): Likewise.
6003         (Archive::should_include_member): Likewise.
6004         (Archive::Armap_entry): Remove.
6005         (Archive::Unused_symbol_iterator): Remove.
6006         (Archive::unused_symbols_begin): Remove.
6007         (Archive::unused_symbols_end): Remove.
6008         (Archive::do_filename): New function.
6009         (Archive::do_get_mtime): New function.
6010         (Archive::do_for_all_unused_symbols): New function.
6011         (Archive::task_): Move to base class.
6012         (Archive::incremental_info_): Likewise.
6013         (class Lib_group): Derive from Library_base.
6014         (Lib_group::do_filename): New function.
6015         (Lib_group::do_get_mtime): New function.
6016         (Lib_group::do_for_all_unused_symbols): New function.
6017         (Lib_group::task_): Move to base class.
6018         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
6019         function.
6020         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
6021         function.
6022         * incremental.cc (Incremental_inputs::report_archive_begin):
6023         Use Library_base; call library's get_mtime; add incremental inputs
6024         entry before members.
6025         (class Unused_symbol_visitor): New class.
6026         (Incremental_inputs::report_archive_end): Use Library_base; use
6027         visitor class to record unused symbols; don't add incremental inputs
6028         entry after members.
6029         (Incremental_inputs::report_object): Use Library_base.
6030         * incremental.h
6031         (Incremental_archive_entry::Incremental_archive_entry): Remove
6032         unused Archive parameter.
6033         (Incremental_inputs::report_archive_begin): Use Library_base.
6034         (Incremental_inputs::report_archive_end): Likewise.
6035         (Incremental_inputs::report_object): Likewise.
6036         * object.cc (Sized_relobj::do_for_all_global_symbols): New
6037         function.
6038         * object.h (Object::for_all_global_symbols): New function.
6039         (Object::do_for_all_global_symbols): New function.
6040         (Sized_relobj::do_for_all_global_symbols): New function.
6041         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
6042         function.
6043         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
6044         function.
6045
6046 2011-03-27  Ian Lance Taylor  <iant@google.com>
6047
6048         * archive.cc (Archive::interpret_header): Return -1 if something
6049         goes wrong.  Change callers accordingly.
6050
6051 2011-03-25  Cary Coutant  <ccoutant@google.com>
6052
6053         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
6054         * testsuite/Makefile.in: Regenerate.
6055
6056 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
6057
6058         * plugin.cc (get_view): New.
6059         (Plugin::load): Pass get_view to the plugin.
6060         (Plugin_manager::get_view): New.
6061
6062 2011-03-21  Ian Lance Taylor  <iant@google.com>
6063
6064         * testsuite/final_layout.sh: Rewrite to not use dc.
6065         * testsuite/relro_test.sh: Fail if dc is not present.
6066
6067 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
6068
6069         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
6070         Change == to -eq.
6071         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
6072         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
6073         Change == to -eq.
6074         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
6075         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
6076
6077 2011-03-14  Ian Lance Taylor  <iant@google.com>
6078
6079         * script-sections.cc (Sort_output_sections::script_compare):
6080         Rename from is_before, change return type.
6081         (Sort_output_sections::operator()): Adjust accordingly.
6082
6083 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
6084
6085         PR gold/12572
6086         * testsuite/odr_violation2.cc: Add comment to make all error line
6087         numbers double digits.
6088         * testsuite/debug_msg.sh: Adjust expected errors.
6089
6090 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
6091
6092         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
6093         but mark earlier ones as non-canonical
6094         (offset_to_iterator): Update search target and example
6095         (do_addr2line): Return extra lines in a vector*
6096         (format_file_lineno): Extract from do_addr2line
6097         (one_addr2line): Add vector* out-param
6098         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
6099         when a lineno entry appeared last for its instruction
6100         (Dwarf_line_info): Add vector* out-param
6101         * object.cc (Relocate_info): Pass NULL for the vector* out-param
6102         * symtab.cc (Odr_violation_compare): Include the lineno in the
6103         comparison again.
6104         (linenos_from_loc): New. Combine the canonical line for an
6105         address with its other lines.
6106         (True_if_intersect): New. Helper functor to make
6107         std::set_intersection a query.
6108         (detect_odr_violations): Compare sets of lines instead of just
6109         one line for each function. This became less deterministic, but
6110         has fewer false positives.
6111         * symtab.h: Declarations.
6112         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
6113         mix an optimized and non-optimized object in the same binary
6114         (odr_violation2.so): Same.
6115         * testsuite/Makefile.in: Regenerate from Makefile.am.
6116         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
6117         * testsuite/debug_msg.sh: Update line numbers and add
6118         assertions.
6119         * testsuite/odr_violation1.cc: Use OdrDerived, in a
6120         non-optimized context.
6121         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
6122         isn't inlined, and use OdrDerived in an optimized context.
6123         * testsuite/odr_header1.h: Defines OdrDerived, where
6124         optimization will change the
6125         first-instruction-in-the-destructor's file and line number.
6126         * testsuite/odr_header2.h: Defines OdrBase.
6127
6128 2011-03-09  Ian Lance Taylor  <iant@google.com>
6129
6130         * fileread.cc (File_read::clear_views): Don't delete the whole
6131         file view.
6132
6133 2011-03-08  Ian Lance Taylor  <iant@google.com>
6134
6135         PR gold/12525
6136         * fileread.cc: #include <climits>.
6137         (GOLD_IOV_MAX): Define.
6138         (File_read::read_multiple): Limit number of entries by iov_max.
6139         * fileread.h (class File_read): Always set max_readv_entries to
6140         128.
6141
6142 2011-03-07  Ian Lance Taylor  <iant@google.com>
6143
6144         PR gold/12525
6145         * options.h (class General_options): Add -dy and -dn.
6146
6147 2011-03-02  Cary Coutant  <ccoutant@google.com>
6148
6149         * testsuite/script_test_9.t: Add TLS segment.
6150
6151 2011-03-02  Simon Baldwin  <simonb@google.com>
6152
6153         * configure.ac: Add check for gnu_indirect_function support in
6154         the toolchain building binutils.
6155         * configure: Rebuild.
6156
6157 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
6158
6159         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
6160         plugin only symbols.
6161         (Symbol_table::sized_finalize_symbol) Mark symbol only present
6162         in plugin files as not needed in the symbol table.
6163
6164 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
6165
6166         * output.cc (Output_section::add_input_section): Delay fill
6167         generation for section ordering.
6168
6169 2011-02-09  Ian Lance Taylor  <iant@google.com>
6170
6171         PR gold/12316
6172         * object.h (class Sized_relobj): Remove clear_local_symbols.
6173         * reloc.cc (Sized_relobj::do_relocate): Don't call
6174         clear_local_symbols.
6175
6176 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
6177
6178         * plugin.cc (is_visible_from_outside): Return true for symbols
6179         in the -u option.
6180
6181 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
6182
6183         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
6184         filename.
6185
6186 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
6187
6188         * icf.h (is_section_foldable_candidate): Change type of parameter
6189         to std::string.
6190         * icf.cc (Icf::find_identical_sections): Change type of local variable
6191         section_name to be std::string.
6192         (is_function_ctor_or_dtor): Change type of parameter to std::string.
6193
6194 2011-01-25  Ian Lance Taylor  <iant@google.com>
6195
6196         * script.cc (script_add_extern): Rewrite to use
6197         add_symbol_reference.
6198
6199 2011-01-25  Doug Kwan  <dougkwan@google.com>
6200
6201         * icf.cc (get_section_contents): Always lock section's object.
6202
6203 2011-01-24  Ian Lance Taylor  <iant@google.com>
6204
6205         * options.h (class General_options): Accept
6206         --no-detect-odr-violations.
6207
6208 2011-01-24  Ian Lance Taylor  <iant@google.com>
6209
6210         * version.cc (version_string): Bump to 1.11.
6211
6212 2011-01-24  Ian Lance Taylor  <iant@google.com>
6213
6214         * plugin.cc (class Plugin_rescan): Define new class.
6215         (Plugin_manager::claim_file): Set any_claimed_.
6216         (Plugin_manager::save_archive): New function.
6217         (Plugin_manager::save_input_group): New function.
6218         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
6219         necessary.
6220         (Plugin_manager::new_undefined_symbol): New function.
6221         (Plugin_manager::rescan): New function.
6222         (Plugin_manager::rescannable_defines): New function.
6223         (Plugin_manager::add_input_file): Set any_added_.
6224         * plugin.h (class Plugin_manager): define new fields rescannable_,
6225         undefined_symbols_, any_claimed_, and any_added_.  Declare
6226         Plugin_rescan as friend.  Declare new functions.
6227         (Plugin_manager::Rescannable): Define type.
6228         (Plugin_manager::Rescannable_list): Define type.
6229         (Plugin_manager::Undefined_symbol_list): Define type.
6230         (Plugin_manager::Plugin_manager): Initialize new fields.
6231         * archive.cc (Archive::defines_symbol): New function.
6232         (Add_archive_symbols::run): Pass archive to plugins if any.
6233         * archive.h (class Archive): Declare defines_symbol.
6234         * readsyms.cc (Input_group::~Input_group): New function.
6235         (Finish_group::run): Pass input_group to plugins if any.
6236         * readsyms.h (class Input_group): Declare destructor.
6237         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
6238         any.
6239
6240 2011-01-10  Ian Lance Taylor  <iant@google.com>
6241
6242         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
6243         section as relro.
6244         (Layout::set_segment_offsets): Reset increase_relro before calling
6245         set_section_addresses a second time.
6246
6247 2011-01-04  Cary Coutant  <ccoutant@google.com>
6248
6249         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
6250         sections before NOBITS sections.
6251
6252 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
6253
6254         * version.cc (print_version): Update copyright to 2011.
6255
6256 2010-12-23  Cary Coutant  <ccoutant@google.com>
6257
6258         * output.h (Output_data_reloc::add_output_section): Pass OD instead
6259         of OS to this->add.  Add OD parameter to second form of the function.
6260
6261 2010-12-20  Ian Lance Taylor  <iant@google.com>
6262
6263         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
6264         second of two consecutive entries with same offset.
6265
6266 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6267
6268         * testsuite/Makefile.am (ifuncmain2static_LDADD)
6269         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
6270         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
6271         to avoid unneeded links against $(LDADD).
6272         * testsuite/Makefile.in: Regenerate.
6273
6274 2010-12-15  Ian Lance Taylor  <iant@google.com>
6275
6276         PR gold/12324
6277         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
6278         for R_X86_64_32 and R_X86_64_PC32.
6279         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
6280         ver_matching_def_pic.o.
6281         (ver_matching_def_pic.o): New target.
6282
6283 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6284
6285         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
6286         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
6287         Move definition before File_read::View member definitions.
6288         (File_read::View::~View): Initialize and hold lock before
6289         updating current_mapped_bytes.
6290
6291 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6292
6293         * dwarf_reader.cc: Remove outdated comment.
6294         * gold-threads.cc: Fix typo in error message.
6295         * archive.cc: Fix typos in comments.
6296         * archive.h: Likewise.
6297         * arm-reloc-property.cc: Likewise.
6298         * arm-reloc-property.h: Likewise.
6299         * arm-reloc.def: Likewise.
6300         * arm.cc: Likewise.
6301         * attributes.h: Likewise.
6302         * cref.cc: Likewise.
6303         * ehframe.cc: Likewise.
6304         * fileread.h: Likewise.
6305         * gold.h: Likewise.
6306         * i386.cc: Likewise.
6307         * icf.cc: Likewise.
6308         * incremental.h: Likewise.
6309         * int_encoding.cc: Likewise.
6310         * layout.h: Likewise.
6311         * main.cc: Likewise.
6312         * merge.h: Likewise.
6313         * object.cc: Likewise.
6314         * object.h: Likewise.
6315         * options.cc: Likewise.
6316         * readsyms.cc: Likewise.
6317         * reduced_debug_output.cc: Likewise.
6318         * reloc.cc: Likewise.
6319         * script-sections.cc: Likewise.
6320         * sparc.cc: Likewise.
6321         * symtab.h: Likewise.
6322         * target-reloc.h: Likewise.
6323         * target.cc: Likewise.
6324         * target.h: Likewise.
6325         * timer.cc: Likewise.
6326         * timer.h: Likewise.
6327         * x86_64.cc: Likewise.
6328
6329 2010-12-09  Cary Coutant  <ccoutant@google.com>
6330
6331         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
6332         stack.
6333         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
6334         parameter; change all callers.
6335         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
6336         * options.h (warn_execstack): New option.
6337
6338 2010-12-07  Doug Kwan  <dougkwan@google.com>
6339
6340         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
6341         like function call relocations.
6342
6343 2010-12-07  Ian Lance Taylor  <iant@google.com>
6344
6345         * archive.cc (Archive::get_elf_object_for_member): Permit
6346         punconfigured to be NULL.
6347         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
6348         (Archive::include_member): Pass NULL to get_elf_object_for_member
6349         if we searched for the archive and this is the first included
6350         object.
6351
6352 2010-12-01  Ian Lance Taylor  <iant@google.com>
6353
6354         * dwarf_reader.h (class Sized_dwarf_line_info): Add
6355         track_relocs_type_ field.
6356         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
6357         Set track_relocs_type_.
6358         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
6359         contents when using RELA relocs.
6360         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
6361         reloc_map_.
6362         * reloc.cc (Track_relocs::next_addend): New function.
6363         * reloc.h (class Track_relocs): Declare next_addend.
6364
6365 2010-12-01  Ian Lance Taylor  <iant@google.com>
6366
6367         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
6368         virtual destructor.
6369
6370 2010-12-01  Ian Lance Taylor  <iant@google.com>
6371
6372         * README: Update compilers known to work and fail.
6373
6374 2010-11-23  Matthias Klose  <doko@ubuntu.com>
6375
6376         * configure.in: For --enable-gold, handle value `default' instead of
6377         `both*'.  Always install ld as ld.bfd, install as ld if gold is
6378         not the default.
6379         * configure: Regenerate.
6380
6381 2010-11-18  Doug Kwan  <dougkwan@google.com>
6382
6383         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
6384         and right_alignment to be zero.  Store result alignment only if it is
6385         greater than existing alignment.
6386
6387 2010-11-16  Cary Coutant  <ccoutant@google.com>
6388
6389         PR gold/12220
6390         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
6391         Check for ".zdebug_line".
6392
6393 2010-11-16  Doug Kwan  <dougkwan@google.com>
6394             Cary Coutant  <ccoutant@google.com>
6395
6396         * output.h (Output_segment::set_section_addresses): Pass increase_relro
6397         by reference; adjust all callers.
6398         * output.cc (Output_segment::set_section_addresses): Adjust references
6399         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
6400         list is empty.
6401         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
6402         end at page boundary.
6403
6404 2010-11-16  Cary Coutant  <ccoutant@google.com>
6405
6406         PR gold/12220
6407         * layout.cc (Layout::choose_output_section): Transform names of
6408         compressed sections even when using a script with a SECTIONS clause.
6409         (Layout::output_section_name): Remove code to transform
6410         compressed debug section names.
6411         * output.cc (Output_section::add_input_section): Use uncompressed
6412         section size when tracking input sections.
6413
6414 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
6415
6416         * symtab.h (Symbol::NON_PIC_REF): Remove.
6417         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
6418         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
6419         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
6420         (Symbol::use_plt_offset): Take a flags argument and pass it
6421         directly to needs_dynamic_reloc.  Restrict check for undefined
6422         weak symbols to function calls.
6423         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
6424         (Target_arm::Scan::global): Use it.
6425         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
6426         (Target_arm::Relocate::relocate): Likewise.
6427         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
6428         parameter with an r_type parameter.  Use get_reference_flags
6429         to get the flags.
6430         (Target_arm::Relocate::relocate): Update accordingly.
6431         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
6432         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
6433         (Target_i386::Scan::global): Likewise.
6434         (Target_i386::Relocate::relocate): Likewise.
6435         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
6436         parameter with an r_type parameter.  Use get_reference_flags
6437         to get the flags.
6438         (Target_i386::Relocate::relocate): Update accordingly.
6439         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
6440         (Target_powerpc::Scan::global): Use it.
6441         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
6442         (Target_powerpc::Relocate::relocate): Likewise.
6443         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
6444         (Target_sparc::Scan::global): Use it.
6445         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
6446         (Target_sparc::Relocate::relocate): Likewise.
6447         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
6448         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
6449         (Target_x86_64::Scan::global): Likewise.
6450         (Target_x86_64::Relocate::relocate): Likewise.
6451
6452 2010-11-08  Doug Kwan  <dougkwan@google.com>
6453             Cary Coutant  <ccoutant@google.com>
6454
6455         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
6456         (Arm_exidx_merge_section::section_contents_): New data member.
6457         (Arm_input_section::Arm_input_section): Initialize original_contents_.
6458         (Arm_input_section::~Arm_input_section): De-allocate memory.
6459         (Arm_input_section::original_contents_): New data member.
6460         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
6461         in parameters instead of calling Object::section_contents without
6462         locking.
6463         (Arm_output_section::group_section): New parameter TASK.  Pass it
6464         to callees that need locking objects.
6465         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
6466         to lock EXIDX input sections.  Fix a formatting issue.  Call
6467         Arm_exidx_merged_section::build_contents to create merged section
6468         contents.
6469         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
6470         to lock object of stub table owner.
6471         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
6472         TEXT_SIZE to initialize data member TEXT_SIZE_.
6473         (Arm_exidx_input_section::addralign): Fix typo in comment.
6474         (Arm_exidx_input_section::text_size): New method.
6475         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
6476         that require locking objects.  Lock objects before scanning for stubs
6477         and updating local symbols.
6478         (Arm_input_section<big_endian>::init): Copy contents of original
6479         input section.
6480         (Arm_input_section<big_endian>::do_write): Use saved contents of
6481         original input section instead of calling Object::section_contents
6482         without locking.
6483         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
6484         size without calling Object::section_size().
6485         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
6486         for size.  Allocate a buffer for merged EXIDX entries.
6487         (Arm_exidx_merged_section::build_contents): New method.
6488         (Arm_exidx_merged_section::do_write): Move merge section contents
6489         building code to Arm_exidx_merged_section::build_contetns.  Write
6490         out contetns in buffer instead of building it on the fly.
6491         (Arm_relobj::make_exidx_input_section): Also pass text section size
6492         to Arm_exidx_input_section constructor.
6493         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
6494         (Arm_dynobj::do_read_symbols): Fix memory leak.
6495         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
6496         * target.h: (class Task): Add forward declaration.
6497         (Target::relax): Add new parameter TASK and pass it to
6498         Target::do_relax().
6499         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
6500
6501 2010-11-05  Cary Coutant  <ccoutant@google.com>
6502
6503         PR gold/10708
6504         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
6505         object when reading from the file.
6506         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
6507         second layout pass.
6508         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
6509         when reading section contents.
6510         (get_section_contents): Likewise.
6511         (icf::find_identical_sections): Likewise.
6512         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
6513         object when reading from the file.
6514         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
6515         the object when doing deferred section layout.
6516
6517 2010-11-03  Nick Clifton  <nickc@redhat.com>
6518
6519         PR gold/12001
6520         * script.h (class Symbol_assignment: name): New member.  Returns
6521         the name of the symbol.
6522         * scrfipt.cc (Script_options::is_pending_assignment): New member.
6523         Returns true if the given symbol name is on the list of
6524         assignments wating to be processed.
6525         * archive.cc (should_incldue_member): If the symbol is undefined,
6526         check to see if it is on the list of symbols pending assignment.
6527
6528 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
6529
6530         * script-sections.cc (Script_sections::find_memory_region): Check
6531         for a NULL output section pointer.
6532
6533 2010-10-29  Doug Kwan  <dougkwan@google.com>
6534
6535         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
6536         Output_section::add_relaxed_input_section.
6537         * output.cc (Output_section::add_relaxed_input_section): Add new
6538         arguments LAYOUT and NAME.  Set section order index.
6539         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
6540         Copy section order index.
6541         * output.h (Output_section::add_relaxed_input_section): Add new
6542         arguments LAYOUT and NAME.
6543
6544 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6545
6546         * testsuite/Makefile.am: Move gcctestdir/ld rule to
6547         NATIVE_OR_CROSS_LINKER.
6548         * testsuite/Makefile.in: Regenerate.
6549
6550 2010-10-20  Doug Kwan  <dougkwan@google.com>
6551
6552         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
6553         without SHF_LINK_ORDER flags.
6554         * layout.cc (Layout::choose_output_section): Do not filter
6555         SHF_LINK_ORDER flag in a relocatable link.
6556
6557 2010-10-17  Cary Coutant  <ccoutant@google.com>
6558
6559         * output.h (Output_segment::set_section_addresses): Change function
6560         signature.  Update all callers.
6561         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
6562         sections.
6563         (Output_segment::set_section_addresses): Align after last TLS
6564         section.  Add padding before last relro section instead of after.
6565
6566 2010-10-17  Doug Kwan  <dougkwan@google.com>
6567
6568         * gold/arm.cc (Target_arm::got_section): Use correct order and set
6569         GOT output section to be writable.
6570
6571 2010-10-14  Cary Coutant  <ccoutant@google.com>
6572
6573         * debug.h (DEBUG_INCREMENTAL): New flag.
6574         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
6575         * gold.cc (queue_initial_tasks): Check parameters for incremental link
6576         mode.
6577         * incremental.cc (report_command_line): Ignore all forms of
6578         --incremental.
6579         * layout.cc (Layout::Layout): Check parameters for incremental link
6580         mode.
6581         * options.cc (General_options::parse_incremental): New function.
6582         (General_options::parse_no_incremental): New function.
6583         (General_options::parse_incremental_full): New function.
6584         (General_options::parse_incremental_update): New function.
6585         (General_options::incremental_mode_): New data member.
6586         (General_options::finalize): Check incremental_mode_.
6587         * options.h (General_options): Update help text for --incremental.
6588         Add --no-incremental, --incremental-full, --incremental-update.
6589         (General_options::Incremental_mode): New enum type.
6590         (General_options::incremental_mode): New function.
6591         (General_options::incremental_mode_): New data member.
6592         * parameters.cc (Parameters::incremental_mode_): New data member.
6593         (Parameters::set_options): Set incremental_mode_.
6594         (Parameters::set_incremental_full): New function.
6595         (Parameters::incremental): New function.
6596         (Parameters::incremental_update): New function.
6597         (set_parameters_incremental_full): New function.
6598         * parameters.h (Parameters::set_incremental_full): New function.
6599         (Parameters::incremental): New function.
6600         (Parameters::incremental_update): New function.
6601         (Parameters::incremental_mode_): New data member.
6602         (set_parameters_incremental_full): New function.
6603         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
6604         incremental link mode.
6605         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
6606         (Sized_relobj::do_relocate_sections): Likewise.
6607         * testsuite/Makefile.am (incremental_test): Use --incremental-full
6608         option.
6609         * testsuite/Makefile.in: Regenerate.
6610         * testsuite/incremental_test.sh: Filter all forms of --incremental.
6611
6612 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6613
6614         * script-sections.h (class Script_sections): Make
6615         Sections_elements typedef public.
6616         * script-sections.cc (class Sort_output_sections): Add elements_
6617         field.  Add constructor which sets it; change all callers.
6618         (Sort_output_sections::is_before): New function.
6619         (Sort_output_sections::operator()): Call is_before.
6620         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
6621         conditional.
6622         * testsuite/script_test_10.sh: New test. Test script section
6623         order.
6624         * testsuite/script_test_10.t: Likewise.
6625         * testsuite/script_test_10.s: Likewise.
6626         * testsuite/Makefile.am: Wrap the cross linker tests and the
6627         common tests into NATIVE_OR_CROSS_LINKER.
6628         (check_SCRIPTS): Add script_test_10.sh.
6629         (check_DATA): Add script_test_10.stdout.
6630         (script_test_10.o, script_test_10): New targets.
6631         (script_test_10.stdout): New target.
6632         * configure, testsuite/Makefile.in: Regenerate.
6633
6634 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6635
6636         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
6637         error for the deprecated relocations.
6638         (Target_arm::Scan::global): Likewise.
6639         (Target_arm::Relocate::relocate): Likewise.
6640
6641 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
6642
6643         * fileread.cc (Input_file::find_file): Initialize *found_name
6644         and *namep when using the fallback search for case 4.
6645
6646 2010-10-11  Cary Coutant  <ccoutant@google.com>
6647
6648         * options.h (class General_options): Redefine -z lazy as an alias for
6649         the negation of -z now.
6650
6651 2010-10-11  Ian Lance Taylor  <iant@google.com>
6652
6653         * resolve.cc (symbol_to_bits): Report the value of the unsupported
6654         binding.
6655
6656 2010-10-06  Nick Clifton  <nickc@redhat.com>
6657
6658         * script-sections.cc(class Memory_region): Remove
6659         current_lma_offset_ field.  Rename current_vma_offset_ to
6660         current_offset_.  Add last_section_ field.
6661         (Memory_region::get_current_vma_address): Rename to
6662         get_current_address.
6663         (Memory_region::get_current_lma_address): Delete.
6664         (Memory_region::increment_vma_offset): Rename to
6665         increment_offset.
6666         (Memory_region::increment_lma_offset): Delete.
6667         (Memory_region::attributes_compatible): New method.  Returns
6668         true if the provided section is compatible with the region.
6669         (Memory_region::get_last_section): New method.  Returns the last
6670         section to use the region.
6671         (Memory_region::set_last_section): New method.  Stores the last
6672         section to use the region.
6673         (Script_sections::block_in_region): New method.  Returns true if
6674         a block of memory is contained within a region.
6675         (Script_sections::find_memory_region): New method.  Locates a
6676         memory region to be used to set a VMA or LMA address.
6677         (Output_section_definition::set_section_addresses): Add code to
6678         check for addresses set by memory regions.
6679         (Output_segment::set_section_addresses): Remove memory region
6680         walking code.
6681         (Script_sections::create_segment): Add a warning if a header
6682         segment is created outside of any region.
6683         * script-sections.h (class Script_sections): Add prototypes for
6684         find_memory_region and block_in_region methods.
6685         * testsuite/memory_test.s: Use .long instead of .word.
6686         * testsuite/memory_test.t: Add some more output sections.
6687         * testsuite/memory_test.sh: Update expected output.
6688
6689 2010-10-02  Doug Kwan  <dougkwan@google.com>
6690
6691         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
6692         defintion to symtab.h
6693         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
6694         declaration to defintion.
6695
6696 2010-10-01  Nick Clifton  <nickc@redhat.com>
6697
6698         * expression.cc (eval): Replace dummy argument with NULL.
6699         (eval_maybe_dot): Check for a NULL result section pointer.
6700         (Symbol_expression::value): Likewise.
6701         (Dot_expression::value): Likewise.
6702         (BINARY_EXPRESSION): Likewise.
6703         (Max_expression::value): Likewise.
6704         (Min_expression::value): Likewise.
6705         (Absolute_expression::value): Likewise.
6706         (Addr_expression::value_from_output_section): Likewise.
6707         (Loaddddr_expression::value_from_output_section): Likewise.
6708         (Segment_start_expression::value): Likewise.
6709         * script-sections.cc
6710         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
6711         argument with NULL.
6712         (Sections_elememt_dot_assignment::set_section_addresses):
6713         Likewise.
6714         (Output_data_expression::do_write_to_buffer): Likewise.
6715         (Output_section_definition::finalize_symbols): Likewise.
6716         (Output_section_definition::set_section_addresses): Likewise.
6717
6718 2010-09-30  Doug Kwan  <dougkwan@google.com>
6719
6720         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
6721
6722 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
6723
6724         * target.h (Target::can_icf_inline_merge_sections): New virtual
6725         function.
6726         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
6727         virtual function.
6728         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
6729         virtual function.
6730         * icf.cc (get_section_contents): Inline merge sections only when
6731         target allows it.
6732
6733 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6734
6735         * configure: Regenerate.
6736
6737 2010-09-17  Ian Lance Taylor  <iant@google.com>
6738
6739         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
6740         * testsuite/Makefile.am (memory_test.o): New target.
6741         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
6742         memory_test.t.
6743         * testsuite/Makefile.in: Rebuild.
6744
6745 2010-09-17  Doug Kwan  <dougkwan@google.com>
6746
6747         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
6748         defintion if relocation uses GOT entries of the symbol.
6749         * testsuite/icf_safe_test.sh: Fix test.
6750         * testsuite/icf_safe_so_test.sh: Fix test.
6751
6752 2010-09-16  Cary Coutant  <ccoutant@google.com>
6753
6754         * script_sections.cc (class Memory_region): Remove "NULL" from
6755         vector initializations.
6756
6757 2010-09-15  Cary Coutant  <ccoutant@google.com>
6758
6759         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
6760         Resolve forwarding symbols.
6761
6762 2010-09-15  Doug Kwan  <dougkwan@google.com>
6763
6764         * gold/testsuite/script_test_3.t: Add ARM special sections.
6765         * gold/testsuite/script_test_4.t: Same.
6766         * gold/testsuite/script_test_5.t: Same.
6767         * gold/testsuite/script_test_6.t: Same.
6768         * gold/testsuite/script_test_7.t: Same.
6769         * gold/testsuite/script_test_7.t: Same.
6770         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
6771
6772 2010-09-14  Cary Coutant  <ccoutant@google.com>
6773
6774         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
6775         (Target_x86_64::Relocate::relocate_tls): Replace check for
6776         saw_tls_block_reloc_ with test for executable section.
6777
6778 2010-09-12  Cary Coutant  <ccoutant@google.com>
6779
6780         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
6781         position-independent executables to shared libraries need dynamic
6782         relocations.
6783         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
6784         position-independent executables.
6785         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
6786         * testsuite/Makefile.in: Regenerate.
6787
6788 2010-09-10  Nick Clifton  <nickc@redhat.com>
6789
6790         PR gold/11997
6791         * testsuite/memory_test.t: Discard any sections that are not
6792         needed.
6793
6794 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
6795
6796         PR gold/11996
6797         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
6798         "This::" to work around a bug in gcc 4.2.
6799
6800         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
6801
6802 2010-09-09  Rafael Espindola  <espindola@google.com>
6803
6804         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
6805         sections with different PF_X flags in the same segment.
6806         (Layout::find_first_load_seg): Search all segments to find the first
6807         one.
6808         * options.h (rosegment): New.
6809
6810 2010-09-08  Rafael Espindola  <espindola@google.com>
6811
6812         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
6813
6814 2010-09-08  Doug Kwan  <dougkwan@google.com>
6815
6816         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
6817         (Arm_relobj::do_relocate_sections): Add new parameter for output
6818         file to match the parent.
6819         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
6820         of local symbols instead of input values.  Update code to track
6821         changes in gold::relocate_section.
6822         * object.cc (Sized_relobj::compute_final_local_value): New methods.
6823         (Sized_relobj::compute_final_local_value_internal): New methods.
6824         (Sized_relobj::do_finalize_local_symbols): Move code from loop
6825         body into private version of Sized_relobj::compute_final_local_value.
6826         Call the inline method.
6827         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
6828         merged symbol value if there is one.
6829         (Symbol_value::has_output_value): New method defintiion.
6830         (Sized_relobj::Compute_final_local_value_status): New enum type.
6831         (Sized_relobj::compute_final_local_value): New methods.
6832         (Sized_relobj::compute_final_local_value_internal): New methods.
6833         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
6834         and arm_cortex_a8.sh.
6835         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
6836         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
6837         New tests.
6838         * Makefile.in: Regenerate.
6839         * testsuite/arm_bl_out_of_range.s: Update test.
6840         * testsuite/thumb_bl_out_of_range.s: Ditto.
6841         * testsuite/thumb_blx_out_of_range.s: Ditto.
6842         * testsuite/arm_branch_out_of_range.sh: New file.
6843         * testsuite/arm_cortex_a8.sh: Ditto.
6844         * testsuite/arm_cortex_a8_b.s: Ditto.
6845         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
6846         * testsuite/arm_cortex_a8_b_local.s: Ditto.
6847         * testsuite/arm_cortex_a8_bl.s: Ditto.
6848         * testsuite/arm_cortex_a8_blx.s: Ditto.
6849         * testsuite/arm_cortex_a8_local.s: Ditto.
6850         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
6851         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
6852
6853 2010-09-08  Rafael Espindola  <espindola@google.com>
6854
6855         * Makefile.am (memory_test.stdout): Run readelf with -W.
6856         * Makefile.in: Regenerate.
6857         * testsuite/memory_test.sh: Make the regexps accept both 32 and
6858         64 bit output.
6859
6860 2010-09-08  Rafael Espindola  <espindola@google.com>
6861
6862         * script-sections.cc (Script_sections::add_memory_region): Convert
6863         field precision to int.
6864         * script.cc (script_set_section_region, script_set_section_region):
6865         Convert field precision to int.
6866
6867 2010-09-08  Rafael Espindola  <espindola@google.com>
6868
6869         * arm.cc (do_finalize_sections): Create the __exidx_start and
6870         __exdix_end symbols even when the section is missing.
6871
6872 2010-09-08  Nick Clifton  <nickc@redhat.com>
6873
6874         * README: Remove claim that MEMORY is not supported.
6875         * expression.cc (script_exp_function_origin)
6876         (script_exp_function_length): Move from here to ...
6877         * script.cc: ... here.
6878         (script_set_section_region, script_add_memory)
6879         (script_parse_memory_attr, script_include_directive): New
6880         functions.
6881         * script-sections.cc
6882         (class Memory_region): New class.
6883         (class Output_section_definition): Add set_memory_region,
6884         set_section_vma, set_section_lma and get_section_name methods.
6885         (class Script_Sections): Add add_memory_region,
6886         find_memory_region, find_memory_region_origin,
6887         find_memory_region_length and set_memory_region methods.
6888         Have set_section_addresses method walk the list of set memory
6889         regions.
6890         Extend the print methos to display memory regions.
6891         * script-sections.h: Add prototypes for new methods.
6892         Add enum for MEMORY region attributes.
6893         * yyscript.y: Add support for parsing MEMORY regions.
6894         * script-c.h: Add prototypes for new functions.
6895         * testsuite/Makefile.am: Add test of MEMORY region functionality.
6896         * testsuite/Makefile.in: Regenerate.
6897         * testsuite/memory_test.sh: New script.
6898         * testsuite/memory_test.s: New assembler source file.
6899         * testsuite/memory_test.t: New linker script.
6900
6901 2010-08-27  Doug Kwan  <dougkwan@google.com>
6902
6903         * gold/resolve.cc (Symbol_table::should_override): Let a weak
6904         reference override an existing dynamic weak reference.
6905         * testsuite/Makefile.am: Add new test dyn_weak_ref.
6906         * testsuite/Makefile.in: Regenerate.
6907         * testsuite/dyn_weak_ref.sh: New file.
6908         * testsuite/dyn_weak_ref_1.c: Ditto.
6909         * testsuite/dyn_weak_ref_2.c: Ditto.
6910
6911 2010-08-27  Ian Lance Taylor  <iant@google.com>
6912
6913         * incremental.h (class Incremental_input_entry): Add virtual
6914         destructor.
6915
6916 2010-08-27  Ian Lance Taylor  <iant@google.com>
6917
6918         * testsuite/start_lib_test_3.c: Mark t3 as used.
6919
6920 2010-08-27  Nick Clifton  <nickc@redhat.com>
6921
6922         * options.cc (version_script): Fix small typo in previous
6923         whitespace tidyup.
6924
6925 2010-08-25  Nick Clifton  <nickc@redhat.com>
6926
6927         * archive.cc: Formatting fixes: Remove whitespace between
6928         typename and following asterisk.  Remove whitespace between
6929         function name and opening parenthesis.
6930         * archive.h: Likewise.
6931         * arm.cc: Likewise.
6932         * attributes.cc: Likewise.
6933         * attributes.h: Likewise.
6934         * common.cc: Likewise.
6935         * copy-relocs.cc: Likewise.
6936         * dirsearch.h: Likewise.
6937         * dynobj.cc: Likewise.
6938         * ehframe.cc: Likewise.
6939         * ehframe.h: Likewise.
6940         * expression.cc: Likewise.
6941         * fileread.cc: Likewise.
6942         * fileread.h: Likewise.
6943         * gc.h: Likewise.
6944         * gold-threads.cc: Likewise.
6945         * gold.cc: Likewise.
6946         * i386.cc: Likewise.
6947         * icf.h: Likewise.
6948         * incremental-dump.cc: Likewise.
6949         * incremental.cc: Likewise.
6950         * layout.cc: Likewise.
6951         * layout.h: Likewise.
6952         * main.cc: Likewise.
6953         * merge.cc: Likewise.
6954         * merge.h: Likewise.
6955         * object.cc: Likewise.
6956         * object.h: Likewise.
6957         * options.cc: Likewise.
6958         * options.h: Likewise.
6959         * output.cc: Likewise.
6960         * output.h: Likewise.
6961         * plugin.cc: Likewise.
6962         * plugin.h: Likewise.
6963         * powerpc.cc: Likewise.
6964         * reloc.cc: Likewise.
6965         * script-c.h: Likewise.
6966         * script-sections.cc: Likewise.
6967         * script.cc: Likewise.
6968         * stringpool.cc: Likewise.
6969         * symtab.cc: Likewise.
6970         * symtab.h: Likewise.
6971         * target.cc: Likewise.
6972         * timer.cc: Likewise.
6973         * timer.h: Likewise.
6974         * version.cc: Likewise.
6975         * x86_64.cc: Likewise.
6976
6977 2010-08-24  Nick Clifton  <nickc@redhat.com>
6978
6979         PR 11899
6980         * layout.cc (segment_precedes): Sort segments by their physical
6981         addresses, if they have been set.
6982
6983 2010-08-23  Cary Coutant  <ccoutant@google.com>
6984
6985         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
6986         symbols data.
6987         (Lib_group::include_member): Unlock object after deleting its
6988         symbols data.
6989         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
6990         the bug fixed here.
6991
6992 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
6993             Cary Coutant  <ccoutant@google.com>
6994
6995         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
6996         constructor, and set_blocker.
6997         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
6998         readsyms_blocker_.
6999         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
7000         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
7001         * testsuite/Makefile.am (start_lib_test): New test case.
7002         * testsuite/Makefile.in: Regenerate.
7003         * testsuite/start_lib_test_main.c: New file.
7004         * testsuite/start_lib_test_1.c: New file.
7005         * testsuite/start_lib_test_2.c: New file.
7006         * testsuite/start_lib_test_3.c: New file.
7007
7008 2010-08-19  Ian Lance Taylor  <iant@google.com>
7009
7010         * Makefile.in: Rebuild with automake 1.11.1.
7011         * aclocal.m4: Likewise.
7012         * testsuite/Makefile.in: Likewise.
7013
7014 2010-08-19  Ian Lance Taylor  <iant@google.com>
7015
7016         PR 10893
7017         * i386.cc (class Output_data_plt_i386): Update declarations.
7018         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
7019         local_ifuncs_ fields.
7020         (Target_i386::do_plt_section_for_global): New function.
7021         (Target_i386::do_plt_section_for_local): New function.
7022         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
7023         parameter; change all callers.  Initialize global_ifuncs_ and
7024         local_ifuncs_.  If doing a static link define __rel_iplt_start and
7025         __rel_iplt_end.
7026         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
7027         (Output_data_plt_i386::add_local_ifunc_entry): New function.
7028         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
7029         symbols.
7030         (Target_i386::make_plt_section): New function, broken out of
7031         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
7032         (Target_i386::make_plt_entry): Call make_plt_section.
7033         (Target_i386::make_local_ifunc_plt_entry): New function.
7034         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
7035         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
7036         R_386_IRELATIVE to switch.
7037         (Target_i386::Scan::global): Likewise.
7038         (Target_i386::Relocate::relocate): Likewise.
7039         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
7040         switch.
7041         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
7042         (Target_x86_64::do_plt_section_for_global): New function.
7043         (Target_x86_64::do_plt_section_for_local): New function.
7044         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
7045         parameter; change all callers.  If doing a static link define
7046         __rela_iplt_start and __rela_iplt_end.
7047         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
7048         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
7049         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
7050         to point to .plt.
7051         (Target_x86_64::make_local_ifunc_plt_entry): New function.
7052         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
7053         switch.
7054         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
7055         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
7056         R_X86_64_IRELATIVE to switch.
7057         (Target_x86_64::Scan::global): Likewise.
7058         (Target_x86_64::Relocate::relocate): Likewise.
7059         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
7060         switch.
7061         * target.h (class Target): Add plt_section_for_global and
7062         plt_section_for_local functions.  Add do_plt_section_for_global
7063         and do_plt_section_for_local virtual functions.
7064         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
7065         clarifying comments.
7066         (Symbol::use_plt_offset): Handle IFUNC symbol.
7067         * object.cc (Sized_relobj::Sized_relobj): Initialize
7068         local_plt_offsets_.
7069         (Sized_relobj::local_has_plt_offset): New function.
7070         (Sized_relobj::local_plt_offset): New function.
7071         (Sized_relobj::set_local_plt_offset): New function.
7072         (Sized_relobj::do_count): Handle IFUNC symbol.
7073         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
7074         a bit away from input_shndx_ field.  Add set_is_func_symbol and
7075         is_ifunc_symbol functions.
7076         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
7077         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
7078         local_plt_offsets_ field.
7079         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
7080         * output.h (class Output_section_data): Add non-const
7081         output_section function.
7082         (class Output_data_got): Update declarations.
7083         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
7084         Add use_plt_offset parameter to global and local constructors.
7085         Change all callers.  Change local_sym_index_ field to 31 bits.
7086         Change GSYM_CODE and CONSTANT_CODE accordingly.
7087         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
7088         doing a static link don't set sh_link field.
7089         (Output_data_got::Got_entry::write): Use PLT offset if
7090         appropriate.
7091         (Output_data_got::add_global_plt): New function.
7092         (Output_data_got::add_local_plt): New function.
7093         * target-reloc.h (relocate_section): Handle IFUNC symbol.
7094         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
7095         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
7096         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
7097         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
7098         IFUNC conditional.
7099         * testsuite/ifunc-sel.h: New file.
7100         * testsuite/ifuncmain1.c: New file.
7101         * testsuite/ifuncmain1vis.c: New file.
7102         * testsuite/ifuncmod1.c: New file.
7103         * testsuite/ifuncdep2.c: New file.
7104         * testsuite/ifuncmain2.c: New file.
7105         * testsuite/ifuncmain3.c: New file.
7106         * testsuite/ifuncmod3.c: New file.
7107         * testsuite/ifuncmain4.c: New file.
7108         * testsuite/ifuncmain5.c: New file.
7109         * testsuite/ifuncmod5.c: New file.
7110         * testsuite/ifuncmain6pie.c: New file.
7111         * testsuite/ifuncmod6.c: New file.
7112         * testsuite/ifuncmain7.c: New file.
7113         * configure, testsuite/Makefile.in: Rebuild.
7114
7115 2010-08-18  Ian Lance Taylor  <iant@google.com>
7116
7117         * incremental.cc
7118         (Output_section_incremental_inputs::write_input_files): Add cast
7119         to avoid signed/unsigned comparison warning.
7120         (Output_section_incremental_inputs::write_info_blocks): Likewise.
7121
7122 2010-08-12  Cary Coutant  <ccoutant@google.com>
7123
7124         * common.cc (Sort_commons::operator()): Remove unnecessary code.
7125
7126 2010-08-13  Ian Lance Taylor  <iant@google.com>
7127
7128         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
7129
7130 2010-08-12  Cary Coutant  <ccoutant@google.com>
7131             Doug Kwan  <dougkwan@google.com>
7132
7133         * resolve.cc (Symbol_table::should_override): When a weak dynamic
7134         defintion overrides non-weak undef, remember that the original undef
7135         is not weak.
7136         * symtab.cc (Symbol_table::sized_write_global): For undef without
7137         an original weak binding, set binding to global in output.
7138         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
7139         * testsuite/Makefile.in: Regenerate.
7140         * testsuite/strong_ref_weak_def.sh: New file.
7141         * testsuite/strong_ref_weak_def_1.c: Ditto.
7142         * testsuite/strong_ref_weak_def_2.c: Ditto.
7143
7144 2010-08-12  Cary Coutant  <ccoutant@google.com>
7145
7146         * testsuite/incremental_test.sh: Rewrite.
7147         * testsuite/incremental_test_1.c: Rewrite.
7148         * testsuite/incremental_test_2.c: Rewrite.
7149
7150 2010-08-12  Cary Coutant  <ccoutant@google.com>
7151
7152         * arm.cc (Target_arm::got_size): Add const.
7153         (Target_arm::got_entry_count): New function.
7154         (Target_arm::plt_entry_count): New function.
7155         (Target_arm::first_plt_entry_offset): New function.
7156         (Target_arm::plt_entry_size): New function.
7157         (Output_data_plt_arm::entry_count): New function.
7158         (Output_data_plt_arm::first_plt_entry_offset): New function.
7159         (Output_data_plt_arm::get_plt_entry_size): New function.
7160         * i386.cc (Target_i386::got_size): Add const.
7161         (Target_i386::got_entry_count): New function.
7162         (Target_i386::plt_entry_count): New function.
7163         (Target_i386::first_plt_entry_offset): New function.
7164         (Target_i386::plt_entry_size): New function.
7165         (Output_data_plt_i386::entry_count): New function.
7166         (Output_data_plt_i386::first_plt_entry_offset): New function.
7167         (Output_data_plt_i386::get_plt_entry_size): New function.
7168         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
7169         find_incremental_inputs_sections.  Dump incremental_got_plt section.
7170         * incremental.cc: Include target.h.
7171         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
7172         parameter.  Adjust all callers.  Find incremental_got_plt section.
7173         (Incremental_inputs::create_data_sections): Create incremental_got_plt
7174         section.
7175         (Output_section_incremental_inputs::set_final_data_size): Calculate
7176         size of incremental_got_plt section.
7177         (Output_section_incremental_inputs::do_write): Write the
7178         incremental_got_plt section.
7179         (Got_plt_view_info): New struct.
7180         (Local_got_offset_visitor): New class.
7181         (Global_got_offset_visitor): New class.
7182         (Global_symbol_visitor_got_plt): New class.
7183         (Output_section_incremental_inputs::write_got_plt): New function.
7184         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
7185         Add parameter.  Adjust all callers.
7186         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
7187         (Incremental_inputs::got_plt_section): New function.
7188         (Incremental_inputs::got_plt_section_): New data member.
7189         (Incremental_got_plt_reader): New class.
7190         * layout.cc (Layout::create_incremental_info_sections): Add the
7191         incremental_got_plt section.
7192         * object.h (Got_offset_list::get_list): New function.
7193         (Got offset_list::for_all_got_offsets): New function.
7194         (Sized_relobj::local_got_offset_list): New function.
7195         * powerpc.cc (Target_powerpc::got_size): Add const.
7196         (Target_powerpc::got_entry_count): New function.
7197         (Target_powerpc::plt_entry_count): New function.
7198         (Target_powerpc::first_plt_entry_offset): New function.
7199         (Target_powerpc::plt_entry_size): New function.
7200         (Output_data_plt_powerpc::entry_count): New function.
7201         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
7202         (Output_data_plt_powerpc::get_plt_entry_size): New function.
7203         * sparc.cc (Target_sparc::got_size): Add const.
7204         (Target_sparc::got_entry_count): New function.
7205         (Target_sparc::plt_entry_count): New function.
7206         (Target_sparc::first_plt_entry_offset): New function.
7207         (Target_sparc::plt_entry_size): New function.
7208         (Output_data_plt_sparc::entry_count): New function.
7209         (Output_data_plt_sparc::first_plt_entry_offset): New function.
7210         (Output_data_plt_sparc::get_plt_entry_size): New function.
7211         * symtab.h (Symbol::got_offset_list): New function.
7212         (Symbol_table::for_all_symbols): New function.
7213         * target.h (Sized_target::got_entry_count): New function.
7214         (Sized_target::plt_entry_count): New function.
7215         (Sized_target::plt_entry_size): New function.
7216         * x86_64.cc (Target_x86_64::got_size): Add const.
7217         (Target_x86_64::got_entry_count): New function.
7218         (Target_x86_64::plt_entry_count): New function.
7219         (Target_x86_64::first_plt_entry_offset): New function.
7220         (Target_x86_64::plt_entry_size): New function.
7221         (Output_data_plt_x86_64::entry_count): New function.
7222         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
7223         (Output_data_plt_x86_64::get_plt_entry_size): New function.
7224
7225 2010-08-12  Cary Coutant  <ccoutant@google.com>
7226
7227         * archive.cc: Include incremental.h.
7228         (Archive::Archive): Initialize incremental_info_.
7229         (Archive::include_member): Record archive members in incremental info.
7230         (Add_archive_symbols::run): Record begin and end of an archive in
7231         incremental info.
7232         (Lib_group::include_member): Record objects in incremental info.
7233         * archive.h (Incremental_archive_entry): Forward declaration.
7234         (Archive::set_incremental_info): New member function.
7235         (Archive::incremental_info): New member function.
7236         (Archive::Unused_symbol_iterator): New class.
7237         (Archive::unused_symbols_begin): New member function.
7238         (Archive::unused_symbols_end): New member function.
7239         (Archive::incremental_info_): New data member.
7240         * incremental-dump.cc (find_input_containing_global): New function.
7241         (dump_incremental_inputs): Dump new incremental info sections.
7242         * incremental.cc: Include symtab.h.
7243         (Output_section_incremental_inputs): New class.
7244         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
7245         new incremental info sections.
7246         (Sized_incremental_binary::do_check_inputs): Likewise.
7247         (Incremental_inputs::report_archive): Remove.
7248         (Incremental_inputs::report_archive_begin): New function.
7249         (Incremental_inputs::report_archive_end): New function.
7250         (Incremental_inputs::report_object): New function.
7251         (Incremental_inputs::finalize_inputs): Remove.
7252         (Incremental_inputs::report_input_section): New function.
7253         (Incremental_inputs::report_script): Rewrite.
7254         (Incremental_inputs::finalize): Do nothing but finalize string table.
7255         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
7256         (Incremental_inputs::sized_create_inputs_section_data): Remove.
7257         (Incremental_inputs::create_data_sections): New function.
7258         (Incremental_inputs::relocs_entsize): New function.
7259         (Output_section_incremental_inputs::set_final_data_size): New function.
7260         (Output_section_incremental_inputs::do_write): New function.
7261         (Output_section_incremental_inputs::write_header): New function.
7262         (Output_section_incremental_inputs::write_input_files): New function.
7263         (Output_section_incremental_inputs::write_info_blocks): New function.
7264         (Output_section_incremental_inputs::write_symtab): New function.
7265         * incremental.h (Incremental_script_entry): Forward declaration.
7266         (Incremental_object_entry): Forward declaration.
7267         (Incremental_archive_entry): Forward declaration.
7268         (Incremental_inputs): Forward declaration.
7269         (Incremental_inputs_header_data): Remove.
7270         (Incremental_inputs_header): Remove.
7271         (Incremental_inputs_header_write): Remove.
7272         (Incremental_inputs_entry_data): Remove.
7273         (Incremental_inputs_entry): Remove.
7274         (Incremental_inputs_entry_write): Remove.
7275         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
7276         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
7277         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
7278         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
7279         Likewise.
7280         (Incremental_input_entry): New class.
7281         (Incremental_script_entry): New class.
7282         (Incremental_object_entry): New class.
7283         (Incremental_archive_entry): New class.
7284         (Incremental_inputs::Incremental_inputs): Initialize new data members.
7285         (Incremental_inputs::report_inputs): Remove.
7286         (Incremental_inputs::report_archive): Remove.
7287         (Incremental_inputs::report_archive_begin): New function.
7288         (Incremental_inputs::report_archive_end): New function.
7289         (Incremental_inputs::report_object): Change prototype.
7290         (Incremental_inputs::report_input_section): New function.
7291         (Incremental_inputs::report_script): Change prototype.
7292         (Incremental_inputs::get_reloc_count): New function.
7293         (Incremental_inputs::set_reloc_count): New function.
7294         (Incremental_inputs::create_data_sections): New function.
7295         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
7296         (Incremental_inputs::inputs_section): New function.
7297         (Incremental_inputs::symtab_section): New function.
7298         (Incremental_inputs::relocs_section): New function.
7299         (Incremental_inputs::get_stringpool): Add const.
7300         (Incremental_inputs::command_line): Add const.
7301         (Incremental_inputs::inputs): Remove.
7302         (Incremental_inputs::command_line_key): New function.
7303         (Incremental_inputs::input_file_count): New function.
7304         (Incremental_inputs::input_files): New function.
7305         (Incremental_inputs::relocs_entsize): New function.
7306         (Incremental_inputs::sized_create_inputs_section_data): Remove.
7307         (Incremental_inputs::finalize_inputs): Remove.
7308         (Incremental_inputs::Input_info): Remove.
7309         (Incremental_inputs::lock_): Remove.
7310         (Incremental_inputs::inputs_): Change type.
7311         (Incremental_inputs::inputs_map_): Remove.
7312         (Incremental_inputs::current_object_entry_): New data member.
7313         (Incremental_inputs::inputs_section_): New data member.
7314         (Incremental_inputs::symtab_section_): New data member.
7315         (Incremental_inputs::relocs_section_): New data member.
7316         (Incremental_inputs::reloc_count_): New data member.
7317         (Incremental_inputs_reader): New class.
7318         (Incremental_symtab_reader): New class.
7319         (Incremental_relocs_reader): New class.
7320         * layout.cc (Layout::finalize): Move finalization of incremental info
7321         and creation of incremental info sections to follow finalization of
7322         symbol table.  Set offsets for postprocessing sections.
7323         (Layout::create_incremental_info_sections): Call
7324         Incremental_inputs::create_data_sections.  Add incremental symtab
7325         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
7326         sections to layout after input sections.
7327         * layout.h (struct Timespec): Forward declaration.
7328         (Layout::incremental_inputs): Add const.
7329         (Layout::create_incremental_info_sections): Add parameter.
7330         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
7331         * object.cc: Include incremental.h.
7332         (Relobj::finalize_incremental_relocs): New function.
7333         (Sized_relobj::do_layout): Record input sections in incremental info.
7334         * object.h (Object::output_section): New function.
7335         (Object::output_section_offset): Moved from Relobj.
7336         (Object::get_incremental_reloc_base): New function.
7337         (Object::get_incremental_reloc_count): New function.
7338         (Object::do_output_section): New function.
7339         (Object::do_output_section_offset): Moved from Relobj.
7340         (Object::do_get_incremental_reloc_base): New function.
7341         (Object::do_get_incremental_reloc_count): New function.
7342         (Object::Object): Initialize new data members.
7343         (Relobj::output_section): Renamed do_output_section and moved to
7344         protected.
7345         (Relobj::output_section_offset): Moved to Object.
7346         (Relobj::do_get_incremental_reloc_base): New function.
7347         (Relobj::do_get_incremental_reloc_count): New function.
7348         (Relobj::allocate_incremental_reloc_counts): New function.
7349         (Relobj::count_incremental_reloc): New function.
7350         (Relobj::finalize_incremental_relocs): New function.
7351         (Relobj::next_incremental_reloc_index): New function.
7352         (Relobj::reloc_counts_): New data member.
7353         (Relobj::reloc_bases_): New data member.
7354         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
7355         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
7356         (Sized_relobj::incremental_relocs_scan): New function.
7357         (Sized_relobj::incremental_relocs_scan_reltype): New function.
7358         (Sized_relobj::incremental_relocs_write): New function.
7359         (Sized_relobj::incremental_relocs_write_reltype): New function.
7360         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
7361         incremental link.
7362         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
7363         archives and object files elsewhere.
7364         (Add_symbols::run): Report object files here.
7365         (Finish_group::run): Report end of archive at end of group.
7366         * reloc.cc: Include layout.h, incremental.h.
7367         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
7368         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
7369         (Sized_relobj::incremental_relocs_scan): New function.
7370         (Sized_relobj::incremental_relocs_scan_reltype): New function.
7371         (Sized_relobj::do_relocate_sections): Write incremental relocations.
7372         (Sized_relobj::incremental_relocs_write): New function.
7373         (Sized_relobj::incremental_relocs_write_reltype): New function.
7374         * script.cc (read_input_script): Rewrite test for incremental link.
7375         Change call to Incremental_inputs::report_script.
7376         * symtab.h (Symbol_table::first_global_index): New function.
7377         (Symbol_table::output_count): New function.
7378
7379 2010-08-12  Doug Kwan  <dougkwan@google.com>
7380
7381         * arm.cc (Target_arm::merge_object_attributes): Check command line
7382         options --no-wchar-size-warning and --no-enum-size-warning.
7383         * options.h (General_options): Add ld-compatible options
7384         --no-enum-size-warning and --no-wchar-size-warning.
7385
7386 2010-08-04  Ian Lance Taylor  <iant@google.com>
7387
7388         * x86_64.cc (Target_x86_64::Scan::local): Use
7389         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
7390         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
7391         (Target_x86_64::Scan::global): Likewise.
7392         (Target_x86_64::Relocate::relocate): Likewise.
7393         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
7394         Likewise.
7395
7396 2010-08-03  Cary Coutant  <ccoutant@google.com>
7397
7398         * merge.cc (Output_merge_string::do_add_input_section): Count strings
7399         to reserve space in merged_strings vector. Keep total input size
7400         for stats.
7401         (Output_merge_string::do_print_merge_stats): Print total input size.
7402         * merge.h (Output_merge_string): Add input_size_ field.
7403         * stringpool.cc (Stringpool_template::string_length): Move
7404         implementations out of Stringpool_template class and place in
7405         stringpool.h.
7406         * stringpool.h (string_length): Move out of Stringpool_template.
7407
7408 2010-08-03  Ian Lance Taylor  <iant@google.com>
7409
7410         PR 11712
7411         * layout.cc (relaxation_loop_body): If address of load segment is
7412         set, adjust address to include headers if possible.
7413
7414 2010-08-03  Ian Lance Taylor  <iant@google.com>
7415
7416         * version.cc (version_string): Bump to 1.10.
7417
7418 2010-08-03  Ian Lance Taylor  <iant@google.com>
7419
7420         PR 11805
7421         * layout.h (enum Output_section_order): Define.
7422         (class Layout): Update declarations.
7423         * layout.cc (Layout::get_output_section): Add order parameter.
7424         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
7425         is_first_non_relro parameters.  Change all callers.
7426         (Layout::choose_output_section): Likewise.
7427         (Layout::add_output_section_data): Likewise.
7428         (Layout::make_output_section): Likewise.  Set order.
7429         (Layout::default_section_order): New function.
7430         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
7431         * output.cc (Output_section::Output_section): Initialize order_.
7432         Don't initialize deleted fields.
7433         (Output_segment::Output_segment): Don't initialize deleted
7434         fields.
7435         (Output_segment::add_output_section_to_load): New function
7436         replacing add_output_section.  Change all callers to call this or
7437         add_output_section_to_nonload.
7438         (Output_segment::add_output_section_to_nonload): New function.
7439         (Output_segment::remove_output_section): Rewrite.
7440         (Output_segment::add_initial_output_data): Likewise.
7441         (Output_segment::has_any_data_sections): Likewise.
7442         (Output_segment::is_first_section_relro): Likewise.
7443         (Output_segment::maximum_alignment): Likewise.
7444         (Output_segment::has_dynamic_reloc): New function replacing
7445         dynamic_reloc_count.  Change all callers.
7446         (Output_segment::has_dynamic_reloc_list): New function replacing
7447         dynamic_reloc_count_list.  Change all callers.
7448         (Output_segment::set_section_addresses): Rewrite.
7449         (Output_segment::set_offset): Rewrite.
7450         (Output_segment::find_first_and_last_list): Remove.
7451         (Output_segment::set_tls_offsets): Rewrite.
7452         (Output_segment::first_section_load_address): Likewise.
7453         (Output_segment::output_section_count): Likewise.
7454         (Output_segment::section_with_lowest_load_address): Likewise.
7455         (Output_segment::write_section_headers): Likewise.
7456         (Output_segment::print_sections_to_map): Likewise.
7457         * output.h (class Output_data): Remove dynamic_reloc_count_
7458         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
7459         (Output_data::add_dynamic_reloc): Rewrite.
7460         (Output_data::has_dynamic_reloc): New function.
7461         (Output_data::dynamic_reloc_count): Remove.
7462         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
7463         is_last_relro_, is_first_non_relro_, is_interp_,
7464         is_dynamic_linker_section_ fields.  Add order and set_order
7465         functions.  Remove is_relro_local, set_is_relro_local,
7466         is_last_relro, set_is_last_relro, is_first_non_relro,
7467         set_is_first_non_relro functions, is_interp, set_is_interp,
7468         is_dynamic_linker_section, and set_is_dynamic_linker_section
7469         functions.
7470         (class Output_segment): Change Output_data_list from std::list to
7471         std:;vector.  Add output_lists_ field.  Remove output_data_ and
7472         output_bss_ fields.  Update declarations.
7473
7474 2010-08-02  Ian Lance Taylor  <iant@google.com>
7475
7476         * arm.cc (Target_arm::gc_process_relocs): Use typename.
7477         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
7478         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
7479
7480 2010-08-02  Ian Lance Taylor  <iant@google.com>
7481
7482         PR 11855
7483         * script.cc (Script_options::Script_options): Initialize
7484         symbol_definitions_ and symbol_references_.
7485         (Script_options::add_symbol_assignment): Update
7486         symbol_definitions_ and symbol_references_.
7487         (Script_options::add_symbol_reference): New function.
7488         (script_symbol): New function.
7489         * script.h (class Script_options): Add symbol_definitions_ and
7490         symbol_references_ fields.
7491         (Script_options::referenced_const_iterator): New type.
7492         (Script_options::referenced_begin): New function.
7493         (Script_options::referenced_end): New function.
7494         (Script_options::is_referenced): New function.
7495         (Script_options::any_unreferenced): New function.
7496         * script-c.h (script_symbol): Declare.
7497         * yyscript.y (exp): Call script_symbol.
7498         * symtab.cc: Include "script.h".
7499         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
7500         Change all callers.  Check symbols referenced by scripts.
7501         (Symbol_table::add_undefined_symbols_from_command_line): Add
7502         layout parameter.  Change all callers.
7503         (Symbol_table::do_add_undefined_symbols_from_command_line):
7504         Likewise.  Break out loop body.  Check symbols referenced by
7505         scripts.
7506         (Symbol_table::add_undefined_symbol_from_command_line): New
7507         function broken out of
7508         do_add_undefined_symbols_from_command_line.
7509         * symtab.h (class Symbol_table): Update declarations.
7510         * archive.cc: Include "layout.h".
7511         (Archive::should_include_member): Add layout parameter.  Change
7512         all callers.  Check for symbol mentioned in expression.
7513         * archive.h (class Archive): Update declaration.
7514         * object.cc (Sized_relobj::do_should_include_member): Add layout
7515         parameter.
7516         * object.h (Object::should_include_member): Add layout parameter.
7517         Change all callers.
7518         (Object::do_should_include_member): Add layout parameter.
7519         (class Sized_relobj): Update declaration.
7520         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
7521         parameter.
7522         * dynobj.h (class Sized_dynobj): Update declaration.
7523         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
7524         layout parameter.
7525         * plugin.h (class Sized_pluginobj): Update declaration.
7526
7527 2010-08-02  Ian Lance Taylor  <iant@google.com>
7528
7529         PR 11866
7530         * output.cc (Output_segment::set_offset): Search for the first and
7531         last sections rather than assuming that the list is in order.
7532         (Output_segment::find_first_and_last_list): New function.
7533         * output.h (class Output_segment): Update declarations.
7534         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
7535         (relro_strip_test_SOURCES): New variable.
7536         (relro_strip_test_DEPENDENCIES): New variable.
7537         (relro_strip_test_LDFLAGS): New variable.
7538         (relro_strip_test_LDADD): New variable.
7539         (relro_strip_test.so): New target.
7540
7541 2010-08-02  Ian Lance Taylor  <iant@google.com>
7542
7543         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
7544         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
7545         (Target_i386::got_tlsdesc_section): New function.
7546         (Target_i386::got_section): Create space for GOT entries for
7547         TLSDESC relocations.
7548         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
7549         R_386_TLS_GOTDESC.
7550         (Target_i386::Scan::global): Likewise.
7551         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
7552         using TLSDESC GOT.
7553         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
7554         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
7555         (Target_x86_64::got_tlsdesc_section): New function.
7556         (Target_x86_64::got_section): Create space for GOT entries for
7557         TLSDESC relocations.
7558         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
7559         R_386_TLS_GOTDESC.
7560         (Target_x86_64::Scan::global): Likewise.
7561         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
7562         using TLSDESC GOT.
7563
7564 2010-08-02  Ian Lance Taylor  <iant@google.com>
7565
7566         * testsuite/final_layout.sh: Use dc to convert from hex to
7567         decimal.
7568
7569 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
7570
7571         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
7572         paramter to the call to gold::gc_process_relocs.
7573         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
7574         paramter to the call to gold::gc_process_relocs.
7575         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
7576         parameter to the call to gold::gc_process_relocs.
7577         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
7578         template parameter to the call to gold::gc_process_relocs.
7579         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
7580         paramter to the call to gold::gc_process_relocs.
7581         * gc.h (get_embedded_addend_size): New function.
7582         (gc_process_relocs): Save the size of the reloc for use by ICF.
7583         * icf.cc (get_section_contents): Get the addend from the text section
7584         for SHT_REL relocation sections.
7585         * icf.h (Icf::Reloc_addend_size_info): New typedef.
7586         (Icf::Reloc_info): Add new member reloc_addend_size_info.
7587         * int_encoding.h (read_from_pointer): New overloaded function.
7588         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
7589         * testsuite/icf_sht_rel_addend_test.sh: New file.
7590         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
7591         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
7592
7593 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7594
7595         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
7596         * Makefile.in: Regenerate.
7597         * testsuite/Makefile.in: Regenerate.
7598
7599 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
7600
7601         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
7602         * gold/testsuite/debug_msg.cc: Likewise.
7603         * gold/testsuite/odr_violation1.cc
7604         * gold/testsuite/odr_violation2.cc
7605
7606 2010-07-21  Cary Coutant  <ccoutant@google.com>
7607
7608         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
7609         string, and length fields.
7610         (Output_merge_string::Merged_strings_list): New type.
7611         (Output_merge_string::Merged_strings_lists): New typedef.
7612         (Output_merge_string): Replace merged_strings_ with
7613         merged_strings_lists_.
7614         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
7615         Merged_strings_list per input object and section.  Don't store pointer
7616         to the string.  Don't store length with each merged string entry.
7617         (Output_merge_string::finalize_merged_data): Loop over list of merged
7618         strings lists.  Recompute length of each merged string.
7619
7620 2010-07-15  Cary Coutant  <ccoutant@google.com>
7621
7622         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
7623         here.
7624
7625 2010-07-14  Ian Lance Taylor  <iant@google.com>
7626
7627         * descriptors.cc (Descriptors::open): Report correct name in error
7628         message.
7629
7630 2010-07-13  Doug Kwan  <dougkwan@google.com>
7631
7632         * arm.cc (Arm_input_section::Arm_input_section): For a
7633         SHT_ARM_EXIDX section, always keeps the input sections.
7634         (Arm_input_section::set_exidx_section_link): New method.
7635         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
7636         has_errors_ to false.
7637         (Arm_exidx_input_section::has_errors,
7638         Arm_exidx_input_section::set_has_errors): New methods.
7639         (Arm_exidx_input_section::has_errors_): New data member.
7640         (Arm_relobj::get_exidx_shndx_list): New method.
7641         (Arm_output_section::append_text_sections_to_list): Do not skip
7642         section without SHF_EXECINSTR.
7643         (Arm_output_section::fix_exidx_coverage): Skip input sections with
7644         errors.
7645         (Arm_relobj::make_exidx_input_section): Add new parameter for text
7646         section header.  Make error messages more verbose.  Check for
7647         a non-executable section linked to an EXIDX section.
7648         (Arm_relobj::do_read_symbols): Remove error checking, which has been
7649         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
7650         check that there is no deferred EXIDX section if we exit early.
7651         Instead of not making an EXIDX section in case of an error, make one
7652         and set the has_errors flag of it.
7653         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
7654         in a relocatable link.
7655         (Target_arm::do_relax): Look for the EXIDX output section instead of
7656         assuming that it is called .ARM.exidx.
7657         (Target_arm::fix_exidx_coverage): Add a new parameter for input
7658         section list.  Do not check for SHF_EXECINSTR section flags but
7659         skip any input section with errors.
7660         * output.cc (Output_section::Output_section): Initialize
7661         always_keeps_input_sections_ to false.
7662         (Output_section::add_input_section): Check for
7663         always_keeps_input_sections_.
7664         *  output.h (Output_section::always_keeps_input_sections,
7665         Output_section::set_always_keeps_input_sections): New methods.
7666         (Output_section::always_keeps_input_sections): New data member.
7667
7668 2010-07-13  Rafael Espindola  <espindola@google.com>
7669
7670         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
7671         * fileread.h (Input_file): Add try_extra_search_path and find_file.
7672
7673 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
7674             Ian Lance Taylor  <iant@google.com>
7675
7676         * output.h (Output_section_lookup_maps::add_merge_section):
7677         Correct check of whether value was inserted.
7678         (Output_section_lookup_maps::add_merge_input_section): Likewise.
7679         (Output_section_lookup_maps::add_relaxed_input_section):
7680         Likewise.
7681         * arm.cc (Target_arm::got_section): Remove used local os.
7682         * i386.cc (Target_i386::got_section): Likewise.
7683         * x86_64.cc (Target_x86_64::got_section): Likewise.
7684         * sparc.cc (Target_sparc::got_section): Likewise.
7685         (Target_sparc::relocate): Remove unused local have_got_offset.
7686         * powerpc.cc (Target_powerpc::relocate): Likewise.
7687
7688 2010-07-13  Ian Lance Taylor  <iant@google.com>
7689
7690         * compressed_output.cc (zlib_decompress): Fix signature in
7691         !HAVE_ZLIB_H case.
7692
7693         * archive.cc (Archive::include_member): Unlock an external member
7694         of a thin archive.  Don't bother to delete an object we know is
7695         NULL.
7696
7697 2010-07-12  Cary Coutant  <ccoutant@google.com>
7698
7699         * compressed_output.cc (zlib_decompress): New function.
7700         (get_uncompressed_size): New function.
7701         (decompress_input_section): New function.
7702         * compressed_output.h (get_uncompressed_size): New function.
7703         (decompress_input_section): New function.
7704         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
7705         Handle compressed debug sections.
7706         * layout.cc (is_compressed_debug_section): New function.
7707         (Layout::output_section_name): Map compressed section names to
7708         canonical names.
7709         * layout.h (is_compressed_debug_section): New function.
7710         (is_debug_info_section): Recognize compressed debug sections.
7711         * merge.cc: Include compressed_output.h.
7712         (Output_merge_data::do_add_input_section): Handle compressed
7713         debug sections.
7714         (Output_merge_string::do_add_input_section): Handle compressed
7715         debug sections.
7716         * object.cc: Include compressed_output.h.
7717         (Sized_relobj::Sized_relobj): Initialize new data members.
7718         (build_compressed_section_map): New function.
7719         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
7720         * object.h (Object::section_is_compressed): New method.
7721         (Object::do_section_is_compressed): New method.
7722         (Sized_relobj::Compressed_section_map): New type.
7723         (Sized_relobj::do_section_is_compressed): New method.
7724         (Sized_relobj::compressed_sections_): New data member.
7725         * output.cc (Output_section::add_input_section): Handle compressed
7726         debug sections.
7727         * reloc.cc: Include compressed_output.h.
7728         (Sized_relobj::write_sections): Handle compressed debug sections.
7729
7730 2010-07-08  Cary Coutant  <ccoutant@google.com>
7731
7732         * resolve.cc (Symbol_table::resolve): Remember whether undef was
7733         weak when resolving to a dynamic def.
7734         (Symbol_table::should_override): Add adjust_dyndef flag; set it
7735         for weak undef/dynamic def cases. Adjust callers.
7736         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
7737         undef_binding_weak_.
7738         (Symbol_table::sized_write_globals): Adjust symbol binding.
7739         (Symbol_table::sized_write_symbol): Add binding parameter.
7740         * symtab.h (Symbol::set_undef_binding): New method.
7741         (Symbol::is_undef_binding_weak): New method.
7742         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
7743         (Symbol_table::should_override): Add new parameter.
7744         (Symbol_table::sized_write_symbol): Add new parameter.
7745
7746         * testsuite/weak_undef_file1.cc: Add new test case.
7747         * testsuite/weak_undef_file2.cc: Fix header comment.
7748         * testsuite/weak_undef_test.cc: Add new test case.
7749
7750 2010-06-29  Doug Kwan  <dougkwan@google.com>
7751
7752         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
7753         Initialize USE_SYMBOL_.
7754         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
7755         definition.
7756         (Arm_reloc_property::uses_symbol_): New data member declaration.
7757         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
7758         uses symbol value and symbol is undefined but not weakly undefined.
7759
7760 2010-06-28  Rafael Espindola  <espindola@google.com>
7761
7762         * plugin.cc (Plugin::load): Use dlerror.
7763
7764 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
7765
7766         * symtab.cc (detect_odr_violations): When reporting an ODR
7767         violation, report an object where the symbol is defined.
7768
7769 2010-06-25  Doug Kwan  <dougkwan@google.com>
7770
7771         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
7772         (Target_arm::section_may_have_icf_unsafe_pointers): New method
7773         definition.
7774         (Target_arm::Scan::local_reloc_may_be_function_pointer,
7775         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
7776         target hook to detect function points.
7777         (Target_arm::Scan::possible_function_pointer_reloc): New method.
7778         * icf.h (Icf::check_section_for_function_pointers): Change type of
7779         parameter SECTION_NAME to const reference to std::string.  Use
7780         target hook to determine if section may have unsafe pointers.
7781         * target.h (Target::section_may_have_icf_unsafe_pointers): New
7782         method definition.
7783
7784 2010-06-21  Rafael Espindola  <espindola@google.com>
7785
7786         * fileread.cc (Input_file::find_fie): New
7787         (Input_file::open): Use Input_file::find_fie.
7788         * fileread.h (Input_file::find_fie): New
7789         * plugin.cc (set_extra_library_path): New.
7790         (Plugin::load): Add set_extra_library_path to the transfer vector.
7791         (Plugin_manager::set_extra_library_path): New.
7792         (Plugin_manager::add_input_file): Use the extra search path if set.
7793         (set_extra_library_path(): New.
7794         * plugin.h (Plugin_manager): Add set_extra_library_path and
7795         extra_search_path_.
7796
7797 2010-06-19  Cary Coutant  <ccoutant@google.com>
7798
7799         * layout.cc (gdb_sections): Add .debug_types.
7800         (lines_only_debug_sections): Likewise.
7801
7802 2010-06-18  Rafael Espindola  <espindola@google.com>
7803
7804         * plugin.cc (add_input_file,add_input_library)
7805         (Plugin_manager::add_input_file): Make filename arguments const.
7806         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
7807         const.
7808
7809 2010-06-16  Doug Kwan  <dougkwan@google.com>
7810
7811         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
7812         .ARM.attributes section if we have not merged any input
7813         attributes sections.
7814
7815 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7816
7817         * arm.cc: Allow combining objects with no EABI version
7818         information.
7819
7820 2010-06-15  Rafael Espindola  <espindola@google.com>
7821
7822         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
7823
7824 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7825
7826         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
7827         (struct iovec): Correct !HAVE_READV definition.
7828
7829 2010-06-10  Cary Coutant  <ccoutant@google.com>
7830
7831         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
7832         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
7833         reloc sections.
7834         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
7835
7836         PR 11683
7837         * symtab.h (Symbol::is_placeholder): New member function.
7838         * target-reloc.h (relocate_section): Check for placeholder symbols.
7839
7840         * testsuite/Makefile.am (plugin_test_8): New test.
7841         (plugin_test_9): New test.
7842         * testsuite/Makefile.in: Regenerate.
7843
7844 2010-06-09  Nick Clifton  <nickc@redhat.com>
7845
7846         * yyscript.y (input_list_element): Allow strings prefixed with
7847         the '-' character.  Treat these as libraries.
7848         * script.cc (script_add_library): New function.  Adds a library
7849         specified by "-l<name>" found in an input script.
7850         * script-c.h: Add prototype for script_add_library.
7851
7852 2010-06-07  Doug Kwan  <dougkwan@google.com>
7853
7854         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
7855         Restrict stub-group size to be within long conditional branch
7856         range when working around cortex-A8 erratum.
7857
7858 2010-06-07  Damien Diederen  <dd@crosstwine.com>
7859
7860         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
7861         #ifdef typo.
7862
7863 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
7864
7865         PR gold/11658
7866         * output.cc
7867         (Output_section::Input_section_sort_entry::compare_section_ordering):
7868         Change to return non-zero correctly.
7869         (Output_section::Input_section_sort_section_order_index_compare
7870         ::operator()): Change to fix ambiguity in comparisons.
7871
7872 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
7873
7874         * gold.h (is_wildcard_string): New function.
7875         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
7876         (Layout::layout_eh_frame): Ditto.
7877         (Layout::find_section_order_index): New method.
7878         (Layout::read_layout_from_file): New method.
7879         * layout.h (Layout::find_section_order_index): New method.
7880         (Layout::read_layout_from_file): New method.
7881         (Layout::input_section_position_): New private member.
7882         (Layout::input_section_glob_): New private member.
7883         * main.cc (main): Call read_layout_from_file here.
7884         * options.h (--section-ordering-file): New option.
7885         * output.cc (Output_section::input_section_order_specified_): New
7886         member.
7887         (Output_section::Output_section): Initialize new member.
7888         (Output_section::add_input_section): Add new parameter.
7889         Keep input sections when --section-ordering-file is used.
7890         (Output_section::set_final_data_size): Sort input sections when
7891         section ordering file is specified.
7892         (Output_section::Input_section_sort_entry): Add new parameter.
7893         Check sorting type.
7894         (Output_section::Input_section_sort_entry::compare_section_ordering):
7895         New method.
7896         (Output_section::Input_section_sort_compare::operator()): Change to
7897         consider section_order_index.
7898         (Output_section::Input_section_sort_init_fini_compare::operator()):
7899         Change to consider section_order_index.
7900         (Output_section::Input_section_sort_section_order_index_compare
7901         ::operator()): New method.
7902         (Output_section::sort_attached_input_sections): Change to sort
7903         according to section order when specified.
7904         (Output_section::add_input_section<32, true>): Add new parameter.
7905         (Output_section::add_input_section<64, true>): Add new parameter.
7906         (Output_section::add_input_section<32, false>): Add new parameter.
7907         (Output_section::add_input_section<64, false>): Add new parameter.
7908         * output.h (Output_section::add_input_section): Add new parameter.
7909         (Output_section::input_section_order_specified): New
7910         method.
7911         (Output_section::set_input_section_order_specified): New method.
7912         (Input_section::Input_section): Initialize section_order_index_.
7913         (Input_section::section_order_index): New method.
7914         (Input_section::set_section_order_index): New method.
7915         (Input_section::section_order_index_): New member.
7916         (Input_section::Input_section_sort_section_order_index_compare): New
7917         struct.
7918         (Output_section::input_section_order_specified_): New member.
7919         * script-sections.cc (is_wildcard_string): Delete and move modified
7920         method to gold.h.
7921         (Output_section_element_input::Output_section_element_input): Modify
7922         call to is_wildcard_string.
7923         (Output_section_element_input::Input_section_pattern
7924         ::Input_section_pattern): Ditto.
7925         (Output_section_element_input::Output_section_element_input): Ditto.
7926         * testsuite/Makefile.am (final_layout): New test case.
7927         * testsuite/Makefile.in: Regenerate.
7928         * testsuite/final_layout.cc: New file.
7929         * testsuite/final_layout.sh: New file.
7930
7931 2010-06-01  Rafael Espindola  <espindola@google.com>
7932
7933         * plugin.cc (Plugin::load): Pass the output name to the plugin.
7934
7935 2010-06-01  Rafael Espindola  <espindola@google.com>
7936
7937         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
7938         visibility of symbols.
7939
7940 2010-05-27  Doug Kwan  <dougkwan@google.com>
7941
7942         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
7943         from start of output section instead of address for a local symbol
7944         in a merged or relaxed section when doing a relocatable link.
7945
7946 2010-05-26  Rafael Espindola  <espindola@google.com>
7947
7948         PR 11604
7949         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
7950         adding sections the garbage collector removed.
7951         * gold/testsuite/Makefile.am: Add test.
7952         * gold/testsuite/Makefile.in: Regenerate.
7953         * gold/testsuite/plugin_test_7.sh: New.
7954         * gold/testsuite/plugin_test_7_1.c: New.
7955         * gold/testsuite/plugin_test_7_2.c: New.
7956
7957 2010-05-26  Rafael Espindola  <espindola@google.com>
7958
7959         * script-sections.cc (Output_section_definition::set_section_addresses):
7960         Check for --section-start.
7961
7962 2010-05-26  Doug Kwan  <dougkwan@google.com>
7963
7964         * arm.cc (Arm_scan_relocatable_relocs): New class.
7965         (Target_arm::relocate_special_relocatable): New method.
7966         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
7967         (Arm_relocate_functions::thumb_branch_common): Same.
7968         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
7969         instead of Default_scan_relocatable_relocs.
7970         * target-reloc.h (relocate_for_relocatable): Let target handle
7971         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
7972         * target.h (Sized_target::relocate_special_relocatable): New method.
7973
7974 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7975
7976         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
7977
7978 2010-05-23  Doug Kwan  <dougkwan@google.com>
7979
7980         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
7981         instead of a cast.
7982         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
7983         with a direct branch, not a conditional branch, to a stub.
7984         * merge.cc (Output_merge_base::record_input_section): New method
7985         defintion.
7986         (Output_merge_data::do_add_input_section): Record input section if
7987         keeps-input-sections flag is set.
7988         (Output_merge_string::do_add_input_section): Ditto.
7989         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
7990         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
7991         INPUT_SECTIONS_.
7992         (Output_merge_base::keeps_input_sections,
7993         Output_merge_base::set_keeps_input_sections,
7994         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
7995         method definitions.
7996         (Output_merge_base::Input_sections): New type declaration.
7997         (Output_merge_base::input_sections_begin,
7998         Output_merge_base::input_sections_end,
7999         Output_merge_base::do_set_keeps_input_sections): New method definitions.
8000         (Output_merge_base::bool keeps_input_sections_,
8001         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
8002         Output_merge_base::input_sections_): New data members.
8003         (Output_merge_data::do_set_keeps_input_sections): New method
8004         defintion.
8005         (Output_merge_string::do_set_keeps_input_sections): Ditto.
8006         * output.cc (Output_section::Input_section::relobj): Move method
8007         defintion from class declaration to here and handle merge sections.
8008         (Output_section::Input_section::shndx): Ditto.
8009         (Output_section::Output_section): Remove initializations of removed
8010         data members and initialize new data member LOOKUP_MAPS_.
8011         (Output_section::add_input_section): Set keeps-input-sections flag
8012         for a newly created merge output section as appropriate.  Adjust code
8013         to use Output_section_lookup_maps class.
8014         (Output_section::add_relaxed_input_section): Adjst code for lookup
8015         maps code refactoring.
8016         (Output_section::add_merge_input_section): Add a new parameter
8017         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
8018         class.  If adding input section to a newly created merge output
8019         section fails, remove the new merge section.
8020         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
8021         Adjust code for use of the Output_section_lookup_maps class.
8022         (Output_section::find_merge_section): Ditto.
8023         (Output_section::build_lookup_maps): New method defintion.
8024         (Output_section::find_relaxed_input_section): Adjust code to use
8025         Output_section_lookup_maps class.
8026         (Output_section::get_input_sections): Export merge sections.  Adjust
8027         code to use Output_section_lookup_maps class.
8028         (Output_section:::add_script_input_section): Adjust code to use
8029         Output_section_lookup_maps class.  Update lookup maps for merge
8030         sections also.
8031         (Output_section::discard_states): Use Output_section_lookup_maps.
8032         (Output_section::restore_states): Same.
8033         * output.h (Merge_section_properties): Move class defintion out of
8034         Output_section.
8035         (Output_section_lookup_maps): New class.
8036         (Output_section::Input_section::is_merge_section): New method
8037         defintion.
8038         (Output_section::Input_section::relobj): Move defintion out of class
8039         defintion.  Declare method only.
8040         (Output_section::Input_section::shndx): Ditto.
8041         (Output_section::Input_section::output_merge_base): New method defintion.
8042         (Output_section::Input_section::u2_.pomb): New union field.
8043         (Output_section::Merge_section_by_properties_map,
8044         Output_section::Output_section_data_by_input_section_map,
8045         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
8046         Remove types.
8047         (Output_section::add_merge_input_section): Add new parameter
8048         KEEPS_INPUT_SECTIONS.
8049         (Output_section::build_lookup_maps): New method declaration.
8050         (Output_section::merge_section_map_,
8051         Output_section::merge_section_by_properties_map_,
8052         Output_section::relaxed_input_section_map_,
8053         Output_section::is_relaxed_input_section_map_valid_): Remove data
8054         members.
8055         (Output_section::lookup_maps_): New data member.
8056
8057 2010-05-21  Doug Kwan  <dougkwan@google.com>
8058
8059         PR gold/11619
8060         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
8061         avoid a compilation error.
8062
8063 2010-05-19  Rafael Espindola  <espindola@google.com>
8064
8065         * script-sections.cc (Output_section_definition::allocate_to_segment):
8066         Update the phdrs_list even when the output section is NULL.
8067         * testsuite/Makefile.am: Add test.
8068         * testsuite/Makefile.in: Regenerate.
8069         * testsuite/script_test_9.cc: New.
8070         * testsuite/script_test_9.sh: New.
8071         * testsuite/script_test_9.t: New.
8072
8073 2010-05-19  Doug Kwan  <dougkwan@google.com>
8074
8075         * arm.cc (Arm_input_section::original_size): New method.
8076         (Arm_input_section::do_addralign): Add a cast.
8077         (Arm_input_section::do_output_offset): Remove static cast.
8078         (Arm_input_section::original_addralign,
8079          Arm_input_section::original_size_): Change type to uint32_t.
8080         (Arm_input_section::init): Add safe casts for section alignment
8081         and size.
8082         (Arm_input_section::set_final_data_size): Do not set address and
8083         offset of stub table.
8084         (Arm_output_section::fix_exidx_coverage): Change use of of
8085         Output_section::Simple_input_section to that of
8086         Output_section::Input_section.
8087         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
8088         except for the first pass.
8089         * output.cc (Output_section::get_input_sections): Change type of
8090         input_sections to std::list<Input_section>.
8091         (Output_section::add_script_input_section): Rename from
8092         Output_section::add_simple_input_section.  Change type of SIS
8093         parameter from Simple_input_section to Input_section.
8094         * output.h (Output_section::Simple_input_section): Remove class.
8095         (Output_section::Input_section): Change class visibility to public.
8096         (Output_section::Input_section::addralign): Use stored alignments
8097         for special input sections if set.
8098         (Output_section::Input_section::set_addralign): New method.
8099         (Output_section::get_input_sections): Change parameter type from
8100         list of Simple_input_section to list of Input_section.
8101         (Output_section::add_script_input_section): Rename from
8102         Output_section::add_simple_input_section. Change first parameter's
8103         type from Simple_input_section to Input_section and remove the
8104         second and third parameters.
8105         * script-sections.cc (Input_section::Input_section_list): Change
8106         type to list of Output_section::Input_section/
8107         (Input_section_info::Input_section_info): Change parameter type of
8108         INPUT_SECTION to Output_section::Input_section.
8109         (Input_section_info::input_section): Change return type.
8110         (Input_section_info::input_section_): Change type to
8111         Output_section::Input_section.
8112         (Output_section_element_input::set_section_addresses): Adjust code
8113         to use Output_section::Input_section instead of
8114         Output_section::Simple_input_section.  Adjust code for renaming
8115         of Output_section::add_simple_input_section.
8116         (Orphan_output_section::set_section_addresses): Ditto.
8117
8118 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8119
8120         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
8121         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
8122
8123 2010-05-18  Rafael Espindola  <espindola@google.com>
8124
8125         * options.cc (General_options::finalize): Handle -nostdlib.
8126         * options.h (nostdlib): New option.
8127         * script.cc (script_add_search_dir): Handle -nostdlib.
8128
8129 2010-05-12  Doug Kwan  <dougkwan@google.com>
8130
8131         * arm.cc (Target_arm::do_finalize_sections): Create an empty
8132         attributes section only if there no attributes section after merging.
8133         (Target_arm::merge_object_attributes): Move value of
8134         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
8135         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
8136         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
8137         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
8138         and arm_attr_merge_7.stdout.
8139         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
8140         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
8141         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
8142         arm_attr_merge_7b.o): New rules.
8143         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
8144         arm_attr_merge_7
8145         * testsuite/Makefile.in: Regenerate.
8146         * testsuite/arm_attr_merge.sh: New file.
8147         * testsuite/arm_attr_merge_[67][ab].s: Same.
8148
8149 2010-05-05  Nick Clifton  <nickc@redhat.com>
8150
8151         * po/es.po: Updated Spanish translation.
8152
8153 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
8154
8155         * Makefile.am (install-exec-local): Properly install gold as
8156         default cross linker.
8157         * Makefile.in: Regenerated.
8158
8159 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
8160             Nick Clifton  <nickc@redhat.com>
8161
8162         * configure.ac (install_as_default): Define and set to false
8163         unless --enable-gold or --enable-gold=both/gold has been
8164         specified.
8165         * configure: Regenerate.
8166
8167         * Makefile.am (install-exec-local): Install the executable as
8168         'ld.gold'.  If install_as_default is true then also install it as
8169         'ld'.
8170         * Makefile.in: Regenerated.
8171
8172 2010-04-24  Ian Lance Taylor  <iant@google.com>
8173
8174         * layout.cc (Layout::layout_reloc): In relocatable link don't
8175         combine reloc sections for grouped sections.
8176
8177 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
8178
8179         * gc.h (gc_process_relocs): Pass information on relocs pointing to
8180         sections that are not ordinary to icf.
8181         * icf.cc (get_section_contents): Handle relocation pointing to section
8182         with no object or shndx information.
8183         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
8184         * testsuite/Makefile.in: Regenerate.
8185         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
8186         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
8187
8188 2010-04-22  Ian Lance Taylor  <iant@google.com>
8189
8190         * expression.cc (Expression::Expression_eval_info): Add
8191         result_alignment_pointer field.
8192         (Expression::eval_with_dot): Add result_alignment_pointer
8193         parameter.  Change all callers.
8194         (Expression::eval_maybe_dot): Likewise.
8195         (class Binary_expression): Add alignment_pointer parameter to
8196         left_value and right_value.  Change all callers.
8197         (BINARY_EXPRESSION): Set result alignment.
8198         (class Trinary_expression): Add alignment_pointer parameter to
8199         arg2_value and arg3_value.  Change all callers.
8200         (Trinary_cond::value): Set result alignment.
8201         (Max_expression::value, Min_expression::value): Likewise.
8202         (Align_expression::value): Likewise.
8203         * script-sections.cc (class Sections_element): Add dot_alignment
8204         parameter to set_section_addresses virtual function.  Update
8205         instantiations.
8206         (class Output_section_element): Likewise.
8207         (Script_sections::create_segments): Add dot_alignment parameter.
8208         Change all callers.
8209         (Script_sections::create_segments_from_phdrs_clause): Likewise.
8210         (Script_sections::set_phdrs_clause_addresses): Likewise.
8211         * script-sections.h: Update declarations.
8212         * script.h: Update declarations.
8213         * output.h (Output_segment::set_minimum_p_align): Don't decrease
8214         min_p_align.
8215         * testsuite/script_test_3.t: Set large alignment.
8216         * testsuite/script_test_3.sh: Make sure that at least one LOAD
8217         segment has expected alignment.
8218
8219 2010-04-22  Nick Clifton  <nickc@redhat.com>
8220
8221         * po/gold.pot: Updated by the Translation project.
8222         * po/vi.po: Updated Vietnamese translation.
8223
8224 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
8225
8226         * testsuite/Makefile.am (check_PROGRAMS): Add
8227         icf_virtual_function_folding_test.
8228         * testsuite/Makefile.in: Regenerated.
8229
8230 2010-04-15  Andrew Haley  <aph@redhat.com>
8231
8232         * options.h (merge_exidx_entries): New option.
8233         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
8234         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
8235         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
8236         (Target_arm::merge_exidx_entries): New function.
8237         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
8238         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
8239         to Arm_exidx_fixup constructor.
8240         Add new arg, merge_exidx_entries.
8241         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
8242         Arm_output_section::fix_exidx_coverage.
8243
8244 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
8245
8246         * icf.cc (get_section_contents): Check for preemptible functions.
8247         Ignore addend when appropriate.
8248         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
8249         section folded.
8250         (add_from_relobj): Check for section folded.
8251         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
8252         * symtab.h (should_add_dynsym_entry): Add new parameter.
8253         * target-reloc.h (scan_relocs): Check for section folded.
8254         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
8255         Check reloc types for function pointers in shared objects.
8256         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
8257         case.
8258         (icf_preemptible_functions_test): New test case.
8259         (icf_string_merge_test): New test case.
8260         * testsuite.Makefile.in: Regenerate.
8261         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
8262         bar_glob.  Refactor code.
8263         * testsuite/icf_preemptible_functions_test.cc: New file.
8264         * testsuite/icf_preemptible_functions_test.sh: New file.
8265         * testsuite/icf_string_merge_test.cc: New file.
8266         * testsuite/icf_string_merge_test.sh: New file.
8267         * testsuite/icf_virtual_function_folding_test.cc: New file.
8268         * testsuite/icf_virtual_function_folding_test.sh: New file.
8269
8270 2010-04-14  Doug Kwan  <dougkwan@google.com>
8271
8272         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
8273         for local symbol recounting if we remove a section due to ICF.
8274         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
8275         there are no regular objects in input.
8276
8277 2010-04-13  Doug Kwan  <dougkwan@google.com>
8278
8279         * arm.cc (Arm_input_section::set_final_data_size): Compute
8280         accurate final data size instead of using current data size.
8281
8282 2010-04-09  Doug Kwan  <dougkwan@google.com>
8283
8284         * layout.cc (Layout::choose_output_section): Handle script section
8285         types.
8286         (Layout::make_output_section_for_script): Add section type parameter.
8287         Handle script section types.
8288         * layout.h (Layout::make_output_section_for_script): Add section
8289         type parameter.
8290         * output.cc (Output_section::Output_section): Initialize data member
8291         is_noload_.
8292         (Output_section::do_reset_address_and_file_offset): Do not set address
8293         to 0 if section is a NOLOAD section.
8294         * output.h (Output_section::is_noload): New method.
8295         (Output_section::set_is_noload): Ditto.
8296         (Output_section::is_noload_): New data member.
8297         * script-c.h (Script_section_type): New enum type.
8298         (struct Parser_output_section_header): Add new file section_type.
8299         * script-sections.cc (Sections_element::output_section_name): Add
8300         parameter for returning script section type.
8301         (Output_section_definition::output_section_name): Ditto.
8302         (Output_section_definition::section_type)P; New method.
8303         (Output_section_definiton::script_section_type_name): Ditto.
8304         (Output_section_definition::script_section_type_): New data member.
8305         (Output_section_definition::Output_section_definition): Initialize
8306         data member Output_section_definition::script_section_type_.
8307         (Output_section_definition::create_sections): Pass script section type
8308         to Layout::make_output_section_for_script.
8309         (Output_section_definition::output_section_name): Return script
8310         section type to caller.
8311         (Output_section_definition::set_section_address): Do not advance
8312         dot value and load address if section type is NOLOAD.  Set address
8313         of NOLOAD sections regardless of section flags.
8314         (Output_section_definition::print): Print section type if it is
8315         not SCRIPT_SECTION_TYPE_NONE.
8316         (Output_section_definition::section_type): New method.
8317         (Output_section_definition::script_section_type_name): Ditto.
8318         (Script_sections::output_section_name): Add new parameter
8319         PSECTION_TYPE for returning script section type.  Pass it to
8320         section elements.  Handle discard sections.
8321         (Sort_output_sections::operator()): Handle NOLOAD sections.
8322         * script-sections.h (Script_sections::Section_type): New enum type.
8323         (Script_sections::output_section_name): Add a new parameter for
8324         returning script section type.
8325         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
8326         INFO and NOLOAD.
8327         * yyscript.y (union): Add new field SECTION_TYPE.
8328         (COPY, DSECT, INFO, NOLOAD): New tokens.
8329         (opt_address_and_section_type): Change type to output_section_header.
8330         (section_type): New non-terminal
8331         (section_header): Handle section type.
8332         (opt_address_and_section_type): Return section type value.
8333
8334 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
8335
8336         * testsuite/plugin_common_test_1.c (foo): Add prototype.
8337         * testsuite/plugin_common_test_2.c (foo): Likewise.
8338
8339 2010-04-08  Doug Kwan  <dougkwan@google.com>
8340
8341         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
8342         Output_merge_data.
8343         * output.cc (Output_section::add_merge_input_section): Simplify
8344         code and return status of Output_merge_base::add_input_section.
8345         Update merge section map only if Output_merge_base::add_input_section
8346         returns true.
8347
8348 2010-04-07  Doug Kwan  <dougkwan@google.com>
8349
8350         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
8351         if section is marked as containing instructions but has no mapping
8352         symbols.
8353         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
8354         correct section index.
8355         (Arm_relobj::find_linked_text_section): Ditto.
8356
8357 2010-04-07  Cary Coutant  <ccoutant@google.com>
8358
8359         * archive.cc (include_member): Destroy Read_symbols_data object before
8360         releasing file.
8361         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
8362         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
8363         (Read_symbols_data::~Read_symbols_data) New destructor.
8364         (Section_relocs::Section_relocs) New constructor.
8365         (Section_relocs::~Section_relocs) New destructor.
8366         (Read_relocs_data::Read_relocs_data) New constructor.
8367         (Read_relocs_data::~Read_relocs_data) New destructor.
8368         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
8369         pointers to NULL after deleting.
8370
8371 2010-04-07  Doug Kwan  <dougkwan@google.com>
8372
8373         * arm.cc: Replace "endianity" with "endianness" in comments.
8374         (Arm_exidx_cantunwind): Ditto.
8375         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
8376         (Arm_relobj::merge_flags_and_attributes): New method.
8377         (Arm_relobj::merge_flags_and_attributes_): New data member.
8378         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
8379         (Arm_relobj::scan_sections_for_stubs): Ditto.
8380         (Arm_relobj::do_read_symbols): Check to see if we really want to
8381         merge processor-specific flags and attributes.  Exit early if
8382         an object is empty except for section names and the undefined symbol.
8383         (Target_arm::do_finalize_sections): Move check for ELF format to
8384         Arm_relobj::do_read_symbols.  Merge processor specific flags and
8385         attributes from a regular object only when we have determined that
8386         it is aapropriate.  Do not create an .ARM.attributes section in
8387         output if there is no regular input object.
8388         (Target_arm::merge_processor_specific_flags): Check
8389         --warn-mismatch before printing any error.
8390         (Target_arm::merge_object_attributes): Ditto.
8391         * gold.cc (queue_middle_tasks): Handle the case in which there is
8392         no regular object in input.
8393         * options.cc (General_options::parse_EB): New method.
8394         (General_options::parse_EL): Same.
8395         (General_options::General_options): Initialize endianness_.
8396         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
8397         New options.
8398         (General_options::Endianness): New enum.
8399         (General_options::endianness): New method.
8400         (General_options::endianness_): New data member.
8401         * parameters.cc (Parameters::set_options): Check target endianness.
8402         (Parameters::set_target_once): Ditto.
8403         (Parameters::check_target_endianness): New method.
8404         (parameters_force_valid_target): If either -EL or -EB is specified,
8405         use it to define endianness of default target.
8406         * parameters.h (Parameters::check_target_endianness): New method
8407         declaration.
8408         * target.h (class Target): Change "endianity" to "endianness"
8409         in comments.
8410
8411 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8412
8413         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
8414         * configure: Regenerate.
8415         * Makefile.in: Regenerate.
8416         * testsuite/Makefile.in: Regenerate.
8417
8418 2010-04-06  Cary Coutant  <ccoutant@google.com>
8419
8420         gcc PR lto/42757
8421         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
8422         prevailing definitions of common symbols.
8423         * testsuite/plugin_test_6.sh: New test case.
8424         * testsuite/plugin_common_test_1.c: New test case.
8425         * testsuite/plugin_common_test_2.c: New test case.
8426         * testsuite/Makefile.am (plugin_test_6): New test case.
8427         * testsuite/Makefile.in: Regenerate.
8428
8429 2010-04-06  Nick Clifton  <nickc@redhat.com>
8430
8431         * po/vi.po: New Vietnamese translation.
8432
8433 2010-03-30  Doug Kwan  <dougkwan@google.com>
8434
8435         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
8436
8437 2010-03-25  Doug Kwan  <dougkwan@google.com>
8438
8439         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
8440         to avoid a conversion warning on a 32-bit host.
8441
8442 2010-03-24  Ian Lance Taylor  <iant@google.com>
8443
8444         * testsuite/script_test_3.t: Add a TLS segment.
8445         * testsuite/Makefile.am (check_PROGRAMS): Add
8446         tls_phdrs_script_test.
8447         (tls_phdrs_script_test_SOURCES): Define.
8448         (tls_phdrs_script_test_DEPENDENCIES): Define.
8449         (tls_phdrs_script_test_LDFLAGS): Define.
8450         (tls_phdrs_script_test_LDADD): Define.
8451         * testsuite/Makefile.in: Rebuild.
8452
8453 2010-03-23  Cary Coutant  <ccoutant@google.com>
8454
8455         * fileread.cc (find_or_make_view): Fix comment.
8456
8457 2010-03-23  Ian Lance Taylor  <iant@google.com>
8458
8459         * script-sections.cc (class Orphan_section_placement): Define
8460         PLACE_TLS and PLACE_TLS_BSS.
8461         (Orphan_section_placement::Orphan_section_placement): Initialize
8462         new places.
8463         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
8464         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
8465         (tls_script_test_SOURCES): Define.
8466         (tls_script_test_DEPENDENCIES): Define.
8467         (tls_script_test_LDFLAGS): Define.
8468         (tls_script_test_LDADD): Define.
8469         * testsuite/Makefile.in: Rebuild.
8470
8471 2010-03-22  Doug Kwan  <dougkwan@google.com>
8472
8473         * arm.cc (Arm_relocate_functions::abs8,
8474         Arm_relocate_functions::abs16): Use correct check for overflow
8475         specified in the ARM ELF specs.
8476         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
8477         target of a BLX instruction specially.
8478         (Reloc_stub::stub_type_for_reloc): Ditto.
8479         (Relocate::relocate): Use symbolic names instead of numeric relocation
8480         codes to report error.
8481         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
8482         workaround.
8483         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
8484         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
8485         thumb2_blx_out_of_range.stdout
8486         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
8487         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
8488         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
8489         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
8490         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
8491         thumb2_blx_in_range, thumb2_blx_in_range.o,
8492         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
8493         thumb2_blx_out_of_range.o): New rules.
8494         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
8495         thumb2_blx_in_range and thumb2_blx_out_of_range.
8496         * testsuite/Makefile.in: Regenerate.
8497         * arm_branch_in_range.sh: Add tests for THUMB BLX.
8498         * testsuite/thumb_blx_in_range.s: New file.
8499         * testsuite/thumb_blx_out_of_range.s: New file.
8500
8501 2010-03-22  Rafael Espindola  <espindola@google.com>
8502
8503         * archive.cc (Should_include): Move to archive.h.
8504         (should_include_member): Make it a member of Archive.
8505         (Lib_group): New.
8506         (Add_lib_group_symbols): New.
8507         * archive.h: Include options.h.
8508         (Archive_member): Moved from Archive.
8509         (Should_include): Moved from archive.cc.
8510         (Lib_group): New.
8511         (Add_lib_group_symbols): New.
8512         * dynobj.cc (do_should_include_member): New.
8513         * dynobj.h (do_should_include_member): New.
8514         * gold.cc (queue_initial_tasks): Update call to queue.
8515         * main.cc (main): Print lib group stats.
8516         * object.cc (do_should_include_member): New.
8517         * object.h: Include archive.h.
8518         (Object::should_include_member): New.
8519         (Object::do_should_include_member): New.
8520         (Sized_relobj::do_should_include_member): New.
8521         * options.cc (General_options::parse_start_lib): New.
8522         (General_options::parse_end_lib): New.
8523         (Input_arguments::add_file): Handle lib groups.
8524         (Input_arguments::start_group): Check we are not in a lib.
8525         (Input_arguments::start_lib): New.
8526         (Input_arguments::end_lib): New.
8527         * options.h (General_options): Add start_lib and end_lib.
8528         (Input_argument::lib_): New.
8529         (Input_argument::lib): New.
8530         (Input_argument::is_lib): New.
8531         (Input_file_lib): New.
8532         (Input_arguments::in_lib_): New.
8533         (Input_arguments::in_lib): New.
8534         (Input_arguments::start_lib): New.
8535         (Input_arguments::end_lib_): New.
8536         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
8537         in unused members as preempted.
8538         (Sized_pluginobj::do_should_include_member): New.
8539         * plugin.h (Sized_pluginobj::do_should_include_member): New.
8540         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
8541         return the blocker.
8542         (Read_symbols::do_whole_lib_group): New.
8543         (Read_symbols::do_lib_group): New.
8544         (Read_symbols::do_read_symbols): Handle lib groups.
8545         (Read_symbols::get_name): Handle lib groups.
8546         * readsyms.h (Read_symbols): Add an archive member pointer.
8547         (Read_symbols::do_whole_lib_group): New.
8548         (Read_symbols::do_lib_group): New.
8549         (Read_symbols::member_): New.
8550         * script.cc (read_input_script): Update call to queue_soon.
8551
8552 2010-03-19  Doug Kwan  <dougkwan@google.com>
8553
8554         * arm.cc (Stub_table::Stub_table): Initialize new data members
8555         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
8556         (Stub_table::add_reloc_stub): Assign stub offset and update
8557         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
8558         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
8559         New data members.
8560         (Stub_table::update_data_size_and_addralign): Use
8561         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
8562         instead of going over all reloc stubs.
8563         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
8564         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
8565         Stringpool_template::offset_ to size of Stringpool_char.
8566         (Stringpool_template::new_key_offset): Remove code to initialize
8567         Stringpool_template::offset_.
8568         * stringpool.h (Stringpool_template::set_no_zero_null): Set
8569         Stringpool_template::offset_ to zero.
8570
8571 2010-03-15  Doug Kwan  <dougkwan@google.com>
8572
8573         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
8574         offset_.
8575         (Stringpool_template::new_key_offset): New method.
8576         (Stringpool_template::add_string): Assign offsets when adding new
8577         strings.
8578         (Stringpool_template::set_string_offsets): Do not set string offsets
8579         when not optimizing.
8580         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
8581         member size_.
8582         (Chunked_vector::clear): Clear size_.
8583         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
8584         (Chunked_vector::size): Return size_.
8585         (Chunked_vector::push_back): Use size_ to find insert position.
8586         (Chunked_vector::size_): New data member.
8587         (Stringpool_template::set_no_zero_null): Assert string set is empty.
8588         (Stringpool_template::new_key_offset): New method declaration.
8589         (Stringpool_template::offset_): New data member.
8590
8591 2010-03-15   Rafael Espindola  <espindola@google.com>
8592
8593         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
8594         Add_symbols' constructor.
8595         * readsyms.h (Add_symbols): Remove the input_group member.
8596
8597 2010-03-10  Ian Lance Taylor  <iant@google.com>
8598
8599         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
8600         target to ask whether a reference to a symbol requires a stack
8601         split.
8602         * target.h (Target::is_call_to_non_split): New function.
8603         (Target::do_is_call_to_non_split): Declare virtual function.
8604         * target.cc: Include "symtab.h".
8605         (Target::do_is_call_to_non_split): New function.
8606         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
8607
8608 2010-03-10  Cary Coutant  <ccoutant@google.com>
8609
8610         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
8611         (File_read::open[1]): Remove initial mapping of whole_file_view_.
8612         (File_read::open[2]): Add whole_file_view_ to list of views.
8613         (File_read::make_view): Remove test of whole_file_view_.
8614         (File_read::find_or_make_view): Create whole_file_view_ if
8615         necessary.
8616         (File_read::clear_views): Replace bool parameter with enum;
8617         adjust all callers.  Don't delete views with permanent data;
8618         do delete cached views and views from archives if
8619         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
8620         if clearing the corresponding view.
8621         * fileread.h (File_read::Clear_views_mode): New enum.
8622         (File_read::View::is_permanent_view): New method.
8623         (File_read::clear_views): Replace bool parameter
8624         with enum; adjust all callers.
8625         * options.h (General_options): Change keep_files_mapped option;
8626         add map_whole_files.
8627         * readsyms.cc (Add_symbols::run): Delete sd_ object before
8628         releasing the file.
8629         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
8630         the file.
8631
8632 2010-03-10  David S. Miller  <davem@davemloft.net>
8633
8634         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
8635
8636 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
8637
8638         * icf.cc (get_section_contents): Add '@' marker after processing the
8639         merge reloc.
8640
8641 2010-03-08  Doug Kwan  <dougkwan@google.com>
8642
8643         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
8644         due to a conversion warning.
8645         (Arm_relobj::update_output_local_symbol_count): Check for local
8646         symbol with unset output index.
8647
8648 2010-03-05  Ian Lance Taylor  <iant@google.com>
8649
8650         * options.h (class General_options): Add --spare-dynamic-tags.
8651         * output.cc (Output_data_dynamic::set_final_data_size): Implement
8652         --spare-dynamic-tags.
8653
8654 2010-03-05  Ian Lance Taylor  <iant@google.com>
8655
8656         * incremental.cc: Include "libiberty.h".
8657
8658 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
8659
8660         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
8661         function, is_info_ member.
8662         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
8663         (Versions::Versions): Update caller.
8664         (Versions::define_base_version): Likewise.
8665         (Versions::add_def): Likewise.
8666
8667 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
8668
8669         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
8670         (Scan::possible_function_pointer_reloc): New function.
8671         (Scan::local_reloc_may_be_function_pointer): Change to call
8672         possible_function_pointer_reloc.
8673         (Scan::global_reloc_may_be_function_pointer): Ditto.
8674         * icf.h (Icf::check_section_for_function_pointers): Change to reject
8675         relocations in ".data.rel.ro._ZTV" section.
8676         * testsuite/icf_safe_so_test.sh: Change to pass i386.
8677         * testsuite/icf_safe_so_test.cc: Ditto.
8678         * testsuite/icf_safe_test.cc: Ditto.
8679         * testsuite/icf_safe_test.sh: Ditto.
8680
8681 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8682             Ian Lance Taylor  <iant@google.com>
8683
8684         * target-reloc.h (relocate_section): Check the symbol table index
8685         for -1U before setting the local symbol index.
8686         (scan_relocatable_relocs): If copying the relocation, record that
8687         the local symbol is required.
8688         * object.h (Symbol_value::is_output_symtab_index_set): New
8689         function.
8690         (Symbol_value::may_be_discarded_from_output_symtab): New
8691         function.
8692         (Symbol_value::has_output_symtab_entry): New function.
8693         (Symbol_value::needs_output_symtab_entry): Remove.
8694         (Symbol_value::output_symtab_index): Make sure the symbol index is
8695         set.
8696         (Symbol_value::set_output_symtab_index): Make sure the symbol
8697         index is not set.  Make sure the new index is valid.
8698         (Symbol_value::set_must_have_output_symtab_entry): New function.
8699         (Symbol_value::has_output_dynsym_entry): New function.
8700         (Symbol_value::set_output_dynsym_index): Make sure the new index
8701         is valid.
8702         (Sized_relobj::set_must_have_output_symtab_entry): New function.
8703         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
8704         local symbol if permitted.
8705         (Sized_relobj::do_finalize_local_symbols): Call
8706         is_output_symtab_index_set rather than needs_output_symtab_entry.
8707         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
8708         rather than needs_output_symtab_entry.  Call
8709         has_output_dynsym_entry rather than needs_output_dynsym_entry.
8710         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
8711         is_output_symtab_index_set rather than needs_output_symtab_entry.
8712         * testsuite/discard_locals_relocatable_test.c: New file.
8713         * testsuite/discard_locals_test.sh: Test -r.
8714         * testsuite/Makefile.am (check_DATA): Add
8715         discard_locals_relocatable_test1.syms,
8716         discard_local_relocatable_test2.syms.
8717         (MOSTLYCLEANFILES): Likewise.  Also add
8718         discard_locals_relocatable_test1.lout and
8719         discard_locals_relocatable_test2.out.
8720         (discard_locals_relocatable_test1.syms): New target.
8721         (discard_locals_relocatable_test.o): New target.
8722         (discard_locals_relocatable_test1.out): New target.
8723         (discard_locals_relocatable_test2.syms): New target.
8724         (discard_locals_relocatable_test2.out): New target.
8725         (various): Add missing ../ld-new dependencies.
8726         * testsuite/Makefile.in: Rebuild.
8727
8728 2010-03-03  Nick Clifton  <nickc@redhat.com>
8729
8730         * po/fi.po: New Finnish translation.
8731
8732 2010-03-01  Doug Kwan  <dougkwan@google.com>
8733
8734         * layout.cc (Layout::Layout): Force section types of .init_array*,
8735         .preinit_array* and .fini_array* sections.
8736         * output.cc (Output_section::Input_section_sort_entry::has_priority):
8737         Fix check of return value of std::string::find.().
8738         (Output_section::Input_section_sort_compare::operator()): Remove
8739         comment about .init_array.
8740         (Output_section::Input_section_sort_init_fini_compare::operator()):
8741         New method.
8742         (Output_section::sort_attached_input_sections): Handle .init_array
8743         and .fini_array specially.
8744         * output.h (Output_section::Inut_section_sort_compare): Update
8745         comment.
8746         (Output_section::Input_section_sort_init_fini_compare): New struct.
8747
8748 2010-02-26  Doug Kwan  <dougkwan@google.com>
8749
8750         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
8751         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
8752         * testsuite/debug_msg.sh: Avoid matching source line number for
8753         use of global variable undef_int.
8754
8755 2010-02-26  Doug Kwan  <dougkwan@google.com>
8756
8757         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
8758         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
8759         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
8760         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
8761         * options.cc (General_options::General_options): Initialize member
8762         fix_v4bx_.
8763         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
8764         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
8765         and rm_no_fix_v4bx.stdout
8766         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
8767         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
8768         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
8769         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
8770         and arm_no_fix_v4bx.
8771         * Makefile.in: Regenerate.
8772         * testsuite/arm_fix_v4bx.s: New file.
8773         * testsuite/arm_fix_v4bx.sh: Ditto.
8774
8775 2010-02-24  Doug Kwan  <dougkwan@google.com>
8776
8777         * arm.cc (Target_arm::got_section): Make the .got section the first
8778         non RELRO section in the data segment.
8779         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
8780         suffixes of section names.
8781
8782 2010-02-24  Doug Kwan  <dougkwan@google.com>
8783
8784         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
8785         flags and attributes merging if an input file is a binary file.
8786         * fileread.cc (Input_file::open): Record format of original file.
8787         * fileread.h (Input_file::Format): New enum type.
8788         (Input_file::Input_file): Initialize data member format_.
8789         (Input_file::format): New method definition.
8790         (Input_file::format_):: New data member.
8791
8792 2010-02-24  Doug Kwan  <dougkwan@google.com>
8793
8794         * arm.cc (Arm_output_data_got): New class.
8795         (ARM_TCB_SIZE): New constant
8796         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
8797         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
8798         If user uses a script with a SECTIONS clause, issue only a warning
8799         for a misplaced EXIDX input section.  Otherwise, issue an error.
8800         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
8801         garbage collection.
8802         (Target_arm::got_mode_index_entry): Handle static linking.
8803         (Target_arm::Scan::local): Ditto.
8804         (Target_arm::Scan::global): Ditto.
8805         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
8806         all incorrectly implemented relocations.
8807         (Target_arm::fix_exidx_coverage): Pass layout to
8808         Arm_output_section::fix_exidx_coverage.
8809         * layout.cc (Layout::section_name_mapping): Remove trailing dots
8810         from ".ARM.exidx." and ".ARM.extab.".
8811
8812 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8813
8814         * arm.cc (Target_arm::do_finalize_sections): Create attribute
8815         section if it does not already exist.
8816         * attributes.cc (Attributes_section_data::Attributes_section_data):
8817         Don't crash if size is zero.
8818
8819 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8820             Ian Lance Taylor  <iant@google.com>
8821
8822         * gold.cc (queue_middle_tasks): If no input files were opened,
8823         exit.
8824         * workqueue.h (Task_function::Task_function): Assert that there is
8825         a blocker.
8826
8827 2010-02-22  Doug Kwan  <dougkwan@google.com>
8828
8829         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
8830         * icf.cc (get_section_contents): Cast snprintf arguments to long long
8831         types to avoid warnings due to different uint64_t implementations
8832         on different hosts.
8833
8834 2010-02-21  Doug Kwan  <dougkwan@google.com>
8835
8836         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
8837         handling of the maximum backward branch offset.
8838         (Arm_relocate_functions::thumb_branch_common): Ditto.
8839         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
8840         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
8841         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
8842         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
8843         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
8844         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
8845         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
8846         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
8847         thumb_bl_out_of_range thumb_bl_out_of_range.o,
8848         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
8849         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
8850         thumb2_bl_out_of_range.o): New rules.
8851         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
8852         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
8853         thumb2_bl_out_of_range
8854         * testsuite/Makefile.in: Regenerate.
8855         * testsuite/arm_bl_in_range.s: New file.
8856         * testsuite/arm_bl_out_of_range.s: Ditto.
8857         * testsuite/arm_branch_in_range.sh: Ditto.
8858         * testsuite/arm_branch_range.t: Ditto.
8859         * testsuite/thumb2_branch_range.t: Ditto.
8860         * testsuite/thumb_bl_in_range.s: Ditto.
8861         * testsuite/thumb_bl_out_of_range.s: Ditto.
8862         * testsuite/thumb_branch_range.t: Ditto.
8863
8864 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
8865
8866         * gc.h (gc_process_relocs): Change vectors to point to the new list.
8867         Add reloc offset information.
8868         * icf.cc (get_section_contents): Change iterators to point to the new
8869         vectors. Add reloc offset information to the contents.
8870         * icf.h (Icf::Sections_reachable_info): New typedef.
8871         (Icf::Sections_reachable_list): New typedef.
8872         (Icf::Offset_info): New typedef.
8873         (Icf::Reloc_info): New struct typedef.
8874         (Icf::Reloc_info_list): New typedef.
8875         (Icf::symbol_reloc_list): Delete method.
8876         (Icf::addend_reloc_list): Delete method.
8877         (Icf::section_reloc_list): Delete method.
8878         (Icf::reloc_info_list): New method.
8879         (Icf::reloc_info_list_): New member.
8880
8881 2010-02-19  Doug Kwan  <dougkwan@google.com>
8882
8883         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
8884         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
8885         * arm.cc (Arm_relocation_functions): New forward declaration.
8886         (Target_arm::Target_arm): Initialize new data members
8887         got_mod_index_offset_ and tls_base_symbol_defined_.
8888         (Target_arm::Relocate::relocate_tls): New method.
8889         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
8890          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
8891         New methods.
8892         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
8893         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
8894         (Target_arm::got_mod_index_offset_,
8895         Target_arm::tls_base_symbol_defined_): New data members.
8896         (Target_arm::Scan::local, Target::Scan::global,
8897         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
8898         relocations.
8899
8900 2010-02-18  Doug Kwan  <dougkwan@google.com>
8901
8902         * arm.cc (Arm_relobj::find_linked_text_section): New method.
8903         (Arm_relobj::make_exidx_input_section): Pass section index of linked
8904         text section as a parameter becuase some broken tools may not set
8905         the link in section header.
8906         (Target_arm::has_got_section): New method.
8907         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
8908         without any mapping symbol as data only.  Remove warning.
8909         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
8910         link in its section header, try to discover the link by inspecting the
8911         REL31 relocation at the beginning of the section.
8912         (Target_arm::Scan::check_non_pic): Report name of offending relocation
8913         in error message.
8914         (Target_arm::Scan::global): Treat any reference to the symbol
8915         _GLOBAL_OFFSET_TABLE_ as a GOT access.
8916
8917 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
8918
8919         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
8920         (Scan::global_reloc_may_be_function_pointer): New function.
8921         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
8922         (Scan::global_reloc_may_be_function_pointer): New function.
8923         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
8924         (Scan::global_reloc_may_be_function_pointer): New function.
8925         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
8926         (Scan::global_reloc_may_be_function_pointer): New function.
8927         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
8928         (Scan::global_reloc_may_be_function_pointer): New function.
8929         (Scan::possible_function_pointer_reloc): New function.
8930         (Target_x86_64::can_check_for_function_pointers): New function.
8931         * gc.h (gc_process_relocs): Scan relocation types to determine if
8932         function pointers were taken for targets that support it.
8933         * icf.cc (Icf::find_identical_sections): Include functions for
8934         folding in safe ICF whose pointer is not taken.
8935         * icf.h (Secn_fptr_taken_set): New typedef.
8936         (fptr_section_id_): New member.
8937         (section_has_function_pointers): New function.
8938         (set_section_has_function_pointers): New function.
8939         (check_section_for_function_pointers): New function.
8940         * options.h: Fix comment for safe ICF option.
8941         * target.h (can_check_for_function_pointers): New function.
8942         * testsuite/Makefile.am: Add icf_safe_so_test test case.
8943         Modify icf_safe_test for X86-64.
8944         * testsuite/Makefile.in: Regenerate.
8945         * testsuite/icf_safe_so_test.cc: New file.
8946         * testsuite/icf_safe_so_test.sh: New file.
8947         * testsuite/icf_safe_test.cc (kept_func_3): New function.
8948         (main): Change to take pointer to function kept_func_3.
8949         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
8950         folding is done correctly for X86-64.
8951
8952 2010-02-12  David S. Miller  <davem@davemloft.net>
8953
8954         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
8955         is_symbolless parameter.
8956         (Output_reloc<SHT_REL>::is_symbolless): New.
8957         (Output_reloc<SHT_REL>::is_symbolless_): New.
8958         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
8959         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
8960         (Output_reloc<SHT_RELA>::is_symbolless): New.
8961         (Output_data_reloc::add_global): Handle is_symbolless.
8962         (Output_data_reloc::add_global_relative): Likewise.
8963         (Output_data_reloc::add_local): Likewise.
8964         (Output_data_reloc::add_local_relative): Likewise.
8965         (Output_data_reloc::add_symbolless_global_addend): New.
8966         (Output_data_reloc::add_symbolless_local_addend): New.
8967         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
8968         is_symbolless.
8969         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
8970         instead of ->is_relative_
8971         (Output_reloc::write): Likewise.
8972         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
8973         (Output_reloc::write_rel): Simplify.
8974
8975         * sparc.cc (Target_sparc::Scan::local): Use
8976         ->add_symbolless_local_addend as needed.
8977         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
8978         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
8979         based upon relocation offset.
8980
8981 2010-02-11  Doug Kwan  <dougkwan@google.com>
8982
8983         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
8984         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
8985         beginning of function.
8986         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
8987         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
8988         parameter is_32bit in calls to should_apply_static_reloc.
8989         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
8990         (check_DATA): Add arm_abs_global.stdout.
8991         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
8992         arm_abs_global.stdout): New rules.
8993         (MOSTLLYCLEANFILES): Add arm_abs_global
8994         * Makefile.in: Regenerate.
8995         * testsuite/arm_abs_global.s: New file.
8996         * testsuite/arm_abs_global.sh: Ditto.
8997         * testsuite/arm_abs_lib.s: Ditto.
8998
8999 2010-02-11  Ian Lance Taylor  <iant@google.com>
9000
9001         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
9002         Read_relocs task.
9003         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
9004         Allocate_commons_task first.
9005         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
9006         task, rather than symtab_lock_.
9007         (Gc_process_relocs::~Gc_process_relocs): New function.
9008         (Gc_process_relocs::is_runnable): Check this_blocker_.
9009         (Gc_process_relocs::locks): Use next_blocker_ rather than
9010         blocker_.
9011         (Scan_relocs::~Scan_relocs): New function.
9012         (Scan_relocs::is_runnable): Check this_blocker_ rather than
9013         symtab_lock_.
9014         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
9015         next_blocker_.
9016         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
9017         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
9018         constructor accordingly.
9019         (class Gc_process_relocs): Likewise.
9020         (class Scan_relocs): Likewise.
9021         * common.h (class Allocate_commons_task): Remove symtab_lock_
9022         field, and corresponding constructor parameter.
9023         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
9024         symtab_lock_.
9025         (Allocate_commons_task::locks): Likewise.
9026
9027 2010-02-11  Ian Lance Taylor  <iant@google.com>
9028
9029         * gold-threads.h (class Once): Define.
9030         (class Initialize_lock): Rewrite as child of Once.
9031         * gold-threads.cc (class Once_initialize): Define.
9032         (once_pointer_control): New static variable.
9033         (once_pointer, once_arg): New static variables.
9034         (c_run_once): New static function.
9035         (Once::Once, Once::run_once, Once::internal_run): New functions.
9036         (class Initialize_lock_once): Remove.
9037         (initialize_lock_control): Remove.
9038         (initialize_lock_pointer): Remove.
9039         (initialize_lock_once): Remove.
9040         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
9041         (Initialize_lock::initialize): Rewrite.
9042         (Initialize_lock::do_run_once): New function.
9043         * archive.cc (Archive::interpret_header): Only clear name if it is
9044         not already empty.
9045         * fileread.cc: Include "gold-threads.h"
9046         (file_counts_lock): New static variable.
9047         (file_counts_initialize_lock): Likewise.
9048         (File_read::release): Only increment counts when using --stats.
9049         Use a lock around the increment.
9050         * parameters.cc (class Set_parameters_target_once): Define.
9051         (set_parameters_target_once): New static variable.
9052         (Parameters::Parameters): Move here from parameters.h.
9053         (Parameters::set_target): Rewrite.
9054         (Parameters::set_target_once): New function.
9055         (Parameters::clear_target): Move here and rewrite.
9056         * parameters.h (class Parameters): Update declarations.  Add
9057         set_parameters_target_once_ field.
9058         (Parameters::Parameters): Move to parameters.cc.
9059         (Parameters::clear_target): Likewise.
9060         * readsyms.cc (Read_symbols::do_group): Create a Start_group
9061         task.
9062         (Start_group::~Start_group): New function.
9063         (Start_group::is_runnable): New function.
9064         (Start_group::locks, Start_group::run): New functions.
9065         (Finish_group::run): Change saw_undefined to size_t.
9066         * readsyms.h (class Start_group): Define.
9067         (class Finish_group): Change saw_undefined_ field to size_t.
9068         (Finish_group::Finish_group): Remove saw_undefined and
9069         this_blocker parameters.  Change all callers.
9070         (Finish_group::set_saw_undefined): New function.
9071         (Finish_group::set_blocker): New function.
9072         * symtab.h (class Symbol_table): Change saw_undefined to return
9073         size_t.  Change saw_undefined_ field to size_t.
9074         * target-select.cc (Set_target_once::do_run_once): New function.
9075         (Target_selector::Target_selector): Initialize set_target_once_
9076         field.  Don't initialize lock_ and initialize_lock_ fields.
9077         (Target_selector::instantiate_target): Rewrite.
9078         (Target_selector::set_target): New function.
9079         * target-select.h (class Set_target_once): Define.
9080         (class Target_selector): Update declarations.  Make
9081         Set_target_once a friend.  Remove lock_ and initialize_lock_
9082         fields.  Add set_target_once_ field.
9083
9084 2010-02-10  Ian Lance Taylor  <iant@google.com>
9085
9086         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
9087         queueing any tasks.
9088         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
9089         (queue_middle_tasks): Add all blockers before queueing any tasks.
9090         (queue_final_tasks): Likewise.
9091         * token.h (Task_token::add_blockers): New function.
9092         * object.h (Input_objects::number_of_relobjs): New function.
9093
9094 2010-02-10  Ian Lance Taylor  <iant@google.com>
9095
9096         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
9097         shared, not if not position independent.
9098         * x86_64.cc (Relocate::relocate_tls): Likewise.
9099         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
9100         (tls_pie_pic_test): New target.
9101         * testsuite/Makefile.in: Rebuild.
9102
9103         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
9104         (tls_test_main_pie.o, tls_test_pie.o): New targets.
9105         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
9106         * testsuite/Makefile.in: Rebuild.
9107
9108 2010-02-09  David S. Miller  <davem@davemloft.net>
9109
9110         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
9111         R_SPARC_RELATIVE using ->add_local_relative().
9112         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
9113
9114         * output.h (Output_data_dynamic::add_section_size): New method
9115         that takes two Output_data objects.
9116         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
9117         entry param.  Handle it in initializers.
9118         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
9119         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
9120         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
9121         arg.
9122         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
9123         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
9124         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
9125         for dynrel_includes_plt.
9126         * i386.cc (Target_i386::do_finalize_sections): Likewise.
9127         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
9128         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
9129         before .rela.plt
9130         (Target_sparc::do_finalize_sections): Update to pass true for
9131         dynrel_includes_plt.
9132         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
9133         output before .rela.plt
9134         (Target_powerpc::do_finalize_sections): Update to pass true for
9135         dynrel_includes_plt when 32-bit.
9136
9137 2010-02-08  Doug Kwan  <dougkwan@google.com>
9138
9139         * arm.cc (Arm_relobj::simple_input_section_output_address): New
9140         method.
9141         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
9142         Arm_relobj::scan_section_for_cortex_a8_stubs,
9143         Arm_relobj::do_relocation_section): Instead of calling
9144         Output_section::output_address, use faster
9145         Arm_relobj::simple_input_section_output_address.
9146
9147 2010-02-08  David S. Miller  <davem@davemloft.net>
9148
9149         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
9150         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
9151         relocation helper function.
9152
9153         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
9154         just like R_SPARC_GOT{10,13,22}.
9155         (Target_sparc::Scan::local): Likewise.
9156         (Target_sparc::Relocate:relocate): Likewise.
9157
9158 2010-02-06  Ian Lance Taylor  <iant@google.com>
9159
9160         * configure.ac: Rewrite targetobjs duplicate removal code to use
9161         only shell constructs.
9162         * configure: Rebuild.
9163
9164 2010-02-05  Doug Kwan  <dougkwan@google.com>
9165
9166         PR 11247
9167         * arm.cc (Arm_relobj::section_is_scannable): New method.
9168         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
9169         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
9170
9171 2010-02-04  Doug Kwan  <dougkwan@google.com>
9172
9173         PR 11247
9174         * arm-reloc-property.cc (cstdio): Include.
9175         * configure.ac (targetobjs): Remove duplicates.
9176         * configure: Regenerate.
9177         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
9178         big and little endian version for a given address size.
9179
9180 2010-02-03  Doug Kwan  <dougkwan@google.com>
9181
9182         * arm-reloc-property.cc
9183         (Arm_reloc_property_table::reloc_name_in_error_message): New method
9184         definition.
9185         * arm-reloc-property.h
9186         (Arm_reloc_property_table::get_implemented_static_reloc_property):
9187         New method definition.
9188         (Arm_reloc_property_table::reloc_name_in_error_message): New method
9189         declaration.
9190         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
9191         overflow to N.
9192         (GOT_PREL): Change implemented to Y.
9193         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
9194         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
9195         (Arm_relocate_functions::movw_abs_nc): Remove method.
9196         (Arm_relocate_functions::movt_abs): Ditto.
9197         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
9198         (Arm_relocate_functions::thm_movt_abs): Ditto.
9199         (Arm_relocate_functions::movw_rel_nc): Ditto.
9200         (Arm_relocate_functions::movw_rel): Ditto.
9201         (Arm_relocate_functions::movt_rel): Ditto.
9202         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
9203         (Arm_relocate_functions:thm_movw_rel): Ditto.
9204         (Arm_relocate_functions:thm_movt_rel): Ditto.
9205         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
9206         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
9207         New method definitions.
9208         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
9209         (Arm_relocation_functions::arm_grp_ldr): Ditto.
9210         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
9211         (Arm_relocation_functions::arm_grp_ldc): Ditto.
9212         (Target_arm::Relocate::relocate): Check for non-static or
9213         unimplemented relocation code and exit early.  Change calls to
9214         Target_arm::reloc_uses_thumb_bit and
9215         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
9216         instead.  Refactor code to handle similar relocations to increase
9217         code sharing.  Remove check for unsupported relocation code in switch
9218         statement.
9219         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
9220         relocation property table to find out size.  Change error message to
9221         print out the name of a relocation code instead of the numeric value.
9222         (Target_arm::scan_reloc_for_stub): Use relocation property table
9223         instead of calling Target_arm::reloc_uses_thumb_bit().
9224
9225 2010-02-02  Doug Kwan  <dougkwan@google.com>
9226
9227         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
9228         types of relaxed input section.
9229
9230 2010-02-02  Doug Kwan  <dougkwan@google.com>
9231
9232         * Makefile.am (HFILES): Add arm-reloc-property.h.
9233         (DEFFILES): New.
9234         (TARGETSOURCES): Add arm-reloc-property.cc
9235         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
9236         (libgold_a_SOURCES): $(DEFFILES)
9237         * Makefile.in: Regenerate.
9238         * arm-reloc-property.cc: New file.
9239         * arm-reloc-property.h: New file.
9240         * arm-reloc.def: New file.
9241         * arm.cc: Update comments.
9242         (arm-reloc-property.h): New included header.
9243         (arm_reloc_property_table): New global variable.
9244         (Target_arm::do_select_as_default_target): New method definition.
9245         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
9246         arm-reloc-property to targ_extra_obj.
9247         * parameters.cc (set_parameters_target): Call
9248         Target::select_as_default_target().
9249         * target.h (Target::select_as_default_target): New method definition.
9250         (Target::do_select_as_default_target): Same.
9251
9252 2010-02-01  Doug Kwan  <dougkwan@google.com>
9253
9254         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
9255         first_output_text_section_.
9256         (Arm_exidx_fixup::first_output_text_section): New method definition.
9257         (Arm_exidx_fixup::first_output_text_section_): New data member.
9258         (Arm_exidx_fixup::process_exidx_section): Record the first text
9259         output section seen.
9260         (Arm_output_section::fix_exidx_coverage): Set correct linked section
9261         and entsize in output section header.
9262
9263 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9264
9265         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
9266         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
9267         (Arm_relocate_functions::thm_alu11): New Method.
9268         (Arm_relocate_functions::thm_pc8): New Method.
9269         (Arm_relocate_functions::thm_pc12): New Method.
9270         (Target_arm::Scan::local): Handle the relocations.
9271         (Target_arm::Scan::global): Likewise.
9272         (Target_arm::Relocate::relocate): Likewise.
9273         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9274
9275 2010-01-29  Doug Kwan  <dougkwan@google.com>
9276
9277         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
9278         of relocation types as ld.
9279
9280 2010-01-29  Doug Kwan  <dougkwan@google.com>
9281
9282         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
9283         to public.
9284         (Arm_relocate_functions::thumb_branch_common): Ditto.
9285         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
9286         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
9287         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
9288         Arm_relocate_functions::jump24): Remove.
9289         (Target_arm::Relocate::relocate): Adjust code to call
9290         Arm_relocation_functions::arm_branch_common and
9291         Arm_relocation_functions::thumb_branch_common instead of their removed
9292         wrappers.  Merge switch-cases together to reduce source code size.
9293
9294 2010-01-29  Doug Kwan  <dougkwan@google.com>
9295
9296         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
9297         output_local_symbol_count_needs_update_.
9298         (Arm_relobj::output_local_symbol_count_needs_update,
9299          Arm_relobj::set_output_local_symbol_count_needs_update,
9300          Arm_relobj::update_output_local_symbol_count): New methods.
9301         (Arm_relobj::output_local_symbol_count_needs_update_): New data
9302         member.
9303         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
9304         of pointed function as in a R_ARM_PREL31 relocation.
9305         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
9306         for output local symbol count updating.
9307         (Target_arm::do_relax): Update output local symbol counts in objects
9308         if necessary.
9309         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
9310
9311 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9312
9313         * arm.cc: Added support for the ARM relocations:
9314         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
9315         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
9316         (Arm_relocate_functions::movw_rel_nc): Renamed (was
9317         movw_prel_nc).
9318         (Arm_relocate_functions::movw_rel): New method.
9319         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
9320         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
9321         thm_movw_prel_nc).
9322         (Arm_relocate_functions::thm_movw_rel): New method.
9323         (Arm_relocate_functions::thm_movt_rel): Renamed (was
9324         thm_movt_prel).
9325         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
9326         relocations.
9327         (Target_arm::Scan::global): Likewise.
9328         (Target_arm::Relocate::relocate): Likewise.
9329         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9330         Likewise.
9331
9332 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9333
9334         * arm.cc: Added support for ARM group relocations.
9335         (Target_arm::reloc_needs_sym_origin): New method.
9336         (Arm_relocate_functions::calc_grp_kn): New method.
9337         (Arm_relocate_functions::calc_grp_residual): New method.
9338         (Arm_relocate_functions::calc_grp_gn): New method.
9339         (Arm_relocate_functions::arm_grp_alu): New Method.
9340         (Arm_relocate_functions::arm_grp_ldr): New Method.
9341         (Arm_relocate_functions::arm_grp_ldrs): New Method.
9342         (Arm_relocate_functions::arm_grp_ldc): New Method.
9343         (Target_arm::Scan::local): Handle the ARM group relocations.
9344         (Target_arm::Scan::global): Likewise.
9345         (Target_arm::Relocate::relocate): Likewise.
9346         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9347         Likewise.
9348
9349 2010-01-26  Doug Kwan  <dougkwan@google.com>
9350
9351         * arm.cc (set): Include.
9352         (class Arm_exidx_fixup): Change type of last_input_section_ to const
9353         pointer type.
9354         (Arm_output_section::Text_section_list): New type.
9355         (Arm_output_section::append_text_sections_to_list): New method.
9356         (Arm_output_section::fix_exidx_coverage): Ditto.
9357         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
9358         (Arm_relobj::convert_input_section_to_relaxed_section): Use
9359         Relobj::set_section_offset() instead of
9360         Sized_relobj::invalidate_section_offset().
9361         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
9362         parameter for section headers. Ignore relocation sections for
9363         unallocated sections and EXIDX sections.
9364         (Target_arm::fix_exidx_coverage): New method.
9365         (Target_arm::output_section_address_less_than): New type.
9366         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
9367         linked text section instead of the EXIDX section.
9368         (Arm_output_section::create_stub_group): Add an assertion to check
9369         that this is not an EXIDX output section.
9370         (Arm_output_section::append_text_sections_to_list): New method.
9371         (Arm_output_section::fix_exidx_coverage): Ditto.
9372         (Arm_relobj::scan_sections_for_stubs): Adjust call to
9373         Arm_relobj::section_needs_reloc_stub_scanning.
9374         (Target_arm::do_relax): Fix EXIDX output section coverage in the
9375         first pass.
9376         (Target_arm::fix_exidx_coverage): New method.
9377         * object.h (Relobj::set_output_section): New method.
9378         (Sized_relobj::invalidate_section_offset): Remove method.
9379         (Sized_relobj::do_invalidate_section_offset): Remove method.
9380         (Sized_relobj::do_set_section_offset): Handle offset value -1.
9381
9382 2010-01-25  Doug Kwan  <dougkwan@google.com>
9383
9384         * arm.cc (Arm_exidx_merged_section::do_output_offset):
9385         Fix warning due to signed and unsigned comparison on a 32-bit host.
9386
9387 2010-01-22  Doug Kwan  <dougkwan@google.com>
9388
9389         * arm.cc (Target_arm::do_relax): Record an output section for section
9390         offset adjustment it contains any stub table that has changed.
9391         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
9392         offsets in an output section if necessary.
9393         * output.cc (Output_section::Output_section): Initialize
9394         section_offsets_need_adjustments_.
9395         (Output_section::add_input_section_for_script): Renamed to
9396         Output_section::add_simple_input_section.
9397         (Output_section::save_states): Add a comment.
9398         (Output_section::discard_states): New method defintion.
9399         (Output_section::adjust_section_offsets): Same.
9400         * output.h (Output_section::add_input_section_for_script): Renamed to
9401         Output_section::add_simple_input_section.
9402         (Output_section::discard_states): New method declaration.
9403         (Output_section::adjust_section_offsets): Same.
9404         (Output_section::section_offsets_need_adjustment,
9405         Output_section::set_section_offsets_need_adjustment): New method
9406         definitions.
9407         (Output_section::section_offsets_need_adjustment_): New data member.
9408         * script-sections.cc
9409         (Output_section_element_input::set_section_address): Adjust code for
9410         renaming of Output_section::add_input_section_for_script.
9411         (Orphan_output_section::set_section_address): Same.
9412
9413 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9414
9415         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
9416         Fix_v4bx enum values .
9417         * gold/options.h (General_options): New option definitions.
9418         (General_options::fix_v4bx): New method.
9419         (General_options::Fix_v4bx): New enum.
9420         * gold/options.cc (General_options::parse_fix_v4bx): New method.
9421         (General_options::parse_fix_v4bx_interworking): New method.
9422
9423 2010-01-22  Doug Kwan  <dougkwan@google.com>
9424
9425         * arm.cc (Arm_exidx_fixup): New class.
9426
9427 2010-01-21  Doug Kwan  <dougkwan@google.com>
9428
9429         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
9430         classes.
9431         (Arm_exidx_section_offset_map): New type.
9432
9433 2010-01-21  Doug Kwan  <dougkwan@google.com>
9434
9435         * arm.cc (Arm_exidx_input_section): New class.
9436         (Arm_relobj::exidx_input_section_by_link,
9437         Arm_relobj::exidx_input_section_by_shndx,
9438         Arm_relobj::make_exidx_input_section): New methods.
9439         (read_arm_attributes_section): Remove.
9440         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
9441         information about them.
9442         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
9443         to here.
9444
9445 2010-01-20  Doug Kwan  <dougkwan@google.com>
9446
9447         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
9448         Input_section_specifier to Section_id.
9449         (Target_arm::new_arm_input_section: Adjust code for change of key
9450         type.
9451         (Target_arm::find_arm_input_section): Ditto.
9452         * gc.h (object.h): Include for Section_id nand Section_id_hash.
9453         (Section_id): Remove.
9454         (Garbage_collection::Section_id_hash): Remove.
9455         * icf.h (object.h): Include for Section_id nand Section_id_hash.
9456         (Section_id): Remove.
9457         (Icf::Section_id_hash): Remove.
9458         * object.h (Section_id, Const_section_id, Section_id_hash,
9459         Const_section_id_hash): New type definitions.
9460         * output.cc (Output_section::add_relaxed_input_section): Change to
9461         use Const_section_id instead of Input_section_specifier as key type.
9462         (Output_section::add_merge_input_section): Ditto.
9463         (Output_section::build_relaxation_map): Change to use Section_id
9464         instead of Input_section_specifier as key type.
9465         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
9466         Ditto.
9467         (Output_section::convert_input_sections_to_relaxed_sections): Change
9468         to use Const_section_id instead of Input_section_specifier as key type.
9469         (Output_section::find_merge_section): Ditto.
9470         (Output_section::find_relaxed_input_section): Ditto.
9471         * output.h (Input_section_specifier): Remove class.
9472         (Output_section::Output_section_data_by_input_section_map): Change
9473         key type to Const_section_id.
9474         (Output_section::Output_relaxed_input_section_by_input_section_map):
9475         Ditto.
9476         (Output_section::Relaxation_map): Change key type to Section_id.
9477
9478 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9479
9480         * gold/arm.cc: Added support for R_ARM_V4BX relocation
9481         (class Arm_v4bx_stub): New class.
9482         (DEF_STUBS): Updated definition to support v4_veneer_bx.
9483         (Stub_factory::make_arm_v4bx_stub): New method.
9484         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
9485         (Stub_table::empty): Handle v4bx stubs.
9486         (Stub_table::add_arm_v4bx_stub): New method.
9487         (Stub_table::find_arm_v4bx_stub): New method.
9488         (Arm_relocate_functions::v4bx): New method.
9489         (Target_arm::fix_v4bx): New method.
9490         (Target_arm::Target_arm): Handle R_ARM_V4BX.
9491         (Stub_table::relocate_stubs): Likewise.
9492         (Stub_table::do_write): Likewise.
9493         (Stub_table::update_data_size_and_addralign): Likewise.
9494         (Stub_table::finalize_stubs):  Likewise.
9495         (Target_arm::Scan::local): Likewise.
9496         (Target_arm::Scan::global): Likewise.
9497         (Target_arm::do_finalize_sections): Likewise.
9498         (Target_arm::Relocate::relocate): Likewise.
9499         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9500         Likewise.
9501         (Target_arm::scan_reloc_for_stub): Likewise.
9502         (Target_arm::scan_reloc_section_for_stubs): Likewise.
9503
9504 2010-01-19  Ian Lance Taylor  <iant@google.com>
9505
9506         * output.cc (Output_section_headers::do_sized_write): Write large
9507         segment count to sh_info field.
9508         (Output_file_header::do_sized_write): For large segment count,
9509         write PN_XNUM to e_phnum field.
9510
9511 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9512
9513         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
9514         (Arm_relocate_functions::thm_jump8): New function.
9515         (Arm_relocate_functions::thm_jump11): New function.
9516         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
9517         R_ARM_THM_JUMP11.
9518         (Target_arm::Scan::global): Likewise.
9519         (Target_arm::Relocate::relocate): Likewise.
9520         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9521         Likewise.
9522
9523 2010-01-14  Doug Kwan  <dougkwan@google.com>
9524
9525         * arm.cc (map, utility): Include headers.
9526         (Target_arm::apply_cortex_a8_workaround): New method.
9527         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
9528         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
9529         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
9530         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
9531         the --[no-]fix-cortex-a8 command line options.
9532         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
9533         (Target_arm::relocate_stub): Use addend in instruction template.
9534         * options.h (DEFINE_bool): Set the user-set flag.
9535         (General_options): Add --[no-]-fix-cortex options.
9536         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
9537         : Update fast look-up map after conversion.
9538
9539 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
9540
9541         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
9542         in the first pass of do_layout.
9543
9544 2010-01-13  Doug Kwan  <dougkwan@google.com>
9545
9546         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
9547         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
9548         apparent compiler problem of not folding static constant integral
9549         data members of elfcpp::Elf_sizes<32>.
9550
9551 2010-01-13  Doug Kwan  <dougkwan@google.com>
9552
9553         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
9554         Arm_relobj::section_needs_cortex_a8_stub_scanning,
9555         Arm_relobj::scan_section_for_cortex_a8_erratum,
9556         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
9557         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
9558         sections to scan for relocation stubs into a new method
9559         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
9560         relocation and Cortex-A8 stub scanning.
9561         (Target_arm::do_relax): Force stubs to be after stubbed sections
9562         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
9563         the beginning of a new relaxation pass.  Update a comment.
9564         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
9565
9566 2010-01-12  Ian Lance Taylor  <iant@google.com>
9567
9568         * target-reloc.h (visibility_error): New inline function.
9569         (relocate_section): Call visibility_error.
9570         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
9571         (MOSTLYCLEANFILES): Likewise.
9572         (protected_4_pic.o, protected_3.err): New targets.
9573         * testsuite/protected_4.cc: New file.
9574
9575 2010-01-12  Doug Kwan  <dougkwan@google.com>
9576
9577         * arm.cc (Cortex_a8_reloc): New class.
9578         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
9579         and cortex_a8_relocs_info_.
9580         (Target_arm::fix_cortex_a8): New method definition.
9581         (Target_arm::Cortex_a8_relocs_info): New type.
9582         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
9583         New data member declarations.
9584         (Target_arm::scan_reloc_for_stub): Record information about
9585         relocations for THUMB branches that might be exempted from the
9586         Cortex-A8 workaround.
9587         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
9588         at the beginning of a relaxation pass.
9589
9590 2010-01-12  Doug Kwan  <dougkwan@google.com>
9591
9592         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
9593         (Arm_relobj::Mapping_symbol_position,
9594          Arm_reloj::Mapping_symbol_position_less,
9595          Arm_relobj::Mapping_symbols_info): New types.
9596         (Target_arm::is_mapping_symbol_name): New method definition.
9597         (Arm_relobj::do_count_local_symbols): Save information about mapping
9598         symbols.
9599
9600 2010-01-11  Doug Kwan  <dougkwan@google.com>
9601
9602         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
9603         Arm_relocate_functions::thumb32_branch_upper,
9604         Arm_relocate_functions::thumb32_branch_lower,
9605         Arm_relocate_functions::thumb32_cond_branch_offset,
9606         Arm_relocate_functions::thumb32_cond_branch_upper,
9607         Arm_relocate_functions::thumb32_cond_branch_lower,
9608         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
9609         branch offset encoding.
9610         (Arm_relocate_functions::thumb_branch_common): Use new branch
9611         offset encoding methods to avoid code duplication.
9612         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
9613         (Stub_addend_reader::operator()): Use new branch encoding method
9614         to avoid code duplication.
9615
9616 2010-01-11  Doug Kwan  <dougkwan@google.com>
9617
9618         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
9619         (Target_arm::do_finalize_sections): Define special EXIDX section
9620         symbols only if referenced.
9621         * gc.h (Garbage_collection::add_reference): New method.
9622         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
9623         code duplication.
9624
9625 2010-01-11  Ian Lance Taylor  <iant@google.com>
9626
9627         * script.cc (Version_script_info::build_expression_list_lookup):
9628         Change complaing about duplicate wildcard match from error to
9629         warning.
9630
9631         * script.cc (class Lazy_demangler): Recreate--revert part of patch
9632         of 2009-12-30.
9633         (Version_script_info::Version_script_info): Initialize globs_,
9634         default_version_, default_is_global_, and exact_.  Don't
9635         initialize globals_ or locals_.
9636         (Version_script_info::build_lookup_tables): Build local symbols
9637         first.
9638         (Version_script_info::unquote): New function.
9639         (Version_script_info::add_exact_match): New function.
9640         (Version_script_info::build_expression_list_lookup): Remove lookup
9641         parameter.  Add is_global parameter.  Change all callers.  Handle
9642         wildcard pattern specially.  Unquote pattern.  Call
9643         add_exact_match.
9644         (Version_script_info::get_name_to_match): New function.
9645         (Version_script_info::get_symbol_version): New function.
9646         (Version_script_info::get_symbol_version_helper): Remove.
9647         (Version_script_info::check_unmatched_names): Call unquote.
9648         * script.h (class Version_script_info): Change get_symbol_version
9649         to be non-inline and add is_global parameter; change all callers.
9650         Rewrite symbol_is_local.  Update declarations.  Define struct
9651         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
9652         Remove globals_ and locals_ members.  Add exact_, globs_,
9653         default_version_, is_global_.
9654         (Version_script_info::Glob): Remove pattern, add expression and
9655         is_global.  Update constructor.  Change all callers.
9656         * dynobj.cc (Versions::finalize): Mark the version symbol as the
9657         default version.
9658         (Versions::symbol_section_contents): If a symbol is undefined, or
9659         defined in a dynamic object, set the version index to
9660         VER_NDX_LOCAL.
9661         * symtab.cc (Symbol_table::add_from_relobj): Don't call
9662         symbol_is_local.
9663         (Symbol_table::add_from_pluginobj): Likewise.
9664         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
9665
9666 2010-01-11  Doug Kwan  <dougkwan@google.com>
9667
9668         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
9669         (incremental_dump_LDADD): Add linking option for libintl.
9670         * Makefile.in: Regenerate.
9671
9672 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
9673
9674         PR gold/11144
9675         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
9676         instead of -Ds.
9677         * testsuite/Makefile.in: Regenerated.
9678
9679 2010-01-10  Doug Kwan  <dougkwan@google.com>
9680
9681         * options.h (DEFINE_var): Use parentheses around argument varname__
9682         in macro body to avoid any unintended subsequent substitutions.
9683
9684 2010-01-10  Ian Lance Taylor  <iant@google.com>
9685
9686         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
9687         candidates before doing symbol resolution.
9688
9689         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
9690         ODR candidates if only one is weak.
9691
9692 2010-01-08  Ian Lance Taylor  <iant@google.com>
9693
9694         * script.cc (Version_script_info::build_expression_list_lookup):
9695         Don't warn about ambiguous version, just record the ambiguity.
9696         (Version_script_info::get_symbol_version_helper): Give error if
9697         version is ambiguous.
9698
9699 2010-01-08  Doug Kwan  <dougkwan@google.com>
9700
9701         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
9702         prev_data_size_ and prev_addralign_.  Remove initializer for
9703         deleted data member has_been_changed_.
9704         (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
9705         to determine if the table is empty.
9706         (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
9707         Remove.
9708         (Stub_table::add_reloc_stub): Define method in class definition
9709         instead of just declaring it there.
9710         (Stub_table::add_cortex_a8_stub): New method definition.
9711         (Stub_table::update_data_size_and_addralign): Ditto.
9712         (Stub_table::finalize_stubs): Ditto.
9713         (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
9714         (Stub_table::do_addralign_): Return address alignment in the
9715         (Stub_table::do_reset_address_and_file_offset): Define method in
9716         class definition instead of declaring it there.  Set current data
9717         size to be the data size of the previous pass.
9718         (Stub_table::set_final_data_size): Use current data size as the
9719         final data size.
9720         (Stub_table::relocate_stub): Change parameter type of stub from
9721         Reloc_stub pointer to Stub pointer.
9722         (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
9723         (Stub_table::Cortex_a8_stub_list): New typedef.
9724         (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
9725          Stub_table::prev_addralign_): New data member.
9726         (Arm_relobj::Arm_relobj): Initialize data member
9727         section_has_cortex_a8_workaround_.
9728         (Arm_relobj::section_has_cortex_a8_workaround,
9729          Arm_relobj::mark_section_for_cortex_a8_workaround): New method
9730          definitions.
9731         (Arm_relobj::section_has_cortex_a8_workaround_): New data member
9732         declarations.
9733         (Target_arm::relocate_stub): Change parameter type of stub from
9734         Reloc_stub pointer to Stub pointer.
9735         (Insn_template::size, Insn_template::alignment): Handle
9736         THUMB16_SPECIAL_TYPE.
9737         (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
9738          Stub_table::update_data_size_and_addralign,
9739          Stub_table::apply_cortex_a8_workaround_to_address_range): New method
9740         definitions.
9741         (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
9742         (Stub_table::do_write): Ditto.
9743         (Target_arm::do_relax): Adjust code for changes in Stub_table.
9744
9745 2010-01-08  Ian Lance Taylor  <iant@google.com>
9746
9747         PR 11108
9748         * symtab.h (class Symbol): Remove fields is_target_special_ and
9749         has_plt_offset_.  Add field is_defined_in_discarded_section_.
9750         (Symbol::is_defined_in_discarded_section): New function.
9751         (Symbol::set_is_defined_in_discarded_section): New function.
9752         (Symbol::has_plt_offset): Rewrite.
9753         (Symbol::set_plt_offset): Verify that new offset is not -1U.
9754         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
9755         Don't initialize is_target_special_ or has_plt_offset_.
9756         Initialize is_defined_in_discarded_section_.
9757         (Symbol_table::add_from_relobj): If appropriate, set
9758         is_defined_in_discarded_section.
9759         * resolve.cc (Symbol::override_base_with_special): Don't test
9760         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
9761         * target-reloc.h (relocate_section): Do special handling for
9762         symbols defined in discarded sections for global symbols as well
9763         as local symbols.
9764
9765 2010-01-08  Ian Lance Taylor  <iant@google.com>
9766
9767         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
9768         the SHT_SYMTAB case.
9769
9770 2010-01-08  Ian Lance Taylor  <iant@google.com>
9771
9772         * object.cc (Sized_relobj::do_layout): Don't get confused if
9773         layout_eh_frame returns NULL.
9774
9775 2010-01-08  Ian Lance Taylor  <iant@google.com>
9776
9777         PR 11084
9778         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
9779         dynamic symbol table, use the normal symbol table.
9780         (Sized_dynobj::do_read_symbols): Remove assertion about type of
9781         symbol table.
9782
9783 2010-01-08  Ian Lance Taylor  <iant@google.com>
9784
9785         PR 11072
9786         * layout.cc (Layout::include_section): Remove .gnu_debuglink
9787         sections.
9788
9789 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
9790
9791         * version.cc (print_version): Change to "Copyright 2010".
9792
9793 2010-01-08  Ian Lance Taylor  <iant@google.com>
9794
9795         PR 10287
9796         PR 11063
9797         * i386.cc (class Target_i386): Change return type of plt_section
9798         to be non-const.
9799         (class Output_data_plt_i386): Add tls_desc_rel_ field.
9800         (Output_data_plt_i386::Output_data_plt_i386): Initialize
9801         tls_desc_rel_ field.
9802         (Output_data_plt_i386::rel_tls_desc): New function.
9803         (Target_i386::rel_tls_desc_section): New function.
9804         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
9805         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
9806         R_386_TLS_DESC reloc in rel_tls_desc_section.
9807         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
9808         Define struct Tlsdesc_info.
9809         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
9810         (Target_x86_64::do_reloc_symbol_index): New function.
9811         (Target_x86_64::add_tlsdesc_info): New function.
9812         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
9813         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
9814         tlsdesc_rel_ field.
9815         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
9816         all callers.
9817         (Output_data_plt_x86_64::rela_tlsdesc): New function.
9818         (Target_x86_64::rela_tlsdesc_section): New function.
9819         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
9820         handling.
9821         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
9822         (Target_x86_64::do_reloc_addend): New function.
9823         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
9824         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
9825         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
9826         (Output_reloc::type): New function.
9827         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
9828         (Output_reloc::is_target_specific): New function.
9829         (Output_reloc::target_arg): New function.
9830         (class Output_reloc) [SHT_RELA]: Add four new constructors for
9831         absolute relocs and target specific relocs.
9832         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
9833         add_target_specific.
9834         (class Output_data_reloc) [SHT_RELA]: Likewise.
9835         * output.cc (Output_reloc::Output_reloc): Add four new versions
9836         for absolute relocs and target specific relocs.
9837         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
9838         (Output_reloc::get_symbol_index): Likewise.
9839         (Output_reloc::local_section_offset): Check that local_sym_index_
9840         is not TARGET_CODE or 0.
9841         (Output_reloc::symbol_value): Likewise.
9842         (Output_reloc::write) [SHT_RELA]: Call target for target specific
9843         reloc.
9844         * target.h (class Target): Add reloc_symbol_index and reloc_addend
9845         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
9846         functions.
9847         * layout.cc (add_target_dynamic_tags): Use output section for
9848         DT_PLTRELSZ and DT_JMPREL.
9849
9850 2010-01-07  Ian Lance Taylor  <iant@google.com>
9851
9852         PR 11061
9853         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
9854         function.
9855         (class Output_data_reloc_generic): Define.
9856         (class Output_data_reloc_base): Change base class to
9857         Output_data_reloc_generic.  Change add() method to call
9858         bump_relative_reloc_count for a relative reloc.  Remove
9859         sort_relocs_ field.
9860         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
9861         to sort_relocs().
9862         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
9863         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
9864         appropriate.
9865         * layout.h (class Layout): Update declaration.
9866
9867 2010-01-07  Ian Lance Taylor  <iant@google.com>
9868
9869         * output.h (class Output_data): Add const version of
9870         output_section and do_output_section.
9871         (class Output_section_data): Add const version of
9872         do_output_section.
9873         (class Output_section): Likewise.
9874         * layout.cc (Layout::add_target_dynamic_tags): New function.
9875         * layout.h (class Layout): Update declarations.
9876         * arm.cc (Target_arm::do_finalize_sections): Use
9877         add_target_dynamic_tags.
9878         * i386.cc (Target_i386::do_finalize_sections): Likewise.
9879         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
9880         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
9881         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
9882
9883 2010-01-07  Ian Lance Taylor  <iant@google.com>
9884
9885         PR 11042
9886         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
9887         object as needed.
9888
9889 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
9890             Ian Lance Taylor  <iant@google.com>
9891
9892         PR 11019
9893         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
9894         Xindex::read_symtab_xindex.
9895
9896 2010-01-07  Doug Kwan  <dougkwan@google.com>
9897
9898         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
9899         (Insn_template::thumb16_bcond_insn): New method declaration.
9900         (Insn_template): Fix spelling.
9901         (Stub::thumb16_special): New method declaration.
9902         (Stub::do_write): Define virtual method which was previously pure
9903         virtual.
9904         (Stub::do_thumb16_special): New method declaration.
9905         (Stub::do_fixed_endian_write): New template member.
9906         (Reloc_stub::do_write): Remove.
9907         (Reloc_stub::do_fixed_endian_write): Remove.
9908         (Cortex_a8_stub): New class definition.
9909         (Stub_factory::make_cortex_a8_stub): New method definition.
9910         (Stub_factory::Stub_factory): Add missing static storage class
9911         qualifier for elf32_arm_stub_a8_veneer_blx.
9912
9913 2010-01-07  Ian Lance Taylor  <iant@google.com>
9914
9915         PR 10980
9916         * options.h (class General_options): Add --warn-unresolved-symbols
9917         and --error-unresolved-symbols.
9918         * errors.cc (Errors::undefined_symbol): Implement
9919         --warn-unresolved-symbols.
9920
9921         * options.h (class General_options): Add -z text and -z textoff.
9922         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
9923
9924 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
9925
9926         * gc.h (Garbage_collection::Cident_section_map): New typedef.
9927         (Garbage_collection::cident_sections): New function.
9928         (Garbage_collection::add_cident_section): New function.
9929         (Garbage_collection::cident_sections_): New member.
9930         (gc_process_relocs): Add references to sections whose names are C
9931         identifiers.
9932         * gold.h (cident_section_start_prefix): New constant.
9933         (cident_section_stop_prefix): New constant.
9934         (is_cident): New function.
9935         * layout.cc (Layout::define_section_symbols): Replace string constants
9936         with the newly defined constants.
9937         * object.cc (Sized_relobj::do_layout): Track sections whose names are
9938         C identifiers.
9939         * testsuite/Makefile.am: Add gc_orphan_section_test.
9940         * testsuite/Makefile.in: Regenerate.
9941         * testsuite/gc_orphan_section_test.cc: New file.
9942         * testsuite/gc_orphan_section_test.sh: New file.
9943
9944 2010-01-06  Ian Lance Taylor  <iant@google.com>
9945
9946         PR 10980
9947         * options.h (class General_options): Add --warn-shared-textrel.
9948         * layout.cc (Layout::finish_dynamic_section): Implement
9949         --warn-shared-textrel.
9950
9951         PR 10980
9952         * options.h (class General_options): Add --warn-multiple-gp.
9953
9954 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9955
9956         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
9957         $(THREADSLIB) and $(LIBDL).
9958         * Makefile.in: Rebuild.
9959
9960 2010-01-06  Ian Lance Taylor  <iant@google.com>
9961
9962         PR 10980
9963         * options.cc (General_options::parse_section_start): New function.
9964         (General_options::section_start): New function.
9965         (General_options::General_options): Initialize all members.
9966         * options.h: Include <map>
9967         (class General_options): Add --section-start.  Add section_starts_
9968         member.
9969         * layout.cc (Layout::attach_allocated_section_to_segment): If
9970         --section-start was used, set the address of the segment.  Remove
9971         local sort_sections.
9972         (Layout::relaxation_loop_body): If the address of the load segment
9973         has been set by --section-start, don't use it.
9974         * output.h (Output_segment::update_flags_for_output_section): New
9975         function.
9976         * output.cc (Output_segment::add_output_section): Call
9977         update_flags_for_output_section.
9978
9979 2010-01-05  Ian Lance Taylor  <iant@google.com>
9980
9981         PR 10980
9982         * options.h (class General_options): Add --undefined-version.
9983         * script.cc (struct Version_expression): Add was_matched_by_symbol
9984         field.
9985         (Version_script_info::matched_symbol): New function.
9986         (Version_script_info::get_symbol_version_helper): Call
9987         matched_symbol.
9988         (Version_script_info::check_unmatched_names): New function.
9989         * script.h (class Version_script_info): Update declarations.
9990         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
9991
9992         * options.h (class General_options): Use DEFINE_bool_alias for
9993         allow_multiple_definition.
9994         * resolve.cc (Symbol_table::should_override): Don't test
9995         allow_multiple_definition.
9996
9997         PR 10980
9998         * options.h (class General_options): Add --cref.
9999         * main.cc (main): Print cref table if --cref.  Don't close mapfile
10000         until after printing cref table.
10001         * cref.cc: Include "symtab.h".
10002         (class Cref_inputs): Define Cref_table_compare and Cref_table.
10003         (Cref_table_compare::operator()): New function.
10004         (Cref_inputs::gather_cref): New function.
10005         (filecol): New static const.
10006         (Cref_inputs::print_cref): New function.
10007         (Cref::print_cref): New function.
10008         * cref.h: Include <cstdio>.
10009         (class Cref): Update declarations.
10010         * mapfile.h (Mapfile::file): New function.
10011         * object.h (class Object): Define Symbols.  Declare virtual
10012         do_get_global_symbols.
10013         (Object::get_global_symbols): New function.
10014         * object.cc (Input_objects::add_object): Pass object to cref_ if
10015         --cref.
10016         (Input_objects::archive_start): Likewise.
10017         (Input_objects::archive_stop): Likewise.
10018         (Input_objects::print_cref): New function.
10019         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
10020         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
10021         --cref.
10022         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
10023         function.
10024         * plugin.h (class Sized_pluginobj): Update declarations.
10025
10026 2010-01-05  Ian Lance Taylor  <iant@google.com>
10027
10028         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
10029         to is_default_version.  Rename insdef to insdefault.
10030         (Symbol_table::add_from_relobj): Rename def to is_default_version
10031         and local to is_forced_local.
10032         (Symbol_table::add_from_pluginobj): Likewise.
10033         (Symbol_table::add_from_dynobj): Likewise.
10034         (Symbol_table::define_special_symbol): Rename insdef to
10035         insdefault.
10036
10037 2010-01-04  Ian Lance Taylor  <iant@google.com>
10038
10039         PR 10980
10040         * options.h (class General_options): Add
10041         --allow-multiple-definition and -z muldefs.
10042         * resolve.cc (Symbol_table::should_override): Don't warn about a
10043         multiple symbol definition if --allow-multiple-definition or -z
10044         muldefs.
10045
10046         PR 10980
10047         * options.h (class General_options): Add --add-needed and
10048         --copy-dt-needed-entries.  Tweak --as-needed help entry.
10049         * object.cc (Input_objects::check_dynamic_dependencies): Give an
10050         error if --copy-dt-needed-entries aka --add-needed is used and
10051         would cause a change in behaviour.
10052
10053         PR 10980
10054         * options.h (class General_options): Add -G as a short version of
10055         --shared.  Add no-op options -assert, -g, and -i.
10056
10057 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
10058
10059         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
10060         check for .text or .gnu.linkonce.t sections.
10061         * icf.cc (Icf::find_identical_sections): Ditto.
10062         Change the detection for mangled function name within the section
10063         name.
10064         * icf.h (is_section_foldable_candidate): New function.
10065
10066 2009-12-30  Ian Lance Taylor  <iant@google.com>
10067
10068         PR 10980
10069         * options.h (class General_options): Permit two dashes with
10070         --retain-symbols-file.
10071
10072 2009-12-30  Ian Lance Taylor  <iant@google.com>
10073
10074         PR 10979
10075         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
10076         don't put the file header and segment headers in the text
10077         segment.
10078
10079         PR 10979
10080         * common.cc (Sort_commons::operator()): Stabilize sort when both
10081         entries are NULL.
10082         (Symbol_table::do_allocate_commons_list): When allocating common
10083         symbols, skip a symbol which is no longer common.
10084         * symtab.h (Symbol::is_common): Test whether the symbol comes from
10085         an object before checking its type.
10086         * testsuite/common_test_2.c: New file.
10087         * testsuite/common_test_3.c: New file.
10088         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
10089         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
10090         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
10091         (common_test_2_pic.o, common_test_2.so): New targets.
10092         (common_test_3_pic.o, common_test_3.so): New targets.
10093         * testsuite/Makefile.in: Rebuild.
10094
10095         PR 10979
10096         * script.cc (read_input_script): If we see a new SECTIONS clause,
10097         and we have added an input section, give an error.
10098         * layout.h (class Layout): Add have_added_input_section function.
10099         Add have_added_input_section_ field.
10100         * layout.cc (Layout::Layout): Initialize
10101         have_added_input_section_.
10102         (Layout::layout): Set have_added_input_section_.
10103         (Layout::layout_eh_frame): Likewise.
10104
10105 2009-12-30  Ian Lance Taylor  <iant@google.com>
10106
10107         PR 10931
10108         * options.h (class General_options): Add --sort-common option.
10109         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
10110         * common.cc (Sort_common): Add sort_order parameter to
10111         constructor.  Add sort_order_ field.
10112         (Sort_commons::operator): Check sort_order_.
10113         (Symbol_table::allocate_commons): Determine the sort order.
10114         (Symbol_table::do_allocate_commons): Add sort_order parameter.
10115         Change all callers.
10116         (Symbol_table::do_allocate_commons_list): Likewise.
10117
10118 2009-12-30  Ian Lance Taylor  <iant@google.com>
10119
10120         PR 10916
10121         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
10122         symbols from this object, don't change the visibility of an
10123         undefined symbol.
10124         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
10125
10126 2009-12-30  Ian Lance Taylor  <iant@google.com>
10127
10128         PR 10861
10129         * script.h (class Version_script_info): Define Language enum.
10130         Update declarations.  Define Glob, Exact, and Lookup types.  Add
10131         new fields globals_, locals_, and is_finalized_.
10132         * script.cc: Various formatting fixes.
10133         (class Parser_closure): Change language_stack_ from a vector of
10134         std::string to one of Version_script_info::Language.  Adjust all
10135         uses accordingly.
10136         (class Lazy_demangler): Remove.
10137         (struct Version_expression): Change language from std::string to
10138         Version_script_info::Language.
10139         (Version_script_info::Version_script_info): New function.
10140         (Version_script_info::~Version_script_info): Don't call clear.
10141         (Version_script_info::finalize): New function.
10142         (Version_script_info::build_lookup_tables): New function.
10143         (Version_script_info::build_expression_list_lookup): New
10144         function.
10145         (Version_script_info::get_symbol_version_helper): Rewrite to use
10146         lookup tables.
10147         (Version_script_info::print_expression_list): Adjust to use
10148         Version_script_info::Language.
10149         (script_push_lex_into_version_mode): Check that the version script
10150         has not been finalized.
10151         (version_script_push_lang): Change language string to
10152         Version_script_info::Language.
10153         * options.cc (Command_line::version_script): New function.
10154         * options.h (class General_options): Add finalize_dynamic_list
10155         function.  Change version_script from declaration to definition.
10156         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
10157         * testsuite/version_script.map: Remove duplicate def of foo.
10158         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
10159         version_script.map.
10160         * testsuite/Makefile.in: Rebuild.
10161
10162 2009-12-30  Ian Lance Taylor  <iant@google.com>
10163
10164         PR 10843
10165         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
10166         if the input symbol index is 0, make the output symbol index 0.
10167
10168 2009-12-30  Ian Lance Taylor  <iant@google.com>
10169
10170         PR 10670
10171         * options.h (class General_options): Add -x/--discard-all.
10172         * object.cc (Sized_relobj::do_count_local_symbols): Handle
10173         --discard-all.  If the local symbol needs a dynamic entry, check
10174         that before handling --discard-locals.
10175
10176 2009-12-30  Ian Lance Taylor  <iant@google.com>
10177
10178         PR 10450
10179         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
10180         flags to PF_R.
10181         (Output_segment::add_output_section): Don't change the flags if
10182         the type is PT_TLS.
10183
10184         PR 10450
10185         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
10186         GNU hash table if they need a dynamic value.  Otherwise, don't add
10187         them if they are defined in a dynamic object or are forced local.
10188
10189 2009-12-29  Ian Lance Taylor  <iant@google.com>
10190
10191         PR 10450
10192         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
10193         .gnu.hash table for a 32-bit target.
10194
10195         PR 10450
10196         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
10197         regular and a dynamic object only needs a dynamic symbol table
10198         entry if it is externally visible.
10199
10200         PR 10450
10201         * i386.cc (class Target_i386): Initialize global_offset_table_ in
10202         constructor.  Add global_offset_table_ field.
10203         (Target_i386::got_section): Set global_offset_table_.
10204         (Target_i386::do_finalize_sections): Set global_offset_table_
10205         size.
10206         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
10207         in constructor.  Add global_offset_table_ field.
10208         (Target_x86_64::got_section): Set global_offset_table_.
10209         (Target_x86_64::do_finalize_sections): Set global_offset_table_
10210         size.
10211
10212         * layout.cc (Layout::Layout): Initialize increase_relro_.
10213         (Layout::get_output_section): Add is_relro, is_last_relro, and
10214         is_first_non_relro parameters.  Change all callers.
10215         (Layout::choose_output_section): Likewise.
10216         (Layout::add_output_section_data): Likewise.
10217         (Layout::make_output_section): Likewise.
10218         (Layout::set_segment_offsets): Clear increase_relro when using a
10219         linker script.
10220         * layout.h (class Layout): Add increase_relro method.  Add
10221         increase_relro_ field.  Update declarations.
10222         * output.cc (Output_section::Output_section): Initialize
10223         is_last_relro_ and is_first_non_relro_.
10224         (Output_segment::add_output_section): Group relro sections is
10225         do_sort is true.  Handle is_last_relro and is_first_non_relro.
10226         (Output_segment::maximum_alignment): Remove relro handling.
10227         (Output_segment::set_section_addresses): Add increase_relro
10228         parameter.  Change all callers.  Add initial alignment to align
10229         relro sections on separate page.  Remove old relro handling.
10230         (Output_segment::set_section_list_addresses): Remove in_relro
10231         parameter.  Change all callers.
10232         (Output_segment::set_offset): Add increase parameter.  Change all
10233         callers.  Remove old relro handling.
10234         * output.h (class Output_section): Add new methods: is_last_relro,
10235         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
10236         Add is_last_relro_ and is_first_non_relro_ fields.
10237         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
10238         Create separate .got.plt section.  Call increase_relro.
10239         * x86_64.cc (Target_x86_64::got_section): Likewise.
10240         * testsuite/relro_script_test.t: Add .got.plt.
10241
10242         PR 10450
10243         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
10244         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
10245         (Layout::finalize): Call set_dynamic_symbol_size.
10246         (Layout::set_dynamic_symbol_size): New function.
10247         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
10248         set_dynamic_symbol_size.
10249
10250         PR 10450
10251         * output.h (class Output_section): Add is_entsize_zero_ field.
10252         * output.cc (Output_section::Output_section): Initialize
10253         is_entsize_zero_.
10254         (Output_section::set_entsize): If two different entsizes are
10255         requested, force it to zero.
10256         (Output_section::add_input_section): Set flags for .debug_str
10257         before updating section flags.  Set entsize.
10258         (Output_section::update_flags_for_input_section): Set SHF_MERGE
10259         and SHF_STRING if all input sections have those flags.
10260
10261 2009-12-29   Rafael Espindola  <espindola@google.com>
10262
10263         * main.cc (main): Fix the sys time reporting.
10264         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
10265         reporting.
10266
10267 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
10268
10269         * options.cc (General_options::parse_version): Allow -v to exit
10270         without an error if there is nothing to link.
10271
10272 2009-12-29  Ian Lance Taylor  <iant@google.com>
10273
10274         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
10275         using a version of gcc before 4.1.
10276         * configure: Rebuild.
10277
10278 2009-12-28  Chris Demetriou  <cgd@google.com>
10279
10280         * attributes.cc (Output_attributes_section_data::do_write): Use
10281         std::vector::front rather than std::vector::data.
10282
10283 2009-12-28  Ian Lance Taylor  <iant@google.com>
10284
10285         * symtab.h (class Symbol_table): Add enum Defined.
10286         * resolve.cc (Symbol_table::should_override): Add defined
10287         parameter.  Change all callers.  Test whether object is NULL
10288         before calling a method on it.
10289         (Symbol_table::report_resolve_problem): Add defined parameter.
10290         Change all callers.
10291         (Symbol_table::should_override_with_special): Likewise.
10292         * symtab.cc (Symbol_table::define_in_output_data): Add defined
10293         parameter.  Change all callers.
10294         (Symbol_table::do_define_in_output_data): Likewise.
10295         (Symbol_table::define_in_output_segment): Likewise.
10296         (Symbol_table::do_define_in_output_segment): Likewise.
10297         (Symbol_table::define_as_constant): Likewise.
10298         (Symbol_table::do_define_as_constant): Likewise.
10299         * script.h (class Symbol_assignment): Add is_defsym parameter to
10300         constructor; change all callers.
10301         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
10302         parameter.  Change all callers.  Add is_defsym_ field.
10303         (class Parser_closure): Add parsing_defsym parameter to
10304         constructor; change all callers.  Add parsing_defsym accessor
10305         function.  Add parsing_defsym_ field.
10306
10307 2009-12-28  Ian Lance Taylor  <iant@google.com>
10308
10309         * gold.cc (queue_middle_tasks): Fix formatting.
10310         * object.cc (Relobj::is_section_name_included): Likewise.
10311
10312 2009-12-23  Ian Lance Taylor  <iant@google.com>
10313
10314         * i386.cc (Target_i386::do_calls_non_split): Recognize
10315         -fsplit-stack prologue for a function with a static chain.
10316         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
10317         -fsplit-stack prologue when using %r11.
10318
10319 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
10320
10321         * options.cc (General_options::parse_version): Make -v continue and do
10322         the link like GNU ld does.
10323
10324 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
10325
10326         * Makefile.am (CCFILES): Add timer.cc.
10327         (HFILES): Add timer.h.
10328         * configure.ac: Check for sysconf and times.
10329         * main.cc: include timer.h.
10330         (main): Use Timer instead of get_run_time.
10331         * timer.cc: New.
10332         * timer.h: New.
10333         * workqueue.cc: include timer.h.
10334         (Workqueue::find_and_run_task):
10335         Report user, sys and wall time.
10336         * Makefile.in: Regenerate.
10337         * config.in: Regenerate.
10338         * configure: Regenerate.
10339
10340 2009-12-16  Doug Kwan  <dougkwan@google.com>
10341
10342         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
10343         sections.
10344         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
10345         relaxed input sections.
10346         * output.cc (Output_section::find_relaxed_input_section): Change
10347         return type to Output_relaxed_input_section pointer.  Adjust code
10348         for new type of relaxed_input_section_map_.
10349         * output.h (Output_section::find_relaxed_input_section): Change
10350         return type to Output_relaxed_input_section pointer.
10351         (Output_section::Output_relaxed_input_section_by_input_section_map):
10352         New type.
10353         (Output_section::relaxed_input_section_map_): Change type to
10354         Output_section::Output_relaxed_input_section_by_input_section_map.
10355         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
10356         input section.
10357
10358 2009-12-15  Ian Lance Taylor  <iant@google.com>
10359
10360         * layout.cc (Layout::create_shstrtab): Only write out after input
10361         sections if we are compressing debug sections.
10362
10363 2009-12-15  Ian Lance Taylor  <iant@google.com>
10364
10365         * archive.cc (Archive::add_symbols): Only look up a symbol without
10366         a version if there is, in fact, a version.
10367
10368 2009-12-14  Ian Lance Taylor  <iant@google.com>
10369
10370         Revert -Wshadow changes, all changes from:
10371         2009-12-11  Doug Kwan  <dougkwan@google.com>
10372         2009-12-11  Nick Clifton  <nickc@redhat.com>
10373         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
10374
10375 2009-12-11  Doug Kwan  <dougkwan@google.com>
10376
10377         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
10378         due to -Wshadow.
10379         * attributes.cc (Object_attribute::size): Ditto.
10380         (Attributes_section_data::size): Ditto.
10381         (Attributes_section_data::Attributes_section_data): Ditto.
10382         (Output_attributes_section_data::do_write): Ditto.
10383         * attributes.h (Object_attribute::set_type): Ditto.
10384         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
10385
10386 2009-12-11  Nick Clifton  <nickc@redhat.com>
10387
10388         * archive.cc: Fix shadowed variable warnings.
10389         * arm.cc: Likewise.
10390         * compressed_output.cc: Likewise.
10391         * compressed_output.h: Likewise.
10392         * configure: Likewise.
10393         * dwarf_reader.cc: Likewise.
10394         * dynobj.cc: Likewise.
10395         * dynobj.h: Likewise.
10396         * ehframe.cc: Likewise.
10397         * ehframe.h: Likewise.
10398         * errors.cc: Likewise.
10399         * expression.cc: Likewise.
10400         * fileread.cc: Likewise.
10401         * fileread.h: Likewise.
10402         * freebsd.h: Likewise.
10403         * i386.cc: Likewise.
10404         * icf.cc: Likewise.
10405         * incremental.h: Likewise.
10406         * layout.cc: Likewise.
10407         * layout.h: Likewise.
10408         * mapfile.cc: Likewise.
10409         * merge.cc: Likewise.
10410         * merge.h: Likewise.
10411         * object.cc: Likewise.
10412         * object.h: Likewise.
10413         * options.h: Likewise.
10414         * output.cc: Likewise.
10415         * output.h: Likewise.
10416         * parameters.cc: Likewise.
10417         * plugin.cc: Likewise.
10418         * powerpc.cc: Likewise.
10419         * reduced_debug_output.cc: Likewise.
10420         * reduced_debug_output.h: Likewise.
10421         * reloc.cc: Likewise.
10422         * reloc.h: Likewise.
10423         * resolve.cc: Likewise.
10424         * script-sections.cc: Likewise.
10425         * script.cc: Likewise.
10426         * script.h: Likewise.
10427         * sparc.cc: Likewise.
10428         * symtab.cc: Likewise.
10429         * symtab.h: Likewise.
10430         * target-select.cc: Likewise.
10431         * target-select.h: Likewise.
10432         * token.h: Likewise.
10433         * workqueue.cc: Likewise.
10434         * workqueue.h: Likewise.
10435         * x86_64.cc: Likewise.
10436
10437 2009-12-10  Doug Kwan  <dougkwan@google.com>
10438
10439         * arm.cc (attributes.h): New include.
10440         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
10441         (Arm_relobj::~Arm_relobj): Delete object pointed by
10442         attributes_section_data_.
10443         (Arm_relobj::attributes_section_data): New method definition.
10444         (Arm_relobj::attributes_section_data_): New data member declaration.
10445         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
10446         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
10447         attributes_section_data_.
10448         (Arm_dynobj::attributes_section_data): New method definition.
10449         (Arm_dynobj::attributes_section_data_): New data member declaration.
10450         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
10451         initialization value of may_use_blx_ to false.
10452         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
10453         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
10454         object attributes to compute results instead of hard-coding.
10455         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
10456         Target_arm::get_secondary_compatible_arch,
10457         Target_arm::set_secondary_compatible_arch
10458         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
10459         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
10460         New method declarations.
10461         (Target_arm::get_aeabi_object_attribute): New method definition.
10462         (Target_arm::attributes_section_data_): New data member declaration.
10463         (read_arm_attributes_section): New template definition.
10464         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
10465         (Arm_dynobj::do_read_symbols): Ditto.
10466         (Target_arm::do_finalize_sections): Merge attributes sections from
10467         input.  Check for BLX use after attributes section merging.
10468         Fix __exidx_start and __exidx_end visibility.  Create an
10469         .ARM.attributes section if necessary.
10470         (Target_arm::get_secondary_compatible_arch,
10471         Target_arm::set_secondary_compatible_arch,
10472         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
10473         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
10474         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
10475         New method definitions.
10476
10477 2009-12-09  Ian Lance Taylor  <iant@google.com>
10478
10479         * plugin.cc (Plugin::load): Don't cast from void* to a function
10480         pointer.
10481
10482 2009-12-09  Ian Lance Taylor  <iant@google.com>
10483
10484         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
10485         information fields.
10486
10487 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
10488
10489         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
10490         Replace two_file_shared_1.so with two_file_shared_2.so.
10491         * testsuite/Makefile.in: Regenerated.
10492
10493 2009-12-08  Doug Kwan  <dougkwan@google.com>
10494
10495         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
10496         (HFILES): Add attributes.h and int_encoding.h.
10497         * Makefile.in: Regenerate.
10498         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
10499         function definitions to int_encoding.cc
10500         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
10501         prototypes to int_encoding.h
10502         * reduced_debug_output.cc (int_encoding.h): New include.
10503         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
10504         function definitions to int_encoding.cc
10505         (insert_into_vector, read_from_pointer): Move template definitions to
10506         int_encoding.h
10507         * attributes.cc: New file.
10508         * attributes.h: New file.
10509         * int_encoding.cc: New file.
10510         * int_encoding.h: New file.
10511
10512 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
10513
10514         PR gold/11055
10515         * incremental-dump.cc (dump_incremental_inputs): New.
10516         (main): Use dump_incremental_inputs.
10517
10518 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
10519
10520         PR gold/10893
10521         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
10522         checking elfcpp::STT_FUNC.
10523         (Target_i386::Relocate::relocate): Likewise.
10524         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
10525
10526         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
10527         symbols from shared libraries into normal FUNC symbols.
10528
10529         * symtab.h (Symbol): Add is_func and use it.
10530
10531 2009-12-05  Doug Kwan  <dougkwan@google.com>
10532
10533         * arm.cc (Target_arm::arm_info): Initialize new fields
10534         attributes_section and attributes_vendor.
10535         * i386.cc (Target_i386::i386_info): Same.
10536         * object.cc (Sized_relobj::do_layout): Skip attribute section.
10537         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
10538         fields attributes_section and attributes_vendor.
10539         * sparc.cc (Target_sparc::sparc_info): Same.
10540         * target.h (Target::attributes_section, Target::attributes_vendor,
10541         Target::is_attributes_section, Target::attribute_arg_type,
10542         Target::attributes_order): New method definitions.
10543         (Target::Target_info::attributes_section,
10544         Target::Target_info::attributes_vendor): New fields.
10545         (Target::do_attribute_arg_type, Target::do_attributes_order): New
10546         virtual method definitions.
10547         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
10548         attributes_section and attributes_vendor.
10549         * testsuite/testfile.cc (Target_test::test_target_info): Same.
10550
10551 2009-12-05  Doug Kwan  <dougkwan@google.com>
10552
10553         * arm.cc: Update comments about interworking and stub generation.
10554         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
10555         considered as non-PIC.
10556         (Arm_relocate_functions::base_abs): Fix formatting.
10557         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
10558         of function to use GOT entry address instead of offset.
10559         (Target_arm::Scan::global): Issue an error if a symbol would need a
10560         PLT does not get one because it is untyped.  Remove code to create
10561         dynamic symbols for relative branches.
10562         (Target_arm::Relocate::relocate: Use 0 instead of false since function
10563         takes unsigned integer instead of boolean.
10564
10565 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
10566
10567         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
10568         (two_file_test_LDADD): Likewise.
10569         (common_test_1_LDADD): Likewise.
10570         (exception_test_LDADD) Likewise.
10571         (weak_test_LDADD): Likewise.
10572         (many_sections_test_LDADD): Likewise.
10573         (initpri1_LDADD): Likewise.
10574         (script_test_1_LDADD): Likewise.
10575         (script_test_2_LDADD): Likewise.
10576         (justsyms_LDADD): Likewise.
10577         (binary_test_LDADD): Likewise.
10578         (large_LDADD): Likewise.
10579         * testsuite/Makefile.in: Regenerated.
10580
10581 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
10582
10583         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
10584         (Symbol_table::override_with_special): Likewise.
10585         (Symbol_table::add_from_object): Likewise.
10586
10587 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
10588
10589         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
10590         Don't set the data_offset twice.
10591
10592 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
10593
10594         * testsuite/Makefile.in: Regenerate.
10595
10596 2009-12-03  Doug Kwan  <dougkwan@google.com>
10597
10598         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
10599         (Target_arm::do_finalize_sections): Add parameter for symbol table
10600         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
10601         * i386.cc (Target_i386::do_finalize_sections): Add an additional
10602         parameter for symbol table pointer.
10603         * layout.cc (Layout::finalize): Call Target::finalize_sections with
10604         an additional parameter for a pointer to symbol table.
10605         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
10606         parameter for a symbol table pointer.
10607         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
10608         * target.h (Target::finalize_sections, Target::do_finalize_sections):
10609         Ditto.
10610         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
10611         parameter for a symbol table pointer.
10612
10613 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
10614
10615         * incremental.cc (Incremental_inputs_header)
10616         (Incremental_inputs_header_write, Incremental_inputs_entry)
10617         (Incremental_inputs_entry_write): Move ...
10618         * incremental.h (Incremental_inputs_header)
10619         (Incremental_inputs_header_write, Incremental_inputs_entry)
10620         (Incremental_inputs_entry_write): here.
10621
10622 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10623
10624         * incremental.cc (make_sized_incremental_binary): Set the target.
10625         Error if it is incompatible.
10626         * output.h (Output_file): Add filename method.
10627
10628 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10629
10630         * incremental.cc (Incremental_inputs_entry): Remove unused argument
10631         from the get_* methods.
10632
10633 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10634
10635         * incremental-dump.cc (main): Check that the offeset of a script is 0.
10636         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
10637         Write 0 for the data_offset of scripts.
10638
10639 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10640
10641         * testsuite/Makefile.am: Add the incremental_test.sh test.
10642         * testsuite/incremental_test.sh: New.
10643         * testsuite/incremental_test_1.c: New.
10644         * testsuite/incremental_test_2.c: New.
10645
10646 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
10647
10648         * incremental-dump.cc (main): Fix typos.
10649
10650 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
10651
10652         PR gold/11025
10653         * incremental-dump.cc (main): Use llu to print 64 bit values.
10654
10655 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
10656             H.J. Lu  <hongjiu.lu@intel.com>
10657
10658         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
10659         $(LIBDL).
10660         (incremental_dump_LDADD): Likewise.
10661         * Makefile.in: Regenerated.
10662
10663 2009-11-25  Doug Kwan  <dougkwan@google.com>
10664
10665         Revert:
10666
10667         2009-11-25  Doug Kwan  <dougkwan@google.com>
10668
10669                 * arm.cc (Target_arm::Target_arm): Move method definition
10670                 outside of class definition.  Add code to handle
10671                 --target1-rel, --target1-abs and --target2= options.
10672                 (Target_arm::get_reloc_reloc_type): Change method to be
10673                 non-static and const.
10674                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
10675                 New data member declaration.
10676                 (Target_arm::Scan::local, Target_arm::Scan::global,
10677                 Target_arm::Relocate::relocate,
10678                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10679                 Adjust call to Target_arm::get_real_reloc_type.
10680                 (Target_arm::get_real_reloc_type): Use command line options
10681                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
10682                 * options.h (--target1-rel, --target1-abs, --target2): New
10683                 ARM-only options.
10684
10685 2009-11-25  Doug Kwan  <dougkwan@google.com>
10686
10687         * arm.cc (Target_arm::Target_arm): Move method definition outside of
10688         class definition.  Add code to handle --target1-rel, --target1-abs
10689         and --target2= options.
10690         (Target_arm::get_reloc_reloc_type): Change method to be non-static
10691         and const.
10692         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
10693         member declaration.
10694         (Target_arm::Scan::local, Target_arm::Scan::global,
10695         Target_arm::Relocate::relocate,
10696         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
10697         call to Target_arm::get_real_reloc_type.
10698         (Target_arm::get_real_reloc_type): Use command line options to
10699         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
10700         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
10701         options.
10702
10703 2009-11-25  Doug Kwan  <dougkwan@google.com>
10704
10705         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
10706         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
10707         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
10708         formatting.
10709         (Arm_relocate_functions::thm_call): Replace body with a call to
10710         Arm_relocate_functions::thumb_branch_common.
10711         (Arm_relocate_functions::thm_jump24,
10712         Arm_relocate_functions::thm_xpc22): New method definitions.
10713         (Arm_relocate_functions::thumb_branch_common): New method definition.
10714         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
10715         operator.
10716         (Target_arm::Relocate::relocate): Adjust call to thm_call.
10717         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
10718
10719 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
10720
10721         * Makefile.am: Build incremental-dump
10722         * Makefile.in: Regenerate.
10723         * incremental-dump.cc: New.
10724         * incremental.cc (Incremental_inputs_header_data,
10725         Incremental_inputs_entry_data): Move to incremental.h
10726         * incremental.h: (Incremental_inputs_header_data,
10727         Incremental_inputs_entry_data): Move from incremental.cc
10728
10729 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
10730
10731         * incremental.cc (Incremental_inputs_header,
10732         Incremental_inputs_header_write, Incremental_inputs_entry,
10733         Incremental_inputs_entry_write): Add a typedef with the data type.
10734
10735 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
10736
10737         * incremental.cc (Incremental_inputs_header,
10738         Incremental_inputs_header_write, Incremental_inputs_entry,
10739         Incremental_inputs_entry_write): Update comment about which
10740         type has the filed descriptions.
10741
10742 2009-11-15  Doug Kwan  <dougkwan@google.com>
10743
10744         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
10745         (Arm_relocate_functions::arm_branch_common): Change method defintion
10746         in class definition to a method declaration and update list of formal
10747         parameters.
10748         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
10749         Arm_relocation_functions::jump24): Adjust call to
10750         Arm_relocate_functions::arm_branch_common.  Update list of formal
10751         parameters.
10752         (Arm_relocate_functions::xpc25): New method definition.
10753         (Arm_relocate_functions::arm_branch_common): Move method defintion
10754         out from class definition.  Use stubs for mode-switching and extending
10755         branch ranges.
10756         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
10757         specially.  Change code to enable use of stubs in ARM branches.
10758
10759 2009-11-10  Doug Kwan  <dougkwan@google.com>
10760
10761         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
10762         in method declaration.
10763         (Target_arm::relocate_stub): New method declaration.
10764         (Target_arm::default_target): Change to return a pointer instead of
10765         a const reference.
10766         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
10767         Target_arm::default_target.
10768         (Arm_Relobj::do_relocate_sections): Remove options paramater in
10769         method definition.
10770         (Target_arm::relocate_section): Adjust view.
10771         (Target_arm::relocate_stub): New method definition.
10772
10773 2009-11-10  Doug Kwan  <dougkwan@google.com>
10774
10775         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
10776         a format warning.
10777         * incremental.cc (open_incremental_binary): Initialized local
10778         variables to avoid warnings.
10779         * object.cc (make_elf_object): Ditto.
10780         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
10781         a format warning.
10782
10783 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
10784
10785         PR gold/10930
10786         * testsuite/plugin_test.c: Include "config.h".
10787
10788 2009-11-09  Doug Kwan  <dougkwan@google.com>
10789
10790         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
10791         (arm_symbol_value): Remove.
10792         (Arm_relocate_functions::arm_branch_common,
10793         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
10794         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
10795         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
10796         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
10797         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
10798         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
10799         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
10800         Arm_relocate_functions::thm_mobw_abs_nc,
10801         Arm_relocate_functions::thm_mov_abs,
10802         Arm_relocate_functions::movw_prel_nc,
10803         Arm_relocate_functions::thm_movt_abs,
10804         Arm_relocate_functions::movt_prel,
10805         Arm_relocate_functions::thm_movw_prel_nc,
10806         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
10807         (Target_arm::Relocate::relocate): Only decompose address into two
10808         parts if relocation type uses the thumb-bit and pass the actual
10809         bit instead of a flag indicating that the thumb-bit is used.  Adjust
10810         calls to methods in Arm_relocate_functions for this change.
10811
10812 2009-11-08  Ian Lance Taylor  <iant@google.com>
10813
10814         PR 10925
10815         * reloc.cc: Instantiate
10816         Sized_relobj::initialize_input_to_output_maps and
10817         Sized_relobj:free_input_to_output_maps.
10818
10819 2009-11-06  Ian Lance Taylor  <iant@google.com>
10820
10821         PR 10876
10822         * defstd.cc (in_segment): Set only_if_ref true for "end".
10823
10824 2009-11-06  Doug Kwan  <dougkwan@google.com>
10825
10826         * arm.cc (class Reloc_stub): Correct a comment.
10827         (Target_arm::Target_arm): Initialize arm_input_section_map_.
10828         (Target_arm::scan_section_for_stubs): New method declaration.
10829         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
10830         Change methods from private to protected.
10831         (Target_arm::do_may_relax): New method definition.
10832         (Target_arm::do_relax, Target_arm::group_sections,
10833         Target_arm::scan_reloc_for_stub,
10834         Target_arm::scan_reloc_section_for_stubs): New method declarations.
10835         (Target_arm::arm_input_section_map_): New data member declaration.
10836         (Target_arm::scan_reloc_for_stub,
10837         Target_arm::scan_reloc_section_for_stubs,
10838         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
10839         Target_arm::do_relax): New method definitions.
10840
10841 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
10842
10843         * configure.ac: Check for (struct stat)::st_mtim
10844         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
10845         * config.in: Regenerate.
10846         * configure: Regenerate.
10847
10848 2009-11-05  Ian Lance Taylor  <iant@google.com>
10849
10850         PR 10910
10851         * output.cc (Output_segment::add_output_section): Add missing
10852         return statement.
10853
10854 2009-11-04  Ian Lance Taylor  <iant@google.com>
10855
10856         PR 10880
10857         * object.h (class Object): Add is_needed and set_is_needed
10858         methods.  Add is_needed_ field.  Make bool fields into bitfields.
10859         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
10860         defined in a dynamic object and referenced by a regular object,
10861         set is_needed for the dynamic object.
10862         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
10863         if the file is marked with as_needed and it is not needed.
10864
10865 2009-11-04  Ian Lance Taylor  <iant@google.com>
10866
10867         PR 10887
10868         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
10869         tags if data is discarded by linker script.
10870         * i386.cc (Target_i386::do_finalize_sections): Likewise.
10871         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
10872         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
10873         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
10874
10875 2009-11-04  Ian Lance Taylor  <iant@google.com>
10876
10877         * layout.cc (Layout::get_output_section): Add is_interp and
10878         is_dynamic_linker_section parameters.  Change all callers.
10879         (Layout::choose_output_section): Likewise.
10880         (Layout::make_output_section): Likewise.
10881         (Layout::add_output_section_data): Add is_dynamic_linker_section
10882         parameter.  Change all callers.
10883         * layout.h (class Layout): Update declarations.
10884         * output.h (class Output_section): Add is_interp, set_is_interp,
10885         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
10886         Add is_interp_, is_dynamic_linker_section_ fields.  Change
10887         generate_code_fills_at_write_ to a bitfield.
10888         * output.cc (Output_section::Output_sections): Initialize new
10889         fields.
10890         (Output_segment::add_output_section): Add do_sort parameter.
10891         Change all callers.
10892
10893 2009-11-03  Ian Lance Taylor  <iant@google.com>
10894
10895         PR 10860
10896         * options.h (class General_options): Add --warn-common.
10897         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
10898         merging two common symbols.
10899         (Symbol_table::should_override): Handle --warn-common when merging
10900         a common symbol with a defined symbol.  Use report_resolve_problem
10901         for multiple definitions.
10902         (Symbol_table::report_resolve_problem): New function.
10903         * symtab.h (class Symbol_table): Declare report_resolve_problem.
10904
10905 2009-11-03  Doug Kwan  <dougkwan@google.com>
10906
10907         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
10908         stub_factory_.
10909         (Target_arm::stub_factory): New method definition.
10910         (Target_arm::new_arm_input_section,
10911         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
10912         Target_arm::reloc_uses_thumb_bit): New method declarations.
10913         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
10914         New type definitions.
10915         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
10916         member declarations.
10917         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
10918         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
10919         New method definitions.
10920
10921 2009-11-03  Ian Lance Taylor  <iant@google.com>
10922
10923         * options.h (class General_options): Add --warn_constructors.
10924
10925 2009-11-03  Ian Lance Taylor  <iant@google.com>
10926
10927         PR 10893
10928         * defstd.cc (in_section): Add entries for __rel_iplt_start,
10929         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
10930
10931 2009-11-03  Ian Lance Taylor  <iant@google.com>
10932
10933         PR 10895
10934         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
10935         --msgid-bugs-address.
10936         (install-pdf): New target.
10937         (install-data_yes): Look up one directory to find mkinstalldirs.
10938
10939 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
10940
10941         * po/Make-in (.po.gmo): Don't generate .gmo files in source
10942         tree.
10943
10944 2009-10-30  Doug Kwan  <dougkwan@google.com>
10945
10946         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
10947
10948 2009-10-30  Doug Kwan  <dougkwan@google.com>
10949
10950         * arm.cc (Stub_addend_reader): New struct template definition
10951         and partial specializations.
10952         (Stub_addend_reader::operator()): New method definition for a
10953         partially specialized template.
10954
10955 2009-10-30  Doug Kwan  <dougkwan@google.com>
10956
10957         * arm.cc (Arm_relobj::processor_specific_flags): New method
10958         definition.
10959         (Arm_relobj::do_read_symbols): New method declaration.
10960         (Arm_relobj::processor_specific_flags_): New data member declaration.
10961         (Arm_dynobj): New class definition.
10962         (Target_arm::do_finalize_sections): Add input_objects parameter.
10963         (Target_arm::do_adjust_elf_header): New method declaration.
10964         (Target_arm::are_eabi_versions_compatible,
10965         (Target_arm::merge_processor_specific_flags): New method declaration.
10966         (Target_arm::do_make_elf_object): New overloaded method definitions
10967         and declaration.
10968         (Arm_relobj::do_read_symbols): New method definition.
10969         (Arm_dynobj::do_read_symbols): Ditto.
10970         (Target_arm::do_finalize_sections): Add input_objects parameters.
10971         Merge processor-specific flags from all input objects.
10972         (Target_arm::are_eabi_versions_compatible,
10973         Target_arm::merge_processor_specific_flags,
10974         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
10975         New method definitions.
10976         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
10977         Input_objects pointer type parameter.
10978         * layout.cc (Layout::finalize): Pass input objects to target's.
10979         finalize_sections function.
10980         * output.cc (Output_file_header::do_sized_write): Set ELF file
10981         header's processor-specific flags.
10982         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
10983         Input_objects pointer type parameter.
10984         * sparc.cc (Target_sparc::do_finalize_sections): Same.
10985         * target.h (Input_objects): New forward class declaration.
10986         (Target::processor_specific_flags,
10987         Target::are_processor_specific_flags_sect): New method definitions.
10988         (Target::finalize_sections): Add input_objects parameter.
10989         (Target::Target): Initialize processor_specific_flags_ and
10990         are_processor_specific_flags_set_.
10991         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
10992         parameter.
10993         (Target::set_processor_specific_flags): New method definition.
10994         (Target::processor_specific_flags_,
10995         Target::are_processor_specific_flags_set_): New data member
10996         declarations.
10997         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
10998         Input_objects pointer type parameter.
10999
11000 2009-10-30  Doug Kwan  <dougkwan@google.com>
11001
11002         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
11003
11004 2009-10-28  Ian Lance Taylor  <iant@google.com>
11005
11006         * object.h (class Relobj): Drop options parameter from
11007         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
11008         do_scan_relocs, do_relocate.  Change all callers.
11009         (class Sized_relobj): Drop options parameters from
11010         do_gc_process_relocs, do_scan_relocs, do_relocate,
11011         do_relocate_sections, relocate_sections, emit_relocs_scan,
11012         emit_relocs_scan_reltype.  Change all callers.
11013         (struct Relocate_info): Remove options field and all references to
11014         it.
11015         * reloc.h (class Read_relocs): Remove options constructor
11016         parameter and options_ field.  Change all callers.
11017         (class Gc_process_relocs, class Scan_relocs): Likewise.
11018         (class Relocate_task): Likewise.
11019         * target-reloc.h (scan_relocs): Remove options parameter.  Change
11020         all callers.
11021         (scan_relocatable_relocs): Likewise.
11022         * target.h (class Sized_target): Remove options parameter from
11023         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
11024         all callers.
11025         * gc.h (gc_process_relocs): Remove options parameter.  Change all
11026         callers.
11027         * arm.cc: Update functions to remove options parameters.
11028         * i386.cc: Likewise.
11029         * powerpc.cc: Likewise.
11030         * sparc.cc: Likewise.
11031         * x86_64.cc: Likewise.
11032         * testsuite/testfile.cc: Likewise.
11033
11034 2009-10-28  Doug Kwan  <dougkwan@google.com>
11035
11036         * arm.cc (Arm_relobj): New class definition.
11037         (Arm_relobj::scan_sections_for_stubs,
11038         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
11039         New method definitions.
11040
11041 2009-10-28  Cary Coutant  <ccoutant@google.com>
11042
11043         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
11044         (Plugin::cleanup_done_): New member.
11045         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
11046         (Plugin_manager::cleanup_done_): Remove.
11047         (Plugin_manager::add_input_file): Edit error message.
11048         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
11049         (Plugin_manager::cleanup): Remove use of cleanup_done_.
11050
11051 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
11052
11053         * fileread.cc: (File_read::View::~View): Use the new
11054         data_ownership_ filed.
11055         (File_read::~File_read): Dispose the new whole_file_view_.
11056         (File_read::open): Mmap the whole file if needed.
11057         (File_read::open): Use whole_file_view_ instead of contents_.
11058         (File_read::find_view): Use whole_file_view_ if applicable.
11059         (File_read::do_read): Use whole_file_view_ instead of contents_.
11060         (File_read::make_view): Use whole_file_view_ instead of contents_,
11061         update File_read::View::View call.
11062         (File_read::find_or_make_view): Update File_read::View::View
11063         call.
11064         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
11065         remove contents_
11066         (File_read::View::Data_ownership): New enum.
11067         (File_read::View::View): Replace bool mapped_ with Data_ownership
11068         argument.
11069         (File_read::View::mapped_): Remove (replaced by data_ownership_).
11070         (File_read::View::data_ownership_): New field.
11071         (File_read::contents_): Remove (replaced by whole_file_view_).
11072         (File_read::whole_file_view_): New field.
11073         * options.h (class General_options): Add --keep-files-mapped.
11074
11075 2009-10-27  Cary Coutant  <ccoutant@google.com>
11076
11077         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
11078         * testsuite/Makefile.am (plugin_test_5): New test case.
11079         * testsuite/Makefile.in: Regenerate.
11080
11081 2009-10-25  Doug Kwan  <dougkwan@google.com>
11082
11083         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
11084         from private to protected to allow access by child class.
11085         (Sized_relobj::do_relocate_sections): New method declaration.
11086         (Sized_relobj::relocate_sections): Virtualize.
11087         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
11088         Sized_relobj::relocate_sections.  Instantiate template explicitly
11089         for different target sizes and endianity.
11090
11091 2009-10-24  Doug Kwan  <dougkwan@google.com>
11092
11093         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
11094         (Arm_input_section::as_arm_input_section): New method.
11095         (Arm_output_section): New class definition.
11096         (Arm_output_section::create_stub_group,
11097         Arm_output_section::group_sections): New method definitions.
11098
11099 2009-10-22  Doug Kwan  <dougkwan@google.com>
11100
11101         * arm.cc (Arm_input_section): New class definition.
11102         (Arm_input_section::init, Arm_input_section:do_write,
11103         Arm_input_section::set_final_data_size,
11104         Arm_input_section::do_reset_address_and_file_offset): New method
11105         definitions.
11106
11107 2009-10-21  Doug Kwan  <dougkwan@google.com>
11108
11109         * arm.cc (Stub_table, Arm_input_section): New forward class
11110         declarations.
11111         (Stub_table): New class defintion.
11112         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
11113         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
11114         New method definition.
11115
11116 2009-10-21  Doug Kwan  <dougkwan@google.com>
11117
11118         * arm.cc: Update copyright comments.
11119         (Target_arm): New forward class template declaration.
11120         (Arm_address): New type.
11121         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
11122         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
11123         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
11124         constants.
11125         (Insn_template): Same.
11126         (DEF_STUBS): New macro.
11127         (Stub_type): New enum type.
11128         (Stub_template): New class definition.
11129         (Stub): Same.
11130         (Reloc_stub): Same.
11131         (Stub_factory): Same.
11132         (Target_arm::Target_arm): Initialize may_use_blx_ and
11133         should_force_pic_veneer_.
11134         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
11135         Target_arm::should_force_pic_veneer,
11136         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
11137         Target_arm::using_thumb_only, Target_arm:;default_target): New
11138         method defintions.
11139         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
11140         New data member declarations.
11141         (Insn_template::size, Insn_template::alignment): New method defintions.
11142         (Stub_template::Stub_template): New method definition.
11143         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
11144         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
11145         (Stub_factory::Stub_factory): New method definition.
11146         * gold.h (string_hash): New template.
11147         * output.h (Input_section_specifier::hash_value): Use
11148         gold::string_hash.
11149         (Input_section_specifier::string_hash): Remove.
11150         * stringpool.cc (Stringpool_template::string_hash): Use
11151         gold::string_hash.
11152
11153 2009-10-20  Doug Kwan  <dougkwan@google.com>
11154
11155         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
11156         symbols of relaxed input sections.
11157         * output.h (Output_section::find_relaxed_input_section): Make
11158         method public.
11159
11160 2009-10-16  Doug Kwan  <dougkwan@google.com>
11161
11162         * dynobj.cc (Versions::Versions): Initialize version_script_.
11163         Only insert base version symbol definition for a shared object
11164         if version script defines any version versions.
11165         (Versions::define_base_version): New method definition.
11166         (Versions::add_def): Check that base version is not needed.
11167         (Versions::add_need): Define base version lazily.
11168         * dynobj.h (Versions::define_base_version): New method declaration.
11169         (Versions::needs_base_version_): New data member declaration.
11170         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
11171         (check_DATA): Add no_version_test.stdout.
11172         (libno_version_test.so, no_version_test.o no_version_test.stdout):
11173         New make rules.
11174         * testsuite/Makefile.in: Regenerate.
11175         * testsuite/no_version_test.c: New file.
11176         * testsuite/no_version_test.sh: Ditto.
11177
11178 2009-10-16  Doug Kwan  <dougkwan@google.com>
11179
11180         * expression.cc (class Segment_start_expression): New class definition.
11181         (Segment_start_expression::value): New method definition.
11182         (script_exp_function_segment_start): Return a new
11183         Segment_start_expression.
11184         * gold/script-c.h (script_saw_segment_start_expression): New function
11185         prototype.
11186         * script-sections.cc (Script_sections::Script_sections): Initialize
11187         SAW_SEGMENT_START_EXPRESSION_ to false.
11188         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
11189         and -Tbbs options to specify section addresses if given in
11190         command line and no SEGMENT_START expression is seen in a script.
11191         * script-sections.h (Script_sections::saw_segment_start_expression,
11192         Script_sections::set_saw_segment_start_expression): New method
11193         definition.
11194         (Script_sections::saw_segment_start_expression_): New data member
11195         declaration.
11196         * script.cc (script_saw_segment_start_expression): New function.
11197         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
11198         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
11199         script_test_7.sh and script_test_8.sh.
11200         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
11201         script_test_8.stdout.
11202         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
11203         (script_test_6, script_test_6.stdout, script_test_7,
11204         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
11205         * Makefile.in: Regenerate.
11206         * testsuite/script_test_6.sh: New file.
11207         * testsuite/script_test_6.t: Same.
11208         * testsuite/script_test_7.sh: Same.
11209         * testsuite/script_test_7.t: Same.
11210         * testsuite/script_test_8.sh: Same.
11211
11212 2009-10-16  Doug Kwan  <dougkwan@google.com>
11213
11214         * output.cc (Output_segment::set_section_list_address): Cast
11215         expressions to unsigned long long type to avoid format warnings.
11216
11217 2009-10-15  Ian Lance Taylor  <iant@google.com>
11218
11219         * script.cc (Script_options::add_symbol_assignment): Always add a
11220         dot assignment to script_sections_.
11221         * script-sections.cc (Script_sections::add_dot_assignment):
11222         Initialize if necessary.
11223
11224         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
11225         program headers with no load segment if there is a linker script.
11226
11227         * layout.cc (Layout::set_segment_offsets): Align the file offset
11228         to the segment aligment for -N or -n with no load segment.
11229         * output.cc (Output_segment::add_output_section): Don't crash if
11230         the first section is a TLS section.
11231         (Output_segment::set_section_list_addresses): Print an error
11232         message if the address moves backward in a linker script.
11233         * script-sections.cc
11234         (Output_section_element_input::set_section_addresses): Don't
11235         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
11236         (Orphan_output_section::set_section_addresses): Likewise.
11237
11238 2009-10-15  Doug Kwan  <dougkwan@google.com>
11239
11240         * layout.cc (Layout::finish_dynamic_section): Generate tags
11241         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
11242         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
11243         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
11244
11245 2009-10-14  Ian Lance Taylor  <iant@google.com>
11246
11247         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
11248         fields.
11249         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
11250         data_shdr fields of relinfo.
11251         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
11252         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
11253         R_386_TLS_LDO_32, adjust based on section flags.
11254         (Target_i386::Relocate::fix_up_ldo): Remove.
11255
11256 2009-10-13  Ian Lance Taylor  <iant@google.com>
11257
11258         Add support for -pie.
11259         * options.h (class General_options): Add -pie and
11260         --pic-executable.
11261         (General_options::output_is_position_independent): Test -pie.
11262         (General_options::output_is_executable): Return true if not shared
11263         and not relocatable.
11264         (General_options::output_is_pie): Remove.
11265         * options.cc (General_options::finalize): Reject incompatible uses
11266         of -pie.
11267         * gold.cc (queue_middle_tasks): A -pie link is not static.
11268         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
11269         * symtab.cc (Symbol::final_value_is_known): Return false if
11270         output_is_position_independent.
11271         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
11272         output_is_position_independent.
11273         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
11274         output_is_position_independent.
11275         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
11276         output_is_position_independent.
11277         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
11278         two_file_pie_test.
11279         (basic_pie_test.o, basic_pie_test): New targets.
11280         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
11281         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
11282         (two_file_pie_test): New target.
11283         * testsuite/Makefile.in: Rebuild.
11284         * README: Remove note saying that -pie is not supported.
11285
11286 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
11287
11288         * options.h (class General_options): Add -init and -fini.
11289         * layout.cc (Layout::finish_dynamic_section): Emit
11290         given init and fini functions.
11291
11292 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
11293
11294         * gc.h (gc_process_relocs): Check if icf is enabled using new
11295         function.
11296         * gold.cc (queue_initial_tasks): Likewise.
11297         (queue_middle_tasks): Likewise.
11298         * object.cc (do_layout): Likewise.
11299         * symtab.cc (is_section_folded): Likewise.
11300         * main.cc (main): Likewise.
11301         * reloc.cc (Read_relocs::run): Likewise.
11302         (Sized_relobj::do_scan_relocs): Likewise.
11303         * icf.cc (is_function_ctor_or_dtor): New function.
11304         (Icf::find_identical_sections): Check if function is ctor or dtor when
11305         safe icf is chosen.
11306         * options.h (General_options::icf): Change option to be an enum.
11307         (Icf_status): New enum.
11308         (icf_enabled): New method.
11309         (icf_safe_folding): New method.
11310         (set_icf_status): New method.
11311         (icf_status_): New variable.
11312         * (options.cc) (General_options::finalize): Set icf_status_.
11313         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
11314         icf_test and icf_keep_unique_test to use the --icf enum flag.
11315         * testsuite/icf_safe_test.sh: New file.
11316         * testsuite/icf_safe_test.cc: New file.
11317
11318 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
11319
11320         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
11321         includes to gc.h and icf.h.
11322         * arm.cc: Include gc.h.
11323         * gold.cc: Likewise.
11324         * i386.cc: Likewise.
11325         * powerpc.cc: Likewise.
11326         * sparc.cc: Likewise.
11327         * x86_64.cc: Likewise.
11328         * gc.h: Include icf.h.
11329
11330 2009-10-11  Ian Lance Taylor  <iant@google.com>
11331
11332         * plugin.cc: Include "gold.h" before other header files.
11333
11334 2009-10-10  Chris Demetriou  <cgd@google.com>
11335
11336         * options.h (Input_file_argument::Input_file_type): New enum.
11337         (Input_file_argument::is_lib_): Replace with...
11338         (Input_file_argument::type_): New member.
11339         (Input_file_argument::Input_file_argument): Take Input_file_type
11340         'type' rather than boolean 'is_lib' as second argument.
11341         (Input_file_argument::is_lib): Use type_.
11342         (Input_file_argument::is_searched_file): New function.
11343         (Input_file_argument::may_need_search): Handle is_searched_file.
11344         * options.cc (General_options::parse_library): Support -l:filename.
11345         (General_options::parse_just_symbols): Update for Input_file_argument
11346         changes.
11347         (Command_line::process): Likewise.
11348         * archive.cc (Archive::get_file_and_offset): Likewise.
11349         * plugin.cc (Plugin_manager::release_input_file): Likewise.
11350         * script.cc (read_script_file, script_add_file): Likewise.
11351         * fileread.cc (Input_file::Input_file): Likewise.
11352         (Input_file::will_search_for): Handle is_searched_file.
11353         (Input_file::open): Likewise.
11354         * readsyms.cc (Read_symbols::get_name): Likewise.
11355         * testsuite/Makefile.am (searched_file_test): New test.
11356         * testsuite/Makefile.in: Regenerate.
11357         * testsuite/searched_file_test.cc: New file.
11358         * testsuite/searched_file_test_lib.cc: New file.
11359
11360 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11361             Ian Lance Taylor  <iant@google.com>
11362
11363         * descriptor.cc: Include <cstdio> and "binary-io.h".
11364         (Descriptors::open): Open the files in binary mode always.
11365         * script.cc (Lex::get_token): Treat \r as whitespace.
11366
11367 2009-10-09  Ian Lance Taylor  <iant@google.com>
11368
11369         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
11370
11371 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11372             Ian Lance Taylor  <iant@google.com>
11373
11374         * configure.ac: Check for readv function also.
11375         * fileread.cc (readv): Define if not HAVE_READV.
11376         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
11377         does not exist.
11378         * config.in: Regenerate.
11379         * configure: Regenerate.
11380
11381 2009-10-09  Doug Kwan  <dougkwan@google.com>
11382
11383         * layout.cc (Layout::make_output_section): Call target hook to make
11384         ordinary output section.
11385         (Layout::finalize): Adjust parameter list of call the
11386         Target::may_relax().
11387         * layout.h (class Layout::section_list): New method.
11388         * merge.h (Output_merge_base::entsize): Change visibility to public.
11389         (Output_merge_base::is_string, Output_merge_base::do_is_string):
11390         New methods.
11391         (Output_merge_string::do_is_string): New method.
11392         * object.cc (Sized_relobj::do_setup): renamed from
11393         Sized_relobj::set_up.
11394         * object.h (Sized_relobj::adjust_shndx,
11395         Sized_relobj::initializ_input_to_output_maps,
11396         Sized_relobj::free_input_to_output_maps): Change visibilities to
11397         protected.
11398         (Sized_relobj::setup): Virtualize.
11399         (Sized_relobj::do_setup): New method declaration.
11400         (Sized_relobj::invalidate_section_offset,
11401         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
11402         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
11403         * options.cc (parse_int): New function.
11404         * options.h (parse_int): New declaration.
11405         (DEFINE_int): New macro.
11406         (stub_group_size): New option.
11407         * output.cc (Output_section::Output_section): Initialize memebers
11408         merge_section_map_, merge_section_by_properties_map_,
11409         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
11410         (Output_section::add_input_section): Handled deferred code-fill
11411         generation and remove an old comment.
11412         (Output_section::add_relaxed_input_section): New method definition.
11413         (Output_section::add_merge_input_section): Use merge section by
11414         properties map to speed to search.  Update merge section maps
11415         as appropriate.
11416         (Output_section::build_relaxation_map): New method definition.
11417         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
11418         Same.
11419         (Output_section::relax_input_section): Renamed to
11420         Output_section::convert_input_sections_to_relaxed_sections and change
11421         interface to take a vector of pointers to relaxed sections.
11422         (Output_section::find_merge_section,
11423         Output_section::find_relaxed_input_section): New method definitions.
11424         (Output_section::is_input_address_mapped,
11425         Output_section::output_offset, Output_section::output_address):
11426         Use output section data maps to speed up searching.
11427         (Output_section::find_starting_output_address): Add comments.
11428         (Output_section::do_write,
11429         Output_section::write_to_postprocessing_buffer): Do code-fill
11430         generation as appropriate.
11431         (Output_section::get_input_sections): Invalidate relaxed input section
11432         map.
11433         (Output_section::restore_states): Adjust type of checkpoint .
11434         Invalidate relaxed input section map.
11435         * output.h (Output_merge_base): New class declaration.
11436         (Input_section_specifier): New class defintion.
11437         (class Output_relaxed_input_section) Change base class to
11438         Output_section_data_build.
11439         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
11440         base class initializer.
11441         (Output_section::add_relaxed_input_section): New method declaration.
11442         (Output_section::Input_section): Change visibility to protected.
11443         (Output_section::Input_section::relobj,
11444         Output_section::Input_section::shndx): Handle relaxed input sections.
11445         Output_section::input_sections) Change visibility to protected.  Also
11446         define overload to return a non-const pointer.
11447         (Output_section::Merge_section_properties): New class defintion.
11448         (Output_section::Merge_section_by_properties_map,
11449         Output_section::Output_section_data_by_input_section_map,
11450         Output_section::Relaxation_map): New types.
11451         (Output_section::relax_input_section): Rename method to
11452         Output_section::convert_input_sections_to_relaxed_sections and change
11453         interface to take a vector of relaxed section pointers.
11454         (Output_section::find_merge_section,
11455         Output_section::find_relaxed_input_section,
11456         Output_section::build_relaxation_map,
11457         Output_section::convert_input_sections_in_list_to_relaxed_sections):
11458         New method declarations.
11459         (Output_section::merge_section_map_
11460         Output_section::merge_section_by_properties_map_,
11461         Output_section::relaxed_input_section_map_,
11462         Output_section::is_relaxed_input_section_map_valid_,
11463         Output_section::generate_code_fills_at_write_): New data members.
11464         * script-sections.cc
11465         (Output_section_element_input::set_section_addresses): Call
11466         current_data_size and addralign methods of relaxed input sections.
11467         (Orphan_output_section::set_section_addresses): Call current_data_size
11468         and addralign methods of relaxed input sections.
11469         * symtab.cc (Symbol_table::compute_final_value): Extract template
11470         from the body of Symbol_table::sized_finalize_symbol.
11471         (Symbol_table::sized_finalized_symbol): Call
11472         Symbol_table::compute_final_value.
11473         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
11474         (Symbol_table::compute_final_value): New templated method declaration.
11475         * target.cc (Target::do_make_output_section): New method defintion.
11476         * target.h (Target::make_output_section): New method declaration.
11477         (Target::relax): Add more parameters for input objects, symbol table
11478         and layout.  Adjust call to do_relax.
11479         (Target::do_make_output_section): New method declaration.
11480         (Target::do_relax): Add parameters for input objects, symbol table
11481         and layout.
11482
11483 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11484
11485         * pread.c: Include stdio.h.
11486
11487 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11488
11489         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
11490         defined.
11491
11492 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11493
11494         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
11495         Change read_shndx type to unsigned int.
11496         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
11497         int.
11498         (Sized_dwarf_line_info::read_line_mappings): Likewise.
11499         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
11500         Change read_shndx type to unsigned int.
11501         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
11502         int.
11503         (Sized_dwarf_line_info::read_line_mappings): Likewise.
11504         * layout.cc (Layout::create_symtab_sections): Cast the result of
11505         local_symcount * symsize to off_t in the gold_assert.
11506
11507 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11508
11509         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
11510         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
11511         R_ARM_BASE_ABS.
11512         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
11513         (Arm_relocate_functions::thm_abs5): New function.
11514         (Arm_relocate_functions::abs12): New function.
11515         (Arm_relocate_functions::abs16): New function.
11516         (Arm_relocate_functions::base_abs): New function.
11517         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
11518         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
11519         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
11520         R_ARM_BASE_ABS.
11521         (Scan::global): Likewise.
11522         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
11523         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
11524         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
11525         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
11526         R_ARM_BASE_ABS.
11527
11528 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11529
11530         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
11531         (Arm_relocate_functions::movt_prel): New function.
11532         (Arm_relocate_functions::thm_movw_prel_nc): New function.
11533         (Arm_relocate_functions::thm_movt_prel): New function.
11534         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
11535         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
11536         (Scan::global, Relocate::relocate): Likewise.
11537         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11538
11539 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
11540
11541         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
11542         Incremental_checker.
11543         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
11544         unsigned int.
11545         (class Incremental_inputs_header): New class.
11546         (Incremental_inputs_header_writer): Edit comment.
11547         (Incremental_inputs_entry): New class.
11548         (Incremental_inputs_entry_writer): Edit comment.
11549         (Sized_incremental_binary::do_find_incremental_inputs_section):
11550         Add *strtab_shndx parameter, fill it.
11551         (Sized_incremental_binary::do_check_inputs): New method.
11552         (Incremental_checker::can_incrementally_link_output_file): Use
11553         Sized_incremental_binary::check_inputs.
11554         (Incremental_inputs::report_command_line): Save command line in
11555         command_line_.
11556         * incremental.h:
11557         (Incremental_binary::find_incremental_inputs_section): New
11558         method.
11559         (Incremental_binary::do_find_incremental_inputs_section): Add
11560         strtab_shndx parameter.
11561         (Incremental_binary::do_check_inputs): New pure virtual method.
11562         (Sized_incremental_binary::do_check_inputs): Declare.
11563         (Incremental_checker::Incremental_checker): Add incremental_inputs
11564         parameter, use it to initialize incremental_inputs_.
11565         (Incremental_checker::incremental_inputs_): New field.
11566         (Incremental_checker::command_line): New method.
11567         (Incremental_checker::inputs): New method.
11568         (Incremental_checker::command_line_): New field.
11569
11570 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
11571
11572         * incremental.cc: Include <cstdarg> and "target-select.h".
11573         (vexplain_no_incremental): New function.
11574         (explain_no_incremental): New function.
11575         (Incremental_binary::error): New method.
11576         (Sized_incremental_binary::do_find_incremental_inputs_section): New
11577         method.
11578         (make_sized_incremental_binary): New function.
11579         (open_incremental_binary): New function.
11580         (can_incrementally_link_file): Add checks if output is ELF and has
11581         inputs section.
11582         * incremental.h: Include "elfcpp_file.h" and "output.h".
11583         (Incremental_binary): New class.
11584         (Sized_incremental_binary): New class.
11585         (open_incremental_binary): Declare.
11586         * object.cc (is_elf_object): Use
11587         elfcpp::Elf_recognizer::is_elf_file.
11588         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
11589         * output.h (Output_file::filesize): New method.
11590
11591 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11592
11593         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
11594         New function.
11595         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
11596         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
11597         function.
11598         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
11599         function.
11600         (Arm_relocate_functions::movw_abs_nc): New function.
11601         (Arm_relocate_functions::movt_abs): New function.
11602         (Arm_relocate_functions::thm_movw_abs_nc): New function.
11603         (Arm_relocate_functions::thm_movt_abs): New function.
11604         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
11605         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
11606         (Scan::global): Likewise.
11607         (Relocate::relocate): Likewise.
11608         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11609
11610 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11611
11612         * arm.cc (Arm_relocate_functions::got_prel) New function.
11613         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
11614         (Relocate::relocate): Likewise.
11615         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11616
11617 2009-10-06  Ian Lance Taylor  <iant@google.com>
11618
11619         * options.h (class General_options): Define
11620         split_stack_adjust_size parameter.
11621         * object.h (class Object): Add uses_split_stack_ and
11622         has_no_split_stack_ fields.  Add uses_split_stack and
11623         has_no_split_stack accessor functions.  Declare
11624         handle_split_stack_section.
11625         (class Reloc_symbol_changes): Define.
11626         (class Sized_relobj): Define Function_offsets.  Declare
11627         split_stack_adjust, split_stack_adjust_reltype, and
11628         find_functions.
11629         * object.cc (Object::handle_split_stack_section): New function.
11630         (Sized_relobj::do_layout): Call handle_split_stack_section.
11631         * dynobj.cc (Sized_dynobj::do_layout): Call
11632         handle_split_stack_section.
11633         * reloc.cc (Sized_relobj::relocate_sections): Call
11634         split_stack_adjust for executable sections in split_stack
11635         objects.  Pass reloc_map to relocate_section.
11636         (Sized_relobj::split_stack_adjust): New function.
11637         (Sized_relobj::split_stack_adjust_reltype): New function.
11638         (Sized_relobj::find_functions): New function.
11639         * target-reloc.h: Include "object.h".
11640         (relocate_section): Add reloc_symbol_changes parameter.  Change
11641         all callers.
11642         * target.h (class Target): Add calls_non_split method.  Declare
11643         do_calls_non_split virtual method.  Declare match_view and
11644         set_view_to_nop.
11645         * target.cc: Include "elfcpp.h".
11646         (Target::do_calls_non_split): New function.
11647         (Target::match_view): New function.
11648         (Target::set_view_to_nop): New function.
11649         * gold.cc (queue_middle_tasks): Give an error if mixing
11650         split-stack and non-split-stack objects with -r.
11651         * i386.cc (Target_i386::relocate_section): Add
11652         reloc_symbol_changes parameter.
11653         (Target_i386::do_calls_non_split): New function.
11654         * x86_64.cc (Target_x86_64::relocate_section): Add
11655         reloc_symbol_changes parameter.
11656         (Target_x86_64::do_calls_non_split): New function.
11657         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
11658         parameter.
11659         * powerpc.cc (Target_powerpc::relocate_section): Add
11660         reloc_symbol_changes parameter.
11661         * sparc.cc (Target_sparc::relocate_section): Add
11662         reloc_symbol_changes parameter.
11663         * configure.ac: Call AM_CONDITIONAL for the default target.
11664         * configure: Rebuild.
11665         * testsuite/Makefile.am (TEST_AS): New variable.
11666         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
11667         (check_DATA): Add split_i386 and split_x86_64 files.
11668         (SPLIT_DEFSYMS): Define.
11669         (split_i386_[1234n].o): New targets.
11670         (split_i386_[124]): New targets.
11671         (split_i386_[1234r].stdout): New targets.
11672         (split_x86_64_[1234n].o): New targets.
11673         (split_x86_64_[124]): New targets.
11674         (split_x86_64_[1234r].stdout): New targets.
11675         (MOSTLYCLEANFILES): Add new executables.
11676         * testsuite/split_i386.sh: New file.
11677         * testsuite/split_x86_64.sh: New file.
11678         * testsuite/split_i386_1.s: New file.
11679         * testsuite/split_i386_2.s: New file.
11680         * testsuite/split_i386_3.s: New file.
11681         * testsuite/split_i386_4.s: New file.
11682         * testsuite/split_i386_n.s: New file.
11683         * testsuite/split_x86_64_1.s: New file.
11684         * testsuite/split_x86_64_2.s: New file.
11685         * testsuite/split_x86_64_3.s: New file.
11686         * testsuite/split_x86_64_4.s: New file.
11687         * testsuite/split_x86_64_n.s: New file.
11688         * testsuite/testfile.cc (Target_test): Update relocation_section
11689         function.
11690         * testsuite/Makefile.in: Rebuild.
11691
11692 2009-10-06  Ian Lance Taylor  <iant@google.com>
11693
11694         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
11695         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
11696         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
11697         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
11698         the address on ldo_addrs_.
11699         (Target_i386::Relocate::fix_up_ldo): New function.
11700
11701 2009-10-06   Rafael Espindola  <espindola@google.com>
11702
11703         * plugin.cc (add_input_library): New.
11704         (Plugin::load): Add add_input_library to tv.
11705         (Plugin_manager::add_input_file): Add the is_lib argument.
11706         (add_input_file): Update call to Plugin_manager::add_input_file.
11707         (add_input_library): New.
11708         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
11709
11710 2009-09-30  Doug Kwan  <dougkwan@google.com>
11711
11712         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
11713         symbol and call Symbol::may_need_copy_reloc to determine if
11714         a copy reloc is needed.
11715         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
11716         nocopyreloc is given in command line.
11717         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
11718         given in command line.
11719         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
11720         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
11721         of the removed Target_i386::may_need_copy_reloc.
11722         * options.h (copyreloc): New option with default value false.
11723         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
11724         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
11725         instead of the removed Target_powerpc::may_need_copy_reloc.
11726         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
11727         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
11728         instead of the removed Target_sparc::may_need_copy_reloc.
11729         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
11730         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
11731         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
11732         instead of the removed Target_x86_64::may_need_copy_reloc.
11733
11734 2009-09-30  Ian Lance Taylor  <iant@google.com>
11735
11736         * object.h (class Object): Remove target_ field, and target,
11737         sized_target, and set_target methods.
11738         (Object::sized_target): Remove.
11739         (class Sized_relobj): Update declarations.  Remove sized_target.
11740         * object.cc (Sized_relobj::setup): Remove target parameter.
11741         Change all callers.
11742         (Input_objects::add_object): Don't do anything with the target.
11743         (make_elf_sized_object): Add punconfigured parameter.  Change all
11744         callers.  Set or test parameter target.
11745         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
11746         Change all callers.
11747         * parameters.cc (Parameters::set_target): Change parameter type to
11748         be non-const.
11749         (Parameters::default_target): Remove.
11750         (set_parameters_target): Change parameter type to be non-const.
11751         (parameters_force_valid_target): New function.
11752         (parameters_clear_target): New function.
11753         * parameters.h (class Parameters): Update declarations.  Remove
11754         default_target method.  Add sized_target and clear_target
11755         methods.  Change target_ to be non-const.
11756         (set_parameters_target): Update declaration.
11757         (parameters_force_valid_target): Declare.
11758         (parameters_clear_target): Declare.
11759         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
11760         as NULL if we aren't searching.
11761         (Add_symbols::run): Don't check for compatible target.
11762         * fileread.cc (Input_file::open_binary): Call
11763         parameters_force_valid_target.
11764         * gold.cc (queue_middle_tasks): Likewise.
11765         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
11766         set_target on object.
11767         * dynobj.h (class Sized_dynobj): Update declarations.
11768         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
11769         make_elf_object returns NULL.
11770         (Archive::include_member): Don't check whether object target is
11771         compatible.
11772         * output.cc (Output_section::add_input_section): Get target from
11773         parameters.
11774         (Output_section::relax_input_section): Likewise.
11775         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
11776         parameters.
11777         (Sized_relobj::do_scan_relocs): Likewise.
11778         (Sized_relobj::relocate_sections): Likewise.
11779         * resolve.cc (Symbol_table::resolve): Likewise.
11780         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
11781         parameter.  Change all callers.
11782         (Symbol_table::add_from_object): Get target from parameters.
11783         (Symbol_table::add_from_relobj): Don't check object target.
11784         (Symbol_table::add_from_dynobj): Likewise.
11785         (Symbol_table::define_special_symbol): Get target from
11786         parameters.
11787         * symtab.h (class Symbol_table): Update declaration.
11788         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
11789         parameter.  Change all callers.  Clear parameter target.
11790         (Binary_test): Test target here.
11791         * testsuite/object_unittest.cc (gold_testsuite): Remove
11792         target_test_pointer parameter.  Change all callers.
11793         (Object_test): Test target here.
11794
11795 2009-09-26  Ian Lance Taylor  <iant@google.com>
11796
11797         * testsuite/initpri1.c: Don't try to use constructor priorities if
11798         compiling with gcc before 4.3.
11799
11800 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
11801
11802         * testsuite/retain_symbols_file_test.sh (check_present): Change
11803         output file name to retain_symbols_file_test.stdout.
11804         (check_absent): Likewise.
11805
11806 2009-09-18  Craig Silverstein  <csilvers@google.com>
11807
11808         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
11809         * options.cc: Include <cerrno> and <fstream>.
11810         (General_options::finalize): Parse -retain-symbols-file tag.
11811         * options.h: New flag.
11812         (General_options): New method should_retain_symbol, new
11813         variable symbols_to_retain.
11814         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
11815         should_retain_symbol map.
11816         * testsuite/Makefile.am (retain_symbols_file_test): New test.
11817         * testsuite/Makefile.in: Regenerate.
11818         * testsuite/retain_symbols_file_test.sh: New file.
11819
11820 2009-09-18  Nick Clifton  <nickc@redhat.com>
11821
11822         * po/es.po: Updated Spanish translation.
11823
11824 2009-09-17  Doug Kwan  <dougkwan@google.com>
11825
11826         * debug.h (DEBUG_RELAXATION): New constant.
11827         (DEBUG_ALL): Add DEBUG_RELAXATION.
11828         (debug_string_to_enum): Add relaxation debug option.
11829         * layout.cc
11830         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
11831         Layout::Relaxation_debug_check::read_sections,
11832         Layout::Relaxation_debug_check::read_sections): New method definitions.
11833         (Layout::Layout): Initialize data members
11834         record_output_section_data_from_scrips_,
11835         script_output_section_data_list_ and relaxation_debug_check_.
11836         (Layout::save_segments, Layout::restore_segments,
11837         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
11838         Layout::relaxation_loop_body): New method definitions.
11839         (Layout::finalize): Support relaxation.  Move section layout code to
11840         Layout::relaxation_loop_body.
11841         (Layout::set_asection_address_from_script): Move code for orphan
11842         section placement out.
11843         (Layout::place_orphan_sections_in_script): New method definition.
11844         * layout.h (Output_segment_headers, Output_file_header):
11845         New forward class declarations.
11846         (Layout::~Layout): Define.
11847         (Layout::new_output_section_data_from_script): New method definition.
11848         (Layout::place_orphan_sections_in_script): New method declaration.
11849         (Layout::Segment_states): New type declaration.
11850         (Layout::save_segments, Layout::restore_segments,
11851         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
11852         Layout::relaxation_loop_body): New method declarations.
11853         (Layout::Output_section_data_list): New type declaration.
11854         (Layout::Relaxation_debug_check): New class definition.
11855         (Layout::record_output_section_data_from_script_,
11856         Layout::script_output_section_data_list_, Layout::segment_states_,
11857         Layout::relaxation_debug_check_): New data members.
11858         * output.cc: (Output_section_headers::do_size): New method definition.
11859         (Output_section_headers::Output_section_headers): Move size
11860         computation to Output_section_headers::do_size.
11861         (Output_segment_headers::do_size): New method definition.
11862         (Output_file_header::Output_file_header): Move size computation to
11863         Output_file_header::do_size and call it.
11864         (Output_file_header::do_size): New method definition.
11865         (Output_data_group::Output_data_group): Adjust call to
11866         Output_section_data.
11867         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
11868         (Output_symtab_xindex::do_write): Add array bound check.
11869         (Output_section::Input_section::print_to_mapfile): Handle
11870         RELAXED_INPUT_SECTION_CODE.
11871         (Output_section::Output_section): Initialize data member checkpoint_.
11872         (Output_section::~Output_section): Delete checkpoint object pointed
11873         by checkpoint_.
11874         (Output_section::add_input_section): Always add an Input_section if
11875         relaxing.
11876         (Output_section::add_merge_input_section): Add assert.
11877         (Output_section::relax_input_section): New method definition.
11878         (Output_section::set_final_data_size): Set load address to zero for
11879         an unallocated section.
11880         (Output_section::do_address_and_file_offset_have_reset_values):
11881         New method definition.
11882         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
11883         Handle relaxed input section.
11884         (Output_section::sort_attached_input_sections): Checkpoint input
11885         section list lazily.
11886         (Output_section::get_input_sections): Change type of input_sections to
11887         list of Simple_input_section pointers.  Checkpoint input section list
11888         lazily.  Also handle relaxed input sections.
11889         (Output_section::add_input_section_for_script): Take a reference to
11890         a Simple_input_section object instead of Relobj pointer and section
11891         index as parameter.  Handle relaxed input sections.
11892         (Output_section::save_states, Output_section::restore_states): New
11893         method definitions.
11894         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
11895         (Output_data::is_data_size_fixed): New method definition.
11896         (Output_data::reset_addresss_and_file_offset): Do not reset data size
11897         if it is fixed.
11898         (Output_data::address_and_file_offset_have_reset_values): New method
11899         definition.
11900         (Output_data::do_address_and_file_offset_have_reset_values): New method
11901         definition.
11902         (Output_data::set_data_size): Check that data size is not fixed.
11903         (Output_data::fix_data_size): New method definition.
11904         (Output_data::is_data_size_fixed_): New data member.
11905         (Output_section_headers::set_final_data_size): New method definition.
11906         (Output_section_headers::do_size): New method declaration.
11907         (Output_segment_headers::set_final_data_size): New method definition.
11908         (Output_segment_headers::do_size): New method declaration.
11909         (Output_file_header::set_final_data_size)::New method definition.
11910         (Output_file_header::do_size)::New method declaration.
11911         (Output_section_data::Output_section_data): Add new parameter
11912         is_data_size_fixed and use it to fix data size.
11913         (Output_data_const::Output_data_const): Adjust call to base class
11914         constructor and fix data size.
11915         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
11916         base class constructor and fix data size.
11917         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
11918         base class constructor and fix data size.
11919         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
11920         class constructor and fix data size.
11921         (Output_data_group::set_final_data_size): New method definition.
11922         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
11923         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
11924         class constructor and fix data size.
11925         (Output_relaxed_input_section): New class definition.
11926         (Output_section::Simple_input_section): New class definition.
11927         (Output_section::get_input_sections): Adjust parameter list.
11928         (Output_section::add_input_section_for_script): Same.
11929         (Output_section::save_states, Output_section::restore_states,
11930         Output_section::do_address_and_file_offset_have_reset_values,
11931         (Output_section::Input_section::Input_section): Handle
11932         RELAXED_INPUT_SECTION_CODE.  Add new overload for
11933         Output_relaxed_input_section.
11934         (Output_section::Input_section::is_input_section,
11935         Output_section::Input_section::set_output_section): Handle relaxed
11936         input section.
11937         (Output_section::Input_section::is_relaxed_input_section,
11938         Output_section::Input_section::output_section_data,
11939         Output_section::Input_section::relaxed_input_section): New method
11940         definitions.
11941         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
11942         value.
11943         (Output_section::Input_section::u1_): Update comments.
11944         (Output_section::Input_section::u2_): Add new union member poris.
11945         (Output_section::Checkpoint_output_section): New classs definition.
11946         (Output_section::relax_input_section): New method declaration.
11947         (Output_section::checkpoint_): New data member.
11948         (Output_segment): Update comments.
11949         (Output_segment::Output_segment): Un-privatize copy constructor.
11950         (Output_segment::operator=): Un-privatize.
11951         * script-sections.cc (Output_section_element::Input_section_list):
11952         Change element type to Output_section::Simple_input_section.
11953         (Output_section_element_dot_assignment::set_section_addresses):
11954         Register output section data for relaxation clean up.
11955         (Output_data_exression::Output_data_expression): Adjust call to base
11956         constructor to fix data size.
11957         (Output_section_element_data::set_section_addresses): Register
11958         Output_data_expression object for relaxation clean up.
11959         (struct Input_section_info): Replace Relobj pointer and section index
11960         pair with Output_section::Simple_input_section and Convert struct to a
11961         class.
11962         (Input_section_sorter::operator()): Adjust access to
11963         Input_section_info data member to use accessors.
11964         (Output_section_element_input::set_section_addresses): Use layout
11965         parameter.  Adjust code to use Output_section::Simple_input_section
11966         and Input_secction_info classes.  Register filler for relaxation
11967         clean up.
11968         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
11969         and section index pair with Output_section::Simple_input_section
11970         class.  Adjust code accordingly.
11971         (Phdrs_element::release_segment): New method definition.
11972         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
11973         segment list.
11974         (Script_sections::release_segments): New method definition.
11975         * gold/script-sections.h (Script_sections::release_segments): New
11976         method declaration.
11977         * gold/target.h (Target::may_relax, Target::relax,
11978         Target::do_may_relax, Target::do_relax): New method definitions.
11979
11980 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11981
11982         * arm.cc (has_signed_unsigned_overflow): New function.
11983         (Arm_relocate_functions::abs8): New function.
11984         (Target_arm::Scan::local): Handle R_ARM_ABS8.
11985         (Target_arm::Scan::global): Likewise.
11986         (Target_arm::relocate::relocate): Likewise.
11987         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
11988         Likewise.
11989
11990 2009-09-16  Cary Coutant  <ccoutant@google.com>
11991
11992         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
11993         * testsuite/Makefile.in: Regenerate.
11994
11995 2009-09-11  Nick Clifton  <nickc@redhat.com>
11996
11997         * po/gold.pot: Updated by the Translation project.
11998
11999 2009-09-08  Cary Coutant  <ccoutant@google.com>
12000
12001         * output.cc (Output_file::open): Add execute permission to empty file.
12002         * testsuite/Makefile.am (permission_test): New test.
12003         * testsuite/Makefile.in: Regenerate.
12004
12005 2009-09-02  Ian Lance Taylor  <iant@google.com>
12006
12007         * output.cc (Output_file::resize): Call map_no_anonymous rather
12008         than map.
12009
12010 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
12011
12012         * gold.cc: Include "incremental.h".
12013         (queue_initial_tasks): Call Incremental_checker methods.
12014         * incremental.cc: Include "output.h".
12015         (Incremental_checker::can_incrementally_link_output_file): New
12016         method.
12017         * incremental.h (Incremental_checker): New class.
12018
12019         * output.cc (Output_file::open_for_modification): New method.
12020         (Output_file::map_anonymous): Changed return type to bool.  Record
12021         map in base_ field.
12022         (Output_file::map_no_anonymous): New method, broken out of map.
12023         (Output_file::map): Use map_no_anonymous and map_anonymous.
12024         * output.h (class Output_file): Update declarations.
12025
12026 2009-08-24  Cary Coutant  <ccoutant@google.com>
12027
12028         * options.h (Command_line::Pre_options): New class.
12029         (Command_line::pre_options): New member.
12030         * options.cc (gold::options::ready_to_register): New variable.
12031         (One_option::register_option): Do nothing if not registering options.
12032         Assert if same short option registered twice.
12033         (General_options::General_options): Turn off option registration when
12034         done constructing.
12035         (Command_line::Pre_options::Pre_options): New constructor.
12036
12037 2009-08-24  Cary Coutant  <ccoutant@google.com>
12038
12039         * options.h (General_options::no_keep_memory): Remove incorrect
12040         short option.
12041
12042 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
12043
12044         * Makefile.am (am__skiplex, am__skipyacc): New.
12045         * Makefile.in: Regenerate.
12046
12047 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
12048
12049         * Makefile.am (AM_CPPFLAGS): Renamed from ...
12050         (INCLUDES): ... this.
12051         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
12052         (AM_CPPFLAGS): Renamed from ...
12053         (INCLUDE): ... this.
12054         * Makefile.in, testsuite/Makefile.in: Regenerate.
12055
12056         * Makefile.in: Regenerate.
12057         * aclocal.m4: Likewise.
12058         * config.in: Likewise.
12059         * configure: Likewise.
12060         * testsuite/Makefile.in: Likewise.
12061
12062         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
12063         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
12064         * Makefile.in: Regenerate.
12065         * testsuite/Makefile.in: Regenerate.
12066
12067 2009-08-19  Cary Coutant  <ccoutant@google.com>
12068
12069         * resolve.cc (Symbol_table::resolve): Don't complain about defined
12070         symbols in shared libraries overridden by hidden or internal symbols
12071         in the main program.
12072
12073 2009-08-19  Chris Demetriou  <cgd@google.com>
12074
12075         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
12076         checking source file names in error messages.
12077
12078 2009-08-18  Doug Kwan  <dougkwan@google.com>
12079
12080         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
12081         an elcpp::Ehdr as parameter.  Adjust call to set_target.
12082         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
12083         an elfcpp::Ehdr as parameter.
12084         * object.cc (Object::set_target): Remove the version that looks up
12085         a target and sets it.
12086         (Sized_relobj::setup): Take a Target object instead of
12087         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
12088         (make_elf_sized_object): Find target and ask target to
12089         make an ELF object.
12090         * object.h: (Object::set_target): Remove the version that looks up
12091         a target and sets it.
12092         (Sized_relobj::setup): Take a Target object instead of
12093         an elfcpp:Ehdr as parameter.
12094         * target.cc: Include dynobj.h.
12095         (Target::do_make_elf_object_implementation): New.
12096         (Target::do_make_elf_object): New.
12097         * target.h (Target::make_elf_object): New template declaration.
12098         (Target::do_make_elf_object): New method declarations.
12099         (Target::do_make_elf_object_implementation): New template declaration.
12100
12101 2009-08-14  Ian Lance Taylor  <iant@google.com>
12102
12103         * gold.h (FUNCTION_NAME): Define.
12104         (gold_unreachable): Use FUNCTION_NAME.
12105
12106 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
12107
12108         * icf.cc (Icf::find_identical_sections): Issue a warning when a
12109         symbol in the --keep-unique list is not found.
12110
12111 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
12112
12113         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
12114         been maked as --keep-unique.
12115         (Icf::unfold_section): New function.
12116         * icf.h (Icf::unfold_section): New function.
12117         * options.h (General_options::keep_unique): New option.
12118         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
12119         * testsuite/Makefile.in: Regenerate.
12120         * testsuite/icf_keep_unique_test.sh: New file.
12121         * testsuite/icf_keep_unique_test.cc: New file.
12122
12123 2009-08-12  Cary Coutant  <ccoutant@google.com>
12124
12125         PR 10471
12126         * resolve.cc (Symbol_table::resolve): Check for references from
12127         dynamic objects to hidden and internal symbols.
12128         * testsuite/Makefile.am (hidden_test.sh): New test.
12129         * testsuite/Makefile.in: Regenerate.
12130         * testsuite/hidden_test.sh: New script.
12131         * testsuite/hidden_test_1.c: New test source.
12132         * testsuite/hidden_test_main.c: New test source.
12133
12134 2009-08-11  Doug Kwan  <dougkwan@google.com>
12135
12136         * arm.cc: Update comments.
12137         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
12138         segment to locate the .ARM.exidx section if present.
12139
12140 2009-08-09  Doug Kwan  <dougkwan@google.com>
12141
12142         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
12143         patch.
12144
12145 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
12146         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
12147         compiler warnings.
12148
12149 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
12150
12151         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
12152         valid tls_segment only for non-debug-section relocations.
12153         * testsuite/Makefile.am: Add gc_tls_test.
12154         * testsuite/Makefile.in: Regenerate.
12155         * testsuite/gc_tls_test.cc: New file.
12156         * testsuite/gc_tls_test.sh: New file.
12157
12158 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
12159
12160         * icf.cc: New file.
12161         * icf.h: New file.
12162         * Makefile.am (CCFILES): Add icf.cc.
12163         (HFILES): Add icf.h
12164         * Makefile.in: Regenerate.
12165         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
12166         * gc.h (gc_process_relocs): Populate lists used by icf to contain
12167         section, symbol and addend information for the relocs.
12168         * gold.cc (queue_middle_tasks): Call identical code folding.
12169         * gold.h: Add defines for multimap.
12170         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
12171         to the call of finalize_local_symbols.
12172         * main.cc (main): Create object of class Icf.
12173         * object.cc (Sized_relobj::do_layout): Allow this function to be
12174         called twice during icf.
12175         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
12176         to sections marked as identical by icf.
12177         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
12178         when available.
12179         (Sized_relobj::do_section_entsize): New function.
12180         * object.h (Object::section_entsize): New function.
12181         (Object::do_section_entsize): New pure virtual function.
12182         (Relobj::finalize_local_symbols): Add new parameter.
12183         (Relobj::do_section_entsize): New function.
12184         * options.h (General_options::icf): New option.
12185         (General_options::icf_iterations): New option.
12186         (General_options::print_icf_sections): New option.
12187         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
12188         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
12189         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
12190         icf.
12191         * symtab.cc (Symbol_table::is_section_folded): New function.
12192         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
12193         to sections marked as identical by icf.
12194         * symtab.h (Symbol_table::set_icf): New function.
12195         (Symbol_table::icf): New function.
12196         (Symbol_table::is_section_folded): New function.
12197         (Symbol_table::icf_): New data member.
12198         * target-reloc.h (relocate_section): Ignore sections folded by icf.
12199         * testsuite/Makefile.am: Add commands to build icf_test.
12200         * testsuite/Makefile.in: Regenerate.
12201         * testsuite/icf_test.sh: New file.
12202         * testsuite/icf_test.cc: New file.
12203
12204 2009-07-24  Chris Demetriou  <cgd@google.com>
12205
12206         * layout.cc (is_compressible_debug_section): Fix incorrect
12207         comment about compressed section names.
12208
12209 2009-07-20  Ian Lance Taylor  <ian@airs.com>
12210
12211         PR 10419
12212         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
12213
12214 2009-07-16  Ian Lance Taylor  <iant@google.com>
12215
12216         PR 10400
12217         * layout.h: #include <map>.
12218         (class Kept_section): Change from struct to class.  Add accessors
12219         and setters.  Add section size to Comdat_group mapping.  Change
12220         Comdat_group to std::map.  Add is_comdat_ field.  Add
12221         linkonce_size field in union.
12222         (class Layout): Update declaration of find_or_add_kept_section.
12223         Don't declare find_kept_object.
12224         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
12225         parameter.  Add object, shndx, is_comdat, and is_group_name
12226         parameters.  Change all callers.  Adjust for new Kept_section.
12227         (Layout::find_kept_object): Remove.
12228         * object.cc (Sized_relobj::include_section_group): Update use of
12229         Kept_section.  Rename secnum to shndx.  Only record
12230         Kept_comdat_section if sections are the same size.
12231         (Sized_relobj::include_linkonce_section): Update use of
12232         Kept_section.  Only record Kept_comdat_section if sections are the
12233         same size.  Set size of linkonce section.
12234         (Sized_relobj::map_to_kept_section): Update call to
12235         get_kept_comdat_section.
12236         * object.h (class Sized_relobj): Rename fields in
12237         Kept_comdat_section to drop trailing underscores; change object
12238         field to Relobj*.  Change Kept_comdat_section_table to store
12239         struct rather than pointer.
12240         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
12241         Add kept_object and kept_shndx parameters.  Change all callers.
12242         (Sized_relobj::get_kept_comdat_section): Change return type to
12243         bool.  Add kept_object and kept_shndx parameters.  Change all
12244         callers.
12245         * plugin.cc (Pluginobj::include_comdat_group): Update call to
12246         Layout::find_or_add_kept_section.
12247
12248 2009-07-09  Ian Lance Taylor  <iant@google.com>
12249
12250         * merge.cc (Object_merge_map::initialize_input_to_output_map):
12251         Reserve space in the hash table.
12252
12253 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
12254
12255         * fileread.cc (File_read::get_mtime): New method.
12256         * fileread.h (Timespec): New structure.
12257         (File_read::get_mtime): New method.
12258         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
12259         Renamed from timestamp_nsec.
12260         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
12261         Elf_Xword.
12262         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
12263         timestamp_nsec.
12264         (Incremental_inputs::report_archive): Save mtime; style fix.
12265         (Incremental_inputs::report_obejct): Save mtime; style fix.
12266         (Incremental_inputs::report_script): Save mtime; style fix.
12267         (Incremental_inputs::finalize_inputs): Style fix.
12268         (Incremental_inputs::finalize): Style fix.
12269         (Incremental_inputs::create_input_section_data): Store inputs
12270         mtime.
12271         * incremental.h (Incremental_inputs::report_script): Add mtime
12272         argument.
12273         (Incremental_inputs::Input_info::Input_info): Intialize only one
12274         union member.
12275         (Incremental_inputs::Input_info::archive): Move to nameless
12276         union.
12277         (Incremental_inputs::Input_info::obejct): Move to nameless union.
12278         (Incremental_inputs::Input_info::script): Move to nameless union.
12279         (Incremental_inputs::mtime): New field.
12280         * script.cc (read_input_script): Pass file mtime to
12281         Incremental_input.
12282         * script.h (Script_info::inputs): Style fix.
12283
12284 2009-07-01  Ian Lance Taylor  <ian@airs.com>
12285
12286         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
12287         instead of 32.
12288
12289 2009-06-24  Ian Lance Taylor  <iant@google.com>
12290
12291         PR 10156
12292         * layout.cc (Layout::choose_output_section): If we find an
12293         existing section, update the flags.
12294         (Layout::create_notes): New function, broken out of
12295         Layout::finalize.
12296         (Layout::finalize): Don't create note sections.
12297         (Layout::create_note): Don't crash if linker script discards
12298         section.
12299         (Layout::create_gold_note): Likewise.
12300         (Layout::create_build_id): Likewise.  Don't set
12301         after_input_sections on the section.
12302         (Layout::create_executable_stack_info): Remove target parameter.
12303         Change caller.
12304         * layout.h (class Layout): Declare create_notes.  Update
12305         declaration of create_executable_stack_info.
12306         * gold.cc (queue_middle_tasks): Call create_notes.
12307         * output.cc (Output_section::update_flags_for_input_section): Move
12308         here from output.h.  If SHF_ALLOC flag is newly set, mark address
12309         invalid.
12310         * output.h (Output_data::mark_address_invalid): New function.
12311         (class Output_section): Only declare, not define,
12312         update_flags_for_input_section.  Remove set_flags.
12313
12314 2009-06-24  Ian Lance Taylor  <iant@google.com>
12315
12316         * script-sections.cc (Output_section_definition::
12317         set_section_addresses): Rename shadowing local load_address to
12318         laddr.
12319
12320 2009-06-24  Ian Lance Taylor  <iant@google.com>
12321
12322         PR 10244
12323         * reloc.cc (relocate_sections): Skip empty relocation sections.
12324
12325 2009-06-23  Ian Lance Taylor  <iant@google.com>
12326
12327         PR 10156
12328         * layout.cc (Layout::create_note): Use choose_output_section
12329         rather than make_output_section.
12330
12331 2009-06-23  Ian Lance Taylor  <iant@google.com>
12332
12333         PR 10237
12334         * options.cc (General_options::parse_V): Set printed_version_.
12335         (General_options::General_options): Initialize printed_version_.
12336         * options.h (class General_options): Add printed_version_ field.
12337         * gold.cc (queue_initial_tasks): If there are no input files,
12338         don't give a fatal error if we printed the version information.
12339         (queue_middle_tasks): If using -r with a shared object, give a
12340         fatal error rather than an ordinary error.
12341
12342 2009-06-23  Ian Lance Taylor  <iant@google.com>
12343
12344         PR 10219
12345         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
12346         (Layout::make_output_section): Set have_stabstr_section_ if we see
12347         a .stab*str section.
12348         (Layout::finalize): Call link_stabs_sections.
12349         (Layout::link_stabs_sections): New file.
12350         * layout.h (class Layout): Add have_stabstr_section_ field.
12351         Declare link_stabs_sections.
12352
12353 2009-06-23  Doug Kwan  <dougkwan@google.com>
12354
12355         * Makefile.am (libgold_a_LIBADD): New.
12356         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
12357         * Makefile.in: Regenerate.
12358         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
12359         * configure: Regenerate.
12360         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
12361         * fileread.cc: Include sys/state.h
12362         * gold.h: Declare memmem and strndup if found missing.
12363         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
12364
12365 2009-06-23  Ian Lance Taylor  <iant@google.com>
12366
12367         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
12368         * configure: Rebuild.
12369
12370 2009-06-23  Ian Lance Taylor  <iant@google.com>
12371
12372         PR 10147
12373         * object.cc (Object::section_contents): Don't try to get a view if
12374         the section has length zero.
12375         (Object::handle_gnu_warning_section): If the section is empty, use
12376         the name of the section as the warning.
12377
12378 2009-06-23  Ian Lance Taylor  <iant@google.com>
12379
12380         PR 10133
12381         * stringpool.h (class Stringpool_template): Add optimize_ field.
12382         (Stringpool_template::set_optimize): New function.
12383         * stringpool.cc (Stringpool_template::Stringpool_template):
12384         Initialize optimize_ field.
12385         (Stringpool_template::set_string_offsets): Test local optimize
12386         fild rather than parameter.
12387         * layout.cc (Layout::Layout): Call set_optimize on the section
12388         name stringpool.
12389
12390 2009-06-22  Ian Lance Taylor  <iant@google.com>
12391
12392         PR 10030
12393         * yyscript.y: Parse TARGET.
12394         * script.cc (script_set_target): New function.
12395         * script-c.h (script_set_target): Declare.
12396         * options.cc (General_options::string_to_object_format): Rename
12397         from string_to_object_format in anonymous namespace.  Change
12398         callers.
12399         * options.h (class General_options): Declare
12400         string_to_object_format.
12401
12402 2009-06-22  Ian Lance Taylor  <iant@google.com>
12403
12404         * script-sections.cc (Script_sections::create_segments): Don't put
12405         program headers in a PT_LOAD segment if -n or -N.
12406
12407 2009-06-22  Ian Lance Taylor  <iant@google.com>
12408
12409         PR 10141
12410         * options.h (class General_options): Add -z lazy and -z now.  Sort
12411         -z options into alphabetical order.
12412         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
12413
12414 2009-06-21  Ian Lance Taylor  <iant@google.com>
12415
12416         * layout.cc (Layout::make_output_section): Call
12417         Target::new_output_section.
12418         (Layout::attach_allocated_section_to_segment): Put large section
12419         sections in a separate load segment with the large segment flag
12420         set.
12421         (Layout::segment_precedes): Sort large data segments after other
12422         load segments.
12423         (align_file_offset): New static function.
12424         (Layout::set_segment_offsets): Use align_file_offset.
12425         * output.h (class Output_section): Add is_small_section_ and
12426         is_large_section_ fields.
12427         (Output_section::is_small_section): New function.
12428         (Output_section::set_is_small_section):  New function.
12429         (Output_section::is_large_section): New function.
12430         (Output_section::set_is_large_section): New function.
12431         (Output_section::is_large_data_section): New function.
12432         (class Output_segment): Add is_large_data_segment_ field.
12433         (Output_segment::is_large_data_segment): New function.
12434         (Output_segment::set_is_large_data_segment): New function.
12435         * output.cc (Output_section::Output_section): Initialize new
12436         fields.
12437         (Output_segment::Output_segment): Likewise.
12438         (Output_segment::add_output_section): Add assertion that large
12439         data sections always go in large data segments.  Force small data
12440         sections to the end of the list of data sections.  Force small BSS
12441         sections to the start of the list of BSS sections.  For large BSS
12442         sections to the end of the list of BSS sections.
12443         * symtab.h (class Symbol): Declare is_common_shndx.
12444         (Symbol::is_defined): Check Symbol::is_common_shndx.
12445         (Symbol::is_common): Likewise.
12446         (class Symbol_table): Define enum Commons_section_type.  Update
12447         declarations.  Add small_commons_ and large_commons_ fields.
12448         * symtab.cc (Symbol::is_common_shndx): New function.
12449         (Symbol_table::Symbol_table): Initialize new fields.
12450         (Symbol_table::add_from_object): Put small and large common
12451         symbols in the right list.
12452         (Symbol_table::sized_finalized_symbol): Check
12453         Symbol::is_common_shndx.
12454         (Symbol_table::sized_write_globals): Likewise.
12455         * common.cc (Symbol_table::do_allocate_commons): Allocate new
12456         common symbol lists.  Don't call do_allocate_commons_list if the
12457         list is empty.
12458         (Symbol_table::do_allocate_commons_list): Remove is_tls
12459         parameter.  Add comons_section_type parameter.  Change all
12460         callers.  Handle small and large common symbols.
12461         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
12462         Symbol::is_common_shndx.
12463         * resolve.cc (symbol_to_bits): Likewise.
12464         * target.h (Target::small_common_shndx): New function.
12465         (Target::small_common_section_flags): New function.
12466         (Target::large_common_shndx): New function.
12467         (Target::large_common_section_flags): New function.
12468         (Target::new_output_section): New function.
12469         (Target::Target_info): Add small_common_shndx, large_common_shndx,
12470         small_common_section_flags, and large_common_section_flags
12471         fields.
12472         (Target::do_new_output_section): New virtual function.
12473         * arm.cc (Target_arm::arm_info): Initialize new fields.
12474         * i386.cc (Target_i386::i386_info): Likewise.
12475         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
12476         Likewise.
12477         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
12478         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
12479         (Target_x86_64::do_new_output_section): New function.
12480         * configure.ac: Define conditional MCMODEL_MEDIUM.
12481         * testsuite/Makefile.am (check_PROGRAMS): Add large.
12482         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
12483         (large_LDFLAGS): Define.
12484         * testsuite/large.c: New file.
12485         * testsuite/testfile.cc (Target_test::test_target_info):
12486         Initialize new fields.
12487         * configure, testsuite/Makefile.in: Rebuild.
12488
12489 2009-06-05  Doug Kwan  <dougkwan@google.com>
12490
12491         * Makefile.am (CCFILES): Add target.cc.
12492         * Makefile.in: Regenerate.
12493         * i386.cc (class Target_i386): Define new virtual method to
12494         override do_is_local_label_name in parent.
12495         * object.cc (Sized_relobj::do_count_local_symbols): Discard
12496         local symbols if --discard-locals or -X is given.
12497         * options.h (class General_options): Declare new options
12498         '--discard-locals' and '-X' for discarding locals.
12499         * target.h (class Target): Define new methods is_local_label_name.
12500         Declare new virtual method do_is_local_label_name.
12501         * target.cc: New file.
12502         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
12503         (check_SCRIPTS): Add discard_locals_test.sh.
12504         (check_DATA): Add discard_local_tests.syms.
12505         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
12506         (discard_local_tests.syms, discard_locals_test.o): New make rules.
12507         * testsuite/Makefile.in: Regenerate.
12508         * testsuite/discard_locals_test.c: New file.
12509         * testsuite/discard_locals_test.sh: Same.
12510
12511 2009-06-05  Doug Kwan  <dougkwan@google.com>
12512
12513         * object.cc (Sized_relobj::Sized_relobj): Initialize
12514         discarded_eh_frame_shndx_ to -1U.
12515         (Sized_relobj::do_layout): Record index of a discard .eh_frame
12516         section.
12517         (Sized_relobj::do_count_local_symbols): Skip local symbols in
12518         a discarded .eh_frame section.
12519         (Sized_relobj::do_finalize_local_symbols): Ditto.
12520         * object.h (class Sized_relobj): Declare new member
12521         discarded_eh_frame_shndx_.
12522         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
12523         (local_labels_test.o, local_labels_test): New rules.
12524         * testsuite/Makefile.in: Regenerate.
12525
12526 2009-06-04  Doug Kwan  <dougkwan@google.com>
12527
12528         * layout.cc (Layout::section_name_mapping): Add mapping for
12529         special ARM sections.
12530
12531 2009-06-03  Doug Kwan  <dougkwan@google.com>
12532
12533         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
12534         (utils::has_overflow): Same.
12535
12536 2009-06-03  Ian Lance Taylor  <iant@google.com>
12537
12538         * layout.cc (Layout::section_name_mapping): New array, replacing
12539         Layout::linkonce_mapping.
12540         (Layout::section_name_mapping_count): New variable, replacing
12541         Layout::linkonce_mapping_count.
12542         (Layout::linkonce_output_name): Remove.
12543         (Layout::output_section_name): Rewrite.
12544         * layout.h (class Layout): Rename Linkonce_mapping to
12545         Section_name_mapping, linkonce_mapping to section_name_mapping,
12546         linkonce_mapping_count to section_name_mapping_count.  Don't
12547         declare linkonce_output_name.
12548
12549 2009-06-03  Doug Kwan  <dougkwan@google.com>
12550
12551         * gold/arm.cc (namespace utils): New.
12552         (Target_arm::reloc_is_non_pic): Define new method.
12553         (class Arm_relocate_functions): New.
12554         (Target_arm::Relocate::relocate): Handle relocation types used by
12555         Android.
12556
12557 2009-06-03  Ian Lance Taylor  <iant@google.com>
12558
12559         * arm.cc (Target_arm::scan::global): Use || instead of |.
12560
12561 2009-06-02  Doug Kwan  <dougkwan@google.com>
12562
12563         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
12564         issued_non_pic_error_.
12565         (class Target_arm::Scan): Declare new method check_non_pic.
12566         Define new method symbol_needs_plt_entry.
12567         Declare new data member issued_non_pic_error_.
12568         (class Target_arm::Relocate): Declare new method
12569         should_apply_static_reloc.
12570         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
12571         (Target_arm::Scan::check_non_pic): Define new method.
12572         (Target_arm::Scan::local): Handle a small subset of reloc types used
12573         by Android.
12574         (Target_arm::Scan::local): Same.
12575         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
12576
12577 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
12578
12579         * incremental.cc (Incremental_inputs::report_command_line): Filter
12580         out --incremental-* options.
12581
12582 2009-05-29  Doug Kwan  <dougkwan@google.com>
12583
12584         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
12585         template class.
12586         (class Target_arm): Update comment.
12587         (Target_arm::Target_arm): Initialize new data members GOT_,
12588         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
12589         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
12590         and Target_arm::rel_dyn_section.
12591         Declare new_enum Target_arm::Got_type.
12592         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
12593         and DYNBSS_.
12594         Update commments for member do_dynsym_value.
12595         (Target_arm::got_size, Target_arm::plt_section,
12596         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
12597         new methods inside class defintion.
12598         (Target_arm::got_section): Define new method.
12599         (Target_arm::rel_dyn_section): Same.
12600         (Output_data_plt_arm): New template class.
12601         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
12602         (Output_data_plt_arm:do_adjust_output_section): Define new method.
12603         (Output_data_plt_arm::add_entry): Same.
12604         (Output_data_plt_arm::first_plt_entry): Define new
12605         static data member for PLT instruction template.
12606         (Output_data_plt_arm::plt_entry): Same.
12607         (Output_data_plt_arm::do_write): Define new method.
12608         (Target_arm::make_plt_entry): Same.
12609         (Target_arm::do_finalize_sections): Same.
12610         (Target_arm::do_dynsym_value): Same.
12611
12612 2009-05-28  Doug Kwan  <dougkwan@google.com>
12613
12614         * Makefile.am (TARGETSOURCES): Add arm.cc.
12615         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
12616         * Makefile.in: Regenerate.
12617         * arm.cc: New file.
12618         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
12619
12620 2009-05-26  Doug Kwan  <dougkwan@google.com>
12621
12622         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
12623         (General_options::check_excluded_libs): Strip off directories in
12624         archive name before matching like GNU ld does.
12625         * testsuite/Makefile.am (MOSTLYCLEANFILES,
12626         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
12627         (exclude_libs_test_LDFLAGS): Add linker option
12628         -Wl,--exclude-libs,libexclude_libs_test_3
12629         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
12630         an explicit archive without using -l.
12631         (alt/libexclude_libs_test_3.a): New make rule.
12632         * testsuite/Makefile.in: Regenerate.
12633         * testsuite/exclude_libs_test.c : Declare lib3_default().
12634         (main): Call it.
12635         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
12636         * exclude_libs_test_3.c: New file.
12637
12638 2009-05-26  Nick Clifton  <nickc@redhat.com>
12639
12640         * po/id.po: New Indonesian translation.
12641         * po/gold.pot: Updated template file.
12642
12643 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
12644
12645         * testsuite/Makefile.am: Add -ffunction-sections to compile
12646         gc_comdat_test files.  Add -Wl,--gc-sections to build
12647         gc_comdat_test.
12648         * testsuite/Makefile.in: Regenerate.
12649         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
12650
12651 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
12652
12653         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
12654         kept comdat section was garbage collected.
12655         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
12656         * testsuite/Makefile.in: Regenerate.
12657         * testsuite/gc_comdat_test.sh: New file.
12658         * testsuite/gc_comdat_test_1.cc: New file.
12659         * testsuite/gc_comdat_test_2.cc: New file.
12660
12661 2009-05-19  Doug Kwan  <dougkwan@google.com>
12662
12663         * archive.cc (Archive::Archive): Move constructor from archive.h
12664         to here.  Initialize no_export_.
12665         (Archive::get_elf_object_for_member): Set no_export flag of object.
12666         * archive.h (Archive::Archive): Move constructor body to
12667         archive.cc.
12668         (Archive::no_export): New method.
12669         (Archive::no_export_): New field.
12670         * object.h (Object::Object): Initialize no_export_ to false.
12671         (Object::no_export, Object::set_no_export): New methods.
12672         (Object::no_export_): New field.
12673         * options.cc (General_options::parse_exclude_libs): New method.
12674         (General_options::check_excluded_libs) Same.
12675         * options.h (exclude_libs): New option.
12676         (General_options::check_excluded_libs): New method declaration.
12677         (General_options::excluded_libs_): New field.
12678         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
12679         default or protected visibility if an object has no-export flag set.
12680         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
12681         (check_SCRIPTS): Add exclude_libs_test.sh.
12682         (check_DATA): Add exclude_libs_test.syms.
12683         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
12684         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
12685         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
12686         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
12687         (exclude_libs_test.syms, libexclude_libs_test_1.a,
12688         libexclude_libs_test_2.a): New rules.
12689         * testsuite/Makefile.in: Regenerate.
12690         * testsuite/exclude_libs_test.c: New file.
12691         * testsuite/exclude_libs_test.sh: Ditto.
12692         * testsuite/exclude_libs_test_1.c: Ditto.
12693         * testsuite/exclude_libs_test_2.c: Ditto.
12694
12695 2009-05-15  Ian Lance Taylor  <iant@google.com>
12696
12697         * configure.ac: Check for declarations for cases where libiberty.h
12698         checks HAVE_DECL_xxx.
12699         * configure, config.in: Rebuild.
12700
12701 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
12702
12703         * gold.h (Incremental_argument_list): Remove (invalid) forward
12704         declaration.
12705         * incremental.cc (Incremental_inputs::report_achive): New method.
12706         (Incremental_inputs::report_object): New method.
12707         (Incremental_inputs::report_script): New method.
12708         (Incremental_inputs::finalize_inputs): New method.
12709         (Incremental_inputs::finalize): Call finalize_inputs().
12710         (Incremental_inputs::sized_create_incremental_inputs_section_data):
12711         Create inputs entries.
12712         * incremental.h (Incremental_input_type): New enum.
12713         (Incremental_inputs::Incremental_input): Initialize new fields.
12714         (Incremental_inputs::report_inputs): New method.
12715         (Incremental_inputs::report_achive): New method.
12716         (Incremental_inputs::report_object): New method.
12717         (Incremental_inputs::report_script): New method.
12718         (Incremental_inputs::finalize_inputs): New method.
12719         (Incremental_inputs::Input_info): New struct.
12720         (Incremental_inputs::Input_info_map): New typedef.
12721         (Incremental_inputs::lock_): New field.
12722         (Incremental_inputs::Inputs_): New field.
12723         (Incremental_inputs::Inputs_map): New field.
12724         * main.cc (main): Call Incremental_input::report_inputs.
12725         * options.h (Input_argument_list): Typedef moved from
12726         Input_arguments.
12727         (Input_file_group::Files): Remove, use ::Input_argument_list.
12728         (Input_file_group::Input_argument_list): Remove, use
12729         ::Input_argument_list.
12730         * plugin.cc (Plugin_manager::add_input_file): Add error in
12731         incremental build.
12732         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
12733         functions.
12734         * script.cc (read_input_script): Call
12735         Incremental_input::report_script.
12736         * script.h (Script_info): New class.
12737
12738 2009-04-27  Ian Lance Taylor  <iant@google.com>
12739
12740         * x86_64.cc (do_adjust_output_section): Set entsize to
12741         plt_entry_size.
12742
12743 2009-04-23  Elliott Hughes  <enh@google.com>
12744
12745         * output.cc (Output_file::close): After short writes, continue
12746         writing from the correct offset in the buffer being written.
12747
12748 2009-04-23  Chris Demetriou  <cgd@google.com>
12749
12750         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
12751         * configure: Regenerate.
12752         * config.in: Regenerate.
12753         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
12754         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
12755
12756 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
12757
12758         * incremental.cc (Incremental_inputs_header_data): Renamed from
12759         Incremental_input_header_data.
12760         (Incremental_inputs_header_data::data_size): New field.
12761         (Incremental_inputs_header_data::put_input_file_count): Renamed
12762         from input_file_count.
12763         (Incremental_inputs_header_data::put_command_line_offset): Renamed
12764         from command_line_offset.
12765         (Incremental_inputs_header_data::put_reserved): Renamed from
12766         put_reserved.
12767         (Incremental_inputs_entry_data): Renamed from
12768         Incremental_input_entry_data.
12769         (Incremental_inputs_entry_data::data_size): New field.
12770         (Incremental_inputs::report_command_line): New method.
12771         (Incremental_inputs::finalize): New method.
12772         (Incremental_inputs::create_incremental_inputs_data): New method.
12773         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
12774         * incremental.h: New file.
12775         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
12776         (Layout::finalize): Create incremental inputs section in
12777         incremental builds.
12778         (Layout::create_incremental_info_sections): New method.
12779         * layout.h (Layout::incremental_inputs): New method.
12780         (Layout::create_incremental_info_sections): New method.
12781         (Layout::incremental_inputs_): New field.
12782         * main.cc (main): Notify Incremental_input of the command line.
12783
12784 2009-04-01  Ian Lance Taylor  <iant@google.com>
12785             Mikolaj Zalewski  <mikolajz@google.com>
12786
12787         * gold.h (reserve_unordered_map): Define, three versions, one for
12788         each version of Unordered_map.
12789         * layout.cc (Layout::Layout): Remove options parameter.  Add
12790         number_of_input_files parameter.  Don't initialize options_.
12791         Initialize number_of_input_files_ and resized_signatures_.  Move
12792         sections_are_attached_.
12793         (Layout::layout_group): Reserve space for group_signatures_.
12794         (Layout::find_or_add_kept_section): Change name parameter to be a
12795         reference.  Resize signatures_ map when it gets large enough.
12796         (Layout::layout_eh_frame): Use parameters->options() instead of
12797         this->options_.
12798         (Layout::make_output_section): Likewise.
12799         (Layout::attach_allocated_section_to_segment): Likewise.
12800         (Layout::finalize, Layout::create_executable_stack): Likewise.
12801         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
12802         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
12803         * layout.h (class Layout): Update declarations.  Remove options_
12804         field.  Add number_of_input_files_ and resized_signatures_
12805         fields.  Move sections_are_attached_ field.
12806         * main.cc (main): Pass number of input files to Layout
12807         constructor.  Don't pass options.
12808
12809 2009-03-30  Ian Lance Taylor  <iant@google.com>
12810
12811         * ffsll.c (ffsll): Correct implementation.
12812
12813 2009-03-27  Ian Lance Taylor  <iant@google.com>
12814
12815         * ffsll.c: New file.
12816         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
12817         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
12818         * ftruncate.c (ftruncate): Declare before definition.
12819         * mremap.c (mremap): Likewise.
12820         * pread.c (pread): Likewise.
12821         * configure, Makefile.in, config.in: Rebuild.
12822
12823         * mremap.c: New file.
12824         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
12825         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
12826         (mremap): Declare if HAVE_MREMAP is not defined.
12827         * configure, Makefile.in, config.in: Rebuild.
12828
12829 2009-03-27  Cary Coutant  <ccoutant@google.com>
12830
12831         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
12832         position independent.
12833         * sparc.cc (Target_sparc::check_non_pic): Likewise.
12834         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
12835
12836 2009-03-24  Cary Coutant  <ccoutant@google.com>
12837
12838         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
12839         an executable.
12840         (needs_dynamic_reloc): Likewise.
12841
12842 2009-03-24  Ian Lance Taylor  <iant@google.com>
12843
12844         * yyscript.y (file_cmd): Recognize EXTERN.
12845         (extern_name_list, extern_name_list_body): New nonterminals.
12846         * script.cc (script_add_extern): Define.
12847         * script-c.h (script_add_extern): Declare.
12848
12849 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
12850
12851         * object.cc (is_elf_object): Define.
12852         * object.h (is_elf_object): Declare.
12853         * archive.cc (Archive::get_elf_object_for_member): Call
12854         is_elf_object.
12855         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
12856
12857 2009-03-24  Elliott Hughes  <enh@google.com>
12858
12859         * output.cc (Output_file::map_anonymous): Define.
12860         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
12861         try an anonymous one.  Report the size if the mmap fails.
12862         * output.h (class Output_file): Declare map_anonymous.
12863
12864 2009-03-24  Ian Lance Taylor  <iant@google.com>
12865
12866         * target-select.cc (instantiate_target): Don't acquire the lock if
12867         the instantiated_target_ field has already been set.
12868
12869 2009-03-23  Ian Lance Taylor  <iant@google.com>
12870
12871         * gold-threads.h (class Initialize_lock): Define.
12872         * gold-threads.cc (class Initialize_lock_once): Define.
12873         (initialize_lock_control): New static variable.
12874         (initialize_lock_pointer): New static variable.
12875         (initialize_lock_once): New static function.
12876         (Initialize_lock::Initialize_lock): Define.
12877         (Initialize_lock::initialize): Define.
12878         * target-select.h: Include "gold-threads.h".
12879         (class Target_selector): Add lock_ and initialize_lock_ fields.
12880         Don't define instantiate_target, just declare it.
12881         * target-select.cc (Target_selector::Target_selector): Initialize
12882         new fields.
12883         (Target_selector::instantiate_target): Define.
12884         * descriptors.h: Include "gold-threads.h".
12885         (class Descriptors): Add initialize_lock_ field.
12886         * descriptors.cc (Descriptors::Descriptors): Initialize new
12887         field.
12888         (Descriptors::open): Use initialize_lock_ field
12889         * errors.h (class Errors): Add initialize_lock_ field.
12890         * errors.cc (Errors::Errors): Initialize new field.
12891         (Errors::initialize_lock): Use initialize_lock_ field.
12892         * powerpc.cc (class Target_selector_powerpc): Remove
12893         instantiated_target_ field.  In do_recognize call
12894         instantiate_target rather than do_instantiate_target.  In
12895         do_instantiate_target just allocate a new target.
12896         * sparc.cc (class Target_selector_sparc): Likewise.
12897
12898         * freebsd.h: New file.
12899         * i386.cc: Include "freebsd.h".
12900         (Target_i386): Derive from Target_freebsd rather than
12901         Sized_target.
12902         (Target_selector_i386): Derive from Target_selector_freebsd rather
12903         than Target_selector.
12904         * x86_64.cc: Include "freebsd.h".
12905         (Target_x86_64): Derive from Target_freebsd rather than
12906         Sized_target.
12907         (Target_selector_x86_64): Derive from Target_selector_freebsd
12908         rather than Target_selector.
12909         * target.h (class Target): Add adjust_elf_header and
12910         do_adjust_elf_header.
12911         * output.cc (Output_file_header:: do_sized_write): Call target
12912         adjust_elf_header routine.
12913         * configure.tgt: Set targ_osabi.
12914         * configure.ac: Define GOLD_DEFAULT_OSABI.
12915         * parameters.cc (Parameters::default_target): Pass
12916         GOLD_DEFAULT_OSABI to select_target.
12917         * target-select.h (class Target_selector): Make instantiate_target
12918         protected rather than private.
12919         * Makefile.am (HFILES): Add freebsd.h.
12920         * configure, Makefile.in, config.in: Rebuild.
12921
12922         * merge.cc (do_add_input_section): Correct pend value.  Change
12923         message about last entry not being null terminated from error to
12924         warning.
12925
12926 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
12927
12928         * incremental.cc: New file.
12929         * Makefile.am (CCFILES): Add incremental.cc.
12930         * Makefile.in: Rebuild.
12931
12932 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
12933
12934         * layout.cc (Layout::output_section_name): Preserve names
12935         of '.note.' sections.
12936
12937 2009-03-19  Ian Lance Taylor  <iant@google.com>
12938
12939         * descriptors.cc (Descriptors::open): Check that the options are
12940         valid before using them.
12941
12942 2009-03-18  Ian Lance Taylor  <iant@google.com>
12943
12944         * script-sections.h: Include <list>.
12945         (class Script_sections): Change Sections_elements from std::vector
12946         to std::list.  Typedef public Elements_iterator.  Add
12947         orphan_section_placement_, data_segment_align_start_, and
12948         saw_data_segment_align_ fields.  Remove data_segment_align_index_
12949         field.
12950         * script-sections.cc (class Orphan_section_placement): New class.
12951         (class Sections_element): Add virtual functions is_relro and
12952         orphan_section_init.  Remove virtual function place_orphan_here.
12953         (class Output_section_definition): Add is_relro and
12954         orphan_section_init.  Remove place_orphan_here.
12955         (class Orphan_output_section): Likewise.
12956         (Script_sections::Script_sections): Update for field changes.
12957         (Script_sections::data_segment_align): Set saw_data_segment_align_
12958         and data_segment_align_start_, not data_segment_align_index.
12959         (Script_sections::data_segment_relro_end): Check
12960         saw_data_segment_align_.  Use data_segment_align_start_ rather
12961         than data_segment_align_index_.
12962         (Script_sections::place_orphan): Rewrite to use
12963         Orphan_section_placement.
12964
12965 2009-03-17  Ian Lance Taylor  <iant@google.com>
12966
12967         * archive.cc (Archive::add_symbols): Check for a version attached
12968         to the symbol name in the archive map.
12969         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
12970         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
12971         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
12972         (ver_test_11.a): New target.
12973         * testsuite/Makefile.in: Rebuild.
12974
12975         * configure.ac: Check for chsize and posix_fallocate.  Replace
12976         ftruncate.
12977         * ftruncate.c: New file, from gnulib.
12978         * output.cc (posix_fallocate): Define dummy version if not
12979         HAVE_POSIX_FALLOCATE.
12980         (Output_file::map): Call posix_fallocate rather than lseek and
12981         write.
12982         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
12983         * configure, Makefile.in, config.in: Rebuild.
12984
12985 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
12986
12987         * layout.h (Layout::create_note): Add section_name parameter.
12988         * layout.cc (Layout::create_note): Likewise.
12989         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
12990
12991 2009-03-17  Ian Lance Taylor  <iant@google.com>
12992
12993         * descriptors.cc: Include "options.h".
12994         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
12995         (Descriptors::open): Always use O_CLOEXEC when opening a new
12996         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
12997         then set FD_CLOEXEC.
12998
12999         * sparc.cc (class Target_sparc): Add has_got_section.
13000         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
13001         make sure we have a GOT section.
13002
13003         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
13004         (Target_sparc::Scan::local): Likewise.
13005         (Target_sparc::Scan::global): Likewise.
13006         (Target_sparc::Relocate::relocate): Likewise.
13007         (Target_sparc::Relocate::relocate_tls): Likewise.
13008
13009         * symtab.cc (Symbol_table::define_default_version): New function,
13010         broken out of add_from_object.
13011         (Symbol_table::add_from_object): Call define_default_version.
13012         (Symbol_table::define_special_symbol): Add resolve_oldsym
13013         parameter.  Change all callers.  If the version for a symbol comes
13014         from a version script, resolve it with the symbol with the same
13015         name with no version.  Also add the symbol without a version if
13016         appropriate.
13017         (do_define_in_output_data): If resolving with oldsym, don't delete
13018         sym.
13019         (do_define_in_output_segment): Likewise.
13020         (do_define_as_constant): Likewise.
13021         * symtab.h (class Symbol_table): Update declarations.
13022
13023 2009-03-13  Ian Lance Taylor  <iant@google.com>
13024
13025         * readsyms.cc (Read_symbols::incompatible_warning): New function.
13026         (Read_symbols::requeue): New function.
13027         (Read_symbols::do_read_symbols): If make_elf_object fails because
13028         the target type is not configured, and the file was searched for,
13029         issue a warning and retry with the next directory.
13030         (Add_symbols::run): If the file has an incompatible format, and
13031         it was searched for, requeue the Read_symbols task.  On error,
13032         release the object.
13033         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
13034         dirindex parameter to constructor.  Change all callers.  Declare
13035         incompatible_warning and requeue.
13036         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
13037         input_argument_ and input_group_ fields.  Add them to
13038         constructor.  Change all callers.
13039         (class Read_script): Add dirindex_ field.  Add it to constructor.
13040         Change all callers.
13041         * archive.cc (Archive::setup): Remove input_objects parameter.
13042         Change all callers.
13043         (Archive::get_file_and_offset): Likewise.
13044         (Archive::read_all_symbols): Likewise.
13045         (Archive::read_symbols): Likewise.
13046         (Archive::get_elf_object_for_member): Remove input_objects
13047         parameter.  Add punconfigured parameter.  Change all callers.
13048         (Archive::add_symbols): Change return type to bool.  Check return
13049         value of include_member.
13050         (Archive::include_all_members): Likewise.
13051         (Archive::include_member): Change return type to bool.  Return
13052         false if first included object has incompatible target.  Set
13053         included_member_ field.
13054         (Add_archive_symbols::run): If add_symbols returns false, requeue
13055         Read_symbols task.
13056         * archive.h (class Archive): Add included_member_ field.
13057         Initialize it in constructor.  Add input_file and searched_for
13058         methods.  Update declarations.
13059         (class Add_archive_symbols): Add dirpath_, dirindex_, and
13060         input_argument_ fields.  Add them to constructor.  Change all
13061         callers.
13062         * script.cc: Include "target-select.h".
13063         (class Parser_closure): Add skip_on_incompatible_target_ and
13064         found_incompatible_target_ fields.  Add
13065         skip_on_incompatible_target parameter to constructor.  Change all
13066         callers.  Add methods skip_on_incompatible_target,
13067         clear_skip_on_incompatible_target, found_incompatible_target, and
13068         set_found_incompatible_target.
13069         (read_input_script): Add dirindex parameter.  Change all callers.
13070         If parser finds an incompatible target, requeue Read_symbols
13071         task.
13072         (script_set_symbol): Clear skip_on_incompatible_target in
13073         closure.
13074         (script_add_assertion, script_parse_option): Likewise.
13075         (script_start_sections, script_add_phdr): Likewise.
13076         (script_check_output_format): New function.
13077         * script.h (read_input_script): Update declaration.
13078         * script-c.h (script_check_output_format): Declare.
13079         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
13080         (ignore_cmd): Remove OUTPUT_FORMAT.
13081         * fileread.cc (Input_file::Input_file): Add explicit this.
13082         (Input_file::will_search_for): New function.
13083         (Input_file::open): Add pindex parameter.  Change all callers.
13084         * fileread.h (class Input_file): Add input_file_argument method.
13085         Declare will_search_for.  Update declarations.
13086         * object.cc (make_elf_object): Add punconfigured parameter.
13087         Change all callers.
13088         * object.h (class Object): Make input_file public.  Add
13089         searched_for method.
13090         (make_elf_object): Update declaration.
13091         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
13092         restart search.
13093         * dirsearch.h (class Dirsearch): Update declaration.
13094         * options.h (class General_options): Add --warn-search-mismatch.
13095         * parameters.cc (Parameters::is_compatible_target): New function.
13096         * parameters.h (class Parameters): Declare is_compatible_target.
13097         * workqueue.cc (Workqueue::add_blocker): New function.
13098         * workqueue.h (class Workqueue): Declare add_blocker.
13099
13100         * fileread.cc (Input_file::open): Remove options parameter.
13101         Change all callers.
13102         (Input_file::open_binary): Likewise.
13103         * script.cc (read_input_script): Likewise.
13104         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
13105         options parameter from constructor.  Change all callers.
13106         (class Read_script): Likewise.
13107         * fileread.h (class Input_file): Update declarations.
13108         * script.h (read_input_script): Update declaration.
13109
13110 2009-03-10  Nick Clifton  <nickc@redhat.com>
13111
13112         * po/es.po: New Spanish translation.
13113
13114 2009-03-06  Cary Coutant  <ccoutant@google.com>
13115
13116         * options.cc (parse_short_option): Keep dash_z from registering itself.
13117
13118 2009-03-03  Ian Lance Taylor  <iant@google.com>
13119
13120         PR 9918
13121         * target-reloc.h (relocate_section): Pass output_section to
13122         relocate.
13123         * i386.cc (Target_i386::should_apply_static_reloc): Add
13124         output_section parameter.  Change all callers.
13125         (Target_i386::Relocate::relocate): Add output_section parameter.
13126         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
13127         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
13128         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
13129         * testsuite/two_file_shared.sh: New script.
13130         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
13131         (check_DATA): Add two_file_shared.dbg.
13132         (two_file_shared.dbg): New target.
13133         * testsuite/Makefile.in: Rebuild.
13134
13135 2009-03-01  Ian Lance Taylor  <iant@google.com>
13136
13137         * configure.ac: Check for byteswap.h.
13138         * configure: Rebuild.
13139         * config.in: Rebuild.
13140
13141 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
13142
13143         * layout.cc (Layout::find_or_add_kept_section): New function.
13144         (Layout::add_comdat): Removed.
13145         * layout.h (struct Kept_section): Move out of class Layout.
13146         Remove trailing underscores from field names.  Add group_sections
13147         field.  Rename group_ field to is_group.  Change all uses.
13148         (class Layout): Declare find_or_add_kept_section, not add_comdat.
13149         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
13150         comdat_groups_ field.
13151         (Sized_relobj::include_section_group): Use
13152         find_or_add_kept_section and Kept_section::group_sections.
13153         (Sized_relobj::include_linkonce_section): Likewise.
13154         * object.cc (class Sized_relobj): Don't define Comdat_group or
13155         Comdat_group_table.  Remove find_comdat_group and
13156         add_comdat_group.  Remove comdat_groups_ field.
13157         * plugin.cc (include_comdat_group): Use
13158         Layout::find_or_add_kept_section.
13159
13160 2009-02-28  Ian Lance Taylor  <iant@google.com>
13161
13162         * README: --gc-sections and map files are now supported.  Document
13163         some build requirements.
13164
13165         PR 6992
13166         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
13167         relocatable link set the value of the section symbol to zero.
13168         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
13169         relocatable link don't include the section address in the local
13170         symbol value.
13171
13172 2009-02-27  Ian Lance Taylor  <iant@google.com>
13173
13174         PR 6811
13175         * options.h (class Search_directory): Add is_system_directory.
13176         (class General_options): Declare is_in_system_directory.
13177         * options.cc (get_relative_sysroot): Make static.
13178         (get_default_sysroot): Make static.
13179         (General_optoins::is_in_system_directory): New function.
13180         * fileread.cc (Input_file::is_in_system_directory): New function.
13181         * fileread.h (class Input_file): Declare is_in_system_directory.
13182         * object.h (class Object): Add is_in_system_directory.
13183         (class Input_objects): Remove system_library_directory_ field.
13184         * object.cc (Input_objects::add_object): Don't set
13185         system_library_directory_.
13186         (input_objects::found_in_system_library_directory): Remove.
13187         * symtab.cc (Symbol_table::write_globals): Remove input_objects
13188         parameter.  Change all callers.
13189         (Symbol_table::sized_write_globals): Likewise.
13190         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
13191         Call Object::is_in_system_directory.
13192         * symtab.h (class Symbol_table): Update declarations.
13193
13194         PR 5990
13195         * descriptors.h (Open_descriptor): Add is_on_stack field.
13196         * descriptors.cc (Descriptors::open): If the descriptor is on the
13197         top of the stack, remove it.  Initialize is_on_stack field.
13198         (Descriptors::release): Only add pod to stack if it is not on the
13199         stack already.
13200         (Descriptors::close_some_descriptor): Clear stack_next and
13201         is_on_stack fields.
13202
13203         PR 7091
13204         * output.cc (Output_section::find_starting_output_address): Rename
13205         from starting_output_address; add PADDR parameter; change return
13206         type.
13207         * output.h (class Output_section): Declare
13208         find_starting_output_address instead of starting_output_address.
13209         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
13210         section symbol for which we can't find a merge section.
13211
13212         PR 9836
13213         * symtab.cc (Symbol_table::add_from_object): If the visibility is
13214         hidden or internal, force the symbol to be local.
13215         * resolve.cc (Symbol::override_visibility): Define.
13216         (Symbol::override_base): Use override_visibility.
13217         (Symbol_table::resolve): Likewise.
13218         (Symbol::override_base_with_special): Likewise.
13219         (Symbol_table::override_with_special): If the visibility is hidden
13220         or internal, force the symbol to be local.
13221         * symtab.h (class Symbol): Add set_visibility and
13222         override_visibility.
13223         * testsuite/ver_test_1.sh: New file.
13224         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
13225         (check_DATA): Add ver_test_1.syms.
13226         (ver_test_1.syms): New target.
13227         * testsuite/Makefile.in: Rebuild.
13228
13229 2009-02-25  Cary Coutant  <ccoutant@google.com>
13230
13231         * layout.cc (Layout::choose_output_section): Don't rename sections
13232         when using a linker script that has a SECTIONS clause.
13233         * Makefile.in: Regenerate.
13234
13235         * testsuite/Makefile.am (script_test_5.sh): New test case.
13236         * testsuite/Makefile.in: Regenerate.
13237         * testsuite/script_test_5.cc: New file.
13238         * testsuite/script_test_5.sh: New file.
13239         * testsuite/script_test_5.t: New file.
13240
13241 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
13242
13243         * archive.cc (Archive::include_member): Update calls to add_symbols.
13244         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
13245         the Layout argument.
13246         * dynobj.h (do_add_symbols): Add the Layout argument.
13247         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
13248         Layout argument.
13249         * object.h (Object::add_symbols): Add the Layout argument.
13250         (Object::do_add_symbols): Add the Layout argument.
13251         (Sized_relobj::do_add_symbols): Add the Layout argument.
13252         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
13253         Unify the two versions.
13254         (Add_plugin_symbols): Remove.
13255         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
13256         (Sized_pluginobj::do_add_symbols): Unify the two versions.
13257         (Add_plugin_symbols): Remove.
13258         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
13259         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
13260         (Add_symbols::run): Make it work with Pulginobj.
13261
13262 2009-02-06  Ian Lance Taylor  <iant@google.com>
13263
13264         * object.cc (Sized_relobj::do_layout): Make info message start
13265         with lower case letter.
13266
13267 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
13268
13269         * binary.cc: Fix file comment.
13270
13271         * options.h (enum Incremental_disposition): Define.
13272         (class General_options): Add new options: --incremental,
13273         --incremental_changed, --incremental_unchanged,
13274         --incremental_unknown.  Add incremental_disposition_ and
13275         implicit_incremental_ fields.
13276         (General_options::incremental_disposition): New function.
13277         (class Position_dependent_options): Add incremental_disposition
13278         option.
13279         (Position_dependent_options::copy_from_options): Set incremental
13280         dispositions.
13281         * options.cc (General_options::parse_incremental_changed): New
13282         function.
13283         (General_options::parse_incremental_unchanged): New function.
13284         (General_options::parse_incremental_unknown): New function.
13285         (General_options::General_options): Initialize new fields
13286         incremental_disposition_ and implicit_incremental_.
13287         (General_options::finalize): Check for uasge of --incremental-*
13288         without --incremental.
13289
13290 2009-02-06  Chris Demetriou  <cgd@google.com>
13291
13292         * gold.h (gold_undefined_symbol): Change to take only a Symbol
13293         pointer and to report location as the file name associated with
13294         the symbol.
13295         (gold_undefined_symbol_at_location): New function to replace the
13296         old gold_undefined_symbol functionality.
13297         * target-reloc.h (relocate_section): Update to use
13298         gold_undefined_symbol_at_location.
13299         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
13300         Call gold_undefined_symbol function rather than gold_error.
13301         * errors.h (Errors::undefined_symbol): Take location as a
13302         string, rather than calculating it from a relocation.
13303         * errors.cc (Errors::fatal): Print "fatal error:" before the
13304         formatted message.
13305         (Errors::error, Errors::error_at_location): Print "error: "
13306         before the formatted message.
13307         (Errors::undefined_symbol): Take location as a string, rather
13308         than calculating it from a relocation.
13309         (gold_undefined_symbol_at_location): New function akin to
13310         old gold_undefined_symbol, calculates location from relocation.
13311         (gold_undefined_symbol): Change to take only a Symbol pointer
13312         and to report location as the file name associated with the symbol.
13313         * testsuite/debug_msg.sh: Update for changed error messages.
13314         * testsuite/undef_symbol.sh: Likewise.
13315
13316 2009-02-04  Duncan Sands  <baldrick@free.fr>
13317
13318         PR 9812
13319         * reduced_debug_output.h
13320         (Output_reduced_debug_abbrev_section::failed): Use format for
13321         gold_warning.
13322         (Output_reduced_debug_info_section::faild): Likewise.
13323
13324 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
13325
13326         * script.cc (Lazy_demangler): New class.
13327         (Version_script_info::get_symbol_version_helper): Demangle a
13328         symbol only once.
13329
13330 2009-01-29  Cary Coutant  <ccoutant@google.com>
13331
13332         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
13333         to __tls_get_addr.
13334         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
13335
13336 2009-01-28  Ian Lance Taylor  <iant@google.com>
13337
13338         * version.cc (version_string): Bump to 1.9.
13339
13340         * gold.h: Include <cstring> and <stdint.h>.
13341         * version.cc: Include <cstdio>.
13342         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
13343         warning.
13344         * reduced_debug_output.cc (insert_into_vector): Rename from
13345         Insert_into_vector; change all callers.  Use Swap_unaligned to
13346         avoid aliasing issue; remove union since it is unnecessary.
13347
13348 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
13349
13350         * Makefile.am (CCFILES): Add gc.cc.
13351         (HFILES): Add gc.h.
13352         * Makefile.in: Regenerate.
13353         * gold.cc (Gc_runner): New class.
13354         (queue_initial_tasks): Call garbage collection related tasks
13355         when corresponding options are invoked.
13356         (queue_middle_gc_tasks): New function.
13357         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
13358         processed early before laying out sections during garbage collection.
13359         * gold.h (queue_middle_gc_tasks): New function.
13360         (is_prefix_of): Move from "layout.cc".
13361         * i386.cc (Target_i386::gc_process_relocs): New function.
13362         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
13363         * main.cc (main): Create object of class "Garbage_collection".
13364         * object.cc (Relobj::copy_symbols_data): New function.
13365         (Relobj::is_section_name_included): New function.
13366         (Sized_relobj::do_layout): Allow this function to be called twice
13367         during garbage collection and defer layout of section during the
13368         first call.
13369         * object.h (Relobj::get_symbols_data): New function.
13370         (Relobj::is_section_name_included): New function.
13371         (Relobj::copy_symbols_data): New function.
13372         (Relobj::set_symbols_data): New function.
13373         (Relobj::get_relocs_data): New function.
13374         (Relobj::set_relocs_data): New function.
13375         (Relobj::is_output_section_offset_invalid): New pure virtual function.
13376         (Relobj::gc_process_relocs): New function.
13377         (Relobj::do_gc_process_relocs): New pure virtual function.
13378         (Relobj::sd_): New data member.
13379         (Sized_relobj::is_output_section_offset_invalid): New function.
13380         (Sized_relobj::do_gc_process_relocs): New function.
13381         * options.h (General_options::gc_sections): Modify to not be a no-op.
13382         (General_options::print_gc_sections): New option.
13383         * plugin.cc (Plugin_finish::run): Remove function call to
13384         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
13385         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
13386         * reloc.cc (Read_relocs::run): Add task to process relocs and
13387         determine unreferenced sections when doing garbage collection.
13388         (Gc_process_relocs): New class.
13389         (Sized_relobj::do_gc_process_relocs): New function.
13390         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
13391         sections that are garbage collected.
13392         * reloc.h (Gc_process_relocs): New class.
13393         * sparc.cc (Target_sparc::gc_process_relocs): New function.
13394         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
13395         symbols whose corresponding sections are garbage collected.
13396         (Symbol_table::Symbol_table): Add new parameter for the garbage
13397         collection object.
13398         (Symbol_table::gc_mark_undef_symbols): New function.
13399         (Symbol_table::gc_mark_symbol_for_shlib): New function.
13400         (Symbol_table::gc_mark_dyn_syms): New function.
13401         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
13402         as garbage.
13403         (Symbol_table::add_from_object): Likewise.
13404         (Symbol_table::add_from_relobj): When building shared objects, do not
13405         treat externally visible symbols as garbage.
13406         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
13407         table information for static and relocatable links.
13408         * symtab.h (Symbol_table::set_gc): New function.
13409         (Symbol_table::gc): New function.
13410         (Symbol_table::gc_mark_undef_symbols): New function.
13411         (Symbol_table::gc_mark_symbol_for_shlib): New function.
13412         (Symbol_table::gc_mark_dyn_syms): New function.
13413         (Symbol_table::gc_): New data member.
13414         * target.h (Sized_target::gc_process_relocs): New pure virtual
13415         function.
13416         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
13417         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
13418
13419 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
13420
13421         * options.h (General_options::gc_sections): Define as a no-op for now.
13422         (General_options::no_keep_memory): Ditto.
13423         (General_options::Bshareable): Define.
13424         * options.cc (General_options::finalize): Honor -Bshareable.
13425
13426 2009-01-20  Andreas Schwab  <schwab@suse.de>
13427
13428         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
13429         read the value in the contents, since we don't use it.  Use the
13430         template endianness when writing.
13431         (Relocate::relocate): Use it for R_PPC_REL16_HA.
13432
13433 2009-01-19  Andreas Schwab  <schwab@suse.de>
13434
13435         * configure.tgt (powerpc64-*): Fix targ_obj.
13436
13437 2009-01-15  Ian Lance Taylor  <iant@google.com>
13438
13439         * object.cc (Sized_relobj::write_local_symbols): Don't write out
13440         local symbols when stripping all symbols.
13441
13442 2009-01-14  Cary Coutant  <ccoutant@google.com>
13443
13444         * output.cc (Output_reloc): Add explicit instantiations.
13445
13446 2009-01-14  Cary Coutant  <ccoutant@google.com>
13447
13448         * archive.cc (Archive::get_elf_object_for_member): Remove call
13449         to File_read::claim_for_plugin.
13450         * descriptors.cc (Descriptors::open): Remove reference to
13451         is_claimed.
13452         (Descriptors::claim_for_plugin): Remove.
13453         * descriptors.h (Descriptors::claim_for_plugin): Remove.
13454         (Descriptors::is_claimed): Remove.
13455         (claim_descriptor_for_plugin): Remove.
13456         * fileread.cc (File_read::claim_for_plugin): Remove.
13457         * fileread.h (File_read::claim_for_plugin): Remove.
13458         (File_read::descriptor): Reopen descriptor if necessary.
13459         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
13460         (Plugin_manager::all_symbols_read): Add task parameter. Change
13461         all callers.
13462         (Plugin_manager::get_input_file): New function.
13463         (Plugin_manager::release_input_file): New function.
13464         (Pluginobj::Pluginobj): Add filesize parameter and initialize
13465         corresponding data member.
13466         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
13467         and pass to base constructor. Change all callers.
13468         (get_input_file, release_input_file): New functions.
13469         (make_sized_plugin_object): Add filesize parameter. Change all callers.
13470         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
13471         (Plugin_manager::all_symbols_read): Add task parameter.
13472         (Plugin_manager::get_input_file): New function.
13473         (Plugin_manager::release_input_file): New function.
13474         (Plugin_manager::task_): New data member.
13475         (Pluginobj::Pluginobj): Add filesize parameter.
13476         (Pluginobj::filename): New function.
13477         (Pluginobj::descriptor): New function.
13478         (Pluginobj::filesize): New function.
13479         (Pluginobj::filesize_): New data member.
13480         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
13481         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
13482         File_read::claim_for_plugin; use Object::unlock to unlock the file.
13483
13484         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
13485         with archive libraries.
13486         * testsuite/Makefile.in: Regenerate.
13487         * testsuite/plugin_test.c (struct sym_info): New type.
13488         (get_input_file, release_input_file): New static variables.
13489         (onload): Capture new transfer vector entries.
13490         (claim_file_hook): Stop reading at end of file according to filesize.
13491         Factor out parsing of readelf output into separate function.
13492         (all_symbols_read_hook): Exercise get_input_file and release_input_file
13493         APIs and get the source file name from the symbol table.  Convert
13494         source file name to corresponding object file name.  Print info
13495         message when adding new input files.
13496         (parse_readelf_line): New function.
13497         * testsuite/plugin_test_1.sh: Add checks for new info messages.
13498         * testsuite/plugin_test_2.sh: Likewise.
13499         * testsuite/plugin_test_3.sh: Likewise.
13500         * testsuite/plugin_test_4.sh: New test case.
13501
13502 2009-01-07  Ian Lance Taylor  <iant@google.com>
13503
13504         * version.cc (version_string): Bump to 1.8.
13505
13506 2008-12-23  Cary Coutant  <ccoutant@google.com>
13507
13508         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
13509         * plugin.cc (Plugin_manager::finish): Rename as
13510         layout_deferred_objects.  Move cleanup to separate function.
13511         (Plugin_manager::cleanup): New function.
13512         (Plugin_finish::run): Call layout_deferred_objects and cleanup
13513         separately.
13514         * plugin.h (Plugin_manager::finish): Rename as
13515         layout_deferred_objects.
13516         (Plugin_manager::cleanup): New function.
13517         (Plugin_manager::cleanup_done): New field.
13518
13519 2008-12-23  Cary Coutant  <ccoutant@google.com>
13520
13521         * plugin.cc (is_visible_from_outside): New function.
13522         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
13523         so we don't return "IR only" status for exported symbols or -r links.
13524
13525         * testsuite/Makefile.am (plugin_test_3): New test case.
13526         * testsuite/Makefile.in: Regenerate.
13527         * testsuite/plugin_test_3.sh: New file.
13528
13529 2008-12-22  Cary Coutant  <ccoutant@google.com>
13530
13531         * object.cc (Sized_relobj::layout_section): New function.
13532         (Sized_relobj::do_layout): Defer layout of input sections until after
13533         plugin has provided replacement files.
13534         (Sized_relobj::do_layout_deferred_sections): New function.
13535         * object.h (Relobj::set_section_offset): Remove virtual keyword.
13536         (Relobj::layout_deferred_sections): New function.
13537         (Relobj::do_layout_deferred_sections): New function.
13538         (Sized_relobj::do_layout_deferred_sections): New function.
13539         (Sized_relobj::layout_section): New function.
13540         (Sized_relobj::Deferred_layout): New structure.
13541         (Sized_relobj::deferred_layout_): New field.
13542         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
13543         Change all callers.  Layout deferred sections.
13544         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
13545         references.
13546         (Plugin_hook::run): Move code from do_plugin_hook inline.
13547         (Plugin_hook::do_plugin_hook): Remove.
13548         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
13549         (Plugin_manager::finish): Renamed, was cleanup.
13550         (Plugin_manager::should_defer_layout): New function.
13551         (Plugin_manager::add_deferred_layout_object): New function.
13552         (Plugin_manager::Deferred_layout_list): New type.
13553         (Plugin_manager::deferred_layout_objects_): New field.
13554         (Plugin_hook::do_plugin_hook): Remove.
13555
13556 2008-12-17  Ian Lance Taylor  <iant@google.com>
13557
13558         * options.h (class General_options): Add --no case for
13559         --export-dynamic.
13560
13561 2008-12-16  Cary Coutant  <ccoutant@google.com>
13562
13563         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
13564         vector.
13565         (Plugin_manager::claim_file): Create plugin object even if
13566         plugin did not call the add_symbols callback.
13567         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
13568         asking for more symbols than were added.
13569         * testsuite/Makefile.am (plugin_test_1): Add test case with
13570         no global symbols.
13571         (empty.syms): New target.
13572         * testsuite/Makefile.in: Regenerate.
13573         * testsuite/plugin_test.c (claim_file_hook): Add new debug
13574         message. Don't call add_symbols if no globals.
13575         (all_symbols_read_hook): Don't provide replacement for empty
13576         claimed file.
13577
13578 2008-12-12  Ian Lance Taylor  <iant@google.com>
13579
13580         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
13581         r_type == 0 for a local symbol with r_sym == 0.
13582         (scan_relocatable_relocs): Pass r_sym to
13583         local_non_section_strategy.
13584         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
13585         r_sym parameter.
13586
13587         * configure.ac: Update test for TLS descriptors: they are
13588         supported as of glibc 2.9.
13589         * configure: Rebuild.
13590
13591 2008-12-11  Ian Lance Taylor  <iant@google.com>
13592
13593         PR 7091
13594         * target-reloc.h (Default_scan_relocatable_relocs): For each
13595         function, map r_type == 0 to RELOC_DISCARD.
13596
13597 2008-12-10  Cary Coutant  <ccoutant@google.com>
13598
13599         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
13600         object to override a kept COMDAT group from a plugin object.
13601
13602 2008-12-09  Ian Lance Taylor  <iant@google.com>
13603
13604         PR 7088
13605         * yyscript.y (file_cmd): Handle INPUT.
13606
13607         * testsuite/initpri1.c: Change all declarations to be full
13608         prototypes by adding void, to avoid compiler warnings.
13609
13610 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
13611
13612         * options.cc (General_options::parse_plugin_opt): New.
13613         (General_options::add_plugin): The argument now is just the filename.
13614         (General_options::add_plugin_option): New.
13615         * options.h (plugin_opt): New.
13616         (add_plugin): Change argument name.
13617         (add_plugin_option): New.
13618         * plugin.cc (Plugin::load): Don't parse the plugin option.
13619         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
13620         (Plugin::add_option): New.
13621         (Plugin::args_): Change type.
13622         (Plugin::filename_): New.
13623         (Plugin_manager::add_plugin_option): New.
13624         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
13625         * testsuite/Makefile.in: Regenerate.
13626
13627 2008-12-05  Cary Coutant  <ccoutant@google.com>
13628
13629         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
13630         Handle --strip-lto-sections option.
13631         * options.h (strip_lto_sections): New option.
13632
13633 2008-12-01  Cary Coutant  <ccoutant@google.com>
13634
13635         * plugin.cc (ld_plugin_message): Change format parameter to const.
13636         Fix mismatch between new[] and delete.
13637
13638 2008-11-14  Cary Coutant  <ccoutant@google.com>
13639
13640         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
13641         instead of -1U.
13642
13643 2008-11-05  Craig Silverstein  <csilvers@google.com>
13644
13645         * options.cc (General_options::parse_dynamic_list): New function.
13646         * options.h (General_options): New flags dynamic_list,
13647         dynamic_list_data, dynamic_list_cpp_new, and
13648         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
13649         (General_options::in_dynamic_list): New function.
13650         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
13651         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
13652         (Lex::can_continue_name): Likewise.
13653         (yylex): Likewise.
13654         (read_script_file): New parameter script_options.
13655         (read_dynamic_list): New function.
13656         (Script_options::define_dynamic_list): New function.
13657         (dynamic_list_keyword_parsecodes): New variable.
13658         (dynamic_list_keywords): New variable.
13659         * script.h (Script_options::define_dynamic_list): New function
13660         prototype.
13661         (read_dynamic_list): New function prototype.
13662         * symtab.cc (strprefix): New macro.
13663         (Symbol::should_add_dynsym_entry): Support dynamic_list,
13664         dynamic_list_data, dynamic_list_cpp_new, and
13665         dynamic_list_cpp_typeinfo.
13666         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
13667         (dynamic_list_expr): New rule.
13668         (dynamic_list_nodes): Likewise.
13669         (dynamic_list_node): Likewise.
13670         * testsuite/Makefile.am (dynamic_list): New test.
13671         * testsuite/Makefile.in: Regenerated.
13672         * testsuite/dynamic_list.t: New file.
13673         * testsuite/dynamic_list.sh: New file.
13674
13675 2008-11-05  Craig Silverstein  <csilvers@google.com>
13676
13677         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
13678         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
13679         (t11_last): Likewise.
13680         * testsuite/ver_test_6.c (main): Likewise.
13681
13682 2008-10-07  Cary Coutant  <ccoutant@google.com>
13683
13684         * options.c (General_options::finalize): Add check for -static and
13685         -shared.
13686         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
13687         is not empty.
13688
13689 2008-10-02  Cary Coutant  <ccoutant@google.com>
13690
13691         * plugin.cc (make_sized_plugin_object): Fix conditional
13692         compilation to work when not all targets are enabled.
13693
13694 2008-09-29  Cary Coutant  <ccoutant@google.com>
13695
13696         * archive.cc (Archive::get_file_and_offset): Use filename instead
13697         of name to get library path.
13698         (Archive::include_member): Unlock external member of a thin archive.
13699
13700         * testsuite/Makefile.am (TEST_AR): New variable.
13701         (thin_archive_test_1): New test.
13702         (thin_archive_test_2): New test.
13703         * testsuite/Makefile.in: Regenerate.
13704         * testsuite/thin_archive_main.cc: New file.
13705         * testsuite/thin_archive_test_1.cc: New file.
13706         * testsuite/thin_archive_test_2.cc: New file.
13707         * testsuite/thin_archive_test_3.cc: New file.
13708         * testsuite/thin_archive_test_4.cc: New file.
13709
13710 2008-09-29  Cary Coutant  <ccoutant@google.com>
13711
13712         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
13713         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
13714         instead of -1U.
13715         (Sized_relobj::do_finalize_local_symbols): Likewise.
13716         (Sized_relobj::map_to_kept_section): Likewise.
13717         * object.h (Sized_relobj::invalid_address): New constant.
13718         (Sized_relobj::do_output_section_offset): Check for invalid_address
13719         and return -1ULL.
13720         * output.cc (Output_reloc::local_section_offset): Use constant
13721         invalid_address instead of -1U.
13722         (Output_reloc::get_address): Likewise.
13723         (Output_section::output_address): Change -1U to -1ULL.
13724         * output.h (Output_reloc::invalid_address): New constant.
13725         * reloc.cc (Sized_relobj::write_sections): Use constant
13726         invalid_address instead of -1U.
13727         (Sized_relobj::relocate_sections): Likewise.
13728         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
13729         values for merge sections.
13730         * target-reloc.h (relocate_for_relocatable): Use constant
13731         invalid_address instead of -1U.
13732
13733 2008-09-19  Cary Coutant  <ccoutant@google.com>
13734
13735         Add plugin functionality for link-time optimization (LTO).
13736         * configure.ac (plugins): Add --enable-plugins option.
13737         * configure: Regenerate.
13738         * config.in: Regenerate.
13739         * Makefile.am (LIBDL): New variable.
13740         (CCFILES): Add plugin.cc.
13741         (HFILES): Add plugin.h.
13742         (ldadd_var): Add LIBDL.
13743         * Makefile.in: Regenerate.
13744
13745         * archive.cc: Include "plugin.h".
13746         (Archive::setup): Don't preread archive symbols when using a plugin.
13747         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
13748         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
13749         files.
13750         (Archive::include_member): Add symbols from plugin objects.
13751         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
13752         * descriptors.cc (Descriptors::open): Check for file descriptors
13753         abandoned by plugins.
13754         (Descriptors::claim_for_plugin): New function.
13755         * descriptors.h (Descriptors::claim_for_plugin): New function.
13756         (Open_descriptor::is_claimed): New field.
13757         (claim_descriptor_for_plugin): New function.
13758         * fileread.cc (File_read::claim_for_plugin): New function.
13759         * fileread.h (File_read::claim_for_plugin): New function.
13760         (File_read::descriptor): New function.
13761         * gold.cc: Include "plugin.h".
13762         (queue_initial_tasks): Add task to call plugin hooks for generating
13763         new object files.
13764         * main.cc: Include "plugin.h".
13765         (main): Load plugin libraries.
13766         * object.h (Pluginobj): Declare.
13767         (Object::pluginobj): New function.
13768         (Object::do_pluginobj): New function.
13769         (Object::set_target): New function.
13770         * options.cc: Include "plugin.h".
13771         (General_options::parse_plugin): New function.
13772         (General_options::General_options): Initialize plugins_ field.
13773         (General_options::add_plugin): New function.
13774         * options.h (Plugin_manager): Declare.
13775         (General_options): Add --plugin option.
13776         (General_options::has_plugins): New function.
13777         (General_options::plugins): New function.
13778         (General_options::add_plugin): New function.
13779         (General_options::plugins_): New field.
13780         * plugin.cc: New file.
13781         * plugin.h: New file.
13782         * readsyms.cc: Include "plugin.h".
13783         (Read_symbols::do_read_symbols): Check for archive before checking
13784         for ELF file.  Call plugin hooks to claim files.
13785         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
13786         from a real object file; force override when processing replacement
13787         files.
13788         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
13789         (Symbol::init_base_object): Likewise.
13790         (Symbol::init_base_output_data): Likewise.
13791         (Symbol::init_base_output_segment): Likewise.
13792         (Symbol::init_base_constant): Likewise.
13793         (Symbol::init_base_undefined): Likewise.
13794         (Symbol::output_section): Assert that object is not a plugin.
13795         (Symbol_table::add_from_pluginobj): New function.
13796         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
13797         undefined.
13798         (Symbol_table::sized_write_globals): Likewise.
13799         (Symbol_table::add_from_pluginobj): Instantiate template.
13800         * symtab.h (Sized_pluginobj): Declare.
13801         (Symbol::in_real_elf): New function.
13802         (Symbol::set_in_real_elf): New function.
13803         (Symbol::in_real_elf_): New field.
13804         (Symbol_table::add_from_pluginobj): New function.
13805
13806         * testsuite/Makefile.am (AM_CFLAGS): New variable.
13807         (LIBDL): New variable.
13808         (LDADD): Add LIBDL.
13809         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
13810         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
13811         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
13812         (MOSTLYCLEANFILES): Likewise.
13813         * testsuite/Makefile.in: Regenerate.
13814         * testsuite/plugin_test.c: New file.
13815         * testsuite/plugin_test_1.sh: New file.
13816         * testsuite/plugin_test_2.sh: New file.
13817
13818 2008-09-16  Ian Lance Taylor  <iant@google.com>
13819
13820         * target-reloc.h (relocate_section): Check whether a symbol is
13821         defined by the ABI before reporting an undefined symbol error.
13822         * target.h (Target::is_defined_by_abi): Make parameter const.
13823         (Target::do_is_defined_by_abi): Likewise.
13824         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
13825         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
13826         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
13827         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
13828         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
13829         * testsuite/Makefile.in: Rebuild.
13830
13831         * fileread.cc (make_view): Add casts to avoid warning.
13832
13833 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
13834
13835         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
13836         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
13837
13838 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
13839
13840         * options.h (General_options::output_is_executable): New.
13841         (General_options::output_is_pie): New.
13842         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
13843         for shared libraries.
13844         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
13845
13846 2008-09-11  Chris Demetriou  <cgd@google.com>
13847
13848         * options.h (origin): New -z option.
13849         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
13850         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
13851         in DT_FLAGS_1.
13852
13853 2008-09-05  Cary Coutant  <ccoutant@google.com>
13854
13855         * fileread.cc (File_read::make_view): Add check for attempt to map
13856         beyond end of file.
13857
13858 2008-09-05  Cary Coutant  <ccoutant@google.com>
13859
13860         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
13861         explicit instantiations.
13862
13863 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
13864
13865         PR gold/6858
13866         * options.cc (General_options::finalize): Allow undefined symbols
13867         in shlibs if linking -shared.
13868
13869         PR gold/6859
13870         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
13871         symbols as not needing a dynsym entry.
13872
13873 2008-08-20  Craig Silverstein  <csilvers@google.com>
13874
13875         * fileread.cc (File_read::open): Do not lock the file unless it
13876         was successfully opened.
13877
13878 2008-08-14  Cary Coutant  <ccoutant@google.com>
13879
13880         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
13881         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
13882         * testsuite/tls_test.cc (struct int128): 128-bit struct
13883         for testing TLS relocs with non-zero addend.
13884         (v12): New TLS variable.
13885         (t12): New test.
13886         (t_last): Add check for v12.
13887         * testsuite/tls_test.h (t12): New function.
13888         * testsuite/tls_test_main.cc (thread_routine): Call new test.
13889
13890 2008-08-13  Ian Lance Taylor  <iant@google.com>
13891
13892         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
13893         set tls_segment_ or relro_segment_.
13894         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
13895         when appropriate.
13896         * output.h (Output_section::clear_is_relro): New function.
13897         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
13898         sections specially even when output_data_ is empty.
13899         (Output_segment::maximum_alignment): When first section is relro,
13900         only force alignment for PT_LOAD segments.
13901         * script.cc (script_data_segment_align): New function.
13902         (script_data_segment_relro_end): New function.
13903         * script-c.h (script_data_segment_align): Declare.
13904         (script_data_segment_relro_end): Declare.
13905         * script-sections.h (class Script_sections): Declare
13906         data_segment_align and data_segment_relro_end.  Add fields
13907         segment_align_index_ and saw_relro_end_.
13908         * script-sections.cc (class Sections_element): Add set_is_relro
13909         virtual function.  Add new bool* parameter to place_orphan_here.
13910         Add get_output_section virtual function.
13911         (class Output_section_definition): Add set_is_relro.  Add new
13912         bool* parameter to place_orphan_here.  Add get_output_section.
13913         Add is_relro_ field.
13914         (Output_section_definition::Output_section_definition): Initialize
13915         evaluated_address_, evaluated_load_address, evaluated_addralign_,
13916         and is_relro_ fields.
13917         (Output_section_definition::place_orphan_here): Add is_relro
13918         parameter.
13919         (Output_section_definition::set_section_addresses): Set relro for
13920         output section.
13921         (Output_section_definition::alternate_constraint): Likewise.
13922         (class Orphan_output_section): Add new bool* parameter to
13923         place_orphan_here.  Add get_output_section.
13924         (Orphan_output_section::place_orphan_here): Add is_relro
13925         parameter.
13926         (Script_sections::Script_sections): Initialize
13927         data_segment_align_index_ and saw_relro_end_.
13928         (Script_sections::data_segment_align): New function.
13929         (Script_sections::data_segment_relro_end): New function.
13930         (Script_sections::place_orphan): Set or clear is_relro.
13931         (Script_sections::set_section_addresses): Force alignment of first
13932         TLS section.
13933         * yyscript.y (exp): Call script_data_segment_align and
13934         script_data_segment_relro_end.
13935         * testsuite/relro_script_test.t: New file.
13936         * testsuite/relro_test.cc (using_script): Declare.
13937         (t1, t2): Test using_script.
13938         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
13939         (relro_script_test_SOURCES): Define.
13940         (relro_script_test_DEPENDENCIES): Define.
13941         (relro_script_test_LDFLAGS): Define.
13942         (relro_script_test_LDADD): Define.
13943         (relro_script_test.so): New target.
13944         * testsuite/Makefile.in: Rebuild.
13945
13946 2008-08-06  Cary Coutant <ccoutant@google.com>
13947
13948         * archive.cc (Archive::total_archives, Archive::total_members)
13949         (Archive::total_members_loaded): New variables.
13950         (Archive::setup): Add parameter.  Add option to preread
13951         archive symbols.
13952         (Archive::read_armap): Add counter.
13953         (Archive::get_file_and_offset): New function.
13954         (Archive::get_elf_object_for_member): New function.
13955         (Archive::read_all_symbols): New function.
13956         (Archive::read_symbols): New function.
13957         (Archive::add_symbols): Add counters.
13958         (Archive::include_all_members): Use armap to find members if it's
13959         already built.
13960         (Archive::include_member): Skip reading symbols if already read.
13961         Factored code into Archive::get_file_and_offset and
13962         Archive::get_elf_object_for_member.  Changed call to
13963         Mapfile::report_include_archive_member.
13964         (Archive::print_stats): New function.
13965         * archive.h: Declare Object and Read_symbols_data classes.
13966         (Archive::Archive): Add initializers for new members.
13967         (Archive::setup): Add parameter.
13968         (Archive::print_stats): New function.
13969         (Archive::total_archives, Archive::total_members)
13970         (Archive::total_members_loaded): New variables.
13971         (Archive::get_file_and_offset): New function.
13972         (Archive::get_elf_object_for_member): New function.
13973         (Archive::read_all_symbols): New function.
13974         (Archive::read_symbols): New function.
13975         (Archive::Archive_member): New class.
13976         (Archive::members_): New member.
13977         (Archive::num_members_): New member.
13978         * main.cc: Include archive.h.
13979         (main): Call Archive::print_stats.
13980         * mapfile.cc (Mapfile::report_include_archive_member): Delete
13981         archive parameter; member_name is now the fully-decorated name.
13982         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
13983         * options.h: (General_options): Add --preread-archive-symbols option.
13984         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
13985         Archive::setup.
13986
13987 2008-08-04  Ian Lance Taylor  <iant@google.com>
13988
13989         * symtab.h (Symbol::use_plt_offset): New function.
13990         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
13991         * powerpc.cc (Relocate::relocate): Likewise.
13992         * sparc.cc (Relocate::relocate): Likewise.
13993         * x86_64.cc (Relocate::relocate): Likewise.
13994         * testsuite/weak_plt.sh: New test.
13995         * testsuite/weak_plt_main.cc: New test.
13996         * testsuite/weak_plt_shared.cc: New test.
13997         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
13998         (check_PROGRAMS): Add weak_plt.
13999         (check_DATA): Add weak_plt_shared.so.
14000         (weak_plt_main_pic.o, weak_plt): New targets.
14001         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
14002         * testsuite/Makefile.in: Rebuild.
14003
14004         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
14005         gcctestdir/ld.
14006         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
14007         * testsuite/Makefile.in: Rebuild.
14008
14009 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
14010
14011         * Makefile.am (POTFILES.in): Set LC_ALL=C.
14012         * Makefile.in: Regenerate.
14013         * po/POTFILES.in: Regenerate.
14014
14015 2008-07-29  Ian Lance Taylor  <iant@google.com>
14016
14017         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
14018         symbols before other symbols.
14019         * testsuite/script_test_2.cc (test_addr): Declare.
14020         (test_addr_alias): Declare.
14021         (main): Check that test_addr and test_addr_alias have the right
14022         values.
14023         * testsuite/script_test_2.t: Define test_addr_alias and
14024         test_addr.
14025
14026 2008-07-24  Ian Lance Taylor  <iant@google.com>
14027
14028         PR 5990
14029         * descriptors.cc: New file.
14030         * descriptors.h: New file.
14031         * gold-threads.h (class Hold_optional_lock): New class.
14032         * fileread.cc: Include "descriptors.h".
14033         (File_read::~File_read): Release descriptor rather than closing
14034         it.
14035         (File_read::open) [file]: Call open_descriptor rather than open.
14036         Set is_descriptor_opened_.
14037         (File_read::open) [memory]: Assert that descriptor is not open.
14038         (File_read::reopen_descriptor): New function.
14039         (File_read::release): Release descriptor.
14040         (File_read::do_read): Make non-const.  Reopen descriptor.
14041         (File_read::read): Make non-const.
14042         (File_read::make_view): Reopen descriptor.
14043         (File_read::do_readv): Likewise.
14044         * fileread.h (class File_read): Add is_descriptor_opened_ field.
14045         Update declarations.
14046         * layout.cc: Include "descriptors.h".
14047         (Layout::create_build_id): Use open_descriptor rather than open.
14048         * output.cc: Include "descriptors.h".
14049         (Output_file::open): Use open_descriptor rather than open.
14050         * archive.cc (Archive::const_iterator): Change Archive to be
14051         non-const.
14052         (Archive::begin, Archive::end): Make non-const.
14053         (Archive::count_members): Likewise.
14054         * archive.h (class Archive): Update declarations.
14055         * object.h (Object::read): Make non-const.
14056         * Makefile.am (CCFILES): Add descriptors.cc.
14057         (HFILES): Add descriptors.h.
14058         * Makefile.in: Rebuild.
14059
14060         PR 6716
14061         * gold.h: Always include <clocale>.  Add Solaris workarounds
14062         following code in binutils/sysdep.h.
14063
14064         PR 6048
14065         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
14066         this->eh_frame_hdr_ is NULL before using it.
14067
14068         * dynobj.cc (Versions::Versions): Update comment.
14069
14070         * dynobj.cc (Versions::Versions): If there is an soname, use it as
14071         the base version name.
14072
14073         * stringpool.cc (Stringpool_template::add_with_length): Set key to
14074         array size plus one.
14075         (Stringpool_template::set_string_offsets): Subtract one from key
14076         before using it as an array index.
14077         (Stringpool_template::get_offset_with_length): Likewise.
14078         (Stringpool_template::write_to_buffer): Likewise.
14079         * stringpool.h (Stringpool_template::get_offset_from_key):
14080         Likewise.
14081
14082 2008-07-23  Ian Lance Taylor  <iant@google.com>
14083
14084         PR 6658
14085         * object.h (Merged_symbol_value::value): Do our best to handle a
14086         negative addend.
14087
14088         PR 6647
14089         * script.cc (Version_script_info::get_versions): Don't add empty
14090         version tag to return value.
14091         (Version_script_info::get_symbol_version_helper): Change return
14092         type to bool.  Add pversion parameter.  Change all callers.
14093         (script_register_vers_node): Don't require a non-NULL tag.
14094         * script.h (class Version_script_info): Update declarations.
14095         (Version_script_info::get_symbol_version): Change return type to
14096         bool.  Add version parameter.  Change all callers.
14097         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
14098         handling.  Handle an empty version from a version script.
14099         (Symbol_table::define_special_symbol): Likewise.
14100         * testsuite/ver_test_10.script: New file.
14101         * testsuite/ver_test_10.sh: New file.
14102         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
14103         (check_DATA): Add ver_test_10.syms.
14104         (ver_test_10.syms, ver_test_10.so): New target.
14105         * testsuite/Makefile.in: Rebuild.
14106
14107 2008-07-23  Simon Baldwin  <simonb@google.com>
14108
14109         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
14110         to zero for undefined symbols from dynamic libraries.
14111
14112 2008-07-23  Ian Lance Taylor  <iant@google.com>
14113
14114         * symtab.cc (Symbol_table::resolve): Remove version parameter.
14115         Change all callers.
14116         * symtab.h (class Symbol_table): Update declaration.
14117         * testsuite/ver_test_9.cc: New file.
14118         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
14119         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
14120         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
14121         (ver_test_9.so, ver_test_9.o): New targets.
14122         * testsuite/Makefile.in: Rebuild.
14123
14124 2008-07-22  Ian Lance Taylor  <iant@google.com>
14125
14126         * options.h (class General_options): Define --check-sections.
14127         * layout.cc (Layout::set_segment_offsets): Handle
14128         --check-sections.
14129
14130         * options.h (class General_options): Define -n/--nmagic and
14131         -N/--omagic.
14132         * options.cc (General_options::finalize): For -n/--nmagic or
14133         -N/--omagic, set -static.
14134         * layout.cc (Layout::attach_allocated_section_to_segment): If
14135         -N/--omagic, don't put read-only and read-write sections in
14136         different segments.
14137         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
14138         finding a read-only segment.
14139         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
14140         don't set the minimum segment alignment to the common page size,
14141         and don't set the file offset to the address modulo the page size.
14142         * script-sections.cc (Script_sections::create_segments): If
14143         -n/--omagic, don't put read-only and read-write sections in
14144         different segments.
14145
14146         * cref.cc: New file.
14147         * cref.h: New file.
14148         * options.h (class General_options): Add --print-symbol-counts.
14149         * main.cc (main): Issue defined symbol report if requested.
14150         * archive.cc (Archive::interpret_header): Make into a const member
14151         function.
14152         (Archive::add_symbols): Call Input_objects::archive_start and
14153         archive_stop.
14154         (Archive::const_iterator): Define new class.
14155         (Archive::begin, Archive::end): New functions.
14156         (Archive::include_all_members): Rewrite to use iterator.
14157         (Archive::count_members): New function.
14158         * archive.h (class Archive): Update declarations.
14159         (Archive::filename): New function.
14160         * object.cc: Include "cref.h".
14161         (Sized_relobj::Sized_relobj): Initialize defined_count_.
14162         (Sized_relobj::do_get_global_symbol_counts): New function.
14163         (Input_objects::add_object): Add object to cross-referencer.
14164         (Input_objects::archive_start): New function.
14165         (Input_objects::archive_stop): New function.
14166         (Input_objects::print_symbol_counts): New function.
14167         * object.h: Declare Cref and Archive.
14168         (Object::get_global_symbol_counts): New function.
14169         (Object::do_get_global_symbol_counts): New pure virtual function.
14170         (class Sized_relobj): Add defined_count_ field.  Update
14171         declarations.
14172         (class Input_objects): Add cref_ field.  Update constructor.
14173         Update declarations.
14174         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
14175         defined_count_.
14176         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
14177         symbol counts.
14178         (Sized_dynobj::do_get_global_symbol_counts): New function.
14179         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
14180         defined_count_.  Update declarations.  Define Symbols typedef.
14181         * symtab.cc (Symbol_table::add_from_relobj): Add defined
14182         parameter.  Change all callers.
14183         (Symbol_table::add_from_dynobj): Add sympointers and defined
14184         parameters.  Change all callers.
14185         * symtab.h (class Symbol_table): Update declarations.
14186         * Makefile.am (CCFILES): Add cref.cc.
14187         (HFILES): Add cref.h.
14188         * Makefile.in: Rebuild.
14189
14190 2008-07-22  Simon Baldwin  <simonb@google.com>
14191
14192         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
14193         to zero when writing undefined symbols.
14194
14195 2008-07-22  Ian Lance Taylor  <iant@google.com>
14196
14197         * output.cc (Output_section::add_input_section): Don't try to
14198         merge empty merge sections.
14199
14200 2008-07-21  Craig Silverstein  <csilvers@google.com>
14201
14202         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
14203         Include symbol version in error message.
14204
14205 2008-07-20  Chris Demetriou  <cgd@google.com>
14206
14207         * configure.ac (gold_cv_c_random_seed): New configured variable.
14208         (RANDOM_SEED_CFLAGS): New substituted variable.
14209         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
14210         * configure: Rebuild.
14211         * Makefile.in: Likewise.
14212         * testsuite/Makefile.in: Likewise.
14213
14214 2008-07-18  Ian Lance Taylor  <iant@google.com>
14215
14216         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
14217         where we see NAME/NULL and NAME/VERSION  as separate symbols.
14218         * testsuite/ver_test_main.cc (main): Call t4.
14219         (t4, t4_2a): Define.
14220         * testsuite/ver_test_2.cc (t4_2): Define.
14221         * testsuite/ver_test_2.script: Put t4_2a in VER2.
14222         * testsuite/ver_test_4.cc (t4_2a): Define.
14223         * testsuite/ver_test_4.script: Put t4_2a in VER2.
14224         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
14225
14226 2008-07-17  Ian Lance Taylor  <iant@google.com>
14227
14228         * dynobj.cc (Versions::add_def): If we give an error about a
14229         missing version, go ahead and create the version anyhow.
14230
14231 2008-07-10  Ian Lance Taylor  <iant@google.com>
14232
14233         Handle output sections with more than 0x7fffffff bytes.
14234         * object.h (class Relobj): Change map_to_output_ to
14235         output_sections_, and just keep a section pointer.  Change all
14236         uses.  Move comdat group support to Sized_relobj.
14237         (Relobj::is_section_specially_mapped): Remove.
14238         (Relobj::output_section): Remove poff parameter.  Change all
14239         callers.
14240         (Relobj::output_section_offset): New function.
14241         (Relobj::set_section_offset): Rewrite.
14242         (Relobj::map_to_output): Remove.
14243         (Relobj::output_sections): New function.
14244         (Relobj::do_output_section_offset): New pure virtual function.
14245         (Relobj::do_set_section_offset): Likewise.
14246         (class Sized_relobj): Add section_offsets_ field.  Add comdat
14247         group support from Relobj.  Update declarations.
14248         (Sized_relobj::get_output_section_offset): New function.
14249         (Sized_relobj::do_output_section_offset): New function.
14250         (Sized_relobj::do_set_section_offset): New function.
14251         * object.cc (Relobj::output_section_address): Remove.
14252         (Sized_relobj::Sized_relobj): Initialize new fields.
14253         (Sized_relobj::include_section_group): Cast find_kept_object to
14254         Sized_relobj.
14255         (Sized_relobj::include_linkonce_section): Likewise.
14256         (Sized_relobj::do_layout): Use separate arrays for output section
14257         and output offset.
14258         (Sized_relobj::do_count_local_symbols): Change map_to_output to
14259         output_sections.
14260         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
14261         output_sections and section_offsets.
14262         (Sized_relobj::write_local_symbols): Likewise.
14263         (map_to_kept_section): Compute output address directly.
14264         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
14265         output_sections and section_offsets.
14266         (Sized_relobj::write_sections): Likewise.
14267         (Sized_relobj::relocate_sections): Likewise.
14268         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
14269         * output.h (class Output_reloc): Update declarations.  Change
14270         u2_.relobj to Sized_relobj*.
14271         (class Output_data_reloc): Change add functions to use
14272         Sized_relobj*.
14273         * output.cc (Output_reloc::Output_reloc): Change relobj to
14274         Sized_relobj*.
14275         (Output_reloc::local_section_offset): Change return type to
14276         Elf_Addr.  Use get_output_section_offset.
14277         (Output_reloc::get_address): Likewise.
14278         (Output_section::is_input_address_mapped): Don't call
14279         is_section_specially_mapped.
14280         (Output_section::output_offset): Likewise.
14281         (Output_section::output_address): Likewise.
14282         (Output_section::starting_output_address): Likewise.
14283         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
14284         parameter to Sized_relobj*.
14285         (Copy_relocs::need_copy_reloc): Likewise.
14286         (Copy_relocs::save): Likewise.
14287         * copy-relocs.h (class Copy_relocs): Update declarations.
14288         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
14289         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
14290         * target-reloc.h (relocate_for_relocatable): Change
14291         offset_in_output_section type to Elf_Addr.  Change code that uses
14292         it as well.
14293         * layout.cc (Layout::layout): Always set *off.
14294         * mapfile.cc (Mapfile::print_input_section): Use
14295         output_section_offset.
14296         * i386.cc (Target_i386::copy_reloc): Change object parameter to
14297         Sized_relobj*.
14298         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
14299         * sparc.cc (Target_sparc::copy_reloc): Likewise.
14300         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
14301
14302 2008-07-03  Ian Lance Taylor  <iant@google.com>
14303
14304         * layout.cc (Layout::include_section): Do not discard unrecognized
14305         SHT_STRTAB sections.
14306
14307 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
14308
14309         * script.cc (Lex::can_continue_name): Make '?' allowable in
14310         version-script names.
14311         * testsuite/version_script.map: Change glob pattern to use '?'
14312
14313 2008-06-30  Manish Singh  <yosh@gimp.org>
14314
14315         PR 6585
14316         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
14317         Correct typo.
14318
14319 2008-06-30  Ian Lance Taylor  <iant@google.com>
14320
14321         PR 6660
14322         PR 6682
14323         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
14324         versions]: Don't try to read the value in the contents, since we
14325         don't use it.  Use the template endianness when writing.
14326
14327 2008-06-25  Cary Coutant  <ccoutant@google.com>
14328
14329         * fileread.cc (File_read::make_view): Assert on zero-length view.
14330         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
14331         symbol table when there are no symbols to read.
14332
14333 2008-06-23  Craig Silverstein  <csilvers@google.com>
14334
14335         * version.cc (version_string): Bump to 1.7
14336
14337 2008-06-18  Craig Silverstein  <csilvers@google.com>
14338
14339         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
14340         constant 0xFFFF to type Valtype.
14341         (Powerpc_relocate_functions::rel16_ha): Likewise.
14342
14343 2008-06-17  Ian Lance Taylor  <iant@google.com>
14344
14345         * output.h (Output_section::Input_section): Initialize p2align_ to
14346         zero for Output_section_data constructors.
14347         (Output_section::Input_section::addralign): If not an input
14348         section, return the alignment of the Output_section_data.
14349         * testsuite/copy_test.cc: New file.
14350         * testsuite/copy_test_1.cc: New file.
14351         * testsuite/copy_test_2.cc: New file.
14352         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
14353         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
14354         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
14355         (copy_test_1_pic.o, copy_test_1.so): New targets.
14356         (copy_test_2_pic.o, copy_test_2.so): New targets.
14357         * testsuite/Makefile.in: Rebuild.
14358
14359         * script-sections.cc (Script_sections::place_orphan): Initialize
14360         local variable exact.
14361
14362 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
14363
14364         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
14365
14366 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
14367             David S. Miller  <davem@davemloft.net>
14368
14369         * powerpc.cc: New file.
14370         * Makefile.am (TARGETSOURCES): Add powerpc.cc
14371         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
14372         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
14373         * Makefile.in: Rebuild.
14374
14375 2008-06-09  Ian Lance Taylor  <iant@google.com>
14376
14377         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
14378         <exception>.
14379         (throwing, orig_terminate): New static variables.
14380         (terminate_handler): New static function.
14381         (t2): Set terminate handler.
14382
14383 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
14384
14385         PR 6584
14386         * binary.cc (Binary_to_elf::sized_convert): Fix .data
14387         alignment.
14388
14389 2008-05-30  Cary Coutant  <ccoutant@google.com>
14390
14391         * archive.cc (Archive::include_all_members) Correct to step
14392         over symbol table and extended name table in thin archives.
14393
14394 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
14395
14396         PR 6407
14397         * target-reloc.h (relocate_for_relocatable): Fix new_offset
14398         calculation.
14399
14400 2008-05-28  Caleb Howe  <cshowe@google.com>
14401
14402         * reduced_debug_output.cc: New file.
14403         * reduced_debug_output.h: New file.
14404         * options.h (class General_options): Add --strip-debug-non-line.
14405         * options.cc (General_options::finalize): Add strip_debug_non_line
14406         to the strip heirarchy.
14407         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
14408         fields.
14409         * layout.cc: Include "reduced_debug_output.h".
14410         (Layout::Layout): Initialize new fields.
14411         (line_only_debug_sections): New static array.
14412         (is_lines_only_debug_sections): New static inline function.
14413         (Layout::include_section): Handle --strip-debug-non-line.
14414         (Layout::make_output_section): If --strip-debug-non-line, build
14415         new output sections for .debug_abbrev and .debug_info.
14416         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
14417         gold.  Warn about possible overflow.
14418         (read_signed_LEB_128): Likewise.
14419         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
14420         (read_signed_LEB_128): Declare.
14421         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
14422         (HFILES): Add reduced_debug_output.h.
14423         * Makefile.in: Rebuild.
14424
14425 2008-05-21  Ian Lance Taylor  <iant@google.com>
14426
14427         * mapfile.cc: New file.
14428         * mapfile.h: New file.
14429         * options.h (class General_options): Add -M/--print-map and -Map.
14430         * options.cc (General_options::finalize): Make -M equivalent to
14431         -Map -.
14432         * main.cc: Include <cstdio> and "mapfile.h".
14433         (main): Open mapfile if requested.
14434         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
14435         constructor.  Change caller.
14436         (queue_initial_tasks): Add mapfile parameter.  Change caller.
14437         (queue_middle_tasks): Likewise.
14438         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
14439         declarations.
14440         * archive.cc: Include "mapfile.h".
14441         (Archive::add_symbols): Add mapfile parameter.  Change all
14442         callers.  Pass mapfile, symbol, and reason to include_member.
14443         (Archive::include_all_members): Add mapfile parameter.  Change all
14444         callers.
14445         (Archive::include_member): Add mapfile, sym, and why parameters.
14446         Change all callers.  Report inclusion to map file.
14447         * archive.h: Include "fileread.h".
14448         (class Archive): Update declarations.
14449         (Archive::file): New const method.
14450         (class Add_archive_symbols): Add mapfile_ field.  Update
14451         constructor.  Change all callers.
14452         * readsyms.h (class Read_symbols): Likewise.
14453         (class Finish_group): Likewise.
14454         (class Read_script): Likewise.
14455         * common.cc: Include "mapfile.h".
14456         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
14457         all callers.
14458         (Symbol_table::do_allocate_commons): Likewise.
14459         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
14460         symbol allocation to mapfile.
14461         * common.h (class Allocate_commons_task): Add mapfile_ field.
14462         Update constructor.  Change all callers.
14463         * symtab.h (class Symbol_table): Update declarations.
14464         * layout.cc: Include "mapfile.h".
14465         (Layout_task_runner::run): Print information to mapfile.
14466         (Layout::create_gold_note): Change Output_data_fixed_space to
14467         Output_data_zero_fill.
14468         (Layout::create_build_id): Likewise.
14469         (Layout::print_to_mapfile): New function.
14470         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
14471         constructor.  Change caller.
14472         (class Layout): Declare print_to_mapfile.
14473         * output.cc (Output_section::Input_section::print_to_mapfile): New
14474         function.
14475         (Output_section::add_input_section): If producing a map, always
14476         add to input_sections_ list.
14477         (Output_section::do_print_to_mapfile): New function.
14478         (Output_segment::print_sections_to_mapfile): New function.
14479         (Output_segment::print_section_list_to_mapfile): New function.
14480         * output.h: Include "mapfile.h".
14481         (Output_data::print_to_mapfile): New function.
14482         (Output_data::do_print_to_mapfile): New virtual function.
14483         (Output_segment_headers::do_print_to_mapfile): New function.
14484         (Output_file_header::do_print_to_mapfile): New function.
14485         (Output_data_const::do_print_to_mapfile): New function.
14486         (class Output_data_const_buffer): Add map_name_ field.  Update
14487         constructor.  Change all callers.  Add do_print_to_mapfile
14488         function.
14489         (class Output_data_fixed_space): Likewise.
14490         (class Output_data_space): Likewise.
14491         (class Output_data_zero_fill): New class.
14492         (Output_data_strtab::do_print_to_mapfile): New function.
14493         (Output_data_reloc_base::do_print_to_mapfile): New function.
14494         (Output_relocatable_relocs::do_print_to_mapfile): New function.
14495         (Output_data_group::do_print_to_mapfile): New function.
14496         (Output_data_got::do_print_to_mapfile): New function.
14497         (Output_data_dynamic::do_print_to_mapfile): New function.
14498         (Output_symtab_xindex::do_print_to_mapfile): New function.
14499         (class Output_section): Declare do_print_to_mapflie.  Declare
14500         print_to_mapfile in Input_section.
14501         (class Output_segment): Declare new functions.
14502         * object.h (Sized_relobj::symbol_count): New function.
14503         * script-sections.cc
14504         (Output_section_element_dot_assignment::set_section_addresses):
14505         Change Output_data_fixed_space to Output_data_zero_fill.
14506         (Output_data_expression::do_print_to_mapfile): New function.
14507         * script.cc (read_input_script): Add mapfile parameter.  Change
14508         all callers.
14509         * script.h (read_input_script): Update declaration.
14510         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
14511         (Eh_frame::do_print_to_mapfile): New function.
14512         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
14513         (Output_merge_string::do_print_to_mapfile): New function.
14514         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
14515         function.
14516         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
14517         function.
14518         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
14519         function.
14520         * Makefile.am (CCFILES): Add mapfile.cc.
14521         (HFILES): Add mapfile.h.
14522         * Makefile.in: Rebuild.
14523
14524 2008-05-19  Ian Lance Taylor  <iant@google.com>
14525
14526         * options.h (class General_options): Add -z relro.
14527         * layout.cc (Layout::Layout): Initialize relro_segment_.
14528         (Layout::add_output_section_data): Return the output section.
14529         (Layout::make_output_section): Rcognize relro sections and mark
14530         them appropriately.
14531         (Layout::attach_allocated_section_to_segment): Put relro sections
14532         in a PT_GNU_RELRO segment.
14533         (Layout::create_initial_dynamic_sections): Mark the .dynamic
14534         section as relro.
14535         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
14536         PT_TLS segments.
14537         (Layout::linkonce_mapping): Map d.rel.ro.local to
14538         .data.rel.ro.local.
14539         (Layout::output_section_name): Us .data.rel.ro.local for any
14540         section which begins with that.
14541         * layout.h (class Layout): Update add_output_section_data
14542         declaration.  Add relro_segment_ field.
14543         * output.cc (Output_section::Output_section): Initialize is_relro_
14544         and is_relro_local_ fields.
14545         (Output_segment::add_output_section): Group relro sections.
14546         (Output_segment::is_first_section_relro): New function.
14547         (Output_segment::maximum_alignment): If there is a relro section,
14548         align the segment to the common page size.
14549         (Output_segment::set_section_addresses): Track whether we are
14550         looking at relro sections.  If the last section is a relro
14551         section, align to the common page size.
14552         (Output_segment::set_section_list_addresses): Add in_relro
14553         parameter.  Change all callers.  Align to the page size when
14554         moving from relro to non-relro section.
14555         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
14556         segment.
14557         * output.h (class Output_section): Add is_relro_ and
14558         is_relro_local_ fields.
14559         (Output_section::is_relro): New function.
14560         (Output_section::set_is_relro): New function.
14561         (Output_section::is_relro_local): New function.
14562         (Output_section::set_is_relro_local): New function.
14563         (class Output_segment): Update declarations.
14564         * i386.cc (Target_i386::got_section): Mark .got section as relro.
14565         * sparc.cc (Target_sparc::got_section): Likewise.
14566         * x86_64.cc (Target_x86_64::got_section): Likewise.
14567         * testsuite/relro_test_main.cc: New file.
14568         * testsuite/relro_test.cc: New file.
14569         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
14570         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
14571         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
14572         (relro_test.so, relro_test_pic.o): New targets.
14573         * testsuite/Makefile.in: Rebuild.
14574
14575 2008-05-16  Ian Lance Taylor  <iant@google.com>
14576
14577         * output.cc (Output_segment::add_output_section): Remove front
14578         parameter.
14579         * output.h (class Output_segment): Remove
14580         add_initial_output_section and overloaded add_output_section.
14581         Update declaration of remaining add_output_section.
14582         * layout.cc (Layout::create_interp): Call add_output_section
14583         rather than add_initial_output_section.
14584         (Layout::finish_dynamic_section): Likewise.
14585
14586         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
14587         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
14588         know the dynamic type.
14589         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
14590         field.  Initialize it in constructor.
14591         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
14592         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
14593         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
14594         reloc.
14595
14596         * output.cc (Output_reloc::get_address): Change return type to
14597         Elf_Addr.
14598         * output.h (class Output_reloc): Update get_address declaration.
14599         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
14600         for section addresses.
14601
14602 2008-05-09  Ian Lance Taylor  <iant@google.com>
14603
14604         PR 6493
14605         * gold.cc (gold_nomem): Use return value of write.
14606
14607 2008-05-08  Ian Lance Taylor  <iant@google.com>
14608
14609         * symtab.c (Symbol::init_base_output_data): Add version
14610         parameter.  Change all callers.
14611         (Symbol::init_base_output_segment): Likewise.
14612         (Symbol::init_base_constant): Likewise.
14613         (Symbol::init_base_undefined): Likewise.
14614         (Sized_symbol::init_output_data): Likewise.
14615         (Sized_symbol::init_output_segment): Likewise.
14616         (Sized_symbol::init_constant): Likewise.
14617         (Sized_symbol::init_undefined): Likewise.
14618         (Symbol_table::do_define_in_output_data): If the new symbol has a
14619         version, mark it as the default.
14620         (Symbol_table::do_define_in_output_segment): Likewise.
14621         (Symbol_table::do_define_as_constant): Likewise.
14622         * symtab.h (class Symbol): Update declarations.
14623         (class Sized_symbol): Likewise.
14624         * resolve.cc (Symbol::override_version): New function.
14625         (Symbol::override_base): Call override_version.
14626         (Symbol::override_base_with_special): Likewise.
14627         * testsuite/ver_script_8.script: New file.
14628         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
14629         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
14630         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
14631         (ver_test_8_1.so, ver_test_8_2.so): New targets.
14632
14633 2008-05-06  Ian Lance Taylor  <iant@google.com>
14634
14635         PR 6049
14636         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
14637         functions.
14638         (class General_options): Remove existing --undefined, and add
14639         --no-undefined instead.  Add new --undefined as synonym for -u.
14640         * archive.cc (Archive::add_symbols): Check whether symbol was
14641         named with -u.
14642         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
14643         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
14644         all uses.  Add IS_UNDEFINED.  Update declarations to split
14645         different versions of init_base.  Declare init_base_undefined.
14646         (Symbol::is_defined): Handle IS_UNDEFINED.
14647         (Symbol::is_undefined): Likewise.
14648         (Symbol::is_weak_undefined): Call is_undefined.
14649         (Symbol::is_absolute): Handle IS_CONSTANT.
14650         (class Sized_symbol): Update declarations to split different
14651         versions of init.  Declare init_undefined.
14652         (class Symbol_table): Declare new functions.
14653         * symtab.cc (Symbol::init_base_object): Rename from init_base.
14654         Change all callers.
14655         (Symbol::init_base_output_data): Likewise.
14656         (Symbol::init_base_output_segment): Likewise.
14657         (Symbol::init_base_constant): Likewise.
14658         (Symbol::init_base_undefined): New function.
14659         (Sized_symbol::init_object): Rename from init.  Change all
14660         callers.
14661         (Sized_symbol::init_output_data): Likewise.
14662         (Sized_symbol::init_output_segment): Likewise.
14663         (Sized_symbol::init_constant): Likewise.
14664         (Sized_symbol::init_undefined): New function.
14665         (Symbol_table::add_undefined_symbols_from_command_line): New
14666         function.
14667         (Symbol_table::do_add_undefined_symbols_from_command_line): New
14668         function.
14669         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
14670         (Symbol::output_section): Likewise.
14671         (Symbol::set_output_section): Likewise.
14672         (Symbol_table::sized_finalize_symbol): Likewise.
14673         (Symbol_table::sized_write_globals): Likewise.
14674         * resolve.cc (Symbol_table::should_override): Likewise.
14675         (Symbol::override_base_with_special): Likewise.
14676
14677         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
14678         symbol, change it to have default visibility.
14679         * testsuite/protected_1.cc: New file.
14680         * testsuite/protected_2.cc: New file.
14681         * testsuite/protected_3.cc: New file.
14682         * testsuite/protected_main_1.cc: New file.
14683         * testsuite/protected_main_2.cc: New file.
14684         * testsuite/protected_main_3.cc: New file.
14685         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
14686         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
14687         (protected_1_LDFLAGS, protected_1_LDADD): Define.
14688         (protected_1.so): New target.
14689         (protected_1_pic.o, protected_2_pic.o): New targets.
14690         (protected_3_pic.o): New target.
14691         (check_PROGRAMS): Add protected_2.
14692         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
14693         (protected_2_LDFLAGS, protected_2_LDADD): Define.
14694         * testsuite/Makefile.in: Rebuild.
14695
14696         * options.h (DEFINE_var): Add set_user_set_##varname__.
14697         (DEFINE_bool_alias): New macro.
14698         (class General_options): Define -Bstatic using DEFINE_bool_alias
14699         rather than DEFINE_special.  Add --undefined as an alias for -z
14700         defs.
14701         * options.cc (General_options::parse_Bstatic): Remove.
14702
14703         * options.h (class General_options): Add --fatal-warnings.
14704         * main.cc (main): Implement --fatal-warnings.
14705         * errors.h (Errors::warning_count): New function.
14706
14707         * options.h (class General_options): Add -Bsymbolic-functions.
14708         * symtab.h (Symbol::is_preemptible): Check for
14709         -Bsymbolic-functions.
14710
14711 2008-05-05  Ian Lance Taylor  <iant@google.com>
14712
14713         * options.h (DEFINE_bool): For DASH_Z, create the negative option
14714         as noVARNAME rather than no-VARNAME.
14715         (class General_options): Add option -z combreloc.
14716         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
14717         get_address.
14718         (Output_reloc::sort_before) [SHT_REL]: New function.
14719         (Output_reloc::sort_before) [SHT_RELA]: New function.
14720         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
14721         Sort_relocs_comparison.
14722         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
14723         parameter.  Change all callers.
14724         (Output_data_reloc::Output_data_reloc) [both versions]: Add
14725         sort_relocs parameter.  Change all callers.
14726         * output.cc (Output_reloc::get_address): New function, broken out
14727         of write_rel.
14728         (Output_reloc::write_rel): Call it.
14729         (Output_reloc::compare): New function.
14730         (Output_data_reloc_base::do_write): Optionally sort relocs.
14731
14732         * configure.ac: If targ_extra_obj is set, link it in.
14733         * configure.tgt: Initialize all variables.
14734         (x86_64*): Set targ_extra_obj and targ_extra_size.
14735         * configure: Rebuild.
14736
14737         * object.cc (Sized_relobj::include_section_group): Adjust section
14738         indexes read from group data.  Build vector to pass to
14739         layout_group.
14740         * layout.cc (Layout::layout_group): Add flags and shndxes
14741         parameters.  Remove contents parameter.  Change caller.  Update
14742         explicit instantiations.
14743         * layout.h (class Layout): Update layout_group declaration.
14744         * output.cc (Output_data_group::Output_data_group): Add flags and
14745         input_shndxes parameters.  Remove contents parameter.  Change
14746         caller.
14747         (Output_data_group::do_write): Change input_sections_ to
14748         input_shndxes_.
14749         * output.h (class Output_data_group): Update constructor
14750         declaration.  Rename input_sections_ to input_shndxes_.
14751         * testsuite/many_sections_test.cc: Add template.
14752
14753 2008-04-30  Cary Coutant  <ccoutant@google.com>
14754
14755         * target-reloc.h (relocate_section): Fix dead-pointer bug.
14756
14757         * layout.cc (Layout::include_section): Refactored check for debug
14758         info section.
14759         (Layout::add_comdat): Add new parameters.  Change type
14760         of signature parameter.  Add object and shndx to signatures table.
14761         (Layout::find_kept_object): New function.
14762         * layout.h: Include <cstring>.
14763         (Layout::is_debug_info_section): New function.
14764         (Layout::add_comdat): Add new parameters.
14765         (Layout::find_kept_object): New function.
14766         (Layout::Kept_section): New struct.
14767         (Layout::Signatures): Change type of map range.
14768         * object.cc (Relobj::output_section_address): New function.
14769         (Sized_relobj::include_section_group): Add new parameters.  Change
14770         calls to Layout::add_comdat.  Change to build table of kept comdat
14771         groups and table mapping discarded sections to kept sections.
14772         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
14773         (Sized_relobj::do_layout): Change calls to include_section_group and
14774         include_linkonce_section.
14775         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
14776         value to zero when section is discarded.
14777         (Sized_relobj::map_to_kept_section): New function.
14778         * object.h (Relobj::output_section_address): New function.
14779         (Relobj::Comdat_group): New type.
14780         (Relobj::find_comdat_group): New function.
14781         (Relobj::Comdat_group_table): New type.
14782         (Relobj::Kept_comdat_section): New type.
14783         (Relobj::Kept_comdat_section_table): New type.
14784         (Relobj::add_comdat_group): New function.
14785         (Relobj::set_kept_comdat_section): New function.
14786         (Relobj::get_kept_comdat_section): New function.
14787         (Relobj::comdat_groups_): New field.
14788         (Relobj::kept_comdat_sections_): New field.
14789         (Symbol_value::input_value): Update comment.
14790         (Sized_relobj::map_to_kept_section) New function.
14791         (Sized_relobj::include_linkonce_section): Add new parameter.
14792         * target-reloc.h (Comdat_behavior): New type.
14793         (get_comdat_behavior): New function.
14794         (relocate_section): Add code to map a discarded section to the
14795         corresponding kept section when applying a relocation.
14796
14797 2008-04-30  Craig Silverstein  <csilvers@google.com>
14798
14799         * dwarf_reader.cc (next_generation_count): New static var.
14800         (Addr2line_cache_entry): New struct.
14801         (addr2line_cache): New static var.
14802         (Dwarf_line_info::one_addr2line): Added caching.
14803         (Dwarf_line_info::clear_addr2line_cache): New function.
14804         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
14805         cache-size parameter.
14806         (Dwarf_line_info::one_addr2line_cache): New function.
14807         * symtab.cc (Symbol_table::detect_odr_violations): Pass
14808         new cache-size argument to one_addr2line(), and clear cache.
14809
14810 2008-04-28  Cary Coutant  <ccoutant@google.com>
14811
14812         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
14813         R_386_PC8 relocations.
14814
14815 2008-04-23  Ian Lance Taylor  <iant@google.com>
14816
14817         * object.cc (Sized_relobj::include_section_group): Check for
14818         invalid section group.
14819
14820         * object.cc (make_elf_object): Correct test for 64-bit ELF file
14821         header size.
14822
14823         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
14824         than read for file header.
14825         * archive.cc (Archive::include_member): Likewise.
14826
14827 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
14828
14829         * aclocal.m4: Regenerate.
14830         * configure: Regenerate.
14831
14832 2008-04-19  Ian Lance Taylor  <iant@google.com>
14833
14834         * version.cc (version_string): Bump to 1.6.
14835
14836         * testsuite/Makefile.am (many_sections_r_test): New target.
14837         (many_sections_r_test_SOURCES): Remove.
14838         (many_sections_r_test_DEPENDENCIES): Remove.
14839         (many_sections_r_test_LDFLAGS): Remove.
14840         (many_sections_r_test_LDADD): Remove.
14841
14842         * object.cc (Sized_relobj::do_add_symbols): Always pass
14843         local_symbol_count_ to add_from_relobj.
14844
14845         * testsuite/Makefile.am (many_sections_check.h): Only check one in
14846         every thousand variables.
14847         * testsuite/Makefile.in: Rebuild.
14848
14849         * object.cc (Xindex::initialize_symtab_xindex): New function.
14850         (Xindex::read_symtab_xindex): New function.
14851         (Xindex::sym_xindex_to_shndx): New function.
14852         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
14853         available.
14854         (Sized_relobj::do_initialize_xindex): New function.
14855         (Sized_relobj::do_read_symbols): Adjust section links.
14856         (Sized_relobj::symbol_section_and_value): Add is_ordinary
14857         parameter.  Change all callers.
14858         (Sized_relobj::include_section_group): Adjust section links and
14859         symbol section indexes.
14860         (Sized_relobj::do_layout): Adjust section links.
14861         (Sized_relobj::do_count_local_symbols): Adjust section links and
14862         symbol section indexes.
14863         (Sized_relobj::do_finalize_local_symbols): Distinguish between
14864         ordinary and special symbols.
14865         (Sized_relobj::write_local_symbols): Add symtab_xindex and
14866         dynsym_xindex parameters.  Change all callers.  Adjust section
14867         links.  Use SHN_XINDEX when needed.
14868         (Sized_relobj::get_symbol_location_info): Adjust section links.
14869         Don't get fooled by special symbols.
14870         * object.h (class Xindex): Define.
14871         (class Object): Add xindex_ parameter.  Declare virtual functoin
14872         do_initialize_xindex.
14873         (Object::adjust_sym_shndx): New function.
14874         (Object::set_xindex): New protected function.
14875         (class Symbol_value): Add is_ordinary_shndx_ field.
14876         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
14877         (Symbol_value::value): Assert ordinary section.
14878         (Symbol_value::initialize_input_to_output_map): Likewise.
14879         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
14880         Change all callers.
14881         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
14882         all callers.
14883         (class Sized_relobj): Update declarations.
14884         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
14885         parameter.  Change all callers.
14886         (Sized_relobj::adjust_shndx): New function.
14887         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
14888         field.
14889         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
14890         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
14891         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
14892         (Sized_dynobj::read_dynsym_section): Adjust section links.
14893         (Sized_dynobj::read_dynamic): Likewise.
14894         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
14895         section links.
14896         (Sized_dynobj::do_initialize_xindex): New function.
14897         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
14898         do_initialize_xindex.
14899         (Sized_dynobj::adjust_shndx): New function.
14900         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
14901         dynsym_xindex_ fields.
14902         (Layout::finalize): Add a call to set_section_indexes before
14903         creating the symtab sections.
14904         (Layout::set_section_indexes): Don't do anything if the section
14905         already has a section index.
14906         (Layout::create_symtab_sections): Add shnum parameter.  Change
14907         caller.  Create .symtab_shndx section if needed.
14908         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
14909         caller.
14910         (Layout::allocated_output_section_count): New function.
14911         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
14912         needed.
14913         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
14914         fields.  Update declarations.
14915         (Layout::symtab_xindex): New function.
14916         (Layout::dynsym_xindex): New function.
14917         (class Write_symbols_task): Add layout_ field.
14918         (Write_symbols_task::Write_symbols_task): Add layout parameter.
14919         Change caller.
14920         * output.cc (Output_section_headers::Output_section_headers): Add
14921         shstrtab_section parameter.  Change all callers.
14922         (Output_section_headers::do_sized_write): Store overflow values
14923         for section count and section string table section index in
14924         section header zero.
14925         (Output_file_header::do_sized_write): Check for overflow of
14926         section count and section string table section index.
14927         (Output_symtab_xindex::do_write): New function.
14928         (Output_symtab_xindex::endian_do_write): New function.
14929         * output.h (class Output_section_headers): Add shstrtab_section_.
14930         Update declarations.
14931         (class Output_symtab_xindex): Define.
14932         (Output_section::has_out_shndx): New function.
14933         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
14934         field.
14935         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
14936         Change all callers.
14937         (Sized_symbol::init): Likewise.
14938         (Symbol::output_section): Check for ordinary symbol.
14939         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
14940         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
14941         callers.
14942         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
14943         Change all callers.  Simplify handling of symbols from sections
14944         not included in the link.
14945         (Symbol_table::add_from_dynobj): Handle ordinary symbol
14946         distinction.
14947         (Weak_alias_sorter::operator()): Assert that symbols are
14948         ordinary.
14949         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
14950         distinction.
14951         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
14952         parameters.  Change all callers.
14953         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
14954         symbol distinction.  Use SHN_XINDEX when needed.
14955         (Symbol_table::write_section_symbol): Add symtab_xindex
14956         parameter.  Change all callers.
14957         (Symbol_table::sized_write_section_symbol): Likewise.  Use
14958         SHN_XINDEX when needed.
14959         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
14960         declarations.
14961         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
14962         (Symbol::is_defined): Check is_ordinary.
14963         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
14964         (Symbol::is_absolute, Symbol::is_common): Likewise.
14965         (class Sized_symbol): Update declarations.
14966         (class Symbol_table): Update declarations.
14967         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
14968         parameters.  Change all callers.
14969         (Sized_symbol::override): Likewise.
14970         (Symbol_table::override): Likewise.
14971         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
14972         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
14973         is_ordinary, and orig_st_shndx parameters.  Change all callers.
14974         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
14975         to be in an ordinary section.
14976         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
14977         object and is_ordinary parameters.  Change all callers.
14978         (Sized_dwarf_line_info::read_relocs): Add object parameter.
14979         Change all callers.  Don't add undefined or non-ordinary symbols
14980         to reloc_map_.
14981         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
14982         Change all callers.
14983         * dwarf_reader.h (class Sized_dwarf_line_info): Update
14984         declarations.
14985         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
14986         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
14987         (Sized_relobj::relocate_sections): Likewise.
14988         * target-reloc.h (scan_relocs): Adjust section symbol index.
14989         (scan_relocatable_relocs): Likewise.
14990         * i386.cc (Scan::local): Check for ordinary symbols.
14991         * sparc.cc (Scan::local): Likewise.
14992         * x86_64.cc (Scan::local): Likewise.
14993         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
14994         to symbol_section_and_value.
14995         * testsuite/many_sections_test.cc: New file.
14996         * testsuite/Makefile.am (BUILT_SOURCES): Define.
14997         (check_PROGRAMS): Add many_sections_test.
14998         (many_sections_test_SOURCES): Define.
14999         (many_sections_test_DEPENDENCIES): Define.
15000         (many_sections_test_LDFLAGS): Define.
15001         (BUILT_SOURCES): Add many_sections_define.h.
15002         (many_sections_define.h): New target.
15003         (BUILT_SOURCES): Add many_sections_check.h.
15004         (many_sections_check.h): New target.
15005         (check_PROGRAMS): Add many_sections_r_test.
15006         (many_sections_r_test_SOURCES): Define.
15007         (many_sections_r_test_DEPENDENCIES): Define.
15008         (many_sections_r_test_LDFLAGS): Define.
15009         (many_sections_r_test_LDADD): Define.
15010         (many_sections_r_test.o): New target.
15011         * testsuite/Makefile.in: Rebuild.
15012
15013 2008-04-17  Cary Coutant  <ccoutant@google.com>
15014
15015         * errors.cc (Errors::info): New function.
15016         (gold_info): New function.
15017         * errors.h (Errors::info): New function.
15018         * gold.h (gold_info): New function.
15019         * object.cc (Input_objects::add_object): Print trace output.
15020         * options.cc (options::parse_set): New function.
15021         (General_options::parse_wrap): Deleted.
15022         (General_options::General_options): Deleted initializer.
15023         * options.h (options::String_set): New typedef.
15024         (options::parse_set): New function.
15025         (DEFINE_set): New macro.
15026         (General_options::wrap): Changed to use DEFINE_set. Changed
15027         callers of any_wrap_symbols and is_wrap_symbol.
15028         (General_options::trace, General_options::trace_symbol):
15029         New options.
15030         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
15031         (General_options::wrap_symbols_): Deleted.
15032         * symtab.cc (Symbol_table::add_from_object): Print trace output.
15033
15034 2008-04-17  David S. Miller  <davem@davemloft.net>
15035
15036         * options.cc (General_options::parse_V): New function.
15037         * options.h: Add entries for -V and -Qy.
15038
15039 2008-04-17  Ian Lance Taylor  <iant@google.com>
15040
15041         * common.cc (Symbol_table::allocate_commons): Remove options
15042         parameter.  Change caller.
15043         (Symbol_table::do_allocate_commons): Remove options parameter.
15044         Change caller.  Just call do_allocate_commons_list twice.
15045         (Symbol_table::do_allocate_commons_list): New function, broken out
15046         of do_allocate_commons.
15047         * common.h (class Allocate_commons_task): Remove options_ field.
15048         Update constructor.
15049         * symtab.cc (Symbol_table::Symbol_table): Initialize
15050         tls_commons_.
15051         (Symbol_table::add_from_object): Put TLS common symbols on
15052         tls_commons_ list.
15053         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
15054         which are IN_OUTPUT_DATA.
15055         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
15056         allocate_commons and do_allocate_commons declarations.  Declare
15057         do_allocate_commons_list.
15058         * gold.cc (queue_middle_tasks): Update creation of
15059         Allocate_commons_task to not pass options.
15060         * testsuite/Makefile.am (INCLUDES): Add -I.. .
15061         (TLS_TEST_C_FLAGS): New variable.
15062         (tls_test_c_pic.o): New target.
15063         (tls_test_shared.so): Link in tls_test_c_pic.o.
15064         (tls_test_c_pic_ie.o): New target.
15065         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
15066         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
15067         (tls_test_c.o): New target.
15068         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
15069         (tls_pic_test_LDADD): Likewise.
15070         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
15071         (tls_shared_gd_to_ie_test_LDADD): Likewise.
15072         (tls_test_c_gnu2.o): New target.
15073         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
15074         tls_test_c_gnu2.o.
15075         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
15076         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
15077         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
15078         * testsuite/tls_test.cc: Include "config.h".
15079         (t_last): Call t11_last.
15080         * testsuite/tls_test.h (t11, t11_last): Declare.
15081         * testsuite/tls_test_c.c: New file.
15082         * testsuite/tls_test_main.cc (thread_routine): Call t11.
15083         * configure.ac: Check for OpenMP support.
15084         * configure, config.in, Makefile.in: Rebuild.
15085         * testsuite/Makefile.in: Rebuild.
15086
15087 2008-04-16  Cary Coutant  <ccoutant@google.com>
15088
15089         * i386.cc (Target_i386::define_tls_base_symbol): New function.
15090         (Target_i386::tls_base_symbol_defined_): New field.
15091         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
15092         (Target_i386::Scan::global): Likewise.
15093         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
15094         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
15095         (Target_x86_64::tls_base_symbol_defined_): New field.
15096         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
15097         (Target_x86_64::Scan::global): Likewise.
15098
15099 2008-04-16  Cary Coutant  <ccoutant@google.com>
15100
15101         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
15102         (Symbol::needs_plt_entry): Allow weak undefined symbols.
15103         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
15104         building shared libraries.
15105         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
15106         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
15107         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
15108         * testsuite/Makefile.in: Rebuild.
15109         * testsuite/weak_undef.h: New file.
15110         * testsuite/weak_undef_file1.cc: Add extra test cases.
15111         * testsuite/weak_undef_file2.cc: Likewise.
15112         * testsuite/weak_undef_test.cc: Likewise.
15113
15114 2008-04-16  David S. Miller  <davem@davemloft.net>
15115
15116         * sparc.cc (Target_sparc::Scan): Change from struct to class.
15117         Add issued_non_pic_error_ field.  Declare check_non_pic.
15118         (Target_sparc::Scan::check_non_pic): New function.
15119         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
15120         (Target_sparc::Scan::global): Likewise.
15121
15122         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
15123         * configure: Rebuild.
15124
15125         * options.h (DEFINE_enable): New macro.
15126         (new_dtags): New enable option.
15127         (initfirst, interpose, loadfltr, nodefaultlib,
15128         nodelete, nodlopen, nodump): New -z options.
15129         * layout.cc (Layout:finish_dynamic_section): If new
15130         dtags enabled, emit DT_RUNPATH.  Also, emit a
15131         DT_FLAGS_1 containing any specified -z flags.
15132
15133 2008-04-16  Ian Lance Taylor  <iant@google.com>
15134
15135         * copy-relocs.cc: New file.
15136         * copy-relocs.h: New file.
15137         * reloc.cc: Remove Copy_relocs code.
15138         * reloc.h: Likewise.
15139         * reloc-types.h (struct Reloc_types) [both versions]: Add
15140         get_reloc_addend_noerror.
15141         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
15142         variants of add_global which take an addend which must be zero.
15143         * i386.cc: Include "copy-relocs.h".
15144         (class Target_i386): Change type of copy_relocs_ to variable,
15145         update initializer.
15146         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
15147         Change all callers.
15148         (Target_i386::do_finalize_sections): Change handling of
15149         copy_relocs_.
15150         * sparc.cc: Include "copy-relocs.h".
15151         (class Target_sparc): Change type of copy_relocs_ to variable,
15152         update initializer.
15153         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
15154         Change all callers.
15155         (Target_sparc::do_finalize_sections): Change handling of
15156         copy_relocs_.
15157         * x86_64.cc: Include "copy-relocs.h".
15158         (class Target_x86_64): Change type of copy_relocs_ to variable,
15159         update initializer.
15160         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
15161         class.  Change all callers.
15162         (Target_x86_64::do_finalize_sections): Change handling of
15163         copy_relocs_.
15164         * Makefile.am (CCFILES): Add copy-relocs.cc.
15165         (HFILES): Add copy-relocs.h.
15166
15167         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
15168
15169         * testsuite/script_test_4.sh: Permit leading zeroes.
15170
15171 2008-04-15  Ian Lance Taylor  <iant@google.com>
15172
15173         * script-sections.cc (Script_sections::create_segments): Use
15174         header_size_adjustment even when there is enough room for the
15175         headers.
15176         * testsuite/script_test_4.sh: New file.
15177         * testsuite/script_test_4.t: New file.
15178         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
15179         (check_DATA): Add script_test_4.stdout.
15180         (MOSTLYCLEANFILES): Likewise.
15181         (script_test_4): New target.
15182         (script_test_4.stdout): New target.
15183         * testsuite/Makefile.in: Rebuild.
15184
15185         * sparc.cc: Add definitions for Output_data_plt_sparc class
15186         constants.
15187
15188 2008-04-14  David S. Miller  <davem@davemloft.net>
15189
15190         * sparc.cc: New file.
15191         * Makefile.am (TARGETSOURCES): Add sparc.cc
15192         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
15193         * configure.tgt: Document targ_extra_size and
15194         targ_extra_big_endian.  Add entries for sparc-* and
15195         sparc64-*.
15196         * configure.ac: Handle targ_extra_size and
15197         targ_extra_big_endian.
15198         * Makefile.in: Rebuild.
15199         * configure: Likewise.
15200         * po/POTFILES.in: Likewise.
15201         * po/gold.pot: Likewise.
15202
15203 2008-04-14  Ian Lance Taylor  <iant@google.com>
15204
15205         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
15206         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
15207         in the name/type/flags to section mapping.  Don't call
15208         allocate_output_section.
15209         (Layout::choose_output_section): Change parameter from adjust_name
15210         to is_input_section.  Don't permit input sections after sections
15211         are attached to segments.  Don't call allocate_output_section.
15212         (Layout::layout_eh_frame): Call update_flags_for_input_section,
15213         not write_enable_output_section.
15214         (Layout::make_output_section): Don't push to
15215         unattached_section_list_ nor call attach_to_segment.  Call
15216         attach_section_to_segment if sections are attached.
15217         (Layout::attach_sections_to_segments): New function.
15218         (Layout::attach_section_to_segment): New function.
15219         (Layout::attach_allocated_section_to_segment): Rename from
15220         attach_to_segment.  Remove flags parameter.
15221         (Layout::allocate_output_section): Remove function.
15222         (Layout::write_enable_output_section): Remove function.
15223         * layout.h (class Layout): Update for above changes.  Add new
15224         field sections_are_attached_.
15225         * output.h (Output_section::update_flags_for_input_section): New
15226         function.
15227         * output.cc (Output_section::add_input_section): Call
15228         update_flags_for_input_section.
15229         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
15230
15231 2008-04-11  Cary Coutant  <ccoutant@google.com>
15232
15233         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
15234         thought unnecessary.
15235         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
15236
15237 2008-04-11  Ian Lance Taylor  <iant@google.com>
15238
15239         * output.h (class Output_section_data): Remove inline definition
15240         of set_addralign.
15241         * output.cc (Output_section_data::set_addralign): New function.
15242
15243 2008-04-11  Cary Coutant  <ccoutant@google.com>
15244
15245         Add support for TLS descriptors for i386 and x86_64.
15246         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
15247         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
15248         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
15249         GOT_TYPE_TLS_DESC.
15250         (Target_i386::got_mod_index_entry): Remove unnecessary code.
15251         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
15252         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
15253         relocations.
15254         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
15255         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
15256         Fix problem with initial-exec relocations.
15257         (Target_i386::Relocate::relocate_tls): Likewise.
15258         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
15259         relaxation.
15260         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
15261         support for section-plus-offset dynamic table entries.
15262         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
15263         (Output_data_dynamic::Dynamic_entry): Add support for
15264         section-plus-offset dynamic table entries.
15265         (Output_data_dynamic::Classification): Likewise.
15266         (Output_data_dynamic::classification_): Renamed offset_.
15267         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
15268         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
15269         (Target_x86_64::make_plt_section): New function.
15270         (Target_x86_64::reserve_tlsdesc_entries): New function.
15271         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
15272         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
15273         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
15274         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
15275         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
15276         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
15277         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
15278         add extra PLT entry for TLS descriptors.
15279         (Output_data_plt_x86_64::got_): New field.
15280         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
15281         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
15282         fields.
15283         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
15284         descriptors.
15285         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
15286         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
15287         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
15288         R_386_TLS_DESC_CALL relocations.
15289         (Target_x86_64::Scan::global): Likewise.
15290         (Target_x86_64::do_finalize_sections): Add dynamic table entries
15291         for TLS descriptors.
15292         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
15293         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
15294         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
15295         GD-to-IE relaxation.
15296         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
15297         and TLS_DESCRIPTORS.
15298         * Makefile.in: Rebuild.
15299         * configure: Rebuild.
15300         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
15301         (tls_test_shared2.so): New target.
15302         (tls_shared_gd_to_ie_test_SOURCES): New variable.
15303         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
15304         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
15305         (tls_shared_gd_to_ie_test_LDADD): New variable.
15306         (tls_shared_gnu2_gd_to_ie_test): New target.
15307         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
15308         New targets.
15309         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
15310         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
15311         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
15312         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
15313         (tls_shared_gnu2_test): New target.
15314         (tls_test_gnu2_shared.so): New target.
15315         (tls_shared_gnu2_test_SOURCES): New variable.
15316         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
15317         (tls_shared_gnu2_test_LDFLAGS): New variable.
15318         (tls_shared_gnu2_test_LDADD): New variable.
15319         * testsuite/Makefile.in: Rebuild.
15320         * testsuite/Makefile.
15321
15322 2008-04-11  Ian Lance Taylor  <iant@google.com>
15323
15324         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
15325         justsyms.t.
15326         * testsuite/Makefile.in: Rebuild.
15327
15328         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
15329         long.
15330         * testsuite/script_test_2.cc (main): Adjust test.
15331
15332 2008-04-11  David S. Miller  <davem@davemloft.net>
15333             Ian Lance Taylor  <iant@google.com>
15334
15335         * options.h (General_options): Add entries for '-Y' and
15336         '-relax'.
15337         * options.cc (General_options:finalize): If -Y was used, add those
15338         entries to the library path instead of the default "/lib" and
15339         "/usr/lib".
15340
15341 2008-04-11  David S. Miller  <davem@davemloft.net>
15342
15343         * testsuite/justsyms.t: Start at 0x100.
15344         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
15345         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
15346         long.
15347         * testsuite/script_test_2.cc: Adjust string and section length
15348         checks.
15349
15350 2008-04-09  Ian Lance Taylor  <iant@google.com>
15351
15352         PR gold/5996
15353         * script-sections.cc (Sections_element::allocate_to_segment): Add
15354         orphan parameter.
15355         (Output_section_definition::allocate_to_segment): Likewise.
15356         (Orphan_output_section::allocate_to_segment): Likewise.
15357         (Script_sections::attach_sections_using_phdrs_clause): Don't
15358         propagate non-PT_LOAD segments to orphan sections.
15359         * testsuite/Makefile.am (script_test_3.stdout): Generate using
15360         readelf rather than objdump.
15361         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
15362         .interp section and PT_INTERP segment are the same size.
15363         * testsuite/Makefile.in: Rebuild.
15364
15365         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
15366         aliases for symbols defined in the same object.
15367         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
15368         (weak_alias_test_SOURCES): New variable.
15369         (weak_alias_test_DEPENDENCIES): New variable.
15370         (weak_alias_test_LDFLAGS): New variable.
15371         (weak_alias_test_LDADD): New variable.
15372         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
15373         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
15374         (weak_alias_test_3.o): New target.
15375         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
15376         * testsuite/weak_alias_test_main.cc: New file.
15377         * testsuite/weak_alias_test_1.cc: New file.
15378         * testsuite/weak_alias_test_2.cc: New file.
15379         * testsuite/weak_alias_test_3.cc: New file.
15380
15381 2008-04-08  Ian Lance Taylor  <iant@google.com>
15382
15383         * options.h (class General_options): Add --noinhibit-exec option.
15384         * main.cc (main): Check --noinhibit-exec.
15385
15386         * options.h (class General_options): Define --wrap as a special
15387         option.  Add wrap_symbols_ field.
15388         (General_options::any_wrap_symbols): New function.
15389         (General_options::is_wrap_symbol): New function.
15390         * options.cc (General_options::parse_wrap): New function.
15391         (General_options::General_options): Initialize wrap_symbols_.
15392         * symtab.cc (Symbol_table::wrap_symbol): New function.
15393         (Symbol_table::add_from_object): Handle --wrap.
15394         * symtab.h (class Symbol_table): Declare wrap_symbol.
15395         * target.h (Target::wrap_char): New function.
15396         (Target::Target_info): Add wrap_char field.
15397         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
15398         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
15399         * testsuite/testfile.cc (Target_test::test_target_info):
15400         Likewise.
15401
15402         * errors.cc (Errors::undefined_symbol): Mention symbol version if
15403         there is one.
15404
15405         * layout.h (class Layout): Add added_eh_frame_data_ field.
15406         * layout.cc (Layout::Layout): Initialize new field.
15407         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
15408         output section until we find a section we merged successfully.
15409         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
15410         that the size be non-zero.
15411
15412         * merge.cc (Object_merge_map::get_output_offset): Remove inline
15413         qualifier.
15414
15415 2008-04-08  Craig Silverstein  <csilvers@google.com>
15416
15417         * configure.ac: Export new conditional variable HAVE_ZLIB.
15418         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
15419         on HAVE_ZLIB.
15420         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
15421         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15422
15423 2008-04-07  Ian Lance Taylor  <iant@google.com>
15424
15425         * version.cc (version_string): Set to "1.5".
15426
15427         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
15428         Add issued_non_pic_error_ field.  Declare check_non_pic.
15429         (Target_x86_64::Scan::check_non_pic): New function.
15430         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
15431         (Target_x86_64::Scan::global): Likewise.
15432
15433         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
15434         addend parameter.  Change caller.  Handle merge sections.
15435         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
15436         Address to Addend.  Don't add in the result of
15437         local_section_offset, pass down the addend and use the returned
15438         value.
15439         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
15440         Update declarations of local_section_offset and symbol_value.
15441         * testsuite/two_file_test_1.cc (t18): New function.
15442         * testsuite/two_file_test_2.cc (f18): New function.
15443         * testsuite/two_file_test_main.cc (main): Call t18.
15444         * testsuite/two_file_test.h (t18, f18): Declare.
15445
15446         * configure.ac: Don't test for objdump, c++filt, or readelf.
15447         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
15448         conditionals.
15449         (TEST_READELF): New variable.
15450         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
15451         (check_PROGRAMS): Add two_file_strip_test.
15452         (two_file_strip_test): New target.
15453         (check_PROGRAMS): Add two_file_same_shared_strip_test.
15454         (two_file_same_shared_strip_test_SOURCES): New variable.
15455         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
15456         (two_file_same_shared_strip_test_LDFLAGS): New variable.
15457         (two_file_same_shared_strip_test_LDADD): New variable.
15458         (two_file_shared_strip.so): New target.
15459         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
15460         (ver_test_5.syms, ver_test_7.syms): Likewise.
15461         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
15462         (strip_test_3.stdout): Use TEST_OBJDUMP.
15463         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15464
15465 2008-04-04  Cary Coutant  <ccoutant@google.com>
15466
15467         * symtab.h (Symbol::is_weak_undefined): New function.
15468         (Symbol::is_strong_undefined): New function.
15469         (Symbol::is_absolute): New function.
15470         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
15471         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
15472         absolute symbols.
15473         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
15474         (weak_undef_test): New target.
15475         * testsuite/Makefile.in: Rebuild.
15476         * testsuite/weak_undef_file1.cc: New file.
15477         * testsuite/weak_undef_file2.cc: New file.
15478         * testsuite/weak_undef_test.cc: New file.
15479
15480 2008-04-03  Craig Silverstein  <csilvers@google.com>
15481
15482         * compressed_output.h (class Output_compressed_section): Use
15483         unsigned buffer.
15484         * compressed_output.cc (zlib_compress): Use unsigned buffers,
15485         add zlib header.
15486         (zlib_compressed_suffix): Removed.
15487         (Output_compressed_section::set_final_data_size): Use unsigned
15488         buffers.
15489         * testsuite/Makefile.am (flagstest_compress_debug_sections):
15490         Fix linker invocation.
15491         (flagstest_o_specialfile_and_compress_debug_sections):
15492         Likewise.
15493         * testsuite/Makefile.in: Regenerated.
15494
15495 2008-04-02  David S. Miller  <davem@davemloft.net>
15496
15497         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
15498         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
15499
15500 2008-04-02  Craig Silverstein  <csilvers@google.com>
15501
15502         * TODO: New file.
15503
15504 2008-04-02  Ian Lance Taylor  <iant@google.com>
15505
15506         * fileread.cc (File_read::find_view): Add byteshift and vshifted
15507         parameters.  Update for new key type to views_.  Change all
15508         callers.
15509         (File_read::read): Adjust for byteshift in returned view.
15510         (File_read::add_view): New function, broken out of
15511         find_and_make_view.
15512         (File_read::make_view): New function, broken out of
15513         find_and_make_view.
15514         (File_read::find_or_make_view): Add offset and aligned
15515         parameters.  Rewrite accordingly.  Change all callers.
15516         (File_read::get_view): Add offset and aligned parameters.  Adjust
15517         for byteshift in return value.
15518         (File_read::get_lasting_view): Likewise.
15519         * fileread.h (class File_read): Update declarations.
15520         (class File_read::View): Add byteshift_ field.  Add byteshift to
15521         constructor.  Add byteshift method.
15522         * archive.h (Archive::clear_uncached_views): New function.
15523         (Archive::get_view): Add aligned parameter.  Change all callers.
15524         * object.h (Object::get_view): Add aligned parameter.  Change all
15525         callers.
15526         (Object::get_lasting_view): Likewise.
15527
15528         * fileread.cc (File_read::release): Don't call clear_views if
15529         there are multiple objects.
15530         * fileread.h (File_read::clear_uncached_views): New function.
15531         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
15532         on the archive.
15533
15534 2008-03-31  Cary Coutant  <ccoutant@google.com>
15535
15536         Add thin archive support.
15537         * archive.cc (Archive::armagt): New const.
15538         (Archive::setup): Remove task parameter and calls to unlock.
15539         (Archive::unlock_nested_archives): New function.
15540         (Archive::read_header): Add nested_off parameter. Change
15541         all callers.
15542         (Archive::interpret_header): Likewise.
15543         (Archive::include_all_members): Change to handle thin
15544         archives.
15545         (Archive::include_member): Likewise.
15546         * archive.h (Archive::Archive): Add new parameters and
15547         initializers.
15548         (Archive::armagt): New const.
15549         (Archive::setup): Remove task parameter.
15550         (Archive::unlock_nested_archives): New function.
15551         (Archive::read_header): Add nested_off parameter.
15552         (Archive::interpret_header): Likewise.
15553         (Archive::Nested_archive_table): New typedef.
15554         (Archive::is_thin_archive_): New field.
15555         (Archive::nested_archives_): New field.
15556         (Archive::options_): New field.
15557         (Archive::dirpath_): New field.
15558         (Archive::task_): New field.
15559         * readsyms.cc (Read_symbols::do_read_symbols): Add check
15560         for thin archives.  Pass additional parameters to
15561         Archive::Archive.  Unlock the archive file after calling
15562         Archive::setup.
15563
15564 2008-03-29  Ian Lance Taylor  <iant@google.com>
15565
15566         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
15567         version symbol to be local.
15568         * testsuite/ver_test_4.sh: New file.
15569         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
15570         (check_DATA): Add ver_test_4.syms.
15571         (ver_test_4.syms): New target.
15572         * testsuite/Makefile.in: Rebuild.
15573
15574         * output.cc
15575         (Output_section::Input_section_sort_entry::has_priority): New
15576         function.
15577         (Output_section::Input_section_sort_entry::match_file_name): New
15578         function.
15579         (Output_section::Input_section_sort_entry::match_section_name):
15580         Remove.
15581         (Output_section::Input_section_sort_entry::match_section_name_prefix):
15582         Remove.
15583         (Output_section::Input_section_sort_entry::match_section_file):
15584         Remove.
15585         (Output_section::Input_section_sort_compare::operator()): Rewrite
15586         using new Input_section_sort_entry functions.  Sort crtbegin and
15587         crtend first.  Sort sections with no priority before sections with
15588         a priority.
15589         * testsuite/initpri1.c (d3): Check j != 4.
15590         (cd5): New constructor/destructor function.
15591         (main): Check j != 2.
15592
15593         * symtab.cc (Symbol_table::add_from_object): If we don't use the
15594         new symbol when resolving, don't call set_is_default.
15595         * testsuite/ver_test_7.cc: New file.
15596         * testsuite/ver_test_7.sh: New file.
15597         * testsuite/Makefile.am (ver_test_7.so): New target.
15598         (ver_test_7.o): New target.
15599         (check_SCRIPTS): Add ver_test_7.sh.
15600         (check_DATA): Add ver_test_7.syms.
15601         (ver_test_7.syms): New target.
15602
15603 2008-03-28  Ian Lance Taylor  <iant@google.com>
15604
15605         * layout.cc (Layout::layout): If we see an input section with a
15606         name that needs sorting, set the must_sort flag for the output
15607         section.
15608         (Layout::make_output_section): If the name of the output section
15609         indicates that it might require sorting, set the may_sort flag.
15610         * output.h (Output_section::may_sort_attached_input_sections): New
15611         function.
15612         (Output_section::set_may_sort_attached_input_sections): New
15613         function.
15614         (Output_section::must_sort_attached_input_sections): New
15615         function.
15616         (Output_section::set_must_sort_attached_input_sections): New
15617         function.
15618         (class Output_section): Declare Input_section_sort_entry.  Define
15619         Input_section_sort_compare.  Declare
15620         sort_attached_input_sections.  Add new fields:
15621         may_sort_attached_input_sections_,
15622         must_sort_attached_input_sections_,
15623         attached_input_sections_are_sorted_.
15624         * output.cc (Output_section::Output_section): Initialize new
15625         fields.
15626         (Output_section::add_input_section): Add an entry to
15627         input_sections_ if may_sort or must_sort are true.
15628         (Output_section::set_final_data_size): Call
15629         sort_attached_input_sections if necessary.
15630         (Output_section::Input_section_sort_entry): Define new class.
15631         (Output_section::Input_section_sort_compare::operator()): New
15632         function.
15633         (Output_section::sort_attached_input_sections): New function.
15634         * configure.ac: Check whether the compiler supports constructor
15635         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
15636         * testsuite/initpri1.c: New file.
15637         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
15638         CONSTRUCTOR_PRIORITY.
15639         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
15640         (initpri1_LDFLAGS): New variable.
15641         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15642
15643 2008-03-27  Ian Lance Taylor  <iant@google.com>
15644
15645         * common.cc (Sort_commons::operator): Correct sorting algorithm.
15646         * testsuite/common_test_1.c: New file.
15647         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
15648         (common_test_1_SOURCES): New variable.
15649         (common_test_1_DEPENDENCIES): New variable.
15650         (common_test_1_LDFLAGS): New variable.
15651
15652         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
15653         and commons_ correctly when NAME/VERSION does not override
15654         NAME/NULL.
15655         * testsuite/ver_test_6.c: New file.
15656         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
15657         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
15658         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
15659
15660 2008-03-26  Ian Lance Taylor  <iant@google.com>
15661
15662         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
15663         of an undefined symbol from a version script.
15664         * testsuite/Makefile.am (ver_test_5.so): New target.
15665         (ver_test_5.o): New target.
15666         (check_SCRIPTS): Add ver_test_5.sh.
15667         (check_DATA): Add ver_test_5.syms.
15668         (ver_test_5.syms): New target.
15669         * testsuite/ver_test_5.cc: New file.
15670         * testsuite/ver_test_5.script: New file.
15671         * testsuite/ver_test_5.sh: New file.
15672         * Makefile.in, testsuite/Makefile.in: Rebuild.
15673
15674         PR gold/5986
15675         Fix problems building gold with gcc 4.3.0.
15676         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
15677         (gold_error_at_location, gold_warning_at_location): Use it.
15678         * configure.ac: Check whether we can compile and use a template
15679         function with a printf attribute.
15680         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
15681         when jumping over bytes.
15682         * object.cc: Instantiate Object::read_section_data.
15683         * debug.h: Include <cstring>
15684         * dwarf_reader.cc: Include <algorithm>
15685         * main.cc: Include <cstring>.
15686         * options.cc: Include <cstring>.
15687         * output.cc: Include <cstring>.
15688         * script.cc: Include <cstring>.
15689         * script.h: Include <string>.
15690         * symtab.cc: Include <cstring> and <algorithm>.
15691         * target-select.cc: Include <cstring>.
15692         * version.cc: Include <string>.
15693         * testsuite/testmain.cc: Include <cstdlib>.
15694         * configure, config.in: Rebuild.
15695
15696 2008-03-25  Ian Lance Taylor  <iant@google.com>
15697
15698         * options.cc: Include "../bfd/bfdver.h".
15699         (options::help): Print bug reporting address.
15700
15701         * version.cc (print_version): Adjust output for current value of
15702         BFD_VERSION_STRING.
15703
15704         * NEWS: New file.
15705
15706         * options.cc (options::help): Print list of supported targets.
15707         * target-select.h: Include <vector>.
15708         (class Target_selector): Make machine_, size_, and is_big_endian_
15709         fields const.  Add bfd_name_ and instantiated_target_ fields.
15710         (Target_selector::Target_selector): Add bfd_name parameter.
15711         (Target_selector::recognize): Make non-virtual, call
15712         do_recognize.
15713         (Target_selector::recognize_by_name): Make non-virtual, call
15714         do_recognize_by_name.
15715         (Target_selector::supported_names): New function.
15716         (Target_selector::bfd_name): New function.
15717         (Target_selector::do_instantiate_target): New pure virtual
15718         function.
15719         (Target_selector::do_recognize): New virtual function.
15720         (Target_selector::do_recognize_by_name): New virtual function.
15721         (Target_selector::instantiate_target): New private function.
15722         (supported_target_names): Declare.
15723         * target-select.cc (Target_selector::Target_selector): Update for
15724         new parameter and fields.
15725         (select_target_by_name): Check that the name matches before
15726         calling recognize_by_name.
15727         (supported_target_names): New function.
15728         * i386.cc (class Target_selector_i386): Update Target_selector
15729         constructor call.  Remove recognize and recognize_by_name.  Add
15730         do_instantiate_target.
15731         * x86_64.cc (class Target_selector_x86_64): Likewise.
15732         * testsuite/testfile.cc (class Target_selector_test): Update for
15733         changes to Target_selector.
15734
15735         * README: Rewrite, with some notes on unsupported features.
15736
15737 2008-03-24  Cary Coutant  <ccoutant@google.com>
15738
15739         * i386.cc (Target_i386::Got_type): New enum declaration.
15740         (Target_i386::Scan::local): Updated callers of Output_data_got
15741         member functions.
15742         (Target_i386::Scan::global): Likewise.
15743         (Target_i386::Relocate::relocate): Likewise.
15744         (Target_i386::Relocate::relocate_tls): Likewise.
15745         * object.h (Got_offset_list): New class.
15746         (Sized_relobj::local_has_got_offset): Added got_type parameter.
15747         (Sized_relobj::local_got_offset): Likewise.
15748         (Sized_relobj::set_local_got_offset): Likewise.
15749         (Sized_relobj::local_has_tls_got_offset): Removed.
15750         (Sized_relobj::local_tls_got_offset): Removed.
15751         (Sized_relobj::set_local_tls_got_offset): Removed.
15752         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
15753         * output.cc (Output_data_got::add_global): Added got_type parameter.
15754         (Output_data_got::add_global_with_rel): Likewise.
15755         (Output_data_got::add_global_with_rela): Likewise.
15756         (Output_data_got::add_global_pair_with_rel): New function.
15757         (Output_data_got::add_global_pair_with_rela): New function.
15758         (Output_data_got::add_local): Added got_type parameter.
15759         (Output_data_got::add_local_with_rel): Likewise.
15760         (Output_data_got::add_local_with_rela): Likewise.
15761         (Output_data_got::add_local_pair_with_rel): New function.
15762         (Output_data_got::add_local_pair_with_rela): New function.
15763         (Output_data_got::add_global_tls): Removed.
15764         (Output_data_got::add_global_tls_with_rel): Removed.
15765         (Output_data_got::add_global_tls_with_rela): Removed.
15766         (Output_data_got::add_local_tls): Removed.
15767         (Output_data_got::add_local_tls_with_rel): Removed.
15768         (Output_data_got::add_local_tls_with_rela): Removed.
15769         * output.h (Output_data_got::add_global): Added got_type parameter.
15770         (Output_data_got::add_global_with_rel): Likewise.
15771         (Output_data_got::add_global_with_rela): Likewise.
15772         (Output_data_got::add_global_pair_with_rel): New function.
15773         (Output_data_got::add_global_pair_with_rela): New function.
15774         (Output_data_got::add_local): Added got_type parameter.
15775         (Output_data_got::add_local_with_rel): Likewise.
15776         (Output_data_got::add_local_with_rela): Likewise.
15777         (Output_data_got::add_local_pair_with_rel): New function.
15778         (Output_data_got::add_local_pair_with_rela): New function.
15779         (Output_data_got::add_global_tls): Removed.
15780         (Output_data_got::add_global_tls_with_rel): Removed.
15781         (Output_data_got::add_global_tls_with_rela): Removed.
15782         (Output_data_got::add_local_tls): Removed.
15783         (Output_data_got::add_local_tls_with_rel): Removed.
15784         (Output_data_got::add_local_tls_with_rela): Removed.
15785         * resolve.cc (Symbol::override_base_with_special): Removed
15786         reference to has_got_offset_ field.
15787         * symtab.cc (Symbol::init_fields): Replaced initialization
15788         of got_offset_ with got_offsets_.  Removed initialization
15789         of has_got_offset_
15790         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
15791         (Symbol::got_offset): Likewise.
15792         (Symbol::set_got_offset): Likewise.
15793         (Symbol::has_tls_got_offset): Removed.
15794         (Symbol::tls_got_offset): Removed.
15795         (Symbol::set_tls_got_offset): Removed.
15796         (Symbol::got_offset_): Removed.
15797         (Symbol::tls_mod_got_offset_): Removed.
15798         (Symbol::tls_pair_got_offset_): Removed.
15799         (Symbol::got_offsets_): New field.
15800         (Symbol::has_got_offset): Removed.
15801         (Symbol::has_tls_mod_got_offset): Removed.
15802         (Symbol::has_tls_pair_got_offset): Removed.
15803         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
15804         (Target_x86_64::Scan::local): Updated callers of Output_data_got
15805         member functions.
15806         (Target_x86_64::Scan::global): Likewise.
15807         (Target_x86_64::Relocate::relocate): Likewise.
15808         (Target_x86_64::Relocate::relocate_tls): Likewise.
15809
15810 2008-03-25  Ben Elliston  <bje@au.ibm.com>
15811
15812         * yyscript.y: Fix spelling error in comment.
15813
15814 2008-03-24  Ian Lance Taylor  <iant@google.com>
15815
15816         * options.h (class General_options): Define build_id option.
15817         * layout.h (class Layout): Declare write_build_id, create_note,
15818         create_build_id.  Add build_id_note_ member.
15819         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
15820         "libiberty.h", "md5.h", "sha1.h".
15821         (Layout::Layout): Initialize eh_frame_data_,
15822         eh_frame_hdr_section_, and build_id_note_.
15823         (Layout::finalize): Call create_build_id.
15824         (Layout::create_note): New function, broken out of
15825         Layout::create_gold_note.
15826         (Layout::create_gold_note): Call create_note.
15827         (Layout::create_build_id): New function.
15828         (Layout::write_build_id): New function.
15829         (Close_task_runner::run): Call write_build_id.
15830
15831         * x86_64.cc: Correct license to GPLv3.
15832
15833 2008-03-23  Ian Lance Taylor  <iant@google.com>
15834
15835         * options.cc: Include "demangle.h".
15836         (parse_optional_string): New function.
15837         (parse_long_option): Handle takes_optional_argument.
15838         (parse_short_option): Update dash_z initializer.  Handle
15839         takes_optional_argument.
15840         (General_options::General_options): Initialize do_demangle_.
15841         (General_options::finalize): Set do_demangle_.  Handle demangling
15842         style.
15843         * options.h (parse_optional_string): Declare.
15844         (struct One_option): Add optional_arg field.  Update constructor.
15845         Update call constructor calls.  Add takes_optional_argument
15846         function.
15847         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
15848         (DEFINE_optional_string): Define.
15849         (General_options::demangle): Change from DEFINE_bool to
15850         DEFINE_optional_string.
15851         (General_options::no_demangle): New function.
15852         (General_options::do_demangle): New function.
15853         (General_options::set_do_demangle): New function.
15854         (General_options::execstack_status_): Move definition to end of
15855         class definition.
15856         (General_options::static_): Likewise.
15857         (General_options::do_demangle_): New field.
15858         * object.cc (big_endian>::get_symbol_location_info): Call
15859         Options::do_demangle, not Options::demangle.
15860         * symtab.cc (demangle): Likewise.
15861
15862 2008-03-22  Ian Lance Taylor  <iant@google.com>
15863
15864         * gold.h: Include <cstddef> and <sys/types.h>
15865         * options.h: Include <cstring>.
15866
15867 2008-03-21  Ian Lance Taylor  <iant@google.com>
15868
15869         * Added source code to GNU binutils.
15870 \f
15871 Copyright (C) 2008-2014 Free Software Foundation, Inc.
15872
15873 Copying and distribution of this file, with or without modification,
15874 are permitted in any medium without royalty provided the copyright
15875 notice and this notice are preserved.
15876
15877 Local Variables:
15878 mode: change-log
15879 left-margin: 8
15880 fill-column: 74
15881 version-control: never
15882 End: