Modify new gold test to pass on powerpc64le
[platform/upstream/binutils.git] / gold / ChangeLog
1 2014-08-06  Alan Modra  <amodra@gmail.com>
2
3         * testsuite/defsym_test.sh: Allow ppc64le localentry annotation.
4
5 2014-08-06  Alan Modra  <amodra@gmail.com>
6
7         PR 13227
8         * symtab.cc (Symbol_table::add_from_relobj): Warn on __gnu_lto_slim.
9
10 2014-07-21  Sriraman Tallam  <tmsriram@google.com>
11
12         * object.cc (Relobj::is_section_name_included): Add
13         ".rodata.nptl_version" to not garbage collect this section.
14
15 2014-07-08  Cary Coutant  <ccoutant@google.com>
16
17         * expression.cc (struct Expression::Expression_eval_info): Add
18         new fields type_pointer, vis_pointer, and nonvis_pointer.
19         (Expression::eval_maybe_dot): Add type_pointer, vis_pointer, and
20         nonvis_pointer parameters. Adjust all calls.
21         (Symbol_expression::value): Update type, visibility, and nonvis bits
22         in caller.
23         * script.cc (Symbol_assignment::sized_finalize): Update type,
24         visibility, and remaining st_other bits for new symbol.
25         * script.h: (Expression::eval_maybe_dot): Add type_pointer,
26         vis_pointer, and nonvis_pointer parameters.
27         * symtab.h (Symbol::set_type): New method.
28
29         * testsuite/Makefile.am (defsym_test): New test.
30         * testsuite/Makefile.in: Regenerate.
31         * testsuite/defsym_test.c: New file.
32         * testsuite/defsym_test.sh: New file.
33
34 2014-07-08  Cary Coutant  <ccoutant@google.com>
35
36         PR gold/15639
37         * dynobj.h (Sized_dynobj::base_read_symbols): New method.
38         * dynobj.cc (Sized_dynobj::do_read_symbols): Move body to...
39         (Sized_dynobj::base_read_symbols): ...new method.
40         * object.h (Sized_relobj_file::base_read_symbols): New method.
41         * object.cc (Sized_relobj_file::do_read_symbols): Move body to...
42         (Sized_relobj_file::base_read_symbols): ...new method.
43         * arm.cc (Arm_relobj::do_read_symbols): Call base_read_symbols.
44         * mips.cc: (Mips_relobj::do_read_symbols): Likewise.
45         * powerpc.cc (Powerpc_dynobj::do_read_symbols): Likewise.
46
47 2014-07-04  Alan Modra  <amodra@gmail.com>
48
49         * po/POTFILES.in: Regenerate.
50
51 2014-07-02  Jing Yu  <jingyu@google.com>
52
53         * aarch64.cc: New file
54         * Makefile.am (TARGETSOURCES): Add aarch64.cc
55         (ALL_TARGETOBJS): Add aarch64.$(OBJEXT)
56         * Makefile.in: Regenerate.
57         * configure.tgt: Add entries for aarch64*.
58         * configure.ac:  Likewise.
59         * configure: Likewise.
60
61 2014-06-27  Alan Modra  <amodra@gmail.com>
62
63         * symtab.cc (Symbol::should_add_dynsym_entry): Don't make inline.
64
65 2014-06-24  Cary Coutant  <ccoutant@google.com>
66
67         * dwp.cc (Dwo_file::read): Allow files with no .debug_types
68         sections.
69         (Dwo_file::sized_read_unit_index): Likewise.
70
71 2014-06-23  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
72
73         * mips.cc: New file.
74         * Makefile.am (TARGETSOURCES): Add mips.cc
75         (ALL_TARGETOBJS): Add mips.$(OBJEXT)
76         * configure.tgt: Add entries for mips*.
77         * configure.ac: Likewise.
78         * Makefile.in: Regenerate.
79         * configure: Likewise.
80
81 2014-06-09  Cary Coutant  <ccoutant@google.com>
82
83         * dwarf_reader.cc (Dwarf_pubnames_table::read_header): Check that
84         unit_length is within section bounds.
85
86 2014-06-09  Cary Coutant  <ccoutant@google.com>
87
88         PR gold/16980
89         * layout.cc (Layout::print_to_mapfile): Print unattached sections in
90         map.
91
92 2014-06-07  Alan Modra  <amodra@gmail.com>
93
94         * powerpc.cc (relocate): Treat field of cmpli insn as a bitfield.
95
96 2014-06-06  Cary Coutant  <ccoutant@google.com>
97
98         * dwarf_reader.h (Dwarf_pubnames_table): Remove output_section_offset_.
99         * dwarf_reader.cc (Dwarf_pubnames_table::read_section): Likewise.
100         (Dwarf_pubnames_table::read_header): Likewise.
101         * layout.cc (gdb_fast_lookup_sections): Add .debug_gnu_pubnames and
102         .debug_gnu_pubtypes.
103
104 2014-06-05  Joel Brobecker  <brobecker@adacore.com>
105
106         * Makefile.am (CONFIG_STATUS_DEPENDENCIES): New.
107         * Makefile.in, configure: Regenerate.
108
109 2014-06-03  Alan Modra  <amodra@gmail.com>
110
111         * powerpc.cc (addis_12_2): Define.
112         (Stub_table::do_write): Support fusion on ELFv2 stubs.
113
114 2014-06-03  Alan Modra  <amodra@gmail.com>
115
116         * testsuite/plugin_test.c (parse_readelf_line): Skip non-visibility
117         st_other output.
118
119 2014-06-02  Alan Modra  <amodra@gmail.com>
120
121         * powerpc.cc (Target_powerpc::local_reloc_may_be_function_pointer):
122         Only ignore relocs on ELFv1.
123         (Target_powerpc::global_reloc_may_be_function_pointer): Likewise.
124
125 2014-05-30  Cary Coutant  <ccoutant@google.com>
126
127         * testsuite/Makefile.am (ehdr_start_test_4): Fix typo in -B option.
128         * testsuite/Makefile.in: Regenerate.
129         * testsuite/ehdr_start_test_4.sh: Look for "U" instead of "w".
130
131 2014-05-27  H.J. Lu  <hongjiu.lu@intel.com>
132
133         PR gold/16945
134         * x86_64.cc (Target_x86_64::Relocate::relocate): Use signed int
135         for got_offset.  Properly get GOT address for R_X86_64_PLTOFF64.
136
137 2014-05-15  Alan Modra  <amodra@gmail.com>
138
139         * powerpc.cc (do_plt_fde_location): Handle zero length .glink.
140         Compare FDE contents with DW_CFA_nop rather than 0.
141
142 2014-05-13  Sriraman Tallam  <tmsriram@google.com>
143
144         * symtab.h (may_need_copy_reloc): Remove check for position independent
145         code.
146         * x86_64.cc (Target_x86_64<size>::Scan::global): Add check for no
147         position independence before pc absolute may_need_copy_reloc call.
148         Add check for executable output befor pc relative may_need_copy_reloc
149         call.
150         * i386.cc: Ditto.
151         * arm.cc: Ditto.
152         * sparc.cc: Ditto.
153         * tilegx.cc: Ditto.
154         * powerpc.cc: Add check for no position independence before
155         may_need_copy_reloc calls.
156         * testsuite/pie_copyrelocs_test.cc: New file.
157         * testsuite/pie_copyrelocs_shared_test.cc: New file.
158         * Makefile.am (pie_copyrelocs_test): New test.
159         * Makefile.in: Regenerate.
160
161 2014-05-08  Martin Liška  <mliska@suse.cz>
162
163         * output.cc (Sized_relobj_file::do_layout): Fix typo in info message.
164
165 2014-05-06  Cary Coutant  <ccoutant@google.com>
166
167         PR gold/16900
168         * i386.cc (Output_data_got_plt_i386): New class.
169         (Output_data_plt_i386::Output_data_plt_i386): Change type of got_plt
170         parameter. Change all callers.
171         (Output_data_plt_i386::layout_): Remove.
172         (Output_data_plt_i386::got_plt_): Change type.
173         (Target_i386::got_plt_): Change type. Change all references.
174         (Target_i386::got_section): Create instance of new class.
175         (Output_data_got_plt_i386::do_write): New function.
176         * x86_64.cc (Output_data_got_plt_x86_64): New class.
177         (Output_data_plt_x86_64::Output_data_plt_x86_64): Change type of got_plt
178         parameter. Change all callers.
179         (Output_data_plt_x86_64::layout_): Remove.
180         (Output_data_plt_x86_64::got_plt_): Change type.
181         (Target_x86_64::got_plt_): Change type. Change all references.
182         (Target_x86_64::got_section): Create instance of new class.
183         (Output_data_got_plt_x86_64::do_write): New function.
184         (Output_data_plt_x86_64::do_write): Don't write reserved words in GOT.
185         (Target_x86_64<size>::init_got_plt_for_update): Create instance of new
186         class.
187
188 2014-05-05  Cary Coutant  <ccoutant@google.com>
189
190         * gdb-index.cc (Gdb_index_info_reader): Don't complain about language
191         if we have pubnames/pubtypes.
192
193 2014-05-02  Cary Coutant  <ccoutant@google.com>
194
195         * defstd.cc (in_segment): Define __ehdr_start here...
196         * layout.cc (Layout::finalize): ...Instead of here.  Set the
197         output segment when known.
198         * resolve.cc (Symbol::override_base_with_special): Remember
199         the original binding.
200         * symtab.cc (Symbol::set_output_segment): New function.
201         (Symbol::set_undefined): New function.
202         * symtab.h (Symbol::is_weak_undefined): Check original undef
203         binding.
204         (Symbol::is_strong_undefined): New function.
205         (Symbol::set_output_segment): New function.
206         (Symbol::set_undefined): New function.
207         * target-reloc.h (is_strong_undefined): Remove.
208         (issue_undefined_symbol_error): Call Symbol::is_weak_undefined.
209         Check for hidden undefs.
210         (relocate_section): Call Symbol::is_strong_undefined.
211
212         * testsuite/Makefile.am (ehdr_start_test_1)
213         (ehdr_start_test_2, ehdr_start_test_3)
214         (ehdr_start_test_4, ehdr_start_test_5): New test cases.
215         * testsuite/Makefile.in: Regenerate.
216         * testsuite/ehdr_start_def.cc: New source file.
217         * testsuite/ehdr_start_test.cc: New source file.
218         * testsuite/ehdr_start_test.t: New linker script.
219         * testsuite/ehdr_start_test_4.sh: New shell script.
220
221 2014-04-23  Cary Coutant  <ccoutant@google.com>
222
223         PR gold/16870
224         * x86_64.cc (Target_x86_64::Relocate::relocate): Add missing break.
225
226 2014-04-15  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
227
228         * layout.cc (Layout::include_section): Allow a target to decide
229         whether to include a section.
230         * target.h (Target::should_include_section): New function.
231         (Target::do_should_include_section): New function.
232
233 2014-04-15  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
234
235         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Remove and
236         inline into ...
237         (Copy_relocs::emit): ... here.
238         * copy-relocs.h (Copy_reloc_entry): Change from class to struct.
239         (Copy_reloc_entry::make_copy_reloc): Change from private to protected.
240         (Copy_reloc_entry::entries_): Change from private to protected.
241
242 2014-04-02  Sriraman Tallam  <tmsriram@google.com>
243
244         * icf.cc (get_section_contents): Replace copies of reloc
245         vectors with const references.
246
247 2014-04-02  Cary Coutant  <ccoutant@google.com>
248
249         * configure.ac (HAVE_PUBNAMES): Use C instead of C++.
250         (HAVE_NO_USE_LINKER_PLUGIN): Check for -fno-use-linker-plugin.
251         * configure: Regenerate.
252         * testsuite/Makefile.am (OPT_NO_PLUGINS): New macro for
253         -fno-use-linker-plugin.
254         (LINK1, CXXLINK1): Add it to the link command.
255         * testsuite/Makefile.in: Regenerate.
256
257 2014-03-12  Alan Modra  <amodra@gmail.com>
258
259         * Makefile.in: Regenerate.
260
261 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
262
263         * symtab.h (Symbol::set_nonvis): New function.
264
265 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
266
267         * symtab.cc (Sized_symbol<32>::init_output_data):
268         Instantiate the template.
269         (Sized_symbol<64>::init_output_data): Likewise.
270
271 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
272
273         * symtab.cc (Symbol_table::sized_write_globals): Allow a target to
274         adjust dynamic symbol value.
275         * target.h (Target::adjust_dyn_symbol): New function.
276         (Target::do_adjust_dyn_symbol): New function.
277
278 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
279
280         * output.cc (Output_data_dynamic::Dynamic_entry::write):
281         Get the value of DYNAMIC_CUSTOM dynamic entry.
282         * output.h (Output_data_dynamic::add_custom): New function.
283         (Dynamic_entry::Dynamic_entry): New constructor for DYNAMIC_CUSTOM
284         dynamic entry.
285         (enum Dynamic_entry::Classification): Add DYNAMIC_CUSTOM.
286         * target.h (Target::dynamic_tag_custom_value): New function.
287         (Target::do_dynamic_tag_custom_value): New function.
288
289 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
290
291         * symtab.cc (Symbol_table::set_dynsym_indexes): Allow a target to set
292         dynsym indexes.
293         * target.h (Target::has_custom_set_dynsym_indexes): New function.
294         (Target::do_has_custom_set_dynsym_indexes): New function.
295         (Target::set_dynsym_indexes): New function.
296         (Target::do_set_dynsym_indexes): New function.
297
298 2014-03-07  Alan Modra  <amodra@gmail.com>
299
300         * powerpc.cc (Powerpc_relocate_functions::Overflow_check): Add
301         CHECK_UNSIGNED, CHECK_LOW_INSN, CHECK_HIGH_INSN.
302         (Powerpc_relocate_functions::has_overflow_unsigned): New function.
303         (Powerpc_relocate_functions::has_overflow_bitfield,
304         overflowed): Use the above.
305         (Target_powerpc::Relocate::relocate): Correct overflow checking
306         for a number of relocations.  Modify overflow test for 16-bit
307         fields in instructions to signed/unsigned according to whether
308         the field takes a signed or unsigned value.
309
310 2014-03-05  Alan Modra  <amodra@gmail.com>
311
312         Update copyright years.
313
314 2014-03-05  Alan Modra  <amodra@gmail.com>
315
316         * powerpc.cc (Target_powerpc::Scan::local, global): Support
317         R_PPC64_ADDR64_LOCAL.
318         (Target_powerpc::Relocate::relocate): Likewise.
319
320 2014-03-03  Alan Modra  <amodra@gmail.com>
321
322         * dwp.cc (print_version): Update copyright year to current.
323
324 2014-02-10  Alan Modra  <amodra@gmail.com>
325
326         * po/gold.pot: Regenerate.
327
328 2014-02-06  Cary Coutant  <ccoutant@google.com>
329
330         Fix problem where -u is ignored when a weak undef is seen.
331
332         * archive.cc (Library_base::should_include_member): Reorder
333         code to check for -u option if a weak undef has already been seen.
334         * testsuite/Makefile.am (weak_undef_test_2): New test case.
335         * testsuite/Makefile.in: Regenerate.
336         * testsuite/weak_undef_file3.cc: New file.
337         * testsuite/weak_undef_file4.cc: New file.
338         * testsuite/weak_undef_test_2.cc: New file.
339
340 2014-02-05  Cary Coutant  <ccoutant@google.com>
341
342         Fix issues with gold undefined symbol diagnostics.
343
344         PR binutils/15435
345         * errors.cc (Errors::undefined_symbol): Move undef vtable symbol
346         check to here.
347         * target-reloc.h (is_strong_undefined): New function.
348         (relocate_section): Move undef vtable symbol check from here.
349         Check for is_strong_undefined.
350
351 2014-02-05  Cary Coutant  <ccoutant@google.com>
352
353         Fix problems with the --dynamic-list option.
354
355         PR gold/13577
356         * options.cc (General_options::parse_dynamic_list):
357         Set have_dynamic_list_.
358         (General_options::General_options): Initialize have_dynamic_list_.
359         (General_options::finalize): Turn off -Bsymbolic and
360         -Bsymbolic-functions if --dynamic-list provided.
361         * options.h (General_options::have_dynamic_list): New function.
362         (General_options::have_dynamic_list_): New data member.
363         * symtab.h (Symbol::is_preemptible): Handle --dynamic-list
364         correctly.
365
366         PR gold/16530
367         * symtab.cc (Symbol_table::add_from_relobj): If symbol is named
368         in --dynamic-list, mark it.
369
370         * testsuite/Makefile.am (gc_dynamic_list_test.sh): New test case.
371         (dynamic_list_2): New test case.
372         * testsuite/Makefile.in: Regenerate.
373         * testsuite/dynamic_list_2.cc: New file.
374         * testsuite/dynamic_list_2.t: New file.
375         * testsuite/dynamic_list_lib1.cc: New file.
376         * testsuite/dynamic_list_lib2.cc: New file.
377         * testsuite/gc_dynamic_list_test.c: New file.
378         * testsuite/gc_dynamic_list_test.sh: New file.
379         * testsuite/gc_dynamic_list_test.t: New file.
380
381 2014-01-28  Cary Coutant  <ccoutant@google.com>
382
383         Add .gdb_index version 7 support.
384
385         * gold/dwarf_reader.cc: include <utility> (for make_pair).
386         (Dwarf_abbrev_table::do_read_abbrevs): Check for compressed
387         debug sections.
388         (Dwarf_ranges_table::read_ranges_table): Likewise.
389         (Dwarf_pubnames_table::read_section): Check for GNU-style
390         sections, and for compressed debug sections.
391         (Dwarf_pubnames_table::read_header): Compute end address of table.
392         (Dwarf_pubnames_table::next_name): Return flag_byte.  Check
393         for end of list by offset, not by offset == 0.
394         (Dwarf_info_reader::do_read_string_table): Check for compressed
395         debug sections.
396         * gold/dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
397         Initialize new data members.
398         (Dwarf_pubnames_table::next_name): return flag_byte.
399         (Dwarf_pubnames_table::end_of_table_): New data member.
400         (Dwarf_pubnames_table::is_gnu_style_): New data member.
401         * gold/gdb-index.cc (gdb_index_version): Update to version 7.
402         (Gdb_index_info_reader::read_pubtable): Read flag_byte.
403         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Don't
404         read skeleton type unit DIEs.
405         (Gdb_index::add_symbol): Add flag_byte; adjust all callers.
406         (Gdb_index::do_write): Write flag_byte.
407         * gold/gdb-index.h (Gdb_index::add_symbol): Add flags parameter.
408         (Gdb_index::Cu_vector): Store flags along with cu indexes.
409         * gold/testsuite/gdb_index_test_3.sh: Allow versions 4-7.
410         * gold/testsuite/gdb_index_test_comm.sh: Likewise.
411
412 2014-01-08  H.J. Lu  <hongjiu.lu@intel.com>
413
414         * version.cc (print_version): Update copyright year to 2014.
415
416 2013-12-19  Dimitry Andric  <dimitry@andric.com>
417
418         * stringpool.cc (Stringpool_template::reserve): Add
419         HAVE_UNORDERED_MAP case.
420         * stringpool.cc (Stringpool_template::print_stats): Likewise.
421
422 2013-12-18  Cary Coutant  <ccoutant@google.com>
423
424         * configure.ac: Check for <unordered_set> and <unordered_map>.
425         * config.in: Regenerate.
426         * configure: Regenerate.
427         * system.h: Use <unordered_set> and <unordered_map> if available.
428
429 2013-12-10  Roland McGrath  <mcgrathr@google.com>
430
431         * Makefile.am (install-exec-local): Prefix $(INSTALL_PROGRAM) uses
432         with $(INSTALL_PROGRAM_ENV).
433         * Makefile.in: Regenerate.
434
435 2013-11-22  Cary Coutant  <ccoutant@google.com>
436
437         * configure.ac: Add check for which library is needed for
438         dlopen.
439         * configure: Regenerate.
440
441 2013-11-22  Cary Coutant  <ccoutant@google.com>
442
443         * testsuite/Makefile.am (exception_x86_64_bnd_test): Use in-tree
444         assembler.
445         * testsuite/Makefile.in: Regenerate.
446
447 2013-11-17  H.J. Lu  <hongjiu.lu@intel.com>
448
449         * x86_64.cc (Target_x86_64<size>::Scan::get_reference_flags):
450         Handle R_X86_64_PC32_BND and R_X86_64_PLT32_BND just like
451         R_X86_64_PC32 and R_X86_64_PLT32, respectively.
452         (Target_x86_64<size>::Scan::local): Likewise.
453         (Target_x86_64<size>::Scan::global): Likewise.
454         (Target_x86_64<size>::Relocate::relocate): Likewise.
455         (Target_x86_64<size>::Relocatable_size_for_reloc::get_size_for_reloc):
456         Likewise.
457         (Target_x86_64<size>::Scan::check_non_pic(): Handle
458         R_X86_64_PC32_BND.
459
460         * testsuite/Makefile.am (check_PROGRAMS): Add
461         exception_x86_64_bnd_test.
462         (exception_x86_64_bnd_test_SOURCES): New macro.
463         (exception_x86_64_bnd_test_DEPENDENCIES): Likewise.
464         (exception_x86_64_bnd_test_LDFLAGS): Likewise.
465         (exception_x86_64_bnd_test_LDADD): Likewise.
466         (exception_x86_64_bnd_1.o): New rule.
467         (exception_x86_64_bnd_2.o): Likewise.
468         * testsuite/Makefile.in: Regenerated.
469
470 2013-11-15  Alan Modra  <amodra@gmail.com>
471
472         * powerpc.cc (Target_powerpc::glink_section): Provide non-const
473         accessor.
474         (Target_powerpc::Branch_info::make_stub): Make global entry stubs.
475         Only call ppc64_local_entry_offset for 64-bit.  Restrict
476         symval_for_branch lookup to ELFv1.
477         (Stub_table::add_plt_call_entry): Use unsigned int off.
478         (Output_data_glink::Address, invalid_address): New.
479         (Output_data_glink::add_eh_frame): Move out of line.  Add
480         support for ELFv2.
481         (Output_data_glink::add_global_entry, find_global_entry,
482         global_entry_address): New functions.
483         (Output_data_glink::global_entry_stubs_, end_branch_table_,
484         ge_size): New variables.
485         (Output_data_glink::set_final_data_size): Add global entry
486         stub sizing.
487         (Output_data_glink::do_write): Write global entry stubs.
488         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Add target
489         parameter.  Return true for ELFv2.  Adjust callers.
490         (Target_powerpc::Scan::local, global): Restrict opd lookup to
491         ELFv1.  Similarly for ifunc and dynamic relocation processing
492         specific to ELFv1.  Recognize that symbols are defined on
493         their plt entries for ELFv2.
494         (Target_powerpc::symval_for_branch): Assert if called for
495         ELFv2 or ppc32.
496         (Target_powerpc::Relocate::relocate): Use global entry plt
497         stub for symbol value if such exists on ELFv2.
498         (Target_powerpc::Relocate::relocate): Don't call
499         symval_for_branch when ELFv2.  Do adjust for local entry
500         offset when ELFv2.
501         (Target_powerpc::do_dynsym_value): Set symbols to global entry
502         plt stub for ELFv2.
503         (Target_powerpc::do_plt_address_for_global): Similarly.
504
505 2013-11-14  Cary Coutant  <ccoutant@google.com>
506
507         Revert patch -- this did not fix the problem, and there is
508         no race there.
509
510         2013-11-14  Cary Coutant  <ccoutant@google.com>
511
512             PR gold/14860
513             * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
514             (Ehframe_hdr::set_final_data_size): Allocate a Lock.
515             * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
516             updating fde_offsets_.
517             (Eh_frame_hdr::lock_): New data member.
518
519 2013-11-14  Cary Coutant  <ccoutant@google.com>
520
521         * dwp.cc (Dwo_file_entry): New type.
522         (File_list): Use Dwo_file_entry.
523         (Dwo_file::verify): New function.
524         (Dwo_file::verify_dwo_list): New function.
525         (Dwo_file::sized_verify_dwo_list): New function.
526         (Dwo_name_info_reader::visit_compilation_unit): Add dwo_id to file
527         list.
528         (Dwp_options): New enum type.
529         (dwp_options): Add --verify-only.
530         (usage): Likewise.
531         (main): Likewise.
532         * dwp.h (gold_info): Add declaration.
533
534 2013-11-14  Cary Coutant  <ccoutant@google.com>
535
536         PR gold/14860
537         * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
538         (Ehframe_hdr::set_final_data_size): Allocate a Lock.
539         * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
540         updating fde_offsets_.
541         (Eh_frame_hdr::lock_): New data member.
542
543 2013-11-06  Cary Coutant  <ccoutant@google.com>
544
545         PR gold/15758
546         * object.cc (Sized_relobj_file::do_layout): Handle .eh_frame sections
547         before reloc sections.
548
549 2013-11-04  Alan Modra  <amodra@gmail.com>
550
551         * symtab.h (Symbol::Reference_flags): Add FUNC_DESC_ABI.
552         (Symbol::needs_dynamic_reloc): Test new flag.
553         * powerpc.cc (needs_dynamic_reloc, use_plt_offset): Delete.
554         (Target_powerpc::Scan::get_reference_flags): Add target param.
555         Return FUNC_DESC_ABI for 64-bit ELFv1.
556         (Target_powerpc::Branch_info::make_stub): Adjust get_reference_flags
557         call.
558         (Target_powerpc::Scan::global): Use Symbol::needs_dynamic_reloc.
559         (Target_powerpc::Relocate::relocate): Use Symbol::use_plt_offset.
560
561 2013-10-31  Cary Coutant  <ccoutant@google.com>
562
563         Restore support for dwp v2 DWARF package file format.
564
565         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
566         tu_length parameter.  Adjust all callers.
567         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
568         * dwp.cc: Include dwarf.h.
569         (Section_bounds): New struct type.
570         (Unit_set): New struct type.
571         (Dwo_file::Dwo_file): Initialize new data member.
572         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
573         Combine and rename to...
574         (Dwo_file::read_unit_index): ...this.
575         (Dwo_file::sized_read_compunit_index)
576         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
577         (Dwo_file::sized_read_unit_index): ...this.
578         (Dwo_file::copy_section): Remove section_name, is_str_offsets
579         parameters; add section_id parameter.
580         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
581         (Dwo_file::add_unit_set): ...this.
582         (Dwo_file::shndx_map_): Remove.
583         (Dwo_file::sect_offsets_): New data member.
584         (Dwp_output_file::Dwp_output_file): Initialize new data members.
585         (Dwp_output_file::add_section): Rename to...
586         (Dwp_output_file::add_contribution): ...this.
587         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
588         (Dwp_output_file::add_tu_set): Likewise.
589         (Dwp_output_file::Contribution): New type.
590         (Dwp_output_file::Section::contributions): New data member.
591         (Dwp_output_file::Cu_or_tu_set): Remove.
592         (Dwp_output_file::Section::Section): New ctor.
593         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
594         (Dwp_output_file::Dwp_index::Section_table): New type.
595         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
596         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
597         parameter.
598         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
599         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
600         (Dwp_output_file::Dwp_index::section_table): New member function.
601         (Dwp_output_file::Dwp_index::section_table_end): New member function.
602         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
603         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
604         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
605         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
606         (Dwp_output_file::Dwp_index::section_table_): New data member.
607         (Dwp_output_file::Dwp_index::section_mask_): New data member.
608         (Dwp_output_file::add_output_section): New member function.
609         (Dwp_output_file::write_new_section): New member function.
610         (Dwp_output_file::write_contributions): New member function.
611         (Dwp_output_file::section_id_map_): New data member.
612         (class Dwo_id_info_reader): Remove.
613         (class Unit_reader): New class.
614         (get_dwarf_section_name): New function.
615         (Dwo_file::read_executable): Adjust initializations of class data.
616         (Dwo_file::read): Add support for v2 package file format.
617         (Dwo_file::read_unit_index): Likewise.
618         (Dwo_file::sized_read_unit_index): Likewise.
619         (Dwo_file::copy_section): Likewise.
620         (Dwo_file::add_unit_set): Likewise.
621         (Dwp_output_file::add_output_section): Likewise.
622         (Dwp_output_file::add_contribution): Likewise.
623         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
624         for empty slot.
625         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
626         file format.
627         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
628         slot.
629         (Dwp_output_file::initialize): Remove unused function.
630         (Dwp_output_file::finalize): Add support for v2 package file format.
631         (Dwp_output_file::write_index): Likewise.
632         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
633         function prototype.
634
635 2013-10-31  Cary Coutant  <ccoutant@google.com>
636
637         * configure.ac: Fix check for -fmerge-constants.
638         * configure.ac: Regenerate.
639
640 2013-10-30  Roland McGrath  <mcgrathr@google.com>
641
642         * x86_64.cc (Output_data_plt_x86_64_nacl::first_plt_entry):
643         Correct 9-byte nop sequence to match what the assembler generates.
644
645 2013-10-30  Alan Modra  <amodra@gmail.com>
646
647         * powerpc.cc (Powerpc_relobj::abiversion, set_abiversion,
648         ppc64_local_entry_offset, ppc64_local_entry_offset,
649         do_read_symbols): New functions.
650         (Powerpc_relobj::e_flags_, st_other_): New vars.
651         (Powerpc_relobj::Powerpc_relobj): Call set_abiversion.
652         (Powerpc_dynobj::abiversion, set_abiversion): New functions.
653         (Powerpc_relobj::e_flags_): New var.
654         (Target_powerpc::first_plt_entry_offset, plt_entry_size): Inline
655         and adjust for ELFv2.
656         (Target_powerpc::abiversion, set_abiversion, stk_toc): New functions.
657         (Powerpc_relobj::do_find_special_sections): Check no .opd in ELFv2.
658         (Powerpc_dynobj::do_find_special_sections): Likewise.
659         (Target_powerpc::do_define_standard_symbols): Define ".TOC.".
660         (Target_powerpc::Branch_info::make_stub): Adjust stub destination
661         to ELFv2 local entry.
662         (Target_powerpc::do_relax): No thread safe barriers needed for
663         ELFv2.
664         (Output_data_plt_powerpc::initial_plt_entry_size_,
665         plt_entry_size): Delete.  Replace all uses with
666         first_plt_entry_offset() and plt_entry_size().
667         (Output_data_plt_powerpc::Output_data_plt_powerpc): Remove
668         reserved_size parm.  Update callers.
669         (Output_data_plt_powerpc::entry_count): Update.
670         (Output_data_plt_powerpc::first_plt_entry_offset): Make private
671         and use Target_powerpc::first_plt_entry_offset().
672         (Output_data_plt_powerpc::get_plt_entry_size): Similarly and
673         rename to plt_entry_size.
674         (Output_data_plt_powerpc::add_ifunc_entry,
675         add_local_ifunc_entry): Adjust reloc for ELFv2.
676         (glink_eh_frame_fde_64): Rename to glink_eh_frame_fde_64v1.
677         (glink_eh_frame_fde_64v2): New.
678         (Stub_table::plt_call_size): Support ELFv2 sizing.
679         (Output_data_glink::add_eh_frame): Use the new FDE.
680         (Output_data_glink::set_final_data_size): Adjust for ELFv2 glink.
681         (Stub_table::do_write): Write ELFv2 stubs and glink.
682         (Target_powerpc::Relocate::relocate): Replaces nop after call
683         with ld 2,24(1) and adjust local offset destination for ELFv2.
684
685 2013-10-30  Alan Modra  <amodra@gmail.com>
686
687         * powerpc.cc (Target_powerpc::Scan::check_non_pic): Handle new relocs.
688         (Target_powerpc::Scan::global, local): Likewise.
689         (Target_powerpc::Relocate::relocate): Likewise.  Check for overflow
690         on all ppc64 @h and @ha relocs.
691
692 2013-10-14  Alan Modra  <amodra@gmail.com>
693
694         * output.h (Output_data_got::add_constant): Tidy.
695         (Output_data_got::add_constant_pair): New function.
696         * powerpc.cc (Output_data_got_powerpc): Override all Output_data_got
697         methods used so as to first call reserve_ent().
698
699 2013-10-11  Roland McGrath  <mcgrathr@google.com>
700
701         * powerpc.cc (Output_data_got_powerpc): Remove unused methods
702         add_got_entry and add_got_entry_pair.
703
704         * configure.ac (TLS_GNU2_DIALECT): Use -Werror in test.
705         (HAVE_PUBNAMES): Likewise.
706         * configure: Regenerate.
707
708         * testsuite/Makefile.am: Replace '-T foo' with '-Wl,-T,foo' throughout.
709         * testsuite/Makefile.in: Regenerate.
710
711         * target.h (Target::adjust_elf_header, Target::do_adjust_elf_header):
712         Remove const from declaration.
713         * target.cc (Sized_target::do_adjust_elf_header): Update definition.
714         * sparc.cc (Target_sparc::do_adjust_elf_header): Likewise.
715         * output.h (Output_file_header): Remove const from member target_
716         and corresponding constructor argument.
717         * output.cc (Output_file_header::Output_file_header): Update prototype.
718         (Output_file_header::do_sized_write): Use this->target_ in place
719         of parameters()->target().
720
721         * testsuite/undef_symbol.cc (Foo::get_a): New method.
722
723         * configure.ac (MERGE_CONSTANTS_FLAG): New check.
724         * configure: Regenerate.
725         * Makefile.in: Regenerate.
726         * testsuite/merge_string_literals_1.c: Renamed to have .cc suffix.
727         * testsuite/merge_string_literals_2.c: Likewise.
728         * testsuite/Makefile.am
729         (merge_string_literals_1.o, merge_string_literals_2.o): Update deps.
730         (AM_CFLAGS, AM_CXXFLAGS): Use $(MERGE_CONSTANTS_FLAG) in place of
731         literal -fmerge-constants.
732         * testsuite/Makefile.in: Regenerate.
733
734         * i386.cc (Target_i386): Remove unused member dynbss_.
735         * arm.cc (Target_arm): Likewise.
736         * powerpc.cc (Target_powerpc): Likewise.
737         * sparc.cc (Target_sparc): Likewise.
738         * tilegx.cc (Target_tilegx): Likewise.
739         * x86_64.cc (Target_x86_64): Likewise.
740         * dwarf_reader.h (Dwarf_info_reader): Remove unused members
741         type_signature_, type_offset_.
742         * plugin.h (Plugin_hook): Remove unused member layout_.
743         * readsyms.h (Add_symbols): Remove unused members dirpath_, dirindex_,
744         mapfile_.
745         (Read_member): Remove unused members input_objects_, symtab_,
746         mapfile_, layout_.
747         (Check_library): Remove unused member symtab_.
748         * archive.h (Lib_group): Remove unused member lib_.
749         * archive.cc (Lib_group::Lib_group): Update initializer.
750         * incremental.h (Incremental_binary): Remove unused member target_.
751         (Incremental_script_entry): Removed unused member script_.
752         * layout.h (Write_symbols_task): Remove unused member input_objects_.
753         * icf.h (Icf): Remove unused member num_tracked_relocs.
754
755         * gold-threads.h (Once): Conditionalize member was_run_lock_ on
756         [ENABLE_THREADS && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4], matching
757         its only use.
758         * gold-threads.cc (Once::Once): Likewise conditionalize initializer.
759
760         * archive.h: Use struct rather than class for forward declaration
761         of Read_symbols_data.
762
763 2013-10-07  Cary Coutant  <ccoutant@google.com>
764
765         PR gold/16010
766         * testsuite/Makefile.am (icf_test): Fix dependencies.
767         (icf_safe_test): Likewise.
768         (icf_safe_so_test): Likewise.
769         (large_symbol_alignment): Add empty _LDADD rule.
770         * testsuite/Makefile.in: Regenerate.
771
772 2013-09-03  Pavel Chupin  <pavel.v.chupin@intel.com>
773
774         PR gold/15927
775         * x86_64.cc (Target_x86_64<size>::Scan::global): Use relative
776         relocation for R_X86_64_32 on x32.
777
778 2013-08-27  Roland McGrath  <mcgrathr@google.com>
779
780         * output.cc (Output_segment::set_section_addresses): Take new
781         Target* argument.  If target->isolate_execinstr() and the segment
782         is executable and starts at a target->abi_pagesize() boundary,
783         pad its end out to a target->abi_pagesize() boundary with code fill.
784         * output.h (Output_segment::set_section_addresses): Update decl.
785         * layout.h (Layout::check_output_data_for_reset_values): Take new
786         argument RELAX_OUTPUTS.
787         (Layout): New member relax_output_list_.
788         (Layout::add_relax_output): New method.
789         * layout.cc (Layout::Layout): Update constructor.
790         (Layout::reset_relax_output): New method.
791         (Layout::clean_up_after_relaxation): Call it.
792         (Layout::prepare_for_relaxation): Update caller.
793         (Layout::set_segment_offsets): Update callers of set_section_addresses.
794         Call reset_relax_output before re-processing segments for
795         isolate_execinstr case.
796         (Layout::write_data): Handle relax_output_list_.
797         (Layout::Relaxation_debug_check::check_output_data_for_reset_values):
798         Take new argument RELAX_OUTPUTS.  Assert it's an empty collection.
799
800 2013-08-23  Yuri Chornoivan  <yurchor@ukr.net>
801
802         PR binutils/15834
803         * object.h: Fix typos.
804
805 2013-08-16  Roland McGrath  <mcgrathr@google.com>
806
807         * i386.cc (Target_i386_nacl::do_code_fill): New virtual function.
808         * x86_64.cc (Target_x86_64_nacl::do_code_fill): New virtual function.
809
810 2013-08-07  Cary Coutant  <ccoutant@google.com>
811
812         Revert support for v2 DWP files:
813
814         2013-03-01  Cary Coutant  <ccoutant@google.com>
815
816             Add dwp support for v2 DWARF package file format.
817             * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
818             tu_length parameter.  Adjust all callers.
819             * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
820             * dwp.cc: Include dwarf.h.
821             (Section_bounds): New struct type.
822             (Unit_set): New struct type.
823             (Dwo_file::Dwo_file): Initialize new data member.
824             (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
825             Combine and rename to...
826             (Dwo_file::read_unit_index): ...this.
827             (Dwo_file::sized_read_compunit_index)
828             (Dwo_file::sized_read_typeunit_index): Combine and rename to...
829             (Dwo_file::sized_read_unit_index): ...this.
830             (Dwo_file::copy_section): Remove section_name, is_str_offsets
831             parameters; add section_id parameter.
832             (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
833             (Dwo_file::add_unit_set): ...this.
834             (Dwo_file::shndx_map_): Remove.
835             (Dwo_file::sect_offsets_): New data member.
836             (Dwp_output_file::Dwp_output_file): Initialize new data members.
837             (Dwp_output_file::add_section): Rename to...
838             (Dwp_output_file::add_contribution): ...this.
839             (Dwp_output_file::add_cu_set): Combine parameters into a struct.
840             (Dwp_output_file::add_tu_set): Likewise.
841             (Dwp_output_file::Contribution): New type.
842             (Dwp_output_file::Section::contributions): New data member.
843             (Dwp_output_file::Cu_or_tu_set): Remove.
844             (Dwp_output_file::Section::Section): New ctor.
845             (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
846             (Dwp_output_file::Dwp_index::Section_table): New type.
847             (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
848             (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
849             parameter.
850             (Dwp_output_file::Dwp_index::shndx_pool): Remove.
851             (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
852             (Dwp_output_file::Dwp_index::section_table): New member function.
853             (Dwp_output_file::Dwp_index::section_table_end): New member function.
854             (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
855             (Dwp_output_file::Dwp_index::section_table_rows): New member function.
856             (Dwp_output_file::Dwp_index::section_table_cols): New member function.
857             (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
858             (Dwp_output_file::Dwp_index::section_table_): New data member.
859             (Dwp_output_file::Dwp_index::section_mask_): New data member.
860             (Dwp_output_file::add_output_section): New member function.
861             (Dwp_output_file::write_new_section): New member function.
862             (Dwp_output_file::write_contributions): New member function.
863             (Dwp_output_file::section_id_map_): New data member.
864             (class Dwo_id_info_reader): Remove.
865             (class Unit_reader): New class.
866             (get_dwarf_section_name): New function.
867             (Dwo_file::read_executable): Adjust initializations of class data.
868             (Dwo_file::read): Add support for v2 package file format.
869             (Dwo_file::read_unit_index): Likewise.
870             (Dwo_file::sized_read_unit_index): Likewise.
871             (Dwo_file::copy_section): Likewise.
872             (Dwo_file::add_unit_set): Likewise.
873             (Dwp_output_file::add_output_section): Likewise.
874             (Dwp_output_file::add_contribution): Likewise.
875             (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
876             for empty slot.
877             (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
878             file format.
879             (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
880             slot.
881             (Dwp_output_file::initialize): Remove unused function.
882             (Dwp_output_file::finalize): Add support for v2 package file format.
883             (Dwp_output_file::write_index): Likewise.
884             * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
885             function prototype.
886
887 2013-07-31  Cary Coutant  <ccoutant@google.com>
888
889         * object.cc (Sized_relobj::do_output_section_address): New function.
890         (Sized_relobj): Instantiate explicitly.
891         * object.h (Object::output_section_address): New function.
892         (Object::do_output_section_address): New function.
893         (Sized_relobj::do_output_section_address): New function.
894         * powerpc.cc (Target_powerpc::symval_for_branch): Use it.
895
896 2013-07-30  Cary Coutant  <ccoutant@google.com>
897             Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
898
899         * parameters.cc (Parameters::entry): Return target-specific entry
900         symbol name.
901         * target.h (Target::entry_symbol_name): New function.
902         (Target_info::entry_symbol_name): New data member.
903
904         * arm.cc (Target_arm::arm_info): Add entry_symbol_name.
905         * i386.cc (Target_i386::i386_info): Likewise.
906         (Target_i386_nacl::i386_nacl_info): Likewise.
907         * sparc.cc (Target_sparc::sparc_info): Likewise.
908         * tilegx.cc (Target_tilegx::tilegx_info): Likewise.
909         * x86_64.cc: (Target_x86_64::x86_64_info) Likewise.
910         (Target_x86_64_nacl::x86_64_nacl_info) Likewise.
911         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
912
913 2013-07-22  Sterling Augustine  <saugustine@google.com>
914
915         * dwarf_reader.cc (Dwarf_pubnames_table::read_section):
916         Convert parameter shndx to local variable. Add parameters symtab
917         and symtab_size.  Scan over section names.  Find relocation
918         section corresponding to current section.  Create and initialize
919         reloc_mapper_ and reloc_type_.
920         (Dwarf_pubnames_table::read_header):  Add assertion.  Change
921         unit_length to off_t.  Initialize member unit_length_.  Fill in field
922         cu_offset_.
923         * dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
924         Initialize new fields unit_length_ and cu_offset_.
925         (Dwarf_pubnames_table::read_section): Update prototype.
926         (Dwarf_pubnames_table::cu_offset): New member function.
927         (Dwarf_pubnames_table::subsection_size): Likewise.
928         (Dwarf_pubnames_table::cu_offset_, Dwarf_pubnames_table::unit_length):
929         New fields.
930         (Dwarf_info_reader::symtab, Dwarf_info_reader::symtab_size): Make
931         member functions public.
932         * gdb_index.cc (Gdb_index_info_reader::read_pubnames_and_pubtypes):
933         Update comment.  Rework logic.  Move repeated parts to...
934         (Gdb_index_info_reader::read_pubtable): ...here. New function.
935         (Gdb_index::Gdb_index): Initialize new fields, pubnames_table_,
936         pubtypes_table_, and stmt_list_offset.
937         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
938         Gdb_index::find_pubtype_offset,
939         Gdb_index::map_pubnames_and_types_to_dies): Define new functions.
940         (Gdb_index::pubnames_read): Update prototype and rework logic.
941         * gdb_index.h (Gdb_index_info_reader, Dwarf_pubnames_table):
942         Forward declare.
943         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
944         Gdb_index::find_pubtype_offset, Gdb_index::pubnames_table)
945         Gdb_index::pubtypes_table, Gdb_index::map_pubnames_and_types_to_dies,
946         Gdb_index::map_pubtable_to_dies):
947         Declare functions.
948         (Gdb_index::pubnames_read): Update declaration.
949         (Gdb_index::Pubname_offset_map): New type.
950         (Gdb_index::cu_pubname_map_, Gdb_index::cu_pubtype_map_,
951         Gdb_index::pubnames_table_, Gdb_index::pubtypes_table_,
952         Gdb_index::stmt_list_offset): Declare.
953         (Gdb_index::pubnames_shndx_, Gdb_index::pubnames_offet_,
954         Gdb_index::pubtypes_object_, Gdb_index::pubtypes_shndx_)
955         Gdb_index::pubtypes_offset_): Remove.
956
957 2013-07-19  Roland McGrath  <mcgrathr@google.com>
958
959         * options.h (General_options): Add -Trodata-segment option.
960         * parameters.cc (Parameters::check_rodata_segment): New function.
961         (Parameters::set_target_once): Call it.
962         * parameters.h (Parameters): Declare it (private member function).
963         * layout.cc (load_seg_unusable_for_headers): New function, broken
964         out of Layout::relaxation_loop_body.  If TARGET->isolate_execinstr()
965         then validate rodata segment rather than text segment.
966         (relaxation_loop_body): Call that.
967         (is_text_segment): New function.  Don't admit a non-executable
968         segment if TARGET->isolate_execinstr().
969         (set_segment_offsets): Call it.  Honor -Trodata-segment option.
970
971 2013-07-15  Shawn Landden  <shawnlandden@gmail.com>
972
973         PR gold/15070
974         * fileread.h (File_read::get_view): Clarify comment about ALIGNED.
975         * nacl.h (Sniff_file::View::View): Request aligned view.
976
977 2013-07-11  Cary Coutant  <ccoutant@google.com>
978
979         * powerpc.cc (Target_powerpc::write_branch_lookup_table): Use
980         correct BRLT entry size.
981
982 2013-07-03  Alan Modra  <amodra@gmail.com>
983
984         * powerpc.cc (Target_powerpc::Relocate::relocate): Update self-call
985         comment.
986
987 2013-07-01  Cary Coutant  <ccoutant@google.com>
988
989         * dwarf_reader.cc (Dwarf_ranges_table::read_ranges_table): Save
990         reloc_type_.
991         (Dwarf_ranges_table::read_range_list): Call lookup_reloc.
992         (Dwarf_ranges_table::lookup_reloc): New function.
993         * dwarf_reader.h (Dwarf_ranges_table::Dwarf_ranges_table): Initialize
994         reloc_type_.
995         (Dwarf_ranges_table::lookup_reloc): New function.
996         (Dwarf_ranges_table::reloc_type_): New data member.
997
998 2013-06-27  Jing Yu  <jingyu@google.com>
999
1000         PR gold/15662
1001         * powerpc.cc (Output_data_brlt_powerpc::reset_brlt_sizes): New
1002         function.
1003         (Output_data_brlt_powerpc::finalize_brlt_sizes): New function.
1004         (Target_powerpc::do_relax): Call the above.
1005
1006 2013-06-27  Cary Coutant  <ccoutant@google.com>
1007
1008         * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
1009         on garbage collected .opd section.
1010
1011 2013-06-27  Alan Modra  <amodra@gmail.com>
1012
1013         * powerpc.cc (Target_powerpc::do_gc_add_reference): Test dst_shndx
1014         is non-zero.
1015         (Target_powerpc::do_gc_mark_symbols): Likewise for sym->shndx().
1016         (Target_powerpc::do_function_location): Likewise for loc->shndx.
1017
1018 2013-06-14  Cary Coutant  <ccoutant@google.com>
1019
1020         * resolve.cc (Symbol::override_base): Don't override st_type
1021         from plugin placeholder symbols.
1022         (Symbol_table::resolve): Likewise.
1023         (Symbol_table::should_override): Don't complain about TLS mismatch
1024         if the TO symbol is a plugin placeholder.
1025         * testsuite/Makefile.am (plugin_test_tls): New test.
1026         * testsuite/Makefile.in: Regenerate.
1027         * testsuite/plugin_test_tls.sh: New test script.
1028         * testsuite/two_file_test_2_tls.cc: New test source.
1029         * testsuite/two_file_test_tls.cc: New test source.
1030
1031 2013-06-05  Alexander Ivchenko  <alexander.ivchenko@intel.com>
1032
1033         * layout.cc (Layout::set_segment_offsets): Taking care of the case when
1034         the maximum segment alignment is larger than the page size.
1035         * testsuite/Makefile.am (large_symbol_alignment): Test that Gold
1036         correctly aligns the symbols with large alignemnt.
1037         * testsuite/Makefile.in: Regenerate.
1038         * testsuite/large_symbol_alignment.cc: New file.
1039
1040 2013-05-30  Alexander Ivchenko  <alexander.ivchenko@intel.com>
1041             Sriraman Tallam  <tmsriram@google.com>
1042
1043         * options.h (sort_section): New option.
1044         * output.h (Input_section_sort_section_prefix_special_ordering_compare):
1045         Rename from Input_section_sort_section_name_special_ordering_compare.
1046         (Input_section_sort_section_name_compare): New struct.
1047         * output.cc (Output_section::Input_section_sort_section_name_compare::
1048         operator()): New function.
1049         (Output_section::sort_attached_input_sections): Use new sort function
1050         for .text if --sort-section=name is specified.
1051         * layout.cc (Layout::make_output_section):
1052         Add sorting by name when --sort-section=name is specified.
1053         * testsuite/Makefile.am (text_section_grouping): Test option
1054         --sort-section=name.
1055         * testsuite/Makefile.in: Regenerate.
1056         * testsuite/section_sorting_name.cc: New file.
1057         * testsuite/section_sorting_name.sh: New file.
1058
1059 2013-05-21  Cary Coutant  <ccoutant@google.com>
1060
1061         * symtab.h (Symbol::is_cxx_vtable): New function.
1062         * target-reloc.h (relocate_section): Check for vtable symbol.
1063         * testsuite/Makefile.am (missing_key_func.sh): New test case.
1064         * testsuite/Makefile.in: Regenerate.
1065         * testsuite/missing_key_func.cc: New test source.
1066         * testsuite/missing_key_func.sh: New test script.
1067
1068 2013-05-21  Cary Coutant  <ccoutant@google.com>
1069
1070         * object.cc (Sized_relobj_file::get_symbol_location_info): Set
1071         type of enclosing symbol.
1072         (Relocate_info::location): Check symbol type when describing symbol.
1073         * object.h (Symbol_location_info): Remove unused line_number;
1074         add enclosing_symbol_type.
1075         * testsuite/debug_msg.sh: Adjust expected output.
1076
1077 2013-05-13  Cary Coutant  <ccoutant@google.com>
1078
1079         * configure.ac: Export DEFAULT_TARGET.
1080         * configure: Regenerate.
1081         * Makefile.in: Regenerate.
1082         * testsuite/Makefile.am: Add .EXPORT_ALL_VARIABLES.
1083         * testsuite/Makefile.in: Regenerate.
1084         * testsuite/debug_msg.sh: Delete duplicate tests.
1085         Don't check undef_int error message match for powerpc where the
1086         source file and line number aren't available.
1087
1088 2013-05-10  Roland McGrath  <mcgrathr@google.com>
1089
1090         * options.h (General_options): Add --rosegment-gap option.
1091         * options.cc (finalize): --rosegment-gap implies --rosegment.
1092         * layout.cc (set_segment_offsets): Let user option override
1093         target->rosegment_gap().
1094
1095 2013-05-10  Roland McGrath  <mcgrathr@google.com>
1096
1097         * options.h (General_options): Remove leading space from help
1098         messages for -nostdlib and --rosegment.
1099
1100 2013-05-03  Maciej W. Rozycki  <macro@codesourcery.com>
1101
1102         PR ld/15365
1103         * layout.cc (Layout::finalize): Make __ehdr_start STV_HIDDEN.
1104
1105 2013-05-03  Alan Modra  <amodra@gmail.com>
1106
1107         * merge.cc (Output_merge_string::do_add_input_section): Correct
1108         scan for number of strings.  Rename vars to avoid shadowing.
1109         Include missing terminator in input_size_.
1110
1111 2013-05-01  H.J. Lu  <hongjiu.lu@intel.com>
1112
1113         * merge.cc (Output_merge_string<Char_type>::do_add_input_section):
1114         Restore empty string handling.
1115
1116 2013-05-01  Cary Coutant  <ccoutant@google.com>
1117
1118         * stringpool.cc (Stringpool_template::new_key_offset): Fix
1119         uninitialized warning.
1120
1121 2013-04-29  Alexander Ivchenko  <alexander.ivchenko@intel.com>
1122
1123         * output.cc (Output_section::add_merge_input_section): Allow
1124         to merge sections if the alignment is more than character size.
1125         * merge.h (Output_merge_string::Output_merge_string): Remove
1126         assert.
1127         * merge.cc (Output_merge_string<Char_type>::do_add_input_section): Count
1128         only not-null strings. Check the alignment of strings.
1129         * stringpool.h
1130         (Stringpool_template<Stringpool_char>::Stringpool_template): Add
1131         alignment as the argument.
1132         (Stringpool_template<Stringpool_char>::addralign_): New class member.
1133         * stringpool.cc (Stringpool_template<Stringpool_char>::new_key_offset):
1134         Align non-zero length strings according to the addralign_.
1135         (Stringpool_template<Stringpool_char>::set_string_offsets):
1136         Updating offsets according to the given alignment.
1137         * testsuite/Makefile.am (text_section_grouping): Test if string
1138         literals are getting merged.
1139         * testsuite/Makefile.in: Regenerate.
1140         * testsuite/merge_string_literals_1.c: New file.
1141         * testsuite/merge_string_literals_2.c: Ditto.
1142         * testsuite/merge_string_literals.sh: Ditto.
1143
1144 2013-04-26  Ian Lance Taylor  <iant@google.com>
1145
1146         * target-reloc.h (relocate_section): If the reloc offset is out of
1147         range, pass VIEW as NULL to relocate.relocate.
1148         * arm.cc (Target_arm:Relocate::relocate): Check for a NULL view.
1149         * i386.cc (Target_i386::Relocate::relocate): Likewise.
1150         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
1151         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
1152         * tilegx.cc (Target_tilegx::Relocate::relocate): Likewise.
1153         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
1154
1155 2013-04-26  Geoff Pike  <gpike@chromium.org>
1156
1157         * gold.cc (queue_final_tasks): invoke layout->queue_build_id_tasks().
1158         * layout.cc (Hash_task): New class.
1159         (Layout::queue_build_id_tasks): New function.
1160         (Layout::write_build_id): Handle single-thread portion of build ID
1161         computation.  (In some cases, all of it is single-threaded.)  Replace
1162         {sha1,md5}_process_bytes with {sha1,md5}_buffer to get the same
1163         functionality in fewer lines of code.
1164         * layout.h (Layout::queue_build_id_tasks): New function declaration.
1165         * options.h (General_options): make "--build-id" default to tree
1166         rather than sha1.  Add two new options related to --build-id=tree:
1167         --build-id-chunk-size-for-treehash and
1168         --build-id-min-file-size-for-treehash.
1169         * Makefile.am: add testing of --build-id=tree and related new options
1170         (these tests will be invoked by "make check").
1171         * Makefile.in: Regenerate.
1172
1173 2013-04-25  Alan Modra  <amodra@gmail.com>
1174
1175         * configure.tgt: Add powerpcle and powerpc64le.
1176
1177 2013-04-22  Alan Modra  <amodra@gmail.com>
1178
1179         PR gold/15355
1180         * layout.cc (Layout::segment_precedes): Allow more than one
1181         segment with the same type and flags.
1182
1183 2013-04-15  Cary Coutant  <ccoutant@google.com>
1184
1185         * layout.cc (Layout::set_relocatable_section_offsets): Don't
1186         allocate space in file for BSS sections.
1187
1188 2013-04-15  Cary Coutant  <ccoutant@google.com>
1189
1190         * script-sections.cc (Orphan_output_section): Reset address
1191         to zero after each orphaned section for relocatable links.
1192
1193 2013-04-15  Cary Coutant  <ccoutant@google.com>
1194
1195         * symtab.cc (Symbol_table::sized_write_globals): Subtract
1196         section starting address for relocatable link.
1197         * testsuite/Makefile.am (script_test_11): New test.
1198         * testsuite/Makefile.in: Regenerate.
1199         * testsuite/script_test_11.c: New source file.
1200         * testsuite/script_test_11.t: New linker script.
1201
1202 2013-04-13  Alan Modra  <amodra@gmail.com>
1203
1204         * powerpc.cc (Stub_control::can_add_to_stub_group): Don't set
1205         owner when sections are not adjacent and exceed group size.
1206         (Target_powerpc::group_sections): Handle corner case.
1207         (Target_powerpc::Branch_info::make_stub): Handle case where
1208         stub table doesn't exist due to branches in non-exec sections.
1209         (Target_powerpc::Relocate::relocate): Likewise.
1210
1211 2013-04-11  Alan Modra  <amodra@gmail.com>
1212
1213         PR gold/15354
1214         * powerpc.cc (Target_powerpc::make_brlt_section): Name section
1215         .branch_lt to match bfd ld.  Adjust comments throughout file.
1216
1217 2013-04-04  Ian Lance Taylor  <iant@google.com>
1218
1219         GCC PR c++/56840
1220         * object.cc (do_layout_deferred_sections): Handle .eh_frame
1221         sections before checking whether they are included in the link.
1222
1223 2013-03-29  Sriraman Tallam  <tmsriram@google.com>
1224
1225         * archive.cc (Archive::get_elf_object_for_member):  Create the elf
1226         object before calling the plugin claim_file handler.  Pass the elf
1227         object of the archive to the plugin. Delete the elf object if the
1228         plugin claims the file.
1229
1230 2013-03-21  Alan Modra  <amodra@gmail.com>
1231
1232         * layout.cc (Layout::set_segment_offsets): Accept writable .text
1233         segment when omagic.
1234
1235 2013-03-21  Alan Modra  <amodra@gmail.com>
1236
1237         * dwp.cc (Dwp_output_file::add_contribution): Avoid signed/unsigned
1238         comparison warning.
1239         * layout.cc (Layout::create_dynamic_symtab): Avoid "may be used
1240         uninitialized" warning.
1241
1242 2013-03-20  Alan Modra  <amodra@gmail.com>
1243
1244         * symtab.h (Symbol::clear_version): New function.
1245         * symtab.cc (Symbol_table::set_dynsym_indexes): Don't set object
1246         is_needed by weak references.  Clear version for symbols defined
1247         in as-needed objects that are not needed.
1248
1249 2013-03-15  Alan Modra  <amodra@gmail.com>
1250
1251         * powerpc.cc (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Make
1252         static and public.  Add report_err param.  Return false for data refs.
1253         (Target_powerpc::rela_dyn_section): New overloaded function.
1254         (Target_powerpc::plt_, iplt_): Elucidate.
1255         (Output_data_plt_powerpc::entry_count): Handle current_data_size()==0.
1256         (Output_data_plt_powerpc::do_write): Don't write .iplt.
1257         (Output_data_plt_powerpc::plt_entry_count): Don't add .iplt entries.
1258         (Target_powerpc::Scan::local, global): Adjust reloc_needs_plt_for_ifunc
1259         calls.  Put ifunc dynamic relocs in irela_dyn_section.  Only
1260         push_branch and make_plt_entry for ifunc syms when
1261         reloc_needs_plt_for_ifunc.
1262         (Target_powerpc::Relocate::relocate): Don't use plt entry value
1263         for ifunc unless reloc_needs_plt_for_ifunc.
1264
1265 2013-03-15  Alan Modra  <amodra@gmail.com>
1266
1267         * gc.h (gc_process_relocs): Don't look through function descriptors.
1268         * icf.cc (get_section_contents): Do so here instead.
1269
1270 2013-03-13  Alan Modra  <amodra@gmail.com>
1271
1272         * powerpc.cc (is_branch_reloc): Forward declare.
1273         (Target_powerpc::do_can_check_for_function_pointers): New predicate.
1274         (Target_powerpc::Scan::local_reloc_may_be_function_pointer): Return
1275         false for 64-bit, true for 32-bit non-branch relocs.
1276         (Target_powerpc::Scan::global_reloc_may_be_function_pointer): Likewise.
1277         * testsuite/Makefile.am (icf_test): Use linker map file instead of
1278         nm output.
1279         (icf_safe_test): Generate linker map file as well as nm output.
1280         (icf_safe_so_test): Likewise.
1281         * testsuite/Makefile.in: Regenerate.
1282         * testsuite/icf_test.sh: Parse linker map file to determine
1283         section folding.
1284         * testsuite/icf_safe_test.sh: Likewise.  Expect folding for PowerPC.
1285         * testsuite/icf_safe_so_test.sh: Likewise.
1286         (X86_32_or_ARM_specific_safe_fold): Merge into..
1287         (arch_specific_safe_fold): ..this.
1288         (X86_64_specific_safe_fold): Delete unused function.
1289
1290 2013-03-12  Alan Modra  <amodra@gmail.com>
1291
1292         * gc.h (gc_process_relocs): Look through function descriptors
1293         to determine shndx, symvalue and addend used by ICF.  Tidy
1294         variable duplication.
1295
1296 2013-03-11  Alan Modra  <amodra@gmail.com>
1297
1298         * gold.cc (queue_middle_tasks): Move detect_odr_violations..
1299         * layout.cc (Layout_task_runner::run): ..to here.
1300         * symtab.h (struct Symbol_location): Extract from..
1301         (class Symbol_table): ..here.
1302         * symtab.cc (Symbol_table::linenos_from_loc): Invoke function_location.
1303         * target.h (class Target): Add function_location and
1304         do_function_location functions.
1305         (class Sized_target): Add do_function_location.
1306         * object.h (class Sized_relobj_file): Move find_shdr..
1307         (class Object): ..to here.
1308         * object.cc: Likewise.  Update to suit.  Instantiate.
1309         (Sized_relobj_file::find_eh_frame): Update find_shdr call.
1310         * powerpc.cc (class Powerpc_dynobj): New.
1311         (Target_powerpc::do_function_location): New function.
1312         (Powerpc_relobj::do_find_special_sections): Update find_shdr call.
1313         (Powerpc_dynobj::do_read_symbols): New function.
1314         (Target_powerpc::do_make_elf_object): Make a Powerpc_dynobj.
1315
1316 2013-03-08  Ian Lance Taylor  <iant@google.com>
1317
1318         * options.cc (General_options::string_to_object_format): Accept
1319         "default".
1320
1321 2013-03-08  Alan Modra  <amodra@gmail.com>
1322
1323         * ehframe.h (Post_fdes) Make it a vector of Post_fde rather than
1324         pointer to Post_fde.
1325         (struct Post_fde): Move definition to here..
1326         * ehframe.cc (struct Post_fde): ..from here.
1327         (Cie::write): Don't alloc Post_fde.
1328         (Eh_frame::do_sized_write): Update.  Don't free Post_fde.
1329
1330 2013-03-07  Alan Modra  <amodra@gmail.com>
1331
1332         * testsuite/discard_locals_relocatable_test.c: Add a powerpc
1333         relocation referencing .LC0.
1334         * testsuite/discard_locals_test.sh: Remove FIXMEs.
1335
1336 2013-03-07  Alan Modra  <amodra@gmail.com>
1337
1338         * testsuite/ifunc-sel.h (ifunc_sel, ifunc_one): Mark
1339         always_inline.  Add assembly for powerpc to avoid GOT.
1340
1341 2013-03-07  Alan Modra  <amodra@gmail.com>
1342
1343         * testsuite/script_test_10.sh: Don't test .bss section
1344         header number.
1345
1346 2013-03-06  Alan Modra  <amodra@gmail.com>
1347
1348         * powerpc.cc (class Powerpc_relobj): Move some member functions.
1349         (Target_powerpc::symval_for_branch):  Add symtab param.  Update
1350         all callers.  Handle folded sections.
1351         (Target_powerpc::do_gc_add_reference): Don't cast dynamic object
1352         to Powerpc_relobj.
1353         (Global_symbol_visitor_opd::operator()): Likewise.
1354
1355 2013-03-04  Alan Modra  <amodra@gmail.com>
1356
1357         * testsuite/Makefile.am (final_layout_script.lds): Add .sbss.
1358         * testsuite/Makefile.in: Regenerate.
1359
1360 2013-03-01  Cary Coutant  <ccoutant@google.com>
1361
1362         Add dwp support for v2 DWARF package file format.
1363         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
1364         tu_length parameter.  Adjust all callers.
1365         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
1366         * dwp.cc: Include dwarf.h.
1367         (Section_bounds): New struct type.
1368         (Unit_set): New struct type.
1369         (Dwo_file::Dwo_file): Initialize new data member.
1370         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
1371         Combine and rename to...
1372         (Dwo_file::read_unit_index): ...this.
1373         (Dwo_file::sized_read_compunit_index)
1374         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
1375         (Dwo_file::sized_read_unit_index): ...this.
1376         (Dwo_file::copy_section): Remove section_name, is_str_offsets
1377         parameters; add section_id parameter.
1378         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
1379         (Dwo_file::add_unit_set): ...this.
1380         (Dwo_file::shndx_map_): Remove.
1381         (Dwo_file::sect_offsets_): New data member.
1382         (Dwp_output_file::Dwp_output_file): Initialize new data members.
1383         (Dwp_output_file::add_section): Rename to...
1384         (Dwp_output_file::add_contribution): ...this.
1385         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
1386         (Dwp_output_file::add_tu_set): Likewise.
1387         (Dwp_output_file::Contribution): New type.
1388         (Dwp_output_file::Section::contributions): New data member.
1389         (Dwp_output_file::Cu_or_tu_set): Remove.
1390         (Dwp_output_file::Section::Section): New ctor.
1391         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
1392         (Dwp_output_file::Dwp_index::Section_table): New type.
1393         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
1394         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
1395         parameter.
1396         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
1397         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
1398         (Dwp_output_file::Dwp_index::section_table): New member function.
1399         (Dwp_output_file::Dwp_index::section_table_end): New member function.
1400         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
1401         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
1402         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
1403         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
1404         (Dwp_output_file::Dwp_index::section_table_): New data member.
1405         (Dwp_output_file::Dwp_index::section_mask_): New data member.
1406         (Dwp_output_file::add_output_section): New member function.
1407         (Dwp_output_file::write_new_section): New member function.
1408         (Dwp_output_file::write_contributions): New member function.
1409         (Dwp_output_file::section_id_map_): New data member.
1410         (class Dwo_id_info_reader): Remove.
1411         (class Unit_reader): New class.
1412         (get_dwarf_section_name): New function.
1413         (Dwo_file::read_executable): Adjust initializations of class data.
1414         (Dwo_file::read): Add support for v2 package file format.
1415         (Dwo_file::read_unit_index): Likewise.
1416         (Dwo_file::sized_read_unit_index): Likewise.
1417         (Dwo_file::copy_section): Likewise.
1418         (Dwo_file::add_unit_set): Likewise.
1419         (Dwp_output_file::add_output_section): Likewise.
1420         (Dwp_output_file::add_contribution): Likewise.
1421         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
1422         for empty slot.
1423         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
1424         file format.
1425         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
1426         slot.
1427         (Dwp_output_file::initialize): Remove unused function.
1428         (Dwp_output_file::finalize): Add support for v2 package file format.
1429         (Dwp_output_file::write_index): Likewise.
1430         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
1431         function prototype.
1432
1433 2013-03-01  Cary Coutant  <ccoutant@google.com>
1434
1435         * dwarf_reader.cc (Dwarf_info_reader::check_buffer): Move
1436         function into class definition in header file.
1437         (Dwarf_info_reader::warn_corrupt_debug_section): New function.
1438         * dwarf_reader.h (Dwarf_info_reader::warn_corrupt_debug_section):
1439         New function.
1440         (Dwarf_info_reader::check_buffer): Move here from .cc file.
1441
1442 2013-02-28  Alan Modra  <amodra@gmail.com>
1443
1444         * target.h (Target::plt_fde_location, do_plt_fde_location): Declare.
1445         * target.cc (Target::do_plt_fde_location): New function.
1446         * ehframe.h (class FDE): Add post_map field to u_.from_linker,
1447         accessor function, and constructor param.
1448         (struct Post_fde, Post_fdes): Declare.
1449         (Cie::write): Add post_fdes param.
1450         * ehframe.cc (Fde::write): Use plt_fde_location.
1451         (struct Post_fde): Define.
1452         (Cie::write): Stash FDEs added post merge mapping.
1453         (Eh_frame::add_ehframe_for_plt): Assert no new CIEs after mapping.
1454         Adjust Fde constructor call.  Bump final_data_size_ for post map FDEs.
1455         (Eh_frame::do_sized_write): Arrange to write post map FDES after
1456         other FDEs.
1457         * powerpc.cc (Target_powerpc::do_plt_fde_location): New function.
1458         (Target_powerpc::has_glink): New function.
1459         (Target_powerpc::do_relax): Add eh_frame info for stubs.
1460         (struct Eh_cie, eh_frame_cie, glink_eh_frame_fde_64,
1461         glink_eh_frame_fde_32, default_fde): New data.
1462         (Stub_table::eh_frame_added_): New var.
1463         (Stub_table::find_long_branch_entry, stub_address, stub_offset):
1464         Make const.
1465         (Stub_table::add_eh_frame): New function.
1466         (Output_data_glink::add_eh_frame): New function.
1467         (Target_powerpc::make_glink_section): Call add_eh_frame.
1468
1469 2013-02-15  Ian Lance Taylor  <iant@google.com>
1470
1471         * options.h (DEFINE_uint64_alias): Define.
1472         (class General_options): Add -Ttext-segment as an alias for
1473         -Ttext.
1474
1475 2013-02-15  Alan Modra  <amodra@gmail.com>
1476
1477         * powerpc.cc (Stub_table::plt_off): New function, extracted from..
1478         (Stub_table::do_write): ..here, two places.
1479         (Stub_table::plt_call_size): Use it here too.
1480
1481 2013-02-11  Ian Lance Taylor  <iant@google.com>
1482
1483         * descriptors.cc (Descriptors::close_all): New function.
1484         * descriptors.h (class Descriptors): Declare close_all.
1485         (close_all_descriptors): New inline function.
1486         * plugin.cc: Include "descriptors.h".
1487         (Plugin_manager::cleanup): Call close_all_descriptors.
1488
1489 2013-02-06  Alan Modra  <amodra@gmail.com>
1490
1491         * README: Update coding style link.
1492
1493 2013-01-28  Cary Coutant  <ccoutant@google.com>
1494
1495         * dwp.cc (File_list): New typedef.
1496         (Dwo_name_info_reader): New class.
1497         (Dwo_id_info_reader::Dwo_id_info_reader): Remove unused parameters.
1498         (Dwo_id_info_reader::visit_top_die): Remove unused member function.
1499         (Dwo_file::~Dwo_file): Delete input_file_ after obj_.
1500         (Dwo_file::read_executable): New function.
1501         (Dwo_file::read): Move common setup code to ...
1502         (Dwo_file::make_object): ... here.
1503         (dwp_options): Add --exec/-e.
1504         (usage): Likewise.
1505         (main): Likewise.
1506
1507 2013-01-24  Sriraman Tallam  <tmsriram@google.com>
1508
1509         * layout.cc (Layout::layout): Check for option text_reorder.
1510         (Layout::make_output_section): Ditto.
1511         * options.h (text_reorder): New option.
1512         * output.cc (Input_section_sort_compare): Remove special ordering
1513         of section names.
1514         (Output_section::
1515          Input_section_sort_section_name_special_ordering_compare::
1516          operator()): New function.
1517         (Output_section::sort_attached_input_sections): Use new sort function
1518         for .text.
1519         * output.h (Input_section_sort_section_name_special_ordering_compare):
1520         New struct.
1521         * testsuite/Makefile.am (text_section_grouping): Test option
1522         --no-text-reorder
1523         * testsuite/Makefile.in: Regenerate.
1524         * testsuite/text_section_grouping.sh: Check order of functions without
1525         default text reordering.
1526
1527 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
1528
1529         * options.h (General_options): Change default to true for new_dtags.
1530
1531 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
1532
1533         * layout.cc (Layout::finish_dynamic_section): Only add DT_RPATH
1534         when enable_new_dtags is false.  Only add DT_RUNPATH when
1535         enable_new_dtags is true.
1536
1537 2013-01-17  Serge Pavlov  <serge.v.pavlov@gmail.com>
1538
1539         * powerpc.cc (Stub_table::find_plt_call_entry): Make types
1540         used in declaration and definition consistent.
1541         (Target_powerpc::symval_for_branch): Ditto.
1542
1543 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
1544
1545         * testsuite/plugin_final_layout.cc: Fix comment.
1546
1547 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
1548
1549         * layout.cc (Layout::layout): Do not do default sorting for
1550         text sections when section ordering is specified.
1551         (make_output_section): Ditto.
1552         * testsuite/plugin_final_layout.cc: Name the function sections
1553         to catch reordering issues.
1554
1555 2013-01-15  Alan Modra  <amodra@gmail.com>
1556
1557         * powerpc.cc (Target_powerpc::do_relax): Default shared libs to
1558         plt-thread-safe.
1559
1560 2013-01-15  Alan Modra  <amodra@gmail.com>
1561
1562         * testsuite/Makefile.am (final_layout_script.lds): Handle .got section.
1563         * testsuite/Makefile.in: Regenerate.
1564
1565 2013-01-14  Alan Modra  <amodra@gmail.com>
1566
1567         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add various output files.
1568         * testsuite/Makefile.in: Regenerate.
1569
1570 2013-01-11  Pavel Chupin  <pavel.v.chupin@intel.com>
1571
1572         PR bfd/14430
1573         Fix mingw gold build with plugins enabled
1574         * Makefile.am: Replace -ldl with @DLOPEN_LIBS@.
1575         * configure.ac: Export DLOPEN_LIBS and add headers check.
1576         * plugin.cc: Handle non-dlfcn case.
1577         * Makefile.in: Regenerate.
1578         * config.in: Regenerate.
1579         * configure: Regenerate.
1580         * testsuite/Makefile.in: Regenerate.
1581
1582 2013-01-09  Sriraman Tallam  <tmsriram@google.com>
1583
1584         * output.h (sort_attached_input_sections): Change to be public.
1585         * script-sections.cc
1586         (Output_section_definition::set_section_addresses): Sort
1587         attached input sections according to section order before linker
1588         script assigns section addresses.
1589         (Orphan_output_section::set_section_addresses): Sort
1590         attached input sections according to section order before linker
1591         script assigns section addresses.
1592         * Makefile.am (final_layout.sh): Use a simple linker script to
1593         check if section ordering still works.
1594         * Makefile.in: Regenerate.
1595
1596 2013-01-09  Ben Cheng  <bccheng@google.com>
1597
1598         * arm.cc (Target_arm::attributes_accept_div): New function.
1599         (Target_arm::attributes_forbid_div): New function.
1600         (Target_arm::merge_object_attributes): Merge the Tag_DIV_use
1601         attribute using the same new functions as what bfd/elf32_arm.c
1602         does.
1603
1604 2013-01-07  Cary Coutant  <ccoutant@google.com>
1605
1606         PR gold/14993
1607         * output.cc (Output_section::add_input_section): For incremental
1608         updates, don't track input sections that are allocated from patch
1609         space.
1610
1611 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
1612             Ian Lance Taylor  <iant@google.com>
1613
1614         PR gold/14897
1615         * configure.ac (--enable-ld): Removed.
1616         (install_as_default): Set to yes only for --enable-gold=default
1617         or --disable-ld.
1618         * configure: Regenerated.
1619
1620 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
1621
1622         * options.h (General_options): Add -fuse-ld= for GCC linker
1623         option compatibility.
1624
1625 2013-01-04  Cary Coutant  <ccoutant@google.com>
1626
1627         * configure.ac: Fix typo restoring CXXFLAGS.
1628         * configure: Regenerate.
1629
1630 2013-01-04  Cary Coutant  <ccoutant@google.com>
1631
1632         * testsuite/Makefile.am (CXXLINK_S): New macro.
1633         (debug_msg_so.err, debug_msg_ndebug.err): Use CXXLINK_S.
1634         * testsuite/Makefile.in: Regenerate.
1635
1636 2013-01-02  H.J. Lu  <hongjiu.lu@intel.com>
1637
1638         * version.cc (print_version): Update copyright year to 2013.
1639
1640 2012-12-20  Ian Lance Taylor  <iant@google.com>
1641
1642         * layout.cc (Layout::special_ordering_of_input_section): New
1643         function.
1644         (Layout::layout): If input section requires special ordering, must
1645         sort input sections.
1646         (Layout::make_output_section): May sort .text input sections.
1647         (Layout::is_section_name_prefix_grouped): Remove.
1648         * layout.h (class Layout): Declare
1649         special_ordering_of_input_section.  Don't declare
1650         is_section_name_prefix_grouped.
1651         * output.cc (Output_section::add_input_section): Revert last
1652         change.
1653         (Output_section::Input_section_sort::match_file_name): Don't crash
1654         if called on output section data.
1655         (Output_section::Input_section_sort_compare): Sort based on
1656         special ordering.
1657         (Output_section::Input_section_sort_section_order_index_compare):
1658         Revert last patch.
1659         (Output_section::sort_attached_input_sections): Likewise.
1660
1661 2012-12-18  Sriraman Tallam  <tmsriram@google.com>
1662
1663         * layout.cc (Layout::is_section_name_prefix_grouped): New function.
1664         * layout.h (Layout::is_section_name_prefix_grouped): New function.
1665         * output.cc (Output_section::add_input_section): Check if section
1666         name contains special prefix.  Keep input sections to sort such
1667         sections.
1668         (Output_section::Input_section_sort_section_order_index_compare
1669          ::operator()): Group sections according to prefixes.
1670         (Output_section::sort_attached_input_sections): Add condition to
1671         Input_section_entry constructor call.
1672         * testsuite/Makefile.am (text_section_grouping): New test.
1673         * testsuite/Makefile.in: Regenerate.
1674         * testsuite/text_section_grouping.cc: New file.
1675         * testsuite/text_section_grouping.sh: New file.
1676
1677 2012-12-17  Nick Clifton  <nickc@redhat.com>
1678
1679         * Makefile.am: Add copyright notice.
1680         * NEWS: Likewise.
1681         * README: Likewise.
1682         * configure.ac: Likewise.
1683         * ftruncate.c: Likewise.
1684         * Makefile.in: Regenerate.
1685
1686 2012-12-14  Cary Coutant  <ccoutant@google.com>
1687
1688         * testsuite/Makefile.am (exception_separate_shared_12_test): Add
1689         --no-as-needed flag.
1690         (exception_separate_shared_12_test): Likewise.
1691         (incremental_copy_test): Likewise.
1692         * testsuite/Makefile.in: Regenerate.
1693
1694 2012-12-14  Cary Coutant  <ccoutant@google.com>
1695
1696         * dwp.cc (Dwp_output_file::add_cu_set): Check for duplicate CUs.
1697         (Dwp_output_file::Dwp_index::enter_set): Add assert.
1698
1699 2012-12-12  Alan Modra  <amodra@gmail.com>
1700
1701         * powerpc.cc (class Track_tls): New.
1702         (class Relocate, class Scan): Inherit Track_tls.
1703         (Target_powerpc::Scan::local, global): Track tls optimization
1704         and avoid creating plt entry for __tls_get_addr if all uses
1705         are optimized away.
1706         (Target_powerpc::Relocate::relocate): Update to use Track_tls.
1707
1708 2012-12-12  Alan Modra  <amodra@gmail.com>
1709
1710         * options.h (General_options): Add --toc-sort/--no-toc-sort.
1711         Replace no_toc_optimize with toc_optimize.
1712         * output.h (Output_section::input_sections): Provide non-const variant.
1713         * powerpc.cc (Powerpc_relobj::has_small_toc_reloc_,
1714         set_has_small_toc_reloc, has_small_toc_reloc): New variable and
1715         accessors.
1716         (Target_powerpc::Scan::local, global): Call set_has_small_toc_reloc.
1717         (class Sort_toc_sections): New.
1718         (Target_powerpc::do_finalize_sections): Sort toc sections.
1719         (Target_powerpc::Relocate::relocate): Update toc_optimize test.
1720
1721 2012-12-10  Roland McGrath  <mcgrathr@google.com>
1722
1723         * testsuite/binary_unittest.cc (read_all): New function.
1724         (Sized_binary_test): Use it instead of ::read.
1725         * fileread.cc (do_read): Don't assume pread always reads the whole
1726         amount in a single call.
1727
1728 2012-12-10  Alan Modra  <amodra@gmail.com>
1729
1730         * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
1731         Set EM_PPC64 or EM_PPC here.
1732         (Target_selector_powerpc::do_recognize): Delete.
1733
1734 2012-12-10  Alan Modra  <amodra@gmail.com>
1735
1736         * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
1737         stub_table_.
1738         (Target_powerpc::Branch_info::make_stub): Don't omit addend.
1739
1740 2012-12-07  Roland McGrath  <mcgrathr@google.com>
1741
1742         * testsuite/binary_unittest.cc (Sized_binary_test):
1743         Use open_descriptor rather than ::open.
1744
1745 2012-12-07  Alan Modra  <amodra@gmail.com>
1746
1747         * powerpc.cc (Stub_table::do_write): Delete redundant Address
1748         typedef and invalid_address constant.
1749         (Output_data_glink, Stub_table, Target_powerpc): Explicitly
1750         instantiate constants.
1751
1752 2012-12-06  Roland McGrath  <mcgrathr@google.com>
1753
1754         * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
1755         Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
1756         * aclocal.m4: Regenerate.
1757         * configure: Regenerate.
1758         * Makefile.in: Regenerate.
1759         * testsuite/Makefile.in: Regenerate.
1760
1761 2012-12-07  Alan Modra  <amodra@gmail.com>
1762
1763         * options.h (General_options): Add no_toc_optimize.
1764         * powerpc.cc (ok_lo_toc_insn): New function.
1765         (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
1766
1767 2012-12-06  Alan Modra  <amodra@gmail.com>
1768
1769         * options.h (General_options): Add plt_align, plt_static_chain,
1770         plt_thread_safe.  Update stub_group_size help text.
1771         * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
1772         for new plt_thread_safe_ var.
1773         (use_plt_offset): Correct comments.
1774         (Target_powerpc::do_relax): Look for thread creation symbols to
1775         determine default plt_thread_safe value.  Clear plt call stubs
1776         as well as branch stubs each iteration.
1777         (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
1778         insn constants.
1779         (l, hi, ha, write_insn): Move earlier.
1780         (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
1781         (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
1782         plt stubs too.
1783         (Stub_table::update_size): Adjust.
1784         (Stub_table::prev_size, set_prev_size): Delete.
1785         (Stub_table::stub_align): Let --plt-align affect result.
1786         (Stub_table::plt_call_size): Calculate sizes for various stubs.
1787         (Stub_table::branch_stub_size): Use last_plt_size in address calc.
1788         (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
1789         (Stub_table::do_write): Support more stub variants.
1790
1791 2012-12-04  Alan Modra  <amodra@gmail.com>
1792
1793         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
1794         (Target_powerpc::do_define_standard_symbols): New function.
1795
1796 2012-12-03  Alan Modra  <amodra@gmail.com>
1797
1798         * output.h: Formatting, whitespace.
1799
1800 2012-12-03  Alan Modra  <amodra@gmail.com>
1801
1802         * layout.h (Layout::get_executable_sections): Declare.
1803         * layout.cc (Layout::get_executable_sections): New function.
1804         * arm.cc (Target_arm::group_sections): Use it.
1805         (Arm_output_section::group_sections): Delete now redundant test.
1806         * output.cc (Output_reloc::Output_reloc): Add is_relative.
1807         param to handle relative relocs.
1808         * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
1809         (Output_data_reloc::add_absolute): Adjust.
1810         (Output_data_reloc::add_relative): New function.
1811         (Output_data::reset_data_size): New function.
1812         (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
1813         (Output_section::set_addralign): New function.
1814         (Output_section::checkpoint_set_addralign): New function.
1815         (Output_section::clear_section_offsets_need_adjustment): New function.
1816         (Output_section::input_sections): Make public.
1817         * powerpc.cc (class Output_data_brlt_powerpc): New.
1818         (class Stub_table, class Stub_control): New.
1819         (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
1820         stub_table_, set_stub_table, stub_table): New vectors and accessor
1821         functions.
1822         (Target_powerpc::do_may_relax, do_relax, push_branch,
1823         new_stub_table, stub_tables, brlt_section, group_sections,
1824         add_branch_lookup_table, find_branch_lookup_table,
1825         write_branch_lookup_table, make_brlt_section): New functions.
1826         (Target_powerpc::struct Sort_sections, class Branch_info): New.
1827         (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
1828         branch_info_): New vars.
1829         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
1830         make call stubs here.
1831         (Output_data_glink): Remove all call stub handling from this class.
1832         (Target_powerpc::Scan::local, global): Save interesting branch
1833         relocs and relocs for ifunc.  Adjust calls to plt entry functions.
1834         (Target_powerpc::do_finalize_sections): Only make reg save/restore
1835         functions on final link.
1836         (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
1837         Handle long branch destinations too.
1838         (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
1839         do_plt_address_for_local): Adjust lookup of plt call stubs.
1840
1841 2012-11-30  Alan Modra  <amodra@gmail.com>
1842
1843         * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
1844         relocs against protected symbols when building 32-bit shared libs.
1845
1846 2012-11-30  Alan Modra  <amodra@gmail.com>
1847
1848         * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
1849         param.  Call got_section() to make .got.  Update all callers
1850         and their callers and so on.
1851
1852 2012-11-30  Alan Modra  <amodra@gmail.com>
1853
1854         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
1855         _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
1856         (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
1857         value if it already exists.
1858
1859 2012-11-19  H.J. Lu  <hongjiu.lu@intel.com>
1860
1861         PR gold/14858
1862         * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
1863
1864 2012-11-14  Roland McGrath  <mcgrathr@google.com>
1865
1866         * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
1867         than bfc instruction for data sandboxing.
1868
1869 2012-11-08  Alan Modra  <amodra@gmail.com>
1870
1871         * po/POTFILES.in: Regenerate.
1872
1873 2012-11-05  Alan Modra  <amodra@gmail.com>
1874
1875         * configure.ac: Apply 2012-09-10 change to config.in here.
1876         * configure: Regenerate.
1877
1878 2012-11-05  Alan Modra  <amodra@gmail.com>
1879
1880         * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
1881         (struct Opd_ent): Use "Address" rather than "Offset".
1882         (Output_data_got_powerpc::got_base_offset): Return Valtype.
1883         (Target_powerpc::got_section): Make public.
1884         (Target_powerpc::scan_relocs): Move code setting symbols..
1885         (Powerpc_relobj::do_scan_relocs): ..to here, new function.
1886         Create _SDA_BASE_ only when referenced.
1887
1888 2012-11-02  Roland McGrath  <mcgrathr@google.com>
1889
1890         * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
1891         from last change.
1892
1893 2012-11-01  Roland McGrath  <mcgrathr@google.com>
1894
1895         * target.h (Sized_target::relocate_relocs): Use Elf_Off
1896         for offset_in_output_section parameter.
1897         (Sized_target::relocate_special_relocatable): Likewise.
1898         * arm.cc (Target_arm::relocate_relocs): Likewise.
1899         (Target_arm::relocate_special_relocatable): Likewise.
1900         * i386.cc (Target_i386::relocate_relocs): Likewise.
1901         * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
1902         * sparc.cc (Target_sparc::relocate_relocs): Likewise.
1903         * target-reloc.h (relocate_relocs): Likewise.
1904         * testsuite/testfile.cc (Target_test): Likewise.
1905         * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
1906         * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
1907
1908         * system.h: Move inclusion of <clocale> to after <libintl.h> in
1909         [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
1910
1911         * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
1912         parameter, which is unused in the [!F_SETFD] case.
1913
1914         * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
1915         SYMNDX to off_t before comparing it to this->data_size().
1916         * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
1917         * incremental.cc (Output_section_incremental_inputs::do_write):
1918         Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
1919
1920         * nacl.cc: Include "libiberty.h" for vasprintf declaration.
1921
1922 2012-10-30  Steve McIntyre  <steve.mcintyre@linaro.org>
1923
1924         * gold.cc (Target_arm::do_adjust_elf_header): Add the
1925         hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
1926         in EABI_VER5.
1927
1928 2012-10-29  Cary Coutant  <ccoutant@google.com>
1929
1930         * dwp.cc (usage): Add file and exit status parameters;
1931         add --help and --version options.
1932         (print_version): New function.
1933         (main): Add --help and --version options.
1934
1935 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1936
1937         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
1938         final_layout_sequence.txt.
1939         * testsuite/Makefile.in: Regenerated.
1940
1941 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1942
1943         * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
1944         COMPILE generated by automake.
1945         (LINK1): Likewise.
1946         (CXXCOMPILE1): Likewise.
1947         (CXXLINK1): Likewise.
1948         (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
1949         (LINK): Likewise.
1950         (CXXCOMPILE): Likewise.
1951         (CXXLINK): Likewise.
1952         * testsuite/Makefile.in: Regenerated.
1953
1954 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1955
1956         * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
1957         on bad fwrite return.
1958
1959 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1960
1961         * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
1962         on val.
1963
1964 2012-10-23  Cary Coutant  <ccoutant@google.com>
1965
1966         * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
1967         * testsuite/Makefile.in: Regenerate.
1968         * testsuite/dwp_test.h: New source file.
1969         * testsuite/dwp_test_1.cc: New source file.
1970         * testsuite/dwp_test_1.s: New source file.
1971         * testsuite/dwp_test_1.sh: New source file.
1972         * testsuite/dwp_test_1b.cc: New source file.
1973         * testsuite/dwp_test_1b.s: New source file.
1974         * testsuite/dwp_test_2.cc: New source file.
1975         * testsuite/dwp_test_2.s: New source file.
1976         * testsuite/dwp_test_2.sh: New source file.
1977         * testsuite/dwp_test_main.cc: New source file.
1978         * testsuite/dwp_test_main.s: New source file.
1979
1980 2012-10-23  Cary Coutant  <ccoutant@google.com>
1981
1982         * dwp.h: New header file.
1983         * dwp.cc: New source file.
1984         * gold.h: Move shared declarations to system.h.
1985         * system.h: New header file.
1986         * Makefile.am: Add dwp.
1987         * Makefile.in: Regenerate.
1988
1989 2012-10-23  Cary Coutant  <ccoutant@google.com>
1990
1991         * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
1992         Dwarf_info_reader::read_from_pointer.
1993         (Dwarf_pubnames_table::read_header): Likewise.
1994         (Dwarf_pubnames_table::next_name): Likewise.
1995         (Dwarf_die::read_attributes): Likewise.
1996         (Dwarf_die::skip_attributes): Likewise.
1997         (Dwarf_info_reader::read_from_pointer): New function template.
1998         * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
1999         (Dwarf_pubnames_table): Likewise.
2000         (Dwarf_info_reader::read_from_pointer): New function template.
2001         * gdb-index.cc (Gdb_index_info_reader): Adjust call to
2002         Dwarf_pubnames_table ctor.
2003
2004 2012-10-23  Cary Coutant  <ccoutant@google.com>
2005
2006         * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
2007         abbrev_shndx.
2008         * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
2009         abbrev_shndx_.
2010         (Dwarf_info_reader::set_abbrev_shndx): New method.
2011         (Dwarf_info_reader::abbrev_shndx_): New data member.
2012
2013 2012-10-23  Cary Coutant  <ccoutant@google.com>
2014
2015         * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
2016         from object, not parameters.
2017         (Dwarf_info_reader::parse): Likewise.
2018         * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
2019         (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
2020         (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
2021         methods.
2022
2023 2012-10-23  Cary Coutant  <ccoutant@google.com>
2024
2025         * fileread.cc (Input_file::Input_file): New constructor.
2026         * fileread.h (class Input_file): Add new constructor.
2027
2028 2012-10-18  Alan Modra  <amodra@gmail.com>
2029
2030         PR gold/14727
2031         * object.cc (Relobj::is_section_name_included): Also match
2032         .sdata personality section.
2033
2034 2012-10-18  Alan Modra  <amodra@gmail.com>
2035
2036         * target-reloc.h (class Default_comdat_behavior): New, package up..
2037         (get_comdat_behaviour): ..this.
2038         (relocate_section): Add Relocate_comdat_behavior template arg,
2039         adjust code to suit.
2040         * arm.cc (Target_arm::relocate_section): Adjust to suit.
2041         (Target_arm::scan_reloc_section): Likewise.
2042         * i386.cc (Target_i386::relocate_section): Likewise.
2043         * sparc.cc (Target_sparc::relocate_section): Likewise.
2044         * tilegx.cc (Target_tilegx::relocate_section): Likewise.
2045         * x86_64.cc (Target_x86_64::relocate_section): Likewise.
2046         * powerpc.cc (class Relocate_comdat_behavior): New.
2047         (Target_powerpc::relocate_section): Don't zap opd relocs.  Supply
2048         gold::relocate_section with new template arg.
2049
2050 2012-10-18  Alan Modra  <amodra@gmail.com>
2051
2052         * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
2053         dynamic relocs for GOT_TPREL got entries, without symbol if
2054         resolving locally.
2055         (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
2056         (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
2057         (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
2058
2059 2012-10-17  Alan Modra  <amodra@gmail.com>
2060
2061         PR gold/14726
2062         * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
2063
2064 2012-10-16  Sriraman Tallam  <tmsriram@google.com>
2065
2066         * layout.cc (Layout::include_section): Keep sections marked
2067         SHF_EXCLUDE when doing relocatable links.
2068
2069 2012-10-16  Alan Modra  <amodra@gmail.com>
2070
2071         * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
2072         (Target_powerpc::do_finalize_sections): Call it.
2073         (Output_data_save_res): New class and supporting functions.
2074         (Target_powerpc::symval_for_branch): Only look up .opd entry for
2075         normal symbols defined in object files.
2076
2077 2012-10-12  Alan Modra  <amodra@gmail.com>
2078
2079         * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
2080         (struct Opd_ent): Make "discard" a bit field.  Add "gc_mark".
2081         (Target_powerpc::do_gc_mark_symbol): Delay marking function code
2082         section if scan_opd_relocs not yet called.
2083         (Target_powerpc::gc_process_relocs): Call process_gc_mark.
2084
2085 2012-10-12  Alan Modra  <amodra@gmail.com>
2086
2087         * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
2088         add_local_ifunc_entry): Revert last change.
2089         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
2090
2091 2012-10-05  Alan Modra  <amodra@gmail.com>
2092
2093         * powerpc.cc (Target_powerpc::do_plt_address_for_local,
2094         do_plt_address_for_global): New functions.
2095         (Output_data_got_powerpc::do_write): Don't segfault when linking
2096         statically.
2097         (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
2098         add_local_ifunc_entry): Return true on adding entry..
2099         (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
2100         glink->add_entry call.  Remove unused symtab param.  Adjust calls.
2101         (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
2102         (Target_powerpc::make_iplt_section): Remove symtab param.  Don't
2103         set up symbols here.
2104         (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
2105         syms here.  Do so even when no .iplt.  Don't segfault when linking
2106         statically.
2107         (Output_data_glink::add_entry, find_entry): Rearrange params.  Add
2108         new variants without reloc param.
2109         (Glink_sym_ent::Glink_sym_ent): Likewise.
2110         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
2111         reloc when refs will resolve to plt call stub.
2112         (Target_powerpc::Scan::local): Correct ifunc handling.  Allow
2113         R_PPC_PLTREL24 to resolve locally.
2114         (Target_powerpc::Scan::global): Correct ifunc handling.
2115         (Target_powerpc::Relocate::relocate): Correct local sym glink
2116         lookup.  Don't destroy "value" when we have a plt call stub,
2117         and when checking plt call validity.
2118         (Target_powerpc::do_dynsym_value): Simplify.
2119
2120 2012-10-05  Alan Modra  <amodra@gmail.com>
2121
2122         * i386.cc (Output_data_plt_i386::address_for_global,
2123         address_for_local): Add plt offset to returned value.  Adjust uses.
2124         * sparc.cc (Output_data_plt_sparc::address_for_global,
2125         address_for_local): Likewise.
2126         * tilegx.cc (Output_data_plt_tilegx::address_for_global,
2127         address_for_local): Likewise.
2128         * x86_64.cc (Output_data_plt_x86_64::address_for_global,
2129         address_for_local): Likewise.
2130         * target.h (Target::plt_address_for_global, plt_address_for_local):
2131         Update comment.
2132         * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
2133         (Output_data_got::Got_entry::write): Nor here.
2134         * output.h: Comment fix.
2135
2136 2012-10-02  Jiong Wang  <jiwang@tilera.com>
2137
2138         * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
2139         global_offset_table_ value for larget got.
2140         (Target_tilegx::Relocate::relocate): Handle adjusted got value.
2141
2142 2012-09-29  Alan Modra  <amodra@gmail.com>
2143
2144         * powerpc.cc (Target_powerpc::iplt_): New output section.
2145         (Target_powerpc::iplt_section, make_iplt_section,
2146         reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
2147         (Target_powerpc::make_plt_entry): Handle ifunc syms.
2148         Target_powerpc::plt_entry_count): Count iplt entries too.
2149         (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
2150         reloc section in constructor.  New params.
2151         (Target_powerpc::make_plt_section): Create reloc section here instead.
2152         (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
2153         functions.
2154         (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
2155         (Output_data_glink::add_entry, find_entry): New functions to
2156         deal with local syms.
2157         (Glink_sym_ent): Add support for local syms.
2158         (Output_data_glink::do_write): Handle ifunc plt entries.
2159         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
2160         (Target_powerpc::Scan::local, global): Handle ifunc syms.
2161         (Target_powerpc::Relocate::relocate): Likewise.
2162         (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
2163
2164 2012-09-25  Alan Modra  <amodra@gmail.com>
2165
2166         * object.h (Sized_relobj_file::adjust_local_symbol,
2167         do_adjust_local_symbol): New functions.
2168         * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
2169         * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
2170         (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
2171         and irregular opd entry spacing.
2172         (Powerpc_relobj::do_read_relocs): Add opd size checks.
2173         (Global_symbol_visitor_opd): New functor.
2174         (Target_powerpc::do_finalize_sections): Omit global symbols defined
2175         on deleted opd entries.
2176
2177 2012-09-15  Jiong Wang  <jiwang@tilera.com>
2178
2179         * tilegx.cc: New file.
2180         * Makefile.am (TARGETSOURCES): Add tilegx.cc
2181         (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
2182         * configure.tgt: Add entries for tilegx*.
2183         * configure.ac: Likewise.
2184         * Makefile.in: Rebuild.
2185         * configure: Likewise.
2186         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
2187         tilegx.
2188
2189 2012-09-13  Alan Modra  <amodra@gmail.com>
2190
2191         * target-reloc.h (scan_relocs): Call scan.local for relocs
2192         against symbols in discarded sections.  Pass is_discarded
2193         param.
2194         * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
2195         Add is_discarded param.
2196         * powerpc (Target_powerpc::Scan::local): Likewise.  Use
2197         is_discarded to flag opd entry as discarded.  Don't emit dyn
2198         relocs on such entries.
2199         (Target_powerpc::Scan::global): Similarly detect and handle
2200         such opd entries.
2201         (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
2202         opd_ent_.  Update all uses.
2203         (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
2204         (Target_powerpc::relocate_section): Zero out discarded opd
2205         entry relocs.
2206
2207 2012-09-12  Ian Lance Taylor  <iant@google.com>
2208
2209         PR gold/14570
2210         * output.cc: Rename Output_data_got template parameter from size
2211         to got_size for all functions.  Compile all variants of
2212         Output_data_got.
2213         (Output_data_got::Got_entry::write): Correct use of size for
2214         symbol value.  Use local_is_tls rather than casting to
2215         Sized_relobj_file.
2216         * object.h (class Object): Add local_is_tls and do_local_is_tls.
2217         (class Sized_relobj_file): Add do_local_is_tls.
2218         * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
2219
2220 2012-09-11  Alan Modra  <amodra@gmail.com>
2221
2222         PR gold/14566
2223         * layout.cc (Layout::set_segment_offsets): When using
2224         common-page-size alignment, ensure we are on a new max-page-size
2225         page.
2226         * output.cc (Output_segment::set_section_addresses): Use
2227         abi_pagesize, not common_pagesize for relro boundary.
2228         (Output_segment::set_offset): Likewise.
2229
2230 2012-09-11  Alan Modra  <amodra@gmail.com>
2231
2232         * output.h (Output_data_got::add_global_tls, add_local_tls,
2233         add_local_tls_pair): New functions.
2234         (Output_data_got::add_local_pair_with_rel): Remove second
2235         reloc param.  Expand comment.
2236         (Output_data_got::Got_entry): Rename use_plt_offset_ to
2237         use_plt_or_tls_offset_, similarly for constructor param.
2238         (Output_data_got::Got_entry::write): Add got_index param.
2239         * output.cc (Output_data_got::add_global_tls, add_local_tls,
2240         add_local_tls_pair): New functions.
2241         (Output_data_got::Got_entry::write): Handle tls symbols
2242         with use_plt_or_tls_offset_ set specially.
2243         (Output_data_got::add_local_pair_with_rel): Only one reloc.
2244         (Output_data_got::do_write): Replace iterator with index, pass
2245         index to entry write function.
2246         * target.h (Target::tls_offset_for_local, tls_offset_for_global,
2247         do_tls_offset_for_local, do_tls_offset_for_global): New functions.
2248         * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
2249         call.
2250         * i386.cc (Target_i386::Scan::local): Likewise.
2251         * sparc.cc (Target_sparc::Scan::local): Likewise.
2252         * x86_64.cc (Target_x86_64::Scan::local): Likewise.
2253         * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
2254         do_tls_offset_for_global): New functions.
2255         (Target_powerpc::Scan::local): Correct TLS relocations and got
2256         entry values.
2257         (Target_powerpc::Scan::global): Don't emit unnecessary
2258         dynamic relocations on TLS GOT entries.
2259
2260 2012-09-10  Matthias Klose  <doko@ubuntu.com>
2261
2262         * config.in: Disable sanity check for kfreebsd.
2263
2264 2012-09-10  Sterling Augustine  <saugustine@google.com>
2265
2266         * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
2267         (Gdb_index::pubtypes_read): New parameter.
2268         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
2269         to calls.
2270         * gdb-index.h (Gdb_index): New fields pubnames_object_ and
2271         pubtypes_object_.
2272
2273 2012-09-09  Alan Modra  <amodra@gmail.com>
2274
2275         * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
2276         (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
2277         * gc.h (gc_process_relocs): Call target gc_add_reference.
2278         * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
2279         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
2280         (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
2281         unnecessary cast.
2282         * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
2283         to cater for when we don't need code offset.  Update use.
2284         (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
2285         (Powerpc_relobj::access_from_map, add_reference, opd_valid,
2286         set_opd_valid): New functions.
2287         (Target_powerpc::do_gc_add_reference): New function.
2288         (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
2289         stashed refs.
2290         (Target_powerpc::do_gc_mark_symbol): New function.
2291
2292 2012-09-06  Cary Coutant  <ccoutant@google.com>
2293
2294         * dwarf_reader.cc (Dwarf_die::read_attributes): Add
2295         DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
2296         (Dwarf_die::skip_attributes): Likewise.
2297         * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
2298         * testsuite/gdb_index_test.cc (inline_func_1): New function.
2299         (main): Call it.
2300         * testsuite/gdb_index_test_comm.sh: Check index for inline function.
2301
2302 2012-09-05  H.J. Lu  <hongjiu.lu@intel.com>
2303
2304         * testsuite/script_test_3.t: Add .got.plt output section
2305         statement.
2306         * testsuite/script_test_4.t: Likewise.
2307
2308 2012-09-05  Alan Modra  <amodra@gmail.com>
2309
2310         * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
2311         update all uses and lose "enum" when using type.
2312
2313 2012-09-05  Alan Modra  <amodra@gmail.com>
2314
2315         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
2316         * configure: Regenerate.
2317         * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
2318         (plugin_final_layout.stdout): Likewise.
2319         (memory_test): Set page sizes to 0x1000.
2320         * testsuite/Makefile.in: Regenerate.
2321         * testsuite/discard_locals_test.sh: Add FIXME comment.
2322         * testsuite/justsyms_exec.c: Disable function test for powerpc64.
2323         * testsuite/pr14265.t: Add .got output section statement.
2324         * testsuite/script_test_2.t: Likewise.
2325         * testsuite/script_test_3.t: Likewise.
2326         * testsuite/script_test_4.t: Likewise.
2327         * testsuite/script_test_5.t: Likewise.
2328         * testsuite/script_test_6.t: Likewise.
2329         * testsuite/script_test_7.t: Likewise.
2330         * testsuite/script_test_9.t: Likewise.
2331
2332 2012-09-05  Alan Modra  <amodra@gmail.com>
2333
2334         * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
2335         (Powerpc_relocate_functions::Status): New typedef.
2336         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
2337         (Target_powerpc::Scan::local): Handle REL64.
2338         (Target_powerpc::Scan::global): Likewise, and dynamic relocs
2339         for REL32 and REL64.
2340         (Target_powerpc::symval_for_branch): New function, extracted from..
2341         (Target_powerpc::Relocate::relocate): ..here.  Correct plt call
2342         checks.  Report overflow errors.
2343
2344 2012-09-05  Alan Modra  <amodra@gmail.com>
2345
2346         * object.h (Sized_relobj_file::emit_relocs): Delete.
2347         (Sized_relobj_file::emit_relocs_reltype): Delete.
2348         * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
2349         relocate_relocs for --emit-relocs.
2350         (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
2351         * output.h: Update comment.
2352         (Output_segment::first_section): New function.
2353         (Output_segment::first_section_load_address): Use first_section.
2354         * output.cc (Output_segment::first_section): New function extracted..
2355         (Output_segment::first_section_load_address): ..from here.  Delete.
2356         * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
2357         * target.h (Sized_target::relocate_for_relocatable): Likewise.
2358         * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
2359         adjust call to target.h function.
2360         * i386.cc (Target_i386): Likewise.
2361         * sparc.cc (Target_sparc): Likewise.
2362         * x86_64.cc (Target_x86_64): Likewise.
2363         * powerpc.cc (Target_powerpc): Likewise.
2364         (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS.  Ensure
2365         first tls section has section symbol for optimised local dynamic
2366         output relocs.
2367         (Target_powerpc::Relocate::relocate): Correct local dynamic value.
2368         (Target_powerpc::relocate_relocs): Adjust relocs emitted for
2369         optimised tls code.
2370         * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
2371         Rename to relocate_relocs.  Update error message.
2372
2373 2012-09-04  Andreas Schwab  <schwab@linux-m68k.org>
2374
2375         * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
2376         --just-symbols.
2377
2378 2012-08-31  Alan Modra  <amodra@gmail.com>
2379
2380         * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
2381         (Powerpc_relobj::toc_base_offset): New stub function.
2382         (Target_powerpc): Add tp_offset, dtp_offset.  Rename
2383         got_mod_index_offset to tlsld_got_offset.  Update all refs.
2384         (Target_powerpc::Relocate::enum skip_tls): New.
2385         (Target_powerpc::call_tls_get_addr_): New var.
2386         (Target_powerpc::is_branch_reloc): Move to file scope.
2387         (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
2388         (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
2389         New functions.
2390         (Target_powerpc::enum Got_type): Delete old values, add new ones.
2391         (powerpc_info): Correct common_pagesize for ppc64.
2392         (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
2393         (Powerpc_relocate_functions): Add overflow check enums and functions.
2394         Add non-shift version of rela, rela_ua.  Delete all rel public
2395         functions.  Delete addr16_lo.  Add addr64, addr64_u, addr32,
2396         addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
2397         addr16_ha3, addr14 functions.
2398         (Output_data_got_powerpc::add_constant_pair): New function.
2399         (Output_data_got_powerpc::got_base_offset): Likewise.
2400         (Output_data_got_powerpc::do_write): Correct 64-bit got header.
2401         (instruction constants): Sort, add some more.
2402         (Output_data_glink::do_write): Add and use Address typedef.  Use
2403         object->toc_base_offset() stub for 64-bit.
2404         (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
2405         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
2406         (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
2407         for R_PPC64_TOC.  Handle more relocs.  Generate got entries for TLS.
2408         Always treat .opd relocs as against locally defined symbol.
2409         Correct condition for RELATIVE relocs.
2410         (Target_powerpc::do_finalize_sections): Test for NULL sections.
2411         (Target_powerpc::Relocate::relocate): Use plt call stub as value
2412         for 32-bit syms with a plt entry.  Correct ppc64 toc base
2413         calculations.  Handle TLS relocs, and more.  Add overflow
2414         checking and adjust for Powerpc_relocate_functions changes.
2415         (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
2416         Reinstate --emit-relocs code with FIXME.
2417
2418 2012-08-30  Alan Modra  <amodra@gmail.com>
2419
2420         * layout.cc (Layout::set_segment_offsets): Set p_align to
2421         abi_pagesize, not common_pagesize.
2422         (Layout::relaxation_loop_body): Similarly use abi_pagesize
2423         to determine whether file header can go in segment.
2424
2425 2012-08-30  Alan Modra  <amodra@gmail.com>
2426
2427         * output.h (Output_reloc::Output_reloc <output section>): Add
2428         is_relative param.  Adjust calls.
2429         (Output_reloc::add_output_section_relative): New functions.
2430         * output.cc (Output_reloc::Output_reloc <output section>): Handle
2431         is_relative.
2432         (Output_reloc::symbol_value): Handle SECTION_CODE.
2433
2434 2012-08-24  Sriraman Tallam  <tmsriram@google.com>
2435
2436         * gold.cc (queue_middle_tasks): Call layout again when unique
2437         segments for sections is desired.
2438         * layout.cc (Layout::Layout): Initialize new members.
2439         (Layout::get_output_section_flags): New function.
2440         (Layout::choose_output_section): Call get_output_section_flags.
2441         (Layout::layout): Make output section for mapping to a unique segment.
2442         (Layout::insert_section_segment_map): New function.
2443         (Layout::attach_allocated_section_to_segment): Make unique segment for
2444         output sections marked so.
2445         (Layout::segment_precedes): Check for unique segments when sorting.
2446         * layout.h (Layout::Unique_segment_info): New struct.
2447         (Layout::Section_segment_map): New typedef.
2448         (Layout::insert_section_segment_map): New function.
2449         (Layout::get_output_section_flags): New function.
2450         (Layout::is_unique_segment_for_sections_specified): New function.
2451         (Layout::set_unique_segment_for_sections_specified): New function.
2452         (Layout::unique_segment_for_sections_specified_): New member.
2453         (Layout::section_segment_map_): New member.
2454         * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
2455         Rename is_gc_pass_one to is_pass_one.
2456         Rename is_gc_pass_two to is_pass_two.
2457         Rename is_gc_or_icf to is_two_pass.
2458         Check for which pass based on whether symbols data is present.
2459         Make it two pass when unique segments for sections is desired.
2460         * output.cc (Output_section::Output_section): Initialize new
2461         members.
2462         * output.h (Output_section::is_unique_segment): New function.
2463         (Output_section::set_is_unique_segment): New function.
2464         (Output_section::is_unique_segment_): New member.
2465         (Output_section::extra_segment_flags): New function.
2466         (Output_section::set_extra_segment_flags): New function.
2467         (Output_section::extra_segment_flags_): New member.
2468         (Output_section::segment_alignment): New function.
2469         (Output_section::set_segment_alignment): New function.
2470         (Output_section::segment_alignment_): New member.
2471         (Output_segment::Output_segment): Initialize is_unique_segment_.
2472         (Output_segment::is_unique_segment): New function.
2473         (Output_segment::set_is_unique_segment): New function.
2474         (Output_segment::is_unique_segment_): New member.
2475         * plugin.cc (allow_unique_segment_for_sections): New function.
2476         (unique_segment_for_sections): New function.
2477         (Plugin::load): Add new functions to transfer vector.
2478         * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
2479         * Makefile.in: Regenerate.
2480         * testsuite/plugin_final_layout.sh: Check if unique segment
2481         functionality works.
2482         * testsuite/plugin_section_order.c (onload): Check if new interfaces
2483         are available.
2484         (allow_unique_segment_for_sections): New global.
2485         (unique_segment_for_sections): New global.
2486         (claim_file_hook): Call allow_unique_segment_for_sections.
2487         (all_symbols_read_hook): Call unique_segment_for_sections.
2488
2489 2012-08-22  Cary Coutant  <ccoutant@google.com>
2490
2491         * layout.cc (Layout::include_section): Don't assert on GROUP
2492         sections with --emit-relocs.
2493
2494 2012-08-21  Cary Coutant  <ccoutant@google.com>
2495
2496         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
2497         if --export-dynamic-symbol names an undef symbol.
2498
2499 2012-08-18  Alan Modra  <amodra@gmail.com>
2500
2501         * powerpc.cc: Formatting and white space.
2502         (Powerpc_relobj): Rename got2_section_ to special_.
2503         Add opd_ent_shndx_ and opd_ent_off_ vectors.
2504         (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
2505         scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
2506         (Target_powerpc): Add Address typedef and invalid_address.  Use
2507         throughout.
2508         (Target_powerpc::is_branch_reloc): New function.
2509         (Powerpc_relocate_functions): Add Address typedef, use throughout.
2510         (Powerpc_relocate_functions:rela, rela_ua): Correct type used
2511         for dst_mask, value and addend.
2512         (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
2513         (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
2514         (Output_data_glink::do_write): Correct toc base.  Don't try to use
2515         uint16_t for 24-bit offset.  Use get_output_section_offset and
2516         check return.
2517         (Target_powerpc::Scan::local): Handle more relocs.
2518         (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
2519         (Target_powerpc::Relocate::relocate): Correct toc base calculation.
2520         Plug in toc restoring insn after plt calls.  Translate branches
2521         to function descriptor symbols to corresponding entry point.
2522         (Target_powerpc::relocate_for_relocatable): Check return from
2523         get_output_section_offset.
2524         * symtab.h: Comment typo.
2525
2526 2012-08-14  Ian Lance Taylor  <iant@google.com>
2527
2528         * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
2529         unsupported_relocal_local to call unsupported_reloc_global.
2530
2531 2012-08-14  Nick Clifton  <nickc@redhat.com>
2532
2533         PR ld/14265
2534         * script-sections.cc (Sections_element::output_section_name): Add
2535         keep return parameter.
2536         (Output_section_element::match_name): Add keep return parameter.
2537         Return the value of the keep_ member.
2538         * script-sections.h (class Output_section): Update
2539         output_section_name prototype.
2540         * layout.cc (Layout::keep_input_section): New public member
2541         function.
2542         (Layout::choose_output_section): Pass keep parameter to
2543         output_section_name.
2544         * layout.h (class Layout): Add keep_input_section.
2545         * object.cc (Sized_relobj_file::do_layout): Check for kept input
2546         sections.
2547         * testsuite/Makefile.am: Add a test.
2548         * testsuite/Makefile.in: Regenerate.
2549         * testsuite/pr14265.c: Source file for the test.
2550         * testsuite/pr14265.t: Linker script for the test.
2551         * testsuite/pr14265.sh: Shell script for the test.
2552
2553 2012-08-14  Alan Modra  <amodra@gmail.com>
2554
2555         * target.h (Target::output_section_name): New function.
2556         (Target::do_output_section_name): New function.
2557         * layout.cc (Layout::choose_output_section): Call the above.
2558         * powerpc.cc (Target_powerpc::do_output_section_name): New function.
2559
2560 2012-08-14  Alan Modra  <amodra@gmail.com>
2561
2562         * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
2563         (Output_data_got_powerpc::do_write): Don't rely on base class lookup
2564         for replace_constant call.
2565         (Output_data_plt_powerpc::do_print_to_mapfile): New function.
2566         (Output_data_glink::do_print_to_mapfile): New function.
2567         (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
2568         (Target_powerpc::Relocate::relocate): Likewise.
2569
2570 2012-08-14  Alan Modra  <amodra@gmail.com>
2571
2572         * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
2573         (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
2574         (Output_data_glink::add_entry,find_entry): Remove shndx param.
2575         (class Glink_sym_ent): Rename from struct Glink_sym_ent.  Remove
2576         all references to shndx_.  Handle special case for R_PPC_PLTREL24
2577         here.
2578         (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
2579         (Output_data_glink::do_write): Retrieve got2_shdnx from object.
2580         (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
2581         here.
2582         (Target_powerpc::Scan::global): Nor on make_plt_entry call.
2583         (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
2584
2585 2012-08-12  Alan Modra  <amodra@gmail.com>
2586
2587         * powerpc.cc: Whitespace fixes.  Wrap overly long lines.
2588         (glink insn constants): Use uint32_t.
2589         (Output_data_glink::add_entry): Use insert, not [] operator.
2590
2591 2012-08-11  Alan Modra  <amodra@gmail.com>
2592
2593         * object.h (Sized_relobj_file::find_shdr): New function.
2594         (Sized_relobj_file::find_special_sections): New function.
2595         * object.cc (Sized_relobj_file::find_shdr): New function.
2596         (Sized_relobj_file::find_eh_frame): Use find_shdr.
2597         (Sized_relobj_file::find_special_sections): New function, split out..
2598         (Sized_relobj_file::do_read_symbols): ..from here.
2599         * output.h (Output_data_got::replace_constant): New function.
2600         (Output_data_got::num_entries): New function.
2601         (Output_data_got::last_got_offset,set_got_size): Use num_entries.
2602         (Output_data_got::got_offset): Protected rather than private.
2603         (Output_data_got::replace_got_entry): New function.
2604         * output.cc (Output_data_got::replace_got_entry): New function.
2605         * powerpc.cc (class Powerpc_relobj): New.
2606         (class Powerpc_relocate_functions): Delete all psymval variants or
2607         convert to value,addend type.  Delete pcrela, pcrela_unaligned.
2608         Implement _ha functions using corresponding _hi function.
2609         (Powerpc_relobj::find_special_sections): New function.
2610         (Target_powerpc::do_make_elf_object): New function.
2611         (class Output_data_got_powerpc): New.
2612         (class Output_data_glink): New.
2613         (class Powerpc_scan_relocatable_reloc): New.
2614         Many more changes througout file.
2615
2616 2012-08-09  Nick Clifton  <nickc@redhat.com>
2617
2618         * po/vi.po: Updated Vietnamese translation.
2619
2620 2012-08-07  Ian Lance Taylor  <iant@google.com>
2621
2622         * layout.cc (Layout::add_target_dynamic_tags): If
2623         dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
2624         plt_rel.
2625
2626 2012-07-30  Nick Clifton  <nickc@redhat.com>
2627
2628         * po/gold.pot: Updated template.
2629         * po/es.po: Updated Spanish translation.
2630
2631 2012-07-18  Cary Coutant  <ccoutant@google.com>
2632
2633         PR gold/14344
2634         * configure.ac: Add check for -gpubnames support.
2635         * configure: Regenerate.
2636         * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
2637         support; force -gno-pubnames.
2638         (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
2639         support.
2640         (gdb_index_test_4): New test.
2641         * testsuite/Makefile.in: Regenerate.
2642         * testsuite/gdb_index_test_1.sh: Refactor code into common file.
2643         * testsuite/gdb_index_test_2.sh: Likewise.
2644         * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
2645         * testsuite/gdb_index_test_4.sh: New script.
2646         * testsuite/gdb_index_test_comm.sh: New script with common code;
2647         don't look for space after colon.
2648
2649 2012-07-16  Sriraman Tallam  <tmsriram@google.com>
2650
2651         * gold.cc (queue_middle_tasks): Update function order only after
2652         deferred objects due to plugins are processed.
2653
2654 2012-07-11  Ian Lance Taylor  <iant@google.com>
2655
2656         * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
2657         (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
2658         (Target_arm::scan_reloc_for_stub): Likewise.
2659         * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
2660         * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
2661         * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
2662         * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
2663         * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
2664
2665 2012-07-10  Dodji Seketeli  <dodji@redhat.com>
2666             Ian Lance Taylor  <iant@google.com>
2667
2668         PR gold/14309
2669         * configure.ac: Test whether std::tr1::hash<off_t> works.
2670         * gold.h: Add a specialization for std::tr1::hash<off_t> if
2671         needed.
2672         * output.h (class Output_fill): Add virtual destructor.
2673         * configure, config.in: Rebuild.
2674
2675 2012-06-22  Roland McGrath  <mcgrathr@google.com>
2676
2677         * layout.cc (finalize): Define __ehdr_start symbol if applicable.
2678
2679 2012-06-12  Rafael Ávila de Espíndola <respindola@mozilla.com>
2680
2681         * plugin.cc (Plugin::load): Handle position independent executables.
2682
2683 2012-06-06  Cary Coutant  <ccoutant@google.com>
2684
2685         * layout.cc (gdb_sections): Remove ".debug_" prefixes,
2686         add .debug_macro.
2687         (lines_only_debug_sections): Likewise.
2688         (gdb_fast_lookup_sections): New static array.
2689         (is_gdb_debug_section): Rename formal parameter.
2690         (is_lines_only_debug_section): Likewise.
2691         (is_gdb_fast_lookup_section): New function.
2692         (Layout::include_section): Check for ".zdebug_" prefix; pass
2693         section name suffix to is_gdb_debug_section, et al.; check for
2694         fast-lookup sections when building .gdb_index.
2695         * options.h (--strip-debug-gdb): Update GDB version number.
2696
2697 2012-06-06  Cary Coutant  <ccoutant@google.com>
2698
2699         * configure.ac: Add check for fallocate.
2700         * configure: Regenerate.
2701         * config.in: Regenerate.
2702
2703         * options.h (class General_options): Add --mmap-output-file and
2704         --posix-fallocate options.
2705         * output.cc: (posix_fallocate): Remove; replace with...
2706         (gold_fallocate): New function.
2707         (Output_file::map_no_anonymous): Call gold_fallocate.
2708         (Output_file::map): Check --mmap-output-file option.
2709
2710 2012-06-05  Jing Yu  <jingyu@google.com>
2711
2712         * gold.h (textdomain): Add do {} to empty while(0).
2713         (bindtextdomain): Likewise.
2714
2715 2012-06-04  Cary Coutant  <ccoutant@google.com>
2716
2717         * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
2718         has_dynsym_index.
2719
2720 2012-05-25  Sriraman Tallam  <tmsriram@google.com>
2721
2722         * symtab.cc (Symbol_table::define_special_symbol):
2723         Initialize *poldsym to prevent uninitialized variable errors.
2724
2725 2012-05-23  Cary Coutant  <ccoutant@google.com>
2726
2727         * layout.cc (Layout::section_name_mapping): Add rules to handle
2728         exact match on .data.rel.ro.local or .data.rel.ro.
2729         (Layout::output_section_name): Check for exact matches.
2730
2731 2012-05-23  Cary Coutant  <ccoutant@google.com>
2732
2733         * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
2734         more carefully.
2735
2736 2012-05-22  Cary Coutant  <ccoutant@google.com>
2737
2738         * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
2739         object before exporting symbol.
2740
2741 2012-05-21  H.J. Lu  <hongjiu.lu@intel.com>
2742
2743         * testsuite/tls_test.cc: Include "config.h" first.
2744         * testsuite/tls_test_c.c: Likewise.
2745
2746 2012-05-17  Daniel Richard G.  <skunk@iskunk.org>
2747             Nick Clifton  <nickc@redhat.com>
2748
2749         PR 14072
2750         * configure.in: Add check that sysdep.h has been included before
2751         any system header files.
2752         * configure: Regenerate.
2753         * config.in: Regenerate.
2754
2755 2012-05-14  Cary Coutant  <ccoutant@google.com>
2756
2757         * layout.cc (Layout::make_output_section): Mark .tdata section
2758         as RELRO.
2759         * testsuite/relro_test.cc: Add a TLS variable.
2760
2761 2012-05-10  H.J. Lu  <hongjiu.lu@intel.com>
2762
2763         PR gold/14091
2764         * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
2765         R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
2766         R_X86_64_64.
2767
2768 2012-05-08  Cary Coutant  <ccoutant@google.com>
2769
2770         * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
2771         (lines_only_debug_sections): Likewise.
2772
2773 2012-05-02  Roland McGrath  <mcgrathr@google.com>
2774
2775         * nacl.cc: New file.
2776         * nacl.h: New file.
2777         * Makefile.am (CCFILES, HFILES): Add them.
2778         * Makefile.in: Regenerate.
2779         * i386.cc (Output_data_plt_i386_nacl): New class.
2780         (Output_data_plt_i386_nacl_exec): New class.
2781         (Output_data_plt_i386_nacl_dyn): New class.
2782         (Target_i386_nacl): New class.
2783         (Target_selector_i386_nacl): New class.
2784         (target_selector_i386): Use it instead of Target_selector_i386.
2785         * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
2786         (Target_x86_64_nacl): New class.
2787         (Target_selector_x86_64_nacl): New class.
2788         (target_selector_x86_64, target_selector_x32): Use it instead of
2789         Target_selector_x86_64.
2790         * arm.cc (Output_data_plt_arm_nacl): New class.
2791         (Target_arm_nacl): New class.
2792         (Target_selector_arm_nacl): New class.
2793         (target_selector_arm, target_selector_armbe): Use it instead of
2794         Target_selector_arm.
2795
2796         * target-select.cc (select_target): Take new Input_file* and off_t
2797         arguments, pass them on to recognize method of selector.
2798         * object.cc (make_elf_sized_object): Update caller.
2799         * parameters.cc (parameters_force_valid_target): Likewise.
2800         * incremental.cc (make_sized_incremental_binary): Likewise.
2801         * target-select.h: Update decl.
2802         (Target_selector::recognize): Take new Input_file* argument,
2803         pass it on to do_recognize.
2804         (Target_selector::do_recognize): Take new Input_file* argument.
2805         * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
2806         * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
2807         * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
2808         * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
2809
2810         * target.h (Target::Target_info): New members isolate_execinstr
2811         and rosegment_gap.
2812         (Target::isolate_execinstr, Target::rosegment_gap): New methods.
2813         * arm.cc (Target_arm::arm_info): Update initializer.
2814         * i386.cc (Target_i386::i386_info): Likewise.
2815         * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
2816         * sparc.cc (Target_sparc::sparc_info): Likewise.
2817         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
2818         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
2819         * layout.cc (Layout::attach_allocated_section_to_segment):
2820         Take new const Target* argument.  If target->isolate_execinstr(), act
2821         like --rosegment.
2822         (Layout::find_first_load_seg): Take new const Target* argument;
2823         if target->isolate_execinstr(), reject PF_X segments.
2824         (Layout::relaxation_loop_body): Update caller.
2825         (Layout::set_segment_offsets): If target->isolate_execinstr(),
2826         reset file offset to zero when we hit LOAD_SEG, and then do a second
2827         loop over the segments before LOAD_SEG to reassign offsets after
2828         addresses have been determined.  Handle target->rosegment_gap().
2829         (Layout::attach_section_to_segment): Take new const Target* argument;
2830         pass it to attach_allocated_section_to_segment.
2831         (Layout::make_output_section): Update caller.
2832         (Layout::attach_sections_to_segments): Take new const Target* argument;
2833         pass it to attach_section_to_segment.
2834         * gold.cc (queue_middle_tasks): Update caller.
2835         * layout.h (Layout): Update method decls with new arguments.
2836
2837         * arm.cc (Target_arm::Target_arm): Take optional argument for the
2838         Target_info pointer to use.
2839         (Target_arm::do_make_data_plt): New virtual method.
2840         (Target_arm::make_data_plt): New method that calls it.
2841         (Target_arm::make_plt_entry): Use it.
2842         (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
2843         for the section alignment.
2844         (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
2845         method.
2846         (Output_data_plt_arm::first_plt_entry_offset): Call it.
2847         (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
2848         method.
2849         (Output_data_plt_arm::get_plt_entry_size): Call it.
2850         (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
2851         (Output_data_plt_arm::fill_plt_entry): New method that calls it.
2852         (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
2853         method.
2854         (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
2855         (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
2856         method instead of sizeof(plt_entry).
2857         (Output_data_plt_arm::add_entry): Likewise.
2858         Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
2859         (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
2860         than static method.
2861         (Target_arm::plt_entry_size): Likewise.
2862         (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
2863         Move to ...
2864         (Output_data_plt_arm_standard): ... here, new class.
2865         (Output_data_plt_arm::do_write): Move guts of PLT filling to...
2866         (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
2867         (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
2868
2869         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
2870         Take additional argument for the PLT entry size.
2871         (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
2872         Use get_plt_entry_size method rather than plt_entry_size variable.
2873         (Output_data_plt_x86_64::reserve_slot): Likewise.
2874         (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
2875         (Output_data_plt_x86_64::add_entry): Likewise.
2876         (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
2877         (Output_data_plt_x86_64::address_for_global): Likewise.
2878         (Output_data_plt_x86_64::address_for_local): Likewise.
2879         (Output_data_plt_x86_64::set_final_data_size): Likewise.
2880         (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
2881         Make method non-static.
2882         (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
2883         method.
2884         (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
2885         (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
2886         (Output_data_plt_x86_64::add_eh_frame): New method to call it.
2887         (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
2888         virtual method.
2889         (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
2890         (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
2891         virtual method.
2892         (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
2893         (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
2894         virtual method.
2895         (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
2896         (Output_data_plt_x86_64::plt_entry_size)
2897         (Output_data_plt_x86_64::first_plt_entry)
2898         (Output_data_plt_x86_64::plt_entry)
2899         (Output_data_plt_x86_64::tlsdesc_plt_entry)
2900         (Output_data_plt_x86_64::plt_eh_frame_fde_size)
2901         (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
2902         (Output_data_plt_x86_64_standard): ... here, new class.
2903         (Target_x86_64::Target_x86_64): Take optional argument for the
2904         Target_info pointer to use.
2905         (Target_x86_64::do_make_data_plt): New virtual method.
2906         (Target_x86_64::make_data_plt): New method to call it.
2907         (Target_x86_64::init_got_plt_for_update): Use that.
2908         Call this->plt_->add_eh_frame method here.
2909         (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
2910         (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
2911         rather than static method.
2912         (Target_x86_64::plt_entry_size): Likewise.
2913         (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
2914         rather than plt_entry_size variable.  Move guts of PLT filling to...
2915         (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
2916         (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
2917         (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
2918
2919         * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
2920         additional argument for the section alignment.
2921         Don't do add_eh_frame_for_plt here.
2922         (Output_data_plt_i386::first_plt_entry_offset): Make the method
2923         non-static.  Use get_plt_entry_size method rather than plt_entry_size
2924         variable.
2925         (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
2926         method.
2927         (Output_data_plt_i386::get_plt_entry_size): Call it.
2928         (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
2929         (Output_data_plt_i386::add_eh_frame): New method to call it.
2930         (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
2931         method.
2932         (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
2933         (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
2934         method.
2935         (Output_data_plt_i386::fill_plt_entry): New method to call it.
2936         (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
2937         method instead of plt_entry_size.
2938         (Output_data_plt_i386::plt_entry_size)
2939         (Output_data_plt_i386::plt_eh_frame_fde_size)
2940         (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
2941         (Output_data_plt_i386_standard): ... here, new class.
2942         (Output_data_plt_i386_exec): New class.
2943         (Output_data_plt_i386::exec_first_plt_entry): Move to ...
2944         (Output_data_plt_i386_exec::first_plt_entry): ... here.
2945         (Output_data_plt_i386::exec_plt_entry): Move to ...
2946         (Output_data_plt_i386_exec::plt_entry): ... here.
2947         (Output_data_plt_i386_dyn): New class.
2948         (Output_data_plt_i386::first_plt_entry): Move to ...
2949         (Output_data_plt_i386_dyn::first_plt_entry): ... here.
2950         (Output_data_plt_i386::dyn_plt_entry): Move to ...
2951         (Output_data_plt_i386_dyn::plt_entry): ... here.
2952         (Target_i386::Target_i386): Take optional argument for the Target_info
2953         pointer to use.
2954         (Target_i386::do_make_data_plt): New virtual method.
2955         (Target_i386::make_data_plt): New method to call it.
2956         (Target_i386::make_plt_section): Use that.
2957         Call this->plt_->add_eh_frame method here.
2958         (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
2959         rather than plt_entry_size variable.
2960         (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
2961         (Output_data_plt_i386::address_for_local): Likewise.
2962         (Output_data_plt_i386::do_write): Likewise.
2963         Move guts of PLT filling to...
2964         (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
2965         (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
2966         (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
2967         (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
2968
2969 2012-05-01  Cary Coutant  <ccoutant@google.com>
2970
2971         * dwarf_reader.cc (Dwarf_die::read_attributes)
2972         (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
2973         (Dwarf_die::uint_attribute): Remove DW_FORM_null.
2974         * reduced_debug_output.cc
2975         (Output_reduced_debug_info_section::get_die_end): Remove
2976         DW_FORM_GNU_ref_index.  Add default case.
2977
2978 2012-04-26  Mark Wielaard  <mjw@redhat.com>
2979
2980         * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
2981         * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
2982         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
2983         DW_AT_high_pc as offset from DW_AT_low_pc.
2984
2985         * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
2986         * testsuite/Makefile.in: Regenerate.
2987         * testsuite/gdb_index_test_3.c: New test source file.
2988         * testsuite/gdb_index_test_3.sh: New test source file.
2989
2990 2012-04-25  Ian Lance Taylor  <iant@google.com>
2991
2992         * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
2993         pointer.
2994         (Stub_addend_reader::operator()): Declare Arm_relocate_functions
2995         as a class, not a struct.
2996         (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
2997         (Target_arm::apply_cortex_a8_workaround): Likewise.
2998         * gc.h: Declare Reloc_types as a struct, not a class.
2999         * object.h: Declare Symbols_data as a struct.
3000         * reloc.h: Declare Read_relocs_data as a struct.
3001         * target.h: Declare Relocate_info as a struct.
3002
3003 2012-04-24  David S. Miller  <davem@davemloft.net>
3004
3005         * sparc.cc (Target_sparc::Relocate::relax_call): New function.
3006         (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
3007         and R_SPARC_WPLT30.
3008
3009 2012-04-24  Cary Coutant  <ccoutant@google.com>
3010
3011         * incremental-dump.cc (find_input_containing_global): Replace
3012         magic number with symbolic constant.
3013         (dump_incremental_inputs): Update version number.
3014         * incremental.cc (Output_section_incremental_inputs): Update version
3015         number; import symbolic constants from Incremental_inputs_reader.
3016         (Incremental_inputs::create_data_sections): Align relocations
3017         section correctly for 64-bit targets.
3018         (Output_section_incremental_inputs::set_final_data_size): Use symbolic
3019         constants; add padding.
3020         (Output_section_incremental_inputs::write_header): Add assert for
3021         header_size.
3022         (Output_section_incremental_inputs::write_input_files): Add assert
3023         for input_entry_size.
3024         (Output_section_incremental_inputs::write_info_blocks): Add padding;
3025         add assert for object_info_size, input_section_entry_size,
3026         global_sym_entry_size.
3027         * incremental.h (Incremental_inputs_reader): Add symbolic constants
3028         for data structure sizes; use them.
3029         (Incremental_input_entry_reader): Import symbolic constants from
3030         Incremental_inputs_reader; use them.
3031
3032 2012-04-23  David S. Miller  <davem@davemloft.net>
3033
3034         * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
3035         and elf_flags_set_.
3036         (Target_sparc::Target_sparc): Initialize new fields.
3037         (Target_sparc::do_make_elf_object): New function.
3038         (Target_sparc::do_adjust_elf_header): New function.
3039
3040 2012-04-23  Cary Coutant  <ccoutant@google.com>
3041
3042         * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
3043         CU range table of gdb index.
3044
3045 2012-04-20  David S. Miller  <davem@davemloft.net>
3046
3047         * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
3048         instead of false.
3049
3050 2012-04-16  David S. Miller  <davem@davemloft.net>
3051
3052         * sparc.cc (Target_sparc::got_address): New function.
3053         (Sparc_relocate_functions::gdop_hix22): New function.
3054         (Sparc_relocate_functions::gdop_lox10): New function.
3055         (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
3056         relocs.
3057         (Target_sparc::Scan::local): Likewise if the global symbol is not
3058         preemptible and is not IFUNC.
3059         (Target_sparc::Relocate::relocate): Perform GOTDATA code
3060         transformations for local and non-preemptible non-IFUNC global
3061         symbols.
3062
3063         * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
3064         writing out 64-bit part of ranges.
3065
3066         * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
3067         -fpic and -fpie respectively.
3068         * Makefile.in: Regenerate.
3069
3070         * sparc.cc (class Target_sparc): Add rela_ifunc_.
3071         (Target_sparc::Target_sparc): Initialize new field.
3072         (Target_sparc::do_plt_section_for_global): New function.
3073         (Target_sparc::do_plt_section_for_local): New function.
3074         (Target_sparc::reloc_needs_plt_for_ifunc): New function.
3075         (Target_sparc::make_plt_section): New function, broken out of
3076         make_plt_entry.  Use ORDER_NON_RELRO_FIRST for ".plt".
3077         (Target_sparc::make_plt_entry): Call make_plt_section.
3078         (Target_sparc::make_local_ifunc_plt_entry): New function.
3079         (Target_sparc::rela_ifunc_section): New function.
3080         (Target_sparc::plt_section): Remove const.
3081         (Output_data_plt_sparc): Update declarations.  Define Global_ifunc
3082         and Local_ifunc types.  Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
3083         and ifunc_count_ fields.
3084         (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
3085         (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
3086         (Output_data_plt_sparc::add_local_ifunc_entry): New function.
3087         (Output_data_plt_sparc::rela_ifunc): New function.
3088         (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
3089         (Output_data_plt_sparc::has_ifunc_section): New function.
3090         (Output_data_plt_sparc::entry_count): Include ifunc_count_.
3091         (Output_data_plt_sparc::address_for_global): New function.
3092         (Output_data_plt_sparc::address_for_local): New function.
3093         (Output_data_plt_sparc::plt_index_to_offset): New function.
3094         (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
3095         and entry_count.
3096         (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
3097         entry_count.
3098         (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
3099         R_SPARC_JMP_IREL to switch.
3100         (Target_sparc::Scan::check_non_pic): Likewise.
3101         (Target_sparc::Scan::local): Handle IFUNC symbols.
3102         (Target_sparc::Scan::local): Likewise.
3103         (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
3104         and plt_address_for_local.
3105         (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
3106         Define __rel_iplt_start and __rel_iplt_end if doing a static link.
3107
3108         * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
3109         (class Output_data_reloc): Adjust calls to Output_reloc_type.
3110         (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
3111         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
3112         global relocs too.
3113         (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
3114         * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
3115         calls.
3116         * sparc.cc (Target_sparc::Scan::global): Likewise.
3117         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
3118
3119 2012-04-16  Cary Coutant  <ccoutant@google.com>
3120
3121         * archive.cc (Library_base::should_include_member): Check for
3122         --export-dynamic-symbol.
3123         * options.h (class General_options): Add --export-dynamic-symbol.
3124         * symtab.cc (Symbol::should_add_dynsym_entry): Check for
3125         --export-dynamic-symbol.
3126         (Symbol_table::gc_mark_undef_symbols): Likewise.
3127         (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
3128
3129 2012-04-12  David S. Miller  <davem@davemloft.net>
3130
3131         * sparc.cc (Reloc::wdisp10): New relocation method.
3132         (Reloc::h34): Likewise.
3133         (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
3134         (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
3135         R_SPARC_WDISP10.
3136         (Target_sparc::Scan::local): Likewise.
3137         (Target_sparc::Scan::global): Likewise.
3138         (Target_sparc::Relocate::relocate): Likewise.
3139
3140 2012-04-09  Cary Coutant  <ccoutant@google.com>
3141
3142         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
3143         low_pc == 0.
3144
3145 2012-04-06  Ian Lance Taylor  <iant@google.com>
3146
3147         * timer.cc: #include <unistd.h>.
3148
3149 2012-04-06  Roland McGrath  <mcgrathr@google.com>
3150
3151         * configure.in (AC_CHECK_HEADERS): Add locale.h.
3152         * config.in: Regenerate.
3153         * configure: Regenerate.
3154
3155 2012-04-05  Nick Clifton  <nickc@redhat.com>
3156
3157         * configure.ac (AC_CHECK_FUNCS): Add setlocale.
3158         (AM_LC_MESSAGES): Add.
3159         * aclocal.m4: Regenerate.
3160         * config.in: Regenerate.
3161         * configure: Regenerate.
3162
3163 2012-03-21  Cary Coutant  <ccoutant@google.com>
3164
3165         * Makefile.am: Add gdb-index.cc, gdb-index.h.
3166         * Makefile.in: Regenerate.
3167         * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
3168         (Sized_elf_reloc_mapper::symbol_section): New function.
3169         (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
3170         (make_elf_reloc_mapper): New function.
3171         (Dwarf_abbrev_table::clear_abbrev_codes): New function.
3172         (Dwarf_abbrev_table::do_read_abbrevs): New function.
3173         (Dwarf_abbrev_table::do_get_abbrev): New function.
3174         (Dwarf_ranges_table::read_ranges_table): New function.
3175         (Dwarf_ranges_table::read_range_list): New function.
3176         (Dwarf_pubnames_table::read_section): New function.
3177         (Dwarf_pubnames_table::read_header): New function.
3178         (Dwarf_pubnames_table::next_name): New function.
3179         (Dwarf_die::Dwarf_die): New function.
3180         (Dwarf_die::read_attributes): New function.
3181         (Dwarf_die::skip_attributes): New function.
3182         (Dwarf_die::set_name): New function.
3183         (Dwarf_die::set_linkage_name): New function.
3184         (Dwarf_die::attribute): New function.
3185         (Dwarf_die::string_attribute): New function.
3186         (Dwarf_die::int_attribute): New function.
3187         (Dwarf_die::uint_attribute): New function.
3188         (Dwarf_die::ref_attribute): New function.
3189         (Dwarf_die::child_offset): New function.
3190         (Dwarf_die::sibling_offset): New function.
3191         (Dwarf_info_reader::check_buffer): New function.
3192         (Dwarf_info_reader::parse): New function.
3193         (Dwarf_info_reader::do_parse): New function.
3194         (Dwarf_info_reader::do_read_string_table): New function.
3195         (Dwarf_info_reader::lookup_reloc): New function.
3196         (Dwarf_info_reader::get_string): New function.
3197         (Dwarf_info_reader::visit_compilation_unit): New function.
3198         (Dwarf_info_reader::visit_type_unit): New function.
3199         (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
3200         Sized_elf_reloc_mapper.
3201         (Sized_dwarf_line_info::symbol_section): Remove function.
3202         (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
3203         (Sized_dwarf_line_info::read_line_mappings): Remove object
3204         parameter, adjust callers.
3205         (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
3206         * dwarf_reader.h: Include <sys/types.h>.
3207         (class Track_relocs): Remove forward declaration.
3208         (class Elf_reloc_mapper): New class.
3209         (class Sized_elf_reloc_mapper): New class.
3210         (class Dwarf_abbrev_table): New class.
3211         (class Dwarf_range_list): New class.
3212         (class Dwarf_ranges_table): New class.
3213         (class Dwarf_pubnames_table): New class.
3214         (class Dwarf_die): New class.
3215         (class Dwarf_info_reader): New class.
3216         (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
3217         (Sized_dwarf_line_info::symbol_section): Remove member function.
3218         * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
3219         base class.
3220         * gdb-index.cc: New source file.
3221         * gdb-index.h: New source file.
3222         * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
3223         and .debug_types sections, call Layout::add_to_gdb_index.
3224         (Sized_relobj_incr::do_section_name): Implement.
3225         (Sized_relobj_incr::do_section_contents): Adjust parameter list and
3226         return type; Implement.
3227         (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
3228         return type.
3229         * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
3230         parameter list and return type.
3231         (Sized_incr_dynobj::do_section_contents): Likewise.
3232         * layout.cc: Include gdb-index.h.
3233         (Layout::Layout): Initialize gdb_index_data_.
3234         (Layout::init_fixed_output_section): Check for .gdb_index section.
3235         (Layout::add_to_gdb_index): New function. Instantiate.
3236         * layout.h: Add forward declaration for class Gdb_index.
3237         (Layout::add_to_gdb_index): New member function.
3238         (Layout::gdb_index_data_): New data member.
3239         * main.cc: Include gdb-index.h.
3240         (main): Print statistics for gdb index.
3241         * object.cc (Object::section_contents): Move code into
3242         do_section_contents.
3243         (need_decompressed_section): Check for sections needed when building
3244         gdb index.
3245         (build_compressed_section_map): Likewise.
3246         (Sized_relobj_file::do_read_symbols): Need local symbols when building
3247         gdb index.
3248         (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
3249         sections; call Layout::add_to_gdb_index.
3250         (Sized_relobj_file::do_decompressed_section_contents): Call
3251         do_section_contents directly.
3252         * object.h (Object::do_section_contents): Adjust parameter list and
3253         return type.
3254         (Object::do_decompressed_section_contents): Call do_section_contents
3255         directly.
3256         (Sized_relobj_file::do_section_contents): Adjust parameter list and
3257         return type.
3258         * options.h (class General_options): Add --gdb-index option.
3259         * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
3260         list and return type.
3261         * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
3262         * reloc.h (Track_relocs::checkpoint): New function.
3263         (Track_relocs::reset): New function.
3264
3265         * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
3266         New test cases.
3267         * testsuite/Makefile.in: Regenerate.
3268         * testsuite/gdb_index_test.cc: New test source file.
3269         * testsuite/gdb_index_test_1.sh: New test source file.
3270         * testsuite/gdb_index_test_2.sh: New test source file.
3271
3272 2012-03-19  Doug Kwan  <dougkwan@google.com>
3273
3274         * arm.cc (Target_arm::do_define_standard_symbols): New method.
3275         (Target_arm::do_finalize_sections): Remove code which defines
3276         __exidx_start and __exidx_end.  Make symbol table parameter
3277         anonymous as it is not used.
3278         * gold.cc (queue_middle_tasks): Call target hook to define any
3279         target-specific symbols.
3280         * target.h (Target::define_standard_symbols): New method.
3281         (Target::do_define_standard_symbols): Same.
3282         * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
3283         * testsuite/Makefile.in: Regenerate.
3284         * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
3285         and __exidx_end.
3286         * testsuite/arm_exidx_test.sh: Check that no unused dynamic
3287         relocations are generated for __exidx_start and __exidx_end.
3288
3289 2012-03-16  Doug Kwan  <dougkwan@google.com>
3290
3291         * testsuite/Makefile.am: Disable test initpri3b.
3292         * testsuite/Makefile.in: Regenerate.
3293
3294 2012-03-15  Doug Kwan  <dougkwan@google.com>
3295
3296         * arm.cc (Target_arm::got_section): Make .got section read-only
3297         if -z now is given.
3298
3299 2012-03-15  Ian Lance Taylor  <iant@google.com>
3300
3301         PR gold/13850
3302         * layout.cc (Layout::make_output_section): Correctly mark
3303         SHT_INIT_ARRAY, et. al., as relro.
3304
3305 2012-03-14  Doug Kwan  <dougkwan@google.com>
3306
3307         * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
3308         dynamic relocations for protected symbols in shared objects.
3309
3310 2012-03-13  Ian Lance Taylor  <iant@google.com>
3311
3312         * resolve.cc (Symbol_table::resolve): When merging common symbols,
3313         keep the larger alignment.
3314
3315 2012-03-12  Cary Coutant  <ccoutant@google.com>
3316
3317         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
3318         handling of DW_LNE_define_file.
3319
3320 2012-03-12  Cary Coutant  <ccoutant@google.com>
3321
3322         * reduced_debug_output.cc
3323         (Output_reduced_debug_info_section::get_die_end): Add new FORM
3324         codes to switch.
3325
3326 2012-02-29  Cary Coutant  <ccoutant@google.com>
3327
3328         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
3329
3330 2012-02-29  Cary Coutant  <ccoutant@google.com>
3331
3332         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
3333         Call Object::decompressed_section_contents.
3334         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
3335         New dtor.
3336         (Sized_dwarf_line_info::buffer_start_): New data member.
3337         * merge.cc (Output_merge_data::do_add_input_section): Call
3338         Object::decompressed_section_contents.
3339         (Output_merge_string::do_add_input_section): Likewise.
3340         * object.cc (need_decompressed_section): New function.
3341         (build_compressed_section_map): Decompress sections needed later.
3342         (Sized_relobj_file::do_decompressed_section_contents): New function.
3343         (Sized_relobj_file::do_discard_decompressed_sections): New function.
3344         * object.h (Object::decompressed_section_contents): New function.
3345         (Object::discard_decompressed_sections): New function.
3346         (Object::do_decompressed_section_contents): New function.
3347         (Object::do_discard_decompressed_sections): New function.
3348         (Compressed_section_info): New type.
3349         (Compressed_section_map): Include decompressed section contents.
3350         (Sized_relobj_file::do_decompressed_section_contents): New function.
3351         (Sized_relobj_file::do_discard_decompressed_sections): New function.
3352
3353 2012-02-16  Cary Coutant  <ccoutant@google.com>
3354
3355         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
3356         * testsuite/Makefile.in: Regenerate.
3357
3358 2012-02-14  Cary Coutant  <ccoutant@google.com>
3359
3360         * options.cc (General_options::finalize): Disallow -pie and -static.
3361
3362 2012-02-03  Doug Kwan  <dougkwan@google.com>
3363
3364         * arm.cc (Arm_relocate_functions::abs8,
3365         Arm_relocate_functions::abs16): Use
3366         Bits::has_signed_unsigned_overflow32.
3367         (Arm_relocate_functions::thm_abs8): Correct range of
3368         overflow check.
3369         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
3370         in assertions.
3371
3372 2012-02-02  Doug Kwan  <dougkwan@google.com>
3373
3374         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
3375         position independent outputs, not just shared objects.
3376
3377 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
3378
3379         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
3380         * configure: Regenerated.
3381
3382 2012-01-27  Ian Lance Taylor  <iant@google.com>
3383
3384         * reloc.h (Bits): New class with static functions, copied from
3385         namespace utils in arm.cc.
3386         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
3387         instead.
3388
3389 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
3390
3391         * incremental.cc (write_info_blocks): Correct relocation offset.
3392
3393 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
3394
3395         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
3396         (Relocate::tls_gd_to_le): Likewise.
3397
3398 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
3399
3400         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
3401
3402 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
3403
3404         * configure.ac: Check if -mcmodel=medium works.
3405         * configure: Regenerated.
3406
3407 2012-01-24  Cary Coutant  <ccoutant@google.com>
3408
3409         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
3410         definition and ...
3411         (read_unsigned_LEB_128_x): ... this new function.
3412         (read_signed_LEB_128): Replaced with inline definition and ...
3413         (read_signed_LEB_128_x): ... this new function.
3414         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
3415         (read_unsigned_LEB_128): Add inline definition.
3416         (read_signed_LEB_128_x): New function.
3417         (read_signed_LEB_128): Add inline definition.
3418         * testsuite/Makefile.am (leb128_unittest): New unit test.
3419         * testsuite/Makefile.in: Regenerate.
3420         * testsuite/leb128_unittest.cc: New unit test.
3421
3422 2012-01-23  Ian Lance Taylor  <iant@google.com>
3423
3424         PR gold/13617
3425         * i386.cc (Target_i386::do_code_fill): When using a jmp
3426         instruction, pad with nop instructions.
3427         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
3428
3429 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
3430
3431         * x86_64.cc (gc_process_relocs): Add typename on types used in
3432         template.
3433         (scan_relocs): Likewise.
3434         (relocate_section): Likewise.
3435         (apply_relocation): Likewise.
3436
3437 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
3438
3439         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
3440         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
3441         under x32.
3442
3443 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
3444
3445         * x86_64.cc: Initial support for x32.
3446
3447 2012-01-03  Cary Coutant  <ccoutant@google.com>
3448
3449         * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
3450         Use abstract base class for GOT.
3451         * gold/output.h (class Output_data_got_base): New abstract base class.
3452         (class Output_data_got): Derive from new base class, adjust ctors.
3453         (Output_data_got::reserve_slot): Make virtual; rename to
3454         do_reserve_slot; Adjust callers.
3455         * gold/target.h (Sized_target::init_got_plt_for_update): Return
3456         pointer to abstract base class.
3457         * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
3458
3459 2011-12-18  Ian Lance Taylor  <iant@google.com>
3460
3461         * object.h (Relobj::local_symbol_value): New function.
3462         (Relobj::local_plt_offset): New function.
3463         (Relobj::local_has_got_offset): New function.
3464         (Relobj::local_got_offset): New function.
3465         (Relobj::set_local_got_offset): New function.
3466         (Relobj::do_local_symbol_value): New pure virtual function.
3467         (Relobj::do_local_plt_offset): Likewise.
3468         (Relobj::do_local_has_got_offset): Likewise.
3469         (Relobj::do_local_got_offset): Likewise.
3470         (Relobj::do_set_local_got_offset): Likewise.
3471         (Sized_relobj::do_local_has_got_offset): Rename from
3472         local_has_got_offset.
3473         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
3474         (Sized_relobj::do_set_local_got_offset): Rename from
3475         set_local_got_offset.
3476         (Sized_relobj_file::do_local_plt_offset): Rename from
3477         local_plt_offset.
3478         (Sized_relobj_file::do_local_symbol_value): New function.
3479         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
3480         local_plt_offset.
3481         * output.cc (Output_data_got::Got_entry::write): Change object to
3482         Relobj.  Use local_symbol_value.
3483         (Output_data_got::add_global_with_rel): Change rel_dyn to
3484         Output_data_reloc_generic*.  Use add_global_generic.
3485         (Output_data_got::add_global_with_rela): Remove.  Change all
3486         callers to use add_global_with_rel.
3487         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
3488         Output_data_reloc_generic*.  Use add_global_generic.
3489         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
3490         callers to use add_global_pair_with_rel.
3491         (Output_data_got::add_local): Change object to Relobj*.
3492         (Output_data_got::add_local_plt): Likewise.
3493         (Output_data_got::add_local_with_rel): Change object to Relobj*,
3494         change rel_dyn to Output_data_reloc_generic*.  Use
3495         add_local_generic.
3496         (Output_data_got::add_local_with_rela): Remove.  Change all
3497         callers to use all_local_with_rel.
3498         (Output_data_got::add_local_pair_with_rel): Change object to
3499         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
3500         add_output_section_generic.
3501         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
3502         callers to use add_local_pair_with_rel.
3503         (Output_data_got::reserve_local): Change object to Relobj*.
3504         * output.h: (class Output_data_reloc_generic): Add pure virtual
3505         declarations for add_global_generic, add_local_generic,
3506         add_output_section_generic.
3507         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
3508         functions for Output_data_reloc_generic.  Update declarations for
3509         changes listed in output.cc.
3510         (class Output_data_got): Change template parameter to got_size.
3511         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
3512         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
3513         function.
3514         (Sized_relobj_incr::do_local_plt_offset): New function.
3515         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
3516         add_global_generic.
3517
3518 2011-12-17  Cary Coutant  <ccoutant@google.com>
3519
3520         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
3521         * resolve.cc (Symbol_table::resolve): Likewise.
3522         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
3523         arrays.
3524         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
3525
3526 2011-12-16  Ian Lance Taylor  <iant@google.com>
3527
3528         * output.h (Output_data_reloc_generic::add): Only call
3529         add_dynamic_reloc if this is a dynamic reloc section.
3530
3531 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
3532
3533         PR gold/13505
3534         * target-reloc.h (apply_relocation): Replace <64, false> with
3535         <size, big_endian>.
3536
3537 2011-11-25  Nick Clifton  <nickc@redhat.com>
3538
3539         * po/it.po: New Italian translation.
3540
3541 2011-11-17  Sterling Augustine  <saugustine@google.com>
3542
3543         * script.cc (script_include_directive): Implement.
3544         (read_script_file): New local variables name and search_path. Update
3545         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
3546         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
3547         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
3548
3549 2011-11-11  Sterling Augustine  <saugustine@google.com>
3550
3551         * yyscript.y (section_cmd): Add support for INCLUDE directive.
3552         (file_or_sections_cmd): Likewise.
3553
3554 2011-11-11  Doug Kwan  <dougkwan@google.com>
3555
3556         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
3557         if --just-symbols is given.
3558
3559 2011-11-10  Doug Kwan  <dougkwan@google.com>
3560
3561         PR gold/13362
3562         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
3563         when processing data relocs.
3564         * reloc.h (Relocate_functions::rel_unaligned): New method.
3565         (Relocate_functions::pcrel_unaligned): Ditto.
3566         (Relocate_functions::rel32_unaligned): Ditto.
3567         (Relocate_functions::pcrel32_unaligned): Ditto.
3568
3569 2011-11-09  Doug Kwan  <dougkwan@google.com>
3570
3571         PR gold/13362
3572         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
3573         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
3574         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
3575         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
3576         (Relocate_functions::rel_unaligned): New.
3577         (Relocate_functions::rel32_unaligned): New.
3578         * target-reloc.h (relocate_for_relocatable): Add code to handle
3579         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
3580         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
3581         arm_unaligned_reloc_r): New targets.
3582         * testsuite/Makefile.in: Regenerate.
3583         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
3584         linking.
3585
3586 2011-11-02  Ian Lance Taylor  <iant@google.com>
3587
3588         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
3589         NATIVE_LINKER.
3590         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
3591         * options.cc (General_options::finalize): Use library search path
3592         from configure script if specified.  If not native and no sysroot,
3593         only search TOOLLIBDIR.
3594         * options.h (Search_directory::Search_directory): Change name to
3595         const std::string&.
3596         (General_options::add_to_library_path_with_sysroot): Change arg to
3597         const std::string&.
3598         * configure, Makefile.in, config.in: Rebuild.
3599
3600 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
3601
3602         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
3603         we are working around the ARM1176 Erratum.
3604         * options.h (General_options::fix_arm1176): Add option.
3605         * testsuite/Makefile.am: Add testcases, and keep current ones
3606         working.
3607         * testsuite/Makefile.in: Regenerate.
3608         * testsuite/arm_fix_1176.s: New file.
3609         * testsuite/arm_fix_1176.sh: Likewise.
3610
3611 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
3612
3613         * arm.cc (Target_arm::Target_arm): Remove initialisation of
3614         may_use_blx_.
3615         (Target_arm::may_use_blx): Remove method.
3616         (Target_arm::set_may_use_blx): Likewise.
3617         (Target_arm::may_use_v4t_interworking): New method.
3618         (Target_arm::may_use_v5t_interworking): Likewise.
3619         (Target_arm::may_use_blx_): Remove member variable.
3620         (Arm_relocate_functions::arm_branch_common): Check for v5T
3621         interworking.
3622         (Arm_relocate_functions::thumb_branch_common): Likewise.
3623         (Reloc_stub::stub_type_for_reloc): Likewise.
3624         (Target_arm::do_finalize_sections): Correct interworking checks.
3625         * testsuite/Makefile.am: Add new tests.
3626         * testsuite/Makefile.in: Regenerate.
3627         * testsuite/arm_farcall_arm_arm.s: New test.
3628         * testsuite/arm_farcall_arm_arm.sh: Likewise.
3629         * testsuite/arm_farcall_arm_thumb.s: Likewise.
3630         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
3631         * testsuite/arm_farcall_thumb_arm.s: Likewise.
3632         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
3633         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
3634         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
3635
3636 2011-10-31  Cary Coutant  <ccoutant@google.com>
3637
3638         PR gold/13023
3639         * expression.cc (Expression::eval_with_dot): Add
3640         is_section_dot_assignment parameter.
3641         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
3642         absolute and assigning to dot within a section.
3643         * script-sections.cc
3644         (Output_section_element_assignment::set_section_addresses): Pass
3645         dot_section to set_if_absolute.
3646         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
3647         as is_section_dot_assignment flag to eval_with_dot.
3648         (Output_section_element_dot_assignment::set_section_addresses):
3649         Likewise.
3650         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
3651         parameter.  Also set value if relative to dot_section; set the
3652         symbol's output_section.
3653         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
3654         parameter.  Adjust all callers.
3655         (Expression::eval_maybe_dot): Likewise.
3656         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
3657         Adjust all callers.
3658         * testsuite/script_test_2.t: Test assignment of an absolute value
3659         to dot within an output section element.
3660
3661 2011-10-31  Cary Coutant  <ccoutant@google.com>
3662
3663         * options.h (class General_options): Add --[no-]gnu-unique options.
3664         * symtab.cc (Symbol_table::sized_write_globals): Convert
3665         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
3666
3667 2011-10-31  Cary Coutant  <ccoutant@google.com>
3668
3669         PR gold/13359
3670         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
3671         unnecessary assertion.
3672         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
3673
3674 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
3675
3676         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
3677         gc_mark_symbol.
3678         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
3679         gc_mark_symbol.
3680         Change to just keep the section associated with symbol.
3681         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
3682         they are externally visible and --export-dynamic is turned on.
3683         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
3684
3685 2011-10-19  Ian Lance Taylor  <iant@google.com>
3686
3687         PR gold/13163
3688         * script-sections.cc
3689         (Output_section_element_dot_assignment::needs_output_section): New
3690         function.
3691
3692 2011-10-19  Ian Lance Taylor  <iant@google.com>
3693
3694         PR gold/13204
3695         * layout.cc (Layout::segment_precedes): Don't assert failure if a
3696         --section-start option was seen.
3697         * options.h (General_options::any_section_start): New function.
3698
3699 2011-10-18  David S. Miller  <davem@davemloft.net>
3700
3701         PR binutils/13301
3702         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
3703         member to track relocation locations that have moved during TLS
3704         reloc optimizations.
3705         (Target_sparc::Relocate::Relocate): Initialize to NULL.
3706         (Target_sparc::Relocate::relocate): Adjust view down by 4
3707         bytes if it matches reloc_adjust_addr_.
3708         (Target_sparc::Relocate::relocate_tls): Always move the
3709         __tls_get_addr call delay slot instruction forward 4 bytes when
3710         performing relaxation.
3711
3712 2011-10-18  Cary Coutant  <ccoutant@google.com>
3713
3714         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
3715         (Output_file::map_no_anonymous): Check for non-zero
3716         return code from posix_fallocate.
3717
3718 2011-10-17  Cary Coutant  <ccoutant@google.com>
3719
3720         PR gold/13245
3721         * plugin.cc (is_visible_from_outside): Check for symbols
3722         referenced from dynamic objects.
3723         * resolve.cc (Symbol_table::resolve): Don't count references
3724         from dynamic objects as references from real ELF files.
3725         * testsuite/plugin_test_2.sh: Adjust expected result.
3726
3727 2011-10-17  Cary Coutant  <ccoutant@google.com>
3728
3729         * gold.cc: Include timer.h.
3730         (queue_middle_tasks): Stamp time.
3731         (queue_final_tasks): Likewise.
3732         * main.cc (main): Store timer in parameters.  Print timers
3733         for each pass.
3734         * parameters.cc (Parameters::Parameters): Initialize timer_.
3735         (Parameters::set_timer): New function.
3736         (set_parameters_timer): New function.
3737         * parameters.h (Parameters::set_timer): New function.
3738         (Parameters::timer): New function.
3739         (Parameters::timer_): New data member.
3740         (set_parameters_timer): New function.
3741         * timer.cc (Timer::stamp): New function.
3742         (Timer::get_pass_time): New function.
3743         * timer.h (Timer::stamp): New function.
3744         (Timer::get_pass_time): New function.
3745         (Timer::pass_times_): New data member.
3746
3747 2011-10-17  Cary Coutant  <ccoutant@google.com>
3748
3749         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
3750         task for members of lib groups.
3751
3752 2011-10-17  Cary Coutant  <ccoutant@google.com>
3753
3754         PR gold/13288
3755         * fileread.cc (File_read::find_view): Add assert.
3756         (File_read::make_view): Move bounds check (replace with assert)...
3757         (File_read::find_or_make_view): ... to here.
3758
3759 2011-10-12  Cary Coutant  <ccoutant@google.com>
3760
3761         * output.cc (Output_file::open_base_file): Handle case where
3762         ::read returns less than requested size.
3763
3764 2011-10-10  Cary Coutant  <ccoutant@google.com>
3765
3766         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
3767         Initialize defined_count_.
3768         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
3769         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
3770         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
3771         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
3772         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
3773         * incremental.h (Sized_relobj_incr::defined_count_): New data
3774         member.
3775         (Sized_incr_dynobj::defined_count_): New data member.
3776         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
3777         Return zeroes instead of internal error.
3778
3779 2011-10-10  Cary Coutant  <ccoutant@google.com>
3780
3781         PR gold/13249
3782         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
3783         (Output_reloc::symbol_value): Return PLT offset if flag is set.
3784         * output.h (class Output_reloc): Add use_plt_offset flag.
3785         (Output_reloc::type_): Adjust size of bit field.
3786         (Output_reloc::use_plt_offset_): New bit field.
3787         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
3788         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
3789         flag.  Adjust all callers.
3790         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
3791         creating RELATIVE relocations.
3792
3793 2011-10-10  Nick Clifton  <nickc@redhat.com>
3794
3795         * po/es.po: Updated Spanish translation.
3796         * po/fi.po: Updated Finnish translation.
3797
3798 2011-10-03   Diego Novillo  <dnovillo@google.com>
3799
3800         * options.cc (parse_uint): Fix dereference of RETVAL.
3801
3802 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
3803
3804         * layout.h (section_order_map_): New member.
3805         (get_section_order_map): New member function.
3806         * output.cc (Output_section::add_input_section): Check for patterns
3807         only when --section-ordering-file is specified.
3808         * gold.cc (queue_middle_tasks): Delay updating order of sections till
3809         output_sections have been formed.
3810         * layout.cc (Layout_Layout): Initialize section_order_map_.
3811         * plugin.cc (update_section_order): Store order in order_map. Do not
3812         update the order.
3813         * testsuite/Makefile.am: Add test case for plugin_final_layout.
3814         * testsuite/Makefile.in: Regenerate.
3815         * testsuite/plugin_section_order.c: New file.
3816         * testsuite/plugin_final_layout.cc: New file.
3817         * testsuite/plugin_final_layout.sh: New file.
3818
3819 2011-09-29  Cary Coutant  <ccoutant@google.com>
3820
3821         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
3822         Check for NULL.
3823         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
3824         symbols during incremental update.
3825         (Symbol_table::add_from_dynobj): Likewise.
3826
3827 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3828             Ian Lance Taylor  <iant@google.com>
3829
3830         * symtab.cc (Symbol_table::define_special_symbol): Always
3831         canonicalize version string.
3832
3833 2011-09-26  Cary Coutant  <ccoutant@google.com>
3834
3835         * gold.cc (queue_initial_tasks): Move option checks ...
3836         * options.cc (General_options::finalize): ... to here. Disable
3837         some options; make others fatal.
3838
3839 2011-09-26  Cary Coutant  <ccoutant@google.com>
3840
3841         gcc PR lto/47247
3842         * plugin.cc (get_symbols_v2): New function.
3843         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
3844         (is_referenced_from_outside): New function.
3845         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
3846         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
3847         (get_symbols): Pass version parameter.
3848         (get_symbols_v2): New function.
3849         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
3850         parameter.
3851         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
3852         (onload): Add LDPT_GET_SYMBOLS_V2.
3853         (all_symbols_read_hook): Use get_symbols_v2; check for
3854         LDPR_PREVAILING_DEF_IRONLY_EXP.
3855         * testsuite/plugin_test_3.sh: Update expected results.
3856
3857 2011-09-23  Simon Baldwin  <simonb@google.com>
3858
3859         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
3860         configuration options.
3861         * configure: Regenerate.
3862         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
3863         * Makefile.in: Regenerate.
3864         * testsuite/Makefile.in: Regenerate.
3865
3866 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
3867
3868         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
3869
3870 2011-09-19  Cary Coutant  <ccoutant@google.com>
3871
3872         * incremental.cc (can_incremental_update): Fix typo in comment.
3873         * incremental.h (can_incremental_update): Likewise.
3874
3875 2011-09-18  Cary Coutant  <ccoutant@google.com>
3876
3877         * incremental.cc (can_incremental_update): New function.
3878         * incremental.h (can_incremental_update): New function.
3879         * layout.cc (Layout::init_fixed_output_section): Call it.
3880         (Layout::make_output_section): Don't allow patch space in .eh_frame.
3881         * object.cc (Sized_relobj_file::do_layout): Call
3882         can_incremental_update.
3883
3884 2011-09-13  Cary Coutant  <ccoutant@google.com>
3885
3886         * configure.ac: Check for glibc support for gnu_indirect_function
3887         support with static linking, setting automake conditional
3888         IFUNC_STATIC.
3889         * Makefile.in: Regenerate.
3890         * configure: Regenerate.
3891
3892         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
3893         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
3894         for IFUNC_STATIC.
3895         * testsuite/Makefile.in: Regenerate.
3896
3897 2011-09-13  Cary Coutant  <ccoutant@google.com>
3898
3899         * incremental.cc (Sized_relobj_incr::do_layout): Call
3900         report_comdat_group for kept comdat sections.
3901         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
3902         * testsuite/Makefile.in: Regenerate.
3903         * testsuite/incr_comdat_test_1.cc: New source file.
3904         * testsuite/incr_comdat_test_2_v1.cc: New source file.
3905         * testsuite/incr_comdat_test_2_v2.cc: New source file.
3906         * testsuite/incr_comdat_test_2_v3.cc: New source file.
3907
3908 2011-09-13  Ian Lance Taylor  <iant@google.com>
3909
3910         * object.cc (Sized_relobj_file::do_layout): Remove unused local
3911         variable external_symbols_offset.
3912
3913 2011-09-12  Ian Lance Taylor  <iant@google.com>
3914
3915         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
3916         triggered if object has no symbols.
3917
3918 2011-09-09  David S. Miller  <davem@davemloft.net>
3919
3920         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
3921         (Output_fill_debug_line::do_write): Likewise.
3922
3923 2011-08-29  Cary Coutant  <ccoutant@google.com>
3924
3925         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
3926         casts to match formatting specs.
3927         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
3928
3929 2011-08-26  Cary Coutant  <ccoutant@google.com>
3930
3931         * layout.cc (Free_list::allocate): Provide guarantee of minimum
3932         remaining hole size when allocating.
3933         (Layout::make_output_section): Set fill methods for debug sections.
3934         * layout.h (Free_list::Free_list_node): Move from private to
3935         public.
3936         (Free_list::set_min_hole_size): New function.
3937         (Free_list::begin, Free_list::end): New functions.
3938         (Free_list::min_hole_): New data member.
3939         * output.cc: Include dwarf.h.
3940         (Output_fill_debug_info::do_minimum_hole_size): New function.
3941         (Output_fill_debug_info::do_write): New function.
3942         (Output_fill_debug_line::do_minimum_hole_size): New function.
3943         (Output_fill_debug_line::do_write): New function.
3944         (Output_section::Output_section): Initialize new data member.
3945         (Output_section::set_final_data_size): Ensure patch space is larger
3946         than minimum hole size.
3947         (Output_section::do_write): Fill holes in debug sections.
3948         * output.h (Output_fill): New class.
3949         (Output_fill_debug_info): New class.
3950         (Output_fill_debug_line): New class.
3951         (Output_section::set_free_space_fill): New function.
3952         (Output_section::free_space_fill_): New data member.
3953         * testsuite/Makefile.am (incremental_test_3): Add
3954         --incremental-patch option.
3955         (incremental_test_4): Likewise.
3956         (incremental_test_5): Likewise.
3957         (incremental_test_6): Likewise.
3958         (incremental_copy_test): Likewise.
3959         (incremental_common_test_1): Likewise.
3960         * testsuite/Makefile.in: Regenerate.
3961
3962 2011-08-26  Nick Clifton  <nickc@redhat.com>
3963
3964         * po/es.po: Updated Spanish translation.
3965
3966 2011-08-01  Cary Coutant  <ccoutant@google.com>
3967
3968         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
3969         * gold/testsuite/Makefile.in: Regenerate.
3970         * gold/testsuite/justsyms_exec.c: New source file.
3971         * gold/testsuite/justsyms_lib.c: New source file.
3972
3973 2011-08-01  Cary Coutant  <ccoutant@google.com>
3974
3975         * layout.cc (Layout::set_segment_offsets): Don't realign text
3976         segment if -Ttext was specified.
3977         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
3978         file type.
3979         * object.h (Sized_relobj_file::e_type): New function.
3980         (Sized_relobj_file::e_type_): New data member.
3981         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
3982         base address for ET_EXEC files.
3983         * target.cc (Target::do_make_elf_object_implementation): Allow
3984         ET_EXEC files with --just-symbols option.
3985
3986 2011-07-28  Cary Coutant  <ccoutant@google.com>
3987
3988         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
3989         Add thread_number parameter.
3990         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
3991         * workqueue-threads.cc
3992         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
3993         current thread if its thread number is greater than desired thread
3994         count.
3995         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
3996         Add thread_number parameter.
3997         (Workqueue::should_cancel_thread): Likewise.
3998         (Workqueue::find_runnable_or_wait): Pass thread_number to
3999         should_cancel_thread.
4000         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
4001         parameter.
4002
4003 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
4004
4005         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
4006         only after checking if it cannot be forced local.
4007         * symtab.h (is_externally_visible): Check if the symbol is not forced
4008         local.
4009
4010 2011-07-15  Ian Lance Taylor  <iant@google.com>
4011
4012         * options.h (class General_options): Add --print-output-format.
4013         Move -EL next to -EB, for  better --help output.
4014         * target-select.cc: Include <cstdio>, "options.h", and
4015         "parameters.h".
4016         (Target_selector::do_target_bfd_name): New function.
4017         (print_output_format): New function.
4018         * target-select.h (class Target_selector): Update declarations.
4019         (Target_selector::target_bfd_name): New function.
4020         (print_output_format): Declare.
4021         * main.cc: Include "target-select.h".
4022         (main): Handle --print-output-format.
4023         * gold.cc: Include "target-select.h".
4024         (queue_initial_tasks): Handle --print-output-format when there are
4025         no input files.
4026         * parameters.cc (parameters_force_valid_target): Give a better
4027         error message if -EB/-EL does not match target.
4028         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
4029         function.
4030
4031 2011-07-15  Ian Lance Taylor  <iant@google.com>
4032
4033         * i386.cc (class Output_data_plt_i386): Add layout_ field.
4034         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
4035         (Output_data_plt_i386::do_write): Write address of .dynamic
4036         section to first entry in .got.plt section.
4037         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
4038         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
4039         Initialize layout_.
4040         (Output_data_plt_x86_64::do_write): Write address of .dynamic
4041         section to first entry in .got.plt section.
4042         * layout.h (Layout::dynamic_section): New function.
4043
4044 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
4045
4046         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
4047         to claim_file call.
4048         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
4049         input_section_position_, and input_section_glob_.
4050         (read_layout_from_file): Call function section_ordering_specified.
4051         * layout.h (is_section_ordering_specified): New function.
4052         (section_ordering_specified): New function.
4053         (section_ordering_specified_): New boolean member.
4054         * main.cc(main): Call load_plugins after layout object is defined.
4055         * output.cc (Output_section::add_input_section): Use
4056         function section_ordering_specified to check if section ordering is
4057         needed.
4058         * output.cc (Output_section::add_relaxed_input_section): Use
4059         function section_ordering_specified to check if section ordering is
4060         needed.
4061         (Output_section::update_section_layout): New function.
4062         (Output_section::sort_attached_input_sections): Check if input section
4063         must be reordered.
4064         * output.h (Output_section::update_section_layout): New function.
4065         * plugin.cc (get_section_count): New function.
4066         (get_section_type): New function.
4067         (get_section_name): New function.
4068         (get_section_contents): New function.
4069         (update_section_order): New function.
4070         (allow_section_ordering): New function.
4071         (Plugin::load): Add the new interfaces to the transfer vector.
4072         (Plugin_manager::load_plugins): New parameter.
4073         (Plugin_manager::all_symbols_read): New parameter.
4074         (Plugin_manager::claim_file): New parameter. Save the elf object for
4075         unclaimed objects.
4076         (Plugin_manager::get_elf_object): New function.
4077         (Plugin_manager::get_view): Change to directly use the bool to check
4078         if get_view is called from claim_file_hook.
4079         * plugin.h (input_objects): New function
4080         (Plugin__manager::load_plugins): New parameter.
4081         (Plugin_manager::claim_file): New parameter.
4082         (Plugin_manager::get_elf_object): New function.
4083         (Plugin_manager::in_claim_file_handler): New function.
4084         (Plugin_manager::in_claim_file_handler_): New member.
4085         (layout): New function.
4086         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
4087         handler with an extra parameter. Make the elf object before calling
4088         claim_file handler.
4089         * testsuite/plugin_test.c (get_section_count): New function pointer.
4090         (get_section_type): New function pointer.
4091         (get_section_name): New function pointer.
4092         (get_section_contents): New function pointer.
4093         (update_section_order): New function pointer.
4094         (allow_section_ordering): New function pointer.
4095         (onload): Check if the new interfaces exist.
4096
4097 2011-07-13  Ian Lance Taylor  <iant@google.com>
4098
4099         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
4100         relro section.
4101         * x86_64.cc (Target_x86_64::got_section): Likewise.
4102         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
4103         (relro_now_test_SOURCES): New variable.
4104         (relro_now_test_DEPENDENCIES): New variable.
4105         (relro_now_test_LDFLAGS): New variable.
4106         (relro_now_test_LDADD): New variable.
4107         (relro_now_test.so): New target.
4108         * testsuite/Makefile.in: Rebuild.
4109
4110 2011-07-12  Ian Lance Taylor  <iant@google.com>
4111
4112         PR gold/12980
4113         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
4114         GLOB_DAT relocation rather than a RELATIVE relocation for a
4115         protected symbol when creating a shared library.
4116         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
4117         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
4118         * testsuite/protected_main_1.cc (main): Test that protected
4119         function has same address.
4120
4121 2011-07-11  Ian Lance Taylor  <iant@google.com>
4122
4123         PR gold/12979
4124         * options.h (class General_options): Add -Bgroup.
4125         * options.cc (General_options::finalize): If -Bgroup is set,
4126         default to --unresolved-symbols=report-all.
4127         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
4128         * target-reloc.h (issue_undefined_symbol_error): Handle
4129         --unresolved-symbols=report-all.
4130
4131 2011-07-08  Ian Lance Taylor  <iant@google.com>
4132
4133         PR gold/11985
4134         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
4135         if linker script discards key sections.
4136         (Layout::create_dynamic_symtab): Likewise.
4137         (Layout::assign_local_dynsym_offsets): Likewise.
4138         (Layout::sized_create_version_sections): Likewise.
4139         (Layout::create_interp): Likewise.
4140         (Layout::finish_dynamic_section): Likewise.
4141         (Layout::set_dynamic_symbol_size): Likewise.
4142
4143 2011-07-08  Ian Lance Taylor  <iant@google.com>
4144
4145         PR gold/12386
4146         * options.h (class General_options): Add --unresolved-symbols.
4147         * target-reloc.h (issue_undefined_symbol_error): Check
4148         --unresolved-symbols.  Add comments.
4149
4150 2011-07-08  Ian Lance Taylor  <iant@google.com>
4151
4152         * testsuite/odr_violation2.cc (Ordering::operator()): Make
4153         expression more complex.
4154
4155 2011-07-08  Ian Lance Taylor  <iant@google.com>
4156
4157         PR gold/11317
4158         * target-reloc.h (issue_undefined_symbol_error): New inline
4159         function, broken out of relocate_section.
4160         (relocate_section): Call issue_undefined_symbol_error.
4161         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
4162         there is no TLS segment if we are about to issue an undefined
4163         symbol error.
4164         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
4165
4166 2011-07-08  Ian Lance Taylor  <iant@google.com>
4167
4168         PR gold/12279
4169         * resolve.cc (Symbol_table::should_override): Add fromtype
4170         parameter.  Change all callers.  Give error when linking together
4171         TLS and non-TLS symbol.
4172         (Symbol_table::should_override_with_special): Add fromtype
4173         parameter.  Change all callers.
4174         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
4175         there is no TLS segment if we have reported some errors.
4176         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
4177
4178 2011-07-08  Ian Lance Taylor  <iant@google.com>
4179
4180         PR gold/12372
4181         * target.h (Target::plt_address_for_global): New function.
4182         (Target::plt_address_for_local): New function.
4183         (Target::plt_section_for_global): Remove.
4184         (Target::plt_section_for_local): Remove.
4185         (Target::do_plt_address_for_global): New virtual function.
4186         (Target::do_plt_address_for_local): New virtual function.
4187         (Target::do_plt_section_for_global): Remove.
4188         (Target::do_plt_section_for_local): Remove.
4189         (Target::register_global_plt_entry): Add Symbol_table and Layout
4190         parameters.
4191         * output.cc (Output_data_got::Got_entry::write): Use
4192         plt_address_for_global and plt_address_for_local.
4193         * layout.cc (Layout::add_target_dynamic_tags): Use size and
4194         address of output section.
4195         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
4196         got_irelative_, and irelative_count_ fields.  Update
4197         declarations.
4198         (Output_data_plt_i386::has_irelative_section): New function.
4199         (Output_data_plt_i386::entry_count): Add irelative_count_.
4200         (Output_data_plt_i386::set_final_data_size): Likewise.
4201         (class Target_i386): Add got_irelative_ and rel_irelative_
4202         fields.  Update declarations.
4203         (Target_i386::Target_i386): Initialize new fields.
4204         (Target_i386::do_plt_address_for_global): New function replacing
4205         do_plt_section_for_global.
4206         (Target_i386::do_plt_address_for_local): New function replacing
4207         do_plt_section_for_local.
4208         (Target_i386::got_section): Create got_irelative_.
4209         (Target_i386::rel_irelative_section): New function.
4210         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
4211         fields.  Don't define __rel_iplt_{start,end}.
4212         (Output_data_plt_i386::add_entry): Add symtab and layout
4213         parameters.  Change all callers.  Use different PLT and GOT for
4214         IFUNC symbols.
4215         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
4216         layout parameters.  Change all callers.  Use different PLT and
4217         GOT.
4218         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
4219         (Output_data_plt_i386::rel_irelative): New function.
4220         (Output_data_plt_i386::address_for_global): New function.
4221         (Output_data_plt_i386::address_for_local): New function.
4222         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
4223         IRELATIVE GOT when changing IFUNC GOT entries.
4224         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
4225         reloc.
4226         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
4227         if we didn't create an IRELATIVE GOT.
4228         (Target_i386::Relocate::relocate): Use plt_address_for_global and
4229         plt_address_for_local.
4230         (Target_i386::do_dynsym_value): Use plt_address_for_global.
4231         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
4232         got_irelative_, and irelative_count_ fields.  Update
4233         declarations.
4234         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
4235         Initialize new fields.  Remove symtab parameter.  Change all
4236         callers.
4237         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
4238         irelative_count_.
4239         (Output_data_plt_x86_64::has_irelative_section): New function.
4240         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
4241         (class Target_x86_64): Add got_irelative_ and rel_irelative_
4242         fields.  Update declarations.
4243         (Target_x86_64::Target_x86_64): Initialize new fields.
4244         (Target_x86_64::do_plt_address_for_global): New function replacing
4245         do_plt_section_for_global.
4246         (Target_x86_64::do_plt_address_for_local): New function replacing
4247         do_plt_section_for_local.
4248         (Target_x86_64::got_section): Create got_irelative_.
4249         (Target_x86_64::rela_irelative_section): New function.
4250         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
4251         all callers.  Don't create __rel_iplt_{start,end}.
4252         (Output_data_plt_x86_64::add_entry): Add symtab and layout
4253         parameters.  Change all callers.  Use different PLT and GOT for
4254         IFUNC symbols.
4255         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
4256         layout parameters.  Change all callers.  Use different PLT and
4257         GOT.
4258         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
4259         parameters.  Change all callers.  Use different PLT and GOT for
4260         IFUNC symbols.
4261         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
4262         (Output_data_plt_x86_64::rela_irelative): New function.
4263         (Output_data_plt_x86_64::address_for_global): New function.
4264         (Output_data_plt_x86_64::address_for_local): New function.
4265         (Output_data_plt_x86_64::set_final_data_size): Likewise.
4266         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
4267         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
4268         (Target_x86_64::register_global_plt_entry): Add symtab and layout
4269         parameters.
4270         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
4271         reloc.
4272         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
4273         symbols if we didn't create an IRELATIVE GOT.
4274         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
4275         plt_address_for_local.
4276         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
4277         * testsuite/ifuncvar1.c: New test file.
4278         * testsuite/ifuncvar2.c: New test file.
4279         * testsuite/ifuncvar3.c: New test file.
4280         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
4281         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
4282         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
4283         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
4284         * testsuite/Makefile.in: Rebuild.
4285
4286 2011-07-07  Cary Coutant  <ccoutant@google.com>
4287
4288         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
4289         (two_file_test_1_ndebug.o): Likewise.
4290         (two_file_test_1b_ndebug.o): Likewise.
4291         (two_file_test_2_ndebug.o): Likewise.
4292         (two_file_test_main_ndebug.o): Likewise.
4293         (incremental_test_2): Link with no-debug versions.
4294
4295 2011-07-06  Cary Coutant  <ccoutant@google.com>
4296
4297         * gold/incremental.cc
4298         (Output_section_incremental_inputs::write_info_blocks): Check for
4299         hidden and internal symbols.
4300
4301 2011-07-06  Cary Coutant  <ccoutant@google.com>
4302
4303         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
4304         Check disposition for startup file.
4305         (Incremental_inputs::report_command_line): Ignore
4306         --incremental-startup-unchanged option.
4307         * options.cc (General_options::parse_incremental_startup_unchanged):
4308         New function.
4309         (General_options::General_options): Initialize new data member.
4310         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
4311         (General_options): Add --incremental-startup-unchanged option.
4312         (General_options::incremental_startup_disposition): New function.
4313         (General_options::incremental_startup_disposition_): New data member.
4314
4315 2011-07-06  Cary Coutant  <ccoutant@google.com>
4316
4317         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
4318         input file index to Script_info ctor.
4319         (Sized_incremental_binary::do_file_has_changed): Find the
4320         command-line argument for files named in scripts.
4321         * incremental.h (Script_info::Script_info): New ctor
4322         with input file index.
4323         (Script_info::input_file_index): New function.
4324         (Script_info::input_file_index_): New data member.
4325         (Incremental_binary::get_library): Add const.
4326         (Incremental_binary::get_script_info): Add const.
4327         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
4328         * testsuite/Makefile.am (incremental_test_5): New test case.
4329         (incremental_test_6): New test case.
4330         * testsuite/Makefile.in: Regenerate.
4331
4332 2011-07-06  Cary Coutant  <ccoutant@google.com>
4333
4334         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
4335         debug output when command lines differ.
4336
4337 2011-07-06  Cary Coutant  <ccoutant@google.com>
4338
4339         * incremental.cc (Incremental_inputs::report_command_line): Ignore
4340         --incremental-patch option.
4341         * layout.cc (Free_list::allocate): Extend allocation beyond original
4342         end if enabled.
4343         (Layout::make_output_section): Mark sections that should get
4344         patch space.
4345         * options.cc (parse_percent): New function.
4346         * options.h (parse_percent): New function.
4347         (DEFINE_percent): New macro.
4348         (General_options): Add --incremental-patch option.
4349         * output.cc (Output_section::Output_section): Initialize new data
4350         members.
4351         (Output_section::add_input_section): Print section name when out
4352         of patch space.
4353         (Output_section::add_output_section_data): Likewise.
4354         (Output_section::set_final_data_size): Add patch space when
4355         doing --incremental-full.
4356         (Output_section::do_reset_address_and_file_offset): Remove patch
4357         space.
4358         (Output_segment::set_section_list_addresses): Print debug output
4359         only if --incremental-update.
4360         * output.h (Output_section::set_is_patch_space_allowed): New function.
4361         (Output_section::is_patch_space_allowed_): New data member.
4362         (Output_section::patch_space_): New data member.
4363         * parameters.cc (Parameters::incremental_full): New function.
4364         * parameters.h (Parameters::incremental_full): New function
4365         * testsuite/Makefile.am (incremental_test_2): Add test for
4366         --incremental-patch option.
4367         * testsuite/Makefile.in: Regenerate.
4368         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
4369         (t18): Remove function body.
4370
4371 2011-07-05  Doug Kwan  <dougkwan@google.com>
4372
4373         PR gold/12771
4374         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
4375         Arm_Address type for relocation result.
4376         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
4377         overflow check.
4378         (Arm_relocate_functions::abs32): Use unaligned access.
4379         (Arm_relocate_functions::rel32): Ditto.
4380         (Arm_relocate_functions::prel31): Ditto.
4381         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
4382         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
4383         static data relocations.
4384         * testsuite/Makefile.in: Regnerate.
4385         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
4386
4387 2011-07-05  Ian Lance Taylor  <iant@google.com>
4388
4389         PR gold/12392
4390         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
4391         symbols if necessary.
4392         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
4393
4394 2011-07-05  Ian Lance Taylor  <iant@google.com>
4395
4396         PR gold/12952
4397         * resolve.cc (Symbol::override_base_with_special): Simply override
4398         version with special symbol version, ignoring previous version.
4399
4400 2011-07-05  Ian Lance Taylor  <iant@google.com>
4401
4402         * object.cc (Sized_relobj_file::include_section_group): Add
4403         information to comment about signature location.
4404
4405 2011-07-02  Ian Lance Taylor  <iant@google.com>
4406
4407         PR gold/12957
4408         * options.h (class General_options): Add -f and -F.
4409         * options.cc (General_options::finalize): Fatal error if -f/-F
4410         are used without -shared.
4411         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
4412
4413 2011-07-02  Ian Lance Taylor  <iant@google.com>
4414
4415         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
4416
4417 2011-07-01  Ian Lance Taylor  <iant@google.com>
4418
4419         PR gold/12525
4420         PR gold/12952
4421         * resolve.cc (Symbol::override_base_with_special): Don't override
4422         the version if the overriding symbol has a different name.
4423         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
4424         all callers.  If we give an error about an undefined version,
4425         define the base version if necessary.
4426         * dynobj.h (class Versions): Update declaration.
4427         * testsuite/weak_alias_test_5.cc: New file.
4428         * testsuite/weak_alias_test.script: New file.
4429         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
4430         and versioned_alias have the right value, and call t2.
4431         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
4432         weak_alias_test_5.so.
4433         (weak_alias_test_LDADD): Likewise.
4434         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
4435         * testsuite/Makefile.in: Rebuild.
4436
4437 2011-07-01  Ian Lance Taylor  <iant@google.com>
4438
4439         PR gold/12525
4440         * options.h (class General_options): Support -z notext.
4441         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
4442         -Wl,-z,notext.
4443         (two_file_shared_nonpic.so): Likewise.
4444         (two_file_shared_mixed.so): Likewise.
4445         (two_file_shared_mixed_1.so): Likewise.
4446         (weak_undef_lib_nonpic.so): Likewise.
4447         (alt/weak_undef_lib_nonpic.so): Likewise.
4448         (tls_test_shared_nonpic.so): Likewise.
4449         * testsuite/Makefile.in: Rebuild.
4450
4451 2011-07-01  Ian Lance Taylor  <iant@google.com>
4452
4453         PR gold/12525
4454         * configure.ac: Test whether static linking works, setting
4455         the automake conditional HAVE_STATIC.
4456         * testsuite/Makefile.am: Disable tests using -static if
4457         HAVE_STATIC is not true.
4458         * configure, testsuite/Makefile.in: Rebuild.
4459
4460 2011-07-01  Ian Lance Taylor  <iant@google.com>
4461
4462         PR gold/12525
4463         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
4464         Assert if we see DW_EH_PE_indirect.
4465         * target.h (Target::ehframe_datarel_base): New function.
4466         (Target::do_ehframe_datarel_base): New target function.
4467         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
4468         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
4469         function.
4470
4471 2011-07-01  Ian Lance Taylor  <iant@google.com>
4472
4473         PR gold/12571
4474         * options.h (class General_options): Add
4475         --ld-generated-unwind-info.
4476         * ehframe.cc (Fde::write): Add address parameter.  Change all
4477         callers.  If associated with PLT, fill in address and size.
4478         (Cie::set_output_offset): Only add merge mapping if there is an
4479         object.
4480         (Cie::write): Add address parameter.  Change all callers.
4481         (Eh_frame::add_ehframe_for_plt): New function.
4482         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
4483         input_offset_ fields into union u_, with new plt field.
4484         (Fde::Fde): Adjust for new union field.
4485         (Fde::Fde) [Output_data version]: New constructor.
4486         (Fde::add_mapping): Only add merge mapping if there is an object.
4487         (class Cie): Update declarations.
4488         (class Eh_frame): Declare add_ehframe_for_plt.
4489         * layout.cc (Layout::layout_eh_frame): Break out code into
4490         make_eh_frame_section, and call it.
4491         (Layout::make_eh_frame_section): New function.
4492         (Layout::add_eh_frame_for_plt): New function.
4493         * layout.h (class Layout): Update declarations.
4494         * merge.cc (Merge_map::add_mapping): Add assertion.
4495         * i386.cc: Include "dwarf.h".
4496         (class Output_data_plt_i386): Make first_plt_entry,
4497         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
4498         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
4499         and plt_eh_frame_fde.
4500         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
4501         boundary.  Call add_eh_frame_for_plt if appropriate.
4502         * x86_64.cc: Include "dwarf.h".
4503         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
4504         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
4505         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
4506         and plt_eh_frame_fde.
4507         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
4508         appropriate.
4509
4510 2011-06-29  Ian Lance Taylor  <iant@google.com>
4511
4512         PR gold/12629
4513         * object.cc (Sized_relobj_file::layout_section): Change shdr
4514         parameter to be const.
4515         (Sized_relobj_file::layout_eh_frame_section): New function, broken
4516         out of do_layout.
4517         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
4518         appropriate.  Call layout_eh_frame_section.
4519         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
4520         sections.
4521         * object.h (class Sized_relobj_file): Update declarations.
4522
4523 2011-06-29  Ian Lance Taylor  <iant@google.com>
4524
4525         PR gold/12652
4526         * script.cc (Token::integer_value): Accept trailing M/m/K/k
4527         modifier.
4528         (Lex::gather_token): Accept trailing M/m/K/k for integers.
4529
4530 2011-06-29  Ian Lance Taylor  <iant@google.com>
4531
4532         PR gold/12675
4533         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
4534         SHT_X86_64_UNWIND.
4535         * layout.cc (Layout::layout_eh_frame): Likewise.
4536
4537 2011-06-29  Ian Lance Taylor  <iant@google.com>
4538
4539         PR gold/12695
4540         * layout.cc (Layout::symtab_section_shndx): New function.
4541         * layout.h (class Layout): Declare symtab_section_shndx.
4542         * output.cc (Output_section::write_header): Call it.
4543
4544 2011-06-29  Ian Lance Taylor  <iant@google.com>
4545
4546         PR gold/12818
4547         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
4548         symbols which are not used in a relocation.
4549
4550 2011-06-28  Ian Lance Taylor  <iant@google.com>
4551
4552         PR gold/12898
4553         * layout.cc (Layout::segment_precedes): Don't crash if a linker
4554         script create indistinguishable segments.
4555         (Layout::set_segment_offsets): Use stable_sort when sorting
4556         segments.  Pass this to Compare_segments constructor.
4557         * layout.h (class Layout): Make segment_precedes non-static.
4558         (class Compare_segments): Change from struct to class.  Add
4559         layout_ field.  Add constructor.
4560         * script-sections.cc
4561         (Script_sections::attach_sections_using_phdrs_clause): Rename
4562         local orphan to is_orphan.  Don't report failure to put empty
4563         section in segment.  On attachment failure, report name of
4564         section, and attach to first PT_LOAD segment.
4565
4566 2011-06-28  Ian Lance Taylor  <iant@google.com>
4567
4568         PR gold/12934
4569         * target-select.cc (Target_selector::Target_selector): Add
4570         emulation parameter.  Change all callers.
4571         (select_target_by_bfd_name): Rename from select_target_by_name.
4572         Change all callers.
4573         (select_target_by_emulation): New function.
4574         (supported_emulation_names): New function.
4575         * target-select.h (class Target_selector): Add emulation_ field.
4576         Update declarations.
4577         (Target_selector::recognize_by_bfd_name): Rename from
4578         recognize_by_name.  Change all callers.
4579         (Target_selector::supported_bfd_names): Rename from
4580         supported_names.  Change all callers.
4581         (Target_selector::recognize_by_emulation): New function.
4582         (Target_selector::supported_emulations): New function.
4583         (Target_selector::emulation): New function.
4584         (Target_selector::do_recognize_by_bfd_name): Rename from
4585         do_recognize_by_name.  Change all callers.
4586         (Target_selector::do_supported_bfd_names): Rename from
4587         do_supported_names.  Change all callers.
4588         (Target_selector::do_recognize_by_emulation): New function.
4589         (Target_selector::do_supported_emulations): New function.
4590         (select_target_by_bfd_name): Change name in declaration.
4591         (select_target_by_emulation): Declare.
4592         (supported_emulation_names): Declare.
4593         * parameters.cc (parameters_force_valid_target): Try to find
4594         target based on emulation from -m option.
4595         * options.h (class General_options): Change doc string for -m.
4596         * options.cc (help): Print emulations.
4597         (General_options::parse_V): Likewise.
4598         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
4599         Add emulation parameter.  Change all callers.
4600
4601 2011-06-28  Ian Lance Taylor  <iant@google.com>
4602
4603         * target.h (class Target): Add osabi_ field.
4604         (Target::osabi): New function.
4605         (Target::set_osabi): New function.
4606         (Target::Target): Initialize osabi_.
4607         (Target::do_adjust_elf_header): Make pure virtual.
4608         (Sized_target::do_adjust_elf_header): Declare.
4609         * target.cc (Sized_target::do_adjust_elf_header): New function.
4610         (class Sized_target): Instantiate all versions.
4611         * freebsd.h (class Target_freebsd): Remove.
4612         (Target_selector_freebsd::do_recognize): Call set_osabi on
4613         Target.
4614         (Target_selector_freebsd::do_recognize_by_name): Likewise.
4615         (Target_selector_freebsd::set_osabi): Remove.
4616         * i386.cc (class Target_i386): Inherit from Sized_target rather
4617         than Target_freebsd.
4618         * x86_64.cc (class Target_x86_64): Likewise.
4619
4620 2011-06-28  Ian Lance Taylor  <iant@google.com>
4621
4622         * target.h (Target::can_check_for_function_pointers): Rewrite.
4623         Make non-virtual.
4624         (Target::can_icf_inline_merge_sections): Likewise.
4625         (Target::section_may_have_icf_unsafe_poineters): Likewise.
4626         (Target::Target_info): Add can_icf_inline_merge_sections field.
4627         (Target::do_can_check_for_function_pointers): New virtual
4628         function.
4629         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
4630         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
4631         from can_check_for_function_pointers, move in file.
4632         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
4633         section_may_have_icf_unsafe_poineters, move in file.
4634         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
4635         * i386.cc (Target_i386::do_can_check_for_function_pointers):
4636         Rename from can_check_for_function_pointers, move in file.
4637         (Target_i386::can_icf_inline_merge_sections): Remove.
4638         (Target_i386::i386_info): Initialize
4639         can_icf_inline_merge_sections.
4640         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
4641         Initialize can_icf_inline_merge_sections.
4642         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
4643         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
4644         Rename from can_check_for_function_pointers, move in file.
4645         (Target_x86_64::can_icf_inline_merge_sections): Remove.
4646         (Target_x86_64::x86_64_info): Initialize
4647         can_icf_inline_merge_sections.
4648         * testsuite/testfile.cc (Target_test::test_target_info):
4649         Likewise.
4650         * icf.cc (get_section_contents): Correct formatting.
4651
4652 2011-06-27  Ian Lance Taylor  <iant@google.com>
4653
4654         * symtab.cc (Symbol::versioned_name): New function.
4655         (Symbol_table::add_to_final_symtab): Use versioned_name when
4656         appropriate.
4657         (Symbol_table::sized_write_symbol): Likewise.
4658         * symtab.h (class Symbol): Declare versioned_name.
4659         * stringpool.h (class Stringpool_template): Add variant of add
4660         which takes a std::basic_string.
4661         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
4662         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
4663         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
4664         (ver_test_12.o): New target.
4665         * testsuite/Makefile.in: Rebuild.
4666
4667 2011-06-27  Doug Kwan  <dougkwan@google.com>
4668
4669         * arm.cc (Arm_relocate_functions::thm_jump8,
4670         Arm_relocate_functions::thm_jump11): Use a wider signed
4671         type to compute offset.
4672         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
4673         arm_thm_jump8.
4674         * testsuite/Makefile.in: Regenerate.
4675         * testsuite/arm_branch_in_range.sh: Check test results of
4676         arm_thm_jump11 and arm_thm_jump8.
4677         * testsuite/arm_thm_jump11.s: New test source file.
4678         * testsuite/arm_thm_jump11.t: New linker script.
4679         * testsuite/arm_thm_jump8.s: New test source file.
4680         * testsuite/arm_thm_jump8.t: New linker script.
4681
4682 2011-06-24  Ian Lance Taylor  <iant@google.com>
4683
4684         * layout.cc: Include "object.h".
4685         (ctors_sections_in_init_array): New static variable.
4686         (Layout::is_ctors_in_init_array): New function.
4687         (Layout::layout): Add entry to ctors_sections_in_init_array if
4688         appropriate.
4689         * layout.h (class Layout): Declare is_ctors_in_init_array.
4690         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
4691         is_ctors_reverse_view is set.
4692         (Sized_relobj_file::write_sections): Add layout parameter.  Change
4693         all callers.  Set is_ctors_reverse_view field of View_size.
4694         (Sized_relobj_file::reverse_words): New function.
4695         * object.h (Sized_relobj_file::View_size): Add
4696         is_ctors_reverse_view field.
4697         (class Sized_relobj_file): Update declarations.
4698         * testsuite/initpri3.c: New test.
4699         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
4700         initpri3b.
4701         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
4702         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
4703         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
4704         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
4705         * testsuite/Makefile.in: Rebuild.
4706
4707 2011-06-24  Cary Coutant  <ccoutant@google.com>
4708
4709         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
4710         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
4711         (debug_msg_cdebug.err): New targets.
4712         * testsuite/Makefile.in: Regenerate.
4713         * testsuite/debug_msg.sh: Check output of link with compressed debug.
4714         Fix checks for link with shared library.
4715
4716 2011-06-24  Doug Kwan  <dougkwan@google.com>
4717
4718         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
4719         skip empty text sections.
4720         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
4721
4722 2011-06-22  Ian Lance Taylor  <iant@google.com>
4723
4724         PR gold/12910
4725         * options.h (class General_options): Add --ctors-in-init-array.
4726         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
4727         friends as SHT_PROGBITS for merging sections.
4728         (Layout::layout): Remove special handling of .init_array and
4729         friends.  Don't sort if doing relocatable link.  Sort for .ctors
4730         and .dtors if ctors_in_init_array.
4731         (Layout::make_output_section): Force correct section types for
4732         .init_array and friends.  Don't sort if doing relocatable link,
4733         Don't sort .ctors and .dtors if ctors_in_init_array.
4734         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
4735         (Layout::output_section_name): Add relobj parameter.  Change all
4736         callers.  Handle .ctors. and .dtors. in code rather than table.
4737         Handle .ctors and .dtors if ctors_in_init_array.
4738         (Layout::match_file_name): New function, moved from output.cc.
4739         * layout.h (class Layout): Update declarations.
4740         * output.cc: Include "layout.h".
4741         (Input_section_sort_entry::get_priority): New function.
4742         (Input_section_sort_entry::match_file_name): Just call
4743         Layout::match_file_name.
4744         (Output_section::Input_section_sort_init_fini_compare::operator()):
4745         Handle .ctors and .dtors.  Sort by explicit priority rather than
4746         by name.
4747         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
4748         * testsuite/initpri2.c: New test.
4749         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
4750         (check_PROGRAMS): Add initpri2.
4751         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
4752         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
4753         * configure, testsuite/Makefile.in: Rebuild.
4754
4755 2011-06-19  Ian Lance Taylor  <iant@google.com>
4756
4757         PR gold/12880
4758         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
4759         .interp section to a PT_INTERP segment even if we have seen a
4760         --dynamic-linker option.  Don't do it if we have seen a PHDRS
4761         clause in a linker script.
4762         (Layout::finalize): Don't create a .interp section if we've
4763         already create a PT_INTERP segment.
4764         (Layout::create_interp): Always call choose_output_section (revert
4765         patch of 2011-06-17).  Don't create PT_INTERP segment.
4766         * script-sections.cc
4767         (Script_sections::create_note_and_tls_segments): Add a .interp
4768         section to a PT_INTERP segment even if we have seen a
4769         --dynamic-linker option.
4770
4771 2011-06-18  Ian Lance Taylor  <iant@google.com>
4772
4773         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
4774         merely because a non-PT_LOAD segment has a dynamic reloc.
4775
4776 2011-06-18  Ian Lance Taylor  <iant@google.com>
4777
4778         * layout.cc (Layout::finish_dynamic_section): Don't create
4779         DT_FLAGS entry if not needed.
4780
4781 2011-06-18  Ian Lance Taylor  <iant@google.com>
4782
4783         PR gold/12745
4784         * layout.cc (Layout::layout_eh_frame): Correct handling of
4785         writable .eh_frame section.
4786
4787 2011-06-17  Ian Lance Taylor  <iant@google.com>
4788
4789         PR gold/12893
4790         * resolve.cc (Symbol_table::resolve): Don't give an error if a
4791         symbol is redefined with the exact same object and value.
4792
4793 2011-06-17  Ian Lance Taylor  <iant@google.com>
4794
4795         PR gold/12880
4796         * layout.h (class Layout): Add interp_segment_ field.
4797         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
4798         (Layout::attach_allocated_section_to_segment): If making shared
4799         library, put .interp section in PT_INTERP segment.
4800         (Layout::finalize): Also call create_interp if -dynamic-linker
4801         option was used.
4802         (Layout::create_interp): Assert that there is no PT_INTERP
4803         segment.  If not using a SECTIONS clause, use make_output_section.
4804         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
4805         * script-sections.cc
4806         (Script_sections::create_note_and_tls_segments): If making shared
4807         library, put .interp section in PT_INTERP segment.
4808
4809 2011-06-17  Ian Lance Taylor  <iant@google.com>
4810
4811         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
4812         when making a shared library.
4813
4814 2011-06-17  Ian Lance Taylor  <iant@google.com>
4815
4816         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
4817         parameter.  Change all callers.  Don't issue warning about PC32
4818         against locally defined symbol.
4819
4820 2011-06-16  Ian Lance Taylor  <iant@google.com>
4821
4822         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
4823         occurs in same object.
4824
4825 2011-06-14  Alan Modra  <amodra@gmail.com>
4826
4827         * po/POTFILES.in: Regenerate.
4828
4829 2011-06-09  Ian Lance Taylor  <iant@google.com>
4830
4831         * script-sections.cc
4832         (Orphan_output_section::set_section_addresses): For a relocatable
4833         link set address to 0.
4834
4835 2011-06-09  Cary Coutant  <ccoutant@google.com>
4836
4837         PR gold/12804
4838         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
4839         used with --compress-debug-sections.
4840         * gold/object.cc (Sized_relobj_file::do_layout): Report
4841         uncompressed size of compressed input sections.
4842
4843 2011-06-08  Cary Coutant  <ccoutant@google.com>
4844
4845         PR gold/12804
4846         * testsuite/two_file_test_2_v1.cc: Change initialization of
4847         v2 to keep it in .data.
4848
4849 2011-06-07  Cary Coutant  <ccoutant@google.com>
4850
4851         * common.cc (Symbol_table::do_allocate_commons_list): Call
4852         gold_fallback.
4853         * errors.cc (Errors::fatal): Adjust call to gold_exit.
4854         (Errors::fallback): New function.
4855         (gold_fallback): New function.
4856         * errors.h (Errors::fallback): New function.
4857         * gold.cc (gold_exit): Change status parameter to enum; adjust
4858         all callers.
4859         (queue_initial_tasks): Call gold_fallback.
4860         * gold.h: Include cstdlib.
4861         (Exit_status): New enum type.
4862         (gold_exit): Change status parameter to enum.
4863         (gold_fallback): New function.
4864         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
4865         (Layout::create_symtab_sections): Likewise.
4866         (Layout::create_shdrs): Likewise.
4867         * main.cc (main): Adjust call to gold_exit.
4868         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
4869         (Output_data_got::add_got_entry_pair): Likewise.
4870         (Output_section::add_input_section): Likewise.
4871         (Output_section::add_output_section_data): Likewise.
4872         (Output_segment::set_section_list_addresses): Likewise.
4873         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
4874
4875 2011-06-07  Cary Coutant  <ccoutant@google.com>
4876
4877         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
4878         for incremental links.
4879         * output.cc (Output_segment::set_section_list_addresses): Remove
4880         FIXME and test for TLS or BSS.
4881
4882 2011-06-07  Cary Coutant  <ccoutant@google.com>
4883
4884         * testsuite/Makefile.am: Add incremental_copy_test,
4885         incremental_common_test_1.
4886         * testsuite/Makefile.in: Regenerate.
4887         * testsuite/common_test_1_v1.c: New source file.
4888         * testsuite/common_test_1_v2.c: New source file.
4889         * testsuite/copy_test_v1.cc: New source file.
4890
4891 2011-06-07  Cary Coutant  <ccoutant@google.com>
4892
4893         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
4894         update, allocate common from bss section's free list.
4895         * incremental-dump.cc (dump_incremental_inputs): Print flag for
4896         linker-defined symbols.
4897         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
4898         Skip GOT and PLT entries that are no longer referenced.
4899         (Output_section_incremental_inputs::write_info_blocks): Mark
4900         linker-defined symbols.
4901         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
4902         * output.cc (Output_section::allocate): New function.
4903         * output.h (Output_section::allocate): New function.
4904         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
4905         linker-defined symbols.
4906         (Symbol::override_base_with_special): Copy is_predefined_ flag.
4907         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
4908         (Symbol::init_base_output_data): Likewise.
4909         (Symbol::init_base_output_segment): Likewise.
4910         (Symbol::init_base_constant): Likewise.
4911         (Sized_symbol::init_output_data): Likewise.
4912         (Sized_symbol::init_output_segment): Likewise.
4913         (Sized_symbol::init_constant): Likewise.
4914         (Symbol_table::do_define_in_output_data): Likewise.
4915         (Symbol_table::do_define_in_output_segment): Likewise.
4916         (Symbol_table::do_define_as_constant): Likewise.
4917         * symtab.h (Symbol::is_predefined): New function.
4918         (Symbol::init_base_output_data): Add is_predefined parameter.
4919         (Symbol::init_base_output_segment): Likewise.
4920         (Symbol::init_base_constant): Likewise.
4921         (Symbol::is_predefined_): New data member.
4922         (Sized_symbol::init_output_data): Add is_predefined parameter.
4923         (Sized_symbol::init_output_segment): Likewise.
4924         (Sized_symbol::init_constant): Likewise.
4925         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
4926
4927 2011-06-07  Cary Coutant  <ccoutant@google.com>
4928
4929         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
4930         instead of emit_copy_reloc.
4931         (Copy_relocs::emit_copy_reloc): Refactor.
4932         (Copy_relocs::make_copy_reloc): New function.
4933         (Copy_relocs::add_copy_reloc): Remove.
4934         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
4935         section.
4936         (Copy_relocs::make_copy_reloc): New function.
4937         (Copy_relocs::add_copy_reloc): Remove.
4938         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
4939         unchanged input files.
4940         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
4941         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
4942         Reserve BSS space for COPY relocations.
4943         (Sized_incremental_binary::do_emit_copy_relocs): New function.
4944         (Output_section_incremental_inputs::write_info_blocks): Record
4945         whether a symbol is copied from a shared object.
4946         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
4947         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
4948         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
4949         (Incremental_input_entry_reader::get_output_symbol_index): Add
4950         is_copy parameter.
4951         (Incremental_binary::emit_copy_relocs): New function.
4952         (Incremental_binary::do_emit_copy_relocs): New function.
4953         (Sized_incremental_binary::Sized_incremental_binary): Initialize
4954         new data member.
4955         (Sized_incremental_binary::add_copy_reloc): New function.
4956         (Sized_incremental_binary::do_emit_copy_relocs): New function.
4957         (Sized_incremental_binary::Copy_reloc): New struct.
4958         (Sized_incremental_binary::Copy_relocs): New typedef.
4959         (Sized_incremental_binary::copy_relocs_): New data member.
4960         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
4961         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
4962         * target.h (Sized_target::emit_copy_reloc): New function.
4963         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
4964
4965 2011-06-02  Cary Coutant  <ccoutant@google.com>
4966
4967         PR gold/12163
4968         * gold/archive.cc (Archive::Archive): Initialize new data member.
4969         (Archive::include_all_members): Return if archive has already been
4970         included.
4971         * gold/archive.h (Archive::include_all_members_): New data member.
4972
4973 2011-06-02  Nick Clifton  <nickc@redhat.com>
4974
4975         * dynobj.h: Fix spelling mistake in comment.
4976         * output.cc: Likewise.
4977
4978 2011-05-31  Doug Kwan  <dougkwan@google.com>
4979             Asier Llano
4980
4981         PR gold/12826
4982         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
4983         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
4984         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
4985         redundant arm_exidx_test.so.
4986         * testsuite/Makefile.in: Regenerate.
4987         (check_SCRIPTS): Add pr12826.sh
4988         (check_DATA): Add pr12826.stdout
4989         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
4990         * testsuite/pr12826.sh: New file.
4991         * testsuite/pr12826_1.s: Ditto.
4992         * testsuite/pr12826_1.s: Ditto.
4993
4994 2011-05-30  Ian Lance Taylor  <iant@google.com>
4995
4996         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
4997         sections.
4998
4999 2011-05-29  Ian Lance Taylor  <iant@google.com>
5000
5001         PR gold/12804
5002         * testsuite/Makefile.am: Use different file name for two_file_test
5003         temporary file for each incremental test.
5004         * testsuite/Makefile.in: Rebuild.
5005
5006 2011-05-29  Ian Lance Taylor  <iant@google.com>
5007
5008         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
5009         binary input file is empty.
5010
5011 2011-05-27  Ian Lance Taylor  <iant@google.com>
5012
5013         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
5014         (ver_test_9.so): Likewise.
5015         * testsuite/Makefile.in: Rebuild.
5016
5017 2011-05-26 Cary Coutant  <ccoutant@google.com>
5018
5019         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
5020         * incremental.cc (Incremental_inputs::report_input_section): Fix
5021         comment, indentation.
5022         (Incremental_inputs::report_comdat_group): New function.
5023         (Output_section_incremental_inputs::set_final_data_size): Adjust size
5024         of data for incremental input file entry.
5025         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
5026         group count, COMDAT group signatures.
5027         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
5028         an unchanged input file.
5029         * incremental.h (Incremental_object_entry::Incremental_object_entry):
5030         Initialize new data member.
5031         (Incremental_object_entry::add_comdat_group): New function.
5032         (Incremental_object_entry::get_comdat_group_count): New function.
5033         (Incremental_object_entry::get_comdat_signature_key): New function.
5034         (Incremental_object_entry::groups_): New data member.
5035         (Incremental_inputs::report_comdat_group): New function.
5036         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
5037         data for incremental input file entry.
5038         (Incremental_input_entry_reader::get_comdat_group_count): New function.
5039         (Incremental_input_entry_reader::get_input_section): Adjust size of
5040         data for incremental input file entry.
5041         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
5042         (Incremental_input_entry_reader::get_comdat_group_signature): New
5043         function.
5044         * object.cc (Sized_relobj::include_section_group): Report kept
5045         COMDAT groups for incremental links.
5046
5047 2011-05-24  David Meyer  <pdox@google.com>
5048
5049         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
5050         with name parameter.  Add found_name parameter.
5051         * fileread.cc (Input_file::find_file): Adjust code accordingly.
5052         * dirsearch.h (class Dirsearch): Update declaration.
5053
5054 2011-05-24  Ian Lance Taylor  <iant@google.com>
5055
5056         * archive.cc (Library_base::should_include_member): Pull in object
5057         from archive if it defines the entry symbol.
5058         * parameters.cc (Parameters::entry): New function.
5059         * parameters.h (class Parameters): Declare entry.
5060         * output.h (class Output_file_header): Remove entry_ field.
5061         * output.cc (Output_file_header::Output_file_header): Remove entry
5062         parameter.  Change all callers.
5063         (Output_file_header::entry): Use parameters->entry.
5064         * gold.cc (queue_middle_tasks): Likewise.
5065         * plugin.cc (Plugin_hook::run): Likewise.
5066
5067 2011-05-24 Cary Coutant  <ccoutant@google.com>
5068
5069         * gold.cc (queue_initial_tasks): Pass incremental base filename
5070         to Output_file::open_base_file; don't print error message.
5071         * incremental-dump.cc (main): Adjust call to
5072         Output_file::open_for_modification.
5073         * incremental-dump.cc (main): Likewise.
5074         * incremental.cc (Incremental_inputs::report_command_line):
5075         Ignore --incremental-base option when comparing command lines.
5076         Ignore parameter when given as separate argument.
5077         * options.h (class General_options): Add --incremental-base.
5078         * output.cc (Output_file::Output_file):
5079         (Output_file::open_base_file): Add base_name and writable parameters;
5080         read base file into new file; print error message here.
5081         (Output_file::map_no_anonymous): Add writable parameter; adjust all
5082         callers.
5083         * output.h (Output_file::open_for_modification): Rename to...
5084         (Output_file::open_base_file): ...this; add base_name and
5085         writable parameters; adjust all callers.
5086         (Output_file::map_no_anonymous): Add writable parameter; adjust all
5087         callers.
5088         * testsuite/Makefile.am (incremental_test_4): Test
5089         --incremental-base.
5090         * testsuite/Makefile.in: Regenerate.
5091
5092 2011-05-24 Cary Coutant  <ccoutant@google.com>
5093
5094         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
5095         incremental_test_4.
5096         * testsuite/Makefile.in: Regenerate.
5097         * testsuite/two_file_test_1_v1.cc: New test source file.
5098         * testsuite/two_file_test_1b_v1.cc: New test source file.
5099         * testsuite/two_file_test_2_v1.cc: New test source file.
5100
5101 2011-05-24 Cary Coutant  <ccoutant@google.com>
5102
5103         * dynobj.h (Dynobj::do_dynobj): New function.
5104         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
5105         flag and soname for shared objects.
5106         * incremental.cc (Incremental_inputs::report_object): Make
5107         either Incremental_object_entry or Incremental_dynobj_entry; add
5108         soname to string table.
5109         (Incremental_inputs::report_input_section): Add assertion.
5110         (Output_section_incremental_inputs::set_final_data_size): Adjust
5111         type of input file entry for shared libraries; adjust size of
5112         shared library info entry.
5113         (Output_section_incremental_inputs::write_input_files): Write
5114         as_needed flag for shared libraries.
5115         (Output_section_incremental_inputs::write_info_blocks): Adjust type
5116         of input file entry for shared libraries; write soname.
5117         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
5118         soname from incremental info.
5119         * incremental.h (enum Incremental_input_flags): Add
5120         INCREMENTAL_INPUT_AS_NEEDED.
5121         (Incremental_input_entry::Incremental_input_entry): Initialize new
5122         data member.
5123         (Incremental_input_entry::set_as_needed): New function.
5124         (Incremental_input_entry::as_needed): New function.
5125         (Incremental_input_entry::do_dynobj_entry): New function.
5126         (Incremental_input_entry::as_needed_): New data member.
5127         (Incremental_object_entry::Incremental_object_entry): Don't check
5128         for shared library.
5129         (Incremental_object_entry::do_type): Likewise.
5130         (class Incremental_dynobj_entry): New class.
5131         (Incremental_input_entry_reader::as_needed): New function.
5132         (Incremental_input_entry_reader::get_soname): New function.
5133         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
5134         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
5135         size of shared library info entry.
5136         * layout.cc (Layout::finish_dynamic_section): Don't test for
5137         incremental link when adding DT_NEEDED entries.
5138         * object.h (Object::Object): Initialize new data member.
5139         (Object::dynobj): New function.
5140         (Object::set_as_needed): New function.
5141         (Object::as_needed): New function.
5142         (Object::do_dynobj): New function.
5143         (Object::as_needed_): New data member.
5144
5145 2011-05-24 Cary Coutant  <ccoutant@google.com>
5146
5147         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
5148         info; adjust display of GOT entries.
5149         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
5150         vector of input objects; remove file_status_.
5151         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
5152         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
5153         got_plt reader; call target hooks to reserve GOT entries.
5154         (Output_section_incremental_inputs::set_final_data_size): Adjust size
5155         of input file info header and GOT info entry.
5156         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
5157         relocation info.
5158         (Got_plt_view_info::got_descriptor): Remove.
5159         (Got_plt_view_info::sym_index): New data member.
5160         (Got_plt_view_info::input_index): New data member.
5161         (Local_got_offset_visitor::visit): Write input file index.
5162         (Global_got_offset_visitor::visit): Write 0 for input file index.
5163         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
5164         with sym_index and input_index.
5165         (Output_section_incremental_inputs::write_got_plt): Adjust size of
5166         incremental info GOT entry; replace got_descriptor with input_index.
5167         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
5168         map from input file index to object.
5169         (Sized_relobj_incr::do_layout): Replace direct data member reference
5170         with accessor function.
5171         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
5172         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
5173         Adjust size of input file info header.
5174         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
5175         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
5176         (Incremental_input_entry_reader::get_input_section): Adjust size of
5177         input file info header.
5178         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
5179         of incremental info GOT entry.
5180         (Incremental_got_plt_reader::get_got_desc): Remove.
5181         (Incremental_got_plt_reader::get_got_symndx): New function.
5182         (Incremental_got_plt_reader::get_got_input_index): New function.
5183         (Sized_incremental_binary::Sized_incremental_binary): Remove
5184         file_status_; add input_objects_.
5185         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
5186         (Sized_incremental_binary::set_file_is_unchanged): Remove.
5187         (Sized_incremental_binary::file_is_unchanged): Remove.
5188         (Sized_incremental_binary::set_input_object): New function.
5189         (Sized_incremental_binary::input_object): New function.
5190         (Sized_incremental_binary::file_status_): Remove.
5191         (Sized_incremental_binary::input_objects_): New data member.
5192         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
5193         references.
5194         (Sized_relobj_incr::invalid_address): Move to base class.
5195         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
5196         class.
5197         (Sized_relobj_incr::do_output_section_offset): Likewise.
5198         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
5199         (Sized_relobj_incr::section_offsets_): Likewise.
5200         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
5201         function.
5202         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
5203         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
5204         with accessor function.
5205         (Sized_relobj_file::do_layout): Likewise.
5206         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
5207         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
5208         (Sized_relobj_file::compute_final_local_value): Replace refs to
5209         section_offsets_ with accessor function.
5210         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
5211         * object.h (Relobj::Relobj): Initialize new data members.
5212         (Relobj::add_dyn_reloc): New function.
5213         (Relobj::first_dyn_reloc): New function.
5214         (Relobj::dyn_reloc_count): New function.
5215         (Relobj::first_dyn_reloc_): New data member.
5216         (Relobj::dyn_reloc_count_): New data member.
5217         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
5218         references.
5219         (Sized_relobj::Address): New typedef.
5220         (Sized_relobj::invalid_address): Move here from child class.
5221         (Sized_relobj::Sized_relobj): Initialize new data members.
5222         (Sized_relobj::sized_relobj): New function.
5223         (Sized_relobj::is_output_section_offset_invalid): Move here from
5224         child class.
5225         (Sized_relobj::get_output_section_offset): Likewise.
5226         (Sized_relobj::local_has_got_offset): Likewise.
5227         (Sized_relobj::local_got_offset): Likewise.
5228         (Sized_relobj::set_local_got_offset): Likewise.
5229         (Sized_relobj::do_for_all_local_got_entries): Likewise.
5230         (Sized_relobj::clear_got_offsets): New function.
5231         (Sized_relobj::section_offsets): Move here from child class.
5232         (Sized_relobj::do_output_section_offset): Likewise.
5233         (Sized_relobj::do_set_section_offset): Likewise.
5234         (Sized_relobj::Local_got_offsets): Likewise.
5235         (Sized_relobj::local_got_offsets_): Likewise.
5236         (Sized_relobj::section_offsets_): Likewise.
5237         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
5238         references.
5239         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
5240         class.
5241         (Sized_relobj_file::sized_relobj): New function
5242         (Sized_relobj_file::local_has_got_offset): Move to base class.
5243         (Sized_relobj_file::local_got_offset): Likewise.
5244         (Sized_relobj_file::set_local_got_offset): Likewise.
5245         (Sized_relobj_file::get_output_section_offset): Likewise.
5246         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
5247         (Sized_relobj_file::do_output_section_offset): Likewise.
5248         (Sized_relobj_file::do_set_section_offset): Likewise.
5249         (Sized_relobj_file::Local_got_offsets): Likewise.
5250         (Sized_relobj_file::local_got_offsets_): Likewise.
5251         (Sized_relobj_file::section_offsets_): Likewise.
5252         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
5253         (all constructors).
5254         (set_needs_dynsym_index): Convert relobj to derived class pointer.
5255         (Output_reloc::get_symbol_index): Likewise.
5256         (Output_reloc::local_section_offset): Likewise.
5257         (Output_reloc::get_address): Likewise.
5258         (Output_reloc::symbol_value): Likewise.
5259         (Output_data_got::reserve_slot): Move to class definition.
5260         (Output_data_got::reserve_local): New function.
5261         (Output_data_got::reserve_slot_for_global): Remove.
5262         (Output_data_got::reserve_global): New function.
5263         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
5264         (all constructors, two instantiations).
5265         (Output_reloc::get_relobj): New function (two instantiations).
5266         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
5267         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
5268         (Output_data_reloc::add_global): Adjust type of relobj.
5269         (Output_data_reloc::add_global_relative): Likewise.
5270         (Output_data_reloc::add_symbolless_global_addend): Likewise.
5271         (Output_data_reloc::add_local): Likewise.
5272         (Output_data_reloc::add_local_relative): Likewise.
5273         (Output_data_reloc::add_symbolless_local_addend): Likewise.
5274         (Output_data_reloc::add_local_section): Likewise.
5275         (Output_data_reloc::add_output_section): Likewise.
5276         (Output_data_reloc::add_absolute): Likewise.
5277         (Output_data_reloc::add_target_specific): Likewise.
5278         (Output_data_got::reserve_slot): Move definition here.
5279         (Output_data_got::reserve_local): New function.
5280         (Output_data_got::reserve_global): New function.
5281         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
5282         section_offsets_ with accessor function.
5283         (Sized_relobj_file::write_sections): Likewise.
5284         (Sized_relobj_file::do_relocate_sections): Likewise.
5285         * target.h (Sized_target::reserve_local_got_entry): New function.
5286         (Sized_target::reserve_global_got_entry): New function.
5287         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
5288         (Target_x86_64::reserve_global_got_entry): New function.
5289         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
5290
5291 2011-05-23 Cary Coutant  <ccoutant@google.com>
5292
5293         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
5294         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
5295         bit when checking got_type.
5296         * incremental.cc (Sized_incremental_binary::setup_readers):
5297         Store symbol table and string table locations; initialize bit vector
5298         of file status flags.
5299         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
5300         unchanged files.
5301         (Sized_incremental_binary::do_process_got_plt): New function.
5302         (Sized_incremental_binary::get_symtab_view): Use stored locations.
5303         (Output_section_incremental_inputs::set_final_data_size): Record
5304         file index for each input file.
5305         (Output_section_incremental_inputs::write_got_plt): Store file index
5306         instead of input entry offset for each GOT entry.
5307         * incremental.h
5308         (Incremental_input_entry::Incremental_input_entry): Initialize new
5309         data member.
5310         (Incremental_input_entry::set_offset): Store file index.
5311         (Incremental_input_entry::get_file_index): New function.
5312         (Incremental_input_entry::file_index_): New data member.
5313         (Incremental_binary::process_got_plt): New function.
5314         (Incremental_binary::do_process_got_plt): New function.
5315         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
5316         data members.
5317         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
5318         (Sized_incremental_binary::set_file_is_unchanged): New function.
5319         (Sized_incremental_binary::file_is_unchanged): New function.
5320         (Sized_incremental_binary::do_process_got_plt): New function.
5321         (Sized_incremental_binary::file_status_): New data member.
5322         (Sized_incremental_binary::main_symtab_loc_): New data member.
5323         (Sized_incremental_binary::main_strtab_loc_): New data member.
5324         * output.cc (Output_data_got::Got_entry::write): Add case
5325         RESERVED_CODE.
5326         (Output_data_got::add_global): Call add_got_entry.
5327         (Output_data_got::add_global_plt): Likewise.
5328         (Output_data_got::add_global_with_rel): Likewise.
5329         (Output_data_got::add_global_with_rela): Likewise.
5330         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
5331         (Output_data_got::add_global_pair_with_rela): Likewise.
5332         (Output_data_got::add_local): Call add_got_entry.
5333         (Output_data_got::add_local_plt): Likewise.
5334         (Output_data_got::add_local_with_rel): Likewise.
5335         (Output_data_got::add_local_with_rela): Likewise.
5336         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
5337         (Output_data_got::add_local_pair_with_rela): Likewise.
5338         (Output_data_got::reserve_slot): New function.
5339         (Output_data_got::reserve_slot_for_global): New function.
5340         (Output_data_got::add_got_entry): New function.
5341         (Output_data_got::add_got_entry_pair): New function.
5342         (Output_section::add_output_section_data): Edit FIXME.
5343         * output.h
5344         (Output_section_data_build::Output_section_data_build): New
5345         constructor with size parameter.
5346         (Output_data_space::Output_data_space): Likewise.
5347         (Output_data_got::Output_data_got): Initialize new data member; new
5348         constructor with size parameter.
5349         (Output_data_got::add_constant): Call add_got_entry.
5350         (Output_data_got::reserve_slot): New function.
5351         (Output_data_got::reserve_slot_for_global): New function.
5352         (class Output_data_got::Got_entry): Add RESERVED_CODE.
5353         (Output_data_got::add_got_entry): New function.
5354         (Output_data_got::add_got_entry_pair): New function.
5355         (Output_data_got::free_list_): New data member.
5356         * target.h (Sized_target::init_got_plt_for_update): New function.
5357         (Sized_target::register_global_plt_entry): New function.
5358         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
5359         Initialize new data member; call init; add constructor with PLT count.
5360         (Output_data_plt_x86_64::init): New function.
5361         (Output_data_plt_x86_64::add_relocation): New function.
5362         (Output_data_plt_x86_64::reserve_slot): New function.
5363         (Output_data_plt_x86_64::free_list_): New data member.
5364         (Target_x86_64::init_got_plt_for_update): New function.
5365         (Target_x86_64::register_global_plt_entry): New function.
5366         (Output_data_plt_x86_64::add_entry): Allocate from free list for
5367         incremental updates.
5368         (Output_data_plt_x86_64::add_relocation): New function.
5369         * testsuite/object_unittest.cc (Object_test): Set default options.
5370
5371 2011-05-16  Ian Lance Taylor  <iant@google.com>
5372
5373         * options.h (class General_options): Make -i a synonym for -r.
5374
5375 2011-05-16  Ian Lance Taylor  <iant@google.com>
5376
5377         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
5378
5379 2011-05-10 Cary Coutant  <ccoutant@google.com>
5380
5381         * object.cc (Sized_relobj::do_count_local_symbols): Check for
5382         strip_all (-s).
5383
5384 2011-05-06  Ian Lance Taylor  <iant@google.com>
5385
5386         * layout.cc (Layout::layout): If the output section flags change,
5387         update the ordering.
5388
5389 2011-04-25 Cary Coutant  <ccoutant@google.com>
5390
5391         * incremental-dump.cc (dump_incremental_inputs): Print local
5392         symbol info for each input file.
5393         * incremental.cc
5394         (Output_section_incremental_inputs::set_final_data_size): Add local
5395         symbol info to input file entries in incremental info.
5396         (Output_section_incremental_inputs::write_info_blocks): Likewise.
5397         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
5398         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
5399         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
5400         implementation.
5401         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
5402         (Sized_incr_relobj::do_relocate): Write the local symbols.
5403         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
5404         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
5405         Adjust size of input file header.
5406         (Incremental_inputs_reader::get_local_symbol_offset): New function.
5407         (Incremental_inputs_reader::get_local_symbol_count): New function.
5408         (Incremental_inputs_reader::get_input_section): Adjust size of input
5409         file header.
5410         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
5411         (Sized_incr_relobj::This): New typedef.
5412         (Sized_incr_relobj::sym_size): New const data member.
5413         (Sized_incr_relobj::Local_symbol): New struct.
5414         (Sized_incr_relobj::do_output_local_symbol_count): New function.
5415         (Sized_incr_relobj::do_local_symbol_offset): New function.
5416         (Sized_incr_relobj::local_symbol_count_): New data member.
5417         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
5418         (Sized_incr_relobj::local_symbol_index_): New data member.
5419         (Sized_incr_relobj::local_symbol_offset_): New data member.
5420         (Sized_incr_relobj::local_dynsym_offset_): New data member.
5421         (Sized_incr_relobj::local_symbols_): New data member.
5422         * object.h (Relobj::output_local_symbol_count): New function.
5423         (Relobj::local_symbol_offset): New function.
5424         (Relobj::do_output_local_symbol_count): New function.
5425         (Relobj::do_local_symbol_offset): New function.
5426         (Sized_relobj::do_output_local_symbol_count): New function.
5427         (Sized_relobj::do_local_symbol_offset): New function.
5428
5429 2011-04-22  Vladimir Simonov  <sv@sw.ru>
5430
5431         * descriptors.cc (set_close_on_exec): New function.
5432         (Descriptors::open): Use set_close_on_exec.
5433         * output.cc (S_ISLNK): Define if not defined.
5434
5435 2011-04-22 Cary Coutant  <ccoutant@google.com>
5436
5437         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
5438         global symbol map.
5439         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
5440         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
5441         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
5442         relocations.
5443         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
5444         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
5445         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
5446         * incremental.h
5447         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
5448         function.
5449         (Incremental_binary::apply_incremental_relocs): New function.
5450         (Incremental_binary::do_apply_incremental_relocs): New function.
5451         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
5452         data member.
5453         (Sized_incremental_binary::add_global_symbol): New function.
5454         (Sized_incremental_binary::global_symbol): New function.
5455         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
5456         (Sized_incremental_binary::symbol_map_): New data member.
5457         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
5458         * target.h (Sized_target::apply_relocation): New function.
5459         * target-reloc.h (apply_relocation): New function.
5460         * x86_64.cc (Target_x86_64::apply_relocation): New function.
5461
5462 2011-04-22  Doug Kwan  <dougkwan@google.com>
5463
5464         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
5465         flag of a SHT_ARM_EXIDX section.
5466         * testsuite/Makefile.am (arm_exidx_test): New test rules.
5467         * testsuite/Makefile.in: Regenerate.
5468         * testsuite/arm_exidx_test.s: New file.
5469         * testsuite/arm_exidx_test.sh: Same.
5470
5471 2011-04-20 Cary Coutant  <ccoutant@google.com>
5472
5473         PR gold/12689
5474         * archive.h (Incremental_archive_entry::Archive_member):
5475         Initialize arg_serial_ (second constructor).
5476
5477 2011-04-17  Ian Lance Taylor  <iant@google.com>
5478
5479         * object.cc (Relocate_info::location): Simplify location string.
5480         * errors.cc (Errors::error_at_location): Don't print program
5481         name.
5482         (Errors::warning_at_location): Likewise.
5483         (Errors::undefined_symbol): Likewise.
5484         * testsuite/debug_msg.sh: Update accordingly.
5485
5486 2011-04-14 Cary Coutant  <ccoutant@google.com>
5487
5488         * gold/layout.cc (Layout::symtab_section_offset): New function.
5489         * gold/layout.h (Layout::symtab_section_offset): New function.
5490         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
5491
5492 2011-04-12  Ian Lance Taylor  <iant@google.com>
5493
5494         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
5495         with MREMAP_MAYMOVE.
5496         * output.h (class Output_file): Add map_is_allocated_ field.
5497         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
5498         not available, provide stubs.  If mremap is not available, #define
5499         it to gold_mremap.
5500         (MREMAP_MAYMOVE): Define if not defined.
5501         (Output_file::Output_file): Initialize map_is_allocated_.
5502         (Output_file::resize): Check map_is_allocated_.
5503         (Output_file::map_anonymous): If mmap fails, use malloc.
5504         (Output_file::unmap): Don't do anything for an anonymous map.
5505         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
5506         is not available, provide stubs.
5507         (File_read::View::~View): Use free rather than delete[].
5508         (File_read::make_view): Use malloc rather than new[].  If mmap
5509         fails, use malloc.
5510         (File_read::find_or_make_view): Use malloc rather than new[].
5511         * gold.h: Remove HAVE_REMAP code.
5512         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
5513         exists.  Rename mremap to gold_mremap.  If mmap is not available
5514         don't do anything.
5515         * configure, config.in: Rebuild.
5516
5517 2011-04-11  Ian Lance Taylor  <iant@google.com>
5518
5519         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
5520         initialize local variable v.
5521
5522 2011-04-11  Cary Coutant  <ccoutant@google.com>
5523
5524         * archive.cc (Archive::include_member): Adjust call to
5525         report_object.
5526         (Add_archive_symbols::run): Track argument serial numbers.
5527         (Lib_group::include_member): Likewise.
5528         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
5529         * archive.h (Incremental_archive_entry::Archive_member):
5530         Initialize arg_serial_.
5531         (Archive_member::arg_serial_): New data member.
5532         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
5533         (Sized_dynobj::do_add_symbols): Track symbols when doing an
5534         incremental link.
5535         (Sized_dynobj::do_for_all_local_got_entries): New function.
5536         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
5537         function.
5538         * fileread.cc (get_mtime): New function.
5539         * fileread.h (get_mtime): New function.
5540         * gold.cc (queue_initial_tasks): Check for incremental update.
5541         (process_incremental_input): New function.
5542         (queue_middle_tasks): Don't force valid target for incremental
5543         update.
5544         * incremental-dump.cc (find_input_containing_global): Adjust
5545         size of symbol info entry.
5546         (dump_incremental_inputs): Dump argument serial number and
5547         in_system_directory flag; bias shndx by 1; print symbol names
5548         when dumping per-file symbol lists; use new symbol info readers.
5549         * incremental.cc
5550         (Output_section_incremental_inputs:update_data_size): New function.
5551         (Sized_incremental_binary::setup_readers): Setup input readers
5552         for each input file; build maps for files added from libraries
5553         and scripts.
5554         (Sized_incremental_binary::check_input_args): New function.
5555         (Sized_incremental_binary::do_check_inputs): Build map of argument
5556         serial numbers to input arguments.
5557         (Sized_incremental_binary::do_file_has_changed): Rename
5558         do_file_is_unchanged to this; compare file modification times.
5559         (Sized_incremental_binary::do_init_layout): New function.
5560         (Sized_incremental_binary::do_reserve_layout): New function.
5561         (Sized_incremental_binary::do_get_input_reader): Remove.
5562         (Sized_incremental_binary::get_symtab_view): New function.
5563         (Incremental_checker::can_incrementally_link_output_file): Remove.
5564         (Incremental_inputs::report_command_line): Exclude --debug options.
5565         (Incremental_inputs::report_archive_begin): Add parameter; track
5566         argument serial numbers; don't put input file entry for archive
5567         before archive members.
5568         (Incremental_inputs::report_archive_end): Put input file entry
5569         for archive after archive members.
5570         (Incremental_inputs::report_object): Add parameter; track argument
5571         serial numbers and in_system_directory flag.
5572         (Incremental_inputs::report_script): Add parameter; track argument
5573         serial numbers.
5574         (Output_section_incremental_inputs::set_final_data_size): Adjust
5575         size of symbol info entry; check for forwarding symbols.
5576         (Output_section_incremental_inputs::write_input_files): Write
5577         in_system_directory flag and argument serial number.
5578         (Output_section_incremental_inputs::write_info_blocks): Map section
5579         indices between incremental info and original input file; store
5580         input section index for each symbol.
5581         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
5582         change operator() to visit().
5583         (class Global_got_offset_visitor): Likewise.
5584         (class Global_symbol_visitor_got_plt):
5585         (Output_section_incremental_inputs::write_got_plt): Use new visitor
5586         classes.
5587         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
5588         (Sized_incr_relobj::do_read_symbols): New function.
5589         (Sized_incr_relobj::do_layout): New function.
5590         (Sized_incr_relobj::do_layout_deferred_sections): New function.
5591         (Sized_incr_relobj::do_add_symbols): New function.
5592         (Sized_incr_relobj::do_should_include_member): New function.
5593         (Sized_incr_relobj::do_for_all_global_symbols): New function.
5594         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
5595         (Sized_incr_relobj::do_section_size): New function.
5596         (Sized_incr_relobj::do_section_name): New function.
5597         (Sized_incr_relobj::do_section_contents): New function.
5598         (Sized_incr_relobj::do_section_flags): New function.
5599         (Sized_incr_relobj::do_section_entsize): New function.
5600         (Sized_incr_relobj::do_section_address): New function.
5601         (Sized_incr_relobj::do_section_type): New function.
5602         (Sized_incr_relobj::do_section_link): New function.
5603         (Sized_incr_relobj::do_section_info): New function.
5604         (Sized_incr_relobj::do_section_addralign): New function.
5605         (Sized_incr_relobj::do_initialize_xindex): New function.
5606         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
5607         (Sized_incr_relobj::do_read_relocs): New function.
5608         (Sized_incr_relobj::do_gc_process_relocs): New function.
5609         (Sized_incr_relobj::do_scan_relocs): New function.
5610         (Sized_incr_relobj::do_count_local_symbols): New function.
5611         (Sized_incr_relobj::do_finalize_local_symbols): New function.
5612         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
5613         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
5614         (Sized_incr_relobj::do_relocate): New function.
5615         (Sized_incr_relobj::do_set_section_offset): New function.
5616         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
5617         (Sized_incr_dynobj::do_read_symbols): New function.
5618         (Sized_incr_dynobj::do_layout): New function.
5619         (Sized_incr_dynobj::do_add_symbols): New function.
5620         (Sized_incr_dynobj::do_should_include_member): New function.
5621         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
5622         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
5623         (Sized_incr_dynobj::do_section_size): New function.
5624         (Sized_incr_dynobj::do_section_name): New function.
5625         (Sized_incr_dynobj::do_section_contents): New function.
5626         (Sized_incr_dynobj::do_section_flags): New function.
5627         (Sized_incr_dynobj::do_section_entsize): New function.
5628         (Sized_incr_dynobj::do_section_address): New function.
5629         (Sized_incr_dynobj::do_section_type): New function.
5630         (Sized_incr_dynobj::do_section_link): New function.
5631         (Sized_incr_dynobj::do_section_info): New function.
5632         (Sized_incr_dynobj::do_section_addralign): New function.
5633         (Sized_incr_dynobj::do_initialize_xindex): New function.
5634         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
5635         (make_sized_incremental_object): New function.
5636         (Incremental_library::copy_unused_symbols): New function.
5637         (Incremental_library::do_for_all_unused_symbols): New function.
5638         * incremental.h (enum Incremental_input_flags): New type.
5639         (class Incremental_checker): Remove.
5640         (Incremental_input_entry::Incremental_input_entry): Add argument
5641         serial number.
5642         (Incremental_input_entry::arg_serial): New function.
5643         (Incremental_input_entry::set_is_in_system_directory): New function.
5644         (Incremental_input_entry::is_in_system_directory): New function.
5645         (Incremental_input_entry::arg_serial_): New data member.
5646         (Incremental_input_entry::is_in_system_directory_): New data member.
5647         (class Script_info): Move here from script.h.
5648         (Script_info::Script_info): Add filename parameter.
5649         (Script_info::filename): New function.
5650         (Script_info::filename_): New data member.
5651         (Incremental_script_entry::Incremental_script_entry): Add argument
5652         serial number.
5653         (Incremental_object_entry::Incremental_object_entry): Likewise.
5654         (Incremental_object_entry::add_input_section): Build list of input
5655         sections with map to original shndx.
5656         (Incremental_object_entry::get_input_section_index): New function.
5657         (Incremental_object_entry::shndx_): New data member.
5658         (Incremental_object_entry::name_key_): Rename; adjust all refs.
5659         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
5660         (Incremental_archive_entry::Incremental_archive_entry): Add argument
5661         serial number.
5662         (Incremental_inputs::report_archive_begin): Likewise.
5663         (Incremental_inputs::report_object): Likewise.
5664         (Incremental_inputs::report_script): Likewise.
5665         (class Incremental_global_symbol_reader): New class.
5666         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
5667         and store flags and input file type.
5668         (Incremental_input_entry_reader::arg_serial): New function.
5669         (Incremental_input_entry_reader::type): Extract type from flags.
5670         (Incremental_input_entry_reader::is_in_system_directory): New function.
5671         (Incremental_input_entry_reader::get_input_section_count): Call
5672         accessor function for type.
5673         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
5674         function for type; adjust size of global symbol entry.
5675         (Incremental_input_entry_reader::get_global_symbol_count): Call
5676         accessor function for type.
5677         (Incremental_input_entry_reader::get_object_count): Likewise.
5678         (Incremental_input_entry_reader::get_object_offset): Likewise.
5679         (Incremental_input_entry_reader::get_member_count): Likewise.
5680         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
5681         (Incremental_input_entry_reader::get_member_offset): Likewise.
5682         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
5683         (Incremental_input_entry_reader::Global_symbol_info): Remove.
5684         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
5685         (Incremental_input_entry_reader::get_global_symbol_reader): New
5686         function.
5687         (Incremental_input_entry_reader::get_output_symbol_index): New
5688         function.
5689         (Incremental_input_entry_reader::type_): Remove.
5690         (Incremental_input_entry_reader::flags_): New data member.
5691         (Incremental_inputs_reader::input_file_offset): New function.
5692         (Incremental_inputs_reader::input_file_index): New function.
5693         (Incremental_inputs_reader::input_file): Call input_file_offset.
5694         (Incremental_inputs_reader::input_file_at_offset): New function.
5695         (Incremental_relocs_reader::get_r_type): Reformat.
5696         (Incremental_relocs_reader::get_r_shndx): Reformat.
5697         (Incremental_relocs_reader::get_r_offset): Reformat.
5698         (Incremental_relocs_reader::data): New function.
5699         (Incremental_binary::Incremental_binary): Initialize new data members.
5700         (Incremental_binary::check_inputs): Add cmdline parameter.
5701         (Incremental_binary::file_is_unchanged): Remove.
5702         (Input_reader::arg_serial): New function.
5703         (Input_reader::get_unused_symbol_count): New function.
5704         (Input_reader::get_unused_symbol): New function.
5705         (Input_reader::do_arg_serial): New function.
5706         (Input_reader::do_get_unused_symbol_count): New function.
5707         (Input_reader::do_get_unused_symbol): New function.
5708         (Incremental_binary::input_file_count): New function.
5709         (Incremental_binary::get_input_reader): Change signature to use
5710         index instead of filename.
5711         (Incremental_binary::file_has_changed): New function.
5712         (Incremental_binary::get_input_argument): New function.
5713         (Incremental_binary::get_library): New function.
5714         (Incremental_binary::get_script_info): New function.
5715         (Incremental_binary::init_layout): New function.
5716         (Incremental_binary::reserve_layout): New function.
5717         (Incremental_binary::output_file): New function.
5718         (Incremental_binary::do_check_inputs): New function.
5719         (Incremental_binary::do_file_is_unchanged): Remove.
5720         (Incremental_binary::do_file_has_changed): New function.
5721         (Incremental_binary::do_init_layout): New function.
5722         (Incremental_binary::do_reserve_layout): New function.
5723         (Incremental_binary::do_input_file_count): New function.
5724         (Incremental_binary::do_get_input_reader): Change signature.
5725         (Incremental_binary::input_args_map_): New data member.
5726         (Incremental_binary::library_map_): New data member.
5727         (Incremental_binary::script_map_): New data member.
5728         (Sized_incremental_binary::Sized_incremental_binary): Initialize
5729         new data members.
5730         (Sized_incremental_binary::output_section): New function.
5731         (Sized_incremental_binary::inputs_reader): Add const.
5732         (Sized_incremental_binary::symtab_reader): Add const.
5733         (Sized_incremental_binary::relocs_reader): Add const.
5734         (Sized_incremental_binary::got_plt_reader): Add const.
5735         (Sized_incremental_binary::get_symtab_view): New function.
5736         (Sized_incremental_binary::Inputs_reader): New typedef.
5737         (Sized_incremental_binary::Input_entry_reader): New typedef.
5738         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
5739         (Sized_incremental_binary::do_file_is_unchanged): Remove.
5740         (Sized_incremental_binary::do_file_has_changed): New function.
5741         (Sized_incremental_binary::do_init_layout): New function.
5742         (Sized_incremental_binary::do_reserve_layout): New function.
5743         (Sized_input_reader::Inputs_reader): Remove.
5744         (Sized_input_reader::Input_entry_reader): Remove.
5745         (Sized_input_reader::do_arg_serial): New function.
5746         (Sized_input_reader::do_get_unused_symbol_count): New function.
5747         (Sized_input_reader::do_get_unused_symbol): New function.
5748         (Sized_incremental_binary::do_input_file_count): New function.
5749         (Sized_incremental_binary::do_get_input_reader): Change signature;
5750         use index instead of filename.
5751         (Sized_incremental_binary::section_map_): New data member.
5752         (Sized_incremental_binary::input_entry_readers_): New data member.
5753         (class Sized_incr_relobj): New class.
5754         (class Sized_incr_dynobj): New class.
5755         (make_sized_incremental_object): New function.
5756         (class Incremental_library): New class.
5757         * layout.cc (Free_list::num_lists): New static data member.
5758         (Free_list::num_nodes): New static data member.
5759         (Free_list::num_removes): New static data member.
5760         (Free_list::num_remove_visits): New static data member.
5761         (Free_list::num_allocates): New static data member.
5762         (Free_list::num_allocate_visits): New static data member.
5763         (Free_list::init): New function.
5764         (Free_list::remove): New function.
5765         (Free_list::allocate): New function.
5766         (Free_list::dump): New function.
5767         (Free_list::print_stats): New function.
5768         (Layout_task_runner::run): Resize output file for incremental updates.
5769         (Layout::Layout): Initialize new data members.
5770         (Layout::set_incremental_base): New function.
5771         (Layout::init_fixed_output_section): New function.
5772         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
5773         incremental updates.
5774         (Layout::create_gold_note): Do not create gold note section for
5775         incremental updates.
5776         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
5777         for incremental updates.
5778         (Layout::set_section_offsets): For incremental updates, allocate space
5779         from free list.
5780         (Layout::create_symtab_sections): Layout with offsets relative to
5781         start of section; for incremental updates, allocate space from free
5782         list.
5783         (Layout::create_shdrs): For incremental updates, allocate space from
5784         free list.
5785         (Layout::finish_dynamic_section): For incremental updates, do not
5786         check --as-needed (fixed in subsequent patch).
5787         * layout.h (class Free_list): New class.
5788         (Layout::set_incremental_base): New function.
5789         (Layout::incremental_base): New function.
5790         (Layout::init_fixed_output_section): New function.
5791         (Layout::allocate): New function.
5792         (Layout::incremental_base_): New data member.
5793         (Layout::free_list_): New data member.
5794         * main.cc (main): Print Free_list statistics.
5795         * object.cc (Relobj::finalize_incremental_relocs): Add
5796         clear_counts parameter; clear counts only when clear_counts is set.
5797         (Sized_relobj::Sized_relobj): Initialize new base class.
5798         (Sized_relobj::do_layout): Don't report special sections.
5799         (Sized_relobj::do_for_all_local_got_entries): New function.
5800         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
5801         symtab_off to all symbol table offsets.
5802         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
5803         * object.h (class Got_offset_list): Move to top of file.
5804         (Object::Object): Allow case where input_file == NULL.
5805         (Object::~Object): Likewise.
5806         (Object::input_file): Assert that input_file != NULL.
5807         (Object::lock): Allow case where input_file == NULL.
5808         (Object::unlock): Likewise.
5809         (Object::is_locked): Likewise.
5810         (Object::token): Likewise.
5811         (Object::release): Likewise.
5812         (Object::is_incremental): New function.
5813         (Object::get_mtime): New function.
5814         (Object::for_all_local_got_entries): New function.
5815         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
5816         (Object::set_is_in_system_directory): New function.
5817         (Object::is_in_system_directory): New function.
5818         (Object::do_is_incremental): New function.
5819         (Object::do_get_mtime): New function.
5820         (Object::do_for_all_local_got_entries): New function.
5821         (Object::is_in_system_directory_): New data member.
5822         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
5823         (class Sized_relobj_base): New class.
5824         (class Sized_relobj): Derive from Sized_relobj_base.
5825         (class Sized_relobj::Symbols): Redeclare from base class.
5826         (class Sized_relobj::local_got_offset_list): Remove.
5827         (class Sized_relobj::Output_sections): Redeclare from base class.
5828         (class Sized_relobj::do_for_all_local_got_entries): New function.
5829         (class Sized_relobj::write_local_symbols): Add offset parameter.
5830         (class Sized_relobj::local_symbol_offset_): Update comment.
5831         (class Sized_relobj::local_dynsym_offset_): Update comment.
5832         * options.cc (Input_arguments::add_file): Remove const.
5833         * options.h (Input_file_argument::Input_file_argument):
5834         Initialize arg_serial_ (all constructors).
5835         (Input_file_argument::set_arg_serial): New function.
5836         (Input_file_argument::arg_serial): New function.
5837         (Input_file_argument::arg_serial_): New data member.
5838         (Input_arguments::Input_arguments): Initialize file_count_.
5839         (Input_arguments::add_file): Remove const.
5840         (Input_arguments::number_of_input_files): New function.
5841         (Input_arguments::file_count_): New data member.
5842         (Command_line::number_of_input_files): Call
5843         Input_arguments::number_of_input_files.
5844         * output.cc (Output_segment_headers::Output_segment_headers):
5845         Set current size.
5846         (Output_section::Input_section::current_data_size): New function.
5847         (Output_section::Output_section): Initialize new data members.
5848         (Output_section::add_input_section): Don't do merge sections for
5849         an incremental link; allocate space from free list for an
5850         incremental update.
5851         (Output_section::add_output_section_data): Allocate space from
5852         free list for an incremental update.
5853         (Output_section::update_data_size): New function.
5854         (Output_section::set_fixed_layout): New function.
5855         (Output_section::reserve): New function.
5856         (Output_segment::set_section_addresses): Remove const.
5857         (Output_segment::set_section_list_addresses): Remove const; allocate
5858         space from free list for an incremental update.
5859         (Output_segment::set_offset): Adjust size of RELRO segment for an
5860         incremental update.
5861         * output.h (Output_data::current_data_size): Move here from
5862         child classes.
5863         (Output_data::pre_finalize_data_size): New function.
5864         (Output_data::update_data_size): New function.
5865         (Output_section_headers::update_data_size): new function.
5866         (Output_section_data_build::current_data_size): Move to Output_data.
5867         (Output_data_strtab::update_data_size): New function.
5868         (Output_section::current_data_size): Move to Output_data.
5869         (Output_section::set_fixed_layout): New function.
5870         (Output_section::has_fixed_layout): New function.
5871         (Output_section::reserve): New function.
5872         (Output_section::update_data_size): New function.
5873         (Output_section::has_fixed_layout_): New data member.
5874         (Output_section::free_list_): New data member.
5875         (Output_segment::set_section_addresses): Remove const.
5876         (Output_segment::set_section_list_addresses): Remove const.
5877         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
5878         New function.
5879         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
5880         New function.
5881         * readsyms.cc (Read_symbols::do_read_symbols): Add library
5882         parameter when calling Add_symbols constructor; store argument
5883         serial number for members of a lib group.
5884         (Add_symbols::locks): Allow case where token == NULL.
5885         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
5886         (Read_member::~Read_member): New function.
5887         (Read_member::is_runnable): New function.
5888         (Read_member::locks): New function.
5889         (Read_member::run): New function.
5890         (Check_script::~Check_script): New function.
5891         (Check_script::is_runnable): New function.
5892         (Check_script::locks): New function.
5893         (Check_script::run): New function.
5894         (Check_library::~Check_library): New function.
5895         (Check_library::is_runnable): New function.
5896         (Check_library::locks): New function.
5897         (Check_library::run): New function.
5898         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
5899         (Add_symbols::library_): New data member.
5900         (class Read_member): New class.
5901         (class Check_script): New class.
5902         (class Check_library): New class.
5903         * reloc.cc (Read_relocs::is_runnable): Allow case where
5904         token == NULL.
5905         (Read_relocs::locks): Likewise.
5906         (Scan_relocs::locks): Likewise.
5907         (Relocate_task::locks): Likewise.
5908         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
5909         to clear counters.
5910         (Sized_relobj::incremental_relocs_scan): Fix comment.
5911         (Sized_relobj::do_relocate): Pass output file offset to
5912         write_local_symbols.
5913         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
5914         from class declaration.
5915         * script.cc (read_input_script): Allocate Script_info; pass
5916         argument serial number to report_script.
5917         * script.h (class Script_info): Move to incremental.h.
5918         * symtab.cc (Symbol_table::add_from_incrobj): New function.
5919         * symtab.h (Symbol_table::add_from_incrobj): New function.
5920         (Symbol_table::set_file_offset): New function.
5921
5922 2011-04-05  Cary Coutant  <ccoutant@google.com>
5923
5924         * incremental-dump.cc (dump_incremental_inputs): Change signature
5925         to take a Sized_incremental_binary; change caller.  Use readers
5926         in Sized_incremental_binary.
5927         * incremental.cc
5928         (Sized_incremental_binary::find_incremental_inputs_sections):
5929         Rename do_find_incremental_inputs_sections to this.
5930         (Sized_incremental_binary::setup_readers): New function.
5931         (Sized_incremental_binary::do_check_inputs): Check
5932         has_incremental_info_ flag; move setup code to setup_readers;
5933         use input readers.
5934         (Sized_incremental_binary::do_file_is_unchanged): New function.
5935         (Sized_incremental_binary::do_get_input_reader): New function.
5936         * incremental.h (class Incremental_binary): Move to end of file.
5937         (Incremental_binary::file_is_unchanged): New function.
5938         (Incremental_binary::do_file_is_unchanged): New function.
5939         (Incremental_binary::Input_reader): New class.
5940         (Incremental_binary::get_input_reader): New function.
5941         (class Sized_incremental_binary): Move to end of file.
5942         (Sized_incremental_binary::Sized_incremental_binary): Setup the
5943         input section reader classes.
5944         (Sized_incremental_binary::has_incremental_info): New function.
5945         (Sized_incremental_binary::inputs_reader): New function.
5946         (Sized_incremental_binary::symtab_reader): New function.
5947         (Sized_incremental_binary::relocs_reader): New function.
5948         (Sized_incremental_binary::got_plt_reader): New function.
5949         (Sized_incremental_binary::do_file_is_unchanged): New function.
5950         (Sized_incremental_binary::Sized_input_reader): New class.
5951         (Sized_incremental_binary::get_input_reader): New function.
5952         (Sized_incremental_binary::find_incremental_inputs_sections):
5953         Rename do_find_incremental_inputs_sections to this.
5954         (Sized_incremental_binary::setup_readers): New function.
5955         (Sized_incremental_binary::has_incremental_info_): New data member.
5956         (Sized_incremental_binary::inputs_reader_): New data member.
5957         (Sized_incremental_binary::symtab_reader_): New data member.
5958         (Sized_incremental_binary::relocs_reader_): New data member.
5959         (Sized_incremental_binary::got_plt_reader_): New data member.
5960         (Sized_incremental_binary::current_input_file_): New data member.
5961
5962 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
5963
5964         PR gold/12640
5965         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
5966         violation.
5967
5968 2011-03-30  Cary Coutant  <ccoutant@google.com>
5969
5970         * archive.cc (Archive::include_member): Adjust call to report_object.
5971         (Add_archive_symbols::run): Add script_info to call to
5972         report_archive_begin.
5973         (Lib_group::include_member): Adjust call to report_object.
5974         (Add_lib_group_symbols::run): Adjust call to report_object.
5975         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
5976         blocks.  Add object count for script input files.
5977         * incremental.cc (Incremental_inputs::report_archive_begin): Add
5978         script_info parameter; change all callers.
5979         (Incremental_inputs::report_object): Add script_info parameter;
5980         change all callers.
5981         (Incremental_inputs::report_script): Store backpointer to
5982         incremental info entry.
5983         (Output_section_incremental_inputs::set_final_data_size): Record
5984         additional information for scripts.
5985         (Output_section_incremental_inputs::write_info_blocks): Likewise.
5986         * incremental.h (Incremental_script_entry::add_object): New function.
5987         (Incremental_script_entry::get_object_count): New function.
5988         (Incremental_script_entry::get_object): New function.
5989         (Incremental_script_entry::objects_): New data member; adjust
5990         constructor.
5991         (Incremental_inputs::report_archive_begin): Add script_info parameter.
5992         (Incremental_inputs::report_object): Add script_info parameter.
5993         (Incremental_inputs_reader::get_object_count): New function.
5994         (Incremental_inputs_reader::get_object_offset): New function.
5995         * options.cc (Input_arguments::add_file): Return reference to
5996         new input argument.
5997         * options.h (Input_argument::set_script_info): New function.
5998         (Input_argument::script_info): New function.
5999         (Input_argument::script_info_): New data member; adjust all
6000         constructors.
6001         (Input_file_group::add_file): Return reference to new input argument.
6002         (Input_file_lib::add_file): Likewise.
6003         (Input_arguments::add_file): Likewise.
6004         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
6005         * script.cc (Parser_closure::Parser_closure): Add script_info
6006         parameter; adjust all callers.
6007         (Parser_closure::script_info): New function.
6008         (Parser_closure::script_info_): New data member.
6009         (read_input_script): Report scripts earlier to incremental info.
6010         (script_add_file): Set script_info in Input_argument.
6011         (script_add_library): Likewise.
6012         * script.h (Script_options::Script_info): Rewrite class.
6013
6014 2011-03-29  Cary Coutant  <ccoutant@google.com>
6015
6016         * archive.cc (Library_base::should_include_member): Move
6017         method here from class Archive.
6018         (Archive::Archive): Initialize base class.
6019         (Archive::should_include_member): Move to base class.
6020         (Archive::do_for_all_unused_symbols): New function.
6021         (Add_archive_symbols::run): Remove redundant access to
6022         incremental_inputs.
6023         (Lib_group::Lib_group): Initialize base class.
6024         (Lib_group::do_filename): New function.
6025         (Lib_group::include_member): Pass pointer to Lib_group to
6026         report_object.
6027         (Lib_group::do_for_all_unused_symbols): New function.
6028         (Add_lib_group_symbols::run): Report archive information for
6029         incremental links.
6030         * archive.h (class Library_base): New base class.
6031         (class Archive): Derive from Library_base.
6032         (Archive::filename): Move to base class.
6033         (Archive::set_incremental_info): Likewise.
6034         (Archive::incremental_info): Likewise.
6035         (Archive::Should_include): Likewise.
6036         (Archive::should_include_member): Likewise.
6037         (Archive::Armap_entry): Remove.
6038         (Archive::Unused_symbol_iterator): Remove.
6039         (Archive::unused_symbols_begin): Remove.
6040         (Archive::unused_symbols_end): Remove.
6041         (Archive::do_filename): New function.
6042         (Archive::do_get_mtime): New function.
6043         (Archive::do_for_all_unused_symbols): New function.
6044         (Archive::task_): Move to base class.
6045         (Archive::incremental_info_): Likewise.
6046         (class Lib_group): Derive from Library_base.
6047         (Lib_group::do_filename): New function.
6048         (Lib_group::do_get_mtime): New function.
6049         (Lib_group::do_for_all_unused_symbols): New function.
6050         (Lib_group::task_): Move to base class.
6051         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
6052         function.
6053         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
6054         function.
6055         * incremental.cc (Incremental_inputs::report_archive_begin):
6056         Use Library_base; call library's get_mtime; add incremental inputs
6057         entry before members.
6058         (class Unused_symbol_visitor): New class.
6059         (Incremental_inputs::report_archive_end): Use Library_base; use
6060         visitor class to record unused symbols; don't add incremental inputs
6061         entry after members.
6062         (Incremental_inputs::report_object): Use Library_base.
6063         * incremental.h
6064         (Incremental_archive_entry::Incremental_archive_entry): Remove
6065         unused Archive parameter.
6066         (Incremental_inputs::report_archive_begin): Use Library_base.
6067         (Incremental_inputs::report_archive_end): Likewise.
6068         (Incremental_inputs::report_object): Likewise.
6069         * object.cc (Sized_relobj::do_for_all_global_symbols): New
6070         function.
6071         * object.h (Object::for_all_global_symbols): New function.
6072         (Object::do_for_all_global_symbols): New function.
6073         (Sized_relobj::do_for_all_global_symbols): New function.
6074         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
6075         function.
6076         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
6077         function.
6078
6079 2011-03-27  Ian Lance Taylor  <iant@google.com>
6080
6081         * archive.cc (Archive::interpret_header): Return -1 if something
6082         goes wrong.  Change callers accordingly.
6083
6084 2011-03-25  Cary Coutant  <ccoutant@google.com>
6085
6086         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
6087         * testsuite/Makefile.in: Regenerate.
6088
6089 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
6090
6091         * plugin.cc (get_view): New.
6092         (Plugin::load): Pass get_view to the plugin.
6093         (Plugin_manager::get_view): New.
6094
6095 2011-03-21  Ian Lance Taylor  <iant@google.com>
6096
6097         * testsuite/final_layout.sh: Rewrite to not use dc.
6098         * testsuite/relro_test.sh: Fail if dc is not present.
6099
6100 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
6101
6102         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
6103         Change == to -eq.
6104         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
6105         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
6106         Change == to -eq.
6107         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
6108         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
6109
6110 2011-03-14  Ian Lance Taylor  <iant@google.com>
6111
6112         * script-sections.cc (Sort_output_sections::script_compare):
6113         Rename from is_before, change return type.
6114         (Sort_output_sections::operator()): Adjust accordingly.
6115
6116 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
6117
6118         PR gold/12572
6119         * testsuite/odr_violation2.cc: Add comment to make all error line
6120         numbers double digits.
6121         * testsuite/debug_msg.sh: Adjust expected errors.
6122
6123 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
6124
6125         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
6126         but mark earlier ones as non-canonical
6127         (offset_to_iterator): Update search target and example
6128         (do_addr2line): Return extra lines in a vector*
6129         (format_file_lineno): Extract from do_addr2line
6130         (one_addr2line): Add vector* out-param
6131         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
6132         when a lineno entry appeared last for its instruction
6133         (Dwarf_line_info): Add vector* out-param
6134         * object.cc (Relocate_info): Pass NULL for the vector* out-param
6135         * symtab.cc (Odr_violation_compare): Include the lineno in the
6136         comparison again.
6137         (linenos_from_loc): New. Combine the canonical line for an
6138         address with its other lines.
6139         (True_if_intersect): New. Helper functor to make
6140         std::set_intersection a query.
6141         (detect_odr_violations): Compare sets of lines instead of just
6142         one line for each function. This became less deterministic, but
6143         has fewer false positives.
6144         * symtab.h: Declarations.
6145         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
6146         mix an optimized and non-optimized object in the same binary
6147         (odr_violation2.so): Same.
6148         * testsuite/Makefile.in: Regenerate from Makefile.am.
6149         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
6150         * testsuite/debug_msg.sh: Update line numbers and add
6151         assertions.
6152         * testsuite/odr_violation1.cc: Use OdrDerived, in a
6153         non-optimized context.
6154         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
6155         isn't inlined, and use OdrDerived in an optimized context.
6156         * testsuite/odr_header1.h: Defines OdrDerived, where
6157         optimization will change the
6158         first-instruction-in-the-destructor's file and line number.
6159         * testsuite/odr_header2.h: Defines OdrBase.
6160
6161 2011-03-09  Ian Lance Taylor  <iant@google.com>
6162
6163         * fileread.cc (File_read::clear_views): Don't delete the whole
6164         file view.
6165
6166 2011-03-08  Ian Lance Taylor  <iant@google.com>
6167
6168         PR gold/12525
6169         * fileread.cc: #include <climits>.
6170         (GOLD_IOV_MAX): Define.
6171         (File_read::read_multiple): Limit number of entries by iov_max.
6172         * fileread.h (class File_read): Always set max_readv_entries to
6173         128.
6174
6175 2011-03-07  Ian Lance Taylor  <iant@google.com>
6176
6177         PR gold/12525
6178         * options.h (class General_options): Add -dy and -dn.
6179
6180 2011-03-02  Cary Coutant  <ccoutant@google.com>
6181
6182         * testsuite/script_test_9.t: Add TLS segment.
6183
6184 2011-03-02  Simon Baldwin  <simonb@google.com>
6185
6186         * configure.ac: Add check for gnu_indirect_function support in
6187         the toolchain building binutils.
6188         * configure: Rebuild.
6189
6190 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
6191
6192         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
6193         plugin only symbols.
6194         (Symbol_table::sized_finalize_symbol) Mark symbol only present
6195         in plugin files as not needed in the symbol table.
6196
6197 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
6198
6199         * output.cc (Output_section::add_input_section): Delay fill
6200         generation for section ordering.
6201
6202 2011-02-09  Ian Lance Taylor  <iant@google.com>
6203
6204         PR gold/12316
6205         * object.h (class Sized_relobj): Remove clear_local_symbols.
6206         * reloc.cc (Sized_relobj::do_relocate): Don't call
6207         clear_local_symbols.
6208
6209 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
6210
6211         * plugin.cc (is_visible_from_outside): Return true for symbols
6212         in the -u option.
6213
6214 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
6215
6216         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
6217         filename.
6218
6219 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
6220
6221         * icf.h (is_section_foldable_candidate): Change type of parameter
6222         to std::string.
6223         * icf.cc (Icf::find_identical_sections): Change type of local variable
6224         section_name to be std::string.
6225         (is_function_ctor_or_dtor): Change type of parameter to std::string.
6226
6227 2011-01-25  Ian Lance Taylor  <iant@google.com>
6228
6229         * script.cc (script_add_extern): Rewrite to use
6230         add_symbol_reference.
6231
6232 2011-01-25  Doug Kwan  <dougkwan@google.com>
6233
6234         * icf.cc (get_section_contents): Always lock section's object.
6235
6236 2011-01-24  Ian Lance Taylor  <iant@google.com>
6237
6238         * options.h (class General_options): Accept
6239         --no-detect-odr-violations.
6240
6241 2011-01-24  Ian Lance Taylor  <iant@google.com>
6242
6243         * version.cc (version_string): Bump to 1.11.
6244
6245 2011-01-24  Ian Lance Taylor  <iant@google.com>
6246
6247         * plugin.cc (class Plugin_rescan): Define new class.
6248         (Plugin_manager::claim_file): Set any_claimed_.
6249         (Plugin_manager::save_archive): New function.
6250         (Plugin_manager::save_input_group): New function.
6251         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
6252         necessary.
6253         (Plugin_manager::new_undefined_symbol): New function.
6254         (Plugin_manager::rescan): New function.
6255         (Plugin_manager::rescannable_defines): New function.
6256         (Plugin_manager::add_input_file): Set any_added_.
6257         * plugin.h (class Plugin_manager): define new fields rescannable_,
6258         undefined_symbols_, any_claimed_, and any_added_.  Declare
6259         Plugin_rescan as friend.  Declare new functions.
6260         (Plugin_manager::Rescannable): Define type.
6261         (Plugin_manager::Rescannable_list): Define type.
6262         (Plugin_manager::Undefined_symbol_list): Define type.
6263         (Plugin_manager::Plugin_manager): Initialize new fields.
6264         * archive.cc (Archive::defines_symbol): New function.
6265         (Add_archive_symbols::run): Pass archive to plugins if any.
6266         * archive.h (class Archive): Declare defines_symbol.
6267         * readsyms.cc (Input_group::~Input_group): New function.
6268         (Finish_group::run): Pass input_group to plugins if any.
6269         * readsyms.h (class Input_group): Declare destructor.
6270         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
6271         any.
6272
6273 2011-01-10  Ian Lance Taylor  <iant@google.com>
6274
6275         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
6276         section as relro.
6277         (Layout::set_segment_offsets): Reset increase_relro before calling
6278         set_section_addresses a second time.
6279
6280 2011-01-04  Cary Coutant  <ccoutant@google.com>
6281
6282         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
6283         sections before NOBITS sections.
6284
6285 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
6286
6287         * version.cc (print_version): Update copyright to 2011.
6288
6289 2010-12-23  Cary Coutant  <ccoutant@google.com>
6290
6291         * output.h (Output_data_reloc::add_output_section): Pass OD instead
6292         of OS to this->add.  Add OD parameter to second form of the function.
6293
6294 2010-12-20  Ian Lance Taylor  <iant@google.com>
6295
6296         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
6297         second of two consecutive entries with same offset.
6298
6299 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6300
6301         * testsuite/Makefile.am (ifuncmain2static_LDADD)
6302         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
6303         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
6304         to avoid unneeded links against $(LDADD).
6305         * testsuite/Makefile.in: Regenerate.
6306
6307 2010-12-15  Ian Lance Taylor  <iant@google.com>
6308
6309         PR gold/12324
6310         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
6311         for R_X86_64_32 and R_X86_64_PC32.
6312         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
6313         ver_matching_def_pic.o.
6314         (ver_matching_def_pic.o): New target.
6315
6316 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6317
6318         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
6319         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
6320         Move definition before File_read::View member definitions.
6321         (File_read::View::~View): Initialize and hold lock before
6322         updating current_mapped_bytes.
6323
6324 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6325
6326         * dwarf_reader.cc: Remove outdated comment.
6327         * gold-threads.cc: Fix typo in error message.
6328         * archive.cc: Fix typos in comments.
6329         * archive.h: Likewise.
6330         * arm-reloc-property.cc: Likewise.
6331         * arm-reloc-property.h: Likewise.
6332         * arm-reloc.def: Likewise.
6333         * arm.cc: Likewise.
6334         * attributes.h: Likewise.
6335         * cref.cc: Likewise.
6336         * ehframe.cc: Likewise.
6337         * fileread.h: Likewise.
6338         * gold.h: Likewise.
6339         * i386.cc: Likewise.
6340         * icf.cc: Likewise.
6341         * incremental.h: Likewise.
6342         * int_encoding.cc: Likewise.
6343         * layout.h: Likewise.
6344         * main.cc: Likewise.
6345         * merge.h: Likewise.
6346         * object.cc: Likewise.
6347         * object.h: Likewise.
6348         * options.cc: Likewise.
6349         * readsyms.cc: Likewise.
6350         * reduced_debug_output.cc: Likewise.
6351         * reloc.cc: Likewise.
6352         * script-sections.cc: Likewise.
6353         * sparc.cc: Likewise.
6354         * symtab.h: Likewise.
6355         * target-reloc.h: Likewise.
6356         * target.cc: Likewise.
6357         * target.h: Likewise.
6358         * timer.cc: Likewise.
6359         * timer.h: Likewise.
6360         * x86_64.cc: Likewise.
6361
6362 2010-12-09  Cary Coutant  <ccoutant@google.com>
6363
6364         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
6365         stack.
6366         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
6367         parameter; change all callers.
6368         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
6369         * options.h (warn_execstack): New option.
6370
6371 2010-12-07  Doug Kwan  <dougkwan@google.com>
6372
6373         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
6374         like function call relocations.
6375
6376 2010-12-07  Ian Lance Taylor  <iant@google.com>
6377
6378         * archive.cc (Archive::get_elf_object_for_member): Permit
6379         punconfigured to be NULL.
6380         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
6381         (Archive::include_member): Pass NULL to get_elf_object_for_member
6382         if we searched for the archive and this is the first included
6383         object.
6384
6385 2010-12-01  Ian Lance Taylor  <iant@google.com>
6386
6387         * dwarf_reader.h (class Sized_dwarf_line_info): Add
6388         track_relocs_type_ field.
6389         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
6390         Set track_relocs_type_.
6391         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
6392         contents when using RELA relocs.
6393         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
6394         reloc_map_.
6395         * reloc.cc (Track_relocs::next_addend): New function.
6396         * reloc.h (class Track_relocs): Declare next_addend.
6397
6398 2010-12-01  Ian Lance Taylor  <iant@google.com>
6399
6400         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
6401         virtual destructor.
6402
6403 2010-12-01  Ian Lance Taylor  <iant@google.com>
6404
6405         * README: Update compilers known to work and fail.
6406
6407 2010-11-23  Matthias Klose  <doko@ubuntu.com>
6408
6409         * configure.in: For --enable-gold, handle value `default' instead of
6410         `both*'.  Always install ld as ld.bfd, install as ld if gold is
6411         not the default.
6412         * configure: Regenerate.
6413
6414 2010-11-18  Doug Kwan  <dougkwan@google.com>
6415
6416         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
6417         and right_alignment to be zero.  Store result alignment only if it is
6418         greater than existing alignment.
6419
6420 2010-11-16  Cary Coutant  <ccoutant@google.com>
6421
6422         PR gold/12220
6423         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
6424         Check for ".zdebug_line".
6425
6426 2010-11-16  Doug Kwan  <dougkwan@google.com>
6427             Cary Coutant  <ccoutant@google.com>
6428
6429         * output.h (Output_segment::set_section_addresses): Pass increase_relro
6430         by reference; adjust all callers.
6431         * output.cc (Output_segment::set_section_addresses): Adjust references
6432         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
6433         list is empty.
6434         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
6435         end at page boundary.
6436
6437 2010-11-16  Cary Coutant  <ccoutant@google.com>
6438
6439         PR gold/12220
6440         * layout.cc (Layout::choose_output_section): Transform names of
6441         compressed sections even when using a script with a SECTIONS clause.
6442         (Layout::output_section_name): Remove code to transform
6443         compressed debug section names.
6444         * output.cc (Output_section::add_input_section): Use uncompressed
6445         section size when tracking input sections.
6446
6447 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
6448
6449         * symtab.h (Symbol::NON_PIC_REF): Remove.
6450         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
6451         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
6452         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
6453         (Symbol::use_plt_offset): Take a flags argument and pass it
6454         directly to needs_dynamic_reloc.  Restrict check for undefined
6455         weak symbols to function calls.
6456         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
6457         (Target_arm::Scan::global): Use it.
6458         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
6459         (Target_arm::Relocate::relocate): Likewise.
6460         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
6461         parameter with an r_type parameter.  Use get_reference_flags
6462         to get the flags.
6463         (Target_arm::Relocate::relocate): Update accordingly.
6464         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
6465         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
6466         (Target_i386::Scan::global): Likewise.
6467         (Target_i386::Relocate::relocate): Likewise.
6468         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
6469         parameter with an r_type parameter.  Use get_reference_flags
6470         to get the flags.
6471         (Target_i386::Relocate::relocate): Update accordingly.
6472         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
6473         (Target_powerpc::Scan::global): Use it.
6474         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
6475         (Target_powerpc::Relocate::relocate): Likewise.
6476         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
6477         (Target_sparc::Scan::global): Use it.
6478         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
6479         (Target_sparc::Relocate::relocate): Likewise.
6480         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
6481         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
6482         (Target_x86_64::Scan::global): Likewise.
6483         (Target_x86_64::Relocate::relocate): Likewise.
6484
6485 2010-11-08  Doug Kwan  <dougkwan@google.com>
6486             Cary Coutant  <ccoutant@google.com>
6487
6488         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
6489         (Arm_exidx_merge_section::section_contents_): New data member.
6490         (Arm_input_section::Arm_input_section): Initialize original_contents_.
6491         (Arm_input_section::~Arm_input_section): De-allocate memory.
6492         (Arm_input_section::original_contents_): New data member.
6493         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
6494         in parameters instead of calling Object::section_contents without
6495         locking.
6496         (Arm_output_section::group_section): New parameter TASK.  Pass it
6497         to callees that need locking objects.
6498         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
6499         to lock EXIDX input sections.  Fix a formatting issue.  Call
6500         Arm_exidx_merged_section::build_contents to create merged section
6501         contents.
6502         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
6503         to lock object of stub table owner.
6504         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
6505         TEXT_SIZE to initialize data member TEXT_SIZE_.
6506         (Arm_exidx_input_section::addralign): Fix typo in comment.
6507         (Arm_exidx_input_section::text_size): New method.
6508         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
6509         that require locking objects.  Lock objects before scanning for stubs
6510         and updating local symbols.
6511         (Arm_input_section<big_endian>::init): Copy contents of original
6512         input section.
6513         (Arm_input_section<big_endian>::do_write): Use saved contents of
6514         original input section instead of calling Object::section_contents
6515         without locking.
6516         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
6517         size without calling Object::section_size().
6518         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
6519         for size.  Allocate a buffer for merged EXIDX entries.
6520         (Arm_exidx_merged_section::build_contents): New method.
6521         (Arm_exidx_merged_section::do_write): Move merge section contents
6522         building code to Arm_exidx_merged_section::build_contetns.  Write
6523         out contetns in buffer instead of building it on the fly.
6524         (Arm_relobj::make_exidx_input_section): Also pass text section size
6525         to Arm_exidx_input_section constructor.
6526         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
6527         (Arm_dynobj::do_read_symbols): Fix memory leak.
6528         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
6529         * target.h: (class Task): Add forward declaration.
6530         (Target::relax): Add new parameter TASK and pass it to
6531         Target::do_relax().
6532         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
6533
6534 2010-11-05  Cary Coutant  <ccoutant@google.com>
6535
6536         PR gold/10708
6537         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
6538         object when reading from the file.
6539         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
6540         second layout pass.
6541         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
6542         when reading section contents.
6543         (get_section_contents): Likewise.
6544         (icf::find_identical_sections): Likewise.
6545         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
6546         object when reading from the file.
6547         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
6548         the object when doing deferred section layout.
6549
6550 2010-11-03  Nick Clifton  <nickc@redhat.com>
6551
6552         PR gold/12001
6553         * script.h (class Symbol_assignment: name): New member.  Returns
6554         the name of the symbol.
6555         * scrfipt.cc (Script_options::is_pending_assignment): New member.
6556         Returns true if the given symbol name is on the list of
6557         assignments wating to be processed.
6558         * archive.cc (should_incldue_member): If the symbol is undefined,
6559         check to see if it is on the list of symbols pending assignment.
6560
6561 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
6562
6563         * script-sections.cc (Script_sections::find_memory_region): Check
6564         for a NULL output section pointer.
6565
6566 2010-10-29  Doug Kwan  <dougkwan@google.com>
6567
6568         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
6569         Output_section::add_relaxed_input_section.
6570         * output.cc (Output_section::add_relaxed_input_section): Add new
6571         arguments LAYOUT and NAME.  Set section order index.
6572         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
6573         Copy section order index.
6574         * output.h (Output_section::add_relaxed_input_section): Add new
6575         arguments LAYOUT and NAME.
6576
6577 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6578
6579         * testsuite/Makefile.am: Move gcctestdir/ld rule to
6580         NATIVE_OR_CROSS_LINKER.
6581         * testsuite/Makefile.in: Regenerate.
6582
6583 2010-10-20  Doug Kwan  <dougkwan@google.com>
6584
6585         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
6586         without SHF_LINK_ORDER flags.
6587         * layout.cc (Layout::choose_output_section): Do not filter
6588         SHF_LINK_ORDER flag in a relocatable link.
6589
6590 2010-10-17  Cary Coutant  <ccoutant@google.com>
6591
6592         * output.h (Output_segment::set_section_addresses): Change function
6593         signature.  Update all callers.
6594         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
6595         sections.
6596         (Output_segment::set_section_addresses): Align after last TLS
6597         section.  Add padding before last relro section instead of after.
6598
6599 2010-10-17  Doug Kwan  <dougkwan@google.com>
6600
6601         * gold/arm.cc (Target_arm::got_section): Use correct order and set
6602         GOT output section to be writable.
6603
6604 2010-10-14  Cary Coutant  <ccoutant@google.com>
6605
6606         * debug.h (DEBUG_INCREMENTAL): New flag.
6607         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
6608         * gold.cc (queue_initial_tasks): Check parameters for incremental link
6609         mode.
6610         * incremental.cc (report_command_line): Ignore all forms of
6611         --incremental.
6612         * layout.cc (Layout::Layout): Check parameters for incremental link
6613         mode.
6614         * options.cc (General_options::parse_incremental): New function.
6615         (General_options::parse_no_incremental): New function.
6616         (General_options::parse_incremental_full): New function.
6617         (General_options::parse_incremental_update): New function.
6618         (General_options::incremental_mode_): New data member.
6619         (General_options::finalize): Check incremental_mode_.
6620         * options.h (General_options): Update help text for --incremental.
6621         Add --no-incremental, --incremental-full, --incremental-update.
6622         (General_options::Incremental_mode): New enum type.
6623         (General_options::incremental_mode): New function.
6624         (General_options::incremental_mode_): New data member.
6625         * parameters.cc (Parameters::incremental_mode_): New data member.
6626         (Parameters::set_options): Set incremental_mode_.
6627         (Parameters::set_incremental_full): New function.
6628         (Parameters::incremental): New function.
6629         (Parameters::incremental_update): New function.
6630         (set_parameters_incremental_full): New function.
6631         * parameters.h (Parameters::set_incremental_full): New function.
6632         (Parameters::incremental): New function.
6633         (Parameters::incremental_update): New function.
6634         (Parameters::incremental_mode_): New data member.
6635         (set_parameters_incremental_full): New function.
6636         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
6637         incremental link mode.
6638         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
6639         (Sized_relobj::do_relocate_sections): Likewise.
6640         * testsuite/Makefile.am (incremental_test): Use --incremental-full
6641         option.
6642         * testsuite/Makefile.in: Regenerate.
6643         * testsuite/incremental_test.sh: Filter all forms of --incremental.
6644
6645 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6646
6647         * script-sections.h (class Script_sections): Make
6648         Sections_elements typedef public.
6649         * script-sections.cc (class Sort_output_sections): Add elements_
6650         field.  Add constructor which sets it; change all callers.
6651         (Sort_output_sections::is_before): New function.
6652         (Sort_output_sections::operator()): Call is_before.
6653         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
6654         conditional.
6655         * testsuite/script_test_10.sh: New test. Test script section
6656         order.
6657         * testsuite/script_test_10.t: Likewise.
6658         * testsuite/script_test_10.s: Likewise.
6659         * testsuite/Makefile.am: Wrap the cross linker tests and the
6660         common tests into NATIVE_OR_CROSS_LINKER.
6661         (check_SCRIPTS): Add script_test_10.sh.
6662         (check_DATA): Add script_test_10.stdout.
6663         (script_test_10.o, script_test_10): New targets.
6664         (script_test_10.stdout): New target.
6665         * configure, testsuite/Makefile.in: Regenerate.
6666
6667 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6668
6669         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
6670         error for the deprecated relocations.
6671         (Target_arm::Scan::global): Likewise.
6672         (Target_arm::Relocate::relocate): Likewise.
6673
6674 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
6675
6676         * fileread.cc (Input_file::find_file): Initialize *found_name
6677         and *namep when using the fallback search for case 4.
6678
6679 2010-10-11  Cary Coutant  <ccoutant@google.com>
6680
6681         * options.h (class General_options): Redefine -z lazy as an alias for
6682         the negation of -z now.
6683
6684 2010-10-11  Ian Lance Taylor  <iant@google.com>
6685
6686         * resolve.cc (symbol_to_bits): Report the value of the unsupported
6687         binding.
6688
6689 2010-10-06  Nick Clifton  <nickc@redhat.com>
6690
6691         * script-sections.cc(class Memory_region): Remove
6692         current_lma_offset_ field.  Rename current_vma_offset_ to
6693         current_offset_.  Add last_section_ field.
6694         (Memory_region::get_current_vma_address): Rename to
6695         get_current_address.
6696         (Memory_region::get_current_lma_address): Delete.
6697         (Memory_region::increment_vma_offset): Rename to
6698         increment_offset.
6699         (Memory_region::increment_lma_offset): Delete.
6700         (Memory_region::attributes_compatible): New method.  Returns
6701         true if the provided section is compatible with the region.
6702         (Memory_region::get_last_section): New method.  Returns the last
6703         section to use the region.
6704         (Memory_region::set_last_section): New method.  Stores the last
6705         section to use the region.
6706         (Script_sections::block_in_region): New method.  Returns true if
6707         a block of memory is contained within a region.
6708         (Script_sections::find_memory_region): New method.  Locates a
6709         memory region to be used to set a VMA or LMA address.
6710         (Output_section_definition::set_section_addresses): Add code to
6711         check for addresses set by memory regions.
6712         (Output_segment::set_section_addresses): Remove memory region
6713         walking code.
6714         (Script_sections::create_segment): Add a warning if a header
6715         segment is created outside of any region.
6716         * script-sections.h (class Script_sections): Add prototypes for
6717         find_memory_region and block_in_region methods.
6718         * testsuite/memory_test.s: Use .long instead of .word.
6719         * testsuite/memory_test.t: Add some more output sections.
6720         * testsuite/memory_test.sh: Update expected output.
6721
6722 2010-10-02  Doug Kwan  <dougkwan@google.com>
6723
6724         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
6725         defintion to symtab.h
6726         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
6727         declaration to defintion.
6728
6729 2010-10-01  Nick Clifton  <nickc@redhat.com>
6730
6731         * expression.cc (eval): Replace dummy argument with NULL.
6732         (eval_maybe_dot): Check for a NULL result section pointer.
6733         (Symbol_expression::value): Likewise.
6734         (Dot_expression::value): Likewise.
6735         (BINARY_EXPRESSION): Likewise.
6736         (Max_expression::value): Likewise.
6737         (Min_expression::value): Likewise.
6738         (Absolute_expression::value): Likewise.
6739         (Addr_expression::value_from_output_section): Likewise.
6740         (Loaddddr_expression::value_from_output_section): Likewise.
6741         (Segment_start_expression::value): Likewise.
6742         * script-sections.cc
6743         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
6744         argument with NULL.
6745         (Sections_elememt_dot_assignment::set_section_addresses):
6746         Likewise.
6747         (Output_data_expression::do_write_to_buffer): Likewise.
6748         (Output_section_definition::finalize_symbols): Likewise.
6749         (Output_section_definition::set_section_addresses): Likewise.
6750
6751 2010-09-30  Doug Kwan  <dougkwan@google.com>
6752
6753         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
6754
6755 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
6756
6757         * target.h (Target::can_icf_inline_merge_sections): New virtual
6758         function.
6759         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
6760         virtual function.
6761         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
6762         virtual function.
6763         * icf.cc (get_section_contents): Inline merge sections only when
6764         target allows it.
6765
6766 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6767
6768         * configure: Regenerate.
6769
6770 2010-09-17  Ian Lance Taylor  <iant@google.com>
6771
6772         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
6773         * testsuite/Makefile.am (memory_test.o): New target.
6774         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
6775         memory_test.t.
6776         * testsuite/Makefile.in: Rebuild.
6777
6778 2010-09-17  Doug Kwan  <dougkwan@google.com>
6779
6780         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
6781         defintion if relocation uses GOT entries of the symbol.
6782         * testsuite/icf_safe_test.sh: Fix test.
6783         * testsuite/icf_safe_so_test.sh: Fix test.
6784
6785 2010-09-16  Cary Coutant  <ccoutant@google.com>
6786
6787         * script_sections.cc (class Memory_region): Remove "NULL" from
6788         vector initializations.
6789
6790 2010-09-15  Cary Coutant  <ccoutant@google.com>
6791
6792         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
6793         Resolve forwarding symbols.
6794
6795 2010-09-15  Doug Kwan  <dougkwan@google.com>
6796
6797         * gold/testsuite/script_test_3.t: Add ARM special sections.
6798         * gold/testsuite/script_test_4.t: Same.
6799         * gold/testsuite/script_test_5.t: Same.
6800         * gold/testsuite/script_test_6.t: Same.
6801         * gold/testsuite/script_test_7.t: Same.
6802         * gold/testsuite/script_test_7.t: Same.
6803         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
6804
6805 2010-09-14  Cary Coutant  <ccoutant@google.com>
6806
6807         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
6808         (Target_x86_64::Relocate::relocate_tls): Replace check for
6809         saw_tls_block_reloc_ with test for executable section.
6810
6811 2010-09-12  Cary Coutant  <ccoutant@google.com>
6812
6813         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
6814         position-independent executables to shared libraries need dynamic
6815         relocations.
6816         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
6817         position-independent executables.
6818         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
6819         * testsuite/Makefile.in: Regenerate.
6820
6821 2010-09-10  Nick Clifton  <nickc@redhat.com>
6822
6823         PR gold/11997
6824         * testsuite/memory_test.t: Discard any sections that are not
6825         needed.
6826
6827 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
6828
6829         PR gold/11996
6830         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
6831         "This::" to work around a bug in gcc 4.2.
6832
6833         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
6834
6835 2010-09-09  Rafael Espindola  <espindola@google.com>
6836
6837         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
6838         sections with different PF_X flags in the same segment.
6839         (Layout::find_first_load_seg): Search all segments to find the first
6840         one.
6841         * options.h (rosegment): New.
6842
6843 2010-09-08  Rafael Espindola  <espindola@google.com>
6844
6845         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
6846
6847 2010-09-08  Doug Kwan  <dougkwan@google.com>
6848
6849         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
6850         (Arm_relobj::do_relocate_sections): Add new parameter for output
6851         file to match the parent.
6852         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
6853         of local symbols instead of input values.  Update code to track
6854         changes in gold::relocate_section.
6855         * object.cc (Sized_relobj::compute_final_local_value): New methods.
6856         (Sized_relobj::compute_final_local_value_internal): New methods.
6857         (Sized_relobj::do_finalize_local_symbols): Move code from loop
6858         body into private version of Sized_relobj::compute_final_local_value.
6859         Call the inline method.
6860         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
6861         merged symbol value if there is one.
6862         (Symbol_value::has_output_value): New method defintiion.
6863         (Sized_relobj::Compute_final_local_value_status): New enum type.
6864         (Sized_relobj::compute_final_local_value): New methods.
6865         (Sized_relobj::compute_final_local_value_internal): New methods.
6866         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
6867         and arm_cortex_a8.sh.
6868         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
6869         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
6870         New tests.
6871         * Makefile.in: Regenerate.
6872         * testsuite/arm_bl_out_of_range.s: Update test.
6873         * testsuite/thumb_bl_out_of_range.s: Ditto.
6874         * testsuite/thumb_blx_out_of_range.s: Ditto.
6875         * testsuite/arm_branch_out_of_range.sh: New file.
6876         * testsuite/arm_cortex_a8.sh: Ditto.
6877         * testsuite/arm_cortex_a8_b.s: Ditto.
6878         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
6879         * testsuite/arm_cortex_a8_b_local.s: Ditto.
6880         * testsuite/arm_cortex_a8_bl.s: Ditto.
6881         * testsuite/arm_cortex_a8_blx.s: Ditto.
6882         * testsuite/arm_cortex_a8_local.s: Ditto.
6883         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
6884         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
6885
6886 2010-09-08  Rafael Espindola  <espindola@google.com>
6887
6888         * Makefile.am (memory_test.stdout): Run readelf with -W.
6889         * Makefile.in: Regenerate.
6890         * testsuite/memory_test.sh: Make the regexps accept both 32 and
6891         64 bit output.
6892
6893 2010-09-08  Rafael Espindola  <espindola@google.com>
6894
6895         * script-sections.cc (Script_sections::add_memory_region): Convert
6896         field precision to int.
6897         * script.cc (script_set_section_region, script_set_section_region):
6898         Convert field precision to int.
6899
6900 2010-09-08  Rafael Espindola  <espindola@google.com>
6901
6902         * arm.cc (do_finalize_sections): Create the __exidx_start and
6903         __exdix_end symbols even when the section is missing.
6904
6905 2010-09-08  Nick Clifton  <nickc@redhat.com>
6906
6907         * README: Remove claim that MEMORY is not supported.
6908         * expression.cc (script_exp_function_origin)
6909         (script_exp_function_length): Move from here to ...
6910         * script.cc: ... here.
6911         (script_set_section_region, script_add_memory)
6912         (script_parse_memory_attr, script_include_directive): New
6913         functions.
6914         * script-sections.cc
6915         (class Memory_region): New class.
6916         (class Output_section_definition): Add set_memory_region,
6917         set_section_vma, set_section_lma and get_section_name methods.
6918         (class Script_Sections): Add add_memory_region,
6919         find_memory_region, find_memory_region_origin,
6920         find_memory_region_length and set_memory_region methods.
6921         Have set_section_addresses method walk the list of set memory
6922         regions.
6923         Extend the print methos to display memory regions.
6924         * script-sections.h: Add prototypes for new methods.
6925         Add enum for MEMORY region attributes.
6926         * yyscript.y: Add support for parsing MEMORY regions.
6927         * script-c.h: Add prototypes for new functions.
6928         * testsuite/Makefile.am: Add test of MEMORY region functionality.
6929         * testsuite/Makefile.in: Regenerate.
6930         * testsuite/memory_test.sh: New script.
6931         * testsuite/memory_test.s: New assembler source file.
6932         * testsuite/memory_test.t: New linker script.
6933
6934 2010-08-27  Doug Kwan  <dougkwan@google.com>
6935
6936         * gold/resolve.cc (Symbol_table::should_override): Let a weak
6937         reference override an existing dynamic weak reference.
6938         * testsuite/Makefile.am: Add new test dyn_weak_ref.
6939         * testsuite/Makefile.in: Regenerate.
6940         * testsuite/dyn_weak_ref.sh: New file.
6941         * testsuite/dyn_weak_ref_1.c: Ditto.
6942         * testsuite/dyn_weak_ref_2.c: Ditto.
6943
6944 2010-08-27  Ian Lance Taylor  <iant@google.com>
6945
6946         * incremental.h (class Incremental_input_entry): Add virtual
6947         destructor.
6948
6949 2010-08-27  Ian Lance Taylor  <iant@google.com>
6950
6951         * testsuite/start_lib_test_3.c: Mark t3 as used.
6952
6953 2010-08-27  Nick Clifton  <nickc@redhat.com>
6954
6955         * options.cc (version_script): Fix small typo in previous
6956         whitespace tidyup.
6957
6958 2010-08-25  Nick Clifton  <nickc@redhat.com>
6959
6960         * archive.cc: Formatting fixes: Remove whitespace between
6961         typename and following asterisk.  Remove whitespace between
6962         function name and opening parenthesis.
6963         * archive.h: Likewise.
6964         * arm.cc: Likewise.
6965         * attributes.cc: Likewise.
6966         * attributes.h: Likewise.
6967         * common.cc: Likewise.
6968         * copy-relocs.cc: Likewise.
6969         * dirsearch.h: Likewise.
6970         * dynobj.cc: Likewise.
6971         * ehframe.cc: Likewise.
6972         * ehframe.h: Likewise.
6973         * expression.cc: Likewise.
6974         * fileread.cc: Likewise.
6975         * fileread.h: Likewise.
6976         * gc.h: Likewise.
6977         * gold-threads.cc: Likewise.
6978         * gold.cc: Likewise.
6979         * i386.cc: Likewise.
6980         * icf.h: Likewise.
6981         * incremental-dump.cc: Likewise.
6982         * incremental.cc: Likewise.
6983         * layout.cc: Likewise.
6984         * layout.h: Likewise.
6985         * main.cc: Likewise.
6986         * merge.cc: Likewise.
6987         * merge.h: Likewise.
6988         * object.cc: Likewise.
6989         * object.h: Likewise.
6990         * options.cc: Likewise.
6991         * options.h: Likewise.
6992         * output.cc: Likewise.
6993         * output.h: Likewise.
6994         * plugin.cc: Likewise.
6995         * plugin.h: Likewise.
6996         * powerpc.cc: Likewise.
6997         * reloc.cc: Likewise.
6998         * script-c.h: Likewise.
6999         * script-sections.cc: Likewise.
7000         * script.cc: Likewise.
7001         * stringpool.cc: Likewise.
7002         * symtab.cc: Likewise.
7003         * symtab.h: Likewise.
7004         * target.cc: Likewise.
7005         * timer.cc: Likewise.
7006         * timer.h: Likewise.
7007         * version.cc: Likewise.
7008         * x86_64.cc: Likewise.
7009
7010 2010-08-24  Nick Clifton  <nickc@redhat.com>
7011
7012         PR 11899
7013         * layout.cc (segment_precedes): Sort segments by their physical
7014         addresses, if they have been set.
7015
7016 2010-08-23  Cary Coutant  <ccoutant@google.com>
7017
7018         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
7019         symbols data.
7020         (Lib_group::include_member): Unlock object after deleting its
7021         symbols data.
7022         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
7023         the bug fixed here.
7024
7025 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
7026             Cary Coutant  <ccoutant@google.com>
7027
7028         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
7029         constructor, and set_blocker.
7030         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
7031         readsyms_blocker_.
7032         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
7033         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
7034         * testsuite/Makefile.am (start_lib_test): New test case.
7035         * testsuite/Makefile.in: Regenerate.
7036         * testsuite/start_lib_test_main.c: New file.
7037         * testsuite/start_lib_test_1.c: New file.
7038         * testsuite/start_lib_test_2.c: New file.
7039         * testsuite/start_lib_test_3.c: New file.
7040
7041 2010-08-19  Ian Lance Taylor  <iant@google.com>
7042
7043         * Makefile.in: Rebuild with automake 1.11.1.
7044         * aclocal.m4: Likewise.
7045         * testsuite/Makefile.in: Likewise.
7046
7047 2010-08-19  Ian Lance Taylor  <iant@google.com>
7048
7049         PR 10893
7050         * i386.cc (class Output_data_plt_i386): Update declarations.
7051         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
7052         local_ifuncs_ fields.
7053         (Target_i386::do_plt_section_for_global): New function.
7054         (Target_i386::do_plt_section_for_local): New function.
7055         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
7056         parameter; change all callers.  Initialize global_ifuncs_ and
7057         local_ifuncs_.  If doing a static link define __rel_iplt_start and
7058         __rel_iplt_end.
7059         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
7060         (Output_data_plt_i386::add_local_ifunc_entry): New function.
7061         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
7062         symbols.
7063         (Target_i386::make_plt_section): New function, broken out of
7064         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
7065         (Target_i386::make_plt_entry): Call make_plt_section.
7066         (Target_i386::make_local_ifunc_plt_entry): New function.
7067         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
7068         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
7069         R_386_IRELATIVE to switch.
7070         (Target_i386::Scan::global): Likewise.
7071         (Target_i386::Relocate::relocate): Likewise.
7072         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
7073         switch.
7074         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
7075         (Target_x86_64::do_plt_section_for_global): New function.
7076         (Target_x86_64::do_plt_section_for_local): New function.
7077         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
7078         parameter; change all callers.  If doing a static link define
7079         __rela_iplt_start and __rela_iplt_end.
7080         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
7081         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
7082         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
7083         to point to .plt.
7084         (Target_x86_64::make_local_ifunc_plt_entry): New function.
7085         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
7086         switch.
7087         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
7088         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
7089         R_X86_64_IRELATIVE to switch.
7090         (Target_x86_64::Scan::global): Likewise.
7091         (Target_x86_64::Relocate::relocate): Likewise.
7092         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
7093         switch.
7094         * target.h (class Target): Add plt_section_for_global and
7095         plt_section_for_local functions.  Add do_plt_section_for_global
7096         and do_plt_section_for_local virtual functions.
7097         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
7098         clarifying comments.
7099         (Symbol::use_plt_offset): Handle IFUNC symbol.
7100         * object.cc (Sized_relobj::Sized_relobj): Initialize
7101         local_plt_offsets_.
7102         (Sized_relobj::local_has_plt_offset): New function.
7103         (Sized_relobj::local_plt_offset): New function.
7104         (Sized_relobj::set_local_plt_offset): New function.
7105         (Sized_relobj::do_count): Handle IFUNC symbol.
7106         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
7107         a bit away from input_shndx_ field.  Add set_is_func_symbol and
7108         is_ifunc_symbol functions.
7109         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
7110         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
7111         local_plt_offsets_ field.
7112         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
7113         * output.h (class Output_section_data): Add non-const
7114         output_section function.
7115         (class Output_data_got): Update declarations.
7116         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
7117         Add use_plt_offset parameter to global and local constructors.
7118         Change all callers.  Change local_sym_index_ field to 31 bits.
7119         Change GSYM_CODE and CONSTANT_CODE accordingly.
7120         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
7121         doing a static link don't set sh_link field.
7122         (Output_data_got::Got_entry::write): Use PLT offset if
7123         appropriate.
7124         (Output_data_got::add_global_plt): New function.
7125         (Output_data_got::add_local_plt): New function.
7126         * target-reloc.h (relocate_section): Handle IFUNC symbol.
7127         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
7128         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
7129         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
7130         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
7131         IFUNC conditional.
7132         * testsuite/ifunc-sel.h: New file.
7133         * testsuite/ifuncmain1.c: New file.
7134         * testsuite/ifuncmain1vis.c: New file.
7135         * testsuite/ifuncmod1.c: New file.
7136         * testsuite/ifuncdep2.c: New file.
7137         * testsuite/ifuncmain2.c: New file.
7138         * testsuite/ifuncmain3.c: New file.
7139         * testsuite/ifuncmod3.c: New file.
7140         * testsuite/ifuncmain4.c: New file.
7141         * testsuite/ifuncmain5.c: New file.
7142         * testsuite/ifuncmod5.c: New file.
7143         * testsuite/ifuncmain6pie.c: New file.
7144         * testsuite/ifuncmod6.c: New file.
7145         * testsuite/ifuncmain7.c: New file.
7146         * configure, testsuite/Makefile.in: Rebuild.
7147
7148 2010-08-18  Ian Lance Taylor  <iant@google.com>
7149
7150         * incremental.cc
7151         (Output_section_incremental_inputs::write_input_files): Add cast
7152         to avoid signed/unsigned comparison warning.
7153         (Output_section_incremental_inputs::write_info_blocks): Likewise.
7154
7155 2010-08-12  Cary Coutant  <ccoutant@google.com>
7156
7157         * common.cc (Sort_commons::operator()): Remove unnecessary code.
7158
7159 2010-08-13  Ian Lance Taylor  <iant@google.com>
7160
7161         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
7162
7163 2010-08-12  Cary Coutant  <ccoutant@google.com>
7164             Doug Kwan  <dougkwan@google.com>
7165
7166         * resolve.cc (Symbol_table::should_override): When a weak dynamic
7167         defintion overrides non-weak undef, remember that the original undef
7168         is not weak.
7169         * symtab.cc (Symbol_table::sized_write_global): For undef without
7170         an original weak binding, set binding to global in output.
7171         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
7172         * testsuite/Makefile.in: Regenerate.
7173         * testsuite/strong_ref_weak_def.sh: New file.
7174         * testsuite/strong_ref_weak_def_1.c: Ditto.
7175         * testsuite/strong_ref_weak_def_2.c: Ditto.
7176
7177 2010-08-12  Cary Coutant  <ccoutant@google.com>
7178
7179         * testsuite/incremental_test.sh: Rewrite.
7180         * testsuite/incremental_test_1.c: Rewrite.
7181         * testsuite/incremental_test_2.c: Rewrite.
7182
7183 2010-08-12  Cary Coutant  <ccoutant@google.com>
7184
7185         * arm.cc (Target_arm::got_size): Add const.
7186         (Target_arm::got_entry_count): New function.
7187         (Target_arm::plt_entry_count): New function.
7188         (Target_arm::first_plt_entry_offset): New function.
7189         (Target_arm::plt_entry_size): New function.
7190         (Output_data_plt_arm::entry_count): New function.
7191         (Output_data_plt_arm::first_plt_entry_offset): New function.
7192         (Output_data_plt_arm::get_plt_entry_size): New function.
7193         * i386.cc (Target_i386::got_size): Add const.
7194         (Target_i386::got_entry_count): New function.
7195         (Target_i386::plt_entry_count): New function.
7196         (Target_i386::first_plt_entry_offset): New function.
7197         (Target_i386::plt_entry_size): New function.
7198         (Output_data_plt_i386::entry_count): New function.
7199         (Output_data_plt_i386::first_plt_entry_offset): New function.
7200         (Output_data_plt_i386::get_plt_entry_size): New function.
7201         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
7202         find_incremental_inputs_sections.  Dump incremental_got_plt section.
7203         * incremental.cc: Include target.h.
7204         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
7205         parameter.  Adjust all callers.  Find incremental_got_plt section.
7206         (Incremental_inputs::create_data_sections): Create incremental_got_plt
7207         section.
7208         (Output_section_incremental_inputs::set_final_data_size): Calculate
7209         size of incremental_got_plt section.
7210         (Output_section_incremental_inputs::do_write): Write the
7211         incremental_got_plt section.
7212         (Got_plt_view_info): New struct.
7213         (Local_got_offset_visitor): New class.
7214         (Global_got_offset_visitor): New class.
7215         (Global_symbol_visitor_got_plt): New class.
7216         (Output_section_incremental_inputs::write_got_plt): New function.
7217         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
7218         Add parameter.  Adjust all callers.
7219         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
7220         (Incremental_inputs::got_plt_section): New function.
7221         (Incremental_inputs::got_plt_section_): New data member.
7222         (Incremental_got_plt_reader): New class.
7223         * layout.cc (Layout::create_incremental_info_sections): Add the
7224         incremental_got_plt section.
7225         * object.h (Got_offset_list::get_list): New function.
7226         (Got offset_list::for_all_got_offsets): New function.
7227         (Sized_relobj::local_got_offset_list): New function.
7228         * powerpc.cc (Target_powerpc::got_size): Add const.
7229         (Target_powerpc::got_entry_count): New function.
7230         (Target_powerpc::plt_entry_count): New function.
7231         (Target_powerpc::first_plt_entry_offset): New function.
7232         (Target_powerpc::plt_entry_size): New function.
7233         (Output_data_plt_powerpc::entry_count): New function.
7234         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
7235         (Output_data_plt_powerpc::get_plt_entry_size): New function.
7236         * sparc.cc (Target_sparc::got_size): Add const.
7237         (Target_sparc::got_entry_count): New function.
7238         (Target_sparc::plt_entry_count): New function.
7239         (Target_sparc::first_plt_entry_offset): New function.
7240         (Target_sparc::plt_entry_size): New function.
7241         (Output_data_plt_sparc::entry_count): New function.
7242         (Output_data_plt_sparc::first_plt_entry_offset): New function.
7243         (Output_data_plt_sparc::get_plt_entry_size): New function.
7244         * symtab.h (Symbol::got_offset_list): New function.
7245         (Symbol_table::for_all_symbols): New function.
7246         * target.h (Sized_target::got_entry_count): New function.
7247         (Sized_target::plt_entry_count): New function.
7248         (Sized_target::plt_entry_size): New function.
7249         * x86_64.cc (Target_x86_64::got_size): Add const.
7250         (Target_x86_64::got_entry_count): New function.
7251         (Target_x86_64::plt_entry_count): New function.
7252         (Target_x86_64::first_plt_entry_offset): New function.
7253         (Target_x86_64::plt_entry_size): New function.
7254         (Output_data_plt_x86_64::entry_count): New function.
7255         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
7256         (Output_data_plt_x86_64::get_plt_entry_size): New function.
7257
7258 2010-08-12  Cary Coutant  <ccoutant@google.com>
7259
7260         * archive.cc: Include incremental.h.
7261         (Archive::Archive): Initialize incremental_info_.
7262         (Archive::include_member): Record archive members in incremental info.
7263         (Add_archive_symbols::run): Record begin and end of an archive in
7264         incremental info.
7265         (Lib_group::include_member): Record objects in incremental info.
7266         * archive.h (Incremental_archive_entry): Forward declaration.
7267         (Archive::set_incremental_info): New member function.
7268         (Archive::incremental_info): New member function.
7269         (Archive::Unused_symbol_iterator): New class.
7270         (Archive::unused_symbols_begin): New member function.
7271         (Archive::unused_symbols_end): New member function.
7272         (Archive::incremental_info_): New data member.
7273         * incremental-dump.cc (find_input_containing_global): New function.
7274         (dump_incremental_inputs): Dump new incremental info sections.
7275         * incremental.cc: Include symtab.h.
7276         (Output_section_incremental_inputs): New class.
7277         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
7278         new incremental info sections.
7279         (Sized_incremental_binary::do_check_inputs): Likewise.
7280         (Incremental_inputs::report_archive): Remove.
7281         (Incremental_inputs::report_archive_begin): New function.
7282         (Incremental_inputs::report_archive_end): New function.
7283         (Incremental_inputs::report_object): New function.
7284         (Incremental_inputs::finalize_inputs): Remove.
7285         (Incremental_inputs::report_input_section): New function.
7286         (Incremental_inputs::report_script): Rewrite.
7287         (Incremental_inputs::finalize): Do nothing but finalize string table.
7288         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
7289         (Incremental_inputs::sized_create_inputs_section_data): Remove.
7290         (Incremental_inputs::create_data_sections): New function.
7291         (Incremental_inputs::relocs_entsize): New function.
7292         (Output_section_incremental_inputs::set_final_data_size): New function.
7293         (Output_section_incremental_inputs::do_write): New function.
7294         (Output_section_incremental_inputs::write_header): New function.
7295         (Output_section_incremental_inputs::write_input_files): New function.
7296         (Output_section_incremental_inputs::write_info_blocks): New function.
7297         (Output_section_incremental_inputs::write_symtab): New function.
7298         * incremental.h (Incremental_script_entry): Forward declaration.
7299         (Incremental_object_entry): Forward declaration.
7300         (Incremental_archive_entry): Forward declaration.
7301         (Incremental_inputs): Forward declaration.
7302         (Incremental_inputs_header_data): Remove.
7303         (Incremental_inputs_header): Remove.
7304         (Incremental_inputs_header_write): Remove.
7305         (Incremental_inputs_entry_data): Remove.
7306         (Incremental_inputs_entry): Remove.
7307         (Incremental_inputs_entry_write): Remove.
7308         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
7309         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
7310         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
7311         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
7312         Likewise.
7313         (Incremental_input_entry): New class.
7314         (Incremental_script_entry): New class.
7315         (Incremental_object_entry): New class.
7316         (Incremental_archive_entry): New class.
7317         (Incremental_inputs::Incremental_inputs): Initialize new data members.
7318         (Incremental_inputs::report_inputs): Remove.
7319         (Incremental_inputs::report_archive): Remove.
7320         (Incremental_inputs::report_archive_begin): New function.
7321         (Incremental_inputs::report_archive_end): New function.
7322         (Incremental_inputs::report_object): Change prototype.
7323         (Incremental_inputs::report_input_section): New function.
7324         (Incremental_inputs::report_script): Change prototype.
7325         (Incremental_inputs::get_reloc_count): New function.
7326         (Incremental_inputs::set_reloc_count): New function.
7327         (Incremental_inputs::create_data_sections): New function.
7328         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
7329         (Incremental_inputs::inputs_section): New function.
7330         (Incremental_inputs::symtab_section): New function.
7331         (Incremental_inputs::relocs_section): New function.
7332         (Incremental_inputs::get_stringpool): Add const.
7333         (Incremental_inputs::command_line): Add const.
7334         (Incremental_inputs::inputs): Remove.
7335         (Incremental_inputs::command_line_key): New function.
7336         (Incremental_inputs::input_file_count): New function.
7337         (Incremental_inputs::input_files): New function.
7338         (Incremental_inputs::relocs_entsize): New function.
7339         (Incremental_inputs::sized_create_inputs_section_data): Remove.
7340         (Incremental_inputs::finalize_inputs): Remove.
7341         (Incremental_inputs::Input_info): Remove.
7342         (Incremental_inputs::lock_): Remove.
7343         (Incremental_inputs::inputs_): Change type.
7344         (Incremental_inputs::inputs_map_): Remove.
7345         (Incremental_inputs::current_object_entry_): New data member.
7346         (Incremental_inputs::inputs_section_): New data member.
7347         (Incremental_inputs::symtab_section_): New data member.
7348         (Incremental_inputs::relocs_section_): New data member.
7349         (Incremental_inputs::reloc_count_): New data member.
7350         (Incremental_inputs_reader): New class.
7351         (Incremental_symtab_reader): New class.
7352         (Incremental_relocs_reader): New class.
7353         * layout.cc (Layout::finalize): Move finalization of incremental info
7354         and creation of incremental info sections to follow finalization of
7355         symbol table.  Set offsets for postprocessing sections.
7356         (Layout::create_incremental_info_sections): Call
7357         Incremental_inputs::create_data_sections.  Add incremental symtab
7358         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
7359         sections to layout after input sections.
7360         * layout.h (struct Timespec): Forward declaration.
7361         (Layout::incremental_inputs): Add const.
7362         (Layout::create_incremental_info_sections): Add parameter.
7363         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
7364         * object.cc: Include incremental.h.
7365         (Relobj::finalize_incremental_relocs): New function.
7366         (Sized_relobj::do_layout): Record input sections in incremental info.
7367         * object.h (Object::output_section): New function.
7368         (Object::output_section_offset): Moved from Relobj.
7369         (Object::get_incremental_reloc_base): New function.
7370         (Object::get_incremental_reloc_count): New function.
7371         (Object::do_output_section): New function.
7372         (Object::do_output_section_offset): Moved from Relobj.
7373         (Object::do_get_incremental_reloc_base): New function.
7374         (Object::do_get_incremental_reloc_count): New function.
7375         (Object::Object): Initialize new data members.
7376         (Relobj::output_section): Renamed do_output_section and moved to
7377         protected.
7378         (Relobj::output_section_offset): Moved to Object.
7379         (Relobj::do_get_incremental_reloc_base): New function.
7380         (Relobj::do_get_incremental_reloc_count): New function.
7381         (Relobj::allocate_incremental_reloc_counts): New function.
7382         (Relobj::count_incremental_reloc): New function.
7383         (Relobj::finalize_incremental_relocs): New function.
7384         (Relobj::next_incremental_reloc_index): New function.
7385         (Relobj::reloc_counts_): New data member.
7386         (Relobj::reloc_bases_): New data member.
7387         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
7388         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
7389         (Sized_relobj::incremental_relocs_scan): New function.
7390         (Sized_relobj::incremental_relocs_scan_reltype): New function.
7391         (Sized_relobj::incremental_relocs_write): New function.
7392         (Sized_relobj::incremental_relocs_write_reltype): New function.
7393         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
7394         incremental link.
7395         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
7396         archives and object files elsewhere.
7397         (Add_symbols::run): Report object files here.
7398         (Finish_group::run): Report end of archive at end of group.
7399         * reloc.cc: Include layout.h, incremental.h.
7400         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
7401         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
7402         (Sized_relobj::incremental_relocs_scan): New function.
7403         (Sized_relobj::incremental_relocs_scan_reltype): New function.
7404         (Sized_relobj::do_relocate_sections): Write incremental relocations.
7405         (Sized_relobj::incremental_relocs_write): New function.
7406         (Sized_relobj::incremental_relocs_write_reltype): New function.
7407         * script.cc (read_input_script): Rewrite test for incremental link.
7408         Change call to Incremental_inputs::report_script.
7409         * symtab.h (Symbol_table::first_global_index): New function.
7410         (Symbol_table::output_count): New function.
7411
7412 2010-08-12  Doug Kwan  <dougkwan@google.com>
7413
7414         * arm.cc (Target_arm::merge_object_attributes): Check command line
7415         options --no-wchar-size-warning and --no-enum-size-warning.
7416         * options.h (General_options): Add ld-compatible options
7417         --no-enum-size-warning and --no-wchar-size-warning.
7418
7419 2010-08-04  Ian Lance Taylor  <iant@google.com>
7420
7421         * x86_64.cc (Target_x86_64::Scan::local): Use
7422         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
7423         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
7424         (Target_x86_64::Scan::global): Likewise.
7425         (Target_x86_64::Relocate::relocate): Likewise.
7426         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
7427         Likewise.
7428
7429 2010-08-03  Cary Coutant  <ccoutant@google.com>
7430
7431         * merge.cc (Output_merge_string::do_add_input_section): Count strings
7432         to reserve space in merged_strings vector. Keep total input size
7433         for stats.
7434         (Output_merge_string::do_print_merge_stats): Print total input size.
7435         * merge.h (Output_merge_string): Add input_size_ field.
7436         * stringpool.cc (Stringpool_template::string_length): Move
7437         implementations out of Stringpool_template class and place in
7438         stringpool.h.
7439         * stringpool.h (string_length): Move out of Stringpool_template.
7440
7441 2010-08-03  Ian Lance Taylor  <iant@google.com>
7442
7443         PR 11712
7444         * layout.cc (relaxation_loop_body): If address of load segment is
7445         set, adjust address to include headers if possible.
7446
7447 2010-08-03  Ian Lance Taylor  <iant@google.com>
7448
7449         * version.cc (version_string): Bump to 1.10.
7450
7451 2010-08-03  Ian Lance Taylor  <iant@google.com>
7452
7453         PR 11805
7454         * layout.h (enum Output_section_order): Define.
7455         (class Layout): Update declarations.
7456         * layout.cc (Layout::get_output_section): Add order parameter.
7457         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
7458         is_first_non_relro parameters.  Change all callers.
7459         (Layout::choose_output_section): Likewise.
7460         (Layout::add_output_section_data): Likewise.
7461         (Layout::make_output_section): Likewise.  Set order.
7462         (Layout::default_section_order): New function.
7463         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
7464         * output.cc (Output_section::Output_section): Initialize order_.
7465         Don't initialize deleted fields.
7466         (Output_segment::Output_segment): Don't initialize deleted
7467         fields.
7468         (Output_segment::add_output_section_to_load): New function
7469         replacing add_output_section.  Change all callers to call this or
7470         add_output_section_to_nonload.
7471         (Output_segment::add_output_section_to_nonload): New function.
7472         (Output_segment::remove_output_section): Rewrite.
7473         (Output_segment::add_initial_output_data): Likewise.
7474         (Output_segment::has_any_data_sections): Likewise.
7475         (Output_segment::is_first_section_relro): Likewise.
7476         (Output_segment::maximum_alignment): Likewise.
7477         (Output_segment::has_dynamic_reloc): New function replacing
7478         dynamic_reloc_count.  Change all callers.
7479         (Output_segment::has_dynamic_reloc_list): New function replacing
7480         dynamic_reloc_count_list.  Change all callers.
7481         (Output_segment::set_section_addresses): Rewrite.
7482         (Output_segment::set_offset): Rewrite.
7483         (Output_segment::find_first_and_last_list): Remove.
7484         (Output_segment::set_tls_offsets): Rewrite.
7485         (Output_segment::first_section_load_address): Likewise.
7486         (Output_segment::output_section_count): Likewise.
7487         (Output_segment::section_with_lowest_load_address): Likewise.
7488         (Output_segment::write_section_headers): Likewise.
7489         (Output_segment::print_sections_to_map): Likewise.
7490         * output.h (class Output_data): Remove dynamic_reloc_count_
7491         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
7492         (Output_data::add_dynamic_reloc): Rewrite.
7493         (Output_data::has_dynamic_reloc): New function.
7494         (Output_data::dynamic_reloc_count): Remove.
7495         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
7496         is_last_relro_, is_first_non_relro_, is_interp_,
7497         is_dynamic_linker_section_ fields.  Add order and set_order
7498         functions.  Remove is_relro_local, set_is_relro_local,
7499         is_last_relro, set_is_last_relro, is_first_non_relro,
7500         set_is_first_non_relro functions, is_interp, set_is_interp,
7501         is_dynamic_linker_section, and set_is_dynamic_linker_section
7502         functions.
7503         (class Output_segment): Change Output_data_list from std::list to
7504         std:;vector.  Add output_lists_ field.  Remove output_data_ and
7505         output_bss_ fields.  Update declarations.
7506
7507 2010-08-02  Ian Lance Taylor  <iant@google.com>
7508
7509         * arm.cc (Target_arm::gc_process_relocs): Use typename.
7510         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
7511         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
7512
7513 2010-08-02  Ian Lance Taylor  <iant@google.com>
7514
7515         PR 11855
7516         * script.cc (Script_options::Script_options): Initialize
7517         symbol_definitions_ and symbol_references_.
7518         (Script_options::add_symbol_assignment): Update
7519         symbol_definitions_ and symbol_references_.
7520         (Script_options::add_symbol_reference): New function.
7521         (script_symbol): New function.
7522         * script.h (class Script_options): Add symbol_definitions_ and
7523         symbol_references_ fields.
7524         (Script_options::referenced_const_iterator): New type.
7525         (Script_options::referenced_begin): New function.
7526         (Script_options::referenced_end): New function.
7527         (Script_options::is_referenced): New function.
7528         (Script_options::any_unreferenced): New function.
7529         * script-c.h (script_symbol): Declare.
7530         * yyscript.y (exp): Call script_symbol.
7531         * symtab.cc: Include "script.h".
7532         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
7533         Change all callers.  Check symbols referenced by scripts.
7534         (Symbol_table::add_undefined_symbols_from_command_line): Add
7535         layout parameter.  Change all callers.
7536         (Symbol_table::do_add_undefined_symbols_from_command_line):
7537         Likewise.  Break out loop body.  Check symbols referenced by
7538         scripts.
7539         (Symbol_table::add_undefined_symbol_from_command_line): New
7540         function broken out of
7541         do_add_undefined_symbols_from_command_line.
7542         * symtab.h (class Symbol_table): Update declarations.
7543         * archive.cc: Include "layout.h".
7544         (Archive::should_include_member): Add layout parameter.  Change
7545         all callers.  Check for symbol mentioned in expression.
7546         * archive.h (class Archive): Update declaration.
7547         * object.cc (Sized_relobj::do_should_include_member): Add layout
7548         parameter.
7549         * object.h (Object::should_include_member): Add layout parameter.
7550         Change all callers.
7551         (Object::do_should_include_member): Add layout parameter.
7552         (class Sized_relobj): Update declaration.
7553         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
7554         parameter.
7555         * dynobj.h (class Sized_dynobj): Update declaration.
7556         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
7557         layout parameter.
7558         * plugin.h (class Sized_pluginobj): Update declaration.
7559
7560 2010-08-02  Ian Lance Taylor  <iant@google.com>
7561
7562         PR 11866
7563         * output.cc (Output_segment::set_offset): Search for the first and
7564         last sections rather than assuming that the list is in order.
7565         (Output_segment::find_first_and_last_list): New function.
7566         * output.h (class Output_segment): Update declarations.
7567         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
7568         (relro_strip_test_SOURCES): New variable.
7569         (relro_strip_test_DEPENDENCIES): New variable.
7570         (relro_strip_test_LDFLAGS): New variable.
7571         (relro_strip_test_LDADD): New variable.
7572         (relro_strip_test.so): New target.
7573
7574 2010-08-02  Ian Lance Taylor  <iant@google.com>
7575
7576         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
7577         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
7578         (Target_i386::got_tlsdesc_section): New function.
7579         (Target_i386::got_section): Create space for GOT entries for
7580         TLSDESC relocations.
7581         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
7582         R_386_TLS_GOTDESC.
7583         (Target_i386::Scan::global): Likewise.
7584         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
7585         using TLSDESC GOT.
7586         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
7587         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
7588         (Target_x86_64::got_tlsdesc_section): New function.
7589         (Target_x86_64::got_section): Create space for GOT entries for
7590         TLSDESC relocations.
7591         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
7592         R_386_TLS_GOTDESC.
7593         (Target_x86_64::Scan::global): Likewise.
7594         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
7595         using TLSDESC GOT.
7596
7597 2010-08-02  Ian Lance Taylor  <iant@google.com>
7598
7599         * testsuite/final_layout.sh: Use dc to convert from hex to
7600         decimal.
7601
7602 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
7603
7604         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
7605         paramter to the call to gold::gc_process_relocs.
7606         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
7607         paramter to the call to gold::gc_process_relocs.
7608         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
7609         parameter to the call to gold::gc_process_relocs.
7610         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
7611         template parameter to the call to gold::gc_process_relocs.
7612         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
7613         paramter to the call to gold::gc_process_relocs.
7614         * gc.h (get_embedded_addend_size): New function.
7615         (gc_process_relocs): Save the size of the reloc for use by ICF.
7616         * icf.cc (get_section_contents): Get the addend from the text section
7617         for SHT_REL relocation sections.
7618         * icf.h (Icf::Reloc_addend_size_info): New typedef.
7619         (Icf::Reloc_info): Add new member reloc_addend_size_info.
7620         * int_encoding.h (read_from_pointer): New overloaded function.
7621         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
7622         * testsuite/icf_sht_rel_addend_test.sh: New file.
7623         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
7624         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
7625
7626 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7627
7628         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
7629         * Makefile.in: Regenerate.
7630         * testsuite/Makefile.in: Regenerate.
7631
7632 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
7633
7634         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
7635         * gold/testsuite/debug_msg.cc: Likewise.
7636         * gold/testsuite/odr_violation1.cc
7637         * gold/testsuite/odr_violation2.cc
7638
7639 2010-07-21  Cary Coutant  <ccoutant@google.com>
7640
7641         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
7642         string, and length fields.
7643         (Output_merge_string::Merged_strings_list): New type.
7644         (Output_merge_string::Merged_strings_lists): New typedef.
7645         (Output_merge_string): Replace merged_strings_ with
7646         merged_strings_lists_.
7647         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
7648         Merged_strings_list per input object and section.  Don't store pointer
7649         to the string.  Don't store length with each merged string entry.
7650         (Output_merge_string::finalize_merged_data): Loop over list of merged
7651         strings lists.  Recompute length of each merged string.
7652
7653 2010-07-15  Cary Coutant  <ccoutant@google.com>
7654
7655         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
7656         here.
7657
7658 2010-07-14  Ian Lance Taylor  <iant@google.com>
7659
7660         * descriptors.cc (Descriptors::open): Report correct name in error
7661         message.
7662
7663 2010-07-13  Doug Kwan  <dougkwan@google.com>
7664
7665         * arm.cc (Arm_input_section::Arm_input_section): For a
7666         SHT_ARM_EXIDX section, always keeps the input sections.
7667         (Arm_input_section::set_exidx_section_link): New method.
7668         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
7669         has_errors_ to false.
7670         (Arm_exidx_input_section::has_errors,
7671         Arm_exidx_input_section::set_has_errors): New methods.
7672         (Arm_exidx_input_section::has_errors_): New data member.
7673         (Arm_relobj::get_exidx_shndx_list): New method.
7674         (Arm_output_section::append_text_sections_to_list): Do not skip
7675         section without SHF_EXECINSTR.
7676         (Arm_output_section::fix_exidx_coverage): Skip input sections with
7677         errors.
7678         (Arm_relobj::make_exidx_input_section): Add new parameter for text
7679         section header.  Make error messages more verbose.  Check for
7680         a non-executable section linked to an EXIDX section.
7681         (Arm_relobj::do_read_symbols): Remove error checking, which has been
7682         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
7683         check that there is no deferred EXIDX section if we exit early.
7684         Instead of not making an EXIDX section in case of an error, make one
7685         and set the has_errors flag of it.
7686         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
7687         in a relocatable link.
7688         (Target_arm::do_relax): Look for the EXIDX output section instead of
7689         assuming that it is called .ARM.exidx.
7690         (Target_arm::fix_exidx_coverage): Add a new parameter for input
7691         section list.  Do not check for SHF_EXECINSTR section flags but
7692         skip any input section with errors.
7693         * output.cc (Output_section::Output_section): Initialize
7694         always_keeps_input_sections_ to false.
7695         (Output_section::add_input_section): Check for
7696         always_keeps_input_sections_.
7697         *  output.h (Output_section::always_keeps_input_sections,
7698         Output_section::set_always_keeps_input_sections): New methods.
7699         (Output_section::always_keeps_input_sections): New data member.
7700
7701 2010-07-13  Rafael Espindola  <espindola@google.com>
7702
7703         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
7704         * fileread.h (Input_file): Add try_extra_search_path and find_file.
7705
7706 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
7707             Ian Lance Taylor  <iant@google.com>
7708
7709         * output.h (Output_section_lookup_maps::add_merge_section):
7710         Correct check of whether value was inserted.
7711         (Output_section_lookup_maps::add_merge_input_section): Likewise.
7712         (Output_section_lookup_maps::add_relaxed_input_section):
7713         Likewise.
7714         * arm.cc (Target_arm::got_section): Remove used local os.
7715         * i386.cc (Target_i386::got_section): Likewise.
7716         * x86_64.cc (Target_x86_64::got_section): Likewise.
7717         * sparc.cc (Target_sparc::got_section): Likewise.
7718         (Target_sparc::relocate): Remove unused local have_got_offset.
7719         * powerpc.cc (Target_powerpc::relocate): Likewise.
7720
7721 2010-07-13  Ian Lance Taylor  <iant@google.com>
7722
7723         * compressed_output.cc (zlib_decompress): Fix signature in
7724         !HAVE_ZLIB_H case.
7725
7726         * archive.cc (Archive::include_member): Unlock an external member
7727         of a thin archive.  Don't bother to delete an object we know is
7728         NULL.
7729
7730 2010-07-12  Cary Coutant  <ccoutant@google.com>
7731
7732         * compressed_output.cc (zlib_decompress): New function.
7733         (get_uncompressed_size): New function.
7734         (decompress_input_section): New function.
7735         * compressed_output.h (get_uncompressed_size): New function.
7736         (decompress_input_section): New function.
7737         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
7738         Handle compressed debug sections.
7739         * layout.cc (is_compressed_debug_section): New function.
7740         (Layout::output_section_name): Map compressed section names to
7741         canonical names.
7742         * layout.h (is_compressed_debug_section): New function.
7743         (is_debug_info_section): Recognize compressed debug sections.
7744         * merge.cc: Include compressed_output.h.
7745         (Output_merge_data::do_add_input_section): Handle compressed
7746         debug sections.
7747         (Output_merge_string::do_add_input_section): Handle compressed
7748         debug sections.
7749         * object.cc: Include compressed_output.h.
7750         (Sized_relobj::Sized_relobj): Initialize new data members.
7751         (build_compressed_section_map): New function.
7752         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
7753         * object.h (Object::section_is_compressed): New method.
7754         (Object::do_section_is_compressed): New method.
7755         (Sized_relobj::Compressed_section_map): New type.
7756         (Sized_relobj::do_section_is_compressed): New method.
7757         (Sized_relobj::compressed_sections_): New data member.
7758         * output.cc (Output_section::add_input_section): Handle compressed
7759         debug sections.
7760         * reloc.cc: Include compressed_output.h.
7761         (Sized_relobj::write_sections): Handle compressed debug sections.
7762
7763 2010-07-08  Cary Coutant  <ccoutant@google.com>
7764
7765         * resolve.cc (Symbol_table::resolve): Remember whether undef was
7766         weak when resolving to a dynamic def.
7767         (Symbol_table::should_override): Add adjust_dyndef flag; set it
7768         for weak undef/dynamic def cases. Adjust callers.
7769         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
7770         undef_binding_weak_.
7771         (Symbol_table::sized_write_globals): Adjust symbol binding.
7772         (Symbol_table::sized_write_symbol): Add binding parameter.
7773         * symtab.h (Symbol::set_undef_binding): New method.
7774         (Symbol::is_undef_binding_weak): New method.
7775         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
7776         (Symbol_table::should_override): Add new parameter.
7777         (Symbol_table::sized_write_symbol): Add new parameter.
7778
7779         * testsuite/weak_undef_file1.cc: Add new test case.
7780         * testsuite/weak_undef_file2.cc: Fix header comment.
7781         * testsuite/weak_undef_test.cc: Add new test case.
7782
7783 2010-06-29  Doug Kwan  <dougkwan@google.com>
7784
7785         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
7786         Initialize USE_SYMBOL_.
7787         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
7788         definition.
7789         (Arm_reloc_property::uses_symbol_): New data member declaration.
7790         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
7791         uses symbol value and symbol is undefined but not weakly undefined.
7792
7793 2010-06-28  Rafael Espindola  <espindola@google.com>
7794
7795         * plugin.cc (Plugin::load): Use dlerror.
7796
7797 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
7798
7799         * symtab.cc (detect_odr_violations): When reporting an ODR
7800         violation, report an object where the symbol is defined.
7801
7802 2010-06-25  Doug Kwan  <dougkwan@google.com>
7803
7804         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
7805         (Target_arm::section_may_have_icf_unsafe_pointers): New method
7806         definition.
7807         (Target_arm::Scan::local_reloc_may_be_function_pointer,
7808         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
7809         target hook to detect function points.
7810         (Target_arm::Scan::possible_function_pointer_reloc): New method.
7811         * icf.h (Icf::check_section_for_function_pointers): Change type of
7812         parameter SECTION_NAME to const reference to std::string.  Use
7813         target hook to determine if section may have unsafe pointers.
7814         * target.h (Target::section_may_have_icf_unsafe_pointers): New
7815         method definition.
7816
7817 2010-06-21  Rafael Espindola  <espindola@google.com>
7818
7819         * fileread.cc (Input_file::find_fie): New
7820         (Input_file::open): Use Input_file::find_fie.
7821         * fileread.h (Input_file::find_fie): New
7822         * plugin.cc (set_extra_library_path): New.
7823         (Plugin::load): Add set_extra_library_path to the transfer vector.
7824         (Plugin_manager::set_extra_library_path): New.
7825         (Plugin_manager::add_input_file): Use the extra search path if set.
7826         (set_extra_library_path(): New.
7827         * plugin.h (Plugin_manager): Add set_extra_library_path and
7828         extra_search_path_.
7829
7830 2010-06-19  Cary Coutant  <ccoutant@google.com>
7831
7832         * layout.cc (gdb_sections): Add .debug_types.
7833         (lines_only_debug_sections): Likewise.
7834
7835 2010-06-18  Rafael Espindola  <espindola@google.com>
7836
7837         * plugin.cc (add_input_file,add_input_library)
7838         (Plugin_manager::add_input_file): Make filename arguments const.
7839         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
7840         const.
7841
7842 2010-06-16  Doug Kwan  <dougkwan@google.com>
7843
7844         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
7845         .ARM.attributes section if we have not merged any input
7846         attributes sections.
7847
7848 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7849
7850         * arm.cc: Allow combining objects with no EABI version
7851         information.
7852
7853 2010-06-15  Rafael Espindola  <espindola@google.com>
7854
7855         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
7856
7857 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7858
7859         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
7860         (struct iovec): Correct !HAVE_READV definition.
7861
7862 2010-06-10  Cary Coutant  <ccoutant@google.com>
7863
7864         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
7865         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
7866         reloc sections.
7867         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
7868
7869         PR 11683
7870         * symtab.h (Symbol::is_placeholder): New member function.
7871         * target-reloc.h (relocate_section): Check for placeholder symbols.
7872
7873         * testsuite/Makefile.am (plugin_test_8): New test.
7874         (plugin_test_9): New test.
7875         * testsuite/Makefile.in: Regenerate.
7876
7877 2010-06-09  Nick Clifton  <nickc@redhat.com>
7878
7879         * yyscript.y (input_list_element): Allow strings prefixed with
7880         the '-' character.  Treat these as libraries.
7881         * script.cc (script_add_library): New function.  Adds a library
7882         specified by "-l<name>" found in an input script.
7883         * script-c.h: Add prototype for script_add_library.
7884
7885 2010-06-07  Doug Kwan  <dougkwan@google.com>
7886
7887         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
7888         Restrict stub-group size to be within long conditional branch
7889         range when working around cortex-A8 erratum.
7890
7891 2010-06-07  Damien Diederen  <dd@crosstwine.com>
7892
7893         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
7894         #ifdef typo.
7895
7896 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
7897
7898         PR gold/11658
7899         * output.cc
7900         (Output_section::Input_section_sort_entry::compare_section_ordering):
7901         Change to return non-zero correctly.
7902         (Output_section::Input_section_sort_section_order_index_compare
7903         ::operator()): Change to fix ambiguity in comparisons.
7904
7905 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
7906
7907         * gold.h (is_wildcard_string): New function.
7908         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
7909         (Layout::layout_eh_frame): Ditto.
7910         (Layout::find_section_order_index): New method.
7911         (Layout::read_layout_from_file): New method.
7912         * layout.h (Layout::find_section_order_index): New method.
7913         (Layout::read_layout_from_file): New method.
7914         (Layout::input_section_position_): New private member.
7915         (Layout::input_section_glob_): New private member.
7916         * main.cc (main): Call read_layout_from_file here.
7917         * options.h (--section-ordering-file): New option.
7918         * output.cc (Output_section::input_section_order_specified_): New
7919         member.
7920         (Output_section::Output_section): Initialize new member.
7921         (Output_section::add_input_section): Add new parameter.
7922         Keep input sections when --section-ordering-file is used.
7923         (Output_section::set_final_data_size): Sort input sections when
7924         section ordering file is specified.
7925         (Output_section::Input_section_sort_entry): Add new parameter.
7926         Check sorting type.
7927         (Output_section::Input_section_sort_entry::compare_section_ordering):
7928         New method.
7929         (Output_section::Input_section_sort_compare::operator()): Change to
7930         consider section_order_index.
7931         (Output_section::Input_section_sort_init_fini_compare::operator()):
7932         Change to consider section_order_index.
7933         (Output_section::Input_section_sort_section_order_index_compare
7934         ::operator()): New method.
7935         (Output_section::sort_attached_input_sections): Change to sort
7936         according to section order when specified.
7937         (Output_section::add_input_section<32, true>): Add new parameter.
7938         (Output_section::add_input_section<64, true>): Add new parameter.
7939         (Output_section::add_input_section<32, false>): Add new parameter.
7940         (Output_section::add_input_section<64, false>): Add new parameter.
7941         * output.h (Output_section::add_input_section): Add new parameter.
7942         (Output_section::input_section_order_specified): New
7943         method.
7944         (Output_section::set_input_section_order_specified): New method.
7945         (Input_section::Input_section): Initialize section_order_index_.
7946         (Input_section::section_order_index): New method.
7947         (Input_section::set_section_order_index): New method.
7948         (Input_section::section_order_index_): New member.
7949         (Input_section::Input_section_sort_section_order_index_compare): New
7950         struct.
7951         (Output_section::input_section_order_specified_): New member.
7952         * script-sections.cc (is_wildcard_string): Delete and move modified
7953         method to gold.h.
7954         (Output_section_element_input::Output_section_element_input): Modify
7955         call to is_wildcard_string.
7956         (Output_section_element_input::Input_section_pattern
7957         ::Input_section_pattern): Ditto.
7958         (Output_section_element_input::Output_section_element_input): Ditto.
7959         * testsuite/Makefile.am (final_layout): New test case.
7960         * testsuite/Makefile.in: Regenerate.
7961         * testsuite/final_layout.cc: New file.
7962         * testsuite/final_layout.sh: New file.
7963
7964 2010-06-01  Rafael Espindola  <espindola@google.com>
7965
7966         * plugin.cc (Plugin::load): Pass the output name to the plugin.
7967
7968 2010-06-01  Rafael Espindola  <espindola@google.com>
7969
7970         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
7971         visibility of symbols.
7972
7973 2010-05-27  Doug Kwan  <dougkwan@google.com>
7974
7975         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
7976         from start of output section instead of address for a local symbol
7977         in a merged or relaxed section when doing a relocatable link.
7978
7979 2010-05-26  Rafael Espindola  <espindola@google.com>
7980
7981         PR 11604
7982         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
7983         adding sections the garbage collector removed.
7984         * gold/testsuite/Makefile.am: Add test.
7985         * gold/testsuite/Makefile.in: Regenerate.
7986         * gold/testsuite/plugin_test_7.sh: New.
7987         * gold/testsuite/plugin_test_7_1.c: New.
7988         * gold/testsuite/plugin_test_7_2.c: New.
7989
7990 2010-05-26  Rafael Espindola  <espindola@google.com>
7991
7992         * script-sections.cc (Output_section_definition::set_section_addresses):
7993         Check for --section-start.
7994
7995 2010-05-26  Doug Kwan  <dougkwan@google.com>
7996
7997         * arm.cc (Arm_scan_relocatable_relocs): New class.
7998         (Target_arm::relocate_special_relocatable): New method.
7999         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
8000         (Arm_relocate_functions::thumb_branch_common): Same.
8001         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
8002         instead of Default_scan_relocatable_relocs.
8003         * target-reloc.h (relocate_for_relocatable): Let target handle
8004         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
8005         * target.h (Sized_target::relocate_special_relocatable): New method.
8006
8007 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8008
8009         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
8010
8011 2010-05-23  Doug Kwan  <dougkwan@google.com>
8012
8013         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
8014         instead of a cast.
8015         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
8016         with a direct branch, not a conditional branch, to a stub.
8017         * merge.cc (Output_merge_base::record_input_section): New method
8018         defintion.
8019         (Output_merge_data::do_add_input_section): Record input section if
8020         keeps-input-sections flag is set.
8021         (Output_merge_string::do_add_input_section): Ditto.
8022         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
8023         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
8024         INPUT_SECTIONS_.
8025         (Output_merge_base::keeps_input_sections,
8026         Output_merge_base::set_keeps_input_sections,
8027         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
8028         method definitions.
8029         (Output_merge_base::Input_sections): New type declaration.
8030         (Output_merge_base::input_sections_begin,
8031         Output_merge_base::input_sections_end,
8032         Output_merge_base::do_set_keeps_input_sections): New method definitions.
8033         (Output_merge_base::bool keeps_input_sections_,
8034         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
8035         Output_merge_base::input_sections_): New data members.
8036         (Output_merge_data::do_set_keeps_input_sections): New method
8037         defintion.
8038         (Output_merge_string::do_set_keeps_input_sections): Ditto.
8039         * output.cc (Output_section::Input_section::relobj): Move method
8040         defintion from class declaration to here and handle merge sections.
8041         (Output_section::Input_section::shndx): Ditto.
8042         (Output_section::Output_section): Remove initializations of removed
8043         data members and initialize new data member LOOKUP_MAPS_.
8044         (Output_section::add_input_section): Set keeps-input-sections flag
8045         for a newly created merge output section as appropriate.  Adjust code
8046         to use Output_section_lookup_maps class.
8047         (Output_section::add_relaxed_input_section): Adjst code for lookup
8048         maps code refactoring.
8049         (Output_section::add_merge_input_section): Add a new parameter
8050         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
8051         class.  If adding input section to a newly created merge output
8052         section fails, remove the new merge section.
8053         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
8054         Adjust code for use of the Output_section_lookup_maps class.
8055         (Output_section::find_merge_section): Ditto.
8056         (Output_section::build_lookup_maps): New method defintion.
8057         (Output_section::find_relaxed_input_section): Adjust code to use
8058         Output_section_lookup_maps class.
8059         (Output_section::get_input_sections): Export merge sections.  Adjust
8060         code to use Output_section_lookup_maps class.
8061         (Output_section:::add_script_input_section): Adjust code to use
8062         Output_section_lookup_maps class.  Update lookup maps for merge
8063         sections also.
8064         (Output_section::discard_states): Use Output_section_lookup_maps.
8065         (Output_section::restore_states): Same.
8066         * output.h (Merge_section_properties): Move class defintion out of
8067         Output_section.
8068         (Output_section_lookup_maps): New class.
8069         (Output_section::Input_section::is_merge_section): New method
8070         defintion.
8071         (Output_section::Input_section::relobj): Move defintion out of class
8072         defintion.  Declare method only.
8073         (Output_section::Input_section::shndx): Ditto.
8074         (Output_section::Input_section::output_merge_base): New method defintion.
8075         (Output_section::Input_section::u2_.pomb): New union field.
8076         (Output_section::Merge_section_by_properties_map,
8077         Output_section::Output_section_data_by_input_section_map,
8078         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
8079         Remove types.
8080         (Output_section::add_merge_input_section): Add new parameter
8081         KEEPS_INPUT_SECTIONS.
8082         (Output_section::build_lookup_maps): New method declaration.
8083         (Output_section::merge_section_map_,
8084         Output_section::merge_section_by_properties_map_,
8085         Output_section::relaxed_input_section_map_,
8086         Output_section::is_relaxed_input_section_map_valid_): Remove data
8087         members.
8088         (Output_section::lookup_maps_): New data member.
8089
8090 2010-05-21  Doug Kwan  <dougkwan@google.com>
8091
8092         PR gold/11619
8093         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
8094         avoid a compilation error.
8095
8096 2010-05-19  Rafael Espindola  <espindola@google.com>
8097
8098         * script-sections.cc (Output_section_definition::allocate_to_segment):
8099         Update the phdrs_list even when the output section is NULL.
8100         * testsuite/Makefile.am: Add test.
8101         * testsuite/Makefile.in: Regenerate.
8102         * testsuite/script_test_9.cc: New.
8103         * testsuite/script_test_9.sh: New.
8104         * testsuite/script_test_9.t: New.
8105
8106 2010-05-19  Doug Kwan  <dougkwan@google.com>
8107
8108         * arm.cc (Arm_input_section::original_size): New method.
8109         (Arm_input_section::do_addralign): Add a cast.
8110         (Arm_input_section::do_output_offset): Remove static cast.
8111         (Arm_input_section::original_addralign,
8112          Arm_input_section::original_size_): Change type to uint32_t.
8113         (Arm_input_section::init): Add safe casts for section alignment
8114         and size.
8115         (Arm_input_section::set_final_data_size): Do not set address and
8116         offset of stub table.
8117         (Arm_output_section::fix_exidx_coverage): Change use of of
8118         Output_section::Simple_input_section to that of
8119         Output_section::Input_section.
8120         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
8121         except for the first pass.
8122         * output.cc (Output_section::get_input_sections): Change type of
8123         input_sections to std::list<Input_section>.
8124         (Output_section::add_script_input_section): Rename from
8125         Output_section::add_simple_input_section.  Change type of SIS
8126         parameter from Simple_input_section to Input_section.
8127         * output.h (Output_section::Simple_input_section): Remove class.
8128         (Output_section::Input_section): Change class visibility to public.
8129         (Output_section::Input_section::addralign): Use stored alignments
8130         for special input sections if set.
8131         (Output_section::Input_section::set_addralign): New method.
8132         (Output_section::get_input_sections): Change parameter type from
8133         list of Simple_input_section to list of Input_section.
8134         (Output_section::add_script_input_section): Rename from
8135         Output_section::add_simple_input_section. Change first parameter's
8136         type from Simple_input_section to Input_section and remove the
8137         second and third parameters.
8138         * script-sections.cc (Input_section::Input_section_list): Change
8139         type to list of Output_section::Input_section/
8140         (Input_section_info::Input_section_info): Change parameter type of
8141         INPUT_SECTION to Output_section::Input_section.
8142         (Input_section_info::input_section): Change return type.
8143         (Input_section_info::input_section_): Change type to
8144         Output_section::Input_section.
8145         (Output_section_element_input::set_section_addresses): Adjust code
8146         to use Output_section::Input_section instead of
8147         Output_section::Simple_input_section.  Adjust code for renaming
8148         of Output_section::add_simple_input_section.
8149         (Orphan_output_section::set_section_addresses): Ditto.
8150
8151 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8152
8153         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
8154         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
8155
8156 2010-05-18  Rafael Espindola  <espindola@google.com>
8157
8158         * options.cc (General_options::finalize): Handle -nostdlib.
8159         * options.h (nostdlib): New option.
8160         * script.cc (script_add_search_dir): Handle -nostdlib.
8161
8162 2010-05-12  Doug Kwan  <dougkwan@google.com>
8163
8164         * arm.cc (Target_arm::do_finalize_sections): Create an empty
8165         attributes section only if there no attributes section after merging.
8166         (Target_arm::merge_object_attributes): Move value of
8167         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
8168         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
8169         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
8170         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
8171         and arm_attr_merge_7.stdout.
8172         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
8173         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
8174         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
8175         arm_attr_merge_7b.o): New rules.
8176         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
8177         arm_attr_merge_7
8178         * testsuite/Makefile.in: Regenerate.
8179         * testsuite/arm_attr_merge.sh: New file.
8180         * testsuite/arm_attr_merge_[67][ab].s: Same.
8181
8182 2010-05-05  Nick Clifton  <nickc@redhat.com>
8183
8184         * po/es.po: Updated Spanish translation.
8185
8186 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
8187
8188         * Makefile.am (install-exec-local): Properly install gold as
8189         default cross linker.
8190         * Makefile.in: Regenerated.
8191
8192 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
8193             Nick Clifton  <nickc@redhat.com>
8194
8195         * configure.ac (install_as_default): Define and set to false
8196         unless --enable-gold or --enable-gold=both/gold has been
8197         specified.
8198         * configure: Regenerate.
8199
8200         * Makefile.am (install-exec-local): Install the executable as
8201         'ld.gold'.  If install_as_default is true then also install it as
8202         'ld'.
8203         * Makefile.in: Regenerated.
8204
8205 2010-04-24  Ian Lance Taylor  <iant@google.com>
8206
8207         * layout.cc (Layout::layout_reloc): In relocatable link don't
8208         combine reloc sections for grouped sections.
8209
8210 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
8211
8212         * gc.h (gc_process_relocs): Pass information on relocs pointing to
8213         sections that are not ordinary to icf.
8214         * icf.cc (get_section_contents): Handle relocation pointing to section
8215         with no object or shndx information.
8216         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
8217         * testsuite/Makefile.in: Regenerate.
8218         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
8219         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
8220
8221 2010-04-22  Ian Lance Taylor  <iant@google.com>
8222
8223         * expression.cc (Expression::Expression_eval_info): Add
8224         result_alignment_pointer field.
8225         (Expression::eval_with_dot): Add result_alignment_pointer
8226         parameter.  Change all callers.
8227         (Expression::eval_maybe_dot): Likewise.
8228         (class Binary_expression): Add alignment_pointer parameter to
8229         left_value and right_value.  Change all callers.
8230         (BINARY_EXPRESSION): Set result alignment.
8231         (class Trinary_expression): Add alignment_pointer parameter to
8232         arg2_value and arg3_value.  Change all callers.
8233         (Trinary_cond::value): Set result alignment.
8234         (Max_expression::value, Min_expression::value): Likewise.
8235         (Align_expression::value): Likewise.
8236         * script-sections.cc (class Sections_element): Add dot_alignment
8237         parameter to set_section_addresses virtual function.  Update
8238         instantiations.
8239         (class Output_section_element): Likewise.
8240         (Script_sections::create_segments): Add dot_alignment parameter.
8241         Change all callers.
8242         (Script_sections::create_segments_from_phdrs_clause): Likewise.
8243         (Script_sections::set_phdrs_clause_addresses): Likewise.
8244         * script-sections.h: Update declarations.
8245         * script.h: Update declarations.
8246         * output.h (Output_segment::set_minimum_p_align): Don't decrease
8247         min_p_align.
8248         * testsuite/script_test_3.t: Set large alignment.
8249         * testsuite/script_test_3.sh: Make sure that at least one LOAD
8250         segment has expected alignment.
8251
8252 2010-04-22  Nick Clifton  <nickc@redhat.com>
8253
8254         * po/gold.pot: Updated by the Translation project.
8255         * po/vi.po: Updated Vietnamese translation.
8256
8257 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
8258
8259         * testsuite/Makefile.am (check_PROGRAMS): Add
8260         icf_virtual_function_folding_test.
8261         * testsuite/Makefile.in: Regenerated.
8262
8263 2010-04-15  Andrew Haley  <aph@redhat.com>
8264
8265         * options.h (merge_exidx_entries): New option.
8266         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
8267         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
8268         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
8269         (Target_arm::merge_exidx_entries): New function.
8270         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
8271         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
8272         to Arm_exidx_fixup constructor.
8273         Add new arg, merge_exidx_entries.
8274         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
8275         Arm_output_section::fix_exidx_coverage.
8276
8277 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
8278
8279         * icf.cc (get_section_contents): Check for preemptible functions.
8280         Ignore addend when appropriate.
8281         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
8282         section folded.
8283         (add_from_relobj): Check for section folded.
8284         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
8285         * symtab.h (should_add_dynsym_entry): Add new parameter.
8286         * target-reloc.h (scan_relocs): Check for section folded.
8287         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
8288         Check reloc types for function pointers in shared objects.
8289         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
8290         case.
8291         (icf_preemptible_functions_test): New test case.
8292         (icf_string_merge_test): New test case.
8293         * testsuite.Makefile.in: Regenerate.
8294         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
8295         bar_glob.  Refactor code.
8296         * testsuite/icf_preemptible_functions_test.cc: New file.
8297         * testsuite/icf_preemptible_functions_test.sh: New file.
8298         * testsuite/icf_string_merge_test.cc: New file.
8299         * testsuite/icf_string_merge_test.sh: New file.
8300         * testsuite/icf_virtual_function_folding_test.cc: New file.
8301         * testsuite/icf_virtual_function_folding_test.sh: New file.
8302
8303 2010-04-14  Doug Kwan  <dougkwan@google.com>
8304
8305         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
8306         for local symbol recounting if we remove a section due to ICF.
8307         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
8308         there are no regular objects in input.
8309
8310 2010-04-13  Doug Kwan  <dougkwan@google.com>
8311
8312         * arm.cc (Arm_input_section::set_final_data_size): Compute
8313         accurate final data size instead of using current data size.
8314
8315 2010-04-09  Doug Kwan  <dougkwan@google.com>
8316
8317         * layout.cc (Layout::choose_output_section): Handle script section
8318         types.
8319         (Layout::make_output_section_for_script): Add section type parameter.
8320         Handle script section types.
8321         * layout.h (Layout::make_output_section_for_script): Add section
8322         type parameter.
8323         * output.cc (Output_section::Output_section): Initialize data member
8324         is_noload_.
8325         (Output_section::do_reset_address_and_file_offset): Do not set address
8326         to 0 if section is a NOLOAD section.
8327         * output.h (Output_section::is_noload): New method.
8328         (Output_section::set_is_noload): Ditto.
8329         (Output_section::is_noload_): New data member.
8330         * script-c.h (Script_section_type): New enum type.
8331         (struct Parser_output_section_header): Add new file section_type.
8332         * script-sections.cc (Sections_element::output_section_name): Add
8333         parameter for returning script section type.
8334         (Output_section_definition::output_section_name): Ditto.
8335         (Output_section_definition::section_type)P; New method.
8336         (Output_section_definiton::script_section_type_name): Ditto.
8337         (Output_section_definition::script_section_type_): New data member.
8338         (Output_section_definition::Output_section_definition): Initialize
8339         data member Output_section_definition::script_section_type_.
8340         (Output_section_definition::create_sections): Pass script section type
8341         to Layout::make_output_section_for_script.
8342         (Output_section_definition::output_section_name): Return script
8343         section type to caller.
8344         (Output_section_definition::set_section_address): Do not advance
8345         dot value and load address if section type is NOLOAD.  Set address
8346         of NOLOAD sections regardless of section flags.
8347         (Output_section_definition::print): Print section type if it is
8348         not SCRIPT_SECTION_TYPE_NONE.
8349         (Output_section_definition::section_type): New method.
8350         (Output_section_definition::script_section_type_name): Ditto.
8351         (Script_sections::output_section_name): Add new parameter
8352         PSECTION_TYPE for returning script section type.  Pass it to
8353         section elements.  Handle discard sections.
8354         (Sort_output_sections::operator()): Handle NOLOAD sections.
8355         * script-sections.h (Script_sections::Section_type): New enum type.
8356         (Script_sections::output_section_name): Add a new parameter for
8357         returning script section type.
8358         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
8359         INFO and NOLOAD.
8360         * yyscript.y (union): Add new field SECTION_TYPE.
8361         (COPY, DSECT, INFO, NOLOAD): New tokens.
8362         (opt_address_and_section_type): Change type to output_section_header.
8363         (section_type): New non-terminal
8364         (section_header): Handle section type.
8365         (opt_address_and_section_type): Return section type value.
8366
8367 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
8368
8369         * testsuite/plugin_common_test_1.c (foo): Add prototype.
8370         * testsuite/plugin_common_test_2.c (foo): Likewise.
8371
8372 2010-04-08  Doug Kwan  <dougkwan@google.com>
8373
8374         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
8375         Output_merge_data.
8376         * output.cc (Output_section::add_merge_input_section): Simplify
8377         code and return status of Output_merge_base::add_input_section.
8378         Update merge section map only if Output_merge_base::add_input_section
8379         returns true.
8380
8381 2010-04-07  Doug Kwan  <dougkwan@google.com>
8382
8383         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
8384         if section is marked as containing instructions but has no mapping
8385         symbols.
8386         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
8387         correct section index.
8388         (Arm_relobj::find_linked_text_section): Ditto.
8389
8390 2010-04-07  Cary Coutant  <ccoutant@google.com>
8391
8392         * archive.cc (include_member): Destroy Read_symbols_data object before
8393         releasing file.
8394         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
8395         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
8396         (Read_symbols_data::~Read_symbols_data) New destructor.
8397         (Section_relocs::Section_relocs) New constructor.
8398         (Section_relocs::~Section_relocs) New destructor.
8399         (Read_relocs_data::Read_relocs_data) New constructor.
8400         (Read_relocs_data::~Read_relocs_data) New destructor.
8401         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
8402         pointers to NULL after deleting.
8403
8404 2010-04-07  Doug Kwan  <dougkwan@google.com>
8405
8406         * arm.cc: Replace "endianity" with "endianness" in comments.
8407         (Arm_exidx_cantunwind): Ditto.
8408         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
8409         (Arm_relobj::merge_flags_and_attributes): New method.
8410         (Arm_relobj::merge_flags_and_attributes_): New data member.
8411         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
8412         (Arm_relobj::scan_sections_for_stubs): Ditto.
8413         (Arm_relobj::do_read_symbols): Check to see if we really want to
8414         merge processor-specific flags and attributes.  Exit early if
8415         an object is empty except for section names and the undefined symbol.
8416         (Target_arm::do_finalize_sections): Move check for ELF format to
8417         Arm_relobj::do_read_symbols.  Merge processor specific flags and
8418         attributes from a regular object only when we have determined that
8419         it is aapropriate.  Do not create an .ARM.attributes section in
8420         output if there is no regular input object.
8421         (Target_arm::merge_processor_specific_flags): Check
8422         --warn-mismatch before printing any error.
8423         (Target_arm::merge_object_attributes): Ditto.
8424         * gold.cc (queue_middle_tasks): Handle the case in which there is
8425         no regular object in input.
8426         * options.cc (General_options::parse_EB): New method.
8427         (General_options::parse_EL): Same.
8428         (General_options::General_options): Initialize endianness_.
8429         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
8430         New options.
8431         (General_options::Endianness): New enum.
8432         (General_options::endianness): New method.
8433         (General_options::endianness_): New data member.
8434         * parameters.cc (Parameters::set_options): Check target endianness.
8435         (Parameters::set_target_once): Ditto.
8436         (Parameters::check_target_endianness): New method.
8437         (parameters_force_valid_target): If either -EL or -EB is specified,
8438         use it to define endianness of default target.
8439         * parameters.h (Parameters::check_target_endianness): New method
8440         declaration.
8441         * target.h (class Target): Change "endianity" to "endianness"
8442         in comments.
8443
8444 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8445
8446         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
8447         * configure: Regenerate.
8448         * Makefile.in: Regenerate.
8449         * testsuite/Makefile.in: Regenerate.
8450
8451 2010-04-06  Cary Coutant  <ccoutant@google.com>
8452
8453         gcc PR lto/42757
8454         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
8455         prevailing definitions of common symbols.
8456         * testsuite/plugin_test_6.sh: New test case.
8457         * testsuite/plugin_common_test_1.c: New test case.
8458         * testsuite/plugin_common_test_2.c: New test case.
8459         * testsuite/Makefile.am (plugin_test_6): New test case.
8460         * testsuite/Makefile.in: Regenerate.
8461
8462 2010-04-06  Nick Clifton  <nickc@redhat.com>
8463
8464         * po/vi.po: New Vietnamese translation.
8465
8466 2010-03-30  Doug Kwan  <dougkwan@google.com>
8467
8468         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
8469
8470 2010-03-25  Doug Kwan  <dougkwan@google.com>
8471
8472         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
8473         to avoid a conversion warning on a 32-bit host.
8474
8475 2010-03-24  Ian Lance Taylor  <iant@google.com>
8476
8477         * testsuite/script_test_3.t: Add a TLS segment.
8478         * testsuite/Makefile.am (check_PROGRAMS): Add
8479         tls_phdrs_script_test.
8480         (tls_phdrs_script_test_SOURCES): Define.
8481         (tls_phdrs_script_test_DEPENDENCIES): Define.
8482         (tls_phdrs_script_test_LDFLAGS): Define.
8483         (tls_phdrs_script_test_LDADD): Define.
8484         * testsuite/Makefile.in: Rebuild.
8485
8486 2010-03-23  Cary Coutant  <ccoutant@google.com>
8487
8488         * fileread.cc (find_or_make_view): Fix comment.
8489
8490 2010-03-23  Ian Lance Taylor  <iant@google.com>
8491
8492         * script-sections.cc (class Orphan_section_placement): Define
8493         PLACE_TLS and PLACE_TLS_BSS.
8494         (Orphan_section_placement::Orphan_section_placement): Initialize
8495         new places.
8496         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
8497         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
8498         (tls_script_test_SOURCES): Define.
8499         (tls_script_test_DEPENDENCIES): Define.
8500         (tls_script_test_LDFLAGS): Define.
8501         (tls_script_test_LDADD): Define.
8502         * testsuite/Makefile.in: Rebuild.
8503
8504 2010-03-22  Doug Kwan  <dougkwan@google.com>
8505
8506         * arm.cc (Arm_relocate_functions::abs8,
8507         Arm_relocate_functions::abs16): Use correct check for overflow
8508         specified in the ARM ELF specs.
8509         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
8510         target of a BLX instruction specially.
8511         (Reloc_stub::stub_type_for_reloc): Ditto.
8512         (Relocate::relocate): Use symbolic names instead of numeric relocation
8513         codes to report error.
8514         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
8515         workaround.
8516         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
8517         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
8518         thumb2_blx_out_of_range.stdout
8519         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
8520         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
8521         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
8522         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
8523         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
8524         thumb2_blx_in_range, thumb2_blx_in_range.o,
8525         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
8526         thumb2_blx_out_of_range.o): New rules.
8527         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
8528         thumb2_blx_in_range and thumb2_blx_out_of_range.
8529         * testsuite/Makefile.in: Regenerate.
8530         * arm_branch_in_range.sh: Add tests for THUMB BLX.
8531         * testsuite/thumb_blx_in_range.s: New file.
8532         * testsuite/thumb_blx_out_of_range.s: New file.
8533
8534 2010-03-22  Rafael Espindola  <espindola@google.com>
8535
8536         * archive.cc (Should_include): Move to archive.h.
8537         (should_include_member): Make it a member of Archive.
8538         (Lib_group): New.
8539         (Add_lib_group_symbols): New.
8540         * archive.h: Include options.h.
8541         (Archive_member): Moved from Archive.
8542         (Should_include): Moved from archive.cc.
8543         (Lib_group): New.
8544         (Add_lib_group_symbols): New.
8545         * dynobj.cc (do_should_include_member): New.
8546         * dynobj.h (do_should_include_member): New.
8547         * gold.cc (queue_initial_tasks): Update call to queue.
8548         * main.cc (main): Print lib group stats.
8549         * object.cc (do_should_include_member): New.
8550         * object.h: Include archive.h.
8551         (Object::should_include_member): New.
8552         (Object::do_should_include_member): New.
8553         (Sized_relobj::do_should_include_member): New.
8554         * options.cc (General_options::parse_start_lib): New.
8555         (General_options::parse_end_lib): New.
8556         (Input_arguments::add_file): Handle lib groups.
8557         (Input_arguments::start_group): Check we are not in a lib.
8558         (Input_arguments::start_lib): New.
8559         (Input_arguments::end_lib): New.
8560         * options.h (General_options): Add start_lib and end_lib.
8561         (Input_argument::lib_): New.
8562         (Input_argument::lib): New.
8563         (Input_argument::is_lib): New.
8564         (Input_file_lib): New.
8565         (Input_arguments::in_lib_): New.
8566         (Input_arguments::in_lib): New.
8567         (Input_arguments::start_lib): New.
8568         (Input_arguments::end_lib_): New.
8569         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
8570         in unused members as preempted.
8571         (Sized_pluginobj::do_should_include_member): New.
8572         * plugin.h (Sized_pluginobj::do_should_include_member): New.
8573         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
8574         return the blocker.
8575         (Read_symbols::do_whole_lib_group): New.
8576         (Read_symbols::do_lib_group): New.
8577         (Read_symbols::do_read_symbols): Handle lib groups.
8578         (Read_symbols::get_name): Handle lib groups.
8579         * readsyms.h (Read_symbols): Add an archive member pointer.
8580         (Read_symbols::do_whole_lib_group): New.
8581         (Read_symbols::do_lib_group): New.
8582         (Read_symbols::member_): New.
8583         * script.cc (read_input_script): Update call to queue_soon.
8584
8585 2010-03-19  Doug Kwan  <dougkwan@google.com>
8586
8587         * arm.cc (Stub_table::Stub_table): Initialize new data members
8588         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
8589         (Stub_table::add_reloc_stub): Assign stub offset and update
8590         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
8591         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
8592         New data members.
8593         (Stub_table::update_data_size_and_addralign): Use
8594         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
8595         instead of going over all reloc stubs.
8596         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
8597         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
8598         Stringpool_template::offset_ to size of Stringpool_char.
8599         (Stringpool_template::new_key_offset): Remove code to initialize
8600         Stringpool_template::offset_.
8601         * stringpool.h (Stringpool_template::set_no_zero_null): Set
8602         Stringpool_template::offset_ to zero.
8603
8604 2010-03-15  Doug Kwan  <dougkwan@google.com>
8605
8606         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
8607         offset_.
8608         (Stringpool_template::new_key_offset): New method.
8609         (Stringpool_template::add_string): Assign offsets when adding new
8610         strings.
8611         (Stringpool_template::set_string_offsets): Do not set string offsets
8612         when not optimizing.
8613         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
8614         member size_.
8615         (Chunked_vector::clear): Clear size_.
8616         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
8617         (Chunked_vector::size): Return size_.
8618         (Chunked_vector::push_back): Use size_ to find insert position.
8619         (Chunked_vector::size_): New data member.
8620         (Stringpool_template::set_no_zero_null): Assert string set is empty.
8621         (Stringpool_template::new_key_offset): New method declaration.
8622         (Stringpool_template::offset_): New data member.
8623
8624 2010-03-15   Rafael Espindola  <espindola@google.com>
8625
8626         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
8627         Add_symbols' constructor.
8628         * readsyms.h (Add_symbols): Remove the input_group member.
8629
8630 2010-03-10  Ian Lance Taylor  <iant@google.com>
8631
8632         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
8633         target to ask whether a reference to a symbol requires a stack
8634         split.
8635         * target.h (Target::is_call_to_non_split): New function.
8636         (Target::do_is_call_to_non_split): Declare virtual function.
8637         * target.cc: Include "symtab.h".
8638         (Target::do_is_call_to_non_split): New function.
8639         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
8640
8641 2010-03-10  Cary Coutant  <ccoutant@google.com>
8642
8643         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
8644         (File_read::open[1]): Remove initial mapping of whole_file_view_.
8645         (File_read::open[2]): Add whole_file_view_ to list of views.
8646         (File_read::make_view): Remove test of whole_file_view_.
8647         (File_read::find_or_make_view): Create whole_file_view_ if
8648         necessary.
8649         (File_read::clear_views): Replace bool parameter with enum;
8650         adjust all callers.  Don't delete views with permanent data;
8651         do delete cached views and views from archives if
8652         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
8653         if clearing the corresponding view.
8654         * fileread.h (File_read::Clear_views_mode): New enum.
8655         (File_read::View::is_permanent_view): New method.
8656         (File_read::clear_views): Replace bool parameter
8657         with enum; adjust all callers.
8658         * options.h (General_options): Change keep_files_mapped option;
8659         add map_whole_files.
8660         * readsyms.cc (Add_symbols::run): Delete sd_ object before
8661         releasing the file.
8662         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
8663         the file.
8664
8665 2010-03-10  David S. Miller  <davem@davemloft.net>
8666
8667         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
8668
8669 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
8670
8671         * icf.cc (get_section_contents): Add '@' marker after processing the
8672         merge reloc.
8673
8674 2010-03-08  Doug Kwan  <dougkwan@google.com>
8675
8676         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
8677         due to a conversion warning.
8678         (Arm_relobj::update_output_local_symbol_count): Check for local
8679         symbol with unset output index.
8680
8681 2010-03-05  Ian Lance Taylor  <iant@google.com>
8682
8683         * options.h (class General_options): Add --spare-dynamic-tags.
8684         * output.cc (Output_data_dynamic::set_final_data_size): Implement
8685         --spare-dynamic-tags.
8686
8687 2010-03-05  Ian Lance Taylor  <iant@google.com>
8688
8689         * incremental.cc: Include "libiberty.h".
8690
8691 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
8692
8693         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
8694         function, is_info_ member.
8695         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
8696         (Versions::Versions): Update caller.
8697         (Versions::define_base_version): Likewise.
8698         (Versions::add_def): Likewise.
8699
8700 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
8701
8702         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
8703         (Scan::possible_function_pointer_reloc): New function.
8704         (Scan::local_reloc_may_be_function_pointer): Change to call
8705         possible_function_pointer_reloc.
8706         (Scan::global_reloc_may_be_function_pointer): Ditto.
8707         * icf.h (Icf::check_section_for_function_pointers): Change to reject
8708         relocations in ".data.rel.ro._ZTV" section.
8709         * testsuite/icf_safe_so_test.sh: Change to pass i386.
8710         * testsuite/icf_safe_so_test.cc: Ditto.
8711         * testsuite/icf_safe_test.cc: Ditto.
8712         * testsuite/icf_safe_test.sh: Ditto.
8713
8714 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8715             Ian Lance Taylor  <iant@google.com>
8716
8717         * target-reloc.h (relocate_section): Check the symbol table index
8718         for -1U before setting the local symbol index.
8719         (scan_relocatable_relocs): If copying the relocation, record that
8720         the local symbol is required.
8721         * object.h (Symbol_value::is_output_symtab_index_set): New
8722         function.
8723         (Symbol_value::may_be_discarded_from_output_symtab): New
8724         function.
8725         (Symbol_value::has_output_symtab_entry): New function.
8726         (Symbol_value::needs_output_symtab_entry): Remove.
8727         (Symbol_value::output_symtab_index): Make sure the symbol index is
8728         set.
8729         (Symbol_value::set_output_symtab_index): Make sure the symbol
8730         index is not set.  Make sure the new index is valid.
8731         (Symbol_value::set_must_have_output_symtab_entry): New function.
8732         (Symbol_value::has_output_dynsym_entry): New function.
8733         (Symbol_value::set_output_dynsym_index): Make sure the new index
8734         is valid.
8735         (Sized_relobj::set_must_have_output_symtab_entry): New function.
8736         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
8737         local symbol if permitted.
8738         (Sized_relobj::do_finalize_local_symbols): Call
8739         is_output_symtab_index_set rather than needs_output_symtab_entry.
8740         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
8741         rather than needs_output_symtab_entry.  Call
8742         has_output_dynsym_entry rather than needs_output_dynsym_entry.
8743         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
8744         is_output_symtab_index_set rather than needs_output_symtab_entry.
8745         * testsuite/discard_locals_relocatable_test.c: New file.
8746         * testsuite/discard_locals_test.sh: Test -r.
8747         * testsuite/Makefile.am (check_DATA): Add
8748         discard_locals_relocatable_test1.syms,
8749         discard_local_relocatable_test2.syms.
8750         (MOSTLYCLEANFILES): Likewise.  Also add
8751         discard_locals_relocatable_test1.lout and
8752         discard_locals_relocatable_test2.out.
8753         (discard_locals_relocatable_test1.syms): New target.
8754         (discard_locals_relocatable_test.o): New target.
8755         (discard_locals_relocatable_test1.out): New target.
8756         (discard_locals_relocatable_test2.syms): New target.
8757         (discard_locals_relocatable_test2.out): New target.
8758         (various): Add missing ../ld-new dependencies.
8759         * testsuite/Makefile.in: Rebuild.
8760
8761 2010-03-03  Nick Clifton  <nickc@redhat.com>
8762
8763         * po/fi.po: New Finnish translation.
8764
8765 2010-03-01  Doug Kwan  <dougkwan@google.com>
8766
8767         * layout.cc (Layout::Layout): Force section types of .init_array*,
8768         .preinit_array* and .fini_array* sections.
8769         * output.cc (Output_section::Input_section_sort_entry::has_priority):
8770         Fix check of return value of std::string::find.().
8771         (Output_section::Input_section_sort_compare::operator()): Remove
8772         comment about .init_array.
8773         (Output_section::Input_section_sort_init_fini_compare::operator()):
8774         New method.
8775         (Output_section::sort_attached_input_sections): Handle .init_array
8776         and .fini_array specially.
8777         * output.h (Output_section::Inut_section_sort_compare): Update
8778         comment.
8779         (Output_section::Input_section_sort_init_fini_compare): New struct.
8780
8781 2010-02-26  Doug Kwan  <dougkwan@google.com>
8782
8783         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
8784         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
8785         * testsuite/debug_msg.sh: Avoid matching source line number for
8786         use of global variable undef_int.
8787
8788 2010-02-26  Doug Kwan  <dougkwan@google.com>
8789
8790         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
8791         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
8792         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
8793         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
8794         * options.cc (General_options::General_options): Initialize member
8795         fix_v4bx_.
8796         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
8797         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
8798         and rm_no_fix_v4bx.stdout
8799         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
8800         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
8801         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
8802         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
8803         and arm_no_fix_v4bx.
8804         * Makefile.in: Regenerate.
8805         * testsuite/arm_fix_v4bx.s: New file.
8806         * testsuite/arm_fix_v4bx.sh: Ditto.
8807
8808 2010-02-24  Doug Kwan  <dougkwan@google.com>
8809
8810         * arm.cc (Target_arm::got_section): Make the .got section the first
8811         non RELRO section in the data segment.
8812         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
8813         suffixes of section names.
8814
8815 2010-02-24  Doug Kwan  <dougkwan@google.com>
8816
8817         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
8818         flags and attributes merging if an input file is a binary file.
8819         * fileread.cc (Input_file::open): Record format of original file.
8820         * fileread.h (Input_file::Format): New enum type.
8821         (Input_file::Input_file): Initialize data member format_.
8822         (Input_file::format): New method definition.
8823         (Input_file::format_):: New data member.
8824
8825 2010-02-24  Doug Kwan  <dougkwan@google.com>
8826
8827         * arm.cc (Arm_output_data_got): New class.
8828         (ARM_TCB_SIZE): New constant
8829         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
8830         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
8831         If user uses a script with a SECTIONS clause, issue only a warning
8832         for a misplaced EXIDX input section.  Otherwise, issue an error.
8833         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
8834         garbage collection.
8835         (Target_arm::got_mode_index_entry): Handle static linking.
8836         (Target_arm::Scan::local): Ditto.
8837         (Target_arm::Scan::global): Ditto.
8838         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
8839         all incorrectly implemented relocations.
8840         (Target_arm::fix_exidx_coverage): Pass layout to
8841         Arm_output_section::fix_exidx_coverage.
8842         * layout.cc (Layout::section_name_mapping): Remove trailing dots
8843         from ".ARM.exidx." and ".ARM.extab.".
8844
8845 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8846
8847         * arm.cc (Target_arm::do_finalize_sections): Create attribute
8848         section if it does not already exist.
8849         * attributes.cc (Attributes_section_data::Attributes_section_data):
8850         Don't crash if size is zero.
8851
8852 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8853             Ian Lance Taylor  <iant@google.com>
8854
8855         * gold.cc (queue_middle_tasks): If no input files were opened,
8856         exit.
8857         * workqueue.h (Task_function::Task_function): Assert that there is
8858         a blocker.
8859
8860 2010-02-22  Doug Kwan  <dougkwan@google.com>
8861
8862         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
8863         * icf.cc (get_section_contents): Cast snprintf arguments to long long
8864         types to avoid warnings due to different uint64_t implementations
8865         on different hosts.
8866
8867 2010-02-21  Doug Kwan  <dougkwan@google.com>
8868
8869         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
8870         handling of the maximum backward branch offset.
8871         (Arm_relocate_functions::thumb_branch_common): Ditto.
8872         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
8873         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
8874         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
8875         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
8876         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
8877         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
8878         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
8879         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
8880         thumb_bl_out_of_range thumb_bl_out_of_range.o,
8881         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
8882         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
8883         thumb2_bl_out_of_range.o): New rules.
8884         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
8885         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
8886         thumb2_bl_out_of_range
8887         * testsuite/Makefile.in: Regenerate.
8888         * testsuite/arm_bl_in_range.s: New file.
8889         * testsuite/arm_bl_out_of_range.s: Ditto.
8890         * testsuite/arm_branch_in_range.sh: Ditto.
8891         * testsuite/arm_branch_range.t: Ditto.
8892         * testsuite/thumb2_branch_range.t: Ditto.
8893         * testsuite/thumb_bl_in_range.s: Ditto.
8894         * testsuite/thumb_bl_out_of_range.s: Ditto.
8895         * testsuite/thumb_branch_range.t: Ditto.
8896
8897 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
8898
8899         * gc.h (gc_process_relocs): Change vectors to point to the new list.
8900         Add reloc offset information.
8901         * icf.cc (get_section_contents): Change iterators to point to the new
8902         vectors. Add reloc offset information to the contents.
8903         * icf.h (Icf::Sections_reachable_info): New typedef.
8904         (Icf::Sections_reachable_list): New typedef.
8905         (Icf::Offset_info): New typedef.
8906         (Icf::Reloc_info): New struct typedef.
8907         (Icf::Reloc_info_list): New typedef.
8908         (Icf::symbol_reloc_list): Delete method.
8909         (Icf::addend_reloc_list): Delete method.
8910         (Icf::section_reloc_list): Delete method.
8911         (Icf::reloc_info_list): New method.
8912         (Icf::reloc_info_list_): New member.
8913
8914 2010-02-19  Doug Kwan  <dougkwan@google.com>
8915
8916         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
8917         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
8918         * arm.cc (Arm_relocation_functions): New forward declaration.
8919         (Target_arm::Target_arm): Initialize new data members
8920         got_mod_index_offset_ and tls_base_symbol_defined_.
8921         (Target_arm::Relocate::relocate_tls): New method.
8922         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
8923          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
8924         New methods.
8925         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
8926         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
8927         (Target_arm::got_mod_index_offset_,
8928         Target_arm::tls_base_symbol_defined_): New data members.
8929         (Target_arm::Scan::local, Target::Scan::global,
8930         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
8931         relocations.
8932
8933 2010-02-18  Doug Kwan  <dougkwan@google.com>
8934
8935         * arm.cc (Arm_relobj::find_linked_text_section): New method.
8936         (Arm_relobj::make_exidx_input_section): Pass section index of linked
8937         text section as a parameter becuase some broken tools may not set
8938         the link in section header.
8939         (Target_arm::has_got_section): New method.
8940         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
8941         without any mapping symbol as data only.  Remove warning.
8942         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
8943         link in its section header, try to discover the link by inspecting the
8944         REL31 relocation at the beginning of the section.
8945         (Target_arm::Scan::check_non_pic): Report name of offending relocation
8946         in error message.
8947         (Target_arm::Scan::global): Treat any reference to the symbol
8948         _GLOBAL_OFFSET_TABLE_ as a GOT access.
8949
8950 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
8951
8952         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
8953         (Scan::global_reloc_may_be_function_pointer): New function.
8954         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
8955         (Scan::global_reloc_may_be_function_pointer): New function.
8956         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
8957         (Scan::global_reloc_may_be_function_pointer): New function.
8958         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
8959         (Scan::global_reloc_may_be_function_pointer): New function.
8960         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
8961         (Scan::global_reloc_may_be_function_pointer): New function.
8962         (Scan::possible_function_pointer_reloc): New function.
8963         (Target_x86_64::can_check_for_function_pointers): New function.
8964         * gc.h (gc_process_relocs): Scan relocation types to determine if
8965         function pointers were taken for targets that support it.
8966         * icf.cc (Icf::find_identical_sections): Include functions for
8967         folding in safe ICF whose pointer is not taken.
8968         * icf.h (Secn_fptr_taken_set): New typedef.
8969         (fptr_section_id_): New member.
8970         (section_has_function_pointers): New function.
8971         (set_section_has_function_pointers): New function.
8972         (check_section_for_function_pointers): New function.
8973         * options.h: Fix comment for safe ICF option.
8974         * target.h (can_check_for_function_pointers): New function.
8975         * testsuite/Makefile.am: Add icf_safe_so_test test case.
8976         Modify icf_safe_test for X86-64.
8977         * testsuite/Makefile.in: Regenerate.
8978         * testsuite/icf_safe_so_test.cc: New file.
8979         * testsuite/icf_safe_so_test.sh: New file.
8980         * testsuite/icf_safe_test.cc (kept_func_3): New function.
8981         (main): Change to take pointer to function kept_func_3.
8982         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
8983         folding is done correctly for X86-64.
8984
8985 2010-02-12  David S. Miller  <davem@davemloft.net>
8986
8987         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
8988         is_symbolless parameter.
8989         (Output_reloc<SHT_REL>::is_symbolless): New.
8990         (Output_reloc<SHT_REL>::is_symbolless_): New.
8991         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
8992         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
8993         (Output_reloc<SHT_RELA>::is_symbolless): New.
8994         (Output_data_reloc::add_global): Handle is_symbolless.
8995         (Output_data_reloc::add_global_relative): Likewise.
8996         (Output_data_reloc::add_local): Likewise.
8997         (Output_data_reloc::add_local_relative): Likewise.
8998         (Output_data_reloc::add_symbolless_global_addend): New.
8999         (Output_data_reloc::add_symbolless_local_addend): New.
9000         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
9001         is_symbolless.
9002         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
9003         instead of ->is_relative_
9004         (Output_reloc::write): Likewise.
9005         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
9006         (Output_reloc::write_rel): Simplify.
9007
9008         * sparc.cc (Target_sparc::Scan::local): Use
9009         ->add_symbolless_local_addend as needed.
9010         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
9011         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
9012         based upon relocation offset.
9013
9014 2010-02-11  Doug Kwan  <dougkwan@google.com>
9015
9016         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
9017         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
9018         beginning of function.
9019         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
9020         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
9021         parameter is_32bit in calls to should_apply_static_reloc.
9022         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
9023         (check_DATA): Add arm_abs_global.stdout.
9024         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
9025         arm_abs_global.stdout): New rules.
9026         (MOSTLLYCLEANFILES): Add arm_abs_global
9027         * Makefile.in: Regenerate.
9028         * testsuite/arm_abs_global.s: New file.
9029         * testsuite/arm_abs_global.sh: Ditto.
9030         * testsuite/arm_abs_lib.s: Ditto.
9031
9032 2010-02-11  Ian Lance Taylor  <iant@google.com>
9033
9034         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
9035         Read_relocs task.
9036         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
9037         Allocate_commons_task first.
9038         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
9039         task, rather than symtab_lock_.
9040         (Gc_process_relocs::~Gc_process_relocs): New function.
9041         (Gc_process_relocs::is_runnable): Check this_blocker_.
9042         (Gc_process_relocs::locks): Use next_blocker_ rather than
9043         blocker_.
9044         (Scan_relocs::~Scan_relocs): New function.
9045         (Scan_relocs::is_runnable): Check this_blocker_ rather than
9046         symtab_lock_.
9047         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
9048         next_blocker_.
9049         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
9050         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
9051         constructor accordingly.
9052         (class Gc_process_relocs): Likewise.
9053         (class Scan_relocs): Likewise.
9054         * common.h (class Allocate_commons_task): Remove symtab_lock_
9055         field, and corresponding constructor parameter.
9056         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
9057         symtab_lock_.
9058         (Allocate_commons_task::locks): Likewise.
9059
9060 2010-02-11  Ian Lance Taylor  <iant@google.com>
9061
9062         * gold-threads.h (class Once): Define.
9063         (class Initialize_lock): Rewrite as child of Once.
9064         * gold-threads.cc (class Once_initialize): Define.
9065         (once_pointer_control): New static variable.
9066         (once_pointer, once_arg): New static variables.
9067         (c_run_once): New static function.
9068         (Once::Once, Once::run_once, Once::internal_run): New functions.
9069         (class Initialize_lock_once): Remove.
9070         (initialize_lock_control): Remove.
9071         (initialize_lock_pointer): Remove.
9072         (initialize_lock_once): Remove.
9073         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
9074         (Initialize_lock::initialize): Rewrite.
9075         (Initialize_lock::do_run_once): New function.
9076         * archive.cc (Archive::interpret_header): Only clear name if it is
9077         not already empty.
9078         * fileread.cc: Include "gold-threads.h"
9079         (file_counts_lock): New static variable.
9080         (file_counts_initialize_lock): Likewise.
9081         (File_read::release): Only increment counts when using --stats.
9082         Use a lock around the increment.
9083         * parameters.cc (class Set_parameters_target_once): Define.
9084         (set_parameters_target_once): New static variable.
9085         (Parameters::Parameters): Move here from parameters.h.
9086         (Parameters::set_target): Rewrite.
9087         (Parameters::set_target_once): New function.
9088         (Parameters::clear_target): Move here and rewrite.
9089         * parameters.h (class Parameters): Update declarations.  Add
9090         set_parameters_target_once_ field.
9091         (Parameters::Parameters): Move to parameters.cc.
9092         (Parameters::clear_target): Likewise.
9093         * readsyms.cc (Read_symbols::do_group): Create a Start_group
9094         task.
9095         (Start_group::~Start_group): New function.
9096         (Start_group::is_runnable): New function.
9097         (Start_group::locks, Start_group::run): New functions.
9098         (Finish_group::run): Change saw_undefined to size_t.
9099         * readsyms.h (class Start_group): Define.
9100         (class Finish_group): Change saw_undefined_ field to size_t.
9101         (Finish_group::Finish_group): Remove saw_undefined and
9102         this_blocker parameters.  Change all callers.
9103         (Finish_group::set_saw_undefined): New function.
9104         (Finish_group::set_blocker): New function.
9105         * symtab.h (class Symbol_table): Change saw_undefined to return
9106         size_t.  Change saw_undefined_ field to size_t.
9107         * target-select.cc (Set_target_once::do_run_once): New function.
9108         (Target_selector::Target_selector): Initialize set_target_once_
9109         field.  Don't initialize lock_ and initialize_lock_ fields.
9110         (Target_selector::instantiate_target): Rewrite.
9111         (Target_selector::set_target): New function.
9112         * target-select.h (class Set_target_once): Define.
9113         (class Target_selector): Update declarations.  Make
9114         Set_target_once a friend.  Remove lock_ and initialize_lock_
9115         fields.  Add set_target_once_ field.
9116
9117 2010-02-10  Ian Lance Taylor  <iant@google.com>
9118
9119         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
9120         queueing any tasks.
9121         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
9122         (queue_middle_tasks): Add all blockers before queueing any tasks.
9123         (queue_final_tasks): Likewise.
9124         * token.h (Task_token::add_blockers): New function.
9125         * object.h (Input_objects::number_of_relobjs): New function.
9126
9127 2010-02-10  Ian Lance Taylor  <iant@google.com>
9128
9129         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
9130         shared, not if not position independent.
9131         * x86_64.cc (Relocate::relocate_tls): Likewise.
9132         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
9133         (tls_pie_pic_test): New target.
9134         * testsuite/Makefile.in: Rebuild.
9135
9136         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
9137         (tls_test_main_pie.o, tls_test_pie.o): New targets.
9138         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
9139         * testsuite/Makefile.in: Rebuild.
9140
9141 2010-02-09  David S. Miller  <davem@davemloft.net>
9142
9143         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
9144         R_SPARC_RELATIVE using ->add_local_relative().
9145         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
9146
9147         * output.h (Output_data_dynamic::add_section_size): New method
9148         that takes two Output_data objects.
9149         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
9150         entry param.  Handle it in initializers.
9151         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
9152         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
9153         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
9154         arg.
9155         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
9156         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
9157         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
9158         for dynrel_includes_plt.
9159         * i386.cc (Target_i386::do_finalize_sections): Likewise.
9160         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
9161         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
9162         before .rela.plt
9163         (Target_sparc::do_finalize_sections): Update to pass true for
9164         dynrel_includes_plt.
9165         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
9166         output before .rela.plt
9167         (Target_powerpc::do_finalize_sections): Update to pass true for
9168         dynrel_includes_plt when 32-bit.
9169
9170 2010-02-08  Doug Kwan  <dougkwan@google.com>
9171
9172         * arm.cc (Arm_relobj::simple_input_section_output_address): New
9173         method.
9174         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
9175         Arm_relobj::scan_section_for_cortex_a8_stubs,
9176         Arm_relobj::do_relocation_section): Instead of calling
9177         Output_section::output_address, use faster
9178         Arm_relobj::simple_input_section_output_address.
9179
9180 2010-02-08  David S. Miller  <davem@davemloft.net>
9181
9182         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
9183         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
9184         relocation helper function.
9185
9186         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
9187         just like R_SPARC_GOT{10,13,22}.
9188         (Target_sparc::Scan::local): Likewise.
9189         (Target_sparc::Relocate:relocate): Likewise.
9190
9191 2010-02-06  Ian Lance Taylor  <iant@google.com>
9192
9193         * configure.ac: Rewrite targetobjs duplicate removal code to use
9194         only shell constructs.
9195         * configure: Rebuild.
9196
9197 2010-02-05  Doug Kwan  <dougkwan@google.com>
9198
9199         PR 11247
9200         * arm.cc (Arm_relobj::section_is_scannable): New method.
9201         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
9202         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
9203
9204 2010-02-04  Doug Kwan  <dougkwan@google.com>
9205
9206         PR 11247
9207         * arm-reloc-property.cc (cstdio): Include.
9208         * configure.ac (targetobjs): Remove duplicates.
9209         * configure: Regenerate.
9210         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
9211         big and little endian version for a given address size.
9212
9213 2010-02-03  Doug Kwan  <dougkwan@google.com>
9214
9215         * arm-reloc-property.cc
9216         (Arm_reloc_property_table::reloc_name_in_error_message): New method
9217         definition.
9218         * arm-reloc-property.h
9219         (Arm_reloc_property_table::get_implemented_static_reloc_property):
9220         New method definition.
9221         (Arm_reloc_property_table::reloc_name_in_error_message): New method
9222         declaration.
9223         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
9224         overflow to N.
9225         (GOT_PREL): Change implemented to Y.
9226         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
9227         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
9228         (Arm_relocate_functions::movw_abs_nc): Remove method.
9229         (Arm_relocate_functions::movt_abs): Ditto.
9230         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
9231         (Arm_relocate_functions::thm_movt_abs): Ditto.
9232         (Arm_relocate_functions::movw_rel_nc): Ditto.
9233         (Arm_relocate_functions::movw_rel): Ditto.
9234         (Arm_relocate_functions::movt_rel): Ditto.
9235         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
9236         (Arm_relocate_functions:thm_movw_rel): Ditto.
9237         (Arm_relocate_functions:thm_movt_rel): Ditto.
9238         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
9239         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
9240         New method definitions.
9241         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
9242         (Arm_relocation_functions::arm_grp_ldr): Ditto.
9243         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
9244         (Arm_relocation_functions::arm_grp_ldc): Ditto.
9245         (Target_arm::Relocate::relocate): Check for non-static or
9246         unimplemented relocation code and exit early.  Change calls to
9247         Target_arm::reloc_uses_thumb_bit and
9248         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
9249         instead.  Refactor code to handle similar relocations to increase
9250         code sharing.  Remove check for unsupported relocation code in switch
9251         statement.
9252         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
9253         relocation property table to find out size.  Change error message to
9254         print out the name of a relocation code instead of the numeric value.
9255         (Target_arm::scan_reloc_for_stub): Use relocation property table
9256         instead of calling Target_arm::reloc_uses_thumb_bit().
9257
9258 2010-02-02  Doug Kwan  <dougkwan@google.com>
9259
9260         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
9261         types of relaxed input section.
9262
9263 2010-02-02  Doug Kwan  <dougkwan@google.com>
9264
9265         * Makefile.am (HFILES): Add arm-reloc-property.h.
9266         (DEFFILES): New.
9267         (TARGETSOURCES): Add arm-reloc-property.cc
9268         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
9269         (libgold_a_SOURCES): $(DEFFILES)
9270         * Makefile.in: Regenerate.
9271         * arm-reloc-property.cc: New file.
9272         * arm-reloc-property.h: New file.
9273         * arm-reloc.def: New file.
9274         * arm.cc: Update comments.
9275         (arm-reloc-property.h): New included header.
9276         (arm_reloc_property_table): New global variable.
9277         (Target_arm::do_select_as_default_target): New method definition.
9278         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
9279         arm-reloc-property to targ_extra_obj.
9280         * parameters.cc (set_parameters_target): Call
9281         Target::select_as_default_target().
9282         * target.h (Target::select_as_default_target): New method definition.
9283         (Target::do_select_as_default_target): Same.
9284
9285 2010-02-01  Doug Kwan  <dougkwan@google.com>
9286
9287         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
9288         first_output_text_section_.
9289         (Arm_exidx_fixup::first_output_text_section): New method definition.
9290         (Arm_exidx_fixup::first_output_text_section_): New data member.
9291         (Arm_exidx_fixup::process_exidx_section): Record the first text
9292         output section seen.
9293         (Arm_output_section::fix_exidx_coverage): Set correct linked section
9294         and entsize in output section header.
9295
9296 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9297
9298         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
9299         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
9300         (Arm_relocate_functions::thm_alu11): New Method.
9301         (Arm_relocate_functions::thm_pc8): New Method.
9302         (Arm_relocate_functions::thm_pc12): New Method.
9303         (Target_arm::Scan::local): Handle the relocations.
9304         (Target_arm::Scan::global): Likewise.
9305         (Target_arm::Relocate::relocate): Likewise.
9306         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9307
9308 2010-01-29  Doug Kwan  <dougkwan@google.com>
9309
9310         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
9311         of relocation types as ld.
9312
9313 2010-01-29  Doug Kwan  <dougkwan@google.com>
9314
9315         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
9316         to public.
9317         (Arm_relocate_functions::thumb_branch_common): Ditto.
9318         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
9319         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
9320         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
9321         Arm_relocate_functions::jump24): Remove.
9322         (Target_arm::Relocate::relocate): Adjust code to call
9323         Arm_relocation_functions::arm_branch_common and
9324         Arm_relocation_functions::thumb_branch_common instead of their removed
9325         wrappers.  Merge switch-cases together to reduce source code size.
9326
9327 2010-01-29  Doug Kwan  <dougkwan@google.com>
9328
9329         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
9330         output_local_symbol_count_needs_update_.
9331         (Arm_relobj::output_local_symbol_count_needs_update,
9332          Arm_relobj::set_output_local_symbol_count_needs_update,
9333          Arm_relobj::update_output_local_symbol_count): New methods.
9334         (Arm_relobj::output_local_symbol_count_needs_update_): New data
9335         member.
9336         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
9337         of pointed function as in a R_ARM_PREL31 relocation.
9338         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
9339         for output local symbol count updating.
9340         (Target_arm::do_relax): Update output local symbol counts in objects
9341         if necessary.
9342         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
9343
9344 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9345
9346         * arm.cc: Added support for the ARM relocations:
9347         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
9348         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
9349         (Arm_relocate_functions::movw_rel_nc): Renamed (was
9350         movw_prel_nc).
9351         (Arm_relocate_functions::movw_rel): New method.
9352         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
9353         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
9354         thm_movw_prel_nc).
9355         (Arm_relocate_functions::thm_movw_rel): New method.
9356         (Arm_relocate_functions::thm_movt_rel): Renamed (was
9357         thm_movt_prel).
9358         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
9359         relocations.
9360         (Target_arm::Scan::global): Likewise.
9361         (Target_arm::Relocate::relocate): Likewise.
9362         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9363         Likewise.
9364
9365 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9366
9367         * arm.cc: Added support for ARM group relocations.
9368         (Target_arm::reloc_needs_sym_origin): New method.
9369         (Arm_relocate_functions::calc_grp_kn): New method.
9370         (Arm_relocate_functions::calc_grp_residual): New method.
9371         (Arm_relocate_functions::calc_grp_gn): New method.
9372         (Arm_relocate_functions::arm_grp_alu): New Method.
9373         (Arm_relocate_functions::arm_grp_ldr): New Method.
9374         (Arm_relocate_functions::arm_grp_ldrs): New Method.
9375         (Arm_relocate_functions::arm_grp_ldc): New Method.
9376         (Target_arm::Scan::local): Handle the ARM group relocations.
9377         (Target_arm::Scan::global): Likewise.
9378         (Target_arm::Relocate::relocate): Likewise.
9379         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9380         Likewise.
9381
9382 2010-01-26  Doug Kwan  <dougkwan@google.com>
9383
9384         * arm.cc (set): Include.
9385         (class Arm_exidx_fixup): Change type of last_input_section_ to const
9386         pointer type.
9387         (Arm_output_section::Text_section_list): New type.
9388         (Arm_output_section::append_text_sections_to_list): New method.
9389         (Arm_output_section::fix_exidx_coverage): Ditto.
9390         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
9391         (Arm_relobj::convert_input_section_to_relaxed_section): Use
9392         Relobj::set_section_offset() instead of
9393         Sized_relobj::invalidate_section_offset().
9394         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
9395         parameter for section headers. Ignore relocation sections for
9396         unallocated sections and EXIDX sections.
9397         (Target_arm::fix_exidx_coverage): New method.
9398         (Target_arm::output_section_address_less_than): New type.
9399         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
9400         linked text section instead of the EXIDX section.
9401         (Arm_output_section::create_stub_group): Add an assertion to check
9402         that this is not an EXIDX output section.
9403         (Arm_output_section::append_text_sections_to_list): New method.
9404         (Arm_output_section::fix_exidx_coverage): Ditto.
9405         (Arm_relobj::scan_sections_for_stubs): Adjust call to
9406         Arm_relobj::section_needs_reloc_stub_scanning.
9407         (Target_arm::do_relax): Fix EXIDX output section coverage in the
9408         first pass.
9409         (Target_arm::fix_exidx_coverage): New method.
9410         * object.h (Relobj::set_output_section): New method.
9411         (Sized_relobj::invalidate_section_offset): Remove method.
9412         (Sized_relobj::do_invalidate_section_offset): Remove method.
9413         (Sized_relobj::do_set_section_offset): Handle offset value -1.
9414
9415 2010-01-25  Doug Kwan  <dougkwan@google.com>
9416
9417         * arm.cc (Arm_exidx_merged_section::do_output_offset):
9418         Fix warning due to signed and unsigned comparison on a 32-bit host.
9419
9420 2010-01-22  Doug Kwan  <dougkwan@google.com>
9421
9422         * arm.cc (Target_arm::do_relax): Record an output section for section
9423         offset adjustment it contains any stub table that has changed.
9424         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
9425         offsets in an output section if necessary.
9426         * output.cc (Output_section::Output_section): Initialize
9427         section_offsets_need_adjustments_.
9428         (Output_section::add_input_section_for_script): Renamed to
9429         Output_section::add_simple_input_section.
9430         (Output_section::save_states): Add a comment.
9431         (Output_section::discard_states): New method defintion.
9432         (Output_section::adjust_section_offsets): Same.
9433         * output.h (Output_section::add_input_section_for_script): Renamed to
9434         Output_section::add_simple_input_section.
9435         (Output_section::discard_states): New method declaration.
9436         (Output_section::adjust_section_offsets): Same.
9437         (Output_section::section_offsets_need_adjustment,
9438         Output_section::set_section_offsets_need_adjustment): New method
9439         definitions.
9440         (Output_section::section_offsets_need_adjustment_): New data member.
9441         * script-sections.cc
9442         (Output_section_element_input::set_section_address): Adjust code for
9443         renaming of Output_section::add_input_section_for_script.
9444         (Orphan_output_section::set_section_address): Same.
9445
9446 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9447
9448         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
9449         Fix_v4bx enum values .
9450         * gold/options.h (General_options): New option definitions.
9451         (General_options::fix_v4bx): New method.
9452         (General_options::Fix_v4bx): New enum.
9453         * gold/options.cc (General_options::parse_fix_v4bx): New method.
9454         (General_options::parse_fix_v4bx_interworking): New method.
9455
9456 2010-01-22  Doug Kwan  <dougkwan@google.com>
9457
9458         * arm.cc (Arm_exidx_fixup): New class.
9459
9460 2010-01-21  Doug Kwan  <dougkwan@google.com>
9461
9462         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
9463         classes.
9464         (Arm_exidx_section_offset_map): New type.
9465
9466 2010-01-21  Doug Kwan  <dougkwan@google.com>
9467
9468         * arm.cc (Arm_exidx_input_section): New class.
9469         (Arm_relobj::exidx_input_section_by_link,
9470         Arm_relobj::exidx_input_section_by_shndx,
9471         Arm_relobj::make_exidx_input_section): New methods.
9472         (read_arm_attributes_section): Remove.
9473         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
9474         information about them.
9475         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
9476         to here.
9477
9478 2010-01-20  Doug Kwan  <dougkwan@google.com>
9479
9480         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
9481         Input_section_specifier to Section_id.
9482         (Target_arm::new_arm_input_section: Adjust code for change of key
9483         type.
9484         (Target_arm::find_arm_input_section): Ditto.
9485         * gc.h (object.h): Include for Section_id nand Section_id_hash.
9486         (Section_id): Remove.
9487         (Garbage_collection::Section_id_hash): Remove.
9488         * icf.h (object.h): Include for Section_id nand Section_id_hash.
9489         (Section_id): Remove.
9490         (Icf::Section_id_hash): Remove.
9491         * object.h (Section_id, Const_section_id, Section_id_hash,
9492         Const_section_id_hash): New type definitions.
9493         * output.cc (Output_section::add_relaxed_input_section): Change to
9494         use Const_section_id instead of Input_section_specifier as key type.
9495         (Output_section::add_merge_input_section): Ditto.
9496         (Output_section::build_relaxation_map): Change to use Section_id
9497         instead of Input_section_specifier as key type.
9498         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
9499         Ditto.
9500         (Output_section::convert_input_sections_to_relaxed_sections): Change
9501         to use Const_section_id instead of Input_section_specifier as key type.
9502         (Output_section::find_merge_section): Ditto.
9503         (Output_section::find_relaxed_input_section): Ditto.
9504         * output.h (Input_section_specifier): Remove class.
9505         (Output_section::Output_section_data_by_input_section_map): Change
9506         key type to Const_section_id.
9507         (Output_section::Output_relaxed_input_section_by_input_section_map):
9508         Ditto.
9509         (Output_section::Relaxation_map): Change key type to Section_id.
9510
9511 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9512
9513         * gold/arm.cc: Added support for R_ARM_V4BX relocation
9514         (class Arm_v4bx_stub): New class.
9515         (DEF_STUBS): Updated definition to support v4_veneer_bx.
9516         (Stub_factory::make_arm_v4bx_stub): New method.
9517         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
9518         (Stub_table::empty): Handle v4bx stubs.
9519         (Stub_table::add_arm_v4bx_stub): New method.
9520         (Stub_table::find_arm_v4bx_stub): New method.
9521         (Arm_relocate_functions::v4bx): New method.
9522         (Target_arm::fix_v4bx): New method.
9523         (Target_arm::Target_arm): Handle R_ARM_V4BX.
9524         (Stub_table::relocate_stubs): Likewise.
9525         (Stub_table::do_write): Likewise.
9526         (Stub_table::update_data_size_and_addralign): Likewise.
9527         (Stub_table::finalize_stubs):  Likewise.
9528         (Target_arm::Scan::local): Likewise.
9529         (Target_arm::Scan::global): Likewise.
9530         (Target_arm::do_finalize_sections): Likewise.
9531         (Target_arm::Relocate::relocate): Likewise.
9532         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9533         Likewise.
9534         (Target_arm::scan_reloc_for_stub): Likewise.
9535         (Target_arm::scan_reloc_section_for_stubs): Likewise.
9536
9537 2010-01-19  Ian Lance Taylor  <iant@google.com>
9538
9539         * output.cc (Output_section_headers::do_sized_write): Write large
9540         segment count to sh_info field.
9541         (Output_file_header::do_sized_write): For large segment count,
9542         write PN_XNUM to e_phnum field.
9543
9544 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9545
9546         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
9547         (Arm_relocate_functions::thm_jump8): New function.
9548         (Arm_relocate_functions::thm_jump11): New function.
9549         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
9550         R_ARM_THM_JUMP11.
9551         (Target_arm::Scan::global): Likewise.
9552         (Target_arm::Relocate::relocate): Likewise.
9553         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9554         Likewise.
9555
9556 2010-01-14  Doug Kwan  <dougkwan@google.com>
9557
9558         * arm.cc (map, utility): Include headers.
9559         (Target_arm::apply_cortex_a8_workaround): New method.
9560         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
9561         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
9562         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
9563         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
9564         the --[no-]fix-cortex-a8 command line options.
9565         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
9566         (Target_arm::relocate_stub): Use addend in instruction template.
9567         * options.h (DEFINE_bool): Set the user-set flag.
9568         (General_options): Add --[no-]-fix-cortex options.
9569         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
9570         : Update fast look-up map after conversion.
9571
9572 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
9573
9574         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
9575         in the first pass of do_layout.
9576
9577 2010-01-13  Doug Kwan  <dougkwan@google.com>
9578
9579         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
9580         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
9581         apparent compiler problem of not folding static constant integral
9582         data members of elfcpp::Elf_sizes<32>.
9583
9584 2010-01-13  Doug Kwan  <dougkwan@google.com>
9585
9586         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
9587         Arm_relobj::section_needs_cortex_a8_stub_scanning,
9588         Arm_relobj::scan_section_for_cortex_a8_erratum,
9589         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
9590         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
9591         sections to scan for relocation stubs into a new method
9592         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
9593         relocation and Cortex-A8 stub scanning.
9594         (Target_arm::do_relax): Force stubs to be after stubbed sections
9595         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
9596         the beginning of a new relaxation pass.  Update a comment.
9597         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
9598
9599 2010-01-12  Ian Lance Taylor  <iant@google.com>
9600
9601         * target-reloc.h (visibility_error): New inline function.
9602         (relocate_section): Call visibility_error.
9603         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
9604         (MOSTLYCLEANFILES): Likewise.
9605         (protected_4_pic.o, protected_3.err): New targets.
9606         * testsuite/protected_4.cc: New file.
9607
9608 2010-01-12  Doug Kwan  <dougkwan@google.com>
9609
9610         * arm.cc (Cortex_a8_reloc): New class.
9611         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
9612         and cortex_a8_relocs_info_.
9613         (Target_arm::fix_cortex_a8): New method definition.
9614         (Target_arm::Cortex_a8_relocs_info): New type.
9615         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
9616         New data member declarations.
9617         (Target_arm::scan_reloc_for_stub): Record information about
9618         relocations for THUMB branches that might be exempted from the
9619         Cortex-A8 workaround.
9620         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
9621         at the beginning of a relaxation pass.
9622
9623 2010-01-12  Doug Kwan  <dougkwan@google.com>
9624
9625         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
9626         (Arm_relobj::Mapping_symbol_position,
9627          Arm_reloj::Mapping_symbol_position_less,
9628          Arm_relobj::Mapping_symbols_info): New types.
9629         (Target_arm::is_mapping_symbol_name): New method definition.
9630         (Arm_relobj::do_count_local_symbols): Save information about mapping
9631         symbols.
9632
9633 2010-01-11  Doug Kwan  <dougkwan@google.com>
9634
9635         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
9636         Arm_relocate_functions::thumb32_branch_upper,
9637         Arm_relocate_functions::thumb32_branch_lower,
9638         Arm_relocate_functions::thumb32_cond_branch_offset,
9639         Arm_relocate_functions::thumb32_cond_branch_upper,
9640         Arm_relocate_functions::thumb32_cond_branch_lower,
9641         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
9642         branch offset encoding.
9643         (Arm_relocate_functions::thumb_branch_common): Use new branch
9644         offset encoding methods to avoid code duplication.
9645         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
9646         (Stub_addend_reader::operator()): Use new branch encoding method
9647         to avoid code duplication.
9648
9649 2010-01-11  Doug Kwan  <dougkwan@google.com>
9650
9651         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
9652         (Target_arm::do_finalize_sections): Define special EXIDX section
9653         symbols only if referenced.
9654         * gc.h (Garbage_collection::add_reference): New method.
9655         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
9656         code duplication.
9657
9658 2010-01-11  Ian Lance Taylor  <iant@google.com>
9659
9660         * script.cc (Version_script_info::build_expression_list_lookup):
9661         Change complaing about duplicate wildcard match from error to
9662         warning.
9663
9664         * script.cc (class Lazy_demangler): Recreate--revert part of patch
9665         of 2009-12-30.
9666         (Version_script_info::Version_script_info): Initialize globs_,
9667         default_version_, default_is_global_, and exact_.  Don't
9668         initialize globals_ or locals_.
9669         (Version_script_info::build_lookup_tables): Build local symbols
9670         first.
9671         (Version_script_info::unquote): New function.
9672         (Version_script_info::add_exact_match): New function.
9673         (Version_script_info::build_expression_list_lookup): Remove lookup
9674         parameter.  Add is_global parameter.  Change all callers.  Handle
9675         wildcard pattern specially.  Unquote pattern.  Call
9676         add_exact_match.
9677         (Version_script_info::get_name_to_match): New function.
9678         (Version_script_info::get_symbol_version): New function.
9679         (Version_script_info::get_symbol_version_helper): Remove.
9680         (Version_script_info::check_unmatched_names): Call unquote.
9681         * script.h (class Version_script_info): Change get_symbol_version
9682         to be non-inline and add is_global parameter; change all callers.
9683         Rewrite symbol_is_local.  Update declarations.  Define struct
9684         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
9685         Remove globals_ and locals_ members.  Add exact_, globs_,
9686         default_version_, is_global_.
9687         (Version_script_info::Glob): Remove pattern, add expression and
9688         is_global.  Update constructor.  Change all callers.
9689         * dynobj.cc (Versions::finalize): Mark the version symbol as the
9690         default version.
9691         (Versions::symbol_section_contents): If a symbol is undefined, or
9692         defined in a dynamic object, set the version index to
9693         VER_NDX_LOCAL.
9694         * symtab.cc (Symbol_table::add_from_relobj): Don't call
9695         symbol_is_local.
9696         (Symbol_table::add_from_pluginobj): Likewise.
9697         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
9698
9699 2010-01-11  Doug Kwan  <dougkwan@google.com>
9700
9701         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
9702         (incremental_dump_LDADD): Add linking option for libintl.
9703         * Makefile.in: Regenerate.
9704
9705 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
9706
9707         PR gold/11144
9708         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
9709         instead of -Ds.
9710         * testsuite/Makefile.in: Regenerated.
9711
9712 2010-01-10  Doug Kwan  <dougkwan@google.com>
9713
9714         * options.h (DEFINE_var): Use parentheses around argument varname__
9715         in macro body to avoid any unintended subsequent substitutions.
9716
9717 2010-01-10  Ian Lance Taylor  <iant@google.com>
9718
9719         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
9720         candidates before doing symbol resolution.
9721
9722         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
9723         ODR candidates if only one is weak.
9724
9725 2010-01-08  Ian Lance Taylor  <iant@google.com>
9726
9727         * script.cc (Version_script_info::build_expression_list_lookup):
9728         Don't warn about ambiguous version, just record the ambiguity.
9729         (Version_script_info::get_symbol_version_helper): Give error if
9730         version is ambiguous.
9731
9732 2010-01-08  Doug Kwan  <dougkwan@google.com>
9733
9734         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
9735         prev_data_size_ and prev_addralign_.  Remove initializer for
9736         deleted data member has_been_changed_.
9737         (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
9738         to determine if the table is empty.
9739         (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
9740         Remove.
9741         (Stub_table::add_reloc_stub): Define method in class definition
9742         instead of just declaring it there.
9743         (Stub_table::add_cortex_a8_stub): New method definition.
9744         (Stub_table::update_data_size_and_addralign): Ditto.
9745         (Stub_table::finalize_stubs): Ditto.
9746         (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
9747         (Stub_table::do_addralign_): Return address alignment in the
9748         (Stub_table::do_reset_address_and_file_offset): Define method in
9749         class definition instead of declaring it there.  Set current data
9750         size to be the data size of the previous pass.
9751         (Stub_table::set_final_data_size): Use current data size as the
9752         final data size.
9753         (Stub_table::relocate_stub): Change parameter type of stub from
9754         Reloc_stub pointer to Stub pointer.
9755         (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
9756         (Stub_table::Cortex_a8_stub_list): New typedef.
9757         (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
9758          Stub_table::prev_addralign_): New data member.
9759         (Arm_relobj::Arm_relobj): Initialize data member
9760         section_has_cortex_a8_workaround_.
9761         (Arm_relobj::section_has_cortex_a8_workaround,
9762          Arm_relobj::mark_section_for_cortex_a8_workaround): New method
9763          definitions.
9764         (Arm_relobj::section_has_cortex_a8_workaround_): New data member
9765         declarations.
9766         (Target_arm::relocate_stub): Change parameter type of stub from
9767         Reloc_stub pointer to Stub pointer.
9768         (Insn_template::size, Insn_template::alignment): Handle
9769         THUMB16_SPECIAL_TYPE.
9770         (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
9771          Stub_table::update_data_size_and_addralign,
9772          Stub_table::apply_cortex_a8_workaround_to_address_range): New method
9773         definitions.
9774         (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
9775         (Stub_table::do_write): Ditto.
9776         (Target_arm::do_relax): Adjust code for changes in Stub_table.
9777
9778 2010-01-08  Ian Lance Taylor  <iant@google.com>
9779
9780         PR 11108
9781         * symtab.h (class Symbol): Remove fields is_target_special_ and
9782         has_plt_offset_.  Add field is_defined_in_discarded_section_.
9783         (Symbol::is_defined_in_discarded_section): New function.
9784         (Symbol::set_is_defined_in_discarded_section): New function.
9785         (Symbol::has_plt_offset): Rewrite.
9786         (Symbol::set_plt_offset): Verify that new offset is not -1U.
9787         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
9788         Don't initialize is_target_special_ or has_plt_offset_.
9789         Initialize is_defined_in_discarded_section_.
9790         (Symbol_table::add_from_relobj): If appropriate, set
9791         is_defined_in_discarded_section.
9792         * resolve.cc (Symbol::override_base_with_special): Don't test
9793         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
9794         * target-reloc.h (relocate_section): Do special handling for
9795         symbols defined in discarded sections for global symbols as well
9796         as local symbols.
9797
9798 2010-01-08  Ian Lance Taylor  <iant@google.com>
9799
9800         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
9801         the SHT_SYMTAB case.
9802
9803 2010-01-08  Ian Lance Taylor  <iant@google.com>
9804
9805         * object.cc (Sized_relobj::do_layout): Don't get confused if
9806         layout_eh_frame returns NULL.
9807
9808 2010-01-08  Ian Lance Taylor  <iant@google.com>
9809
9810         PR 11084
9811         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
9812         dynamic symbol table, use the normal symbol table.
9813         (Sized_dynobj::do_read_symbols): Remove assertion about type of
9814         symbol table.
9815
9816 2010-01-08  Ian Lance Taylor  <iant@google.com>
9817
9818         PR 11072
9819         * layout.cc (Layout::include_section): Remove .gnu_debuglink
9820         sections.
9821
9822 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
9823
9824         * version.cc (print_version): Change to "Copyright 2010".
9825
9826 2010-01-08  Ian Lance Taylor  <iant@google.com>
9827
9828         PR 10287
9829         PR 11063
9830         * i386.cc (class Target_i386): Change return type of plt_section
9831         to be non-const.
9832         (class Output_data_plt_i386): Add tls_desc_rel_ field.
9833         (Output_data_plt_i386::Output_data_plt_i386): Initialize
9834         tls_desc_rel_ field.
9835         (Output_data_plt_i386::rel_tls_desc): New function.
9836         (Target_i386::rel_tls_desc_section): New function.
9837         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
9838         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
9839         R_386_TLS_DESC reloc in rel_tls_desc_section.
9840         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
9841         Define struct Tlsdesc_info.
9842         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
9843         (Target_x86_64::do_reloc_symbol_index): New function.
9844         (Target_x86_64::add_tlsdesc_info): New function.
9845         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
9846         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
9847         tlsdesc_rel_ field.
9848         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
9849         all callers.
9850         (Output_data_plt_x86_64::rela_tlsdesc): New function.
9851         (Target_x86_64::rela_tlsdesc_section): New function.
9852         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
9853         handling.
9854         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
9855         (Target_x86_64::do_reloc_addend): New function.
9856         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
9857         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
9858         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
9859         (Output_reloc::type): New function.
9860         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
9861         (Output_reloc::is_target_specific): New function.
9862         (Output_reloc::target_arg): New function.
9863         (class Output_reloc) [SHT_RELA]: Add four new constructors for
9864         absolute relocs and target specific relocs.
9865         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
9866         add_target_specific.
9867         (class Output_data_reloc) [SHT_RELA]: Likewise.
9868         * output.cc (Output_reloc::Output_reloc): Add four new versions
9869         for absolute relocs and target specific relocs.
9870         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
9871         (Output_reloc::get_symbol_index): Likewise.
9872         (Output_reloc::local_section_offset): Check that local_sym_index_
9873         is not TARGET_CODE or 0.
9874         (Output_reloc::symbol_value): Likewise.
9875         (Output_reloc::write) [SHT_RELA]: Call target for target specific
9876         reloc.
9877         * target.h (class Target): Add reloc_symbol_index and reloc_addend
9878         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
9879         functions.
9880         * layout.cc (add_target_dynamic_tags): Use output section for
9881         DT_PLTRELSZ and DT_JMPREL.
9882
9883 2010-01-07  Ian Lance Taylor  <iant@google.com>
9884
9885         PR 11061
9886         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
9887         function.
9888         (class Output_data_reloc_generic): Define.
9889         (class Output_data_reloc_base): Change base class to
9890         Output_data_reloc_generic.  Change add() method to call
9891         bump_relative_reloc_count for a relative reloc.  Remove
9892         sort_relocs_ field.
9893         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
9894         to sort_relocs().
9895         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
9896         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
9897         appropriate.
9898         * layout.h (class Layout): Update declaration.
9899
9900 2010-01-07  Ian Lance Taylor  <iant@google.com>
9901
9902         * output.h (class Output_data): Add const version of
9903         output_section and do_output_section.
9904         (class Output_section_data): Add const version of
9905         do_output_section.
9906         (class Output_section): Likewise.
9907         * layout.cc (Layout::add_target_dynamic_tags): New function.
9908         * layout.h (class Layout): Update declarations.
9909         * arm.cc (Target_arm::do_finalize_sections): Use
9910         add_target_dynamic_tags.
9911         * i386.cc (Target_i386::do_finalize_sections): Likewise.
9912         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
9913         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
9914         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
9915
9916 2010-01-07  Ian Lance Taylor  <iant@google.com>
9917
9918         PR 11042
9919         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
9920         object as needed.
9921
9922 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
9923             Ian Lance Taylor  <iant@google.com>
9924
9925         PR 11019
9926         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
9927         Xindex::read_symtab_xindex.
9928
9929 2010-01-07  Doug Kwan  <dougkwan@google.com>
9930
9931         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
9932         (Insn_template::thumb16_bcond_insn): New method declaration.
9933         (Insn_template): Fix spelling.
9934         (Stub::thumb16_special): New method declaration.
9935         (Stub::do_write): Define virtual method which was previously pure
9936         virtual.
9937         (Stub::do_thumb16_special): New method declaration.
9938         (Stub::do_fixed_endian_write): New template member.
9939         (Reloc_stub::do_write): Remove.
9940         (Reloc_stub::do_fixed_endian_write): Remove.
9941         (Cortex_a8_stub): New class definition.
9942         (Stub_factory::make_cortex_a8_stub): New method definition.
9943         (Stub_factory::Stub_factory): Add missing static storage class
9944         qualifier for elf32_arm_stub_a8_veneer_blx.
9945
9946 2010-01-07  Ian Lance Taylor  <iant@google.com>
9947
9948         PR 10980
9949         * options.h (class General_options): Add --warn-unresolved-symbols
9950         and --error-unresolved-symbols.
9951         * errors.cc (Errors::undefined_symbol): Implement
9952         --warn-unresolved-symbols.
9953
9954         * options.h (class General_options): Add -z text and -z textoff.
9955         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
9956
9957 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
9958
9959         * gc.h (Garbage_collection::Cident_section_map): New typedef.
9960         (Garbage_collection::cident_sections): New function.
9961         (Garbage_collection::add_cident_section): New function.
9962         (Garbage_collection::cident_sections_): New member.
9963         (gc_process_relocs): Add references to sections whose names are C
9964         identifiers.
9965         * gold.h (cident_section_start_prefix): New constant.
9966         (cident_section_stop_prefix): New constant.
9967         (is_cident): New function.
9968         * layout.cc (Layout::define_section_symbols): Replace string constants
9969         with the newly defined constants.
9970         * object.cc (Sized_relobj::do_layout): Track sections whose names are
9971         C identifiers.
9972         * testsuite/Makefile.am: Add gc_orphan_section_test.
9973         * testsuite/Makefile.in: Regenerate.
9974         * testsuite/gc_orphan_section_test.cc: New file.
9975         * testsuite/gc_orphan_section_test.sh: New file.
9976
9977 2010-01-06  Ian Lance Taylor  <iant@google.com>
9978
9979         PR 10980
9980         * options.h (class General_options): Add --warn-shared-textrel.
9981         * layout.cc (Layout::finish_dynamic_section): Implement
9982         --warn-shared-textrel.
9983
9984         PR 10980
9985         * options.h (class General_options): Add --warn-multiple-gp.
9986
9987 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9988
9989         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
9990         $(THREADSLIB) and $(LIBDL).
9991         * Makefile.in: Rebuild.
9992
9993 2010-01-06  Ian Lance Taylor  <iant@google.com>
9994
9995         PR 10980
9996         * options.cc (General_options::parse_section_start): New function.
9997         (General_options::section_start): New function.
9998         (General_options::General_options): Initialize all members.
9999         * options.h: Include <map>
10000         (class General_options): Add --section-start.  Add section_starts_
10001         member.
10002         * layout.cc (Layout::attach_allocated_section_to_segment): If
10003         --section-start was used, set the address of the segment.  Remove
10004         local sort_sections.
10005         (Layout::relaxation_loop_body): If the address of the load segment
10006         has been set by --section-start, don't use it.
10007         * output.h (Output_segment::update_flags_for_output_section): New
10008         function.
10009         * output.cc (Output_segment::add_output_section): Call
10010         update_flags_for_output_section.
10011
10012 2010-01-05  Ian Lance Taylor  <iant@google.com>
10013
10014         PR 10980
10015         * options.h (class General_options): Add --undefined-version.
10016         * script.cc (struct Version_expression): Add was_matched_by_symbol
10017         field.
10018         (Version_script_info::matched_symbol): New function.
10019         (Version_script_info::get_symbol_version_helper): Call
10020         matched_symbol.
10021         (Version_script_info::check_unmatched_names): New function.
10022         * script.h (class Version_script_info): Update declarations.
10023         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
10024
10025         * options.h (class General_options): Use DEFINE_bool_alias for
10026         allow_multiple_definition.
10027         * resolve.cc (Symbol_table::should_override): Don't test
10028         allow_multiple_definition.
10029
10030         PR 10980
10031         * options.h (class General_options): Add --cref.
10032         * main.cc (main): Print cref table if --cref.  Don't close mapfile
10033         until after printing cref table.
10034         * cref.cc: Include "symtab.h".
10035         (class Cref_inputs): Define Cref_table_compare and Cref_table.
10036         (Cref_table_compare::operator()): New function.
10037         (Cref_inputs::gather_cref): New function.
10038         (filecol): New static const.
10039         (Cref_inputs::print_cref): New function.
10040         (Cref::print_cref): New function.
10041         * cref.h: Include <cstdio>.
10042         (class Cref): Update declarations.
10043         * mapfile.h (Mapfile::file): New function.
10044         * object.h (class Object): Define Symbols.  Declare virtual
10045         do_get_global_symbols.
10046         (Object::get_global_symbols): New function.
10047         * object.cc (Input_objects::add_object): Pass object to cref_ if
10048         --cref.
10049         (Input_objects::archive_start): Likewise.
10050         (Input_objects::archive_stop): Likewise.
10051         (Input_objects::print_cref): New function.
10052         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
10053         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
10054         --cref.
10055         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
10056         function.
10057         * plugin.h (class Sized_pluginobj): Update declarations.
10058
10059 2010-01-05  Ian Lance Taylor  <iant@google.com>
10060
10061         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
10062         to is_default_version.  Rename insdef to insdefault.
10063         (Symbol_table::add_from_relobj): Rename def to is_default_version
10064         and local to is_forced_local.
10065         (Symbol_table::add_from_pluginobj): Likewise.
10066         (Symbol_table::add_from_dynobj): Likewise.
10067         (Symbol_table::define_special_symbol): Rename insdef to
10068         insdefault.
10069
10070 2010-01-04  Ian Lance Taylor  <iant@google.com>
10071
10072         PR 10980
10073         * options.h (class General_options): Add
10074         --allow-multiple-definition and -z muldefs.
10075         * resolve.cc (Symbol_table::should_override): Don't warn about a
10076         multiple symbol definition if --allow-multiple-definition or -z
10077         muldefs.
10078
10079         PR 10980
10080         * options.h (class General_options): Add --add-needed and
10081         --copy-dt-needed-entries.  Tweak --as-needed help entry.
10082         * object.cc (Input_objects::check_dynamic_dependencies): Give an
10083         error if --copy-dt-needed-entries aka --add-needed is used and
10084         would cause a change in behaviour.
10085
10086         PR 10980
10087         * options.h (class General_options): Add -G as a short version of
10088         --shared.  Add no-op options -assert, -g, and -i.
10089
10090 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
10091
10092         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
10093         check for .text or .gnu.linkonce.t sections.
10094         * icf.cc (Icf::find_identical_sections): Ditto.
10095         Change the detection for mangled function name within the section
10096         name.
10097         * icf.h (is_section_foldable_candidate): New function.
10098
10099 2009-12-30  Ian Lance Taylor  <iant@google.com>
10100
10101         PR 10980
10102         * options.h (class General_options): Permit two dashes with
10103         --retain-symbols-file.
10104
10105 2009-12-30  Ian Lance Taylor  <iant@google.com>
10106
10107         PR 10979
10108         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
10109         don't put the file header and segment headers in the text
10110         segment.
10111
10112         PR 10979
10113         * common.cc (Sort_commons::operator()): Stabilize sort when both
10114         entries are NULL.
10115         (Symbol_table::do_allocate_commons_list): When allocating common
10116         symbols, skip a symbol which is no longer common.
10117         * symtab.h (Symbol::is_common): Test whether the symbol comes from
10118         an object before checking its type.
10119         * testsuite/common_test_2.c: New file.
10120         * testsuite/common_test_3.c: New file.
10121         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
10122         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
10123         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
10124         (common_test_2_pic.o, common_test_2.so): New targets.
10125         (common_test_3_pic.o, common_test_3.so): New targets.
10126         * testsuite/Makefile.in: Rebuild.
10127
10128         PR 10979
10129         * script.cc (read_input_script): If we see a new SECTIONS clause,
10130         and we have added an input section, give an error.
10131         * layout.h (class Layout): Add have_added_input_section function.
10132         Add have_added_input_section_ field.
10133         * layout.cc (Layout::Layout): Initialize
10134         have_added_input_section_.
10135         (Layout::layout): Set have_added_input_section_.
10136         (Layout::layout_eh_frame): Likewise.
10137
10138 2009-12-30  Ian Lance Taylor  <iant@google.com>
10139
10140         PR 10931
10141         * options.h (class General_options): Add --sort-common option.
10142         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
10143         * common.cc (Sort_common): Add sort_order parameter to
10144         constructor.  Add sort_order_ field.
10145         (Sort_commons::operator): Check sort_order_.
10146         (Symbol_table::allocate_commons): Determine the sort order.
10147         (Symbol_table::do_allocate_commons): Add sort_order parameter.
10148         Change all callers.
10149         (Symbol_table::do_allocate_commons_list): Likewise.
10150
10151 2009-12-30  Ian Lance Taylor  <iant@google.com>
10152
10153         PR 10916
10154         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
10155         symbols from this object, don't change the visibility of an
10156         undefined symbol.
10157         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
10158
10159 2009-12-30  Ian Lance Taylor  <iant@google.com>
10160
10161         PR 10861
10162         * script.h (class Version_script_info): Define Language enum.
10163         Update declarations.  Define Glob, Exact, and Lookup types.  Add
10164         new fields globals_, locals_, and is_finalized_.
10165         * script.cc: Various formatting fixes.
10166         (class Parser_closure): Change language_stack_ from a vector of
10167         std::string to one of Version_script_info::Language.  Adjust all
10168         uses accordingly.
10169         (class Lazy_demangler): Remove.
10170         (struct Version_expression): Change language from std::string to
10171         Version_script_info::Language.
10172         (Version_script_info::Version_script_info): New function.
10173         (Version_script_info::~Version_script_info): Don't call clear.
10174         (Version_script_info::finalize): New function.
10175         (Version_script_info::build_lookup_tables): New function.
10176         (Version_script_info::build_expression_list_lookup): New
10177         function.
10178         (Version_script_info::get_symbol_version_helper): Rewrite to use
10179         lookup tables.
10180         (Version_script_info::print_expression_list): Adjust to use
10181         Version_script_info::Language.
10182         (script_push_lex_into_version_mode): Check that the version script
10183         has not been finalized.
10184         (version_script_push_lang): Change language string to
10185         Version_script_info::Language.
10186         * options.cc (Command_line::version_script): New function.
10187         * options.h (class General_options): Add finalize_dynamic_list
10188         function.  Change version_script from declaration to definition.
10189         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
10190         * testsuite/version_script.map: Remove duplicate def of foo.
10191         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
10192         version_script.map.
10193         * testsuite/Makefile.in: Rebuild.
10194
10195 2009-12-30  Ian Lance Taylor  <iant@google.com>
10196
10197         PR 10843
10198         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
10199         if the input symbol index is 0, make the output symbol index 0.
10200
10201 2009-12-30  Ian Lance Taylor  <iant@google.com>
10202
10203         PR 10670
10204         * options.h (class General_options): Add -x/--discard-all.
10205         * object.cc (Sized_relobj::do_count_local_symbols): Handle
10206         --discard-all.  If the local symbol needs a dynamic entry, check
10207         that before handling --discard-locals.
10208
10209 2009-12-30  Ian Lance Taylor  <iant@google.com>
10210
10211         PR 10450
10212         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
10213         flags to PF_R.
10214         (Output_segment::add_output_section): Don't change the flags if
10215         the type is PT_TLS.
10216
10217         PR 10450
10218         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
10219         GNU hash table if they need a dynamic value.  Otherwise, don't add
10220         them if they are defined in a dynamic object or are forced local.
10221
10222 2009-12-29  Ian Lance Taylor  <iant@google.com>
10223
10224         PR 10450
10225         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
10226         .gnu.hash table for a 32-bit target.
10227
10228         PR 10450
10229         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
10230         regular and a dynamic object only needs a dynamic symbol table
10231         entry if it is externally visible.
10232
10233         PR 10450
10234         * i386.cc (class Target_i386): Initialize global_offset_table_ in
10235         constructor.  Add global_offset_table_ field.
10236         (Target_i386::got_section): Set global_offset_table_.
10237         (Target_i386::do_finalize_sections): Set global_offset_table_
10238         size.
10239         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
10240         in constructor.  Add global_offset_table_ field.
10241         (Target_x86_64::got_section): Set global_offset_table_.
10242         (Target_x86_64::do_finalize_sections): Set global_offset_table_
10243         size.
10244
10245         * layout.cc (Layout::Layout): Initialize increase_relro_.
10246         (Layout::get_output_section): Add is_relro, is_last_relro, and
10247         is_first_non_relro parameters.  Change all callers.
10248         (Layout::choose_output_section): Likewise.
10249         (Layout::add_output_section_data): Likewise.
10250         (Layout::make_output_section): Likewise.
10251         (Layout::set_segment_offsets): Clear increase_relro when using a
10252         linker script.
10253         * layout.h (class Layout): Add increase_relro method.  Add
10254         increase_relro_ field.  Update declarations.
10255         * output.cc (Output_section::Output_section): Initialize
10256         is_last_relro_ and is_first_non_relro_.
10257         (Output_segment::add_output_section): Group relro sections is
10258         do_sort is true.  Handle is_last_relro and is_first_non_relro.
10259         (Output_segment::maximum_alignment): Remove relro handling.
10260         (Output_segment::set_section_addresses): Add increase_relro
10261         parameter.  Change all callers.  Add initial alignment to align
10262         relro sections on separate page.  Remove old relro handling.
10263         (Output_segment::set_section_list_addresses): Remove in_relro
10264         parameter.  Change all callers.
10265         (Output_segment::set_offset): Add increase parameter.  Change all
10266         callers.  Remove old relro handling.
10267         * output.h (class Output_section): Add new methods: is_last_relro,
10268         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
10269         Add is_last_relro_ and is_first_non_relro_ fields.
10270         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
10271         Create separate .got.plt section.  Call increase_relro.
10272         * x86_64.cc (Target_x86_64::got_section): Likewise.
10273         * testsuite/relro_script_test.t: Add .got.plt.
10274
10275         PR 10450
10276         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
10277         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
10278         (Layout::finalize): Call set_dynamic_symbol_size.
10279         (Layout::set_dynamic_symbol_size): New function.
10280         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
10281         set_dynamic_symbol_size.
10282
10283         PR 10450
10284         * output.h (class Output_section): Add is_entsize_zero_ field.
10285         * output.cc (Output_section::Output_section): Initialize
10286         is_entsize_zero_.
10287         (Output_section::set_entsize): If two different entsizes are
10288         requested, force it to zero.
10289         (Output_section::add_input_section): Set flags for .debug_str
10290         before updating section flags.  Set entsize.
10291         (Output_section::update_flags_for_input_section): Set SHF_MERGE
10292         and SHF_STRING if all input sections have those flags.
10293
10294 2009-12-29   Rafael Espindola  <espindola@google.com>
10295
10296         * main.cc (main): Fix the sys time reporting.
10297         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
10298         reporting.
10299
10300 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
10301
10302         * options.cc (General_options::parse_version): Allow -v to exit
10303         without an error if there is nothing to link.
10304
10305 2009-12-29  Ian Lance Taylor  <iant@google.com>
10306
10307         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
10308         using a version of gcc before 4.1.
10309         * configure: Rebuild.
10310
10311 2009-12-28  Chris Demetriou  <cgd@google.com>
10312
10313         * attributes.cc (Output_attributes_section_data::do_write): Use
10314         std::vector::front rather than std::vector::data.
10315
10316 2009-12-28  Ian Lance Taylor  <iant@google.com>
10317
10318         * symtab.h (class Symbol_table): Add enum Defined.
10319         * resolve.cc (Symbol_table::should_override): Add defined
10320         parameter.  Change all callers.  Test whether object is NULL
10321         before calling a method on it.
10322         (Symbol_table::report_resolve_problem): Add defined parameter.
10323         Change all callers.
10324         (Symbol_table::should_override_with_special): Likewise.
10325         * symtab.cc (Symbol_table::define_in_output_data): Add defined
10326         parameter.  Change all callers.
10327         (Symbol_table::do_define_in_output_data): Likewise.
10328         (Symbol_table::define_in_output_segment): Likewise.
10329         (Symbol_table::do_define_in_output_segment): Likewise.
10330         (Symbol_table::define_as_constant): Likewise.
10331         (Symbol_table::do_define_as_constant): Likewise.
10332         * script.h (class Symbol_assignment): Add is_defsym parameter to
10333         constructor; change all callers.
10334         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
10335         parameter.  Change all callers.  Add is_defsym_ field.
10336         (class Parser_closure): Add parsing_defsym parameter to
10337         constructor; change all callers.  Add parsing_defsym accessor
10338         function.  Add parsing_defsym_ field.
10339
10340 2009-12-28  Ian Lance Taylor  <iant@google.com>
10341
10342         * gold.cc (queue_middle_tasks): Fix formatting.
10343         * object.cc (Relobj::is_section_name_included): Likewise.
10344
10345 2009-12-23  Ian Lance Taylor  <iant@google.com>
10346
10347         * i386.cc (Target_i386::do_calls_non_split): Recognize
10348         -fsplit-stack prologue for a function with a static chain.
10349         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
10350         -fsplit-stack prologue when using %r11.
10351
10352 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
10353
10354         * options.cc (General_options::parse_version): Make -v continue and do
10355         the link like GNU ld does.
10356
10357 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
10358
10359         * Makefile.am (CCFILES): Add timer.cc.
10360         (HFILES): Add timer.h.
10361         * configure.ac: Check for sysconf and times.
10362         * main.cc: include timer.h.
10363         (main): Use Timer instead of get_run_time.
10364         * timer.cc: New.
10365         * timer.h: New.
10366         * workqueue.cc: include timer.h.
10367         (Workqueue::find_and_run_task):
10368         Report user, sys and wall time.
10369         * Makefile.in: Regenerate.
10370         * config.in: Regenerate.
10371         * configure: Regenerate.
10372
10373 2009-12-16  Doug Kwan  <dougkwan@google.com>
10374
10375         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
10376         sections.
10377         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
10378         relaxed input sections.
10379         * output.cc (Output_section::find_relaxed_input_section): Change
10380         return type to Output_relaxed_input_section pointer.  Adjust code
10381         for new type of relaxed_input_section_map_.
10382         * output.h (Output_section::find_relaxed_input_section): Change
10383         return type to Output_relaxed_input_section pointer.
10384         (Output_section::Output_relaxed_input_section_by_input_section_map):
10385         New type.
10386         (Output_section::relaxed_input_section_map_): Change type to
10387         Output_section::Output_relaxed_input_section_by_input_section_map.
10388         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
10389         input section.
10390
10391 2009-12-15  Ian Lance Taylor  <iant@google.com>
10392
10393         * layout.cc (Layout::create_shstrtab): Only write out after input
10394         sections if we are compressing debug sections.
10395
10396 2009-12-15  Ian Lance Taylor  <iant@google.com>
10397
10398         * archive.cc (Archive::add_symbols): Only look up a symbol without
10399         a version if there is, in fact, a version.
10400
10401 2009-12-14  Ian Lance Taylor  <iant@google.com>
10402
10403         Revert -Wshadow changes, all changes from:
10404         2009-12-11  Doug Kwan  <dougkwan@google.com>
10405         2009-12-11  Nick Clifton  <nickc@redhat.com>
10406         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
10407
10408 2009-12-11  Doug Kwan  <dougkwan@google.com>
10409
10410         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
10411         due to -Wshadow.
10412         * attributes.cc (Object_attribute::size): Ditto.
10413         (Attributes_section_data::size): Ditto.
10414         (Attributes_section_data::Attributes_section_data): Ditto.
10415         (Output_attributes_section_data::do_write): Ditto.
10416         * attributes.h (Object_attribute::set_type): Ditto.
10417         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
10418
10419 2009-12-11  Nick Clifton  <nickc@redhat.com>
10420
10421         * archive.cc: Fix shadowed variable warnings.
10422         * arm.cc: Likewise.
10423         * compressed_output.cc: Likewise.
10424         * compressed_output.h: Likewise.
10425         * configure: Likewise.
10426         * dwarf_reader.cc: Likewise.
10427         * dynobj.cc: Likewise.
10428         * dynobj.h: Likewise.
10429         * ehframe.cc: Likewise.
10430         * ehframe.h: Likewise.
10431         * errors.cc: Likewise.
10432         * expression.cc: Likewise.
10433         * fileread.cc: Likewise.
10434         * fileread.h: Likewise.
10435         * freebsd.h: Likewise.
10436         * i386.cc: Likewise.
10437         * icf.cc: Likewise.
10438         * incremental.h: Likewise.
10439         * layout.cc: Likewise.
10440         * layout.h: Likewise.
10441         * mapfile.cc: Likewise.
10442         * merge.cc: Likewise.
10443         * merge.h: Likewise.
10444         * object.cc: Likewise.
10445         * object.h: Likewise.
10446         * options.h: Likewise.
10447         * output.cc: Likewise.
10448         * output.h: Likewise.
10449         * parameters.cc: Likewise.
10450         * plugin.cc: Likewise.
10451         * powerpc.cc: Likewise.
10452         * reduced_debug_output.cc: Likewise.
10453         * reduced_debug_output.h: Likewise.
10454         * reloc.cc: Likewise.
10455         * reloc.h: Likewise.
10456         * resolve.cc: Likewise.
10457         * script-sections.cc: Likewise.
10458         * script.cc: Likewise.
10459         * script.h: Likewise.
10460         * sparc.cc: Likewise.
10461         * symtab.cc: Likewise.
10462         * symtab.h: Likewise.
10463         * target-select.cc: Likewise.
10464         * target-select.h: Likewise.
10465         * token.h: Likewise.
10466         * workqueue.cc: Likewise.
10467         * workqueue.h: Likewise.
10468         * x86_64.cc: Likewise.
10469
10470 2009-12-10  Doug Kwan  <dougkwan@google.com>
10471
10472         * arm.cc (attributes.h): New include.
10473         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
10474         (Arm_relobj::~Arm_relobj): Delete object pointed by
10475         attributes_section_data_.
10476         (Arm_relobj::attributes_section_data): New method definition.
10477         (Arm_relobj::attributes_section_data_): New data member declaration.
10478         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
10479         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
10480         attributes_section_data_.
10481         (Arm_dynobj::attributes_section_data): New method definition.
10482         (Arm_dynobj::attributes_section_data_): New data member declaration.
10483         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
10484         initialization value of may_use_blx_ to false.
10485         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
10486         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
10487         object attributes to compute results instead of hard-coding.
10488         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
10489         Target_arm::get_secondary_compatible_arch,
10490         Target_arm::set_secondary_compatible_arch
10491         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
10492         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
10493         New method declarations.
10494         (Target_arm::get_aeabi_object_attribute): New method definition.
10495         (Target_arm::attributes_section_data_): New data member declaration.
10496         (read_arm_attributes_section): New template definition.
10497         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
10498         (Arm_dynobj::do_read_symbols): Ditto.
10499         (Target_arm::do_finalize_sections): Merge attributes sections from
10500         input.  Check for BLX use after attributes section merging.
10501         Fix __exidx_start and __exidx_end visibility.  Create an
10502         .ARM.attributes section if necessary.
10503         (Target_arm::get_secondary_compatible_arch,
10504         Target_arm::set_secondary_compatible_arch,
10505         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
10506         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
10507         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
10508         New method definitions.
10509
10510 2009-12-09  Ian Lance Taylor  <iant@google.com>
10511
10512         * plugin.cc (Plugin::load): Don't cast from void* to a function
10513         pointer.
10514
10515 2009-12-09  Ian Lance Taylor  <iant@google.com>
10516
10517         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
10518         information fields.
10519
10520 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
10521
10522         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
10523         Replace two_file_shared_1.so with two_file_shared_2.so.
10524         * testsuite/Makefile.in: Regenerated.
10525
10526 2009-12-08  Doug Kwan  <dougkwan@google.com>
10527
10528         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
10529         (HFILES): Add attributes.h and int_encoding.h.
10530         * Makefile.in: Regenerate.
10531         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
10532         function definitions to int_encoding.cc
10533         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
10534         prototypes to int_encoding.h
10535         * reduced_debug_output.cc (int_encoding.h): New include.
10536         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
10537         function definitions to int_encoding.cc
10538         (insert_into_vector, read_from_pointer): Move template definitions to
10539         int_encoding.h
10540         * attributes.cc: New file.
10541         * attributes.h: New file.
10542         * int_encoding.cc: New file.
10543         * int_encoding.h: New file.
10544
10545 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
10546
10547         PR gold/11055
10548         * incremental-dump.cc (dump_incremental_inputs): New.
10549         (main): Use dump_incremental_inputs.
10550
10551 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
10552
10553         PR gold/10893
10554         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
10555         checking elfcpp::STT_FUNC.
10556         (Target_i386::Relocate::relocate): Likewise.
10557         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
10558
10559         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
10560         symbols from shared libraries into normal FUNC symbols.
10561
10562         * symtab.h (Symbol): Add is_func and use it.
10563
10564 2009-12-05  Doug Kwan  <dougkwan@google.com>
10565
10566         * arm.cc (Target_arm::arm_info): Initialize new fields
10567         attributes_section and attributes_vendor.
10568         * i386.cc (Target_i386::i386_info): Same.
10569         * object.cc (Sized_relobj::do_layout): Skip attribute section.
10570         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
10571         fields attributes_section and attributes_vendor.
10572         * sparc.cc (Target_sparc::sparc_info): Same.
10573         * target.h (Target::attributes_section, Target::attributes_vendor,
10574         Target::is_attributes_section, Target::attribute_arg_type,
10575         Target::attributes_order): New method definitions.
10576         (Target::Target_info::attributes_section,
10577         Target::Target_info::attributes_vendor): New fields.
10578         (Target::do_attribute_arg_type, Target::do_attributes_order): New
10579         virtual method definitions.
10580         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
10581         attributes_section and attributes_vendor.
10582         * testsuite/testfile.cc (Target_test::test_target_info): Same.
10583
10584 2009-12-05  Doug Kwan  <dougkwan@google.com>
10585
10586         * arm.cc: Update comments about interworking and stub generation.
10587         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
10588         considered as non-PIC.
10589         (Arm_relocate_functions::base_abs): Fix formatting.
10590         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
10591         of function to use GOT entry address instead of offset.
10592         (Target_arm::Scan::global): Issue an error if a symbol would need a
10593         PLT does not get one because it is untyped.  Remove code to create
10594         dynamic symbols for relative branches.
10595         (Target_arm::Relocate::relocate: Use 0 instead of false since function
10596         takes unsigned integer instead of boolean.
10597
10598 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
10599
10600         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
10601         (two_file_test_LDADD): Likewise.
10602         (common_test_1_LDADD): Likewise.
10603         (exception_test_LDADD) Likewise.
10604         (weak_test_LDADD): Likewise.
10605         (many_sections_test_LDADD): Likewise.
10606         (initpri1_LDADD): Likewise.
10607         (script_test_1_LDADD): Likewise.
10608         (script_test_2_LDADD): Likewise.
10609         (justsyms_LDADD): Likewise.
10610         (binary_test_LDADD): Likewise.
10611         (large_LDADD): Likewise.
10612         * testsuite/Makefile.in: Regenerated.
10613
10614 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
10615
10616         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
10617         (Symbol_table::override_with_special): Likewise.
10618         (Symbol_table::add_from_object): Likewise.
10619
10620 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
10621
10622         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
10623         Don't set the data_offset twice.
10624
10625 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
10626
10627         * testsuite/Makefile.in: Regenerate.
10628
10629 2009-12-03  Doug Kwan  <dougkwan@google.com>
10630
10631         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
10632         (Target_arm::do_finalize_sections): Add parameter for symbol table
10633         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
10634         * i386.cc (Target_i386::do_finalize_sections): Add an additional
10635         parameter for symbol table pointer.
10636         * layout.cc (Layout::finalize): Call Target::finalize_sections with
10637         an additional parameter for a pointer to symbol table.
10638         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
10639         parameter for a symbol table pointer.
10640         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
10641         * target.h (Target::finalize_sections, Target::do_finalize_sections):
10642         Ditto.
10643         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
10644         parameter for a symbol table pointer.
10645
10646 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
10647
10648         * incremental.cc (Incremental_inputs_header)
10649         (Incremental_inputs_header_write, Incremental_inputs_entry)
10650         (Incremental_inputs_entry_write): Move ...
10651         * incremental.h (Incremental_inputs_header)
10652         (Incremental_inputs_header_write, Incremental_inputs_entry)
10653         (Incremental_inputs_entry_write): here.
10654
10655 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10656
10657         * incremental.cc (make_sized_incremental_binary): Set the target.
10658         Error if it is incompatible.
10659         * output.h (Output_file): Add filename method.
10660
10661 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10662
10663         * incremental.cc (Incremental_inputs_entry): Remove unused argument
10664         from the get_* methods.
10665
10666 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10667
10668         * incremental-dump.cc (main): Check that the offeset of a script is 0.
10669         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
10670         Write 0 for the data_offset of scripts.
10671
10672 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10673
10674         * testsuite/Makefile.am: Add the incremental_test.sh test.
10675         * testsuite/incremental_test.sh: New.
10676         * testsuite/incremental_test_1.c: New.
10677         * testsuite/incremental_test_2.c: New.
10678
10679 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
10680
10681         * incremental-dump.cc (main): Fix typos.
10682
10683 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
10684
10685         PR gold/11025
10686         * incremental-dump.cc (main): Use llu to print 64 bit values.
10687
10688 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
10689             H.J. Lu  <hongjiu.lu@intel.com>
10690
10691         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
10692         $(LIBDL).
10693         (incremental_dump_LDADD): Likewise.
10694         * Makefile.in: Regenerated.
10695
10696 2009-11-25  Doug Kwan  <dougkwan@google.com>
10697
10698         Revert:
10699
10700         2009-11-25  Doug Kwan  <dougkwan@google.com>
10701
10702                 * arm.cc (Target_arm::Target_arm): Move method definition
10703                 outside of class definition.  Add code to handle
10704                 --target1-rel, --target1-abs and --target2= options.
10705                 (Target_arm::get_reloc_reloc_type): Change method to be
10706                 non-static and const.
10707                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
10708                 New data member declaration.
10709                 (Target_arm::Scan::local, Target_arm::Scan::global,
10710                 Target_arm::Relocate::relocate,
10711                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10712                 Adjust call to Target_arm::get_real_reloc_type.
10713                 (Target_arm::get_real_reloc_type): Use command line options
10714                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
10715                 * options.h (--target1-rel, --target1-abs, --target2): New
10716                 ARM-only options.
10717
10718 2009-11-25  Doug Kwan  <dougkwan@google.com>
10719
10720         * arm.cc (Target_arm::Target_arm): Move method definition outside of
10721         class definition.  Add code to handle --target1-rel, --target1-abs
10722         and --target2= options.
10723         (Target_arm::get_reloc_reloc_type): Change method to be non-static
10724         and const.
10725         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
10726         member declaration.
10727         (Target_arm::Scan::local, Target_arm::Scan::global,
10728         Target_arm::Relocate::relocate,
10729         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
10730         call to Target_arm::get_real_reloc_type.
10731         (Target_arm::get_real_reloc_type): Use command line options to
10732         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
10733         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
10734         options.
10735
10736 2009-11-25  Doug Kwan  <dougkwan@google.com>
10737
10738         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
10739         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
10740         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
10741         formatting.
10742         (Arm_relocate_functions::thm_call): Replace body with a call to
10743         Arm_relocate_functions::thumb_branch_common.
10744         (Arm_relocate_functions::thm_jump24,
10745         Arm_relocate_functions::thm_xpc22): New method definitions.
10746         (Arm_relocate_functions::thumb_branch_common): New method definition.
10747         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
10748         operator.
10749         (Target_arm::Relocate::relocate): Adjust call to thm_call.
10750         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
10751
10752 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
10753
10754         * Makefile.am: Build incremental-dump
10755         * Makefile.in: Regenerate.
10756         * incremental-dump.cc: New.
10757         * incremental.cc (Incremental_inputs_header_data,
10758         Incremental_inputs_entry_data): Move to incremental.h
10759         * incremental.h: (Incremental_inputs_header_data,
10760         Incremental_inputs_entry_data): Move from incremental.cc
10761
10762 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
10763
10764         * incremental.cc (Incremental_inputs_header,
10765         Incremental_inputs_header_write, Incremental_inputs_entry,
10766         Incremental_inputs_entry_write): Add a typedef with the data type.
10767
10768 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
10769
10770         * incremental.cc (Incremental_inputs_header,
10771         Incremental_inputs_header_write, Incremental_inputs_entry,
10772         Incremental_inputs_entry_write): Update comment about which
10773         type has the filed descriptions.
10774
10775 2009-11-15  Doug Kwan  <dougkwan@google.com>
10776
10777         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
10778         (Arm_relocate_functions::arm_branch_common): Change method defintion
10779         in class definition to a method declaration and update list of formal
10780         parameters.
10781         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
10782         Arm_relocation_functions::jump24): Adjust call to
10783         Arm_relocate_functions::arm_branch_common.  Update list of formal
10784         parameters.
10785         (Arm_relocate_functions::xpc25): New method definition.
10786         (Arm_relocate_functions::arm_branch_common): Move method defintion
10787         out from class definition.  Use stubs for mode-switching and extending
10788         branch ranges.
10789         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
10790         specially.  Change code to enable use of stubs in ARM branches.
10791
10792 2009-11-10  Doug Kwan  <dougkwan@google.com>
10793
10794         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
10795         in method declaration.
10796         (Target_arm::relocate_stub): New method declaration.
10797         (Target_arm::default_target): Change to return a pointer instead of
10798         a const reference.
10799         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
10800         Target_arm::default_target.
10801         (Arm_Relobj::do_relocate_sections): Remove options paramater in
10802         method definition.
10803         (Target_arm::relocate_section): Adjust view.
10804         (Target_arm::relocate_stub): New method definition.
10805
10806 2009-11-10  Doug Kwan  <dougkwan@google.com>
10807
10808         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
10809         a format warning.
10810         * incremental.cc (open_incremental_binary): Initialized local
10811         variables to avoid warnings.
10812         * object.cc (make_elf_object): Ditto.
10813         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
10814         a format warning.
10815
10816 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
10817
10818         PR gold/10930
10819         * testsuite/plugin_test.c: Include "config.h".
10820
10821 2009-11-09  Doug Kwan  <dougkwan@google.com>
10822
10823         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
10824         (arm_symbol_value): Remove.
10825         (Arm_relocate_functions::arm_branch_common,
10826         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
10827         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
10828         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
10829         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
10830         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
10831         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
10832         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
10833         Arm_relocate_functions::thm_mobw_abs_nc,
10834         Arm_relocate_functions::thm_mov_abs,
10835         Arm_relocate_functions::movw_prel_nc,
10836         Arm_relocate_functions::thm_movt_abs,
10837         Arm_relocate_functions::movt_prel,
10838         Arm_relocate_functions::thm_movw_prel_nc,
10839         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
10840         (Target_arm::Relocate::relocate): Only decompose address into two
10841         parts if relocation type uses the thumb-bit and pass the actual
10842         bit instead of a flag indicating that the thumb-bit is used.  Adjust
10843         calls to methods in Arm_relocate_functions for this change.
10844
10845 2009-11-08  Ian Lance Taylor  <iant@google.com>
10846
10847         PR 10925
10848         * reloc.cc: Instantiate
10849         Sized_relobj::initialize_input_to_output_maps and
10850         Sized_relobj:free_input_to_output_maps.
10851
10852 2009-11-06  Ian Lance Taylor  <iant@google.com>
10853
10854         PR 10876
10855         * defstd.cc (in_segment): Set only_if_ref true for "end".
10856
10857 2009-11-06  Doug Kwan  <dougkwan@google.com>
10858
10859         * arm.cc (class Reloc_stub): Correct a comment.
10860         (Target_arm::Target_arm): Initialize arm_input_section_map_.
10861         (Target_arm::scan_section_for_stubs): New method declaration.
10862         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
10863         Change methods from private to protected.
10864         (Target_arm::do_may_relax): New method definition.
10865         (Target_arm::do_relax, Target_arm::group_sections,
10866         Target_arm::scan_reloc_for_stub,
10867         Target_arm::scan_reloc_section_for_stubs): New method declarations.
10868         (Target_arm::arm_input_section_map_): New data member declaration.
10869         (Target_arm::scan_reloc_for_stub,
10870         Target_arm::scan_reloc_section_for_stubs,
10871         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
10872         Target_arm::do_relax): New method definitions.
10873
10874 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
10875
10876         * configure.ac: Check for (struct stat)::st_mtim
10877         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
10878         * config.in: Regenerate.
10879         * configure: Regenerate.
10880
10881 2009-11-05  Ian Lance Taylor  <iant@google.com>
10882
10883         PR 10910
10884         * output.cc (Output_segment::add_output_section): Add missing
10885         return statement.
10886
10887 2009-11-04  Ian Lance Taylor  <iant@google.com>
10888
10889         PR 10880
10890         * object.h (class Object): Add is_needed and set_is_needed
10891         methods.  Add is_needed_ field.  Make bool fields into bitfields.
10892         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
10893         defined in a dynamic object and referenced by a regular object,
10894         set is_needed for the dynamic object.
10895         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
10896         if the file is marked with as_needed and it is not needed.
10897
10898 2009-11-04  Ian Lance Taylor  <iant@google.com>
10899
10900         PR 10887
10901         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
10902         tags if data is discarded by linker script.
10903         * i386.cc (Target_i386::do_finalize_sections): Likewise.
10904         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
10905         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
10906         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
10907
10908 2009-11-04  Ian Lance Taylor  <iant@google.com>
10909
10910         * layout.cc (Layout::get_output_section): Add is_interp and
10911         is_dynamic_linker_section parameters.  Change all callers.
10912         (Layout::choose_output_section): Likewise.
10913         (Layout::make_output_section): Likewise.
10914         (Layout::add_output_section_data): Add is_dynamic_linker_section
10915         parameter.  Change all callers.
10916         * layout.h (class Layout): Update declarations.
10917         * output.h (class Output_section): Add is_interp, set_is_interp,
10918         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
10919         Add is_interp_, is_dynamic_linker_section_ fields.  Change
10920         generate_code_fills_at_write_ to a bitfield.
10921         * output.cc (Output_section::Output_sections): Initialize new
10922         fields.
10923         (Output_segment::add_output_section): Add do_sort parameter.
10924         Change all callers.
10925
10926 2009-11-03  Ian Lance Taylor  <iant@google.com>
10927
10928         PR 10860
10929         * options.h (class General_options): Add --warn-common.
10930         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
10931         merging two common symbols.
10932         (Symbol_table::should_override): Handle --warn-common when merging
10933         a common symbol with a defined symbol.  Use report_resolve_problem
10934         for multiple definitions.
10935         (Symbol_table::report_resolve_problem): New function.
10936         * symtab.h (class Symbol_table): Declare report_resolve_problem.
10937
10938 2009-11-03  Doug Kwan  <dougkwan@google.com>
10939
10940         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
10941         stub_factory_.
10942         (Target_arm::stub_factory): New method definition.
10943         (Target_arm::new_arm_input_section,
10944         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
10945         Target_arm::reloc_uses_thumb_bit): New method declarations.
10946         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
10947         New type definitions.
10948         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
10949         member declarations.
10950         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
10951         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
10952         New method definitions.
10953
10954 2009-11-03  Ian Lance Taylor  <iant@google.com>
10955
10956         * options.h (class General_options): Add --warn_constructors.
10957
10958 2009-11-03  Ian Lance Taylor  <iant@google.com>
10959
10960         PR 10893
10961         * defstd.cc (in_section): Add entries for __rel_iplt_start,
10962         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
10963
10964 2009-11-03  Ian Lance Taylor  <iant@google.com>
10965
10966         PR 10895
10967         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
10968         --msgid-bugs-address.
10969         (install-pdf): New target.
10970         (install-data_yes): Look up one directory to find mkinstalldirs.
10971
10972 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
10973
10974         * po/Make-in (.po.gmo): Don't generate .gmo files in source
10975         tree.
10976
10977 2009-10-30  Doug Kwan  <dougkwan@google.com>
10978
10979         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
10980
10981 2009-10-30  Doug Kwan  <dougkwan@google.com>
10982
10983         * arm.cc (Stub_addend_reader): New struct template definition
10984         and partial specializations.
10985         (Stub_addend_reader::operator()): New method definition for a
10986         partially specialized template.
10987
10988 2009-10-30  Doug Kwan  <dougkwan@google.com>
10989
10990         * arm.cc (Arm_relobj::processor_specific_flags): New method
10991         definition.
10992         (Arm_relobj::do_read_symbols): New method declaration.
10993         (Arm_relobj::processor_specific_flags_): New data member declaration.
10994         (Arm_dynobj): New class definition.
10995         (Target_arm::do_finalize_sections): Add input_objects parameter.
10996         (Target_arm::do_adjust_elf_header): New method declaration.
10997         (Target_arm::are_eabi_versions_compatible,
10998         (Target_arm::merge_processor_specific_flags): New method declaration.
10999         (Target_arm::do_make_elf_object): New overloaded method definitions
11000         and declaration.
11001         (Arm_relobj::do_read_symbols): New method definition.
11002         (Arm_dynobj::do_read_symbols): Ditto.
11003         (Target_arm::do_finalize_sections): Add input_objects parameters.
11004         Merge processor-specific flags from all input objects.
11005         (Target_arm::are_eabi_versions_compatible,
11006         Target_arm::merge_processor_specific_flags,
11007         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
11008         New method definitions.
11009         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
11010         Input_objects pointer type parameter.
11011         * layout.cc (Layout::finalize): Pass input objects to target's.
11012         finalize_sections function.
11013         * output.cc (Output_file_header::do_sized_write): Set ELF file
11014         header's processor-specific flags.
11015         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
11016         Input_objects pointer type parameter.
11017         * sparc.cc (Target_sparc::do_finalize_sections): Same.
11018         * target.h (Input_objects): New forward class declaration.
11019         (Target::processor_specific_flags,
11020         Target::are_processor_specific_flags_sect): New method definitions.
11021         (Target::finalize_sections): Add input_objects parameter.
11022         (Target::Target): Initialize processor_specific_flags_ and
11023         are_processor_specific_flags_set_.
11024         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
11025         parameter.
11026         (Target::set_processor_specific_flags): New method definition.
11027         (Target::processor_specific_flags_,
11028         Target::are_processor_specific_flags_set_): New data member
11029         declarations.
11030         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
11031         Input_objects pointer type parameter.
11032
11033 2009-10-30  Doug Kwan  <dougkwan@google.com>
11034
11035         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
11036
11037 2009-10-28  Ian Lance Taylor  <iant@google.com>
11038
11039         * object.h (class Relobj): Drop options parameter from
11040         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
11041         do_scan_relocs, do_relocate.  Change all callers.
11042         (class Sized_relobj): Drop options parameters from
11043         do_gc_process_relocs, do_scan_relocs, do_relocate,
11044         do_relocate_sections, relocate_sections, emit_relocs_scan,
11045         emit_relocs_scan_reltype.  Change all callers.
11046         (struct Relocate_info): Remove options field and all references to
11047         it.
11048         * reloc.h (class Read_relocs): Remove options constructor
11049         parameter and options_ field.  Change all callers.
11050         (class Gc_process_relocs, class Scan_relocs): Likewise.
11051         (class Relocate_task): Likewise.
11052         * target-reloc.h (scan_relocs): Remove options parameter.  Change
11053         all callers.
11054         (scan_relocatable_relocs): Likewise.
11055         * target.h (class Sized_target): Remove options parameter from
11056         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
11057         all callers.
11058         * gc.h (gc_process_relocs): Remove options parameter.  Change all
11059         callers.
11060         * arm.cc: Update functions to remove options parameters.
11061         * i386.cc: Likewise.
11062         * powerpc.cc: Likewise.
11063         * sparc.cc: Likewise.
11064         * x86_64.cc: Likewise.
11065         * testsuite/testfile.cc: Likewise.
11066
11067 2009-10-28  Doug Kwan  <dougkwan@google.com>
11068
11069         * arm.cc (Arm_relobj): New class definition.
11070         (Arm_relobj::scan_sections_for_stubs,
11071         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
11072         New method definitions.
11073
11074 2009-10-28  Cary Coutant  <ccoutant@google.com>
11075
11076         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
11077         (Plugin::cleanup_done_): New member.
11078         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
11079         (Plugin_manager::cleanup_done_): Remove.
11080         (Plugin_manager::add_input_file): Edit error message.
11081         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
11082         (Plugin_manager::cleanup): Remove use of cleanup_done_.
11083
11084 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
11085
11086         * fileread.cc: (File_read::View::~View): Use the new
11087         data_ownership_ filed.
11088         (File_read::~File_read): Dispose the new whole_file_view_.
11089         (File_read::open): Mmap the whole file if needed.
11090         (File_read::open): Use whole_file_view_ instead of contents_.
11091         (File_read::find_view): Use whole_file_view_ if applicable.
11092         (File_read::do_read): Use whole_file_view_ instead of contents_.
11093         (File_read::make_view): Use whole_file_view_ instead of contents_,
11094         update File_read::View::View call.
11095         (File_read::find_or_make_view): Update File_read::View::View
11096         call.
11097         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
11098         remove contents_
11099         (File_read::View::Data_ownership): New enum.
11100         (File_read::View::View): Replace bool mapped_ with Data_ownership
11101         argument.
11102         (File_read::View::mapped_): Remove (replaced by data_ownership_).
11103         (File_read::View::data_ownership_): New field.
11104         (File_read::contents_): Remove (replaced by whole_file_view_).
11105         (File_read::whole_file_view_): New field.
11106         * options.h (class General_options): Add --keep-files-mapped.
11107
11108 2009-10-27  Cary Coutant  <ccoutant@google.com>
11109
11110         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
11111         * testsuite/Makefile.am (plugin_test_5): New test case.
11112         * testsuite/Makefile.in: Regenerate.
11113
11114 2009-10-25  Doug Kwan  <dougkwan@google.com>
11115
11116         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
11117         from private to protected to allow access by child class.
11118         (Sized_relobj::do_relocate_sections): New method declaration.
11119         (Sized_relobj::relocate_sections): Virtualize.
11120         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
11121         Sized_relobj::relocate_sections.  Instantiate template explicitly
11122         for different target sizes and endianity.
11123
11124 2009-10-24  Doug Kwan  <dougkwan@google.com>
11125
11126         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
11127         (Arm_input_section::as_arm_input_section): New method.
11128         (Arm_output_section): New class definition.
11129         (Arm_output_section::create_stub_group,
11130         Arm_output_section::group_sections): New method definitions.
11131
11132 2009-10-22  Doug Kwan  <dougkwan@google.com>
11133
11134         * arm.cc (Arm_input_section): New class definition.
11135         (Arm_input_section::init, Arm_input_section:do_write,
11136         Arm_input_section::set_final_data_size,
11137         Arm_input_section::do_reset_address_and_file_offset): New method
11138         definitions.
11139
11140 2009-10-21  Doug Kwan  <dougkwan@google.com>
11141
11142         * arm.cc (Stub_table, Arm_input_section): New forward class
11143         declarations.
11144         (Stub_table): New class defintion.
11145         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
11146         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
11147         New method definition.
11148
11149 2009-10-21  Doug Kwan  <dougkwan@google.com>
11150
11151         * arm.cc: Update copyright comments.
11152         (Target_arm): New forward class template declaration.
11153         (Arm_address): New type.
11154         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
11155         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
11156         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
11157         constants.
11158         (Insn_template): Same.
11159         (DEF_STUBS): New macro.
11160         (Stub_type): New enum type.
11161         (Stub_template): New class definition.
11162         (Stub): Same.
11163         (Reloc_stub): Same.
11164         (Stub_factory): Same.
11165         (Target_arm::Target_arm): Initialize may_use_blx_ and
11166         should_force_pic_veneer_.
11167         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
11168         Target_arm::should_force_pic_veneer,
11169         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
11170         Target_arm::using_thumb_only, Target_arm:;default_target): New
11171         method defintions.
11172         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
11173         New data member declarations.
11174         (Insn_template::size, Insn_template::alignment): New method defintions.
11175         (Stub_template::Stub_template): New method definition.
11176         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
11177         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
11178         (Stub_factory::Stub_factory): New method definition.
11179         * gold.h (string_hash): New template.
11180         * output.h (Input_section_specifier::hash_value): Use
11181         gold::string_hash.
11182         (Input_section_specifier::string_hash): Remove.
11183         * stringpool.cc (Stringpool_template::string_hash): Use
11184         gold::string_hash.
11185
11186 2009-10-20  Doug Kwan  <dougkwan@google.com>
11187
11188         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
11189         symbols of relaxed input sections.
11190         * output.h (Output_section::find_relaxed_input_section): Make
11191         method public.
11192
11193 2009-10-16  Doug Kwan  <dougkwan@google.com>
11194
11195         * dynobj.cc (Versions::Versions): Initialize version_script_.
11196         Only insert base version symbol definition for a shared object
11197         if version script defines any version versions.
11198         (Versions::define_base_version): New method definition.
11199         (Versions::add_def): Check that base version is not needed.
11200         (Versions::add_need): Define base version lazily.
11201         * dynobj.h (Versions::define_base_version): New method declaration.
11202         (Versions::needs_base_version_): New data member declaration.
11203         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
11204         (check_DATA): Add no_version_test.stdout.
11205         (libno_version_test.so, no_version_test.o no_version_test.stdout):
11206         New make rules.
11207         * testsuite/Makefile.in: Regenerate.
11208         * testsuite/no_version_test.c: New file.
11209         * testsuite/no_version_test.sh: Ditto.
11210
11211 2009-10-16  Doug Kwan  <dougkwan@google.com>
11212
11213         * expression.cc (class Segment_start_expression): New class definition.
11214         (Segment_start_expression::value): New method definition.
11215         (script_exp_function_segment_start): Return a new
11216         Segment_start_expression.
11217         * gold/script-c.h (script_saw_segment_start_expression): New function
11218         prototype.
11219         * script-sections.cc (Script_sections::Script_sections): Initialize
11220         SAW_SEGMENT_START_EXPRESSION_ to false.
11221         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
11222         and -Tbbs options to specify section addresses if given in
11223         command line and no SEGMENT_START expression is seen in a script.
11224         * script-sections.h (Script_sections::saw_segment_start_expression,
11225         Script_sections::set_saw_segment_start_expression): New method
11226         definition.
11227         (Script_sections::saw_segment_start_expression_): New data member
11228         declaration.
11229         * script.cc (script_saw_segment_start_expression): New function.
11230         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
11231         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
11232         script_test_7.sh and script_test_8.sh.
11233         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
11234         script_test_8.stdout.
11235         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
11236         (script_test_6, script_test_6.stdout, script_test_7,
11237         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
11238         * Makefile.in: Regenerate.
11239         * testsuite/script_test_6.sh: New file.
11240         * testsuite/script_test_6.t: Same.
11241         * testsuite/script_test_7.sh: Same.
11242         * testsuite/script_test_7.t: Same.
11243         * testsuite/script_test_8.sh: Same.
11244
11245 2009-10-16  Doug Kwan  <dougkwan@google.com>
11246
11247         * output.cc (Output_segment::set_section_list_address): Cast
11248         expressions to unsigned long long type to avoid format warnings.
11249
11250 2009-10-15  Ian Lance Taylor  <iant@google.com>
11251
11252         * script.cc (Script_options::add_symbol_assignment): Always add a
11253         dot assignment to script_sections_.
11254         * script-sections.cc (Script_sections::add_dot_assignment):
11255         Initialize if necessary.
11256
11257         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
11258         program headers with no load segment if there is a linker script.
11259
11260         * layout.cc (Layout::set_segment_offsets): Align the file offset
11261         to the segment aligment for -N or -n with no load segment.
11262         * output.cc (Output_segment::add_output_section): Don't crash if
11263         the first section is a TLS section.
11264         (Output_segment::set_section_list_addresses): Print an error
11265         message if the address moves backward in a linker script.
11266         * script-sections.cc
11267         (Output_section_element_input::set_section_addresses): Don't
11268         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
11269         (Orphan_output_section::set_section_addresses): Likewise.
11270
11271 2009-10-15  Doug Kwan  <dougkwan@google.com>
11272
11273         * layout.cc (Layout::finish_dynamic_section): Generate tags
11274         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
11275         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
11276         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
11277
11278 2009-10-14  Ian Lance Taylor  <iant@google.com>
11279
11280         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
11281         fields.
11282         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
11283         data_shdr fields of relinfo.
11284         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
11285         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
11286         R_386_TLS_LDO_32, adjust based on section flags.
11287         (Target_i386::Relocate::fix_up_ldo): Remove.
11288
11289 2009-10-13  Ian Lance Taylor  <iant@google.com>
11290
11291         Add support for -pie.
11292         * options.h (class General_options): Add -pie and
11293         --pic-executable.
11294         (General_options::output_is_position_independent): Test -pie.
11295         (General_options::output_is_executable): Return true if not shared
11296         and not relocatable.
11297         (General_options::output_is_pie): Remove.
11298         * options.cc (General_options::finalize): Reject incompatible uses
11299         of -pie.
11300         * gold.cc (queue_middle_tasks): A -pie link is not static.
11301         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
11302         * symtab.cc (Symbol::final_value_is_known): Return false if
11303         output_is_position_independent.
11304         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
11305         output_is_position_independent.
11306         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
11307         output_is_position_independent.
11308         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
11309         output_is_position_independent.
11310         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
11311         two_file_pie_test.
11312         (basic_pie_test.o, basic_pie_test): New targets.
11313         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
11314         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
11315         (two_file_pie_test): New target.
11316         * testsuite/Makefile.in: Rebuild.
11317         * README: Remove note saying that -pie is not supported.
11318
11319 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
11320
11321         * options.h (class General_options): Add -init and -fini.
11322         * layout.cc (Layout::finish_dynamic_section): Emit
11323         given init and fini functions.
11324
11325 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
11326
11327         * gc.h (gc_process_relocs): Check if icf is enabled using new
11328         function.
11329         * gold.cc (queue_initial_tasks): Likewise.
11330         (queue_middle_tasks): Likewise.
11331         * object.cc (do_layout): Likewise.
11332         * symtab.cc (is_section_folded): Likewise.
11333         * main.cc (main): Likewise.
11334         * reloc.cc (Read_relocs::run): Likewise.
11335         (Sized_relobj::do_scan_relocs): Likewise.
11336         * icf.cc (is_function_ctor_or_dtor): New function.
11337         (Icf::find_identical_sections): Check if function is ctor or dtor when
11338         safe icf is chosen.
11339         * options.h (General_options::icf): Change option to be an enum.
11340         (Icf_status): New enum.
11341         (icf_enabled): New method.
11342         (icf_safe_folding): New method.
11343         (set_icf_status): New method.
11344         (icf_status_): New variable.
11345         * (options.cc) (General_options::finalize): Set icf_status_.
11346         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
11347         icf_test and icf_keep_unique_test to use the --icf enum flag.
11348         * testsuite/icf_safe_test.sh: New file.
11349         * testsuite/icf_safe_test.cc: New file.
11350
11351 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
11352
11353         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
11354         includes to gc.h and icf.h.
11355         * arm.cc: Include gc.h.
11356         * gold.cc: Likewise.
11357         * i386.cc: Likewise.
11358         * powerpc.cc: Likewise.
11359         * sparc.cc: Likewise.
11360         * x86_64.cc: Likewise.
11361         * gc.h: Include icf.h.
11362
11363 2009-10-11  Ian Lance Taylor  <iant@google.com>
11364
11365         * plugin.cc: Include "gold.h" before other header files.
11366
11367 2009-10-10  Chris Demetriou  <cgd@google.com>
11368
11369         * options.h (Input_file_argument::Input_file_type): New enum.
11370         (Input_file_argument::is_lib_): Replace with...
11371         (Input_file_argument::type_): New member.
11372         (Input_file_argument::Input_file_argument): Take Input_file_type
11373         'type' rather than boolean 'is_lib' as second argument.
11374         (Input_file_argument::is_lib): Use type_.
11375         (Input_file_argument::is_searched_file): New function.
11376         (Input_file_argument::may_need_search): Handle is_searched_file.
11377         * options.cc (General_options::parse_library): Support -l:filename.
11378         (General_options::parse_just_symbols): Update for Input_file_argument
11379         changes.
11380         (Command_line::process): Likewise.
11381         * archive.cc (Archive::get_file_and_offset): Likewise.
11382         * plugin.cc (Plugin_manager::release_input_file): Likewise.
11383         * script.cc (read_script_file, script_add_file): Likewise.
11384         * fileread.cc (Input_file::Input_file): Likewise.
11385         (Input_file::will_search_for): Handle is_searched_file.
11386         (Input_file::open): Likewise.
11387         * readsyms.cc (Read_symbols::get_name): Likewise.
11388         * testsuite/Makefile.am (searched_file_test): New test.
11389         * testsuite/Makefile.in: Regenerate.
11390         * testsuite/searched_file_test.cc: New file.
11391         * testsuite/searched_file_test_lib.cc: New file.
11392
11393 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11394             Ian Lance Taylor  <iant@google.com>
11395
11396         * descriptor.cc: Include <cstdio> and "binary-io.h".
11397         (Descriptors::open): Open the files in binary mode always.
11398         * script.cc (Lex::get_token): Treat \r as whitespace.
11399
11400 2009-10-09  Ian Lance Taylor  <iant@google.com>
11401
11402         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
11403
11404 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11405             Ian Lance Taylor  <iant@google.com>
11406
11407         * configure.ac: Check for readv function also.
11408         * fileread.cc (readv): Define if not HAVE_READV.
11409         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
11410         does not exist.
11411         * config.in: Regenerate.
11412         * configure: Regenerate.
11413
11414 2009-10-09  Doug Kwan  <dougkwan@google.com>
11415
11416         * layout.cc (Layout::make_output_section): Call target hook to make
11417         ordinary output section.
11418         (Layout::finalize): Adjust parameter list of call the
11419         Target::may_relax().
11420         * layout.h (class Layout::section_list): New method.
11421         * merge.h (Output_merge_base::entsize): Change visibility to public.
11422         (Output_merge_base::is_string, Output_merge_base::do_is_string):
11423         New methods.
11424         (Output_merge_string::do_is_string): New method.
11425         * object.cc (Sized_relobj::do_setup): renamed from
11426         Sized_relobj::set_up.
11427         * object.h (Sized_relobj::adjust_shndx,
11428         Sized_relobj::initializ_input_to_output_maps,
11429         Sized_relobj::free_input_to_output_maps): Change visibilities to
11430         protected.
11431         (Sized_relobj::setup): Virtualize.
11432         (Sized_relobj::do_setup): New method declaration.
11433         (Sized_relobj::invalidate_section_offset,
11434         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
11435         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
11436         * options.cc (parse_int): New function.
11437         * options.h (parse_int): New declaration.
11438         (DEFINE_int): New macro.
11439         (stub_group_size): New option.
11440         * output.cc (Output_section::Output_section): Initialize memebers
11441         merge_section_map_, merge_section_by_properties_map_,
11442         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
11443         (Output_section::add_input_section): Handled deferred code-fill
11444         generation and remove an old comment.
11445         (Output_section::add_relaxed_input_section): New method definition.
11446         (Output_section::add_merge_input_section): Use merge section by
11447         properties map to speed to search.  Update merge section maps
11448         as appropriate.
11449         (Output_section::build_relaxation_map): New method definition.
11450         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
11451         Same.
11452         (Output_section::relax_input_section): Renamed to
11453         Output_section::convert_input_sections_to_relaxed_sections and change
11454         interface to take a vector of pointers to relaxed sections.
11455         (Output_section::find_merge_section,
11456         Output_section::find_relaxed_input_section): New method definitions.
11457         (Output_section::is_input_address_mapped,
11458         Output_section::output_offset, Output_section::output_address):
11459         Use output section data maps to speed up searching.
11460         (Output_section::find_starting_output_address): Add comments.
11461         (Output_section::do_write,
11462         Output_section::write_to_postprocessing_buffer): Do code-fill
11463         generation as appropriate.
11464         (Output_section::get_input_sections): Invalidate relaxed input section
11465         map.
11466         (Output_section::restore_states): Adjust type of checkpoint .
11467         Invalidate relaxed input section map.
11468         * output.h (Output_merge_base): New class declaration.
11469         (Input_section_specifier): New class defintion.
11470         (class Output_relaxed_input_section) Change base class to
11471         Output_section_data_build.
11472         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
11473         base class initializer.
11474         (Output_section::add_relaxed_input_section): New method declaration.
11475         (Output_section::Input_section): Change visibility to protected.
11476         (Output_section::Input_section::relobj,
11477         Output_section::Input_section::shndx): Handle relaxed input sections.
11478         Output_section::input_sections) Change visibility to protected.  Also
11479         define overload to return a non-const pointer.
11480         (Output_section::Merge_section_properties): New class defintion.
11481         (Output_section::Merge_section_by_properties_map,
11482         Output_section::Output_section_data_by_input_section_map,
11483         Output_section::Relaxation_map): New types.
11484         (Output_section::relax_input_section): Rename method to
11485         Output_section::convert_input_sections_to_relaxed_sections and change
11486         interface to take a vector of relaxed section pointers.
11487         (Output_section::find_merge_section,
11488         Output_section::find_relaxed_input_section,
11489         Output_section::build_relaxation_map,
11490         Output_section::convert_input_sections_in_list_to_relaxed_sections):
11491         New method declarations.
11492         (Output_section::merge_section_map_
11493         Output_section::merge_section_by_properties_map_,
11494         Output_section::relaxed_input_section_map_,
11495         Output_section::is_relaxed_input_section_map_valid_,
11496         Output_section::generate_code_fills_at_write_): New data members.
11497         * script-sections.cc
11498         (Output_section_element_input::set_section_addresses): Call
11499         current_data_size and addralign methods of relaxed input sections.
11500         (Orphan_output_section::set_section_addresses): Call current_data_size
11501         and addralign methods of relaxed input sections.
11502         * symtab.cc (Symbol_table::compute_final_value): Extract template
11503         from the body of Symbol_table::sized_finalize_symbol.
11504         (Symbol_table::sized_finalized_symbol): Call
11505         Symbol_table::compute_final_value.
11506         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
11507         (Symbol_table::compute_final_value): New templated method declaration.
11508         * target.cc (Target::do_make_output_section): New method defintion.
11509         * target.h (Target::make_output_section): New method declaration.
11510         (Target::relax): Add more parameters for input objects, symbol table
11511         and layout.  Adjust call to do_relax.
11512         (Target::do_make_output_section): New method declaration.
11513         (Target::do_relax): Add parameters for input objects, symbol table
11514         and layout.
11515
11516 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11517
11518         * pread.c: Include stdio.h.
11519
11520 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11521
11522         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
11523         defined.
11524
11525 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11526
11527         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
11528         Change read_shndx type to unsigned int.
11529         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
11530         int.
11531         (Sized_dwarf_line_info::read_line_mappings): Likewise.
11532         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
11533         Change read_shndx type to unsigned int.
11534         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
11535         int.
11536         (Sized_dwarf_line_info::read_line_mappings): Likewise.
11537         * layout.cc (Layout::create_symtab_sections): Cast the result of
11538         local_symcount * symsize to off_t in the gold_assert.
11539
11540 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11541
11542         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
11543         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
11544         R_ARM_BASE_ABS.
11545         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
11546         (Arm_relocate_functions::thm_abs5): New function.
11547         (Arm_relocate_functions::abs12): New function.
11548         (Arm_relocate_functions::abs16): New function.
11549         (Arm_relocate_functions::base_abs): New function.
11550         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
11551         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
11552         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
11553         R_ARM_BASE_ABS.
11554         (Scan::global): Likewise.
11555         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
11556         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
11557         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
11558         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
11559         R_ARM_BASE_ABS.
11560
11561 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11562
11563         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
11564         (Arm_relocate_functions::movt_prel): New function.
11565         (Arm_relocate_functions::thm_movw_prel_nc): New function.
11566         (Arm_relocate_functions::thm_movt_prel): New function.
11567         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
11568         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
11569         (Scan::global, Relocate::relocate): Likewise.
11570         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11571
11572 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
11573
11574         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
11575         Incremental_checker.
11576         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
11577         unsigned int.
11578         (class Incremental_inputs_header): New class.
11579         (Incremental_inputs_header_writer): Edit comment.
11580         (Incremental_inputs_entry): New class.
11581         (Incremental_inputs_entry_writer): Edit comment.
11582         (Sized_incremental_binary::do_find_incremental_inputs_section):
11583         Add *strtab_shndx parameter, fill it.
11584         (Sized_incremental_binary::do_check_inputs): New method.
11585         (Incremental_checker::can_incrementally_link_output_file): Use
11586         Sized_incremental_binary::check_inputs.
11587         (Incremental_inputs::report_command_line): Save command line in
11588         command_line_.
11589         * incremental.h:
11590         (Incremental_binary::find_incremental_inputs_section): New
11591         method.
11592         (Incremental_binary::do_find_incremental_inputs_section): Add
11593         strtab_shndx parameter.
11594         (Incremental_binary::do_check_inputs): New pure virtual method.
11595         (Sized_incremental_binary::do_check_inputs): Declare.
11596         (Incremental_checker::Incremental_checker): Add incremental_inputs
11597         parameter, use it to initialize incremental_inputs_.
11598         (Incremental_checker::incremental_inputs_): New field.
11599         (Incremental_checker::command_line): New method.
11600         (Incremental_checker::inputs): New method.
11601         (Incremental_checker::command_line_): New field.
11602
11603 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
11604
11605         * incremental.cc: Include <cstdarg> and "target-select.h".
11606         (vexplain_no_incremental): New function.
11607         (explain_no_incremental): New function.
11608         (Incremental_binary::error): New method.
11609         (Sized_incremental_binary::do_find_incremental_inputs_section): New
11610         method.
11611         (make_sized_incremental_binary): New function.
11612         (open_incremental_binary): New function.
11613         (can_incrementally_link_file): Add checks if output is ELF and has
11614         inputs section.
11615         * incremental.h: Include "elfcpp_file.h" and "output.h".
11616         (Incremental_binary): New class.
11617         (Sized_incremental_binary): New class.
11618         (open_incremental_binary): Declare.
11619         * object.cc (is_elf_object): Use
11620         elfcpp::Elf_recognizer::is_elf_file.
11621         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
11622         * output.h (Output_file::filesize): New method.
11623
11624 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11625
11626         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
11627         New function.
11628         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
11629         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
11630         function.
11631         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
11632         function.
11633         (Arm_relocate_functions::movw_abs_nc): New function.
11634         (Arm_relocate_functions::movt_abs): New function.
11635         (Arm_relocate_functions::thm_movw_abs_nc): New function.
11636         (Arm_relocate_functions::thm_movt_abs): New function.
11637         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
11638         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
11639         (Scan::global): Likewise.
11640         (Relocate::relocate): Likewise.
11641         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11642
11643 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11644
11645         * arm.cc (Arm_relocate_functions::got_prel) New function.
11646         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
11647         (Relocate::relocate): Likewise.
11648         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11649
11650 2009-10-06  Ian Lance Taylor  <iant@google.com>
11651
11652         * options.h (class General_options): Define
11653         split_stack_adjust_size parameter.
11654         * object.h (class Object): Add uses_split_stack_ and
11655         has_no_split_stack_ fields.  Add uses_split_stack and
11656         has_no_split_stack accessor functions.  Declare
11657         handle_split_stack_section.
11658         (class Reloc_symbol_changes): Define.
11659         (class Sized_relobj): Define Function_offsets.  Declare
11660         split_stack_adjust, split_stack_adjust_reltype, and
11661         find_functions.
11662         * object.cc (Object::handle_split_stack_section): New function.
11663         (Sized_relobj::do_layout): Call handle_split_stack_section.
11664         * dynobj.cc (Sized_dynobj::do_layout): Call
11665         handle_split_stack_section.
11666         * reloc.cc (Sized_relobj::relocate_sections): Call
11667         split_stack_adjust for executable sections in split_stack
11668         objects.  Pass reloc_map to relocate_section.
11669         (Sized_relobj::split_stack_adjust): New function.
11670         (Sized_relobj::split_stack_adjust_reltype): New function.
11671         (Sized_relobj::find_functions): New function.
11672         * target-reloc.h: Include "object.h".
11673         (relocate_section): Add reloc_symbol_changes parameter.  Change
11674         all callers.
11675         * target.h (class Target): Add calls_non_split method.  Declare
11676         do_calls_non_split virtual method.  Declare match_view and
11677         set_view_to_nop.
11678         * target.cc: Include "elfcpp.h".
11679         (Target::do_calls_non_split): New function.
11680         (Target::match_view): New function.
11681         (Target::set_view_to_nop): New function.
11682         * gold.cc (queue_middle_tasks): Give an error if mixing
11683         split-stack and non-split-stack objects with -r.
11684         * i386.cc (Target_i386::relocate_section): Add
11685         reloc_symbol_changes parameter.
11686         (Target_i386::do_calls_non_split): New function.
11687         * x86_64.cc (Target_x86_64::relocate_section): Add
11688         reloc_symbol_changes parameter.
11689         (Target_x86_64::do_calls_non_split): New function.
11690         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
11691         parameter.
11692         * powerpc.cc (Target_powerpc::relocate_section): Add
11693         reloc_symbol_changes parameter.
11694         * sparc.cc (Target_sparc::relocate_section): Add
11695         reloc_symbol_changes parameter.
11696         * configure.ac: Call AM_CONDITIONAL for the default target.
11697         * configure: Rebuild.
11698         * testsuite/Makefile.am (TEST_AS): New variable.
11699         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
11700         (check_DATA): Add split_i386 and split_x86_64 files.
11701         (SPLIT_DEFSYMS): Define.
11702         (split_i386_[1234n].o): New targets.
11703         (split_i386_[124]): New targets.
11704         (split_i386_[1234r].stdout): New targets.
11705         (split_x86_64_[1234n].o): New targets.
11706         (split_x86_64_[124]): New targets.
11707         (split_x86_64_[1234r].stdout): New targets.
11708         (MOSTLYCLEANFILES): Add new executables.
11709         * testsuite/split_i386.sh: New file.
11710         * testsuite/split_x86_64.sh: New file.
11711         * testsuite/split_i386_1.s: New file.
11712         * testsuite/split_i386_2.s: New file.
11713         * testsuite/split_i386_3.s: New file.
11714         * testsuite/split_i386_4.s: New file.
11715         * testsuite/split_i386_n.s: New file.
11716         * testsuite/split_x86_64_1.s: New file.
11717         * testsuite/split_x86_64_2.s: New file.
11718         * testsuite/split_x86_64_3.s: New file.
11719         * testsuite/split_x86_64_4.s: New file.
11720         * testsuite/split_x86_64_n.s: New file.
11721         * testsuite/testfile.cc (Target_test): Update relocation_section
11722         function.
11723         * testsuite/Makefile.in: Rebuild.
11724
11725 2009-10-06  Ian Lance Taylor  <iant@google.com>
11726
11727         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
11728         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
11729         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
11730         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
11731         the address on ldo_addrs_.
11732         (Target_i386::Relocate::fix_up_ldo): New function.
11733
11734 2009-10-06   Rafael Espindola  <espindola@google.com>
11735
11736         * plugin.cc (add_input_library): New.
11737         (Plugin::load): Add add_input_library to tv.
11738         (Plugin_manager::add_input_file): Add the is_lib argument.
11739         (add_input_file): Update call to Plugin_manager::add_input_file.
11740         (add_input_library): New.
11741         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
11742
11743 2009-09-30  Doug Kwan  <dougkwan@google.com>
11744
11745         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
11746         symbol and call Symbol::may_need_copy_reloc to determine if
11747         a copy reloc is needed.
11748         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
11749         nocopyreloc is given in command line.
11750         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
11751         given in command line.
11752         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
11753         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
11754         of the removed Target_i386::may_need_copy_reloc.
11755         * options.h (copyreloc): New option with default value false.
11756         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
11757         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
11758         instead of the removed Target_powerpc::may_need_copy_reloc.
11759         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
11760         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
11761         instead of the removed Target_sparc::may_need_copy_reloc.
11762         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
11763         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
11764         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
11765         instead of the removed Target_x86_64::may_need_copy_reloc.
11766
11767 2009-09-30  Ian Lance Taylor  <iant@google.com>
11768
11769         * object.h (class Object): Remove target_ field, and target,
11770         sized_target, and set_target methods.
11771         (Object::sized_target): Remove.
11772         (class Sized_relobj): Update declarations.  Remove sized_target.
11773         * object.cc (Sized_relobj::setup): Remove target parameter.
11774         Change all callers.
11775         (Input_objects::add_object): Don't do anything with the target.
11776         (make_elf_sized_object): Add punconfigured parameter.  Change all
11777         callers.  Set or test parameter target.
11778         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
11779         Change all callers.
11780         * parameters.cc (Parameters::set_target): Change parameter type to
11781         be non-const.
11782         (Parameters::default_target): Remove.
11783         (set_parameters_target): Change parameter type to be non-const.
11784         (parameters_force_valid_target): New function.
11785         (parameters_clear_target): New function.
11786         * parameters.h (class Parameters): Update declarations.  Remove
11787         default_target method.  Add sized_target and clear_target
11788         methods.  Change target_ to be non-const.
11789         (set_parameters_target): Update declaration.
11790         (parameters_force_valid_target): Declare.
11791         (parameters_clear_target): Declare.
11792         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
11793         as NULL if we aren't searching.
11794         (Add_symbols::run): Don't check for compatible target.
11795         * fileread.cc (Input_file::open_binary): Call
11796         parameters_force_valid_target.
11797         * gold.cc (queue_middle_tasks): Likewise.
11798         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
11799         set_target on object.
11800         * dynobj.h (class Sized_dynobj): Update declarations.
11801         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
11802         make_elf_object returns NULL.
11803         (Archive::include_member): Don't check whether object target is
11804         compatible.
11805         * output.cc (Output_section::add_input_section): Get target from
11806         parameters.
11807         (Output_section::relax_input_section): Likewise.
11808         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
11809         parameters.
11810         (Sized_relobj::do_scan_relocs): Likewise.
11811         (Sized_relobj::relocate_sections): Likewise.
11812         * resolve.cc (Symbol_table::resolve): Likewise.
11813         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
11814         parameter.  Change all callers.
11815         (Symbol_table::add_from_object): Get target from parameters.
11816         (Symbol_table::add_from_relobj): Don't check object target.
11817         (Symbol_table::add_from_dynobj): Likewise.
11818         (Symbol_table::define_special_symbol): Get target from
11819         parameters.
11820         * symtab.h (class Symbol_table): Update declaration.
11821         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
11822         parameter.  Change all callers.  Clear parameter target.
11823         (Binary_test): Test target here.
11824         * testsuite/object_unittest.cc (gold_testsuite): Remove
11825         target_test_pointer parameter.  Change all callers.
11826         (Object_test): Test target here.
11827
11828 2009-09-26  Ian Lance Taylor  <iant@google.com>
11829
11830         * testsuite/initpri1.c: Don't try to use constructor priorities if
11831         compiling with gcc before 4.3.
11832
11833 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
11834
11835         * testsuite/retain_symbols_file_test.sh (check_present): Change
11836         output file name to retain_symbols_file_test.stdout.
11837         (check_absent): Likewise.
11838
11839 2009-09-18  Craig Silverstein  <csilvers@google.com>
11840
11841         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
11842         * options.cc: Include <cerrno> and <fstream>.
11843         (General_options::finalize): Parse -retain-symbols-file tag.
11844         * options.h: New flag.
11845         (General_options): New method should_retain_symbol, new
11846         variable symbols_to_retain.
11847         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
11848         should_retain_symbol map.
11849         * testsuite/Makefile.am (retain_symbols_file_test): New test.
11850         * testsuite/Makefile.in: Regenerate.
11851         * testsuite/retain_symbols_file_test.sh: New file.
11852
11853 2009-09-18  Nick Clifton  <nickc@redhat.com>
11854
11855         * po/es.po: Updated Spanish translation.
11856
11857 2009-09-17  Doug Kwan  <dougkwan@google.com>
11858
11859         * debug.h (DEBUG_RELAXATION): New constant.
11860         (DEBUG_ALL): Add DEBUG_RELAXATION.
11861         (debug_string_to_enum): Add relaxation debug option.
11862         * layout.cc
11863         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
11864         Layout::Relaxation_debug_check::read_sections,
11865         Layout::Relaxation_debug_check::read_sections): New method definitions.
11866         (Layout::Layout): Initialize data members
11867         record_output_section_data_from_scrips_,
11868         script_output_section_data_list_ and relaxation_debug_check_.
11869         (Layout::save_segments, Layout::restore_segments,
11870         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
11871         Layout::relaxation_loop_body): New method definitions.
11872         (Layout::finalize): Support relaxation.  Move section layout code to
11873         Layout::relaxation_loop_body.
11874         (Layout::set_asection_address_from_script): Move code for orphan
11875         section placement out.
11876         (Layout::place_orphan_sections_in_script): New method definition.
11877         * layout.h (Output_segment_headers, Output_file_header):
11878         New forward class declarations.
11879         (Layout::~Layout): Define.
11880         (Layout::new_output_section_data_from_script): New method definition.
11881         (Layout::place_orphan_sections_in_script): New method declaration.
11882         (Layout::Segment_states): New type declaration.
11883         (Layout::save_segments, Layout::restore_segments,
11884         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
11885         Layout::relaxation_loop_body): New method declarations.
11886         (Layout::Output_section_data_list): New type declaration.
11887         (Layout::Relaxation_debug_check): New class definition.
11888         (Layout::record_output_section_data_from_script_,
11889         Layout::script_output_section_data_list_, Layout::segment_states_,
11890         Layout::relaxation_debug_check_): New data members.
11891         * output.cc: (Output_section_headers::do_size): New method definition.
11892         (Output_section_headers::Output_section_headers): Move size
11893         computation to Output_section_headers::do_size.
11894         (Output_segment_headers::do_size): New method definition.
11895         (Output_file_header::Output_file_header): Move size computation to
11896         Output_file_header::do_size and call it.
11897         (Output_file_header::do_size): New method definition.
11898         (Output_data_group::Output_data_group): Adjust call to
11899         Output_section_data.
11900         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
11901         (Output_symtab_xindex::do_write): Add array bound check.
11902         (Output_section::Input_section::print_to_mapfile): Handle
11903         RELAXED_INPUT_SECTION_CODE.
11904         (Output_section::Output_section): Initialize data member checkpoint_.
11905         (Output_section::~Output_section): Delete checkpoint object pointed
11906         by checkpoint_.
11907         (Output_section::add_input_section): Always add an Input_section if
11908         relaxing.
11909         (Output_section::add_merge_input_section): Add assert.
11910         (Output_section::relax_input_section): New method definition.
11911         (Output_section::set_final_data_size): Set load address to zero for
11912         an unallocated section.
11913         (Output_section::do_address_and_file_offset_have_reset_values):
11914         New method definition.
11915         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
11916         Handle relaxed input section.
11917         (Output_section::sort_attached_input_sections): Checkpoint input
11918         section list lazily.
11919         (Output_section::get_input_sections): Change type of input_sections to
11920         list of Simple_input_section pointers.  Checkpoint input section list
11921         lazily.  Also handle relaxed input sections.
11922         (Output_section::add_input_section_for_script): Take a reference to
11923         a Simple_input_section object instead of Relobj pointer and section
11924         index as parameter.  Handle relaxed input sections.
11925         (Output_section::save_states, Output_section::restore_states): New
11926         method definitions.
11927         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
11928         (Output_data::is_data_size_fixed): New method definition.
11929         (Output_data::reset_addresss_and_file_offset): Do not reset data size
11930         if it is fixed.
11931         (Output_data::address_and_file_offset_have_reset_values): New method
11932         definition.
11933         (Output_data::do_address_and_file_offset_have_reset_values): New method
11934         definition.
11935         (Output_data::set_data_size): Check that data size is not fixed.
11936         (Output_data::fix_data_size): New method definition.
11937         (Output_data::is_data_size_fixed_): New data member.
11938         (Output_section_headers::set_final_data_size): New method definition.
11939         (Output_section_headers::do_size): New method declaration.
11940         (Output_segment_headers::set_final_data_size): New method definition.
11941         (Output_segment_headers::do_size): New method declaration.
11942         (Output_file_header::set_final_data_size)::New method definition.
11943         (Output_file_header::do_size)::New method declaration.
11944         (Output_section_data::Output_section_data): Add new parameter
11945         is_data_size_fixed and use it to fix data size.
11946         (Output_data_const::Output_data_const): Adjust call to base class
11947         constructor and fix data size.
11948         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
11949         base class constructor and fix data size.
11950         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
11951         base class constructor and fix data size.
11952         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
11953         class constructor and fix data size.
11954         (Output_data_group::set_final_data_size): New method definition.
11955         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
11956         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
11957         class constructor and fix data size.
11958         (Output_relaxed_input_section): New class definition.
11959         (Output_section::Simple_input_section): New class definition.
11960         (Output_section::get_input_sections): Adjust parameter list.
11961         (Output_section::add_input_section_for_script): Same.
11962         (Output_section::save_states, Output_section::restore_states,
11963         Output_section::do_address_and_file_offset_have_reset_values,
11964         (Output_section::Input_section::Input_section): Handle
11965         RELAXED_INPUT_SECTION_CODE.  Add new overload for
11966         Output_relaxed_input_section.
11967         (Output_section::Input_section::is_input_section,
11968         Output_section::Input_section::set_output_section): Handle relaxed
11969         input section.
11970         (Output_section::Input_section::is_relaxed_input_section,
11971         Output_section::Input_section::output_section_data,
11972         Output_section::Input_section::relaxed_input_section): New method
11973         definitions.
11974         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
11975         value.
11976         (Output_section::Input_section::u1_): Update comments.
11977         (Output_section::Input_section::u2_): Add new union member poris.
11978         (Output_section::Checkpoint_output_section): New classs definition.
11979         (Output_section::relax_input_section): New method declaration.
11980         (Output_section::checkpoint_): New data member.
11981         (Output_segment): Update comments.
11982         (Output_segment::Output_segment): Un-privatize copy constructor.
11983         (Output_segment::operator=): Un-privatize.
11984         * script-sections.cc (Output_section_element::Input_section_list):
11985         Change element type to Output_section::Simple_input_section.
11986         (Output_section_element_dot_assignment::set_section_addresses):
11987         Register output section data for relaxation clean up.
11988         (Output_data_exression::Output_data_expression): Adjust call to base
11989         constructor to fix data size.
11990         (Output_section_element_data::set_section_addresses): Register
11991         Output_data_expression object for relaxation clean up.
11992         (struct Input_section_info): Replace Relobj pointer and section index
11993         pair with Output_section::Simple_input_section and Convert struct to a
11994         class.
11995         (Input_section_sorter::operator()): Adjust access to
11996         Input_section_info data member to use accessors.
11997         (Output_section_element_input::set_section_addresses): Use layout
11998         parameter.  Adjust code to use Output_section::Simple_input_section
11999         and Input_secction_info classes.  Register filler for relaxation
12000         clean up.
12001         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
12002         and section index pair with Output_section::Simple_input_section
12003         class.  Adjust code accordingly.
12004         (Phdrs_element::release_segment): New method definition.
12005         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
12006         segment list.
12007         (Script_sections::release_segments): New method definition.
12008         * gold/script-sections.h (Script_sections::release_segments): New
12009         method declaration.
12010         * gold/target.h (Target::may_relax, Target::relax,
12011         Target::do_may_relax, Target::do_relax): New method definitions.
12012
12013 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
12014
12015         * arm.cc (has_signed_unsigned_overflow): New function.
12016         (Arm_relocate_functions::abs8): New function.
12017         (Target_arm::Scan::local): Handle R_ARM_ABS8.
12018         (Target_arm::Scan::global): Likewise.
12019         (Target_arm::relocate::relocate): Likewise.
12020         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
12021         Likewise.
12022
12023 2009-09-16  Cary Coutant  <ccoutant@google.com>
12024
12025         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
12026         * testsuite/Makefile.in: Regenerate.
12027
12028 2009-09-11  Nick Clifton  <nickc@redhat.com>
12029
12030         * po/gold.pot: Updated by the Translation project.
12031
12032 2009-09-08  Cary Coutant  <ccoutant@google.com>
12033
12034         * output.cc (Output_file::open): Add execute permission to empty file.
12035         * testsuite/Makefile.am (permission_test): New test.
12036         * testsuite/Makefile.in: Regenerate.
12037
12038 2009-09-02  Ian Lance Taylor  <iant@google.com>
12039
12040         * output.cc (Output_file::resize): Call map_no_anonymous rather
12041         than map.
12042
12043 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
12044
12045         * gold.cc: Include "incremental.h".
12046         (queue_initial_tasks): Call Incremental_checker methods.
12047         * incremental.cc: Include "output.h".
12048         (Incremental_checker::can_incrementally_link_output_file): New
12049         method.
12050         * incremental.h (Incremental_checker): New class.
12051
12052         * output.cc (Output_file::open_for_modification): New method.
12053         (Output_file::map_anonymous): Changed return type to bool.  Record
12054         map in base_ field.
12055         (Output_file::map_no_anonymous): New method, broken out of map.
12056         (Output_file::map): Use map_no_anonymous and map_anonymous.
12057         * output.h (class Output_file): Update declarations.
12058
12059 2009-08-24  Cary Coutant  <ccoutant@google.com>
12060
12061         * options.h (Command_line::Pre_options): New class.
12062         (Command_line::pre_options): New member.
12063         * options.cc (gold::options::ready_to_register): New variable.
12064         (One_option::register_option): Do nothing if not registering options.
12065         Assert if same short option registered twice.
12066         (General_options::General_options): Turn off option registration when
12067         done constructing.
12068         (Command_line::Pre_options::Pre_options): New constructor.
12069
12070 2009-08-24  Cary Coutant  <ccoutant@google.com>
12071
12072         * options.h (General_options::no_keep_memory): Remove incorrect
12073         short option.
12074
12075 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
12076
12077         * Makefile.am (am__skiplex, am__skipyacc): New.
12078         * Makefile.in: Regenerate.
12079
12080 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
12081
12082         * Makefile.am (AM_CPPFLAGS): Renamed from ...
12083         (INCLUDES): ... this.
12084         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
12085         (AM_CPPFLAGS): Renamed from ...
12086         (INCLUDE): ... this.
12087         * Makefile.in, testsuite/Makefile.in: Regenerate.
12088
12089         * Makefile.in: Regenerate.
12090         * aclocal.m4: Likewise.
12091         * config.in: Likewise.
12092         * configure: Likewise.
12093         * testsuite/Makefile.in: Likewise.
12094
12095         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
12096         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
12097         * Makefile.in: Regenerate.
12098         * testsuite/Makefile.in: Regenerate.
12099
12100 2009-08-19  Cary Coutant  <ccoutant@google.com>
12101
12102         * resolve.cc (Symbol_table::resolve): Don't complain about defined
12103         symbols in shared libraries overridden by hidden or internal symbols
12104         in the main program.
12105
12106 2009-08-19  Chris Demetriou  <cgd@google.com>
12107
12108         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
12109         checking source file names in error messages.
12110
12111 2009-08-18  Doug Kwan  <dougkwan@google.com>
12112
12113         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
12114         an elcpp::Ehdr as parameter.  Adjust call to set_target.
12115         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
12116         an elfcpp::Ehdr as parameter.
12117         * object.cc (Object::set_target): Remove the version that looks up
12118         a target and sets it.
12119         (Sized_relobj::setup): Take a Target object instead of
12120         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
12121         (make_elf_sized_object): Find target and ask target to
12122         make an ELF object.
12123         * object.h: (Object::set_target): Remove the version that looks up
12124         a target and sets it.
12125         (Sized_relobj::setup): Take a Target object instead of
12126         an elfcpp:Ehdr as parameter.
12127         * target.cc: Include dynobj.h.
12128         (Target::do_make_elf_object_implementation): New.
12129         (Target::do_make_elf_object): New.
12130         * target.h (Target::make_elf_object): New template declaration.
12131         (Target::do_make_elf_object): New method declarations.
12132         (Target::do_make_elf_object_implementation): New template declaration.
12133
12134 2009-08-14  Ian Lance Taylor  <iant@google.com>
12135
12136         * gold.h (FUNCTION_NAME): Define.
12137         (gold_unreachable): Use FUNCTION_NAME.
12138
12139 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
12140
12141         * icf.cc (Icf::find_identical_sections): Issue a warning when a
12142         symbol in the --keep-unique list is not found.
12143
12144 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
12145
12146         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
12147         been maked as --keep-unique.
12148         (Icf::unfold_section): New function.
12149         * icf.h (Icf::unfold_section): New function.
12150         * options.h (General_options::keep_unique): New option.
12151         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
12152         * testsuite/Makefile.in: Regenerate.
12153         * testsuite/icf_keep_unique_test.sh: New file.
12154         * testsuite/icf_keep_unique_test.cc: New file.
12155
12156 2009-08-12  Cary Coutant  <ccoutant@google.com>
12157
12158         PR 10471
12159         * resolve.cc (Symbol_table::resolve): Check for references from
12160         dynamic objects to hidden and internal symbols.
12161         * testsuite/Makefile.am (hidden_test.sh): New test.
12162         * testsuite/Makefile.in: Regenerate.
12163         * testsuite/hidden_test.sh: New script.
12164         * testsuite/hidden_test_1.c: New test source.
12165         * testsuite/hidden_test_main.c: New test source.
12166
12167 2009-08-11  Doug Kwan  <dougkwan@google.com>
12168
12169         * arm.cc: Update comments.
12170         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
12171         segment to locate the .ARM.exidx section if present.
12172
12173 2009-08-09  Doug Kwan  <dougkwan@google.com>
12174
12175         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
12176         patch.
12177
12178 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
12179         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
12180         compiler warnings.
12181
12182 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
12183
12184         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
12185         valid tls_segment only for non-debug-section relocations.
12186         * testsuite/Makefile.am: Add gc_tls_test.
12187         * testsuite/Makefile.in: Regenerate.
12188         * testsuite/gc_tls_test.cc: New file.
12189         * testsuite/gc_tls_test.sh: New file.
12190
12191 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
12192
12193         * icf.cc: New file.
12194         * icf.h: New file.
12195         * Makefile.am (CCFILES): Add icf.cc.
12196         (HFILES): Add icf.h
12197         * Makefile.in: Regenerate.
12198         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
12199         * gc.h (gc_process_relocs): Populate lists used by icf to contain
12200         section, symbol and addend information for the relocs.
12201         * gold.cc (queue_middle_tasks): Call identical code folding.
12202         * gold.h: Add defines for multimap.
12203         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
12204         to the call of finalize_local_symbols.
12205         * main.cc (main): Create object of class Icf.
12206         * object.cc (Sized_relobj::do_layout): Allow this function to be
12207         called twice during icf.
12208         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
12209         to sections marked as identical by icf.
12210         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
12211         when available.
12212         (Sized_relobj::do_section_entsize): New function.
12213         * object.h (Object::section_entsize): New function.
12214         (Object::do_section_entsize): New pure virtual function.
12215         (Relobj::finalize_local_symbols): Add new parameter.
12216         (Relobj::do_section_entsize): New function.
12217         * options.h (General_options::icf): New option.
12218         (General_options::icf_iterations): New option.
12219         (General_options::print_icf_sections): New option.
12220         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
12221         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
12222         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
12223         icf.
12224         * symtab.cc (Symbol_table::is_section_folded): New function.
12225         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
12226         to sections marked as identical by icf.
12227         * symtab.h (Symbol_table::set_icf): New function.
12228         (Symbol_table::icf): New function.
12229         (Symbol_table::is_section_folded): New function.
12230         (Symbol_table::icf_): New data member.
12231         * target-reloc.h (relocate_section): Ignore sections folded by icf.
12232         * testsuite/Makefile.am: Add commands to build icf_test.
12233         * testsuite/Makefile.in: Regenerate.
12234         * testsuite/icf_test.sh: New file.
12235         * testsuite/icf_test.cc: New file.
12236
12237 2009-07-24  Chris Demetriou  <cgd@google.com>
12238
12239         * layout.cc (is_compressible_debug_section): Fix incorrect
12240         comment about compressed section names.
12241
12242 2009-07-20  Ian Lance Taylor  <ian@airs.com>
12243
12244         PR 10419
12245         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
12246
12247 2009-07-16  Ian Lance Taylor  <iant@google.com>
12248
12249         PR 10400
12250         * layout.h: #include <map>.
12251         (class Kept_section): Change from struct to class.  Add accessors
12252         and setters.  Add section size to Comdat_group mapping.  Change
12253         Comdat_group to std::map.  Add is_comdat_ field.  Add
12254         linkonce_size field in union.
12255         (class Layout): Update declaration of find_or_add_kept_section.
12256         Don't declare find_kept_object.
12257         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
12258         parameter.  Add object, shndx, is_comdat, and is_group_name
12259         parameters.  Change all callers.  Adjust for new Kept_section.
12260         (Layout::find_kept_object): Remove.
12261         * object.cc (Sized_relobj::include_section_group): Update use of
12262         Kept_section.  Rename secnum to shndx.  Only record
12263         Kept_comdat_section if sections are the same size.
12264         (Sized_relobj::include_linkonce_section): Update use of
12265         Kept_section.  Only record Kept_comdat_section if sections are the
12266         same size.  Set size of linkonce section.
12267         (Sized_relobj::map_to_kept_section): Update call to
12268         get_kept_comdat_section.
12269         * object.h (class Sized_relobj): Rename fields in
12270         Kept_comdat_section to drop trailing underscores; change object
12271         field to Relobj*.  Change Kept_comdat_section_table to store
12272         struct rather than pointer.
12273         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
12274         Add kept_object and kept_shndx parameters.  Change all callers.
12275         (Sized_relobj::get_kept_comdat_section): Change return type to
12276         bool.  Add kept_object and kept_shndx parameters.  Change all
12277         callers.
12278         * plugin.cc (Pluginobj::include_comdat_group): Update call to
12279         Layout::find_or_add_kept_section.
12280
12281 2009-07-09  Ian Lance Taylor  <iant@google.com>
12282
12283         * merge.cc (Object_merge_map::initialize_input_to_output_map):
12284         Reserve space in the hash table.
12285
12286 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
12287
12288         * fileread.cc (File_read::get_mtime): New method.
12289         * fileread.h (Timespec): New structure.
12290         (File_read::get_mtime): New method.
12291         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
12292         Renamed from timestamp_nsec.
12293         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
12294         Elf_Xword.
12295         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
12296         timestamp_nsec.
12297         (Incremental_inputs::report_archive): Save mtime; style fix.
12298         (Incremental_inputs::report_obejct): Save mtime; style fix.
12299         (Incremental_inputs::report_script): Save mtime; style fix.
12300         (Incremental_inputs::finalize_inputs): Style fix.
12301         (Incremental_inputs::finalize): Style fix.
12302         (Incremental_inputs::create_input_section_data): Store inputs
12303         mtime.
12304         * incremental.h (Incremental_inputs::report_script): Add mtime
12305         argument.
12306         (Incremental_inputs::Input_info::Input_info): Intialize only one
12307         union member.
12308         (Incremental_inputs::Input_info::archive): Move to nameless
12309         union.
12310         (Incremental_inputs::Input_info::obejct): Move to nameless union.
12311         (Incremental_inputs::Input_info::script): Move to nameless union.
12312         (Incremental_inputs::mtime): New field.
12313         * script.cc (read_input_script): Pass file mtime to
12314         Incremental_input.
12315         * script.h (Script_info::inputs): Style fix.
12316
12317 2009-07-01  Ian Lance Taylor  <ian@airs.com>
12318
12319         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
12320         instead of 32.
12321
12322 2009-06-24  Ian Lance Taylor  <iant@google.com>
12323
12324         PR 10156
12325         * layout.cc (Layout::choose_output_section): If we find an
12326         existing section, update the flags.
12327         (Layout::create_notes): New function, broken out of
12328         Layout::finalize.
12329         (Layout::finalize): Don't create note sections.
12330         (Layout::create_note): Don't crash if linker script discards
12331         section.
12332         (Layout::create_gold_note): Likewise.
12333         (Layout::create_build_id): Likewise.  Don't set
12334         after_input_sections on the section.
12335         (Layout::create_executable_stack_info): Remove target parameter.
12336         Change caller.
12337         * layout.h (class Layout): Declare create_notes.  Update
12338         declaration of create_executable_stack_info.
12339         * gold.cc (queue_middle_tasks): Call create_notes.
12340         * output.cc (Output_section::update_flags_for_input_section): Move
12341         here from output.h.  If SHF_ALLOC flag is newly set, mark address
12342         invalid.
12343         * output.h (Output_data::mark_address_invalid): New function.
12344         (class Output_section): Only declare, not define,
12345         update_flags_for_input_section.  Remove set_flags.
12346
12347 2009-06-24  Ian Lance Taylor  <iant@google.com>
12348
12349         * script-sections.cc (Output_section_definition::
12350         set_section_addresses): Rename shadowing local load_address to
12351         laddr.
12352
12353 2009-06-24  Ian Lance Taylor  <iant@google.com>
12354
12355         PR 10244
12356         * reloc.cc (relocate_sections): Skip empty relocation sections.
12357
12358 2009-06-23  Ian Lance Taylor  <iant@google.com>
12359
12360         PR 10156
12361         * layout.cc (Layout::create_note): Use choose_output_section
12362         rather than make_output_section.
12363
12364 2009-06-23  Ian Lance Taylor  <iant@google.com>
12365
12366         PR 10237
12367         * options.cc (General_options::parse_V): Set printed_version_.
12368         (General_options::General_options): Initialize printed_version_.
12369         * options.h (class General_options): Add printed_version_ field.
12370         * gold.cc (queue_initial_tasks): If there are no input files,
12371         don't give a fatal error if we printed the version information.
12372         (queue_middle_tasks): If using -r with a shared object, give a
12373         fatal error rather than an ordinary error.
12374
12375 2009-06-23  Ian Lance Taylor  <iant@google.com>
12376
12377         PR 10219
12378         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
12379         (Layout::make_output_section): Set have_stabstr_section_ if we see
12380         a .stab*str section.
12381         (Layout::finalize): Call link_stabs_sections.
12382         (Layout::link_stabs_sections): New file.
12383         * layout.h (class Layout): Add have_stabstr_section_ field.
12384         Declare link_stabs_sections.
12385
12386 2009-06-23  Doug Kwan  <dougkwan@google.com>
12387
12388         * Makefile.am (libgold_a_LIBADD): New.
12389         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
12390         * Makefile.in: Regenerate.
12391         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
12392         * configure: Regenerate.
12393         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
12394         * fileread.cc: Include sys/state.h
12395         * gold.h: Declare memmem and strndup if found missing.
12396         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
12397
12398 2009-06-23  Ian Lance Taylor  <iant@google.com>
12399
12400         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
12401         * configure: Rebuild.
12402
12403 2009-06-23  Ian Lance Taylor  <iant@google.com>
12404
12405         PR 10147
12406         * object.cc (Object::section_contents): Don't try to get a view if
12407         the section has length zero.
12408         (Object::handle_gnu_warning_section): If the section is empty, use
12409         the name of the section as the warning.
12410
12411 2009-06-23  Ian Lance Taylor  <iant@google.com>
12412
12413         PR 10133
12414         * stringpool.h (class Stringpool_template): Add optimize_ field.
12415         (Stringpool_template::set_optimize): New function.
12416         * stringpool.cc (Stringpool_template::Stringpool_template):
12417         Initialize optimize_ field.
12418         (Stringpool_template::set_string_offsets): Test local optimize
12419         fild rather than parameter.
12420         * layout.cc (Layout::Layout): Call set_optimize on the section
12421         name stringpool.
12422
12423 2009-06-22  Ian Lance Taylor  <iant@google.com>
12424
12425         PR 10030
12426         * yyscript.y: Parse TARGET.
12427         * script.cc (script_set_target): New function.
12428         * script-c.h (script_set_target): Declare.
12429         * options.cc (General_options::string_to_object_format): Rename
12430         from string_to_object_format in anonymous namespace.  Change
12431         callers.
12432         * options.h (class General_options): Declare
12433         string_to_object_format.
12434
12435 2009-06-22  Ian Lance Taylor  <iant@google.com>
12436
12437         * script-sections.cc (Script_sections::create_segments): Don't put
12438         program headers in a PT_LOAD segment if -n or -N.
12439
12440 2009-06-22  Ian Lance Taylor  <iant@google.com>
12441
12442         PR 10141
12443         * options.h (class General_options): Add -z lazy and -z now.  Sort
12444         -z options into alphabetical order.
12445         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
12446
12447 2009-06-21  Ian Lance Taylor  <iant@google.com>
12448
12449         * layout.cc (Layout::make_output_section): Call
12450         Target::new_output_section.
12451         (Layout::attach_allocated_section_to_segment): Put large section
12452         sections in a separate load segment with the large segment flag
12453         set.
12454         (Layout::segment_precedes): Sort large data segments after other
12455         load segments.
12456         (align_file_offset): New static function.
12457         (Layout::set_segment_offsets): Use align_file_offset.
12458         * output.h (class Output_section): Add is_small_section_ and
12459         is_large_section_ fields.
12460         (Output_section::is_small_section): New function.
12461         (Output_section::set_is_small_section):  New function.
12462         (Output_section::is_large_section): New function.
12463         (Output_section::set_is_large_section): New function.
12464         (Output_section::is_large_data_section): New function.
12465         (class Output_segment): Add is_large_data_segment_ field.
12466         (Output_segment::is_large_data_segment): New function.
12467         (Output_segment::set_is_large_data_segment): New function.
12468         * output.cc (Output_section::Output_section): Initialize new
12469         fields.
12470         (Output_segment::Output_segment): Likewise.
12471         (Output_segment::add_output_section): Add assertion that large
12472         data sections always go in large data segments.  Force small data
12473         sections to the end of the list of data sections.  Force small BSS
12474         sections to the start of the list of BSS sections.  For large BSS
12475         sections to the end of the list of BSS sections.
12476         * symtab.h (class Symbol): Declare is_common_shndx.
12477         (Symbol::is_defined): Check Symbol::is_common_shndx.
12478         (Symbol::is_common): Likewise.
12479         (class Symbol_table): Define enum Commons_section_type.  Update
12480         declarations.  Add small_commons_ and large_commons_ fields.
12481         * symtab.cc (Symbol::is_common_shndx): New function.
12482         (Symbol_table::Symbol_table): Initialize new fields.
12483         (Symbol_table::add_from_object): Put small and large common
12484         symbols in the right list.
12485         (Symbol_table::sized_finalized_symbol): Check
12486         Symbol::is_common_shndx.
12487         (Symbol_table::sized_write_globals): Likewise.
12488         * common.cc (Symbol_table::do_allocate_commons): Allocate new
12489         common symbol lists.  Don't call do_allocate_commons_list if the
12490         list is empty.
12491         (Symbol_table::do_allocate_commons_list): Remove is_tls
12492         parameter.  Add comons_section_type parameter.  Change all
12493         callers.  Handle small and large common symbols.
12494         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
12495         Symbol::is_common_shndx.
12496         * resolve.cc (symbol_to_bits): Likewise.
12497         * target.h (Target::small_common_shndx): New function.
12498         (Target::small_common_section_flags): New function.
12499         (Target::large_common_shndx): New function.
12500         (Target::large_common_section_flags): New function.
12501         (Target::new_output_section): New function.
12502         (Target::Target_info): Add small_common_shndx, large_common_shndx,
12503         small_common_section_flags, and large_common_section_flags
12504         fields.
12505         (Target::do_new_output_section): New virtual function.
12506         * arm.cc (Target_arm::arm_info): Initialize new fields.
12507         * i386.cc (Target_i386::i386_info): Likewise.
12508         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
12509         Likewise.
12510         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
12511         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
12512         (Target_x86_64::do_new_output_section): New function.
12513         * configure.ac: Define conditional MCMODEL_MEDIUM.
12514         * testsuite/Makefile.am (check_PROGRAMS): Add large.
12515         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
12516         (large_LDFLAGS): Define.
12517         * testsuite/large.c: New file.
12518         * testsuite/testfile.cc (Target_test::test_target_info):
12519         Initialize new fields.
12520         * configure, testsuite/Makefile.in: Rebuild.
12521
12522 2009-06-05  Doug Kwan  <dougkwan@google.com>
12523
12524         * Makefile.am (CCFILES): Add target.cc.
12525         * Makefile.in: Regenerate.
12526         * i386.cc (class Target_i386): Define new virtual method to
12527         override do_is_local_label_name in parent.
12528         * object.cc (Sized_relobj::do_count_local_symbols): Discard
12529         local symbols if --discard-locals or -X is given.
12530         * options.h (class General_options): Declare new options
12531         '--discard-locals' and '-X' for discarding locals.
12532         * target.h (class Target): Define new methods is_local_label_name.
12533         Declare new virtual method do_is_local_label_name.
12534         * target.cc: New file.
12535         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
12536         (check_SCRIPTS): Add discard_locals_test.sh.
12537         (check_DATA): Add discard_local_tests.syms.
12538         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
12539         (discard_local_tests.syms, discard_locals_test.o): New make rules.
12540         * testsuite/Makefile.in: Regenerate.
12541         * testsuite/discard_locals_test.c: New file.
12542         * testsuite/discard_locals_test.sh: Same.
12543
12544 2009-06-05  Doug Kwan  <dougkwan@google.com>
12545
12546         * object.cc (Sized_relobj::Sized_relobj): Initialize
12547         discarded_eh_frame_shndx_ to -1U.
12548         (Sized_relobj::do_layout): Record index of a discard .eh_frame
12549         section.
12550         (Sized_relobj::do_count_local_symbols): Skip local symbols in
12551         a discarded .eh_frame section.
12552         (Sized_relobj::do_finalize_local_symbols): Ditto.
12553         * object.h (class Sized_relobj): Declare new member
12554         discarded_eh_frame_shndx_.
12555         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
12556         (local_labels_test.o, local_labels_test): New rules.
12557         * testsuite/Makefile.in: Regenerate.
12558
12559 2009-06-04  Doug Kwan  <dougkwan@google.com>
12560
12561         * layout.cc (Layout::section_name_mapping): Add mapping for
12562         special ARM sections.
12563
12564 2009-06-03  Doug Kwan  <dougkwan@google.com>
12565
12566         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
12567         (utils::has_overflow): Same.
12568
12569 2009-06-03  Ian Lance Taylor  <iant@google.com>
12570
12571         * layout.cc (Layout::section_name_mapping): New array, replacing
12572         Layout::linkonce_mapping.
12573         (Layout::section_name_mapping_count): New variable, replacing
12574         Layout::linkonce_mapping_count.
12575         (Layout::linkonce_output_name): Remove.
12576         (Layout::output_section_name): Rewrite.
12577         * layout.h (class Layout): Rename Linkonce_mapping to
12578         Section_name_mapping, linkonce_mapping to section_name_mapping,
12579         linkonce_mapping_count to section_name_mapping_count.  Don't
12580         declare linkonce_output_name.
12581
12582 2009-06-03  Doug Kwan  <dougkwan@google.com>
12583
12584         * gold/arm.cc (namespace utils): New.
12585         (Target_arm::reloc_is_non_pic): Define new method.
12586         (class Arm_relocate_functions): New.
12587         (Target_arm::Relocate::relocate): Handle relocation types used by
12588         Android.
12589
12590 2009-06-03  Ian Lance Taylor  <iant@google.com>
12591
12592         * arm.cc (Target_arm::scan::global): Use || instead of |.
12593
12594 2009-06-02  Doug Kwan  <dougkwan@google.com>
12595
12596         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
12597         issued_non_pic_error_.
12598         (class Target_arm::Scan): Declare new method check_non_pic.
12599         Define new method symbol_needs_plt_entry.
12600         Declare new data member issued_non_pic_error_.
12601         (class Target_arm::Relocate): Declare new method
12602         should_apply_static_reloc.
12603         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
12604         (Target_arm::Scan::check_non_pic): Define new method.
12605         (Target_arm::Scan::local): Handle a small subset of reloc types used
12606         by Android.
12607         (Target_arm::Scan::local): Same.
12608         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
12609
12610 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
12611
12612         * incremental.cc (Incremental_inputs::report_command_line): Filter
12613         out --incremental-* options.
12614
12615 2009-05-29  Doug Kwan  <dougkwan@google.com>
12616
12617         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
12618         template class.
12619         (class Target_arm): Update comment.
12620         (Target_arm::Target_arm): Initialize new data members GOT_,
12621         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
12622         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
12623         and Target_arm::rel_dyn_section.
12624         Declare new_enum Target_arm::Got_type.
12625         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
12626         and DYNBSS_.
12627         Update commments for member do_dynsym_value.
12628         (Target_arm::got_size, Target_arm::plt_section,
12629         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
12630         new methods inside class defintion.
12631         (Target_arm::got_section): Define new method.
12632         (Target_arm::rel_dyn_section): Same.
12633         (Output_data_plt_arm): New template class.
12634         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
12635         (Output_data_plt_arm:do_adjust_output_section): Define new method.
12636         (Output_data_plt_arm::add_entry): Same.
12637         (Output_data_plt_arm::first_plt_entry): Define new
12638         static data member for PLT instruction template.
12639         (Output_data_plt_arm::plt_entry): Same.
12640         (Output_data_plt_arm::do_write): Define new method.
12641         (Target_arm::make_plt_entry): Same.
12642         (Target_arm::do_finalize_sections): Same.
12643         (Target_arm::do_dynsym_value): Same.
12644
12645 2009-05-28  Doug Kwan  <dougkwan@google.com>
12646
12647         * Makefile.am (TARGETSOURCES): Add arm.cc.
12648         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
12649         * Makefile.in: Regenerate.
12650         * arm.cc: New file.
12651         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
12652
12653 2009-05-26  Doug Kwan  <dougkwan@google.com>
12654
12655         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
12656         (General_options::check_excluded_libs): Strip off directories in
12657         archive name before matching like GNU ld does.
12658         * testsuite/Makefile.am (MOSTLYCLEANFILES,
12659         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
12660         (exclude_libs_test_LDFLAGS): Add linker option
12661         -Wl,--exclude-libs,libexclude_libs_test_3
12662         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
12663         an explicit archive without using -l.
12664         (alt/libexclude_libs_test_3.a): New make rule.
12665         * testsuite/Makefile.in: Regenerate.
12666         * testsuite/exclude_libs_test.c : Declare lib3_default().
12667         (main): Call it.
12668         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
12669         * exclude_libs_test_3.c: New file.
12670
12671 2009-05-26  Nick Clifton  <nickc@redhat.com>
12672
12673         * po/id.po: New Indonesian translation.
12674         * po/gold.pot: Updated template file.
12675
12676 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
12677
12678         * testsuite/Makefile.am: Add -ffunction-sections to compile
12679         gc_comdat_test files.  Add -Wl,--gc-sections to build
12680         gc_comdat_test.
12681         * testsuite/Makefile.in: Regenerate.
12682         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
12683
12684 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
12685
12686         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
12687         kept comdat section was garbage collected.
12688         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
12689         * testsuite/Makefile.in: Regenerate.
12690         * testsuite/gc_comdat_test.sh: New file.
12691         * testsuite/gc_comdat_test_1.cc: New file.
12692         * testsuite/gc_comdat_test_2.cc: New file.
12693
12694 2009-05-19  Doug Kwan  <dougkwan@google.com>
12695
12696         * archive.cc (Archive::Archive): Move constructor from archive.h
12697         to here.  Initialize no_export_.
12698         (Archive::get_elf_object_for_member): Set no_export flag of object.
12699         * archive.h (Archive::Archive): Move constructor body to
12700         archive.cc.
12701         (Archive::no_export): New method.
12702         (Archive::no_export_): New field.
12703         * object.h (Object::Object): Initialize no_export_ to false.
12704         (Object::no_export, Object::set_no_export): New methods.
12705         (Object::no_export_): New field.
12706         * options.cc (General_options::parse_exclude_libs): New method.
12707         (General_options::check_excluded_libs) Same.
12708         * options.h (exclude_libs): New option.
12709         (General_options::check_excluded_libs): New method declaration.
12710         (General_options::excluded_libs_): New field.
12711         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
12712         default or protected visibility if an object has no-export flag set.
12713         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
12714         (check_SCRIPTS): Add exclude_libs_test.sh.
12715         (check_DATA): Add exclude_libs_test.syms.
12716         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
12717         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
12718         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
12719         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
12720         (exclude_libs_test.syms, libexclude_libs_test_1.a,
12721         libexclude_libs_test_2.a): New rules.
12722         * testsuite/Makefile.in: Regenerate.
12723         * testsuite/exclude_libs_test.c: New file.
12724         * testsuite/exclude_libs_test.sh: Ditto.
12725         * testsuite/exclude_libs_test_1.c: Ditto.
12726         * testsuite/exclude_libs_test_2.c: Ditto.
12727
12728 2009-05-15  Ian Lance Taylor  <iant@google.com>
12729
12730         * configure.ac: Check for declarations for cases where libiberty.h
12731         checks HAVE_DECL_xxx.
12732         * configure, config.in: Rebuild.
12733
12734 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
12735
12736         * gold.h (Incremental_argument_list): Remove (invalid) forward
12737         declaration.
12738         * incremental.cc (Incremental_inputs::report_achive): New method.
12739         (Incremental_inputs::report_object): New method.
12740         (Incremental_inputs::report_script): New method.
12741         (Incremental_inputs::finalize_inputs): New method.
12742         (Incremental_inputs::finalize): Call finalize_inputs().
12743         (Incremental_inputs::sized_create_incremental_inputs_section_data):
12744         Create inputs entries.
12745         * incremental.h (Incremental_input_type): New enum.
12746         (Incremental_inputs::Incremental_input): Initialize new fields.
12747         (Incremental_inputs::report_inputs): New method.
12748         (Incremental_inputs::report_achive): New method.
12749         (Incremental_inputs::report_object): New method.
12750         (Incremental_inputs::report_script): New method.
12751         (Incremental_inputs::finalize_inputs): New method.
12752         (Incremental_inputs::Input_info): New struct.
12753         (Incremental_inputs::Input_info_map): New typedef.
12754         (Incremental_inputs::lock_): New field.
12755         (Incremental_inputs::Inputs_): New field.
12756         (Incremental_inputs::Inputs_map): New field.
12757         * main.cc (main): Call Incremental_input::report_inputs.
12758         * options.h (Input_argument_list): Typedef moved from
12759         Input_arguments.
12760         (Input_file_group::Files): Remove, use ::Input_argument_list.
12761         (Input_file_group::Input_argument_list): Remove, use
12762         ::Input_argument_list.
12763         * plugin.cc (Plugin_manager::add_input_file): Add error in
12764         incremental build.
12765         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
12766         functions.
12767         * script.cc (read_input_script): Call
12768         Incremental_input::report_script.
12769         * script.h (Script_info): New class.
12770
12771 2009-04-27  Ian Lance Taylor  <iant@google.com>
12772
12773         * x86_64.cc (do_adjust_output_section): Set entsize to
12774         plt_entry_size.
12775
12776 2009-04-23  Elliott Hughes  <enh@google.com>
12777
12778         * output.cc (Output_file::close): After short writes, continue
12779         writing from the correct offset in the buffer being written.
12780
12781 2009-04-23  Chris Demetriou  <cgd@google.com>
12782
12783         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
12784         * configure: Regenerate.
12785         * config.in: Regenerate.
12786         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
12787         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
12788
12789 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
12790
12791         * incremental.cc (Incremental_inputs_header_data): Renamed from
12792         Incremental_input_header_data.
12793         (Incremental_inputs_header_data::data_size): New field.
12794         (Incremental_inputs_header_data::put_input_file_count): Renamed
12795         from input_file_count.
12796         (Incremental_inputs_header_data::put_command_line_offset): Renamed
12797         from command_line_offset.
12798         (Incremental_inputs_header_data::put_reserved): Renamed from
12799         put_reserved.
12800         (Incremental_inputs_entry_data): Renamed from
12801         Incremental_input_entry_data.
12802         (Incremental_inputs_entry_data::data_size): New field.
12803         (Incremental_inputs::report_command_line): New method.
12804         (Incremental_inputs::finalize): New method.
12805         (Incremental_inputs::create_incremental_inputs_data): New method.
12806         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
12807         * incremental.h: New file.
12808         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
12809         (Layout::finalize): Create incremental inputs section in
12810         incremental builds.
12811         (Layout::create_incremental_info_sections): New method.
12812         * layout.h (Layout::incremental_inputs): New method.
12813         (Layout::create_incremental_info_sections): New method.
12814         (Layout::incremental_inputs_): New field.
12815         * main.cc (main): Notify Incremental_input of the command line.
12816
12817 2009-04-01  Ian Lance Taylor  <iant@google.com>
12818             Mikolaj Zalewski  <mikolajz@google.com>
12819
12820         * gold.h (reserve_unordered_map): Define, three versions, one for
12821         each version of Unordered_map.
12822         * layout.cc (Layout::Layout): Remove options parameter.  Add
12823         number_of_input_files parameter.  Don't initialize options_.
12824         Initialize number_of_input_files_ and resized_signatures_.  Move
12825         sections_are_attached_.
12826         (Layout::layout_group): Reserve space for group_signatures_.
12827         (Layout::find_or_add_kept_section): Change name parameter to be a
12828         reference.  Resize signatures_ map when it gets large enough.
12829         (Layout::layout_eh_frame): Use parameters->options() instead of
12830         this->options_.
12831         (Layout::make_output_section): Likewise.
12832         (Layout::attach_allocated_section_to_segment): Likewise.
12833         (Layout::finalize, Layout::create_executable_stack): Likewise.
12834         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
12835         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
12836         * layout.h (class Layout): Update declarations.  Remove options_
12837         field.  Add number_of_input_files_ and resized_signatures_
12838         fields.  Move sections_are_attached_ field.
12839         * main.cc (main): Pass number of input files to Layout
12840         constructor.  Don't pass options.
12841
12842 2009-03-30  Ian Lance Taylor  <iant@google.com>
12843
12844         * ffsll.c (ffsll): Correct implementation.
12845
12846 2009-03-27  Ian Lance Taylor  <iant@google.com>
12847
12848         * ffsll.c: New file.
12849         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
12850         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
12851         * ftruncate.c (ftruncate): Declare before definition.
12852         * mremap.c (mremap): Likewise.
12853         * pread.c (pread): Likewise.
12854         * configure, Makefile.in, config.in: Rebuild.
12855
12856         * mremap.c: New file.
12857         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
12858         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
12859         (mremap): Declare if HAVE_MREMAP is not defined.
12860         * configure, Makefile.in, config.in: Rebuild.
12861
12862 2009-03-27  Cary Coutant  <ccoutant@google.com>
12863
12864         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
12865         position independent.
12866         * sparc.cc (Target_sparc::check_non_pic): Likewise.
12867         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
12868
12869 2009-03-24  Cary Coutant  <ccoutant@google.com>
12870
12871         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
12872         an executable.
12873         (needs_dynamic_reloc): Likewise.
12874
12875 2009-03-24  Ian Lance Taylor  <iant@google.com>
12876
12877         * yyscript.y (file_cmd): Recognize EXTERN.
12878         (extern_name_list, extern_name_list_body): New nonterminals.
12879         * script.cc (script_add_extern): Define.
12880         * script-c.h (script_add_extern): Declare.
12881
12882 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
12883
12884         * object.cc (is_elf_object): Define.
12885         * object.h (is_elf_object): Declare.
12886         * archive.cc (Archive::get_elf_object_for_member): Call
12887         is_elf_object.
12888         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
12889
12890 2009-03-24  Elliott Hughes  <enh@google.com>
12891
12892         * output.cc (Output_file::map_anonymous): Define.
12893         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
12894         try an anonymous one.  Report the size if the mmap fails.
12895         * output.h (class Output_file): Declare map_anonymous.
12896
12897 2009-03-24  Ian Lance Taylor  <iant@google.com>
12898
12899         * target-select.cc (instantiate_target): Don't acquire the lock if
12900         the instantiated_target_ field has already been set.
12901
12902 2009-03-23  Ian Lance Taylor  <iant@google.com>
12903
12904         * gold-threads.h (class Initialize_lock): Define.
12905         * gold-threads.cc (class Initialize_lock_once): Define.
12906         (initialize_lock_control): New static variable.
12907         (initialize_lock_pointer): New static variable.
12908         (initialize_lock_once): New static function.
12909         (Initialize_lock::Initialize_lock): Define.
12910         (Initialize_lock::initialize): Define.
12911         * target-select.h: Include "gold-threads.h".
12912         (class Target_selector): Add lock_ and initialize_lock_ fields.
12913         Don't define instantiate_target, just declare it.
12914         * target-select.cc (Target_selector::Target_selector): Initialize
12915         new fields.
12916         (Target_selector::instantiate_target): Define.
12917         * descriptors.h: Include "gold-threads.h".
12918         (class Descriptors): Add initialize_lock_ field.
12919         * descriptors.cc (Descriptors::Descriptors): Initialize new
12920         field.
12921         (Descriptors::open): Use initialize_lock_ field
12922         * errors.h (class Errors): Add initialize_lock_ field.
12923         * errors.cc (Errors::Errors): Initialize new field.
12924         (Errors::initialize_lock): Use initialize_lock_ field.
12925         * powerpc.cc (class Target_selector_powerpc): Remove
12926         instantiated_target_ field.  In do_recognize call
12927         instantiate_target rather than do_instantiate_target.  In
12928         do_instantiate_target just allocate a new target.
12929         * sparc.cc (class Target_selector_sparc): Likewise.
12930
12931         * freebsd.h: New file.
12932         * i386.cc: Include "freebsd.h".
12933         (Target_i386): Derive from Target_freebsd rather than
12934         Sized_target.
12935         (Target_selector_i386): Derive from Target_selector_freebsd rather
12936         than Target_selector.
12937         * x86_64.cc: Include "freebsd.h".
12938         (Target_x86_64): Derive from Target_freebsd rather than
12939         Sized_target.
12940         (Target_selector_x86_64): Derive from Target_selector_freebsd
12941         rather than Target_selector.
12942         * target.h (class Target): Add adjust_elf_header and
12943         do_adjust_elf_header.
12944         * output.cc (Output_file_header:: do_sized_write): Call target
12945         adjust_elf_header routine.
12946         * configure.tgt: Set targ_osabi.
12947         * configure.ac: Define GOLD_DEFAULT_OSABI.
12948         * parameters.cc (Parameters::default_target): Pass
12949         GOLD_DEFAULT_OSABI to select_target.
12950         * target-select.h (class Target_selector): Make instantiate_target
12951         protected rather than private.
12952         * Makefile.am (HFILES): Add freebsd.h.
12953         * configure, Makefile.in, config.in: Rebuild.
12954
12955         * merge.cc (do_add_input_section): Correct pend value.  Change
12956         message about last entry not being null terminated from error to
12957         warning.
12958
12959 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
12960
12961         * incremental.cc: New file.
12962         * Makefile.am (CCFILES): Add incremental.cc.
12963         * Makefile.in: Rebuild.
12964
12965 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
12966
12967         * layout.cc (Layout::output_section_name): Preserve names
12968         of '.note.' sections.
12969
12970 2009-03-19  Ian Lance Taylor  <iant@google.com>
12971
12972         * descriptors.cc (Descriptors::open): Check that the options are
12973         valid before using them.
12974
12975 2009-03-18  Ian Lance Taylor  <iant@google.com>
12976
12977         * script-sections.h: Include <list>.
12978         (class Script_sections): Change Sections_elements from std::vector
12979         to std::list.  Typedef public Elements_iterator.  Add
12980         orphan_section_placement_, data_segment_align_start_, and
12981         saw_data_segment_align_ fields.  Remove data_segment_align_index_
12982         field.
12983         * script-sections.cc (class Orphan_section_placement): New class.
12984         (class Sections_element): Add virtual functions is_relro and
12985         orphan_section_init.  Remove virtual function place_orphan_here.
12986         (class Output_section_definition): Add is_relro and
12987         orphan_section_init.  Remove place_orphan_here.
12988         (class Orphan_output_section): Likewise.
12989         (Script_sections::Script_sections): Update for field changes.
12990         (Script_sections::data_segment_align): Set saw_data_segment_align_
12991         and data_segment_align_start_, not data_segment_align_index.
12992         (Script_sections::data_segment_relro_end): Check
12993         saw_data_segment_align_.  Use data_segment_align_start_ rather
12994         than data_segment_align_index_.
12995         (Script_sections::place_orphan): Rewrite to use
12996         Orphan_section_placement.
12997
12998 2009-03-17  Ian Lance Taylor  <iant@google.com>
12999
13000         * archive.cc (Archive::add_symbols): Check for a version attached
13001         to the symbol name in the archive map.
13002         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
13003         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
13004         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
13005         (ver_test_11.a): New target.
13006         * testsuite/Makefile.in: Rebuild.
13007
13008         * configure.ac: Check for chsize and posix_fallocate.  Replace
13009         ftruncate.
13010         * ftruncate.c: New file, from gnulib.
13011         * output.cc (posix_fallocate): Define dummy version if not
13012         HAVE_POSIX_FALLOCATE.
13013         (Output_file::map): Call posix_fallocate rather than lseek and
13014         write.
13015         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
13016         * configure, Makefile.in, config.in: Rebuild.
13017
13018 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
13019
13020         * layout.h (Layout::create_note): Add section_name parameter.
13021         * layout.cc (Layout::create_note): Likewise.
13022         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
13023
13024 2009-03-17  Ian Lance Taylor  <iant@google.com>
13025
13026         * descriptors.cc: Include "options.h".
13027         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
13028         (Descriptors::open): Always use O_CLOEXEC when opening a new
13029         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
13030         then set FD_CLOEXEC.
13031
13032         * sparc.cc (class Target_sparc): Add has_got_section.
13033         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
13034         make sure we have a GOT section.
13035
13036         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
13037         (Target_sparc::Scan::local): Likewise.
13038         (Target_sparc::Scan::global): Likewise.
13039         (Target_sparc::Relocate::relocate): Likewise.
13040         (Target_sparc::Relocate::relocate_tls): Likewise.
13041
13042         * symtab.cc (Symbol_table::define_default_version): New function,
13043         broken out of add_from_object.
13044         (Symbol_table::add_from_object): Call define_default_version.
13045         (Symbol_table::define_special_symbol): Add resolve_oldsym
13046         parameter.  Change all callers.  If the version for a symbol comes
13047         from a version script, resolve it with the symbol with the same
13048         name with no version.  Also add the symbol without a version if
13049         appropriate.
13050         (do_define_in_output_data): If resolving with oldsym, don't delete
13051         sym.
13052         (do_define_in_output_segment): Likewise.
13053         (do_define_as_constant): Likewise.
13054         * symtab.h (class Symbol_table): Update declarations.
13055
13056 2009-03-13  Ian Lance Taylor  <iant@google.com>
13057
13058         * readsyms.cc (Read_symbols::incompatible_warning): New function.
13059         (Read_symbols::requeue): New function.
13060         (Read_symbols::do_read_symbols): If make_elf_object fails because
13061         the target type is not configured, and the file was searched for,
13062         issue a warning and retry with the next directory.
13063         (Add_symbols::run): If the file has an incompatible format, and
13064         it was searched for, requeue the Read_symbols task.  On error,
13065         release the object.
13066         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
13067         dirindex parameter to constructor.  Change all callers.  Declare
13068         incompatible_warning and requeue.
13069         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
13070         input_argument_ and input_group_ fields.  Add them to
13071         constructor.  Change all callers.
13072         (class Read_script): Add dirindex_ field.  Add it to constructor.
13073         Change all callers.
13074         * archive.cc (Archive::setup): Remove input_objects parameter.
13075         Change all callers.
13076         (Archive::get_file_and_offset): Likewise.
13077         (Archive::read_all_symbols): Likewise.
13078         (Archive::read_symbols): Likewise.
13079         (Archive::get_elf_object_for_member): Remove input_objects
13080         parameter.  Add punconfigured parameter.  Change all callers.
13081         (Archive::add_symbols): Change return type to bool.  Check return
13082         value of include_member.
13083         (Archive::include_all_members): Likewise.
13084         (Archive::include_member): Change return type to bool.  Return
13085         false if first included object has incompatible target.  Set
13086         included_member_ field.
13087         (Add_archive_symbols::run): If add_symbols returns false, requeue
13088         Read_symbols task.
13089         * archive.h (class Archive): Add included_member_ field.
13090         Initialize it in constructor.  Add input_file and searched_for
13091         methods.  Update declarations.
13092         (class Add_archive_symbols): Add dirpath_, dirindex_, and
13093         input_argument_ fields.  Add them to constructor.  Change all
13094         callers.
13095         * script.cc: Include "target-select.h".
13096         (class Parser_closure): Add skip_on_incompatible_target_ and
13097         found_incompatible_target_ fields.  Add
13098         skip_on_incompatible_target parameter to constructor.  Change all
13099         callers.  Add methods skip_on_incompatible_target,
13100         clear_skip_on_incompatible_target, found_incompatible_target, and
13101         set_found_incompatible_target.
13102         (read_input_script): Add dirindex parameter.  Change all callers.
13103         If parser finds an incompatible target, requeue Read_symbols
13104         task.
13105         (script_set_symbol): Clear skip_on_incompatible_target in
13106         closure.
13107         (script_add_assertion, script_parse_option): Likewise.
13108         (script_start_sections, script_add_phdr): Likewise.
13109         (script_check_output_format): New function.
13110         * script.h (read_input_script): Update declaration.
13111         * script-c.h (script_check_output_format): Declare.
13112         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
13113         (ignore_cmd): Remove OUTPUT_FORMAT.
13114         * fileread.cc (Input_file::Input_file): Add explicit this.
13115         (Input_file::will_search_for): New function.
13116         (Input_file::open): Add pindex parameter.  Change all callers.
13117         * fileread.h (class Input_file): Add input_file_argument method.
13118         Declare will_search_for.  Update declarations.
13119         * object.cc (make_elf_object): Add punconfigured parameter.
13120         Change all callers.
13121         * object.h (class Object): Make input_file public.  Add
13122         searched_for method.
13123         (make_elf_object): Update declaration.
13124         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
13125         restart search.
13126         * dirsearch.h (class Dirsearch): Update declaration.
13127         * options.h (class General_options): Add --warn-search-mismatch.
13128         * parameters.cc (Parameters::is_compatible_target): New function.
13129         * parameters.h (class Parameters): Declare is_compatible_target.
13130         * workqueue.cc (Workqueue::add_blocker): New function.
13131         * workqueue.h (class Workqueue): Declare add_blocker.
13132
13133         * fileread.cc (Input_file::open): Remove options parameter.
13134         Change all callers.
13135         (Input_file::open_binary): Likewise.
13136         * script.cc (read_input_script): Likewise.
13137         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
13138         options parameter from constructor.  Change all callers.
13139         (class Read_script): Likewise.
13140         * fileread.h (class Input_file): Update declarations.
13141         * script.h (read_input_script): Update declaration.
13142
13143 2009-03-10  Nick Clifton  <nickc@redhat.com>
13144
13145         * po/es.po: New Spanish translation.
13146
13147 2009-03-06  Cary Coutant  <ccoutant@google.com>
13148
13149         * options.cc (parse_short_option): Keep dash_z from registering itself.
13150
13151 2009-03-03  Ian Lance Taylor  <iant@google.com>
13152
13153         PR 9918
13154         * target-reloc.h (relocate_section): Pass output_section to
13155         relocate.
13156         * i386.cc (Target_i386::should_apply_static_reloc): Add
13157         output_section parameter.  Change all callers.
13158         (Target_i386::Relocate::relocate): Add output_section parameter.
13159         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
13160         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
13161         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
13162         * testsuite/two_file_shared.sh: New script.
13163         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
13164         (check_DATA): Add two_file_shared.dbg.
13165         (two_file_shared.dbg): New target.
13166         * testsuite/Makefile.in: Rebuild.
13167
13168 2009-03-01  Ian Lance Taylor  <iant@google.com>
13169
13170         * configure.ac: Check for byteswap.h.
13171         * configure: Rebuild.
13172         * config.in: Rebuild.
13173
13174 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
13175
13176         * layout.cc (Layout::find_or_add_kept_section): New function.
13177         (Layout::add_comdat): Removed.
13178         * layout.h (struct Kept_section): Move out of class Layout.
13179         Remove trailing underscores from field names.  Add group_sections
13180         field.  Rename group_ field to is_group.  Change all uses.
13181         (class Layout): Declare find_or_add_kept_section, not add_comdat.
13182         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
13183         comdat_groups_ field.
13184         (Sized_relobj::include_section_group): Use
13185         find_or_add_kept_section and Kept_section::group_sections.
13186         (Sized_relobj::include_linkonce_section): Likewise.
13187         * object.cc (class Sized_relobj): Don't define Comdat_group or
13188         Comdat_group_table.  Remove find_comdat_group and
13189         add_comdat_group.  Remove comdat_groups_ field.
13190         * plugin.cc (include_comdat_group): Use
13191         Layout::find_or_add_kept_section.
13192
13193 2009-02-28  Ian Lance Taylor  <iant@google.com>
13194
13195         * README: --gc-sections and map files are now supported.  Document
13196         some build requirements.
13197
13198         PR 6992
13199         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
13200         relocatable link set the value of the section symbol to zero.
13201         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
13202         relocatable link don't include the section address in the local
13203         symbol value.
13204
13205 2009-02-27  Ian Lance Taylor  <iant@google.com>
13206
13207         PR 6811
13208         * options.h (class Search_directory): Add is_system_directory.
13209         (class General_options): Declare is_in_system_directory.
13210         * options.cc (get_relative_sysroot): Make static.
13211         (get_default_sysroot): Make static.
13212         (General_optoins::is_in_system_directory): New function.
13213         * fileread.cc (Input_file::is_in_system_directory): New function.
13214         * fileread.h (class Input_file): Declare is_in_system_directory.
13215         * object.h (class Object): Add is_in_system_directory.
13216         (class Input_objects): Remove system_library_directory_ field.
13217         * object.cc (Input_objects::add_object): Don't set
13218         system_library_directory_.
13219         (input_objects::found_in_system_library_directory): Remove.
13220         * symtab.cc (Symbol_table::write_globals): Remove input_objects
13221         parameter.  Change all callers.
13222         (Symbol_table::sized_write_globals): Likewise.
13223         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
13224         Call Object::is_in_system_directory.
13225         * symtab.h (class Symbol_table): Update declarations.
13226
13227         PR 5990
13228         * descriptors.h (Open_descriptor): Add is_on_stack field.
13229         * descriptors.cc (Descriptors::open): If the descriptor is on the
13230         top of the stack, remove it.  Initialize is_on_stack field.
13231         (Descriptors::release): Only add pod to stack if it is not on the
13232         stack already.
13233         (Descriptors::close_some_descriptor): Clear stack_next and
13234         is_on_stack fields.
13235
13236         PR 7091
13237         * output.cc (Output_section::find_starting_output_address): Rename
13238         from starting_output_address; add PADDR parameter; change return
13239         type.
13240         * output.h (class Output_section): Declare
13241         find_starting_output_address instead of starting_output_address.
13242         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
13243         section symbol for which we can't find a merge section.
13244
13245         PR 9836
13246         * symtab.cc (Symbol_table::add_from_object): If the visibility is
13247         hidden or internal, force the symbol to be local.
13248         * resolve.cc (Symbol::override_visibility): Define.
13249         (Symbol::override_base): Use override_visibility.
13250         (Symbol_table::resolve): Likewise.
13251         (Symbol::override_base_with_special): Likewise.
13252         (Symbol_table::override_with_special): If the visibility is hidden
13253         or internal, force the symbol to be local.
13254         * symtab.h (class Symbol): Add set_visibility and
13255         override_visibility.
13256         * testsuite/ver_test_1.sh: New file.
13257         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
13258         (check_DATA): Add ver_test_1.syms.
13259         (ver_test_1.syms): New target.
13260         * testsuite/Makefile.in: Rebuild.
13261
13262 2009-02-25  Cary Coutant  <ccoutant@google.com>
13263
13264         * layout.cc (Layout::choose_output_section): Don't rename sections
13265         when using a linker script that has a SECTIONS clause.
13266         * Makefile.in: Regenerate.
13267
13268         * testsuite/Makefile.am (script_test_5.sh): New test case.
13269         * testsuite/Makefile.in: Regenerate.
13270         * testsuite/script_test_5.cc: New file.
13271         * testsuite/script_test_5.sh: New file.
13272         * testsuite/script_test_5.t: New file.
13273
13274 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
13275
13276         * archive.cc (Archive::include_member): Update calls to add_symbols.
13277         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
13278         the Layout argument.
13279         * dynobj.h (do_add_symbols): Add the Layout argument.
13280         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
13281         Layout argument.
13282         * object.h (Object::add_symbols): Add the Layout argument.
13283         (Object::do_add_symbols): Add the Layout argument.
13284         (Sized_relobj::do_add_symbols): Add the Layout argument.
13285         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
13286         Unify the two versions.
13287         (Add_plugin_symbols): Remove.
13288         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
13289         (Sized_pluginobj::do_add_symbols): Unify the two versions.
13290         (Add_plugin_symbols): Remove.
13291         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
13292         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
13293         (Add_symbols::run): Make it work with Pulginobj.
13294
13295 2009-02-06  Ian Lance Taylor  <iant@google.com>
13296
13297         * object.cc (Sized_relobj::do_layout): Make info message start
13298         with lower case letter.
13299
13300 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
13301
13302         * binary.cc: Fix file comment.
13303
13304         * options.h (enum Incremental_disposition): Define.
13305         (class General_options): Add new options: --incremental,
13306         --incremental_changed, --incremental_unchanged,
13307         --incremental_unknown.  Add incremental_disposition_ and
13308         implicit_incremental_ fields.
13309         (General_options::incremental_disposition): New function.
13310         (class Position_dependent_options): Add incremental_disposition
13311         option.
13312         (Position_dependent_options::copy_from_options): Set incremental
13313         dispositions.
13314         * options.cc (General_options::parse_incremental_changed): New
13315         function.
13316         (General_options::parse_incremental_unchanged): New function.
13317         (General_options::parse_incremental_unknown): New function.
13318         (General_options::General_options): Initialize new fields
13319         incremental_disposition_ and implicit_incremental_.
13320         (General_options::finalize): Check for uasge of --incremental-*
13321         without --incremental.
13322
13323 2009-02-06  Chris Demetriou  <cgd@google.com>
13324
13325         * gold.h (gold_undefined_symbol): Change to take only a Symbol
13326         pointer and to report location as the file name associated with
13327         the symbol.
13328         (gold_undefined_symbol_at_location): New function to replace the
13329         old gold_undefined_symbol functionality.
13330         * target-reloc.h (relocate_section): Update to use
13331         gold_undefined_symbol_at_location.
13332         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
13333         Call gold_undefined_symbol function rather than gold_error.
13334         * errors.h (Errors::undefined_symbol): Take location as a
13335         string, rather than calculating it from a relocation.
13336         * errors.cc (Errors::fatal): Print "fatal error:" before the
13337         formatted message.
13338         (Errors::error, Errors::error_at_location): Print "error: "
13339         before the formatted message.
13340         (Errors::undefined_symbol): Take location as a string, rather
13341         than calculating it from a relocation.
13342         (gold_undefined_symbol_at_location): New function akin to
13343         old gold_undefined_symbol, calculates location from relocation.
13344         (gold_undefined_symbol): Change to take only a Symbol pointer
13345         and to report location as the file name associated with the symbol.
13346         * testsuite/debug_msg.sh: Update for changed error messages.
13347         * testsuite/undef_symbol.sh: Likewise.
13348
13349 2009-02-04  Duncan Sands  <baldrick@free.fr>
13350
13351         PR 9812
13352         * reduced_debug_output.h
13353         (Output_reduced_debug_abbrev_section::failed): Use format for
13354         gold_warning.
13355         (Output_reduced_debug_info_section::faild): Likewise.
13356
13357 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
13358
13359         * script.cc (Lazy_demangler): New class.
13360         (Version_script_info::get_symbol_version_helper): Demangle a
13361         symbol only once.
13362
13363 2009-01-29  Cary Coutant  <ccoutant@google.com>
13364
13365         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
13366         to __tls_get_addr.
13367         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
13368
13369 2009-01-28  Ian Lance Taylor  <iant@google.com>
13370
13371         * version.cc (version_string): Bump to 1.9.
13372
13373         * gold.h: Include <cstring> and <stdint.h>.
13374         * version.cc: Include <cstdio>.
13375         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
13376         warning.
13377         * reduced_debug_output.cc (insert_into_vector): Rename from
13378         Insert_into_vector; change all callers.  Use Swap_unaligned to
13379         avoid aliasing issue; remove union since it is unnecessary.
13380
13381 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
13382
13383         * Makefile.am (CCFILES): Add gc.cc.
13384         (HFILES): Add gc.h.
13385         * Makefile.in: Regenerate.
13386         * gold.cc (Gc_runner): New class.
13387         (queue_initial_tasks): Call garbage collection related tasks
13388         when corresponding options are invoked.
13389         (queue_middle_gc_tasks): New function.
13390         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
13391         processed early before laying out sections during garbage collection.
13392         * gold.h (queue_middle_gc_tasks): New function.
13393         (is_prefix_of): Move from "layout.cc".
13394         * i386.cc (Target_i386::gc_process_relocs): New function.
13395         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
13396         * main.cc (main): Create object of class "Garbage_collection".
13397         * object.cc (Relobj::copy_symbols_data): New function.
13398         (Relobj::is_section_name_included): New function.
13399         (Sized_relobj::do_layout): Allow this function to be called twice
13400         during garbage collection and defer layout of section during the
13401         first call.
13402         * object.h (Relobj::get_symbols_data): New function.
13403         (Relobj::is_section_name_included): New function.
13404         (Relobj::copy_symbols_data): New function.
13405         (Relobj::set_symbols_data): New function.
13406         (Relobj::get_relocs_data): New function.
13407         (Relobj::set_relocs_data): New function.
13408         (Relobj::is_output_section_offset_invalid): New pure virtual function.
13409         (Relobj::gc_process_relocs): New function.
13410         (Relobj::do_gc_process_relocs): New pure virtual function.
13411         (Relobj::sd_): New data member.
13412         (Sized_relobj::is_output_section_offset_invalid): New function.
13413         (Sized_relobj::do_gc_process_relocs): New function.
13414         * options.h (General_options::gc_sections): Modify to not be a no-op.
13415         (General_options::print_gc_sections): New option.
13416         * plugin.cc (Plugin_finish::run): Remove function call to
13417         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
13418         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
13419         * reloc.cc (Read_relocs::run): Add task to process relocs and
13420         determine unreferenced sections when doing garbage collection.
13421         (Gc_process_relocs): New class.
13422         (Sized_relobj::do_gc_process_relocs): New function.
13423         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
13424         sections that are garbage collected.
13425         * reloc.h (Gc_process_relocs): New class.
13426         * sparc.cc (Target_sparc::gc_process_relocs): New function.
13427         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
13428         symbols whose corresponding sections are garbage collected.
13429         (Symbol_table::Symbol_table): Add new parameter for the garbage
13430         collection object.
13431         (Symbol_table::gc_mark_undef_symbols): New function.
13432         (Symbol_table::gc_mark_symbol_for_shlib): New function.
13433         (Symbol_table::gc_mark_dyn_syms): New function.
13434         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
13435         as garbage.
13436         (Symbol_table::add_from_object): Likewise.
13437         (Symbol_table::add_from_relobj): When building shared objects, do not
13438         treat externally visible symbols as garbage.
13439         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
13440         table information for static and relocatable links.
13441         * symtab.h (Symbol_table::set_gc): New function.
13442         (Symbol_table::gc): New function.
13443         (Symbol_table::gc_mark_undef_symbols): New function.
13444         (Symbol_table::gc_mark_symbol_for_shlib): New function.
13445         (Symbol_table::gc_mark_dyn_syms): New function.
13446         (Symbol_table::gc_): New data member.
13447         * target.h (Sized_target::gc_process_relocs): New pure virtual
13448         function.
13449         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
13450         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
13451
13452 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
13453
13454         * options.h (General_options::gc_sections): Define as a no-op for now.
13455         (General_options::no_keep_memory): Ditto.
13456         (General_options::Bshareable): Define.
13457         * options.cc (General_options::finalize): Honor -Bshareable.
13458
13459 2009-01-20  Andreas Schwab  <schwab@suse.de>
13460
13461         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
13462         read the value in the contents, since we don't use it.  Use the
13463         template endianness when writing.
13464         (Relocate::relocate): Use it for R_PPC_REL16_HA.
13465
13466 2009-01-19  Andreas Schwab  <schwab@suse.de>
13467
13468         * configure.tgt (powerpc64-*): Fix targ_obj.
13469
13470 2009-01-15  Ian Lance Taylor  <iant@google.com>
13471
13472         * object.cc (Sized_relobj::write_local_symbols): Don't write out
13473         local symbols when stripping all symbols.
13474
13475 2009-01-14  Cary Coutant  <ccoutant@google.com>
13476
13477         * output.cc (Output_reloc): Add explicit instantiations.
13478
13479 2009-01-14  Cary Coutant  <ccoutant@google.com>
13480
13481         * archive.cc (Archive::get_elf_object_for_member): Remove call
13482         to File_read::claim_for_plugin.
13483         * descriptors.cc (Descriptors::open): Remove reference to
13484         is_claimed.
13485         (Descriptors::claim_for_plugin): Remove.
13486         * descriptors.h (Descriptors::claim_for_plugin): Remove.
13487         (Descriptors::is_claimed): Remove.
13488         (claim_descriptor_for_plugin): Remove.
13489         * fileread.cc (File_read::claim_for_plugin): Remove.
13490         * fileread.h (File_read::claim_for_plugin): Remove.
13491         (File_read::descriptor): Reopen descriptor if necessary.
13492         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
13493         (Plugin_manager::all_symbols_read): Add task parameter. Change
13494         all callers.
13495         (Plugin_manager::get_input_file): New function.
13496         (Plugin_manager::release_input_file): New function.
13497         (Pluginobj::Pluginobj): Add filesize parameter and initialize
13498         corresponding data member.
13499         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
13500         and pass to base constructor. Change all callers.
13501         (get_input_file, release_input_file): New functions.
13502         (make_sized_plugin_object): Add filesize parameter. Change all callers.
13503         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
13504         (Plugin_manager::all_symbols_read): Add task parameter.
13505         (Plugin_manager::get_input_file): New function.
13506         (Plugin_manager::release_input_file): New function.
13507         (Plugin_manager::task_): New data member.
13508         (Pluginobj::Pluginobj): Add filesize parameter.
13509         (Pluginobj::filename): New function.
13510         (Pluginobj::descriptor): New function.
13511         (Pluginobj::filesize): New function.
13512         (Pluginobj::filesize_): New data member.
13513         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
13514         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
13515         File_read::claim_for_plugin; use Object::unlock to unlock the file.
13516
13517         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
13518         with archive libraries.
13519         * testsuite/Makefile.in: Regenerate.
13520         * testsuite/plugin_test.c (struct sym_info): New type.
13521         (get_input_file, release_input_file): New static variables.
13522         (onload): Capture new transfer vector entries.
13523         (claim_file_hook): Stop reading at end of file according to filesize.
13524         Factor out parsing of readelf output into separate function.
13525         (all_symbols_read_hook): Exercise get_input_file and release_input_file
13526         APIs and get the source file name from the symbol table.  Convert
13527         source file name to corresponding object file name.  Print info
13528         message when adding new input files.
13529         (parse_readelf_line): New function.
13530         * testsuite/plugin_test_1.sh: Add checks for new info messages.
13531         * testsuite/plugin_test_2.sh: Likewise.
13532         * testsuite/plugin_test_3.sh: Likewise.
13533         * testsuite/plugin_test_4.sh: New test case.
13534
13535 2009-01-07  Ian Lance Taylor  <iant@google.com>
13536
13537         * version.cc (version_string): Bump to 1.8.
13538
13539 2008-12-23  Cary Coutant  <ccoutant@google.com>
13540
13541         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
13542         * plugin.cc (Plugin_manager::finish): Rename as
13543         layout_deferred_objects.  Move cleanup to separate function.
13544         (Plugin_manager::cleanup): New function.
13545         (Plugin_finish::run): Call layout_deferred_objects and cleanup
13546         separately.
13547         * plugin.h (Plugin_manager::finish): Rename as
13548         layout_deferred_objects.
13549         (Plugin_manager::cleanup): New function.
13550         (Plugin_manager::cleanup_done): New field.
13551
13552 2008-12-23  Cary Coutant  <ccoutant@google.com>
13553
13554         * plugin.cc (is_visible_from_outside): New function.
13555         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
13556         so we don't return "IR only" status for exported symbols or -r links.
13557
13558         * testsuite/Makefile.am (plugin_test_3): New test case.
13559         * testsuite/Makefile.in: Regenerate.
13560         * testsuite/plugin_test_3.sh: New file.
13561
13562 2008-12-22  Cary Coutant  <ccoutant@google.com>
13563
13564         * object.cc (Sized_relobj::layout_section): New function.
13565         (Sized_relobj::do_layout): Defer layout of input sections until after
13566         plugin has provided replacement files.
13567         (Sized_relobj::do_layout_deferred_sections): New function.
13568         * object.h (Relobj::set_section_offset): Remove virtual keyword.
13569         (Relobj::layout_deferred_sections): New function.
13570         (Relobj::do_layout_deferred_sections): New function.
13571         (Sized_relobj::do_layout_deferred_sections): New function.
13572         (Sized_relobj::layout_section): New function.
13573         (Sized_relobj::Deferred_layout): New structure.
13574         (Sized_relobj::deferred_layout_): New field.
13575         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
13576         Change all callers.  Layout deferred sections.
13577         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
13578         references.
13579         (Plugin_hook::run): Move code from do_plugin_hook inline.
13580         (Plugin_hook::do_plugin_hook): Remove.
13581         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
13582         (Plugin_manager::finish): Renamed, was cleanup.
13583         (Plugin_manager::should_defer_layout): New function.
13584         (Plugin_manager::add_deferred_layout_object): New function.
13585         (Plugin_manager::Deferred_layout_list): New type.
13586         (Plugin_manager::deferred_layout_objects_): New field.
13587         (Plugin_hook::do_plugin_hook): Remove.
13588
13589 2008-12-17  Ian Lance Taylor  <iant@google.com>
13590
13591         * options.h (class General_options): Add --no case for
13592         --export-dynamic.
13593
13594 2008-12-16  Cary Coutant  <ccoutant@google.com>
13595
13596         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
13597         vector.
13598         (Plugin_manager::claim_file): Create plugin object even if
13599         plugin did not call the add_symbols callback.
13600         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
13601         asking for more symbols than were added.
13602         * testsuite/Makefile.am (plugin_test_1): Add test case with
13603         no global symbols.
13604         (empty.syms): New target.
13605         * testsuite/Makefile.in: Regenerate.
13606         * testsuite/plugin_test.c (claim_file_hook): Add new debug
13607         message. Don't call add_symbols if no globals.
13608         (all_symbols_read_hook): Don't provide replacement for empty
13609         claimed file.
13610
13611 2008-12-12  Ian Lance Taylor  <iant@google.com>
13612
13613         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
13614         r_type == 0 for a local symbol with r_sym == 0.
13615         (scan_relocatable_relocs): Pass r_sym to
13616         local_non_section_strategy.
13617         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
13618         r_sym parameter.
13619
13620         * configure.ac: Update test for TLS descriptors: they are
13621         supported as of glibc 2.9.
13622         * configure: Rebuild.
13623
13624 2008-12-11  Ian Lance Taylor  <iant@google.com>
13625
13626         PR 7091
13627         * target-reloc.h (Default_scan_relocatable_relocs): For each
13628         function, map r_type == 0 to RELOC_DISCARD.
13629
13630 2008-12-10  Cary Coutant  <ccoutant@google.com>
13631
13632         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
13633         object to override a kept COMDAT group from a plugin object.
13634
13635 2008-12-09  Ian Lance Taylor  <iant@google.com>
13636
13637         PR 7088
13638         * yyscript.y (file_cmd): Handle INPUT.
13639
13640         * testsuite/initpri1.c: Change all declarations to be full
13641         prototypes by adding void, to avoid compiler warnings.
13642
13643 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
13644
13645         * options.cc (General_options::parse_plugin_opt): New.
13646         (General_options::add_plugin): The argument now is just the filename.
13647         (General_options::add_plugin_option): New.
13648         * options.h (plugin_opt): New.
13649         (add_plugin): Change argument name.
13650         (add_plugin_option): New.
13651         * plugin.cc (Plugin::load): Don't parse the plugin option.
13652         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
13653         (Plugin::add_option): New.
13654         (Plugin::args_): Change type.
13655         (Plugin::filename_): New.
13656         (Plugin_manager::add_plugin_option): New.
13657         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
13658         * testsuite/Makefile.in: Regenerate.
13659
13660 2008-12-05  Cary Coutant  <ccoutant@google.com>
13661
13662         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
13663         Handle --strip-lto-sections option.
13664         * options.h (strip_lto_sections): New option.
13665
13666 2008-12-01  Cary Coutant  <ccoutant@google.com>
13667
13668         * plugin.cc (ld_plugin_message): Change format parameter to const.
13669         Fix mismatch between new[] and delete.
13670
13671 2008-11-14  Cary Coutant  <ccoutant@google.com>
13672
13673         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
13674         instead of -1U.
13675
13676 2008-11-05  Craig Silverstein  <csilvers@google.com>
13677
13678         * options.cc (General_options::parse_dynamic_list): New function.
13679         * options.h (General_options): New flags dynamic_list,
13680         dynamic_list_data, dynamic_list_cpp_new, and
13681         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
13682         (General_options::in_dynamic_list): New function.
13683         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
13684         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
13685         (Lex::can_continue_name): Likewise.
13686         (yylex): Likewise.
13687         (read_script_file): New parameter script_options.
13688         (read_dynamic_list): New function.
13689         (Script_options::define_dynamic_list): New function.
13690         (dynamic_list_keyword_parsecodes): New variable.
13691         (dynamic_list_keywords): New variable.
13692         * script.h (Script_options::define_dynamic_list): New function
13693         prototype.
13694         (read_dynamic_list): New function prototype.
13695         * symtab.cc (strprefix): New macro.
13696         (Symbol::should_add_dynsym_entry): Support dynamic_list,
13697         dynamic_list_data, dynamic_list_cpp_new, and
13698         dynamic_list_cpp_typeinfo.
13699         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
13700         (dynamic_list_expr): New rule.
13701         (dynamic_list_nodes): Likewise.
13702         (dynamic_list_node): Likewise.
13703         * testsuite/Makefile.am (dynamic_list): New test.
13704         * testsuite/Makefile.in: Regenerated.
13705         * testsuite/dynamic_list.t: New file.
13706         * testsuite/dynamic_list.sh: New file.
13707
13708 2008-11-05  Craig Silverstein  <csilvers@google.com>
13709
13710         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
13711         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
13712         (t11_last): Likewise.
13713         * testsuite/ver_test_6.c (main): Likewise.
13714
13715 2008-10-07  Cary Coutant  <ccoutant@google.com>
13716
13717         * options.c (General_options::finalize): Add check for -static and
13718         -shared.
13719         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
13720         is not empty.
13721
13722 2008-10-02  Cary Coutant  <ccoutant@google.com>
13723
13724         * plugin.cc (make_sized_plugin_object): Fix conditional
13725         compilation to work when not all targets are enabled.
13726
13727 2008-09-29  Cary Coutant  <ccoutant@google.com>
13728
13729         * archive.cc (Archive::get_file_and_offset): Use filename instead
13730         of name to get library path.
13731         (Archive::include_member): Unlock external member of a thin archive.
13732
13733         * testsuite/Makefile.am (TEST_AR): New variable.
13734         (thin_archive_test_1): New test.
13735         (thin_archive_test_2): New test.
13736         * testsuite/Makefile.in: Regenerate.
13737         * testsuite/thin_archive_main.cc: New file.
13738         * testsuite/thin_archive_test_1.cc: New file.
13739         * testsuite/thin_archive_test_2.cc: New file.
13740         * testsuite/thin_archive_test_3.cc: New file.
13741         * testsuite/thin_archive_test_4.cc: New file.
13742
13743 2008-09-29  Cary Coutant  <ccoutant@google.com>
13744
13745         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
13746         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
13747         instead of -1U.
13748         (Sized_relobj::do_finalize_local_symbols): Likewise.
13749         (Sized_relobj::map_to_kept_section): Likewise.
13750         * object.h (Sized_relobj::invalid_address): New constant.
13751         (Sized_relobj::do_output_section_offset): Check for invalid_address
13752         and return -1ULL.
13753         * output.cc (Output_reloc::local_section_offset): Use constant
13754         invalid_address instead of -1U.
13755         (Output_reloc::get_address): Likewise.
13756         (Output_section::output_address): Change -1U to -1ULL.
13757         * output.h (Output_reloc::invalid_address): New constant.
13758         * reloc.cc (Sized_relobj::write_sections): Use constant
13759         invalid_address instead of -1U.
13760         (Sized_relobj::relocate_sections): Likewise.
13761         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
13762         values for merge sections.
13763         * target-reloc.h (relocate_for_relocatable): Use constant
13764         invalid_address instead of -1U.
13765
13766 2008-09-19  Cary Coutant  <ccoutant@google.com>
13767
13768         Add plugin functionality for link-time optimization (LTO).
13769         * configure.ac (plugins): Add --enable-plugins option.
13770         * configure: Regenerate.
13771         * config.in: Regenerate.
13772         * Makefile.am (LIBDL): New variable.
13773         (CCFILES): Add plugin.cc.
13774         (HFILES): Add plugin.h.
13775         (ldadd_var): Add LIBDL.
13776         * Makefile.in: Regenerate.
13777
13778         * archive.cc: Include "plugin.h".
13779         (Archive::setup): Don't preread archive symbols when using a plugin.
13780         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
13781         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
13782         files.
13783         (Archive::include_member): Add symbols from plugin objects.
13784         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
13785         * descriptors.cc (Descriptors::open): Check for file descriptors
13786         abandoned by plugins.
13787         (Descriptors::claim_for_plugin): New function.
13788         * descriptors.h (Descriptors::claim_for_plugin): New function.
13789         (Open_descriptor::is_claimed): New field.
13790         (claim_descriptor_for_plugin): New function.
13791         * fileread.cc (File_read::claim_for_plugin): New function.
13792         * fileread.h (File_read::claim_for_plugin): New function.
13793         (File_read::descriptor): New function.
13794         * gold.cc: Include "plugin.h".
13795         (queue_initial_tasks): Add task to call plugin hooks for generating
13796         new object files.
13797         * main.cc: Include "plugin.h".
13798         (main): Load plugin libraries.
13799         * object.h (Pluginobj): Declare.
13800         (Object::pluginobj): New function.
13801         (Object::do_pluginobj): New function.
13802         (Object::set_target): New function.
13803         * options.cc: Include "plugin.h".
13804         (General_options::parse_plugin): New function.
13805         (General_options::General_options): Initialize plugins_ field.
13806         (General_options::add_plugin): New function.
13807         * options.h (Plugin_manager): Declare.
13808         (General_options): Add --plugin option.
13809         (General_options::has_plugins): New function.
13810         (General_options::plugins): New function.
13811         (General_options::add_plugin): New function.
13812         (General_options::plugins_): New field.
13813         * plugin.cc: New file.
13814         * plugin.h: New file.
13815         * readsyms.cc: Include "plugin.h".
13816         (Read_symbols::do_read_symbols): Check for archive before checking
13817         for ELF file.  Call plugin hooks to claim files.
13818         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
13819         from a real object file; force override when processing replacement
13820         files.
13821         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
13822         (Symbol::init_base_object): Likewise.
13823         (Symbol::init_base_output_data): Likewise.
13824         (Symbol::init_base_output_segment): Likewise.
13825         (Symbol::init_base_constant): Likewise.
13826         (Symbol::init_base_undefined): Likewise.
13827         (Symbol::output_section): Assert that object is not a plugin.
13828         (Symbol_table::add_from_pluginobj): New function.
13829         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
13830         undefined.
13831         (Symbol_table::sized_write_globals): Likewise.
13832         (Symbol_table::add_from_pluginobj): Instantiate template.
13833         * symtab.h (Sized_pluginobj): Declare.
13834         (Symbol::in_real_elf): New function.
13835         (Symbol::set_in_real_elf): New function.
13836         (Symbol::in_real_elf_): New field.
13837         (Symbol_table::add_from_pluginobj): New function.
13838
13839         * testsuite/Makefile.am (AM_CFLAGS): New variable.
13840         (LIBDL): New variable.
13841         (LDADD): Add LIBDL.
13842         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
13843         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
13844         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
13845         (MOSTLYCLEANFILES): Likewise.
13846         * testsuite/Makefile.in: Regenerate.
13847         * testsuite/plugin_test.c: New file.
13848         * testsuite/plugin_test_1.sh: New file.
13849         * testsuite/plugin_test_2.sh: New file.
13850
13851 2008-09-16  Ian Lance Taylor  <iant@google.com>
13852
13853         * target-reloc.h (relocate_section): Check whether a symbol is
13854         defined by the ABI before reporting an undefined symbol error.
13855         * target.h (Target::is_defined_by_abi): Make parameter const.
13856         (Target::do_is_defined_by_abi): Likewise.
13857         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
13858         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
13859         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
13860         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
13861         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
13862         * testsuite/Makefile.in: Rebuild.
13863
13864         * fileread.cc (make_view): Add casts to avoid warning.
13865
13866 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
13867
13868         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
13869         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
13870
13871 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
13872
13873         * options.h (General_options::output_is_executable): New.
13874         (General_options::output_is_pie): New.
13875         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
13876         for shared libraries.
13877         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
13878
13879 2008-09-11  Chris Demetriou  <cgd@google.com>
13880
13881         * options.h (origin): New -z option.
13882         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
13883         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
13884         in DT_FLAGS_1.
13885
13886 2008-09-05  Cary Coutant  <ccoutant@google.com>
13887
13888         * fileread.cc (File_read::make_view): Add check for attempt to map
13889         beyond end of file.
13890
13891 2008-09-05  Cary Coutant  <ccoutant@google.com>
13892
13893         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
13894         explicit instantiations.
13895
13896 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
13897
13898         PR gold/6858
13899         * options.cc (General_options::finalize): Allow undefined symbols
13900         in shlibs if linking -shared.
13901
13902         PR gold/6859
13903         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
13904         symbols as not needing a dynsym entry.
13905
13906 2008-08-20  Craig Silverstein  <csilvers@google.com>
13907
13908         * fileread.cc (File_read::open): Do not lock the file unless it
13909         was successfully opened.
13910
13911 2008-08-14  Cary Coutant  <ccoutant@google.com>
13912
13913         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
13914         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
13915         * testsuite/tls_test.cc (struct int128): 128-bit struct
13916         for testing TLS relocs with non-zero addend.
13917         (v12): New TLS variable.
13918         (t12): New test.
13919         (t_last): Add check for v12.
13920         * testsuite/tls_test.h (t12): New function.
13921         * testsuite/tls_test_main.cc (thread_routine): Call new test.
13922
13923 2008-08-13  Ian Lance Taylor  <iant@google.com>
13924
13925         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
13926         set tls_segment_ or relro_segment_.
13927         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
13928         when appropriate.
13929         * output.h (Output_section::clear_is_relro): New function.
13930         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
13931         sections specially even when output_data_ is empty.
13932         (Output_segment::maximum_alignment): When first section is relro,
13933         only force alignment for PT_LOAD segments.
13934         * script.cc (script_data_segment_align): New function.
13935         (script_data_segment_relro_end): New function.
13936         * script-c.h (script_data_segment_align): Declare.
13937         (script_data_segment_relro_end): Declare.
13938         * script-sections.h (class Script_sections): Declare
13939         data_segment_align and data_segment_relro_end.  Add fields
13940         segment_align_index_ and saw_relro_end_.
13941         * script-sections.cc (class Sections_element): Add set_is_relro
13942         virtual function.  Add new bool* parameter to place_orphan_here.
13943         Add get_output_section virtual function.
13944         (class Output_section_definition): Add set_is_relro.  Add new
13945         bool* parameter to place_orphan_here.  Add get_output_section.
13946         Add is_relro_ field.
13947         (Output_section_definition::Output_section_definition): Initialize
13948         evaluated_address_, evaluated_load_address, evaluated_addralign_,
13949         and is_relro_ fields.
13950         (Output_section_definition::place_orphan_here): Add is_relro
13951         parameter.
13952         (Output_section_definition::set_section_addresses): Set relro for
13953         output section.
13954         (Output_section_definition::alternate_constraint): Likewise.
13955         (class Orphan_output_section): Add new bool* parameter to
13956         place_orphan_here.  Add get_output_section.
13957         (Orphan_output_section::place_orphan_here): Add is_relro
13958         parameter.
13959         (Script_sections::Script_sections): Initialize
13960         data_segment_align_index_ and saw_relro_end_.
13961         (Script_sections::data_segment_align): New function.
13962         (Script_sections::data_segment_relro_end): New function.
13963         (Script_sections::place_orphan): Set or clear is_relro.
13964         (Script_sections::set_section_addresses): Force alignment of first
13965         TLS section.
13966         * yyscript.y (exp): Call script_data_segment_align and
13967         script_data_segment_relro_end.
13968         * testsuite/relro_script_test.t: New file.
13969         * testsuite/relro_test.cc (using_script): Declare.
13970         (t1, t2): Test using_script.
13971         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
13972         (relro_script_test_SOURCES): Define.
13973         (relro_script_test_DEPENDENCIES): Define.
13974         (relro_script_test_LDFLAGS): Define.
13975         (relro_script_test_LDADD): Define.
13976         (relro_script_test.so): New target.
13977         * testsuite/Makefile.in: Rebuild.
13978
13979 2008-08-06  Cary Coutant <ccoutant@google.com>
13980
13981         * archive.cc (Archive::total_archives, Archive::total_members)
13982         (Archive::total_members_loaded): New variables.
13983         (Archive::setup): Add parameter.  Add option to preread
13984         archive symbols.
13985         (Archive::read_armap): Add counter.
13986         (Archive::get_file_and_offset): New function.
13987         (Archive::get_elf_object_for_member): New function.
13988         (Archive::read_all_symbols): New function.
13989         (Archive::read_symbols): New function.
13990         (Archive::add_symbols): Add counters.
13991         (Archive::include_all_members): Use armap to find members if it's
13992         already built.
13993         (Archive::include_member): Skip reading symbols if already read.
13994         Factored code into Archive::get_file_and_offset and
13995         Archive::get_elf_object_for_member.  Changed call to
13996         Mapfile::report_include_archive_member.
13997         (Archive::print_stats): New function.
13998         * archive.h: Declare Object and Read_symbols_data classes.
13999         (Archive::Archive): Add initializers for new members.
14000         (Archive::setup): Add parameter.
14001         (Archive::print_stats): New function.
14002         (Archive::total_archives, Archive::total_members)
14003         (Archive::total_members_loaded): New variables.
14004         (Archive::get_file_and_offset): New function.
14005         (Archive::get_elf_object_for_member): New function.
14006         (Archive::read_all_symbols): New function.
14007         (Archive::read_symbols): New function.
14008         (Archive::Archive_member): New class.
14009         (Archive::members_): New member.
14010         (Archive::num_members_): New member.
14011         * main.cc: Include archive.h.
14012         (main): Call Archive::print_stats.
14013         * mapfile.cc (Mapfile::report_include_archive_member): Delete
14014         archive parameter; member_name is now the fully-decorated name.
14015         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
14016         * options.h: (General_options): Add --preread-archive-symbols option.
14017         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
14018         Archive::setup.
14019
14020 2008-08-04  Ian Lance Taylor  <iant@google.com>
14021
14022         * symtab.h (Symbol::use_plt_offset): New function.
14023         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
14024         * powerpc.cc (Relocate::relocate): Likewise.
14025         * sparc.cc (Relocate::relocate): Likewise.
14026         * x86_64.cc (Relocate::relocate): Likewise.
14027         * testsuite/weak_plt.sh: New test.
14028         * testsuite/weak_plt_main.cc: New test.
14029         * testsuite/weak_plt_shared.cc: New test.
14030         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
14031         (check_PROGRAMS): Add weak_plt.
14032         (check_DATA): Add weak_plt_shared.so.
14033         (weak_plt_main_pic.o, weak_plt): New targets.
14034         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
14035         * testsuite/Makefile.in: Rebuild.
14036
14037         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
14038         gcctestdir/ld.
14039         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
14040         * testsuite/Makefile.in: Rebuild.
14041
14042 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
14043
14044         * Makefile.am (POTFILES.in): Set LC_ALL=C.
14045         * Makefile.in: Regenerate.
14046         * po/POTFILES.in: Regenerate.
14047
14048 2008-07-29  Ian Lance Taylor  <iant@google.com>
14049
14050         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
14051         symbols before other symbols.
14052         * testsuite/script_test_2.cc (test_addr): Declare.
14053         (test_addr_alias): Declare.
14054         (main): Check that test_addr and test_addr_alias have the right
14055         values.
14056         * testsuite/script_test_2.t: Define test_addr_alias and
14057         test_addr.
14058
14059 2008-07-24  Ian Lance Taylor  <iant@google.com>
14060
14061         PR 5990
14062         * descriptors.cc: New file.
14063         * descriptors.h: New file.
14064         * gold-threads.h (class Hold_optional_lock): New class.
14065         * fileread.cc: Include "descriptors.h".
14066         (File_read::~File_read): Release descriptor rather than closing
14067         it.
14068         (File_read::open) [file]: Call open_descriptor rather than open.
14069         Set is_descriptor_opened_.
14070         (File_read::open) [memory]: Assert that descriptor is not open.
14071         (File_read::reopen_descriptor): New function.
14072         (File_read::release): Release descriptor.
14073         (File_read::do_read): Make non-const.  Reopen descriptor.
14074         (File_read::read): Make non-const.
14075         (File_read::make_view): Reopen descriptor.
14076         (File_read::do_readv): Likewise.
14077         * fileread.h (class File_read): Add is_descriptor_opened_ field.
14078         Update declarations.
14079         * layout.cc: Include "descriptors.h".
14080         (Layout::create_build_id): Use open_descriptor rather than open.
14081         * output.cc: Include "descriptors.h".
14082         (Output_file::open): Use open_descriptor rather than open.
14083         * archive.cc (Archive::const_iterator): Change Archive to be
14084         non-const.
14085         (Archive::begin, Archive::end): Make non-const.
14086         (Archive::count_members): Likewise.
14087         * archive.h (class Archive): Update declarations.
14088         * object.h (Object::read): Make non-const.
14089         * Makefile.am (CCFILES): Add descriptors.cc.
14090         (HFILES): Add descriptors.h.
14091         * Makefile.in: Rebuild.
14092
14093         PR 6716
14094         * gold.h: Always include <clocale>.  Add Solaris workarounds
14095         following code in binutils/sysdep.h.
14096
14097         PR 6048
14098         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
14099         this->eh_frame_hdr_ is NULL before using it.
14100
14101         * dynobj.cc (Versions::Versions): Update comment.
14102
14103         * dynobj.cc (Versions::Versions): If there is an soname, use it as
14104         the base version name.
14105
14106         * stringpool.cc (Stringpool_template::add_with_length): Set key to
14107         array size plus one.
14108         (Stringpool_template::set_string_offsets): Subtract one from key
14109         before using it as an array index.
14110         (Stringpool_template::get_offset_with_length): Likewise.
14111         (Stringpool_template::write_to_buffer): Likewise.
14112         * stringpool.h (Stringpool_template::get_offset_from_key):
14113         Likewise.
14114
14115 2008-07-23  Ian Lance Taylor  <iant@google.com>
14116
14117         PR 6658
14118         * object.h (Merged_symbol_value::value): Do our best to handle a
14119         negative addend.
14120
14121         PR 6647
14122         * script.cc (Version_script_info::get_versions): Don't add empty
14123         version tag to return value.
14124         (Version_script_info::get_symbol_version_helper): Change return
14125         type to bool.  Add pversion parameter.  Change all callers.
14126         (script_register_vers_node): Don't require a non-NULL tag.
14127         * script.h (class Version_script_info): Update declarations.
14128         (Version_script_info::get_symbol_version): Change return type to
14129         bool.  Add version parameter.  Change all callers.
14130         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
14131         handling.  Handle an empty version from a version script.
14132         (Symbol_table::define_special_symbol): Likewise.
14133         * testsuite/ver_test_10.script: New file.
14134         * testsuite/ver_test_10.sh: New file.
14135         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
14136         (check_DATA): Add ver_test_10.syms.
14137         (ver_test_10.syms, ver_test_10.so): New target.
14138         * testsuite/Makefile.in: Rebuild.
14139
14140 2008-07-23  Simon Baldwin  <simonb@google.com>
14141
14142         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
14143         to zero for undefined symbols from dynamic libraries.
14144
14145 2008-07-23  Ian Lance Taylor  <iant@google.com>
14146
14147         * symtab.cc (Symbol_table::resolve): Remove version parameter.
14148         Change all callers.
14149         * symtab.h (class Symbol_table): Update declaration.
14150         * testsuite/ver_test_9.cc: New file.
14151         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
14152         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
14153         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
14154         (ver_test_9.so, ver_test_9.o): New targets.
14155         * testsuite/Makefile.in: Rebuild.
14156
14157 2008-07-22  Ian Lance Taylor  <iant@google.com>
14158
14159         * options.h (class General_options): Define --check-sections.
14160         * layout.cc (Layout::set_segment_offsets): Handle
14161         --check-sections.
14162
14163         * options.h (class General_options): Define -n/--nmagic and
14164         -N/--omagic.
14165         * options.cc (General_options::finalize): For -n/--nmagic or
14166         -N/--omagic, set -static.
14167         * layout.cc (Layout::attach_allocated_section_to_segment): If
14168         -N/--omagic, don't put read-only and read-write sections in
14169         different segments.
14170         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
14171         finding a read-only segment.
14172         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
14173         don't set the minimum segment alignment to the common page size,
14174         and don't set the file offset to the address modulo the page size.
14175         * script-sections.cc (Script_sections::create_segments): If
14176         -n/--omagic, don't put read-only and read-write sections in
14177         different segments.
14178
14179         * cref.cc: New file.
14180         * cref.h: New file.
14181         * options.h (class General_options): Add --print-symbol-counts.
14182         * main.cc (main): Issue defined symbol report if requested.
14183         * archive.cc (Archive::interpret_header): Make into a const member
14184         function.
14185         (Archive::add_symbols): Call Input_objects::archive_start and
14186         archive_stop.
14187         (Archive::const_iterator): Define new class.
14188         (Archive::begin, Archive::end): New functions.
14189         (Archive::include_all_members): Rewrite to use iterator.
14190         (Archive::count_members): New function.
14191         * archive.h (class Archive): Update declarations.
14192         (Archive::filename): New function.
14193         * object.cc: Include "cref.h".
14194         (Sized_relobj::Sized_relobj): Initialize defined_count_.
14195         (Sized_relobj::do_get_global_symbol_counts): New function.
14196         (Input_objects::add_object): Add object to cross-referencer.
14197         (Input_objects::archive_start): New function.
14198         (Input_objects::archive_stop): New function.
14199         (Input_objects::print_symbol_counts): New function.
14200         * object.h: Declare Cref and Archive.
14201         (Object::get_global_symbol_counts): New function.
14202         (Object::do_get_global_symbol_counts): New pure virtual function.
14203         (class Sized_relobj): Add defined_count_ field.  Update
14204         declarations.
14205         (class Input_objects): Add cref_ field.  Update constructor.
14206         Update declarations.
14207         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
14208         defined_count_.
14209         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
14210         symbol counts.
14211         (Sized_dynobj::do_get_global_symbol_counts): New function.
14212         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
14213         defined_count_.  Update declarations.  Define Symbols typedef.
14214         * symtab.cc (Symbol_table::add_from_relobj): Add defined
14215         parameter.  Change all callers.
14216         (Symbol_table::add_from_dynobj): Add sympointers and defined
14217         parameters.  Change all callers.
14218         * symtab.h (class Symbol_table): Update declarations.
14219         * Makefile.am (CCFILES): Add cref.cc.
14220         (HFILES): Add cref.h.
14221         * Makefile.in: Rebuild.
14222
14223 2008-07-22  Simon Baldwin  <simonb@google.com>
14224
14225         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
14226         to zero when writing undefined symbols.
14227
14228 2008-07-22  Ian Lance Taylor  <iant@google.com>
14229
14230         * output.cc (Output_section::add_input_section): Don't try to
14231         merge empty merge sections.
14232
14233 2008-07-21  Craig Silverstein  <csilvers@google.com>
14234
14235         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
14236         Include symbol version in error message.
14237
14238 2008-07-20  Chris Demetriou  <cgd@google.com>
14239
14240         * configure.ac (gold_cv_c_random_seed): New configured variable.
14241         (RANDOM_SEED_CFLAGS): New substituted variable.
14242         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
14243         * configure: Rebuild.
14244         * Makefile.in: Likewise.
14245         * testsuite/Makefile.in: Likewise.
14246
14247 2008-07-18  Ian Lance Taylor  <iant@google.com>
14248
14249         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
14250         where we see NAME/NULL and NAME/VERSION  as separate symbols.
14251         * testsuite/ver_test_main.cc (main): Call t4.
14252         (t4, t4_2a): Define.
14253         * testsuite/ver_test_2.cc (t4_2): Define.
14254         * testsuite/ver_test_2.script: Put t4_2a in VER2.
14255         * testsuite/ver_test_4.cc (t4_2a): Define.
14256         * testsuite/ver_test_4.script: Put t4_2a in VER2.
14257         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
14258
14259 2008-07-17  Ian Lance Taylor  <iant@google.com>
14260
14261         * dynobj.cc (Versions::add_def): If we give an error about a
14262         missing version, go ahead and create the version anyhow.
14263
14264 2008-07-10  Ian Lance Taylor  <iant@google.com>
14265
14266         Handle output sections with more than 0x7fffffff bytes.
14267         * object.h (class Relobj): Change map_to_output_ to
14268         output_sections_, and just keep a section pointer.  Change all
14269         uses.  Move comdat group support to Sized_relobj.
14270         (Relobj::is_section_specially_mapped): Remove.
14271         (Relobj::output_section): Remove poff parameter.  Change all
14272         callers.
14273         (Relobj::output_section_offset): New function.
14274         (Relobj::set_section_offset): Rewrite.
14275         (Relobj::map_to_output): Remove.
14276         (Relobj::output_sections): New function.
14277         (Relobj::do_output_section_offset): New pure virtual function.
14278         (Relobj::do_set_section_offset): Likewise.
14279         (class Sized_relobj): Add section_offsets_ field.  Add comdat
14280         group support from Relobj.  Update declarations.
14281         (Sized_relobj::get_output_section_offset): New function.
14282         (Sized_relobj::do_output_section_offset): New function.
14283         (Sized_relobj::do_set_section_offset): New function.
14284         * object.cc (Relobj::output_section_address): Remove.
14285         (Sized_relobj::Sized_relobj): Initialize new fields.
14286         (Sized_relobj::include_section_group): Cast find_kept_object to
14287         Sized_relobj.
14288         (Sized_relobj::include_linkonce_section): Likewise.
14289         (Sized_relobj::do_layout): Use separate arrays for output section
14290         and output offset.
14291         (Sized_relobj::do_count_local_symbols): Change map_to_output to
14292         output_sections.
14293         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
14294         output_sections and section_offsets.
14295         (Sized_relobj::write_local_symbols): Likewise.
14296         (map_to_kept_section): Compute output address directly.
14297         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
14298         output_sections and section_offsets.
14299         (Sized_relobj::write_sections): Likewise.
14300         (Sized_relobj::relocate_sections): Likewise.
14301         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
14302         * output.h (class Output_reloc): Update declarations.  Change
14303         u2_.relobj to Sized_relobj*.
14304         (class Output_data_reloc): Change add functions to use
14305         Sized_relobj*.
14306         * output.cc (Output_reloc::Output_reloc): Change relobj to
14307         Sized_relobj*.
14308         (Output_reloc::local_section_offset): Change return type to
14309         Elf_Addr.  Use get_output_section_offset.
14310         (Output_reloc::get_address): Likewise.
14311         (Output_section::is_input_address_mapped): Don't call
14312         is_section_specially_mapped.
14313         (Output_section::output_offset): Likewise.
14314         (Output_section::output_address): Likewise.
14315         (Output_section::starting_output_address): Likewise.
14316         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
14317         parameter to Sized_relobj*.
14318         (Copy_relocs::need_copy_reloc): Likewise.
14319         (Copy_relocs::save): Likewise.
14320         * copy-relocs.h (class Copy_relocs): Update declarations.
14321         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
14322         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
14323         * target-reloc.h (relocate_for_relocatable): Change
14324         offset_in_output_section type to Elf_Addr.  Change code that uses
14325         it as well.
14326         * layout.cc (Layout::layout): Always set *off.
14327         * mapfile.cc (Mapfile::print_input_section): Use
14328         output_section_offset.
14329         * i386.cc (Target_i386::copy_reloc): Change object parameter to
14330         Sized_relobj*.
14331         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
14332         * sparc.cc (Target_sparc::copy_reloc): Likewise.
14333         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
14334
14335 2008-07-03  Ian Lance Taylor  <iant@google.com>
14336
14337         * layout.cc (Layout::include_section): Do not discard unrecognized
14338         SHT_STRTAB sections.
14339
14340 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
14341
14342         * script.cc (Lex::can_continue_name): Make '?' allowable in
14343         version-script names.
14344         * testsuite/version_script.map: Change glob pattern to use '?'
14345
14346 2008-06-30  Manish Singh  <yosh@gimp.org>
14347
14348         PR 6585
14349         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
14350         Correct typo.
14351
14352 2008-06-30  Ian Lance Taylor  <iant@google.com>
14353
14354         PR 6660
14355         PR 6682
14356         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
14357         versions]: Don't try to read the value in the contents, since we
14358         don't use it.  Use the template endianness when writing.
14359
14360 2008-06-25  Cary Coutant  <ccoutant@google.com>
14361
14362         * fileread.cc (File_read::make_view): Assert on zero-length view.
14363         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
14364         symbol table when there are no symbols to read.
14365
14366 2008-06-23  Craig Silverstein  <csilvers@google.com>
14367
14368         * version.cc (version_string): Bump to 1.7
14369
14370 2008-06-18  Craig Silverstein  <csilvers@google.com>
14371
14372         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
14373         constant 0xFFFF to type Valtype.
14374         (Powerpc_relocate_functions::rel16_ha): Likewise.
14375
14376 2008-06-17  Ian Lance Taylor  <iant@google.com>
14377
14378         * output.h (Output_section::Input_section): Initialize p2align_ to
14379         zero for Output_section_data constructors.
14380         (Output_section::Input_section::addralign): If not an input
14381         section, return the alignment of the Output_section_data.
14382         * testsuite/copy_test.cc: New file.
14383         * testsuite/copy_test_1.cc: New file.
14384         * testsuite/copy_test_2.cc: New file.
14385         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
14386         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
14387         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
14388         (copy_test_1_pic.o, copy_test_1.so): New targets.
14389         (copy_test_2_pic.o, copy_test_2.so): New targets.
14390         * testsuite/Makefile.in: Rebuild.
14391
14392         * script-sections.cc (Script_sections::place_orphan): Initialize
14393         local variable exact.
14394
14395 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
14396
14397         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
14398
14399 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
14400             David S. Miller  <davem@davemloft.net>
14401
14402         * powerpc.cc: New file.
14403         * Makefile.am (TARGETSOURCES): Add powerpc.cc
14404         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
14405         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
14406         * Makefile.in: Rebuild.
14407
14408 2008-06-09  Ian Lance Taylor  <iant@google.com>
14409
14410         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
14411         <exception>.
14412         (throwing, orig_terminate): New static variables.
14413         (terminate_handler): New static function.
14414         (t2): Set terminate handler.
14415
14416 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
14417
14418         PR 6584
14419         * binary.cc (Binary_to_elf::sized_convert): Fix .data
14420         alignment.
14421
14422 2008-05-30  Cary Coutant  <ccoutant@google.com>
14423
14424         * archive.cc (Archive::include_all_members) Correct to step
14425         over symbol table and extended name table in thin archives.
14426
14427 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
14428
14429         PR 6407
14430         * target-reloc.h (relocate_for_relocatable): Fix new_offset
14431         calculation.
14432
14433 2008-05-28  Caleb Howe  <cshowe@google.com>
14434
14435         * reduced_debug_output.cc: New file.
14436         * reduced_debug_output.h: New file.
14437         * options.h (class General_options): Add --strip-debug-non-line.
14438         * options.cc (General_options::finalize): Add strip_debug_non_line
14439         to the strip heirarchy.
14440         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
14441         fields.
14442         * layout.cc: Include "reduced_debug_output.h".
14443         (Layout::Layout): Initialize new fields.
14444         (line_only_debug_sections): New static array.
14445         (is_lines_only_debug_sections): New static inline function.
14446         (Layout::include_section): Handle --strip-debug-non-line.
14447         (Layout::make_output_section): If --strip-debug-non-line, build
14448         new output sections for .debug_abbrev and .debug_info.
14449         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
14450         gold.  Warn about possible overflow.
14451         (read_signed_LEB_128): Likewise.
14452         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
14453         (read_signed_LEB_128): Declare.
14454         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
14455         (HFILES): Add reduced_debug_output.h.
14456         * Makefile.in: Rebuild.
14457
14458 2008-05-21  Ian Lance Taylor  <iant@google.com>
14459
14460         * mapfile.cc: New file.
14461         * mapfile.h: New file.
14462         * options.h (class General_options): Add -M/--print-map and -Map.
14463         * options.cc (General_options::finalize): Make -M equivalent to
14464         -Map -.
14465         * main.cc: Include <cstdio> and "mapfile.h".
14466         (main): Open mapfile if requested.
14467         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
14468         constructor.  Change caller.
14469         (queue_initial_tasks): Add mapfile parameter.  Change caller.
14470         (queue_middle_tasks): Likewise.
14471         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
14472         declarations.
14473         * archive.cc: Include "mapfile.h".
14474         (Archive::add_symbols): Add mapfile parameter.  Change all
14475         callers.  Pass mapfile, symbol, and reason to include_member.
14476         (Archive::include_all_members): Add mapfile parameter.  Change all
14477         callers.
14478         (Archive::include_member): Add mapfile, sym, and why parameters.
14479         Change all callers.  Report inclusion to map file.
14480         * archive.h: Include "fileread.h".
14481         (class Archive): Update declarations.
14482         (Archive::file): New const method.
14483         (class Add_archive_symbols): Add mapfile_ field.  Update
14484         constructor.  Change all callers.
14485         * readsyms.h (class Read_symbols): Likewise.
14486         (class Finish_group): Likewise.
14487         (class Read_script): Likewise.
14488         * common.cc: Include "mapfile.h".
14489         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
14490         all callers.
14491         (Symbol_table::do_allocate_commons): Likewise.
14492         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
14493         symbol allocation to mapfile.
14494         * common.h (class Allocate_commons_task): Add mapfile_ field.
14495         Update constructor.  Change all callers.
14496         * symtab.h (class Symbol_table): Update declarations.
14497         * layout.cc: Include "mapfile.h".
14498         (Layout_task_runner::run): Print information to mapfile.
14499         (Layout::create_gold_note): Change Output_data_fixed_space to
14500         Output_data_zero_fill.
14501         (Layout::create_build_id): Likewise.
14502         (Layout::print_to_mapfile): New function.
14503         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
14504         constructor.  Change caller.
14505         (class Layout): Declare print_to_mapfile.
14506         * output.cc (Output_section::Input_section::print_to_mapfile): New
14507         function.
14508         (Output_section::add_input_section): If producing a map, always
14509         add to input_sections_ list.
14510         (Output_section::do_print_to_mapfile): New function.
14511         (Output_segment::print_sections_to_mapfile): New function.
14512         (Output_segment::print_section_list_to_mapfile): New function.
14513         * output.h: Include "mapfile.h".
14514         (Output_data::print_to_mapfile): New function.
14515         (Output_data::do_print_to_mapfile): New virtual function.
14516         (Output_segment_headers::do_print_to_mapfile): New function.
14517         (Output_file_header::do_print_to_mapfile): New function.
14518         (Output_data_const::do_print_to_mapfile): New function.
14519         (class Output_data_const_buffer): Add map_name_ field.  Update
14520         constructor.  Change all callers.  Add do_print_to_mapfile
14521         function.
14522         (class Output_data_fixed_space): Likewise.
14523         (class Output_data_space): Likewise.
14524         (class Output_data_zero_fill): New class.
14525         (Output_data_strtab::do_print_to_mapfile): New function.
14526         (Output_data_reloc_base::do_print_to_mapfile): New function.
14527         (Output_relocatable_relocs::do_print_to_mapfile): New function.
14528         (Output_data_group::do_print_to_mapfile): New function.
14529         (Output_data_got::do_print_to_mapfile): New function.
14530         (Output_data_dynamic::do_print_to_mapfile): New function.
14531         (Output_symtab_xindex::do_print_to_mapfile): New function.
14532         (class Output_section): Declare do_print_to_mapflie.  Declare
14533         print_to_mapfile in Input_section.
14534         (class Output_segment): Declare new functions.
14535         * object.h (Sized_relobj::symbol_count): New function.
14536         * script-sections.cc
14537         (Output_section_element_dot_assignment::set_section_addresses):
14538         Change Output_data_fixed_space to Output_data_zero_fill.
14539         (Output_data_expression::do_print_to_mapfile): New function.
14540         * script.cc (read_input_script): Add mapfile parameter.  Change
14541         all callers.
14542         * script.h (read_input_script): Update declaration.
14543         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
14544         (Eh_frame::do_print_to_mapfile): New function.
14545         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
14546         (Output_merge_string::do_print_to_mapfile): New function.
14547         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
14548         function.
14549         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
14550         function.
14551         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
14552         function.
14553         * Makefile.am (CCFILES): Add mapfile.cc.
14554         (HFILES): Add mapfile.h.
14555         * Makefile.in: Rebuild.
14556
14557 2008-05-19  Ian Lance Taylor  <iant@google.com>
14558
14559         * options.h (class General_options): Add -z relro.
14560         * layout.cc (Layout::Layout): Initialize relro_segment_.
14561         (Layout::add_output_section_data): Return the output section.
14562         (Layout::make_output_section): Rcognize relro sections and mark
14563         them appropriately.
14564         (Layout::attach_allocated_section_to_segment): Put relro sections
14565         in a PT_GNU_RELRO segment.
14566         (Layout::create_initial_dynamic_sections): Mark the .dynamic
14567         section as relro.
14568         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
14569         PT_TLS segments.
14570         (Layout::linkonce_mapping): Map d.rel.ro.local to
14571         .data.rel.ro.local.
14572         (Layout::output_section_name): Us .data.rel.ro.local for any
14573         section which begins with that.
14574         * layout.h (class Layout): Update add_output_section_data
14575         declaration.  Add relro_segment_ field.
14576         * output.cc (Output_section::Output_section): Initialize is_relro_
14577         and is_relro_local_ fields.
14578         (Output_segment::add_output_section): Group relro sections.
14579         (Output_segment::is_first_section_relro): New function.
14580         (Output_segment::maximum_alignment): If there is a relro section,
14581         align the segment to the common page size.
14582         (Output_segment::set_section_addresses): Track whether we are
14583         looking at relro sections.  If the last section is a relro
14584         section, align to the common page size.
14585         (Output_segment::set_section_list_addresses): Add in_relro
14586         parameter.  Change all callers.  Align to the page size when
14587         moving from relro to non-relro section.
14588         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
14589         segment.
14590         * output.h (class Output_section): Add is_relro_ and
14591         is_relro_local_ fields.
14592         (Output_section::is_relro): New function.
14593         (Output_section::set_is_relro): New function.
14594         (Output_section::is_relro_local): New function.
14595         (Output_section::set_is_relro_local): New function.
14596         (class Output_segment): Update declarations.
14597         * i386.cc (Target_i386::got_section): Mark .got section as relro.
14598         * sparc.cc (Target_sparc::got_section): Likewise.
14599         * x86_64.cc (Target_x86_64::got_section): Likewise.
14600         * testsuite/relro_test_main.cc: New file.
14601         * testsuite/relro_test.cc: New file.
14602         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
14603         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
14604         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
14605         (relro_test.so, relro_test_pic.o): New targets.
14606         * testsuite/Makefile.in: Rebuild.
14607
14608 2008-05-16  Ian Lance Taylor  <iant@google.com>
14609
14610         * output.cc (Output_segment::add_output_section): Remove front
14611         parameter.
14612         * output.h (class Output_segment): Remove
14613         add_initial_output_section and overloaded add_output_section.
14614         Update declaration of remaining add_output_section.
14615         * layout.cc (Layout::create_interp): Call add_output_section
14616         rather than add_initial_output_section.
14617         (Layout::finish_dynamic_section): Likewise.
14618
14619         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
14620         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
14621         know the dynamic type.
14622         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
14623         field.  Initialize it in constructor.
14624         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
14625         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
14626         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
14627         reloc.
14628
14629         * output.cc (Output_reloc::get_address): Change return type to
14630         Elf_Addr.
14631         * output.h (class Output_reloc): Update get_address declaration.
14632         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
14633         for section addresses.
14634
14635 2008-05-09  Ian Lance Taylor  <iant@google.com>
14636
14637         PR 6493
14638         * gold.cc (gold_nomem): Use return value of write.
14639
14640 2008-05-08  Ian Lance Taylor  <iant@google.com>
14641
14642         * symtab.c (Symbol::init_base_output_data): Add version
14643         parameter.  Change all callers.
14644         (Symbol::init_base_output_segment): Likewise.
14645         (Symbol::init_base_constant): Likewise.
14646         (Symbol::init_base_undefined): Likewise.
14647         (Sized_symbol::init_output_data): Likewise.
14648         (Sized_symbol::init_output_segment): Likewise.
14649         (Sized_symbol::init_constant): Likewise.
14650         (Sized_symbol::init_undefined): Likewise.
14651         (Symbol_table::do_define_in_output_data): If the new symbol has a
14652         version, mark it as the default.
14653         (Symbol_table::do_define_in_output_segment): Likewise.
14654         (Symbol_table::do_define_as_constant): Likewise.
14655         * symtab.h (class Symbol): Update declarations.
14656         (class Sized_symbol): Likewise.
14657         * resolve.cc (Symbol::override_version): New function.
14658         (Symbol::override_base): Call override_version.
14659         (Symbol::override_base_with_special): Likewise.
14660         * testsuite/ver_script_8.script: New file.
14661         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
14662         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
14663         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
14664         (ver_test_8_1.so, ver_test_8_2.so): New targets.
14665
14666 2008-05-06  Ian Lance Taylor  <iant@google.com>
14667
14668         PR 6049
14669         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
14670         functions.
14671         (class General_options): Remove existing --undefined, and add
14672         --no-undefined instead.  Add new --undefined as synonym for -u.
14673         * archive.cc (Archive::add_symbols): Check whether symbol was
14674         named with -u.
14675         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
14676         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
14677         all uses.  Add IS_UNDEFINED.  Update declarations to split
14678         different versions of init_base.  Declare init_base_undefined.
14679         (Symbol::is_defined): Handle IS_UNDEFINED.
14680         (Symbol::is_undefined): Likewise.
14681         (Symbol::is_weak_undefined): Call is_undefined.
14682         (Symbol::is_absolute): Handle IS_CONSTANT.
14683         (class Sized_symbol): Update declarations to split different
14684         versions of init.  Declare init_undefined.
14685         (class Symbol_table): Declare new functions.
14686         * symtab.cc (Symbol::init_base_object): Rename from init_base.
14687         Change all callers.
14688         (Symbol::init_base_output_data): Likewise.
14689         (Symbol::init_base_output_segment): Likewise.
14690         (Symbol::init_base_constant): Likewise.
14691         (Symbol::init_base_undefined): New function.
14692         (Sized_symbol::init_object): Rename from init.  Change all
14693         callers.
14694         (Sized_symbol::init_output_data): Likewise.
14695         (Sized_symbol::init_output_segment): Likewise.
14696         (Sized_symbol::init_constant): Likewise.
14697         (Sized_symbol::init_undefined): New function.
14698         (Symbol_table::add_undefined_symbols_from_command_line): New
14699         function.
14700         (Symbol_table::do_add_undefined_symbols_from_command_line): New
14701         function.
14702         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
14703         (Symbol::output_section): Likewise.
14704         (Symbol::set_output_section): Likewise.
14705         (Symbol_table::sized_finalize_symbol): Likewise.
14706         (Symbol_table::sized_write_globals): Likewise.
14707         * resolve.cc (Symbol_table::should_override): Likewise.
14708         (Symbol::override_base_with_special): Likewise.
14709
14710         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
14711         symbol, change it to have default visibility.
14712         * testsuite/protected_1.cc: New file.
14713         * testsuite/protected_2.cc: New file.
14714         * testsuite/protected_3.cc: New file.
14715         * testsuite/protected_main_1.cc: New file.
14716         * testsuite/protected_main_2.cc: New file.
14717         * testsuite/protected_main_3.cc: New file.
14718         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
14719         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
14720         (protected_1_LDFLAGS, protected_1_LDADD): Define.
14721         (protected_1.so): New target.
14722         (protected_1_pic.o, protected_2_pic.o): New targets.
14723         (protected_3_pic.o): New target.
14724         (check_PROGRAMS): Add protected_2.
14725         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
14726         (protected_2_LDFLAGS, protected_2_LDADD): Define.
14727         * testsuite/Makefile.in: Rebuild.
14728
14729         * options.h (DEFINE_var): Add set_user_set_##varname__.
14730         (DEFINE_bool_alias): New macro.
14731         (class General_options): Define -Bstatic using DEFINE_bool_alias
14732         rather than DEFINE_special.  Add --undefined as an alias for -z
14733         defs.
14734         * options.cc (General_options::parse_Bstatic): Remove.
14735
14736         * options.h (class General_options): Add --fatal-warnings.
14737         * main.cc (main): Implement --fatal-warnings.
14738         * errors.h (Errors::warning_count): New function.
14739
14740         * options.h (class General_options): Add -Bsymbolic-functions.
14741         * symtab.h (Symbol::is_preemptible): Check for
14742         -Bsymbolic-functions.
14743
14744 2008-05-05  Ian Lance Taylor  <iant@google.com>
14745
14746         * options.h (DEFINE_bool): For DASH_Z, create the negative option
14747         as noVARNAME rather than no-VARNAME.
14748         (class General_options): Add option -z combreloc.
14749         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
14750         get_address.
14751         (Output_reloc::sort_before) [SHT_REL]: New function.
14752         (Output_reloc::sort_before) [SHT_RELA]: New function.
14753         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
14754         Sort_relocs_comparison.
14755         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
14756         parameter.  Change all callers.
14757         (Output_data_reloc::Output_data_reloc) [both versions]: Add
14758         sort_relocs parameter.  Change all callers.
14759         * output.cc (Output_reloc::get_address): New function, broken out
14760         of write_rel.
14761         (Output_reloc::write_rel): Call it.
14762         (Output_reloc::compare): New function.
14763         (Output_data_reloc_base::do_write): Optionally sort relocs.
14764
14765         * configure.ac: If targ_extra_obj is set, link it in.
14766         * configure.tgt: Initialize all variables.
14767         (x86_64*): Set targ_extra_obj and targ_extra_size.
14768         * configure: Rebuild.
14769
14770         * object.cc (Sized_relobj::include_section_group): Adjust section
14771         indexes read from group data.  Build vector to pass to
14772         layout_group.
14773         * layout.cc (Layout::layout_group): Add flags and shndxes
14774         parameters.  Remove contents parameter.  Change caller.  Update
14775         explicit instantiations.
14776         * layout.h (class Layout): Update layout_group declaration.
14777         * output.cc (Output_data_group::Output_data_group): Add flags and
14778         input_shndxes parameters.  Remove contents parameter.  Change
14779         caller.
14780         (Output_data_group::do_write): Change input_sections_ to
14781         input_shndxes_.
14782         * output.h (class Output_data_group): Update constructor
14783         declaration.  Rename input_sections_ to input_shndxes_.
14784         * testsuite/many_sections_test.cc: Add template.
14785
14786 2008-04-30  Cary Coutant  <ccoutant@google.com>
14787
14788         * target-reloc.h (relocate_section): Fix dead-pointer bug.
14789
14790         * layout.cc (Layout::include_section): Refactored check for debug
14791         info section.
14792         (Layout::add_comdat): Add new parameters.  Change type
14793         of signature parameter.  Add object and shndx to signatures table.
14794         (Layout::find_kept_object): New function.
14795         * layout.h: Include <cstring>.
14796         (Layout::is_debug_info_section): New function.
14797         (Layout::add_comdat): Add new parameters.
14798         (Layout::find_kept_object): New function.
14799         (Layout::Kept_section): New struct.
14800         (Layout::Signatures): Change type of map range.
14801         * object.cc (Relobj::output_section_address): New function.
14802         (Sized_relobj::include_section_group): Add new parameters.  Change
14803         calls to Layout::add_comdat.  Change to build table of kept comdat
14804         groups and table mapping discarded sections to kept sections.
14805         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
14806         (Sized_relobj::do_layout): Change calls to include_section_group and
14807         include_linkonce_section.
14808         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
14809         value to zero when section is discarded.
14810         (Sized_relobj::map_to_kept_section): New function.
14811         * object.h (Relobj::output_section_address): New function.
14812         (Relobj::Comdat_group): New type.
14813         (Relobj::find_comdat_group): New function.
14814         (Relobj::Comdat_group_table): New type.
14815         (Relobj::Kept_comdat_section): New type.
14816         (Relobj::Kept_comdat_section_table): New type.
14817         (Relobj::add_comdat_group): New function.
14818         (Relobj::set_kept_comdat_section): New function.
14819         (Relobj::get_kept_comdat_section): New function.
14820         (Relobj::comdat_groups_): New field.
14821         (Relobj::kept_comdat_sections_): New field.
14822         (Symbol_value::input_value): Update comment.
14823         (Sized_relobj::map_to_kept_section) New function.
14824         (Sized_relobj::include_linkonce_section): Add new parameter.
14825         * target-reloc.h (Comdat_behavior): New type.
14826         (get_comdat_behavior): New function.
14827         (relocate_section): Add code to map a discarded section to the
14828         corresponding kept section when applying a relocation.
14829
14830 2008-04-30  Craig Silverstein  <csilvers@google.com>
14831
14832         * dwarf_reader.cc (next_generation_count): New static var.
14833         (Addr2line_cache_entry): New struct.
14834         (addr2line_cache): New static var.
14835         (Dwarf_line_info::one_addr2line): Added caching.
14836         (Dwarf_line_info::clear_addr2line_cache): New function.
14837         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
14838         cache-size parameter.
14839         (Dwarf_line_info::one_addr2line_cache): New function.
14840         * symtab.cc (Symbol_table::detect_odr_violations): Pass
14841         new cache-size argument to one_addr2line(), and clear cache.
14842
14843 2008-04-28  Cary Coutant  <ccoutant@google.com>
14844
14845         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
14846         R_386_PC8 relocations.
14847
14848 2008-04-23  Ian Lance Taylor  <iant@google.com>
14849
14850         * object.cc (Sized_relobj::include_section_group): Check for
14851         invalid section group.
14852
14853         * object.cc (make_elf_object): Correct test for 64-bit ELF file
14854         header size.
14855
14856         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
14857         than read for file header.
14858         * archive.cc (Archive::include_member): Likewise.
14859
14860 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
14861
14862         * aclocal.m4: Regenerate.
14863         * configure: Regenerate.
14864
14865 2008-04-19  Ian Lance Taylor  <iant@google.com>
14866
14867         * version.cc (version_string): Bump to 1.6.
14868
14869         * testsuite/Makefile.am (many_sections_r_test): New target.
14870         (many_sections_r_test_SOURCES): Remove.
14871         (many_sections_r_test_DEPENDENCIES): Remove.
14872         (many_sections_r_test_LDFLAGS): Remove.
14873         (many_sections_r_test_LDADD): Remove.
14874
14875         * object.cc (Sized_relobj::do_add_symbols): Always pass
14876         local_symbol_count_ to add_from_relobj.
14877
14878         * testsuite/Makefile.am (many_sections_check.h): Only check one in
14879         every thousand variables.
14880         * testsuite/Makefile.in: Rebuild.
14881
14882         * object.cc (Xindex::initialize_symtab_xindex): New function.
14883         (Xindex::read_symtab_xindex): New function.
14884         (Xindex::sym_xindex_to_shndx): New function.
14885         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
14886         available.
14887         (Sized_relobj::do_initialize_xindex): New function.
14888         (Sized_relobj::do_read_symbols): Adjust section links.
14889         (Sized_relobj::symbol_section_and_value): Add is_ordinary
14890         parameter.  Change all callers.
14891         (Sized_relobj::include_section_group): Adjust section links and
14892         symbol section indexes.
14893         (Sized_relobj::do_layout): Adjust section links.
14894         (Sized_relobj::do_count_local_symbols): Adjust section links and
14895         symbol section indexes.
14896         (Sized_relobj::do_finalize_local_symbols): Distinguish between
14897         ordinary and special symbols.
14898         (Sized_relobj::write_local_symbols): Add symtab_xindex and
14899         dynsym_xindex parameters.  Change all callers.  Adjust section
14900         links.  Use SHN_XINDEX when needed.
14901         (Sized_relobj::get_symbol_location_info): Adjust section links.
14902         Don't get fooled by special symbols.
14903         * object.h (class Xindex): Define.
14904         (class Object): Add xindex_ parameter.  Declare virtual functoin
14905         do_initialize_xindex.
14906         (Object::adjust_sym_shndx): New function.
14907         (Object::set_xindex): New protected function.
14908         (class Symbol_value): Add is_ordinary_shndx_ field.
14909         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
14910         (Symbol_value::value): Assert ordinary section.
14911         (Symbol_value::initialize_input_to_output_map): Likewise.
14912         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
14913         Change all callers.
14914         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
14915         all callers.
14916         (class Sized_relobj): Update declarations.
14917         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
14918         parameter.  Change all callers.
14919         (Sized_relobj::adjust_shndx): New function.
14920         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
14921         field.
14922         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
14923         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
14924         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
14925         (Sized_dynobj::read_dynsym_section): Adjust section links.
14926         (Sized_dynobj::read_dynamic): Likewise.
14927         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
14928         section links.
14929         (Sized_dynobj::do_initialize_xindex): New function.
14930         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
14931         do_initialize_xindex.
14932         (Sized_dynobj::adjust_shndx): New function.
14933         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
14934         dynsym_xindex_ fields.
14935         (Layout::finalize): Add a call to set_section_indexes before
14936         creating the symtab sections.
14937         (Layout::set_section_indexes): Don't do anything if the section
14938         already has a section index.
14939         (Layout::create_symtab_sections): Add shnum parameter.  Change
14940         caller.  Create .symtab_shndx section if needed.
14941         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
14942         caller.
14943         (Layout::allocated_output_section_count): New function.
14944         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
14945         needed.
14946         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
14947         fields.  Update declarations.
14948         (Layout::symtab_xindex): New function.
14949         (Layout::dynsym_xindex): New function.
14950         (class Write_symbols_task): Add layout_ field.
14951         (Write_symbols_task::Write_symbols_task): Add layout parameter.
14952         Change caller.
14953         * output.cc (Output_section_headers::Output_section_headers): Add
14954         shstrtab_section parameter.  Change all callers.
14955         (Output_section_headers::do_sized_write): Store overflow values
14956         for section count and section string table section index in
14957         section header zero.
14958         (Output_file_header::do_sized_write): Check for overflow of
14959         section count and section string table section index.
14960         (Output_symtab_xindex::do_write): New function.
14961         (Output_symtab_xindex::endian_do_write): New function.
14962         * output.h (class Output_section_headers): Add shstrtab_section_.
14963         Update declarations.
14964         (class Output_symtab_xindex): Define.
14965         (Output_section::has_out_shndx): New function.
14966         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
14967         field.
14968         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
14969         Change all callers.
14970         (Sized_symbol::init): Likewise.
14971         (Symbol::output_section): Check for ordinary symbol.
14972         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
14973         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
14974         callers.
14975         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
14976         Change all callers.  Simplify handling of symbols from sections
14977         not included in the link.
14978         (Symbol_table::add_from_dynobj): Handle ordinary symbol
14979         distinction.
14980         (Weak_alias_sorter::operator()): Assert that symbols are
14981         ordinary.
14982         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
14983         distinction.
14984         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
14985         parameters.  Change all callers.
14986         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
14987         symbol distinction.  Use SHN_XINDEX when needed.
14988         (Symbol_table::write_section_symbol): Add symtab_xindex
14989         parameter.  Change all callers.
14990         (Symbol_table::sized_write_section_symbol): Likewise.  Use
14991         SHN_XINDEX when needed.
14992         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
14993         declarations.
14994         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
14995         (Symbol::is_defined): Check is_ordinary.
14996         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
14997         (Symbol::is_absolute, Symbol::is_common): Likewise.
14998         (class Sized_symbol): Update declarations.
14999         (class Symbol_table): Update declarations.
15000         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
15001         parameters.  Change all callers.
15002         (Sized_symbol::override): Likewise.
15003         (Symbol_table::override): Likewise.
15004         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
15005         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
15006         is_ordinary, and orig_st_shndx parameters.  Change all callers.
15007         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
15008         to be in an ordinary section.
15009         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
15010         object and is_ordinary parameters.  Change all callers.
15011         (Sized_dwarf_line_info::read_relocs): Add object parameter.
15012         Change all callers.  Don't add undefined or non-ordinary symbols
15013         to reloc_map_.
15014         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
15015         Change all callers.
15016         * dwarf_reader.h (class Sized_dwarf_line_info): Update
15017         declarations.
15018         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
15019         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
15020         (Sized_relobj::relocate_sections): Likewise.
15021         * target-reloc.h (scan_relocs): Adjust section symbol index.
15022         (scan_relocatable_relocs): Likewise.
15023         * i386.cc (Scan::local): Check for ordinary symbols.
15024         * sparc.cc (Scan::local): Likewise.
15025         * x86_64.cc (Scan::local): Likewise.
15026         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
15027         to symbol_section_and_value.
15028         * testsuite/many_sections_test.cc: New file.
15029         * testsuite/Makefile.am (BUILT_SOURCES): Define.
15030         (check_PROGRAMS): Add many_sections_test.
15031         (many_sections_test_SOURCES): Define.
15032         (many_sections_test_DEPENDENCIES): Define.
15033         (many_sections_test_LDFLAGS): Define.
15034         (BUILT_SOURCES): Add many_sections_define.h.
15035         (many_sections_define.h): New target.
15036         (BUILT_SOURCES): Add many_sections_check.h.
15037         (many_sections_check.h): New target.
15038         (check_PROGRAMS): Add many_sections_r_test.
15039         (many_sections_r_test_SOURCES): Define.
15040         (many_sections_r_test_DEPENDENCIES): Define.
15041         (many_sections_r_test_LDFLAGS): Define.
15042         (many_sections_r_test_LDADD): Define.
15043         (many_sections_r_test.o): New target.
15044         * testsuite/Makefile.in: Rebuild.
15045
15046 2008-04-17  Cary Coutant  <ccoutant@google.com>
15047
15048         * errors.cc (Errors::info): New function.
15049         (gold_info): New function.
15050         * errors.h (Errors::info): New function.
15051         * gold.h (gold_info): New function.
15052         * object.cc (Input_objects::add_object): Print trace output.
15053         * options.cc (options::parse_set): New function.
15054         (General_options::parse_wrap): Deleted.
15055         (General_options::General_options): Deleted initializer.
15056         * options.h (options::String_set): New typedef.
15057         (options::parse_set): New function.
15058         (DEFINE_set): New macro.
15059         (General_options::wrap): Changed to use DEFINE_set. Changed
15060         callers of any_wrap_symbols and is_wrap_symbol.
15061         (General_options::trace, General_options::trace_symbol):
15062         New options.
15063         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
15064         (General_options::wrap_symbols_): Deleted.
15065         * symtab.cc (Symbol_table::add_from_object): Print trace output.
15066
15067 2008-04-17  David S. Miller  <davem@davemloft.net>
15068
15069         * options.cc (General_options::parse_V): New function.
15070         * options.h: Add entries for -V and -Qy.
15071
15072 2008-04-17  Ian Lance Taylor  <iant@google.com>
15073
15074         * common.cc (Symbol_table::allocate_commons): Remove options
15075         parameter.  Change caller.
15076         (Symbol_table::do_allocate_commons): Remove options parameter.
15077         Change caller.  Just call do_allocate_commons_list twice.
15078         (Symbol_table::do_allocate_commons_list): New function, broken out
15079         of do_allocate_commons.
15080         * common.h (class Allocate_commons_task): Remove options_ field.
15081         Update constructor.
15082         * symtab.cc (Symbol_table::Symbol_table): Initialize
15083         tls_commons_.
15084         (Symbol_table::add_from_object): Put TLS common symbols on
15085         tls_commons_ list.
15086         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
15087         which are IN_OUTPUT_DATA.
15088         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
15089         allocate_commons and do_allocate_commons declarations.  Declare
15090         do_allocate_commons_list.
15091         * gold.cc (queue_middle_tasks): Update creation of
15092         Allocate_commons_task to not pass options.
15093         * testsuite/Makefile.am (INCLUDES): Add -I.. .
15094         (TLS_TEST_C_FLAGS): New variable.
15095         (tls_test_c_pic.o): New target.
15096         (tls_test_shared.so): Link in tls_test_c_pic.o.
15097         (tls_test_c_pic_ie.o): New target.
15098         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
15099         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
15100         (tls_test_c.o): New target.
15101         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
15102         (tls_pic_test_LDADD): Likewise.
15103         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
15104         (tls_shared_gd_to_ie_test_LDADD): Likewise.
15105         (tls_test_c_gnu2.o): New target.
15106         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
15107         tls_test_c_gnu2.o.
15108         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
15109         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
15110         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
15111         * testsuite/tls_test.cc: Include "config.h".
15112         (t_last): Call t11_last.
15113         * testsuite/tls_test.h (t11, t11_last): Declare.
15114         * testsuite/tls_test_c.c: New file.
15115         * testsuite/tls_test_main.cc (thread_routine): Call t11.
15116         * configure.ac: Check for OpenMP support.
15117         * configure, config.in, Makefile.in: Rebuild.
15118         * testsuite/Makefile.in: Rebuild.
15119
15120 2008-04-16  Cary Coutant  <ccoutant@google.com>
15121
15122         * i386.cc (Target_i386::define_tls_base_symbol): New function.
15123         (Target_i386::tls_base_symbol_defined_): New field.
15124         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
15125         (Target_i386::Scan::global): Likewise.
15126         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
15127         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
15128         (Target_x86_64::tls_base_symbol_defined_): New field.
15129         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
15130         (Target_x86_64::Scan::global): Likewise.
15131
15132 2008-04-16  Cary Coutant  <ccoutant@google.com>
15133
15134         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
15135         (Symbol::needs_plt_entry): Allow weak undefined symbols.
15136         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
15137         building shared libraries.
15138         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
15139         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
15140         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
15141         * testsuite/Makefile.in: Rebuild.
15142         * testsuite/weak_undef.h: New file.
15143         * testsuite/weak_undef_file1.cc: Add extra test cases.
15144         * testsuite/weak_undef_file2.cc: Likewise.
15145         * testsuite/weak_undef_test.cc: Likewise.
15146
15147 2008-04-16  David S. Miller  <davem@davemloft.net>
15148
15149         * sparc.cc (Target_sparc::Scan): Change from struct to class.
15150         Add issued_non_pic_error_ field.  Declare check_non_pic.
15151         (Target_sparc::Scan::check_non_pic): New function.
15152         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
15153         (Target_sparc::Scan::global): Likewise.
15154
15155         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
15156         * configure: Rebuild.
15157
15158         * options.h (DEFINE_enable): New macro.
15159         (new_dtags): New enable option.
15160         (initfirst, interpose, loadfltr, nodefaultlib,
15161         nodelete, nodlopen, nodump): New -z options.
15162         * layout.cc (Layout:finish_dynamic_section): If new
15163         dtags enabled, emit DT_RUNPATH.  Also, emit a
15164         DT_FLAGS_1 containing any specified -z flags.
15165
15166 2008-04-16  Ian Lance Taylor  <iant@google.com>
15167
15168         * copy-relocs.cc: New file.
15169         * copy-relocs.h: New file.
15170         * reloc.cc: Remove Copy_relocs code.
15171         * reloc.h: Likewise.
15172         * reloc-types.h (struct Reloc_types) [both versions]: Add
15173         get_reloc_addend_noerror.
15174         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
15175         variants of add_global which take an addend which must be zero.
15176         * i386.cc: Include "copy-relocs.h".
15177         (class Target_i386): Change type of copy_relocs_ to variable,
15178         update initializer.
15179         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
15180         Change all callers.
15181         (Target_i386::do_finalize_sections): Change handling of
15182         copy_relocs_.
15183         * sparc.cc: Include "copy-relocs.h".
15184         (class Target_sparc): Change type of copy_relocs_ to variable,
15185         update initializer.
15186         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
15187         Change all callers.
15188         (Target_sparc::do_finalize_sections): Change handling of
15189         copy_relocs_.
15190         * x86_64.cc: Include "copy-relocs.h".
15191         (class Target_x86_64): Change type of copy_relocs_ to variable,
15192         update initializer.
15193         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
15194         class.  Change all callers.
15195         (Target_x86_64::do_finalize_sections): Change handling of
15196         copy_relocs_.
15197         * Makefile.am (CCFILES): Add copy-relocs.cc.
15198         (HFILES): Add copy-relocs.h.
15199
15200         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
15201
15202         * testsuite/script_test_4.sh: Permit leading zeroes.
15203
15204 2008-04-15  Ian Lance Taylor  <iant@google.com>
15205
15206         * script-sections.cc (Script_sections::create_segments): Use
15207         header_size_adjustment even when there is enough room for the
15208         headers.
15209         * testsuite/script_test_4.sh: New file.
15210         * testsuite/script_test_4.t: New file.
15211         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
15212         (check_DATA): Add script_test_4.stdout.
15213         (MOSTLYCLEANFILES): Likewise.
15214         (script_test_4): New target.
15215         (script_test_4.stdout): New target.
15216         * testsuite/Makefile.in: Rebuild.
15217
15218         * sparc.cc: Add definitions for Output_data_plt_sparc class
15219         constants.
15220
15221 2008-04-14  David S. Miller  <davem@davemloft.net>
15222
15223         * sparc.cc: New file.
15224         * Makefile.am (TARGETSOURCES): Add sparc.cc
15225         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
15226         * configure.tgt: Document targ_extra_size and
15227         targ_extra_big_endian.  Add entries for sparc-* and
15228         sparc64-*.
15229         * configure.ac: Handle targ_extra_size and
15230         targ_extra_big_endian.
15231         * Makefile.in: Rebuild.
15232         * configure: Likewise.
15233         * po/POTFILES.in: Likewise.
15234         * po/gold.pot: Likewise.
15235
15236 2008-04-14  Ian Lance Taylor  <iant@google.com>
15237
15238         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
15239         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
15240         in the name/type/flags to section mapping.  Don't call
15241         allocate_output_section.
15242         (Layout::choose_output_section): Change parameter from adjust_name
15243         to is_input_section.  Don't permit input sections after sections
15244         are attached to segments.  Don't call allocate_output_section.
15245         (Layout::layout_eh_frame): Call update_flags_for_input_section,
15246         not write_enable_output_section.
15247         (Layout::make_output_section): Don't push to
15248         unattached_section_list_ nor call attach_to_segment.  Call
15249         attach_section_to_segment if sections are attached.
15250         (Layout::attach_sections_to_segments): New function.
15251         (Layout::attach_section_to_segment): New function.
15252         (Layout::attach_allocated_section_to_segment): Rename from
15253         attach_to_segment.  Remove flags parameter.
15254         (Layout::allocate_output_section): Remove function.
15255         (Layout::write_enable_output_section): Remove function.
15256         * layout.h (class Layout): Update for above changes.  Add new
15257         field sections_are_attached_.
15258         * output.h (Output_section::update_flags_for_input_section): New
15259         function.
15260         * output.cc (Output_section::add_input_section): Call
15261         update_flags_for_input_section.
15262         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
15263
15264 2008-04-11  Cary Coutant  <ccoutant@google.com>
15265
15266         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
15267         thought unnecessary.
15268         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
15269
15270 2008-04-11  Ian Lance Taylor  <iant@google.com>
15271
15272         * output.h (class Output_section_data): Remove inline definition
15273         of set_addralign.
15274         * output.cc (Output_section_data::set_addralign): New function.
15275
15276 2008-04-11  Cary Coutant  <ccoutant@google.com>
15277
15278         Add support for TLS descriptors for i386 and x86_64.
15279         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
15280         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
15281         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
15282         GOT_TYPE_TLS_DESC.
15283         (Target_i386::got_mod_index_entry): Remove unnecessary code.
15284         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
15285         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
15286         relocations.
15287         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
15288         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
15289         Fix problem with initial-exec relocations.
15290         (Target_i386::Relocate::relocate_tls): Likewise.
15291         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
15292         relaxation.
15293         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
15294         support for section-plus-offset dynamic table entries.
15295         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
15296         (Output_data_dynamic::Dynamic_entry): Add support for
15297         section-plus-offset dynamic table entries.
15298         (Output_data_dynamic::Classification): Likewise.
15299         (Output_data_dynamic::classification_): Renamed offset_.
15300         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
15301         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
15302         (Target_x86_64::make_plt_section): New function.
15303         (Target_x86_64::reserve_tlsdesc_entries): New function.
15304         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
15305         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
15306         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
15307         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
15308         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
15309         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
15310         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
15311         add extra PLT entry for TLS descriptors.
15312         (Output_data_plt_x86_64::got_): New field.
15313         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
15314         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
15315         fields.
15316         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
15317         descriptors.
15318         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
15319         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
15320         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
15321         R_386_TLS_DESC_CALL relocations.
15322         (Target_x86_64::Scan::global): Likewise.
15323         (Target_x86_64::do_finalize_sections): Add dynamic table entries
15324         for TLS descriptors.
15325         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
15326         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
15327         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
15328         GD-to-IE relaxation.
15329         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
15330         and TLS_DESCRIPTORS.
15331         * Makefile.in: Rebuild.
15332         * configure: Rebuild.
15333         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
15334         (tls_test_shared2.so): New target.
15335         (tls_shared_gd_to_ie_test_SOURCES): New variable.
15336         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
15337         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
15338         (tls_shared_gd_to_ie_test_LDADD): New variable.
15339         (tls_shared_gnu2_gd_to_ie_test): New target.
15340         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
15341         New targets.
15342         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
15343         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
15344         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
15345         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
15346         (tls_shared_gnu2_test): New target.
15347         (tls_test_gnu2_shared.so): New target.
15348         (tls_shared_gnu2_test_SOURCES): New variable.
15349         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
15350         (tls_shared_gnu2_test_LDFLAGS): New variable.
15351         (tls_shared_gnu2_test_LDADD): New variable.
15352         * testsuite/Makefile.in: Rebuild.
15353         * testsuite/Makefile.
15354
15355 2008-04-11  Ian Lance Taylor  <iant@google.com>
15356
15357         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
15358         justsyms.t.
15359         * testsuite/Makefile.in: Rebuild.
15360
15361         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
15362         long.
15363         * testsuite/script_test_2.cc (main): Adjust test.
15364
15365 2008-04-11  David S. Miller  <davem@davemloft.net>
15366             Ian Lance Taylor  <iant@google.com>
15367
15368         * options.h (General_options): Add entries for '-Y' and
15369         '-relax'.
15370         * options.cc (General_options:finalize): If -Y was used, add those
15371         entries to the library path instead of the default "/lib" and
15372         "/usr/lib".
15373
15374 2008-04-11  David S. Miller  <davem@davemloft.net>
15375
15376         * testsuite/justsyms.t: Start at 0x100.
15377         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
15378         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
15379         long.
15380         * testsuite/script_test_2.cc: Adjust string and section length
15381         checks.
15382
15383 2008-04-09  Ian Lance Taylor  <iant@google.com>
15384
15385         PR gold/5996
15386         * script-sections.cc (Sections_element::allocate_to_segment): Add
15387         orphan parameter.
15388         (Output_section_definition::allocate_to_segment): Likewise.
15389         (Orphan_output_section::allocate_to_segment): Likewise.
15390         (Script_sections::attach_sections_using_phdrs_clause): Don't
15391         propagate non-PT_LOAD segments to orphan sections.
15392         * testsuite/Makefile.am (script_test_3.stdout): Generate using
15393         readelf rather than objdump.
15394         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
15395         .interp section and PT_INTERP segment are the same size.
15396         * testsuite/Makefile.in: Rebuild.
15397
15398         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
15399         aliases for symbols defined in the same object.
15400         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
15401         (weak_alias_test_SOURCES): New variable.
15402         (weak_alias_test_DEPENDENCIES): New variable.
15403         (weak_alias_test_LDFLAGS): New variable.
15404         (weak_alias_test_LDADD): New variable.
15405         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
15406         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
15407         (weak_alias_test_3.o): New target.
15408         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
15409         * testsuite/weak_alias_test_main.cc: New file.
15410         * testsuite/weak_alias_test_1.cc: New file.
15411         * testsuite/weak_alias_test_2.cc: New file.
15412         * testsuite/weak_alias_test_3.cc: New file.
15413
15414 2008-04-08  Ian Lance Taylor  <iant@google.com>
15415
15416         * options.h (class General_options): Add --noinhibit-exec option.
15417         * main.cc (main): Check --noinhibit-exec.
15418
15419         * options.h (class General_options): Define --wrap as a special
15420         option.  Add wrap_symbols_ field.
15421         (General_options::any_wrap_symbols): New function.
15422         (General_options::is_wrap_symbol): New function.
15423         * options.cc (General_options::parse_wrap): New function.
15424         (General_options::General_options): Initialize wrap_symbols_.
15425         * symtab.cc (Symbol_table::wrap_symbol): New function.
15426         (Symbol_table::add_from_object): Handle --wrap.
15427         * symtab.h (class Symbol_table): Declare wrap_symbol.
15428         * target.h (Target::wrap_char): New function.
15429         (Target::Target_info): Add wrap_char field.
15430         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
15431         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
15432         * testsuite/testfile.cc (Target_test::test_target_info):
15433         Likewise.
15434
15435         * errors.cc (Errors::undefined_symbol): Mention symbol version if
15436         there is one.
15437
15438         * layout.h (class Layout): Add added_eh_frame_data_ field.
15439         * layout.cc (Layout::Layout): Initialize new field.
15440         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
15441         output section until we find a section we merged successfully.
15442         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
15443         that the size be non-zero.
15444
15445         * merge.cc (Object_merge_map::get_output_offset): Remove inline
15446         qualifier.
15447
15448 2008-04-08  Craig Silverstein  <csilvers@google.com>
15449
15450         * configure.ac: Export new conditional variable HAVE_ZLIB.
15451         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
15452         on HAVE_ZLIB.
15453         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
15454         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15455
15456 2008-04-07  Ian Lance Taylor  <iant@google.com>
15457
15458         * version.cc (version_string): Set to "1.5".
15459
15460         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
15461         Add issued_non_pic_error_ field.  Declare check_non_pic.
15462         (Target_x86_64::Scan::check_non_pic): New function.
15463         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
15464         (Target_x86_64::Scan::global): Likewise.
15465
15466         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
15467         addend parameter.  Change caller.  Handle merge sections.
15468         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
15469         Address to Addend.  Don't add in the result of
15470         local_section_offset, pass down the addend and use the returned
15471         value.
15472         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
15473         Update declarations of local_section_offset and symbol_value.
15474         * testsuite/two_file_test_1.cc (t18): New function.
15475         * testsuite/two_file_test_2.cc (f18): New function.
15476         * testsuite/two_file_test_main.cc (main): Call t18.
15477         * testsuite/two_file_test.h (t18, f18): Declare.
15478
15479         * configure.ac: Don't test for objdump, c++filt, or readelf.
15480         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
15481         conditionals.
15482         (TEST_READELF): New variable.
15483         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
15484         (check_PROGRAMS): Add two_file_strip_test.
15485         (two_file_strip_test): New target.
15486         (check_PROGRAMS): Add two_file_same_shared_strip_test.
15487         (two_file_same_shared_strip_test_SOURCES): New variable.
15488         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
15489         (two_file_same_shared_strip_test_LDFLAGS): New variable.
15490         (two_file_same_shared_strip_test_LDADD): New variable.
15491         (two_file_shared_strip.so): New target.
15492         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
15493         (ver_test_5.syms, ver_test_7.syms): Likewise.
15494         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
15495         (strip_test_3.stdout): Use TEST_OBJDUMP.
15496         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15497
15498 2008-04-04  Cary Coutant  <ccoutant@google.com>
15499
15500         * symtab.h (Symbol::is_weak_undefined): New function.
15501         (Symbol::is_strong_undefined): New function.
15502         (Symbol::is_absolute): New function.
15503         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
15504         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
15505         absolute symbols.
15506         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
15507         (weak_undef_test): New target.
15508         * testsuite/Makefile.in: Rebuild.
15509         * testsuite/weak_undef_file1.cc: New file.
15510         * testsuite/weak_undef_file2.cc: New file.
15511         * testsuite/weak_undef_test.cc: New file.
15512
15513 2008-04-03  Craig Silverstein  <csilvers@google.com>
15514
15515         * compressed_output.h (class Output_compressed_section): Use
15516         unsigned buffer.
15517         * compressed_output.cc (zlib_compress): Use unsigned buffers,
15518         add zlib header.
15519         (zlib_compressed_suffix): Removed.
15520         (Output_compressed_section::set_final_data_size): Use unsigned
15521         buffers.
15522         * testsuite/Makefile.am (flagstest_compress_debug_sections):
15523         Fix linker invocation.
15524         (flagstest_o_specialfile_and_compress_debug_sections):
15525         Likewise.
15526         * testsuite/Makefile.in: Regenerated.
15527
15528 2008-04-02  David S. Miller  <davem@davemloft.net>
15529
15530         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
15531         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
15532
15533 2008-04-02  Craig Silverstein  <csilvers@google.com>
15534
15535         * TODO: New file.
15536
15537 2008-04-02  Ian Lance Taylor  <iant@google.com>
15538
15539         * fileread.cc (File_read::find_view): Add byteshift and vshifted
15540         parameters.  Update for new key type to views_.  Change all
15541         callers.
15542         (File_read::read): Adjust for byteshift in returned view.
15543         (File_read::add_view): New function, broken out of
15544         find_and_make_view.
15545         (File_read::make_view): New function, broken out of
15546         find_and_make_view.
15547         (File_read::find_or_make_view): Add offset and aligned
15548         parameters.  Rewrite accordingly.  Change all callers.
15549         (File_read::get_view): Add offset and aligned parameters.  Adjust
15550         for byteshift in return value.
15551         (File_read::get_lasting_view): Likewise.
15552         * fileread.h (class File_read): Update declarations.
15553         (class File_read::View): Add byteshift_ field.  Add byteshift to
15554         constructor.  Add byteshift method.
15555         * archive.h (Archive::clear_uncached_views): New function.
15556         (Archive::get_view): Add aligned parameter.  Change all callers.
15557         * object.h (Object::get_view): Add aligned parameter.  Change all
15558         callers.
15559         (Object::get_lasting_view): Likewise.
15560
15561         * fileread.cc (File_read::release): Don't call clear_views if
15562         there are multiple objects.
15563         * fileread.h (File_read::clear_uncached_views): New function.
15564         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
15565         on the archive.
15566
15567 2008-03-31  Cary Coutant  <ccoutant@google.com>
15568
15569         Add thin archive support.
15570         * archive.cc (Archive::armagt): New const.
15571         (Archive::setup): Remove task parameter and calls to unlock.
15572         (Archive::unlock_nested_archives): New function.
15573         (Archive::read_header): Add nested_off parameter. Change
15574         all callers.
15575         (Archive::interpret_header): Likewise.
15576         (Archive::include_all_members): Change to handle thin
15577         archives.
15578         (Archive::include_member): Likewise.
15579         * archive.h (Archive::Archive): Add new parameters and
15580         initializers.
15581         (Archive::armagt): New const.
15582         (Archive::setup): Remove task parameter.
15583         (Archive::unlock_nested_archives): New function.
15584         (Archive::read_header): Add nested_off parameter.
15585         (Archive::interpret_header): Likewise.
15586         (Archive::Nested_archive_table): New typedef.
15587         (Archive::is_thin_archive_): New field.
15588         (Archive::nested_archives_): New field.
15589         (Archive::options_): New field.
15590         (Archive::dirpath_): New field.
15591         (Archive::task_): New field.
15592         * readsyms.cc (Read_symbols::do_read_symbols): Add check
15593         for thin archives.  Pass additional parameters to
15594         Archive::Archive.  Unlock the archive file after calling
15595         Archive::setup.
15596
15597 2008-03-29  Ian Lance Taylor  <iant@google.com>
15598
15599         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
15600         version symbol to be local.
15601         * testsuite/ver_test_4.sh: New file.
15602         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
15603         (check_DATA): Add ver_test_4.syms.
15604         (ver_test_4.syms): New target.
15605         * testsuite/Makefile.in: Rebuild.
15606
15607         * output.cc
15608         (Output_section::Input_section_sort_entry::has_priority): New
15609         function.
15610         (Output_section::Input_section_sort_entry::match_file_name): New
15611         function.
15612         (Output_section::Input_section_sort_entry::match_section_name):
15613         Remove.
15614         (Output_section::Input_section_sort_entry::match_section_name_prefix):
15615         Remove.
15616         (Output_section::Input_section_sort_entry::match_section_file):
15617         Remove.
15618         (Output_section::Input_section_sort_compare::operator()): Rewrite
15619         using new Input_section_sort_entry functions.  Sort crtbegin and
15620         crtend first.  Sort sections with no priority before sections with
15621         a priority.
15622         * testsuite/initpri1.c (d3): Check j != 4.
15623         (cd5): New constructor/destructor function.
15624         (main): Check j != 2.
15625
15626         * symtab.cc (Symbol_table::add_from_object): If we don't use the
15627         new symbol when resolving, don't call set_is_default.
15628         * testsuite/ver_test_7.cc: New file.
15629         * testsuite/ver_test_7.sh: New file.
15630         * testsuite/Makefile.am (ver_test_7.so): New target.
15631         (ver_test_7.o): New target.
15632         (check_SCRIPTS): Add ver_test_7.sh.
15633         (check_DATA): Add ver_test_7.syms.
15634         (ver_test_7.syms): New target.
15635
15636 2008-03-28  Ian Lance Taylor  <iant@google.com>
15637
15638         * layout.cc (Layout::layout): If we see an input section with a
15639         name that needs sorting, set the must_sort flag for the output
15640         section.
15641         (Layout::make_output_section): If the name of the output section
15642         indicates that it might require sorting, set the may_sort flag.
15643         * output.h (Output_section::may_sort_attached_input_sections): New
15644         function.
15645         (Output_section::set_may_sort_attached_input_sections): New
15646         function.
15647         (Output_section::must_sort_attached_input_sections): New
15648         function.
15649         (Output_section::set_must_sort_attached_input_sections): New
15650         function.
15651         (class Output_section): Declare Input_section_sort_entry.  Define
15652         Input_section_sort_compare.  Declare
15653         sort_attached_input_sections.  Add new fields:
15654         may_sort_attached_input_sections_,
15655         must_sort_attached_input_sections_,
15656         attached_input_sections_are_sorted_.
15657         * output.cc (Output_section::Output_section): Initialize new
15658         fields.
15659         (Output_section::add_input_section): Add an entry to
15660         input_sections_ if may_sort or must_sort are true.
15661         (Output_section::set_final_data_size): Call
15662         sort_attached_input_sections if necessary.
15663         (Output_section::Input_section_sort_entry): Define new class.
15664         (Output_section::Input_section_sort_compare::operator()): New
15665         function.
15666         (Output_section::sort_attached_input_sections): New function.
15667         * configure.ac: Check whether the compiler supports constructor
15668         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
15669         * testsuite/initpri1.c: New file.
15670         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
15671         CONSTRUCTOR_PRIORITY.
15672         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
15673         (initpri1_LDFLAGS): New variable.
15674         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15675
15676 2008-03-27  Ian Lance Taylor  <iant@google.com>
15677
15678         * common.cc (Sort_commons::operator): Correct sorting algorithm.
15679         * testsuite/common_test_1.c: New file.
15680         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
15681         (common_test_1_SOURCES): New variable.
15682         (common_test_1_DEPENDENCIES): New variable.
15683         (common_test_1_LDFLAGS): New variable.
15684
15685         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
15686         and commons_ correctly when NAME/VERSION does not override
15687         NAME/NULL.
15688         * testsuite/ver_test_6.c: New file.
15689         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
15690         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
15691         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
15692
15693 2008-03-26  Ian Lance Taylor  <iant@google.com>
15694
15695         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
15696         of an undefined symbol from a version script.
15697         * testsuite/Makefile.am (ver_test_5.so): New target.
15698         (ver_test_5.o): New target.
15699         (check_SCRIPTS): Add ver_test_5.sh.
15700         (check_DATA): Add ver_test_5.syms.
15701         (ver_test_5.syms): New target.
15702         * testsuite/ver_test_5.cc: New file.
15703         * testsuite/ver_test_5.script: New file.
15704         * testsuite/ver_test_5.sh: New file.
15705         * Makefile.in, testsuite/Makefile.in: Rebuild.
15706
15707         PR gold/5986
15708         Fix problems building gold with gcc 4.3.0.
15709         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
15710         (gold_error_at_location, gold_warning_at_location): Use it.
15711         * configure.ac: Check whether we can compile and use a template
15712         function with a printf attribute.
15713         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
15714         when jumping over bytes.
15715         * object.cc: Instantiate Object::read_section_data.
15716         * debug.h: Include <cstring>
15717         * dwarf_reader.cc: Include <algorithm>
15718         * main.cc: Include <cstring>.
15719         * options.cc: Include <cstring>.
15720         * output.cc: Include <cstring>.
15721         * script.cc: Include <cstring>.
15722         * script.h: Include <string>.
15723         * symtab.cc: Include <cstring> and <algorithm>.
15724         * target-select.cc: Include <cstring>.
15725         * version.cc: Include <string>.
15726         * testsuite/testmain.cc: Include <cstdlib>.
15727         * configure, config.in: Rebuild.
15728
15729 2008-03-25  Ian Lance Taylor  <iant@google.com>
15730
15731         * options.cc: Include "../bfd/bfdver.h".
15732         (options::help): Print bug reporting address.
15733
15734         * version.cc (print_version): Adjust output for current value of
15735         BFD_VERSION_STRING.
15736
15737         * NEWS: New file.
15738
15739         * options.cc (options::help): Print list of supported targets.
15740         * target-select.h: Include <vector>.
15741         (class Target_selector): Make machine_, size_, and is_big_endian_
15742         fields const.  Add bfd_name_ and instantiated_target_ fields.
15743         (Target_selector::Target_selector): Add bfd_name parameter.
15744         (Target_selector::recognize): Make non-virtual, call
15745         do_recognize.
15746         (Target_selector::recognize_by_name): Make non-virtual, call
15747         do_recognize_by_name.
15748         (Target_selector::supported_names): New function.
15749         (Target_selector::bfd_name): New function.
15750         (Target_selector::do_instantiate_target): New pure virtual
15751         function.
15752         (Target_selector::do_recognize): New virtual function.
15753         (Target_selector::do_recognize_by_name): New virtual function.
15754         (Target_selector::instantiate_target): New private function.
15755         (supported_target_names): Declare.
15756         * target-select.cc (Target_selector::Target_selector): Update for
15757         new parameter and fields.
15758         (select_target_by_name): Check that the name matches before
15759         calling recognize_by_name.
15760         (supported_target_names): New function.
15761         * i386.cc (class Target_selector_i386): Update Target_selector
15762         constructor call.  Remove recognize and recognize_by_name.  Add
15763         do_instantiate_target.
15764         * x86_64.cc (class Target_selector_x86_64): Likewise.
15765         * testsuite/testfile.cc (class Target_selector_test): Update for
15766         changes to Target_selector.
15767
15768         * README: Rewrite, with some notes on unsupported features.
15769
15770 2008-03-24  Cary Coutant  <ccoutant@google.com>
15771
15772         * i386.cc (Target_i386::Got_type): New enum declaration.
15773         (Target_i386::Scan::local): Updated callers of Output_data_got
15774         member functions.
15775         (Target_i386::Scan::global): Likewise.
15776         (Target_i386::Relocate::relocate): Likewise.
15777         (Target_i386::Relocate::relocate_tls): Likewise.
15778         * object.h (Got_offset_list): New class.
15779         (Sized_relobj::local_has_got_offset): Added got_type parameter.
15780         (Sized_relobj::local_got_offset): Likewise.
15781         (Sized_relobj::set_local_got_offset): Likewise.
15782         (Sized_relobj::local_has_tls_got_offset): Removed.
15783         (Sized_relobj::local_tls_got_offset): Removed.
15784         (Sized_relobj::set_local_tls_got_offset): Removed.
15785         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
15786         * output.cc (Output_data_got::add_global): Added got_type parameter.
15787         (Output_data_got::add_global_with_rel): Likewise.
15788         (Output_data_got::add_global_with_rela): Likewise.
15789         (Output_data_got::add_global_pair_with_rel): New function.
15790         (Output_data_got::add_global_pair_with_rela): New function.
15791         (Output_data_got::add_local): Added got_type parameter.
15792         (Output_data_got::add_local_with_rel): Likewise.
15793         (Output_data_got::add_local_with_rela): Likewise.
15794         (Output_data_got::add_local_pair_with_rel): New function.
15795         (Output_data_got::add_local_pair_with_rela): New function.
15796         (Output_data_got::add_global_tls): Removed.
15797         (Output_data_got::add_global_tls_with_rel): Removed.
15798         (Output_data_got::add_global_tls_with_rela): Removed.
15799         (Output_data_got::add_local_tls): Removed.
15800         (Output_data_got::add_local_tls_with_rel): Removed.
15801         (Output_data_got::add_local_tls_with_rela): Removed.
15802         * output.h (Output_data_got::add_global): Added got_type parameter.
15803         (Output_data_got::add_global_with_rel): Likewise.
15804         (Output_data_got::add_global_with_rela): Likewise.
15805         (Output_data_got::add_global_pair_with_rel): New function.
15806         (Output_data_got::add_global_pair_with_rela): New function.
15807         (Output_data_got::add_local): Added got_type parameter.
15808         (Output_data_got::add_local_with_rel): Likewise.
15809         (Output_data_got::add_local_with_rela): Likewise.
15810         (Output_data_got::add_local_pair_with_rel): New function.
15811         (Output_data_got::add_local_pair_with_rela): New function.
15812         (Output_data_got::add_global_tls): Removed.
15813         (Output_data_got::add_global_tls_with_rel): Removed.
15814         (Output_data_got::add_global_tls_with_rela): Removed.
15815         (Output_data_got::add_local_tls): Removed.
15816         (Output_data_got::add_local_tls_with_rel): Removed.
15817         (Output_data_got::add_local_tls_with_rela): Removed.
15818         * resolve.cc (Symbol::override_base_with_special): Removed
15819         reference to has_got_offset_ field.
15820         * symtab.cc (Symbol::init_fields): Replaced initialization
15821         of got_offset_ with got_offsets_.  Removed initialization
15822         of has_got_offset_
15823         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
15824         (Symbol::got_offset): Likewise.
15825         (Symbol::set_got_offset): Likewise.
15826         (Symbol::has_tls_got_offset): Removed.
15827         (Symbol::tls_got_offset): Removed.
15828         (Symbol::set_tls_got_offset): Removed.
15829         (Symbol::got_offset_): Removed.
15830         (Symbol::tls_mod_got_offset_): Removed.
15831         (Symbol::tls_pair_got_offset_): Removed.
15832         (Symbol::got_offsets_): New field.
15833         (Symbol::has_got_offset): Removed.
15834         (Symbol::has_tls_mod_got_offset): Removed.
15835         (Symbol::has_tls_pair_got_offset): Removed.
15836         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
15837         (Target_x86_64::Scan::local): Updated callers of Output_data_got
15838         member functions.
15839         (Target_x86_64::Scan::global): Likewise.
15840         (Target_x86_64::Relocate::relocate): Likewise.
15841         (Target_x86_64::Relocate::relocate_tls): Likewise.
15842
15843 2008-03-25  Ben Elliston  <bje@au.ibm.com>
15844
15845         * yyscript.y: Fix spelling error in comment.
15846
15847 2008-03-24  Ian Lance Taylor  <iant@google.com>
15848
15849         * options.h (class General_options): Define build_id option.
15850         * layout.h (class Layout): Declare write_build_id, create_note,
15851         create_build_id.  Add build_id_note_ member.
15852         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
15853         "libiberty.h", "md5.h", "sha1.h".
15854         (Layout::Layout): Initialize eh_frame_data_,
15855         eh_frame_hdr_section_, and build_id_note_.
15856         (Layout::finalize): Call create_build_id.
15857         (Layout::create_note): New function, broken out of
15858         Layout::create_gold_note.
15859         (Layout::create_gold_note): Call create_note.
15860         (Layout::create_build_id): New function.
15861         (Layout::write_build_id): New function.
15862         (Close_task_runner::run): Call write_build_id.
15863
15864         * x86_64.cc: Correct license to GPLv3.
15865
15866 2008-03-23  Ian Lance Taylor  <iant@google.com>
15867
15868         * options.cc: Include "demangle.h".
15869         (parse_optional_string): New function.
15870         (parse_long_option): Handle takes_optional_argument.
15871         (parse_short_option): Update dash_z initializer.  Handle
15872         takes_optional_argument.
15873         (General_options::General_options): Initialize do_demangle_.
15874         (General_options::finalize): Set do_demangle_.  Handle demangling
15875         style.
15876         * options.h (parse_optional_string): Declare.
15877         (struct One_option): Add optional_arg field.  Update constructor.
15878         Update call constructor calls.  Add takes_optional_argument
15879         function.
15880         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
15881         (DEFINE_optional_string): Define.
15882         (General_options::demangle): Change from DEFINE_bool to
15883         DEFINE_optional_string.
15884         (General_options::no_demangle): New function.
15885         (General_options::do_demangle): New function.
15886         (General_options::set_do_demangle): New function.
15887         (General_options::execstack_status_): Move definition to end of
15888         class definition.
15889         (General_options::static_): Likewise.
15890         (General_options::do_demangle_): New field.
15891         * object.cc (big_endian>::get_symbol_location_info): Call
15892         Options::do_demangle, not Options::demangle.
15893         * symtab.cc (demangle): Likewise.
15894
15895 2008-03-22  Ian Lance Taylor  <iant@google.com>
15896
15897         * gold.h: Include <cstddef> and <sys/types.h>
15898         * options.h: Include <cstring>.
15899
15900 2008-03-21  Ian Lance Taylor  <iant@google.com>
15901
15902         * Added source code to GNU binutils.
15903 \f
15904 Copyright (C) 2008-2014 Free Software Foundation, Inc.
15905
15906 Copying and distribution of this file, with or without modification,
15907 are permitted in any medium without royalty provided the copyright
15908 notice and this notice are preserved.
15909
15910 Local Variables:
15911 mode: change-log
15912 left-margin: 8
15913 fill-column: 74
15914 version-control: never
15915 End: