auto-generate most target debug methods
[platform/upstream/binutils.git] / gold / ChangeLog
1 2014-07-21  Sriraman Tallam  <tmsriram@google.com>
2
3         * object.cc (Relobj::is_section_name_included): Add
4         ".rodata.nptl_version" to not garbage collect this section.
5
6 2014-07-08  Cary Coutant  <ccoutant@google.com>
7
8         * expression.cc (struct Expression::Expression_eval_info): Add
9         new fields type_pointer, vis_pointer, and nonvis_pointer.
10         (Expression::eval_maybe_dot): Add type_pointer, vis_pointer, and
11         nonvis_pointer parameters. Adjust all calls.
12         (Symbol_expression::value): Update type, visibility, and nonvis bits
13         in caller.
14         * script.cc (Symbol_assignment::sized_finalize): Update type,
15         visibility, and remaining st_other bits for new symbol.
16         * script.h: (Expression::eval_maybe_dot): Add type_pointer,
17         vis_pointer, and nonvis_pointer parameters.
18         * symtab.h (Symbol::set_type): New method.
19
20         * testsuite/Makefile.am (defsym_test): New test.
21         * testsuite/Makefile.in: Regenerate.
22         * testsuite/defsym_test.c: New file.
23         * testsuite/defsym_test.sh: New file.
24
25 2014-07-08  Cary Coutant  <ccoutant@google.com>
26
27         PR gold/15639
28         * dynobj.h (Sized_dynobj::base_read_symbols): New method.
29         * dynobj.cc (Sized_dynobj::do_read_symbols): Move body to...
30         (Sized_dynobj::base_read_symbols): ...new method.
31         * object.h (Sized_relobj_file::base_read_symbols): New method.
32         * object.cc (Sized_relobj_file::do_read_symbols): Move body to...
33         (Sized_relobj_file::base_read_symbols): ...new method.
34         * arm.cc (Arm_relobj::do_read_symbols): Call base_read_symbols.
35         * mips.cc: (Mips_relobj::do_read_symbols): Likewise.
36         * powerpc.cc (Powerpc_dynobj::do_read_symbols): Likewise.
37
38 2014-07-04  Alan Modra  <amodra@gmail.com>
39
40         * po/POTFILES.in: Regenerate.
41
42 2014-07-02  Jing Yu  <jingyu@google.com>
43
44         * aarch64.cc: New file
45         * Makefile.am (TARGETSOURCES): Add aarch64.cc
46         (ALL_TARGETOBJS): Add aarch64.$(OBJEXT)
47         * Makefile.in: Regenerate.
48         * configure.tgt: Add entries for aarch64*.
49         * configure.ac:  Likewise.
50         * configure: Likewise.
51
52 2014-06-27  Alan Modra  <amodra@gmail.com>
53
54         * symtab.cc (Symbol::should_add_dynsym_entry): Don't make inline.
55
56 2014-06-24  Cary Coutant  <ccoutant@google.com>
57
58         * dwp.cc (Dwo_file::read): Allow files with no .debug_types
59         sections.
60         (Dwo_file::sized_read_unit_index): Likewise.
61
62 2014-06-23  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
63
64         * mips.cc: New file.
65         * Makefile.am (TARGETSOURCES): Add mips.cc
66         (ALL_TARGETOBJS): Add mips.$(OBJEXT)
67         * configure.tgt: Add entries for mips*.
68         * configure.ac: Likewise.
69         * Makefile.in: Regenerate.
70         * configure: Likewise.
71
72 2014-06-09  Cary Coutant  <ccoutant@google.com>
73
74         * dwarf_reader.cc (Dwarf_pubnames_table::read_header): Check that
75         unit_length is within section bounds.
76
77 2014-06-09  Cary Coutant  <ccoutant@google.com>
78
79         PR gold/16980
80         * layout.cc (Layout::print_to_mapfile): Print unattached sections in
81         map.
82
83 2014-06-07  Alan Modra  <amodra@gmail.com>
84
85         * powerpc.cc (relocate): Treat field of cmpli insn as a bitfield.
86
87 2014-06-06  Cary Coutant  <ccoutant@google.com>
88
89         * dwarf_reader.h (Dwarf_pubnames_table): Remove output_section_offset_.
90         * dwarf_reader.cc (Dwarf_pubnames_table::read_section): Likewise.
91         (Dwarf_pubnames_table::read_header): Likewise.
92         * layout.cc (gdb_fast_lookup_sections): Add .debug_gnu_pubnames and
93         .debug_gnu_pubtypes.
94
95 2014-06-05  Joel Brobecker  <brobecker@adacore.com>
96
97         * Makefile.am (CONFIG_STATUS_DEPENDENCIES): New.
98         * Makefile.in, configure: Regenerate.
99
100 2014-06-03  Alan Modra  <amodra@gmail.com>
101
102         * powerpc.cc (addis_12_2): Define.
103         (Stub_table::do_write): Support fusion on ELFv2 stubs.
104
105 2014-06-03  Alan Modra  <amodra@gmail.com>
106
107         * testsuite/plugin_test.c (parse_readelf_line): Skip non-visibility
108         st_other output.
109
110 2014-06-02  Alan Modra  <amodra@gmail.com>
111
112         * powerpc.cc (Target_powerpc::local_reloc_may_be_function_pointer):
113         Only ignore relocs on ELFv1.
114         (Target_powerpc::global_reloc_may_be_function_pointer): Likewise.
115
116 2014-05-30  Cary Coutant  <ccoutant@google.com>
117
118         * testsuite/Makefile.am (ehdr_start_test_4): Fix typo in -B option.
119         * testsuite/Makefile.in: Regenerate.
120         * testsuite/ehdr_start_test_4.sh: Look for "U" instead of "w".
121
122 2014-05-27  H.J. Lu  <hongjiu.lu@intel.com>
123
124         PR gold/16945
125         * x86_64.cc (Target_x86_64::Relocate::relocate): Use signed int
126         for got_offset.  Properly get GOT address for R_X86_64_PLTOFF64.
127
128 2014-05-15  Alan Modra  <amodra@gmail.com>
129
130         * powerpc.cc (do_plt_fde_location): Handle zero length .glink.
131         Compare FDE contents with DW_CFA_nop rather than 0.
132
133 2014-05-13  Sriraman Tallam  <tmsriram@google.com>
134
135         * symtab.h (may_need_copy_reloc): Remove check for position independent
136         code.
137         * x86_64.cc (Target_x86_64<size>::Scan::global): Add check for no
138         position independence before pc absolute may_need_copy_reloc call.
139         Add check for executable output befor pc relative may_need_copy_reloc
140         call.
141         * i386.cc: Ditto.
142         * arm.cc: Ditto.
143         * sparc.cc: Ditto.
144         * tilegx.cc: Ditto.
145         * powerpc.cc: Add check for no position independence before
146         may_need_copy_reloc calls.
147         * testsuite/pie_copyrelocs_test.cc: New file.
148         * testsuite/pie_copyrelocs_shared_test.cc: New file.
149         * Makefile.am (pie_copyrelocs_test): New test.
150         * Makefile.in: Regenerate.
151
152 2014-05-08  Martin Liška  <mliska@suse.cz>
153
154         * output.cc (Sized_relobj_file::do_layout): Fix typo in info message.
155
156 2014-05-06  Cary Coutant  <ccoutant@google.com>
157
158         PR gold/16900
159         * i386.cc (Output_data_got_plt_i386): New class.
160         (Output_data_plt_i386::Output_data_plt_i386): Change type of got_plt
161         parameter. Change all callers.
162         (Output_data_plt_i386::layout_): Remove.
163         (Output_data_plt_i386::got_plt_): Change type.
164         (Target_i386::got_plt_): Change type. Change all references.
165         (Target_i386::got_section): Create instance of new class.
166         (Output_data_got_plt_i386::do_write): New function.
167         * x86_64.cc (Output_data_got_plt_x86_64): New class.
168         (Output_data_plt_x86_64::Output_data_plt_x86_64): Change type of got_plt
169         parameter. Change all callers.
170         (Output_data_plt_x86_64::layout_): Remove.
171         (Output_data_plt_x86_64::got_plt_): Change type.
172         (Target_x86_64::got_plt_): Change type. Change all references.
173         (Target_x86_64::got_section): Create instance of new class.
174         (Output_data_got_plt_x86_64::do_write): New function.
175         (Output_data_plt_x86_64::do_write): Don't write reserved words in GOT.
176         (Target_x86_64<size>::init_got_plt_for_update): Create instance of new
177         class.
178
179 2014-05-05  Cary Coutant  <ccoutant@google.com>
180
181         * gdb-index.cc (Gdb_index_info_reader): Don't complain about language
182         if we have pubnames/pubtypes.
183
184 2014-05-02  Cary Coutant  <ccoutant@google.com>
185
186         * defstd.cc (in_segment): Define __ehdr_start here...
187         * layout.cc (Layout::finalize): ...Instead of here.  Set the
188         output segment when known.
189         * resolve.cc (Symbol::override_base_with_special): Remember
190         the original binding.
191         * symtab.cc (Symbol::set_output_segment): New function.
192         (Symbol::set_undefined): New function.
193         * symtab.h (Symbol::is_weak_undefined): Check original undef
194         binding.
195         (Symbol::is_strong_undefined): New function.
196         (Symbol::set_output_segment): New function.
197         (Symbol::set_undefined): New function.
198         * target-reloc.h (is_strong_undefined): Remove.
199         (issue_undefined_symbol_error): Call Symbol::is_weak_undefined.
200         Check for hidden undefs.
201         (relocate_section): Call Symbol::is_strong_undefined.
202
203         * testsuite/Makefile.am (ehdr_start_test_1)
204         (ehdr_start_test_2, ehdr_start_test_3)
205         (ehdr_start_test_4, ehdr_start_test_5): New test cases.
206         * testsuite/Makefile.in: Regenerate.
207         * testsuite/ehdr_start_def.cc: New source file.
208         * testsuite/ehdr_start_test.cc: New source file.
209         * testsuite/ehdr_start_test.t: New linker script.
210         * testsuite/ehdr_start_test_4.sh: New shell script.
211
212 2014-04-23  Cary Coutant  <ccoutant@google.com>
213
214         PR gold/16870
215         * x86_64.cc (Target_x86_64::Relocate::relocate): Add missing break.
216
217 2014-04-15  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
218
219         * layout.cc (Layout::include_section): Allow a target to decide
220         whether to include a section.
221         * target.h (Target::should_include_section): New function.
222         (Target::do_should_include_section): New function.
223
224 2014-04-15  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
225
226         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Remove and
227         inline into ...
228         (Copy_relocs::emit): ... here.
229         * copy-relocs.h (Copy_reloc_entry): Change from class to struct.
230         (Copy_reloc_entry::make_copy_reloc): Change from private to protected.
231         (Copy_reloc_entry::entries_): Change from private to protected.
232
233 2014-04-02  Sriraman Tallam  <tmsriram@google.com>
234
235         * icf.cc (get_section_contents): Replace copies of reloc
236         vectors with const references.
237
238 2014-04-02  Cary Coutant  <ccoutant@google.com>
239
240         * configure.ac (HAVE_PUBNAMES): Use C instead of C++.
241         (HAVE_NO_USE_LINKER_PLUGIN): Check for -fno-use-linker-plugin.
242         * configure: Regenerate.
243         * testsuite/Makefile.am (OPT_NO_PLUGINS): New macro for
244         -fno-use-linker-plugin.
245         (LINK1, CXXLINK1): Add it to the link command.
246         * testsuite/Makefile.in: Regenerate.
247
248 2014-03-12  Alan Modra  <amodra@gmail.com>
249
250         * Makefile.in: Regenerate.
251
252 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
253
254         * symtab.h (Symbol::set_nonvis): New function.
255
256 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
257
258         * symtab.cc (Sized_symbol<32>::init_output_data):
259         Instantiate the template.
260         (Sized_symbol<64>::init_output_data): Likewise.
261
262 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
263
264         * symtab.cc (Symbol_table::sized_write_globals): Allow a target to
265         adjust dynamic symbol value.
266         * target.h (Target::adjust_dyn_symbol): New function.
267         (Target::do_adjust_dyn_symbol): New function.
268
269 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
270
271         * output.cc (Output_data_dynamic::Dynamic_entry::write):
272         Get the value of DYNAMIC_CUSTOM dynamic entry.
273         * output.h (Output_data_dynamic::add_custom): New function.
274         (Dynamic_entry::Dynamic_entry): New constructor for DYNAMIC_CUSTOM
275         dynamic entry.
276         (enum Dynamic_entry::Classification): Add DYNAMIC_CUSTOM.
277         * target.h (Target::dynamic_tag_custom_value): New function.
278         (Target::do_dynamic_tag_custom_value): New function.
279
280 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
281
282         * symtab.cc (Symbol_table::set_dynsym_indexes): Allow a target to set
283         dynsym indexes.
284         * target.h (Target::has_custom_set_dynsym_indexes): New function.
285         (Target::do_has_custom_set_dynsym_indexes): New function.
286         (Target::set_dynsym_indexes): New function.
287         (Target::do_set_dynsym_indexes): New function.
288
289 2014-03-07  Alan Modra  <amodra@gmail.com>
290
291         * powerpc.cc (Powerpc_relocate_functions::Overflow_check): Add
292         CHECK_UNSIGNED, CHECK_LOW_INSN, CHECK_HIGH_INSN.
293         (Powerpc_relocate_functions::has_overflow_unsigned): New function.
294         (Powerpc_relocate_functions::has_overflow_bitfield,
295         overflowed): Use the above.
296         (Target_powerpc::Relocate::relocate): Correct overflow checking
297         for a number of relocations.  Modify overflow test for 16-bit
298         fields in instructions to signed/unsigned according to whether
299         the field takes a signed or unsigned value.
300
301 2014-03-05  Alan Modra  <amodra@gmail.com>
302
303         Update copyright years.
304
305 2014-03-05  Alan Modra  <amodra@gmail.com>
306
307         * powerpc.cc (Target_powerpc::Scan::local, global): Support
308         R_PPC64_ADDR64_LOCAL.
309         (Target_powerpc::Relocate::relocate): Likewise.
310
311 2014-03-03  Alan Modra  <amodra@gmail.com>
312
313         * dwp.cc (print_version): Update copyright year to current.
314
315 2014-02-10  Alan Modra  <amodra@gmail.com>
316
317         * po/gold.pot: Regenerate.
318
319 2014-02-06  Cary Coutant  <ccoutant@google.com>
320
321         Fix problem where -u is ignored when a weak undef is seen.
322
323         * archive.cc (Library_base::should_include_member): Reorder
324         code to check for -u option if a weak undef has already been seen.
325         * testsuite/Makefile.am (weak_undef_test_2): New test case.
326         * testsuite/Makefile.in: Regenerate.
327         * testsuite/weak_undef_file3.cc: New file.
328         * testsuite/weak_undef_file4.cc: New file.
329         * testsuite/weak_undef_test_2.cc: New file.
330
331 2014-02-05  Cary Coutant  <ccoutant@google.com>
332
333         Fix issues with gold undefined symbol diagnostics.
334
335         PR binutils/15435
336         * errors.cc (Errors::undefined_symbol): Move undef vtable symbol
337         check to here.
338         * target-reloc.h (is_strong_undefined): New function.
339         (relocate_section): Move undef vtable symbol check from here.
340         Check for is_strong_undefined.
341
342 2014-02-05  Cary Coutant  <ccoutant@google.com>
343
344         Fix problems with the --dynamic-list option.
345
346         PR gold/13577
347         * options.cc (General_options::parse_dynamic_list):
348         Set have_dynamic_list_.
349         (General_options::General_options): Initialize have_dynamic_list_.
350         (General_options::finalize): Turn off -Bsymbolic and
351         -Bsymbolic-functions if --dynamic-list provided.
352         * options.h (General_options::have_dynamic_list): New function.
353         (General_options::have_dynamic_list_): New data member.
354         * symtab.h (Symbol::is_preemptible): Handle --dynamic-list
355         correctly.
356
357         PR gold/16530
358         * symtab.cc (Symbol_table::add_from_relobj): If symbol is named
359         in --dynamic-list, mark it.
360
361         * testsuite/Makefile.am (gc_dynamic_list_test.sh): New test case.
362         (dynamic_list_2): New test case.
363         * testsuite/Makefile.in: Regenerate.
364         * testsuite/dynamic_list_2.cc: New file.
365         * testsuite/dynamic_list_2.t: New file.
366         * testsuite/dynamic_list_lib1.cc: New file.
367         * testsuite/dynamic_list_lib2.cc: New file.
368         * testsuite/gc_dynamic_list_test.c: New file.
369         * testsuite/gc_dynamic_list_test.sh: New file.
370         * testsuite/gc_dynamic_list_test.t: New file.
371
372 2014-01-28  Cary Coutant  <ccoutant@google.com>
373
374         Add .gdb_index version 7 support.
375
376         * gold/dwarf_reader.cc: include <utility> (for make_pair).
377         (Dwarf_abbrev_table::do_read_abbrevs): Check for compressed
378         debug sections.
379         (Dwarf_ranges_table::read_ranges_table): Likewise.
380         (Dwarf_pubnames_table::read_section): Check for GNU-style
381         sections, and for compressed debug sections.
382         (Dwarf_pubnames_table::read_header): Compute end address of table.
383         (Dwarf_pubnames_table::next_name): Return flag_byte.  Check
384         for end of list by offset, not by offset == 0.
385         (Dwarf_info_reader::do_read_string_table): Check for compressed
386         debug sections.
387         * gold/dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
388         Initialize new data members.
389         (Dwarf_pubnames_table::next_name): return flag_byte.
390         (Dwarf_pubnames_table::end_of_table_): New data member.
391         (Dwarf_pubnames_table::is_gnu_style_): New data member.
392         * gold/gdb-index.cc (gdb_index_version): Update to version 7.
393         (Gdb_index_info_reader::read_pubtable): Read flag_byte.
394         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Don't
395         read skeleton type unit DIEs.
396         (Gdb_index::add_symbol): Add flag_byte; adjust all callers.
397         (Gdb_index::do_write): Write flag_byte.
398         * gold/gdb-index.h (Gdb_index::add_symbol): Add flags parameter.
399         (Gdb_index::Cu_vector): Store flags along with cu indexes.
400         * gold/testsuite/gdb_index_test_3.sh: Allow versions 4-7.
401         * gold/testsuite/gdb_index_test_comm.sh: Likewise.
402
403 2014-01-08  H.J. Lu  <hongjiu.lu@intel.com>
404
405         * version.cc (print_version): Update copyright year to 2014.
406
407 2013-12-19  Dimitry Andric  <dimitry@andric.com>
408
409         * stringpool.cc (Stringpool_template::reserve): Add
410         HAVE_UNORDERED_MAP case.
411         * stringpool.cc (Stringpool_template::print_stats): Likewise.
412
413 2013-12-18  Cary Coutant  <ccoutant@google.com>
414
415         * configure.ac: Check for <unordered_set> and <unordered_map>.
416         * config.in: Regenerate.
417         * configure: Regenerate.
418         * system.h: Use <unordered_set> and <unordered_map> if available.
419
420 2013-12-10  Roland McGrath  <mcgrathr@google.com>
421
422         * Makefile.am (install-exec-local): Prefix $(INSTALL_PROGRAM) uses
423         with $(INSTALL_PROGRAM_ENV).
424         * Makefile.in: Regenerate.
425
426 2013-11-22  Cary Coutant  <ccoutant@google.com>
427
428         * configure.ac: Add check for which library is needed for
429         dlopen.
430         * configure: Regenerate.
431
432 2013-11-22  Cary Coutant  <ccoutant@google.com>
433
434         * testsuite/Makefile.am (exception_x86_64_bnd_test): Use in-tree
435         assembler.
436         * testsuite/Makefile.in: Regenerate.
437
438 2013-11-17  H.J. Lu  <hongjiu.lu@intel.com>
439
440         * x86_64.cc (Target_x86_64<size>::Scan::get_reference_flags):
441         Handle R_X86_64_PC32_BND and R_X86_64_PLT32_BND just like
442         R_X86_64_PC32 and R_X86_64_PLT32, respectively.
443         (Target_x86_64<size>::Scan::local): Likewise.
444         (Target_x86_64<size>::Scan::global): Likewise.
445         (Target_x86_64<size>::Relocate::relocate): Likewise.
446         (Target_x86_64<size>::Relocatable_size_for_reloc::get_size_for_reloc):
447         Likewise.
448         (Target_x86_64<size>::Scan::check_non_pic(): Handle
449         R_X86_64_PC32_BND.
450
451         * testsuite/Makefile.am (check_PROGRAMS): Add
452         exception_x86_64_bnd_test.
453         (exception_x86_64_bnd_test_SOURCES): New macro.
454         (exception_x86_64_bnd_test_DEPENDENCIES): Likewise.
455         (exception_x86_64_bnd_test_LDFLAGS): Likewise.
456         (exception_x86_64_bnd_test_LDADD): Likewise.
457         (exception_x86_64_bnd_1.o): New rule.
458         (exception_x86_64_bnd_2.o): Likewise.
459         * testsuite/Makefile.in: Regenerated.
460
461 2013-11-15  Alan Modra  <amodra@gmail.com>
462
463         * powerpc.cc (Target_powerpc::glink_section): Provide non-const
464         accessor.
465         (Target_powerpc::Branch_info::make_stub): Make global entry stubs.
466         Only call ppc64_local_entry_offset for 64-bit.  Restrict
467         symval_for_branch lookup to ELFv1.
468         (Stub_table::add_plt_call_entry): Use unsigned int off.
469         (Output_data_glink::Address, invalid_address): New.
470         (Output_data_glink::add_eh_frame): Move out of line.  Add
471         support for ELFv2.
472         (Output_data_glink::add_global_entry, find_global_entry,
473         global_entry_address): New functions.
474         (Output_data_glink::global_entry_stubs_, end_branch_table_,
475         ge_size): New variables.
476         (Output_data_glink::set_final_data_size): Add global entry
477         stub sizing.
478         (Output_data_glink::do_write): Write global entry stubs.
479         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Add target
480         parameter.  Return true for ELFv2.  Adjust callers.
481         (Target_powerpc::Scan::local, global): Restrict opd lookup to
482         ELFv1.  Similarly for ifunc and dynamic relocation processing
483         specific to ELFv1.  Recognize that symbols are defined on
484         their plt entries for ELFv2.
485         (Target_powerpc::symval_for_branch): Assert if called for
486         ELFv2 or ppc32.
487         (Target_powerpc::Relocate::relocate): Use global entry plt
488         stub for symbol value if such exists on ELFv2.
489         (Target_powerpc::Relocate::relocate): Don't call
490         symval_for_branch when ELFv2.  Do adjust for local entry
491         offset when ELFv2.
492         (Target_powerpc::do_dynsym_value): Set symbols to global entry
493         plt stub for ELFv2.
494         (Target_powerpc::do_plt_address_for_global): Similarly.
495
496 2013-11-14  Cary Coutant  <ccoutant@google.com>
497
498         Revert patch -- this did not fix the problem, and there is
499         no race there.
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-14  Cary Coutant  <ccoutant@google.com>
511
512         * dwp.cc (Dwo_file_entry): New type.
513         (File_list): Use Dwo_file_entry.
514         (Dwo_file::verify): New function.
515         (Dwo_file::verify_dwo_list): New function.
516         (Dwo_file::sized_verify_dwo_list): New function.
517         (Dwo_name_info_reader::visit_compilation_unit): Add dwo_id to file
518         list.
519         (Dwp_options): New enum type.
520         (dwp_options): Add --verify-only.
521         (usage): Likewise.
522         (main): Likewise.
523         * dwp.h (gold_info): Add declaration.
524
525 2013-11-14  Cary Coutant  <ccoutant@google.com>
526
527         PR gold/14860
528         * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
529         (Ehframe_hdr::set_final_data_size): Allocate a Lock.
530         * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
531         updating fde_offsets_.
532         (Eh_frame_hdr::lock_): New data member.
533
534 2013-11-06  Cary Coutant  <ccoutant@google.com>
535
536         PR gold/15758
537         * object.cc (Sized_relobj_file::do_layout): Handle .eh_frame sections
538         before reloc sections.
539
540 2013-11-04  Alan Modra  <amodra@gmail.com>
541
542         * symtab.h (Symbol::Reference_flags): Add FUNC_DESC_ABI.
543         (Symbol::needs_dynamic_reloc): Test new flag.
544         * powerpc.cc (needs_dynamic_reloc, use_plt_offset): Delete.
545         (Target_powerpc::Scan::get_reference_flags): Add target param.
546         Return FUNC_DESC_ABI for 64-bit ELFv1.
547         (Target_powerpc::Branch_info::make_stub): Adjust get_reference_flags
548         call.
549         (Target_powerpc::Scan::global): Use Symbol::needs_dynamic_reloc.
550         (Target_powerpc::Relocate::relocate): Use Symbol::use_plt_offset.
551
552 2013-10-31  Cary Coutant  <ccoutant@google.com>
553
554         Restore support for dwp v2 DWARF package file format.
555
556         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
557         tu_length parameter.  Adjust all callers.
558         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
559         * dwp.cc: Include dwarf.h.
560         (Section_bounds): New struct type.
561         (Unit_set): New struct type.
562         (Dwo_file::Dwo_file): Initialize new data member.
563         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
564         Combine and rename to...
565         (Dwo_file::read_unit_index): ...this.
566         (Dwo_file::sized_read_compunit_index)
567         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
568         (Dwo_file::sized_read_unit_index): ...this.
569         (Dwo_file::copy_section): Remove section_name, is_str_offsets
570         parameters; add section_id parameter.
571         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
572         (Dwo_file::add_unit_set): ...this.
573         (Dwo_file::shndx_map_): Remove.
574         (Dwo_file::sect_offsets_): New data member.
575         (Dwp_output_file::Dwp_output_file): Initialize new data members.
576         (Dwp_output_file::add_section): Rename to...
577         (Dwp_output_file::add_contribution): ...this.
578         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
579         (Dwp_output_file::add_tu_set): Likewise.
580         (Dwp_output_file::Contribution): New type.
581         (Dwp_output_file::Section::contributions): New data member.
582         (Dwp_output_file::Cu_or_tu_set): Remove.
583         (Dwp_output_file::Section::Section): New ctor.
584         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
585         (Dwp_output_file::Dwp_index::Section_table): New type.
586         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
587         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
588         parameter.
589         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
590         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
591         (Dwp_output_file::Dwp_index::section_table): New member function.
592         (Dwp_output_file::Dwp_index::section_table_end): New member function.
593         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
594         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
595         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
596         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
597         (Dwp_output_file::Dwp_index::section_table_): New data member.
598         (Dwp_output_file::Dwp_index::section_mask_): New data member.
599         (Dwp_output_file::add_output_section): New member function.
600         (Dwp_output_file::write_new_section): New member function.
601         (Dwp_output_file::write_contributions): New member function.
602         (Dwp_output_file::section_id_map_): New data member.
603         (class Dwo_id_info_reader): Remove.
604         (class Unit_reader): New class.
605         (get_dwarf_section_name): New function.
606         (Dwo_file::read_executable): Adjust initializations of class data.
607         (Dwo_file::read): Add support for v2 package file format.
608         (Dwo_file::read_unit_index): Likewise.
609         (Dwo_file::sized_read_unit_index): Likewise.
610         (Dwo_file::copy_section): Likewise.
611         (Dwo_file::add_unit_set): Likewise.
612         (Dwp_output_file::add_output_section): Likewise.
613         (Dwp_output_file::add_contribution): Likewise.
614         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
615         for empty slot.
616         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
617         file format.
618         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
619         slot.
620         (Dwp_output_file::initialize): Remove unused function.
621         (Dwp_output_file::finalize): Add support for v2 package file format.
622         (Dwp_output_file::write_index): Likewise.
623         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
624         function prototype.
625
626 2013-10-31  Cary Coutant  <ccoutant@google.com>
627
628         * configure.ac: Fix check for -fmerge-constants.
629         * configure.ac: Regenerate.
630
631 2013-10-30  Roland McGrath  <mcgrathr@google.com>
632
633         * x86_64.cc (Output_data_plt_x86_64_nacl::first_plt_entry):
634         Correct 9-byte nop sequence to match what the assembler generates.
635
636 2013-10-30  Alan Modra  <amodra@gmail.com>
637
638         * powerpc.cc (Powerpc_relobj::abiversion, set_abiversion,
639         ppc64_local_entry_offset, ppc64_local_entry_offset,
640         do_read_symbols): New functions.
641         (Powerpc_relobj::e_flags_, st_other_): New vars.
642         (Powerpc_relobj::Powerpc_relobj): Call set_abiversion.
643         (Powerpc_dynobj::abiversion, set_abiversion): New functions.
644         (Powerpc_relobj::e_flags_): New var.
645         (Target_powerpc::first_plt_entry_offset, plt_entry_size): Inline
646         and adjust for ELFv2.
647         (Target_powerpc::abiversion, set_abiversion, stk_toc): New functions.
648         (Powerpc_relobj::do_find_special_sections): Check no .opd in ELFv2.
649         (Powerpc_dynobj::do_find_special_sections): Likewise.
650         (Target_powerpc::do_define_standard_symbols): Define ".TOC.".
651         (Target_powerpc::Branch_info::make_stub): Adjust stub destination
652         to ELFv2 local entry.
653         (Target_powerpc::do_relax): No thread safe barriers needed for
654         ELFv2.
655         (Output_data_plt_powerpc::initial_plt_entry_size_,
656         plt_entry_size): Delete.  Replace all uses with
657         first_plt_entry_offset() and plt_entry_size().
658         (Output_data_plt_powerpc::Output_data_plt_powerpc): Remove
659         reserved_size parm.  Update callers.
660         (Output_data_plt_powerpc::entry_count): Update.
661         (Output_data_plt_powerpc::first_plt_entry_offset): Make private
662         and use Target_powerpc::first_plt_entry_offset().
663         (Output_data_plt_powerpc::get_plt_entry_size): Similarly and
664         rename to plt_entry_size.
665         (Output_data_plt_powerpc::add_ifunc_entry,
666         add_local_ifunc_entry): Adjust reloc for ELFv2.
667         (glink_eh_frame_fde_64): Rename to glink_eh_frame_fde_64v1.
668         (glink_eh_frame_fde_64v2): New.
669         (Stub_table::plt_call_size): Support ELFv2 sizing.
670         (Output_data_glink::add_eh_frame): Use the new FDE.
671         (Output_data_glink::set_final_data_size): Adjust for ELFv2 glink.
672         (Stub_table::do_write): Write ELFv2 stubs and glink.
673         (Target_powerpc::Relocate::relocate): Replaces nop after call
674         with ld 2,24(1) and adjust local offset destination for ELFv2.
675
676 2013-10-30  Alan Modra  <amodra@gmail.com>
677
678         * powerpc.cc (Target_powerpc::Scan::check_non_pic): Handle new relocs.
679         (Target_powerpc::Scan::global, local): Likewise.
680         (Target_powerpc::Relocate::relocate): Likewise.  Check for overflow
681         on all ppc64 @h and @ha relocs.
682
683 2013-10-14  Alan Modra  <amodra@gmail.com>
684
685         * output.h (Output_data_got::add_constant): Tidy.
686         (Output_data_got::add_constant_pair): New function.
687         * powerpc.cc (Output_data_got_powerpc): Override all Output_data_got
688         methods used so as to first call reserve_ent().
689
690 2013-10-11  Roland McGrath  <mcgrathr@google.com>
691
692         * powerpc.cc (Output_data_got_powerpc): Remove unused methods
693         add_got_entry and add_got_entry_pair.
694
695         * configure.ac (TLS_GNU2_DIALECT): Use -Werror in test.
696         (HAVE_PUBNAMES): Likewise.
697         * configure: Regenerate.
698
699         * testsuite/Makefile.am: Replace '-T foo' with '-Wl,-T,foo' throughout.
700         * testsuite/Makefile.in: Regenerate.
701
702         * target.h (Target::adjust_elf_header, Target::do_adjust_elf_header):
703         Remove const from declaration.
704         * target.cc (Sized_target::do_adjust_elf_header): Update definition.
705         * sparc.cc (Target_sparc::do_adjust_elf_header): Likewise.
706         * output.h (Output_file_header): Remove const from member target_
707         and corresponding constructor argument.
708         * output.cc (Output_file_header::Output_file_header): Update prototype.
709         (Output_file_header::do_sized_write): Use this->target_ in place
710         of parameters()->target().
711
712         * testsuite/undef_symbol.cc (Foo::get_a): New method.
713
714         * configure.ac (MERGE_CONSTANTS_FLAG): New check.
715         * configure: Regenerate.
716         * Makefile.in: Regenerate.
717         * testsuite/merge_string_literals_1.c: Renamed to have .cc suffix.
718         * testsuite/merge_string_literals_2.c: Likewise.
719         * testsuite/Makefile.am
720         (merge_string_literals_1.o, merge_string_literals_2.o): Update deps.
721         (AM_CFLAGS, AM_CXXFLAGS): Use $(MERGE_CONSTANTS_FLAG) in place of
722         literal -fmerge-constants.
723         * testsuite/Makefile.in: Regenerate.
724
725         * i386.cc (Target_i386): Remove unused member dynbss_.
726         * arm.cc (Target_arm): Likewise.
727         * powerpc.cc (Target_powerpc): Likewise.
728         * sparc.cc (Target_sparc): Likewise.
729         * tilegx.cc (Target_tilegx): Likewise.
730         * x86_64.cc (Target_x86_64): Likewise.
731         * dwarf_reader.h (Dwarf_info_reader): Remove unused members
732         type_signature_, type_offset_.
733         * plugin.h (Plugin_hook): Remove unused member layout_.
734         * readsyms.h (Add_symbols): Remove unused members dirpath_, dirindex_,
735         mapfile_.
736         (Read_member): Remove unused members input_objects_, symtab_,
737         mapfile_, layout_.
738         (Check_library): Remove unused member symtab_.
739         * archive.h (Lib_group): Remove unused member lib_.
740         * archive.cc (Lib_group::Lib_group): Update initializer.
741         * incremental.h (Incremental_binary): Remove unused member target_.
742         (Incremental_script_entry): Removed unused member script_.
743         * layout.h (Write_symbols_task): Remove unused member input_objects_.
744         * icf.h (Icf): Remove unused member num_tracked_relocs.
745
746         * gold-threads.h (Once): Conditionalize member was_run_lock_ on
747         [ENABLE_THREADS && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4], matching
748         its only use.
749         * gold-threads.cc (Once::Once): Likewise conditionalize initializer.
750
751         * archive.h: Use struct rather than class for forward declaration
752         of Read_symbols_data.
753
754 2013-10-07  Cary Coutant  <ccoutant@google.com>
755
756         PR gold/16010
757         * testsuite/Makefile.am (icf_test): Fix dependencies.
758         (icf_safe_test): Likewise.
759         (icf_safe_so_test): Likewise.
760         (large_symbol_alignment): Add empty _LDADD rule.
761         * testsuite/Makefile.in: Regenerate.
762
763 2013-09-03  Pavel Chupin  <pavel.v.chupin@intel.com>
764
765         PR gold/15927
766         * x86_64.cc (Target_x86_64<size>::Scan::global): Use relative
767         relocation for R_X86_64_32 on x32.
768
769 2013-08-27  Roland McGrath  <mcgrathr@google.com>
770
771         * output.cc (Output_segment::set_section_addresses): Take new
772         Target* argument.  If target->isolate_execinstr() and the segment
773         is executable and starts at a target->abi_pagesize() boundary,
774         pad its end out to a target->abi_pagesize() boundary with code fill.
775         * output.h (Output_segment::set_section_addresses): Update decl.
776         * layout.h (Layout::check_output_data_for_reset_values): Take new
777         argument RELAX_OUTPUTS.
778         (Layout): New member relax_output_list_.
779         (Layout::add_relax_output): New method.
780         * layout.cc (Layout::Layout): Update constructor.
781         (Layout::reset_relax_output): New method.
782         (Layout::clean_up_after_relaxation): Call it.
783         (Layout::prepare_for_relaxation): Update caller.
784         (Layout::set_segment_offsets): Update callers of set_section_addresses.
785         Call reset_relax_output before re-processing segments for
786         isolate_execinstr case.
787         (Layout::write_data): Handle relax_output_list_.
788         (Layout::Relaxation_debug_check::check_output_data_for_reset_values):
789         Take new argument RELAX_OUTPUTS.  Assert it's an empty collection.
790
791 2013-08-23  Yuri Chornoivan  <yurchor@ukr.net>
792
793         PR binutils/15834
794         * object.h: Fix typos.
795
796 2013-08-16  Roland McGrath  <mcgrathr@google.com>
797
798         * i386.cc (Target_i386_nacl::do_code_fill): New virtual function.
799         * x86_64.cc (Target_x86_64_nacl::do_code_fill): New virtual function.
800
801 2013-08-07  Cary Coutant  <ccoutant@google.com>
802
803         Revert support for v2 DWP files:
804
805         2013-03-01  Cary Coutant  <ccoutant@google.com>
806
807             Add dwp support for v2 DWARF package file format.
808             * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
809             tu_length parameter.  Adjust all callers.
810             * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
811             * dwp.cc: Include dwarf.h.
812             (Section_bounds): New struct type.
813             (Unit_set): New struct type.
814             (Dwo_file::Dwo_file): Initialize new data member.
815             (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
816             Combine and rename to...
817             (Dwo_file::read_unit_index): ...this.
818             (Dwo_file::sized_read_compunit_index)
819             (Dwo_file::sized_read_typeunit_index): Combine and rename to...
820             (Dwo_file::sized_read_unit_index): ...this.
821             (Dwo_file::copy_section): Remove section_name, is_str_offsets
822             parameters; add section_id parameter.
823             (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
824             (Dwo_file::add_unit_set): ...this.
825             (Dwo_file::shndx_map_): Remove.
826             (Dwo_file::sect_offsets_): New data member.
827             (Dwp_output_file::Dwp_output_file): Initialize new data members.
828             (Dwp_output_file::add_section): Rename to...
829             (Dwp_output_file::add_contribution): ...this.
830             (Dwp_output_file::add_cu_set): Combine parameters into a struct.
831             (Dwp_output_file::add_tu_set): Likewise.
832             (Dwp_output_file::Contribution): New type.
833             (Dwp_output_file::Section::contributions): New data member.
834             (Dwp_output_file::Cu_or_tu_set): Remove.
835             (Dwp_output_file::Section::Section): New ctor.
836             (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
837             (Dwp_output_file::Dwp_index::Section_table): New type.
838             (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
839             (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
840             parameter.
841             (Dwp_output_file::Dwp_index::shndx_pool): Remove.
842             (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
843             (Dwp_output_file::Dwp_index::section_table): New member function.
844             (Dwp_output_file::Dwp_index::section_table_end): New member function.
845             (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
846             (Dwp_output_file::Dwp_index::section_table_rows): New member function.
847             (Dwp_output_file::Dwp_index::section_table_cols): New member function.
848             (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
849             (Dwp_output_file::Dwp_index::section_table_): New data member.
850             (Dwp_output_file::Dwp_index::section_mask_): New data member.
851             (Dwp_output_file::add_output_section): New member function.
852             (Dwp_output_file::write_new_section): New member function.
853             (Dwp_output_file::write_contributions): New member function.
854             (Dwp_output_file::section_id_map_): New data member.
855             (class Dwo_id_info_reader): Remove.
856             (class Unit_reader): New class.
857             (get_dwarf_section_name): New function.
858             (Dwo_file::read_executable): Adjust initializations of class data.
859             (Dwo_file::read): Add support for v2 package file format.
860             (Dwo_file::read_unit_index): Likewise.
861             (Dwo_file::sized_read_unit_index): Likewise.
862             (Dwo_file::copy_section): Likewise.
863             (Dwo_file::add_unit_set): Likewise.
864             (Dwp_output_file::add_output_section): Likewise.
865             (Dwp_output_file::add_contribution): Likewise.
866             (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
867             for empty slot.
868             (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
869             file format.
870             (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
871             slot.
872             (Dwp_output_file::initialize): Remove unused function.
873             (Dwp_output_file::finalize): Add support for v2 package file format.
874             (Dwp_output_file::write_index): Likewise.
875             * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
876             function prototype.
877
878 2013-07-31  Cary Coutant  <ccoutant@google.com>
879
880         * object.cc (Sized_relobj::do_output_section_address): New function.
881         (Sized_relobj): Instantiate explicitly.
882         * object.h (Object::output_section_address): New function.
883         (Object::do_output_section_address): New function.
884         (Sized_relobj::do_output_section_address): New function.
885         * powerpc.cc (Target_powerpc::symval_for_branch): Use it.
886
887 2013-07-30  Cary Coutant  <ccoutant@google.com>
888             Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
889
890         * parameters.cc (Parameters::entry): Return target-specific entry
891         symbol name.
892         * target.h (Target::entry_symbol_name): New function.
893         (Target_info::entry_symbol_name): New data member.
894
895         * arm.cc (Target_arm::arm_info): Add entry_symbol_name.
896         * i386.cc (Target_i386::i386_info): Likewise.
897         (Target_i386_nacl::i386_nacl_info): Likewise.
898         * sparc.cc (Target_sparc::sparc_info): Likewise.
899         * tilegx.cc (Target_tilegx::tilegx_info): Likewise.
900         * x86_64.cc: (Target_x86_64::x86_64_info) Likewise.
901         (Target_x86_64_nacl::x86_64_nacl_info) Likewise.
902         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
903
904 2013-07-22  Sterling Augustine  <saugustine@google.com>
905
906         * dwarf_reader.cc (Dwarf_pubnames_table::read_section):
907         Convert parameter shndx to local variable. Add parameters symtab
908         and symtab_size.  Scan over section names.  Find relocation
909         section corresponding to current section.  Create and initialize
910         reloc_mapper_ and reloc_type_.
911         (Dwarf_pubnames_table::read_header):  Add assertion.  Change
912         unit_length to off_t.  Initialize member unit_length_.  Fill in field
913         cu_offset_.
914         * dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
915         Initialize new fields unit_length_ and cu_offset_.
916         (Dwarf_pubnames_table::read_section): Update prototype.
917         (Dwarf_pubnames_table::cu_offset): New member function.
918         (Dwarf_pubnames_table::subsection_size): Likewise.
919         (Dwarf_pubnames_table::cu_offset_, Dwarf_pubnames_table::unit_length):
920         New fields.
921         (Dwarf_info_reader::symtab, Dwarf_info_reader::symtab_size): Make
922         member functions public.
923         * gdb_index.cc (Gdb_index_info_reader::read_pubnames_and_pubtypes):
924         Update comment.  Rework logic.  Move repeated parts to...
925         (Gdb_index_info_reader::read_pubtable): ...here. New function.
926         (Gdb_index::Gdb_index): Initialize new fields, pubnames_table_,
927         pubtypes_table_, and stmt_list_offset.
928         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
929         Gdb_index::find_pubtype_offset,
930         Gdb_index::map_pubnames_and_types_to_dies): Define new functions.
931         (Gdb_index::pubnames_read): Update prototype and rework logic.
932         * gdb_index.h (Gdb_index_info_reader, Dwarf_pubnames_table):
933         Forward declare.
934         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
935         Gdb_index::find_pubtype_offset, Gdb_index::pubnames_table)
936         Gdb_index::pubtypes_table, Gdb_index::map_pubnames_and_types_to_dies,
937         Gdb_index::map_pubtable_to_dies):
938         Declare functions.
939         (Gdb_index::pubnames_read): Update declaration.
940         (Gdb_index::Pubname_offset_map): New type.
941         (Gdb_index::cu_pubname_map_, Gdb_index::cu_pubtype_map_,
942         Gdb_index::pubnames_table_, Gdb_index::pubtypes_table_,
943         Gdb_index::stmt_list_offset): Declare.
944         (Gdb_index::pubnames_shndx_, Gdb_index::pubnames_offet_,
945         Gdb_index::pubtypes_object_, Gdb_index::pubtypes_shndx_)
946         Gdb_index::pubtypes_offset_): Remove.
947
948 2013-07-19  Roland McGrath  <mcgrathr@google.com>
949
950         * options.h (General_options): Add -Trodata-segment option.
951         * parameters.cc (Parameters::check_rodata_segment): New function.
952         (Parameters::set_target_once): Call it.
953         * parameters.h (Parameters): Declare it (private member function).
954         * layout.cc (load_seg_unusable_for_headers): New function, broken
955         out of Layout::relaxation_loop_body.  If TARGET->isolate_execinstr()
956         then validate rodata segment rather than text segment.
957         (relaxation_loop_body): Call that.
958         (is_text_segment): New function.  Don't admit a non-executable
959         segment if TARGET->isolate_execinstr().
960         (set_segment_offsets): Call it.  Honor -Trodata-segment option.
961
962 2013-07-15  Shawn Landden  <shawnlandden@gmail.com>
963
964         PR gold/15070
965         * fileread.h (File_read::get_view): Clarify comment about ALIGNED.
966         * nacl.h (Sniff_file::View::View): Request aligned view.
967
968 2013-07-11  Cary Coutant  <ccoutant@google.com>
969
970         * powerpc.cc (Target_powerpc::write_branch_lookup_table): Use
971         correct BRLT entry size.
972
973 2013-07-03  Alan Modra  <amodra@gmail.com>
974
975         * powerpc.cc (Target_powerpc::Relocate::relocate): Update self-call
976         comment.
977
978 2013-07-01  Cary Coutant  <ccoutant@google.com>
979
980         * dwarf_reader.cc (Dwarf_ranges_table::read_ranges_table): Save
981         reloc_type_.
982         (Dwarf_ranges_table::read_range_list): Call lookup_reloc.
983         (Dwarf_ranges_table::lookup_reloc): New function.
984         * dwarf_reader.h (Dwarf_ranges_table::Dwarf_ranges_table): Initialize
985         reloc_type_.
986         (Dwarf_ranges_table::lookup_reloc): New function.
987         (Dwarf_ranges_table::reloc_type_): New data member.
988
989 2013-06-27  Jing Yu  <jingyu@google.com>
990
991         PR gold/15662
992         * powerpc.cc (Output_data_brlt_powerpc::reset_brlt_sizes): New
993         function.
994         (Output_data_brlt_powerpc::finalize_brlt_sizes): New function.
995         (Target_powerpc::do_relax): Call the above.
996
997 2013-06-27  Cary Coutant  <ccoutant@google.com>
998
999         * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
1000         on garbage collected .opd section.
1001
1002 2013-06-27  Alan Modra  <amodra@gmail.com>
1003
1004         * powerpc.cc (Target_powerpc::do_gc_add_reference): Test dst_shndx
1005         is non-zero.
1006         (Target_powerpc::do_gc_mark_symbols): Likewise for sym->shndx().
1007         (Target_powerpc::do_function_location): Likewise for loc->shndx.
1008
1009 2013-06-14  Cary Coutant  <ccoutant@google.com>
1010
1011         * resolve.cc (Symbol::override_base): Don't override st_type
1012         from plugin placeholder symbols.
1013         (Symbol_table::resolve): Likewise.
1014         (Symbol_table::should_override): Don't complain about TLS mismatch
1015         if the TO symbol is a plugin placeholder.
1016         * testsuite/Makefile.am (plugin_test_tls): New test.
1017         * testsuite/Makefile.in: Regenerate.
1018         * testsuite/plugin_test_tls.sh: New test script.
1019         * testsuite/two_file_test_2_tls.cc: New test source.
1020         * testsuite/two_file_test_tls.cc: New test source.
1021
1022 2013-06-05  Alexander Ivchenko  <alexander.ivchenko@intel.com>
1023
1024         * layout.cc (Layout::set_segment_offsets): Taking care of the case when
1025         the maximum segment alignment is larger than the page size.
1026         * testsuite/Makefile.am (large_symbol_alignment): Test that Gold
1027         correctly aligns the symbols with large alignemnt.
1028         * testsuite/Makefile.in: Regenerate.
1029         * testsuite/large_symbol_alignment.cc: New file.
1030
1031 2013-05-30  Alexander Ivchenko  <alexander.ivchenko@intel.com>
1032             Sriraman Tallam  <tmsriram@google.com>
1033
1034         * options.h (sort_section): New option.
1035         * output.h (Input_section_sort_section_prefix_special_ordering_compare):
1036         Rename from Input_section_sort_section_name_special_ordering_compare.
1037         (Input_section_sort_section_name_compare): New struct.
1038         * output.cc (Output_section::Input_section_sort_section_name_compare::
1039         operator()): New function.
1040         (Output_section::sort_attached_input_sections): Use new sort function
1041         for .text if --sort-section=name is specified.
1042         * layout.cc (Layout::make_output_section):
1043         Add sorting by name when --sort-section=name is specified.
1044         * testsuite/Makefile.am (text_section_grouping): Test option
1045         --sort-section=name.
1046         * testsuite/Makefile.in: Regenerate.
1047         * testsuite/section_sorting_name.cc: New file.
1048         * testsuite/section_sorting_name.sh: New file.
1049
1050 2013-05-21  Cary Coutant  <ccoutant@google.com>
1051
1052         * symtab.h (Symbol::is_cxx_vtable): New function.
1053         * target-reloc.h (relocate_section): Check for vtable symbol.
1054         * testsuite/Makefile.am (missing_key_func.sh): New test case.
1055         * testsuite/Makefile.in: Regenerate.
1056         * testsuite/missing_key_func.cc: New test source.
1057         * testsuite/missing_key_func.sh: New test script.
1058
1059 2013-05-21  Cary Coutant  <ccoutant@google.com>
1060
1061         * object.cc (Sized_relobj_file::get_symbol_location_info): Set
1062         type of enclosing symbol.
1063         (Relocate_info::location): Check symbol type when describing symbol.
1064         * object.h (Symbol_location_info): Remove unused line_number;
1065         add enclosing_symbol_type.
1066         * testsuite/debug_msg.sh: Adjust expected output.
1067
1068 2013-05-13  Cary Coutant  <ccoutant@google.com>
1069
1070         * configure.ac: Export DEFAULT_TARGET.
1071         * configure: Regenerate.
1072         * Makefile.in: Regenerate.
1073         * testsuite/Makefile.am: Add .EXPORT_ALL_VARIABLES.
1074         * testsuite/Makefile.in: Regenerate.
1075         * testsuite/debug_msg.sh: Delete duplicate tests.
1076         Don't check undef_int error message match for powerpc where the
1077         source file and line number aren't available.
1078
1079 2013-05-10  Roland McGrath  <mcgrathr@google.com>
1080
1081         * options.h (General_options): Add --rosegment-gap option.
1082         * options.cc (finalize): --rosegment-gap implies --rosegment.
1083         * layout.cc (set_segment_offsets): Let user option override
1084         target->rosegment_gap().
1085
1086 2013-05-10  Roland McGrath  <mcgrathr@google.com>
1087
1088         * options.h (General_options): Remove leading space from help
1089         messages for -nostdlib and --rosegment.
1090
1091 2013-05-03  Maciej W. Rozycki  <macro@codesourcery.com>
1092
1093         PR ld/15365
1094         * layout.cc (Layout::finalize): Make __ehdr_start STV_HIDDEN.
1095
1096 2013-05-03  Alan Modra  <amodra@gmail.com>
1097
1098         * merge.cc (Output_merge_string::do_add_input_section): Correct
1099         scan for number of strings.  Rename vars to avoid shadowing.
1100         Include missing terminator in input_size_.
1101
1102 2013-05-01  H.J. Lu  <hongjiu.lu@intel.com>
1103
1104         * merge.cc (Output_merge_string<Char_type>::do_add_input_section):
1105         Restore empty string handling.
1106
1107 2013-05-01  Cary Coutant  <ccoutant@google.com>
1108
1109         * stringpool.cc (Stringpool_template::new_key_offset): Fix
1110         uninitialized warning.
1111
1112 2013-04-29  Alexander Ivchenko  <alexander.ivchenko@intel.com>
1113
1114         * output.cc (Output_section::add_merge_input_section): Allow
1115         to merge sections if the alignment is more than character size.
1116         * merge.h (Output_merge_string::Output_merge_string): Remove
1117         assert.
1118         * merge.cc (Output_merge_string<Char_type>::do_add_input_section): Count
1119         only not-null strings. Check the alignment of strings.
1120         * stringpool.h
1121         (Stringpool_template<Stringpool_char>::Stringpool_template): Add
1122         alignment as the argument.
1123         (Stringpool_template<Stringpool_char>::addralign_): New class member.
1124         * stringpool.cc (Stringpool_template<Stringpool_char>::new_key_offset):
1125         Align non-zero length strings according to the addralign_.
1126         (Stringpool_template<Stringpool_char>::set_string_offsets):
1127         Updating offsets according to the given alignment.
1128         * testsuite/Makefile.am (text_section_grouping): Test if string
1129         literals are getting merged.
1130         * testsuite/Makefile.in: Regenerate.
1131         * testsuite/merge_string_literals_1.c: New file.
1132         * testsuite/merge_string_literals_2.c: Ditto.
1133         * testsuite/merge_string_literals.sh: Ditto.
1134
1135 2013-04-26  Ian Lance Taylor  <iant@google.com>
1136
1137         * target-reloc.h (relocate_section): If the reloc offset is out of
1138         range, pass VIEW as NULL to relocate.relocate.
1139         * arm.cc (Target_arm:Relocate::relocate): Check for a NULL view.
1140         * i386.cc (Target_i386::Relocate::relocate): Likewise.
1141         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
1142         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
1143         * tilegx.cc (Target_tilegx::Relocate::relocate): Likewise.
1144         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
1145
1146 2013-04-26  Geoff Pike  <gpike@chromium.org>
1147
1148         * gold.cc (queue_final_tasks): invoke layout->queue_build_id_tasks().
1149         * layout.cc (Hash_task): New class.
1150         (Layout::queue_build_id_tasks): New function.
1151         (Layout::write_build_id): Handle single-thread portion of build ID
1152         computation.  (In some cases, all of it is single-threaded.)  Replace
1153         {sha1,md5}_process_bytes with {sha1,md5}_buffer to get the same
1154         functionality in fewer lines of code.
1155         * layout.h (Layout::queue_build_id_tasks): New function declaration.
1156         * options.h (General_options): make "--build-id" default to tree
1157         rather than sha1.  Add two new options related to --build-id=tree:
1158         --build-id-chunk-size-for-treehash and
1159         --build-id-min-file-size-for-treehash.
1160         * Makefile.am: add testing of --build-id=tree and related new options
1161         (these tests will be invoked by "make check").
1162         * Makefile.in: Regenerate.
1163
1164 2013-04-25  Alan Modra  <amodra@gmail.com>
1165
1166         * configure.tgt: Add powerpcle and powerpc64le.
1167
1168 2013-04-22  Alan Modra  <amodra@gmail.com>
1169
1170         PR gold/15355
1171         * layout.cc (Layout::segment_precedes): Allow more than one
1172         segment with the same type and flags.
1173
1174 2013-04-15  Cary Coutant  <ccoutant@google.com>
1175
1176         * layout.cc (Layout::set_relocatable_section_offsets): Don't
1177         allocate space in file for BSS sections.
1178
1179 2013-04-15  Cary Coutant  <ccoutant@google.com>
1180
1181         * script-sections.cc (Orphan_output_section): Reset address
1182         to zero after each orphaned section for relocatable links.
1183
1184 2013-04-15  Cary Coutant  <ccoutant@google.com>
1185
1186         * symtab.cc (Symbol_table::sized_write_globals): Subtract
1187         section starting address for relocatable link.
1188         * testsuite/Makefile.am (script_test_11): New test.
1189         * testsuite/Makefile.in: Regenerate.
1190         * testsuite/script_test_11.c: New source file.
1191         * testsuite/script_test_11.t: New linker script.
1192
1193 2013-04-13  Alan Modra  <amodra@gmail.com>
1194
1195         * powerpc.cc (Stub_control::can_add_to_stub_group): Don't set
1196         owner when sections are not adjacent and exceed group size.
1197         (Target_powerpc::group_sections): Handle corner case.
1198         (Target_powerpc::Branch_info::make_stub): Handle case where
1199         stub table doesn't exist due to branches in non-exec sections.
1200         (Target_powerpc::Relocate::relocate): Likewise.
1201
1202 2013-04-11  Alan Modra  <amodra@gmail.com>
1203
1204         PR gold/15354
1205         * powerpc.cc (Target_powerpc::make_brlt_section): Name section
1206         .branch_lt to match bfd ld.  Adjust comments throughout file.
1207
1208 2013-04-04  Ian Lance Taylor  <iant@google.com>
1209
1210         GCC PR c++/56840
1211         * object.cc (do_layout_deferred_sections): Handle .eh_frame
1212         sections before checking whether they are included in the link.
1213
1214 2013-03-29  Sriraman Tallam  <tmsriram@google.com>
1215
1216         * archive.cc (Archive::get_elf_object_for_member):  Create the elf
1217         object before calling the plugin claim_file handler.  Pass the elf
1218         object of the archive to the plugin. Delete the elf object if the
1219         plugin claims the file.
1220
1221 2013-03-21  Alan Modra  <amodra@gmail.com>
1222
1223         * layout.cc (Layout::set_segment_offsets): Accept writable .text
1224         segment when omagic.
1225
1226 2013-03-21  Alan Modra  <amodra@gmail.com>
1227
1228         * dwp.cc (Dwp_output_file::add_contribution): Avoid signed/unsigned
1229         comparison warning.
1230         * layout.cc (Layout::create_dynamic_symtab): Avoid "may be used
1231         uninitialized" warning.
1232
1233 2013-03-20  Alan Modra  <amodra@gmail.com>
1234
1235         * symtab.h (Symbol::clear_version): New function.
1236         * symtab.cc (Symbol_table::set_dynsym_indexes): Don't set object
1237         is_needed by weak references.  Clear version for symbols defined
1238         in as-needed objects that are not needed.
1239
1240 2013-03-15  Alan Modra  <amodra@gmail.com>
1241
1242         * powerpc.cc (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Make
1243         static and public.  Add report_err param.  Return false for data refs.
1244         (Target_powerpc::rela_dyn_section): New overloaded function.
1245         (Target_powerpc::plt_, iplt_): Elucidate.
1246         (Output_data_plt_powerpc::entry_count): Handle current_data_size()==0.
1247         (Output_data_plt_powerpc::do_write): Don't write .iplt.
1248         (Output_data_plt_powerpc::plt_entry_count): Don't add .iplt entries.
1249         (Target_powerpc::Scan::local, global): Adjust reloc_needs_plt_for_ifunc
1250         calls.  Put ifunc dynamic relocs in irela_dyn_section.  Only
1251         push_branch and make_plt_entry for ifunc syms when
1252         reloc_needs_plt_for_ifunc.
1253         (Target_powerpc::Relocate::relocate): Don't use plt entry value
1254         for ifunc unless reloc_needs_plt_for_ifunc.
1255
1256 2013-03-15  Alan Modra  <amodra@gmail.com>
1257
1258         * gc.h (gc_process_relocs): Don't look through function descriptors.
1259         * icf.cc (get_section_contents): Do so here instead.
1260
1261 2013-03-13  Alan Modra  <amodra@gmail.com>
1262
1263         * powerpc.cc (is_branch_reloc): Forward declare.
1264         (Target_powerpc::do_can_check_for_function_pointers): New predicate.
1265         (Target_powerpc::Scan::local_reloc_may_be_function_pointer): Return
1266         false for 64-bit, true for 32-bit non-branch relocs.
1267         (Target_powerpc::Scan::global_reloc_may_be_function_pointer): Likewise.
1268         * testsuite/Makefile.am (icf_test): Use linker map file instead of
1269         nm output.
1270         (icf_safe_test): Generate linker map file as well as nm output.
1271         (icf_safe_so_test): Likewise.
1272         * testsuite/Makefile.in: Regenerate.
1273         * testsuite/icf_test.sh: Parse linker map file to determine
1274         section folding.
1275         * testsuite/icf_safe_test.sh: Likewise.  Expect folding for PowerPC.
1276         * testsuite/icf_safe_so_test.sh: Likewise.
1277         (X86_32_or_ARM_specific_safe_fold): Merge into..
1278         (arch_specific_safe_fold): ..this.
1279         (X86_64_specific_safe_fold): Delete unused function.
1280
1281 2013-03-12  Alan Modra  <amodra@gmail.com>
1282
1283         * gc.h (gc_process_relocs): Look through function descriptors
1284         to determine shndx, symvalue and addend used by ICF.  Tidy
1285         variable duplication.
1286
1287 2013-03-11  Alan Modra  <amodra@gmail.com>
1288
1289         * gold.cc (queue_middle_tasks): Move detect_odr_violations..
1290         * layout.cc (Layout_task_runner::run): ..to here.
1291         * symtab.h (struct Symbol_location): Extract from..
1292         (class Symbol_table): ..here.
1293         * symtab.cc (Symbol_table::linenos_from_loc): Invoke function_location.
1294         * target.h (class Target): Add function_location and
1295         do_function_location functions.
1296         (class Sized_target): Add do_function_location.
1297         * object.h (class Sized_relobj_file): Move find_shdr..
1298         (class Object): ..to here.
1299         * object.cc: Likewise.  Update to suit.  Instantiate.
1300         (Sized_relobj_file::find_eh_frame): Update find_shdr call.
1301         * powerpc.cc (class Powerpc_dynobj): New.
1302         (Target_powerpc::do_function_location): New function.
1303         (Powerpc_relobj::do_find_special_sections): Update find_shdr call.
1304         (Powerpc_dynobj::do_read_symbols): New function.
1305         (Target_powerpc::do_make_elf_object): Make a Powerpc_dynobj.
1306
1307 2013-03-08  Ian Lance Taylor  <iant@google.com>
1308
1309         * options.cc (General_options::string_to_object_format): Accept
1310         "default".
1311
1312 2013-03-08  Alan Modra  <amodra@gmail.com>
1313
1314         * ehframe.h (Post_fdes) Make it a vector of Post_fde rather than
1315         pointer to Post_fde.
1316         (struct Post_fde): Move definition to here..
1317         * ehframe.cc (struct Post_fde): ..from here.
1318         (Cie::write): Don't alloc Post_fde.
1319         (Eh_frame::do_sized_write): Update.  Don't free Post_fde.
1320
1321 2013-03-07  Alan Modra  <amodra@gmail.com>
1322
1323         * testsuite/discard_locals_relocatable_test.c: Add a powerpc
1324         relocation referencing .LC0.
1325         * testsuite/discard_locals_test.sh: Remove FIXMEs.
1326
1327 2013-03-07  Alan Modra  <amodra@gmail.com>
1328
1329         * testsuite/ifunc-sel.h (ifunc_sel, ifunc_one): Mark
1330         always_inline.  Add assembly for powerpc to avoid GOT.
1331
1332 2013-03-07  Alan Modra  <amodra@gmail.com>
1333
1334         * testsuite/script_test_10.sh: Don't test .bss section
1335         header number.
1336
1337 2013-03-06  Alan Modra  <amodra@gmail.com>
1338
1339         * powerpc.cc (class Powerpc_relobj): Move some member functions.
1340         (Target_powerpc::symval_for_branch):  Add symtab param.  Update
1341         all callers.  Handle folded sections.
1342         (Target_powerpc::do_gc_add_reference): Don't cast dynamic object
1343         to Powerpc_relobj.
1344         (Global_symbol_visitor_opd::operator()): Likewise.
1345
1346 2013-03-04  Alan Modra  <amodra@gmail.com>
1347
1348         * testsuite/Makefile.am (final_layout_script.lds): Add .sbss.
1349         * testsuite/Makefile.in: Regenerate.
1350
1351 2013-03-01  Cary Coutant  <ccoutant@google.com>
1352
1353         Add dwp support for v2 DWARF package file format.
1354         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
1355         tu_length parameter.  Adjust all callers.
1356         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
1357         * dwp.cc: Include dwarf.h.
1358         (Section_bounds): New struct type.
1359         (Unit_set): New struct type.
1360         (Dwo_file::Dwo_file): Initialize new data member.
1361         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
1362         Combine and rename to...
1363         (Dwo_file::read_unit_index): ...this.
1364         (Dwo_file::sized_read_compunit_index)
1365         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
1366         (Dwo_file::sized_read_unit_index): ...this.
1367         (Dwo_file::copy_section): Remove section_name, is_str_offsets
1368         parameters; add section_id parameter.
1369         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
1370         (Dwo_file::add_unit_set): ...this.
1371         (Dwo_file::shndx_map_): Remove.
1372         (Dwo_file::sect_offsets_): New data member.
1373         (Dwp_output_file::Dwp_output_file): Initialize new data members.
1374         (Dwp_output_file::add_section): Rename to...
1375         (Dwp_output_file::add_contribution): ...this.
1376         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
1377         (Dwp_output_file::add_tu_set): Likewise.
1378         (Dwp_output_file::Contribution): New type.
1379         (Dwp_output_file::Section::contributions): New data member.
1380         (Dwp_output_file::Cu_or_tu_set): Remove.
1381         (Dwp_output_file::Section::Section): New ctor.
1382         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
1383         (Dwp_output_file::Dwp_index::Section_table): New type.
1384         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
1385         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
1386         parameter.
1387         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
1388         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
1389         (Dwp_output_file::Dwp_index::section_table): New member function.
1390         (Dwp_output_file::Dwp_index::section_table_end): New member function.
1391         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
1392         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
1393         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
1394         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
1395         (Dwp_output_file::Dwp_index::section_table_): New data member.
1396         (Dwp_output_file::Dwp_index::section_mask_): New data member.
1397         (Dwp_output_file::add_output_section): New member function.
1398         (Dwp_output_file::write_new_section): New member function.
1399         (Dwp_output_file::write_contributions): New member function.
1400         (Dwp_output_file::section_id_map_): New data member.
1401         (class Dwo_id_info_reader): Remove.
1402         (class Unit_reader): New class.
1403         (get_dwarf_section_name): New function.
1404         (Dwo_file::read_executable): Adjust initializations of class data.
1405         (Dwo_file::read): Add support for v2 package file format.
1406         (Dwo_file::read_unit_index): Likewise.
1407         (Dwo_file::sized_read_unit_index): Likewise.
1408         (Dwo_file::copy_section): Likewise.
1409         (Dwo_file::add_unit_set): Likewise.
1410         (Dwp_output_file::add_output_section): Likewise.
1411         (Dwp_output_file::add_contribution): Likewise.
1412         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
1413         for empty slot.
1414         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
1415         file format.
1416         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
1417         slot.
1418         (Dwp_output_file::initialize): Remove unused function.
1419         (Dwp_output_file::finalize): Add support for v2 package file format.
1420         (Dwp_output_file::write_index): Likewise.
1421         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
1422         function prototype.
1423
1424 2013-03-01  Cary Coutant  <ccoutant@google.com>
1425
1426         * dwarf_reader.cc (Dwarf_info_reader::check_buffer): Move
1427         function into class definition in header file.
1428         (Dwarf_info_reader::warn_corrupt_debug_section): New function.
1429         * dwarf_reader.h (Dwarf_info_reader::warn_corrupt_debug_section):
1430         New function.
1431         (Dwarf_info_reader::check_buffer): Move here from .cc file.
1432
1433 2013-02-28  Alan Modra  <amodra@gmail.com>
1434
1435         * target.h (Target::plt_fde_location, do_plt_fde_location): Declare.
1436         * target.cc (Target::do_plt_fde_location): New function.
1437         * ehframe.h (class FDE): Add post_map field to u_.from_linker,
1438         accessor function, and constructor param.
1439         (struct Post_fde, Post_fdes): Declare.
1440         (Cie::write): Add post_fdes param.
1441         * ehframe.cc (Fde::write): Use plt_fde_location.
1442         (struct Post_fde): Define.
1443         (Cie::write): Stash FDEs added post merge mapping.
1444         (Eh_frame::add_ehframe_for_plt): Assert no new CIEs after mapping.
1445         Adjust Fde constructor call.  Bump final_data_size_ for post map FDEs.
1446         (Eh_frame::do_sized_write): Arrange to write post map FDES after
1447         other FDEs.
1448         * powerpc.cc (Target_powerpc::do_plt_fde_location): New function.
1449         (Target_powerpc::has_glink): New function.
1450         (Target_powerpc::do_relax): Add eh_frame info for stubs.
1451         (struct Eh_cie, eh_frame_cie, glink_eh_frame_fde_64,
1452         glink_eh_frame_fde_32, default_fde): New data.
1453         (Stub_table::eh_frame_added_): New var.
1454         (Stub_table::find_long_branch_entry, stub_address, stub_offset):
1455         Make const.
1456         (Stub_table::add_eh_frame): New function.
1457         (Output_data_glink::add_eh_frame): New function.
1458         (Target_powerpc::make_glink_section): Call add_eh_frame.
1459
1460 2013-02-15  Ian Lance Taylor  <iant@google.com>
1461
1462         * options.h (DEFINE_uint64_alias): Define.
1463         (class General_options): Add -Ttext-segment as an alias for
1464         -Ttext.
1465
1466 2013-02-15  Alan Modra  <amodra@gmail.com>
1467
1468         * powerpc.cc (Stub_table::plt_off): New function, extracted from..
1469         (Stub_table::do_write): ..here, two places.
1470         (Stub_table::plt_call_size): Use it here too.
1471
1472 2013-02-11  Ian Lance Taylor  <iant@google.com>
1473
1474         * descriptors.cc (Descriptors::close_all): New function.
1475         * descriptors.h (class Descriptors): Declare close_all.
1476         (close_all_descriptors): New inline function.
1477         * plugin.cc: Include "descriptors.h".
1478         (Plugin_manager::cleanup): Call close_all_descriptors.
1479
1480 2013-02-06  Alan Modra  <amodra@gmail.com>
1481
1482         * README: Update coding style link.
1483
1484 2013-01-28  Cary Coutant  <ccoutant@google.com>
1485
1486         * dwp.cc (File_list): New typedef.
1487         (Dwo_name_info_reader): New class.
1488         (Dwo_id_info_reader::Dwo_id_info_reader): Remove unused parameters.
1489         (Dwo_id_info_reader::visit_top_die): Remove unused member function.
1490         (Dwo_file::~Dwo_file): Delete input_file_ after obj_.
1491         (Dwo_file::read_executable): New function.
1492         (Dwo_file::read): Move common setup code to ...
1493         (Dwo_file::make_object): ... here.
1494         (dwp_options): Add --exec/-e.
1495         (usage): Likewise.
1496         (main): Likewise.
1497
1498 2013-01-24  Sriraman Tallam  <tmsriram@google.com>
1499
1500         * layout.cc (Layout::layout): Check for option text_reorder.
1501         (Layout::make_output_section): Ditto.
1502         * options.h (text_reorder): New option.
1503         * output.cc (Input_section_sort_compare): Remove special ordering
1504         of section names.
1505         (Output_section::
1506          Input_section_sort_section_name_special_ordering_compare::
1507          operator()): New function.
1508         (Output_section::sort_attached_input_sections): Use new sort function
1509         for .text.
1510         * output.h (Input_section_sort_section_name_special_ordering_compare):
1511         New struct.
1512         * testsuite/Makefile.am (text_section_grouping): Test option
1513         --no-text-reorder
1514         * testsuite/Makefile.in: Regenerate.
1515         * testsuite/text_section_grouping.sh: Check order of functions without
1516         default text reordering.
1517
1518 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
1519
1520         * options.h (General_options): Change default to true for new_dtags.
1521
1522 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
1523
1524         * layout.cc (Layout::finish_dynamic_section): Only add DT_RPATH
1525         when enable_new_dtags is false.  Only add DT_RUNPATH when
1526         enable_new_dtags is true.
1527
1528 2013-01-17  Serge Pavlov  <serge.v.pavlov@gmail.com>
1529
1530         * powerpc.cc (Stub_table::find_plt_call_entry): Make types
1531         used in declaration and definition consistent.
1532         (Target_powerpc::symval_for_branch): Ditto.
1533
1534 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
1535
1536         * testsuite/plugin_final_layout.cc: Fix comment.
1537
1538 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
1539
1540         * layout.cc (Layout::layout): Do not do default sorting for
1541         text sections when section ordering is specified.
1542         (make_output_section): Ditto.
1543         * testsuite/plugin_final_layout.cc: Name the function sections
1544         to catch reordering issues.
1545
1546 2013-01-15  Alan Modra  <amodra@gmail.com>
1547
1548         * powerpc.cc (Target_powerpc::do_relax): Default shared libs to
1549         plt-thread-safe.
1550
1551 2013-01-15  Alan Modra  <amodra@gmail.com>
1552
1553         * testsuite/Makefile.am (final_layout_script.lds): Handle .got section.
1554         * testsuite/Makefile.in: Regenerate.
1555
1556 2013-01-14  Alan Modra  <amodra@gmail.com>
1557
1558         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add various output files.
1559         * testsuite/Makefile.in: Regenerate.
1560
1561 2013-01-11  Pavel Chupin  <pavel.v.chupin@intel.com>
1562
1563         PR bfd/14430
1564         Fix mingw gold build with plugins enabled
1565         * Makefile.am: Replace -ldl with @DLOPEN_LIBS@.
1566         * configure.ac: Export DLOPEN_LIBS and add headers check.
1567         * plugin.cc: Handle non-dlfcn case.
1568         * Makefile.in: Regenerate.
1569         * config.in: Regenerate.
1570         * configure: Regenerate.
1571         * testsuite/Makefile.in: Regenerate.
1572
1573 2013-01-09  Sriraman Tallam  <tmsriram@google.com>
1574
1575         * output.h (sort_attached_input_sections): Change to be public.
1576         * script-sections.cc
1577         (Output_section_definition::set_section_addresses): Sort
1578         attached input sections according to section order before linker
1579         script assigns section addresses.
1580         (Orphan_output_section::set_section_addresses): Sort
1581         attached input sections according to section order before linker
1582         script assigns section addresses.
1583         * Makefile.am (final_layout.sh): Use a simple linker script to
1584         check if section ordering still works.
1585         * Makefile.in: Regenerate.
1586
1587 2013-01-09  Ben Cheng  <bccheng@google.com>
1588
1589         * arm.cc (Target_arm::attributes_accept_div): New function.
1590         (Target_arm::attributes_forbid_div): New function.
1591         (Target_arm::merge_object_attributes): Merge the Tag_DIV_use
1592         attribute using the same new functions as what bfd/elf32_arm.c
1593         does.
1594
1595 2013-01-07  Cary Coutant  <ccoutant@google.com>
1596
1597         PR gold/14993
1598         * output.cc (Output_section::add_input_section): For incremental
1599         updates, don't track input sections that are allocated from patch
1600         space.
1601
1602 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
1603             Ian Lance Taylor  <iant@google.com>
1604
1605         PR gold/14897
1606         * configure.ac (--enable-ld): Removed.
1607         (install_as_default): Set to yes only for --enable-gold=default
1608         or --disable-ld.
1609         * configure: Regenerated.
1610
1611 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
1612
1613         * options.h (General_options): Add -fuse-ld= for GCC linker
1614         option compatibility.
1615
1616 2013-01-04  Cary Coutant  <ccoutant@google.com>
1617
1618         * configure.ac: Fix typo restoring CXXFLAGS.
1619         * configure: Regenerate.
1620
1621 2013-01-04  Cary Coutant  <ccoutant@google.com>
1622
1623         * testsuite/Makefile.am (CXXLINK_S): New macro.
1624         (debug_msg_so.err, debug_msg_ndebug.err): Use CXXLINK_S.
1625         * testsuite/Makefile.in: Regenerate.
1626
1627 2013-01-02  H.J. Lu  <hongjiu.lu@intel.com>
1628
1629         * version.cc (print_version): Update copyright year to 2013.
1630
1631 2012-12-20  Ian Lance Taylor  <iant@google.com>
1632
1633         * layout.cc (Layout::special_ordering_of_input_section): New
1634         function.
1635         (Layout::layout): If input section requires special ordering, must
1636         sort input sections.
1637         (Layout::make_output_section): May sort .text input sections.
1638         (Layout::is_section_name_prefix_grouped): Remove.
1639         * layout.h (class Layout): Declare
1640         special_ordering_of_input_section.  Don't declare
1641         is_section_name_prefix_grouped.
1642         * output.cc (Output_section::add_input_section): Revert last
1643         change.
1644         (Output_section::Input_section_sort::match_file_name): Don't crash
1645         if called on output section data.
1646         (Output_section::Input_section_sort_compare): Sort based on
1647         special ordering.
1648         (Output_section::Input_section_sort_section_order_index_compare):
1649         Revert last patch.
1650         (Output_section::sort_attached_input_sections): Likewise.
1651
1652 2012-12-18  Sriraman Tallam  <tmsriram@google.com>
1653
1654         * layout.cc (Layout::is_section_name_prefix_grouped): New function.
1655         * layout.h (Layout::is_section_name_prefix_grouped): New function.
1656         * output.cc (Output_section::add_input_section): Check if section
1657         name contains special prefix.  Keep input sections to sort such
1658         sections.
1659         (Output_section::Input_section_sort_section_order_index_compare
1660          ::operator()): Group sections according to prefixes.
1661         (Output_section::sort_attached_input_sections): Add condition to
1662         Input_section_entry constructor call.
1663         * testsuite/Makefile.am (text_section_grouping): New test.
1664         * testsuite/Makefile.in: Regenerate.
1665         * testsuite/text_section_grouping.cc: New file.
1666         * testsuite/text_section_grouping.sh: New file.
1667
1668 2012-12-17  Nick Clifton  <nickc@redhat.com>
1669
1670         * Makefile.am: Add copyright notice.
1671         * NEWS: Likewise.
1672         * README: Likewise.
1673         * configure.ac: Likewise.
1674         * ftruncate.c: Likewise.
1675         * Makefile.in: Regenerate.
1676
1677 2012-12-14  Cary Coutant  <ccoutant@google.com>
1678
1679         * testsuite/Makefile.am (exception_separate_shared_12_test): Add
1680         --no-as-needed flag.
1681         (exception_separate_shared_12_test): Likewise.
1682         (incremental_copy_test): Likewise.
1683         * testsuite/Makefile.in: Regenerate.
1684
1685 2012-12-14  Cary Coutant  <ccoutant@google.com>
1686
1687         * dwp.cc (Dwp_output_file::add_cu_set): Check for duplicate CUs.
1688         (Dwp_output_file::Dwp_index::enter_set): Add assert.
1689
1690 2012-12-12  Alan Modra  <amodra@gmail.com>
1691
1692         * powerpc.cc (class Track_tls): New.
1693         (class Relocate, class Scan): Inherit Track_tls.
1694         (Target_powerpc::Scan::local, global): Track tls optimization
1695         and avoid creating plt entry for __tls_get_addr if all uses
1696         are optimized away.
1697         (Target_powerpc::Relocate::relocate): Update to use Track_tls.
1698
1699 2012-12-12  Alan Modra  <amodra@gmail.com>
1700
1701         * options.h (General_options): Add --toc-sort/--no-toc-sort.
1702         Replace no_toc_optimize with toc_optimize.
1703         * output.h (Output_section::input_sections): Provide non-const variant.
1704         * powerpc.cc (Powerpc_relobj::has_small_toc_reloc_,
1705         set_has_small_toc_reloc, has_small_toc_reloc): New variable and
1706         accessors.
1707         (Target_powerpc::Scan::local, global): Call set_has_small_toc_reloc.
1708         (class Sort_toc_sections): New.
1709         (Target_powerpc::do_finalize_sections): Sort toc sections.
1710         (Target_powerpc::Relocate::relocate): Update toc_optimize test.
1711
1712 2012-12-10  Roland McGrath  <mcgrathr@google.com>
1713
1714         * testsuite/binary_unittest.cc (read_all): New function.
1715         (Sized_binary_test): Use it instead of ::read.
1716         * fileread.cc (do_read): Don't assume pread always reads the whole
1717         amount in a single call.
1718
1719 2012-12-10  Alan Modra  <amodra@gmail.com>
1720
1721         * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
1722         Set EM_PPC64 or EM_PPC here.
1723         (Target_selector_powerpc::do_recognize): Delete.
1724
1725 2012-12-10  Alan Modra  <amodra@gmail.com>
1726
1727         * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
1728         stub_table_.
1729         (Target_powerpc::Branch_info::make_stub): Don't omit addend.
1730
1731 2012-12-07  Roland McGrath  <mcgrathr@google.com>
1732
1733         * testsuite/binary_unittest.cc (Sized_binary_test):
1734         Use open_descriptor rather than ::open.
1735
1736 2012-12-07  Alan Modra  <amodra@gmail.com>
1737
1738         * powerpc.cc (Stub_table::do_write): Delete redundant Address
1739         typedef and invalid_address constant.
1740         (Output_data_glink, Stub_table, Target_powerpc): Explicitly
1741         instantiate constants.
1742
1743 2012-12-06  Roland McGrath  <mcgrathr@google.com>
1744
1745         * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
1746         Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
1747         * aclocal.m4: Regenerate.
1748         * configure: Regenerate.
1749         * Makefile.in: Regenerate.
1750         * testsuite/Makefile.in: Regenerate.
1751
1752 2012-12-07  Alan Modra  <amodra@gmail.com>
1753
1754         * options.h (General_options): Add no_toc_optimize.
1755         * powerpc.cc (ok_lo_toc_insn): New function.
1756         (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
1757
1758 2012-12-06  Alan Modra  <amodra@gmail.com>
1759
1760         * options.h (General_options): Add plt_align, plt_static_chain,
1761         plt_thread_safe.  Update stub_group_size help text.
1762         * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
1763         for new plt_thread_safe_ var.
1764         (use_plt_offset): Correct comments.
1765         (Target_powerpc::do_relax): Look for thread creation symbols to
1766         determine default plt_thread_safe value.  Clear plt call stubs
1767         as well as branch stubs each iteration.
1768         (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
1769         insn constants.
1770         (l, hi, ha, write_insn): Move earlier.
1771         (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
1772         (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
1773         plt stubs too.
1774         (Stub_table::update_size): Adjust.
1775         (Stub_table::prev_size, set_prev_size): Delete.
1776         (Stub_table::stub_align): Let --plt-align affect result.
1777         (Stub_table::plt_call_size): Calculate sizes for various stubs.
1778         (Stub_table::branch_stub_size): Use last_plt_size in address calc.
1779         (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
1780         (Stub_table::do_write): Support more stub variants.
1781
1782 2012-12-04  Alan Modra  <amodra@gmail.com>
1783
1784         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
1785         (Target_powerpc::do_define_standard_symbols): New function.
1786
1787 2012-12-03  Alan Modra  <amodra@gmail.com>
1788
1789         * output.h: Formatting, whitespace.
1790
1791 2012-12-03  Alan Modra  <amodra@gmail.com>
1792
1793         * layout.h (Layout::get_executable_sections): Declare.
1794         * layout.cc (Layout::get_executable_sections): New function.
1795         * arm.cc (Target_arm::group_sections): Use it.
1796         (Arm_output_section::group_sections): Delete now redundant test.
1797         * output.cc (Output_reloc::Output_reloc): Add is_relative.
1798         param to handle relative relocs.
1799         * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
1800         (Output_data_reloc::add_absolute): Adjust.
1801         (Output_data_reloc::add_relative): New function.
1802         (Output_data::reset_data_size): New function.
1803         (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
1804         (Output_section::set_addralign): New function.
1805         (Output_section::checkpoint_set_addralign): New function.
1806         (Output_section::clear_section_offsets_need_adjustment): New function.
1807         (Output_section::input_sections): Make public.
1808         * powerpc.cc (class Output_data_brlt_powerpc): New.
1809         (class Stub_table, class Stub_control): New.
1810         (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
1811         stub_table_, set_stub_table, stub_table): New vectors and accessor
1812         functions.
1813         (Target_powerpc::do_may_relax, do_relax, push_branch,
1814         new_stub_table, stub_tables, brlt_section, group_sections,
1815         add_branch_lookup_table, find_branch_lookup_table,
1816         write_branch_lookup_table, make_brlt_section): New functions.
1817         (Target_powerpc::struct Sort_sections, class Branch_info): New.
1818         (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
1819         branch_info_): New vars.
1820         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
1821         make call stubs here.
1822         (Output_data_glink): Remove all call stub handling from this class.
1823         (Target_powerpc::Scan::local, global): Save interesting branch
1824         relocs and relocs for ifunc.  Adjust calls to plt entry functions.
1825         (Target_powerpc::do_finalize_sections): Only make reg save/restore
1826         functions on final link.
1827         (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
1828         Handle long branch destinations too.
1829         (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
1830         do_plt_address_for_local): Adjust lookup of plt call stubs.
1831
1832 2012-11-30  Alan Modra  <amodra@gmail.com>
1833
1834         * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
1835         relocs against protected symbols when building 32-bit shared libs.
1836
1837 2012-11-30  Alan Modra  <amodra@gmail.com>
1838
1839         * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
1840         param.  Call got_section() to make .got.  Update all callers
1841         and their callers and so on.
1842
1843 2012-11-30  Alan Modra  <amodra@gmail.com>
1844
1845         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
1846         _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
1847         (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
1848         value if it already exists.
1849
1850 2012-11-19  H.J. Lu  <hongjiu.lu@intel.com>
1851
1852         PR gold/14858
1853         * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
1854
1855 2012-11-14  Roland McGrath  <mcgrathr@google.com>
1856
1857         * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
1858         than bfc instruction for data sandboxing.
1859
1860 2012-11-08  Alan Modra  <amodra@gmail.com>
1861
1862         * po/POTFILES.in: Regenerate.
1863
1864 2012-11-05  Alan Modra  <amodra@gmail.com>
1865
1866         * configure.ac: Apply 2012-09-10 change to config.in here.
1867         * configure: Regenerate.
1868
1869 2012-11-05  Alan Modra  <amodra@gmail.com>
1870
1871         * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
1872         (struct Opd_ent): Use "Address" rather than "Offset".
1873         (Output_data_got_powerpc::got_base_offset): Return Valtype.
1874         (Target_powerpc::got_section): Make public.
1875         (Target_powerpc::scan_relocs): Move code setting symbols..
1876         (Powerpc_relobj::do_scan_relocs): ..to here, new function.
1877         Create _SDA_BASE_ only when referenced.
1878
1879 2012-11-02  Roland McGrath  <mcgrathr@google.com>
1880
1881         * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
1882         from last change.
1883
1884 2012-11-01  Roland McGrath  <mcgrathr@google.com>
1885
1886         * target.h (Sized_target::relocate_relocs): Use Elf_Off
1887         for offset_in_output_section parameter.
1888         (Sized_target::relocate_special_relocatable): Likewise.
1889         * arm.cc (Target_arm::relocate_relocs): Likewise.
1890         (Target_arm::relocate_special_relocatable): Likewise.
1891         * i386.cc (Target_i386::relocate_relocs): Likewise.
1892         * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
1893         * sparc.cc (Target_sparc::relocate_relocs): Likewise.
1894         * target-reloc.h (relocate_relocs): Likewise.
1895         * testsuite/testfile.cc (Target_test): Likewise.
1896         * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
1897         * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
1898
1899         * system.h: Move inclusion of <clocale> to after <libintl.h> in
1900         [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
1901
1902         * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
1903         parameter, which is unused in the [!F_SETFD] case.
1904
1905         * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
1906         SYMNDX to off_t before comparing it to this->data_size().
1907         * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
1908         * incremental.cc (Output_section_incremental_inputs::do_write):
1909         Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
1910
1911         * nacl.cc: Include "libiberty.h" for vasprintf declaration.
1912
1913 2012-10-30  Steve McIntyre  <steve.mcintyre@linaro.org>
1914
1915         * gold.cc (Target_arm::do_adjust_elf_header): Add the
1916         hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
1917         in EABI_VER5.
1918
1919 2012-10-29  Cary Coutant  <ccoutant@google.com>
1920
1921         * dwp.cc (usage): Add file and exit status parameters;
1922         add --help and --version options.
1923         (print_version): New function.
1924         (main): Add --help and --version options.
1925
1926 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1927
1928         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
1929         final_layout_sequence.txt.
1930         * testsuite/Makefile.in: Regenerated.
1931
1932 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1933
1934         * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
1935         COMPILE generated by automake.
1936         (LINK1): Likewise.
1937         (CXXCOMPILE1): Likewise.
1938         (CXXLINK1): Likewise.
1939         (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
1940         (LINK): Likewise.
1941         (CXXCOMPILE): Likewise.
1942         (CXXLINK): Likewise.
1943         * testsuite/Makefile.in: Regenerated.
1944
1945 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1946
1947         * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
1948         on bad fwrite return.
1949
1950 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1951
1952         * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
1953         on val.
1954
1955 2012-10-23  Cary Coutant  <ccoutant@google.com>
1956
1957         * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
1958         * testsuite/Makefile.in: Regenerate.
1959         * testsuite/dwp_test.h: New source file.
1960         * testsuite/dwp_test_1.cc: New source file.
1961         * testsuite/dwp_test_1.s: New source file.
1962         * testsuite/dwp_test_1.sh: New source file.
1963         * testsuite/dwp_test_1b.cc: New source file.
1964         * testsuite/dwp_test_1b.s: New source file.
1965         * testsuite/dwp_test_2.cc: New source file.
1966         * testsuite/dwp_test_2.s: New source file.
1967         * testsuite/dwp_test_2.sh: New source file.
1968         * testsuite/dwp_test_main.cc: New source file.
1969         * testsuite/dwp_test_main.s: New source file.
1970
1971 2012-10-23  Cary Coutant  <ccoutant@google.com>
1972
1973         * dwp.h: New header file.
1974         * dwp.cc: New source file.
1975         * gold.h: Move shared declarations to system.h.
1976         * system.h: New header file.
1977         * Makefile.am: Add dwp.
1978         * Makefile.in: Regenerate.
1979
1980 2012-10-23  Cary Coutant  <ccoutant@google.com>
1981
1982         * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
1983         Dwarf_info_reader::read_from_pointer.
1984         (Dwarf_pubnames_table::read_header): Likewise.
1985         (Dwarf_pubnames_table::next_name): Likewise.
1986         (Dwarf_die::read_attributes): Likewise.
1987         (Dwarf_die::skip_attributes): Likewise.
1988         (Dwarf_info_reader::read_from_pointer): New function template.
1989         * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
1990         (Dwarf_pubnames_table): Likewise.
1991         (Dwarf_info_reader::read_from_pointer): New function template.
1992         * gdb-index.cc (Gdb_index_info_reader): Adjust call to
1993         Dwarf_pubnames_table ctor.
1994
1995 2012-10-23  Cary Coutant  <ccoutant@google.com>
1996
1997         * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
1998         abbrev_shndx.
1999         * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
2000         abbrev_shndx_.
2001         (Dwarf_info_reader::set_abbrev_shndx): New method.
2002         (Dwarf_info_reader::abbrev_shndx_): New data member.
2003
2004 2012-10-23  Cary Coutant  <ccoutant@google.com>
2005
2006         * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
2007         from object, not parameters.
2008         (Dwarf_info_reader::parse): Likewise.
2009         * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
2010         (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
2011         (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
2012         methods.
2013
2014 2012-10-23  Cary Coutant  <ccoutant@google.com>
2015
2016         * fileread.cc (Input_file::Input_file): New constructor.
2017         * fileread.h (class Input_file): Add new constructor.
2018
2019 2012-10-18  Alan Modra  <amodra@gmail.com>
2020
2021         PR gold/14727
2022         * object.cc (Relobj::is_section_name_included): Also match
2023         .sdata personality section.
2024
2025 2012-10-18  Alan Modra  <amodra@gmail.com>
2026
2027         * target-reloc.h (class Default_comdat_behavior): New, package up..
2028         (get_comdat_behaviour): ..this.
2029         (relocate_section): Add Relocate_comdat_behavior template arg,
2030         adjust code to suit.
2031         * arm.cc (Target_arm::relocate_section): Adjust to suit.
2032         (Target_arm::scan_reloc_section): Likewise.
2033         * i386.cc (Target_i386::relocate_section): Likewise.
2034         * sparc.cc (Target_sparc::relocate_section): Likewise.
2035         * tilegx.cc (Target_tilegx::relocate_section): Likewise.
2036         * x86_64.cc (Target_x86_64::relocate_section): Likewise.
2037         * powerpc.cc (class Relocate_comdat_behavior): New.
2038         (Target_powerpc::relocate_section): Don't zap opd relocs.  Supply
2039         gold::relocate_section with new template arg.
2040
2041 2012-10-18  Alan Modra  <amodra@gmail.com>
2042
2043         * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
2044         dynamic relocs for GOT_TPREL got entries, without symbol if
2045         resolving locally.
2046         (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
2047         (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
2048         (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
2049
2050 2012-10-17  Alan Modra  <amodra@gmail.com>
2051
2052         PR gold/14726
2053         * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
2054
2055 2012-10-16  Sriraman Tallam  <tmsriram@google.com>
2056
2057         * layout.cc (Layout::include_section): Keep sections marked
2058         SHF_EXCLUDE when doing relocatable links.
2059
2060 2012-10-16  Alan Modra  <amodra@gmail.com>
2061
2062         * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
2063         (Target_powerpc::do_finalize_sections): Call it.
2064         (Output_data_save_res): New class and supporting functions.
2065         (Target_powerpc::symval_for_branch): Only look up .opd entry for
2066         normal symbols defined in object files.
2067
2068 2012-10-12  Alan Modra  <amodra@gmail.com>
2069
2070         * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
2071         (struct Opd_ent): Make "discard" a bit field.  Add "gc_mark".
2072         (Target_powerpc::do_gc_mark_symbol): Delay marking function code
2073         section if scan_opd_relocs not yet called.
2074         (Target_powerpc::gc_process_relocs): Call process_gc_mark.
2075
2076 2012-10-12  Alan Modra  <amodra@gmail.com>
2077
2078         * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
2079         add_local_ifunc_entry): Revert last change.
2080         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
2081
2082 2012-10-05  Alan Modra  <amodra@gmail.com>
2083
2084         * powerpc.cc (Target_powerpc::do_plt_address_for_local,
2085         do_plt_address_for_global): New functions.
2086         (Output_data_got_powerpc::do_write): Don't segfault when linking
2087         statically.
2088         (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
2089         add_local_ifunc_entry): Return true on adding entry..
2090         (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
2091         glink->add_entry call.  Remove unused symtab param.  Adjust calls.
2092         (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
2093         (Target_powerpc::make_iplt_section): Remove symtab param.  Don't
2094         set up symbols here.
2095         (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
2096         syms here.  Do so even when no .iplt.  Don't segfault when linking
2097         statically.
2098         (Output_data_glink::add_entry, find_entry): Rearrange params.  Add
2099         new variants without reloc param.
2100         (Glink_sym_ent::Glink_sym_ent): Likewise.
2101         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
2102         reloc when refs will resolve to plt call stub.
2103         (Target_powerpc::Scan::local): Correct ifunc handling.  Allow
2104         R_PPC_PLTREL24 to resolve locally.
2105         (Target_powerpc::Scan::global): Correct ifunc handling.
2106         (Target_powerpc::Relocate::relocate): Correct local sym glink
2107         lookup.  Don't destroy "value" when we have a plt call stub,
2108         and when checking plt call validity.
2109         (Target_powerpc::do_dynsym_value): Simplify.
2110
2111 2012-10-05  Alan Modra  <amodra@gmail.com>
2112
2113         * i386.cc (Output_data_plt_i386::address_for_global,
2114         address_for_local): Add plt offset to returned value.  Adjust uses.
2115         * sparc.cc (Output_data_plt_sparc::address_for_global,
2116         address_for_local): Likewise.
2117         * tilegx.cc (Output_data_plt_tilegx::address_for_global,
2118         address_for_local): Likewise.
2119         * x86_64.cc (Output_data_plt_x86_64::address_for_global,
2120         address_for_local): Likewise.
2121         * target.h (Target::plt_address_for_global, plt_address_for_local):
2122         Update comment.
2123         * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
2124         (Output_data_got::Got_entry::write): Nor here.
2125         * output.h: Comment fix.
2126
2127 2012-10-02  Jiong Wang  <jiwang@tilera.com>
2128
2129         * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
2130         global_offset_table_ value for larget got.
2131         (Target_tilegx::Relocate::relocate): Handle adjusted got value.
2132
2133 2012-09-29  Alan Modra  <amodra@gmail.com>
2134
2135         * powerpc.cc (Target_powerpc::iplt_): New output section.
2136         (Target_powerpc::iplt_section, make_iplt_section,
2137         reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
2138         (Target_powerpc::make_plt_entry): Handle ifunc syms.
2139         Target_powerpc::plt_entry_count): Count iplt entries too.
2140         (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
2141         reloc section in constructor.  New params.
2142         (Target_powerpc::make_plt_section): Create reloc section here instead.
2143         (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
2144         functions.
2145         (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
2146         (Output_data_glink::add_entry, find_entry): New functions to
2147         deal with local syms.
2148         (Glink_sym_ent): Add support for local syms.
2149         (Output_data_glink::do_write): Handle ifunc plt entries.
2150         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
2151         (Target_powerpc::Scan::local, global): Handle ifunc syms.
2152         (Target_powerpc::Relocate::relocate): Likewise.
2153         (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
2154
2155 2012-09-25  Alan Modra  <amodra@gmail.com>
2156
2157         * object.h (Sized_relobj_file::adjust_local_symbol,
2158         do_adjust_local_symbol): New functions.
2159         * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
2160         * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
2161         (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
2162         and irregular opd entry spacing.
2163         (Powerpc_relobj::do_read_relocs): Add opd size checks.
2164         (Global_symbol_visitor_opd): New functor.
2165         (Target_powerpc::do_finalize_sections): Omit global symbols defined
2166         on deleted opd entries.
2167
2168 2012-09-15  Jiong Wang  <jiwang@tilera.com>
2169
2170         * tilegx.cc: New file.
2171         * Makefile.am (TARGETSOURCES): Add tilegx.cc
2172         (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
2173         * configure.tgt: Add entries for tilegx*.
2174         * configure.ac: Likewise.
2175         * Makefile.in: Rebuild.
2176         * configure: Likewise.
2177         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
2178         tilegx.
2179
2180 2012-09-13  Alan Modra  <amodra@gmail.com>
2181
2182         * target-reloc.h (scan_relocs): Call scan.local for relocs
2183         against symbols in discarded sections.  Pass is_discarded
2184         param.
2185         * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
2186         Add is_discarded param.
2187         * powerpc (Target_powerpc::Scan::local): Likewise.  Use
2188         is_discarded to flag opd entry as discarded.  Don't emit dyn
2189         relocs on such entries.
2190         (Target_powerpc::Scan::global): Similarly detect and handle
2191         such opd entries.
2192         (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
2193         opd_ent_.  Update all uses.
2194         (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
2195         (Target_powerpc::relocate_section): Zero out discarded opd
2196         entry relocs.
2197
2198 2012-09-12  Ian Lance Taylor  <iant@google.com>
2199
2200         PR gold/14570
2201         * output.cc: Rename Output_data_got template parameter from size
2202         to got_size for all functions.  Compile all variants of
2203         Output_data_got.
2204         (Output_data_got::Got_entry::write): Correct use of size for
2205         symbol value.  Use local_is_tls rather than casting to
2206         Sized_relobj_file.
2207         * object.h (class Object): Add local_is_tls and do_local_is_tls.
2208         (class Sized_relobj_file): Add do_local_is_tls.
2209         * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
2210
2211 2012-09-11  Alan Modra  <amodra@gmail.com>
2212
2213         PR gold/14566
2214         * layout.cc (Layout::set_segment_offsets): When using
2215         common-page-size alignment, ensure we are on a new max-page-size
2216         page.
2217         * output.cc (Output_segment::set_section_addresses): Use
2218         abi_pagesize, not common_pagesize for relro boundary.
2219         (Output_segment::set_offset): Likewise.
2220
2221 2012-09-11  Alan Modra  <amodra@gmail.com>
2222
2223         * output.h (Output_data_got::add_global_tls, add_local_tls,
2224         add_local_tls_pair): New functions.
2225         (Output_data_got::add_local_pair_with_rel): Remove second
2226         reloc param.  Expand comment.
2227         (Output_data_got::Got_entry): Rename use_plt_offset_ to
2228         use_plt_or_tls_offset_, similarly for constructor param.
2229         (Output_data_got::Got_entry::write): Add got_index param.
2230         * output.cc (Output_data_got::add_global_tls, add_local_tls,
2231         add_local_tls_pair): New functions.
2232         (Output_data_got::Got_entry::write): Handle tls symbols
2233         with use_plt_or_tls_offset_ set specially.
2234         (Output_data_got::add_local_pair_with_rel): Only one reloc.
2235         (Output_data_got::do_write): Replace iterator with index, pass
2236         index to entry write function.
2237         * target.h (Target::tls_offset_for_local, tls_offset_for_global,
2238         do_tls_offset_for_local, do_tls_offset_for_global): New functions.
2239         * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
2240         call.
2241         * i386.cc (Target_i386::Scan::local): Likewise.
2242         * sparc.cc (Target_sparc::Scan::local): Likewise.
2243         * x86_64.cc (Target_x86_64::Scan::local): Likewise.
2244         * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
2245         do_tls_offset_for_global): New functions.
2246         (Target_powerpc::Scan::local): Correct TLS relocations and got
2247         entry values.
2248         (Target_powerpc::Scan::global): Don't emit unnecessary
2249         dynamic relocations on TLS GOT entries.
2250
2251 2012-09-10  Matthias Klose  <doko@ubuntu.com>
2252
2253         * config.in: Disable sanity check for kfreebsd.
2254
2255 2012-09-10  Sterling Augustine  <saugustine@google.com>
2256
2257         * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
2258         (Gdb_index::pubtypes_read): New parameter.
2259         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
2260         to calls.
2261         * gdb-index.h (Gdb_index): New fields pubnames_object_ and
2262         pubtypes_object_.
2263
2264 2012-09-09  Alan Modra  <amodra@gmail.com>
2265
2266         * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
2267         (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
2268         * gc.h (gc_process_relocs): Call target gc_add_reference.
2269         * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
2270         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
2271         (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
2272         unnecessary cast.
2273         * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
2274         to cater for when we don't need code offset.  Update use.
2275         (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
2276         (Powerpc_relobj::access_from_map, add_reference, opd_valid,
2277         set_opd_valid): New functions.
2278         (Target_powerpc::do_gc_add_reference): New function.
2279         (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
2280         stashed refs.
2281         (Target_powerpc::do_gc_mark_symbol): New function.
2282
2283 2012-09-06  Cary Coutant  <ccoutant@google.com>
2284
2285         * dwarf_reader.cc (Dwarf_die::read_attributes): Add
2286         DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
2287         (Dwarf_die::skip_attributes): Likewise.
2288         * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
2289         * testsuite/gdb_index_test.cc (inline_func_1): New function.
2290         (main): Call it.
2291         * testsuite/gdb_index_test_comm.sh: Check index for inline function.
2292
2293 2012-09-05  H.J. Lu  <hongjiu.lu@intel.com>
2294
2295         * testsuite/script_test_3.t: Add .got.plt output section
2296         statement.
2297         * testsuite/script_test_4.t: Likewise.
2298
2299 2012-09-05  Alan Modra  <amodra@gmail.com>
2300
2301         * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
2302         update all uses and lose "enum" when using type.
2303
2304 2012-09-05  Alan Modra  <amodra@gmail.com>
2305
2306         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
2307         * configure: Regenerate.
2308         * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
2309         (plugin_final_layout.stdout): Likewise.
2310         (memory_test): Set page sizes to 0x1000.
2311         * testsuite/Makefile.in: Regenerate.
2312         * testsuite/discard_locals_test.sh: Add FIXME comment.
2313         * testsuite/justsyms_exec.c: Disable function test for powerpc64.
2314         * testsuite/pr14265.t: Add .got output section statement.
2315         * testsuite/script_test_2.t: Likewise.
2316         * testsuite/script_test_3.t: Likewise.
2317         * testsuite/script_test_4.t: Likewise.
2318         * testsuite/script_test_5.t: Likewise.
2319         * testsuite/script_test_6.t: Likewise.
2320         * testsuite/script_test_7.t: Likewise.
2321         * testsuite/script_test_9.t: Likewise.
2322
2323 2012-09-05  Alan Modra  <amodra@gmail.com>
2324
2325         * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
2326         (Powerpc_relocate_functions::Status): New typedef.
2327         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
2328         (Target_powerpc::Scan::local): Handle REL64.
2329         (Target_powerpc::Scan::global): Likewise, and dynamic relocs
2330         for REL32 and REL64.
2331         (Target_powerpc::symval_for_branch): New function, extracted from..
2332         (Target_powerpc::Relocate::relocate): ..here.  Correct plt call
2333         checks.  Report overflow errors.
2334
2335 2012-09-05  Alan Modra  <amodra@gmail.com>
2336
2337         * object.h (Sized_relobj_file::emit_relocs): Delete.
2338         (Sized_relobj_file::emit_relocs_reltype): Delete.
2339         * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
2340         relocate_relocs for --emit-relocs.
2341         (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
2342         * output.h: Update comment.
2343         (Output_segment::first_section): New function.
2344         (Output_segment::first_section_load_address): Use first_section.
2345         * output.cc (Output_segment::first_section): New function extracted..
2346         (Output_segment::first_section_load_address): ..from here.  Delete.
2347         * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
2348         * target.h (Sized_target::relocate_for_relocatable): Likewise.
2349         * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
2350         adjust call to target.h function.
2351         * i386.cc (Target_i386): Likewise.
2352         * sparc.cc (Target_sparc): Likewise.
2353         * x86_64.cc (Target_x86_64): Likewise.
2354         * powerpc.cc (Target_powerpc): Likewise.
2355         (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS.  Ensure
2356         first tls section has section symbol for optimised local dynamic
2357         output relocs.
2358         (Target_powerpc::Relocate::relocate): Correct local dynamic value.
2359         (Target_powerpc::relocate_relocs): Adjust relocs emitted for
2360         optimised tls code.
2361         * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
2362         Rename to relocate_relocs.  Update error message.
2363
2364 2012-09-04  Andreas Schwab  <schwab@linux-m68k.org>
2365
2366         * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
2367         --just-symbols.
2368
2369 2012-08-31  Alan Modra  <amodra@gmail.com>
2370
2371         * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
2372         (Powerpc_relobj::toc_base_offset): New stub function.
2373         (Target_powerpc): Add tp_offset, dtp_offset.  Rename
2374         got_mod_index_offset to tlsld_got_offset.  Update all refs.
2375         (Target_powerpc::Relocate::enum skip_tls): New.
2376         (Target_powerpc::call_tls_get_addr_): New var.
2377         (Target_powerpc::is_branch_reloc): Move to file scope.
2378         (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
2379         (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
2380         New functions.
2381         (Target_powerpc::enum Got_type): Delete old values, add new ones.
2382         (powerpc_info): Correct common_pagesize for ppc64.
2383         (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
2384         (Powerpc_relocate_functions): Add overflow check enums and functions.
2385         Add non-shift version of rela, rela_ua.  Delete all rel public
2386         functions.  Delete addr16_lo.  Add addr64, addr64_u, addr32,
2387         addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
2388         addr16_ha3, addr14 functions.
2389         (Output_data_got_powerpc::add_constant_pair): New function.
2390         (Output_data_got_powerpc::got_base_offset): Likewise.
2391         (Output_data_got_powerpc::do_write): Correct 64-bit got header.
2392         (instruction constants): Sort, add some more.
2393         (Output_data_glink::do_write): Add and use Address typedef.  Use
2394         object->toc_base_offset() stub for 64-bit.
2395         (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
2396         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
2397         (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
2398         for R_PPC64_TOC.  Handle more relocs.  Generate got entries for TLS.
2399         Always treat .opd relocs as against locally defined symbol.
2400         Correct condition for RELATIVE relocs.
2401         (Target_powerpc::do_finalize_sections): Test for NULL sections.
2402         (Target_powerpc::Relocate::relocate): Use plt call stub as value
2403         for 32-bit syms with a plt entry.  Correct ppc64 toc base
2404         calculations.  Handle TLS relocs, and more.  Add overflow
2405         checking and adjust for Powerpc_relocate_functions changes.
2406         (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
2407         Reinstate --emit-relocs code with FIXME.
2408
2409 2012-08-30  Alan Modra  <amodra@gmail.com>
2410
2411         * layout.cc (Layout::set_segment_offsets): Set p_align to
2412         abi_pagesize, not common_pagesize.
2413         (Layout::relaxation_loop_body): Similarly use abi_pagesize
2414         to determine whether file header can go in segment.
2415
2416 2012-08-30  Alan Modra  <amodra@gmail.com>
2417
2418         * output.h (Output_reloc::Output_reloc <output section>): Add
2419         is_relative param.  Adjust calls.
2420         (Output_reloc::add_output_section_relative): New functions.
2421         * output.cc (Output_reloc::Output_reloc <output section>): Handle
2422         is_relative.
2423         (Output_reloc::symbol_value): Handle SECTION_CODE.
2424
2425 2012-08-24  Sriraman Tallam  <tmsriram@google.com>
2426
2427         * gold.cc (queue_middle_tasks): Call layout again when unique
2428         segments for sections is desired.
2429         * layout.cc (Layout::Layout): Initialize new members.
2430         (Layout::get_output_section_flags): New function.
2431         (Layout::choose_output_section): Call get_output_section_flags.
2432         (Layout::layout): Make output section for mapping to a unique segment.
2433         (Layout::insert_section_segment_map): New function.
2434         (Layout::attach_allocated_section_to_segment): Make unique segment for
2435         output sections marked so.
2436         (Layout::segment_precedes): Check for unique segments when sorting.
2437         * layout.h (Layout::Unique_segment_info): New struct.
2438         (Layout::Section_segment_map): New typedef.
2439         (Layout::insert_section_segment_map): New function.
2440         (Layout::get_output_section_flags): New function.
2441         (Layout::is_unique_segment_for_sections_specified): New function.
2442         (Layout::set_unique_segment_for_sections_specified): New function.
2443         (Layout::unique_segment_for_sections_specified_): New member.
2444         (Layout::section_segment_map_): New member.
2445         * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
2446         Rename is_gc_pass_one to is_pass_one.
2447         Rename is_gc_pass_two to is_pass_two.
2448         Rename is_gc_or_icf to is_two_pass.
2449         Check for which pass based on whether symbols data is present.
2450         Make it two pass when unique segments for sections is desired.
2451         * output.cc (Output_section::Output_section): Initialize new
2452         members.
2453         * output.h (Output_section::is_unique_segment): New function.
2454         (Output_section::set_is_unique_segment): New function.
2455         (Output_section::is_unique_segment_): New member.
2456         (Output_section::extra_segment_flags): New function.
2457         (Output_section::set_extra_segment_flags): New function.
2458         (Output_section::extra_segment_flags_): New member.
2459         (Output_section::segment_alignment): New function.
2460         (Output_section::set_segment_alignment): New function.
2461         (Output_section::segment_alignment_): New member.
2462         (Output_segment::Output_segment): Initialize is_unique_segment_.
2463         (Output_segment::is_unique_segment): New function.
2464         (Output_segment::set_is_unique_segment): New function.
2465         (Output_segment::is_unique_segment_): New member.
2466         * plugin.cc (allow_unique_segment_for_sections): New function.
2467         (unique_segment_for_sections): New function.
2468         (Plugin::load): Add new functions to transfer vector.
2469         * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
2470         * Makefile.in: Regenerate.
2471         * testsuite/plugin_final_layout.sh: Check if unique segment
2472         functionality works.
2473         * testsuite/plugin_section_order.c (onload): Check if new interfaces
2474         are available.
2475         (allow_unique_segment_for_sections): New global.
2476         (unique_segment_for_sections): New global.
2477         (claim_file_hook): Call allow_unique_segment_for_sections.
2478         (all_symbols_read_hook): Call unique_segment_for_sections.
2479
2480 2012-08-22  Cary Coutant  <ccoutant@google.com>
2481
2482         * layout.cc (Layout::include_section): Don't assert on GROUP
2483         sections with --emit-relocs.
2484
2485 2012-08-21  Cary Coutant  <ccoutant@google.com>
2486
2487         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
2488         if --export-dynamic-symbol names an undef symbol.
2489
2490 2012-08-18  Alan Modra  <amodra@gmail.com>
2491
2492         * powerpc.cc: Formatting and white space.
2493         (Powerpc_relobj): Rename got2_section_ to special_.
2494         Add opd_ent_shndx_ and opd_ent_off_ vectors.
2495         (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
2496         scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
2497         (Target_powerpc): Add Address typedef and invalid_address.  Use
2498         throughout.
2499         (Target_powerpc::is_branch_reloc): New function.
2500         (Powerpc_relocate_functions): Add Address typedef, use throughout.
2501         (Powerpc_relocate_functions:rela, rela_ua): Correct type used
2502         for dst_mask, value and addend.
2503         (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
2504         (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
2505         (Output_data_glink::do_write): Correct toc base.  Don't try to use
2506         uint16_t for 24-bit offset.  Use get_output_section_offset and
2507         check return.
2508         (Target_powerpc::Scan::local): Handle more relocs.
2509         (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
2510         (Target_powerpc::Relocate::relocate): Correct toc base calculation.
2511         Plug in toc restoring insn after plt calls.  Translate branches
2512         to function descriptor symbols to corresponding entry point.
2513         (Target_powerpc::relocate_for_relocatable): Check return from
2514         get_output_section_offset.
2515         * symtab.h: Comment typo.
2516
2517 2012-08-14  Ian Lance Taylor  <iant@google.com>
2518
2519         * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
2520         unsupported_relocal_local to call unsupported_reloc_global.
2521
2522 2012-08-14  Nick Clifton  <nickc@redhat.com>
2523
2524         PR ld/14265
2525         * script-sections.cc (Sections_element::output_section_name): Add
2526         keep return parameter.
2527         (Output_section_element::match_name): Add keep return parameter.
2528         Return the value of the keep_ member.
2529         * script-sections.h (class Output_section): Update
2530         output_section_name prototype.
2531         * layout.cc (Layout::keep_input_section): New public member
2532         function.
2533         (Layout::choose_output_section): Pass keep parameter to
2534         output_section_name.
2535         * layout.h (class Layout): Add keep_input_section.
2536         * object.cc (Sized_relobj_file::do_layout): Check for kept input
2537         sections.
2538         * testsuite/Makefile.am: Add a test.
2539         * testsuite/Makefile.in: Regenerate.
2540         * testsuite/pr14265.c: Source file for the test.
2541         * testsuite/pr14265.t: Linker script for the test.
2542         * testsuite/pr14265.sh: Shell script for the test.
2543
2544 2012-08-14  Alan Modra  <amodra@gmail.com>
2545
2546         * target.h (Target::output_section_name): New function.
2547         (Target::do_output_section_name): New function.
2548         * layout.cc (Layout::choose_output_section): Call the above.
2549         * powerpc.cc (Target_powerpc::do_output_section_name): New function.
2550
2551 2012-08-14  Alan Modra  <amodra@gmail.com>
2552
2553         * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
2554         (Output_data_got_powerpc::do_write): Don't rely on base class lookup
2555         for replace_constant call.
2556         (Output_data_plt_powerpc::do_print_to_mapfile): New function.
2557         (Output_data_glink::do_print_to_mapfile): New function.
2558         (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
2559         (Target_powerpc::Relocate::relocate): Likewise.
2560
2561 2012-08-14  Alan Modra  <amodra@gmail.com>
2562
2563         * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
2564         (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
2565         (Output_data_glink::add_entry,find_entry): Remove shndx param.
2566         (class Glink_sym_ent): Rename from struct Glink_sym_ent.  Remove
2567         all references to shndx_.  Handle special case for R_PPC_PLTREL24
2568         here.
2569         (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
2570         (Output_data_glink::do_write): Retrieve got2_shdnx from object.
2571         (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
2572         here.
2573         (Target_powerpc::Scan::global): Nor on make_plt_entry call.
2574         (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
2575
2576 2012-08-12  Alan Modra  <amodra@gmail.com>
2577
2578         * powerpc.cc: Whitespace fixes.  Wrap overly long lines.
2579         (glink insn constants): Use uint32_t.
2580         (Output_data_glink::add_entry): Use insert, not [] operator.
2581
2582 2012-08-11  Alan Modra  <amodra@gmail.com>
2583
2584         * object.h (Sized_relobj_file::find_shdr): New function.
2585         (Sized_relobj_file::find_special_sections): New function.
2586         * object.cc (Sized_relobj_file::find_shdr): New function.
2587         (Sized_relobj_file::find_eh_frame): Use find_shdr.
2588         (Sized_relobj_file::find_special_sections): New function, split out..
2589         (Sized_relobj_file::do_read_symbols): ..from here.
2590         * output.h (Output_data_got::replace_constant): New function.
2591         (Output_data_got::num_entries): New function.
2592         (Output_data_got::last_got_offset,set_got_size): Use num_entries.
2593         (Output_data_got::got_offset): Protected rather than private.
2594         (Output_data_got::replace_got_entry): New function.
2595         * output.cc (Output_data_got::replace_got_entry): New function.
2596         * powerpc.cc (class Powerpc_relobj): New.
2597         (class Powerpc_relocate_functions): Delete all psymval variants or
2598         convert to value,addend type.  Delete pcrela, pcrela_unaligned.
2599         Implement _ha functions using corresponding _hi function.
2600         (Powerpc_relobj::find_special_sections): New function.
2601         (Target_powerpc::do_make_elf_object): New function.
2602         (class Output_data_got_powerpc): New.
2603         (class Output_data_glink): New.
2604         (class Powerpc_scan_relocatable_reloc): New.
2605         Many more changes througout file.
2606
2607 2012-08-09  Nick Clifton  <nickc@redhat.com>
2608
2609         * po/vi.po: Updated Vietnamese translation.
2610
2611 2012-08-07  Ian Lance Taylor  <iant@google.com>
2612
2613         * layout.cc (Layout::add_target_dynamic_tags): If
2614         dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
2615         plt_rel.
2616
2617 2012-07-30  Nick Clifton  <nickc@redhat.com>
2618
2619         * po/gold.pot: Updated template.
2620         * po/es.po: Updated Spanish translation.
2621
2622 2012-07-18  Cary Coutant  <ccoutant@google.com>
2623
2624         PR gold/14344
2625         * configure.ac: Add check for -gpubnames support.
2626         * configure: Regenerate.
2627         * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
2628         support; force -gno-pubnames.
2629         (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
2630         support.
2631         (gdb_index_test_4): New test.
2632         * testsuite/Makefile.in: Regenerate.
2633         * testsuite/gdb_index_test_1.sh: Refactor code into common file.
2634         * testsuite/gdb_index_test_2.sh: Likewise.
2635         * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
2636         * testsuite/gdb_index_test_4.sh: New script.
2637         * testsuite/gdb_index_test_comm.sh: New script with common code;
2638         don't look for space after colon.
2639
2640 2012-07-16  Sriraman Tallam  <tmsriram@google.com>
2641
2642         * gold.cc (queue_middle_tasks): Update function order only after
2643         deferred objects due to plugins are processed.
2644
2645 2012-07-11  Ian Lance Taylor  <iant@google.com>
2646
2647         * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
2648         (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
2649         (Target_arm::scan_reloc_for_stub): Likewise.
2650         * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
2651         * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
2652         * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
2653         * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
2654         * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
2655
2656 2012-07-10  Dodji Seketeli  <dodji@redhat.com>
2657             Ian Lance Taylor  <iant@google.com>
2658
2659         PR gold/14309
2660         * configure.ac: Test whether std::tr1::hash<off_t> works.
2661         * gold.h: Add a specialization for std::tr1::hash<off_t> if
2662         needed.
2663         * output.h (class Output_fill): Add virtual destructor.
2664         * configure, config.in: Rebuild.
2665
2666 2012-06-22  Roland McGrath  <mcgrathr@google.com>
2667
2668         * layout.cc (finalize): Define __ehdr_start symbol if applicable.
2669
2670 2012-06-12  Rafael Ávila de Espíndola <respindola@mozilla.com>
2671
2672         * plugin.cc (Plugin::load): Handle position independent executables.
2673
2674 2012-06-06  Cary Coutant  <ccoutant@google.com>
2675
2676         * layout.cc (gdb_sections): Remove ".debug_" prefixes,
2677         add .debug_macro.
2678         (lines_only_debug_sections): Likewise.
2679         (gdb_fast_lookup_sections): New static array.
2680         (is_gdb_debug_section): Rename formal parameter.
2681         (is_lines_only_debug_section): Likewise.
2682         (is_gdb_fast_lookup_section): New function.
2683         (Layout::include_section): Check for ".zdebug_" prefix; pass
2684         section name suffix to is_gdb_debug_section, et al.; check for
2685         fast-lookup sections when building .gdb_index.
2686         * options.h (--strip-debug-gdb): Update GDB version number.
2687
2688 2012-06-06  Cary Coutant  <ccoutant@google.com>
2689
2690         * configure.ac: Add check for fallocate.
2691         * configure: Regenerate.
2692         * config.in: Regenerate.
2693
2694         * options.h (class General_options): Add --mmap-output-file and
2695         --posix-fallocate options.
2696         * output.cc: (posix_fallocate): Remove; replace with...
2697         (gold_fallocate): New function.
2698         (Output_file::map_no_anonymous): Call gold_fallocate.
2699         (Output_file::map): Check --mmap-output-file option.
2700
2701 2012-06-05  Jing Yu  <jingyu@google.com>
2702
2703         * gold.h (textdomain): Add do {} to empty while(0).
2704         (bindtextdomain): Likewise.
2705
2706 2012-06-04  Cary Coutant  <ccoutant@google.com>
2707
2708         * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
2709         has_dynsym_index.
2710
2711 2012-05-25  Sriraman Tallam  <tmsriram@google.com>
2712
2713         * symtab.cc (Symbol_table::define_special_symbol):
2714         Initialize *poldsym to prevent uninitialized variable errors.
2715
2716 2012-05-23  Cary Coutant  <ccoutant@google.com>
2717
2718         * layout.cc (Layout::section_name_mapping): Add rules to handle
2719         exact match on .data.rel.ro.local or .data.rel.ro.
2720         (Layout::output_section_name): Check for exact matches.
2721
2722 2012-05-23  Cary Coutant  <ccoutant@google.com>
2723
2724         * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
2725         more carefully.
2726
2727 2012-05-22  Cary Coutant  <ccoutant@google.com>
2728
2729         * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
2730         object before exporting symbol.
2731
2732 2012-05-21  H.J. Lu  <hongjiu.lu@intel.com>
2733
2734         * testsuite/tls_test.cc: Include "config.h" first.
2735         * testsuite/tls_test_c.c: Likewise.
2736
2737 2012-05-17  Daniel Richard G.  <skunk@iskunk.org>
2738             Nick Clifton  <nickc@redhat.com>
2739
2740         PR 14072
2741         * configure.in: Add check that sysdep.h has been included before
2742         any system header files.
2743         * configure: Regenerate.
2744         * config.in: Regenerate.
2745
2746 2012-05-14  Cary Coutant  <ccoutant@google.com>
2747
2748         * layout.cc (Layout::make_output_section): Mark .tdata section
2749         as RELRO.
2750         * testsuite/relro_test.cc: Add a TLS variable.
2751
2752 2012-05-10  H.J. Lu  <hongjiu.lu@intel.com>
2753
2754         PR gold/14091
2755         * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
2756         R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
2757         R_X86_64_64.
2758
2759 2012-05-08  Cary Coutant  <ccoutant@google.com>
2760
2761         * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
2762         (lines_only_debug_sections): Likewise.
2763
2764 2012-05-02  Roland McGrath  <mcgrathr@google.com>
2765
2766         * nacl.cc: New file.
2767         * nacl.h: New file.
2768         * Makefile.am (CCFILES, HFILES): Add them.
2769         * Makefile.in: Regenerate.
2770         * i386.cc (Output_data_plt_i386_nacl): New class.
2771         (Output_data_plt_i386_nacl_exec): New class.
2772         (Output_data_plt_i386_nacl_dyn): New class.
2773         (Target_i386_nacl): New class.
2774         (Target_selector_i386_nacl): New class.
2775         (target_selector_i386): Use it instead of Target_selector_i386.
2776         * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
2777         (Target_x86_64_nacl): New class.
2778         (Target_selector_x86_64_nacl): New class.
2779         (target_selector_x86_64, target_selector_x32): Use it instead of
2780         Target_selector_x86_64.
2781         * arm.cc (Output_data_plt_arm_nacl): New class.
2782         (Target_arm_nacl): New class.
2783         (Target_selector_arm_nacl): New class.
2784         (target_selector_arm, target_selector_armbe): Use it instead of
2785         Target_selector_arm.
2786
2787         * target-select.cc (select_target): Take new Input_file* and off_t
2788         arguments, pass them on to recognize method of selector.
2789         * object.cc (make_elf_sized_object): Update caller.
2790         * parameters.cc (parameters_force_valid_target): Likewise.
2791         * incremental.cc (make_sized_incremental_binary): Likewise.
2792         * target-select.h: Update decl.
2793         (Target_selector::recognize): Take new Input_file* argument,
2794         pass it on to do_recognize.
2795         (Target_selector::do_recognize): Take new Input_file* argument.
2796         * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
2797         * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
2798         * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
2799         * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
2800
2801         * target.h (Target::Target_info): New members isolate_execinstr
2802         and rosegment_gap.
2803         (Target::isolate_execinstr, Target::rosegment_gap): New methods.
2804         * arm.cc (Target_arm::arm_info): Update initializer.
2805         * i386.cc (Target_i386::i386_info): Likewise.
2806         * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
2807         * sparc.cc (Target_sparc::sparc_info): Likewise.
2808         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
2809         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
2810         * layout.cc (Layout::attach_allocated_section_to_segment):
2811         Take new const Target* argument.  If target->isolate_execinstr(), act
2812         like --rosegment.
2813         (Layout::find_first_load_seg): Take new const Target* argument;
2814         if target->isolate_execinstr(), reject PF_X segments.
2815         (Layout::relaxation_loop_body): Update caller.
2816         (Layout::set_segment_offsets): If target->isolate_execinstr(),
2817         reset file offset to zero when we hit LOAD_SEG, and then do a second
2818         loop over the segments before LOAD_SEG to reassign offsets after
2819         addresses have been determined.  Handle target->rosegment_gap().
2820         (Layout::attach_section_to_segment): Take new const Target* argument;
2821         pass it to attach_allocated_section_to_segment.
2822         (Layout::make_output_section): Update caller.
2823         (Layout::attach_sections_to_segments): Take new const Target* argument;
2824         pass it to attach_section_to_segment.
2825         * gold.cc (queue_middle_tasks): Update caller.
2826         * layout.h (Layout): Update method decls with new arguments.
2827
2828         * arm.cc (Target_arm::Target_arm): Take optional argument for the
2829         Target_info pointer to use.
2830         (Target_arm::do_make_data_plt): New virtual method.
2831         (Target_arm::make_data_plt): New method that calls it.
2832         (Target_arm::make_plt_entry): Use it.
2833         (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
2834         for the section alignment.
2835         (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
2836         method.
2837         (Output_data_plt_arm::first_plt_entry_offset): Call it.
2838         (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
2839         method.
2840         (Output_data_plt_arm::get_plt_entry_size): Call it.
2841         (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
2842         (Output_data_plt_arm::fill_plt_entry): New method that calls it.
2843         (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
2844         method.
2845         (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
2846         (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
2847         method instead of sizeof(plt_entry).
2848         (Output_data_plt_arm::add_entry): Likewise.
2849         Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
2850         (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
2851         than static method.
2852         (Target_arm::plt_entry_size): Likewise.
2853         (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
2854         Move to ...
2855         (Output_data_plt_arm_standard): ... here, new class.
2856         (Output_data_plt_arm::do_write): Move guts of PLT filling to...
2857         (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
2858         (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
2859
2860         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
2861         Take additional argument for the PLT entry size.
2862         (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
2863         Use get_plt_entry_size method rather than plt_entry_size variable.
2864         (Output_data_plt_x86_64::reserve_slot): Likewise.
2865         (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
2866         (Output_data_plt_x86_64::add_entry): Likewise.
2867         (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
2868         (Output_data_plt_x86_64::address_for_global): Likewise.
2869         (Output_data_plt_x86_64::address_for_local): Likewise.
2870         (Output_data_plt_x86_64::set_final_data_size): Likewise.
2871         (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
2872         Make method non-static.
2873         (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
2874         method.
2875         (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
2876         (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
2877         (Output_data_plt_x86_64::add_eh_frame): New method to call it.
2878         (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
2879         virtual method.
2880         (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
2881         (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
2882         virtual method.
2883         (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
2884         (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
2885         virtual method.
2886         (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
2887         (Output_data_plt_x86_64::plt_entry_size)
2888         (Output_data_plt_x86_64::first_plt_entry)
2889         (Output_data_plt_x86_64::plt_entry)
2890         (Output_data_plt_x86_64::tlsdesc_plt_entry)
2891         (Output_data_plt_x86_64::plt_eh_frame_fde_size)
2892         (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
2893         (Output_data_plt_x86_64_standard): ... here, new class.
2894         (Target_x86_64::Target_x86_64): Take optional argument for the
2895         Target_info pointer to use.
2896         (Target_x86_64::do_make_data_plt): New virtual method.
2897         (Target_x86_64::make_data_plt): New method to call it.
2898         (Target_x86_64::init_got_plt_for_update): Use that.
2899         Call this->plt_->add_eh_frame method here.
2900         (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
2901         (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
2902         rather than static method.
2903         (Target_x86_64::plt_entry_size): Likewise.
2904         (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
2905         rather than plt_entry_size variable.  Move guts of PLT filling to...
2906         (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
2907         (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
2908         (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
2909
2910         * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
2911         additional argument for the section alignment.
2912         Don't do add_eh_frame_for_plt here.
2913         (Output_data_plt_i386::first_plt_entry_offset): Make the method
2914         non-static.  Use get_plt_entry_size method rather than plt_entry_size
2915         variable.
2916         (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
2917         method.
2918         (Output_data_plt_i386::get_plt_entry_size): Call it.
2919         (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
2920         (Output_data_plt_i386::add_eh_frame): New method to call it.
2921         (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
2922         method.
2923         (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
2924         (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
2925         method.
2926         (Output_data_plt_i386::fill_plt_entry): New method to call it.
2927         (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
2928         method instead of plt_entry_size.
2929         (Output_data_plt_i386::plt_entry_size)
2930         (Output_data_plt_i386::plt_eh_frame_fde_size)
2931         (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
2932         (Output_data_plt_i386_standard): ... here, new class.
2933         (Output_data_plt_i386_exec): New class.
2934         (Output_data_plt_i386::exec_first_plt_entry): Move to ...
2935         (Output_data_plt_i386_exec::first_plt_entry): ... here.
2936         (Output_data_plt_i386::exec_plt_entry): Move to ...
2937         (Output_data_plt_i386_exec::plt_entry): ... here.
2938         (Output_data_plt_i386_dyn): New class.
2939         (Output_data_plt_i386::first_plt_entry): Move to ...
2940         (Output_data_plt_i386_dyn::first_plt_entry): ... here.
2941         (Output_data_plt_i386::dyn_plt_entry): Move to ...
2942         (Output_data_plt_i386_dyn::plt_entry): ... here.
2943         (Target_i386::Target_i386): Take optional argument for the Target_info
2944         pointer to use.
2945         (Target_i386::do_make_data_plt): New virtual method.
2946         (Target_i386::make_data_plt): New method to call it.
2947         (Target_i386::make_plt_section): Use that.
2948         Call this->plt_->add_eh_frame method here.
2949         (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
2950         rather than plt_entry_size variable.
2951         (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
2952         (Output_data_plt_i386::address_for_local): Likewise.
2953         (Output_data_plt_i386::do_write): Likewise.
2954         Move guts of PLT filling to...
2955         (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
2956         (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
2957         (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
2958         (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
2959
2960 2012-05-01  Cary Coutant  <ccoutant@google.com>
2961
2962         * dwarf_reader.cc (Dwarf_die::read_attributes)
2963         (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
2964         (Dwarf_die::uint_attribute): Remove DW_FORM_null.
2965         * reduced_debug_output.cc
2966         (Output_reduced_debug_info_section::get_die_end): Remove
2967         DW_FORM_GNU_ref_index.  Add default case.
2968
2969 2012-04-26  Mark Wielaard  <mjw@redhat.com>
2970
2971         * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
2972         * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
2973         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
2974         DW_AT_high_pc as offset from DW_AT_low_pc.
2975
2976         * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
2977         * testsuite/Makefile.in: Regenerate.
2978         * testsuite/gdb_index_test_3.c: New test source file.
2979         * testsuite/gdb_index_test_3.sh: New test source file.
2980
2981 2012-04-25  Ian Lance Taylor  <iant@google.com>
2982
2983         * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
2984         pointer.
2985         (Stub_addend_reader::operator()): Declare Arm_relocate_functions
2986         as a class, not a struct.
2987         (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
2988         (Target_arm::apply_cortex_a8_workaround): Likewise.
2989         * gc.h: Declare Reloc_types as a struct, not a class.
2990         * object.h: Declare Symbols_data as a struct.
2991         * reloc.h: Declare Read_relocs_data as a struct.
2992         * target.h: Declare Relocate_info as a struct.
2993
2994 2012-04-24  David S. Miller  <davem@davemloft.net>
2995
2996         * sparc.cc (Target_sparc::Relocate::relax_call): New function.
2997         (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
2998         and R_SPARC_WPLT30.
2999
3000 2012-04-24  Cary Coutant  <ccoutant@google.com>
3001
3002         * incremental-dump.cc (find_input_containing_global): Replace
3003         magic number with symbolic constant.
3004         (dump_incremental_inputs): Update version number.
3005         * incremental.cc (Output_section_incremental_inputs): Update version
3006         number; import symbolic constants from Incremental_inputs_reader.
3007         (Incremental_inputs::create_data_sections): Align relocations
3008         section correctly for 64-bit targets.
3009         (Output_section_incremental_inputs::set_final_data_size): Use symbolic
3010         constants; add padding.
3011         (Output_section_incremental_inputs::write_header): Add assert for
3012         header_size.
3013         (Output_section_incremental_inputs::write_input_files): Add assert
3014         for input_entry_size.
3015         (Output_section_incremental_inputs::write_info_blocks): Add padding;
3016         add assert for object_info_size, input_section_entry_size,
3017         global_sym_entry_size.
3018         * incremental.h (Incremental_inputs_reader): Add symbolic constants
3019         for data structure sizes; use them.
3020         (Incremental_input_entry_reader): Import symbolic constants from
3021         Incremental_inputs_reader; use them.
3022
3023 2012-04-23  David S. Miller  <davem@davemloft.net>
3024
3025         * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
3026         and elf_flags_set_.
3027         (Target_sparc::Target_sparc): Initialize new fields.
3028         (Target_sparc::do_make_elf_object): New function.
3029         (Target_sparc::do_adjust_elf_header): New function.
3030
3031 2012-04-23  Cary Coutant  <ccoutant@google.com>
3032
3033         * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
3034         CU range table of gdb index.
3035
3036 2012-04-20  David S. Miller  <davem@davemloft.net>
3037
3038         * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
3039         instead of false.
3040
3041 2012-04-16  David S. Miller  <davem@davemloft.net>
3042
3043         * sparc.cc (Target_sparc::got_address): New function.
3044         (Sparc_relocate_functions::gdop_hix22): New function.
3045         (Sparc_relocate_functions::gdop_lox10): New function.
3046         (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
3047         relocs.
3048         (Target_sparc::Scan::local): Likewise if the global symbol is not
3049         preemptible and is not IFUNC.
3050         (Target_sparc::Relocate::relocate): Perform GOTDATA code
3051         transformations for local and non-preemptible non-IFUNC global
3052         symbols.
3053
3054         * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
3055         writing out 64-bit part of ranges.
3056
3057         * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
3058         -fpic and -fpie respectively.
3059         * Makefile.in: Regenerate.
3060
3061         * sparc.cc (class Target_sparc): Add rela_ifunc_.
3062         (Target_sparc::Target_sparc): Initialize new field.
3063         (Target_sparc::do_plt_section_for_global): New function.
3064         (Target_sparc::do_plt_section_for_local): New function.
3065         (Target_sparc::reloc_needs_plt_for_ifunc): New function.
3066         (Target_sparc::make_plt_section): New function, broken out of
3067         make_plt_entry.  Use ORDER_NON_RELRO_FIRST for ".plt".
3068         (Target_sparc::make_plt_entry): Call make_plt_section.
3069         (Target_sparc::make_local_ifunc_plt_entry): New function.
3070         (Target_sparc::rela_ifunc_section): New function.
3071         (Target_sparc::plt_section): Remove const.
3072         (Output_data_plt_sparc): Update declarations.  Define Global_ifunc
3073         and Local_ifunc types.  Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
3074         and ifunc_count_ fields.
3075         (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
3076         (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
3077         (Output_data_plt_sparc::add_local_ifunc_entry): New function.
3078         (Output_data_plt_sparc::rela_ifunc): New function.
3079         (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
3080         (Output_data_plt_sparc::has_ifunc_section): New function.
3081         (Output_data_plt_sparc::entry_count): Include ifunc_count_.
3082         (Output_data_plt_sparc::address_for_global): New function.
3083         (Output_data_plt_sparc::address_for_local): New function.
3084         (Output_data_plt_sparc::plt_index_to_offset): New function.
3085         (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
3086         and entry_count.
3087         (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
3088         entry_count.
3089         (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
3090         R_SPARC_JMP_IREL to switch.
3091         (Target_sparc::Scan::check_non_pic): Likewise.
3092         (Target_sparc::Scan::local): Handle IFUNC symbols.
3093         (Target_sparc::Scan::local): Likewise.
3094         (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
3095         and plt_address_for_local.
3096         (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
3097         Define __rel_iplt_start and __rel_iplt_end if doing a static link.
3098
3099         * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
3100         (class Output_data_reloc): Adjust calls to Output_reloc_type.
3101         (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
3102         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
3103         global relocs too.
3104         (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
3105         * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
3106         calls.
3107         * sparc.cc (Target_sparc::Scan::global): Likewise.
3108         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
3109
3110 2012-04-16  Cary Coutant  <ccoutant@google.com>
3111
3112         * archive.cc (Library_base::should_include_member): Check for
3113         --export-dynamic-symbol.
3114         * options.h (class General_options): Add --export-dynamic-symbol.
3115         * symtab.cc (Symbol::should_add_dynsym_entry): Check for
3116         --export-dynamic-symbol.
3117         (Symbol_table::gc_mark_undef_symbols): Likewise.
3118         (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
3119
3120 2012-04-12  David S. Miller  <davem@davemloft.net>
3121
3122         * sparc.cc (Reloc::wdisp10): New relocation method.
3123         (Reloc::h34): Likewise.
3124         (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
3125         (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
3126         R_SPARC_WDISP10.
3127         (Target_sparc::Scan::local): Likewise.
3128         (Target_sparc::Scan::global): Likewise.
3129         (Target_sparc::Relocate::relocate): Likewise.
3130
3131 2012-04-09  Cary Coutant  <ccoutant@google.com>
3132
3133         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
3134         low_pc == 0.
3135
3136 2012-04-06  Ian Lance Taylor  <iant@google.com>
3137
3138         * timer.cc: #include <unistd.h>.
3139
3140 2012-04-06  Roland McGrath  <mcgrathr@google.com>
3141
3142         * configure.in (AC_CHECK_HEADERS): Add locale.h.
3143         * config.in: Regenerate.
3144         * configure: Regenerate.
3145
3146 2012-04-05  Nick Clifton  <nickc@redhat.com>
3147
3148         * configure.ac (AC_CHECK_FUNCS): Add setlocale.
3149         (AM_LC_MESSAGES): Add.
3150         * aclocal.m4: Regenerate.
3151         * config.in: Regenerate.
3152         * configure: Regenerate.
3153
3154 2012-03-21  Cary Coutant  <ccoutant@google.com>
3155
3156         * Makefile.am: Add gdb-index.cc, gdb-index.h.
3157         * Makefile.in: Regenerate.
3158         * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
3159         (Sized_elf_reloc_mapper::symbol_section): New function.
3160         (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
3161         (make_elf_reloc_mapper): New function.
3162         (Dwarf_abbrev_table::clear_abbrev_codes): New function.
3163         (Dwarf_abbrev_table::do_read_abbrevs): New function.
3164         (Dwarf_abbrev_table::do_get_abbrev): New function.
3165         (Dwarf_ranges_table::read_ranges_table): New function.
3166         (Dwarf_ranges_table::read_range_list): New function.
3167         (Dwarf_pubnames_table::read_section): New function.
3168         (Dwarf_pubnames_table::read_header): New function.
3169         (Dwarf_pubnames_table::next_name): New function.
3170         (Dwarf_die::Dwarf_die): New function.
3171         (Dwarf_die::read_attributes): New function.
3172         (Dwarf_die::skip_attributes): New function.
3173         (Dwarf_die::set_name): New function.
3174         (Dwarf_die::set_linkage_name): New function.
3175         (Dwarf_die::attribute): New function.
3176         (Dwarf_die::string_attribute): New function.
3177         (Dwarf_die::int_attribute): New function.
3178         (Dwarf_die::uint_attribute): New function.
3179         (Dwarf_die::ref_attribute): New function.
3180         (Dwarf_die::child_offset): New function.
3181         (Dwarf_die::sibling_offset): New function.
3182         (Dwarf_info_reader::check_buffer): New function.
3183         (Dwarf_info_reader::parse): New function.
3184         (Dwarf_info_reader::do_parse): New function.
3185         (Dwarf_info_reader::do_read_string_table): New function.
3186         (Dwarf_info_reader::lookup_reloc): New function.
3187         (Dwarf_info_reader::get_string): New function.
3188         (Dwarf_info_reader::visit_compilation_unit): New function.
3189         (Dwarf_info_reader::visit_type_unit): New function.
3190         (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
3191         Sized_elf_reloc_mapper.
3192         (Sized_dwarf_line_info::symbol_section): Remove function.
3193         (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
3194         (Sized_dwarf_line_info::read_line_mappings): Remove object
3195         parameter, adjust callers.
3196         (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
3197         * dwarf_reader.h: Include <sys/types.h>.
3198         (class Track_relocs): Remove forward declaration.
3199         (class Elf_reloc_mapper): New class.
3200         (class Sized_elf_reloc_mapper): New class.
3201         (class Dwarf_abbrev_table): New class.
3202         (class Dwarf_range_list): New class.
3203         (class Dwarf_ranges_table): New class.
3204         (class Dwarf_pubnames_table): New class.
3205         (class Dwarf_die): New class.
3206         (class Dwarf_info_reader): New class.
3207         (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
3208         (Sized_dwarf_line_info::symbol_section): Remove member function.
3209         * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
3210         base class.
3211         * gdb-index.cc: New source file.
3212         * gdb-index.h: New source file.
3213         * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
3214         and .debug_types sections, call Layout::add_to_gdb_index.
3215         (Sized_relobj_incr::do_section_name): Implement.
3216         (Sized_relobj_incr::do_section_contents): Adjust parameter list and
3217         return type; Implement.
3218         (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
3219         return type.
3220         * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
3221         parameter list and return type.
3222         (Sized_incr_dynobj::do_section_contents): Likewise.
3223         * layout.cc: Include gdb-index.h.
3224         (Layout::Layout): Initialize gdb_index_data_.
3225         (Layout::init_fixed_output_section): Check for .gdb_index section.
3226         (Layout::add_to_gdb_index): New function. Instantiate.
3227         * layout.h: Add forward declaration for class Gdb_index.
3228         (Layout::add_to_gdb_index): New member function.
3229         (Layout::gdb_index_data_): New data member.
3230         * main.cc: Include gdb-index.h.
3231         (main): Print statistics for gdb index.
3232         * object.cc (Object::section_contents): Move code into
3233         do_section_contents.
3234         (need_decompressed_section): Check for sections needed when building
3235         gdb index.
3236         (build_compressed_section_map): Likewise.
3237         (Sized_relobj_file::do_read_symbols): Need local symbols when building
3238         gdb index.
3239         (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
3240         sections; call Layout::add_to_gdb_index.
3241         (Sized_relobj_file::do_decompressed_section_contents): Call
3242         do_section_contents directly.
3243         * object.h (Object::do_section_contents): Adjust parameter list and
3244         return type.
3245         (Object::do_decompressed_section_contents): Call do_section_contents
3246         directly.
3247         (Sized_relobj_file::do_section_contents): Adjust parameter list and
3248         return type.
3249         * options.h (class General_options): Add --gdb-index option.
3250         * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
3251         list and return type.
3252         * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
3253         * reloc.h (Track_relocs::checkpoint): New function.
3254         (Track_relocs::reset): New function.
3255
3256         * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
3257         New test cases.
3258         * testsuite/Makefile.in: Regenerate.
3259         * testsuite/gdb_index_test.cc: New test source file.
3260         * testsuite/gdb_index_test_1.sh: New test source file.
3261         * testsuite/gdb_index_test_2.sh: New test source file.
3262
3263 2012-03-19  Doug Kwan  <dougkwan@google.com>
3264
3265         * arm.cc (Target_arm::do_define_standard_symbols): New method.
3266         (Target_arm::do_finalize_sections): Remove code which defines
3267         __exidx_start and __exidx_end.  Make symbol table parameter
3268         anonymous as it is not used.
3269         * gold.cc (queue_middle_tasks): Call target hook to define any
3270         target-specific symbols.
3271         * target.h (Target::define_standard_symbols): New method.
3272         (Target::do_define_standard_symbols): Same.
3273         * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
3274         * testsuite/Makefile.in: Regenerate.
3275         * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
3276         and __exidx_end.
3277         * testsuite/arm_exidx_test.sh: Check that no unused dynamic
3278         relocations are generated for __exidx_start and __exidx_end.
3279
3280 2012-03-16  Doug Kwan  <dougkwan@google.com>
3281
3282         * testsuite/Makefile.am: Disable test initpri3b.
3283         * testsuite/Makefile.in: Regenerate.
3284
3285 2012-03-15  Doug Kwan  <dougkwan@google.com>
3286
3287         * arm.cc (Target_arm::got_section): Make .got section read-only
3288         if -z now is given.
3289
3290 2012-03-15  Ian Lance Taylor  <iant@google.com>
3291
3292         PR gold/13850
3293         * layout.cc (Layout::make_output_section): Correctly mark
3294         SHT_INIT_ARRAY, et. al., as relro.
3295
3296 2012-03-14  Doug Kwan  <dougkwan@google.com>
3297
3298         * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
3299         dynamic relocations for protected symbols in shared objects.
3300
3301 2012-03-13  Ian Lance Taylor  <iant@google.com>
3302
3303         * resolve.cc (Symbol_table::resolve): When merging common symbols,
3304         keep the larger alignment.
3305
3306 2012-03-12  Cary Coutant  <ccoutant@google.com>
3307
3308         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
3309         handling of DW_LNE_define_file.
3310
3311 2012-03-12  Cary Coutant  <ccoutant@google.com>
3312
3313         * reduced_debug_output.cc
3314         (Output_reduced_debug_info_section::get_die_end): Add new FORM
3315         codes to switch.
3316
3317 2012-02-29  Cary Coutant  <ccoutant@google.com>
3318
3319         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
3320
3321 2012-02-29  Cary Coutant  <ccoutant@google.com>
3322
3323         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
3324         Call Object::decompressed_section_contents.
3325         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
3326         New dtor.
3327         (Sized_dwarf_line_info::buffer_start_): New data member.
3328         * merge.cc (Output_merge_data::do_add_input_section): Call
3329         Object::decompressed_section_contents.
3330         (Output_merge_string::do_add_input_section): Likewise.
3331         * object.cc (need_decompressed_section): New function.
3332         (build_compressed_section_map): Decompress sections needed later.
3333         (Sized_relobj_file::do_decompressed_section_contents): New function.
3334         (Sized_relobj_file::do_discard_decompressed_sections): New function.
3335         * object.h (Object::decompressed_section_contents): New function.
3336         (Object::discard_decompressed_sections): New function.
3337         (Object::do_decompressed_section_contents): New function.
3338         (Object::do_discard_decompressed_sections): New function.
3339         (Compressed_section_info): New type.
3340         (Compressed_section_map): Include decompressed section contents.
3341         (Sized_relobj_file::do_decompressed_section_contents): New function.
3342         (Sized_relobj_file::do_discard_decompressed_sections): New function.
3343
3344 2012-02-16  Cary Coutant  <ccoutant@google.com>
3345
3346         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
3347         * testsuite/Makefile.in: Regenerate.
3348
3349 2012-02-14  Cary Coutant  <ccoutant@google.com>
3350
3351         * options.cc (General_options::finalize): Disallow -pie and -static.
3352
3353 2012-02-03  Doug Kwan  <dougkwan@google.com>
3354
3355         * arm.cc (Arm_relocate_functions::abs8,
3356         Arm_relocate_functions::abs16): Use
3357         Bits::has_signed_unsigned_overflow32.
3358         (Arm_relocate_functions::thm_abs8): Correct range of
3359         overflow check.
3360         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
3361         in assertions.
3362
3363 2012-02-02  Doug Kwan  <dougkwan@google.com>
3364
3365         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
3366         position independent outputs, not just shared objects.
3367
3368 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
3369
3370         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
3371         * configure: Regenerated.
3372
3373 2012-01-27  Ian Lance Taylor  <iant@google.com>
3374
3375         * reloc.h (Bits): New class with static functions, copied from
3376         namespace utils in arm.cc.
3377         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
3378         instead.
3379
3380 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
3381
3382         * incremental.cc (write_info_blocks): Correct relocation offset.
3383
3384 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
3385
3386         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
3387         (Relocate::tls_gd_to_le): Likewise.
3388
3389 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
3390
3391         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
3392
3393 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
3394
3395         * configure.ac: Check if -mcmodel=medium works.
3396         * configure: Regenerated.
3397
3398 2012-01-24  Cary Coutant  <ccoutant@google.com>
3399
3400         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
3401         definition and ...
3402         (read_unsigned_LEB_128_x): ... this new function.
3403         (read_signed_LEB_128): Replaced with inline definition and ...
3404         (read_signed_LEB_128_x): ... this new function.
3405         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
3406         (read_unsigned_LEB_128): Add inline definition.
3407         (read_signed_LEB_128_x): New function.
3408         (read_signed_LEB_128): Add inline definition.
3409         * testsuite/Makefile.am (leb128_unittest): New unit test.
3410         * testsuite/Makefile.in: Regenerate.
3411         * testsuite/leb128_unittest.cc: New unit test.
3412
3413 2012-01-23  Ian Lance Taylor  <iant@google.com>
3414
3415         PR gold/13617
3416         * i386.cc (Target_i386::do_code_fill): When using a jmp
3417         instruction, pad with nop instructions.
3418         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
3419
3420 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
3421
3422         * x86_64.cc (gc_process_relocs): Add typename on types used in
3423         template.
3424         (scan_relocs): Likewise.
3425         (relocate_section): Likewise.
3426         (apply_relocation): Likewise.
3427
3428 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
3429
3430         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
3431         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
3432         under x32.
3433
3434 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
3435
3436         * x86_64.cc: Initial support for x32.
3437
3438 2012-01-03  Cary Coutant  <ccoutant@google.com>
3439
3440         * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
3441         Use abstract base class for GOT.
3442         * gold/output.h (class Output_data_got_base): New abstract base class.
3443         (class Output_data_got): Derive from new base class, adjust ctors.
3444         (Output_data_got::reserve_slot): Make virtual; rename to
3445         do_reserve_slot; Adjust callers.
3446         * gold/target.h (Sized_target::init_got_plt_for_update): Return
3447         pointer to abstract base class.
3448         * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
3449
3450 2011-12-18  Ian Lance Taylor  <iant@google.com>
3451
3452         * object.h (Relobj::local_symbol_value): New function.
3453         (Relobj::local_plt_offset): New function.
3454         (Relobj::local_has_got_offset): New function.
3455         (Relobj::local_got_offset): New function.
3456         (Relobj::set_local_got_offset): New function.
3457         (Relobj::do_local_symbol_value): New pure virtual function.
3458         (Relobj::do_local_plt_offset): Likewise.
3459         (Relobj::do_local_has_got_offset): Likewise.
3460         (Relobj::do_local_got_offset): Likewise.
3461         (Relobj::do_set_local_got_offset): Likewise.
3462         (Sized_relobj::do_local_has_got_offset): Rename from
3463         local_has_got_offset.
3464         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
3465         (Sized_relobj::do_set_local_got_offset): Rename from
3466         set_local_got_offset.
3467         (Sized_relobj_file::do_local_plt_offset): Rename from
3468         local_plt_offset.
3469         (Sized_relobj_file::do_local_symbol_value): New function.
3470         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
3471         local_plt_offset.
3472         * output.cc (Output_data_got::Got_entry::write): Change object to
3473         Relobj.  Use local_symbol_value.
3474         (Output_data_got::add_global_with_rel): Change rel_dyn to
3475         Output_data_reloc_generic*.  Use add_global_generic.
3476         (Output_data_got::add_global_with_rela): Remove.  Change all
3477         callers to use add_global_with_rel.
3478         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
3479         Output_data_reloc_generic*.  Use add_global_generic.
3480         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
3481         callers to use add_global_pair_with_rel.
3482         (Output_data_got::add_local): Change object to Relobj*.
3483         (Output_data_got::add_local_plt): Likewise.
3484         (Output_data_got::add_local_with_rel): Change object to Relobj*,
3485         change rel_dyn to Output_data_reloc_generic*.  Use
3486         add_local_generic.
3487         (Output_data_got::add_local_with_rela): Remove.  Change all
3488         callers to use all_local_with_rel.
3489         (Output_data_got::add_local_pair_with_rel): Change object to
3490         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
3491         add_output_section_generic.
3492         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
3493         callers to use add_local_pair_with_rel.
3494         (Output_data_got::reserve_local): Change object to Relobj*.
3495         * output.h: (class Output_data_reloc_generic): Add pure virtual
3496         declarations for add_global_generic, add_local_generic,
3497         add_output_section_generic.
3498         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
3499         functions for Output_data_reloc_generic.  Update declarations for
3500         changes listed in output.cc.
3501         (class Output_data_got): Change template parameter to got_size.
3502         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
3503         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
3504         function.
3505         (Sized_relobj_incr::do_local_plt_offset): New function.
3506         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
3507         add_global_generic.
3508
3509 2011-12-17  Cary Coutant  <ccoutant@google.com>
3510
3511         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
3512         * resolve.cc (Symbol_table::resolve): Likewise.
3513         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
3514         arrays.
3515         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
3516
3517 2011-12-16  Ian Lance Taylor  <iant@google.com>
3518
3519         * output.h (Output_data_reloc_generic::add): Only call
3520         add_dynamic_reloc if this is a dynamic reloc section.
3521
3522 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
3523
3524         PR gold/13505
3525         * target-reloc.h (apply_relocation): Replace <64, false> with
3526         <size, big_endian>.
3527
3528 2011-11-25  Nick Clifton  <nickc@redhat.com>
3529
3530         * po/it.po: New Italian translation.
3531
3532 2011-11-17  Sterling Augustine  <saugustine@google.com>
3533
3534         * script.cc (script_include_directive): Implement.
3535         (read_script_file): New local variables name and search_path. Update
3536         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
3537         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
3538         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
3539
3540 2011-11-11  Sterling Augustine  <saugustine@google.com>
3541
3542         * yyscript.y (section_cmd): Add support for INCLUDE directive.
3543         (file_or_sections_cmd): Likewise.
3544
3545 2011-11-11  Doug Kwan  <dougkwan@google.com>
3546
3547         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
3548         if --just-symbols is given.
3549
3550 2011-11-10  Doug Kwan  <dougkwan@google.com>
3551
3552         PR gold/13362
3553         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
3554         when processing data relocs.
3555         * reloc.h (Relocate_functions::rel_unaligned): New method.
3556         (Relocate_functions::pcrel_unaligned): Ditto.
3557         (Relocate_functions::rel32_unaligned): Ditto.
3558         (Relocate_functions::pcrel32_unaligned): Ditto.
3559
3560 2011-11-09  Doug Kwan  <dougkwan@google.com>
3561
3562         PR gold/13362
3563         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
3564         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
3565         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
3566         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
3567         (Relocate_functions::rel_unaligned): New.
3568         (Relocate_functions::rel32_unaligned): New.
3569         * target-reloc.h (relocate_for_relocatable): Add code to handle
3570         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
3571         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
3572         arm_unaligned_reloc_r): New targets.
3573         * testsuite/Makefile.in: Regenerate.
3574         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
3575         linking.
3576
3577 2011-11-02  Ian Lance Taylor  <iant@google.com>
3578
3579         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
3580         NATIVE_LINKER.
3581         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
3582         * options.cc (General_options::finalize): Use library search path
3583         from configure script if specified.  If not native and no sysroot,
3584         only search TOOLLIBDIR.
3585         * options.h (Search_directory::Search_directory): Change name to
3586         const std::string&.
3587         (General_options::add_to_library_path_with_sysroot): Change arg to
3588         const std::string&.
3589         * configure, Makefile.in, config.in: Rebuild.
3590
3591 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
3592
3593         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
3594         we are working around the ARM1176 Erratum.
3595         * options.h (General_options::fix_arm1176): Add option.
3596         * testsuite/Makefile.am: Add testcases, and keep current ones
3597         working.
3598         * testsuite/Makefile.in: Regenerate.
3599         * testsuite/arm_fix_1176.s: New file.
3600         * testsuite/arm_fix_1176.sh: Likewise.
3601
3602 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
3603
3604         * arm.cc (Target_arm::Target_arm): Remove initialisation of
3605         may_use_blx_.
3606         (Target_arm::may_use_blx): Remove method.
3607         (Target_arm::set_may_use_blx): Likewise.
3608         (Target_arm::may_use_v4t_interworking): New method.
3609         (Target_arm::may_use_v5t_interworking): Likewise.
3610         (Target_arm::may_use_blx_): Remove member variable.
3611         (Arm_relocate_functions::arm_branch_common): Check for v5T
3612         interworking.
3613         (Arm_relocate_functions::thumb_branch_common): Likewise.
3614         (Reloc_stub::stub_type_for_reloc): Likewise.
3615         (Target_arm::do_finalize_sections): Correct interworking checks.
3616         * testsuite/Makefile.am: Add new tests.
3617         * testsuite/Makefile.in: Regenerate.
3618         * testsuite/arm_farcall_arm_arm.s: New test.
3619         * testsuite/arm_farcall_arm_arm.sh: Likewise.
3620         * testsuite/arm_farcall_arm_thumb.s: Likewise.
3621         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
3622         * testsuite/arm_farcall_thumb_arm.s: Likewise.
3623         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
3624         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
3625         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
3626
3627 2011-10-31  Cary Coutant  <ccoutant@google.com>
3628
3629         PR gold/13023
3630         * expression.cc (Expression::eval_with_dot): Add
3631         is_section_dot_assignment parameter.
3632         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
3633         absolute and assigning to dot within a section.
3634         * script-sections.cc
3635         (Output_section_element_assignment::set_section_addresses): Pass
3636         dot_section to set_if_absolute.
3637         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
3638         as is_section_dot_assignment flag to eval_with_dot.
3639         (Output_section_element_dot_assignment::set_section_addresses):
3640         Likewise.
3641         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
3642         parameter.  Also set value if relative to dot_section; set the
3643         symbol's output_section.
3644         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
3645         parameter.  Adjust all callers.
3646         (Expression::eval_maybe_dot): Likewise.
3647         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
3648         Adjust all callers.
3649         * testsuite/script_test_2.t: Test assignment of an absolute value
3650         to dot within an output section element.
3651
3652 2011-10-31  Cary Coutant  <ccoutant@google.com>
3653
3654         * options.h (class General_options): Add --[no-]gnu-unique options.
3655         * symtab.cc (Symbol_table::sized_write_globals): Convert
3656         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
3657
3658 2011-10-31  Cary Coutant  <ccoutant@google.com>
3659
3660         PR gold/13359
3661         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
3662         unnecessary assertion.
3663         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
3664
3665 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
3666
3667         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
3668         gc_mark_symbol.
3669         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
3670         gc_mark_symbol.
3671         Change to just keep the section associated with symbol.
3672         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
3673         they are externally visible and --export-dynamic is turned on.
3674         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
3675
3676 2011-10-19  Ian Lance Taylor  <iant@google.com>
3677
3678         PR gold/13163
3679         * script-sections.cc
3680         (Output_section_element_dot_assignment::needs_output_section): New
3681         function.
3682
3683 2011-10-19  Ian Lance Taylor  <iant@google.com>
3684
3685         PR gold/13204
3686         * layout.cc (Layout::segment_precedes): Don't assert failure if a
3687         --section-start option was seen.
3688         * options.h (General_options::any_section_start): New function.
3689
3690 2011-10-18  David S. Miller  <davem@davemloft.net>
3691
3692         PR binutils/13301
3693         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
3694         member to track relocation locations that have moved during TLS
3695         reloc optimizations.
3696         (Target_sparc::Relocate::Relocate): Initialize to NULL.
3697         (Target_sparc::Relocate::relocate): Adjust view down by 4
3698         bytes if it matches reloc_adjust_addr_.
3699         (Target_sparc::Relocate::relocate_tls): Always move the
3700         __tls_get_addr call delay slot instruction forward 4 bytes when
3701         performing relaxation.
3702
3703 2011-10-18  Cary Coutant  <ccoutant@google.com>
3704
3705         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
3706         (Output_file::map_no_anonymous): Check for non-zero
3707         return code from posix_fallocate.
3708
3709 2011-10-17  Cary Coutant  <ccoutant@google.com>
3710
3711         PR gold/13245
3712         * plugin.cc (is_visible_from_outside): Check for symbols
3713         referenced from dynamic objects.
3714         * resolve.cc (Symbol_table::resolve): Don't count references
3715         from dynamic objects as references from real ELF files.
3716         * testsuite/plugin_test_2.sh: Adjust expected result.
3717
3718 2011-10-17  Cary Coutant  <ccoutant@google.com>
3719
3720         * gold.cc: Include timer.h.
3721         (queue_middle_tasks): Stamp time.
3722         (queue_final_tasks): Likewise.
3723         * main.cc (main): Store timer in parameters.  Print timers
3724         for each pass.
3725         * parameters.cc (Parameters::Parameters): Initialize timer_.
3726         (Parameters::set_timer): New function.
3727         (set_parameters_timer): New function.
3728         * parameters.h (Parameters::set_timer): New function.
3729         (Parameters::timer): New function.
3730         (Parameters::timer_): New data member.
3731         (set_parameters_timer): New function.
3732         * timer.cc (Timer::stamp): New function.
3733         (Timer::get_pass_time): New function.
3734         * timer.h (Timer::stamp): New function.
3735         (Timer::get_pass_time): New function.
3736         (Timer::pass_times_): New data member.
3737
3738 2011-10-17  Cary Coutant  <ccoutant@google.com>
3739
3740         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
3741         task for members of lib groups.
3742
3743 2011-10-17  Cary Coutant  <ccoutant@google.com>
3744
3745         PR gold/13288
3746         * fileread.cc (File_read::find_view): Add assert.
3747         (File_read::make_view): Move bounds check (replace with assert)...
3748         (File_read::find_or_make_view): ... to here.
3749
3750 2011-10-12  Cary Coutant  <ccoutant@google.com>
3751
3752         * output.cc (Output_file::open_base_file): Handle case where
3753         ::read returns less than requested size.
3754
3755 2011-10-10  Cary Coutant  <ccoutant@google.com>
3756
3757         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
3758         Initialize defined_count_.
3759         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
3760         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
3761         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
3762         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
3763         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
3764         * incremental.h (Sized_relobj_incr::defined_count_): New data
3765         member.
3766         (Sized_incr_dynobj::defined_count_): New data member.
3767         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
3768         Return zeroes instead of internal error.
3769
3770 2011-10-10  Cary Coutant  <ccoutant@google.com>
3771
3772         PR gold/13249
3773         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
3774         (Output_reloc::symbol_value): Return PLT offset if flag is set.
3775         * output.h (class Output_reloc): Add use_plt_offset flag.
3776         (Output_reloc::type_): Adjust size of bit field.
3777         (Output_reloc::use_plt_offset_): New bit field.
3778         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
3779         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
3780         flag.  Adjust all callers.
3781         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
3782         creating RELATIVE relocations.
3783
3784 2011-10-10  Nick Clifton  <nickc@redhat.com>
3785
3786         * po/es.po: Updated Spanish translation.
3787         * po/fi.po: Updated Finnish translation.
3788
3789 2011-10-03   Diego Novillo  <dnovillo@google.com>
3790
3791         * options.cc (parse_uint): Fix dereference of RETVAL.
3792
3793 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
3794
3795         * layout.h (section_order_map_): New member.
3796         (get_section_order_map): New member function.
3797         * output.cc (Output_section::add_input_section): Check for patterns
3798         only when --section-ordering-file is specified.
3799         * gold.cc (queue_middle_tasks): Delay updating order of sections till
3800         output_sections have been formed.
3801         * layout.cc (Layout_Layout): Initialize section_order_map_.
3802         * plugin.cc (update_section_order): Store order in order_map. Do not
3803         update the order.
3804         * testsuite/Makefile.am: Add test case for plugin_final_layout.
3805         * testsuite/Makefile.in: Regenerate.
3806         * testsuite/plugin_section_order.c: New file.
3807         * testsuite/plugin_final_layout.cc: New file.
3808         * testsuite/plugin_final_layout.sh: New file.
3809
3810 2011-09-29  Cary Coutant  <ccoutant@google.com>
3811
3812         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
3813         Check for NULL.
3814         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
3815         symbols during incremental update.
3816         (Symbol_table::add_from_dynobj): Likewise.
3817
3818 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3819             Ian Lance Taylor  <iant@google.com>
3820
3821         * symtab.cc (Symbol_table::define_special_symbol): Always
3822         canonicalize version string.
3823
3824 2011-09-26  Cary Coutant  <ccoutant@google.com>
3825
3826         * gold.cc (queue_initial_tasks): Move option checks ...
3827         * options.cc (General_options::finalize): ... to here. Disable
3828         some options; make others fatal.
3829
3830 2011-09-26  Cary Coutant  <ccoutant@google.com>
3831
3832         gcc PR lto/47247
3833         * plugin.cc (get_symbols_v2): New function.
3834         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
3835         (is_referenced_from_outside): New function.
3836         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
3837         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
3838         (get_symbols): Pass version parameter.
3839         (get_symbols_v2): New function.
3840         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
3841         parameter.
3842         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
3843         (onload): Add LDPT_GET_SYMBOLS_V2.
3844         (all_symbols_read_hook): Use get_symbols_v2; check for
3845         LDPR_PREVAILING_DEF_IRONLY_EXP.
3846         * testsuite/plugin_test_3.sh: Update expected results.
3847
3848 2011-09-23  Simon Baldwin  <simonb@google.com>
3849
3850         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
3851         configuration options.
3852         * configure: Regenerate.
3853         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
3854         * Makefile.in: Regenerate.
3855         * testsuite/Makefile.in: Regenerate.
3856
3857 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
3858
3859         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
3860
3861 2011-09-19  Cary Coutant  <ccoutant@google.com>
3862
3863         * incremental.cc (can_incremental_update): Fix typo in comment.
3864         * incremental.h (can_incremental_update): Likewise.
3865
3866 2011-09-18  Cary Coutant  <ccoutant@google.com>
3867
3868         * incremental.cc (can_incremental_update): New function.
3869         * incremental.h (can_incremental_update): New function.
3870         * layout.cc (Layout::init_fixed_output_section): Call it.
3871         (Layout::make_output_section): Don't allow patch space in .eh_frame.
3872         * object.cc (Sized_relobj_file::do_layout): Call
3873         can_incremental_update.
3874
3875 2011-09-13  Cary Coutant  <ccoutant@google.com>
3876
3877         * configure.ac: Check for glibc support for gnu_indirect_function
3878         support with static linking, setting automake conditional
3879         IFUNC_STATIC.
3880         * Makefile.in: Regenerate.
3881         * configure: Regenerate.
3882
3883         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
3884         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
3885         for IFUNC_STATIC.
3886         * testsuite/Makefile.in: Regenerate.
3887
3888 2011-09-13  Cary Coutant  <ccoutant@google.com>
3889
3890         * incremental.cc (Sized_relobj_incr::do_layout): Call
3891         report_comdat_group for kept comdat sections.
3892         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
3893         * testsuite/Makefile.in: Regenerate.
3894         * testsuite/incr_comdat_test_1.cc: New source file.
3895         * testsuite/incr_comdat_test_2_v1.cc: New source file.
3896         * testsuite/incr_comdat_test_2_v2.cc: New source file.
3897         * testsuite/incr_comdat_test_2_v3.cc: New source file.
3898
3899 2011-09-13  Ian Lance Taylor  <iant@google.com>
3900
3901         * object.cc (Sized_relobj_file::do_layout): Remove unused local
3902         variable external_symbols_offset.
3903
3904 2011-09-12  Ian Lance Taylor  <iant@google.com>
3905
3906         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
3907         triggered if object has no symbols.
3908
3909 2011-09-09  David S. Miller  <davem@davemloft.net>
3910
3911         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
3912         (Output_fill_debug_line::do_write): Likewise.
3913
3914 2011-08-29  Cary Coutant  <ccoutant@google.com>
3915
3916         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
3917         casts to match formatting specs.
3918         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
3919
3920 2011-08-26  Cary Coutant  <ccoutant@google.com>
3921
3922         * layout.cc (Free_list::allocate): Provide guarantee of minimum
3923         remaining hole size when allocating.
3924         (Layout::make_output_section): Set fill methods for debug sections.
3925         * layout.h (Free_list::Free_list_node): Move from private to
3926         public.
3927         (Free_list::set_min_hole_size): New function.
3928         (Free_list::begin, Free_list::end): New functions.
3929         (Free_list::min_hole_): New data member.
3930         * output.cc: Include dwarf.h.
3931         (Output_fill_debug_info::do_minimum_hole_size): New function.
3932         (Output_fill_debug_info::do_write): New function.
3933         (Output_fill_debug_line::do_minimum_hole_size): New function.
3934         (Output_fill_debug_line::do_write): New function.
3935         (Output_section::Output_section): Initialize new data member.
3936         (Output_section::set_final_data_size): Ensure patch space is larger
3937         than minimum hole size.
3938         (Output_section::do_write): Fill holes in debug sections.
3939         * output.h (Output_fill): New class.
3940         (Output_fill_debug_info): New class.
3941         (Output_fill_debug_line): New class.
3942         (Output_section::set_free_space_fill): New function.
3943         (Output_section::free_space_fill_): New data member.
3944         * testsuite/Makefile.am (incremental_test_3): Add
3945         --incremental-patch option.
3946         (incremental_test_4): Likewise.
3947         (incremental_test_5): Likewise.
3948         (incremental_test_6): Likewise.
3949         (incremental_copy_test): Likewise.
3950         (incremental_common_test_1): Likewise.
3951         * testsuite/Makefile.in: Regenerate.
3952
3953 2011-08-26  Nick Clifton  <nickc@redhat.com>
3954
3955         * po/es.po: Updated Spanish translation.
3956
3957 2011-08-01  Cary Coutant  <ccoutant@google.com>
3958
3959         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
3960         * gold/testsuite/Makefile.in: Regenerate.
3961         * gold/testsuite/justsyms_exec.c: New source file.
3962         * gold/testsuite/justsyms_lib.c: New source file.
3963
3964 2011-08-01  Cary Coutant  <ccoutant@google.com>
3965
3966         * layout.cc (Layout::set_segment_offsets): Don't realign text
3967         segment if -Ttext was specified.
3968         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
3969         file type.
3970         * object.h (Sized_relobj_file::e_type): New function.
3971         (Sized_relobj_file::e_type_): New data member.
3972         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
3973         base address for ET_EXEC files.
3974         * target.cc (Target::do_make_elf_object_implementation): Allow
3975         ET_EXEC files with --just-symbols option.
3976
3977 2011-07-28  Cary Coutant  <ccoutant@google.com>
3978
3979         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
3980         Add thread_number parameter.
3981         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
3982         * workqueue-threads.cc
3983         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
3984         current thread if its thread number is greater than desired thread
3985         count.
3986         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
3987         Add thread_number parameter.
3988         (Workqueue::should_cancel_thread): Likewise.
3989         (Workqueue::find_runnable_or_wait): Pass thread_number to
3990         should_cancel_thread.
3991         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
3992         parameter.
3993
3994 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
3995
3996         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
3997         only after checking if it cannot be forced local.
3998         * symtab.h (is_externally_visible): Check if the symbol is not forced
3999         local.
4000
4001 2011-07-15  Ian Lance Taylor  <iant@google.com>
4002
4003         * options.h (class General_options): Add --print-output-format.
4004         Move -EL next to -EB, for  better --help output.
4005         * target-select.cc: Include <cstdio>, "options.h", and
4006         "parameters.h".
4007         (Target_selector::do_target_bfd_name): New function.
4008         (print_output_format): New function.
4009         * target-select.h (class Target_selector): Update declarations.
4010         (Target_selector::target_bfd_name): New function.
4011         (print_output_format): Declare.
4012         * main.cc: Include "target-select.h".
4013         (main): Handle --print-output-format.
4014         * gold.cc: Include "target-select.h".
4015         (queue_initial_tasks): Handle --print-output-format when there are
4016         no input files.
4017         * parameters.cc (parameters_force_valid_target): Give a better
4018         error message if -EB/-EL does not match target.
4019         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
4020         function.
4021
4022 2011-07-15  Ian Lance Taylor  <iant@google.com>
4023
4024         * i386.cc (class Output_data_plt_i386): Add layout_ field.
4025         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
4026         (Output_data_plt_i386::do_write): Write address of .dynamic
4027         section to first entry in .got.plt section.
4028         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
4029         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
4030         Initialize layout_.
4031         (Output_data_plt_x86_64::do_write): Write address of .dynamic
4032         section to first entry in .got.plt section.
4033         * layout.h (Layout::dynamic_section): New function.
4034
4035 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
4036
4037         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
4038         to claim_file call.
4039         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
4040         input_section_position_, and input_section_glob_.
4041         (read_layout_from_file): Call function section_ordering_specified.
4042         * layout.h (is_section_ordering_specified): New function.
4043         (section_ordering_specified): New function.
4044         (section_ordering_specified_): New boolean member.
4045         * main.cc(main): Call load_plugins after layout object is defined.
4046         * output.cc (Output_section::add_input_section): Use
4047         function section_ordering_specified to check if section ordering is
4048         needed.
4049         * output.cc (Output_section::add_relaxed_input_section): Use
4050         function section_ordering_specified to check if section ordering is
4051         needed.
4052         (Output_section::update_section_layout): New function.
4053         (Output_section::sort_attached_input_sections): Check if input section
4054         must be reordered.
4055         * output.h (Output_section::update_section_layout): New function.
4056         * plugin.cc (get_section_count): New function.
4057         (get_section_type): New function.
4058         (get_section_name): New function.
4059         (get_section_contents): New function.
4060         (update_section_order): New function.
4061         (allow_section_ordering): New function.
4062         (Plugin::load): Add the new interfaces to the transfer vector.
4063         (Plugin_manager::load_plugins): New parameter.
4064         (Plugin_manager::all_symbols_read): New parameter.
4065         (Plugin_manager::claim_file): New parameter. Save the elf object for
4066         unclaimed objects.
4067         (Plugin_manager::get_elf_object): New function.
4068         (Plugin_manager::get_view): Change to directly use the bool to check
4069         if get_view is called from claim_file_hook.
4070         * plugin.h (input_objects): New function
4071         (Plugin__manager::load_plugins): New parameter.
4072         (Plugin_manager::claim_file): New parameter.
4073         (Plugin_manager::get_elf_object): New function.
4074         (Plugin_manager::in_claim_file_handler): New function.
4075         (Plugin_manager::in_claim_file_handler_): New member.
4076         (layout): New function.
4077         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
4078         handler with an extra parameter. Make the elf object before calling
4079         claim_file handler.
4080         * testsuite/plugin_test.c (get_section_count): New function pointer.
4081         (get_section_type): New function pointer.
4082         (get_section_name): New function pointer.
4083         (get_section_contents): New function pointer.
4084         (update_section_order): New function pointer.
4085         (allow_section_ordering): New function pointer.
4086         (onload): Check if the new interfaces exist.
4087
4088 2011-07-13  Ian Lance Taylor  <iant@google.com>
4089
4090         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
4091         relro section.
4092         * x86_64.cc (Target_x86_64::got_section): Likewise.
4093         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
4094         (relro_now_test_SOURCES): New variable.
4095         (relro_now_test_DEPENDENCIES): New variable.
4096         (relro_now_test_LDFLAGS): New variable.
4097         (relro_now_test_LDADD): New variable.
4098         (relro_now_test.so): New target.
4099         * testsuite/Makefile.in: Rebuild.
4100
4101 2011-07-12  Ian Lance Taylor  <iant@google.com>
4102
4103         PR gold/12980
4104         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
4105         GLOB_DAT relocation rather than a RELATIVE relocation for a
4106         protected symbol when creating a shared library.
4107         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
4108         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
4109         * testsuite/protected_main_1.cc (main): Test that protected
4110         function has same address.
4111
4112 2011-07-11  Ian Lance Taylor  <iant@google.com>
4113
4114         PR gold/12979
4115         * options.h (class General_options): Add -Bgroup.
4116         * options.cc (General_options::finalize): If -Bgroup is set,
4117         default to --unresolved-symbols=report-all.
4118         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
4119         * target-reloc.h (issue_undefined_symbol_error): Handle
4120         --unresolved-symbols=report-all.
4121
4122 2011-07-08  Ian Lance Taylor  <iant@google.com>
4123
4124         PR gold/11985
4125         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
4126         if linker script discards key sections.
4127         (Layout::create_dynamic_symtab): Likewise.
4128         (Layout::assign_local_dynsym_offsets): Likewise.
4129         (Layout::sized_create_version_sections): Likewise.
4130         (Layout::create_interp): Likewise.
4131         (Layout::finish_dynamic_section): Likewise.
4132         (Layout::set_dynamic_symbol_size): Likewise.
4133
4134 2011-07-08  Ian Lance Taylor  <iant@google.com>
4135
4136         PR gold/12386
4137         * options.h (class General_options): Add --unresolved-symbols.
4138         * target-reloc.h (issue_undefined_symbol_error): Check
4139         --unresolved-symbols.  Add comments.
4140
4141 2011-07-08  Ian Lance Taylor  <iant@google.com>
4142
4143         * testsuite/odr_violation2.cc (Ordering::operator()): Make
4144         expression more complex.
4145
4146 2011-07-08  Ian Lance Taylor  <iant@google.com>
4147
4148         PR gold/11317
4149         * target-reloc.h (issue_undefined_symbol_error): New inline
4150         function, broken out of relocate_section.
4151         (relocate_section): Call issue_undefined_symbol_error.
4152         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
4153         there is no TLS segment if we are about to issue an undefined
4154         symbol error.
4155         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
4156
4157 2011-07-08  Ian Lance Taylor  <iant@google.com>
4158
4159         PR gold/12279
4160         * resolve.cc (Symbol_table::should_override): Add fromtype
4161         parameter.  Change all callers.  Give error when linking together
4162         TLS and non-TLS symbol.
4163         (Symbol_table::should_override_with_special): Add fromtype
4164         parameter.  Change all callers.
4165         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
4166         there is no TLS segment if we have reported some errors.
4167         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
4168
4169 2011-07-08  Ian Lance Taylor  <iant@google.com>
4170
4171         PR gold/12372
4172         * target.h (Target::plt_address_for_global): New function.
4173         (Target::plt_address_for_local): New function.
4174         (Target::plt_section_for_global): Remove.
4175         (Target::plt_section_for_local): Remove.
4176         (Target::do_plt_address_for_global): New virtual function.
4177         (Target::do_plt_address_for_local): New virtual function.
4178         (Target::do_plt_section_for_global): Remove.
4179         (Target::do_plt_section_for_local): Remove.
4180         (Target::register_global_plt_entry): Add Symbol_table and Layout
4181         parameters.
4182         * output.cc (Output_data_got::Got_entry::write): Use
4183         plt_address_for_global and plt_address_for_local.
4184         * layout.cc (Layout::add_target_dynamic_tags): Use size and
4185         address of output section.
4186         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
4187         got_irelative_, and irelative_count_ fields.  Update
4188         declarations.
4189         (Output_data_plt_i386::has_irelative_section): New function.
4190         (Output_data_plt_i386::entry_count): Add irelative_count_.
4191         (Output_data_plt_i386::set_final_data_size): Likewise.
4192         (class Target_i386): Add got_irelative_ and rel_irelative_
4193         fields.  Update declarations.
4194         (Target_i386::Target_i386): Initialize new fields.
4195         (Target_i386::do_plt_address_for_global): New function replacing
4196         do_plt_section_for_global.
4197         (Target_i386::do_plt_address_for_local): New function replacing
4198         do_plt_section_for_local.
4199         (Target_i386::got_section): Create got_irelative_.
4200         (Target_i386::rel_irelative_section): New function.
4201         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
4202         fields.  Don't define __rel_iplt_{start,end}.
4203         (Output_data_plt_i386::add_entry): Add symtab and layout
4204         parameters.  Change all callers.  Use different PLT and GOT for
4205         IFUNC symbols.
4206         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
4207         layout parameters.  Change all callers.  Use different PLT and
4208         GOT.
4209         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
4210         (Output_data_plt_i386::rel_irelative): New function.
4211         (Output_data_plt_i386::address_for_global): New function.
4212         (Output_data_plt_i386::address_for_local): New function.
4213         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
4214         IRELATIVE GOT when changing IFUNC GOT entries.
4215         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
4216         reloc.
4217         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
4218         if we didn't create an IRELATIVE GOT.
4219         (Target_i386::Relocate::relocate): Use plt_address_for_global and
4220         plt_address_for_local.
4221         (Target_i386::do_dynsym_value): Use plt_address_for_global.
4222         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
4223         got_irelative_, and irelative_count_ fields.  Update
4224         declarations.
4225         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
4226         Initialize new fields.  Remove symtab parameter.  Change all
4227         callers.
4228         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
4229         irelative_count_.
4230         (Output_data_plt_x86_64::has_irelative_section): New function.
4231         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
4232         (class Target_x86_64): Add got_irelative_ and rel_irelative_
4233         fields.  Update declarations.
4234         (Target_x86_64::Target_x86_64): Initialize new fields.
4235         (Target_x86_64::do_plt_address_for_global): New function replacing
4236         do_plt_section_for_global.
4237         (Target_x86_64::do_plt_address_for_local): New function replacing
4238         do_plt_section_for_local.
4239         (Target_x86_64::got_section): Create got_irelative_.
4240         (Target_x86_64::rela_irelative_section): New function.
4241         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
4242         all callers.  Don't create __rel_iplt_{start,end}.
4243         (Output_data_plt_x86_64::add_entry): Add symtab and layout
4244         parameters.  Change all callers.  Use different PLT and GOT for
4245         IFUNC symbols.
4246         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
4247         layout parameters.  Change all callers.  Use different PLT and
4248         GOT.
4249         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
4250         parameters.  Change all callers.  Use different PLT and GOT for
4251         IFUNC symbols.
4252         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
4253         (Output_data_plt_x86_64::rela_irelative): New function.
4254         (Output_data_plt_x86_64::address_for_global): New function.
4255         (Output_data_plt_x86_64::address_for_local): New function.
4256         (Output_data_plt_x86_64::set_final_data_size): Likewise.
4257         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
4258         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
4259         (Target_x86_64::register_global_plt_entry): Add symtab and layout
4260         parameters.
4261         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
4262         reloc.
4263         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
4264         symbols if we didn't create an IRELATIVE GOT.
4265         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
4266         plt_address_for_local.
4267         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
4268         * testsuite/ifuncvar1.c: New test file.
4269         * testsuite/ifuncvar2.c: New test file.
4270         * testsuite/ifuncvar3.c: New test file.
4271         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
4272         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
4273         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
4274         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
4275         * testsuite/Makefile.in: Rebuild.
4276
4277 2011-07-07  Cary Coutant  <ccoutant@google.com>
4278
4279         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
4280         (two_file_test_1_ndebug.o): Likewise.
4281         (two_file_test_1b_ndebug.o): Likewise.
4282         (two_file_test_2_ndebug.o): Likewise.
4283         (two_file_test_main_ndebug.o): Likewise.
4284         (incremental_test_2): Link with no-debug versions.
4285
4286 2011-07-06  Cary Coutant  <ccoutant@google.com>
4287
4288         * gold/incremental.cc
4289         (Output_section_incremental_inputs::write_info_blocks): Check for
4290         hidden and internal symbols.
4291
4292 2011-07-06  Cary Coutant  <ccoutant@google.com>
4293
4294         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
4295         Check disposition for startup file.
4296         (Incremental_inputs::report_command_line): Ignore
4297         --incremental-startup-unchanged option.
4298         * options.cc (General_options::parse_incremental_startup_unchanged):
4299         New function.
4300         (General_options::General_options): Initialize new data member.
4301         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
4302         (General_options): Add --incremental-startup-unchanged option.
4303         (General_options::incremental_startup_disposition): New function.
4304         (General_options::incremental_startup_disposition_): New data member.
4305
4306 2011-07-06  Cary Coutant  <ccoutant@google.com>
4307
4308         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
4309         input file index to Script_info ctor.
4310         (Sized_incremental_binary::do_file_has_changed): Find the
4311         command-line argument for files named in scripts.
4312         * incremental.h (Script_info::Script_info): New ctor
4313         with input file index.
4314         (Script_info::input_file_index): New function.
4315         (Script_info::input_file_index_): New data member.
4316         (Incremental_binary::get_library): Add const.
4317         (Incremental_binary::get_script_info): Add const.
4318         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
4319         * testsuite/Makefile.am (incremental_test_5): New test case.
4320         (incremental_test_6): New test case.
4321         * testsuite/Makefile.in: Regenerate.
4322
4323 2011-07-06  Cary Coutant  <ccoutant@google.com>
4324
4325         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
4326         debug output when command lines differ.
4327
4328 2011-07-06  Cary Coutant  <ccoutant@google.com>
4329
4330         * incremental.cc (Incremental_inputs::report_command_line): Ignore
4331         --incremental-patch option.
4332         * layout.cc (Free_list::allocate): Extend allocation beyond original
4333         end if enabled.
4334         (Layout::make_output_section): Mark sections that should get
4335         patch space.
4336         * options.cc (parse_percent): New function.
4337         * options.h (parse_percent): New function.
4338         (DEFINE_percent): New macro.
4339         (General_options): Add --incremental-patch option.
4340         * output.cc (Output_section::Output_section): Initialize new data
4341         members.
4342         (Output_section::add_input_section): Print section name when out
4343         of patch space.
4344         (Output_section::add_output_section_data): Likewise.
4345         (Output_section::set_final_data_size): Add patch space when
4346         doing --incremental-full.
4347         (Output_section::do_reset_address_and_file_offset): Remove patch
4348         space.
4349         (Output_segment::set_section_list_addresses): Print debug output
4350         only if --incremental-update.
4351         * output.h (Output_section::set_is_patch_space_allowed): New function.
4352         (Output_section::is_patch_space_allowed_): New data member.
4353         (Output_section::patch_space_): New data member.
4354         * parameters.cc (Parameters::incremental_full): New function.
4355         * parameters.h (Parameters::incremental_full): New function
4356         * testsuite/Makefile.am (incremental_test_2): Add test for
4357         --incremental-patch option.
4358         * testsuite/Makefile.in: Regenerate.
4359         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
4360         (t18): Remove function body.
4361
4362 2011-07-05  Doug Kwan  <dougkwan@google.com>
4363
4364         PR gold/12771
4365         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
4366         Arm_Address type for relocation result.
4367         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
4368         overflow check.
4369         (Arm_relocate_functions::abs32): Use unaligned access.
4370         (Arm_relocate_functions::rel32): Ditto.
4371         (Arm_relocate_functions::prel31): Ditto.
4372         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
4373         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
4374         static data relocations.
4375         * testsuite/Makefile.in: Regnerate.
4376         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
4377
4378 2011-07-05  Ian Lance Taylor  <iant@google.com>
4379
4380         PR gold/12392
4381         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
4382         symbols if necessary.
4383         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
4384
4385 2011-07-05  Ian Lance Taylor  <iant@google.com>
4386
4387         PR gold/12952
4388         * resolve.cc (Symbol::override_base_with_special): Simply override
4389         version with special symbol version, ignoring previous version.
4390
4391 2011-07-05  Ian Lance Taylor  <iant@google.com>
4392
4393         * object.cc (Sized_relobj_file::include_section_group): Add
4394         information to comment about signature location.
4395
4396 2011-07-02  Ian Lance Taylor  <iant@google.com>
4397
4398         PR gold/12957
4399         * options.h (class General_options): Add -f and -F.
4400         * options.cc (General_options::finalize): Fatal error if -f/-F
4401         are used without -shared.
4402         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
4403
4404 2011-07-02  Ian Lance Taylor  <iant@google.com>
4405
4406         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
4407
4408 2011-07-01  Ian Lance Taylor  <iant@google.com>
4409
4410         PR gold/12525
4411         PR gold/12952
4412         * resolve.cc (Symbol::override_base_with_special): Don't override
4413         the version if the overriding symbol has a different name.
4414         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
4415         all callers.  If we give an error about an undefined version,
4416         define the base version if necessary.
4417         * dynobj.h (class Versions): Update declaration.
4418         * testsuite/weak_alias_test_5.cc: New file.
4419         * testsuite/weak_alias_test.script: New file.
4420         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
4421         and versioned_alias have the right value, and call t2.
4422         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
4423         weak_alias_test_5.so.
4424         (weak_alias_test_LDADD): Likewise.
4425         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
4426         * testsuite/Makefile.in: Rebuild.
4427
4428 2011-07-01  Ian Lance Taylor  <iant@google.com>
4429
4430         PR gold/12525
4431         * options.h (class General_options): Support -z notext.
4432         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
4433         -Wl,-z,notext.
4434         (two_file_shared_nonpic.so): Likewise.
4435         (two_file_shared_mixed.so): Likewise.
4436         (two_file_shared_mixed_1.so): Likewise.
4437         (weak_undef_lib_nonpic.so): Likewise.
4438         (alt/weak_undef_lib_nonpic.so): Likewise.
4439         (tls_test_shared_nonpic.so): Likewise.
4440         * testsuite/Makefile.in: Rebuild.
4441
4442 2011-07-01  Ian Lance Taylor  <iant@google.com>
4443
4444         PR gold/12525
4445         * configure.ac: Test whether static linking works, setting
4446         the automake conditional HAVE_STATIC.
4447         * testsuite/Makefile.am: Disable tests using -static if
4448         HAVE_STATIC is not true.
4449         * configure, testsuite/Makefile.in: Rebuild.
4450
4451 2011-07-01  Ian Lance Taylor  <iant@google.com>
4452
4453         PR gold/12525
4454         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
4455         Assert if we see DW_EH_PE_indirect.
4456         * target.h (Target::ehframe_datarel_base): New function.
4457         (Target::do_ehframe_datarel_base): New target function.
4458         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
4459         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
4460         function.
4461
4462 2011-07-01  Ian Lance Taylor  <iant@google.com>
4463
4464         PR gold/12571
4465         * options.h (class General_options): Add
4466         --ld-generated-unwind-info.
4467         * ehframe.cc (Fde::write): Add address parameter.  Change all
4468         callers.  If associated with PLT, fill in address and size.
4469         (Cie::set_output_offset): Only add merge mapping if there is an
4470         object.
4471         (Cie::write): Add address parameter.  Change all callers.
4472         (Eh_frame::add_ehframe_for_plt): New function.
4473         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
4474         input_offset_ fields into union u_, with new plt field.
4475         (Fde::Fde): Adjust for new union field.
4476         (Fde::Fde) [Output_data version]: New constructor.
4477         (Fde::add_mapping): Only add merge mapping if there is an object.
4478         (class Cie): Update declarations.
4479         (class Eh_frame): Declare add_ehframe_for_plt.
4480         * layout.cc (Layout::layout_eh_frame): Break out code into
4481         make_eh_frame_section, and call it.
4482         (Layout::make_eh_frame_section): New function.
4483         (Layout::add_eh_frame_for_plt): New function.
4484         * layout.h (class Layout): Update declarations.
4485         * merge.cc (Merge_map::add_mapping): Add assertion.
4486         * i386.cc: Include "dwarf.h".
4487         (class Output_data_plt_i386): Make first_plt_entry,
4488         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
4489         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
4490         and plt_eh_frame_fde.
4491         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
4492         boundary.  Call add_eh_frame_for_plt if appropriate.
4493         * x86_64.cc: Include "dwarf.h".
4494         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
4495         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
4496         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
4497         and plt_eh_frame_fde.
4498         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
4499         appropriate.
4500
4501 2011-06-29  Ian Lance Taylor  <iant@google.com>
4502
4503         PR gold/12629
4504         * object.cc (Sized_relobj_file::layout_section): Change shdr
4505         parameter to be const.
4506         (Sized_relobj_file::layout_eh_frame_section): New function, broken
4507         out of do_layout.
4508         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
4509         appropriate.  Call layout_eh_frame_section.
4510         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
4511         sections.
4512         * object.h (class Sized_relobj_file): Update declarations.
4513
4514 2011-06-29  Ian Lance Taylor  <iant@google.com>
4515
4516         PR gold/12652
4517         * script.cc (Token::integer_value): Accept trailing M/m/K/k
4518         modifier.
4519         (Lex::gather_token): Accept trailing M/m/K/k for integers.
4520
4521 2011-06-29  Ian Lance Taylor  <iant@google.com>
4522
4523         PR gold/12675
4524         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
4525         SHT_X86_64_UNWIND.
4526         * layout.cc (Layout::layout_eh_frame): Likewise.
4527
4528 2011-06-29  Ian Lance Taylor  <iant@google.com>
4529
4530         PR gold/12695
4531         * layout.cc (Layout::symtab_section_shndx): New function.
4532         * layout.h (class Layout): Declare symtab_section_shndx.
4533         * output.cc (Output_section::write_header): Call it.
4534
4535 2011-06-29  Ian Lance Taylor  <iant@google.com>
4536
4537         PR gold/12818
4538         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
4539         symbols which are not used in a relocation.
4540
4541 2011-06-28  Ian Lance Taylor  <iant@google.com>
4542
4543         PR gold/12898
4544         * layout.cc (Layout::segment_precedes): Don't crash if a linker
4545         script create indistinguishable segments.
4546         (Layout::set_segment_offsets): Use stable_sort when sorting
4547         segments.  Pass this to Compare_segments constructor.
4548         * layout.h (class Layout): Make segment_precedes non-static.
4549         (class Compare_segments): Change from struct to class.  Add
4550         layout_ field.  Add constructor.
4551         * script-sections.cc
4552         (Script_sections::attach_sections_using_phdrs_clause): Rename
4553         local orphan to is_orphan.  Don't report failure to put empty
4554         section in segment.  On attachment failure, report name of
4555         section, and attach to first PT_LOAD segment.
4556
4557 2011-06-28  Ian Lance Taylor  <iant@google.com>
4558
4559         PR gold/12934
4560         * target-select.cc (Target_selector::Target_selector): Add
4561         emulation parameter.  Change all callers.
4562         (select_target_by_bfd_name): Rename from select_target_by_name.
4563         Change all callers.
4564         (select_target_by_emulation): New function.
4565         (supported_emulation_names): New function.
4566         * target-select.h (class Target_selector): Add emulation_ field.
4567         Update declarations.
4568         (Target_selector::recognize_by_bfd_name): Rename from
4569         recognize_by_name.  Change all callers.
4570         (Target_selector::supported_bfd_names): Rename from
4571         supported_names.  Change all callers.
4572         (Target_selector::recognize_by_emulation): New function.
4573         (Target_selector::supported_emulations): New function.
4574         (Target_selector::emulation): New function.
4575         (Target_selector::do_recognize_by_bfd_name): Rename from
4576         do_recognize_by_name.  Change all callers.
4577         (Target_selector::do_supported_bfd_names): Rename from
4578         do_supported_names.  Change all callers.
4579         (Target_selector::do_recognize_by_emulation): New function.
4580         (Target_selector::do_supported_emulations): New function.
4581         (select_target_by_bfd_name): Change name in declaration.
4582         (select_target_by_emulation): Declare.
4583         (supported_emulation_names): Declare.
4584         * parameters.cc (parameters_force_valid_target): Try to find
4585         target based on emulation from -m option.
4586         * options.h (class General_options): Change doc string for -m.
4587         * options.cc (help): Print emulations.
4588         (General_options::parse_V): Likewise.
4589         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
4590         Add emulation parameter.  Change all callers.
4591
4592 2011-06-28  Ian Lance Taylor  <iant@google.com>
4593
4594         * target.h (class Target): Add osabi_ field.
4595         (Target::osabi): New function.
4596         (Target::set_osabi): New function.
4597         (Target::Target): Initialize osabi_.
4598         (Target::do_adjust_elf_header): Make pure virtual.
4599         (Sized_target::do_adjust_elf_header): Declare.
4600         * target.cc (Sized_target::do_adjust_elf_header): New function.
4601         (class Sized_target): Instantiate all versions.
4602         * freebsd.h (class Target_freebsd): Remove.
4603         (Target_selector_freebsd::do_recognize): Call set_osabi on
4604         Target.
4605         (Target_selector_freebsd::do_recognize_by_name): Likewise.
4606         (Target_selector_freebsd::set_osabi): Remove.
4607         * i386.cc (class Target_i386): Inherit from Sized_target rather
4608         than Target_freebsd.
4609         * x86_64.cc (class Target_x86_64): Likewise.
4610
4611 2011-06-28  Ian Lance Taylor  <iant@google.com>
4612
4613         * target.h (Target::can_check_for_function_pointers): Rewrite.
4614         Make non-virtual.
4615         (Target::can_icf_inline_merge_sections): Likewise.
4616         (Target::section_may_have_icf_unsafe_poineters): Likewise.
4617         (Target::Target_info): Add can_icf_inline_merge_sections field.
4618         (Target::do_can_check_for_function_pointers): New virtual
4619         function.
4620         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
4621         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
4622         from can_check_for_function_pointers, move in file.
4623         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
4624         section_may_have_icf_unsafe_poineters, move in file.
4625         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
4626         * i386.cc (Target_i386::do_can_check_for_function_pointers):
4627         Rename from can_check_for_function_pointers, move in file.
4628         (Target_i386::can_icf_inline_merge_sections): Remove.
4629         (Target_i386::i386_info): Initialize
4630         can_icf_inline_merge_sections.
4631         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
4632         Initialize can_icf_inline_merge_sections.
4633         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
4634         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
4635         Rename from can_check_for_function_pointers, move in file.
4636         (Target_x86_64::can_icf_inline_merge_sections): Remove.
4637         (Target_x86_64::x86_64_info): Initialize
4638         can_icf_inline_merge_sections.
4639         * testsuite/testfile.cc (Target_test::test_target_info):
4640         Likewise.
4641         * icf.cc (get_section_contents): Correct formatting.
4642
4643 2011-06-27  Ian Lance Taylor  <iant@google.com>
4644
4645         * symtab.cc (Symbol::versioned_name): New function.
4646         (Symbol_table::add_to_final_symtab): Use versioned_name when
4647         appropriate.
4648         (Symbol_table::sized_write_symbol): Likewise.
4649         * symtab.h (class Symbol): Declare versioned_name.
4650         * stringpool.h (class Stringpool_template): Add variant of add
4651         which takes a std::basic_string.
4652         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
4653         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
4654         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
4655         (ver_test_12.o): New target.
4656         * testsuite/Makefile.in: Rebuild.
4657
4658 2011-06-27  Doug Kwan  <dougkwan@google.com>
4659
4660         * arm.cc (Arm_relocate_functions::thm_jump8,
4661         Arm_relocate_functions::thm_jump11): Use a wider signed
4662         type to compute offset.
4663         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
4664         arm_thm_jump8.
4665         * testsuite/Makefile.in: Regenerate.
4666         * testsuite/arm_branch_in_range.sh: Check test results of
4667         arm_thm_jump11 and arm_thm_jump8.
4668         * testsuite/arm_thm_jump11.s: New test source file.
4669         * testsuite/arm_thm_jump11.t: New linker script.
4670         * testsuite/arm_thm_jump8.s: New test source file.
4671         * testsuite/arm_thm_jump8.t: New linker script.
4672
4673 2011-06-24  Ian Lance Taylor  <iant@google.com>
4674
4675         * layout.cc: Include "object.h".
4676         (ctors_sections_in_init_array): New static variable.
4677         (Layout::is_ctors_in_init_array): New function.
4678         (Layout::layout): Add entry to ctors_sections_in_init_array if
4679         appropriate.
4680         * layout.h (class Layout): Declare is_ctors_in_init_array.
4681         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
4682         is_ctors_reverse_view is set.
4683         (Sized_relobj_file::write_sections): Add layout parameter.  Change
4684         all callers.  Set is_ctors_reverse_view field of View_size.
4685         (Sized_relobj_file::reverse_words): New function.
4686         * object.h (Sized_relobj_file::View_size): Add
4687         is_ctors_reverse_view field.
4688         (class Sized_relobj_file): Update declarations.
4689         * testsuite/initpri3.c: New test.
4690         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
4691         initpri3b.
4692         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
4693         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
4694         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
4695         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
4696         * testsuite/Makefile.in: Rebuild.
4697
4698 2011-06-24  Cary Coutant  <ccoutant@google.com>
4699
4700         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
4701         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
4702         (debug_msg_cdebug.err): New targets.
4703         * testsuite/Makefile.in: Regenerate.
4704         * testsuite/debug_msg.sh: Check output of link with compressed debug.
4705         Fix checks for link with shared library.
4706
4707 2011-06-24  Doug Kwan  <dougkwan@google.com>
4708
4709         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
4710         skip empty text sections.
4711         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
4712
4713 2011-06-22  Ian Lance Taylor  <iant@google.com>
4714
4715         PR gold/12910
4716         * options.h (class General_options): Add --ctors-in-init-array.
4717         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
4718         friends as SHT_PROGBITS for merging sections.
4719         (Layout::layout): Remove special handling of .init_array and
4720         friends.  Don't sort if doing relocatable link.  Sort for .ctors
4721         and .dtors if ctors_in_init_array.
4722         (Layout::make_output_section): Force correct section types for
4723         .init_array and friends.  Don't sort if doing relocatable link,
4724         Don't sort .ctors and .dtors if ctors_in_init_array.
4725         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
4726         (Layout::output_section_name): Add relobj parameter.  Change all
4727         callers.  Handle .ctors. and .dtors. in code rather than table.
4728         Handle .ctors and .dtors if ctors_in_init_array.
4729         (Layout::match_file_name): New function, moved from output.cc.
4730         * layout.h (class Layout): Update declarations.
4731         * output.cc: Include "layout.h".
4732         (Input_section_sort_entry::get_priority): New function.
4733         (Input_section_sort_entry::match_file_name): Just call
4734         Layout::match_file_name.
4735         (Output_section::Input_section_sort_init_fini_compare::operator()):
4736         Handle .ctors and .dtors.  Sort by explicit priority rather than
4737         by name.
4738         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
4739         * testsuite/initpri2.c: New test.
4740         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
4741         (check_PROGRAMS): Add initpri2.
4742         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
4743         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
4744         * configure, testsuite/Makefile.in: Rebuild.
4745
4746 2011-06-19  Ian Lance Taylor  <iant@google.com>
4747
4748         PR gold/12880
4749         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
4750         .interp section to a PT_INTERP segment even if we have seen a
4751         --dynamic-linker option.  Don't do it if we have seen a PHDRS
4752         clause in a linker script.
4753         (Layout::finalize): Don't create a .interp section if we've
4754         already create a PT_INTERP segment.
4755         (Layout::create_interp): Always call choose_output_section (revert
4756         patch of 2011-06-17).  Don't create PT_INTERP segment.
4757         * script-sections.cc
4758         (Script_sections::create_note_and_tls_segments): Add a .interp
4759         section to a PT_INTERP segment even if we have seen a
4760         --dynamic-linker option.
4761
4762 2011-06-18  Ian Lance Taylor  <iant@google.com>
4763
4764         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
4765         merely because a non-PT_LOAD segment has a dynamic reloc.
4766
4767 2011-06-18  Ian Lance Taylor  <iant@google.com>
4768
4769         * layout.cc (Layout::finish_dynamic_section): Don't create
4770         DT_FLAGS entry if not needed.
4771
4772 2011-06-18  Ian Lance Taylor  <iant@google.com>
4773
4774         PR gold/12745
4775         * layout.cc (Layout::layout_eh_frame): Correct handling of
4776         writable .eh_frame section.
4777
4778 2011-06-17  Ian Lance Taylor  <iant@google.com>
4779
4780         PR gold/12893
4781         * resolve.cc (Symbol_table::resolve): Don't give an error if a
4782         symbol is redefined with the exact same object and value.
4783
4784 2011-06-17  Ian Lance Taylor  <iant@google.com>
4785
4786         PR gold/12880
4787         * layout.h (class Layout): Add interp_segment_ field.
4788         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
4789         (Layout::attach_allocated_section_to_segment): If making shared
4790         library, put .interp section in PT_INTERP segment.
4791         (Layout::finalize): Also call create_interp if -dynamic-linker
4792         option was used.
4793         (Layout::create_interp): Assert that there is no PT_INTERP
4794         segment.  If not using a SECTIONS clause, use make_output_section.
4795         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
4796         * script-sections.cc
4797         (Script_sections::create_note_and_tls_segments): If making shared
4798         library, put .interp section in PT_INTERP segment.
4799
4800 2011-06-17  Ian Lance Taylor  <iant@google.com>
4801
4802         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
4803         when making a shared library.
4804
4805 2011-06-17  Ian Lance Taylor  <iant@google.com>
4806
4807         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
4808         parameter.  Change all callers.  Don't issue warning about PC32
4809         against locally defined symbol.
4810
4811 2011-06-16  Ian Lance Taylor  <iant@google.com>
4812
4813         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
4814         occurs in same object.
4815
4816 2011-06-14  Alan Modra  <amodra@gmail.com>
4817
4818         * po/POTFILES.in: Regenerate.
4819
4820 2011-06-09  Ian Lance Taylor  <iant@google.com>
4821
4822         * script-sections.cc
4823         (Orphan_output_section::set_section_addresses): For a relocatable
4824         link set address to 0.
4825
4826 2011-06-09  Cary Coutant  <ccoutant@google.com>
4827
4828         PR gold/12804
4829         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
4830         used with --compress-debug-sections.
4831         * gold/object.cc (Sized_relobj_file::do_layout): Report
4832         uncompressed size of compressed input sections.
4833
4834 2011-06-08  Cary Coutant  <ccoutant@google.com>
4835
4836         PR gold/12804
4837         * testsuite/two_file_test_2_v1.cc: Change initialization of
4838         v2 to keep it in .data.
4839
4840 2011-06-07  Cary Coutant  <ccoutant@google.com>
4841
4842         * common.cc (Symbol_table::do_allocate_commons_list): Call
4843         gold_fallback.
4844         * errors.cc (Errors::fatal): Adjust call to gold_exit.
4845         (Errors::fallback): New function.
4846         (gold_fallback): New function.
4847         * errors.h (Errors::fallback): New function.
4848         * gold.cc (gold_exit): Change status parameter to enum; adjust
4849         all callers.
4850         (queue_initial_tasks): Call gold_fallback.
4851         * gold.h: Include cstdlib.
4852         (Exit_status): New enum type.
4853         (gold_exit): Change status parameter to enum.
4854         (gold_fallback): New function.
4855         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
4856         (Layout::create_symtab_sections): Likewise.
4857         (Layout::create_shdrs): Likewise.
4858         * main.cc (main): Adjust call to gold_exit.
4859         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
4860         (Output_data_got::add_got_entry_pair): Likewise.
4861         (Output_section::add_input_section): Likewise.
4862         (Output_section::add_output_section_data): Likewise.
4863         (Output_segment::set_section_list_addresses): Likewise.
4864         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
4865
4866 2011-06-07  Cary Coutant  <ccoutant@google.com>
4867
4868         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
4869         for incremental links.
4870         * output.cc (Output_segment::set_section_list_addresses): Remove
4871         FIXME and test for TLS or BSS.
4872
4873 2011-06-07  Cary Coutant  <ccoutant@google.com>
4874
4875         * testsuite/Makefile.am: Add incremental_copy_test,
4876         incremental_common_test_1.
4877         * testsuite/Makefile.in: Regenerate.
4878         * testsuite/common_test_1_v1.c: New source file.
4879         * testsuite/common_test_1_v2.c: New source file.
4880         * testsuite/copy_test_v1.cc: New source file.
4881
4882 2011-06-07  Cary Coutant  <ccoutant@google.com>
4883
4884         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
4885         update, allocate common from bss section's free list.
4886         * incremental-dump.cc (dump_incremental_inputs): Print flag for
4887         linker-defined symbols.
4888         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
4889         Skip GOT and PLT entries that are no longer referenced.
4890         (Output_section_incremental_inputs::write_info_blocks): Mark
4891         linker-defined symbols.
4892         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
4893         * output.cc (Output_section::allocate): New function.
4894         * output.h (Output_section::allocate): New function.
4895         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
4896         linker-defined symbols.
4897         (Symbol::override_base_with_special): Copy is_predefined_ flag.
4898         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
4899         (Symbol::init_base_output_data): Likewise.
4900         (Symbol::init_base_output_segment): Likewise.
4901         (Symbol::init_base_constant): Likewise.
4902         (Sized_symbol::init_output_data): Likewise.
4903         (Sized_symbol::init_output_segment): Likewise.
4904         (Sized_symbol::init_constant): Likewise.
4905         (Symbol_table::do_define_in_output_data): Likewise.
4906         (Symbol_table::do_define_in_output_segment): Likewise.
4907         (Symbol_table::do_define_as_constant): Likewise.
4908         * symtab.h (Symbol::is_predefined): New function.
4909         (Symbol::init_base_output_data): Add is_predefined parameter.
4910         (Symbol::init_base_output_segment): Likewise.
4911         (Symbol::init_base_constant): Likewise.
4912         (Symbol::is_predefined_): New data member.
4913         (Sized_symbol::init_output_data): Add is_predefined parameter.
4914         (Sized_symbol::init_output_segment): Likewise.
4915         (Sized_symbol::init_constant): Likewise.
4916         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
4917
4918 2011-06-07  Cary Coutant  <ccoutant@google.com>
4919
4920         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
4921         instead of emit_copy_reloc.
4922         (Copy_relocs::emit_copy_reloc): Refactor.
4923         (Copy_relocs::make_copy_reloc): New function.
4924         (Copy_relocs::add_copy_reloc): Remove.
4925         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
4926         section.
4927         (Copy_relocs::make_copy_reloc): New function.
4928         (Copy_relocs::add_copy_reloc): Remove.
4929         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
4930         unchanged input files.
4931         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
4932         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
4933         Reserve BSS space for COPY relocations.
4934         (Sized_incremental_binary::do_emit_copy_relocs): New function.
4935         (Output_section_incremental_inputs::write_info_blocks): Record
4936         whether a symbol is copied from a shared object.
4937         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
4938         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
4939         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
4940         (Incremental_input_entry_reader::get_output_symbol_index): Add
4941         is_copy parameter.
4942         (Incremental_binary::emit_copy_relocs): New function.
4943         (Incremental_binary::do_emit_copy_relocs): New function.
4944         (Sized_incremental_binary::Sized_incremental_binary): Initialize
4945         new data member.
4946         (Sized_incremental_binary::add_copy_reloc): New function.
4947         (Sized_incremental_binary::do_emit_copy_relocs): New function.
4948         (Sized_incremental_binary::Copy_reloc): New struct.
4949         (Sized_incremental_binary::Copy_relocs): New typedef.
4950         (Sized_incremental_binary::copy_relocs_): New data member.
4951         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
4952         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
4953         * target.h (Sized_target::emit_copy_reloc): New function.
4954         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
4955
4956 2011-06-02  Cary Coutant  <ccoutant@google.com>
4957
4958         PR gold/12163
4959         * gold/archive.cc (Archive::Archive): Initialize new data member.
4960         (Archive::include_all_members): Return if archive has already been
4961         included.
4962         * gold/archive.h (Archive::include_all_members_): New data member.
4963
4964 2011-06-02  Nick Clifton  <nickc@redhat.com>
4965
4966         * dynobj.h: Fix spelling mistake in comment.
4967         * output.cc: Likewise.
4968
4969 2011-05-31  Doug Kwan  <dougkwan@google.com>
4970             Asier Llano
4971
4972         PR gold/12826
4973         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
4974         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
4975         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
4976         redundant arm_exidx_test.so.
4977         * testsuite/Makefile.in: Regenerate.
4978         (check_SCRIPTS): Add pr12826.sh
4979         (check_DATA): Add pr12826.stdout
4980         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
4981         * testsuite/pr12826.sh: New file.
4982         * testsuite/pr12826_1.s: Ditto.
4983         * testsuite/pr12826_1.s: Ditto.
4984
4985 2011-05-30  Ian Lance Taylor  <iant@google.com>
4986
4987         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
4988         sections.
4989
4990 2011-05-29  Ian Lance Taylor  <iant@google.com>
4991
4992         PR gold/12804
4993         * testsuite/Makefile.am: Use different file name for two_file_test
4994         temporary file for each incremental test.
4995         * testsuite/Makefile.in: Rebuild.
4996
4997 2011-05-29  Ian Lance Taylor  <iant@google.com>
4998
4999         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
5000         binary input file is empty.
5001
5002 2011-05-27  Ian Lance Taylor  <iant@google.com>
5003
5004         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
5005         (ver_test_9.so): Likewise.
5006         * testsuite/Makefile.in: Rebuild.
5007
5008 2011-05-26 Cary Coutant  <ccoutant@google.com>
5009
5010         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
5011         * incremental.cc (Incremental_inputs::report_input_section): Fix
5012         comment, indentation.
5013         (Incremental_inputs::report_comdat_group): New function.
5014         (Output_section_incremental_inputs::set_final_data_size): Adjust size
5015         of data for incremental input file entry.
5016         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
5017         group count, COMDAT group signatures.
5018         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
5019         an unchanged input file.
5020         * incremental.h (Incremental_object_entry::Incremental_object_entry):
5021         Initialize new data member.
5022         (Incremental_object_entry::add_comdat_group): New function.
5023         (Incremental_object_entry::get_comdat_group_count): New function.
5024         (Incremental_object_entry::get_comdat_signature_key): New function.
5025         (Incremental_object_entry::groups_): New data member.
5026         (Incremental_inputs::report_comdat_group): New function.
5027         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
5028         data for incremental input file entry.
5029         (Incremental_input_entry_reader::get_comdat_group_count): New function.
5030         (Incremental_input_entry_reader::get_input_section): Adjust size of
5031         data for incremental input file entry.
5032         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
5033         (Incremental_input_entry_reader::get_comdat_group_signature): New
5034         function.
5035         * object.cc (Sized_relobj::include_section_group): Report kept
5036         COMDAT groups for incremental links.
5037
5038 2011-05-24  David Meyer  <pdox@google.com>
5039
5040         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
5041         with name parameter.  Add found_name parameter.
5042         * fileread.cc (Input_file::find_file): Adjust code accordingly.
5043         * dirsearch.h (class Dirsearch): Update declaration.
5044
5045 2011-05-24  Ian Lance Taylor  <iant@google.com>
5046
5047         * archive.cc (Library_base::should_include_member): Pull in object
5048         from archive if it defines the entry symbol.
5049         * parameters.cc (Parameters::entry): New function.
5050         * parameters.h (class Parameters): Declare entry.
5051         * output.h (class Output_file_header): Remove entry_ field.
5052         * output.cc (Output_file_header::Output_file_header): Remove entry
5053         parameter.  Change all callers.
5054         (Output_file_header::entry): Use parameters->entry.
5055         * gold.cc (queue_middle_tasks): Likewise.
5056         * plugin.cc (Plugin_hook::run): Likewise.
5057
5058 2011-05-24 Cary Coutant  <ccoutant@google.com>
5059
5060         * gold.cc (queue_initial_tasks): Pass incremental base filename
5061         to Output_file::open_base_file; don't print error message.
5062         * incremental-dump.cc (main): Adjust call to
5063         Output_file::open_for_modification.
5064         * incremental-dump.cc (main): Likewise.
5065         * incremental.cc (Incremental_inputs::report_command_line):
5066         Ignore --incremental-base option when comparing command lines.
5067         Ignore parameter when given as separate argument.
5068         * options.h (class General_options): Add --incremental-base.
5069         * output.cc (Output_file::Output_file):
5070         (Output_file::open_base_file): Add base_name and writable parameters;
5071         read base file into new file; print error message here.
5072         (Output_file::map_no_anonymous): Add writable parameter; adjust all
5073         callers.
5074         * output.h (Output_file::open_for_modification): Rename to...
5075         (Output_file::open_base_file): ...this; add base_name and
5076         writable parameters; adjust all callers.
5077         (Output_file::map_no_anonymous): Add writable parameter; adjust all
5078         callers.
5079         * testsuite/Makefile.am (incremental_test_4): Test
5080         --incremental-base.
5081         * testsuite/Makefile.in: Regenerate.
5082
5083 2011-05-24 Cary Coutant  <ccoutant@google.com>
5084
5085         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
5086         incremental_test_4.
5087         * testsuite/Makefile.in: Regenerate.
5088         * testsuite/two_file_test_1_v1.cc: New test source file.
5089         * testsuite/two_file_test_1b_v1.cc: New test source file.
5090         * testsuite/two_file_test_2_v1.cc: New test source file.
5091
5092 2011-05-24 Cary Coutant  <ccoutant@google.com>
5093
5094         * dynobj.h (Dynobj::do_dynobj): New function.
5095         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
5096         flag and soname for shared objects.
5097         * incremental.cc (Incremental_inputs::report_object): Make
5098         either Incremental_object_entry or Incremental_dynobj_entry; add
5099         soname to string table.
5100         (Incremental_inputs::report_input_section): Add assertion.
5101         (Output_section_incremental_inputs::set_final_data_size): Adjust
5102         type of input file entry for shared libraries; adjust size of
5103         shared library info entry.
5104         (Output_section_incremental_inputs::write_input_files): Write
5105         as_needed flag for shared libraries.
5106         (Output_section_incremental_inputs::write_info_blocks): Adjust type
5107         of input file entry for shared libraries; write soname.
5108         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
5109         soname from incremental info.
5110         * incremental.h (enum Incremental_input_flags): Add
5111         INCREMENTAL_INPUT_AS_NEEDED.
5112         (Incremental_input_entry::Incremental_input_entry): Initialize new
5113         data member.
5114         (Incremental_input_entry::set_as_needed): New function.
5115         (Incremental_input_entry::as_needed): New function.
5116         (Incremental_input_entry::do_dynobj_entry): New function.
5117         (Incremental_input_entry::as_needed_): New data member.
5118         (Incremental_object_entry::Incremental_object_entry): Don't check
5119         for shared library.
5120         (Incremental_object_entry::do_type): Likewise.
5121         (class Incremental_dynobj_entry): New class.
5122         (Incremental_input_entry_reader::as_needed): New function.
5123         (Incremental_input_entry_reader::get_soname): New function.
5124         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
5125         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
5126         size of shared library info entry.
5127         * layout.cc (Layout::finish_dynamic_section): Don't test for
5128         incremental link when adding DT_NEEDED entries.
5129         * object.h (Object::Object): Initialize new data member.
5130         (Object::dynobj): New function.
5131         (Object::set_as_needed): New function.
5132         (Object::as_needed): New function.
5133         (Object::do_dynobj): New function.
5134         (Object::as_needed_): New data member.
5135
5136 2011-05-24 Cary Coutant  <ccoutant@google.com>
5137
5138         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
5139         info; adjust display of GOT entries.
5140         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
5141         vector of input objects; remove file_status_.
5142         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
5143         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
5144         got_plt reader; call target hooks to reserve GOT entries.
5145         (Output_section_incremental_inputs::set_final_data_size): Adjust size
5146         of input file info header and GOT info entry.
5147         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
5148         relocation info.
5149         (Got_plt_view_info::got_descriptor): Remove.
5150         (Got_plt_view_info::sym_index): New data member.
5151         (Got_plt_view_info::input_index): New data member.
5152         (Local_got_offset_visitor::visit): Write input file index.
5153         (Global_got_offset_visitor::visit): Write 0 for input file index.
5154         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
5155         with sym_index and input_index.
5156         (Output_section_incremental_inputs::write_got_plt): Adjust size of
5157         incremental info GOT entry; replace got_descriptor with input_index.
5158         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
5159         map from input file index to object.
5160         (Sized_relobj_incr::do_layout): Replace direct data member reference
5161         with accessor function.
5162         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
5163         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
5164         Adjust size of input file info header.
5165         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
5166         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
5167         (Incremental_input_entry_reader::get_input_section): Adjust size of
5168         input file info header.
5169         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
5170         of incremental info GOT entry.
5171         (Incremental_got_plt_reader::get_got_desc): Remove.
5172         (Incremental_got_plt_reader::get_got_symndx): New function.
5173         (Incremental_got_plt_reader::get_got_input_index): New function.
5174         (Sized_incremental_binary::Sized_incremental_binary): Remove
5175         file_status_; add input_objects_.
5176         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
5177         (Sized_incremental_binary::set_file_is_unchanged): Remove.
5178         (Sized_incremental_binary::file_is_unchanged): Remove.
5179         (Sized_incremental_binary::set_input_object): New function.
5180         (Sized_incremental_binary::input_object): New function.
5181         (Sized_incremental_binary::file_status_): Remove.
5182         (Sized_incremental_binary::input_objects_): New data member.
5183         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
5184         references.
5185         (Sized_relobj_incr::invalid_address): Move to base class.
5186         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
5187         class.
5188         (Sized_relobj_incr::do_output_section_offset): Likewise.
5189         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
5190         (Sized_relobj_incr::section_offsets_): Likewise.
5191         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
5192         function.
5193         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
5194         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
5195         with accessor function.
5196         (Sized_relobj_file::do_layout): Likewise.
5197         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
5198         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
5199         (Sized_relobj_file::compute_final_local_value): Replace refs to
5200         section_offsets_ with accessor function.
5201         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
5202         * object.h (Relobj::Relobj): Initialize new data members.
5203         (Relobj::add_dyn_reloc): New function.
5204         (Relobj::first_dyn_reloc): New function.
5205         (Relobj::dyn_reloc_count): New function.
5206         (Relobj::first_dyn_reloc_): New data member.
5207         (Relobj::dyn_reloc_count_): New data member.
5208         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
5209         references.
5210         (Sized_relobj::Address): New typedef.
5211         (Sized_relobj::invalid_address): Move here from child class.
5212         (Sized_relobj::Sized_relobj): Initialize new data members.
5213         (Sized_relobj::sized_relobj): New function.
5214         (Sized_relobj::is_output_section_offset_invalid): Move here from
5215         child class.
5216         (Sized_relobj::get_output_section_offset): Likewise.
5217         (Sized_relobj::local_has_got_offset): Likewise.
5218         (Sized_relobj::local_got_offset): Likewise.
5219         (Sized_relobj::set_local_got_offset): Likewise.
5220         (Sized_relobj::do_for_all_local_got_entries): Likewise.
5221         (Sized_relobj::clear_got_offsets): New function.
5222         (Sized_relobj::section_offsets): Move here from child class.
5223         (Sized_relobj::do_output_section_offset): Likewise.
5224         (Sized_relobj::do_set_section_offset): Likewise.
5225         (Sized_relobj::Local_got_offsets): Likewise.
5226         (Sized_relobj::local_got_offsets_): Likewise.
5227         (Sized_relobj::section_offsets_): Likewise.
5228         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
5229         references.
5230         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
5231         class.
5232         (Sized_relobj_file::sized_relobj): New function
5233         (Sized_relobj_file::local_has_got_offset): Move to base class.
5234         (Sized_relobj_file::local_got_offset): Likewise.
5235         (Sized_relobj_file::set_local_got_offset): Likewise.
5236         (Sized_relobj_file::get_output_section_offset): Likewise.
5237         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
5238         (Sized_relobj_file::do_output_section_offset): Likewise.
5239         (Sized_relobj_file::do_set_section_offset): Likewise.
5240         (Sized_relobj_file::Local_got_offsets): Likewise.
5241         (Sized_relobj_file::local_got_offsets_): Likewise.
5242         (Sized_relobj_file::section_offsets_): Likewise.
5243         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
5244         (all constructors).
5245         (set_needs_dynsym_index): Convert relobj to derived class pointer.
5246         (Output_reloc::get_symbol_index): Likewise.
5247         (Output_reloc::local_section_offset): Likewise.
5248         (Output_reloc::get_address): Likewise.
5249         (Output_reloc::symbol_value): Likewise.
5250         (Output_data_got::reserve_slot): Move to class definition.
5251         (Output_data_got::reserve_local): New function.
5252         (Output_data_got::reserve_slot_for_global): Remove.
5253         (Output_data_got::reserve_global): New function.
5254         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
5255         (all constructors, two instantiations).
5256         (Output_reloc::get_relobj): New function (two instantiations).
5257         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
5258         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
5259         (Output_data_reloc::add_global): Adjust type of relobj.
5260         (Output_data_reloc::add_global_relative): Likewise.
5261         (Output_data_reloc::add_symbolless_global_addend): Likewise.
5262         (Output_data_reloc::add_local): Likewise.
5263         (Output_data_reloc::add_local_relative): Likewise.
5264         (Output_data_reloc::add_symbolless_local_addend): Likewise.
5265         (Output_data_reloc::add_local_section): Likewise.
5266         (Output_data_reloc::add_output_section): Likewise.
5267         (Output_data_reloc::add_absolute): Likewise.
5268         (Output_data_reloc::add_target_specific): Likewise.
5269         (Output_data_got::reserve_slot): Move definition here.
5270         (Output_data_got::reserve_local): New function.
5271         (Output_data_got::reserve_global): New function.
5272         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
5273         section_offsets_ with accessor function.
5274         (Sized_relobj_file::write_sections): Likewise.
5275         (Sized_relobj_file::do_relocate_sections): Likewise.
5276         * target.h (Sized_target::reserve_local_got_entry): New function.
5277         (Sized_target::reserve_global_got_entry): New function.
5278         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
5279         (Target_x86_64::reserve_global_got_entry): New function.
5280         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
5281
5282 2011-05-23 Cary Coutant  <ccoutant@google.com>
5283
5284         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
5285         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
5286         bit when checking got_type.
5287         * incremental.cc (Sized_incremental_binary::setup_readers):
5288         Store symbol table and string table locations; initialize bit vector
5289         of file status flags.
5290         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
5291         unchanged files.
5292         (Sized_incremental_binary::do_process_got_plt): New function.
5293         (Sized_incremental_binary::get_symtab_view): Use stored locations.
5294         (Output_section_incremental_inputs::set_final_data_size): Record
5295         file index for each input file.
5296         (Output_section_incremental_inputs::write_got_plt): Store file index
5297         instead of input entry offset for each GOT entry.
5298         * incremental.h
5299         (Incremental_input_entry::Incremental_input_entry): Initialize new
5300         data member.
5301         (Incremental_input_entry::set_offset): Store file index.
5302         (Incremental_input_entry::get_file_index): New function.
5303         (Incremental_input_entry::file_index_): New data member.
5304         (Incremental_binary::process_got_plt): New function.
5305         (Incremental_binary::do_process_got_plt): New function.
5306         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
5307         data members.
5308         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
5309         (Sized_incremental_binary::set_file_is_unchanged): New function.
5310         (Sized_incremental_binary::file_is_unchanged): New function.
5311         (Sized_incremental_binary::do_process_got_plt): New function.
5312         (Sized_incremental_binary::file_status_): New data member.
5313         (Sized_incremental_binary::main_symtab_loc_): New data member.
5314         (Sized_incremental_binary::main_strtab_loc_): New data member.
5315         * output.cc (Output_data_got::Got_entry::write): Add case
5316         RESERVED_CODE.
5317         (Output_data_got::add_global): Call add_got_entry.
5318         (Output_data_got::add_global_plt): Likewise.
5319         (Output_data_got::add_global_with_rel): Likewise.
5320         (Output_data_got::add_global_with_rela): Likewise.
5321         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
5322         (Output_data_got::add_global_pair_with_rela): Likewise.
5323         (Output_data_got::add_local): Call add_got_entry.
5324         (Output_data_got::add_local_plt): Likewise.
5325         (Output_data_got::add_local_with_rel): Likewise.
5326         (Output_data_got::add_local_with_rela): Likewise.
5327         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
5328         (Output_data_got::add_local_pair_with_rela): Likewise.
5329         (Output_data_got::reserve_slot): New function.
5330         (Output_data_got::reserve_slot_for_global): New function.
5331         (Output_data_got::add_got_entry): New function.
5332         (Output_data_got::add_got_entry_pair): New function.
5333         (Output_section::add_output_section_data): Edit FIXME.
5334         * output.h
5335         (Output_section_data_build::Output_section_data_build): New
5336         constructor with size parameter.
5337         (Output_data_space::Output_data_space): Likewise.
5338         (Output_data_got::Output_data_got): Initialize new data member; new
5339         constructor with size parameter.
5340         (Output_data_got::add_constant): Call add_got_entry.
5341         (Output_data_got::reserve_slot): New function.
5342         (Output_data_got::reserve_slot_for_global): New function.
5343         (class Output_data_got::Got_entry): Add RESERVED_CODE.
5344         (Output_data_got::add_got_entry): New function.
5345         (Output_data_got::add_got_entry_pair): New function.
5346         (Output_data_got::free_list_): New data member.
5347         * target.h (Sized_target::init_got_plt_for_update): New function.
5348         (Sized_target::register_global_plt_entry): New function.
5349         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
5350         Initialize new data member; call init; add constructor with PLT count.
5351         (Output_data_plt_x86_64::init): New function.
5352         (Output_data_plt_x86_64::add_relocation): New function.
5353         (Output_data_plt_x86_64::reserve_slot): New function.
5354         (Output_data_plt_x86_64::free_list_): New data member.
5355         (Target_x86_64::init_got_plt_for_update): New function.
5356         (Target_x86_64::register_global_plt_entry): New function.
5357         (Output_data_plt_x86_64::add_entry): Allocate from free list for
5358         incremental updates.
5359         (Output_data_plt_x86_64::add_relocation): New function.
5360         * testsuite/object_unittest.cc (Object_test): Set default options.
5361
5362 2011-05-16  Ian Lance Taylor  <iant@google.com>
5363
5364         * options.h (class General_options): Make -i a synonym for -r.
5365
5366 2011-05-16  Ian Lance Taylor  <iant@google.com>
5367
5368         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
5369
5370 2011-05-10 Cary Coutant  <ccoutant@google.com>
5371
5372         * object.cc (Sized_relobj::do_count_local_symbols): Check for
5373         strip_all (-s).
5374
5375 2011-05-06  Ian Lance Taylor  <iant@google.com>
5376
5377         * layout.cc (Layout::layout): If the output section flags change,
5378         update the ordering.
5379
5380 2011-04-25 Cary Coutant  <ccoutant@google.com>
5381
5382         * incremental-dump.cc (dump_incremental_inputs): Print local
5383         symbol info for each input file.
5384         * incremental.cc
5385         (Output_section_incremental_inputs::set_final_data_size): Add local
5386         symbol info to input file entries in incremental info.
5387         (Output_section_incremental_inputs::write_info_blocks): Likewise.
5388         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
5389         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
5390         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
5391         implementation.
5392         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
5393         (Sized_incr_relobj::do_relocate): Write the local symbols.
5394         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
5395         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
5396         Adjust size of input file header.
5397         (Incremental_inputs_reader::get_local_symbol_offset): New function.
5398         (Incremental_inputs_reader::get_local_symbol_count): New function.
5399         (Incremental_inputs_reader::get_input_section): Adjust size of input
5400         file header.
5401         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
5402         (Sized_incr_relobj::This): New typedef.
5403         (Sized_incr_relobj::sym_size): New const data member.
5404         (Sized_incr_relobj::Local_symbol): New struct.
5405         (Sized_incr_relobj::do_output_local_symbol_count): New function.
5406         (Sized_incr_relobj::do_local_symbol_offset): New function.
5407         (Sized_incr_relobj::local_symbol_count_): New data member.
5408         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
5409         (Sized_incr_relobj::local_symbol_index_): New data member.
5410         (Sized_incr_relobj::local_symbol_offset_): New data member.
5411         (Sized_incr_relobj::local_dynsym_offset_): New data member.
5412         (Sized_incr_relobj::local_symbols_): New data member.
5413         * object.h (Relobj::output_local_symbol_count): New function.
5414         (Relobj::local_symbol_offset): New function.
5415         (Relobj::do_output_local_symbol_count): New function.
5416         (Relobj::do_local_symbol_offset): New function.
5417         (Sized_relobj::do_output_local_symbol_count): New function.
5418         (Sized_relobj::do_local_symbol_offset): New function.
5419
5420 2011-04-22  Vladimir Simonov  <sv@sw.ru>
5421
5422         * descriptors.cc (set_close_on_exec): New function.
5423         (Descriptors::open): Use set_close_on_exec.
5424         * output.cc (S_ISLNK): Define if not defined.
5425
5426 2011-04-22 Cary Coutant  <ccoutant@google.com>
5427
5428         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
5429         global symbol map.
5430         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
5431         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
5432         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
5433         relocations.
5434         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
5435         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
5436         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
5437         * incremental.h
5438         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
5439         function.
5440         (Incremental_binary::apply_incremental_relocs): New function.
5441         (Incremental_binary::do_apply_incremental_relocs): New function.
5442         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
5443         data member.
5444         (Sized_incremental_binary::add_global_symbol): New function.
5445         (Sized_incremental_binary::global_symbol): New function.
5446         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
5447         (Sized_incremental_binary::symbol_map_): New data member.
5448         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
5449         * target.h (Sized_target::apply_relocation): New function.
5450         * target-reloc.h (apply_relocation): New function.
5451         * x86_64.cc (Target_x86_64::apply_relocation): New function.
5452
5453 2011-04-22  Doug Kwan  <dougkwan@google.com>
5454
5455         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
5456         flag of a SHT_ARM_EXIDX section.
5457         * testsuite/Makefile.am (arm_exidx_test): New test rules.
5458         * testsuite/Makefile.in: Regenerate.
5459         * testsuite/arm_exidx_test.s: New file.
5460         * testsuite/arm_exidx_test.sh: Same.
5461
5462 2011-04-20 Cary Coutant  <ccoutant@google.com>
5463
5464         PR gold/12689
5465         * archive.h (Incremental_archive_entry::Archive_member):
5466         Initialize arg_serial_ (second constructor).
5467
5468 2011-04-17  Ian Lance Taylor  <iant@google.com>
5469
5470         * object.cc (Relocate_info::location): Simplify location string.
5471         * errors.cc (Errors::error_at_location): Don't print program
5472         name.
5473         (Errors::warning_at_location): Likewise.
5474         (Errors::undefined_symbol): Likewise.
5475         * testsuite/debug_msg.sh: Update accordingly.
5476
5477 2011-04-14 Cary Coutant  <ccoutant@google.com>
5478
5479         * gold/layout.cc (Layout::symtab_section_offset): New function.
5480         * gold/layout.h (Layout::symtab_section_offset): New function.
5481         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
5482
5483 2011-04-12  Ian Lance Taylor  <iant@google.com>
5484
5485         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
5486         with MREMAP_MAYMOVE.
5487         * output.h (class Output_file): Add map_is_allocated_ field.
5488         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
5489         not available, provide stubs.  If mremap is not available, #define
5490         it to gold_mremap.
5491         (MREMAP_MAYMOVE): Define if not defined.
5492         (Output_file::Output_file): Initialize map_is_allocated_.
5493         (Output_file::resize): Check map_is_allocated_.
5494         (Output_file::map_anonymous): If mmap fails, use malloc.
5495         (Output_file::unmap): Don't do anything for an anonymous map.
5496         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
5497         is not available, provide stubs.
5498         (File_read::View::~View): Use free rather than delete[].
5499         (File_read::make_view): Use malloc rather than new[].  If mmap
5500         fails, use malloc.
5501         (File_read::find_or_make_view): Use malloc rather than new[].
5502         * gold.h: Remove HAVE_REMAP code.
5503         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
5504         exists.  Rename mremap to gold_mremap.  If mmap is not available
5505         don't do anything.
5506         * configure, config.in: Rebuild.
5507
5508 2011-04-11  Ian Lance Taylor  <iant@google.com>
5509
5510         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
5511         initialize local variable v.
5512
5513 2011-04-11  Cary Coutant  <ccoutant@google.com>
5514
5515         * archive.cc (Archive::include_member): Adjust call to
5516         report_object.
5517         (Add_archive_symbols::run): Track argument serial numbers.
5518         (Lib_group::include_member): Likewise.
5519         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
5520         * archive.h (Incremental_archive_entry::Archive_member):
5521         Initialize arg_serial_.
5522         (Archive_member::arg_serial_): New data member.
5523         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
5524         (Sized_dynobj::do_add_symbols): Track symbols when doing an
5525         incremental link.
5526         (Sized_dynobj::do_for_all_local_got_entries): New function.
5527         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
5528         function.
5529         * fileread.cc (get_mtime): New function.
5530         * fileread.h (get_mtime): New function.
5531         * gold.cc (queue_initial_tasks): Check for incremental update.
5532         (process_incremental_input): New function.
5533         (queue_middle_tasks): Don't force valid target for incremental
5534         update.
5535         * incremental-dump.cc (find_input_containing_global): Adjust
5536         size of symbol info entry.
5537         (dump_incremental_inputs): Dump argument serial number and
5538         in_system_directory flag; bias shndx by 1; print symbol names
5539         when dumping per-file symbol lists; use new symbol info readers.
5540         * incremental.cc
5541         (Output_section_incremental_inputs:update_data_size): New function.
5542         (Sized_incremental_binary::setup_readers): Setup input readers
5543         for each input file; build maps for files added from libraries
5544         and scripts.
5545         (Sized_incremental_binary::check_input_args): New function.
5546         (Sized_incremental_binary::do_check_inputs): Build map of argument
5547         serial numbers to input arguments.
5548         (Sized_incremental_binary::do_file_has_changed): Rename
5549         do_file_is_unchanged to this; compare file modification times.
5550         (Sized_incremental_binary::do_init_layout): New function.
5551         (Sized_incremental_binary::do_reserve_layout): New function.
5552         (Sized_incremental_binary::do_get_input_reader): Remove.
5553         (Sized_incremental_binary::get_symtab_view): New function.
5554         (Incremental_checker::can_incrementally_link_output_file): Remove.
5555         (Incremental_inputs::report_command_line): Exclude --debug options.
5556         (Incremental_inputs::report_archive_begin): Add parameter; track
5557         argument serial numbers; don't put input file entry for archive
5558         before archive members.
5559         (Incremental_inputs::report_archive_end): Put input file entry
5560         for archive after archive members.
5561         (Incremental_inputs::report_object): Add parameter; track argument
5562         serial numbers and in_system_directory flag.
5563         (Incremental_inputs::report_script): Add parameter; track argument
5564         serial numbers.
5565         (Output_section_incremental_inputs::set_final_data_size): Adjust
5566         size of symbol info entry; check for forwarding symbols.
5567         (Output_section_incremental_inputs::write_input_files): Write
5568         in_system_directory flag and argument serial number.
5569         (Output_section_incremental_inputs::write_info_blocks): Map section
5570         indices between incremental info and original input file; store
5571         input section index for each symbol.
5572         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
5573         change operator() to visit().
5574         (class Global_got_offset_visitor): Likewise.
5575         (class Global_symbol_visitor_got_plt):
5576         (Output_section_incremental_inputs::write_got_plt): Use new visitor
5577         classes.
5578         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
5579         (Sized_incr_relobj::do_read_symbols): New function.
5580         (Sized_incr_relobj::do_layout): New function.
5581         (Sized_incr_relobj::do_layout_deferred_sections): New function.
5582         (Sized_incr_relobj::do_add_symbols): New function.
5583         (Sized_incr_relobj::do_should_include_member): New function.
5584         (Sized_incr_relobj::do_for_all_global_symbols): New function.
5585         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
5586         (Sized_incr_relobj::do_section_size): New function.
5587         (Sized_incr_relobj::do_section_name): New function.
5588         (Sized_incr_relobj::do_section_contents): New function.
5589         (Sized_incr_relobj::do_section_flags): New function.
5590         (Sized_incr_relobj::do_section_entsize): New function.
5591         (Sized_incr_relobj::do_section_address): New function.
5592         (Sized_incr_relobj::do_section_type): New function.
5593         (Sized_incr_relobj::do_section_link): New function.
5594         (Sized_incr_relobj::do_section_info): New function.
5595         (Sized_incr_relobj::do_section_addralign): New function.
5596         (Sized_incr_relobj::do_initialize_xindex): New function.
5597         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
5598         (Sized_incr_relobj::do_read_relocs): New function.
5599         (Sized_incr_relobj::do_gc_process_relocs): New function.
5600         (Sized_incr_relobj::do_scan_relocs): New function.
5601         (Sized_incr_relobj::do_count_local_symbols): New function.
5602         (Sized_incr_relobj::do_finalize_local_symbols): New function.
5603         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
5604         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
5605         (Sized_incr_relobj::do_relocate): New function.
5606         (Sized_incr_relobj::do_set_section_offset): New function.
5607         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
5608         (Sized_incr_dynobj::do_read_symbols): New function.
5609         (Sized_incr_dynobj::do_layout): New function.
5610         (Sized_incr_dynobj::do_add_symbols): New function.
5611         (Sized_incr_dynobj::do_should_include_member): New function.
5612         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
5613         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
5614         (Sized_incr_dynobj::do_section_size): New function.
5615         (Sized_incr_dynobj::do_section_name): New function.
5616         (Sized_incr_dynobj::do_section_contents): New function.
5617         (Sized_incr_dynobj::do_section_flags): New function.
5618         (Sized_incr_dynobj::do_section_entsize): New function.
5619         (Sized_incr_dynobj::do_section_address): New function.
5620         (Sized_incr_dynobj::do_section_type): New function.
5621         (Sized_incr_dynobj::do_section_link): New function.
5622         (Sized_incr_dynobj::do_section_info): New function.
5623         (Sized_incr_dynobj::do_section_addralign): New function.
5624         (Sized_incr_dynobj::do_initialize_xindex): New function.
5625         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
5626         (make_sized_incremental_object): New function.
5627         (Incremental_library::copy_unused_symbols): New function.
5628         (Incremental_library::do_for_all_unused_symbols): New function.
5629         * incremental.h (enum Incremental_input_flags): New type.
5630         (class Incremental_checker): Remove.
5631         (Incremental_input_entry::Incremental_input_entry): Add argument
5632         serial number.
5633         (Incremental_input_entry::arg_serial): New function.
5634         (Incremental_input_entry::set_is_in_system_directory): New function.
5635         (Incremental_input_entry::is_in_system_directory): New function.
5636         (Incremental_input_entry::arg_serial_): New data member.
5637         (Incremental_input_entry::is_in_system_directory_): New data member.
5638         (class Script_info): Move here from script.h.
5639         (Script_info::Script_info): Add filename parameter.
5640         (Script_info::filename): New function.
5641         (Script_info::filename_): New data member.
5642         (Incremental_script_entry::Incremental_script_entry): Add argument
5643         serial number.
5644         (Incremental_object_entry::Incremental_object_entry): Likewise.
5645         (Incremental_object_entry::add_input_section): Build list of input
5646         sections with map to original shndx.
5647         (Incremental_object_entry::get_input_section_index): New function.
5648         (Incremental_object_entry::shndx_): New data member.
5649         (Incremental_object_entry::name_key_): Rename; adjust all refs.
5650         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
5651         (Incremental_archive_entry::Incremental_archive_entry): Add argument
5652         serial number.
5653         (Incremental_inputs::report_archive_begin): Likewise.
5654         (Incremental_inputs::report_object): Likewise.
5655         (Incremental_inputs::report_script): Likewise.
5656         (class Incremental_global_symbol_reader): New class.
5657         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
5658         and store flags and input file type.
5659         (Incremental_input_entry_reader::arg_serial): New function.
5660         (Incremental_input_entry_reader::type): Extract type from flags.
5661         (Incremental_input_entry_reader::is_in_system_directory): New function.
5662         (Incremental_input_entry_reader::get_input_section_count): Call
5663         accessor function for type.
5664         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
5665         function for type; adjust size of global symbol entry.
5666         (Incremental_input_entry_reader::get_global_symbol_count): Call
5667         accessor function for type.
5668         (Incremental_input_entry_reader::get_object_count): Likewise.
5669         (Incremental_input_entry_reader::get_object_offset): Likewise.
5670         (Incremental_input_entry_reader::get_member_count): Likewise.
5671         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
5672         (Incremental_input_entry_reader::get_member_offset): Likewise.
5673         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
5674         (Incremental_input_entry_reader::Global_symbol_info): Remove.
5675         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
5676         (Incremental_input_entry_reader::get_global_symbol_reader): New
5677         function.
5678         (Incremental_input_entry_reader::get_output_symbol_index): New
5679         function.
5680         (Incremental_input_entry_reader::type_): Remove.
5681         (Incremental_input_entry_reader::flags_): New data member.
5682         (Incremental_inputs_reader::input_file_offset): New function.
5683         (Incremental_inputs_reader::input_file_index): New function.
5684         (Incremental_inputs_reader::input_file): Call input_file_offset.
5685         (Incremental_inputs_reader::input_file_at_offset): New function.
5686         (Incremental_relocs_reader::get_r_type): Reformat.
5687         (Incremental_relocs_reader::get_r_shndx): Reformat.
5688         (Incremental_relocs_reader::get_r_offset): Reformat.
5689         (Incremental_relocs_reader::data): New function.
5690         (Incremental_binary::Incremental_binary): Initialize new data members.
5691         (Incremental_binary::check_inputs): Add cmdline parameter.
5692         (Incremental_binary::file_is_unchanged): Remove.
5693         (Input_reader::arg_serial): New function.
5694         (Input_reader::get_unused_symbol_count): New function.
5695         (Input_reader::get_unused_symbol): New function.
5696         (Input_reader::do_arg_serial): New function.
5697         (Input_reader::do_get_unused_symbol_count): New function.
5698         (Input_reader::do_get_unused_symbol): New function.
5699         (Incremental_binary::input_file_count): New function.
5700         (Incremental_binary::get_input_reader): Change signature to use
5701         index instead of filename.
5702         (Incremental_binary::file_has_changed): New function.
5703         (Incremental_binary::get_input_argument): New function.
5704         (Incremental_binary::get_library): New function.
5705         (Incremental_binary::get_script_info): New function.
5706         (Incremental_binary::init_layout): New function.
5707         (Incremental_binary::reserve_layout): New function.
5708         (Incremental_binary::output_file): New function.
5709         (Incremental_binary::do_check_inputs): New function.
5710         (Incremental_binary::do_file_is_unchanged): Remove.
5711         (Incremental_binary::do_file_has_changed): New function.
5712         (Incremental_binary::do_init_layout): New function.
5713         (Incremental_binary::do_reserve_layout): New function.
5714         (Incremental_binary::do_input_file_count): New function.
5715         (Incremental_binary::do_get_input_reader): Change signature.
5716         (Incremental_binary::input_args_map_): New data member.
5717         (Incremental_binary::library_map_): New data member.
5718         (Incremental_binary::script_map_): New data member.
5719         (Sized_incremental_binary::Sized_incremental_binary): Initialize
5720         new data members.
5721         (Sized_incremental_binary::output_section): New function.
5722         (Sized_incremental_binary::inputs_reader): Add const.
5723         (Sized_incremental_binary::symtab_reader): Add const.
5724         (Sized_incremental_binary::relocs_reader): Add const.
5725         (Sized_incremental_binary::got_plt_reader): Add const.
5726         (Sized_incremental_binary::get_symtab_view): New function.
5727         (Sized_incremental_binary::Inputs_reader): New typedef.
5728         (Sized_incremental_binary::Input_entry_reader): New typedef.
5729         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
5730         (Sized_incremental_binary::do_file_is_unchanged): Remove.
5731         (Sized_incremental_binary::do_file_has_changed): New function.
5732         (Sized_incremental_binary::do_init_layout): New function.
5733         (Sized_incremental_binary::do_reserve_layout): New function.
5734         (Sized_input_reader::Inputs_reader): Remove.
5735         (Sized_input_reader::Input_entry_reader): Remove.
5736         (Sized_input_reader::do_arg_serial): New function.
5737         (Sized_input_reader::do_get_unused_symbol_count): New function.
5738         (Sized_input_reader::do_get_unused_symbol): New function.
5739         (Sized_incremental_binary::do_input_file_count): New function.
5740         (Sized_incremental_binary::do_get_input_reader): Change signature;
5741         use index instead of filename.
5742         (Sized_incremental_binary::section_map_): New data member.
5743         (Sized_incremental_binary::input_entry_readers_): New data member.
5744         (class Sized_incr_relobj): New class.
5745         (class Sized_incr_dynobj): New class.
5746         (make_sized_incremental_object): New function.
5747         (class Incremental_library): New class.
5748         * layout.cc (Free_list::num_lists): New static data member.
5749         (Free_list::num_nodes): New static data member.
5750         (Free_list::num_removes): New static data member.
5751         (Free_list::num_remove_visits): New static data member.
5752         (Free_list::num_allocates): New static data member.
5753         (Free_list::num_allocate_visits): New static data member.
5754         (Free_list::init): New function.
5755         (Free_list::remove): New function.
5756         (Free_list::allocate): New function.
5757         (Free_list::dump): New function.
5758         (Free_list::print_stats): New function.
5759         (Layout_task_runner::run): Resize output file for incremental updates.
5760         (Layout::Layout): Initialize new data members.
5761         (Layout::set_incremental_base): New function.
5762         (Layout::init_fixed_output_section): New function.
5763         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
5764         incremental updates.
5765         (Layout::create_gold_note): Do not create gold note section for
5766         incremental updates.
5767         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
5768         for incremental updates.
5769         (Layout::set_section_offsets): For incremental updates, allocate space
5770         from free list.
5771         (Layout::create_symtab_sections): Layout with offsets relative to
5772         start of section; for incremental updates, allocate space from free
5773         list.
5774         (Layout::create_shdrs): For incremental updates, allocate space from
5775         free list.
5776         (Layout::finish_dynamic_section): For incremental updates, do not
5777         check --as-needed (fixed in subsequent patch).
5778         * layout.h (class Free_list): New class.
5779         (Layout::set_incremental_base): New function.
5780         (Layout::incremental_base): New function.
5781         (Layout::init_fixed_output_section): New function.
5782         (Layout::allocate): New function.
5783         (Layout::incremental_base_): New data member.
5784         (Layout::free_list_): New data member.
5785         * main.cc (main): Print Free_list statistics.
5786         * object.cc (Relobj::finalize_incremental_relocs): Add
5787         clear_counts parameter; clear counts only when clear_counts is set.
5788         (Sized_relobj::Sized_relobj): Initialize new base class.
5789         (Sized_relobj::do_layout): Don't report special sections.
5790         (Sized_relobj::do_for_all_local_got_entries): New function.
5791         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
5792         symtab_off to all symbol table offsets.
5793         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
5794         * object.h (class Got_offset_list): Move to top of file.
5795         (Object::Object): Allow case where input_file == NULL.
5796         (Object::~Object): Likewise.
5797         (Object::input_file): Assert that input_file != NULL.
5798         (Object::lock): Allow case where input_file == NULL.
5799         (Object::unlock): Likewise.
5800         (Object::is_locked): Likewise.
5801         (Object::token): Likewise.
5802         (Object::release): Likewise.
5803         (Object::is_incremental): New function.
5804         (Object::get_mtime): New function.
5805         (Object::for_all_local_got_entries): New function.
5806         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
5807         (Object::set_is_in_system_directory): New function.
5808         (Object::is_in_system_directory): New function.
5809         (Object::do_is_incremental): New function.
5810         (Object::do_get_mtime): New function.
5811         (Object::do_for_all_local_got_entries): New function.
5812         (Object::is_in_system_directory_): New data member.
5813         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
5814         (class Sized_relobj_base): New class.
5815         (class Sized_relobj): Derive from Sized_relobj_base.
5816         (class Sized_relobj::Symbols): Redeclare from base class.
5817         (class Sized_relobj::local_got_offset_list): Remove.
5818         (class Sized_relobj::Output_sections): Redeclare from base class.
5819         (class Sized_relobj::do_for_all_local_got_entries): New function.
5820         (class Sized_relobj::write_local_symbols): Add offset parameter.
5821         (class Sized_relobj::local_symbol_offset_): Update comment.
5822         (class Sized_relobj::local_dynsym_offset_): Update comment.
5823         * options.cc (Input_arguments::add_file): Remove const.
5824         * options.h (Input_file_argument::Input_file_argument):
5825         Initialize arg_serial_ (all constructors).
5826         (Input_file_argument::set_arg_serial): New function.
5827         (Input_file_argument::arg_serial): New function.
5828         (Input_file_argument::arg_serial_): New data member.
5829         (Input_arguments::Input_arguments): Initialize file_count_.
5830         (Input_arguments::add_file): Remove const.
5831         (Input_arguments::number_of_input_files): New function.
5832         (Input_arguments::file_count_): New data member.
5833         (Command_line::number_of_input_files): Call
5834         Input_arguments::number_of_input_files.
5835         * output.cc (Output_segment_headers::Output_segment_headers):
5836         Set current size.
5837         (Output_section::Input_section::current_data_size): New function.
5838         (Output_section::Output_section): Initialize new data members.
5839         (Output_section::add_input_section): Don't do merge sections for
5840         an incremental link; allocate space from free list for an
5841         incremental update.
5842         (Output_section::add_output_section_data): Allocate space from
5843         free list for an incremental update.
5844         (Output_section::update_data_size): New function.
5845         (Output_section::set_fixed_layout): New function.
5846         (Output_section::reserve): New function.
5847         (Output_segment::set_section_addresses): Remove const.
5848         (Output_segment::set_section_list_addresses): Remove const; allocate
5849         space from free list for an incremental update.
5850         (Output_segment::set_offset): Adjust size of RELRO segment for an
5851         incremental update.
5852         * output.h (Output_data::current_data_size): Move here from
5853         child classes.
5854         (Output_data::pre_finalize_data_size): New function.
5855         (Output_data::update_data_size): New function.
5856         (Output_section_headers::update_data_size): new function.
5857         (Output_section_data_build::current_data_size): Move to Output_data.
5858         (Output_data_strtab::update_data_size): New function.
5859         (Output_section::current_data_size): Move to Output_data.
5860         (Output_section::set_fixed_layout): New function.
5861         (Output_section::has_fixed_layout): New function.
5862         (Output_section::reserve): New function.
5863         (Output_section::update_data_size): New function.
5864         (Output_section::has_fixed_layout_): New data member.
5865         (Output_section::free_list_): New data member.
5866         (Output_segment::set_section_addresses): Remove const.
5867         (Output_segment::set_section_list_addresses): Remove const.
5868         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
5869         New function.
5870         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
5871         New function.
5872         * readsyms.cc (Read_symbols::do_read_symbols): Add library
5873         parameter when calling Add_symbols constructor; store argument
5874         serial number for members of a lib group.
5875         (Add_symbols::locks): Allow case where token == NULL.
5876         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
5877         (Read_member::~Read_member): New function.
5878         (Read_member::is_runnable): New function.
5879         (Read_member::locks): New function.
5880         (Read_member::run): New function.
5881         (Check_script::~Check_script): New function.
5882         (Check_script::is_runnable): New function.
5883         (Check_script::locks): New function.
5884         (Check_script::run): New function.
5885         (Check_library::~Check_library): New function.
5886         (Check_library::is_runnable): New function.
5887         (Check_library::locks): New function.
5888         (Check_library::run): New function.
5889         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
5890         (Add_symbols::library_): New data member.
5891         (class Read_member): New class.
5892         (class Check_script): New class.
5893         (class Check_library): New class.
5894         * reloc.cc (Read_relocs::is_runnable): Allow case where
5895         token == NULL.
5896         (Read_relocs::locks): Likewise.
5897         (Scan_relocs::locks): Likewise.
5898         (Relocate_task::locks): Likewise.
5899         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
5900         to clear counters.
5901         (Sized_relobj::incremental_relocs_scan): Fix comment.
5902         (Sized_relobj::do_relocate): Pass output file offset to
5903         write_local_symbols.
5904         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
5905         from class declaration.
5906         * script.cc (read_input_script): Allocate Script_info; pass
5907         argument serial number to report_script.
5908         * script.h (class Script_info): Move to incremental.h.
5909         * symtab.cc (Symbol_table::add_from_incrobj): New function.
5910         * symtab.h (Symbol_table::add_from_incrobj): New function.
5911         (Symbol_table::set_file_offset): New function.
5912
5913 2011-04-05  Cary Coutant  <ccoutant@google.com>
5914
5915         * incremental-dump.cc (dump_incremental_inputs): Change signature
5916         to take a Sized_incremental_binary; change caller.  Use readers
5917         in Sized_incremental_binary.
5918         * incremental.cc
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::do_check_inputs): Check
5923         has_incremental_info_ flag; move setup code to setup_readers;
5924         use input readers.
5925         (Sized_incremental_binary::do_file_is_unchanged): New function.
5926         (Sized_incremental_binary::do_get_input_reader): New function.
5927         * incremental.h (class Incremental_binary): Move to end of file.
5928         (Incremental_binary::file_is_unchanged): New function.
5929         (Incremental_binary::do_file_is_unchanged): New function.
5930         (Incremental_binary::Input_reader): New class.
5931         (Incremental_binary::get_input_reader): New function.
5932         (class Sized_incremental_binary): Move to end of file.
5933         (Sized_incremental_binary::Sized_incremental_binary): Setup the
5934         input section reader classes.
5935         (Sized_incremental_binary::has_incremental_info): New function.
5936         (Sized_incremental_binary::inputs_reader): New function.
5937         (Sized_incremental_binary::symtab_reader): New function.
5938         (Sized_incremental_binary::relocs_reader): New function.
5939         (Sized_incremental_binary::got_plt_reader): New function.
5940         (Sized_incremental_binary::do_file_is_unchanged): New function.
5941         (Sized_incremental_binary::Sized_input_reader): New class.
5942         (Sized_incremental_binary::get_input_reader): New function.
5943         (Sized_incremental_binary::find_incremental_inputs_sections):
5944         Rename do_find_incremental_inputs_sections to this.
5945         (Sized_incremental_binary::setup_readers): New function.
5946         (Sized_incremental_binary::has_incremental_info_): New data member.
5947         (Sized_incremental_binary::inputs_reader_): New data member.
5948         (Sized_incremental_binary::symtab_reader_): New data member.
5949         (Sized_incremental_binary::relocs_reader_): New data member.
5950         (Sized_incremental_binary::got_plt_reader_): New data member.
5951         (Sized_incremental_binary::current_input_file_): New data member.
5952
5953 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
5954
5955         PR gold/12640
5956         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
5957         violation.
5958
5959 2011-03-30  Cary Coutant  <ccoutant@google.com>
5960
5961         * archive.cc (Archive::include_member): Adjust call to report_object.
5962         (Add_archive_symbols::run): Add script_info to call to
5963         report_archive_begin.
5964         (Lib_group::include_member): Adjust call to report_object.
5965         (Add_lib_group_symbols::run): Adjust call to report_object.
5966         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
5967         blocks.  Add object count for script input files.
5968         * incremental.cc (Incremental_inputs::report_archive_begin): Add
5969         script_info parameter; change all callers.
5970         (Incremental_inputs::report_object): Add script_info parameter;
5971         change all callers.
5972         (Incremental_inputs::report_script): Store backpointer to
5973         incremental info entry.
5974         (Output_section_incremental_inputs::set_final_data_size): Record
5975         additional information for scripts.
5976         (Output_section_incremental_inputs::write_info_blocks): Likewise.
5977         * incremental.h (Incremental_script_entry::add_object): New function.
5978         (Incremental_script_entry::get_object_count): New function.
5979         (Incremental_script_entry::get_object): New function.
5980         (Incremental_script_entry::objects_): New data member; adjust
5981         constructor.
5982         (Incremental_inputs::report_archive_begin): Add script_info parameter.
5983         (Incremental_inputs::report_object): Add script_info parameter.
5984         (Incremental_inputs_reader::get_object_count): New function.
5985         (Incremental_inputs_reader::get_object_offset): New function.
5986         * options.cc (Input_arguments::add_file): Return reference to
5987         new input argument.
5988         * options.h (Input_argument::set_script_info): New function.
5989         (Input_argument::script_info): New function.
5990         (Input_argument::script_info_): New data member; adjust all
5991         constructors.
5992         (Input_file_group::add_file): Return reference to new input argument.
5993         (Input_file_lib::add_file): Likewise.
5994         (Input_arguments::add_file): Likewise.
5995         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
5996         * script.cc (Parser_closure::Parser_closure): Add script_info
5997         parameter; adjust all callers.
5998         (Parser_closure::script_info): New function.
5999         (Parser_closure::script_info_): New data member.
6000         (read_input_script): Report scripts earlier to incremental info.
6001         (script_add_file): Set script_info in Input_argument.
6002         (script_add_library): Likewise.
6003         * script.h (Script_options::Script_info): Rewrite class.
6004
6005 2011-03-29  Cary Coutant  <ccoutant@google.com>
6006
6007         * archive.cc (Library_base::should_include_member): Move
6008         method here from class Archive.
6009         (Archive::Archive): Initialize base class.
6010         (Archive::should_include_member): Move to base class.
6011         (Archive::do_for_all_unused_symbols): New function.
6012         (Add_archive_symbols::run): Remove redundant access to
6013         incremental_inputs.
6014         (Lib_group::Lib_group): Initialize base class.
6015         (Lib_group::do_filename): New function.
6016         (Lib_group::include_member): Pass pointer to Lib_group to
6017         report_object.
6018         (Lib_group::do_for_all_unused_symbols): New function.
6019         (Add_lib_group_symbols::run): Report archive information for
6020         incremental links.
6021         * archive.h (class Library_base): New base class.
6022         (class Archive): Derive from Library_base.
6023         (Archive::filename): Move to base class.
6024         (Archive::set_incremental_info): Likewise.
6025         (Archive::incremental_info): Likewise.
6026         (Archive::Should_include): Likewise.
6027         (Archive::should_include_member): Likewise.
6028         (Archive::Armap_entry): Remove.
6029         (Archive::Unused_symbol_iterator): Remove.
6030         (Archive::unused_symbols_begin): Remove.
6031         (Archive::unused_symbols_end): Remove.
6032         (Archive::do_filename): New function.
6033         (Archive::do_get_mtime): New function.
6034         (Archive::do_for_all_unused_symbols): New function.
6035         (Archive::task_): Move to base class.
6036         (Archive::incremental_info_): Likewise.
6037         (class Lib_group): Derive from Library_base.
6038         (Lib_group::do_filename): New function.
6039         (Lib_group::do_get_mtime): New function.
6040         (Lib_group::do_for_all_unused_symbols): New function.
6041         (Lib_group::task_): Move to base class.
6042         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
6043         function.
6044         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
6045         function.
6046         * incremental.cc (Incremental_inputs::report_archive_begin):
6047         Use Library_base; call library's get_mtime; add incremental inputs
6048         entry before members.
6049         (class Unused_symbol_visitor): New class.
6050         (Incremental_inputs::report_archive_end): Use Library_base; use
6051         visitor class to record unused symbols; don't add incremental inputs
6052         entry after members.
6053         (Incremental_inputs::report_object): Use Library_base.
6054         * incremental.h
6055         (Incremental_archive_entry::Incremental_archive_entry): Remove
6056         unused Archive parameter.
6057         (Incremental_inputs::report_archive_begin): Use Library_base.
6058         (Incremental_inputs::report_archive_end): Likewise.
6059         (Incremental_inputs::report_object): Likewise.
6060         * object.cc (Sized_relobj::do_for_all_global_symbols): New
6061         function.
6062         * object.h (Object::for_all_global_symbols): New function.
6063         (Object::do_for_all_global_symbols): New function.
6064         (Sized_relobj::do_for_all_global_symbols): New function.
6065         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
6066         function.
6067         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
6068         function.
6069
6070 2011-03-27  Ian Lance Taylor  <iant@google.com>
6071
6072         * archive.cc (Archive::interpret_header): Return -1 if something
6073         goes wrong.  Change callers accordingly.
6074
6075 2011-03-25  Cary Coutant  <ccoutant@google.com>
6076
6077         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
6078         * testsuite/Makefile.in: Regenerate.
6079
6080 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
6081
6082         * plugin.cc (get_view): New.
6083         (Plugin::load): Pass get_view to the plugin.
6084         (Plugin_manager::get_view): New.
6085
6086 2011-03-21  Ian Lance Taylor  <iant@google.com>
6087
6088         * testsuite/final_layout.sh: Rewrite to not use dc.
6089         * testsuite/relro_test.sh: Fail if dc is not present.
6090
6091 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
6092
6093         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
6094         Change == to -eq.
6095         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
6096         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
6097         Change == to -eq.
6098         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
6099         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
6100
6101 2011-03-14  Ian Lance Taylor  <iant@google.com>
6102
6103         * script-sections.cc (Sort_output_sections::script_compare):
6104         Rename from is_before, change return type.
6105         (Sort_output_sections::operator()): Adjust accordingly.
6106
6107 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
6108
6109         PR gold/12572
6110         * testsuite/odr_violation2.cc: Add comment to make all error line
6111         numbers double digits.
6112         * testsuite/debug_msg.sh: Adjust expected errors.
6113
6114 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
6115
6116         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
6117         but mark earlier ones as non-canonical
6118         (offset_to_iterator): Update search target and example
6119         (do_addr2line): Return extra lines in a vector*
6120         (format_file_lineno): Extract from do_addr2line
6121         (one_addr2line): Add vector* out-param
6122         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
6123         when a lineno entry appeared last for its instruction
6124         (Dwarf_line_info): Add vector* out-param
6125         * object.cc (Relocate_info): Pass NULL for the vector* out-param
6126         * symtab.cc (Odr_violation_compare): Include the lineno in the
6127         comparison again.
6128         (linenos_from_loc): New. Combine the canonical line for an
6129         address with its other lines.
6130         (True_if_intersect): New. Helper functor to make
6131         std::set_intersection a query.
6132         (detect_odr_violations): Compare sets of lines instead of just
6133         one line for each function. This became less deterministic, but
6134         has fewer false positives.
6135         * symtab.h: Declarations.
6136         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
6137         mix an optimized and non-optimized object in the same binary
6138         (odr_violation2.so): Same.
6139         * testsuite/Makefile.in: Regenerate from Makefile.am.
6140         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
6141         * testsuite/debug_msg.sh: Update line numbers and add
6142         assertions.
6143         * testsuite/odr_violation1.cc: Use OdrDerived, in a
6144         non-optimized context.
6145         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
6146         isn't inlined, and use OdrDerived in an optimized context.
6147         * testsuite/odr_header1.h: Defines OdrDerived, where
6148         optimization will change the
6149         first-instruction-in-the-destructor's file and line number.
6150         * testsuite/odr_header2.h: Defines OdrBase.
6151
6152 2011-03-09  Ian Lance Taylor  <iant@google.com>
6153
6154         * fileread.cc (File_read::clear_views): Don't delete the whole
6155         file view.
6156
6157 2011-03-08  Ian Lance Taylor  <iant@google.com>
6158
6159         PR gold/12525
6160         * fileread.cc: #include <climits>.
6161         (GOLD_IOV_MAX): Define.
6162         (File_read::read_multiple): Limit number of entries by iov_max.
6163         * fileread.h (class File_read): Always set max_readv_entries to
6164         128.
6165
6166 2011-03-07  Ian Lance Taylor  <iant@google.com>
6167
6168         PR gold/12525
6169         * options.h (class General_options): Add -dy and -dn.
6170
6171 2011-03-02  Cary Coutant  <ccoutant@google.com>
6172
6173         * testsuite/script_test_9.t: Add TLS segment.
6174
6175 2011-03-02  Simon Baldwin  <simonb@google.com>
6176
6177         * configure.ac: Add check for gnu_indirect_function support in
6178         the toolchain building binutils.
6179         * configure: Rebuild.
6180
6181 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
6182
6183         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
6184         plugin only symbols.
6185         (Symbol_table::sized_finalize_symbol) Mark symbol only present
6186         in plugin files as not needed in the symbol table.
6187
6188 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
6189
6190         * output.cc (Output_section::add_input_section): Delay fill
6191         generation for section ordering.
6192
6193 2011-02-09  Ian Lance Taylor  <iant@google.com>
6194
6195         PR gold/12316
6196         * object.h (class Sized_relobj): Remove clear_local_symbols.
6197         * reloc.cc (Sized_relobj::do_relocate): Don't call
6198         clear_local_symbols.
6199
6200 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
6201
6202         * plugin.cc (is_visible_from_outside): Return true for symbols
6203         in the -u option.
6204
6205 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
6206
6207         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
6208         filename.
6209
6210 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
6211
6212         * icf.h (is_section_foldable_candidate): Change type of parameter
6213         to std::string.
6214         * icf.cc (Icf::find_identical_sections): Change type of local variable
6215         section_name to be std::string.
6216         (is_function_ctor_or_dtor): Change type of parameter to std::string.
6217
6218 2011-01-25  Ian Lance Taylor  <iant@google.com>
6219
6220         * script.cc (script_add_extern): Rewrite to use
6221         add_symbol_reference.
6222
6223 2011-01-25  Doug Kwan  <dougkwan@google.com>
6224
6225         * icf.cc (get_section_contents): Always lock section's object.
6226
6227 2011-01-24  Ian Lance Taylor  <iant@google.com>
6228
6229         * options.h (class General_options): Accept
6230         --no-detect-odr-violations.
6231
6232 2011-01-24  Ian Lance Taylor  <iant@google.com>
6233
6234         * version.cc (version_string): Bump to 1.11.
6235
6236 2011-01-24  Ian Lance Taylor  <iant@google.com>
6237
6238         * plugin.cc (class Plugin_rescan): Define new class.
6239         (Plugin_manager::claim_file): Set any_claimed_.
6240         (Plugin_manager::save_archive): New function.
6241         (Plugin_manager::save_input_group): New function.
6242         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
6243         necessary.
6244         (Plugin_manager::new_undefined_symbol): New function.
6245         (Plugin_manager::rescan): New function.
6246         (Plugin_manager::rescannable_defines): New function.
6247         (Plugin_manager::add_input_file): Set any_added_.
6248         * plugin.h (class Plugin_manager): define new fields rescannable_,
6249         undefined_symbols_, any_claimed_, and any_added_.  Declare
6250         Plugin_rescan as friend.  Declare new functions.
6251         (Plugin_manager::Rescannable): Define type.
6252         (Plugin_manager::Rescannable_list): Define type.
6253         (Plugin_manager::Undefined_symbol_list): Define type.
6254         (Plugin_manager::Plugin_manager): Initialize new fields.
6255         * archive.cc (Archive::defines_symbol): New function.
6256         (Add_archive_symbols::run): Pass archive to plugins if any.
6257         * archive.h (class Archive): Declare defines_symbol.
6258         * readsyms.cc (Input_group::~Input_group): New function.
6259         (Finish_group::run): Pass input_group to plugins if any.
6260         * readsyms.h (class Input_group): Declare destructor.
6261         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
6262         any.
6263
6264 2011-01-10  Ian Lance Taylor  <iant@google.com>
6265
6266         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
6267         section as relro.
6268         (Layout::set_segment_offsets): Reset increase_relro before calling
6269         set_section_addresses a second time.
6270
6271 2011-01-04  Cary Coutant  <ccoutant@google.com>
6272
6273         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
6274         sections before NOBITS sections.
6275
6276 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
6277
6278         * version.cc (print_version): Update copyright to 2011.
6279
6280 2010-12-23  Cary Coutant  <ccoutant@google.com>
6281
6282         * output.h (Output_data_reloc::add_output_section): Pass OD instead
6283         of OS to this->add.  Add OD parameter to second form of the function.
6284
6285 2010-12-20  Ian Lance Taylor  <iant@google.com>
6286
6287         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
6288         second of two consecutive entries with same offset.
6289
6290 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6291
6292         * testsuite/Makefile.am (ifuncmain2static_LDADD)
6293         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
6294         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
6295         to avoid unneeded links against $(LDADD).
6296         * testsuite/Makefile.in: Regenerate.
6297
6298 2010-12-15  Ian Lance Taylor  <iant@google.com>
6299
6300         PR gold/12324
6301         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
6302         for R_X86_64_32 and R_X86_64_PC32.
6303         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
6304         ver_matching_def_pic.o.
6305         (ver_matching_def_pic.o): New target.
6306
6307 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6308
6309         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
6310         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
6311         Move definition before File_read::View member definitions.
6312         (File_read::View::~View): Initialize and hold lock before
6313         updating current_mapped_bytes.
6314
6315 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6316
6317         * dwarf_reader.cc: Remove outdated comment.
6318         * gold-threads.cc: Fix typo in error message.
6319         * archive.cc: Fix typos in comments.
6320         * archive.h: Likewise.
6321         * arm-reloc-property.cc: Likewise.
6322         * arm-reloc-property.h: Likewise.
6323         * arm-reloc.def: Likewise.
6324         * arm.cc: Likewise.
6325         * attributes.h: Likewise.
6326         * cref.cc: Likewise.
6327         * ehframe.cc: Likewise.
6328         * fileread.h: Likewise.
6329         * gold.h: Likewise.
6330         * i386.cc: Likewise.
6331         * icf.cc: Likewise.
6332         * incremental.h: Likewise.
6333         * int_encoding.cc: Likewise.
6334         * layout.h: Likewise.
6335         * main.cc: Likewise.
6336         * merge.h: Likewise.
6337         * object.cc: Likewise.
6338         * object.h: Likewise.
6339         * options.cc: Likewise.
6340         * readsyms.cc: Likewise.
6341         * reduced_debug_output.cc: Likewise.
6342         * reloc.cc: Likewise.
6343         * script-sections.cc: Likewise.
6344         * sparc.cc: Likewise.
6345         * symtab.h: Likewise.
6346         * target-reloc.h: Likewise.
6347         * target.cc: Likewise.
6348         * target.h: Likewise.
6349         * timer.cc: Likewise.
6350         * timer.h: Likewise.
6351         * x86_64.cc: Likewise.
6352
6353 2010-12-09  Cary Coutant  <ccoutant@google.com>
6354
6355         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
6356         stack.
6357         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
6358         parameter; change all callers.
6359         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
6360         * options.h (warn_execstack): New option.
6361
6362 2010-12-07  Doug Kwan  <dougkwan@google.com>
6363
6364         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
6365         like function call relocations.
6366
6367 2010-12-07  Ian Lance Taylor  <iant@google.com>
6368
6369         * archive.cc (Archive::get_elf_object_for_member): Permit
6370         punconfigured to be NULL.
6371         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
6372         (Archive::include_member): Pass NULL to get_elf_object_for_member
6373         if we searched for the archive and this is the first included
6374         object.
6375
6376 2010-12-01  Ian Lance Taylor  <iant@google.com>
6377
6378         * dwarf_reader.h (class Sized_dwarf_line_info): Add
6379         track_relocs_type_ field.
6380         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
6381         Set track_relocs_type_.
6382         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
6383         contents when using RELA relocs.
6384         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
6385         reloc_map_.
6386         * reloc.cc (Track_relocs::next_addend): New function.
6387         * reloc.h (class Track_relocs): Declare next_addend.
6388
6389 2010-12-01  Ian Lance Taylor  <iant@google.com>
6390
6391         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
6392         virtual destructor.
6393
6394 2010-12-01  Ian Lance Taylor  <iant@google.com>
6395
6396         * README: Update compilers known to work and fail.
6397
6398 2010-11-23  Matthias Klose  <doko@ubuntu.com>
6399
6400         * configure.in: For --enable-gold, handle value `default' instead of
6401         `both*'.  Always install ld as ld.bfd, install as ld if gold is
6402         not the default.
6403         * configure: Regenerate.
6404
6405 2010-11-18  Doug Kwan  <dougkwan@google.com>
6406
6407         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
6408         and right_alignment to be zero.  Store result alignment only if it is
6409         greater than existing alignment.
6410
6411 2010-11-16  Cary Coutant  <ccoutant@google.com>
6412
6413         PR gold/12220
6414         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
6415         Check for ".zdebug_line".
6416
6417 2010-11-16  Doug Kwan  <dougkwan@google.com>
6418             Cary Coutant  <ccoutant@google.com>
6419
6420         * output.h (Output_segment::set_section_addresses): Pass increase_relro
6421         by reference; adjust all callers.
6422         * output.cc (Output_segment::set_section_addresses): Adjust references
6423         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
6424         list is empty.
6425         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
6426         end at page boundary.
6427
6428 2010-11-16  Cary Coutant  <ccoutant@google.com>
6429
6430         PR gold/12220
6431         * layout.cc (Layout::choose_output_section): Transform names of
6432         compressed sections even when using a script with a SECTIONS clause.
6433         (Layout::output_section_name): Remove code to transform
6434         compressed debug section names.
6435         * output.cc (Output_section::add_input_section): Use uncompressed
6436         section size when tracking input sections.
6437
6438 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
6439
6440         * symtab.h (Symbol::NON_PIC_REF): Remove.
6441         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
6442         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
6443         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
6444         (Symbol::use_plt_offset): Take a flags argument and pass it
6445         directly to needs_dynamic_reloc.  Restrict check for undefined
6446         weak symbols to function calls.
6447         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
6448         (Target_arm::Scan::global): Use it.
6449         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
6450         (Target_arm::Relocate::relocate): Likewise.
6451         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
6452         parameter with an r_type parameter.  Use get_reference_flags
6453         to get the flags.
6454         (Target_arm::Relocate::relocate): Update accordingly.
6455         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
6456         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
6457         (Target_i386::Scan::global): Likewise.
6458         (Target_i386::Relocate::relocate): Likewise.
6459         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
6460         parameter with an r_type parameter.  Use get_reference_flags
6461         to get the flags.
6462         (Target_i386::Relocate::relocate): Update accordingly.
6463         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
6464         (Target_powerpc::Scan::global): Use it.
6465         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
6466         (Target_powerpc::Relocate::relocate): Likewise.
6467         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
6468         (Target_sparc::Scan::global): Use it.
6469         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
6470         (Target_sparc::Relocate::relocate): Likewise.
6471         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
6472         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
6473         (Target_x86_64::Scan::global): Likewise.
6474         (Target_x86_64::Relocate::relocate): Likewise.
6475
6476 2010-11-08  Doug Kwan  <dougkwan@google.com>
6477             Cary Coutant  <ccoutant@google.com>
6478
6479         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
6480         (Arm_exidx_merge_section::section_contents_): New data member.
6481         (Arm_input_section::Arm_input_section): Initialize original_contents_.
6482         (Arm_input_section::~Arm_input_section): De-allocate memory.
6483         (Arm_input_section::original_contents_): New data member.
6484         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
6485         in parameters instead of calling Object::section_contents without
6486         locking.
6487         (Arm_output_section::group_section): New parameter TASK.  Pass it
6488         to callees that need locking objects.
6489         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
6490         to lock EXIDX input sections.  Fix a formatting issue.  Call
6491         Arm_exidx_merged_section::build_contents to create merged section
6492         contents.
6493         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
6494         to lock object of stub table owner.
6495         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
6496         TEXT_SIZE to initialize data member TEXT_SIZE_.
6497         (Arm_exidx_input_section::addralign): Fix typo in comment.
6498         (Arm_exidx_input_section::text_size): New method.
6499         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
6500         that require locking objects.  Lock objects before scanning for stubs
6501         and updating local symbols.
6502         (Arm_input_section<big_endian>::init): Copy contents of original
6503         input section.
6504         (Arm_input_section<big_endian>::do_write): Use saved contents of
6505         original input section instead of calling Object::section_contents
6506         without locking.
6507         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
6508         size without calling Object::section_size().
6509         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
6510         for size.  Allocate a buffer for merged EXIDX entries.
6511         (Arm_exidx_merged_section::build_contents): New method.
6512         (Arm_exidx_merged_section::do_write): Move merge section contents
6513         building code to Arm_exidx_merged_section::build_contetns.  Write
6514         out contetns in buffer instead of building it on the fly.
6515         (Arm_relobj::make_exidx_input_section): Also pass text section size
6516         to Arm_exidx_input_section constructor.
6517         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
6518         (Arm_dynobj::do_read_symbols): Fix memory leak.
6519         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
6520         * target.h: (class Task): Add forward declaration.
6521         (Target::relax): Add new parameter TASK and pass it to
6522         Target::do_relax().
6523         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
6524
6525 2010-11-05  Cary Coutant  <ccoutant@google.com>
6526
6527         PR gold/10708
6528         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
6529         object when reading from the file.
6530         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
6531         second layout pass.
6532         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
6533         when reading section contents.
6534         (get_section_contents): Likewise.
6535         (icf::find_identical_sections): Likewise.
6536         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
6537         object when reading from the file.
6538         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
6539         the object when doing deferred section layout.
6540
6541 2010-11-03  Nick Clifton  <nickc@redhat.com>
6542
6543         PR gold/12001
6544         * script.h (class Symbol_assignment: name): New member.  Returns
6545         the name of the symbol.
6546         * scrfipt.cc (Script_options::is_pending_assignment): New member.
6547         Returns true if the given symbol name is on the list of
6548         assignments wating to be processed.
6549         * archive.cc (should_incldue_member): If the symbol is undefined,
6550         check to see if it is on the list of symbols pending assignment.
6551
6552 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
6553
6554         * script-sections.cc (Script_sections::find_memory_region): Check
6555         for a NULL output section pointer.
6556
6557 2010-10-29  Doug Kwan  <dougkwan@google.com>
6558
6559         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
6560         Output_section::add_relaxed_input_section.
6561         * output.cc (Output_section::add_relaxed_input_section): Add new
6562         arguments LAYOUT and NAME.  Set section order index.
6563         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
6564         Copy section order index.
6565         * output.h (Output_section::add_relaxed_input_section): Add new
6566         arguments LAYOUT and NAME.
6567
6568 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6569
6570         * testsuite/Makefile.am: Move gcctestdir/ld rule to
6571         NATIVE_OR_CROSS_LINKER.
6572         * testsuite/Makefile.in: Regenerate.
6573
6574 2010-10-20  Doug Kwan  <dougkwan@google.com>
6575
6576         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
6577         without SHF_LINK_ORDER flags.
6578         * layout.cc (Layout::choose_output_section): Do not filter
6579         SHF_LINK_ORDER flag in a relocatable link.
6580
6581 2010-10-17  Cary Coutant  <ccoutant@google.com>
6582
6583         * output.h (Output_segment::set_section_addresses): Change function
6584         signature.  Update all callers.
6585         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
6586         sections.
6587         (Output_segment::set_section_addresses): Align after last TLS
6588         section.  Add padding before last relro section instead of after.
6589
6590 2010-10-17  Doug Kwan  <dougkwan@google.com>
6591
6592         * gold/arm.cc (Target_arm::got_section): Use correct order and set
6593         GOT output section to be writable.
6594
6595 2010-10-14  Cary Coutant  <ccoutant@google.com>
6596
6597         * debug.h (DEBUG_INCREMENTAL): New flag.
6598         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
6599         * gold.cc (queue_initial_tasks): Check parameters for incremental link
6600         mode.
6601         * incremental.cc (report_command_line): Ignore all forms of
6602         --incremental.
6603         * layout.cc (Layout::Layout): Check parameters for incremental link
6604         mode.
6605         * options.cc (General_options::parse_incremental): New function.
6606         (General_options::parse_no_incremental): New function.
6607         (General_options::parse_incremental_full): New function.
6608         (General_options::parse_incremental_update): New function.
6609         (General_options::incremental_mode_): New data member.
6610         (General_options::finalize): Check incremental_mode_.
6611         * options.h (General_options): Update help text for --incremental.
6612         Add --no-incremental, --incremental-full, --incremental-update.
6613         (General_options::Incremental_mode): New enum type.
6614         (General_options::incremental_mode): New function.
6615         (General_options::incremental_mode_): New data member.
6616         * parameters.cc (Parameters::incremental_mode_): New data member.
6617         (Parameters::set_options): Set incremental_mode_.
6618         (Parameters::set_incremental_full): New function.
6619         (Parameters::incremental): New function.
6620         (Parameters::incremental_update): New function.
6621         (set_parameters_incremental_full): New function.
6622         * parameters.h (Parameters::set_incremental_full): New function.
6623         (Parameters::incremental): New function.
6624         (Parameters::incremental_update): New function.
6625         (Parameters::incremental_mode_): New data member.
6626         (set_parameters_incremental_full): New function.
6627         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
6628         incremental link mode.
6629         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
6630         (Sized_relobj::do_relocate_sections): Likewise.
6631         * testsuite/Makefile.am (incremental_test): Use --incremental-full
6632         option.
6633         * testsuite/Makefile.in: Regenerate.
6634         * testsuite/incremental_test.sh: Filter all forms of --incremental.
6635
6636 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6637
6638         * script-sections.h (class Script_sections): Make
6639         Sections_elements typedef public.
6640         * script-sections.cc (class Sort_output_sections): Add elements_
6641         field.  Add constructor which sets it; change all callers.
6642         (Sort_output_sections::is_before): New function.
6643         (Sort_output_sections::operator()): Call is_before.
6644         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
6645         conditional.
6646         * testsuite/script_test_10.sh: New test. Test script section
6647         order.
6648         * testsuite/script_test_10.t: Likewise.
6649         * testsuite/script_test_10.s: Likewise.
6650         * testsuite/Makefile.am: Wrap the cross linker tests and the
6651         common tests into NATIVE_OR_CROSS_LINKER.
6652         (check_SCRIPTS): Add script_test_10.sh.
6653         (check_DATA): Add script_test_10.stdout.
6654         (script_test_10.o, script_test_10): New targets.
6655         (script_test_10.stdout): New target.
6656         * configure, testsuite/Makefile.in: Regenerate.
6657
6658 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6659
6660         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
6661         error for the deprecated relocations.
6662         (Target_arm::Scan::global): Likewise.
6663         (Target_arm::Relocate::relocate): Likewise.
6664
6665 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
6666
6667         * fileread.cc (Input_file::find_file): Initialize *found_name
6668         and *namep when using the fallback search for case 4.
6669
6670 2010-10-11  Cary Coutant  <ccoutant@google.com>
6671
6672         * options.h (class General_options): Redefine -z lazy as an alias for
6673         the negation of -z now.
6674
6675 2010-10-11  Ian Lance Taylor  <iant@google.com>
6676
6677         * resolve.cc (symbol_to_bits): Report the value of the unsupported
6678         binding.
6679
6680 2010-10-06  Nick Clifton  <nickc@redhat.com>
6681
6682         * script-sections.cc(class Memory_region): Remove
6683         current_lma_offset_ field.  Rename current_vma_offset_ to
6684         current_offset_.  Add last_section_ field.
6685         (Memory_region::get_current_vma_address): Rename to
6686         get_current_address.
6687         (Memory_region::get_current_lma_address): Delete.
6688         (Memory_region::increment_vma_offset): Rename to
6689         increment_offset.
6690         (Memory_region::increment_lma_offset): Delete.
6691         (Memory_region::attributes_compatible): New method.  Returns
6692         true if the provided section is compatible with the region.
6693         (Memory_region::get_last_section): New method.  Returns the last
6694         section to use the region.
6695         (Memory_region::set_last_section): New method.  Stores the last
6696         section to use the region.
6697         (Script_sections::block_in_region): New method.  Returns true if
6698         a block of memory is contained within a region.
6699         (Script_sections::find_memory_region): New method.  Locates a
6700         memory region to be used to set a VMA or LMA address.
6701         (Output_section_definition::set_section_addresses): Add code to
6702         check for addresses set by memory regions.
6703         (Output_segment::set_section_addresses): Remove memory region
6704         walking code.
6705         (Script_sections::create_segment): Add a warning if a header
6706         segment is created outside of any region.
6707         * script-sections.h (class Script_sections): Add prototypes for
6708         find_memory_region and block_in_region methods.
6709         * testsuite/memory_test.s: Use .long instead of .word.
6710         * testsuite/memory_test.t: Add some more output sections.
6711         * testsuite/memory_test.sh: Update expected output.
6712
6713 2010-10-02  Doug Kwan  <dougkwan@google.com>
6714
6715         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
6716         defintion to symtab.h
6717         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
6718         declaration to defintion.
6719
6720 2010-10-01  Nick Clifton  <nickc@redhat.com>
6721
6722         * expression.cc (eval): Replace dummy argument with NULL.
6723         (eval_maybe_dot): Check for a NULL result section pointer.
6724         (Symbol_expression::value): Likewise.
6725         (Dot_expression::value): Likewise.
6726         (BINARY_EXPRESSION): Likewise.
6727         (Max_expression::value): Likewise.
6728         (Min_expression::value): Likewise.
6729         (Absolute_expression::value): Likewise.
6730         (Addr_expression::value_from_output_section): Likewise.
6731         (Loaddddr_expression::value_from_output_section): Likewise.
6732         (Segment_start_expression::value): Likewise.
6733         * script-sections.cc
6734         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
6735         argument with NULL.
6736         (Sections_elememt_dot_assignment::set_section_addresses):
6737         Likewise.
6738         (Output_data_expression::do_write_to_buffer): Likewise.
6739         (Output_section_definition::finalize_symbols): Likewise.
6740         (Output_section_definition::set_section_addresses): Likewise.
6741
6742 2010-09-30  Doug Kwan  <dougkwan@google.com>
6743
6744         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
6745
6746 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
6747
6748         * target.h (Target::can_icf_inline_merge_sections): New virtual
6749         function.
6750         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
6751         virtual function.
6752         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
6753         virtual function.
6754         * icf.cc (get_section_contents): Inline merge sections only when
6755         target allows it.
6756
6757 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6758
6759         * configure: Regenerate.
6760
6761 2010-09-17  Ian Lance Taylor  <iant@google.com>
6762
6763         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
6764         * testsuite/Makefile.am (memory_test.o): New target.
6765         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
6766         memory_test.t.
6767         * testsuite/Makefile.in: Rebuild.
6768
6769 2010-09-17  Doug Kwan  <dougkwan@google.com>
6770
6771         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
6772         defintion if relocation uses GOT entries of the symbol.
6773         * testsuite/icf_safe_test.sh: Fix test.
6774         * testsuite/icf_safe_so_test.sh: Fix test.
6775
6776 2010-09-16  Cary Coutant  <ccoutant@google.com>
6777
6778         * script_sections.cc (class Memory_region): Remove "NULL" from
6779         vector initializations.
6780
6781 2010-09-15  Cary Coutant  <ccoutant@google.com>
6782
6783         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
6784         Resolve forwarding symbols.
6785
6786 2010-09-15  Doug Kwan  <dougkwan@google.com>
6787
6788         * gold/testsuite/script_test_3.t: Add ARM special sections.
6789         * gold/testsuite/script_test_4.t: Same.
6790         * gold/testsuite/script_test_5.t: Same.
6791         * gold/testsuite/script_test_6.t: Same.
6792         * gold/testsuite/script_test_7.t: Same.
6793         * gold/testsuite/script_test_7.t: Same.
6794         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
6795
6796 2010-09-14  Cary Coutant  <ccoutant@google.com>
6797
6798         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
6799         (Target_x86_64::Relocate::relocate_tls): Replace check for
6800         saw_tls_block_reloc_ with test for executable section.
6801
6802 2010-09-12  Cary Coutant  <ccoutant@google.com>
6803
6804         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
6805         position-independent executables to shared libraries need dynamic
6806         relocations.
6807         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
6808         position-independent executables.
6809         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
6810         * testsuite/Makefile.in: Regenerate.
6811
6812 2010-09-10  Nick Clifton  <nickc@redhat.com>
6813
6814         PR gold/11997
6815         * testsuite/memory_test.t: Discard any sections that are not
6816         needed.
6817
6818 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
6819
6820         PR gold/11996
6821         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
6822         "This::" to work around a bug in gcc 4.2.
6823
6824         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
6825
6826 2010-09-09  Rafael Espindola  <espindola@google.com>
6827
6828         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
6829         sections with different PF_X flags in the same segment.
6830         (Layout::find_first_load_seg): Search all segments to find the first
6831         one.
6832         * options.h (rosegment): New.
6833
6834 2010-09-08  Rafael Espindola  <espindola@google.com>
6835
6836         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
6837
6838 2010-09-08  Doug Kwan  <dougkwan@google.com>
6839
6840         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
6841         (Arm_relobj::do_relocate_sections): Add new parameter for output
6842         file to match the parent.
6843         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
6844         of local symbols instead of input values.  Update code to track
6845         changes in gold::relocate_section.
6846         * object.cc (Sized_relobj::compute_final_local_value): New methods.
6847         (Sized_relobj::compute_final_local_value_internal): New methods.
6848         (Sized_relobj::do_finalize_local_symbols): Move code from loop
6849         body into private version of Sized_relobj::compute_final_local_value.
6850         Call the inline method.
6851         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
6852         merged symbol value if there is one.
6853         (Symbol_value::has_output_value): New method defintiion.
6854         (Sized_relobj::Compute_final_local_value_status): New enum type.
6855         (Sized_relobj::compute_final_local_value): New methods.
6856         (Sized_relobj::compute_final_local_value_internal): New methods.
6857         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
6858         and arm_cortex_a8.sh.
6859         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
6860         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
6861         New tests.
6862         * Makefile.in: Regenerate.
6863         * testsuite/arm_bl_out_of_range.s: Update test.
6864         * testsuite/thumb_bl_out_of_range.s: Ditto.
6865         * testsuite/thumb_blx_out_of_range.s: Ditto.
6866         * testsuite/arm_branch_out_of_range.sh: New file.
6867         * testsuite/arm_cortex_a8.sh: Ditto.
6868         * testsuite/arm_cortex_a8_b.s: Ditto.
6869         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
6870         * testsuite/arm_cortex_a8_b_local.s: Ditto.
6871         * testsuite/arm_cortex_a8_bl.s: Ditto.
6872         * testsuite/arm_cortex_a8_blx.s: Ditto.
6873         * testsuite/arm_cortex_a8_local.s: Ditto.
6874         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
6875         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
6876
6877 2010-09-08  Rafael Espindola  <espindola@google.com>
6878
6879         * Makefile.am (memory_test.stdout): Run readelf with -W.
6880         * Makefile.in: Regenerate.
6881         * testsuite/memory_test.sh: Make the regexps accept both 32 and
6882         64 bit output.
6883
6884 2010-09-08  Rafael Espindola  <espindola@google.com>
6885
6886         * script-sections.cc (Script_sections::add_memory_region): Convert
6887         field precision to int.
6888         * script.cc (script_set_section_region, script_set_section_region):
6889         Convert field precision to int.
6890
6891 2010-09-08  Rafael Espindola  <espindola@google.com>
6892
6893         * arm.cc (do_finalize_sections): Create the __exidx_start and
6894         __exdix_end symbols even when the section is missing.
6895
6896 2010-09-08  Nick Clifton  <nickc@redhat.com>
6897
6898         * README: Remove claim that MEMORY is not supported.
6899         * expression.cc (script_exp_function_origin)
6900         (script_exp_function_length): Move from here to ...
6901         * script.cc: ... here.
6902         (script_set_section_region, script_add_memory)
6903         (script_parse_memory_attr, script_include_directive): New
6904         functions.
6905         * script-sections.cc
6906         (class Memory_region): New class.
6907         (class Output_section_definition): Add set_memory_region,
6908         set_section_vma, set_section_lma and get_section_name methods.
6909         (class Script_Sections): Add add_memory_region,
6910         find_memory_region, find_memory_region_origin,
6911         find_memory_region_length and set_memory_region methods.
6912         Have set_section_addresses method walk the list of set memory
6913         regions.
6914         Extend the print methos to display memory regions.
6915         * script-sections.h: Add prototypes for new methods.
6916         Add enum for MEMORY region attributes.
6917         * yyscript.y: Add support for parsing MEMORY regions.
6918         * script-c.h: Add prototypes for new functions.
6919         * testsuite/Makefile.am: Add test of MEMORY region functionality.
6920         * testsuite/Makefile.in: Regenerate.
6921         * testsuite/memory_test.sh: New script.
6922         * testsuite/memory_test.s: New assembler source file.
6923         * testsuite/memory_test.t: New linker script.
6924
6925 2010-08-27  Doug Kwan  <dougkwan@google.com>
6926
6927         * gold/resolve.cc (Symbol_table::should_override): Let a weak
6928         reference override an existing dynamic weak reference.
6929         * testsuite/Makefile.am: Add new test dyn_weak_ref.
6930         * testsuite/Makefile.in: Regenerate.
6931         * testsuite/dyn_weak_ref.sh: New file.
6932         * testsuite/dyn_weak_ref_1.c: Ditto.
6933         * testsuite/dyn_weak_ref_2.c: Ditto.
6934
6935 2010-08-27  Ian Lance Taylor  <iant@google.com>
6936
6937         * incremental.h (class Incremental_input_entry): Add virtual
6938         destructor.
6939
6940 2010-08-27  Ian Lance Taylor  <iant@google.com>
6941
6942         * testsuite/start_lib_test_3.c: Mark t3 as used.
6943
6944 2010-08-27  Nick Clifton  <nickc@redhat.com>
6945
6946         * options.cc (version_script): Fix small typo in previous
6947         whitespace tidyup.
6948
6949 2010-08-25  Nick Clifton  <nickc@redhat.com>
6950
6951         * archive.cc: Formatting fixes: Remove whitespace between
6952         typename and following asterisk.  Remove whitespace between
6953         function name and opening parenthesis.
6954         * archive.h: Likewise.
6955         * arm.cc: Likewise.
6956         * attributes.cc: Likewise.
6957         * attributes.h: Likewise.
6958         * common.cc: Likewise.
6959         * copy-relocs.cc: Likewise.
6960         * dirsearch.h: Likewise.
6961         * dynobj.cc: Likewise.
6962         * ehframe.cc: Likewise.
6963         * ehframe.h: Likewise.
6964         * expression.cc: Likewise.
6965         * fileread.cc: Likewise.
6966         * fileread.h: Likewise.
6967         * gc.h: Likewise.
6968         * gold-threads.cc: Likewise.
6969         * gold.cc: Likewise.
6970         * i386.cc: Likewise.
6971         * icf.h: Likewise.
6972         * incremental-dump.cc: Likewise.
6973         * incremental.cc: Likewise.
6974         * layout.cc: Likewise.
6975         * layout.h: Likewise.
6976         * main.cc: Likewise.
6977         * merge.cc: Likewise.
6978         * merge.h: Likewise.
6979         * object.cc: Likewise.
6980         * object.h: Likewise.
6981         * options.cc: Likewise.
6982         * options.h: Likewise.
6983         * output.cc: Likewise.
6984         * output.h: Likewise.
6985         * plugin.cc: Likewise.
6986         * plugin.h: Likewise.
6987         * powerpc.cc: Likewise.
6988         * reloc.cc: Likewise.
6989         * script-c.h: Likewise.
6990         * script-sections.cc: Likewise.
6991         * script.cc: Likewise.
6992         * stringpool.cc: Likewise.
6993         * symtab.cc: Likewise.
6994         * symtab.h: Likewise.
6995         * target.cc: Likewise.
6996         * timer.cc: Likewise.
6997         * timer.h: Likewise.
6998         * version.cc: Likewise.
6999         * x86_64.cc: Likewise.
7000
7001 2010-08-24  Nick Clifton  <nickc@redhat.com>
7002
7003         PR 11899
7004         * layout.cc (segment_precedes): Sort segments by their physical
7005         addresses, if they have been set.
7006
7007 2010-08-23  Cary Coutant  <ccoutant@google.com>
7008
7009         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
7010         symbols data.
7011         (Lib_group::include_member): Unlock object after deleting its
7012         symbols data.
7013         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
7014         the bug fixed here.
7015
7016 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
7017             Cary Coutant  <ccoutant@google.com>
7018
7019         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
7020         constructor, and set_blocker.
7021         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
7022         readsyms_blocker_.
7023         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
7024         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
7025         * testsuite/Makefile.am (start_lib_test): New test case.
7026         * testsuite/Makefile.in: Regenerate.
7027         * testsuite/start_lib_test_main.c: New file.
7028         * testsuite/start_lib_test_1.c: New file.
7029         * testsuite/start_lib_test_2.c: New file.
7030         * testsuite/start_lib_test_3.c: New file.
7031
7032 2010-08-19  Ian Lance Taylor  <iant@google.com>
7033
7034         * Makefile.in: Rebuild with automake 1.11.1.
7035         * aclocal.m4: Likewise.
7036         * testsuite/Makefile.in: Likewise.
7037
7038 2010-08-19  Ian Lance Taylor  <iant@google.com>
7039
7040         PR 10893
7041         * i386.cc (class Output_data_plt_i386): Update declarations.
7042         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
7043         local_ifuncs_ fields.
7044         (Target_i386::do_plt_section_for_global): New function.
7045         (Target_i386::do_plt_section_for_local): New function.
7046         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
7047         parameter; change all callers.  Initialize global_ifuncs_ and
7048         local_ifuncs_.  If doing a static link define __rel_iplt_start and
7049         __rel_iplt_end.
7050         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
7051         (Output_data_plt_i386::add_local_ifunc_entry): New function.
7052         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
7053         symbols.
7054         (Target_i386::make_plt_section): New function, broken out of
7055         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
7056         (Target_i386::make_plt_entry): Call make_plt_section.
7057         (Target_i386::make_local_ifunc_plt_entry): New function.
7058         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
7059         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
7060         R_386_IRELATIVE to switch.
7061         (Target_i386::Scan::global): Likewise.
7062         (Target_i386::Relocate::relocate): Likewise.
7063         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
7064         switch.
7065         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
7066         (Target_x86_64::do_plt_section_for_global): New function.
7067         (Target_x86_64::do_plt_section_for_local): New function.
7068         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
7069         parameter; change all callers.  If doing a static link define
7070         __rela_iplt_start and __rela_iplt_end.
7071         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
7072         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
7073         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
7074         to point to .plt.
7075         (Target_x86_64::make_local_ifunc_plt_entry): New function.
7076         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
7077         switch.
7078         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
7079         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
7080         R_X86_64_IRELATIVE to switch.
7081         (Target_x86_64::Scan::global): Likewise.
7082         (Target_x86_64::Relocate::relocate): Likewise.
7083         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
7084         switch.
7085         * target.h (class Target): Add plt_section_for_global and
7086         plt_section_for_local functions.  Add do_plt_section_for_global
7087         and do_plt_section_for_local virtual functions.
7088         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
7089         clarifying comments.
7090         (Symbol::use_plt_offset): Handle IFUNC symbol.
7091         * object.cc (Sized_relobj::Sized_relobj): Initialize
7092         local_plt_offsets_.
7093         (Sized_relobj::local_has_plt_offset): New function.
7094         (Sized_relobj::local_plt_offset): New function.
7095         (Sized_relobj::set_local_plt_offset): New function.
7096         (Sized_relobj::do_count): Handle IFUNC symbol.
7097         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
7098         a bit away from input_shndx_ field.  Add set_is_func_symbol and
7099         is_ifunc_symbol functions.
7100         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
7101         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
7102         local_plt_offsets_ field.
7103         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
7104         * output.h (class Output_section_data): Add non-const
7105         output_section function.
7106         (class Output_data_got): Update declarations.
7107         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
7108         Add use_plt_offset parameter to global and local constructors.
7109         Change all callers.  Change local_sym_index_ field to 31 bits.
7110         Change GSYM_CODE and CONSTANT_CODE accordingly.
7111         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
7112         doing a static link don't set sh_link field.
7113         (Output_data_got::Got_entry::write): Use PLT offset if
7114         appropriate.
7115         (Output_data_got::add_global_plt): New function.
7116         (Output_data_got::add_local_plt): New function.
7117         * target-reloc.h (relocate_section): Handle IFUNC symbol.
7118         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
7119         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
7120         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
7121         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
7122         IFUNC conditional.
7123         * testsuite/ifunc-sel.h: New file.
7124         * testsuite/ifuncmain1.c: New file.
7125         * testsuite/ifuncmain1vis.c: New file.
7126         * testsuite/ifuncmod1.c: New file.
7127         * testsuite/ifuncdep2.c: New file.
7128         * testsuite/ifuncmain2.c: New file.
7129         * testsuite/ifuncmain3.c: New file.
7130         * testsuite/ifuncmod3.c: New file.
7131         * testsuite/ifuncmain4.c: New file.
7132         * testsuite/ifuncmain5.c: New file.
7133         * testsuite/ifuncmod5.c: New file.
7134         * testsuite/ifuncmain6pie.c: New file.
7135         * testsuite/ifuncmod6.c: New file.
7136         * testsuite/ifuncmain7.c: New file.
7137         * configure, testsuite/Makefile.in: Rebuild.
7138
7139 2010-08-18  Ian Lance Taylor  <iant@google.com>
7140
7141         * incremental.cc
7142         (Output_section_incremental_inputs::write_input_files): Add cast
7143         to avoid signed/unsigned comparison warning.
7144         (Output_section_incremental_inputs::write_info_blocks): Likewise.
7145
7146 2010-08-12  Cary Coutant  <ccoutant@google.com>
7147
7148         * common.cc (Sort_commons::operator()): Remove unnecessary code.
7149
7150 2010-08-13  Ian Lance Taylor  <iant@google.com>
7151
7152         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
7153
7154 2010-08-12  Cary Coutant  <ccoutant@google.com>
7155             Doug Kwan  <dougkwan@google.com>
7156
7157         * resolve.cc (Symbol_table::should_override): When a weak dynamic
7158         defintion overrides non-weak undef, remember that the original undef
7159         is not weak.
7160         * symtab.cc (Symbol_table::sized_write_global): For undef without
7161         an original weak binding, set binding to global in output.
7162         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
7163         * testsuite/Makefile.in: Regenerate.
7164         * testsuite/strong_ref_weak_def.sh: New file.
7165         * testsuite/strong_ref_weak_def_1.c: Ditto.
7166         * testsuite/strong_ref_weak_def_2.c: Ditto.
7167
7168 2010-08-12  Cary Coutant  <ccoutant@google.com>
7169
7170         * testsuite/incremental_test.sh: Rewrite.
7171         * testsuite/incremental_test_1.c: Rewrite.
7172         * testsuite/incremental_test_2.c: Rewrite.
7173
7174 2010-08-12  Cary Coutant  <ccoutant@google.com>
7175
7176         * arm.cc (Target_arm::got_size): Add const.
7177         (Target_arm::got_entry_count): New function.
7178         (Target_arm::plt_entry_count): New function.
7179         (Target_arm::first_plt_entry_offset): New function.
7180         (Target_arm::plt_entry_size): New function.
7181         (Output_data_plt_arm::entry_count): New function.
7182         (Output_data_plt_arm::first_plt_entry_offset): New function.
7183         (Output_data_plt_arm::get_plt_entry_size): New function.
7184         * i386.cc (Target_i386::got_size): Add const.
7185         (Target_i386::got_entry_count): New function.
7186         (Target_i386::plt_entry_count): New function.
7187         (Target_i386::first_plt_entry_offset): New function.
7188         (Target_i386::plt_entry_size): New function.
7189         (Output_data_plt_i386::entry_count): New function.
7190         (Output_data_plt_i386::first_plt_entry_offset): New function.
7191         (Output_data_plt_i386::get_plt_entry_size): New function.
7192         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
7193         find_incremental_inputs_sections.  Dump incremental_got_plt section.
7194         * incremental.cc: Include target.h.
7195         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
7196         parameter.  Adjust all callers.  Find incremental_got_plt section.
7197         (Incremental_inputs::create_data_sections): Create incremental_got_plt
7198         section.
7199         (Output_section_incremental_inputs::set_final_data_size): Calculate
7200         size of incremental_got_plt section.
7201         (Output_section_incremental_inputs::do_write): Write the
7202         incremental_got_plt section.
7203         (Got_plt_view_info): New struct.
7204         (Local_got_offset_visitor): New class.
7205         (Global_got_offset_visitor): New class.
7206         (Global_symbol_visitor_got_plt): New class.
7207         (Output_section_incremental_inputs::write_got_plt): New function.
7208         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
7209         Add parameter.  Adjust all callers.
7210         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
7211         (Incremental_inputs::got_plt_section): New function.
7212         (Incremental_inputs::got_plt_section_): New data member.
7213         (Incremental_got_plt_reader): New class.
7214         * layout.cc (Layout::create_incremental_info_sections): Add the
7215         incremental_got_plt section.
7216         * object.h (Got_offset_list::get_list): New function.
7217         (Got offset_list::for_all_got_offsets): New function.
7218         (Sized_relobj::local_got_offset_list): New function.
7219         * powerpc.cc (Target_powerpc::got_size): Add const.
7220         (Target_powerpc::got_entry_count): New function.
7221         (Target_powerpc::plt_entry_count): New function.
7222         (Target_powerpc::first_plt_entry_offset): New function.
7223         (Target_powerpc::plt_entry_size): New function.
7224         (Output_data_plt_powerpc::entry_count): New function.
7225         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
7226         (Output_data_plt_powerpc::get_plt_entry_size): New function.
7227         * sparc.cc (Target_sparc::got_size): Add const.
7228         (Target_sparc::got_entry_count): New function.
7229         (Target_sparc::plt_entry_count): New function.
7230         (Target_sparc::first_plt_entry_offset): New function.
7231         (Target_sparc::plt_entry_size): New function.
7232         (Output_data_plt_sparc::entry_count): New function.
7233         (Output_data_plt_sparc::first_plt_entry_offset): New function.
7234         (Output_data_plt_sparc::get_plt_entry_size): New function.
7235         * symtab.h (Symbol::got_offset_list): New function.
7236         (Symbol_table::for_all_symbols): New function.
7237         * target.h (Sized_target::got_entry_count): New function.
7238         (Sized_target::plt_entry_count): New function.
7239         (Sized_target::plt_entry_size): New function.
7240         * x86_64.cc (Target_x86_64::got_size): Add const.
7241         (Target_x86_64::got_entry_count): New function.
7242         (Target_x86_64::plt_entry_count): New function.
7243         (Target_x86_64::first_plt_entry_offset): New function.
7244         (Target_x86_64::plt_entry_size): New function.
7245         (Output_data_plt_x86_64::entry_count): New function.
7246         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
7247         (Output_data_plt_x86_64::get_plt_entry_size): New function.
7248
7249 2010-08-12  Cary Coutant  <ccoutant@google.com>
7250
7251         * archive.cc: Include incremental.h.
7252         (Archive::Archive): Initialize incremental_info_.
7253         (Archive::include_member): Record archive members in incremental info.
7254         (Add_archive_symbols::run): Record begin and end of an archive in
7255         incremental info.
7256         (Lib_group::include_member): Record objects in incremental info.
7257         * archive.h (Incremental_archive_entry): Forward declaration.
7258         (Archive::set_incremental_info): New member function.
7259         (Archive::incremental_info): New member function.
7260         (Archive::Unused_symbol_iterator): New class.
7261         (Archive::unused_symbols_begin): New member function.
7262         (Archive::unused_symbols_end): New member function.
7263         (Archive::incremental_info_): New data member.
7264         * incremental-dump.cc (find_input_containing_global): New function.
7265         (dump_incremental_inputs): Dump new incremental info sections.
7266         * incremental.cc: Include symtab.h.
7267         (Output_section_incremental_inputs): New class.
7268         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
7269         new incremental info sections.
7270         (Sized_incremental_binary::do_check_inputs): Likewise.
7271         (Incremental_inputs::report_archive): Remove.
7272         (Incremental_inputs::report_archive_begin): New function.
7273         (Incremental_inputs::report_archive_end): New function.
7274         (Incremental_inputs::report_object): New function.
7275         (Incremental_inputs::finalize_inputs): Remove.
7276         (Incremental_inputs::report_input_section): New function.
7277         (Incremental_inputs::report_script): Rewrite.
7278         (Incremental_inputs::finalize): Do nothing but finalize string table.
7279         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
7280         (Incremental_inputs::sized_create_inputs_section_data): Remove.
7281         (Incremental_inputs::create_data_sections): New function.
7282         (Incremental_inputs::relocs_entsize): New function.
7283         (Output_section_incremental_inputs::set_final_data_size): New function.
7284         (Output_section_incremental_inputs::do_write): New function.
7285         (Output_section_incremental_inputs::write_header): New function.
7286         (Output_section_incremental_inputs::write_input_files): New function.
7287         (Output_section_incremental_inputs::write_info_blocks): New function.
7288         (Output_section_incremental_inputs::write_symtab): New function.
7289         * incremental.h (Incremental_script_entry): Forward declaration.
7290         (Incremental_object_entry): Forward declaration.
7291         (Incremental_archive_entry): Forward declaration.
7292         (Incremental_inputs): Forward declaration.
7293         (Incremental_inputs_header_data): Remove.
7294         (Incremental_inputs_header): Remove.
7295         (Incremental_inputs_header_write): Remove.
7296         (Incremental_inputs_entry_data): Remove.
7297         (Incremental_inputs_entry): Remove.
7298         (Incremental_inputs_entry_write): Remove.
7299         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
7300         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
7301         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
7302         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
7303         Likewise.
7304         (Incremental_input_entry): New class.
7305         (Incremental_script_entry): New class.
7306         (Incremental_object_entry): New class.
7307         (Incremental_archive_entry): New class.
7308         (Incremental_inputs::Incremental_inputs): Initialize new data members.
7309         (Incremental_inputs::report_inputs): Remove.
7310         (Incremental_inputs::report_archive): Remove.
7311         (Incremental_inputs::report_archive_begin): New function.
7312         (Incremental_inputs::report_archive_end): New function.
7313         (Incremental_inputs::report_object): Change prototype.
7314         (Incremental_inputs::report_input_section): New function.
7315         (Incremental_inputs::report_script): Change prototype.
7316         (Incremental_inputs::get_reloc_count): New function.
7317         (Incremental_inputs::set_reloc_count): New function.
7318         (Incremental_inputs::create_data_sections): New function.
7319         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
7320         (Incremental_inputs::inputs_section): New function.
7321         (Incremental_inputs::symtab_section): New function.
7322         (Incremental_inputs::relocs_section): New function.
7323         (Incremental_inputs::get_stringpool): Add const.
7324         (Incremental_inputs::command_line): Add const.
7325         (Incremental_inputs::inputs): Remove.
7326         (Incremental_inputs::command_line_key): New function.
7327         (Incremental_inputs::input_file_count): New function.
7328         (Incremental_inputs::input_files): New function.
7329         (Incremental_inputs::relocs_entsize): New function.
7330         (Incremental_inputs::sized_create_inputs_section_data): Remove.
7331         (Incremental_inputs::finalize_inputs): Remove.
7332         (Incremental_inputs::Input_info): Remove.
7333         (Incremental_inputs::lock_): Remove.
7334         (Incremental_inputs::inputs_): Change type.
7335         (Incremental_inputs::inputs_map_): Remove.
7336         (Incremental_inputs::current_object_entry_): New data member.
7337         (Incremental_inputs::inputs_section_): New data member.
7338         (Incremental_inputs::symtab_section_): New data member.
7339         (Incremental_inputs::relocs_section_): New data member.
7340         (Incremental_inputs::reloc_count_): New data member.
7341         (Incremental_inputs_reader): New class.
7342         (Incremental_symtab_reader): New class.
7343         (Incremental_relocs_reader): New class.
7344         * layout.cc (Layout::finalize): Move finalization of incremental info
7345         and creation of incremental info sections to follow finalization of
7346         symbol table.  Set offsets for postprocessing sections.
7347         (Layout::create_incremental_info_sections): Call
7348         Incremental_inputs::create_data_sections.  Add incremental symtab
7349         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
7350         sections to layout after input sections.
7351         * layout.h (struct Timespec): Forward declaration.
7352         (Layout::incremental_inputs): Add const.
7353         (Layout::create_incremental_info_sections): Add parameter.
7354         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
7355         * object.cc: Include incremental.h.
7356         (Relobj::finalize_incremental_relocs): New function.
7357         (Sized_relobj::do_layout): Record input sections in incremental info.
7358         * object.h (Object::output_section): New function.
7359         (Object::output_section_offset): Moved from Relobj.
7360         (Object::get_incremental_reloc_base): New function.
7361         (Object::get_incremental_reloc_count): New function.
7362         (Object::do_output_section): New function.
7363         (Object::do_output_section_offset): Moved from Relobj.
7364         (Object::do_get_incremental_reloc_base): New function.
7365         (Object::do_get_incremental_reloc_count): New function.
7366         (Object::Object): Initialize new data members.
7367         (Relobj::output_section): Renamed do_output_section and moved to
7368         protected.
7369         (Relobj::output_section_offset): Moved to Object.
7370         (Relobj::do_get_incremental_reloc_base): New function.
7371         (Relobj::do_get_incremental_reloc_count): New function.
7372         (Relobj::allocate_incremental_reloc_counts): New function.
7373         (Relobj::count_incremental_reloc): New function.
7374         (Relobj::finalize_incremental_relocs): New function.
7375         (Relobj::next_incremental_reloc_index): New function.
7376         (Relobj::reloc_counts_): New data member.
7377         (Relobj::reloc_bases_): New data member.
7378         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
7379         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
7380         (Sized_relobj::incremental_relocs_scan): New function.
7381         (Sized_relobj::incremental_relocs_scan_reltype): New function.
7382         (Sized_relobj::incremental_relocs_write): New function.
7383         (Sized_relobj::incremental_relocs_write_reltype): New function.
7384         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
7385         incremental link.
7386         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
7387         archives and object files elsewhere.
7388         (Add_symbols::run): Report object files here.
7389         (Finish_group::run): Report end of archive at end of group.
7390         * reloc.cc: Include layout.h, incremental.h.
7391         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
7392         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
7393         (Sized_relobj::incremental_relocs_scan): New function.
7394         (Sized_relobj::incremental_relocs_scan_reltype): New function.
7395         (Sized_relobj::do_relocate_sections): Write incremental relocations.
7396         (Sized_relobj::incremental_relocs_write): New function.
7397         (Sized_relobj::incremental_relocs_write_reltype): New function.
7398         * script.cc (read_input_script): Rewrite test for incremental link.
7399         Change call to Incremental_inputs::report_script.
7400         * symtab.h (Symbol_table::first_global_index): New function.
7401         (Symbol_table::output_count): New function.
7402
7403 2010-08-12  Doug Kwan  <dougkwan@google.com>
7404
7405         * arm.cc (Target_arm::merge_object_attributes): Check command line
7406         options --no-wchar-size-warning and --no-enum-size-warning.
7407         * options.h (General_options): Add ld-compatible options
7408         --no-enum-size-warning and --no-wchar-size-warning.
7409
7410 2010-08-04  Ian Lance Taylor  <iant@google.com>
7411
7412         * x86_64.cc (Target_x86_64::Scan::local): Use
7413         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
7414         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
7415         (Target_x86_64::Scan::global): Likewise.
7416         (Target_x86_64::Relocate::relocate): Likewise.
7417         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
7418         Likewise.
7419
7420 2010-08-03  Cary Coutant  <ccoutant@google.com>
7421
7422         * merge.cc (Output_merge_string::do_add_input_section): Count strings
7423         to reserve space in merged_strings vector. Keep total input size
7424         for stats.
7425         (Output_merge_string::do_print_merge_stats): Print total input size.
7426         * merge.h (Output_merge_string): Add input_size_ field.
7427         * stringpool.cc (Stringpool_template::string_length): Move
7428         implementations out of Stringpool_template class and place in
7429         stringpool.h.
7430         * stringpool.h (string_length): Move out of Stringpool_template.
7431
7432 2010-08-03  Ian Lance Taylor  <iant@google.com>
7433
7434         PR 11712
7435         * layout.cc (relaxation_loop_body): If address of load segment is
7436         set, adjust address to include headers if possible.
7437
7438 2010-08-03  Ian Lance Taylor  <iant@google.com>
7439
7440         * version.cc (version_string): Bump to 1.10.
7441
7442 2010-08-03  Ian Lance Taylor  <iant@google.com>
7443
7444         PR 11805
7445         * layout.h (enum Output_section_order): Define.
7446         (class Layout): Update declarations.
7447         * layout.cc (Layout::get_output_section): Add order parameter.
7448         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
7449         is_first_non_relro parameters.  Change all callers.
7450         (Layout::choose_output_section): Likewise.
7451         (Layout::add_output_section_data): Likewise.
7452         (Layout::make_output_section): Likewise.  Set order.
7453         (Layout::default_section_order): New function.
7454         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
7455         * output.cc (Output_section::Output_section): Initialize order_.
7456         Don't initialize deleted fields.
7457         (Output_segment::Output_segment): Don't initialize deleted
7458         fields.
7459         (Output_segment::add_output_section_to_load): New function
7460         replacing add_output_section.  Change all callers to call this or
7461         add_output_section_to_nonload.
7462         (Output_segment::add_output_section_to_nonload): New function.
7463         (Output_segment::remove_output_section): Rewrite.
7464         (Output_segment::add_initial_output_data): Likewise.
7465         (Output_segment::has_any_data_sections): Likewise.
7466         (Output_segment::is_first_section_relro): Likewise.
7467         (Output_segment::maximum_alignment): Likewise.
7468         (Output_segment::has_dynamic_reloc): New function replacing
7469         dynamic_reloc_count.  Change all callers.
7470         (Output_segment::has_dynamic_reloc_list): New function replacing
7471         dynamic_reloc_count_list.  Change all callers.
7472         (Output_segment::set_section_addresses): Rewrite.
7473         (Output_segment::set_offset): Rewrite.
7474         (Output_segment::find_first_and_last_list): Remove.
7475         (Output_segment::set_tls_offsets): Rewrite.
7476         (Output_segment::first_section_load_address): Likewise.
7477         (Output_segment::output_section_count): Likewise.
7478         (Output_segment::section_with_lowest_load_address): Likewise.
7479         (Output_segment::write_section_headers): Likewise.
7480         (Output_segment::print_sections_to_map): Likewise.
7481         * output.h (class Output_data): Remove dynamic_reloc_count_
7482         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
7483         (Output_data::add_dynamic_reloc): Rewrite.
7484         (Output_data::has_dynamic_reloc): New function.
7485         (Output_data::dynamic_reloc_count): Remove.
7486         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
7487         is_last_relro_, is_first_non_relro_, is_interp_,
7488         is_dynamic_linker_section_ fields.  Add order and set_order
7489         functions.  Remove is_relro_local, set_is_relro_local,
7490         is_last_relro, set_is_last_relro, is_first_non_relro,
7491         set_is_first_non_relro functions, is_interp, set_is_interp,
7492         is_dynamic_linker_section, and set_is_dynamic_linker_section
7493         functions.
7494         (class Output_segment): Change Output_data_list from std::list to
7495         std:;vector.  Add output_lists_ field.  Remove output_data_ and
7496         output_bss_ fields.  Update declarations.
7497
7498 2010-08-02  Ian Lance Taylor  <iant@google.com>
7499
7500         * arm.cc (Target_arm::gc_process_relocs): Use typename.
7501         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
7502         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
7503
7504 2010-08-02  Ian Lance Taylor  <iant@google.com>
7505
7506         PR 11855
7507         * script.cc (Script_options::Script_options): Initialize
7508         symbol_definitions_ and symbol_references_.
7509         (Script_options::add_symbol_assignment): Update
7510         symbol_definitions_ and symbol_references_.
7511         (Script_options::add_symbol_reference): New function.
7512         (script_symbol): New function.
7513         * script.h (class Script_options): Add symbol_definitions_ and
7514         symbol_references_ fields.
7515         (Script_options::referenced_const_iterator): New type.
7516         (Script_options::referenced_begin): New function.
7517         (Script_options::referenced_end): New function.
7518         (Script_options::is_referenced): New function.
7519         (Script_options::any_unreferenced): New function.
7520         * script-c.h (script_symbol): Declare.
7521         * yyscript.y (exp): Call script_symbol.
7522         * symtab.cc: Include "script.h".
7523         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
7524         Change all callers.  Check symbols referenced by scripts.
7525         (Symbol_table::add_undefined_symbols_from_command_line): Add
7526         layout parameter.  Change all callers.
7527         (Symbol_table::do_add_undefined_symbols_from_command_line):
7528         Likewise.  Break out loop body.  Check symbols referenced by
7529         scripts.
7530         (Symbol_table::add_undefined_symbol_from_command_line): New
7531         function broken out of
7532         do_add_undefined_symbols_from_command_line.
7533         * symtab.h (class Symbol_table): Update declarations.
7534         * archive.cc: Include "layout.h".
7535         (Archive::should_include_member): Add layout parameter.  Change
7536         all callers.  Check for symbol mentioned in expression.
7537         * archive.h (class Archive): Update declaration.
7538         * object.cc (Sized_relobj::do_should_include_member): Add layout
7539         parameter.
7540         * object.h (Object::should_include_member): Add layout parameter.
7541         Change all callers.
7542         (Object::do_should_include_member): Add layout parameter.
7543         (class Sized_relobj): Update declaration.
7544         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
7545         parameter.
7546         * dynobj.h (class Sized_dynobj): Update declaration.
7547         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
7548         layout parameter.
7549         * plugin.h (class Sized_pluginobj): Update declaration.
7550
7551 2010-08-02  Ian Lance Taylor  <iant@google.com>
7552
7553         PR 11866
7554         * output.cc (Output_segment::set_offset): Search for the first and
7555         last sections rather than assuming that the list is in order.
7556         (Output_segment::find_first_and_last_list): New function.
7557         * output.h (class Output_segment): Update declarations.
7558         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
7559         (relro_strip_test_SOURCES): New variable.
7560         (relro_strip_test_DEPENDENCIES): New variable.
7561         (relro_strip_test_LDFLAGS): New variable.
7562         (relro_strip_test_LDADD): New variable.
7563         (relro_strip_test.so): New target.
7564
7565 2010-08-02  Ian Lance Taylor  <iant@google.com>
7566
7567         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
7568         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
7569         (Target_i386::got_tlsdesc_section): New function.
7570         (Target_i386::got_section): Create space for GOT entries for
7571         TLSDESC relocations.
7572         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
7573         R_386_TLS_GOTDESC.
7574         (Target_i386::Scan::global): Likewise.
7575         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
7576         using TLSDESC GOT.
7577         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
7578         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
7579         (Target_x86_64::got_tlsdesc_section): New function.
7580         (Target_x86_64::got_section): Create space for GOT entries for
7581         TLSDESC relocations.
7582         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
7583         R_386_TLS_GOTDESC.
7584         (Target_x86_64::Scan::global): Likewise.
7585         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
7586         using TLSDESC GOT.
7587
7588 2010-08-02  Ian Lance Taylor  <iant@google.com>
7589
7590         * testsuite/final_layout.sh: Use dc to convert from hex to
7591         decimal.
7592
7593 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
7594
7595         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
7596         paramter to the call to gold::gc_process_relocs.
7597         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
7598         paramter to the call to gold::gc_process_relocs.
7599         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
7600         parameter to the call to gold::gc_process_relocs.
7601         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
7602         template parameter to the call to gold::gc_process_relocs.
7603         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
7604         paramter to the call to gold::gc_process_relocs.
7605         * gc.h (get_embedded_addend_size): New function.
7606         (gc_process_relocs): Save the size of the reloc for use by ICF.
7607         * icf.cc (get_section_contents): Get the addend from the text section
7608         for SHT_REL relocation sections.
7609         * icf.h (Icf::Reloc_addend_size_info): New typedef.
7610         (Icf::Reloc_info): Add new member reloc_addend_size_info.
7611         * int_encoding.h (read_from_pointer): New overloaded function.
7612         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
7613         * testsuite/icf_sht_rel_addend_test.sh: New file.
7614         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
7615         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
7616
7617 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7618
7619         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
7620         * Makefile.in: Regenerate.
7621         * testsuite/Makefile.in: Regenerate.
7622
7623 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
7624
7625         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
7626         * gold/testsuite/debug_msg.cc: Likewise.
7627         * gold/testsuite/odr_violation1.cc
7628         * gold/testsuite/odr_violation2.cc
7629
7630 2010-07-21  Cary Coutant  <ccoutant@google.com>
7631
7632         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
7633         string, and length fields.
7634         (Output_merge_string::Merged_strings_list): New type.
7635         (Output_merge_string::Merged_strings_lists): New typedef.
7636         (Output_merge_string): Replace merged_strings_ with
7637         merged_strings_lists_.
7638         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
7639         Merged_strings_list per input object and section.  Don't store pointer
7640         to the string.  Don't store length with each merged string entry.
7641         (Output_merge_string::finalize_merged_data): Loop over list of merged
7642         strings lists.  Recompute length of each merged string.
7643
7644 2010-07-15  Cary Coutant  <ccoutant@google.com>
7645
7646         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
7647         here.
7648
7649 2010-07-14  Ian Lance Taylor  <iant@google.com>
7650
7651         * descriptors.cc (Descriptors::open): Report correct name in error
7652         message.
7653
7654 2010-07-13  Doug Kwan  <dougkwan@google.com>
7655
7656         * arm.cc (Arm_input_section::Arm_input_section): For a
7657         SHT_ARM_EXIDX section, always keeps the input sections.
7658         (Arm_input_section::set_exidx_section_link): New method.
7659         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
7660         has_errors_ to false.
7661         (Arm_exidx_input_section::has_errors,
7662         Arm_exidx_input_section::set_has_errors): New methods.
7663         (Arm_exidx_input_section::has_errors_): New data member.
7664         (Arm_relobj::get_exidx_shndx_list): New method.
7665         (Arm_output_section::append_text_sections_to_list): Do not skip
7666         section without SHF_EXECINSTR.
7667         (Arm_output_section::fix_exidx_coverage): Skip input sections with
7668         errors.
7669         (Arm_relobj::make_exidx_input_section): Add new parameter for text
7670         section header.  Make error messages more verbose.  Check for
7671         a non-executable section linked to an EXIDX section.
7672         (Arm_relobj::do_read_symbols): Remove error checking, which has been
7673         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
7674         check that there is no deferred EXIDX section if we exit early.
7675         Instead of not making an EXIDX section in case of an error, make one
7676         and set the has_errors flag of it.
7677         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
7678         in a relocatable link.
7679         (Target_arm::do_relax): Look for the EXIDX output section instead of
7680         assuming that it is called .ARM.exidx.
7681         (Target_arm::fix_exidx_coverage): Add a new parameter for input
7682         section list.  Do not check for SHF_EXECINSTR section flags but
7683         skip any input section with errors.
7684         * output.cc (Output_section::Output_section): Initialize
7685         always_keeps_input_sections_ to false.
7686         (Output_section::add_input_section): Check for
7687         always_keeps_input_sections_.
7688         *  output.h (Output_section::always_keeps_input_sections,
7689         Output_section::set_always_keeps_input_sections): New methods.
7690         (Output_section::always_keeps_input_sections): New data member.
7691
7692 2010-07-13  Rafael Espindola  <espindola@google.com>
7693
7694         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
7695         * fileread.h (Input_file): Add try_extra_search_path and find_file.
7696
7697 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
7698             Ian Lance Taylor  <iant@google.com>
7699
7700         * output.h (Output_section_lookup_maps::add_merge_section):
7701         Correct check of whether value was inserted.
7702         (Output_section_lookup_maps::add_merge_input_section): Likewise.
7703         (Output_section_lookup_maps::add_relaxed_input_section):
7704         Likewise.
7705         * arm.cc (Target_arm::got_section): Remove used local os.
7706         * i386.cc (Target_i386::got_section): Likewise.
7707         * x86_64.cc (Target_x86_64::got_section): Likewise.
7708         * sparc.cc (Target_sparc::got_section): Likewise.
7709         (Target_sparc::relocate): Remove unused local have_got_offset.
7710         * powerpc.cc (Target_powerpc::relocate): Likewise.
7711
7712 2010-07-13  Ian Lance Taylor  <iant@google.com>
7713
7714         * compressed_output.cc (zlib_decompress): Fix signature in
7715         !HAVE_ZLIB_H case.
7716
7717         * archive.cc (Archive::include_member): Unlock an external member
7718         of a thin archive.  Don't bother to delete an object we know is
7719         NULL.
7720
7721 2010-07-12  Cary Coutant  <ccoutant@google.com>
7722
7723         * compressed_output.cc (zlib_decompress): New function.
7724         (get_uncompressed_size): New function.
7725         (decompress_input_section): New function.
7726         * compressed_output.h (get_uncompressed_size): New function.
7727         (decompress_input_section): New function.
7728         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
7729         Handle compressed debug sections.
7730         * layout.cc (is_compressed_debug_section): New function.
7731         (Layout::output_section_name): Map compressed section names to
7732         canonical names.
7733         * layout.h (is_compressed_debug_section): New function.
7734         (is_debug_info_section): Recognize compressed debug sections.
7735         * merge.cc: Include compressed_output.h.
7736         (Output_merge_data::do_add_input_section): Handle compressed
7737         debug sections.
7738         (Output_merge_string::do_add_input_section): Handle compressed
7739         debug sections.
7740         * object.cc: Include compressed_output.h.
7741         (Sized_relobj::Sized_relobj): Initialize new data members.
7742         (build_compressed_section_map): New function.
7743         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
7744         * object.h (Object::section_is_compressed): New method.
7745         (Object::do_section_is_compressed): New method.
7746         (Sized_relobj::Compressed_section_map): New type.
7747         (Sized_relobj::do_section_is_compressed): New method.
7748         (Sized_relobj::compressed_sections_): New data member.
7749         * output.cc (Output_section::add_input_section): Handle compressed
7750         debug sections.
7751         * reloc.cc: Include compressed_output.h.
7752         (Sized_relobj::write_sections): Handle compressed debug sections.
7753
7754 2010-07-08  Cary Coutant  <ccoutant@google.com>
7755
7756         * resolve.cc (Symbol_table::resolve): Remember whether undef was
7757         weak when resolving to a dynamic def.
7758         (Symbol_table::should_override): Add adjust_dyndef flag; set it
7759         for weak undef/dynamic def cases. Adjust callers.
7760         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
7761         undef_binding_weak_.
7762         (Symbol_table::sized_write_globals): Adjust symbol binding.
7763         (Symbol_table::sized_write_symbol): Add binding parameter.
7764         * symtab.h (Symbol::set_undef_binding): New method.
7765         (Symbol::is_undef_binding_weak): New method.
7766         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
7767         (Symbol_table::should_override): Add new parameter.
7768         (Symbol_table::sized_write_symbol): Add new parameter.
7769
7770         * testsuite/weak_undef_file1.cc: Add new test case.
7771         * testsuite/weak_undef_file2.cc: Fix header comment.
7772         * testsuite/weak_undef_test.cc: Add new test case.
7773
7774 2010-06-29  Doug Kwan  <dougkwan@google.com>
7775
7776         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
7777         Initialize USE_SYMBOL_.
7778         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
7779         definition.
7780         (Arm_reloc_property::uses_symbol_): New data member declaration.
7781         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
7782         uses symbol value and symbol is undefined but not weakly undefined.
7783
7784 2010-06-28  Rafael Espindola  <espindola@google.com>
7785
7786         * plugin.cc (Plugin::load): Use dlerror.
7787
7788 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
7789
7790         * symtab.cc (detect_odr_violations): When reporting an ODR
7791         violation, report an object where the symbol is defined.
7792
7793 2010-06-25  Doug Kwan  <dougkwan@google.com>
7794
7795         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
7796         (Target_arm::section_may_have_icf_unsafe_pointers): New method
7797         definition.
7798         (Target_arm::Scan::local_reloc_may_be_function_pointer,
7799         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
7800         target hook to detect function points.
7801         (Target_arm::Scan::possible_function_pointer_reloc): New method.
7802         * icf.h (Icf::check_section_for_function_pointers): Change type of
7803         parameter SECTION_NAME to const reference to std::string.  Use
7804         target hook to determine if section may have unsafe pointers.
7805         * target.h (Target::section_may_have_icf_unsafe_pointers): New
7806         method definition.
7807
7808 2010-06-21  Rafael Espindola  <espindola@google.com>
7809
7810         * fileread.cc (Input_file::find_fie): New
7811         (Input_file::open): Use Input_file::find_fie.
7812         * fileread.h (Input_file::find_fie): New
7813         * plugin.cc (set_extra_library_path): New.
7814         (Plugin::load): Add set_extra_library_path to the transfer vector.
7815         (Plugin_manager::set_extra_library_path): New.
7816         (Plugin_manager::add_input_file): Use the extra search path if set.
7817         (set_extra_library_path(): New.
7818         * plugin.h (Plugin_manager): Add set_extra_library_path and
7819         extra_search_path_.
7820
7821 2010-06-19  Cary Coutant  <ccoutant@google.com>
7822
7823         * layout.cc (gdb_sections): Add .debug_types.
7824         (lines_only_debug_sections): Likewise.
7825
7826 2010-06-18  Rafael Espindola  <espindola@google.com>
7827
7828         * plugin.cc (add_input_file,add_input_library)
7829         (Plugin_manager::add_input_file): Make filename arguments const.
7830         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
7831         const.
7832
7833 2010-06-16  Doug Kwan  <dougkwan@google.com>
7834
7835         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
7836         .ARM.attributes section if we have not merged any input
7837         attributes sections.
7838
7839 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7840
7841         * arm.cc: Allow combining objects with no EABI version
7842         information.
7843
7844 2010-06-15  Rafael Espindola  <espindola@google.com>
7845
7846         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
7847
7848 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7849
7850         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
7851         (struct iovec): Correct !HAVE_READV definition.
7852
7853 2010-06-10  Cary Coutant  <ccoutant@google.com>
7854
7855         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
7856         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
7857         reloc sections.
7858         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
7859
7860         PR 11683
7861         * symtab.h (Symbol::is_placeholder): New member function.
7862         * target-reloc.h (relocate_section): Check for placeholder symbols.
7863
7864         * testsuite/Makefile.am (plugin_test_8): New test.
7865         (plugin_test_9): New test.
7866         * testsuite/Makefile.in: Regenerate.
7867
7868 2010-06-09  Nick Clifton  <nickc@redhat.com>
7869
7870         * yyscript.y (input_list_element): Allow strings prefixed with
7871         the '-' character.  Treat these as libraries.
7872         * script.cc (script_add_library): New function.  Adds a library
7873         specified by "-l<name>" found in an input script.
7874         * script-c.h: Add prototype for script_add_library.
7875
7876 2010-06-07  Doug Kwan  <dougkwan@google.com>
7877
7878         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
7879         Restrict stub-group size to be within long conditional branch
7880         range when working around cortex-A8 erratum.
7881
7882 2010-06-07  Damien Diederen  <dd@crosstwine.com>
7883
7884         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
7885         #ifdef typo.
7886
7887 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
7888
7889         PR gold/11658
7890         * output.cc
7891         (Output_section::Input_section_sort_entry::compare_section_ordering):
7892         Change to return non-zero correctly.
7893         (Output_section::Input_section_sort_section_order_index_compare
7894         ::operator()): Change to fix ambiguity in comparisons.
7895
7896 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
7897
7898         * gold.h (is_wildcard_string): New function.
7899         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
7900         (Layout::layout_eh_frame): Ditto.
7901         (Layout::find_section_order_index): New method.
7902         (Layout::read_layout_from_file): New method.
7903         * layout.h (Layout::find_section_order_index): New method.
7904         (Layout::read_layout_from_file): New method.
7905         (Layout::input_section_position_): New private member.
7906         (Layout::input_section_glob_): New private member.
7907         * main.cc (main): Call read_layout_from_file here.
7908         * options.h (--section-ordering-file): New option.
7909         * output.cc (Output_section::input_section_order_specified_): New
7910         member.
7911         (Output_section::Output_section): Initialize new member.
7912         (Output_section::add_input_section): Add new parameter.
7913         Keep input sections when --section-ordering-file is used.
7914         (Output_section::set_final_data_size): Sort input sections when
7915         section ordering file is specified.
7916         (Output_section::Input_section_sort_entry): Add new parameter.
7917         Check sorting type.
7918         (Output_section::Input_section_sort_entry::compare_section_ordering):
7919         New method.
7920         (Output_section::Input_section_sort_compare::operator()): Change to
7921         consider section_order_index.
7922         (Output_section::Input_section_sort_init_fini_compare::operator()):
7923         Change to consider section_order_index.
7924         (Output_section::Input_section_sort_section_order_index_compare
7925         ::operator()): New method.
7926         (Output_section::sort_attached_input_sections): Change to sort
7927         according to section order when specified.
7928         (Output_section::add_input_section<32, true>): Add new parameter.
7929         (Output_section::add_input_section<64, true>): Add new parameter.
7930         (Output_section::add_input_section<32, false>): Add new parameter.
7931         (Output_section::add_input_section<64, false>): Add new parameter.
7932         * output.h (Output_section::add_input_section): Add new parameter.
7933         (Output_section::input_section_order_specified): New
7934         method.
7935         (Output_section::set_input_section_order_specified): New method.
7936         (Input_section::Input_section): Initialize section_order_index_.
7937         (Input_section::section_order_index): New method.
7938         (Input_section::set_section_order_index): New method.
7939         (Input_section::section_order_index_): New member.
7940         (Input_section::Input_section_sort_section_order_index_compare): New
7941         struct.
7942         (Output_section::input_section_order_specified_): New member.
7943         * script-sections.cc (is_wildcard_string): Delete and move modified
7944         method to gold.h.
7945         (Output_section_element_input::Output_section_element_input): Modify
7946         call to is_wildcard_string.
7947         (Output_section_element_input::Input_section_pattern
7948         ::Input_section_pattern): Ditto.
7949         (Output_section_element_input::Output_section_element_input): Ditto.
7950         * testsuite/Makefile.am (final_layout): New test case.
7951         * testsuite/Makefile.in: Regenerate.
7952         * testsuite/final_layout.cc: New file.
7953         * testsuite/final_layout.sh: New file.
7954
7955 2010-06-01  Rafael Espindola  <espindola@google.com>
7956
7957         * plugin.cc (Plugin::load): Pass the output name to the plugin.
7958
7959 2010-06-01  Rafael Espindola  <espindola@google.com>
7960
7961         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
7962         visibility of symbols.
7963
7964 2010-05-27  Doug Kwan  <dougkwan@google.com>
7965
7966         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
7967         from start of output section instead of address for a local symbol
7968         in a merged or relaxed section when doing a relocatable link.
7969
7970 2010-05-26  Rafael Espindola  <espindola@google.com>
7971
7972         PR 11604
7973         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
7974         adding sections the garbage collector removed.
7975         * gold/testsuite/Makefile.am: Add test.
7976         * gold/testsuite/Makefile.in: Regenerate.
7977         * gold/testsuite/plugin_test_7.sh: New.
7978         * gold/testsuite/plugin_test_7_1.c: New.
7979         * gold/testsuite/plugin_test_7_2.c: New.
7980
7981 2010-05-26  Rafael Espindola  <espindola@google.com>
7982
7983         * script-sections.cc (Output_section_definition::set_section_addresses):
7984         Check for --section-start.
7985
7986 2010-05-26  Doug Kwan  <dougkwan@google.com>
7987
7988         * arm.cc (Arm_scan_relocatable_relocs): New class.
7989         (Target_arm::relocate_special_relocatable): New method.
7990         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
7991         (Arm_relocate_functions::thumb_branch_common): Same.
7992         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
7993         instead of Default_scan_relocatable_relocs.
7994         * target-reloc.h (relocate_for_relocatable): Let target handle
7995         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
7996         * target.h (Sized_target::relocate_special_relocatable): New method.
7997
7998 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7999
8000         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
8001
8002 2010-05-23  Doug Kwan  <dougkwan@google.com>
8003
8004         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
8005         instead of a cast.
8006         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
8007         with a direct branch, not a conditional branch, to a stub.
8008         * merge.cc (Output_merge_base::record_input_section): New method
8009         defintion.
8010         (Output_merge_data::do_add_input_section): Record input section if
8011         keeps-input-sections flag is set.
8012         (Output_merge_string::do_add_input_section): Ditto.
8013         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
8014         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
8015         INPUT_SECTIONS_.
8016         (Output_merge_base::keeps_input_sections,
8017         Output_merge_base::set_keeps_input_sections,
8018         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
8019         method definitions.
8020         (Output_merge_base::Input_sections): New type declaration.
8021         (Output_merge_base::input_sections_begin,
8022         Output_merge_base::input_sections_end,
8023         Output_merge_base::do_set_keeps_input_sections): New method definitions.
8024         (Output_merge_base::bool keeps_input_sections_,
8025         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
8026         Output_merge_base::input_sections_): New data members.
8027         (Output_merge_data::do_set_keeps_input_sections): New method
8028         defintion.
8029         (Output_merge_string::do_set_keeps_input_sections): Ditto.
8030         * output.cc (Output_section::Input_section::relobj): Move method
8031         defintion from class declaration to here and handle merge sections.
8032         (Output_section::Input_section::shndx): Ditto.
8033         (Output_section::Output_section): Remove initializations of removed
8034         data members and initialize new data member LOOKUP_MAPS_.
8035         (Output_section::add_input_section): Set keeps-input-sections flag
8036         for a newly created merge output section as appropriate.  Adjust code
8037         to use Output_section_lookup_maps class.
8038         (Output_section::add_relaxed_input_section): Adjst code for lookup
8039         maps code refactoring.
8040         (Output_section::add_merge_input_section): Add a new parameter
8041         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
8042         class.  If adding input section to a newly created merge output
8043         section fails, remove the new merge section.
8044         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
8045         Adjust code for use of the Output_section_lookup_maps class.
8046         (Output_section::find_merge_section): Ditto.
8047         (Output_section::build_lookup_maps): New method defintion.
8048         (Output_section::find_relaxed_input_section): Adjust code to use
8049         Output_section_lookup_maps class.
8050         (Output_section::get_input_sections): Export merge sections.  Adjust
8051         code to use Output_section_lookup_maps class.
8052         (Output_section:::add_script_input_section): Adjust code to use
8053         Output_section_lookup_maps class.  Update lookup maps for merge
8054         sections also.
8055         (Output_section::discard_states): Use Output_section_lookup_maps.
8056         (Output_section::restore_states): Same.
8057         * output.h (Merge_section_properties): Move class defintion out of
8058         Output_section.
8059         (Output_section_lookup_maps): New class.
8060         (Output_section::Input_section::is_merge_section): New method
8061         defintion.
8062         (Output_section::Input_section::relobj): Move defintion out of class
8063         defintion.  Declare method only.
8064         (Output_section::Input_section::shndx): Ditto.
8065         (Output_section::Input_section::output_merge_base): New method defintion.
8066         (Output_section::Input_section::u2_.pomb): New union field.
8067         (Output_section::Merge_section_by_properties_map,
8068         Output_section::Output_section_data_by_input_section_map,
8069         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
8070         Remove types.
8071         (Output_section::add_merge_input_section): Add new parameter
8072         KEEPS_INPUT_SECTIONS.
8073         (Output_section::build_lookup_maps): New method declaration.
8074         (Output_section::merge_section_map_,
8075         Output_section::merge_section_by_properties_map_,
8076         Output_section::relaxed_input_section_map_,
8077         Output_section::is_relaxed_input_section_map_valid_): Remove data
8078         members.
8079         (Output_section::lookup_maps_): New data member.
8080
8081 2010-05-21  Doug Kwan  <dougkwan@google.com>
8082
8083         PR gold/11619
8084         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
8085         avoid a compilation error.
8086
8087 2010-05-19  Rafael Espindola  <espindola@google.com>
8088
8089         * script-sections.cc (Output_section_definition::allocate_to_segment):
8090         Update the phdrs_list even when the output section is NULL.
8091         * testsuite/Makefile.am: Add test.
8092         * testsuite/Makefile.in: Regenerate.
8093         * testsuite/script_test_9.cc: New.
8094         * testsuite/script_test_9.sh: New.
8095         * testsuite/script_test_9.t: New.
8096
8097 2010-05-19  Doug Kwan  <dougkwan@google.com>
8098
8099         * arm.cc (Arm_input_section::original_size): New method.
8100         (Arm_input_section::do_addralign): Add a cast.
8101         (Arm_input_section::do_output_offset): Remove static cast.
8102         (Arm_input_section::original_addralign,
8103          Arm_input_section::original_size_): Change type to uint32_t.
8104         (Arm_input_section::init): Add safe casts for section alignment
8105         and size.
8106         (Arm_input_section::set_final_data_size): Do not set address and
8107         offset of stub table.
8108         (Arm_output_section::fix_exidx_coverage): Change use of of
8109         Output_section::Simple_input_section to that of
8110         Output_section::Input_section.
8111         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
8112         except for the first pass.
8113         * output.cc (Output_section::get_input_sections): Change type of
8114         input_sections to std::list<Input_section>.
8115         (Output_section::add_script_input_section): Rename from
8116         Output_section::add_simple_input_section.  Change type of SIS
8117         parameter from Simple_input_section to Input_section.
8118         * output.h (Output_section::Simple_input_section): Remove class.
8119         (Output_section::Input_section): Change class visibility to public.
8120         (Output_section::Input_section::addralign): Use stored alignments
8121         for special input sections if set.
8122         (Output_section::Input_section::set_addralign): New method.
8123         (Output_section::get_input_sections): Change parameter type from
8124         list of Simple_input_section to list of Input_section.
8125         (Output_section::add_script_input_section): Rename from
8126         Output_section::add_simple_input_section. Change first parameter's
8127         type from Simple_input_section to Input_section and remove the
8128         second and third parameters.
8129         * script-sections.cc (Input_section::Input_section_list): Change
8130         type to list of Output_section::Input_section/
8131         (Input_section_info::Input_section_info): Change parameter type of
8132         INPUT_SECTION to Output_section::Input_section.
8133         (Input_section_info::input_section): Change return type.
8134         (Input_section_info::input_section_): Change type to
8135         Output_section::Input_section.
8136         (Output_section_element_input::set_section_addresses): Adjust code
8137         to use Output_section::Input_section instead of
8138         Output_section::Simple_input_section.  Adjust code for renaming
8139         of Output_section::add_simple_input_section.
8140         (Orphan_output_section::set_section_addresses): Ditto.
8141
8142 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8143
8144         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
8145         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
8146
8147 2010-05-18  Rafael Espindola  <espindola@google.com>
8148
8149         * options.cc (General_options::finalize): Handle -nostdlib.
8150         * options.h (nostdlib): New option.
8151         * script.cc (script_add_search_dir): Handle -nostdlib.
8152
8153 2010-05-12  Doug Kwan  <dougkwan@google.com>
8154
8155         * arm.cc (Target_arm::do_finalize_sections): Create an empty
8156         attributes section only if there no attributes section after merging.
8157         (Target_arm::merge_object_attributes): Move value of
8158         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
8159         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
8160         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
8161         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
8162         and arm_attr_merge_7.stdout.
8163         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
8164         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
8165         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
8166         arm_attr_merge_7b.o): New rules.
8167         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
8168         arm_attr_merge_7
8169         * testsuite/Makefile.in: Regenerate.
8170         * testsuite/arm_attr_merge.sh: New file.
8171         * testsuite/arm_attr_merge_[67][ab].s: Same.
8172
8173 2010-05-05  Nick Clifton  <nickc@redhat.com>
8174
8175         * po/es.po: Updated Spanish translation.
8176
8177 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
8178
8179         * Makefile.am (install-exec-local): Properly install gold as
8180         default cross linker.
8181         * Makefile.in: Regenerated.
8182
8183 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
8184             Nick Clifton  <nickc@redhat.com>
8185
8186         * configure.ac (install_as_default): Define and set to false
8187         unless --enable-gold or --enable-gold=both/gold has been
8188         specified.
8189         * configure: Regenerate.
8190
8191         * Makefile.am (install-exec-local): Install the executable as
8192         'ld.gold'.  If install_as_default is true then also install it as
8193         'ld'.
8194         * Makefile.in: Regenerated.
8195
8196 2010-04-24  Ian Lance Taylor  <iant@google.com>
8197
8198         * layout.cc (Layout::layout_reloc): In relocatable link don't
8199         combine reloc sections for grouped sections.
8200
8201 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
8202
8203         * gc.h (gc_process_relocs): Pass information on relocs pointing to
8204         sections that are not ordinary to icf.
8205         * icf.cc (get_section_contents): Handle relocation pointing to section
8206         with no object or shndx information.
8207         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
8208         * testsuite/Makefile.in: Regenerate.
8209         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
8210         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
8211
8212 2010-04-22  Ian Lance Taylor  <iant@google.com>
8213
8214         * expression.cc (Expression::Expression_eval_info): Add
8215         result_alignment_pointer field.
8216         (Expression::eval_with_dot): Add result_alignment_pointer
8217         parameter.  Change all callers.
8218         (Expression::eval_maybe_dot): Likewise.
8219         (class Binary_expression): Add alignment_pointer parameter to
8220         left_value and right_value.  Change all callers.
8221         (BINARY_EXPRESSION): Set result alignment.
8222         (class Trinary_expression): Add alignment_pointer parameter to
8223         arg2_value and arg3_value.  Change all callers.
8224         (Trinary_cond::value): Set result alignment.
8225         (Max_expression::value, Min_expression::value): Likewise.
8226         (Align_expression::value): Likewise.
8227         * script-sections.cc (class Sections_element): Add dot_alignment
8228         parameter to set_section_addresses virtual function.  Update
8229         instantiations.
8230         (class Output_section_element): Likewise.
8231         (Script_sections::create_segments): Add dot_alignment parameter.
8232         Change all callers.
8233         (Script_sections::create_segments_from_phdrs_clause): Likewise.
8234         (Script_sections::set_phdrs_clause_addresses): Likewise.
8235         * script-sections.h: Update declarations.
8236         * script.h: Update declarations.
8237         * output.h (Output_segment::set_minimum_p_align): Don't decrease
8238         min_p_align.
8239         * testsuite/script_test_3.t: Set large alignment.
8240         * testsuite/script_test_3.sh: Make sure that at least one LOAD
8241         segment has expected alignment.
8242
8243 2010-04-22  Nick Clifton  <nickc@redhat.com>
8244
8245         * po/gold.pot: Updated by the Translation project.
8246         * po/vi.po: Updated Vietnamese translation.
8247
8248 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
8249
8250         * testsuite/Makefile.am (check_PROGRAMS): Add
8251         icf_virtual_function_folding_test.
8252         * testsuite/Makefile.in: Regenerated.
8253
8254 2010-04-15  Andrew Haley  <aph@redhat.com>
8255
8256         * options.h (merge_exidx_entries): New option.
8257         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
8258         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
8259         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
8260         (Target_arm::merge_exidx_entries): New function.
8261         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
8262         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
8263         to Arm_exidx_fixup constructor.
8264         Add new arg, merge_exidx_entries.
8265         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
8266         Arm_output_section::fix_exidx_coverage.
8267
8268 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
8269
8270         * icf.cc (get_section_contents): Check for preemptible functions.
8271         Ignore addend when appropriate.
8272         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
8273         section folded.
8274         (add_from_relobj): Check for section folded.
8275         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
8276         * symtab.h (should_add_dynsym_entry): Add new parameter.
8277         * target-reloc.h (scan_relocs): Check for section folded.
8278         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
8279         Check reloc types for function pointers in shared objects.
8280         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
8281         case.
8282         (icf_preemptible_functions_test): New test case.
8283         (icf_string_merge_test): New test case.
8284         * testsuite.Makefile.in: Regenerate.
8285         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
8286         bar_glob.  Refactor code.
8287         * testsuite/icf_preemptible_functions_test.cc: New file.
8288         * testsuite/icf_preemptible_functions_test.sh: New file.
8289         * testsuite/icf_string_merge_test.cc: New file.
8290         * testsuite/icf_string_merge_test.sh: New file.
8291         * testsuite/icf_virtual_function_folding_test.cc: New file.
8292         * testsuite/icf_virtual_function_folding_test.sh: New file.
8293
8294 2010-04-14  Doug Kwan  <dougkwan@google.com>
8295
8296         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
8297         for local symbol recounting if we remove a section due to ICF.
8298         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
8299         there are no regular objects in input.
8300
8301 2010-04-13  Doug Kwan  <dougkwan@google.com>
8302
8303         * arm.cc (Arm_input_section::set_final_data_size): Compute
8304         accurate final data size instead of using current data size.
8305
8306 2010-04-09  Doug Kwan  <dougkwan@google.com>
8307
8308         * layout.cc (Layout::choose_output_section): Handle script section
8309         types.
8310         (Layout::make_output_section_for_script): Add section type parameter.
8311         Handle script section types.
8312         * layout.h (Layout::make_output_section_for_script): Add section
8313         type parameter.
8314         * output.cc (Output_section::Output_section): Initialize data member
8315         is_noload_.
8316         (Output_section::do_reset_address_and_file_offset): Do not set address
8317         to 0 if section is a NOLOAD section.
8318         * output.h (Output_section::is_noload): New method.
8319         (Output_section::set_is_noload): Ditto.
8320         (Output_section::is_noload_): New data member.
8321         * script-c.h (Script_section_type): New enum type.
8322         (struct Parser_output_section_header): Add new file section_type.
8323         * script-sections.cc (Sections_element::output_section_name): Add
8324         parameter for returning script section type.
8325         (Output_section_definition::output_section_name): Ditto.
8326         (Output_section_definition::section_type)P; New method.
8327         (Output_section_definiton::script_section_type_name): Ditto.
8328         (Output_section_definition::script_section_type_): New data member.
8329         (Output_section_definition::Output_section_definition): Initialize
8330         data member Output_section_definition::script_section_type_.
8331         (Output_section_definition::create_sections): Pass script section type
8332         to Layout::make_output_section_for_script.
8333         (Output_section_definition::output_section_name): Return script
8334         section type to caller.
8335         (Output_section_definition::set_section_address): Do not advance
8336         dot value and load address if section type is NOLOAD.  Set address
8337         of NOLOAD sections regardless of section flags.
8338         (Output_section_definition::print): Print section type if it is
8339         not SCRIPT_SECTION_TYPE_NONE.
8340         (Output_section_definition::section_type): New method.
8341         (Output_section_definition::script_section_type_name): Ditto.
8342         (Script_sections::output_section_name): Add new parameter
8343         PSECTION_TYPE for returning script section type.  Pass it to
8344         section elements.  Handle discard sections.
8345         (Sort_output_sections::operator()): Handle NOLOAD sections.
8346         * script-sections.h (Script_sections::Section_type): New enum type.
8347         (Script_sections::output_section_name): Add a new parameter for
8348         returning script section type.
8349         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
8350         INFO and NOLOAD.
8351         * yyscript.y (union): Add new field SECTION_TYPE.
8352         (COPY, DSECT, INFO, NOLOAD): New tokens.
8353         (opt_address_and_section_type): Change type to output_section_header.
8354         (section_type): New non-terminal
8355         (section_header): Handle section type.
8356         (opt_address_and_section_type): Return section type value.
8357
8358 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
8359
8360         * testsuite/plugin_common_test_1.c (foo): Add prototype.
8361         * testsuite/plugin_common_test_2.c (foo): Likewise.
8362
8363 2010-04-08  Doug Kwan  <dougkwan@google.com>
8364
8365         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
8366         Output_merge_data.
8367         * output.cc (Output_section::add_merge_input_section): Simplify
8368         code and return status of Output_merge_base::add_input_section.
8369         Update merge section map only if Output_merge_base::add_input_section
8370         returns true.
8371
8372 2010-04-07  Doug Kwan  <dougkwan@google.com>
8373
8374         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
8375         if section is marked as containing instructions but has no mapping
8376         symbols.
8377         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
8378         correct section index.
8379         (Arm_relobj::find_linked_text_section): Ditto.
8380
8381 2010-04-07  Cary Coutant  <ccoutant@google.com>
8382
8383         * archive.cc (include_member): Destroy Read_symbols_data object before
8384         releasing file.
8385         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
8386         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
8387         (Read_symbols_data::~Read_symbols_data) New destructor.
8388         (Section_relocs::Section_relocs) New constructor.
8389         (Section_relocs::~Section_relocs) New destructor.
8390         (Read_relocs_data::Read_relocs_data) New constructor.
8391         (Read_relocs_data::~Read_relocs_data) New destructor.
8392         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
8393         pointers to NULL after deleting.
8394
8395 2010-04-07  Doug Kwan  <dougkwan@google.com>
8396
8397         * arm.cc: Replace "endianity" with "endianness" in comments.
8398         (Arm_exidx_cantunwind): Ditto.
8399         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
8400         (Arm_relobj::merge_flags_and_attributes): New method.
8401         (Arm_relobj::merge_flags_and_attributes_): New data member.
8402         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
8403         (Arm_relobj::scan_sections_for_stubs): Ditto.
8404         (Arm_relobj::do_read_symbols): Check to see if we really want to
8405         merge processor-specific flags and attributes.  Exit early if
8406         an object is empty except for section names and the undefined symbol.
8407         (Target_arm::do_finalize_sections): Move check for ELF format to
8408         Arm_relobj::do_read_symbols.  Merge processor specific flags and
8409         attributes from a regular object only when we have determined that
8410         it is aapropriate.  Do not create an .ARM.attributes section in
8411         output if there is no regular input object.
8412         (Target_arm::merge_processor_specific_flags): Check
8413         --warn-mismatch before printing any error.
8414         (Target_arm::merge_object_attributes): Ditto.
8415         * gold.cc (queue_middle_tasks): Handle the case in which there is
8416         no regular object in input.
8417         * options.cc (General_options::parse_EB): New method.
8418         (General_options::parse_EL): Same.
8419         (General_options::General_options): Initialize endianness_.
8420         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
8421         New options.
8422         (General_options::Endianness): New enum.
8423         (General_options::endianness): New method.
8424         (General_options::endianness_): New data member.
8425         * parameters.cc (Parameters::set_options): Check target endianness.
8426         (Parameters::set_target_once): Ditto.
8427         (Parameters::check_target_endianness): New method.
8428         (parameters_force_valid_target): If either -EL or -EB is specified,
8429         use it to define endianness of default target.
8430         * parameters.h (Parameters::check_target_endianness): New method
8431         declaration.
8432         * target.h (class Target): Change "endianity" to "endianness"
8433         in comments.
8434
8435 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8436
8437         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
8438         * configure: Regenerate.
8439         * Makefile.in: Regenerate.
8440         * testsuite/Makefile.in: Regenerate.
8441
8442 2010-04-06  Cary Coutant  <ccoutant@google.com>
8443
8444         gcc PR lto/42757
8445         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
8446         prevailing definitions of common symbols.
8447         * testsuite/plugin_test_6.sh: New test case.
8448         * testsuite/plugin_common_test_1.c: New test case.
8449         * testsuite/plugin_common_test_2.c: New test case.
8450         * testsuite/Makefile.am (plugin_test_6): New test case.
8451         * testsuite/Makefile.in: Regenerate.
8452
8453 2010-04-06  Nick Clifton  <nickc@redhat.com>
8454
8455         * po/vi.po: New Vietnamese translation.
8456
8457 2010-03-30  Doug Kwan  <dougkwan@google.com>
8458
8459         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
8460
8461 2010-03-25  Doug Kwan  <dougkwan@google.com>
8462
8463         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
8464         to avoid a conversion warning on a 32-bit host.
8465
8466 2010-03-24  Ian Lance Taylor  <iant@google.com>
8467
8468         * testsuite/script_test_3.t: Add a TLS segment.
8469         * testsuite/Makefile.am (check_PROGRAMS): Add
8470         tls_phdrs_script_test.
8471         (tls_phdrs_script_test_SOURCES): Define.
8472         (tls_phdrs_script_test_DEPENDENCIES): Define.
8473         (tls_phdrs_script_test_LDFLAGS): Define.
8474         (tls_phdrs_script_test_LDADD): Define.
8475         * testsuite/Makefile.in: Rebuild.
8476
8477 2010-03-23  Cary Coutant  <ccoutant@google.com>
8478
8479         * fileread.cc (find_or_make_view): Fix comment.
8480
8481 2010-03-23  Ian Lance Taylor  <iant@google.com>
8482
8483         * script-sections.cc (class Orphan_section_placement): Define
8484         PLACE_TLS and PLACE_TLS_BSS.
8485         (Orphan_section_placement::Orphan_section_placement): Initialize
8486         new places.
8487         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
8488         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
8489         (tls_script_test_SOURCES): Define.
8490         (tls_script_test_DEPENDENCIES): Define.
8491         (tls_script_test_LDFLAGS): Define.
8492         (tls_script_test_LDADD): Define.
8493         * testsuite/Makefile.in: Rebuild.
8494
8495 2010-03-22  Doug Kwan  <dougkwan@google.com>
8496
8497         * arm.cc (Arm_relocate_functions::abs8,
8498         Arm_relocate_functions::abs16): Use correct check for overflow
8499         specified in the ARM ELF specs.
8500         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
8501         target of a BLX instruction specially.
8502         (Reloc_stub::stub_type_for_reloc): Ditto.
8503         (Relocate::relocate): Use symbolic names instead of numeric relocation
8504         codes to report error.
8505         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
8506         workaround.
8507         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
8508         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
8509         thumb2_blx_out_of_range.stdout
8510         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
8511         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
8512         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
8513         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
8514         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
8515         thumb2_blx_in_range, thumb2_blx_in_range.o,
8516         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
8517         thumb2_blx_out_of_range.o): New rules.
8518         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
8519         thumb2_blx_in_range and thumb2_blx_out_of_range.
8520         * testsuite/Makefile.in: Regenerate.
8521         * arm_branch_in_range.sh: Add tests for THUMB BLX.
8522         * testsuite/thumb_blx_in_range.s: New file.
8523         * testsuite/thumb_blx_out_of_range.s: New file.
8524
8525 2010-03-22  Rafael Espindola  <espindola@google.com>
8526
8527         * archive.cc (Should_include): Move to archive.h.
8528         (should_include_member): Make it a member of Archive.
8529         (Lib_group): New.
8530         (Add_lib_group_symbols): New.
8531         * archive.h: Include options.h.
8532         (Archive_member): Moved from Archive.
8533         (Should_include): Moved from archive.cc.
8534         (Lib_group): New.
8535         (Add_lib_group_symbols): New.
8536         * dynobj.cc (do_should_include_member): New.
8537         * dynobj.h (do_should_include_member): New.
8538         * gold.cc (queue_initial_tasks): Update call to queue.
8539         * main.cc (main): Print lib group stats.
8540         * object.cc (do_should_include_member): New.
8541         * object.h: Include archive.h.
8542         (Object::should_include_member): New.
8543         (Object::do_should_include_member): New.
8544         (Sized_relobj::do_should_include_member): New.
8545         * options.cc (General_options::parse_start_lib): New.
8546         (General_options::parse_end_lib): New.
8547         (Input_arguments::add_file): Handle lib groups.
8548         (Input_arguments::start_group): Check we are not in a lib.
8549         (Input_arguments::start_lib): New.
8550         (Input_arguments::end_lib): New.
8551         * options.h (General_options): Add start_lib and end_lib.
8552         (Input_argument::lib_): New.
8553         (Input_argument::lib): New.
8554         (Input_argument::is_lib): New.
8555         (Input_file_lib): New.
8556         (Input_arguments::in_lib_): New.
8557         (Input_arguments::in_lib): New.
8558         (Input_arguments::start_lib): New.
8559         (Input_arguments::end_lib_): New.
8560         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
8561         in unused members as preempted.
8562         (Sized_pluginobj::do_should_include_member): New.
8563         * plugin.h (Sized_pluginobj::do_should_include_member): New.
8564         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
8565         return the blocker.
8566         (Read_symbols::do_whole_lib_group): New.
8567         (Read_symbols::do_lib_group): New.
8568         (Read_symbols::do_read_symbols): Handle lib groups.
8569         (Read_symbols::get_name): Handle lib groups.
8570         * readsyms.h (Read_symbols): Add an archive member pointer.
8571         (Read_symbols::do_whole_lib_group): New.
8572         (Read_symbols::do_lib_group): New.
8573         (Read_symbols::member_): New.
8574         * script.cc (read_input_script): Update call to queue_soon.
8575
8576 2010-03-19  Doug Kwan  <dougkwan@google.com>
8577
8578         * arm.cc (Stub_table::Stub_table): Initialize new data members
8579         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
8580         (Stub_table::add_reloc_stub): Assign stub offset and update
8581         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
8582         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
8583         New data members.
8584         (Stub_table::update_data_size_and_addralign): Use
8585         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
8586         instead of going over all reloc stubs.
8587         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
8588         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
8589         Stringpool_template::offset_ to size of Stringpool_char.
8590         (Stringpool_template::new_key_offset): Remove code to initialize
8591         Stringpool_template::offset_.
8592         * stringpool.h (Stringpool_template::set_no_zero_null): Set
8593         Stringpool_template::offset_ to zero.
8594
8595 2010-03-15  Doug Kwan  <dougkwan@google.com>
8596
8597         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
8598         offset_.
8599         (Stringpool_template::new_key_offset): New method.
8600         (Stringpool_template::add_string): Assign offsets when adding new
8601         strings.
8602         (Stringpool_template::set_string_offsets): Do not set string offsets
8603         when not optimizing.
8604         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
8605         member size_.
8606         (Chunked_vector::clear): Clear size_.
8607         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
8608         (Chunked_vector::size): Return size_.
8609         (Chunked_vector::push_back): Use size_ to find insert position.
8610         (Chunked_vector::size_): New data member.
8611         (Stringpool_template::set_no_zero_null): Assert string set is empty.
8612         (Stringpool_template::new_key_offset): New method declaration.
8613         (Stringpool_template::offset_): New data member.
8614
8615 2010-03-15   Rafael Espindola  <espindola@google.com>
8616
8617         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
8618         Add_symbols' constructor.
8619         * readsyms.h (Add_symbols): Remove the input_group member.
8620
8621 2010-03-10  Ian Lance Taylor  <iant@google.com>
8622
8623         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
8624         target to ask whether a reference to a symbol requires a stack
8625         split.
8626         * target.h (Target::is_call_to_non_split): New function.
8627         (Target::do_is_call_to_non_split): Declare virtual function.
8628         * target.cc: Include "symtab.h".
8629         (Target::do_is_call_to_non_split): New function.
8630         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
8631
8632 2010-03-10  Cary Coutant  <ccoutant@google.com>
8633
8634         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
8635         (File_read::open[1]): Remove initial mapping of whole_file_view_.
8636         (File_read::open[2]): Add whole_file_view_ to list of views.
8637         (File_read::make_view): Remove test of whole_file_view_.
8638         (File_read::find_or_make_view): Create whole_file_view_ if
8639         necessary.
8640         (File_read::clear_views): Replace bool parameter with enum;
8641         adjust all callers.  Don't delete views with permanent data;
8642         do delete cached views and views from archives if
8643         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
8644         if clearing the corresponding view.
8645         * fileread.h (File_read::Clear_views_mode): New enum.
8646         (File_read::View::is_permanent_view): New method.
8647         (File_read::clear_views): Replace bool parameter
8648         with enum; adjust all callers.
8649         * options.h (General_options): Change keep_files_mapped option;
8650         add map_whole_files.
8651         * readsyms.cc (Add_symbols::run): Delete sd_ object before
8652         releasing the file.
8653         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
8654         the file.
8655
8656 2010-03-10  David S. Miller  <davem@davemloft.net>
8657
8658         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
8659
8660 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
8661
8662         * icf.cc (get_section_contents): Add '@' marker after processing the
8663         merge reloc.
8664
8665 2010-03-08  Doug Kwan  <dougkwan@google.com>
8666
8667         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
8668         due to a conversion warning.
8669         (Arm_relobj::update_output_local_symbol_count): Check for local
8670         symbol with unset output index.
8671
8672 2010-03-05  Ian Lance Taylor  <iant@google.com>
8673
8674         * options.h (class General_options): Add --spare-dynamic-tags.
8675         * output.cc (Output_data_dynamic::set_final_data_size): Implement
8676         --spare-dynamic-tags.
8677
8678 2010-03-05  Ian Lance Taylor  <iant@google.com>
8679
8680         * incremental.cc: Include "libiberty.h".
8681
8682 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
8683
8684         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
8685         function, is_info_ member.
8686         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
8687         (Versions::Versions): Update caller.
8688         (Versions::define_base_version): Likewise.
8689         (Versions::add_def): Likewise.
8690
8691 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
8692
8693         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
8694         (Scan::possible_function_pointer_reloc): New function.
8695         (Scan::local_reloc_may_be_function_pointer): Change to call
8696         possible_function_pointer_reloc.
8697         (Scan::global_reloc_may_be_function_pointer): Ditto.
8698         * icf.h (Icf::check_section_for_function_pointers): Change to reject
8699         relocations in ".data.rel.ro._ZTV" section.
8700         * testsuite/icf_safe_so_test.sh: Change to pass i386.
8701         * testsuite/icf_safe_so_test.cc: Ditto.
8702         * testsuite/icf_safe_test.cc: Ditto.
8703         * testsuite/icf_safe_test.sh: Ditto.
8704
8705 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8706             Ian Lance Taylor  <iant@google.com>
8707
8708         * target-reloc.h (relocate_section): Check the symbol table index
8709         for -1U before setting the local symbol index.
8710         (scan_relocatable_relocs): If copying the relocation, record that
8711         the local symbol is required.
8712         * object.h (Symbol_value::is_output_symtab_index_set): New
8713         function.
8714         (Symbol_value::may_be_discarded_from_output_symtab): New
8715         function.
8716         (Symbol_value::has_output_symtab_entry): New function.
8717         (Symbol_value::needs_output_symtab_entry): Remove.
8718         (Symbol_value::output_symtab_index): Make sure the symbol index is
8719         set.
8720         (Symbol_value::set_output_symtab_index): Make sure the symbol
8721         index is not set.  Make sure the new index is valid.
8722         (Symbol_value::set_must_have_output_symtab_entry): New function.
8723         (Symbol_value::has_output_dynsym_entry): New function.
8724         (Symbol_value::set_output_dynsym_index): Make sure the new index
8725         is valid.
8726         (Sized_relobj::set_must_have_output_symtab_entry): New function.
8727         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
8728         local symbol if permitted.
8729         (Sized_relobj::do_finalize_local_symbols): Call
8730         is_output_symtab_index_set rather than needs_output_symtab_entry.
8731         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
8732         rather than needs_output_symtab_entry.  Call
8733         has_output_dynsym_entry rather than needs_output_dynsym_entry.
8734         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
8735         is_output_symtab_index_set rather than needs_output_symtab_entry.
8736         * testsuite/discard_locals_relocatable_test.c: New file.
8737         * testsuite/discard_locals_test.sh: Test -r.
8738         * testsuite/Makefile.am (check_DATA): Add
8739         discard_locals_relocatable_test1.syms,
8740         discard_local_relocatable_test2.syms.
8741         (MOSTLYCLEANFILES): Likewise.  Also add
8742         discard_locals_relocatable_test1.lout and
8743         discard_locals_relocatable_test2.out.
8744         (discard_locals_relocatable_test1.syms): New target.
8745         (discard_locals_relocatable_test.o): New target.
8746         (discard_locals_relocatable_test1.out): New target.
8747         (discard_locals_relocatable_test2.syms): New target.
8748         (discard_locals_relocatable_test2.out): New target.
8749         (various): Add missing ../ld-new dependencies.
8750         * testsuite/Makefile.in: Rebuild.
8751
8752 2010-03-03  Nick Clifton  <nickc@redhat.com>
8753
8754         * po/fi.po: New Finnish translation.
8755
8756 2010-03-01  Doug Kwan  <dougkwan@google.com>
8757
8758         * layout.cc (Layout::Layout): Force section types of .init_array*,
8759         .preinit_array* and .fini_array* sections.
8760         * output.cc (Output_section::Input_section_sort_entry::has_priority):
8761         Fix check of return value of std::string::find.().
8762         (Output_section::Input_section_sort_compare::operator()): Remove
8763         comment about .init_array.
8764         (Output_section::Input_section_sort_init_fini_compare::operator()):
8765         New method.
8766         (Output_section::sort_attached_input_sections): Handle .init_array
8767         and .fini_array specially.
8768         * output.h (Output_section::Inut_section_sort_compare): Update
8769         comment.
8770         (Output_section::Input_section_sort_init_fini_compare): New struct.
8771
8772 2010-02-26  Doug Kwan  <dougkwan@google.com>
8773
8774         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
8775         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
8776         * testsuite/debug_msg.sh: Avoid matching source line number for
8777         use of global variable undef_int.
8778
8779 2010-02-26  Doug Kwan  <dougkwan@google.com>
8780
8781         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
8782         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
8783         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
8784         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
8785         * options.cc (General_options::General_options): Initialize member
8786         fix_v4bx_.
8787         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
8788         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
8789         and rm_no_fix_v4bx.stdout
8790         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
8791         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
8792         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
8793         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
8794         and arm_no_fix_v4bx.
8795         * Makefile.in: Regenerate.
8796         * testsuite/arm_fix_v4bx.s: New file.
8797         * testsuite/arm_fix_v4bx.sh: Ditto.
8798
8799 2010-02-24  Doug Kwan  <dougkwan@google.com>
8800
8801         * arm.cc (Target_arm::got_section): Make the .got section the first
8802         non RELRO section in the data segment.
8803         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
8804         suffixes of section names.
8805
8806 2010-02-24  Doug Kwan  <dougkwan@google.com>
8807
8808         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
8809         flags and attributes merging if an input file is a binary file.
8810         * fileread.cc (Input_file::open): Record format of original file.
8811         * fileread.h (Input_file::Format): New enum type.
8812         (Input_file::Input_file): Initialize data member format_.
8813         (Input_file::format): New method definition.
8814         (Input_file::format_):: New data member.
8815
8816 2010-02-24  Doug Kwan  <dougkwan@google.com>
8817
8818         * arm.cc (Arm_output_data_got): New class.
8819         (ARM_TCB_SIZE): New constant
8820         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
8821         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
8822         If user uses a script with a SECTIONS clause, issue only a warning
8823         for a misplaced EXIDX input section.  Otherwise, issue an error.
8824         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
8825         garbage collection.
8826         (Target_arm::got_mode_index_entry): Handle static linking.
8827         (Target_arm::Scan::local): Ditto.
8828         (Target_arm::Scan::global): Ditto.
8829         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
8830         all incorrectly implemented relocations.
8831         (Target_arm::fix_exidx_coverage): Pass layout to
8832         Arm_output_section::fix_exidx_coverage.
8833         * layout.cc (Layout::section_name_mapping): Remove trailing dots
8834         from ".ARM.exidx." and ".ARM.extab.".
8835
8836 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8837
8838         * arm.cc (Target_arm::do_finalize_sections): Create attribute
8839         section if it does not already exist.
8840         * attributes.cc (Attributes_section_data::Attributes_section_data):
8841         Don't crash if size is zero.
8842
8843 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8844             Ian Lance Taylor  <iant@google.com>
8845
8846         * gold.cc (queue_middle_tasks): If no input files were opened,
8847         exit.
8848         * workqueue.h (Task_function::Task_function): Assert that there is
8849         a blocker.
8850
8851 2010-02-22  Doug Kwan  <dougkwan@google.com>
8852
8853         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
8854         * icf.cc (get_section_contents): Cast snprintf arguments to long long
8855         types to avoid warnings due to different uint64_t implementations
8856         on different hosts.
8857
8858 2010-02-21  Doug Kwan  <dougkwan@google.com>
8859
8860         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
8861         handling of the maximum backward branch offset.
8862         (Arm_relocate_functions::thumb_branch_common): Ditto.
8863         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
8864         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
8865         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
8866         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
8867         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
8868         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
8869         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
8870         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
8871         thumb_bl_out_of_range thumb_bl_out_of_range.o,
8872         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
8873         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
8874         thumb2_bl_out_of_range.o): New rules.
8875         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
8876         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
8877         thumb2_bl_out_of_range
8878         * testsuite/Makefile.in: Regenerate.
8879         * testsuite/arm_bl_in_range.s: New file.
8880         * testsuite/arm_bl_out_of_range.s: Ditto.
8881         * testsuite/arm_branch_in_range.sh: Ditto.
8882         * testsuite/arm_branch_range.t: Ditto.
8883         * testsuite/thumb2_branch_range.t: Ditto.
8884         * testsuite/thumb_bl_in_range.s: Ditto.
8885         * testsuite/thumb_bl_out_of_range.s: Ditto.
8886         * testsuite/thumb_branch_range.t: Ditto.
8887
8888 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
8889
8890         * gc.h (gc_process_relocs): Change vectors to point to the new list.
8891         Add reloc offset information.
8892         * icf.cc (get_section_contents): Change iterators to point to the new
8893         vectors. Add reloc offset information to the contents.
8894         * icf.h (Icf::Sections_reachable_info): New typedef.
8895         (Icf::Sections_reachable_list): New typedef.
8896         (Icf::Offset_info): New typedef.
8897         (Icf::Reloc_info): New struct typedef.
8898         (Icf::Reloc_info_list): New typedef.
8899         (Icf::symbol_reloc_list): Delete method.
8900         (Icf::addend_reloc_list): Delete method.
8901         (Icf::section_reloc_list): Delete method.
8902         (Icf::reloc_info_list): New method.
8903         (Icf::reloc_info_list_): New member.
8904
8905 2010-02-19  Doug Kwan  <dougkwan@google.com>
8906
8907         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
8908         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
8909         * arm.cc (Arm_relocation_functions): New forward declaration.
8910         (Target_arm::Target_arm): Initialize new data members
8911         got_mod_index_offset_ and tls_base_symbol_defined_.
8912         (Target_arm::Relocate::relocate_tls): New method.
8913         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
8914          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
8915         New methods.
8916         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
8917         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
8918         (Target_arm::got_mod_index_offset_,
8919         Target_arm::tls_base_symbol_defined_): New data members.
8920         (Target_arm::Scan::local, Target::Scan::global,
8921         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
8922         relocations.
8923
8924 2010-02-18  Doug Kwan  <dougkwan@google.com>
8925
8926         * arm.cc (Arm_relobj::find_linked_text_section): New method.
8927         (Arm_relobj::make_exidx_input_section): Pass section index of linked
8928         text section as a parameter becuase some broken tools may not set
8929         the link in section header.
8930         (Target_arm::has_got_section): New method.
8931         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
8932         without any mapping symbol as data only.  Remove warning.
8933         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
8934         link in its section header, try to discover the link by inspecting the
8935         REL31 relocation at the beginning of the section.
8936         (Target_arm::Scan::check_non_pic): Report name of offending relocation
8937         in error message.
8938         (Target_arm::Scan::global): Treat any reference to the symbol
8939         _GLOBAL_OFFSET_TABLE_ as a GOT access.
8940
8941 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
8942
8943         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
8944         (Scan::global_reloc_may_be_function_pointer): New function.
8945         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
8946         (Scan::global_reloc_may_be_function_pointer): New function.
8947         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
8948         (Scan::global_reloc_may_be_function_pointer): New function.
8949         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
8950         (Scan::global_reloc_may_be_function_pointer): New function.
8951         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
8952         (Scan::global_reloc_may_be_function_pointer): New function.
8953         (Scan::possible_function_pointer_reloc): New function.
8954         (Target_x86_64::can_check_for_function_pointers): New function.
8955         * gc.h (gc_process_relocs): Scan relocation types to determine if
8956         function pointers were taken for targets that support it.
8957         * icf.cc (Icf::find_identical_sections): Include functions for
8958         folding in safe ICF whose pointer is not taken.
8959         * icf.h (Secn_fptr_taken_set): New typedef.
8960         (fptr_section_id_): New member.
8961         (section_has_function_pointers): New function.
8962         (set_section_has_function_pointers): New function.
8963         (check_section_for_function_pointers): New function.
8964         * options.h: Fix comment for safe ICF option.
8965         * target.h (can_check_for_function_pointers): New function.
8966         * testsuite/Makefile.am: Add icf_safe_so_test test case.
8967         Modify icf_safe_test for X86-64.
8968         * testsuite/Makefile.in: Regenerate.
8969         * testsuite/icf_safe_so_test.cc: New file.
8970         * testsuite/icf_safe_so_test.sh: New file.
8971         * testsuite/icf_safe_test.cc (kept_func_3): New function.
8972         (main): Change to take pointer to function kept_func_3.
8973         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
8974         folding is done correctly for X86-64.
8975
8976 2010-02-12  David S. Miller  <davem@davemloft.net>
8977
8978         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
8979         is_symbolless parameter.
8980         (Output_reloc<SHT_REL>::is_symbolless): New.
8981         (Output_reloc<SHT_REL>::is_symbolless_): New.
8982         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
8983         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
8984         (Output_reloc<SHT_RELA>::is_symbolless): New.
8985         (Output_data_reloc::add_global): Handle is_symbolless.
8986         (Output_data_reloc::add_global_relative): Likewise.
8987         (Output_data_reloc::add_local): Likewise.
8988         (Output_data_reloc::add_local_relative): Likewise.
8989         (Output_data_reloc::add_symbolless_global_addend): New.
8990         (Output_data_reloc::add_symbolless_local_addend): New.
8991         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
8992         is_symbolless.
8993         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
8994         instead of ->is_relative_
8995         (Output_reloc::write): Likewise.
8996         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
8997         (Output_reloc::write_rel): Simplify.
8998
8999         * sparc.cc (Target_sparc::Scan::local): Use
9000         ->add_symbolless_local_addend as needed.
9001         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
9002         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
9003         based upon relocation offset.
9004
9005 2010-02-11  Doug Kwan  <dougkwan@google.com>
9006
9007         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
9008         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
9009         beginning of function.
9010         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
9011         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
9012         parameter is_32bit in calls to should_apply_static_reloc.
9013         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
9014         (check_DATA): Add arm_abs_global.stdout.
9015         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
9016         arm_abs_global.stdout): New rules.
9017         (MOSTLLYCLEANFILES): Add arm_abs_global
9018         * Makefile.in: Regenerate.
9019         * testsuite/arm_abs_global.s: New file.
9020         * testsuite/arm_abs_global.sh: Ditto.
9021         * testsuite/arm_abs_lib.s: Ditto.
9022
9023 2010-02-11  Ian Lance Taylor  <iant@google.com>
9024
9025         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
9026         Read_relocs task.
9027         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
9028         Allocate_commons_task first.
9029         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
9030         task, rather than symtab_lock_.
9031         (Gc_process_relocs::~Gc_process_relocs): New function.
9032         (Gc_process_relocs::is_runnable): Check this_blocker_.
9033         (Gc_process_relocs::locks): Use next_blocker_ rather than
9034         blocker_.
9035         (Scan_relocs::~Scan_relocs): New function.
9036         (Scan_relocs::is_runnable): Check this_blocker_ rather than
9037         symtab_lock_.
9038         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
9039         next_blocker_.
9040         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
9041         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
9042         constructor accordingly.
9043         (class Gc_process_relocs): Likewise.
9044         (class Scan_relocs): Likewise.
9045         * common.h (class Allocate_commons_task): Remove symtab_lock_
9046         field, and corresponding constructor parameter.
9047         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
9048         symtab_lock_.
9049         (Allocate_commons_task::locks): Likewise.
9050
9051 2010-02-11  Ian Lance Taylor  <iant@google.com>
9052
9053         * gold-threads.h (class Once): Define.
9054         (class Initialize_lock): Rewrite as child of Once.
9055         * gold-threads.cc (class Once_initialize): Define.
9056         (once_pointer_control): New static variable.
9057         (once_pointer, once_arg): New static variables.
9058         (c_run_once): New static function.
9059         (Once::Once, Once::run_once, Once::internal_run): New functions.
9060         (class Initialize_lock_once): Remove.
9061         (initialize_lock_control): Remove.
9062         (initialize_lock_pointer): Remove.
9063         (initialize_lock_once): Remove.
9064         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
9065         (Initialize_lock::initialize): Rewrite.
9066         (Initialize_lock::do_run_once): New function.
9067         * archive.cc (Archive::interpret_header): Only clear name if it is
9068         not already empty.
9069         * fileread.cc: Include "gold-threads.h"
9070         (file_counts_lock): New static variable.
9071         (file_counts_initialize_lock): Likewise.
9072         (File_read::release): Only increment counts when using --stats.
9073         Use a lock around the increment.
9074         * parameters.cc (class Set_parameters_target_once): Define.
9075         (set_parameters_target_once): New static variable.
9076         (Parameters::Parameters): Move here from parameters.h.
9077         (Parameters::set_target): Rewrite.
9078         (Parameters::set_target_once): New function.
9079         (Parameters::clear_target): Move here and rewrite.
9080         * parameters.h (class Parameters): Update declarations.  Add
9081         set_parameters_target_once_ field.
9082         (Parameters::Parameters): Move to parameters.cc.
9083         (Parameters::clear_target): Likewise.
9084         * readsyms.cc (Read_symbols::do_group): Create a Start_group
9085         task.
9086         (Start_group::~Start_group): New function.
9087         (Start_group::is_runnable): New function.
9088         (Start_group::locks, Start_group::run): New functions.
9089         (Finish_group::run): Change saw_undefined to size_t.
9090         * readsyms.h (class Start_group): Define.
9091         (class Finish_group): Change saw_undefined_ field to size_t.
9092         (Finish_group::Finish_group): Remove saw_undefined and
9093         this_blocker parameters.  Change all callers.
9094         (Finish_group::set_saw_undefined): New function.
9095         (Finish_group::set_blocker): New function.
9096         * symtab.h (class Symbol_table): Change saw_undefined to return
9097         size_t.  Change saw_undefined_ field to size_t.
9098         * target-select.cc (Set_target_once::do_run_once): New function.
9099         (Target_selector::Target_selector): Initialize set_target_once_
9100         field.  Don't initialize lock_ and initialize_lock_ fields.
9101         (Target_selector::instantiate_target): Rewrite.
9102         (Target_selector::set_target): New function.
9103         * target-select.h (class Set_target_once): Define.
9104         (class Target_selector): Update declarations.  Make
9105         Set_target_once a friend.  Remove lock_ and initialize_lock_
9106         fields.  Add set_target_once_ field.
9107
9108 2010-02-10  Ian Lance Taylor  <iant@google.com>
9109
9110         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
9111         queueing any tasks.
9112         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
9113         (queue_middle_tasks): Add all blockers before queueing any tasks.
9114         (queue_final_tasks): Likewise.
9115         * token.h (Task_token::add_blockers): New function.
9116         * object.h (Input_objects::number_of_relobjs): New function.
9117
9118 2010-02-10  Ian Lance Taylor  <iant@google.com>
9119
9120         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
9121         shared, not if not position independent.
9122         * x86_64.cc (Relocate::relocate_tls): Likewise.
9123         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
9124         (tls_pie_pic_test): New target.
9125         * testsuite/Makefile.in: Rebuild.
9126
9127         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
9128         (tls_test_main_pie.o, tls_test_pie.o): New targets.
9129         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
9130         * testsuite/Makefile.in: Rebuild.
9131
9132 2010-02-09  David S. Miller  <davem@davemloft.net>
9133
9134         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
9135         R_SPARC_RELATIVE using ->add_local_relative().
9136         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
9137
9138         * output.h (Output_data_dynamic::add_section_size): New method
9139         that takes two Output_data objects.
9140         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
9141         entry param.  Handle it in initializers.
9142         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
9143         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
9144         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
9145         arg.
9146         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
9147         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
9148         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
9149         for dynrel_includes_plt.
9150         * i386.cc (Target_i386::do_finalize_sections): Likewise.
9151         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
9152         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
9153         before .rela.plt
9154         (Target_sparc::do_finalize_sections): Update to pass true for
9155         dynrel_includes_plt.
9156         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
9157         output before .rela.plt
9158         (Target_powerpc::do_finalize_sections): Update to pass true for
9159         dynrel_includes_plt when 32-bit.
9160
9161 2010-02-08  Doug Kwan  <dougkwan@google.com>
9162
9163         * arm.cc (Arm_relobj::simple_input_section_output_address): New
9164         method.
9165         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
9166         Arm_relobj::scan_section_for_cortex_a8_stubs,
9167         Arm_relobj::do_relocation_section): Instead of calling
9168         Output_section::output_address, use faster
9169         Arm_relobj::simple_input_section_output_address.
9170
9171 2010-02-08  David S. Miller  <davem@davemloft.net>
9172
9173         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
9174         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
9175         relocation helper function.
9176
9177         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
9178         just like R_SPARC_GOT{10,13,22}.
9179         (Target_sparc::Scan::local): Likewise.
9180         (Target_sparc::Relocate:relocate): Likewise.
9181
9182 2010-02-06  Ian Lance Taylor  <iant@google.com>
9183
9184         * configure.ac: Rewrite targetobjs duplicate removal code to use
9185         only shell constructs.
9186         * configure: Rebuild.
9187
9188 2010-02-05  Doug Kwan  <dougkwan@google.com>
9189
9190         PR 11247
9191         * arm.cc (Arm_relobj::section_is_scannable): New method.
9192         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
9193         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
9194
9195 2010-02-04  Doug Kwan  <dougkwan@google.com>
9196
9197         PR 11247
9198         * arm-reloc-property.cc (cstdio): Include.
9199         * configure.ac (targetobjs): Remove duplicates.
9200         * configure: Regenerate.
9201         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
9202         big and little endian version for a given address size.
9203
9204 2010-02-03  Doug Kwan  <dougkwan@google.com>
9205
9206         * arm-reloc-property.cc
9207         (Arm_reloc_property_table::reloc_name_in_error_message): New method
9208         definition.
9209         * arm-reloc-property.h
9210         (Arm_reloc_property_table::get_implemented_static_reloc_property):
9211         New method definition.
9212         (Arm_reloc_property_table::reloc_name_in_error_message): New method
9213         declaration.
9214         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
9215         overflow to N.
9216         (GOT_PREL): Change implemented to Y.
9217         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
9218         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
9219         (Arm_relocate_functions::movw_abs_nc): Remove method.
9220         (Arm_relocate_functions::movt_abs): Ditto.
9221         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
9222         (Arm_relocate_functions::thm_movt_abs): Ditto.
9223         (Arm_relocate_functions::movw_rel_nc): Ditto.
9224         (Arm_relocate_functions::movw_rel): Ditto.
9225         (Arm_relocate_functions::movt_rel): Ditto.
9226         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
9227         (Arm_relocate_functions:thm_movw_rel): Ditto.
9228         (Arm_relocate_functions:thm_movt_rel): Ditto.
9229         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
9230         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
9231         New method definitions.
9232         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
9233         (Arm_relocation_functions::arm_grp_ldr): Ditto.
9234         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
9235         (Arm_relocation_functions::arm_grp_ldc): Ditto.
9236         (Target_arm::Relocate::relocate): Check for non-static or
9237         unimplemented relocation code and exit early.  Change calls to
9238         Target_arm::reloc_uses_thumb_bit and
9239         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
9240         instead.  Refactor code to handle similar relocations to increase
9241         code sharing.  Remove check for unsupported relocation code in switch
9242         statement.
9243         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
9244         relocation property table to find out size.  Change error message to
9245         print out the name of a relocation code instead of the numeric value.
9246         (Target_arm::scan_reloc_for_stub): Use relocation property table
9247         instead of calling Target_arm::reloc_uses_thumb_bit().
9248
9249 2010-02-02  Doug Kwan  <dougkwan@google.com>
9250
9251         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
9252         types of relaxed input section.
9253
9254 2010-02-02  Doug Kwan  <dougkwan@google.com>
9255
9256         * Makefile.am (HFILES): Add arm-reloc-property.h.
9257         (DEFFILES): New.
9258         (TARGETSOURCES): Add arm-reloc-property.cc
9259         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
9260         (libgold_a_SOURCES): $(DEFFILES)
9261         * Makefile.in: Regenerate.
9262         * arm-reloc-property.cc: New file.
9263         * arm-reloc-property.h: New file.
9264         * arm-reloc.def: New file.
9265         * arm.cc: Update comments.
9266         (arm-reloc-property.h): New included header.
9267         (arm_reloc_property_table): New global variable.
9268         (Target_arm::do_select_as_default_target): New method definition.
9269         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
9270         arm-reloc-property to targ_extra_obj.
9271         * parameters.cc (set_parameters_target): Call
9272         Target::select_as_default_target().
9273         * target.h (Target::select_as_default_target): New method definition.
9274         (Target::do_select_as_default_target): Same.
9275
9276 2010-02-01  Doug Kwan  <dougkwan@google.com>
9277
9278         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
9279         first_output_text_section_.
9280         (Arm_exidx_fixup::first_output_text_section): New method definition.
9281         (Arm_exidx_fixup::first_output_text_section_): New data member.
9282         (Arm_exidx_fixup::process_exidx_section): Record the first text
9283         output section seen.
9284         (Arm_output_section::fix_exidx_coverage): Set correct linked section
9285         and entsize in output section header.
9286
9287 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9288
9289         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
9290         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
9291         (Arm_relocate_functions::thm_alu11): New Method.
9292         (Arm_relocate_functions::thm_pc8): New Method.
9293         (Arm_relocate_functions::thm_pc12): New Method.
9294         (Target_arm::Scan::local): Handle the relocations.
9295         (Target_arm::Scan::global): Likewise.
9296         (Target_arm::Relocate::relocate): Likewise.
9297         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9298
9299 2010-01-29  Doug Kwan  <dougkwan@google.com>
9300
9301         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
9302         of relocation types as ld.
9303
9304 2010-01-29  Doug Kwan  <dougkwan@google.com>
9305
9306         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
9307         to public.
9308         (Arm_relocate_functions::thumb_branch_common): Ditto.
9309         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
9310         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
9311         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
9312         Arm_relocate_functions::jump24): Remove.
9313         (Target_arm::Relocate::relocate): Adjust code to call
9314         Arm_relocation_functions::arm_branch_common and
9315         Arm_relocation_functions::thumb_branch_common instead of their removed
9316         wrappers.  Merge switch-cases together to reduce source code size.
9317
9318 2010-01-29  Doug Kwan  <dougkwan@google.com>
9319
9320         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
9321         output_local_symbol_count_needs_update_.
9322         (Arm_relobj::output_local_symbol_count_needs_update,
9323          Arm_relobj::set_output_local_symbol_count_needs_update,
9324          Arm_relobj::update_output_local_symbol_count): New methods.
9325         (Arm_relobj::output_local_symbol_count_needs_update_): New data
9326         member.
9327         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
9328         of pointed function as in a R_ARM_PREL31 relocation.
9329         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
9330         for output local symbol count updating.
9331         (Target_arm::do_relax): Update output local symbol counts in objects
9332         if necessary.
9333         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
9334
9335 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9336
9337         * arm.cc: Added support for the ARM relocations:
9338         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
9339         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
9340         (Arm_relocate_functions::movw_rel_nc): Renamed (was
9341         movw_prel_nc).
9342         (Arm_relocate_functions::movw_rel): New method.
9343         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
9344         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
9345         thm_movw_prel_nc).
9346         (Arm_relocate_functions::thm_movw_rel): New method.
9347         (Arm_relocate_functions::thm_movt_rel): Renamed (was
9348         thm_movt_prel).
9349         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
9350         relocations.
9351         (Target_arm::Scan::global): Likewise.
9352         (Target_arm::Relocate::relocate): Likewise.
9353         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9354         Likewise.
9355
9356 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9357
9358         * arm.cc: Added support for ARM group relocations.
9359         (Target_arm::reloc_needs_sym_origin): New method.
9360         (Arm_relocate_functions::calc_grp_kn): New method.
9361         (Arm_relocate_functions::calc_grp_residual): New method.
9362         (Arm_relocate_functions::calc_grp_gn): New method.
9363         (Arm_relocate_functions::arm_grp_alu): New Method.
9364         (Arm_relocate_functions::arm_grp_ldr): New Method.
9365         (Arm_relocate_functions::arm_grp_ldrs): New Method.
9366         (Arm_relocate_functions::arm_grp_ldc): New Method.
9367         (Target_arm::Scan::local): Handle the ARM group relocations.
9368         (Target_arm::Scan::global): Likewise.
9369         (Target_arm::Relocate::relocate): Likewise.
9370         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9371         Likewise.
9372
9373 2010-01-26  Doug Kwan  <dougkwan@google.com>
9374
9375         * arm.cc (set): Include.
9376         (class Arm_exidx_fixup): Change type of last_input_section_ to const
9377         pointer type.
9378         (Arm_output_section::Text_section_list): New type.
9379         (Arm_output_section::append_text_sections_to_list): New method.
9380         (Arm_output_section::fix_exidx_coverage): Ditto.
9381         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
9382         (Arm_relobj::convert_input_section_to_relaxed_section): Use
9383         Relobj::set_section_offset() instead of
9384         Sized_relobj::invalidate_section_offset().
9385         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
9386         parameter for section headers. Ignore relocation sections for
9387         unallocated sections and EXIDX sections.
9388         (Target_arm::fix_exidx_coverage): New method.
9389         (Target_arm::output_section_address_less_than): New type.
9390         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
9391         linked text section instead of the EXIDX section.
9392         (Arm_output_section::create_stub_group): Add an assertion to check
9393         that this is not an EXIDX output section.
9394         (Arm_output_section::append_text_sections_to_list): New method.
9395         (Arm_output_section::fix_exidx_coverage): Ditto.
9396         (Arm_relobj::scan_sections_for_stubs): Adjust call to
9397         Arm_relobj::section_needs_reloc_stub_scanning.
9398         (Target_arm::do_relax): Fix EXIDX output section coverage in the
9399         first pass.
9400         (Target_arm::fix_exidx_coverage): New method.
9401         * object.h (Relobj::set_output_section): New method.
9402         (Sized_relobj::invalidate_section_offset): Remove method.
9403         (Sized_relobj::do_invalidate_section_offset): Remove method.
9404         (Sized_relobj::do_set_section_offset): Handle offset value -1.
9405
9406 2010-01-25  Doug Kwan  <dougkwan@google.com>
9407
9408         * arm.cc (Arm_exidx_merged_section::do_output_offset):
9409         Fix warning due to signed and unsigned comparison on a 32-bit host.
9410
9411 2010-01-22  Doug Kwan  <dougkwan@google.com>
9412
9413         * arm.cc (Target_arm::do_relax): Record an output section for section
9414         offset adjustment it contains any stub table that has changed.
9415         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
9416         offsets in an output section if necessary.
9417         * output.cc (Output_section::Output_section): Initialize
9418         section_offsets_need_adjustments_.
9419         (Output_section::add_input_section_for_script): Renamed to
9420         Output_section::add_simple_input_section.
9421         (Output_section::save_states): Add a comment.
9422         (Output_section::discard_states): New method defintion.
9423         (Output_section::adjust_section_offsets): Same.
9424         * output.h (Output_section::add_input_section_for_script): Renamed to
9425         Output_section::add_simple_input_section.
9426         (Output_section::discard_states): New method declaration.
9427         (Output_section::adjust_section_offsets): Same.
9428         (Output_section::section_offsets_need_adjustment,
9429         Output_section::set_section_offsets_need_adjustment): New method
9430         definitions.
9431         (Output_section::section_offsets_need_adjustment_): New data member.
9432         * script-sections.cc
9433         (Output_section_element_input::set_section_address): Adjust code for
9434         renaming of Output_section::add_input_section_for_script.
9435         (Orphan_output_section::set_section_address): Same.
9436
9437 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9438
9439         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
9440         Fix_v4bx enum values .
9441         * gold/options.h (General_options): New option definitions.
9442         (General_options::fix_v4bx): New method.
9443         (General_options::Fix_v4bx): New enum.
9444         * gold/options.cc (General_options::parse_fix_v4bx): New method.
9445         (General_options::parse_fix_v4bx_interworking): New method.
9446
9447 2010-01-22  Doug Kwan  <dougkwan@google.com>
9448
9449         * arm.cc (Arm_exidx_fixup): New class.
9450
9451 2010-01-21  Doug Kwan  <dougkwan@google.com>
9452
9453         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
9454         classes.
9455         (Arm_exidx_section_offset_map): New type.
9456
9457 2010-01-21  Doug Kwan  <dougkwan@google.com>
9458
9459         * arm.cc (Arm_exidx_input_section): New class.
9460         (Arm_relobj::exidx_input_section_by_link,
9461         Arm_relobj::exidx_input_section_by_shndx,
9462         Arm_relobj::make_exidx_input_section): New methods.
9463         (read_arm_attributes_section): Remove.
9464         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
9465         information about them.
9466         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
9467         to here.
9468
9469 2010-01-20  Doug Kwan  <dougkwan@google.com>
9470
9471         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
9472         Input_section_specifier to Section_id.
9473         (Target_arm::new_arm_input_section: Adjust code for change of key
9474         type.
9475         (Target_arm::find_arm_input_section): Ditto.
9476         * gc.h (object.h): Include for Section_id nand Section_id_hash.
9477         (Section_id): Remove.
9478         (Garbage_collection::Section_id_hash): Remove.
9479         * icf.h (object.h): Include for Section_id nand Section_id_hash.
9480         (Section_id): Remove.
9481         (Icf::Section_id_hash): Remove.
9482         * object.h (Section_id, Const_section_id, Section_id_hash,
9483         Const_section_id_hash): New type definitions.
9484         * output.cc (Output_section::add_relaxed_input_section): Change to
9485         use Const_section_id instead of Input_section_specifier as key type.
9486         (Output_section::add_merge_input_section): Ditto.
9487         (Output_section::build_relaxation_map): Change to use Section_id
9488         instead of Input_section_specifier as key type.
9489         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
9490         Ditto.
9491         (Output_section::convert_input_sections_to_relaxed_sections): Change
9492         to use Const_section_id instead of Input_section_specifier as key type.
9493         (Output_section::find_merge_section): Ditto.
9494         (Output_section::find_relaxed_input_section): Ditto.
9495         * output.h (Input_section_specifier): Remove class.
9496         (Output_section::Output_section_data_by_input_section_map): Change
9497         key type to Const_section_id.
9498         (Output_section::Output_relaxed_input_section_by_input_section_map):
9499         Ditto.
9500         (Output_section::Relaxation_map): Change key type to Section_id.
9501
9502 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9503
9504         * gold/arm.cc: Added support for R_ARM_V4BX relocation
9505         (class Arm_v4bx_stub): New class.
9506         (DEF_STUBS): Updated definition to support v4_veneer_bx.
9507         (Stub_factory::make_arm_v4bx_stub): New method.
9508         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
9509         (Stub_table::empty): Handle v4bx stubs.
9510         (Stub_table::add_arm_v4bx_stub): New method.
9511         (Stub_table::find_arm_v4bx_stub): New method.
9512         (Arm_relocate_functions::v4bx): New method.
9513         (Target_arm::fix_v4bx): New method.
9514         (Target_arm::Target_arm): Handle R_ARM_V4BX.
9515         (Stub_table::relocate_stubs): Likewise.
9516         (Stub_table::do_write): Likewise.
9517         (Stub_table::update_data_size_and_addralign): Likewise.
9518         (Stub_table::finalize_stubs):  Likewise.
9519         (Target_arm::Scan::local): Likewise.
9520         (Target_arm::Scan::global): Likewise.
9521         (Target_arm::do_finalize_sections): Likewise.
9522         (Target_arm::Relocate::relocate): Likewise.
9523         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9524         Likewise.
9525         (Target_arm::scan_reloc_for_stub): Likewise.
9526         (Target_arm::scan_reloc_section_for_stubs): Likewise.
9527
9528 2010-01-19  Ian Lance Taylor  <iant@google.com>
9529
9530         * output.cc (Output_section_headers::do_sized_write): Write large
9531         segment count to sh_info field.
9532         (Output_file_header::do_sized_write): For large segment count,
9533         write PN_XNUM to e_phnum field.
9534
9535 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9536
9537         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
9538         (Arm_relocate_functions::thm_jump8): New function.
9539         (Arm_relocate_functions::thm_jump11): New function.
9540         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
9541         R_ARM_THM_JUMP11.
9542         (Target_arm::Scan::global): Likewise.
9543         (Target_arm::Relocate::relocate): Likewise.
9544         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9545         Likewise.
9546
9547 2010-01-14  Doug Kwan  <dougkwan@google.com>
9548
9549         * arm.cc (map, utility): Include headers.
9550         (Target_arm::apply_cortex_a8_workaround): New method.
9551         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
9552         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
9553         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
9554         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
9555         the --[no-]fix-cortex-a8 command line options.
9556         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
9557         (Target_arm::relocate_stub): Use addend in instruction template.
9558         * options.h (DEFINE_bool): Set the user-set flag.
9559         (General_options): Add --[no-]-fix-cortex options.
9560         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
9561         : Update fast look-up map after conversion.
9562
9563 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
9564
9565         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
9566         in the first pass of do_layout.
9567
9568 2010-01-13  Doug Kwan  <dougkwan@google.com>
9569
9570         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
9571         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
9572         apparent compiler problem of not folding static constant integral
9573         data members of elfcpp::Elf_sizes<32>.
9574
9575 2010-01-13  Doug Kwan  <dougkwan@google.com>
9576
9577         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
9578         Arm_relobj::section_needs_cortex_a8_stub_scanning,
9579         Arm_relobj::scan_section_for_cortex_a8_erratum,
9580         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
9581         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
9582         sections to scan for relocation stubs into a new method
9583         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
9584         relocation and Cortex-A8 stub scanning.
9585         (Target_arm::do_relax): Force stubs to be after stubbed sections
9586         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
9587         the beginning of a new relaxation pass.  Update a comment.
9588         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
9589
9590 2010-01-12  Ian Lance Taylor  <iant@google.com>
9591
9592         * target-reloc.h (visibility_error): New inline function.
9593         (relocate_section): Call visibility_error.
9594         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
9595         (MOSTLYCLEANFILES): Likewise.
9596         (protected_4_pic.o, protected_3.err): New targets.
9597         * testsuite/protected_4.cc: New file.
9598
9599 2010-01-12  Doug Kwan  <dougkwan@google.com>
9600
9601         * arm.cc (Cortex_a8_reloc): New class.
9602         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
9603         and cortex_a8_relocs_info_.
9604         (Target_arm::fix_cortex_a8): New method definition.
9605         (Target_arm::Cortex_a8_relocs_info): New type.
9606         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
9607         New data member declarations.
9608         (Target_arm::scan_reloc_for_stub): Record information about
9609         relocations for THUMB branches that might be exempted from the
9610         Cortex-A8 workaround.
9611         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
9612         at the beginning of a relaxation pass.
9613
9614 2010-01-12  Doug Kwan  <dougkwan@google.com>
9615
9616         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
9617         (Arm_relobj::Mapping_symbol_position,
9618          Arm_reloj::Mapping_symbol_position_less,
9619          Arm_relobj::Mapping_symbols_info): New types.
9620         (Target_arm::is_mapping_symbol_name): New method definition.
9621         (Arm_relobj::do_count_local_symbols): Save information about mapping
9622         symbols.
9623
9624 2010-01-11  Doug Kwan  <dougkwan@google.com>
9625
9626         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
9627         Arm_relocate_functions::thumb32_branch_upper,
9628         Arm_relocate_functions::thumb32_branch_lower,
9629         Arm_relocate_functions::thumb32_cond_branch_offset,
9630         Arm_relocate_functions::thumb32_cond_branch_upper,
9631         Arm_relocate_functions::thumb32_cond_branch_lower,
9632         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
9633         branch offset encoding.
9634         (Arm_relocate_functions::thumb_branch_common): Use new branch
9635         offset encoding methods to avoid code duplication.
9636         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
9637         (Stub_addend_reader::operator()): Use new branch encoding method
9638         to avoid code duplication.
9639
9640 2010-01-11  Doug Kwan  <dougkwan@google.com>
9641
9642         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
9643         (Target_arm::do_finalize_sections): Define special EXIDX section
9644         symbols only if referenced.
9645         * gc.h (Garbage_collection::add_reference): New method.
9646         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
9647         code duplication.
9648
9649 2010-01-11  Ian Lance Taylor  <iant@google.com>
9650
9651         * script.cc (Version_script_info::build_expression_list_lookup):
9652         Change complaing about duplicate wildcard match from error to
9653         warning.
9654
9655         * script.cc (class Lazy_demangler): Recreate--revert part of patch
9656         of 2009-12-30.
9657         (Version_script_info::Version_script_info): Initialize globs_,
9658         default_version_, default_is_global_, and exact_.  Don't
9659         initialize globals_ or locals_.
9660         (Version_script_info::build_lookup_tables): Build local symbols
9661         first.
9662         (Version_script_info::unquote): New function.
9663         (Version_script_info::add_exact_match): New function.
9664         (Version_script_info::build_expression_list_lookup): Remove lookup
9665         parameter.  Add is_global parameter.  Change all callers.  Handle
9666         wildcard pattern specially.  Unquote pattern.  Call
9667         add_exact_match.
9668         (Version_script_info::get_name_to_match): New function.
9669         (Version_script_info::get_symbol_version): New function.
9670         (Version_script_info::get_symbol_version_helper): Remove.
9671         (Version_script_info::check_unmatched_names): Call unquote.
9672         * script.h (class Version_script_info): Change get_symbol_version
9673         to be non-inline and add is_global parameter; change all callers.
9674         Rewrite symbol_is_local.  Update declarations.  Define struct
9675         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
9676         Remove globals_ and locals_ members.  Add exact_, globs_,
9677         default_version_, is_global_.
9678         (Version_script_info::Glob): Remove pattern, add expression and
9679         is_global.  Update constructor.  Change all callers.
9680         * dynobj.cc (Versions::finalize): Mark the version symbol as the
9681         default version.
9682         (Versions::symbol_section_contents): If a symbol is undefined, or
9683         defined in a dynamic object, set the version index to
9684         VER_NDX_LOCAL.
9685         * symtab.cc (Symbol_table::add_from_relobj): Don't call
9686         symbol_is_local.
9687         (Symbol_table::add_from_pluginobj): Likewise.
9688         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
9689
9690 2010-01-11  Doug Kwan  <dougkwan@google.com>
9691
9692         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
9693         (incremental_dump_LDADD): Add linking option for libintl.
9694         * Makefile.in: Regenerate.
9695
9696 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
9697
9698         PR gold/11144
9699         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
9700         instead of -Ds.
9701         * testsuite/Makefile.in: Regenerated.
9702
9703 2010-01-10  Doug Kwan  <dougkwan@google.com>
9704
9705         * options.h (DEFINE_var): Use parentheses around argument varname__
9706         in macro body to avoid any unintended subsequent substitutions.
9707
9708 2010-01-10  Ian Lance Taylor  <iant@google.com>
9709
9710         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
9711         candidates before doing symbol resolution.
9712
9713         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
9714         ODR candidates if only one is weak.
9715
9716 2010-01-08  Ian Lance Taylor  <iant@google.com>
9717
9718         * script.cc (Version_script_info::build_expression_list_lookup):
9719         Don't warn about ambiguous version, just record the ambiguity.
9720         (Version_script_info::get_symbol_version_helper): Give error if
9721         version is ambiguous.
9722
9723 2010-01-08  Doug Kwan  <dougkwan@google.com>
9724
9725         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
9726         prev_data_size_ and prev_addralign_.  Remove initializer for
9727         deleted data member has_been_changed_.
9728         (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
9729         to determine if the table is empty.
9730         (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
9731         Remove.
9732         (Stub_table::add_reloc_stub): Define method in class definition
9733         instead of just declaring it there.
9734         (Stub_table::add_cortex_a8_stub): New method definition.
9735         (Stub_table::update_data_size_and_addralign): Ditto.
9736         (Stub_table::finalize_stubs): Ditto.
9737         (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
9738         (Stub_table::do_addralign_): Return address alignment in the
9739         (Stub_table::do_reset_address_and_file_offset): Define method in
9740         class definition instead of declaring it there.  Set current data
9741         size to be the data size of the previous pass.
9742         (Stub_table::set_final_data_size): Use current data size as the
9743         final data size.
9744         (Stub_table::relocate_stub): Change parameter type of stub from
9745         Reloc_stub pointer to Stub pointer.
9746         (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
9747         (Stub_table::Cortex_a8_stub_list): New typedef.
9748         (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
9749          Stub_table::prev_addralign_): New data member.
9750         (Arm_relobj::Arm_relobj): Initialize data member
9751         section_has_cortex_a8_workaround_.
9752         (Arm_relobj::section_has_cortex_a8_workaround,
9753          Arm_relobj::mark_section_for_cortex_a8_workaround): New method
9754          definitions.
9755         (Arm_relobj::section_has_cortex_a8_workaround_): New data member
9756         declarations.
9757         (Target_arm::relocate_stub): Change parameter type of stub from
9758         Reloc_stub pointer to Stub pointer.
9759         (Insn_template::size, Insn_template::alignment): Handle
9760         THUMB16_SPECIAL_TYPE.
9761         (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
9762          Stub_table::update_data_size_and_addralign,
9763          Stub_table::apply_cortex_a8_workaround_to_address_range): New method
9764         definitions.
9765         (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
9766         (Stub_table::do_write): Ditto.
9767         (Target_arm::do_relax): Adjust code for changes in Stub_table.
9768
9769 2010-01-08  Ian Lance Taylor  <iant@google.com>
9770
9771         PR 11108
9772         * symtab.h (class Symbol): Remove fields is_target_special_ and
9773         has_plt_offset_.  Add field is_defined_in_discarded_section_.
9774         (Symbol::is_defined_in_discarded_section): New function.
9775         (Symbol::set_is_defined_in_discarded_section): New function.
9776         (Symbol::has_plt_offset): Rewrite.
9777         (Symbol::set_plt_offset): Verify that new offset is not -1U.
9778         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
9779         Don't initialize is_target_special_ or has_plt_offset_.
9780         Initialize is_defined_in_discarded_section_.
9781         (Symbol_table::add_from_relobj): If appropriate, set
9782         is_defined_in_discarded_section.
9783         * resolve.cc (Symbol::override_base_with_special): Don't test
9784         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
9785         * target-reloc.h (relocate_section): Do special handling for
9786         symbols defined in discarded sections for global symbols as well
9787         as local symbols.
9788
9789 2010-01-08  Ian Lance Taylor  <iant@google.com>
9790
9791         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
9792         the SHT_SYMTAB case.
9793
9794 2010-01-08  Ian Lance Taylor  <iant@google.com>
9795
9796         * object.cc (Sized_relobj::do_layout): Don't get confused if
9797         layout_eh_frame returns NULL.
9798
9799 2010-01-08  Ian Lance Taylor  <iant@google.com>
9800
9801         PR 11084
9802         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
9803         dynamic symbol table, use the normal symbol table.
9804         (Sized_dynobj::do_read_symbols): Remove assertion about type of
9805         symbol table.
9806
9807 2010-01-08  Ian Lance Taylor  <iant@google.com>
9808
9809         PR 11072
9810         * layout.cc (Layout::include_section): Remove .gnu_debuglink
9811         sections.
9812
9813 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
9814
9815         * version.cc (print_version): Change to "Copyright 2010".
9816
9817 2010-01-08  Ian Lance Taylor  <iant@google.com>
9818
9819         PR 10287
9820         PR 11063
9821         * i386.cc (class Target_i386): Change return type of plt_section
9822         to be non-const.
9823         (class Output_data_plt_i386): Add tls_desc_rel_ field.
9824         (Output_data_plt_i386::Output_data_plt_i386): Initialize
9825         tls_desc_rel_ field.
9826         (Output_data_plt_i386::rel_tls_desc): New function.
9827         (Target_i386::rel_tls_desc_section): New function.
9828         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
9829         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
9830         R_386_TLS_DESC reloc in rel_tls_desc_section.
9831         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
9832         Define struct Tlsdesc_info.
9833         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
9834         (Target_x86_64::do_reloc_symbol_index): New function.
9835         (Target_x86_64::add_tlsdesc_info): New function.
9836         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
9837         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
9838         tlsdesc_rel_ field.
9839         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
9840         all callers.
9841         (Output_data_plt_x86_64::rela_tlsdesc): New function.
9842         (Target_x86_64::rela_tlsdesc_section): New function.
9843         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
9844         handling.
9845         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
9846         (Target_x86_64::do_reloc_addend): New function.
9847         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
9848         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
9849         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
9850         (Output_reloc::type): New function.
9851         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
9852         (Output_reloc::is_target_specific): New function.
9853         (Output_reloc::target_arg): New function.
9854         (class Output_reloc) [SHT_RELA]: Add four new constructors for
9855         absolute relocs and target specific relocs.
9856         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
9857         add_target_specific.
9858         (class Output_data_reloc) [SHT_RELA]: Likewise.
9859         * output.cc (Output_reloc::Output_reloc): Add four new versions
9860         for absolute relocs and target specific relocs.
9861         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
9862         (Output_reloc::get_symbol_index): Likewise.
9863         (Output_reloc::local_section_offset): Check that local_sym_index_
9864         is not TARGET_CODE or 0.
9865         (Output_reloc::symbol_value): Likewise.
9866         (Output_reloc::write) [SHT_RELA]: Call target for target specific
9867         reloc.
9868         * target.h (class Target): Add reloc_symbol_index and reloc_addend
9869         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
9870         functions.
9871         * layout.cc (add_target_dynamic_tags): Use output section for
9872         DT_PLTRELSZ and DT_JMPREL.
9873
9874 2010-01-07  Ian Lance Taylor  <iant@google.com>
9875
9876         PR 11061
9877         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
9878         function.
9879         (class Output_data_reloc_generic): Define.
9880         (class Output_data_reloc_base): Change base class to
9881         Output_data_reloc_generic.  Change add() method to call
9882         bump_relative_reloc_count for a relative reloc.  Remove
9883         sort_relocs_ field.
9884         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
9885         to sort_relocs().
9886         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
9887         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
9888         appropriate.
9889         * layout.h (class Layout): Update declaration.
9890
9891 2010-01-07  Ian Lance Taylor  <iant@google.com>
9892
9893         * output.h (class Output_data): Add const version of
9894         output_section and do_output_section.
9895         (class Output_section_data): Add const version of
9896         do_output_section.
9897         (class Output_section): Likewise.
9898         * layout.cc (Layout::add_target_dynamic_tags): New function.
9899         * layout.h (class Layout): Update declarations.
9900         * arm.cc (Target_arm::do_finalize_sections): Use
9901         add_target_dynamic_tags.
9902         * i386.cc (Target_i386::do_finalize_sections): Likewise.
9903         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
9904         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
9905         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
9906
9907 2010-01-07  Ian Lance Taylor  <iant@google.com>
9908
9909         PR 11042
9910         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
9911         object as needed.
9912
9913 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
9914             Ian Lance Taylor  <iant@google.com>
9915
9916         PR 11019
9917         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
9918         Xindex::read_symtab_xindex.
9919
9920 2010-01-07  Doug Kwan  <dougkwan@google.com>
9921
9922         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
9923         (Insn_template::thumb16_bcond_insn): New method declaration.
9924         (Insn_template): Fix spelling.
9925         (Stub::thumb16_special): New method declaration.
9926         (Stub::do_write): Define virtual method which was previously pure
9927         virtual.
9928         (Stub::do_thumb16_special): New method declaration.
9929         (Stub::do_fixed_endian_write): New template member.
9930         (Reloc_stub::do_write): Remove.
9931         (Reloc_stub::do_fixed_endian_write): Remove.
9932         (Cortex_a8_stub): New class definition.
9933         (Stub_factory::make_cortex_a8_stub): New method definition.
9934         (Stub_factory::Stub_factory): Add missing static storage class
9935         qualifier for elf32_arm_stub_a8_veneer_blx.
9936
9937 2010-01-07  Ian Lance Taylor  <iant@google.com>
9938
9939         PR 10980
9940         * options.h (class General_options): Add --warn-unresolved-symbols
9941         and --error-unresolved-symbols.
9942         * errors.cc (Errors::undefined_symbol): Implement
9943         --warn-unresolved-symbols.
9944
9945         * options.h (class General_options): Add -z text and -z textoff.
9946         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
9947
9948 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
9949
9950         * gc.h (Garbage_collection::Cident_section_map): New typedef.
9951         (Garbage_collection::cident_sections): New function.
9952         (Garbage_collection::add_cident_section): New function.
9953         (Garbage_collection::cident_sections_): New member.
9954         (gc_process_relocs): Add references to sections whose names are C
9955         identifiers.
9956         * gold.h (cident_section_start_prefix): New constant.
9957         (cident_section_stop_prefix): New constant.
9958         (is_cident): New function.
9959         * layout.cc (Layout::define_section_symbols): Replace string constants
9960         with the newly defined constants.
9961         * object.cc (Sized_relobj::do_layout): Track sections whose names are
9962         C identifiers.
9963         * testsuite/Makefile.am: Add gc_orphan_section_test.
9964         * testsuite/Makefile.in: Regenerate.
9965         * testsuite/gc_orphan_section_test.cc: New file.
9966         * testsuite/gc_orphan_section_test.sh: New file.
9967
9968 2010-01-06  Ian Lance Taylor  <iant@google.com>
9969
9970         PR 10980
9971         * options.h (class General_options): Add --warn-shared-textrel.
9972         * layout.cc (Layout::finish_dynamic_section): Implement
9973         --warn-shared-textrel.
9974
9975         PR 10980
9976         * options.h (class General_options): Add --warn-multiple-gp.
9977
9978 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9979
9980         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
9981         $(THREADSLIB) and $(LIBDL).
9982         * Makefile.in: Rebuild.
9983
9984 2010-01-06  Ian Lance Taylor  <iant@google.com>
9985
9986         PR 10980
9987         * options.cc (General_options::parse_section_start): New function.
9988         (General_options::section_start): New function.
9989         (General_options::General_options): Initialize all members.
9990         * options.h: Include <map>
9991         (class General_options): Add --section-start.  Add section_starts_
9992         member.
9993         * layout.cc (Layout::attach_allocated_section_to_segment): If
9994         --section-start was used, set the address of the segment.  Remove
9995         local sort_sections.
9996         (Layout::relaxation_loop_body): If the address of the load segment
9997         has been set by --section-start, don't use it.
9998         * output.h (Output_segment::update_flags_for_output_section): New
9999         function.
10000         * output.cc (Output_segment::add_output_section): Call
10001         update_flags_for_output_section.
10002
10003 2010-01-05  Ian Lance Taylor  <iant@google.com>
10004
10005         PR 10980
10006         * options.h (class General_options): Add --undefined-version.
10007         * script.cc (struct Version_expression): Add was_matched_by_symbol
10008         field.
10009         (Version_script_info::matched_symbol): New function.
10010         (Version_script_info::get_symbol_version_helper): Call
10011         matched_symbol.
10012         (Version_script_info::check_unmatched_names): New function.
10013         * script.h (class Version_script_info): Update declarations.
10014         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
10015
10016         * options.h (class General_options): Use DEFINE_bool_alias for
10017         allow_multiple_definition.
10018         * resolve.cc (Symbol_table::should_override): Don't test
10019         allow_multiple_definition.
10020
10021         PR 10980
10022         * options.h (class General_options): Add --cref.
10023         * main.cc (main): Print cref table if --cref.  Don't close mapfile
10024         until after printing cref table.
10025         * cref.cc: Include "symtab.h".
10026         (class Cref_inputs): Define Cref_table_compare and Cref_table.
10027         (Cref_table_compare::operator()): New function.
10028         (Cref_inputs::gather_cref): New function.
10029         (filecol): New static const.
10030         (Cref_inputs::print_cref): New function.
10031         (Cref::print_cref): New function.
10032         * cref.h: Include <cstdio>.
10033         (class Cref): Update declarations.
10034         * mapfile.h (Mapfile::file): New function.
10035         * object.h (class Object): Define Symbols.  Declare virtual
10036         do_get_global_symbols.
10037         (Object::get_global_symbols): New function.
10038         * object.cc (Input_objects::add_object): Pass object to cref_ if
10039         --cref.
10040         (Input_objects::archive_start): Likewise.
10041         (Input_objects::archive_stop): Likewise.
10042         (Input_objects::print_cref): New function.
10043         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
10044         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
10045         --cref.
10046         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
10047         function.
10048         * plugin.h (class Sized_pluginobj): Update declarations.
10049
10050 2010-01-05  Ian Lance Taylor  <iant@google.com>
10051
10052         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
10053         to is_default_version.  Rename insdef to insdefault.
10054         (Symbol_table::add_from_relobj): Rename def to is_default_version
10055         and local to is_forced_local.
10056         (Symbol_table::add_from_pluginobj): Likewise.
10057         (Symbol_table::add_from_dynobj): Likewise.
10058         (Symbol_table::define_special_symbol): Rename insdef to
10059         insdefault.
10060
10061 2010-01-04  Ian Lance Taylor  <iant@google.com>
10062
10063         PR 10980
10064         * options.h (class General_options): Add
10065         --allow-multiple-definition and -z muldefs.
10066         * resolve.cc (Symbol_table::should_override): Don't warn about a
10067         multiple symbol definition if --allow-multiple-definition or -z
10068         muldefs.
10069
10070         PR 10980
10071         * options.h (class General_options): Add --add-needed and
10072         --copy-dt-needed-entries.  Tweak --as-needed help entry.
10073         * object.cc (Input_objects::check_dynamic_dependencies): Give an
10074         error if --copy-dt-needed-entries aka --add-needed is used and
10075         would cause a change in behaviour.
10076
10077         PR 10980
10078         * options.h (class General_options): Add -G as a short version of
10079         --shared.  Add no-op options -assert, -g, and -i.
10080
10081 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
10082
10083         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
10084         check for .text or .gnu.linkonce.t sections.
10085         * icf.cc (Icf::find_identical_sections): Ditto.
10086         Change the detection for mangled function name within the section
10087         name.
10088         * icf.h (is_section_foldable_candidate): New function.
10089
10090 2009-12-30  Ian Lance Taylor  <iant@google.com>
10091
10092         PR 10980
10093         * options.h (class General_options): Permit two dashes with
10094         --retain-symbols-file.
10095
10096 2009-12-30  Ian Lance Taylor  <iant@google.com>
10097
10098         PR 10979
10099         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
10100         don't put the file header and segment headers in the text
10101         segment.
10102
10103         PR 10979
10104         * common.cc (Sort_commons::operator()): Stabilize sort when both
10105         entries are NULL.
10106         (Symbol_table::do_allocate_commons_list): When allocating common
10107         symbols, skip a symbol which is no longer common.
10108         * symtab.h (Symbol::is_common): Test whether the symbol comes from
10109         an object before checking its type.
10110         * testsuite/common_test_2.c: New file.
10111         * testsuite/common_test_3.c: New file.
10112         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
10113         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
10114         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
10115         (common_test_2_pic.o, common_test_2.so): New targets.
10116         (common_test_3_pic.o, common_test_3.so): New targets.
10117         * testsuite/Makefile.in: Rebuild.
10118
10119         PR 10979
10120         * script.cc (read_input_script): If we see a new SECTIONS clause,
10121         and we have added an input section, give an error.
10122         * layout.h (class Layout): Add have_added_input_section function.
10123         Add have_added_input_section_ field.
10124         * layout.cc (Layout::Layout): Initialize
10125         have_added_input_section_.
10126         (Layout::layout): Set have_added_input_section_.
10127         (Layout::layout_eh_frame): Likewise.
10128
10129 2009-12-30  Ian Lance Taylor  <iant@google.com>
10130
10131         PR 10931
10132         * options.h (class General_options): Add --sort-common option.
10133         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
10134         * common.cc (Sort_common): Add sort_order parameter to
10135         constructor.  Add sort_order_ field.
10136         (Sort_commons::operator): Check sort_order_.
10137         (Symbol_table::allocate_commons): Determine the sort order.
10138         (Symbol_table::do_allocate_commons): Add sort_order parameter.
10139         Change all callers.
10140         (Symbol_table::do_allocate_commons_list): Likewise.
10141
10142 2009-12-30  Ian Lance Taylor  <iant@google.com>
10143
10144         PR 10916
10145         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
10146         symbols from this object, don't change the visibility of an
10147         undefined symbol.
10148         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
10149
10150 2009-12-30  Ian Lance Taylor  <iant@google.com>
10151
10152         PR 10861
10153         * script.h (class Version_script_info): Define Language enum.
10154         Update declarations.  Define Glob, Exact, and Lookup types.  Add
10155         new fields globals_, locals_, and is_finalized_.
10156         * script.cc: Various formatting fixes.
10157         (class Parser_closure): Change language_stack_ from a vector of
10158         std::string to one of Version_script_info::Language.  Adjust all
10159         uses accordingly.
10160         (class Lazy_demangler): Remove.
10161         (struct Version_expression): Change language from std::string to
10162         Version_script_info::Language.
10163         (Version_script_info::Version_script_info): New function.
10164         (Version_script_info::~Version_script_info): Don't call clear.
10165         (Version_script_info::finalize): New function.
10166         (Version_script_info::build_lookup_tables): New function.
10167         (Version_script_info::build_expression_list_lookup): New
10168         function.
10169         (Version_script_info::get_symbol_version_helper): Rewrite to use
10170         lookup tables.
10171         (Version_script_info::print_expression_list): Adjust to use
10172         Version_script_info::Language.
10173         (script_push_lex_into_version_mode): Check that the version script
10174         has not been finalized.
10175         (version_script_push_lang): Change language string to
10176         Version_script_info::Language.
10177         * options.cc (Command_line::version_script): New function.
10178         * options.h (class General_options): Add finalize_dynamic_list
10179         function.  Change version_script from declaration to definition.
10180         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
10181         * testsuite/version_script.map: Remove duplicate def of foo.
10182         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
10183         version_script.map.
10184         * testsuite/Makefile.in: Rebuild.
10185
10186 2009-12-30  Ian Lance Taylor  <iant@google.com>
10187
10188         PR 10843
10189         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
10190         if the input symbol index is 0, make the output symbol index 0.
10191
10192 2009-12-30  Ian Lance Taylor  <iant@google.com>
10193
10194         PR 10670
10195         * options.h (class General_options): Add -x/--discard-all.
10196         * object.cc (Sized_relobj::do_count_local_symbols): Handle
10197         --discard-all.  If the local symbol needs a dynamic entry, check
10198         that before handling --discard-locals.
10199
10200 2009-12-30  Ian Lance Taylor  <iant@google.com>
10201
10202         PR 10450
10203         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
10204         flags to PF_R.
10205         (Output_segment::add_output_section): Don't change the flags if
10206         the type is PT_TLS.
10207
10208         PR 10450
10209         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
10210         GNU hash table if they need a dynamic value.  Otherwise, don't add
10211         them if they are defined in a dynamic object or are forced local.
10212
10213 2009-12-29  Ian Lance Taylor  <iant@google.com>
10214
10215         PR 10450
10216         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
10217         .gnu.hash table for a 32-bit target.
10218
10219         PR 10450
10220         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
10221         regular and a dynamic object only needs a dynamic symbol table
10222         entry if it is externally visible.
10223
10224         PR 10450
10225         * i386.cc (class Target_i386): Initialize global_offset_table_ in
10226         constructor.  Add global_offset_table_ field.
10227         (Target_i386::got_section): Set global_offset_table_.
10228         (Target_i386::do_finalize_sections): Set global_offset_table_
10229         size.
10230         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
10231         in constructor.  Add global_offset_table_ field.
10232         (Target_x86_64::got_section): Set global_offset_table_.
10233         (Target_x86_64::do_finalize_sections): Set global_offset_table_
10234         size.
10235
10236         * layout.cc (Layout::Layout): Initialize increase_relro_.
10237         (Layout::get_output_section): Add is_relro, is_last_relro, and
10238         is_first_non_relro parameters.  Change all callers.
10239         (Layout::choose_output_section): Likewise.
10240         (Layout::add_output_section_data): Likewise.
10241         (Layout::make_output_section): Likewise.
10242         (Layout::set_segment_offsets): Clear increase_relro when using a
10243         linker script.
10244         * layout.h (class Layout): Add increase_relro method.  Add
10245         increase_relro_ field.  Update declarations.
10246         * output.cc (Output_section::Output_section): Initialize
10247         is_last_relro_ and is_first_non_relro_.
10248         (Output_segment::add_output_section): Group relro sections is
10249         do_sort is true.  Handle is_last_relro and is_first_non_relro.
10250         (Output_segment::maximum_alignment): Remove relro handling.
10251         (Output_segment::set_section_addresses): Add increase_relro
10252         parameter.  Change all callers.  Add initial alignment to align
10253         relro sections on separate page.  Remove old relro handling.
10254         (Output_segment::set_section_list_addresses): Remove in_relro
10255         parameter.  Change all callers.
10256         (Output_segment::set_offset): Add increase parameter.  Change all
10257         callers.  Remove old relro handling.
10258         * output.h (class Output_section): Add new methods: is_last_relro,
10259         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
10260         Add is_last_relro_ and is_first_non_relro_ fields.
10261         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
10262         Create separate .got.plt section.  Call increase_relro.
10263         * x86_64.cc (Target_x86_64::got_section): Likewise.
10264         * testsuite/relro_script_test.t: Add .got.plt.
10265
10266         PR 10450
10267         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
10268         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
10269         (Layout::finalize): Call set_dynamic_symbol_size.
10270         (Layout::set_dynamic_symbol_size): New function.
10271         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
10272         set_dynamic_symbol_size.
10273
10274         PR 10450
10275         * output.h (class Output_section): Add is_entsize_zero_ field.
10276         * output.cc (Output_section::Output_section): Initialize
10277         is_entsize_zero_.
10278         (Output_section::set_entsize): If two different entsizes are
10279         requested, force it to zero.
10280         (Output_section::add_input_section): Set flags for .debug_str
10281         before updating section flags.  Set entsize.
10282         (Output_section::update_flags_for_input_section): Set SHF_MERGE
10283         and SHF_STRING if all input sections have those flags.
10284
10285 2009-12-29   Rafael Espindola  <espindola@google.com>
10286
10287         * main.cc (main): Fix the sys time reporting.
10288         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
10289         reporting.
10290
10291 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
10292
10293         * options.cc (General_options::parse_version): Allow -v to exit
10294         without an error if there is nothing to link.
10295
10296 2009-12-29  Ian Lance Taylor  <iant@google.com>
10297
10298         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
10299         using a version of gcc before 4.1.
10300         * configure: Rebuild.
10301
10302 2009-12-28  Chris Demetriou  <cgd@google.com>
10303
10304         * attributes.cc (Output_attributes_section_data::do_write): Use
10305         std::vector::front rather than std::vector::data.
10306
10307 2009-12-28  Ian Lance Taylor  <iant@google.com>
10308
10309         * symtab.h (class Symbol_table): Add enum Defined.
10310         * resolve.cc (Symbol_table::should_override): Add defined
10311         parameter.  Change all callers.  Test whether object is NULL
10312         before calling a method on it.
10313         (Symbol_table::report_resolve_problem): Add defined parameter.
10314         Change all callers.
10315         (Symbol_table::should_override_with_special): Likewise.
10316         * symtab.cc (Symbol_table::define_in_output_data): Add defined
10317         parameter.  Change all callers.
10318         (Symbol_table::do_define_in_output_data): Likewise.
10319         (Symbol_table::define_in_output_segment): Likewise.
10320         (Symbol_table::do_define_in_output_segment): Likewise.
10321         (Symbol_table::define_as_constant): Likewise.
10322         (Symbol_table::do_define_as_constant): Likewise.
10323         * script.h (class Symbol_assignment): Add is_defsym parameter to
10324         constructor; change all callers.
10325         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
10326         parameter.  Change all callers.  Add is_defsym_ field.
10327         (class Parser_closure): Add parsing_defsym parameter to
10328         constructor; change all callers.  Add parsing_defsym accessor
10329         function.  Add parsing_defsym_ field.
10330
10331 2009-12-28  Ian Lance Taylor  <iant@google.com>
10332
10333         * gold.cc (queue_middle_tasks): Fix formatting.
10334         * object.cc (Relobj::is_section_name_included): Likewise.
10335
10336 2009-12-23  Ian Lance Taylor  <iant@google.com>
10337
10338         * i386.cc (Target_i386::do_calls_non_split): Recognize
10339         -fsplit-stack prologue for a function with a static chain.
10340         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
10341         -fsplit-stack prologue when using %r11.
10342
10343 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
10344
10345         * options.cc (General_options::parse_version): Make -v continue and do
10346         the link like GNU ld does.
10347
10348 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
10349
10350         * Makefile.am (CCFILES): Add timer.cc.
10351         (HFILES): Add timer.h.
10352         * configure.ac: Check for sysconf and times.
10353         * main.cc: include timer.h.
10354         (main): Use Timer instead of get_run_time.
10355         * timer.cc: New.
10356         * timer.h: New.
10357         * workqueue.cc: include timer.h.
10358         (Workqueue::find_and_run_task):
10359         Report user, sys and wall time.
10360         * Makefile.in: Regenerate.
10361         * config.in: Regenerate.
10362         * configure: Regenerate.
10363
10364 2009-12-16  Doug Kwan  <dougkwan@google.com>
10365
10366         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
10367         sections.
10368         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
10369         relaxed input sections.
10370         * output.cc (Output_section::find_relaxed_input_section): Change
10371         return type to Output_relaxed_input_section pointer.  Adjust code
10372         for new type of relaxed_input_section_map_.
10373         * output.h (Output_section::find_relaxed_input_section): Change
10374         return type to Output_relaxed_input_section pointer.
10375         (Output_section::Output_relaxed_input_section_by_input_section_map):
10376         New type.
10377         (Output_section::relaxed_input_section_map_): Change type to
10378         Output_section::Output_relaxed_input_section_by_input_section_map.
10379         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
10380         input section.
10381
10382 2009-12-15  Ian Lance Taylor  <iant@google.com>
10383
10384         * layout.cc (Layout::create_shstrtab): Only write out after input
10385         sections if we are compressing debug sections.
10386
10387 2009-12-15  Ian Lance Taylor  <iant@google.com>
10388
10389         * archive.cc (Archive::add_symbols): Only look up a symbol without
10390         a version if there is, in fact, a version.
10391
10392 2009-12-14  Ian Lance Taylor  <iant@google.com>
10393
10394         Revert -Wshadow changes, all changes from:
10395         2009-12-11  Doug Kwan  <dougkwan@google.com>
10396         2009-12-11  Nick Clifton  <nickc@redhat.com>
10397         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
10398
10399 2009-12-11  Doug Kwan  <dougkwan@google.com>
10400
10401         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
10402         due to -Wshadow.
10403         * attributes.cc (Object_attribute::size): Ditto.
10404         (Attributes_section_data::size): Ditto.
10405         (Attributes_section_data::Attributes_section_data): Ditto.
10406         (Output_attributes_section_data::do_write): Ditto.
10407         * attributes.h (Object_attribute::set_type): Ditto.
10408         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
10409
10410 2009-12-11  Nick Clifton  <nickc@redhat.com>
10411
10412         * archive.cc: Fix shadowed variable warnings.
10413         * arm.cc: Likewise.
10414         * compressed_output.cc: Likewise.
10415         * compressed_output.h: Likewise.
10416         * configure: Likewise.
10417         * dwarf_reader.cc: Likewise.
10418         * dynobj.cc: Likewise.
10419         * dynobj.h: Likewise.
10420         * ehframe.cc: Likewise.
10421         * ehframe.h: Likewise.
10422         * errors.cc: Likewise.
10423         * expression.cc: Likewise.
10424         * fileread.cc: Likewise.
10425         * fileread.h: Likewise.
10426         * freebsd.h: Likewise.
10427         * i386.cc: Likewise.
10428         * icf.cc: Likewise.
10429         * incremental.h: Likewise.
10430         * layout.cc: Likewise.
10431         * layout.h: Likewise.
10432         * mapfile.cc: Likewise.
10433         * merge.cc: Likewise.
10434         * merge.h: Likewise.
10435         * object.cc: Likewise.
10436         * object.h: Likewise.
10437         * options.h: Likewise.
10438         * output.cc: Likewise.
10439         * output.h: Likewise.
10440         * parameters.cc: Likewise.
10441         * plugin.cc: Likewise.
10442         * powerpc.cc: Likewise.
10443         * reduced_debug_output.cc: Likewise.
10444         * reduced_debug_output.h: Likewise.
10445         * reloc.cc: Likewise.
10446         * reloc.h: Likewise.
10447         * resolve.cc: Likewise.
10448         * script-sections.cc: Likewise.
10449         * script.cc: Likewise.
10450         * script.h: Likewise.
10451         * sparc.cc: Likewise.
10452         * symtab.cc: Likewise.
10453         * symtab.h: Likewise.
10454         * target-select.cc: Likewise.
10455         * target-select.h: Likewise.
10456         * token.h: Likewise.
10457         * workqueue.cc: Likewise.
10458         * workqueue.h: Likewise.
10459         * x86_64.cc: Likewise.
10460
10461 2009-12-10  Doug Kwan  <dougkwan@google.com>
10462
10463         * arm.cc (attributes.h): New include.
10464         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
10465         (Arm_relobj::~Arm_relobj): Delete object pointed by
10466         attributes_section_data_.
10467         (Arm_relobj::attributes_section_data): New method definition.
10468         (Arm_relobj::attributes_section_data_): New data member declaration.
10469         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
10470         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
10471         attributes_section_data_.
10472         (Arm_dynobj::attributes_section_data): New method definition.
10473         (Arm_dynobj::attributes_section_data_): New data member declaration.
10474         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
10475         initialization value of may_use_blx_ to false.
10476         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
10477         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
10478         object attributes to compute results instead of hard-coding.
10479         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
10480         Target_arm::get_secondary_compatible_arch,
10481         Target_arm::set_secondary_compatible_arch
10482         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
10483         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
10484         New method declarations.
10485         (Target_arm::get_aeabi_object_attribute): New method definition.
10486         (Target_arm::attributes_section_data_): New data member declaration.
10487         (read_arm_attributes_section): New template definition.
10488         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
10489         (Arm_dynobj::do_read_symbols): Ditto.
10490         (Target_arm::do_finalize_sections): Merge attributes sections from
10491         input.  Check for BLX use after attributes section merging.
10492         Fix __exidx_start and __exidx_end visibility.  Create an
10493         .ARM.attributes section if necessary.
10494         (Target_arm::get_secondary_compatible_arch,
10495         Target_arm::set_secondary_compatible_arch,
10496         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
10497         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
10498         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
10499         New method definitions.
10500
10501 2009-12-09  Ian Lance Taylor  <iant@google.com>
10502
10503         * plugin.cc (Plugin::load): Don't cast from void* to a function
10504         pointer.
10505
10506 2009-12-09  Ian Lance Taylor  <iant@google.com>
10507
10508         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
10509         information fields.
10510
10511 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
10512
10513         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
10514         Replace two_file_shared_1.so with two_file_shared_2.so.
10515         * testsuite/Makefile.in: Regenerated.
10516
10517 2009-12-08  Doug Kwan  <dougkwan@google.com>
10518
10519         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
10520         (HFILES): Add attributes.h and int_encoding.h.
10521         * Makefile.in: Regenerate.
10522         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
10523         function definitions to int_encoding.cc
10524         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
10525         prototypes to int_encoding.h
10526         * reduced_debug_output.cc (int_encoding.h): New include.
10527         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
10528         function definitions to int_encoding.cc
10529         (insert_into_vector, read_from_pointer): Move template definitions to
10530         int_encoding.h
10531         * attributes.cc: New file.
10532         * attributes.h: New file.
10533         * int_encoding.cc: New file.
10534         * int_encoding.h: New file.
10535
10536 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
10537
10538         PR gold/11055
10539         * incremental-dump.cc (dump_incremental_inputs): New.
10540         (main): Use dump_incremental_inputs.
10541
10542 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
10543
10544         PR gold/10893
10545         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
10546         checking elfcpp::STT_FUNC.
10547         (Target_i386::Relocate::relocate): Likewise.
10548         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
10549
10550         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
10551         symbols from shared libraries into normal FUNC symbols.
10552
10553         * symtab.h (Symbol): Add is_func and use it.
10554
10555 2009-12-05  Doug Kwan  <dougkwan@google.com>
10556
10557         * arm.cc (Target_arm::arm_info): Initialize new fields
10558         attributes_section and attributes_vendor.
10559         * i386.cc (Target_i386::i386_info): Same.
10560         * object.cc (Sized_relobj::do_layout): Skip attribute section.
10561         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
10562         fields attributes_section and attributes_vendor.
10563         * sparc.cc (Target_sparc::sparc_info): Same.
10564         * target.h (Target::attributes_section, Target::attributes_vendor,
10565         Target::is_attributes_section, Target::attribute_arg_type,
10566         Target::attributes_order): New method definitions.
10567         (Target::Target_info::attributes_section,
10568         Target::Target_info::attributes_vendor): New fields.
10569         (Target::do_attribute_arg_type, Target::do_attributes_order): New
10570         virtual method definitions.
10571         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
10572         attributes_section and attributes_vendor.
10573         * testsuite/testfile.cc (Target_test::test_target_info): Same.
10574
10575 2009-12-05  Doug Kwan  <dougkwan@google.com>
10576
10577         * arm.cc: Update comments about interworking and stub generation.
10578         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
10579         considered as non-PIC.
10580         (Arm_relocate_functions::base_abs): Fix formatting.
10581         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
10582         of function to use GOT entry address instead of offset.
10583         (Target_arm::Scan::global): Issue an error if a symbol would need a
10584         PLT does not get one because it is untyped.  Remove code to create
10585         dynamic symbols for relative branches.
10586         (Target_arm::Relocate::relocate: Use 0 instead of false since function
10587         takes unsigned integer instead of boolean.
10588
10589 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
10590
10591         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
10592         (two_file_test_LDADD): Likewise.
10593         (common_test_1_LDADD): Likewise.
10594         (exception_test_LDADD) Likewise.
10595         (weak_test_LDADD): Likewise.
10596         (many_sections_test_LDADD): Likewise.
10597         (initpri1_LDADD): Likewise.
10598         (script_test_1_LDADD): Likewise.
10599         (script_test_2_LDADD): Likewise.
10600         (justsyms_LDADD): Likewise.
10601         (binary_test_LDADD): Likewise.
10602         (large_LDADD): Likewise.
10603         * testsuite/Makefile.in: Regenerated.
10604
10605 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
10606
10607         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
10608         (Symbol_table::override_with_special): Likewise.
10609         (Symbol_table::add_from_object): Likewise.
10610
10611 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
10612
10613         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
10614         Don't set the data_offset twice.
10615
10616 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
10617
10618         * testsuite/Makefile.in: Regenerate.
10619
10620 2009-12-03  Doug Kwan  <dougkwan@google.com>
10621
10622         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
10623         (Target_arm::do_finalize_sections): Add parameter for symbol table
10624         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
10625         * i386.cc (Target_i386::do_finalize_sections): Add an additional
10626         parameter for symbol table pointer.
10627         * layout.cc (Layout::finalize): Call Target::finalize_sections with
10628         an additional parameter for a pointer to symbol table.
10629         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
10630         parameter for a symbol table pointer.
10631         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
10632         * target.h (Target::finalize_sections, Target::do_finalize_sections):
10633         Ditto.
10634         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
10635         parameter for a symbol table pointer.
10636
10637 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
10638
10639         * incremental.cc (Incremental_inputs_header)
10640         (Incremental_inputs_header_write, Incremental_inputs_entry)
10641         (Incremental_inputs_entry_write): Move ...
10642         * incremental.h (Incremental_inputs_header)
10643         (Incremental_inputs_header_write, Incremental_inputs_entry)
10644         (Incremental_inputs_entry_write): here.
10645
10646 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10647
10648         * incremental.cc (make_sized_incremental_binary): Set the target.
10649         Error if it is incompatible.
10650         * output.h (Output_file): Add filename method.
10651
10652 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10653
10654         * incremental.cc (Incremental_inputs_entry): Remove unused argument
10655         from the get_* methods.
10656
10657 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10658
10659         * incremental-dump.cc (main): Check that the offeset of a script is 0.
10660         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
10661         Write 0 for the data_offset of scripts.
10662
10663 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10664
10665         * testsuite/Makefile.am: Add the incremental_test.sh test.
10666         * testsuite/incremental_test.sh: New.
10667         * testsuite/incremental_test_1.c: New.
10668         * testsuite/incremental_test_2.c: New.
10669
10670 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
10671
10672         * incremental-dump.cc (main): Fix typos.
10673
10674 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
10675
10676         PR gold/11025
10677         * incremental-dump.cc (main): Use llu to print 64 bit values.
10678
10679 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
10680             H.J. Lu  <hongjiu.lu@intel.com>
10681
10682         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
10683         $(LIBDL).
10684         (incremental_dump_LDADD): Likewise.
10685         * Makefile.in: Regenerated.
10686
10687 2009-11-25  Doug Kwan  <dougkwan@google.com>
10688
10689         Revert:
10690
10691         2009-11-25  Doug Kwan  <dougkwan@google.com>
10692
10693                 * arm.cc (Target_arm::Target_arm): Move method definition
10694                 outside of class definition.  Add code to handle
10695                 --target1-rel, --target1-abs and --target2= options.
10696                 (Target_arm::get_reloc_reloc_type): Change method to be
10697                 non-static and const.
10698                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
10699                 New data member declaration.
10700                 (Target_arm::Scan::local, Target_arm::Scan::global,
10701                 Target_arm::Relocate::relocate,
10702                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10703                 Adjust call to Target_arm::get_real_reloc_type.
10704                 (Target_arm::get_real_reloc_type): Use command line options
10705                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
10706                 * options.h (--target1-rel, --target1-abs, --target2): New
10707                 ARM-only options.
10708
10709 2009-11-25  Doug Kwan  <dougkwan@google.com>
10710
10711         * arm.cc (Target_arm::Target_arm): Move method definition outside of
10712         class definition.  Add code to handle --target1-rel, --target1-abs
10713         and --target2= options.
10714         (Target_arm::get_reloc_reloc_type): Change method to be non-static
10715         and const.
10716         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
10717         member declaration.
10718         (Target_arm::Scan::local, Target_arm::Scan::global,
10719         Target_arm::Relocate::relocate,
10720         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
10721         call to Target_arm::get_real_reloc_type.
10722         (Target_arm::get_real_reloc_type): Use command line options to
10723         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
10724         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
10725         options.
10726
10727 2009-11-25  Doug Kwan  <dougkwan@google.com>
10728
10729         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
10730         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
10731         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
10732         formatting.
10733         (Arm_relocate_functions::thm_call): Replace body with a call to
10734         Arm_relocate_functions::thumb_branch_common.
10735         (Arm_relocate_functions::thm_jump24,
10736         Arm_relocate_functions::thm_xpc22): New method definitions.
10737         (Arm_relocate_functions::thumb_branch_common): New method definition.
10738         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
10739         operator.
10740         (Target_arm::Relocate::relocate): Adjust call to thm_call.
10741         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
10742
10743 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
10744
10745         * Makefile.am: Build incremental-dump
10746         * Makefile.in: Regenerate.
10747         * incremental-dump.cc: New.
10748         * incremental.cc (Incremental_inputs_header_data,
10749         Incremental_inputs_entry_data): Move to incremental.h
10750         * incremental.h: (Incremental_inputs_header_data,
10751         Incremental_inputs_entry_data): Move from incremental.cc
10752
10753 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
10754
10755         * incremental.cc (Incremental_inputs_header,
10756         Incremental_inputs_header_write, Incremental_inputs_entry,
10757         Incremental_inputs_entry_write): Add a typedef with the data type.
10758
10759 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
10760
10761         * incremental.cc (Incremental_inputs_header,
10762         Incremental_inputs_header_write, Incremental_inputs_entry,
10763         Incremental_inputs_entry_write): Update comment about which
10764         type has the filed descriptions.
10765
10766 2009-11-15  Doug Kwan  <dougkwan@google.com>
10767
10768         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
10769         (Arm_relocate_functions::arm_branch_common): Change method defintion
10770         in class definition to a method declaration and update list of formal
10771         parameters.
10772         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
10773         Arm_relocation_functions::jump24): Adjust call to
10774         Arm_relocate_functions::arm_branch_common.  Update list of formal
10775         parameters.
10776         (Arm_relocate_functions::xpc25): New method definition.
10777         (Arm_relocate_functions::arm_branch_common): Move method defintion
10778         out from class definition.  Use stubs for mode-switching and extending
10779         branch ranges.
10780         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
10781         specially.  Change code to enable use of stubs in ARM branches.
10782
10783 2009-11-10  Doug Kwan  <dougkwan@google.com>
10784
10785         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
10786         in method declaration.
10787         (Target_arm::relocate_stub): New method declaration.
10788         (Target_arm::default_target): Change to return a pointer instead of
10789         a const reference.
10790         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
10791         Target_arm::default_target.
10792         (Arm_Relobj::do_relocate_sections): Remove options paramater in
10793         method definition.
10794         (Target_arm::relocate_section): Adjust view.
10795         (Target_arm::relocate_stub): New method definition.
10796
10797 2009-11-10  Doug Kwan  <dougkwan@google.com>
10798
10799         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
10800         a format warning.
10801         * incremental.cc (open_incremental_binary): Initialized local
10802         variables to avoid warnings.
10803         * object.cc (make_elf_object): Ditto.
10804         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
10805         a format warning.
10806
10807 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
10808
10809         PR gold/10930
10810         * testsuite/plugin_test.c: Include "config.h".
10811
10812 2009-11-09  Doug Kwan  <dougkwan@google.com>
10813
10814         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
10815         (arm_symbol_value): Remove.
10816         (Arm_relocate_functions::arm_branch_common,
10817         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
10818         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
10819         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
10820         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
10821         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
10822         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
10823         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
10824         Arm_relocate_functions::thm_mobw_abs_nc,
10825         Arm_relocate_functions::thm_mov_abs,
10826         Arm_relocate_functions::movw_prel_nc,
10827         Arm_relocate_functions::thm_movt_abs,
10828         Arm_relocate_functions::movt_prel,
10829         Arm_relocate_functions::thm_movw_prel_nc,
10830         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
10831         (Target_arm::Relocate::relocate): Only decompose address into two
10832         parts if relocation type uses the thumb-bit and pass the actual
10833         bit instead of a flag indicating that the thumb-bit is used.  Adjust
10834         calls to methods in Arm_relocate_functions for this change.
10835
10836 2009-11-08  Ian Lance Taylor  <iant@google.com>
10837
10838         PR 10925
10839         * reloc.cc: Instantiate
10840         Sized_relobj::initialize_input_to_output_maps and
10841         Sized_relobj:free_input_to_output_maps.
10842
10843 2009-11-06  Ian Lance Taylor  <iant@google.com>
10844
10845         PR 10876
10846         * defstd.cc (in_segment): Set only_if_ref true for "end".
10847
10848 2009-11-06  Doug Kwan  <dougkwan@google.com>
10849
10850         * arm.cc (class Reloc_stub): Correct a comment.
10851         (Target_arm::Target_arm): Initialize arm_input_section_map_.
10852         (Target_arm::scan_section_for_stubs): New method declaration.
10853         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
10854         Change methods from private to protected.
10855         (Target_arm::do_may_relax): New method definition.
10856         (Target_arm::do_relax, Target_arm::group_sections,
10857         Target_arm::scan_reloc_for_stub,
10858         Target_arm::scan_reloc_section_for_stubs): New method declarations.
10859         (Target_arm::arm_input_section_map_): New data member declaration.
10860         (Target_arm::scan_reloc_for_stub,
10861         Target_arm::scan_reloc_section_for_stubs,
10862         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
10863         Target_arm::do_relax): New method definitions.
10864
10865 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
10866
10867         * configure.ac: Check for (struct stat)::st_mtim
10868         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
10869         * config.in: Regenerate.
10870         * configure: Regenerate.
10871
10872 2009-11-05  Ian Lance Taylor  <iant@google.com>
10873
10874         PR 10910
10875         * output.cc (Output_segment::add_output_section): Add missing
10876         return statement.
10877
10878 2009-11-04  Ian Lance Taylor  <iant@google.com>
10879
10880         PR 10880
10881         * object.h (class Object): Add is_needed and set_is_needed
10882         methods.  Add is_needed_ field.  Make bool fields into bitfields.
10883         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
10884         defined in a dynamic object and referenced by a regular object,
10885         set is_needed for the dynamic object.
10886         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
10887         if the file is marked with as_needed and it is not needed.
10888
10889 2009-11-04  Ian Lance Taylor  <iant@google.com>
10890
10891         PR 10887
10892         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
10893         tags if data is discarded by linker script.
10894         * i386.cc (Target_i386::do_finalize_sections): Likewise.
10895         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
10896         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
10897         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
10898
10899 2009-11-04  Ian Lance Taylor  <iant@google.com>
10900
10901         * layout.cc (Layout::get_output_section): Add is_interp and
10902         is_dynamic_linker_section parameters.  Change all callers.
10903         (Layout::choose_output_section): Likewise.
10904         (Layout::make_output_section): Likewise.
10905         (Layout::add_output_section_data): Add is_dynamic_linker_section
10906         parameter.  Change all callers.
10907         * layout.h (class Layout): Update declarations.
10908         * output.h (class Output_section): Add is_interp, set_is_interp,
10909         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
10910         Add is_interp_, is_dynamic_linker_section_ fields.  Change
10911         generate_code_fills_at_write_ to a bitfield.
10912         * output.cc (Output_section::Output_sections): Initialize new
10913         fields.
10914         (Output_segment::add_output_section): Add do_sort parameter.
10915         Change all callers.
10916
10917 2009-11-03  Ian Lance Taylor  <iant@google.com>
10918
10919         PR 10860
10920         * options.h (class General_options): Add --warn-common.
10921         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
10922         merging two common symbols.
10923         (Symbol_table::should_override): Handle --warn-common when merging
10924         a common symbol with a defined symbol.  Use report_resolve_problem
10925         for multiple definitions.
10926         (Symbol_table::report_resolve_problem): New function.
10927         * symtab.h (class Symbol_table): Declare report_resolve_problem.
10928
10929 2009-11-03  Doug Kwan  <dougkwan@google.com>
10930
10931         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
10932         stub_factory_.
10933         (Target_arm::stub_factory): New method definition.
10934         (Target_arm::new_arm_input_section,
10935         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
10936         Target_arm::reloc_uses_thumb_bit): New method declarations.
10937         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
10938         New type definitions.
10939         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
10940         member declarations.
10941         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
10942         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
10943         New method definitions.
10944
10945 2009-11-03  Ian Lance Taylor  <iant@google.com>
10946
10947         * options.h (class General_options): Add --warn_constructors.
10948
10949 2009-11-03  Ian Lance Taylor  <iant@google.com>
10950
10951         PR 10893
10952         * defstd.cc (in_section): Add entries for __rel_iplt_start,
10953         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
10954
10955 2009-11-03  Ian Lance Taylor  <iant@google.com>
10956
10957         PR 10895
10958         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
10959         --msgid-bugs-address.
10960         (install-pdf): New target.
10961         (install-data_yes): Look up one directory to find mkinstalldirs.
10962
10963 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
10964
10965         * po/Make-in (.po.gmo): Don't generate .gmo files in source
10966         tree.
10967
10968 2009-10-30  Doug Kwan  <dougkwan@google.com>
10969
10970         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
10971
10972 2009-10-30  Doug Kwan  <dougkwan@google.com>
10973
10974         * arm.cc (Stub_addend_reader): New struct template definition
10975         and partial specializations.
10976         (Stub_addend_reader::operator()): New method definition for a
10977         partially specialized template.
10978
10979 2009-10-30  Doug Kwan  <dougkwan@google.com>
10980
10981         * arm.cc (Arm_relobj::processor_specific_flags): New method
10982         definition.
10983         (Arm_relobj::do_read_symbols): New method declaration.
10984         (Arm_relobj::processor_specific_flags_): New data member declaration.
10985         (Arm_dynobj): New class definition.
10986         (Target_arm::do_finalize_sections): Add input_objects parameter.
10987         (Target_arm::do_adjust_elf_header): New method declaration.
10988         (Target_arm::are_eabi_versions_compatible,
10989         (Target_arm::merge_processor_specific_flags): New method declaration.
10990         (Target_arm::do_make_elf_object): New overloaded method definitions
10991         and declaration.
10992         (Arm_relobj::do_read_symbols): New method definition.
10993         (Arm_dynobj::do_read_symbols): Ditto.
10994         (Target_arm::do_finalize_sections): Add input_objects parameters.
10995         Merge processor-specific flags from all input objects.
10996         (Target_arm::are_eabi_versions_compatible,
10997         Target_arm::merge_processor_specific_flags,
10998         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
10999         New method definitions.
11000         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
11001         Input_objects pointer type parameter.
11002         * layout.cc (Layout::finalize): Pass input objects to target's.
11003         finalize_sections function.
11004         * output.cc (Output_file_header::do_sized_write): Set ELF file
11005         header's processor-specific flags.
11006         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
11007         Input_objects pointer type parameter.
11008         * sparc.cc (Target_sparc::do_finalize_sections): Same.
11009         * target.h (Input_objects): New forward class declaration.
11010         (Target::processor_specific_flags,
11011         Target::are_processor_specific_flags_sect): New method definitions.
11012         (Target::finalize_sections): Add input_objects parameter.
11013         (Target::Target): Initialize processor_specific_flags_ and
11014         are_processor_specific_flags_set_.
11015         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
11016         parameter.
11017         (Target::set_processor_specific_flags): New method definition.
11018         (Target::processor_specific_flags_,
11019         Target::are_processor_specific_flags_set_): New data member
11020         declarations.
11021         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
11022         Input_objects pointer type parameter.
11023
11024 2009-10-30  Doug Kwan  <dougkwan@google.com>
11025
11026         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
11027
11028 2009-10-28  Ian Lance Taylor  <iant@google.com>
11029
11030         * object.h (class Relobj): Drop options parameter from
11031         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
11032         do_scan_relocs, do_relocate.  Change all callers.
11033         (class Sized_relobj): Drop options parameters from
11034         do_gc_process_relocs, do_scan_relocs, do_relocate,
11035         do_relocate_sections, relocate_sections, emit_relocs_scan,
11036         emit_relocs_scan_reltype.  Change all callers.
11037         (struct Relocate_info): Remove options field and all references to
11038         it.
11039         * reloc.h (class Read_relocs): Remove options constructor
11040         parameter and options_ field.  Change all callers.
11041         (class Gc_process_relocs, class Scan_relocs): Likewise.
11042         (class Relocate_task): Likewise.
11043         * target-reloc.h (scan_relocs): Remove options parameter.  Change
11044         all callers.
11045         (scan_relocatable_relocs): Likewise.
11046         * target.h (class Sized_target): Remove options parameter from
11047         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
11048         all callers.
11049         * gc.h (gc_process_relocs): Remove options parameter.  Change all
11050         callers.
11051         * arm.cc: Update functions to remove options parameters.
11052         * i386.cc: Likewise.
11053         * powerpc.cc: Likewise.
11054         * sparc.cc: Likewise.
11055         * x86_64.cc: Likewise.
11056         * testsuite/testfile.cc: Likewise.
11057
11058 2009-10-28  Doug Kwan  <dougkwan@google.com>
11059
11060         * arm.cc (Arm_relobj): New class definition.
11061         (Arm_relobj::scan_sections_for_stubs,
11062         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
11063         New method definitions.
11064
11065 2009-10-28  Cary Coutant  <ccoutant@google.com>
11066
11067         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
11068         (Plugin::cleanup_done_): New member.
11069         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
11070         (Plugin_manager::cleanup_done_): Remove.
11071         (Plugin_manager::add_input_file): Edit error message.
11072         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
11073         (Plugin_manager::cleanup): Remove use of cleanup_done_.
11074
11075 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
11076
11077         * fileread.cc: (File_read::View::~View): Use the new
11078         data_ownership_ filed.
11079         (File_read::~File_read): Dispose the new whole_file_view_.
11080         (File_read::open): Mmap the whole file if needed.
11081         (File_read::open): Use whole_file_view_ instead of contents_.
11082         (File_read::find_view): Use whole_file_view_ if applicable.
11083         (File_read::do_read): Use whole_file_view_ instead of contents_.
11084         (File_read::make_view): Use whole_file_view_ instead of contents_,
11085         update File_read::View::View call.
11086         (File_read::find_or_make_view): Update File_read::View::View
11087         call.
11088         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
11089         remove contents_
11090         (File_read::View::Data_ownership): New enum.
11091         (File_read::View::View): Replace bool mapped_ with Data_ownership
11092         argument.
11093         (File_read::View::mapped_): Remove (replaced by data_ownership_).
11094         (File_read::View::data_ownership_): New field.
11095         (File_read::contents_): Remove (replaced by whole_file_view_).
11096         (File_read::whole_file_view_): New field.
11097         * options.h (class General_options): Add --keep-files-mapped.
11098
11099 2009-10-27  Cary Coutant  <ccoutant@google.com>
11100
11101         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
11102         * testsuite/Makefile.am (plugin_test_5): New test case.
11103         * testsuite/Makefile.in: Regenerate.
11104
11105 2009-10-25  Doug Kwan  <dougkwan@google.com>
11106
11107         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
11108         from private to protected to allow access by child class.
11109         (Sized_relobj::do_relocate_sections): New method declaration.
11110         (Sized_relobj::relocate_sections): Virtualize.
11111         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
11112         Sized_relobj::relocate_sections.  Instantiate template explicitly
11113         for different target sizes and endianity.
11114
11115 2009-10-24  Doug Kwan  <dougkwan@google.com>
11116
11117         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
11118         (Arm_input_section::as_arm_input_section): New method.
11119         (Arm_output_section): New class definition.
11120         (Arm_output_section::create_stub_group,
11121         Arm_output_section::group_sections): New method definitions.
11122
11123 2009-10-22  Doug Kwan  <dougkwan@google.com>
11124
11125         * arm.cc (Arm_input_section): New class definition.
11126         (Arm_input_section::init, Arm_input_section:do_write,
11127         Arm_input_section::set_final_data_size,
11128         Arm_input_section::do_reset_address_and_file_offset): New method
11129         definitions.
11130
11131 2009-10-21  Doug Kwan  <dougkwan@google.com>
11132
11133         * arm.cc (Stub_table, Arm_input_section): New forward class
11134         declarations.
11135         (Stub_table): New class defintion.
11136         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
11137         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
11138         New method definition.
11139
11140 2009-10-21  Doug Kwan  <dougkwan@google.com>
11141
11142         * arm.cc: Update copyright comments.
11143         (Target_arm): New forward class template declaration.
11144         (Arm_address): New type.
11145         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
11146         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
11147         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
11148         constants.
11149         (Insn_template): Same.
11150         (DEF_STUBS): New macro.
11151         (Stub_type): New enum type.
11152         (Stub_template): New class definition.
11153         (Stub): Same.
11154         (Reloc_stub): Same.
11155         (Stub_factory): Same.
11156         (Target_arm::Target_arm): Initialize may_use_blx_ and
11157         should_force_pic_veneer_.
11158         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
11159         Target_arm::should_force_pic_veneer,
11160         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
11161         Target_arm::using_thumb_only, Target_arm:;default_target): New
11162         method defintions.
11163         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
11164         New data member declarations.
11165         (Insn_template::size, Insn_template::alignment): New method defintions.
11166         (Stub_template::Stub_template): New method definition.
11167         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
11168         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
11169         (Stub_factory::Stub_factory): New method definition.
11170         * gold.h (string_hash): New template.
11171         * output.h (Input_section_specifier::hash_value): Use
11172         gold::string_hash.
11173         (Input_section_specifier::string_hash): Remove.
11174         * stringpool.cc (Stringpool_template::string_hash): Use
11175         gold::string_hash.
11176
11177 2009-10-20  Doug Kwan  <dougkwan@google.com>
11178
11179         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
11180         symbols of relaxed input sections.
11181         * output.h (Output_section::find_relaxed_input_section): Make
11182         method public.
11183
11184 2009-10-16  Doug Kwan  <dougkwan@google.com>
11185
11186         * dynobj.cc (Versions::Versions): Initialize version_script_.
11187         Only insert base version symbol definition for a shared object
11188         if version script defines any version versions.
11189         (Versions::define_base_version): New method definition.
11190         (Versions::add_def): Check that base version is not needed.
11191         (Versions::add_need): Define base version lazily.
11192         * dynobj.h (Versions::define_base_version): New method declaration.
11193         (Versions::needs_base_version_): New data member declaration.
11194         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
11195         (check_DATA): Add no_version_test.stdout.
11196         (libno_version_test.so, no_version_test.o no_version_test.stdout):
11197         New make rules.
11198         * testsuite/Makefile.in: Regenerate.
11199         * testsuite/no_version_test.c: New file.
11200         * testsuite/no_version_test.sh: Ditto.
11201
11202 2009-10-16  Doug Kwan  <dougkwan@google.com>
11203
11204         * expression.cc (class Segment_start_expression): New class definition.
11205         (Segment_start_expression::value): New method definition.
11206         (script_exp_function_segment_start): Return a new
11207         Segment_start_expression.
11208         * gold/script-c.h (script_saw_segment_start_expression): New function
11209         prototype.
11210         * script-sections.cc (Script_sections::Script_sections): Initialize
11211         SAW_SEGMENT_START_EXPRESSION_ to false.
11212         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
11213         and -Tbbs options to specify section addresses if given in
11214         command line and no SEGMENT_START expression is seen in a script.
11215         * script-sections.h (Script_sections::saw_segment_start_expression,
11216         Script_sections::set_saw_segment_start_expression): New method
11217         definition.
11218         (Script_sections::saw_segment_start_expression_): New data member
11219         declaration.
11220         * script.cc (script_saw_segment_start_expression): New function.
11221         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
11222         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
11223         script_test_7.sh and script_test_8.sh.
11224         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
11225         script_test_8.stdout.
11226         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
11227         (script_test_6, script_test_6.stdout, script_test_7,
11228         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
11229         * Makefile.in: Regenerate.
11230         * testsuite/script_test_6.sh: New file.
11231         * testsuite/script_test_6.t: Same.
11232         * testsuite/script_test_7.sh: Same.
11233         * testsuite/script_test_7.t: Same.
11234         * testsuite/script_test_8.sh: Same.
11235
11236 2009-10-16  Doug Kwan  <dougkwan@google.com>
11237
11238         * output.cc (Output_segment::set_section_list_address): Cast
11239         expressions to unsigned long long type to avoid format warnings.
11240
11241 2009-10-15  Ian Lance Taylor  <iant@google.com>
11242
11243         * script.cc (Script_options::add_symbol_assignment): Always add a
11244         dot assignment to script_sections_.
11245         * script-sections.cc (Script_sections::add_dot_assignment):
11246         Initialize if necessary.
11247
11248         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
11249         program headers with no load segment if there is a linker script.
11250
11251         * layout.cc (Layout::set_segment_offsets): Align the file offset
11252         to the segment aligment for -N or -n with no load segment.
11253         * output.cc (Output_segment::add_output_section): Don't crash if
11254         the first section is a TLS section.
11255         (Output_segment::set_section_list_addresses): Print an error
11256         message if the address moves backward in a linker script.
11257         * script-sections.cc
11258         (Output_section_element_input::set_section_addresses): Don't
11259         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
11260         (Orphan_output_section::set_section_addresses): Likewise.
11261
11262 2009-10-15  Doug Kwan  <dougkwan@google.com>
11263
11264         * layout.cc (Layout::finish_dynamic_section): Generate tags
11265         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
11266         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
11267         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
11268
11269 2009-10-14  Ian Lance Taylor  <iant@google.com>
11270
11271         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
11272         fields.
11273         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
11274         data_shdr fields of relinfo.
11275         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
11276         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
11277         R_386_TLS_LDO_32, adjust based on section flags.
11278         (Target_i386::Relocate::fix_up_ldo): Remove.
11279
11280 2009-10-13  Ian Lance Taylor  <iant@google.com>
11281
11282         Add support for -pie.
11283         * options.h (class General_options): Add -pie and
11284         --pic-executable.
11285         (General_options::output_is_position_independent): Test -pie.
11286         (General_options::output_is_executable): Return true if not shared
11287         and not relocatable.
11288         (General_options::output_is_pie): Remove.
11289         * options.cc (General_options::finalize): Reject incompatible uses
11290         of -pie.
11291         * gold.cc (queue_middle_tasks): A -pie link is not static.
11292         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
11293         * symtab.cc (Symbol::final_value_is_known): Return false if
11294         output_is_position_independent.
11295         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
11296         output_is_position_independent.
11297         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
11298         output_is_position_independent.
11299         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
11300         output_is_position_independent.
11301         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
11302         two_file_pie_test.
11303         (basic_pie_test.o, basic_pie_test): New targets.
11304         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
11305         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
11306         (two_file_pie_test): New target.
11307         * testsuite/Makefile.in: Rebuild.
11308         * README: Remove note saying that -pie is not supported.
11309
11310 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
11311
11312         * options.h (class General_options): Add -init and -fini.
11313         * layout.cc (Layout::finish_dynamic_section): Emit
11314         given init and fini functions.
11315
11316 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
11317
11318         * gc.h (gc_process_relocs): Check if icf is enabled using new
11319         function.
11320         * gold.cc (queue_initial_tasks): Likewise.
11321         (queue_middle_tasks): Likewise.
11322         * object.cc (do_layout): Likewise.
11323         * symtab.cc (is_section_folded): Likewise.
11324         * main.cc (main): Likewise.
11325         * reloc.cc (Read_relocs::run): Likewise.
11326         (Sized_relobj::do_scan_relocs): Likewise.
11327         * icf.cc (is_function_ctor_or_dtor): New function.
11328         (Icf::find_identical_sections): Check if function is ctor or dtor when
11329         safe icf is chosen.
11330         * options.h (General_options::icf): Change option to be an enum.
11331         (Icf_status): New enum.
11332         (icf_enabled): New method.
11333         (icf_safe_folding): New method.
11334         (set_icf_status): New method.
11335         (icf_status_): New variable.
11336         * (options.cc) (General_options::finalize): Set icf_status_.
11337         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
11338         icf_test and icf_keep_unique_test to use the --icf enum flag.
11339         * testsuite/icf_safe_test.sh: New file.
11340         * testsuite/icf_safe_test.cc: New file.
11341
11342 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
11343
11344         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
11345         includes to gc.h and icf.h.
11346         * arm.cc: Include gc.h.
11347         * gold.cc: Likewise.
11348         * i386.cc: Likewise.
11349         * powerpc.cc: Likewise.
11350         * sparc.cc: Likewise.
11351         * x86_64.cc: Likewise.
11352         * gc.h: Include icf.h.
11353
11354 2009-10-11  Ian Lance Taylor  <iant@google.com>
11355
11356         * plugin.cc: Include "gold.h" before other header files.
11357
11358 2009-10-10  Chris Demetriou  <cgd@google.com>
11359
11360         * options.h (Input_file_argument::Input_file_type): New enum.
11361         (Input_file_argument::is_lib_): Replace with...
11362         (Input_file_argument::type_): New member.
11363         (Input_file_argument::Input_file_argument): Take Input_file_type
11364         'type' rather than boolean 'is_lib' as second argument.
11365         (Input_file_argument::is_lib): Use type_.
11366         (Input_file_argument::is_searched_file): New function.
11367         (Input_file_argument::may_need_search): Handle is_searched_file.
11368         * options.cc (General_options::parse_library): Support -l:filename.
11369         (General_options::parse_just_symbols): Update for Input_file_argument
11370         changes.
11371         (Command_line::process): Likewise.
11372         * archive.cc (Archive::get_file_and_offset): Likewise.
11373         * plugin.cc (Plugin_manager::release_input_file): Likewise.
11374         * script.cc (read_script_file, script_add_file): Likewise.
11375         * fileread.cc (Input_file::Input_file): Likewise.
11376         (Input_file::will_search_for): Handle is_searched_file.
11377         (Input_file::open): Likewise.
11378         * readsyms.cc (Read_symbols::get_name): Likewise.
11379         * testsuite/Makefile.am (searched_file_test): New test.
11380         * testsuite/Makefile.in: Regenerate.
11381         * testsuite/searched_file_test.cc: New file.
11382         * testsuite/searched_file_test_lib.cc: New file.
11383
11384 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11385             Ian Lance Taylor  <iant@google.com>
11386
11387         * descriptor.cc: Include <cstdio> and "binary-io.h".
11388         (Descriptors::open): Open the files in binary mode always.
11389         * script.cc (Lex::get_token): Treat \r as whitespace.
11390
11391 2009-10-09  Ian Lance Taylor  <iant@google.com>
11392
11393         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
11394
11395 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11396             Ian Lance Taylor  <iant@google.com>
11397
11398         * configure.ac: Check for readv function also.
11399         * fileread.cc (readv): Define if not HAVE_READV.
11400         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
11401         does not exist.
11402         * config.in: Regenerate.
11403         * configure: Regenerate.
11404
11405 2009-10-09  Doug Kwan  <dougkwan@google.com>
11406
11407         * layout.cc (Layout::make_output_section): Call target hook to make
11408         ordinary output section.
11409         (Layout::finalize): Adjust parameter list of call the
11410         Target::may_relax().
11411         * layout.h (class Layout::section_list): New method.
11412         * merge.h (Output_merge_base::entsize): Change visibility to public.
11413         (Output_merge_base::is_string, Output_merge_base::do_is_string):
11414         New methods.
11415         (Output_merge_string::do_is_string): New method.
11416         * object.cc (Sized_relobj::do_setup): renamed from
11417         Sized_relobj::set_up.
11418         * object.h (Sized_relobj::adjust_shndx,
11419         Sized_relobj::initializ_input_to_output_maps,
11420         Sized_relobj::free_input_to_output_maps): Change visibilities to
11421         protected.
11422         (Sized_relobj::setup): Virtualize.
11423         (Sized_relobj::do_setup): New method declaration.
11424         (Sized_relobj::invalidate_section_offset,
11425         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
11426         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
11427         * options.cc (parse_int): New function.
11428         * options.h (parse_int): New declaration.
11429         (DEFINE_int): New macro.
11430         (stub_group_size): New option.
11431         * output.cc (Output_section::Output_section): Initialize memebers
11432         merge_section_map_, merge_section_by_properties_map_,
11433         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
11434         (Output_section::add_input_section): Handled deferred code-fill
11435         generation and remove an old comment.
11436         (Output_section::add_relaxed_input_section): New method definition.
11437         (Output_section::add_merge_input_section): Use merge section by
11438         properties map to speed to search.  Update merge section maps
11439         as appropriate.
11440         (Output_section::build_relaxation_map): New method definition.
11441         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
11442         Same.
11443         (Output_section::relax_input_section): Renamed to
11444         Output_section::convert_input_sections_to_relaxed_sections and change
11445         interface to take a vector of pointers to relaxed sections.
11446         (Output_section::find_merge_section,
11447         Output_section::find_relaxed_input_section): New method definitions.
11448         (Output_section::is_input_address_mapped,
11449         Output_section::output_offset, Output_section::output_address):
11450         Use output section data maps to speed up searching.
11451         (Output_section::find_starting_output_address): Add comments.
11452         (Output_section::do_write,
11453         Output_section::write_to_postprocessing_buffer): Do code-fill
11454         generation as appropriate.
11455         (Output_section::get_input_sections): Invalidate relaxed input section
11456         map.
11457         (Output_section::restore_states): Adjust type of checkpoint .
11458         Invalidate relaxed input section map.
11459         * output.h (Output_merge_base): New class declaration.
11460         (Input_section_specifier): New class defintion.
11461         (class Output_relaxed_input_section) Change base class to
11462         Output_section_data_build.
11463         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
11464         base class initializer.
11465         (Output_section::add_relaxed_input_section): New method declaration.
11466         (Output_section::Input_section): Change visibility to protected.
11467         (Output_section::Input_section::relobj,
11468         Output_section::Input_section::shndx): Handle relaxed input sections.
11469         Output_section::input_sections) Change visibility to protected.  Also
11470         define overload to return a non-const pointer.
11471         (Output_section::Merge_section_properties): New class defintion.
11472         (Output_section::Merge_section_by_properties_map,
11473         Output_section::Output_section_data_by_input_section_map,
11474         Output_section::Relaxation_map): New types.
11475         (Output_section::relax_input_section): Rename method to
11476         Output_section::convert_input_sections_to_relaxed_sections and change
11477         interface to take a vector of relaxed section pointers.
11478         (Output_section::find_merge_section,
11479         Output_section::find_relaxed_input_section,
11480         Output_section::build_relaxation_map,
11481         Output_section::convert_input_sections_in_list_to_relaxed_sections):
11482         New method declarations.
11483         (Output_section::merge_section_map_
11484         Output_section::merge_section_by_properties_map_,
11485         Output_section::relaxed_input_section_map_,
11486         Output_section::is_relaxed_input_section_map_valid_,
11487         Output_section::generate_code_fills_at_write_): New data members.
11488         * script-sections.cc
11489         (Output_section_element_input::set_section_addresses): Call
11490         current_data_size and addralign methods of relaxed input sections.
11491         (Orphan_output_section::set_section_addresses): Call current_data_size
11492         and addralign methods of relaxed input sections.
11493         * symtab.cc (Symbol_table::compute_final_value): Extract template
11494         from the body of Symbol_table::sized_finalize_symbol.
11495         (Symbol_table::sized_finalized_symbol): Call
11496         Symbol_table::compute_final_value.
11497         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
11498         (Symbol_table::compute_final_value): New templated method declaration.
11499         * target.cc (Target::do_make_output_section): New method defintion.
11500         * target.h (Target::make_output_section): New method declaration.
11501         (Target::relax): Add more parameters for input objects, symbol table
11502         and layout.  Adjust call to do_relax.
11503         (Target::do_make_output_section): New method declaration.
11504         (Target::do_relax): Add parameters for input objects, symbol table
11505         and layout.
11506
11507 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11508
11509         * pread.c: Include stdio.h.
11510
11511 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11512
11513         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
11514         defined.
11515
11516 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11517
11518         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
11519         Change read_shndx type to unsigned int.
11520         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
11521         int.
11522         (Sized_dwarf_line_info::read_line_mappings): Likewise.
11523         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
11524         Change read_shndx type to unsigned int.
11525         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
11526         int.
11527         (Sized_dwarf_line_info::read_line_mappings): Likewise.
11528         * layout.cc (Layout::create_symtab_sections): Cast the result of
11529         local_symcount * symsize to off_t in the gold_assert.
11530
11531 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11532
11533         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
11534         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
11535         R_ARM_BASE_ABS.
11536         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
11537         (Arm_relocate_functions::thm_abs5): New function.
11538         (Arm_relocate_functions::abs12): New function.
11539         (Arm_relocate_functions::abs16): New function.
11540         (Arm_relocate_functions::base_abs): New function.
11541         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
11542         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
11543         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
11544         R_ARM_BASE_ABS.
11545         (Scan::global): Likewise.
11546         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
11547         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
11548         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
11549         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
11550         R_ARM_BASE_ABS.
11551
11552 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11553
11554         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
11555         (Arm_relocate_functions::movt_prel): New function.
11556         (Arm_relocate_functions::thm_movw_prel_nc): New function.
11557         (Arm_relocate_functions::thm_movt_prel): New function.
11558         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
11559         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
11560         (Scan::global, Relocate::relocate): Likewise.
11561         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11562
11563 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
11564
11565         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
11566         Incremental_checker.
11567         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
11568         unsigned int.
11569         (class Incremental_inputs_header): New class.
11570         (Incremental_inputs_header_writer): Edit comment.
11571         (Incremental_inputs_entry): New class.
11572         (Incremental_inputs_entry_writer): Edit comment.
11573         (Sized_incremental_binary::do_find_incremental_inputs_section):
11574         Add *strtab_shndx parameter, fill it.
11575         (Sized_incremental_binary::do_check_inputs): New method.
11576         (Incremental_checker::can_incrementally_link_output_file): Use
11577         Sized_incremental_binary::check_inputs.
11578         (Incremental_inputs::report_command_line): Save command line in
11579         command_line_.
11580         * incremental.h:
11581         (Incremental_binary::find_incremental_inputs_section): New
11582         method.
11583         (Incremental_binary::do_find_incremental_inputs_section): Add
11584         strtab_shndx parameter.
11585         (Incremental_binary::do_check_inputs): New pure virtual method.
11586         (Sized_incremental_binary::do_check_inputs): Declare.
11587         (Incremental_checker::Incremental_checker): Add incremental_inputs
11588         parameter, use it to initialize incremental_inputs_.
11589         (Incremental_checker::incremental_inputs_): New field.
11590         (Incremental_checker::command_line): New method.
11591         (Incremental_checker::inputs): New method.
11592         (Incremental_checker::command_line_): New field.
11593
11594 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
11595
11596         * incremental.cc: Include <cstdarg> and "target-select.h".
11597         (vexplain_no_incremental): New function.
11598         (explain_no_incremental): New function.
11599         (Incremental_binary::error): New method.
11600         (Sized_incremental_binary::do_find_incremental_inputs_section): New
11601         method.
11602         (make_sized_incremental_binary): New function.
11603         (open_incremental_binary): New function.
11604         (can_incrementally_link_file): Add checks if output is ELF and has
11605         inputs section.
11606         * incremental.h: Include "elfcpp_file.h" and "output.h".
11607         (Incremental_binary): New class.
11608         (Sized_incremental_binary): New class.
11609         (open_incremental_binary): Declare.
11610         * object.cc (is_elf_object): Use
11611         elfcpp::Elf_recognizer::is_elf_file.
11612         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
11613         * output.h (Output_file::filesize): New method.
11614
11615 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11616
11617         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
11618         New function.
11619         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
11620         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
11621         function.
11622         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
11623         function.
11624         (Arm_relocate_functions::movw_abs_nc): New function.
11625         (Arm_relocate_functions::movt_abs): New function.
11626         (Arm_relocate_functions::thm_movw_abs_nc): New function.
11627         (Arm_relocate_functions::thm_movt_abs): New function.
11628         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
11629         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
11630         (Scan::global): Likewise.
11631         (Relocate::relocate): Likewise.
11632         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11633
11634 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11635
11636         * arm.cc (Arm_relocate_functions::got_prel) New function.
11637         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
11638         (Relocate::relocate): Likewise.
11639         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11640
11641 2009-10-06  Ian Lance Taylor  <iant@google.com>
11642
11643         * options.h (class General_options): Define
11644         split_stack_adjust_size parameter.
11645         * object.h (class Object): Add uses_split_stack_ and
11646         has_no_split_stack_ fields.  Add uses_split_stack and
11647         has_no_split_stack accessor functions.  Declare
11648         handle_split_stack_section.
11649         (class Reloc_symbol_changes): Define.
11650         (class Sized_relobj): Define Function_offsets.  Declare
11651         split_stack_adjust, split_stack_adjust_reltype, and
11652         find_functions.
11653         * object.cc (Object::handle_split_stack_section): New function.
11654         (Sized_relobj::do_layout): Call handle_split_stack_section.
11655         * dynobj.cc (Sized_dynobj::do_layout): Call
11656         handle_split_stack_section.
11657         * reloc.cc (Sized_relobj::relocate_sections): Call
11658         split_stack_adjust for executable sections in split_stack
11659         objects.  Pass reloc_map to relocate_section.
11660         (Sized_relobj::split_stack_adjust): New function.
11661         (Sized_relobj::split_stack_adjust_reltype): New function.
11662         (Sized_relobj::find_functions): New function.
11663         * target-reloc.h: Include "object.h".
11664         (relocate_section): Add reloc_symbol_changes parameter.  Change
11665         all callers.
11666         * target.h (class Target): Add calls_non_split method.  Declare
11667         do_calls_non_split virtual method.  Declare match_view and
11668         set_view_to_nop.
11669         * target.cc: Include "elfcpp.h".
11670         (Target::do_calls_non_split): New function.
11671         (Target::match_view): New function.
11672         (Target::set_view_to_nop): New function.
11673         * gold.cc (queue_middle_tasks): Give an error if mixing
11674         split-stack and non-split-stack objects with -r.
11675         * i386.cc (Target_i386::relocate_section): Add
11676         reloc_symbol_changes parameter.
11677         (Target_i386::do_calls_non_split): New function.
11678         * x86_64.cc (Target_x86_64::relocate_section): Add
11679         reloc_symbol_changes parameter.
11680         (Target_x86_64::do_calls_non_split): New function.
11681         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
11682         parameter.
11683         * powerpc.cc (Target_powerpc::relocate_section): Add
11684         reloc_symbol_changes parameter.
11685         * sparc.cc (Target_sparc::relocate_section): Add
11686         reloc_symbol_changes parameter.
11687         * configure.ac: Call AM_CONDITIONAL for the default target.
11688         * configure: Rebuild.
11689         * testsuite/Makefile.am (TEST_AS): New variable.
11690         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
11691         (check_DATA): Add split_i386 and split_x86_64 files.
11692         (SPLIT_DEFSYMS): Define.
11693         (split_i386_[1234n].o): New targets.
11694         (split_i386_[124]): New targets.
11695         (split_i386_[1234r].stdout): New targets.
11696         (split_x86_64_[1234n].o): New targets.
11697         (split_x86_64_[124]): New targets.
11698         (split_x86_64_[1234r].stdout): New targets.
11699         (MOSTLYCLEANFILES): Add new executables.
11700         * testsuite/split_i386.sh: New file.
11701         * testsuite/split_x86_64.sh: New file.
11702         * testsuite/split_i386_1.s: New file.
11703         * testsuite/split_i386_2.s: New file.
11704         * testsuite/split_i386_3.s: New file.
11705         * testsuite/split_i386_4.s: New file.
11706         * testsuite/split_i386_n.s: New file.
11707         * testsuite/split_x86_64_1.s: New file.
11708         * testsuite/split_x86_64_2.s: New file.
11709         * testsuite/split_x86_64_3.s: New file.
11710         * testsuite/split_x86_64_4.s: New file.
11711         * testsuite/split_x86_64_n.s: New file.
11712         * testsuite/testfile.cc (Target_test): Update relocation_section
11713         function.
11714         * testsuite/Makefile.in: Rebuild.
11715
11716 2009-10-06  Ian Lance Taylor  <iant@google.com>
11717
11718         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
11719         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
11720         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
11721         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
11722         the address on ldo_addrs_.
11723         (Target_i386::Relocate::fix_up_ldo): New function.
11724
11725 2009-10-06   Rafael Espindola  <espindola@google.com>
11726
11727         * plugin.cc (add_input_library): New.
11728         (Plugin::load): Add add_input_library to tv.
11729         (Plugin_manager::add_input_file): Add the is_lib argument.
11730         (add_input_file): Update call to Plugin_manager::add_input_file.
11731         (add_input_library): New.
11732         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
11733
11734 2009-09-30  Doug Kwan  <dougkwan@google.com>
11735
11736         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
11737         symbol and call Symbol::may_need_copy_reloc to determine if
11738         a copy reloc is needed.
11739         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
11740         nocopyreloc is given in command line.
11741         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
11742         given in command line.
11743         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
11744         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
11745         of the removed Target_i386::may_need_copy_reloc.
11746         * options.h (copyreloc): New option with default value false.
11747         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
11748         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
11749         instead of the removed Target_powerpc::may_need_copy_reloc.
11750         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
11751         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
11752         instead of the removed Target_sparc::may_need_copy_reloc.
11753         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
11754         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
11755         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
11756         instead of the removed Target_x86_64::may_need_copy_reloc.
11757
11758 2009-09-30  Ian Lance Taylor  <iant@google.com>
11759
11760         * object.h (class Object): Remove target_ field, and target,
11761         sized_target, and set_target methods.
11762         (Object::sized_target): Remove.
11763         (class Sized_relobj): Update declarations.  Remove sized_target.
11764         * object.cc (Sized_relobj::setup): Remove target parameter.
11765         Change all callers.
11766         (Input_objects::add_object): Don't do anything with the target.
11767         (make_elf_sized_object): Add punconfigured parameter.  Change all
11768         callers.  Set or test parameter target.
11769         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
11770         Change all callers.
11771         * parameters.cc (Parameters::set_target): Change parameter type to
11772         be non-const.
11773         (Parameters::default_target): Remove.
11774         (set_parameters_target): Change parameter type to be non-const.
11775         (parameters_force_valid_target): New function.
11776         (parameters_clear_target): New function.
11777         * parameters.h (class Parameters): Update declarations.  Remove
11778         default_target method.  Add sized_target and clear_target
11779         methods.  Change target_ to be non-const.
11780         (set_parameters_target): Update declaration.
11781         (parameters_force_valid_target): Declare.
11782         (parameters_clear_target): Declare.
11783         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
11784         as NULL if we aren't searching.
11785         (Add_symbols::run): Don't check for compatible target.
11786         * fileread.cc (Input_file::open_binary): Call
11787         parameters_force_valid_target.
11788         * gold.cc (queue_middle_tasks): Likewise.
11789         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
11790         set_target on object.
11791         * dynobj.h (class Sized_dynobj): Update declarations.
11792         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
11793         make_elf_object returns NULL.
11794         (Archive::include_member): Don't check whether object target is
11795         compatible.
11796         * output.cc (Output_section::add_input_section): Get target from
11797         parameters.
11798         (Output_section::relax_input_section): Likewise.
11799         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
11800         parameters.
11801         (Sized_relobj::do_scan_relocs): Likewise.
11802         (Sized_relobj::relocate_sections): Likewise.
11803         * resolve.cc (Symbol_table::resolve): Likewise.
11804         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
11805         parameter.  Change all callers.
11806         (Symbol_table::add_from_object): Get target from parameters.
11807         (Symbol_table::add_from_relobj): Don't check object target.
11808         (Symbol_table::add_from_dynobj): Likewise.
11809         (Symbol_table::define_special_symbol): Get target from
11810         parameters.
11811         * symtab.h (class Symbol_table): Update declaration.
11812         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
11813         parameter.  Change all callers.  Clear parameter target.
11814         (Binary_test): Test target here.
11815         * testsuite/object_unittest.cc (gold_testsuite): Remove
11816         target_test_pointer parameter.  Change all callers.
11817         (Object_test): Test target here.
11818
11819 2009-09-26  Ian Lance Taylor  <iant@google.com>
11820
11821         * testsuite/initpri1.c: Don't try to use constructor priorities if
11822         compiling with gcc before 4.3.
11823
11824 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
11825
11826         * testsuite/retain_symbols_file_test.sh (check_present): Change
11827         output file name to retain_symbols_file_test.stdout.
11828         (check_absent): Likewise.
11829
11830 2009-09-18  Craig Silverstein  <csilvers@google.com>
11831
11832         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
11833         * options.cc: Include <cerrno> and <fstream>.
11834         (General_options::finalize): Parse -retain-symbols-file tag.
11835         * options.h: New flag.
11836         (General_options): New method should_retain_symbol, new
11837         variable symbols_to_retain.
11838         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
11839         should_retain_symbol map.
11840         * testsuite/Makefile.am (retain_symbols_file_test): New test.
11841         * testsuite/Makefile.in: Regenerate.
11842         * testsuite/retain_symbols_file_test.sh: New file.
11843
11844 2009-09-18  Nick Clifton  <nickc@redhat.com>
11845
11846         * po/es.po: Updated Spanish translation.
11847
11848 2009-09-17  Doug Kwan  <dougkwan@google.com>
11849
11850         * debug.h (DEBUG_RELAXATION): New constant.
11851         (DEBUG_ALL): Add DEBUG_RELAXATION.
11852         (debug_string_to_enum): Add relaxation debug option.
11853         * layout.cc
11854         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
11855         Layout::Relaxation_debug_check::read_sections,
11856         Layout::Relaxation_debug_check::read_sections): New method definitions.
11857         (Layout::Layout): Initialize data members
11858         record_output_section_data_from_scrips_,
11859         script_output_section_data_list_ and relaxation_debug_check_.
11860         (Layout::save_segments, Layout::restore_segments,
11861         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
11862         Layout::relaxation_loop_body): New method definitions.
11863         (Layout::finalize): Support relaxation.  Move section layout code to
11864         Layout::relaxation_loop_body.
11865         (Layout::set_asection_address_from_script): Move code for orphan
11866         section placement out.
11867         (Layout::place_orphan_sections_in_script): New method definition.
11868         * layout.h (Output_segment_headers, Output_file_header):
11869         New forward class declarations.
11870         (Layout::~Layout): Define.
11871         (Layout::new_output_section_data_from_script): New method definition.
11872         (Layout::place_orphan_sections_in_script): New method declaration.
11873         (Layout::Segment_states): New type declaration.
11874         (Layout::save_segments, Layout::restore_segments,
11875         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
11876         Layout::relaxation_loop_body): New method declarations.
11877         (Layout::Output_section_data_list): New type declaration.
11878         (Layout::Relaxation_debug_check): New class definition.
11879         (Layout::record_output_section_data_from_script_,
11880         Layout::script_output_section_data_list_, Layout::segment_states_,
11881         Layout::relaxation_debug_check_): New data members.
11882         * output.cc: (Output_section_headers::do_size): New method definition.
11883         (Output_section_headers::Output_section_headers): Move size
11884         computation to Output_section_headers::do_size.
11885         (Output_segment_headers::do_size): New method definition.
11886         (Output_file_header::Output_file_header): Move size computation to
11887         Output_file_header::do_size and call it.
11888         (Output_file_header::do_size): New method definition.
11889         (Output_data_group::Output_data_group): Adjust call to
11890         Output_section_data.
11891         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
11892         (Output_symtab_xindex::do_write): Add array bound check.
11893         (Output_section::Input_section::print_to_mapfile): Handle
11894         RELAXED_INPUT_SECTION_CODE.
11895         (Output_section::Output_section): Initialize data member checkpoint_.
11896         (Output_section::~Output_section): Delete checkpoint object pointed
11897         by checkpoint_.
11898         (Output_section::add_input_section): Always add an Input_section if
11899         relaxing.
11900         (Output_section::add_merge_input_section): Add assert.
11901         (Output_section::relax_input_section): New method definition.
11902         (Output_section::set_final_data_size): Set load address to zero for
11903         an unallocated section.
11904         (Output_section::do_address_and_file_offset_have_reset_values):
11905         New method definition.
11906         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
11907         Handle relaxed input section.
11908         (Output_section::sort_attached_input_sections): Checkpoint input
11909         section list lazily.
11910         (Output_section::get_input_sections): Change type of input_sections to
11911         list of Simple_input_section pointers.  Checkpoint input section list
11912         lazily.  Also handle relaxed input sections.
11913         (Output_section::add_input_section_for_script): Take a reference to
11914         a Simple_input_section object instead of Relobj pointer and section
11915         index as parameter.  Handle relaxed input sections.
11916         (Output_section::save_states, Output_section::restore_states): New
11917         method definitions.
11918         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
11919         (Output_data::is_data_size_fixed): New method definition.
11920         (Output_data::reset_addresss_and_file_offset): Do not reset data size
11921         if it is fixed.
11922         (Output_data::address_and_file_offset_have_reset_values): New method
11923         definition.
11924         (Output_data::do_address_and_file_offset_have_reset_values): New method
11925         definition.
11926         (Output_data::set_data_size): Check that data size is not fixed.
11927         (Output_data::fix_data_size): New method definition.
11928         (Output_data::is_data_size_fixed_): New data member.
11929         (Output_section_headers::set_final_data_size): New method definition.
11930         (Output_section_headers::do_size): New method declaration.
11931         (Output_segment_headers::set_final_data_size): New method definition.
11932         (Output_segment_headers::do_size): New method declaration.
11933         (Output_file_header::set_final_data_size)::New method definition.
11934         (Output_file_header::do_size)::New method declaration.
11935         (Output_section_data::Output_section_data): Add new parameter
11936         is_data_size_fixed and use it to fix data size.
11937         (Output_data_const::Output_data_const): Adjust call to base class
11938         constructor and fix data size.
11939         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
11940         base class constructor and fix data size.
11941         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
11942         base class constructor and fix data size.
11943         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
11944         class constructor and fix data size.
11945         (Output_data_group::set_final_data_size): New method definition.
11946         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
11947         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
11948         class constructor and fix data size.
11949         (Output_relaxed_input_section): New class definition.
11950         (Output_section::Simple_input_section): New class definition.
11951         (Output_section::get_input_sections): Adjust parameter list.
11952         (Output_section::add_input_section_for_script): Same.
11953         (Output_section::save_states, Output_section::restore_states,
11954         Output_section::do_address_and_file_offset_have_reset_values,
11955         (Output_section::Input_section::Input_section): Handle
11956         RELAXED_INPUT_SECTION_CODE.  Add new overload for
11957         Output_relaxed_input_section.
11958         (Output_section::Input_section::is_input_section,
11959         Output_section::Input_section::set_output_section): Handle relaxed
11960         input section.
11961         (Output_section::Input_section::is_relaxed_input_section,
11962         Output_section::Input_section::output_section_data,
11963         Output_section::Input_section::relaxed_input_section): New method
11964         definitions.
11965         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
11966         value.
11967         (Output_section::Input_section::u1_): Update comments.
11968         (Output_section::Input_section::u2_): Add new union member poris.
11969         (Output_section::Checkpoint_output_section): New classs definition.
11970         (Output_section::relax_input_section): New method declaration.
11971         (Output_section::checkpoint_): New data member.
11972         (Output_segment): Update comments.
11973         (Output_segment::Output_segment): Un-privatize copy constructor.
11974         (Output_segment::operator=): Un-privatize.
11975         * script-sections.cc (Output_section_element::Input_section_list):
11976         Change element type to Output_section::Simple_input_section.
11977         (Output_section_element_dot_assignment::set_section_addresses):
11978         Register output section data for relaxation clean up.
11979         (Output_data_exression::Output_data_expression): Adjust call to base
11980         constructor to fix data size.
11981         (Output_section_element_data::set_section_addresses): Register
11982         Output_data_expression object for relaxation clean up.
11983         (struct Input_section_info): Replace Relobj pointer and section index
11984         pair with Output_section::Simple_input_section and Convert struct to a
11985         class.
11986         (Input_section_sorter::operator()): Adjust access to
11987         Input_section_info data member to use accessors.
11988         (Output_section_element_input::set_section_addresses): Use layout
11989         parameter.  Adjust code to use Output_section::Simple_input_section
11990         and Input_secction_info classes.  Register filler for relaxation
11991         clean up.
11992         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
11993         and section index pair with Output_section::Simple_input_section
11994         class.  Adjust code accordingly.
11995         (Phdrs_element::release_segment): New method definition.
11996         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
11997         segment list.
11998         (Script_sections::release_segments): New method definition.
11999         * gold/script-sections.h (Script_sections::release_segments): New
12000         method declaration.
12001         * gold/target.h (Target::may_relax, Target::relax,
12002         Target::do_may_relax, Target::do_relax): New method definitions.
12003
12004 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
12005
12006         * arm.cc (has_signed_unsigned_overflow): New function.
12007         (Arm_relocate_functions::abs8): New function.
12008         (Target_arm::Scan::local): Handle R_ARM_ABS8.
12009         (Target_arm::Scan::global): Likewise.
12010         (Target_arm::relocate::relocate): Likewise.
12011         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
12012         Likewise.
12013
12014 2009-09-16  Cary Coutant  <ccoutant@google.com>
12015
12016         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
12017         * testsuite/Makefile.in: Regenerate.
12018
12019 2009-09-11  Nick Clifton  <nickc@redhat.com>
12020
12021         * po/gold.pot: Updated by the Translation project.
12022
12023 2009-09-08  Cary Coutant  <ccoutant@google.com>
12024
12025         * output.cc (Output_file::open): Add execute permission to empty file.
12026         * testsuite/Makefile.am (permission_test): New test.
12027         * testsuite/Makefile.in: Regenerate.
12028
12029 2009-09-02  Ian Lance Taylor  <iant@google.com>
12030
12031         * output.cc (Output_file::resize): Call map_no_anonymous rather
12032         than map.
12033
12034 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
12035
12036         * gold.cc: Include "incremental.h".
12037         (queue_initial_tasks): Call Incremental_checker methods.
12038         * incremental.cc: Include "output.h".
12039         (Incremental_checker::can_incrementally_link_output_file): New
12040         method.
12041         * incremental.h (Incremental_checker): New class.
12042
12043         * output.cc (Output_file::open_for_modification): New method.
12044         (Output_file::map_anonymous): Changed return type to bool.  Record
12045         map in base_ field.
12046         (Output_file::map_no_anonymous): New method, broken out of map.
12047         (Output_file::map): Use map_no_anonymous and map_anonymous.
12048         * output.h (class Output_file): Update declarations.
12049
12050 2009-08-24  Cary Coutant  <ccoutant@google.com>
12051
12052         * options.h (Command_line::Pre_options): New class.
12053         (Command_line::pre_options): New member.
12054         * options.cc (gold::options::ready_to_register): New variable.
12055         (One_option::register_option): Do nothing if not registering options.
12056         Assert if same short option registered twice.
12057         (General_options::General_options): Turn off option registration when
12058         done constructing.
12059         (Command_line::Pre_options::Pre_options): New constructor.
12060
12061 2009-08-24  Cary Coutant  <ccoutant@google.com>
12062
12063         * options.h (General_options::no_keep_memory): Remove incorrect
12064         short option.
12065
12066 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
12067
12068         * Makefile.am (am__skiplex, am__skipyacc): New.
12069         * Makefile.in: Regenerate.
12070
12071 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
12072
12073         * Makefile.am (AM_CPPFLAGS): Renamed from ...
12074         (INCLUDES): ... this.
12075         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
12076         (AM_CPPFLAGS): Renamed from ...
12077         (INCLUDE): ... this.
12078         * Makefile.in, testsuite/Makefile.in: Regenerate.
12079
12080         * Makefile.in: Regenerate.
12081         * aclocal.m4: Likewise.
12082         * config.in: Likewise.
12083         * configure: Likewise.
12084         * testsuite/Makefile.in: Likewise.
12085
12086         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
12087         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
12088         * Makefile.in: Regenerate.
12089         * testsuite/Makefile.in: Regenerate.
12090
12091 2009-08-19  Cary Coutant  <ccoutant@google.com>
12092
12093         * resolve.cc (Symbol_table::resolve): Don't complain about defined
12094         symbols in shared libraries overridden by hidden or internal symbols
12095         in the main program.
12096
12097 2009-08-19  Chris Demetriou  <cgd@google.com>
12098
12099         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
12100         checking source file names in error messages.
12101
12102 2009-08-18  Doug Kwan  <dougkwan@google.com>
12103
12104         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
12105         an elcpp::Ehdr as parameter.  Adjust call to set_target.
12106         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
12107         an elfcpp::Ehdr as parameter.
12108         * object.cc (Object::set_target): Remove the version that looks up
12109         a target and sets it.
12110         (Sized_relobj::setup): Take a Target object instead of
12111         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
12112         (make_elf_sized_object): Find target and ask target to
12113         make an ELF object.
12114         * object.h: (Object::set_target): Remove the version that looks up
12115         a target and sets it.
12116         (Sized_relobj::setup): Take a Target object instead of
12117         an elfcpp:Ehdr as parameter.
12118         * target.cc: Include dynobj.h.
12119         (Target::do_make_elf_object_implementation): New.
12120         (Target::do_make_elf_object): New.
12121         * target.h (Target::make_elf_object): New template declaration.
12122         (Target::do_make_elf_object): New method declarations.
12123         (Target::do_make_elf_object_implementation): New template declaration.
12124
12125 2009-08-14  Ian Lance Taylor  <iant@google.com>
12126
12127         * gold.h (FUNCTION_NAME): Define.
12128         (gold_unreachable): Use FUNCTION_NAME.
12129
12130 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
12131
12132         * icf.cc (Icf::find_identical_sections): Issue a warning when a
12133         symbol in the --keep-unique list is not found.
12134
12135 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
12136
12137         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
12138         been maked as --keep-unique.
12139         (Icf::unfold_section): New function.
12140         * icf.h (Icf::unfold_section): New function.
12141         * options.h (General_options::keep_unique): New option.
12142         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
12143         * testsuite/Makefile.in: Regenerate.
12144         * testsuite/icf_keep_unique_test.sh: New file.
12145         * testsuite/icf_keep_unique_test.cc: New file.
12146
12147 2009-08-12  Cary Coutant  <ccoutant@google.com>
12148
12149         PR 10471
12150         * resolve.cc (Symbol_table::resolve): Check for references from
12151         dynamic objects to hidden and internal symbols.
12152         * testsuite/Makefile.am (hidden_test.sh): New test.
12153         * testsuite/Makefile.in: Regenerate.
12154         * testsuite/hidden_test.sh: New script.
12155         * testsuite/hidden_test_1.c: New test source.
12156         * testsuite/hidden_test_main.c: New test source.
12157
12158 2009-08-11  Doug Kwan  <dougkwan@google.com>
12159
12160         * arm.cc: Update comments.
12161         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
12162         segment to locate the .ARM.exidx section if present.
12163
12164 2009-08-09  Doug Kwan  <dougkwan@google.com>
12165
12166         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
12167         patch.
12168
12169 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
12170         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
12171         compiler warnings.
12172
12173 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
12174
12175         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
12176         valid tls_segment only for non-debug-section relocations.
12177         * testsuite/Makefile.am: Add gc_tls_test.
12178         * testsuite/Makefile.in: Regenerate.
12179         * testsuite/gc_tls_test.cc: New file.
12180         * testsuite/gc_tls_test.sh: New file.
12181
12182 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
12183
12184         * icf.cc: New file.
12185         * icf.h: New file.
12186         * Makefile.am (CCFILES): Add icf.cc.
12187         (HFILES): Add icf.h
12188         * Makefile.in: Regenerate.
12189         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
12190         * gc.h (gc_process_relocs): Populate lists used by icf to contain
12191         section, symbol and addend information for the relocs.
12192         * gold.cc (queue_middle_tasks): Call identical code folding.
12193         * gold.h: Add defines for multimap.
12194         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
12195         to the call of finalize_local_symbols.
12196         * main.cc (main): Create object of class Icf.
12197         * object.cc (Sized_relobj::do_layout): Allow this function to be
12198         called twice during icf.
12199         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
12200         to sections marked as identical by icf.
12201         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
12202         when available.
12203         (Sized_relobj::do_section_entsize): New function.
12204         * object.h (Object::section_entsize): New function.
12205         (Object::do_section_entsize): New pure virtual function.
12206         (Relobj::finalize_local_symbols): Add new parameter.
12207         (Relobj::do_section_entsize): New function.
12208         * options.h (General_options::icf): New option.
12209         (General_options::icf_iterations): New option.
12210         (General_options::print_icf_sections): New option.
12211         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
12212         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
12213         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
12214         icf.
12215         * symtab.cc (Symbol_table::is_section_folded): New function.
12216         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
12217         to sections marked as identical by icf.
12218         * symtab.h (Symbol_table::set_icf): New function.
12219         (Symbol_table::icf): New function.
12220         (Symbol_table::is_section_folded): New function.
12221         (Symbol_table::icf_): New data member.
12222         * target-reloc.h (relocate_section): Ignore sections folded by icf.
12223         * testsuite/Makefile.am: Add commands to build icf_test.
12224         * testsuite/Makefile.in: Regenerate.
12225         * testsuite/icf_test.sh: New file.
12226         * testsuite/icf_test.cc: New file.
12227
12228 2009-07-24  Chris Demetriou  <cgd@google.com>
12229
12230         * layout.cc (is_compressible_debug_section): Fix incorrect
12231         comment about compressed section names.
12232
12233 2009-07-20  Ian Lance Taylor  <ian@airs.com>
12234
12235         PR 10419
12236         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
12237
12238 2009-07-16  Ian Lance Taylor  <iant@google.com>
12239
12240         PR 10400
12241         * layout.h: #include <map>.
12242         (class Kept_section): Change from struct to class.  Add accessors
12243         and setters.  Add section size to Comdat_group mapping.  Change
12244         Comdat_group to std::map.  Add is_comdat_ field.  Add
12245         linkonce_size field in union.
12246         (class Layout): Update declaration of find_or_add_kept_section.
12247         Don't declare find_kept_object.
12248         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
12249         parameter.  Add object, shndx, is_comdat, and is_group_name
12250         parameters.  Change all callers.  Adjust for new Kept_section.
12251         (Layout::find_kept_object): Remove.
12252         * object.cc (Sized_relobj::include_section_group): Update use of
12253         Kept_section.  Rename secnum to shndx.  Only record
12254         Kept_comdat_section if sections are the same size.
12255         (Sized_relobj::include_linkonce_section): Update use of
12256         Kept_section.  Only record Kept_comdat_section if sections are the
12257         same size.  Set size of linkonce section.
12258         (Sized_relobj::map_to_kept_section): Update call to
12259         get_kept_comdat_section.
12260         * object.h (class Sized_relobj): Rename fields in
12261         Kept_comdat_section to drop trailing underscores; change object
12262         field to Relobj*.  Change Kept_comdat_section_table to store
12263         struct rather than pointer.
12264         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
12265         Add kept_object and kept_shndx parameters.  Change all callers.
12266         (Sized_relobj::get_kept_comdat_section): Change return type to
12267         bool.  Add kept_object and kept_shndx parameters.  Change all
12268         callers.
12269         * plugin.cc (Pluginobj::include_comdat_group): Update call to
12270         Layout::find_or_add_kept_section.
12271
12272 2009-07-09  Ian Lance Taylor  <iant@google.com>
12273
12274         * merge.cc (Object_merge_map::initialize_input_to_output_map):
12275         Reserve space in the hash table.
12276
12277 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
12278
12279         * fileread.cc (File_read::get_mtime): New method.
12280         * fileread.h (Timespec): New structure.
12281         (File_read::get_mtime): New method.
12282         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
12283         Renamed from timestamp_nsec.
12284         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
12285         Elf_Xword.
12286         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
12287         timestamp_nsec.
12288         (Incremental_inputs::report_archive): Save mtime; style fix.
12289         (Incremental_inputs::report_obejct): Save mtime; style fix.
12290         (Incremental_inputs::report_script): Save mtime; style fix.
12291         (Incremental_inputs::finalize_inputs): Style fix.
12292         (Incremental_inputs::finalize): Style fix.
12293         (Incremental_inputs::create_input_section_data): Store inputs
12294         mtime.
12295         * incremental.h (Incremental_inputs::report_script): Add mtime
12296         argument.
12297         (Incremental_inputs::Input_info::Input_info): Intialize only one
12298         union member.
12299         (Incremental_inputs::Input_info::archive): Move to nameless
12300         union.
12301         (Incremental_inputs::Input_info::obejct): Move to nameless union.
12302         (Incremental_inputs::Input_info::script): Move to nameless union.
12303         (Incremental_inputs::mtime): New field.
12304         * script.cc (read_input_script): Pass file mtime to
12305         Incremental_input.
12306         * script.h (Script_info::inputs): Style fix.
12307
12308 2009-07-01  Ian Lance Taylor  <ian@airs.com>
12309
12310         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
12311         instead of 32.
12312
12313 2009-06-24  Ian Lance Taylor  <iant@google.com>
12314
12315         PR 10156
12316         * layout.cc (Layout::choose_output_section): If we find an
12317         existing section, update the flags.
12318         (Layout::create_notes): New function, broken out of
12319         Layout::finalize.
12320         (Layout::finalize): Don't create note sections.
12321         (Layout::create_note): Don't crash if linker script discards
12322         section.
12323         (Layout::create_gold_note): Likewise.
12324         (Layout::create_build_id): Likewise.  Don't set
12325         after_input_sections on the section.
12326         (Layout::create_executable_stack_info): Remove target parameter.
12327         Change caller.
12328         * layout.h (class Layout): Declare create_notes.  Update
12329         declaration of create_executable_stack_info.
12330         * gold.cc (queue_middle_tasks): Call create_notes.
12331         * output.cc (Output_section::update_flags_for_input_section): Move
12332         here from output.h.  If SHF_ALLOC flag is newly set, mark address
12333         invalid.
12334         * output.h (Output_data::mark_address_invalid): New function.
12335         (class Output_section): Only declare, not define,
12336         update_flags_for_input_section.  Remove set_flags.
12337
12338 2009-06-24  Ian Lance Taylor  <iant@google.com>
12339
12340         * script-sections.cc (Output_section_definition::
12341         set_section_addresses): Rename shadowing local load_address to
12342         laddr.
12343
12344 2009-06-24  Ian Lance Taylor  <iant@google.com>
12345
12346         PR 10244
12347         * reloc.cc (relocate_sections): Skip empty relocation sections.
12348
12349 2009-06-23  Ian Lance Taylor  <iant@google.com>
12350
12351         PR 10156
12352         * layout.cc (Layout::create_note): Use choose_output_section
12353         rather than make_output_section.
12354
12355 2009-06-23  Ian Lance Taylor  <iant@google.com>
12356
12357         PR 10237
12358         * options.cc (General_options::parse_V): Set printed_version_.
12359         (General_options::General_options): Initialize printed_version_.
12360         * options.h (class General_options): Add printed_version_ field.
12361         * gold.cc (queue_initial_tasks): If there are no input files,
12362         don't give a fatal error if we printed the version information.
12363         (queue_middle_tasks): If using -r with a shared object, give a
12364         fatal error rather than an ordinary error.
12365
12366 2009-06-23  Ian Lance Taylor  <iant@google.com>
12367
12368         PR 10219
12369         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
12370         (Layout::make_output_section): Set have_stabstr_section_ if we see
12371         a .stab*str section.
12372         (Layout::finalize): Call link_stabs_sections.
12373         (Layout::link_stabs_sections): New file.
12374         * layout.h (class Layout): Add have_stabstr_section_ field.
12375         Declare link_stabs_sections.
12376
12377 2009-06-23  Doug Kwan  <dougkwan@google.com>
12378
12379         * Makefile.am (libgold_a_LIBADD): New.
12380         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
12381         * Makefile.in: Regenerate.
12382         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
12383         * configure: Regenerate.
12384         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
12385         * fileread.cc: Include sys/state.h
12386         * gold.h: Declare memmem and strndup if found missing.
12387         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
12388
12389 2009-06-23  Ian Lance Taylor  <iant@google.com>
12390
12391         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
12392         * configure: Rebuild.
12393
12394 2009-06-23  Ian Lance Taylor  <iant@google.com>
12395
12396         PR 10147
12397         * object.cc (Object::section_contents): Don't try to get a view if
12398         the section has length zero.
12399         (Object::handle_gnu_warning_section): If the section is empty, use
12400         the name of the section as the warning.
12401
12402 2009-06-23  Ian Lance Taylor  <iant@google.com>
12403
12404         PR 10133
12405         * stringpool.h (class Stringpool_template): Add optimize_ field.
12406         (Stringpool_template::set_optimize): New function.
12407         * stringpool.cc (Stringpool_template::Stringpool_template):
12408         Initialize optimize_ field.
12409         (Stringpool_template::set_string_offsets): Test local optimize
12410         fild rather than parameter.
12411         * layout.cc (Layout::Layout): Call set_optimize on the section
12412         name stringpool.
12413
12414 2009-06-22  Ian Lance Taylor  <iant@google.com>
12415
12416         PR 10030
12417         * yyscript.y: Parse TARGET.
12418         * script.cc (script_set_target): New function.
12419         * script-c.h (script_set_target): Declare.
12420         * options.cc (General_options::string_to_object_format): Rename
12421         from string_to_object_format in anonymous namespace.  Change
12422         callers.
12423         * options.h (class General_options): Declare
12424         string_to_object_format.
12425
12426 2009-06-22  Ian Lance Taylor  <iant@google.com>
12427
12428         * script-sections.cc (Script_sections::create_segments): Don't put
12429         program headers in a PT_LOAD segment if -n or -N.
12430
12431 2009-06-22  Ian Lance Taylor  <iant@google.com>
12432
12433         PR 10141
12434         * options.h (class General_options): Add -z lazy and -z now.  Sort
12435         -z options into alphabetical order.
12436         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
12437
12438 2009-06-21  Ian Lance Taylor  <iant@google.com>
12439
12440         * layout.cc (Layout::make_output_section): Call
12441         Target::new_output_section.
12442         (Layout::attach_allocated_section_to_segment): Put large section
12443         sections in a separate load segment with the large segment flag
12444         set.
12445         (Layout::segment_precedes): Sort large data segments after other
12446         load segments.
12447         (align_file_offset): New static function.
12448         (Layout::set_segment_offsets): Use align_file_offset.
12449         * output.h (class Output_section): Add is_small_section_ and
12450         is_large_section_ fields.
12451         (Output_section::is_small_section): New function.
12452         (Output_section::set_is_small_section):  New function.
12453         (Output_section::is_large_section): New function.
12454         (Output_section::set_is_large_section): New function.
12455         (Output_section::is_large_data_section): New function.
12456         (class Output_segment): Add is_large_data_segment_ field.
12457         (Output_segment::is_large_data_segment): New function.
12458         (Output_segment::set_is_large_data_segment): New function.
12459         * output.cc (Output_section::Output_section): Initialize new
12460         fields.
12461         (Output_segment::Output_segment): Likewise.
12462         (Output_segment::add_output_section): Add assertion that large
12463         data sections always go in large data segments.  Force small data
12464         sections to the end of the list of data sections.  Force small BSS
12465         sections to the start of the list of BSS sections.  For large BSS
12466         sections to the end of the list of BSS sections.
12467         * symtab.h (class Symbol): Declare is_common_shndx.
12468         (Symbol::is_defined): Check Symbol::is_common_shndx.
12469         (Symbol::is_common): Likewise.
12470         (class Symbol_table): Define enum Commons_section_type.  Update
12471         declarations.  Add small_commons_ and large_commons_ fields.
12472         * symtab.cc (Symbol::is_common_shndx): New function.
12473         (Symbol_table::Symbol_table): Initialize new fields.
12474         (Symbol_table::add_from_object): Put small and large common
12475         symbols in the right list.
12476         (Symbol_table::sized_finalized_symbol): Check
12477         Symbol::is_common_shndx.
12478         (Symbol_table::sized_write_globals): Likewise.
12479         * common.cc (Symbol_table::do_allocate_commons): Allocate new
12480         common symbol lists.  Don't call do_allocate_commons_list if the
12481         list is empty.
12482         (Symbol_table::do_allocate_commons_list): Remove is_tls
12483         parameter.  Add comons_section_type parameter.  Change all
12484         callers.  Handle small and large common symbols.
12485         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
12486         Symbol::is_common_shndx.
12487         * resolve.cc (symbol_to_bits): Likewise.
12488         * target.h (Target::small_common_shndx): New function.
12489         (Target::small_common_section_flags): New function.
12490         (Target::large_common_shndx): New function.
12491         (Target::large_common_section_flags): New function.
12492         (Target::new_output_section): New function.
12493         (Target::Target_info): Add small_common_shndx, large_common_shndx,
12494         small_common_section_flags, and large_common_section_flags
12495         fields.
12496         (Target::do_new_output_section): New virtual function.
12497         * arm.cc (Target_arm::arm_info): Initialize new fields.
12498         * i386.cc (Target_i386::i386_info): Likewise.
12499         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
12500         Likewise.
12501         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
12502         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
12503         (Target_x86_64::do_new_output_section): New function.
12504         * configure.ac: Define conditional MCMODEL_MEDIUM.
12505         * testsuite/Makefile.am (check_PROGRAMS): Add large.
12506         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
12507         (large_LDFLAGS): Define.
12508         * testsuite/large.c: New file.
12509         * testsuite/testfile.cc (Target_test::test_target_info):
12510         Initialize new fields.
12511         * configure, testsuite/Makefile.in: Rebuild.
12512
12513 2009-06-05  Doug Kwan  <dougkwan@google.com>
12514
12515         * Makefile.am (CCFILES): Add target.cc.
12516         * Makefile.in: Regenerate.
12517         * i386.cc (class Target_i386): Define new virtual method to
12518         override do_is_local_label_name in parent.
12519         * object.cc (Sized_relobj::do_count_local_symbols): Discard
12520         local symbols if --discard-locals or -X is given.
12521         * options.h (class General_options): Declare new options
12522         '--discard-locals' and '-X' for discarding locals.
12523         * target.h (class Target): Define new methods is_local_label_name.
12524         Declare new virtual method do_is_local_label_name.
12525         * target.cc: New file.
12526         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
12527         (check_SCRIPTS): Add discard_locals_test.sh.
12528         (check_DATA): Add discard_local_tests.syms.
12529         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
12530         (discard_local_tests.syms, discard_locals_test.o): New make rules.
12531         * testsuite/Makefile.in: Regenerate.
12532         * testsuite/discard_locals_test.c: New file.
12533         * testsuite/discard_locals_test.sh: Same.
12534
12535 2009-06-05  Doug Kwan  <dougkwan@google.com>
12536
12537         * object.cc (Sized_relobj::Sized_relobj): Initialize
12538         discarded_eh_frame_shndx_ to -1U.
12539         (Sized_relobj::do_layout): Record index of a discard .eh_frame
12540         section.
12541         (Sized_relobj::do_count_local_symbols): Skip local symbols in
12542         a discarded .eh_frame section.
12543         (Sized_relobj::do_finalize_local_symbols): Ditto.
12544         * object.h (class Sized_relobj): Declare new member
12545         discarded_eh_frame_shndx_.
12546         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
12547         (local_labels_test.o, local_labels_test): New rules.
12548         * testsuite/Makefile.in: Regenerate.
12549
12550 2009-06-04  Doug Kwan  <dougkwan@google.com>
12551
12552         * layout.cc (Layout::section_name_mapping): Add mapping for
12553         special ARM sections.
12554
12555 2009-06-03  Doug Kwan  <dougkwan@google.com>
12556
12557         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
12558         (utils::has_overflow): Same.
12559
12560 2009-06-03  Ian Lance Taylor  <iant@google.com>
12561
12562         * layout.cc (Layout::section_name_mapping): New array, replacing
12563         Layout::linkonce_mapping.
12564         (Layout::section_name_mapping_count): New variable, replacing
12565         Layout::linkonce_mapping_count.
12566         (Layout::linkonce_output_name): Remove.
12567         (Layout::output_section_name): Rewrite.
12568         * layout.h (class Layout): Rename Linkonce_mapping to
12569         Section_name_mapping, linkonce_mapping to section_name_mapping,
12570         linkonce_mapping_count to section_name_mapping_count.  Don't
12571         declare linkonce_output_name.
12572
12573 2009-06-03  Doug Kwan  <dougkwan@google.com>
12574
12575         * gold/arm.cc (namespace utils): New.
12576         (Target_arm::reloc_is_non_pic): Define new method.
12577         (class Arm_relocate_functions): New.
12578         (Target_arm::Relocate::relocate): Handle relocation types used by
12579         Android.
12580
12581 2009-06-03  Ian Lance Taylor  <iant@google.com>
12582
12583         * arm.cc (Target_arm::scan::global): Use || instead of |.
12584
12585 2009-06-02  Doug Kwan  <dougkwan@google.com>
12586
12587         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
12588         issued_non_pic_error_.
12589         (class Target_arm::Scan): Declare new method check_non_pic.
12590         Define new method symbol_needs_plt_entry.
12591         Declare new data member issued_non_pic_error_.
12592         (class Target_arm::Relocate): Declare new method
12593         should_apply_static_reloc.
12594         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
12595         (Target_arm::Scan::check_non_pic): Define new method.
12596         (Target_arm::Scan::local): Handle a small subset of reloc types used
12597         by Android.
12598         (Target_arm::Scan::local): Same.
12599         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
12600
12601 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
12602
12603         * incremental.cc (Incremental_inputs::report_command_line): Filter
12604         out --incremental-* options.
12605
12606 2009-05-29  Doug Kwan  <dougkwan@google.com>
12607
12608         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
12609         template class.
12610         (class Target_arm): Update comment.
12611         (Target_arm::Target_arm): Initialize new data members GOT_,
12612         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
12613         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
12614         and Target_arm::rel_dyn_section.
12615         Declare new_enum Target_arm::Got_type.
12616         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
12617         and DYNBSS_.
12618         Update commments for member do_dynsym_value.
12619         (Target_arm::got_size, Target_arm::plt_section,
12620         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
12621         new methods inside class defintion.
12622         (Target_arm::got_section): Define new method.
12623         (Target_arm::rel_dyn_section): Same.
12624         (Output_data_plt_arm): New template class.
12625         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
12626         (Output_data_plt_arm:do_adjust_output_section): Define new method.
12627         (Output_data_plt_arm::add_entry): Same.
12628         (Output_data_plt_arm::first_plt_entry): Define new
12629         static data member for PLT instruction template.
12630         (Output_data_plt_arm::plt_entry): Same.
12631         (Output_data_plt_arm::do_write): Define new method.
12632         (Target_arm::make_plt_entry): Same.
12633         (Target_arm::do_finalize_sections): Same.
12634         (Target_arm::do_dynsym_value): Same.
12635
12636 2009-05-28  Doug Kwan  <dougkwan@google.com>
12637
12638         * Makefile.am (TARGETSOURCES): Add arm.cc.
12639         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
12640         * Makefile.in: Regenerate.
12641         * arm.cc: New file.
12642         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
12643
12644 2009-05-26  Doug Kwan  <dougkwan@google.com>
12645
12646         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
12647         (General_options::check_excluded_libs): Strip off directories in
12648         archive name before matching like GNU ld does.
12649         * testsuite/Makefile.am (MOSTLYCLEANFILES,
12650         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
12651         (exclude_libs_test_LDFLAGS): Add linker option
12652         -Wl,--exclude-libs,libexclude_libs_test_3
12653         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
12654         an explicit archive without using -l.
12655         (alt/libexclude_libs_test_3.a): New make rule.
12656         * testsuite/Makefile.in: Regenerate.
12657         * testsuite/exclude_libs_test.c : Declare lib3_default().
12658         (main): Call it.
12659         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
12660         * exclude_libs_test_3.c: New file.
12661
12662 2009-05-26  Nick Clifton  <nickc@redhat.com>
12663
12664         * po/id.po: New Indonesian translation.
12665         * po/gold.pot: Updated template file.
12666
12667 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
12668
12669         * testsuite/Makefile.am: Add -ffunction-sections to compile
12670         gc_comdat_test files.  Add -Wl,--gc-sections to build
12671         gc_comdat_test.
12672         * testsuite/Makefile.in: Regenerate.
12673         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
12674
12675 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
12676
12677         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
12678         kept comdat section was garbage collected.
12679         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
12680         * testsuite/Makefile.in: Regenerate.
12681         * testsuite/gc_comdat_test.sh: New file.
12682         * testsuite/gc_comdat_test_1.cc: New file.
12683         * testsuite/gc_comdat_test_2.cc: New file.
12684
12685 2009-05-19  Doug Kwan  <dougkwan@google.com>
12686
12687         * archive.cc (Archive::Archive): Move constructor from archive.h
12688         to here.  Initialize no_export_.
12689         (Archive::get_elf_object_for_member): Set no_export flag of object.
12690         * archive.h (Archive::Archive): Move constructor body to
12691         archive.cc.
12692         (Archive::no_export): New method.
12693         (Archive::no_export_): New field.
12694         * object.h (Object::Object): Initialize no_export_ to false.
12695         (Object::no_export, Object::set_no_export): New methods.
12696         (Object::no_export_): New field.
12697         * options.cc (General_options::parse_exclude_libs): New method.
12698         (General_options::check_excluded_libs) Same.
12699         * options.h (exclude_libs): New option.
12700         (General_options::check_excluded_libs): New method declaration.
12701         (General_options::excluded_libs_): New field.
12702         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
12703         default or protected visibility if an object has no-export flag set.
12704         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
12705         (check_SCRIPTS): Add exclude_libs_test.sh.
12706         (check_DATA): Add exclude_libs_test.syms.
12707         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
12708         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
12709         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
12710         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
12711         (exclude_libs_test.syms, libexclude_libs_test_1.a,
12712         libexclude_libs_test_2.a): New rules.
12713         * testsuite/Makefile.in: Regenerate.
12714         * testsuite/exclude_libs_test.c: New file.
12715         * testsuite/exclude_libs_test.sh: Ditto.
12716         * testsuite/exclude_libs_test_1.c: Ditto.
12717         * testsuite/exclude_libs_test_2.c: Ditto.
12718
12719 2009-05-15  Ian Lance Taylor  <iant@google.com>
12720
12721         * configure.ac: Check for declarations for cases where libiberty.h
12722         checks HAVE_DECL_xxx.
12723         * configure, config.in: Rebuild.
12724
12725 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
12726
12727         * gold.h (Incremental_argument_list): Remove (invalid) forward
12728         declaration.
12729         * incremental.cc (Incremental_inputs::report_achive): New method.
12730         (Incremental_inputs::report_object): New method.
12731         (Incremental_inputs::report_script): New method.
12732         (Incremental_inputs::finalize_inputs): New method.
12733         (Incremental_inputs::finalize): Call finalize_inputs().
12734         (Incremental_inputs::sized_create_incremental_inputs_section_data):
12735         Create inputs entries.
12736         * incremental.h (Incremental_input_type): New enum.
12737         (Incremental_inputs::Incremental_input): Initialize new fields.
12738         (Incremental_inputs::report_inputs): New method.
12739         (Incremental_inputs::report_achive): New method.
12740         (Incremental_inputs::report_object): New method.
12741         (Incremental_inputs::report_script): New method.
12742         (Incremental_inputs::finalize_inputs): New method.
12743         (Incremental_inputs::Input_info): New struct.
12744         (Incremental_inputs::Input_info_map): New typedef.
12745         (Incremental_inputs::lock_): New field.
12746         (Incremental_inputs::Inputs_): New field.
12747         (Incremental_inputs::Inputs_map): New field.
12748         * main.cc (main): Call Incremental_input::report_inputs.
12749         * options.h (Input_argument_list): Typedef moved from
12750         Input_arguments.
12751         (Input_file_group::Files): Remove, use ::Input_argument_list.
12752         (Input_file_group::Input_argument_list): Remove, use
12753         ::Input_argument_list.
12754         * plugin.cc (Plugin_manager::add_input_file): Add error in
12755         incremental build.
12756         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
12757         functions.
12758         * script.cc (read_input_script): Call
12759         Incremental_input::report_script.
12760         * script.h (Script_info): New class.
12761
12762 2009-04-27  Ian Lance Taylor  <iant@google.com>
12763
12764         * x86_64.cc (do_adjust_output_section): Set entsize to
12765         plt_entry_size.
12766
12767 2009-04-23  Elliott Hughes  <enh@google.com>
12768
12769         * output.cc (Output_file::close): After short writes, continue
12770         writing from the correct offset in the buffer being written.
12771
12772 2009-04-23  Chris Demetriou  <cgd@google.com>
12773
12774         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
12775         * configure: Regenerate.
12776         * config.in: Regenerate.
12777         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
12778         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
12779
12780 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
12781
12782         * incremental.cc (Incremental_inputs_header_data): Renamed from
12783         Incremental_input_header_data.
12784         (Incremental_inputs_header_data::data_size): New field.
12785         (Incremental_inputs_header_data::put_input_file_count): Renamed
12786         from input_file_count.
12787         (Incremental_inputs_header_data::put_command_line_offset): Renamed
12788         from command_line_offset.
12789         (Incremental_inputs_header_data::put_reserved): Renamed from
12790         put_reserved.
12791         (Incremental_inputs_entry_data): Renamed from
12792         Incremental_input_entry_data.
12793         (Incremental_inputs_entry_data::data_size): New field.
12794         (Incremental_inputs::report_command_line): New method.
12795         (Incremental_inputs::finalize): New method.
12796         (Incremental_inputs::create_incremental_inputs_data): New method.
12797         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
12798         * incremental.h: New file.
12799         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
12800         (Layout::finalize): Create incremental inputs section in
12801         incremental builds.
12802         (Layout::create_incremental_info_sections): New method.
12803         * layout.h (Layout::incremental_inputs): New method.
12804         (Layout::create_incremental_info_sections): New method.
12805         (Layout::incremental_inputs_): New field.
12806         * main.cc (main): Notify Incremental_input of the command line.
12807
12808 2009-04-01  Ian Lance Taylor  <iant@google.com>
12809             Mikolaj Zalewski  <mikolajz@google.com>
12810
12811         * gold.h (reserve_unordered_map): Define, three versions, one for
12812         each version of Unordered_map.
12813         * layout.cc (Layout::Layout): Remove options parameter.  Add
12814         number_of_input_files parameter.  Don't initialize options_.
12815         Initialize number_of_input_files_ and resized_signatures_.  Move
12816         sections_are_attached_.
12817         (Layout::layout_group): Reserve space for group_signatures_.
12818         (Layout::find_or_add_kept_section): Change name parameter to be a
12819         reference.  Resize signatures_ map when it gets large enough.
12820         (Layout::layout_eh_frame): Use parameters->options() instead of
12821         this->options_.
12822         (Layout::make_output_section): Likewise.
12823         (Layout::attach_allocated_section_to_segment): Likewise.
12824         (Layout::finalize, Layout::create_executable_stack): Likewise.
12825         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
12826         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
12827         * layout.h (class Layout): Update declarations.  Remove options_
12828         field.  Add number_of_input_files_ and resized_signatures_
12829         fields.  Move sections_are_attached_ field.
12830         * main.cc (main): Pass number of input files to Layout
12831         constructor.  Don't pass options.
12832
12833 2009-03-30  Ian Lance Taylor  <iant@google.com>
12834
12835         * ffsll.c (ffsll): Correct implementation.
12836
12837 2009-03-27  Ian Lance Taylor  <iant@google.com>
12838
12839         * ffsll.c: New file.
12840         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
12841         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
12842         * ftruncate.c (ftruncate): Declare before definition.
12843         * mremap.c (mremap): Likewise.
12844         * pread.c (pread): Likewise.
12845         * configure, Makefile.in, config.in: Rebuild.
12846
12847         * mremap.c: New file.
12848         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
12849         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
12850         (mremap): Declare if HAVE_MREMAP is not defined.
12851         * configure, Makefile.in, config.in: Rebuild.
12852
12853 2009-03-27  Cary Coutant  <ccoutant@google.com>
12854
12855         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
12856         position independent.
12857         * sparc.cc (Target_sparc::check_non_pic): Likewise.
12858         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
12859
12860 2009-03-24  Cary Coutant  <ccoutant@google.com>
12861
12862         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
12863         an executable.
12864         (needs_dynamic_reloc): Likewise.
12865
12866 2009-03-24  Ian Lance Taylor  <iant@google.com>
12867
12868         * yyscript.y (file_cmd): Recognize EXTERN.
12869         (extern_name_list, extern_name_list_body): New nonterminals.
12870         * script.cc (script_add_extern): Define.
12871         * script-c.h (script_add_extern): Declare.
12872
12873 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
12874
12875         * object.cc (is_elf_object): Define.
12876         * object.h (is_elf_object): Declare.
12877         * archive.cc (Archive::get_elf_object_for_member): Call
12878         is_elf_object.
12879         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
12880
12881 2009-03-24  Elliott Hughes  <enh@google.com>
12882
12883         * output.cc (Output_file::map_anonymous): Define.
12884         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
12885         try an anonymous one.  Report the size if the mmap fails.
12886         * output.h (class Output_file): Declare map_anonymous.
12887
12888 2009-03-24  Ian Lance Taylor  <iant@google.com>
12889
12890         * target-select.cc (instantiate_target): Don't acquire the lock if
12891         the instantiated_target_ field has already been set.
12892
12893 2009-03-23  Ian Lance Taylor  <iant@google.com>
12894
12895         * gold-threads.h (class Initialize_lock): Define.
12896         * gold-threads.cc (class Initialize_lock_once): Define.
12897         (initialize_lock_control): New static variable.
12898         (initialize_lock_pointer): New static variable.
12899         (initialize_lock_once): New static function.
12900         (Initialize_lock::Initialize_lock): Define.
12901         (Initialize_lock::initialize): Define.
12902         * target-select.h: Include "gold-threads.h".
12903         (class Target_selector): Add lock_ and initialize_lock_ fields.
12904         Don't define instantiate_target, just declare it.
12905         * target-select.cc (Target_selector::Target_selector): Initialize
12906         new fields.
12907         (Target_selector::instantiate_target): Define.
12908         * descriptors.h: Include "gold-threads.h".
12909         (class Descriptors): Add initialize_lock_ field.
12910         * descriptors.cc (Descriptors::Descriptors): Initialize new
12911         field.
12912         (Descriptors::open): Use initialize_lock_ field
12913         * errors.h (class Errors): Add initialize_lock_ field.
12914         * errors.cc (Errors::Errors): Initialize new field.
12915         (Errors::initialize_lock): Use initialize_lock_ field.
12916         * powerpc.cc (class Target_selector_powerpc): Remove
12917         instantiated_target_ field.  In do_recognize call
12918         instantiate_target rather than do_instantiate_target.  In
12919         do_instantiate_target just allocate a new target.
12920         * sparc.cc (class Target_selector_sparc): Likewise.
12921
12922         * freebsd.h: New file.
12923         * i386.cc: Include "freebsd.h".
12924         (Target_i386): Derive from Target_freebsd rather than
12925         Sized_target.
12926         (Target_selector_i386): Derive from Target_selector_freebsd rather
12927         than Target_selector.
12928         * x86_64.cc: Include "freebsd.h".
12929         (Target_x86_64): Derive from Target_freebsd rather than
12930         Sized_target.
12931         (Target_selector_x86_64): Derive from Target_selector_freebsd
12932         rather than Target_selector.
12933         * target.h (class Target): Add adjust_elf_header and
12934         do_adjust_elf_header.
12935         * output.cc (Output_file_header:: do_sized_write): Call target
12936         adjust_elf_header routine.
12937         * configure.tgt: Set targ_osabi.
12938         * configure.ac: Define GOLD_DEFAULT_OSABI.
12939         * parameters.cc (Parameters::default_target): Pass
12940         GOLD_DEFAULT_OSABI to select_target.
12941         * target-select.h (class Target_selector): Make instantiate_target
12942         protected rather than private.
12943         * Makefile.am (HFILES): Add freebsd.h.
12944         * configure, Makefile.in, config.in: Rebuild.
12945
12946         * merge.cc (do_add_input_section): Correct pend value.  Change
12947         message about last entry not being null terminated from error to
12948         warning.
12949
12950 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
12951
12952         * incremental.cc: New file.
12953         * Makefile.am (CCFILES): Add incremental.cc.
12954         * Makefile.in: Rebuild.
12955
12956 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
12957
12958         * layout.cc (Layout::output_section_name): Preserve names
12959         of '.note.' sections.
12960
12961 2009-03-19  Ian Lance Taylor  <iant@google.com>
12962
12963         * descriptors.cc (Descriptors::open): Check that the options are
12964         valid before using them.
12965
12966 2009-03-18  Ian Lance Taylor  <iant@google.com>
12967
12968         * script-sections.h: Include <list>.
12969         (class Script_sections): Change Sections_elements from std::vector
12970         to std::list.  Typedef public Elements_iterator.  Add
12971         orphan_section_placement_, data_segment_align_start_, and
12972         saw_data_segment_align_ fields.  Remove data_segment_align_index_
12973         field.
12974         * script-sections.cc (class Orphan_section_placement): New class.
12975         (class Sections_element): Add virtual functions is_relro and
12976         orphan_section_init.  Remove virtual function place_orphan_here.
12977         (class Output_section_definition): Add is_relro and
12978         orphan_section_init.  Remove place_orphan_here.
12979         (class Orphan_output_section): Likewise.
12980         (Script_sections::Script_sections): Update for field changes.
12981         (Script_sections::data_segment_align): Set saw_data_segment_align_
12982         and data_segment_align_start_, not data_segment_align_index.
12983         (Script_sections::data_segment_relro_end): Check
12984         saw_data_segment_align_.  Use data_segment_align_start_ rather
12985         than data_segment_align_index_.
12986         (Script_sections::place_orphan): Rewrite to use
12987         Orphan_section_placement.
12988
12989 2009-03-17  Ian Lance Taylor  <iant@google.com>
12990
12991         * archive.cc (Archive::add_symbols): Check for a version attached
12992         to the symbol name in the archive map.
12993         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
12994         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
12995         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
12996         (ver_test_11.a): New target.
12997         * testsuite/Makefile.in: Rebuild.
12998
12999         * configure.ac: Check for chsize and posix_fallocate.  Replace
13000         ftruncate.
13001         * ftruncate.c: New file, from gnulib.
13002         * output.cc (posix_fallocate): Define dummy version if not
13003         HAVE_POSIX_FALLOCATE.
13004         (Output_file::map): Call posix_fallocate rather than lseek and
13005         write.
13006         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
13007         * configure, Makefile.in, config.in: Rebuild.
13008
13009 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
13010
13011         * layout.h (Layout::create_note): Add section_name parameter.
13012         * layout.cc (Layout::create_note): Likewise.
13013         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
13014
13015 2009-03-17  Ian Lance Taylor  <iant@google.com>
13016
13017         * descriptors.cc: Include "options.h".
13018         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
13019         (Descriptors::open): Always use O_CLOEXEC when opening a new
13020         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
13021         then set FD_CLOEXEC.
13022
13023         * sparc.cc (class Target_sparc): Add has_got_section.
13024         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
13025         make sure we have a GOT section.
13026
13027         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
13028         (Target_sparc::Scan::local): Likewise.
13029         (Target_sparc::Scan::global): Likewise.
13030         (Target_sparc::Relocate::relocate): Likewise.
13031         (Target_sparc::Relocate::relocate_tls): Likewise.
13032
13033         * symtab.cc (Symbol_table::define_default_version): New function,
13034         broken out of add_from_object.
13035         (Symbol_table::add_from_object): Call define_default_version.
13036         (Symbol_table::define_special_symbol): Add resolve_oldsym
13037         parameter.  Change all callers.  If the version for a symbol comes
13038         from a version script, resolve it with the symbol with the same
13039         name with no version.  Also add the symbol without a version if
13040         appropriate.
13041         (do_define_in_output_data): If resolving with oldsym, don't delete
13042         sym.
13043         (do_define_in_output_segment): Likewise.
13044         (do_define_as_constant): Likewise.
13045         * symtab.h (class Symbol_table): Update declarations.
13046
13047 2009-03-13  Ian Lance Taylor  <iant@google.com>
13048
13049         * readsyms.cc (Read_symbols::incompatible_warning): New function.
13050         (Read_symbols::requeue): New function.
13051         (Read_symbols::do_read_symbols): If make_elf_object fails because
13052         the target type is not configured, and the file was searched for,
13053         issue a warning and retry with the next directory.
13054         (Add_symbols::run): If the file has an incompatible format, and
13055         it was searched for, requeue the Read_symbols task.  On error,
13056         release the object.
13057         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
13058         dirindex parameter to constructor.  Change all callers.  Declare
13059         incompatible_warning and requeue.
13060         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
13061         input_argument_ and input_group_ fields.  Add them to
13062         constructor.  Change all callers.
13063         (class Read_script): Add dirindex_ field.  Add it to constructor.
13064         Change all callers.
13065         * archive.cc (Archive::setup): Remove input_objects parameter.
13066         Change all callers.
13067         (Archive::get_file_and_offset): Likewise.
13068         (Archive::read_all_symbols): Likewise.
13069         (Archive::read_symbols): Likewise.
13070         (Archive::get_elf_object_for_member): Remove input_objects
13071         parameter.  Add punconfigured parameter.  Change all callers.
13072         (Archive::add_symbols): Change return type to bool.  Check return
13073         value of include_member.
13074         (Archive::include_all_members): Likewise.
13075         (Archive::include_member): Change return type to bool.  Return
13076         false if first included object has incompatible target.  Set
13077         included_member_ field.
13078         (Add_archive_symbols::run): If add_symbols returns false, requeue
13079         Read_symbols task.
13080         * archive.h (class Archive): Add included_member_ field.
13081         Initialize it in constructor.  Add input_file and searched_for
13082         methods.  Update declarations.
13083         (class Add_archive_symbols): Add dirpath_, dirindex_, and
13084         input_argument_ fields.  Add them to constructor.  Change all
13085         callers.
13086         * script.cc: Include "target-select.h".
13087         (class Parser_closure): Add skip_on_incompatible_target_ and
13088         found_incompatible_target_ fields.  Add
13089         skip_on_incompatible_target parameter to constructor.  Change all
13090         callers.  Add methods skip_on_incompatible_target,
13091         clear_skip_on_incompatible_target, found_incompatible_target, and
13092         set_found_incompatible_target.
13093         (read_input_script): Add dirindex parameter.  Change all callers.
13094         If parser finds an incompatible target, requeue Read_symbols
13095         task.
13096         (script_set_symbol): Clear skip_on_incompatible_target in
13097         closure.
13098         (script_add_assertion, script_parse_option): Likewise.
13099         (script_start_sections, script_add_phdr): Likewise.
13100         (script_check_output_format): New function.
13101         * script.h (read_input_script): Update declaration.
13102         * script-c.h (script_check_output_format): Declare.
13103         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
13104         (ignore_cmd): Remove OUTPUT_FORMAT.
13105         * fileread.cc (Input_file::Input_file): Add explicit this.
13106         (Input_file::will_search_for): New function.
13107         (Input_file::open): Add pindex parameter.  Change all callers.
13108         * fileread.h (class Input_file): Add input_file_argument method.
13109         Declare will_search_for.  Update declarations.
13110         * object.cc (make_elf_object): Add punconfigured parameter.
13111         Change all callers.
13112         * object.h (class Object): Make input_file public.  Add
13113         searched_for method.
13114         (make_elf_object): Update declaration.
13115         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
13116         restart search.
13117         * dirsearch.h (class Dirsearch): Update declaration.
13118         * options.h (class General_options): Add --warn-search-mismatch.
13119         * parameters.cc (Parameters::is_compatible_target): New function.
13120         * parameters.h (class Parameters): Declare is_compatible_target.
13121         * workqueue.cc (Workqueue::add_blocker): New function.
13122         * workqueue.h (class Workqueue): Declare add_blocker.
13123
13124         * fileread.cc (Input_file::open): Remove options parameter.
13125         Change all callers.
13126         (Input_file::open_binary): Likewise.
13127         * script.cc (read_input_script): Likewise.
13128         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
13129         options parameter from constructor.  Change all callers.
13130         (class Read_script): Likewise.
13131         * fileread.h (class Input_file): Update declarations.
13132         * script.h (read_input_script): Update declaration.
13133
13134 2009-03-10  Nick Clifton  <nickc@redhat.com>
13135
13136         * po/es.po: New Spanish translation.
13137
13138 2009-03-06  Cary Coutant  <ccoutant@google.com>
13139
13140         * options.cc (parse_short_option): Keep dash_z from registering itself.
13141
13142 2009-03-03  Ian Lance Taylor  <iant@google.com>
13143
13144         PR 9918
13145         * target-reloc.h (relocate_section): Pass output_section to
13146         relocate.
13147         * i386.cc (Target_i386::should_apply_static_reloc): Add
13148         output_section parameter.  Change all callers.
13149         (Target_i386::Relocate::relocate): Add output_section parameter.
13150         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
13151         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
13152         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
13153         * testsuite/two_file_shared.sh: New script.
13154         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
13155         (check_DATA): Add two_file_shared.dbg.
13156         (two_file_shared.dbg): New target.
13157         * testsuite/Makefile.in: Rebuild.
13158
13159 2009-03-01  Ian Lance Taylor  <iant@google.com>
13160
13161         * configure.ac: Check for byteswap.h.
13162         * configure: Rebuild.
13163         * config.in: Rebuild.
13164
13165 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
13166
13167         * layout.cc (Layout::find_or_add_kept_section): New function.
13168         (Layout::add_comdat): Removed.
13169         * layout.h (struct Kept_section): Move out of class Layout.
13170         Remove trailing underscores from field names.  Add group_sections
13171         field.  Rename group_ field to is_group.  Change all uses.
13172         (class Layout): Declare find_or_add_kept_section, not add_comdat.
13173         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
13174         comdat_groups_ field.
13175         (Sized_relobj::include_section_group): Use
13176         find_or_add_kept_section and Kept_section::group_sections.
13177         (Sized_relobj::include_linkonce_section): Likewise.
13178         * object.cc (class Sized_relobj): Don't define Comdat_group or
13179         Comdat_group_table.  Remove find_comdat_group and
13180         add_comdat_group.  Remove comdat_groups_ field.
13181         * plugin.cc (include_comdat_group): Use
13182         Layout::find_or_add_kept_section.
13183
13184 2009-02-28  Ian Lance Taylor  <iant@google.com>
13185
13186         * README: --gc-sections and map files are now supported.  Document
13187         some build requirements.
13188
13189         PR 6992
13190         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
13191         relocatable link set the value of the section symbol to zero.
13192         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
13193         relocatable link don't include the section address in the local
13194         symbol value.
13195
13196 2009-02-27  Ian Lance Taylor  <iant@google.com>
13197
13198         PR 6811
13199         * options.h (class Search_directory): Add is_system_directory.
13200         (class General_options): Declare is_in_system_directory.
13201         * options.cc (get_relative_sysroot): Make static.
13202         (get_default_sysroot): Make static.
13203         (General_optoins::is_in_system_directory): New function.
13204         * fileread.cc (Input_file::is_in_system_directory): New function.
13205         * fileread.h (class Input_file): Declare is_in_system_directory.
13206         * object.h (class Object): Add is_in_system_directory.
13207         (class Input_objects): Remove system_library_directory_ field.
13208         * object.cc (Input_objects::add_object): Don't set
13209         system_library_directory_.
13210         (input_objects::found_in_system_library_directory): Remove.
13211         * symtab.cc (Symbol_table::write_globals): Remove input_objects
13212         parameter.  Change all callers.
13213         (Symbol_table::sized_write_globals): Likewise.
13214         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
13215         Call Object::is_in_system_directory.
13216         * symtab.h (class Symbol_table): Update declarations.
13217
13218         PR 5990
13219         * descriptors.h (Open_descriptor): Add is_on_stack field.
13220         * descriptors.cc (Descriptors::open): If the descriptor is on the
13221         top of the stack, remove it.  Initialize is_on_stack field.
13222         (Descriptors::release): Only add pod to stack if it is not on the
13223         stack already.
13224         (Descriptors::close_some_descriptor): Clear stack_next and
13225         is_on_stack fields.
13226
13227         PR 7091
13228         * output.cc (Output_section::find_starting_output_address): Rename
13229         from starting_output_address; add PADDR parameter; change return
13230         type.
13231         * output.h (class Output_section): Declare
13232         find_starting_output_address instead of starting_output_address.
13233         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
13234         section symbol for which we can't find a merge section.
13235
13236         PR 9836
13237         * symtab.cc (Symbol_table::add_from_object): If the visibility is
13238         hidden or internal, force the symbol to be local.
13239         * resolve.cc (Symbol::override_visibility): Define.
13240         (Symbol::override_base): Use override_visibility.
13241         (Symbol_table::resolve): Likewise.
13242         (Symbol::override_base_with_special): Likewise.
13243         (Symbol_table::override_with_special): If the visibility is hidden
13244         or internal, force the symbol to be local.
13245         * symtab.h (class Symbol): Add set_visibility and
13246         override_visibility.
13247         * testsuite/ver_test_1.sh: New file.
13248         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
13249         (check_DATA): Add ver_test_1.syms.
13250         (ver_test_1.syms): New target.
13251         * testsuite/Makefile.in: Rebuild.
13252
13253 2009-02-25  Cary Coutant  <ccoutant@google.com>
13254
13255         * layout.cc (Layout::choose_output_section): Don't rename sections
13256         when using a linker script that has a SECTIONS clause.
13257         * Makefile.in: Regenerate.
13258
13259         * testsuite/Makefile.am (script_test_5.sh): New test case.
13260         * testsuite/Makefile.in: Regenerate.
13261         * testsuite/script_test_5.cc: New file.
13262         * testsuite/script_test_5.sh: New file.
13263         * testsuite/script_test_5.t: New file.
13264
13265 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
13266
13267         * archive.cc (Archive::include_member): Update calls to add_symbols.
13268         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
13269         the Layout argument.
13270         * dynobj.h (do_add_symbols): Add the Layout argument.
13271         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
13272         Layout argument.
13273         * object.h (Object::add_symbols): Add the Layout argument.
13274         (Object::do_add_symbols): Add the Layout argument.
13275         (Sized_relobj::do_add_symbols): Add the Layout argument.
13276         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
13277         Unify the two versions.
13278         (Add_plugin_symbols): Remove.
13279         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
13280         (Sized_pluginobj::do_add_symbols): Unify the two versions.
13281         (Add_plugin_symbols): Remove.
13282         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
13283         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
13284         (Add_symbols::run): Make it work with Pulginobj.
13285
13286 2009-02-06  Ian Lance Taylor  <iant@google.com>
13287
13288         * object.cc (Sized_relobj::do_layout): Make info message start
13289         with lower case letter.
13290
13291 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
13292
13293         * binary.cc: Fix file comment.
13294
13295         * options.h (enum Incremental_disposition): Define.
13296         (class General_options): Add new options: --incremental,
13297         --incremental_changed, --incremental_unchanged,
13298         --incremental_unknown.  Add incremental_disposition_ and
13299         implicit_incremental_ fields.
13300         (General_options::incremental_disposition): New function.
13301         (class Position_dependent_options): Add incremental_disposition
13302         option.
13303         (Position_dependent_options::copy_from_options): Set incremental
13304         dispositions.
13305         * options.cc (General_options::parse_incremental_changed): New
13306         function.
13307         (General_options::parse_incremental_unchanged): New function.
13308         (General_options::parse_incremental_unknown): New function.
13309         (General_options::General_options): Initialize new fields
13310         incremental_disposition_ and implicit_incremental_.
13311         (General_options::finalize): Check for uasge of --incremental-*
13312         without --incremental.
13313
13314 2009-02-06  Chris Demetriou  <cgd@google.com>
13315
13316         * gold.h (gold_undefined_symbol): Change to take only a Symbol
13317         pointer and to report location as the file name associated with
13318         the symbol.
13319         (gold_undefined_symbol_at_location): New function to replace the
13320         old gold_undefined_symbol functionality.
13321         * target-reloc.h (relocate_section): Update to use
13322         gold_undefined_symbol_at_location.
13323         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
13324         Call gold_undefined_symbol function rather than gold_error.
13325         * errors.h (Errors::undefined_symbol): Take location as a
13326         string, rather than calculating it from a relocation.
13327         * errors.cc (Errors::fatal): Print "fatal error:" before the
13328         formatted message.
13329         (Errors::error, Errors::error_at_location): Print "error: "
13330         before the formatted message.
13331         (Errors::undefined_symbol): Take location as a string, rather
13332         than calculating it from a relocation.
13333         (gold_undefined_symbol_at_location): New function akin to
13334         old gold_undefined_symbol, calculates location from relocation.
13335         (gold_undefined_symbol): Change to take only a Symbol pointer
13336         and to report location as the file name associated with the symbol.
13337         * testsuite/debug_msg.sh: Update for changed error messages.
13338         * testsuite/undef_symbol.sh: Likewise.
13339
13340 2009-02-04  Duncan Sands  <baldrick@free.fr>
13341
13342         PR 9812
13343         * reduced_debug_output.h
13344         (Output_reduced_debug_abbrev_section::failed): Use format for
13345         gold_warning.
13346         (Output_reduced_debug_info_section::faild): Likewise.
13347
13348 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
13349
13350         * script.cc (Lazy_demangler): New class.
13351         (Version_script_info::get_symbol_version_helper): Demangle a
13352         symbol only once.
13353
13354 2009-01-29  Cary Coutant  <ccoutant@google.com>
13355
13356         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
13357         to __tls_get_addr.
13358         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
13359
13360 2009-01-28  Ian Lance Taylor  <iant@google.com>
13361
13362         * version.cc (version_string): Bump to 1.9.
13363
13364         * gold.h: Include <cstring> and <stdint.h>.
13365         * version.cc: Include <cstdio>.
13366         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
13367         warning.
13368         * reduced_debug_output.cc (insert_into_vector): Rename from
13369         Insert_into_vector; change all callers.  Use Swap_unaligned to
13370         avoid aliasing issue; remove union since it is unnecessary.
13371
13372 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
13373
13374         * Makefile.am (CCFILES): Add gc.cc.
13375         (HFILES): Add gc.h.
13376         * Makefile.in: Regenerate.
13377         * gold.cc (Gc_runner): New class.
13378         (queue_initial_tasks): Call garbage collection related tasks
13379         when corresponding options are invoked.
13380         (queue_middle_gc_tasks): New function.
13381         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
13382         processed early before laying out sections during garbage collection.
13383         * gold.h (queue_middle_gc_tasks): New function.
13384         (is_prefix_of): Move from "layout.cc".
13385         * i386.cc (Target_i386::gc_process_relocs): New function.
13386         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
13387         * main.cc (main): Create object of class "Garbage_collection".
13388         * object.cc (Relobj::copy_symbols_data): New function.
13389         (Relobj::is_section_name_included): New function.
13390         (Sized_relobj::do_layout): Allow this function to be called twice
13391         during garbage collection and defer layout of section during the
13392         first call.
13393         * object.h (Relobj::get_symbols_data): New function.
13394         (Relobj::is_section_name_included): New function.
13395         (Relobj::copy_symbols_data): New function.
13396         (Relobj::set_symbols_data): New function.
13397         (Relobj::get_relocs_data): New function.
13398         (Relobj::set_relocs_data): New function.
13399         (Relobj::is_output_section_offset_invalid): New pure virtual function.
13400         (Relobj::gc_process_relocs): New function.
13401         (Relobj::do_gc_process_relocs): New pure virtual function.
13402         (Relobj::sd_): New data member.
13403         (Sized_relobj::is_output_section_offset_invalid): New function.
13404         (Sized_relobj::do_gc_process_relocs): New function.
13405         * options.h (General_options::gc_sections): Modify to not be a no-op.
13406         (General_options::print_gc_sections): New option.
13407         * plugin.cc (Plugin_finish::run): Remove function call to
13408         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
13409         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
13410         * reloc.cc (Read_relocs::run): Add task to process relocs and
13411         determine unreferenced sections when doing garbage collection.
13412         (Gc_process_relocs): New class.
13413         (Sized_relobj::do_gc_process_relocs): New function.
13414         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
13415         sections that are garbage collected.
13416         * reloc.h (Gc_process_relocs): New class.
13417         * sparc.cc (Target_sparc::gc_process_relocs): New function.
13418         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
13419         symbols whose corresponding sections are garbage collected.
13420         (Symbol_table::Symbol_table): Add new parameter for the garbage
13421         collection object.
13422         (Symbol_table::gc_mark_undef_symbols): New function.
13423         (Symbol_table::gc_mark_symbol_for_shlib): New function.
13424         (Symbol_table::gc_mark_dyn_syms): New function.
13425         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
13426         as garbage.
13427         (Symbol_table::add_from_object): Likewise.
13428         (Symbol_table::add_from_relobj): When building shared objects, do not
13429         treat externally visible symbols as garbage.
13430         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
13431         table information for static and relocatable links.
13432         * symtab.h (Symbol_table::set_gc): New function.
13433         (Symbol_table::gc): New function.
13434         (Symbol_table::gc_mark_undef_symbols): New function.
13435         (Symbol_table::gc_mark_symbol_for_shlib): New function.
13436         (Symbol_table::gc_mark_dyn_syms): New function.
13437         (Symbol_table::gc_): New data member.
13438         * target.h (Sized_target::gc_process_relocs): New pure virtual
13439         function.
13440         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
13441         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
13442
13443 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
13444
13445         * options.h (General_options::gc_sections): Define as a no-op for now.
13446         (General_options::no_keep_memory): Ditto.
13447         (General_options::Bshareable): Define.
13448         * options.cc (General_options::finalize): Honor -Bshareable.
13449
13450 2009-01-20  Andreas Schwab  <schwab@suse.de>
13451
13452         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
13453         read the value in the contents, since we don't use it.  Use the
13454         template endianness when writing.
13455         (Relocate::relocate): Use it for R_PPC_REL16_HA.
13456
13457 2009-01-19  Andreas Schwab  <schwab@suse.de>
13458
13459         * configure.tgt (powerpc64-*): Fix targ_obj.
13460
13461 2009-01-15  Ian Lance Taylor  <iant@google.com>
13462
13463         * object.cc (Sized_relobj::write_local_symbols): Don't write out
13464         local symbols when stripping all symbols.
13465
13466 2009-01-14  Cary Coutant  <ccoutant@google.com>
13467
13468         * output.cc (Output_reloc): Add explicit instantiations.
13469
13470 2009-01-14  Cary Coutant  <ccoutant@google.com>
13471
13472         * archive.cc (Archive::get_elf_object_for_member): Remove call
13473         to File_read::claim_for_plugin.
13474         * descriptors.cc (Descriptors::open): Remove reference to
13475         is_claimed.
13476         (Descriptors::claim_for_plugin): Remove.
13477         * descriptors.h (Descriptors::claim_for_plugin): Remove.
13478         (Descriptors::is_claimed): Remove.
13479         (claim_descriptor_for_plugin): Remove.
13480         * fileread.cc (File_read::claim_for_plugin): Remove.
13481         * fileread.h (File_read::claim_for_plugin): Remove.
13482         (File_read::descriptor): Reopen descriptor if necessary.
13483         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
13484         (Plugin_manager::all_symbols_read): Add task parameter. Change
13485         all callers.
13486         (Plugin_manager::get_input_file): New function.
13487         (Plugin_manager::release_input_file): New function.
13488         (Pluginobj::Pluginobj): Add filesize parameter and initialize
13489         corresponding data member.
13490         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
13491         and pass to base constructor. Change all callers.
13492         (get_input_file, release_input_file): New functions.
13493         (make_sized_plugin_object): Add filesize parameter. Change all callers.
13494         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
13495         (Plugin_manager::all_symbols_read): Add task parameter.
13496         (Plugin_manager::get_input_file): New function.
13497         (Plugin_manager::release_input_file): New function.
13498         (Plugin_manager::task_): New data member.
13499         (Pluginobj::Pluginobj): Add filesize parameter.
13500         (Pluginobj::filename): New function.
13501         (Pluginobj::descriptor): New function.
13502         (Pluginobj::filesize): New function.
13503         (Pluginobj::filesize_): New data member.
13504         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
13505         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
13506         File_read::claim_for_plugin; use Object::unlock to unlock the file.
13507
13508         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
13509         with archive libraries.
13510         * testsuite/Makefile.in: Regenerate.
13511         * testsuite/plugin_test.c (struct sym_info): New type.
13512         (get_input_file, release_input_file): New static variables.
13513         (onload): Capture new transfer vector entries.
13514         (claim_file_hook): Stop reading at end of file according to filesize.
13515         Factor out parsing of readelf output into separate function.
13516         (all_symbols_read_hook): Exercise get_input_file and release_input_file
13517         APIs and get the source file name from the symbol table.  Convert
13518         source file name to corresponding object file name.  Print info
13519         message when adding new input files.
13520         (parse_readelf_line): New function.
13521         * testsuite/plugin_test_1.sh: Add checks for new info messages.
13522         * testsuite/plugin_test_2.sh: Likewise.
13523         * testsuite/plugin_test_3.sh: Likewise.
13524         * testsuite/plugin_test_4.sh: New test case.
13525
13526 2009-01-07  Ian Lance Taylor  <iant@google.com>
13527
13528         * version.cc (version_string): Bump to 1.8.
13529
13530 2008-12-23  Cary Coutant  <ccoutant@google.com>
13531
13532         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
13533         * plugin.cc (Plugin_manager::finish): Rename as
13534         layout_deferred_objects.  Move cleanup to separate function.
13535         (Plugin_manager::cleanup): New function.
13536         (Plugin_finish::run): Call layout_deferred_objects and cleanup
13537         separately.
13538         * plugin.h (Plugin_manager::finish): Rename as
13539         layout_deferred_objects.
13540         (Plugin_manager::cleanup): New function.
13541         (Plugin_manager::cleanup_done): New field.
13542
13543 2008-12-23  Cary Coutant  <ccoutant@google.com>
13544
13545         * plugin.cc (is_visible_from_outside): New function.
13546         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
13547         so we don't return "IR only" status for exported symbols or -r links.
13548
13549         * testsuite/Makefile.am (plugin_test_3): New test case.
13550         * testsuite/Makefile.in: Regenerate.
13551         * testsuite/plugin_test_3.sh: New file.
13552
13553 2008-12-22  Cary Coutant  <ccoutant@google.com>
13554
13555         * object.cc (Sized_relobj::layout_section): New function.
13556         (Sized_relobj::do_layout): Defer layout of input sections until after
13557         plugin has provided replacement files.
13558         (Sized_relobj::do_layout_deferred_sections): New function.
13559         * object.h (Relobj::set_section_offset): Remove virtual keyword.
13560         (Relobj::layout_deferred_sections): New function.
13561         (Relobj::do_layout_deferred_sections): New function.
13562         (Sized_relobj::do_layout_deferred_sections): New function.
13563         (Sized_relobj::layout_section): New function.
13564         (Sized_relobj::Deferred_layout): New structure.
13565         (Sized_relobj::deferred_layout_): New field.
13566         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
13567         Change all callers.  Layout deferred sections.
13568         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
13569         references.
13570         (Plugin_hook::run): Move code from do_plugin_hook inline.
13571         (Plugin_hook::do_plugin_hook): Remove.
13572         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
13573         (Plugin_manager::finish): Renamed, was cleanup.
13574         (Plugin_manager::should_defer_layout): New function.
13575         (Plugin_manager::add_deferred_layout_object): New function.
13576         (Plugin_manager::Deferred_layout_list): New type.
13577         (Plugin_manager::deferred_layout_objects_): New field.
13578         (Plugin_hook::do_plugin_hook): Remove.
13579
13580 2008-12-17  Ian Lance Taylor  <iant@google.com>
13581
13582         * options.h (class General_options): Add --no case for
13583         --export-dynamic.
13584
13585 2008-12-16  Cary Coutant  <ccoutant@google.com>
13586
13587         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
13588         vector.
13589         (Plugin_manager::claim_file): Create plugin object even if
13590         plugin did not call the add_symbols callback.
13591         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
13592         asking for more symbols than were added.
13593         * testsuite/Makefile.am (plugin_test_1): Add test case with
13594         no global symbols.
13595         (empty.syms): New target.
13596         * testsuite/Makefile.in: Regenerate.
13597         * testsuite/plugin_test.c (claim_file_hook): Add new debug
13598         message. Don't call add_symbols if no globals.
13599         (all_symbols_read_hook): Don't provide replacement for empty
13600         claimed file.
13601
13602 2008-12-12  Ian Lance Taylor  <iant@google.com>
13603
13604         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
13605         r_type == 0 for a local symbol with r_sym == 0.
13606         (scan_relocatable_relocs): Pass r_sym to
13607         local_non_section_strategy.
13608         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
13609         r_sym parameter.
13610
13611         * configure.ac: Update test for TLS descriptors: they are
13612         supported as of glibc 2.9.
13613         * configure: Rebuild.
13614
13615 2008-12-11  Ian Lance Taylor  <iant@google.com>
13616
13617         PR 7091
13618         * target-reloc.h (Default_scan_relocatable_relocs): For each
13619         function, map r_type == 0 to RELOC_DISCARD.
13620
13621 2008-12-10  Cary Coutant  <ccoutant@google.com>
13622
13623         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
13624         object to override a kept COMDAT group from a plugin object.
13625
13626 2008-12-09  Ian Lance Taylor  <iant@google.com>
13627
13628         PR 7088
13629         * yyscript.y (file_cmd): Handle INPUT.
13630
13631         * testsuite/initpri1.c: Change all declarations to be full
13632         prototypes by adding void, to avoid compiler warnings.
13633
13634 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
13635
13636         * options.cc (General_options::parse_plugin_opt): New.
13637         (General_options::add_plugin): The argument now is just the filename.
13638         (General_options::add_plugin_option): New.
13639         * options.h (plugin_opt): New.
13640         (add_plugin): Change argument name.
13641         (add_plugin_option): New.
13642         * plugin.cc (Plugin::load): Don't parse the plugin option.
13643         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
13644         (Plugin::add_option): New.
13645         (Plugin::args_): Change type.
13646         (Plugin::filename_): New.
13647         (Plugin_manager::add_plugin_option): New.
13648         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
13649         * testsuite/Makefile.in: Regenerate.
13650
13651 2008-12-05  Cary Coutant  <ccoutant@google.com>
13652
13653         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
13654         Handle --strip-lto-sections option.
13655         * options.h (strip_lto_sections): New option.
13656
13657 2008-12-01  Cary Coutant  <ccoutant@google.com>
13658
13659         * plugin.cc (ld_plugin_message): Change format parameter to const.
13660         Fix mismatch between new[] and delete.
13661
13662 2008-11-14  Cary Coutant  <ccoutant@google.com>
13663
13664         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
13665         instead of -1U.
13666
13667 2008-11-05  Craig Silverstein  <csilvers@google.com>
13668
13669         * options.cc (General_options::parse_dynamic_list): New function.
13670         * options.h (General_options): New flags dynamic_list,
13671         dynamic_list_data, dynamic_list_cpp_new, and
13672         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
13673         (General_options::in_dynamic_list): New function.
13674         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
13675         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
13676         (Lex::can_continue_name): Likewise.
13677         (yylex): Likewise.
13678         (read_script_file): New parameter script_options.
13679         (read_dynamic_list): New function.
13680         (Script_options::define_dynamic_list): New function.
13681         (dynamic_list_keyword_parsecodes): New variable.
13682         (dynamic_list_keywords): New variable.
13683         * script.h (Script_options::define_dynamic_list): New function
13684         prototype.
13685         (read_dynamic_list): New function prototype.
13686         * symtab.cc (strprefix): New macro.
13687         (Symbol::should_add_dynsym_entry): Support dynamic_list,
13688         dynamic_list_data, dynamic_list_cpp_new, and
13689         dynamic_list_cpp_typeinfo.
13690         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
13691         (dynamic_list_expr): New rule.
13692         (dynamic_list_nodes): Likewise.
13693         (dynamic_list_node): Likewise.
13694         * testsuite/Makefile.am (dynamic_list): New test.
13695         * testsuite/Makefile.in: Regenerated.
13696         * testsuite/dynamic_list.t: New file.
13697         * testsuite/dynamic_list.sh: New file.
13698
13699 2008-11-05  Craig Silverstein  <csilvers@google.com>
13700
13701         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
13702         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
13703         (t11_last): Likewise.
13704         * testsuite/ver_test_6.c (main): Likewise.
13705
13706 2008-10-07  Cary Coutant  <ccoutant@google.com>
13707
13708         * options.c (General_options::finalize): Add check for -static and
13709         -shared.
13710         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
13711         is not empty.
13712
13713 2008-10-02  Cary Coutant  <ccoutant@google.com>
13714
13715         * plugin.cc (make_sized_plugin_object): Fix conditional
13716         compilation to work when not all targets are enabled.
13717
13718 2008-09-29  Cary Coutant  <ccoutant@google.com>
13719
13720         * archive.cc (Archive::get_file_and_offset): Use filename instead
13721         of name to get library path.
13722         (Archive::include_member): Unlock external member of a thin archive.
13723
13724         * testsuite/Makefile.am (TEST_AR): New variable.
13725         (thin_archive_test_1): New test.
13726         (thin_archive_test_2): New test.
13727         * testsuite/Makefile.in: Regenerate.
13728         * testsuite/thin_archive_main.cc: New file.
13729         * testsuite/thin_archive_test_1.cc: New file.
13730         * testsuite/thin_archive_test_2.cc: New file.
13731         * testsuite/thin_archive_test_3.cc: New file.
13732         * testsuite/thin_archive_test_4.cc: New file.
13733
13734 2008-09-29  Cary Coutant  <ccoutant@google.com>
13735
13736         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
13737         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
13738         instead of -1U.
13739         (Sized_relobj::do_finalize_local_symbols): Likewise.
13740         (Sized_relobj::map_to_kept_section): Likewise.
13741         * object.h (Sized_relobj::invalid_address): New constant.
13742         (Sized_relobj::do_output_section_offset): Check for invalid_address
13743         and return -1ULL.
13744         * output.cc (Output_reloc::local_section_offset): Use constant
13745         invalid_address instead of -1U.
13746         (Output_reloc::get_address): Likewise.
13747         (Output_section::output_address): Change -1U to -1ULL.
13748         * output.h (Output_reloc::invalid_address): New constant.
13749         * reloc.cc (Sized_relobj::write_sections): Use constant
13750         invalid_address instead of -1U.
13751         (Sized_relobj::relocate_sections): Likewise.
13752         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
13753         values for merge sections.
13754         * target-reloc.h (relocate_for_relocatable): Use constant
13755         invalid_address instead of -1U.
13756
13757 2008-09-19  Cary Coutant  <ccoutant@google.com>
13758
13759         Add plugin functionality for link-time optimization (LTO).
13760         * configure.ac (plugins): Add --enable-plugins option.
13761         * configure: Regenerate.
13762         * config.in: Regenerate.
13763         * Makefile.am (LIBDL): New variable.
13764         (CCFILES): Add plugin.cc.
13765         (HFILES): Add plugin.h.
13766         (ldadd_var): Add LIBDL.
13767         * Makefile.in: Regenerate.
13768
13769         * archive.cc: Include "plugin.h".
13770         (Archive::setup): Don't preread archive symbols when using a plugin.
13771         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
13772         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
13773         files.
13774         (Archive::include_member): Add symbols from plugin objects.
13775         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
13776         * descriptors.cc (Descriptors::open): Check for file descriptors
13777         abandoned by plugins.
13778         (Descriptors::claim_for_plugin): New function.
13779         * descriptors.h (Descriptors::claim_for_plugin): New function.
13780         (Open_descriptor::is_claimed): New field.
13781         (claim_descriptor_for_plugin): New function.
13782         * fileread.cc (File_read::claim_for_plugin): New function.
13783         * fileread.h (File_read::claim_for_plugin): New function.
13784         (File_read::descriptor): New function.
13785         * gold.cc: Include "plugin.h".
13786         (queue_initial_tasks): Add task to call plugin hooks for generating
13787         new object files.
13788         * main.cc: Include "plugin.h".
13789         (main): Load plugin libraries.
13790         * object.h (Pluginobj): Declare.
13791         (Object::pluginobj): New function.
13792         (Object::do_pluginobj): New function.
13793         (Object::set_target): New function.
13794         * options.cc: Include "plugin.h".
13795         (General_options::parse_plugin): New function.
13796         (General_options::General_options): Initialize plugins_ field.
13797         (General_options::add_plugin): New function.
13798         * options.h (Plugin_manager): Declare.
13799         (General_options): Add --plugin option.
13800         (General_options::has_plugins): New function.
13801         (General_options::plugins): New function.
13802         (General_options::add_plugin): New function.
13803         (General_options::plugins_): New field.
13804         * plugin.cc: New file.
13805         * plugin.h: New file.
13806         * readsyms.cc: Include "plugin.h".
13807         (Read_symbols::do_read_symbols): Check for archive before checking
13808         for ELF file.  Call plugin hooks to claim files.
13809         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
13810         from a real object file; force override when processing replacement
13811         files.
13812         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
13813         (Symbol::init_base_object): Likewise.
13814         (Symbol::init_base_output_data): Likewise.
13815         (Symbol::init_base_output_segment): Likewise.
13816         (Symbol::init_base_constant): Likewise.
13817         (Symbol::init_base_undefined): Likewise.
13818         (Symbol::output_section): Assert that object is not a plugin.
13819         (Symbol_table::add_from_pluginobj): New function.
13820         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
13821         undefined.
13822         (Symbol_table::sized_write_globals): Likewise.
13823         (Symbol_table::add_from_pluginobj): Instantiate template.
13824         * symtab.h (Sized_pluginobj): Declare.
13825         (Symbol::in_real_elf): New function.
13826         (Symbol::set_in_real_elf): New function.
13827         (Symbol::in_real_elf_): New field.
13828         (Symbol_table::add_from_pluginobj): New function.
13829
13830         * testsuite/Makefile.am (AM_CFLAGS): New variable.
13831         (LIBDL): New variable.
13832         (LDADD): Add LIBDL.
13833         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
13834         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
13835         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
13836         (MOSTLYCLEANFILES): Likewise.
13837         * testsuite/Makefile.in: Regenerate.
13838         * testsuite/plugin_test.c: New file.
13839         * testsuite/plugin_test_1.sh: New file.
13840         * testsuite/plugin_test_2.sh: New file.
13841
13842 2008-09-16  Ian Lance Taylor  <iant@google.com>
13843
13844         * target-reloc.h (relocate_section): Check whether a symbol is
13845         defined by the ABI before reporting an undefined symbol error.
13846         * target.h (Target::is_defined_by_abi): Make parameter const.
13847         (Target::do_is_defined_by_abi): Likewise.
13848         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
13849         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
13850         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
13851         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
13852         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
13853         * testsuite/Makefile.in: Rebuild.
13854
13855         * fileread.cc (make_view): Add casts to avoid warning.
13856
13857 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
13858
13859         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
13860         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
13861
13862 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
13863
13864         * options.h (General_options::output_is_executable): New.
13865         (General_options::output_is_pie): New.
13866         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
13867         for shared libraries.
13868         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
13869
13870 2008-09-11  Chris Demetriou  <cgd@google.com>
13871
13872         * options.h (origin): New -z option.
13873         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
13874         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
13875         in DT_FLAGS_1.
13876
13877 2008-09-05  Cary Coutant  <ccoutant@google.com>
13878
13879         * fileread.cc (File_read::make_view): Add check for attempt to map
13880         beyond end of file.
13881
13882 2008-09-05  Cary Coutant  <ccoutant@google.com>
13883
13884         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
13885         explicit instantiations.
13886
13887 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
13888
13889         PR gold/6858
13890         * options.cc (General_options::finalize): Allow undefined symbols
13891         in shlibs if linking -shared.
13892
13893         PR gold/6859
13894         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
13895         symbols as not needing a dynsym entry.
13896
13897 2008-08-20  Craig Silverstein  <csilvers@google.com>
13898
13899         * fileread.cc (File_read::open): Do not lock the file unless it
13900         was successfully opened.
13901
13902 2008-08-14  Cary Coutant  <ccoutant@google.com>
13903
13904         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
13905         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
13906         * testsuite/tls_test.cc (struct int128): 128-bit struct
13907         for testing TLS relocs with non-zero addend.
13908         (v12): New TLS variable.
13909         (t12): New test.
13910         (t_last): Add check for v12.
13911         * testsuite/tls_test.h (t12): New function.
13912         * testsuite/tls_test_main.cc (thread_routine): Call new test.
13913
13914 2008-08-13  Ian Lance Taylor  <iant@google.com>
13915
13916         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
13917         set tls_segment_ or relro_segment_.
13918         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
13919         when appropriate.
13920         * output.h (Output_section::clear_is_relro): New function.
13921         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
13922         sections specially even when output_data_ is empty.
13923         (Output_segment::maximum_alignment): When first section is relro,
13924         only force alignment for PT_LOAD segments.
13925         * script.cc (script_data_segment_align): New function.
13926         (script_data_segment_relro_end): New function.
13927         * script-c.h (script_data_segment_align): Declare.
13928         (script_data_segment_relro_end): Declare.
13929         * script-sections.h (class Script_sections): Declare
13930         data_segment_align and data_segment_relro_end.  Add fields
13931         segment_align_index_ and saw_relro_end_.
13932         * script-sections.cc (class Sections_element): Add set_is_relro
13933         virtual function.  Add new bool* parameter to place_orphan_here.
13934         Add get_output_section virtual function.
13935         (class Output_section_definition): Add set_is_relro.  Add new
13936         bool* parameter to place_orphan_here.  Add get_output_section.
13937         Add is_relro_ field.
13938         (Output_section_definition::Output_section_definition): Initialize
13939         evaluated_address_, evaluated_load_address, evaluated_addralign_,
13940         and is_relro_ fields.
13941         (Output_section_definition::place_orphan_here): Add is_relro
13942         parameter.
13943         (Output_section_definition::set_section_addresses): Set relro for
13944         output section.
13945         (Output_section_definition::alternate_constraint): Likewise.
13946         (class Orphan_output_section): Add new bool* parameter to
13947         place_orphan_here.  Add get_output_section.
13948         (Orphan_output_section::place_orphan_here): Add is_relro
13949         parameter.
13950         (Script_sections::Script_sections): Initialize
13951         data_segment_align_index_ and saw_relro_end_.
13952         (Script_sections::data_segment_align): New function.
13953         (Script_sections::data_segment_relro_end): New function.
13954         (Script_sections::place_orphan): Set or clear is_relro.
13955         (Script_sections::set_section_addresses): Force alignment of first
13956         TLS section.
13957         * yyscript.y (exp): Call script_data_segment_align and
13958         script_data_segment_relro_end.
13959         * testsuite/relro_script_test.t: New file.
13960         * testsuite/relro_test.cc (using_script): Declare.
13961         (t1, t2): Test using_script.
13962         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
13963         (relro_script_test_SOURCES): Define.
13964         (relro_script_test_DEPENDENCIES): Define.
13965         (relro_script_test_LDFLAGS): Define.
13966         (relro_script_test_LDADD): Define.
13967         (relro_script_test.so): New target.
13968         * testsuite/Makefile.in: Rebuild.
13969
13970 2008-08-06  Cary Coutant <ccoutant@google.com>
13971
13972         * archive.cc (Archive::total_archives, Archive::total_members)
13973         (Archive::total_members_loaded): New variables.
13974         (Archive::setup): Add parameter.  Add option to preread
13975         archive symbols.
13976         (Archive::read_armap): Add counter.
13977         (Archive::get_file_and_offset): New function.
13978         (Archive::get_elf_object_for_member): New function.
13979         (Archive::read_all_symbols): New function.
13980         (Archive::read_symbols): New function.
13981         (Archive::add_symbols): Add counters.
13982         (Archive::include_all_members): Use armap to find members if it's
13983         already built.
13984         (Archive::include_member): Skip reading symbols if already read.
13985         Factored code into Archive::get_file_and_offset and
13986         Archive::get_elf_object_for_member.  Changed call to
13987         Mapfile::report_include_archive_member.
13988         (Archive::print_stats): New function.
13989         * archive.h: Declare Object and Read_symbols_data classes.
13990         (Archive::Archive): Add initializers for new members.
13991         (Archive::setup): Add parameter.
13992         (Archive::print_stats): New function.
13993         (Archive::total_archives, Archive::total_members)
13994         (Archive::total_members_loaded): New variables.
13995         (Archive::get_file_and_offset): New function.
13996         (Archive::get_elf_object_for_member): New function.
13997         (Archive::read_all_symbols): New function.
13998         (Archive::read_symbols): New function.
13999         (Archive::Archive_member): New class.
14000         (Archive::members_): New member.
14001         (Archive::num_members_): New member.
14002         * main.cc: Include archive.h.
14003         (main): Call Archive::print_stats.
14004         * mapfile.cc (Mapfile::report_include_archive_member): Delete
14005         archive parameter; member_name is now the fully-decorated name.
14006         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
14007         * options.h: (General_options): Add --preread-archive-symbols option.
14008         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
14009         Archive::setup.
14010
14011 2008-08-04  Ian Lance Taylor  <iant@google.com>
14012
14013         * symtab.h (Symbol::use_plt_offset): New function.
14014         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
14015         * powerpc.cc (Relocate::relocate): Likewise.
14016         * sparc.cc (Relocate::relocate): Likewise.
14017         * x86_64.cc (Relocate::relocate): Likewise.
14018         * testsuite/weak_plt.sh: New test.
14019         * testsuite/weak_plt_main.cc: New test.
14020         * testsuite/weak_plt_shared.cc: New test.
14021         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
14022         (check_PROGRAMS): Add weak_plt.
14023         (check_DATA): Add weak_plt_shared.so.
14024         (weak_plt_main_pic.o, weak_plt): New targets.
14025         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
14026         * testsuite/Makefile.in: Rebuild.
14027
14028         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
14029         gcctestdir/ld.
14030         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
14031         * testsuite/Makefile.in: Rebuild.
14032
14033 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
14034
14035         * Makefile.am (POTFILES.in): Set LC_ALL=C.
14036         * Makefile.in: Regenerate.
14037         * po/POTFILES.in: Regenerate.
14038
14039 2008-07-29  Ian Lance Taylor  <iant@google.com>
14040
14041         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
14042         symbols before other symbols.
14043         * testsuite/script_test_2.cc (test_addr): Declare.
14044         (test_addr_alias): Declare.
14045         (main): Check that test_addr and test_addr_alias have the right
14046         values.
14047         * testsuite/script_test_2.t: Define test_addr_alias and
14048         test_addr.
14049
14050 2008-07-24  Ian Lance Taylor  <iant@google.com>
14051
14052         PR 5990
14053         * descriptors.cc: New file.
14054         * descriptors.h: New file.
14055         * gold-threads.h (class Hold_optional_lock): New class.
14056         * fileread.cc: Include "descriptors.h".
14057         (File_read::~File_read): Release descriptor rather than closing
14058         it.
14059         (File_read::open) [file]: Call open_descriptor rather than open.
14060         Set is_descriptor_opened_.
14061         (File_read::open) [memory]: Assert that descriptor is not open.
14062         (File_read::reopen_descriptor): New function.
14063         (File_read::release): Release descriptor.
14064         (File_read::do_read): Make non-const.  Reopen descriptor.
14065         (File_read::read): Make non-const.
14066         (File_read::make_view): Reopen descriptor.
14067         (File_read::do_readv): Likewise.
14068         * fileread.h (class File_read): Add is_descriptor_opened_ field.
14069         Update declarations.
14070         * layout.cc: Include "descriptors.h".
14071         (Layout::create_build_id): Use open_descriptor rather than open.
14072         * output.cc: Include "descriptors.h".
14073         (Output_file::open): Use open_descriptor rather than open.
14074         * archive.cc (Archive::const_iterator): Change Archive to be
14075         non-const.
14076         (Archive::begin, Archive::end): Make non-const.
14077         (Archive::count_members): Likewise.
14078         * archive.h (class Archive): Update declarations.
14079         * object.h (Object::read): Make non-const.
14080         * Makefile.am (CCFILES): Add descriptors.cc.
14081         (HFILES): Add descriptors.h.
14082         * Makefile.in: Rebuild.
14083
14084         PR 6716
14085         * gold.h: Always include <clocale>.  Add Solaris workarounds
14086         following code in binutils/sysdep.h.
14087
14088         PR 6048
14089         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
14090         this->eh_frame_hdr_ is NULL before using it.
14091
14092         * dynobj.cc (Versions::Versions): Update comment.
14093
14094         * dynobj.cc (Versions::Versions): If there is an soname, use it as
14095         the base version name.
14096
14097         * stringpool.cc (Stringpool_template::add_with_length): Set key to
14098         array size plus one.
14099         (Stringpool_template::set_string_offsets): Subtract one from key
14100         before using it as an array index.
14101         (Stringpool_template::get_offset_with_length): Likewise.
14102         (Stringpool_template::write_to_buffer): Likewise.
14103         * stringpool.h (Stringpool_template::get_offset_from_key):
14104         Likewise.
14105
14106 2008-07-23  Ian Lance Taylor  <iant@google.com>
14107
14108         PR 6658
14109         * object.h (Merged_symbol_value::value): Do our best to handle a
14110         negative addend.
14111
14112         PR 6647
14113         * script.cc (Version_script_info::get_versions): Don't add empty
14114         version tag to return value.
14115         (Version_script_info::get_symbol_version_helper): Change return
14116         type to bool.  Add pversion parameter.  Change all callers.
14117         (script_register_vers_node): Don't require a non-NULL tag.
14118         * script.h (class Version_script_info): Update declarations.
14119         (Version_script_info::get_symbol_version): Change return type to
14120         bool.  Add version parameter.  Change all callers.
14121         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
14122         handling.  Handle an empty version from a version script.
14123         (Symbol_table::define_special_symbol): Likewise.
14124         * testsuite/ver_test_10.script: New file.
14125         * testsuite/ver_test_10.sh: New file.
14126         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
14127         (check_DATA): Add ver_test_10.syms.
14128         (ver_test_10.syms, ver_test_10.so): New target.
14129         * testsuite/Makefile.in: Rebuild.
14130
14131 2008-07-23  Simon Baldwin  <simonb@google.com>
14132
14133         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
14134         to zero for undefined symbols from dynamic libraries.
14135
14136 2008-07-23  Ian Lance Taylor  <iant@google.com>
14137
14138         * symtab.cc (Symbol_table::resolve): Remove version parameter.
14139         Change all callers.
14140         * symtab.h (class Symbol_table): Update declaration.
14141         * testsuite/ver_test_9.cc: New file.
14142         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
14143         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
14144         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
14145         (ver_test_9.so, ver_test_9.o): New targets.
14146         * testsuite/Makefile.in: Rebuild.
14147
14148 2008-07-22  Ian Lance Taylor  <iant@google.com>
14149
14150         * options.h (class General_options): Define --check-sections.
14151         * layout.cc (Layout::set_segment_offsets): Handle
14152         --check-sections.
14153
14154         * options.h (class General_options): Define -n/--nmagic and
14155         -N/--omagic.
14156         * options.cc (General_options::finalize): For -n/--nmagic or
14157         -N/--omagic, set -static.
14158         * layout.cc (Layout::attach_allocated_section_to_segment): If
14159         -N/--omagic, don't put read-only and read-write sections in
14160         different segments.
14161         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
14162         finding a read-only segment.
14163         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
14164         don't set the minimum segment alignment to the common page size,
14165         and don't set the file offset to the address modulo the page size.
14166         * script-sections.cc (Script_sections::create_segments): If
14167         -n/--omagic, don't put read-only and read-write sections in
14168         different segments.
14169
14170         * cref.cc: New file.
14171         * cref.h: New file.
14172         * options.h (class General_options): Add --print-symbol-counts.
14173         * main.cc (main): Issue defined symbol report if requested.
14174         * archive.cc (Archive::interpret_header): Make into a const member
14175         function.
14176         (Archive::add_symbols): Call Input_objects::archive_start and
14177         archive_stop.
14178         (Archive::const_iterator): Define new class.
14179         (Archive::begin, Archive::end): New functions.
14180         (Archive::include_all_members): Rewrite to use iterator.
14181         (Archive::count_members): New function.
14182         * archive.h (class Archive): Update declarations.
14183         (Archive::filename): New function.
14184         * object.cc: Include "cref.h".
14185         (Sized_relobj::Sized_relobj): Initialize defined_count_.
14186         (Sized_relobj::do_get_global_symbol_counts): New function.
14187         (Input_objects::add_object): Add object to cross-referencer.
14188         (Input_objects::archive_start): New function.
14189         (Input_objects::archive_stop): New function.
14190         (Input_objects::print_symbol_counts): New function.
14191         * object.h: Declare Cref and Archive.
14192         (Object::get_global_symbol_counts): New function.
14193         (Object::do_get_global_symbol_counts): New pure virtual function.
14194         (class Sized_relobj): Add defined_count_ field.  Update
14195         declarations.
14196         (class Input_objects): Add cref_ field.  Update constructor.
14197         Update declarations.
14198         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
14199         defined_count_.
14200         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
14201         symbol counts.
14202         (Sized_dynobj::do_get_global_symbol_counts): New function.
14203         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
14204         defined_count_.  Update declarations.  Define Symbols typedef.
14205         * symtab.cc (Symbol_table::add_from_relobj): Add defined
14206         parameter.  Change all callers.
14207         (Symbol_table::add_from_dynobj): Add sympointers and defined
14208         parameters.  Change all callers.
14209         * symtab.h (class Symbol_table): Update declarations.
14210         * Makefile.am (CCFILES): Add cref.cc.
14211         (HFILES): Add cref.h.
14212         * Makefile.in: Rebuild.
14213
14214 2008-07-22  Simon Baldwin  <simonb@google.com>
14215
14216         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
14217         to zero when writing undefined symbols.
14218
14219 2008-07-22  Ian Lance Taylor  <iant@google.com>
14220
14221         * output.cc (Output_section::add_input_section): Don't try to
14222         merge empty merge sections.
14223
14224 2008-07-21  Craig Silverstein  <csilvers@google.com>
14225
14226         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
14227         Include symbol version in error message.
14228
14229 2008-07-20  Chris Demetriou  <cgd@google.com>
14230
14231         * configure.ac (gold_cv_c_random_seed): New configured variable.
14232         (RANDOM_SEED_CFLAGS): New substituted variable.
14233         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
14234         * configure: Rebuild.
14235         * Makefile.in: Likewise.
14236         * testsuite/Makefile.in: Likewise.
14237
14238 2008-07-18  Ian Lance Taylor  <iant@google.com>
14239
14240         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
14241         where we see NAME/NULL and NAME/VERSION  as separate symbols.
14242         * testsuite/ver_test_main.cc (main): Call t4.
14243         (t4, t4_2a): Define.
14244         * testsuite/ver_test_2.cc (t4_2): Define.
14245         * testsuite/ver_test_2.script: Put t4_2a in VER2.
14246         * testsuite/ver_test_4.cc (t4_2a): Define.
14247         * testsuite/ver_test_4.script: Put t4_2a in VER2.
14248         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
14249
14250 2008-07-17  Ian Lance Taylor  <iant@google.com>
14251
14252         * dynobj.cc (Versions::add_def): If we give an error about a
14253         missing version, go ahead and create the version anyhow.
14254
14255 2008-07-10  Ian Lance Taylor  <iant@google.com>
14256
14257         Handle output sections with more than 0x7fffffff bytes.
14258         * object.h (class Relobj): Change map_to_output_ to
14259         output_sections_, and just keep a section pointer.  Change all
14260         uses.  Move comdat group support to Sized_relobj.
14261         (Relobj::is_section_specially_mapped): Remove.
14262         (Relobj::output_section): Remove poff parameter.  Change all
14263         callers.
14264         (Relobj::output_section_offset): New function.
14265         (Relobj::set_section_offset): Rewrite.
14266         (Relobj::map_to_output): Remove.
14267         (Relobj::output_sections): New function.
14268         (Relobj::do_output_section_offset): New pure virtual function.
14269         (Relobj::do_set_section_offset): Likewise.
14270         (class Sized_relobj): Add section_offsets_ field.  Add comdat
14271         group support from Relobj.  Update declarations.
14272         (Sized_relobj::get_output_section_offset): New function.
14273         (Sized_relobj::do_output_section_offset): New function.
14274         (Sized_relobj::do_set_section_offset): New function.
14275         * object.cc (Relobj::output_section_address): Remove.
14276         (Sized_relobj::Sized_relobj): Initialize new fields.
14277         (Sized_relobj::include_section_group): Cast find_kept_object to
14278         Sized_relobj.
14279         (Sized_relobj::include_linkonce_section): Likewise.
14280         (Sized_relobj::do_layout): Use separate arrays for output section
14281         and output offset.
14282         (Sized_relobj::do_count_local_symbols): Change map_to_output to
14283         output_sections.
14284         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
14285         output_sections and section_offsets.
14286         (Sized_relobj::write_local_symbols): Likewise.
14287         (map_to_kept_section): Compute output address directly.
14288         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
14289         output_sections and section_offsets.
14290         (Sized_relobj::write_sections): Likewise.
14291         (Sized_relobj::relocate_sections): Likewise.
14292         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
14293         * output.h (class Output_reloc): Update declarations.  Change
14294         u2_.relobj to Sized_relobj*.
14295         (class Output_data_reloc): Change add functions to use
14296         Sized_relobj*.
14297         * output.cc (Output_reloc::Output_reloc): Change relobj to
14298         Sized_relobj*.
14299         (Output_reloc::local_section_offset): Change return type to
14300         Elf_Addr.  Use get_output_section_offset.
14301         (Output_reloc::get_address): Likewise.
14302         (Output_section::is_input_address_mapped): Don't call
14303         is_section_specially_mapped.
14304         (Output_section::output_offset): Likewise.
14305         (Output_section::output_address): Likewise.
14306         (Output_section::starting_output_address): Likewise.
14307         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
14308         parameter to Sized_relobj*.
14309         (Copy_relocs::need_copy_reloc): Likewise.
14310         (Copy_relocs::save): Likewise.
14311         * copy-relocs.h (class Copy_relocs): Update declarations.
14312         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
14313         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
14314         * target-reloc.h (relocate_for_relocatable): Change
14315         offset_in_output_section type to Elf_Addr.  Change code that uses
14316         it as well.
14317         * layout.cc (Layout::layout): Always set *off.
14318         * mapfile.cc (Mapfile::print_input_section): Use
14319         output_section_offset.
14320         * i386.cc (Target_i386::copy_reloc): Change object parameter to
14321         Sized_relobj*.
14322         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
14323         * sparc.cc (Target_sparc::copy_reloc): Likewise.
14324         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
14325
14326 2008-07-03  Ian Lance Taylor  <iant@google.com>
14327
14328         * layout.cc (Layout::include_section): Do not discard unrecognized
14329         SHT_STRTAB sections.
14330
14331 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
14332
14333         * script.cc (Lex::can_continue_name): Make '?' allowable in
14334         version-script names.
14335         * testsuite/version_script.map: Change glob pattern to use '?'
14336
14337 2008-06-30  Manish Singh  <yosh@gimp.org>
14338
14339         PR 6585
14340         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
14341         Correct typo.
14342
14343 2008-06-30  Ian Lance Taylor  <iant@google.com>
14344
14345         PR 6660
14346         PR 6682
14347         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
14348         versions]: Don't try to read the value in the contents, since we
14349         don't use it.  Use the template endianness when writing.
14350
14351 2008-06-25  Cary Coutant  <ccoutant@google.com>
14352
14353         * fileread.cc (File_read::make_view): Assert on zero-length view.
14354         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
14355         symbol table when there are no symbols to read.
14356
14357 2008-06-23  Craig Silverstein  <csilvers@google.com>
14358
14359         * version.cc (version_string): Bump to 1.7
14360
14361 2008-06-18  Craig Silverstein  <csilvers@google.com>
14362
14363         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
14364         constant 0xFFFF to type Valtype.
14365         (Powerpc_relocate_functions::rel16_ha): Likewise.
14366
14367 2008-06-17  Ian Lance Taylor  <iant@google.com>
14368
14369         * output.h (Output_section::Input_section): Initialize p2align_ to
14370         zero for Output_section_data constructors.
14371         (Output_section::Input_section::addralign): If not an input
14372         section, return the alignment of the Output_section_data.
14373         * testsuite/copy_test.cc: New file.
14374         * testsuite/copy_test_1.cc: New file.
14375         * testsuite/copy_test_2.cc: New file.
14376         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
14377         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
14378         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
14379         (copy_test_1_pic.o, copy_test_1.so): New targets.
14380         (copy_test_2_pic.o, copy_test_2.so): New targets.
14381         * testsuite/Makefile.in: Rebuild.
14382
14383         * script-sections.cc (Script_sections::place_orphan): Initialize
14384         local variable exact.
14385
14386 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
14387
14388         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
14389
14390 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
14391             David S. Miller  <davem@davemloft.net>
14392
14393         * powerpc.cc: New file.
14394         * Makefile.am (TARGETSOURCES): Add powerpc.cc
14395         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
14396         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
14397         * Makefile.in: Rebuild.
14398
14399 2008-06-09  Ian Lance Taylor  <iant@google.com>
14400
14401         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
14402         <exception>.
14403         (throwing, orig_terminate): New static variables.
14404         (terminate_handler): New static function.
14405         (t2): Set terminate handler.
14406
14407 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
14408
14409         PR 6584
14410         * binary.cc (Binary_to_elf::sized_convert): Fix .data
14411         alignment.
14412
14413 2008-05-30  Cary Coutant  <ccoutant@google.com>
14414
14415         * archive.cc (Archive::include_all_members) Correct to step
14416         over symbol table and extended name table in thin archives.
14417
14418 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
14419
14420         PR 6407
14421         * target-reloc.h (relocate_for_relocatable): Fix new_offset
14422         calculation.
14423
14424 2008-05-28  Caleb Howe  <cshowe@google.com>
14425
14426         * reduced_debug_output.cc: New file.
14427         * reduced_debug_output.h: New file.
14428         * options.h (class General_options): Add --strip-debug-non-line.
14429         * options.cc (General_options::finalize): Add strip_debug_non_line
14430         to the strip heirarchy.
14431         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
14432         fields.
14433         * layout.cc: Include "reduced_debug_output.h".
14434         (Layout::Layout): Initialize new fields.
14435         (line_only_debug_sections): New static array.
14436         (is_lines_only_debug_sections): New static inline function.
14437         (Layout::include_section): Handle --strip-debug-non-line.
14438         (Layout::make_output_section): If --strip-debug-non-line, build
14439         new output sections for .debug_abbrev and .debug_info.
14440         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
14441         gold.  Warn about possible overflow.
14442         (read_signed_LEB_128): Likewise.
14443         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
14444         (read_signed_LEB_128): Declare.
14445         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
14446         (HFILES): Add reduced_debug_output.h.
14447         * Makefile.in: Rebuild.
14448
14449 2008-05-21  Ian Lance Taylor  <iant@google.com>
14450
14451         * mapfile.cc: New file.
14452         * mapfile.h: New file.
14453         * options.h (class General_options): Add -M/--print-map and -Map.
14454         * options.cc (General_options::finalize): Make -M equivalent to
14455         -Map -.
14456         * main.cc: Include <cstdio> and "mapfile.h".
14457         (main): Open mapfile if requested.
14458         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
14459         constructor.  Change caller.
14460         (queue_initial_tasks): Add mapfile parameter.  Change caller.
14461         (queue_middle_tasks): Likewise.
14462         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
14463         declarations.
14464         * archive.cc: Include "mapfile.h".
14465         (Archive::add_symbols): Add mapfile parameter.  Change all
14466         callers.  Pass mapfile, symbol, and reason to include_member.
14467         (Archive::include_all_members): Add mapfile parameter.  Change all
14468         callers.
14469         (Archive::include_member): Add mapfile, sym, and why parameters.
14470         Change all callers.  Report inclusion to map file.
14471         * archive.h: Include "fileread.h".
14472         (class Archive): Update declarations.
14473         (Archive::file): New const method.
14474         (class Add_archive_symbols): Add mapfile_ field.  Update
14475         constructor.  Change all callers.
14476         * readsyms.h (class Read_symbols): Likewise.
14477         (class Finish_group): Likewise.
14478         (class Read_script): Likewise.
14479         * common.cc: Include "mapfile.h".
14480         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
14481         all callers.
14482         (Symbol_table::do_allocate_commons): Likewise.
14483         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
14484         symbol allocation to mapfile.
14485         * common.h (class Allocate_commons_task): Add mapfile_ field.
14486         Update constructor.  Change all callers.
14487         * symtab.h (class Symbol_table): Update declarations.
14488         * layout.cc: Include "mapfile.h".
14489         (Layout_task_runner::run): Print information to mapfile.
14490         (Layout::create_gold_note): Change Output_data_fixed_space to
14491         Output_data_zero_fill.
14492         (Layout::create_build_id): Likewise.
14493         (Layout::print_to_mapfile): New function.
14494         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
14495         constructor.  Change caller.
14496         (class Layout): Declare print_to_mapfile.
14497         * output.cc (Output_section::Input_section::print_to_mapfile): New
14498         function.
14499         (Output_section::add_input_section): If producing a map, always
14500         add to input_sections_ list.
14501         (Output_section::do_print_to_mapfile): New function.
14502         (Output_segment::print_sections_to_mapfile): New function.
14503         (Output_segment::print_section_list_to_mapfile): New function.
14504         * output.h: Include "mapfile.h".
14505         (Output_data::print_to_mapfile): New function.
14506         (Output_data::do_print_to_mapfile): New virtual function.
14507         (Output_segment_headers::do_print_to_mapfile): New function.
14508         (Output_file_header::do_print_to_mapfile): New function.
14509         (Output_data_const::do_print_to_mapfile): New function.
14510         (class Output_data_const_buffer): Add map_name_ field.  Update
14511         constructor.  Change all callers.  Add do_print_to_mapfile
14512         function.
14513         (class Output_data_fixed_space): Likewise.
14514         (class Output_data_space): Likewise.
14515         (class Output_data_zero_fill): New class.
14516         (Output_data_strtab::do_print_to_mapfile): New function.
14517         (Output_data_reloc_base::do_print_to_mapfile): New function.
14518         (Output_relocatable_relocs::do_print_to_mapfile): New function.
14519         (Output_data_group::do_print_to_mapfile): New function.
14520         (Output_data_got::do_print_to_mapfile): New function.
14521         (Output_data_dynamic::do_print_to_mapfile): New function.
14522         (Output_symtab_xindex::do_print_to_mapfile): New function.
14523         (class Output_section): Declare do_print_to_mapflie.  Declare
14524         print_to_mapfile in Input_section.
14525         (class Output_segment): Declare new functions.
14526         * object.h (Sized_relobj::symbol_count): New function.
14527         * script-sections.cc
14528         (Output_section_element_dot_assignment::set_section_addresses):
14529         Change Output_data_fixed_space to Output_data_zero_fill.
14530         (Output_data_expression::do_print_to_mapfile): New function.
14531         * script.cc (read_input_script): Add mapfile parameter.  Change
14532         all callers.
14533         * script.h (read_input_script): Update declaration.
14534         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
14535         (Eh_frame::do_print_to_mapfile): New function.
14536         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
14537         (Output_merge_string::do_print_to_mapfile): New function.
14538         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
14539         function.
14540         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
14541         function.
14542         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
14543         function.
14544         * Makefile.am (CCFILES): Add mapfile.cc.
14545         (HFILES): Add mapfile.h.
14546         * Makefile.in: Rebuild.
14547
14548 2008-05-19  Ian Lance Taylor  <iant@google.com>
14549
14550         * options.h (class General_options): Add -z relro.
14551         * layout.cc (Layout::Layout): Initialize relro_segment_.
14552         (Layout::add_output_section_data): Return the output section.
14553         (Layout::make_output_section): Rcognize relro sections and mark
14554         them appropriately.
14555         (Layout::attach_allocated_section_to_segment): Put relro sections
14556         in a PT_GNU_RELRO segment.
14557         (Layout::create_initial_dynamic_sections): Mark the .dynamic
14558         section as relro.
14559         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
14560         PT_TLS segments.
14561         (Layout::linkonce_mapping): Map d.rel.ro.local to
14562         .data.rel.ro.local.
14563         (Layout::output_section_name): Us .data.rel.ro.local for any
14564         section which begins with that.
14565         * layout.h (class Layout): Update add_output_section_data
14566         declaration.  Add relro_segment_ field.
14567         * output.cc (Output_section::Output_section): Initialize is_relro_
14568         and is_relro_local_ fields.
14569         (Output_segment::add_output_section): Group relro sections.
14570         (Output_segment::is_first_section_relro): New function.
14571         (Output_segment::maximum_alignment): If there is a relro section,
14572         align the segment to the common page size.
14573         (Output_segment::set_section_addresses): Track whether we are
14574         looking at relro sections.  If the last section is a relro
14575         section, align to the common page size.
14576         (Output_segment::set_section_list_addresses): Add in_relro
14577         parameter.  Change all callers.  Align to the page size when
14578         moving from relro to non-relro section.
14579         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
14580         segment.
14581         * output.h (class Output_section): Add is_relro_ and
14582         is_relro_local_ fields.
14583         (Output_section::is_relro): New function.
14584         (Output_section::set_is_relro): New function.
14585         (Output_section::is_relro_local): New function.
14586         (Output_section::set_is_relro_local): New function.
14587         (class Output_segment): Update declarations.
14588         * i386.cc (Target_i386::got_section): Mark .got section as relro.
14589         * sparc.cc (Target_sparc::got_section): Likewise.
14590         * x86_64.cc (Target_x86_64::got_section): Likewise.
14591         * testsuite/relro_test_main.cc: New file.
14592         * testsuite/relro_test.cc: New file.
14593         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
14594         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
14595         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
14596         (relro_test.so, relro_test_pic.o): New targets.
14597         * testsuite/Makefile.in: Rebuild.
14598
14599 2008-05-16  Ian Lance Taylor  <iant@google.com>
14600
14601         * output.cc (Output_segment::add_output_section): Remove front
14602         parameter.
14603         * output.h (class Output_segment): Remove
14604         add_initial_output_section and overloaded add_output_section.
14605         Update declaration of remaining add_output_section.
14606         * layout.cc (Layout::create_interp): Call add_output_section
14607         rather than add_initial_output_section.
14608         (Layout::finish_dynamic_section): Likewise.
14609
14610         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
14611         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
14612         know the dynamic type.
14613         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
14614         field.  Initialize it in constructor.
14615         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
14616         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
14617         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
14618         reloc.
14619
14620         * output.cc (Output_reloc::get_address): Change return type to
14621         Elf_Addr.
14622         * output.h (class Output_reloc): Update get_address declaration.
14623         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
14624         for section addresses.
14625
14626 2008-05-09  Ian Lance Taylor  <iant@google.com>
14627
14628         PR 6493
14629         * gold.cc (gold_nomem): Use return value of write.
14630
14631 2008-05-08  Ian Lance Taylor  <iant@google.com>
14632
14633         * symtab.c (Symbol::init_base_output_data): Add version
14634         parameter.  Change all callers.
14635         (Symbol::init_base_output_segment): Likewise.
14636         (Symbol::init_base_constant): Likewise.
14637         (Symbol::init_base_undefined): Likewise.
14638         (Sized_symbol::init_output_data): Likewise.
14639         (Sized_symbol::init_output_segment): Likewise.
14640         (Sized_symbol::init_constant): Likewise.
14641         (Sized_symbol::init_undefined): Likewise.
14642         (Symbol_table::do_define_in_output_data): If the new symbol has a
14643         version, mark it as the default.
14644         (Symbol_table::do_define_in_output_segment): Likewise.
14645         (Symbol_table::do_define_as_constant): Likewise.
14646         * symtab.h (class Symbol): Update declarations.
14647         (class Sized_symbol): Likewise.
14648         * resolve.cc (Symbol::override_version): New function.
14649         (Symbol::override_base): Call override_version.
14650         (Symbol::override_base_with_special): Likewise.
14651         * testsuite/ver_script_8.script: New file.
14652         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
14653         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
14654         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
14655         (ver_test_8_1.so, ver_test_8_2.so): New targets.
14656
14657 2008-05-06  Ian Lance Taylor  <iant@google.com>
14658
14659         PR 6049
14660         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
14661         functions.
14662         (class General_options): Remove existing --undefined, and add
14663         --no-undefined instead.  Add new --undefined as synonym for -u.
14664         * archive.cc (Archive::add_symbols): Check whether symbol was
14665         named with -u.
14666         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
14667         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
14668         all uses.  Add IS_UNDEFINED.  Update declarations to split
14669         different versions of init_base.  Declare init_base_undefined.
14670         (Symbol::is_defined): Handle IS_UNDEFINED.
14671         (Symbol::is_undefined): Likewise.
14672         (Symbol::is_weak_undefined): Call is_undefined.
14673         (Symbol::is_absolute): Handle IS_CONSTANT.
14674         (class Sized_symbol): Update declarations to split different
14675         versions of init.  Declare init_undefined.
14676         (class Symbol_table): Declare new functions.
14677         * symtab.cc (Symbol::init_base_object): Rename from init_base.
14678         Change all callers.
14679         (Symbol::init_base_output_data): Likewise.
14680         (Symbol::init_base_output_segment): Likewise.
14681         (Symbol::init_base_constant): Likewise.
14682         (Symbol::init_base_undefined): New function.
14683         (Sized_symbol::init_object): Rename from init.  Change all
14684         callers.
14685         (Sized_symbol::init_output_data): Likewise.
14686         (Sized_symbol::init_output_segment): Likewise.
14687         (Sized_symbol::init_constant): Likewise.
14688         (Sized_symbol::init_undefined): New function.
14689         (Symbol_table::add_undefined_symbols_from_command_line): New
14690         function.
14691         (Symbol_table::do_add_undefined_symbols_from_command_line): New
14692         function.
14693         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
14694         (Symbol::output_section): Likewise.
14695         (Symbol::set_output_section): Likewise.
14696         (Symbol_table::sized_finalize_symbol): Likewise.
14697         (Symbol_table::sized_write_globals): Likewise.
14698         * resolve.cc (Symbol_table::should_override): Likewise.
14699         (Symbol::override_base_with_special): Likewise.
14700
14701         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
14702         symbol, change it to have default visibility.
14703         * testsuite/protected_1.cc: New file.
14704         * testsuite/protected_2.cc: New file.
14705         * testsuite/protected_3.cc: New file.
14706         * testsuite/protected_main_1.cc: New file.
14707         * testsuite/protected_main_2.cc: New file.
14708         * testsuite/protected_main_3.cc: New file.
14709         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
14710         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
14711         (protected_1_LDFLAGS, protected_1_LDADD): Define.
14712         (protected_1.so): New target.
14713         (protected_1_pic.o, protected_2_pic.o): New targets.
14714         (protected_3_pic.o): New target.
14715         (check_PROGRAMS): Add protected_2.
14716         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
14717         (protected_2_LDFLAGS, protected_2_LDADD): Define.
14718         * testsuite/Makefile.in: Rebuild.
14719
14720         * options.h (DEFINE_var): Add set_user_set_##varname__.
14721         (DEFINE_bool_alias): New macro.
14722         (class General_options): Define -Bstatic using DEFINE_bool_alias
14723         rather than DEFINE_special.  Add --undefined as an alias for -z
14724         defs.
14725         * options.cc (General_options::parse_Bstatic): Remove.
14726
14727         * options.h (class General_options): Add --fatal-warnings.
14728         * main.cc (main): Implement --fatal-warnings.
14729         * errors.h (Errors::warning_count): New function.
14730
14731         * options.h (class General_options): Add -Bsymbolic-functions.
14732         * symtab.h (Symbol::is_preemptible): Check for
14733         -Bsymbolic-functions.
14734
14735 2008-05-05  Ian Lance Taylor  <iant@google.com>
14736
14737         * options.h (DEFINE_bool): For DASH_Z, create the negative option
14738         as noVARNAME rather than no-VARNAME.
14739         (class General_options): Add option -z combreloc.
14740         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
14741         get_address.
14742         (Output_reloc::sort_before) [SHT_REL]: New function.
14743         (Output_reloc::sort_before) [SHT_RELA]: New function.
14744         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
14745         Sort_relocs_comparison.
14746         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
14747         parameter.  Change all callers.
14748         (Output_data_reloc::Output_data_reloc) [both versions]: Add
14749         sort_relocs parameter.  Change all callers.
14750         * output.cc (Output_reloc::get_address): New function, broken out
14751         of write_rel.
14752         (Output_reloc::write_rel): Call it.
14753         (Output_reloc::compare): New function.
14754         (Output_data_reloc_base::do_write): Optionally sort relocs.
14755
14756         * configure.ac: If targ_extra_obj is set, link it in.
14757         * configure.tgt: Initialize all variables.
14758         (x86_64*): Set targ_extra_obj and targ_extra_size.
14759         * configure: Rebuild.
14760
14761         * object.cc (Sized_relobj::include_section_group): Adjust section
14762         indexes read from group data.  Build vector to pass to
14763         layout_group.
14764         * layout.cc (Layout::layout_group): Add flags and shndxes
14765         parameters.  Remove contents parameter.  Change caller.  Update
14766         explicit instantiations.
14767         * layout.h (class Layout): Update layout_group declaration.
14768         * output.cc (Output_data_group::Output_data_group): Add flags and
14769         input_shndxes parameters.  Remove contents parameter.  Change
14770         caller.
14771         (Output_data_group::do_write): Change input_sections_ to
14772         input_shndxes_.
14773         * output.h (class Output_data_group): Update constructor
14774         declaration.  Rename input_sections_ to input_shndxes_.
14775         * testsuite/many_sections_test.cc: Add template.
14776
14777 2008-04-30  Cary Coutant  <ccoutant@google.com>
14778
14779         * target-reloc.h (relocate_section): Fix dead-pointer bug.
14780
14781         * layout.cc (Layout::include_section): Refactored check for debug
14782         info section.
14783         (Layout::add_comdat): Add new parameters.  Change type
14784         of signature parameter.  Add object and shndx to signatures table.
14785         (Layout::find_kept_object): New function.
14786         * layout.h: Include <cstring>.
14787         (Layout::is_debug_info_section): New function.
14788         (Layout::add_comdat): Add new parameters.
14789         (Layout::find_kept_object): New function.
14790         (Layout::Kept_section): New struct.
14791         (Layout::Signatures): Change type of map range.
14792         * object.cc (Relobj::output_section_address): New function.
14793         (Sized_relobj::include_section_group): Add new parameters.  Change
14794         calls to Layout::add_comdat.  Change to build table of kept comdat
14795         groups and table mapping discarded sections to kept sections.
14796         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
14797         (Sized_relobj::do_layout): Change calls to include_section_group and
14798         include_linkonce_section.
14799         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
14800         value to zero when section is discarded.
14801         (Sized_relobj::map_to_kept_section): New function.
14802         * object.h (Relobj::output_section_address): New function.
14803         (Relobj::Comdat_group): New type.
14804         (Relobj::find_comdat_group): New function.
14805         (Relobj::Comdat_group_table): New type.
14806         (Relobj::Kept_comdat_section): New type.
14807         (Relobj::Kept_comdat_section_table): New type.
14808         (Relobj::add_comdat_group): New function.
14809         (Relobj::set_kept_comdat_section): New function.
14810         (Relobj::get_kept_comdat_section): New function.
14811         (Relobj::comdat_groups_): New field.
14812         (Relobj::kept_comdat_sections_): New field.
14813         (Symbol_value::input_value): Update comment.
14814         (Sized_relobj::map_to_kept_section) New function.
14815         (Sized_relobj::include_linkonce_section): Add new parameter.
14816         * target-reloc.h (Comdat_behavior): New type.
14817         (get_comdat_behavior): New function.
14818         (relocate_section): Add code to map a discarded section to the
14819         corresponding kept section when applying a relocation.
14820
14821 2008-04-30  Craig Silverstein  <csilvers@google.com>
14822
14823         * dwarf_reader.cc (next_generation_count): New static var.
14824         (Addr2line_cache_entry): New struct.
14825         (addr2line_cache): New static var.
14826         (Dwarf_line_info::one_addr2line): Added caching.
14827         (Dwarf_line_info::clear_addr2line_cache): New function.
14828         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
14829         cache-size parameter.
14830         (Dwarf_line_info::one_addr2line_cache): New function.
14831         * symtab.cc (Symbol_table::detect_odr_violations): Pass
14832         new cache-size argument to one_addr2line(), and clear cache.
14833
14834 2008-04-28  Cary Coutant  <ccoutant@google.com>
14835
14836         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
14837         R_386_PC8 relocations.
14838
14839 2008-04-23  Ian Lance Taylor  <iant@google.com>
14840
14841         * object.cc (Sized_relobj::include_section_group): Check for
14842         invalid section group.
14843
14844         * object.cc (make_elf_object): Correct test for 64-bit ELF file
14845         header size.
14846
14847         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
14848         than read for file header.
14849         * archive.cc (Archive::include_member): Likewise.
14850
14851 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
14852
14853         * aclocal.m4: Regenerate.
14854         * configure: Regenerate.
14855
14856 2008-04-19  Ian Lance Taylor  <iant@google.com>
14857
14858         * version.cc (version_string): Bump to 1.6.
14859
14860         * testsuite/Makefile.am (many_sections_r_test): New target.
14861         (many_sections_r_test_SOURCES): Remove.
14862         (many_sections_r_test_DEPENDENCIES): Remove.
14863         (many_sections_r_test_LDFLAGS): Remove.
14864         (many_sections_r_test_LDADD): Remove.
14865
14866         * object.cc (Sized_relobj::do_add_symbols): Always pass
14867         local_symbol_count_ to add_from_relobj.
14868
14869         * testsuite/Makefile.am (many_sections_check.h): Only check one in
14870         every thousand variables.
14871         * testsuite/Makefile.in: Rebuild.
14872
14873         * object.cc (Xindex::initialize_symtab_xindex): New function.
14874         (Xindex::read_symtab_xindex): New function.
14875         (Xindex::sym_xindex_to_shndx): New function.
14876         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
14877         available.
14878         (Sized_relobj::do_initialize_xindex): New function.
14879         (Sized_relobj::do_read_symbols): Adjust section links.
14880         (Sized_relobj::symbol_section_and_value): Add is_ordinary
14881         parameter.  Change all callers.
14882         (Sized_relobj::include_section_group): Adjust section links and
14883         symbol section indexes.
14884         (Sized_relobj::do_layout): Adjust section links.
14885         (Sized_relobj::do_count_local_symbols): Adjust section links and
14886         symbol section indexes.
14887         (Sized_relobj::do_finalize_local_symbols): Distinguish between
14888         ordinary and special symbols.
14889         (Sized_relobj::write_local_symbols): Add symtab_xindex and
14890         dynsym_xindex parameters.  Change all callers.  Adjust section
14891         links.  Use SHN_XINDEX when needed.
14892         (Sized_relobj::get_symbol_location_info): Adjust section links.
14893         Don't get fooled by special symbols.
14894         * object.h (class Xindex): Define.
14895         (class Object): Add xindex_ parameter.  Declare virtual functoin
14896         do_initialize_xindex.
14897         (Object::adjust_sym_shndx): New function.
14898         (Object::set_xindex): New protected function.
14899         (class Symbol_value): Add is_ordinary_shndx_ field.
14900         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
14901         (Symbol_value::value): Assert ordinary section.
14902         (Symbol_value::initialize_input_to_output_map): Likewise.
14903         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
14904         Change all callers.
14905         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
14906         all callers.
14907         (class Sized_relobj): Update declarations.
14908         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
14909         parameter.  Change all callers.
14910         (Sized_relobj::adjust_shndx): New function.
14911         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
14912         field.
14913         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
14914         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
14915         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
14916         (Sized_dynobj::read_dynsym_section): Adjust section links.
14917         (Sized_dynobj::read_dynamic): Likewise.
14918         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
14919         section links.
14920         (Sized_dynobj::do_initialize_xindex): New function.
14921         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
14922         do_initialize_xindex.
14923         (Sized_dynobj::adjust_shndx): New function.
14924         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
14925         dynsym_xindex_ fields.
14926         (Layout::finalize): Add a call to set_section_indexes before
14927         creating the symtab sections.
14928         (Layout::set_section_indexes): Don't do anything if the section
14929         already has a section index.
14930         (Layout::create_symtab_sections): Add shnum parameter.  Change
14931         caller.  Create .symtab_shndx section if needed.
14932         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
14933         caller.
14934         (Layout::allocated_output_section_count): New function.
14935         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
14936         needed.
14937         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
14938         fields.  Update declarations.
14939         (Layout::symtab_xindex): New function.
14940         (Layout::dynsym_xindex): New function.
14941         (class Write_symbols_task): Add layout_ field.
14942         (Write_symbols_task::Write_symbols_task): Add layout parameter.
14943         Change caller.
14944         * output.cc (Output_section_headers::Output_section_headers): Add
14945         shstrtab_section parameter.  Change all callers.
14946         (Output_section_headers::do_sized_write): Store overflow values
14947         for section count and section string table section index in
14948         section header zero.
14949         (Output_file_header::do_sized_write): Check for overflow of
14950         section count and section string table section index.
14951         (Output_symtab_xindex::do_write): New function.
14952         (Output_symtab_xindex::endian_do_write): New function.
14953         * output.h (class Output_section_headers): Add shstrtab_section_.
14954         Update declarations.
14955         (class Output_symtab_xindex): Define.
14956         (Output_section::has_out_shndx): New function.
14957         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
14958         field.
14959         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
14960         Change all callers.
14961         (Sized_symbol::init): Likewise.
14962         (Symbol::output_section): Check for ordinary symbol.
14963         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
14964         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
14965         callers.
14966         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
14967         Change all callers.  Simplify handling of symbols from sections
14968         not included in the link.
14969         (Symbol_table::add_from_dynobj): Handle ordinary symbol
14970         distinction.
14971         (Weak_alias_sorter::operator()): Assert that symbols are
14972         ordinary.
14973         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
14974         distinction.
14975         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
14976         parameters.  Change all callers.
14977         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
14978         symbol distinction.  Use SHN_XINDEX when needed.
14979         (Symbol_table::write_section_symbol): Add symtab_xindex
14980         parameter.  Change all callers.
14981         (Symbol_table::sized_write_section_symbol): Likewise.  Use
14982         SHN_XINDEX when needed.
14983         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
14984         declarations.
14985         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
14986         (Symbol::is_defined): Check is_ordinary.
14987         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
14988         (Symbol::is_absolute, Symbol::is_common): Likewise.
14989         (class Sized_symbol): Update declarations.
14990         (class Symbol_table): Update declarations.
14991         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
14992         parameters.  Change all callers.
14993         (Sized_symbol::override): Likewise.
14994         (Symbol_table::override): Likewise.
14995         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
14996         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
14997         is_ordinary, and orig_st_shndx parameters.  Change all callers.
14998         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
14999         to be in an ordinary section.
15000         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
15001         object and is_ordinary parameters.  Change all callers.
15002         (Sized_dwarf_line_info::read_relocs): Add object parameter.
15003         Change all callers.  Don't add undefined or non-ordinary symbols
15004         to reloc_map_.
15005         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
15006         Change all callers.
15007         * dwarf_reader.h (class Sized_dwarf_line_info): Update
15008         declarations.
15009         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
15010         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
15011         (Sized_relobj::relocate_sections): Likewise.
15012         * target-reloc.h (scan_relocs): Adjust section symbol index.
15013         (scan_relocatable_relocs): Likewise.
15014         * i386.cc (Scan::local): Check for ordinary symbols.
15015         * sparc.cc (Scan::local): Likewise.
15016         * x86_64.cc (Scan::local): Likewise.
15017         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
15018         to symbol_section_and_value.
15019         * testsuite/many_sections_test.cc: New file.
15020         * testsuite/Makefile.am (BUILT_SOURCES): Define.
15021         (check_PROGRAMS): Add many_sections_test.
15022         (many_sections_test_SOURCES): Define.
15023         (many_sections_test_DEPENDENCIES): Define.
15024         (many_sections_test_LDFLAGS): Define.
15025         (BUILT_SOURCES): Add many_sections_define.h.
15026         (many_sections_define.h): New target.
15027         (BUILT_SOURCES): Add many_sections_check.h.
15028         (many_sections_check.h): New target.
15029         (check_PROGRAMS): Add many_sections_r_test.
15030         (many_sections_r_test_SOURCES): Define.
15031         (many_sections_r_test_DEPENDENCIES): Define.
15032         (many_sections_r_test_LDFLAGS): Define.
15033         (many_sections_r_test_LDADD): Define.
15034         (many_sections_r_test.o): New target.
15035         * testsuite/Makefile.in: Rebuild.
15036
15037 2008-04-17  Cary Coutant  <ccoutant@google.com>
15038
15039         * errors.cc (Errors::info): New function.
15040         (gold_info): New function.
15041         * errors.h (Errors::info): New function.
15042         * gold.h (gold_info): New function.
15043         * object.cc (Input_objects::add_object): Print trace output.
15044         * options.cc (options::parse_set): New function.
15045         (General_options::parse_wrap): Deleted.
15046         (General_options::General_options): Deleted initializer.
15047         * options.h (options::String_set): New typedef.
15048         (options::parse_set): New function.
15049         (DEFINE_set): New macro.
15050         (General_options::wrap): Changed to use DEFINE_set. Changed
15051         callers of any_wrap_symbols and is_wrap_symbol.
15052         (General_options::trace, General_options::trace_symbol):
15053         New options.
15054         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
15055         (General_options::wrap_symbols_): Deleted.
15056         * symtab.cc (Symbol_table::add_from_object): Print trace output.
15057
15058 2008-04-17  David S. Miller  <davem@davemloft.net>
15059
15060         * options.cc (General_options::parse_V): New function.
15061         * options.h: Add entries for -V and -Qy.
15062
15063 2008-04-17  Ian Lance Taylor  <iant@google.com>
15064
15065         * common.cc (Symbol_table::allocate_commons): Remove options
15066         parameter.  Change caller.
15067         (Symbol_table::do_allocate_commons): Remove options parameter.
15068         Change caller.  Just call do_allocate_commons_list twice.
15069         (Symbol_table::do_allocate_commons_list): New function, broken out
15070         of do_allocate_commons.
15071         * common.h (class Allocate_commons_task): Remove options_ field.
15072         Update constructor.
15073         * symtab.cc (Symbol_table::Symbol_table): Initialize
15074         tls_commons_.
15075         (Symbol_table::add_from_object): Put TLS common symbols on
15076         tls_commons_ list.
15077         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
15078         which are IN_OUTPUT_DATA.
15079         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
15080         allocate_commons and do_allocate_commons declarations.  Declare
15081         do_allocate_commons_list.
15082         * gold.cc (queue_middle_tasks): Update creation of
15083         Allocate_commons_task to not pass options.
15084         * testsuite/Makefile.am (INCLUDES): Add -I.. .
15085         (TLS_TEST_C_FLAGS): New variable.
15086         (tls_test_c_pic.o): New target.
15087         (tls_test_shared.so): Link in tls_test_c_pic.o.
15088         (tls_test_c_pic_ie.o): New target.
15089         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
15090         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
15091         (tls_test_c.o): New target.
15092         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
15093         (tls_pic_test_LDADD): Likewise.
15094         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
15095         (tls_shared_gd_to_ie_test_LDADD): Likewise.
15096         (tls_test_c_gnu2.o): New target.
15097         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
15098         tls_test_c_gnu2.o.
15099         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
15100         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
15101         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
15102         * testsuite/tls_test.cc: Include "config.h".
15103         (t_last): Call t11_last.
15104         * testsuite/tls_test.h (t11, t11_last): Declare.
15105         * testsuite/tls_test_c.c: New file.
15106         * testsuite/tls_test_main.cc (thread_routine): Call t11.
15107         * configure.ac: Check for OpenMP support.
15108         * configure, config.in, Makefile.in: Rebuild.
15109         * testsuite/Makefile.in: Rebuild.
15110
15111 2008-04-16  Cary Coutant  <ccoutant@google.com>
15112
15113         * i386.cc (Target_i386::define_tls_base_symbol): New function.
15114         (Target_i386::tls_base_symbol_defined_): New field.
15115         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
15116         (Target_i386::Scan::global): Likewise.
15117         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
15118         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
15119         (Target_x86_64::tls_base_symbol_defined_): New field.
15120         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
15121         (Target_x86_64::Scan::global): Likewise.
15122
15123 2008-04-16  Cary Coutant  <ccoutant@google.com>
15124
15125         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
15126         (Symbol::needs_plt_entry): Allow weak undefined symbols.
15127         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
15128         building shared libraries.
15129         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
15130         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
15131         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
15132         * testsuite/Makefile.in: Rebuild.
15133         * testsuite/weak_undef.h: New file.
15134         * testsuite/weak_undef_file1.cc: Add extra test cases.
15135         * testsuite/weak_undef_file2.cc: Likewise.
15136         * testsuite/weak_undef_test.cc: Likewise.
15137
15138 2008-04-16  David S. Miller  <davem@davemloft.net>
15139
15140         * sparc.cc (Target_sparc::Scan): Change from struct to class.
15141         Add issued_non_pic_error_ field.  Declare check_non_pic.
15142         (Target_sparc::Scan::check_non_pic): New function.
15143         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
15144         (Target_sparc::Scan::global): Likewise.
15145
15146         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
15147         * configure: Rebuild.
15148
15149         * options.h (DEFINE_enable): New macro.
15150         (new_dtags): New enable option.
15151         (initfirst, interpose, loadfltr, nodefaultlib,
15152         nodelete, nodlopen, nodump): New -z options.
15153         * layout.cc (Layout:finish_dynamic_section): If new
15154         dtags enabled, emit DT_RUNPATH.  Also, emit a
15155         DT_FLAGS_1 containing any specified -z flags.
15156
15157 2008-04-16  Ian Lance Taylor  <iant@google.com>
15158
15159         * copy-relocs.cc: New file.
15160         * copy-relocs.h: New file.
15161         * reloc.cc: Remove Copy_relocs code.
15162         * reloc.h: Likewise.
15163         * reloc-types.h (struct Reloc_types) [both versions]: Add
15164         get_reloc_addend_noerror.
15165         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
15166         variants of add_global which take an addend which must be zero.
15167         * i386.cc: Include "copy-relocs.h".
15168         (class Target_i386): Change type of copy_relocs_ to variable,
15169         update initializer.
15170         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
15171         Change all callers.
15172         (Target_i386::do_finalize_sections): Change handling of
15173         copy_relocs_.
15174         * sparc.cc: Include "copy-relocs.h".
15175         (class Target_sparc): Change type of copy_relocs_ to variable,
15176         update initializer.
15177         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
15178         Change all callers.
15179         (Target_sparc::do_finalize_sections): Change handling of
15180         copy_relocs_.
15181         * x86_64.cc: Include "copy-relocs.h".
15182         (class Target_x86_64): Change type of copy_relocs_ to variable,
15183         update initializer.
15184         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
15185         class.  Change all callers.
15186         (Target_x86_64::do_finalize_sections): Change handling of
15187         copy_relocs_.
15188         * Makefile.am (CCFILES): Add copy-relocs.cc.
15189         (HFILES): Add copy-relocs.h.
15190
15191         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
15192
15193         * testsuite/script_test_4.sh: Permit leading zeroes.
15194
15195 2008-04-15  Ian Lance Taylor  <iant@google.com>
15196
15197         * script-sections.cc (Script_sections::create_segments): Use
15198         header_size_adjustment even when there is enough room for the
15199         headers.
15200         * testsuite/script_test_4.sh: New file.
15201         * testsuite/script_test_4.t: New file.
15202         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
15203         (check_DATA): Add script_test_4.stdout.
15204         (MOSTLYCLEANFILES): Likewise.
15205         (script_test_4): New target.
15206         (script_test_4.stdout): New target.
15207         * testsuite/Makefile.in: Rebuild.
15208
15209         * sparc.cc: Add definitions for Output_data_plt_sparc class
15210         constants.
15211
15212 2008-04-14  David S. Miller  <davem@davemloft.net>
15213
15214         * sparc.cc: New file.
15215         * Makefile.am (TARGETSOURCES): Add sparc.cc
15216         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
15217         * configure.tgt: Document targ_extra_size and
15218         targ_extra_big_endian.  Add entries for sparc-* and
15219         sparc64-*.
15220         * configure.ac: Handle targ_extra_size and
15221         targ_extra_big_endian.
15222         * Makefile.in: Rebuild.
15223         * configure: Likewise.
15224         * po/POTFILES.in: Likewise.
15225         * po/gold.pot: Likewise.
15226
15227 2008-04-14  Ian Lance Taylor  <iant@google.com>
15228
15229         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
15230         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
15231         in the name/type/flags to section mapping.  Don't call
15232         allocate_output_section.
15233         (Layout::choose_output_section): Change parameter from adjust_name
15234         to is_input_section.  Don't permit input sections after sections
15235         are attached to segments.  Don't call allocate_output_section.
15236         (Layout::layout_eh_frame): Call update_flags_for_input_section,
15237         not write_enable_output_section.
15238         (Layout::make_output_section): Don't push to
15239         unattached_section_list_ nor call attach_to_segment.  Call
15240         attach_section_to_segment if sections are attached.
15241         (Layout::attach_sections_to_segments): New function.
15242         (Layout::attach_section_to_segment): New function.
15243         (Layout::attach_allocated_section_to_segment): Rename from
15244         attach_to_segment.  Remove flags parameter.
15245         (Layout::allocate_output_section): Remove function.
15246         (Layout::write_enable_output_section): Remove function.
15247         * layout.h (class Layout): Update for above changes.  Add new
15248         field sections_are_attached_.
15249         * output.h (Output_section::update_flags_for_input_section): New
15250         function.
15251         * output.cc (Output_section::add_input_section): Call
15252         update_flags_for_input_section.
15253         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
15254
15255 2008-04-11  Cary Coutant  <ccoutant@google.com>
15256
15257         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
15258         thought unnecessary.
15259         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
15260
15261 2008-04-11  Ian Lance Taylor  <iant@google.com>
15262
15263         * output.h (class Output_section_data): Remove inline definition
15264         of set_addralign.
15265         * output.cc (Output_section_data::set_addralign): New function.
15266
15267 2008-04-11  Cary Coutant  <ccoutant@google.com>
15268
15269         Add support for TLS descriptors for i386 and x86_64.
15270         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
15271         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
15272         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
15273         GOT_TYPE_TLS_DESC.
15274         (Target_i386::got_mod_index_entry): Remove unnecessary code.
15275         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
15276         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
15277         relocations.
15278         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
15279         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
15280         Fix problem with initial-exec relocations.
15281         (Target_i386::Relocate::relocate_tls): Likewise.
15282         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
15283         relaxation.
15284         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
15285         support for section-plus-offset dynamic table entries.
15286         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
15287         (Output_data_dynamic::Dynamic_entry): Add support for
15288         section-plus-offset dynamic table entries.
15289         (Output_data_dynamic::Classification): Likewise.
15290         (Output_data_dynamic::classification_): Renamed offset_.
15291         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
15292         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
15293         (Target_x86_64::make_plt_section): New function.
15294         (Target_x86_64::reserve_tlsdesc_entries): New function.
15295         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
15296         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
15297         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
15298         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
15299         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
15300         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
15301         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
15302         add extra PLT entry for TLS descriptors.
15303         (Output_data_plt_x86_64::got_): New field.
15304         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
15305         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
15306         fields.
15307         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
15308         descriptors.
15309         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
15310         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
15311         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
15312         R_386_TLS_DESC_CALL relocations.
15313         (Target_x86_64::Scan::global): Likewise.
15314         (Target_x86_64::do_finalize_sections): Add dynamic table entries
15315         for TLS descriptors.
15316         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
15317         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
15318         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
15319         GD-to-IE relaxation.
15320         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
15321         and TLS_DESCRIPTORS.
15322         * Makefile.in: Rebuild.
15323         * configure: Rebuild.
15324         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
15325         (tls_test_shared2.so): New target.
15326         (tls_shared_gd_to_ie_test_SOURCES): New variable.
15327         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
15328         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
15329         (tls_shared_gd_to_ie_test_LDADD): New variable.
15330         (tls_shared_gnu2_gd_to_ie_test): New target.
15331         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
15332         New targets.
15333         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
15334         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
15335         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
15336         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
15337         (tls_shared_gnu2_test): New target.
15338         (tls_test_gnu2_shared.so): New target.
15339         (tls_shared_gnu2_test_SOURCES): New variable.
15340         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
15341         (tls_shared_gnu2_test_LDFLAGS): New variable.
15342         (tls_shared_gnu2_test_LDADD): New variable.
15343         * testsuite/Makefile.in: Rebuild.
15344         * testsuite/Makefile.
15345
15346 2008-04-11  Ian Lance Taylor  <iant@google.com>
15347
15348         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
15349         justsyms.t.
15350         * testsuite/Makefile.in: Rebuild.
15351
15352         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
15353         long.
15354         * testsuite/script_test_2.cc (main): Adjust test.
15355
15356 2008-04-11  David S. Miller  <davem@davemloft.net>
15357             Ian Lance Taylor  <iant@google.com>
15358
15359         * options.h (General_options): Add entries for '-Y' and
15360         '-relax'.
15361         * options.cc (General_options:finalize): If -Y was used, add those
15362         entries to the library path instead of the default "/lib" and
15363         "/usr/lib".
15364
15365 2008-04-11  David S. Miller  <davem@davemloft.net>
15366
15367         * testsuite/justsyms.t: Start at 0x100.
15368         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
15369         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
15370         long.
15371         * testsuite/script_test_2.cc: Adjust string and section length
15372         checks.
15373
15374 2008-04-09  Ian Lance Taylor  <iant@google.com>
15375
15376         PR gold/5996
15377         * script-sections.cc (Sections_element::allocate_to_segment): Add
15378         orphan parameter.
15379         (Output_section_definition::allocate_to_segment): Likewise.
15380         (Orphan_output_section::allocate_to_segment): Likewise.
15381         (Script_sections::attach_sections_using_phdrs_clause): Don't
15382         propagate non-PT_LOAD segments to orphan sections.
15383         * testsuite/Makefile.am (script_test_3.stdout): Generate using
15384         readelf rather than objdump.
15385         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
15386         .interp section and PT_INTERP segment are the same size.
15387         * testsuite/Makefile.in: Rebuild.
15388
15389         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
15390         aliases for symbols defined in the same object.
15391         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
15392         (weak_alias_test_SOURCES): New variable.
15393         (weak_alias_test_DEPENDENCIES): New variable.
15394         (weak_alias_test_LDFLAGS): New variable.
15395         (weak_alias_test_LDADD): New variable.
15396         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
15397         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
15398         (weak_alias_test_3.o): New target.
15399         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
15400         * testsuite/weak_alias_test_main.cc: New file.
15401         * testsuite/weak_alias_test_1.cc: New file.
15402         * testsuite/weak_alias_test_2.cc: New file.
15403         * testsuite/weak_alias_test_3.cc: New file.
15404
15405 2008-04-08  Ian Lance Taylor  <iant@google.com>
15406
15407         * options.h (class General_options): Add --noinhibit-exec option.
15408         * main.cc (main): Check --noinhibit-exec.
15409
15410         * options.h (class General_options): Define --wrap as a special
15411         option.  Add wrap_symbols_ field.
15412         (General_options::any_wrap_symbols): New function.
15413         (General_options::is_wrap_symbol): New function.
15414         * options.cc (General_options::parse_wrap): New function.
15415         (General_options::General_options): Initialize wrap_symbols_.
15416         * symtab.cc (Symbol_table::wrap_symbol): New function.
15417         (Symbol_table::add_from_object): Handle --wrap.
15418         * symtab.h (class Symbol_table): Declare wrap_symbol.
15419         * target.h (Target::wrap_char): New function.
15420         (Target::Target_info): Add wrap_char field.
15421         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
15422         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
15423         * testsuite/testfile.cc (Target_test::test_target_info):
15424         Likewise.
15425
15426         * errors.cc (Errors::undefined_symbol): Mention symbol version if
15427         there is one.
15428
15429         * layout.h (class Layout): Add added_eh_frame_data_ field.
15430         * layout.cc (Layout::Layout): Initialize new field.
15431         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
15432         output section until we find a section we merged successfully.
15433         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
15434         that the size be non-zero.
15435
15436         * merge.cc (Object_merge_map::get_output_offset): Remove inline
15437         qualifier.
15438
15439 2008-04-08  Craig Silverstein  <csilvers@google.com>
15440
15441         * configure.ac: Export new conditional variable HAVE_ZLIB.
15442         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
15443         on HAVE_ZLIB.
15444         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
15445         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15446
15447 2008-04-07  Ian Lance Taylor  <iant@google.com>
15448
15449         * version.cc (version_string): Set to "1.5".
15450
15451         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
15452         Add issued_non_pic_error_ field.  Declare check_non_pic.
15453         (Target_x86_64::Scan::check_non_pic): New function.
15454         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
15455         (Target_x86_64::Scan::global): Likewise.
15456
15457         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
15458         addend parameter.  Change caller.  Handle merge sections.
15459         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
15460         Address to Addend.  Don't add in the result of
15461         local_section_offset, pass down the addend and use the returned
15462         value.
15463         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
15464         Update declarations of local_section_offset and symbol_value.
15465         * testsuite/two_file_test_1.cc (t18): New function.
15466         * testsuite/two_file_test_2.cc (f18): New function.
15467         * testsuite/two_file_test_main.cc (main): Call t18.
15468         * testsuite/two_file_test.h (t18, f18): Declare.
15469
15470         * configure.ac: Don't test for objdump, c++filt, or readelf.
15471         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
15472         conditionals.
15473         (TEST_READELF): New variable.
15474         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
15475         (check_PROGRAMS): Add two_file_strip_test.
15476         (two_file_strip_test): New target.
15477         (check_PROGRAMS): Add two_file_same_shared_strip_test.
15478         (two_file_same_shared_strip_test_SOURCES): New variable.
15479         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
15480         (two_file_same_shared_strip_test_LDFLAGS): New variable.
15481         (two_file_same_shared_strip_test_LDADD): New variable.
15482         (two_file_shared_strip.so): New target.
15483         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
15484         (ver_test_5.syms, ver_test_7.syms): Likewise.
15485         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
15486         (strip_test_3.stdout): Use TEST_OBJDUMP.
15487         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15488
15489 2008-04-04  Cary Coutant  <ccoutant@google.com>
15490
15491         * symtab.h (Symbol::is_weak_undefined): New function.
15492         (Symbol::is_strong_undefined): New function.
15493         (Symbol::is_absolute): New function.
15494         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
15495         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
15496         absolute symbols.
15497         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
15498         (weak_undef_test): New target.
15499         * testsuite/Makefile.in: Rebuild.
15500         * testsuite/weak_undef_file1.cc: New file.
15501         * testsuite/weak_undef_file2.cc: New file.
15502         * testsuite/weak_undef_test.cc: New file.
15503
15504 2008-04-03  Craig Silverstein  <csilvers@google.com>
15505
15506         * compressed_output.h (class Output_compressed_section): Use
15507         unsigned buffer.
15508         * compressed_output.cc (zlib_compress): Use unsigned buffers,
15509         add zlib header.
15510         (zlib_compressed_suffix): Removed.
15511         (Output_compressed_section::set_final_data_size): Use unsigned
15512         buffers.
15513         * testsuite/Makefile.am (flagstest_compress_debug_sections):
15514         Fix linker invocation.
15515         (flagstest_o_specialfile_and_compress_debug_sections):
15516         Likewise.
15517         * testsuite/Makefile.in: Regenerated.
15518
15519 2008-04-02  David S. Miller  <davem@davemloft.net>
15520
15521         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
15522         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
15523
15524 2008-04-02  Craig Silverstein  <csilvers@google.com>
15525
15526         * TODO: New file.
15527
15528 2008-04-02  Ian Lance Taylor  <iant@google.com>
15529
15530         * fileread.cc (File_read::find_view): Add byteshift and vshifted
15531         parameters.  Update for new key type to views_.  Change all
15532         callers.
15533         (File_read::read): Adjust for byteshift in returned view.
15534         (File_read::add_view): New function, broken out of
15535         find_and_make_view.
15536         (File_read::make_view): New function, broken out of
15537         find_and_make_view.
15538         (File_read::find_or_make_view): Add offset and aligned
15539         parameters.  Rewrite accordingly.  Change all callers.
15540         (File_read::get_view): Add offset and aligned parameters.  Adjust
15541         for byteshift in return value.
15542         (File_read::get_lasting_view): Likewise.
15543         * fileread.h (class File_read): Update declarations.
15544         (class File_read::View): Add byteshift_ field.  Add byteshift to
15545         constructor.  Add byteshift method.
15546         * archive.h (Archive::clear_uncached_views): New function.
15547         (Archive::get_view): Add aligned parameter.  Change all callers.
15548         * object.h (Object::get_view): Add aligned parameter.  Change all
15549         callers.
15550         (Object::get_lasting_view): Likewise.
15551
15552         * fileread.cc (File_read::release): Don't call clear_views if
15553         there are multiple objects.
15554         * fileread.h (File_read::clear_uncached_views): New function.
15555         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
15556         on the archive.
15557
15558 2008-03-31  Cary Coutant  <ccoutant@google.com>
15559
15560         Add thin archive support.
15561         * archive.cc (Archive::armagt): New const.
15562         (Archive::setup): Remove task parameter and calls to unlock.
15563         (Archive::unlock_nested_archives): New function.
15564         (Archive::read_header): Add nested_off parameter. Change
15565         all callers.
15566         (Archive::interpret_header): Likewise.
15567         (Archive::include_all_members): Change to handle thin
15568         archives.
15569         (Archive::include_member): Likewise.
15570         * archive.h (Archive::Archive): Add new parameters and
15571         initializers.
15572         (Archive::armagt): New const.
15573         (Archive::setup): Remove task parameter.
15574         (Archive::unlock_nested_archives): New function.
15575         (Archive::read_header): Add nested_off parameter.
15576         (Archive::interpret_header): Likewise.
15577         (Archive::Nested_archive_table): New typedef.
15578         (Archive::is_thin_archive_): New field.
15579         (Archive::nested_archives_): New field.
15580         (Archive::options_): New field.
15581         (Archive::dirpath_): New field.
15582         (Archive::task_): New field.
15583         * readsyms.cc (Read_symbols::do_read_symbols): Add check
15584         for thin archives.  Pass additional parameters to
15585         Archive::Archive.  Unlock the archive file after calling
15586         Archive::setup.
15587
15588 2008-03-29  Ian Lance Taylor  <iant@google.com>
15589
15590         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
15591         version symbol to be local.
15592         * testsuite/ver_test_4.sh: New file.
15593         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
15594         (check_DATA): Add ver_test_4.syms.
15595         (ver_test_4.syms): New target.
15596         * testsuite/Makefile.in: Rebuild.
15597
15598         * output.cc
15599         (Output_section::Input_section_sort_entry::has_priority): New
15600         function.
15601         (Output_section::Input_section_sort_entry::match_file_name): New
15602         function.
15603         (Output_section::Input_section_sort_entry::match_section_name):
15604         Remove.
15605         (Output_section::Input_section_sort_entry::match_section_name_prefix):
15606         Remove.
15607         (Output_section::Input_section_sort_entry::match_section_file):
15608         Remove.
15609         (Output_section::Input_section_sort_compare::operator()): Rewrite
15610         using new Input_section_sort_entry functions.  Sort crtbegin and
15611         crtend first.  Sort sections with no priority before sections with
15612         a priority.
15613         * testsuite/initpri1.c (d3): Check j != 4.
15614         (cd5): New constructor/destructor function.
15615         (main): Check j != 2.
15616
15617         * symtab.cc (Symbol_table::add_from_object): If we don't use the
15618         new symbol when resolving, don't call set_is_default.
15619         * testsuite/ver_test_7.cc: New file.
15620         * testsuite/ver_test_7.sh: New file.
15621         * testsuite/Makefile.am (ver_test_7.so): New target.
15622         (ver_test_7.o): New target.
15623         (check_SCRIPTS): Add ver_test_7.sh.
15624         (check_DATA): Add ver_test_7.syms.
15625         (ver_test_7.syms): New target.
15626
15627 2008-03-28  Ian Lance Taylor  <iant@google.com>
15628
15629         * layout.cc (Layout::layout): If we see an input section with a
15630         name that needs sorting, set the must_sort flag for the output
15631         section.
15632         (Layout::make_output_section): If the name of the output section
15633         indicates that it might require sorting, set the may_sort flag.
15634         * output.h (Output_section::may_sort_attached_input_sections): New
15635         function.
15636         (Output_section::set_may_sort_attached_input_sections): New
15637         function.
15638         (Output_section::must_sort_attached_input_sections): New
15639         function.
15640         (Output_section::set_must_sort_attached_input_sections): New
15641         function.
15642         (class Output_section): Declare Input_section_sort_entry.  Define
15643         Input_section_sort_compare.  Declare
15644         sort_attached_input_sections.  Add new fields:
15645         may_sort_attached_input_sections_,
15646         must_sort_attached_input_sections_,
15647         attached_input_sections_are_sorted_.
15648         * output.cc (Output_section::Output_section): Initialize new
15649         fields.
15650         (Output_section::add_input_section): Add an entry to
15651         input_sections_ if may_sort or must_sort are true.
15652         (Output_section::set_final_data_size): Call
15653         sort_attached_input_sections if necessary.
15654         (Output_section::Input_section_sort_entry): Define new class.
15655         (Output_section::Input_section_sort_compare::operator()): New
15656         function.
15657         (Output_section::sort_attached_input_sections): New function.
15658         * configure.ac: Check whether the compiler supports constructor
15659         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
15660         * testsuite/initpri1.c: New file.
15661         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
15662         CONSTRUCTOR_PRIORITY.
15663         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
15664         (initpri1_LDFLAGS): New variable.
15665         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15666
15667 2008-03-27  Ian Lance Taylor  <iant@google.com>
15668
15669         * common.cc (Sort_commons::operator): Correct sorting algorithm.
15670         * testsuite/common_test_1.c: New file.
15671         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
15672         (common_test_1_SOURCES): New variable.
15673         (common_test_1_DEPENDENCIES): New variable.
15674         (common_test_1_LDFLAGS): New variable.
15675
15676         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
15677         and commons_ correctly when NAME/VERSION does not override
15678         NAME/NULL.
15679         * testsuite/ver_test_6.c: New file.
15680         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
15681         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
15682         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
15683
15684 2008-03-26  Ian Lance Taylor  <iant@google.com>
15685
15686         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
15687         of an undefined symbol from a version script.
15688         * testsuite/Makefile.am (ver_test_5.so): New target.
15689         (ver_test_5.o): New target.
15690         (check_SCRIPTS): Add ver_test_5.sh.
15691         (check_DATA): Add ver_test_5.syms.
15692         (ver_test_5.syms): New target.
15693         * testsuite/ver_test_5.cc: New file.
15694         * testsuite/ver_test_5.script: New file.
15695         * testsuite/ver_test_5.sh: New file.
15696         * Makefile.in, testsuite/Makefile.in: Rebuild.
15697
15698         PR gold/5986
15699         Fix problems building gold with gcc 4.3.0.
15700         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
15701         (gold_error_at_location, gold_warning_at_location): Use it.
15702         * configure.ac: Check whether we can compile and use a template
15703         function with a printf attribute.
15704         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
15705         when jumping over bytes.
15706         * object.cc: Instantiate Object::read_section_data.
15707         * debug.h: Include <cstring>
15708         * dwarf_reader.cc: Include <algorithm>
15709         * main.cc: Include <cstring>.
15710         * options.cc: Include <cstring>.
15711         * output.cc: Include <cstring>.
15712         * script.cc: Include <cstring>.
15713         * script.h: Include <string>.
15714         * symtab.cc: Include <cstring> and <algorithm>.
15715         * target-select.cc: Include <cstring>.
15716         * version.cc: Include <string>.
15717         * testsuite/testmain.cc: Include <cstdlib>.
15718         * configure, config.in: Rebuild.
15719
15720 2008-03-25  Ian Lance Taylor  <iant@google.com>
15721
15722         * options.cc: Include "../bfd/bfdver.h".
15723         (options::help): Print bug reporting address.
15724
15725         * version.cc (print_version): Adjust output for current value of
15726         BFD_VERSION_STRING.
15727
15728         * NEWS: New file.
15729
15730         * options.cc (options::help): Print list of supported targets.
15731         * target-select.h: Include <vector>.
15732         (class Target_selector): Make machine_, size_, and is_big_endian_
15733         fields const.  Add bfd_name_ and instantiated_target_ fields.
15734         (Target_selector::Target_selector): Add bfd_name parameter.
15735         (Target_selector::recognize): Make non-virtual, call
15736         do_recognize.
15737         (Target_selector::recognize_by_name): Make non-virtual, call
15738         do_recognize_by_name.
15739         (Target_selector::supported_names): New function.
15740         (Target_selector::bfd_name): New function.
15741         (Target_selector::do_instantiate_target): New pure virtual
15742         function.
15743         (Target_selector::do_recognize): New virtual function.
15744         (Target_selector::do_recognize_by_name): New virtual function.
15745         (Target_selector::instantiate_target): New private function.
15746         (supported_target_names): Declare.
15747         * target-select.cc (Target_selector::Target_selector): Update for
15748         new parameter and fields.
15749         (select_target_by_name): Check that the name matches before
15750         calling recognize_by_name.
15751         (supported_target_names): New function.
15752         * i386.cc (class Target_selector_i386): Update Target_selector
15753         constructor call.  Remove recognize and recognize_by_name.  Add
15754         do_instantiate_target.
15755         * x86_64.cc (class Target_selector_x86_64): Likewise.
15756         * testsuite/testfile.cc (class Target_selector_test): Update for
15757         changes to Target_selector.
15758
15759         * README: Rewrite, with some notes on unsupported features.
15760
15761 2008-03-24  Cary Coutant  <ccoutant@google.com>
15762
15763         * i386.cc (Target_i386::Got_type): New enum declaration.
15764         (Target_i386::Scan::local): Updated callers of Output_data_got
15765         member functions.
15766         (Target_i386::Scan::global): Likewise.
15767         (Target_i386::Relocate::relocate): Likewise.
15768         (Target_i386::Relocate::relocate_tls): Likewise.
15769         * object.h (Got_offset_list): New class.
15770         (Sized_relobj::local_has_got_offset): Added got_type parameter.
15771         (Sized_relobj::local_got_offset): Likewise.
15772         (Sized_relobj::set_local_got_offset): Likewise.
15773         (Sized_relobj::local_has_tls_got_offset): Removed.
15774         (Sized_relobj::local_tls_got_offset): Removed.
15775         (Sized_relobj::set_local_tls_got_offset): Removed.
15776         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
15777         * output.cc (Output_data_got::add_global): Added got_type parameter.
15778         (Output_data_got::add_global_with_rel): Likewise.
15779         (Output_data_got::add_global_with_rela): Likewise.
15780         (Output_data_got::add_global_pair_with_rel): New function.
15781         (Output_data_got::add_global_pair_with_rela): New function.
15782         (Output_data_got::add_local): Added got_type parameter.
15783         (Output_data_got::add_local_with_rel): Likewise.
15784         (Output_data_got::add_local_with_rela): Likewise.
15785         (Output_data_got::add_local_pair_with_rel): New function.
15786         (Output_data_got::add_local_pair_with_rela): New function.
15787         (Output_data_got::add_global_tls): Removed.
15788         (Output_data_got::add_global_tls_with_rel): Removed.
15789         (Output_data_got::add_global_tls_with_rela): Removed.
15790         (Output_data_got::add_local_tls): Removed.
15791         (Output_data_got::add_local_tls_with_rel): Removed.
15792         (Output_data_got::add_local_tls_with_rela): Removed.
15793         * output.h (Output_data_got::add_global): Added got_type parameter.
15794         (Output_data_got::add_global_with_rel): Likewise.
15795         (Output_data_got::add_global_with_rela): Likewise.
15796         (Output_data_got::add_global_pair_with_rel): New function.
15797         (Output_data_got::add_global_pair_with_rela): New function.
15798         (Output_data_got::add_local): Added got_type parameter.
15799         (Output_data_got::add_local_with_rel): Likewise.
15800         (Output_data_got::add_local_with_rela): Likewise.
15801         (Output_data_got::add_local_pair_with_rel): New function.
15802         (Output_data_got::add_local_pair_with_rela): New function.
15803         (Output_data_got::add_global_tls): Removed.
15804         (Output_data_got::add_global_tls_with_rel): Removed.
15805         (Output_data_got::add_global_tls_with_rela): Removed.
15806         (Output_data_got::add_local_tls): Removed.
15807         (Output_data_got::add_local_tls_with_rel): Removed.
15808         (Output_data_got::add_local_tls_with_rela): Removed.
15809         * resolve.cc (Symbol::override_base_with_special): Removed
15810         reference to has_got_offset_ field.
15811         * symtab.cc (Symbol::init_fields): Replaced initialization
15812         of got_offset_ with got_offsets_.  Removed initialization
15813         of has_got_offset_
15814         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
15815         (Symbol::got_offset): Likewise.
15816         (Symbol::set_got_offset): Likewise.
15817         (Symbol::has_tls_got_offset): Removed.
15818         (Symbol::tls_got_offset): Removed.
15819         (Symbol::set_tls_got_offset): Removed.
15820         (Symbol::got_offset_): Removed.
15821         (Symbol::tls_mod_got_offset_): Removed.
15822         (Symbol::tls_pair_got_offset_): Removed.
15823         (Symbol::got_offsets_): New field.
15824         (Symbol::has_got_offset): Removed.
15825         (Symbol::has_tls_mod_got_offset): Removed.
15826         (Symbol::has_tls_pair_got_offset): Removed.
15827         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
15828         (Target_x86_64::Scan::local): Updated callers of Output_data_got
15829         member functions.
15830         (Target_x86_64::Scan::global): Likewise.
15831         (Target_x86_64::Relocate::relocate): Likewise.
15832         (Target_x86_64::Relocate::relocate_tls): Likewise.
15833
15834 2008-03-25  Ben Elliston  <bje@au.ibm.com>
15835
15836         * yyscript.y: Fix spelling error in comment.
15837
15838 2008-03-24  Ian Lance Taylor  <iant@google.com>
15839
15840         * options.h (class General_options): Define build_id option.
15841         * layout.h (class Layout): Declare write_build_id, create_note,
15842         create_build_id.  Add build_id_note_ member.
15843         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
15844         "libiberty.h", "md5.h", "sha1.h".
15845         (Layout::Layout): Initialize eh_frame_data_,
15846         eh_frame_hdr_section_, and build_id_note_.
15847         (Layout::finalize): Call create_build_id.
15848         (Layout::create_note): New function, broken out of
15849         Layout::create_gold_note.
15850         (Layout::create_gold_note): Call create_note.
15851         (Layout::create_build_id): New function.
15852         (Layout::write_build_id): New function.
15853         (Close_task_runner::run): Call write_build_id.
15854
15855         * x86_64.cc: Correct license to GPLv3.
15856
15857 2008-03-23  Ian Lance Taylor  <iant@google.com>
15858
15859         * options.cc: Include "demangle.h".
15860         (parse_optional_string): New function.
15861         (parse_long_option): Handle takes_optional_argument.
15862         (parse_short_option): Update dash_z initializer.  Handle
15863         takes_optional_argument.
15864         (General_options::General_options): Initialize do_demangle_.
15865         (General_options::finalize): Set do_demangle_.  Handle demangling
15866         style.
15867         * options.h (parse_optional_string): Declare.
15868         (struct One_option): Add optional_arg field.  Update constructor.
15869         Update call constructor calls.  Add takes_optional_argument
15870         function.
15871         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
15872         (DEFINE_optional_string): Define.
15873         (General_options::demangle): Change from DEFINE_bool to
15874         DEFINE_optional_string.
15875         (General_options::no_demangle): New function.
15876         (General_options::do_demangle): New function.
15877         (General_options::set_do_demangle): New function.
15878         (General_options::execstack_status_): Move definition to end of
15879         class definition.
15880         (General_options::static_): Likewise.
15881         (General_options::do_demangle_): New field.
15882         * object.cc (big_endian>::get_symbol_location_info): Call
15883         Options::do_demangle, not Options::demangle.
15884         * symtab.cc (demangle): Likewise.
15885
15886 2008-03-22  Ian Lance Taylor  <iant@google.com>
15887
15888         * gold.h: Include <cstddef> and <sys/types.h>
15889         * options.h: Include <cstring>.
15890
15891 2008-03-21  Ian Lance Taylor  <iant@google.com>
15892
15893         * Added source code to GNU binutils.
15894 \f
15895 Copyright (C) 2008-2014 Free Software Foundation, Inc.
15896
15897 Copying and distribution of this file, with or without modification,
15898 are permitted in any medium without royalty provided the copyright
15899 notice and this notice are preserved.
15900
15901 Local Variables:
15902 mode: change-log
15903 left-margin: 8
15904 fill-column: 74
15905 version-control: never
15906 End: