264f127bd7b8239d84ad8035a70ca5ea1fa39a41
[external/binutils.git] / gold / ChangeLog
1 2014-06-27  Alan Modra  <amodra@gmail.com>
2
3         * symtab.cc (Symbol::should_add_dynsym_entry): Don't make inline.
4
5 2014-06-24  Cary Coutant  <ccoutant@google.com>
6
7         * dwp.cc (Dwo_file::read): Allow files with no .debug_types
8         sections.
9         (Dwo_file::sized_read_unit_index): Likewise.
10
11 2014-06-23  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
12
13         * mips.cc: New file.
14         * Makefile.am (TARGETSOURCES): Add mips.cc
15         (ALL_TARGETOBJS): Add mips.$(OBJEXT)
16         * configure.tgt: Add entries for mips*.
17         * configure.ac: Likewise.
18         * Makefile.in: Regenerate.
19         * configure: Likewise.
20
21 2014-06-09  Cary Coutant  <ccoutant@google.com>
22
23         * dwarf_reader.cc (Dwarf_pubnames_table::read_header): Check that
24         unit_length is within section bounds.
25
26 2014-06-09  Cary Coutant  <ccoutant@google.com>
27
28         PR gold/16980
29         * layout.cc (Layout::print_to_mapfile): Print unattached sections in
30         map.
31
32 2014-06-07  Alan Modra  <amodra@gmail.com>
33
34         * powerpc.cc (relocate): Treat field of cmpli insn as a bitfield.
35
36 2014-06-06  Cary Coutant  <ccoutant@google.com>
37
38         * dwarf_reader.h (Dwarf_pubnames_table): Remove output_section_offset_.
39         * dwarf_reader.cc (Dwarf_pubnames_table::read_section): Likewise.
40         (Dwarf_pubnames_table::read_header): Likewise.
41         * layout.cc (gdb_fast_lookup_sections): Add .debug_gnu_pubnames and
42         .debug_gnu_pubtypes.
43
44 2014-06-05  Joel Brobecker  <brobecker@adacore.com>
45
46         * Makefile.am (CONFIG_STATUS_DEPENDENCIES): New.
47         * Makefile.in, configure: Regenerate.
48
49 2014-06-03  Alan Modra  <amodra@gmail.com>
50
51         * powerpc.cc (addis_12_2): Define.
52         (Stub_table::do_write): Support fusion on ELFv2 stubs.
53
54 2014-06-03  Alan Modra  <amodra@gmail.com>
55
56         * testsuite/plugin_test.c (parse_readelf_line): Skip non-visibility
57         st_other output.
58
59 2014-06-02  Alan Modra  <amodra@gmail.com>
60
61         * powerpc.cc (Target_powerpc::local_reloc_may_be_function_pointer):
62         Only ignore relocs on ELFv1.
63         (Target_powerpc::global_reloc_may_be_function_pointer): Likewise.
64
65 2014-05-30  Cary Coutant  <ccoutant@google.com>
66
67         * testsuite/Makefile.am (ehdr_start_test_4): Fix typo in -B option.
68         * testsuite/Makefile.in: Regenerate.
69         * testsuite/ehdr_start_test_4.sh: Look for "U" instead of "w".
70
71 2014-05-27  H.J. Lu  <hongjiu.lu@intel.com>
72
73         PR gold/16945
74         * x86_64.cc (Target_x86_64::Relocate::relocate): Use signed int
75         for got_offset.  Properly get GOT address for R_X86_64_PLTOFF64.
76
77 2014-05-15  Alan Modra  <amodra@gmail.com>
78
79         * powerpc.cc (do_plt_fde_location): Handle zero length .glink.
80         Compare FDE contents with DW_CFA_nop rather than 0.
81
82 2014-05-13  Sriraman Tallam  <tmsriram@google.com>
83
84         * symtab.h (may_need_copy_reloc): Remove check for position independent
85         code.
86         * x86_64.cc (Target_x86_64<size>::Scan::global): Add check for no
87         position independence before pc absolute may_need_copy_reloc call.
88         Add check for executable output befor pc relative may_need_copy_reloc
89         call.
90         * i386.cc: Ditto.
91         * arm.cc: Ditto.
92         * sparc.cc: Ditto.
93         * tilegx.cc: Ditto.
94         * powerpc.cc: Add check for no position independence before
95         may_need_copy_reloc calls.
96         * testsuite/pie_copyrelocs_test.cc: New file.
97         * testsuite/pie_copyrelocs_shared_test.cc: New file.
98         * Makefile.am (pie_copyrelocs_test): New test.
99         * Makefile.in: Regenerate.
100
101 2014-05-08  Martin Liška  <mliska@suse.cz>
102
103         * output.cc (Sized_relobj_file::do_layout): Fix typo in info message.
104
105 2014-05-06  Cary Coutant  <ccoutant@google.com>
106
107         PR gold/16900
108         * i386.cc (Output_data_got_plt_i386): New class.
109         (Output_data_plt_i386::Output_data_plt_i386): Change type of got_plt
110         parameter. Change all callers.
111         (Output_data_plt_i386::layout_): Remove.
112         (Output_data_plt_i386::got_plt_): Change type.
113         (Target_i386::got_plt_): Change type. Change all references.
114         (Target_i386::got_section): Create instance of new class.
115         (Output_data_got_plt_i386::do_write): New function.
116         * x86_64.cc (Output_data_got_plt_x86_64): New class.
117         (Output_data_plt_x86_64::Output_data_plt_x86_64): Change type of got_plt
118         parameter. Change all callers.
119         (Output_data_plt_x86_64::layout_): Remove.
120         (Output_data_plt_x86_64::got_plt_): Change type.
121         (Target_x86_64::got_plt_): Change type. Change all references.
122         (Target_x86_64::got_section): Create instance of new class.
123         (Output_data_got_plt_x86_64::do_write): New function.
124         (Output_data_plt_x86_64::do_write): Don't write reserved words in GOT.
125         (Target_x86_64<size>::init_got_plt_for_update): Create instance of new
126         class.
127
128 2014-05-05  Cary Coutant  <ccoutant@google.com>
129
130         * gdb-index.cc (Gdb_index_info_reader): Don't complain about language
131         if we have pubnames/pubtypes.
132
133 2014-05-02  Cary Coutant  <ccoutant@google.com>
134
135         * defstd.cc (in_segment): Define __ehdr_start here...
136         * layout.cc (Layout::finalize): ...Instead of here.  Set the
137         output segment when known.
138         * resolve.cc (Symbol::override_base_with_special): Remember
139         the original binding.
140         * symtab.cc (Symbol::set_output_segment): New function.
141         (Symbol::set_undefined): New function.
142         * symtab.h (Symbol::is_weak_undefined): Check original undef
143         binding.
144         (Symbol::is_strong_undefined): New function.
145         (Symbol::set_output_segment): New function.
146         (Symbol::set_undefined): New function.
147         * target-reloc.h (is_strong_undefined): Remove.
148         (issue_undefined_symbol_error): Call Symbol::is_weak_undefined.
149         Check for hidden undefs.
150         (relocate_section): Call Symbol::is_strong_undefined.
151
152         * testsuite/Makefile.am (ehdr_start_test_1)
153         (ehdr_start_test_2, ehdr_start_test_3)
154         (ehdr_start_test_4, ehdr_start_test_5): New test cases.
155         * testsuite/Makefile.in: Regenerate.
156         * testsuite/ehdr_start_def.cc: New source file.
157         * testsuite/ehdr_start_test.cc: New source file.
158         * testsuite/ehdr_start_test.t: New linker script.
159         * testsuite/ehdr_start_test_4.sh: New shell script.
160
161 2014-04-23  Cary Coutant  <ccoutant@google.com>
162
163         PR gold/16870
164         * x86_64.cc (Target_x86_64::Relocate::relocate): Add missing break.
165
166 2014-04-15  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
167
168         * layout.cc (Layout::include_section): Allow a target to decide
169         whether to include a section.
170         * target.h (Target::should_include_section): New function.
171         (Target::do_should_include_section): New function.
172
173 2014-04-15  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
174
175         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Remove and
176         inline into ...
177         (Copy_relocs::emit): ... here.
178         * copy-relocs.h (Copy_reloc_entry): Change from class to struct.
179         (Copy_reloc_entry::make_copy_reloc): Change from private to protected.
180         (Copy_reloc_entry::entries_): Change from private to protected.
181
182 2014-04-02  Sriraman Tallam  <tmsriram@google.com>
183
184         * icf.cc (get_section_contents): Replace copies of reloc
185         vectors with const references.
186
187 2014-04-02  Cary Coutant  <ccoutant@google.com>
188
189         * configure.ac (HAVE_PUBNAMES): Use C instead of C++.
190         (HAVE_NO_USE_LINKER_PLUGIN): Check for -fno-use-linker-plugin.
191         * configure: Regenerate.
192         * testsuite/Makefile.am (OPT_NO_PLUGINS): New macro for
193         -fno-use-linker-plugin.
194         (LINK1, CXXLINK1): Add it to the link command.
195         * testsuite/Makefile.in: Regenerate.
196
197 2014-03-12  Alan Modra  <amodra@gmail.com>
198
199         * Makefile.in: Regenerate.
200
201 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
202
203         * symtab.h (Symbol::set_nonvis): New function.
204
205 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
206
207         * symtab.cc (Sized_symbol<32>::init_output_data):
208         Instantiate the template.
209         (Sized_symbol<64>::init_output_data): Likewise.
210
211 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
212
213         * symtab.cc (Symbol_table::sized_write_globals): Allow a target to
214         adjust dynamic symbol value.
215         * target.h (Target::adjust_dyn_symbol): New function.
216         (Target::do_adjust_dyn_symbol): New function.
217
218 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
219
220         * output.cc (Output_data_dynamic::Dynamic_entry::write):
221         Get the value of DYNAMIC_CUSTOM dynamic entry.
222         * output.h (Output_data_dynamic::add_custom): New function.
223         (Dynamic_entry::Dynamic_entry): New constructor for DYNAMIC_CUSTOM
224         dynamic entry.
225         (enum Dynamic_entry::Classification): Add DYNAMIC_CUSTOM.
226         * target.h (Target::dynamic_tag_custom_value): New function.
227         (Target::do_dynamic_tag_custom_value): New function.
228
229 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
230
231         * symtab.cc (Symbol_table::set_dynsym_indexes): Allow a target to set
232         dynsym indexes.
233         * target.h (Target::has_custom_set_dynsym_indexes): New function.
234         (Target::do_has_custom_set_dynsym_indexes): New function.
235         (Target::set_dynsym_indexes): New function.
236         (Target::do_set_dynsym_indexes): New function.
237
238 2014-03-07  Alan Modra  <amodra@gmail.com>
239
240         * powerpc.cc (Powerpc_relocate_functions::Overflow_check): Add
241         CHECK_UNSIGNED, CHECK_LOW_INSN, CHECK_HIGH_INSN.
242         (Powerpc_relocate_functions::has_overflow_unsigned): New function.
243         (Powerpc_relocate_functions::has_overflow_bitfield,
244         overflowed): Use the above.
245         (Target_powerpc::Relocate::relocate): Correct overflow checking
246         for a number of relocations.  Modify overflow test for 16-bit
247         fields in instructions to signed/unsigned according to whether
248         the field takes a signed or unsigned value.
249
250 2014-03-05  Alan Modra  <amodra@gmail.com>
251
252         Update copyright years.
253
254 2014-03-05  Alan Modra  <amodra@gmail.com>
255
256         * powerpc.cc (Target_powerpc::Scan::local, global): Support
257         R_PPC64_ADDR64_LOCAL.
258         (Target_powerpc::Relocate::relocate): Likewise.
259
260 2014-03-03  Alan Modra  <amodra@gmail.com>
261
262         * dwp.cc (print_version): Update copyright year to current.
263
264 2014-02-10  Alan Modra  <amodra@gmail.com>
265
266         * po/gold.pot: Regenerate.
267
268 2014-02-06  Cary Coutant  <ccoutant@google.com>
269
270         Fix problem where -u is ignored when a weak undef is seen.
271
272         * archive.cc (Library_base::should_include_member): Reorder
273         code to check for -u option if a weak undef has already been seen.
274         * testsuite/Makefile.am (weak_undef_test_2): New test case.
275         * testsuite/Makefile.in: Regenerate.
276         * testsuite/weak_undef_file3.cc: New file.
277         * testsuite/weak_undef_file4.cc: New file.
278         * testsuite/weak_undef_test_2.cc: New file.
279
280 2014-02-05  Cary Coutant  <ccoutant@google.com>
281
282         Fix issues with gold undefined symbol diagnostics.
283
284         PR binutils/15435
285         * errors.cc (Errors::undefined_symbol): Move undef vtable symbol
286         check to here.
287         * target-reloc.h (is_strong_undefined): New function.
288         (relocate_section): Move undef vtable symbol check from here.
289         Check for is_strong_undefined.
290
291 2014-02-05  Cary Coutant  <ccoutant@google.com>
292
293         Fix problems with the --dynamic-list option.
294
295         PR gold/13577
296         * options.cc (General_options::parse_dynamic_list):
297         Set have_dynamic_list_.
298         (General_options::General_options): Initialize have_dynamic_list_.
299         (General_options::finalize): Turn off -Bsymbolic and
300         -Bsymbolic-functions if --dynamic-list provided.
301         * options.h (General_options::have_dynamic_list): New function.
302         (General_options::have_dynamic_list_): New data member.
303         * symtab.h (Symbol::is_preemptible): Handle --dynamic-list
304         correctly.
305
306         PR gold/16530
307         * symtab.cc (Symbol_table::add_from_relobj): If symbol is named
308         in --dynamic-list, mark it.
309
310         * testsuite/Makefile.am (gc_dynamic_list_test.sh): New test case.
311         (dynamic_list_2): New test case.
312         * testsuite/Makefile.in: Regenerate.
313         * testsuite/dynamic_list_2.cc: New file.
314         * testsuite/dynamic_list_2.t: New file.
315         * testsuite/dynamic_list_lib1.cc: New file.
316         * testsuite/dynamic_list_lib2.cc: New file.
317         * testsuite/gc_dynamic_list_test.c: New file.
318         * testsuite/gc_dynamic_list_test.sh: New file.
319         * testsuite/gc_dynamic_list_test.t: New file.
320
321 2014-01-28  Cary Coutant  <ccoutant@google.com>
322
323         Add .gdb_index version 7 support.
324
325         * gold/dwarf_reader.cc: include <utility> (for make_pair).
326         (Dwarf_abbrev_table::do_read_abbrevs): Check for compressed
327         debug sections.
328         (Dwarf_ranges_table::read_ranges_table): Likewise.
329         (Dwarf_pubnames_table::read_section): Check for GNU-style
330         sections, and for compressed debug sections.
331         (Dwarf_pubnames_table::read_header): Compute end address of table.
332         (Dwarf_pubnames_table::next_name): Return flag_byte.  Check
333         for end of list by offset, not by offset == 0.
334         (Dwarf_info_reader::do_read_string_table): Check for compressed
335         debug sections.
336         * gold/dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
337         Initialize new data members.
338         (Dwarf_pubnames_table::next_name): return flag_byte.
339         (Dwarf_pubnames_table::end_of_table_): New data member.
340         (Dwarf_pubnames_table::is_gnu_style_): New data member.
341         * gold/gdb-index.cc (gdb_index_version): Update to version 7.
342         (Gdb_index_info_reader::read_pubtable): Read flag_byte.
343         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Don't
344         read skeleton type unit DIEs.
345         (Gdb_index::add_symbol): Add flag_byte; adjust all callers.
346         (Gdb_index::do_write): Write flag_byte.
347         * gold/gdb-index.h (Gdb_index::add_symbol): Add flags parameter.
348         (Gdb_index::Cu_vector): Store flags along with cu indexes.
349         * gold/testsuite/gdb_index_test_3.sh: Allow versions 4-7.
350         * gold/testsuite/gdb_index_test_comm.sh: Likewise.
351
352 2014-01-08  H.J. Lu  <hongjiu.lu@intel.com>
353
354         * version.cc (print_version): Update copyright year to 2014.
355
356 2013-12-19  Dimitry Andric  <dimitry@andric.com>
357
358         * stringpool.cc (Stringpool_template::reserve): Add
359         HAVE_UNORDERED_MAP case.
360         * stringpool.cc (Stringpool_template::print_stats): Likewise.
361
362 2013-12-18  Cary Coutant  <ccoutant@google.com>
363
364         * configure.ac: Check for <unordered_set> and <unordered_map>.
365         * config.in: Regenerate.
366         * configure: Regenerate.
367         * system.h: Use <unordered_set> and <unordered_map> if available.
368
369 2013-12-10  Roland McGrath  <mcgrathr@google.com>
370
371         * Makefile.am (install-exec-local): Prefix $(INSTALL_PROGRAM) uses
372         with $(INSTALL_PROGRAM_ENV).
373         * Makefile.in: Regenerate.
374
375 2013-11-22  Cary Coutant  <ccoutant@google.com>
376
377         * configure.ac: Add check for which library is needed for
378         dlopen.
379         * configure: Regenerate.
380
381 2013-11-22  Cary Coutant  <ccoutant@google.com>
382
383         * testsuite/Makefile.am (exception_x86_64_bnd_test): Use in-tree
384         assembler.
385         * testsuite/Makefile.in: Regenerate.
386
387 2013-11-17  H.J. Lu  <hongjiu.lu@intel.com>
388
389         * x86_64.cc (Target_x86_64<size>::Scan::get_reference_flags):
390         Handle R_X86_64_PC32_BND and R_X86_64_PLT32_BND just like
391         R_X86_64_PC32 and R_X86_64_PLT32, respectively.
392         (Target_x86_64<size>::Scan::local): Likewise.
393         (Target_x86_64<size>::Scan::global): Likewise.
394         (Target_x86_64<size>::Relocate::relocate): Likewise.
395         (Target_x86_64<size>::Relocatable_size_for_reloc::get_size_for_reloc):
396         Likewise.
397         (Target_x86_64<size>::Scan::check_non_pic(): Handle
398         R_X86_64_PC32_BND.
399
400         * testsuite/Makefile.am (check_PROGRAMS): Add
401         exception_x86_64_bnd_test.
402         (exception_x86_64_bnd_test_SOURCES): New macro.
403         (exception_x86_64_bnd_test_DEPENDENCIES): Likewise.
404         (exception_x86_64_bnd_test_LDFLAGS): Likewise.
405         (exception_x86_64_bnd_test_LDADD): Likewise.
406         (exception_x86_64_bnd_1.o): New rule.
407         (exception_x86_64_bnd_2.o): Likewise.
408         * testsuite/Makefile.in: Regenerated.
409
410 2013-11-15  Alan Modra  <amodra@gmail.com>
411
412         * powerpc.cc (Target_powerpc::glink_section): Provide non-const
413         accessor.
414         (Target_powerpc::Branch_info::make_stub): Make global entry stubs.
415         Only call ppc64_local_entry_offset for 64-bit.  Restrict
416         symval_for_branch lookup to ELFv1.
417         (Stub_table::add_plt_call_entry): Use unsigned int off.
418         (Output_data_glink::Address, invalid_address): New.
419         (Output_data_glink::add_eh_frame): Move out of line.  Add
420         support for ELFv2.
421         (Output_data_glink::add_global_entry, find_global_entry,
422         global_entry_address): New functions.
423         (Output_data_glink::global_entry_stubs_, end_branch_table_,
424         ge_size): New variables.
425         (Output_data_glink::set_final_data_size): Add global entry
426         stub sizing.
427         (Output_data_glink::do_write): Write global entry stubs.
428         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Add target
429         parameter.  Return true for ELFv2.  Adjust callers.
430         (Target_powerpc::Scan::local, global): Restrict opd lookup to
431         ELFv1.  Similarly for ifunc and dynamic relocation processing
432         specific to ELFv1.  Recognize that symbols are defined on
433         their plt entries for ELFv2.
434         (Target_powerpc::symval_for_branch): Assert if called for
435         ELFv2 or ppc32.
436         (Target_powerpc::Relocate::relocate): Use global entry plt
437         stub for symbol value if such exists on ELFv2.
438         (Target_powerpc::Relocate::relocate): Don't call
439         symval_for_branch when ELFv2.  Do adjust for local entry
440         offset when ELFv2.
441         (Target_powerpc::do_dynsym_value): Set symbols to global entry
442         plt stub for ELFv2.
443         (Target_powerpc::do_plt_address_for_global): Similarly.
444
445 2013-11-14  Cary Coutant  <ccoutant@google.com>
446
447         Revert patch -- this did not fix the problem, and there is
448         no race there.
449
450         2013-11-14  Cary Coutant  <ccoutant@google.com>
451
452             PR gold/14860
453             * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
454             (Ehframe_hdr::set_final_data_size): Allocate a Lock.
455             * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
456             updating fde_offsets_.
457             (Eh_frame_hdr::lock_): New data member.
458
459 2013-11-14  Cary Coutant  <ccoutant@google.com>
460
461         * dwp.cc (Dwo_file_entry): New type.
462         (File_list): Use Dwo_file_entry.
463         (Dwo_file::verify): New function.
464         (Dwo_file::verify_dwo_list): New function.
465         (Dwo_file::sized_verify_dwo_list): New function.
466         (Dwo_name_info_reader::visit_compilation_unit): Add dwo_id to file
467         list.
468         (Dwp_options): New enum type.
469         (dwp_options): Add --verify-only.
470         (usage): Likewise.
471         (main): Likewise.
472         * dwp.h (gold_info): Add declaration.
473
474 2013-11-14  Cary Coutant  <ccoutant@google.com>
475
476         PR gold/14860
477         * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
478         (Ehframe_hdr::set_final_data_size): Allocate a Lock.
479         * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
480         updating fde_offsets_.
481         (Eh_frame_hdr::lock_): New data member.
482
483 2013-11-06  Cary Coutant  <ccoutant@google.com>
484
485         PR gold/15758
486         * object.cc (Sized_relobj_file::do_layout): Handle .eh_frame sections
487         before reloc sections.
488
489 2013-11-04  Alan Modra  <amodra@gmail.com>
490
491         * symtab.h (Symbol::Reference_flags): Add FUNC_DESC_ABI.
492         (Symbol::needs_dynamic_reloc): Test new flag.
493         * powerpc.cc (needs_dynamic_reloc, use_plt_offset): Delete.
494         (Target_powerpc::Scan::get_reference_flags): Add target param.
495         Return FUNC_DESC_ABI for 64-bit ELFv1.
496         (Target_powerpc::Branch_info::make_stub): Adjust get_reference_flags
497         call.
498         (Target_powerpc::Scan::global): Use Symbol::needs_dynamic_reloc.
499         (Target_powerpc::Relocate::relocate): Use Symbol::use_plt_offset.
500
501 2013-10-31  Cary Coutant  <ccoutant@google.com>
502
503         Restore support for dwp v2 DWARF package file format.
504
505         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
506         tu_length parameter.  Adjust all callers.
507         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
508         * dwp.cc: Include dwarf.h.
509         (Section_bounds): New struct type.
510         (Unit_set): New struct type.
511         (Dwo_file::Dwo_file): Initialize new data member.
512         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
513         Combine and rename to...
514         (Dwo_file::read_unit_index): ...this.
515         (Dwo_file::sized_read_compunit_index)
516         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
517         (Dwo_file::sized_read_unit_index): ...this.
518         (Dwo_file::copy_section): Remove section_name, is_str_offsets
519         parameters; add section_id parameter.
520         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
521         (Dwo_file::add_unit_set): ...this.
522         (Dwo_file::shndx_map_): Remove.
523         (Dwo_file::sect_offsets_): New data member.
524         (Dwp_output_file::Dwp_output_file): Initialize new data members.
525         (Dwp_output_file::add_section): Rename to...
526         (Dwp_output_file::add_contribution): ...this.
527         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
528         (Dwp_output_file::add_tu_set): Likewise.
529         (Dwp_output_file::Contribution): New type.
530         (Dwp_output_file::Section::contributions): New data member.
531         (Dwp_output_file::Cu_or_tu_set): Remove.
532         (Dwp_output_file::Section::Section): New ctor.
533         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
534         (Dwp_output_file::Dwp_index::Section_table): New type.
535         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
536         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
537         parameter.
538         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
539         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
540         (Dwp_output_file::Dwp_index::section_table): New member function.
541         (Dwp_output_file::Dwp_index::section_table_end): New member function.
542         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
543         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
544         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
545         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
546         (Dwp_output_file::Dwp_index::section_table_): New data member.
547         (Dwp_output_file::Dwp_index::section_mask_): New data member.
548         (Dwp_output_file::add_output_section): New member function.
549         (Dwp_output_file::write_new_section): New member function.
550         (Dwp_output_file::write_contributions): New member function.
551         (Dwp_output_file::section_id_map_): New data member.
552         (class Dwo_id_info_reader): Remove.
553         (class Unit_reader): New class.
554         (get_dwarf_section_name): New function.
555         (Dwo_file::read_executable): Adjust initializations of class data.
556         (Dwo_file::read): Add support for v2 package file format.
557         (Dwo_file::read_unit_index): Likewise.
558         (Dwo_file::sized_read_unit_index): Likewise.
559         (Dwo_file::copy_section): Likewise.
560         (Dwo_file::add_unit_set): Likewise.
561         (Dwp_output_file::add_output_section): Likewise.
562         (Dwp_output_file::add_contribution): Likewise.
563         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
564         for empty slot.
565         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
566         file format.
567         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
568         slot.
569         (Dwp_output_file::initialize): Remove unused function.
570         (Dwp_output_file::finalize): Add support for v2 package file format.
571         (Dwp_output_file::write_index): Likewise.
572         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
573         function prototype.
574
575 2013-10-31  Cary Coutant  <ccoutant@google.com>
576
577         * configure.ac: Fix check for -fmerge-constants.
578         * configure.ac: Regenerate.
579
580 2013-10-30  Roland McGrath  <mcgrathr@google.com>
581
582         * x86_64.cc (Output_data_plt_x86_64_nacl::first_plt_entry):
583         Correct 9-byte nop sequence to match what the assembler generates.
584
585 2013-10-30  Alan Modra  <amodra@gmail.com>
586
587         * powerpc.cc (Powerpc_relobj::abiversion, set_abiversion,
588         ppc64_local_entry_offset, ppc64_local_entry_offset,
589         do_read_symbols): New functions.
590         (Powerpc_relobj::e_flags_, st_other_): New vars.
591         (Powerpc_relobj::Powerpc_relobj): Call set_abiversion.
592         (Powerpc_dynobj::abiversion, set_abiversion): New functions.
593         (Powerpc_relobj::e_flags_): New var.
594         (Target_powerpc::first_plt_entry_offset, plt_entry_size): Inline
595         and adjust for ELFv2.
596         (Target_powerpc::abiversion, set_abiversion, stk_toc): New functions.
597         (Powerpc_relobj::do_find_special_sections): Check no .opd in ELFv2.
598         (Powerpc_dynobj::do_find_special_sections): Likewise.
599         (Target_powerpc::do_define_standard_symbols): Define ".TOC.".
600         (Target_powerpc::Branch_info::make_stub): Adjust stub destination
601         to ELFv2 local entry.
602         (Target_powerpc::do_relax): No thread safe barriers needed for
603         ELFv2.
604         (Output_data_plt_powerpc::initial_plt_entry_size_,
605         plt_entry_size): Delete.  Replace all uses with
606         first_plt_entry_offset() and plt_entry_size().
607         (Output_data_plt_powerpc::Output_data_plt_powerpc): Remove
608         reserved_size parm.  Update callers.
609         (Output_data_plt_powerpc::entry_count): Update.
610         (Output_data_plt_powerpc::first_plt_entry_offset): Make private
611         and use Target_powerpc::first_plt_entry_offset().
612         (Output_data_plt_powerpc::get_plt_entry_size): Similarly and
613         rename to plt_entry_size.
614         (Output_data_plt_powerpc::add_ifunc_entry,
615         add_local_ifunc_entry): Adjust reloc for ELFv2.
616         (glink_eh_frame_fde_64): Rename to glink_eh_frame_fde_64v1.
617         (glink_eh_frame_fde_64v2): New.
618         (Stub_table::plt_call_size): Support ELFv2 sizing.
619         (Output_data_glink::add_eh_frame): Use the new FDE.
620         (Output_data_glink::set_final_data_size): Adjust for ELFv2 glink.
621         (Stub_table::do_write): Write ELFv2 stubs and glink.
622         (Target_powerpc::Relocate::relocate): Replaces nop after call
623         with ld 2,24(1) and adjust local offset destination for ELFv2.
624
625 2013-10-30  Alan Modra  <amodra@gmail.com>
626
627         * powerpc.cc (Target_powerpc::Scan::check_non_pic): Handle new relocs.
628         (Target_powerpc::Scan::global, local): Likewise.
629         (Target_powerpc::Relocate::relocate): Likewise.  Check for overflow
630         on all ppc64 @h and @ha relocs.
631
632 2013-10-14  Alan Modra  <amodra@gmail.com>
633
634         * output.h (Output_data_got::add_constant): Tidy.
635         (Output_data_got::add_constant_pair): New function.
636         * powerpc.cc (Output_data_got_powerpc): Override all Output_data_got
637         methods used so as to first call reserve_ent().
638
639 2013-10-11  Roland McGrath  <mcgrathr@google.com>
640
641         * powerpc.cc (Output_data_got_powerpc): Remove unused methods
642         add_got_entry and add_got_entry_pair.
643
644         * configure.ac (TLS_GNU2_DIALECT): Use -Werror in test.
645         (HAVE_PUBNAMES): Likewise.
646         * configure: Regenerate.
647
648         * testsuite/Makefile.am: Replace '-T foo' with '-Wl,-T,foo' throughout.
649         * testsuite/Makefile.in: Regenerate.
650
651         * target.h (Target::adjust_elf_header, Target::do_adjust_elf_header):
652         Remove const from declaration.
653         * target.cc (Sized_target::do_adjust_elf_header): Update definition.
654         * sparc.cc (Target_sparc::do_adjust_elf_header): Likewise.
655         * output.h (Output_file_header): Remove const from member target_
656         and corresponding constructor argument.
657         * output.cc (Output_file_header::Output_file_header): Update prototype.
658         (Output_file_header::do_sized_write): Use this->target_ in place
659         of parameters()->target().
660
661         * testsuite/undef_symbol.cc (Foo::get_a): New method.
662
663         * configure.ac (MERGE_CONSTANTS_FLAG): New check.
664         * configure: Regenerate.
665         * Makefile.in: Regenerate.
666         * testsuite/merge_string_literals_1.c: Renamed to have .cc suffix.
667         * testsuite/merge_string_literals_2.c: Likewise.
668         * testsuite/Makefile.am
669         (merge_string_literals_1.o, merge_string_literals_2.o): Update deps.
670         (AM_CFLAGS, AM_CXXFLAGS): Use $(MERGE_CONSTANTS_FLAG) in place of
671         literal -fmerge-constants.
672         * testsuite/Makefile.in: Regenerate.
673
674         * i386.cc (Target_i386): Remove unused member dynbss_.
675         * arm.cc (Target_arm): Likewise.
676         * powerpc.cc (Target_powerpc): Likewise.
677         * sparc.cc (Target_sparc): Likewise.
678         * tilegx.cc (Target_tilegx): Likewise.
679         * x86_64.cc (Target_x86_64): Likewise.
680         * dwarf_reader.h (Dwarf_info_reader): Remove unused members
681         type_signature_, type_offset_.
682         * plugin.h (Plugin_hook): Remove unused member layout_.
683         * readsyms.h (Add_symbols): Remove unused members dirpath_, dirindex_,
684         mapfile_.
685         (Read_member): Remove unused members input_objects_, symtab_,
686         mapfile_, layout_.
687         (Check_library): Remove unused member symtab_.
688         * archive.h (Lib_group): Remove unused member lib_.
689         * archive.cc (Lib_group::Lib_group): Update initializer.
690         * incremental.h (Incremental_binary): Remove unused member target_.
691         (Incremental_script_entry): Removed unused member script_.
692         * layout.h (Write_symbols_task): Remove unused member input_objects_.
693         * icf.h (Icf): Remove unused member num_tracked_relocs.
694
695         * gold-threads.h (Once): Conditionalize member was_run_lock_ on
696         [ENABLE_THREADS && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4], matching
697         its only use.
698         * gold-threads.cc (Once::Once): Likewise conditionalize initializer.
699
700         * archive.h: Use struct rather than class for forward declaration
701         of Read_symbols_data.
702
703 2013-10-07  Cary Coutant  <ccoutant@google.com>
704
705         PR gold/16010
706         * testsuite/Makefile.am (icf_test): Fix dependencies.
707         (icf_safe_test): Likewise.
708         (icf_safe_so_test): Likewise.
709         (large_symbol_alignment): Add empty _LDADD rule.
710         * testsuite/Makefile.in: Regenerate.
711
712 2013-09-03  Pavel Chupin  <pavel.v.chupin@intel.com>
713
714         PR gold/15927
715         * x86_64.cc (Target_x86_64<size>::Scan::global): Use relative
716         relocation for R_X86_64_32 on x32.
717
718 2013-08-27  Roland McGrath  <mcgrathr@google.com>
719
720         * output.cc (Output_segment::set_section_addresses): Take new
721         Target* argument.  If target->isolate_execinstr() and the segment
722         is executable and starts at a target->abi_pagesize() boundary,
723         pad its end out to a target->abi_pagesize() boundary with code fill.
724         * output.h (Output_segment::set_section_addresses): Update decl.
725         * layout.h (Layout::check_output_data_for_reset_values): Take new
726         argument RELAX_OUTPUTS.
727         (Layout): New member relax_output_list_.
728         (Layout::add_relax_output): New method.
729         * layout.cc (Layout::Layout): Update constructor.
730         (Layout::reset_relax_output): New method.
731         (Layout::clean_up_after_relaxation): Call it.
732         (Layout::prepare_for_relaxation): Update caller.
733         (Layout::set_segment_offsets): Update callers of set_section_addresses.
734         Call reset_relax_output before re-processing segments for
735         isolate_execinstr case.
736         (Layout::write_data): Handle relax_output_list_.
737         (Layout::Relaxation_debug_check::check_output_data_for_reset_values):
738         Take new argument RELAX_OUTPUTS.  Assert it's an empty collection.
739
740 2013-08-23  Yuri Chornoivan  <yurchor@ukr.net>
741
742         PR binutils/15834
743         * object.h: Fix typos.
744
745 2013-08-16  Roland McGrath  <mcgrathr@google.com>
746
747         * i386.cc (Target_i386_nacl::do_code_fill): New virtual function.
748         * x86_64.cc (Target_x86_64_nacl::do_code_fill): New virtual function.
749
750 2013-08-07  Cary Coutant  <ccoutant@google.com>
751
752         Revert support for v2 DWP files:
753
754         2013-03-01  Cary Coutant  <ccoutant@google.com>
755
756             Add dwp support for v2 DWARF package file format.
757             * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
758             tu_length parameter.  Adjust all callers.
759             * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
760             * dwp.cc: Include dwarf.h.
761             (Section_bounds): New struct type.
762             (Unit_set): New struct type.
763             (Dwo_file::Dwo_file): Initialize new data member.
764             (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
765             Combine and rename to...
766             (Dwo_file::read_unit_index): ...this.
767             (Dwo_file::sized_read_compunit_index)
768             (Dwo_file::sized_read_typeunit_index): Combine and rename to...
769             (Dwo_file::sized_read_unit_index): ...this.
770             (Dwo_file::copy_section): Remove section_name, is_str_offsets
771             parameters; add section_id parameter.
772             (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
773             (Dwo_file::add_unit_set): ...this.
774             (Dwo_file::shndx_map_): Remove.
775             (Dwo_file::sect_offsets_): New data member.
776             (Dwp_output_file::Dwp_output_file): Initialize new data members.
777             (Dwp_output_file::add_section): Rename to...
778             (Dwp_output_file::add_contribution): ...this.
779             (Dwp_output_file::add_cu_set): Combine parameters into a struct.
780             (Dwp_output_file::add_tu_set): Likewise.
781             (Dwp_output_file::Contribution): New type.
782             (Dwp_output_file::Section::contributions): New data member.
783             (Dwp_output_file::Cu_or_tu_set): Remove.
784             (Dwp_output_file::Section::Section): New ctor.
785             (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
786             (Dwp_output_file::Dwp_index::Section_table): New type.
787             (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
788             (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
789             parameter.
790             (Dwp_output_file::Dwp_index::shndx_pool): Remove.
791             (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
792             (Dwp_output_file::Dwp_index::section_table): New member function.
793             (Dwp_output_file::Dwp_index::section_table_end): New member function.
794             (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
795             (Dwp_output_file::Dwp_index::section_table_rows): New member function.
796             (Dwp_output_file::Dwp_index::section_table_cols): New member function.
797             (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
798             (Dwp_output_file::Dwp_index::section_table_): New data member.
799             (Dwp_output_file::Dwp_index::section_mask_): New data member.
800             (Dwp_output_file::add_output_section): New member function.
801             (Dwp_output_file::write_new_section): New member function.
802             (Dwp_output_file::write_contributions): New member function.
803             (Dwp_output_file::section_id_map_): New data member.
804             (class Dwo_id_info_reader): Remove.
805             (class Unit_reader): New class.
806             (get_dwarf_section_name): New function.
807             (Dwo_file::read_executable): Adjust initializations of class data.
808             (Dwo_file::read): Add support for v2 package file format.
809             (Dwo_file::read_unit_index): Likewise.
810             (Dwo_file::sized_read_unit_index): Likewise.
811             (Dwo_file::copy_section): Likewise.
812             (Dwo_file::add_unit_set): Likewise.
813             (Dwp_output_file::add_output_section): Likewise.
814             (Dwp_output_file::add_contribution): Likewise.
815             (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
816             for empty slot.
817             (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
818             file format.
819             (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
820             slot.
821             (Dwp_output_file::initialize): Remove unused function.
822             (Dwp_output_file::finalize): Add support for v2 package file format.
823             (Dwp_output_file::write_index): Likewise.
824             * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
825             function prototype.
826
827 2013-07-31  Cary Coutant  <ccoutant@google.com>
828
829         * object.cc (Sized_relobj::do_output_section_address): New function.
830         (Sized_relobj): Instantiate explicitly.
831         * object.h (Object::output_section_address): New function.
832         (Object::do_output_section_address): New function.
833         (Sized_relobj::do_output_section_address): New function.
834         * powerpc.cc (Target_powerpc::symval_for_branch): Use it.
835
836 2013-07-30  Cary Coutant  <ccoutant@google.com>
837             Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
838
839         * parameters.cc (Parameters::entry): Return target-specific entry
840         symbol name.
841         * target.h (Target::entry_symbol_name): New function.
842         (Target_info::entry_symbol_name): New data member.
843
844         * arm.cc (Target_arm::arm_info): Add entry_symbol_name.
845         * i386.cc (Target_i386::i386_info): Likewise.
846         (Target_i386_nacl::i386_nacl_info): Likewise.
847         * sparc.cc (Target_sparc::sparc_info): Likewise.
848         * tilegx.cc (Target_tilegx::tilegx_info): Likewise.
849         * x86_64.cc: (Target_x86_64::x86_64_info) Likewise.
850         (Target_x86_64_nacl::x86_64_nacl_info) Likewise.
851         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
852
853 2013-07-22  Sterling Augustine  <saugustine@google.com>
854
855         * dwarf_reader.cc (Dwarf_pubnames_table::read_section):
856         Convert parameter shndx to local variable. Add parameters symtab
857         and symtab_size.  Scan over section names.  Find relocation
858         section corresponding to current section.  Create and initialize
859         reloc_mapper_ and reloc_type_.
860         (Dwarf_pubnames_table::read_header):  Add assertion.  Change
861         unit_length to off_t.  Initialize member unit_length_.  Fill in field
862         cu_offset_.
863         * dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
864         Initialize new fields unit_length_ and cu_offset_.
865         (Dwarf_pubnames_table::read_section): Update prototype.
866         (Dwarf_pubnames_table::cu_offset): New member function.
867         (Dwarf_pubnames_table::subsection_size): Likewise.
868         (Dwarf_pubnames_table::cu_offset_, Dwarf_pubnames_table::unit_length):
869         New fields.
870         (Dwarf_info_reader::symtab, Dwarf_info_reader::symtab_size): Make
871         member functions public.
872         * gdb_index.cc (Gdb_index_info_reader::read_pubnames_and_pubtypes):
873         Update comment.  Rework logic.  Move repeated parts to...
874         (Gdb_index_info_reader::read_pubtable): ...here. New function.
875         (Gdb_index::Gdb_index): Initialize new fields, pubnames_table_,
876         pubtypes_table_, and stmt_list_offset.
877         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
878         Gdb_index::find_pubtype_offset,
879         Gdb_index::map_pubnames_and_types_to_dies): Define new functions.
880         (Gdb_index::pubnames_read): Update prototype and rework logic.
881         * gdb_index.h (Gdb_index_info_reader, Dwarf_pubnames_table):
882         Forward declare.
883         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
884         Gdb_index::find_pubtype_offset, Gdb_index::pubnames_table)
885         Gdb_index::pubtypes_table, Gdb_index::map_pubnames_and_types_to_dies,
886         Gdb_index::map_pubtable_to_dies):
887         Declare functions.
888         (Gdb_index::pubnames_read): Update declaration.
889         (Gdb_index::Pubname_offset_map): New type.
890         (Gdb_index::cu_pubname_map_, Gdb_index::cu_pubtype_map_,
891         Gdb_index::pubnames_table_, Gdb_index::pubtypes_table_,
892         Gdb_index::stmt_list_offset): Declare.
893         (Gdb_index::pubnames_shndx_, Gdb_index::pubnames_offet_,
894         Gdb_index::pubtypes_object_, Gdb_index::pubtypes_shndx_)
895         Gdb_index::pubtypes_offset_): Remove.
896
897 2013-07-19  Roland McGrath  <mcgrathr@google.com>
898
899         * options.h (General_options): Add -Trodata-segment option.
900         * parameters.cc (Parameters::check_rodata_segment): New function.
901         (Parameters::set_target_once): Call it.
902         * parameters.h (Parameters): Declare it (private member function).
903         * layout.cc (load_seg_unusable_for_headers): New function, broken
904         out of Layout::relaxation_loop_body.  If TARGET->isolate_execinstr()
905         then validate rodata segment rather than text segment.
906         (relaxation_loop_body): Call that.
907         (is_text_segment): New function.  Don't admit a non-executable
908         segment if TARGET->isolate_execinstr().
909         (set_segment_offsets): Call it.  Honor -Trodata-segment option.
910
911 2013-07-15  Shawn Landden  <shawnlandden@gmail.com>
912
913         PR gold/15070
914         * fileread.h (File_read::get_view): Clarify comment about ALIGNED.
915         * nacl.h (Sniff_file::View::View): Request aligned view.
916
917 2013-07-11  Cary Coutant  <ccoutant@google.com>
918
919         * powerpc.cc (Target_powerpc::write_branch_lookup_table): Use
920         correct BRLT entry size.
921
922 2013-07-03  Alan Modra  <amodra@gmail.com>
923
924         * powerpc.cc (Target_powerpc::Relocate::relocate): Update self-call
925         comment.
926
927 2013-07-01  Cary Coutant  <ccoutant@google.com>
928
929         * dwarf_reader.cc (Dwarf_ranges_table::read_ranges_table): Save
930         reloc_type_.
931         (Dwarf_ranges_table::read_range_list): Call lookup_reloc.
932         (Dwarf_ranges_table::lookup_reloc): New function.
933         * dwarf_reader.h (Dwarf_ranges_table::Dwarf_ranges_table): Initialize
934         reloc_type_.
935         (Dwarf_ranges_table::lookup_reloc): New function.
936         (Dwarf_ranges_table::reloc_type_): New data member.
937
938 2013-06-27  Jing Yu  <jingyu@google.com>
939
940         PR gold/15662
941         * powerpc.cc (Output_data_brlt_powerpc::reset_brlt_sizes): New
942         function.
943         (Output_data_brlt_powerpc::finalize_brlt_sizes): New function.
944         (Target_powerpc::do_relax): Call the above.
945
946 2013-06-27  Cary Coutant  <ccoutant@google.com>
947
948         * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
949         on garbage collected .opd section.
950
951 2013-06-27  Alan Modra  <amodra@gmail.com>
952
953         * powerpc.cc (Target_powerpc::do_gc_add_reference): Test dst_shndx
954         is non-zero.
955         (Target_powerpc::do_gc_mark_symbols): Likewise for sym->shndx().
956         (Target_powerpc::do_function_location): Likewise for loc->shndx.
957
958 2013-06-14  Cary Coutant  <ccoutant@google.com>
959
960         * resolve.cc (Symbol::override_base): Don't override st_type
961         from plugin placeholder symbols.
962         (Symbol_table::resolve): Likewise.
963         (Symbol_table::should_override): Don't complain about TLS mismatch
964         if the TO symbol is a plugin placeholder.
965         * testsuite/Makefile.am (plugin_test_tls): New test.
966         * testsuite/Makefile.in: Regenerate.
967         * testsuite/plugin_test_tls.sh: New test script.
968         * testsuite/two_file_test_2_tls.cc: New test source.
969         * testsuite/two_file_test_tls.cc: New test source.
970
971 2013-06-05  Alexander Ivchenko  <alexander.ivchenko@intel.com>
972
973         * layout.cc (Layout::set_segment_offsets): Taking care of the case when
974         the maximum segment alignment is larger than the page size.
975         * testsuite/Makefile.am (large_symbol_alignment): Test that Gold
976         correctly aligns the symbols with large alignemnt.
977         * testsuite/Makefile.in: Regenerate.
978         * testsuite/large_symbol_alignment.cc: New file.
979
980 2013-05-30  Alexander Ivchenko  <alexander.ivchenko@intel.com>
981             Sriraman Tallam  <tmsriram@google.com>
982
983         * options.h (sort_section): New option.
984         * output.h (Input_section_sort_section_prefix_special_ordering_compare):
985         Rename from Input_section_sort_section_name_special_ordering_compare.
986         (Input_section_sort_section_name_compare): New struct.
987         * output.cc (Output_section::Input_section_sort_section_name_compare::
988         operator()): New function.
989         (Output_section::sort_attached_input_sections): Use new sort function
990         for .text if --sort-section=name is specified.
991         * layout.cc (Layout::make_output_section):
992         Add sorting by name when --sort-section=name is specified.
993         * testsuite/Makefile.am (text_section_grouping): Test option
994         --sort-section=name.
995         * testsuite/Makefile.in: Regenerate.
996         * testsuite/section_sorting_name.cc: New file.
997         * testsuite/section_sorting_name.sh: New file.
998
999 2013-05-21  Cary Coutant  <ccoutant@google.com>
1000
1001         * symtab.h (Symbol::is_cxx_vtable): New function.
1002         * target-reloc.h (relocate_section): Check for vtable symbol.
1003         * testsuite/Makefile.am (missing_key_func.sh): New test case.
1004         * testsuite/Makefile.in: Regenerate.
1005         * testsuite/missing_key_func.cc: New test source.
1006         * testsuite/missing_key_func.sh: New test script.
1007
1008 2013-05-21  Cary Coutant  <ccoutant@google.com>
1009
1010         * object.cc (Sized_relobj_file::get_symbol_location_info): Set
1011         type of enclosing symbol.
1012         (Relocate_info::location): Check symbol type when describing symbol.
1013         * object.h (Symbol_location_info): Remove unused line_number;
1014         add enclosing_symbol_type.
1015         * testsuite/debug_msg.sh: Adjust expected output.
1016
1017 2013-05-13  Cary Coutant  <ccoutant@google.com>
1018
1019         * configure.ac: Export DEFAULT_TARGET.
1020         * configure: Regenerate.
1021         * Makefile.in: Regenerate.
1022         * testsuite/Makefile.am: Add .EXPORT_ALL_VARIABLES.
1023         * testsuite/Makefile.in: Regenerate.
1024         * testsuite/debug_msg.sh: Delete duplicate tests.
1025         Don't check undef_int error message match for powerpc where the
1026         source file and line number aren't available.
1027
1028 2013-05-10  Roland McGrath  <mcgrathr@google.com>
1029
1030         * options.h (General_options): Add --rosegment-gap option.
1031         * options.cc (finalize): --rosegment-gap implies --rosegment.
1032         * layout.cc (set_segment_offsets): Let user option override
1033         target->rosegment_gap().
1034
1035 2013-05-10  Roland McGrath  <mcgrathr@google.com>
1036
1037         * options.h (General_options): Remove leading space from help
1038         messages for -nostdlib and --rosegment.
1039
1040 2013-05-03  Maciej W. Rozycki  <macro@codesourcery.com>
1041
1042         PR ld/15365
1043         * layout.cc (Layout::finalize): Make __ehdr_start STV_HIDDEN.
1044
1045 2013-05-03  Alan Modra  <amodra@gmail.com>
1046
1047         * merge.cc (Output_merge_string::do_add_input_section): Correct
1048         scan for number of strings.  Rename vars to avoid shadowing.
1049         Include missing terminator in input_size_.
1050
1051 2013-05-01  H.J. Lu  <hongjiu.lu@intel.com>
1052
1053         * merge.cc (Output_merge_string<Char_type>::do_add_input_section):
1054         Restore empty string handling.
1055
1056 2013-05-01  Cary Coutant  <ccoutant@google.com>
1057
1058         * stringpool.cc (Stringpool_template::new_key_offset): Fix
1059         uninitialized warning.
1060
1061 2013-04-29  Alexander Ivchenko  <alexander.ivchenko@intel.com>
1062
1063         * output.cc (Output_section::add_merge_input_section): Allow
1064         to merge sections if the alignment is more than character size.
1065         * merge.h (Output_merge_string::Output_merge_string): Remove
1066         assert.
1067         * merge.cc (Output_merge_string<Char_type>::do_add_input_section): Count
1068         only not-null strings. Check the alignment of strings.
1069         * stringpool.h
1070         (Stringpool_template<Stringpool_char>::Stringpool_template): Add
1071         alignment as the argument.
1072         (Stringpool_template<Stringpool_char>::addralign_): New class member.
1073         * stringpool.cc (Stringpool_template<Stringpool_char>::new_key_offset):
1074         Align non-zero length strings according to the addralign_.
1075         (Stringpool_template<Stringpool_char>::set_string_offsets):
1076         Updating offsets according to the given alignment.
1077         * testsuite/Makefile.am (text_section_grouping): Test if string
1078         literals are getting merged.
1079         * testsuite/Makefile.in: Regenerate.
1080         * testsuite/merge_string_literals_1.c: New file.
1081         * testsuite/merge_string_literals_2.c: Ditto.
1082         * testsuite/merge_string_literals.sh: Ditto.
1083
1084 2013-04-26  Ian Lance Taylor  <iant@google.com>
1085
1086         * target-reloc.h (relocate_section): If the reloc offset is out of
1087         range, pass VIEW as NULL to relocate.relocate.
1088         * arm.cc (Target_arm:Relocate::relocate): Check for a NULL view.
1089         * i386.cc (Target_i386::Relocate::relocate): Likewise.
1090         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
1091         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
1092         * tilegx.cc (Target_tilegx::Relocate::relocate): Likewise.
1093         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
1094
1095 2013-04-26  Geoff Pike  <gpike@chromium.org>
1096
1097         * gold.cc (queue_final_tasks): invoke layout->queue_build_id_tasks().
1098         * layout.cc (Hash_task): New class.
1099         (Layout::queue_build_id_tasks): New function.
1100         (Layout::write_build_id): Handle single-thread portion of build ID
1101         computation.  (In some cases, all of it is single-threaded.)  Replace
1102         {sha1,md5}_process_bytes with {sha1,md5}_buffer to get the same
1103         functionality in fewer lines of code.
1104         * layout.h (Layout::queue_build_id_tasks): New function declaration.
1105         * options.h (General_options): make "--build-id" default to tree
1106         rather than sha1.  Add two new options related to --build-id=tree:
1107         --build-id-chunk-size-for-treehash and
1108         --build-id-min-file-size-for-treehash.
1109         * Makefile.am: add testing of --build-id=tree and related new options
1110         (these tests will be invoked by "make check").
1111         * Makefile.in: Regenerate.
1112
1113 2013-04-25  Alan Modra  <amodra@gmail.com>
1114
1115         * configure.tgt: Add powerpcle and powerpc64le.
1116
1117 2013-04-22  Alan Modra  <amodra@gmail.com>
1118
1119         PR gold/15355
1120         * layout.cc (Layout::segment_precedes): Allow more than one
1121         segment with the same type and flags.
1122
1123 2013-04-15  Cary Coutant  <ccoutant@google.com>
1124
1125         * layout.cc (Layout::set_relocatable_section_offsets): Don't
1126         allocate space in file for BSS sections.
1127
1128 2013-04-15  Cary Coutant  <ccoutant@google.com>
1129
1130         * script-sections.cc (Orphan_output_section): Reset address
1131         to zero after each orphaned section for relocatable links.
1132
1133 2013-04-15  Cary Coutant  <ccoutant@google.com>
1134
1135         * symtab.cc (Symbol_table::sized_write_globals): Subtract
1136         section starting address for relocatable link.
1137         * testsuite/Makefile.am (script_test_11): New test.
1138         * testsuite/Makefile.in: Regenerate.
1139         * testsuite/script_test_11.c: New source file.
1140         * testsuite/script_test_11.t: New linker script.
1141
1142 2013-04-13  Alan Modra  <amodra@gmail.com>
1143
1144         * powerpc.cc (Stub_control::can_add_to_stub_group): Don't set
1145         owner when sections are not adjacent and exceed group size.
1146         (Target_powerpc::group_sections): Handle corner case.
1147         (Target_powerpc::Branch_info::make_stub): Handle case where
1148         stub table doesn't exist due to branches in non-exec sections.
1149         (Target_powerpc::Relocate::relocate): Likewise.
1150
1151 2013-04-11  Alan Modra  <amodra@gmail.com>
1152
1153         PR gold/15354
1154         * powerpc.cc (Target_powerpc::make_brlt_section): Name section
1155         .branch_lt to match bfd ld.  Adjust comments throughout file.
1156
1157 2013-04-04  Ian Lance Taylor  <iant@google.com>
1158
1159         GCC PR c++/56840
1160         * object.cc (do_layout_deferred_sections): Handle .eh_frame
1161         sections before checking whether they are included in the link.
1162
1163 2013-03-29  Sriraman Tallam  <tmsriram@google.com>
1164
1165         * archive.cc (Archive::get_elf_object_for_member):  Create the elf
1166         object before calling the plugin claim_file handler.  Pass the elf
1167         object of the archive to the plugin. Delete the elf object if the
1168         plugin claims the file.
1169
1170 2013-03-21  Alan Modra  <amodra@gmail.com>
1171
1172         * layout.cc (Layout::set_segment_offsets): Accept writable .text
1173         segment when omagic.
1174
1175 2013-03-21  Alan Modra  <amodra@gmail.com>
1176
1177         * dwp.cc (Dwp_output_file::add_contribution): Avoid signed/unsigned
1178         comparison warning.
1179         * layout.cc (Layout::create_dynamic_symtab): Avoid "may be used
1180         uninitialized" warning.
1181
1182 2013-03-20  Alan Modra  <amodra@gmail.com>
1183
1184         * symtab.h (Symbol::clear_version): New function.
1185         * symtab.cc (Symbol_table::set_dynsym_indexes): Don't set object
1186         is_needed by weak references.  Clear version for symbols defined
1187         in as-needed objects that are not needed.
1188
1189 2013-03-15  Alan Modra  <amodra@gmail.com>
1190
1191         * powerpc.cc (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Make
1192         static and public.  Add report_err param.  Return false for data refs.
1193         (Target_powerpc::rela_dyn_section): New overloaded function.
1194         (Target_powerpc::plt_, iplt_): Elucidate.
1195         (Output_data_plt_powerpc::entry_count): Handle current_data_size()==0.
1196         (Output_data_plt_powerpc::do_write): Don't write .iplt.
1197         (Output_data_plt_powerpc::plt_entry_count): Don't add .iplt entries.
1198         (Target_powerpc::Scan::local, global): Adjust reloc_needs_plt_for_ifunc
1199         calls.  Put ifunc dynamic relocs in irela_dyn_section.  Only
1200         push_branch and make_plt_entry for ifunc syms when
1201         reloc_needs_plt_for_ifunc.
1202         (Target_powerpc::Relocate::relocate): Don't use plt entry value
1203         for ifunc unless reloc_needs_plt_for_ifunc.
1204
1205 2013-03-15  Alan Modra  <amodra@gmail.com>
1206
1207         * gc.h (gc_process_relocs): Don't look through function descriptors.
1208         * icf.cc (get_section_contents): Do so here instead.
1209
1210 2013-03-13  Alan Modra  <amodra@gmail.com>
1211
1212         * powerpc.cc (is_branch_reloc): Forward declare.
1213         (Target_powerpc::do_can_check_for_function_pointers): New predicate.
1214         (Target_powerpc::Scan::local_reloc_may_be_function_pointer): Return
1215         false for 64-bit, true for 32-bit non-branch relocs.
1216         (Target_powerpc::Scan::global_reloc_may_be_function_pointer): Likewise.
1217         * testsuite/Makefile.am (icf_test): Use linker map file instead of
1218         nm output.
1219         (icf_safe_test): Generate linker map file as well as nm output.
1220         (icf_safe_so_test): Likewise.
1221         * testsuite/Makefile.in: Regenerate.
1222         * testsuite/icf_test.sh: Parse linker map file to determine
1223         section folding.
1224         * testsuite/icf_safe_test.sh: Likewise.  Expect folding for PowerPC.
1225         * testsuite/icf_safe_so_test.sh: Likewise.
1226         (X86_32_or_ARM_specific_safe_fold): Merge into..
1227         (arch_specific_safe_fold): ..this.
1228         (X86_64_specific_safe_fold): Delete unused function.
1229
1230 2013-03-12  Alan Modra  <amodra@gmail.com>
1231
1232         * gc.h (gc_process_relocs): Look through function descriptors
1233         to determine shndx, symvalue and addend used by ICF.  Tidy
1234         variable duplication.
1235
1236 2013-03-11  Alan Modra  <amodra@gmail.com>
1237
1238         * gold.cc (queue_middle_tasks): Move detect_odr_violations..
1239         * layout.cc (Layout_task_runner::run): ..to here.
1240         * symtab.h (struct Symbol_location): Extract from..
1241         (class Symbol_table): ..here.
1242         * symtab.cc (Symbol_table::linenos_from_loc): Invoke function_location.
1243         * target.h (class Target): Add function_location and
1244         do_function_location functions.
1245         (class Sized_target): Add do_function_location.
1246         * object.h (class Sized_relobj_file): Move find_shdr..
1247         (class Object): ..to here.
1248         * object.cc: Likewise.  Update to suit.  Instantiate.
1249         (Sized_relobj_file::find_eh_frame): Update find_shdr call.
1250         * powerpc.cc (class Powerpc_dynobj): New.
1251         (Target_powerpc::do_function_location): New function.
1252         (Powerpc_relobj::do_find_special_sections): Update find_shdr call.
1253         (Powerpc_dynobj::do_read_symbols): New function.
1254         (Target_powerpc::do_make_elf_object): Make a Powerpc_dynobj.
1255
1256 2013-03-08  Ian Lance Taylor  <iant@google.com>
1257
1258         * options.cc (General_options::string_to_object_format): Accept
1259         "default".
1260
1261 2013-03-08  Alan Modra  <amodra@gmail.com>
1262
1263         * ehframe.h (Post_fdes) Make it a vector of Post_fde rather than
1264         pointer to Post_fde.
1265         (struct Post_fde): Move definition to here..
1266         * ehframe.cc (struct Post_fde): ..from here.
1267         (Cie::write): Don't alloc Post_fde.
1268         (Eh_frame::do_sized_write): Update.  Don't free Post_fde.
1269
1270 2013-03-07  Alan Modra  <amodra@gmail.com>
1271
1272         * testsuite/discard_locals_relocatable_test.c: Add a powerpc
1273         relocation referencing .LC0.
1274         * testsuite/discard_locals_test.sh: Remove FIXMEs.
1275
1276 2013-03-07  Alan Modra  <amodra@gmail.com>
1277
1278         * testsuite/ifunc-sel.h (ifunc_sel, ifunc_one): Mark
1279         always_inline.  Add assembly for powerpc to avoid GOT.
1280
1281 2013-03-07  Alan Modra  <amodra@gmail.com>
1282
1283         * testsuite/script_test_10.sh: Don't test .bss section
1284         header number.
1285
1286 2013-03-06  Alan Modra  <amodra@gmail.com>
1287
1288         * powerpc.cc (class Powerpc_relobj): Move some member functions.
1289         (Target_powerpc::symval_for_branch):  Add symtab param.  Update
1290         all callers.  Handle folded sections.
1291         (Target_powerpc::do_gc_add_reference): Don't cast dynamic object
1292         to Powerpc_relobj.
1293         (Global_symbol_visitor_opd::operator()): Likewise.
1294
1295 2013-03-04  Alan Modra  <amodra@gmail.com>
1296
1297         * testsuite/Makefile.am (final_layout_script.lds): Add .sbss.
1298         * testsuite/Makefile.in: Regenerate.
1299
1300 2013-03-01  Cary Coutant  <ccoutant@google.com>
1301
1302         Add dwp support for v2 DWARF package file format.
1303         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
1304         tu_length parameter.  Adjust all callers.
1305         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
1306         * dwp.cc: Include dwarf.h.
1307         (Section_bounds): New struct type.
1308         (Unit_set): New struct type.
1309         (Dwo_file::Dwo_file): Initialize new data member.
1310         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
1311         Combine and rename to...
1312         (Dwo_file::read_unit_index): ...this.
1313         (Dwo_file::sized_read_compunit_index)
1314         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
1315         (Dwo_file::sized_read_unit_index): ...this.
1316         (Dwo_file::copy_section): Remove section_name, is_str_offsets
1317         parameters; add section_id parameter.
1318         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
1319         (Dwo_file::add_unit_set): ...this.
1320         (Dwo_file::shndx_map_): Remove.
1321         (Dwo_file::sect_offsets_): New data member.
1322         (Dwp_output_file::Dwp_output_file): Initialize new data members.
1323         (Dwp_output_file::add_section): Rename to...
1324         (Dwp_output_file::add_contribution): ...this.
1325         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
1326         (Dwp_output_file::add_tu_set): Likewise.
1327         (Dwp_output_file::Contribution): New type.
1328         (Dwp_output_file::Section::contributions): New data member.
1329         (Dwp_output_file::Cu_or_tu_set): Remove.
1330         (Dwp_output_file::Section::Section): New ctor.
1331         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
1332         (Dwp_output_file::Dwp_index::Section_table): New type.
1333         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
1334         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
1335         parameter.
1336         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
1337         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
1338         (Dwp_output_file::Dwp_index::section_table): New member function.
1339         (Dwp_output_file::Dwp_index::section_table_end): New member function.
1340         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
1341         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
1342         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
1343         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
1344         (Dwp_output_file::Dwp_index::section_table_): New data member.
1345         (Dwp_output_file::Dwp_index::section_mask_): New data member.
1346         (Dwp_output_file::add_output_section): New member function.
1347         (Dwp_output_file::write_new_section): New member function.
1348         (Dwp_output_file::write_contributions): New member function.
1349         (Dwp_output_file::section_id_map_): New data member.
1350         (class Dwo_id_info_reader): Remove.
1351         (class Unit_reader): New class.
1352         (get_dwarf_section_name): New function.
1353         (Dwo_file::read_executable): Adjust initializations of class data.
1354         (Dwo_file::read): Add support for v2 package file format.
1355         (Dwo_file::read_unit_index): Likewise.
1356         (Dwo_file::sized_read_unit_index): Likewise.
1357         (Dwo_file::copy_section): Likewise.
1358         (Dwo_file::add_unit_set): Likewise.
1359         (Dwp_output_file::add_output_section): Likewise.
1360         (Dwp_output_file::add_contribution): Likewise.
1361         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
1362         for empty slot.
1363         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
1364         file format.
1365         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
1366         slot.
1367         (Dwp_output_file::initialize): Remove unused function.
1368         (Dwp_output_file::finalize): Add support for v2 package file format.
1369         (Dwp_output_file::write_index): Likewise.
1370         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
1371         function prototype.
1372
1373 2013-03-01  Cary Coutant  <ccoutant@google.com>
1374
1375         * dwarf_reader.cc (Dwarf_info_reader::check_buffer): Move
1376         function into class definition in header file.
1377         (Dwarf_info_reader::warn_corrupt_debug_section): New function.
1378         * dwarf_reader.h (Dwarf_info_reader::warn_corrupt_debug_section):
1379         New function.
1380         (Dwarf_info_reader::check_buffer): Move here from .cc file.
1381
1382 2013-02-28  Alan Modra  <amodra@gmail.com>
1383
1384         * target.h (Target::plt_fde_location, do_plt_fde_location): Declare.
1385         * target.cc (Target::do_plt_fde_location): New function.
1386         * ehframe.h (class FDE): Add post_map field to u_.from_linker,
1387         accessor function, and constructor param.
1388         (struct Post_fde, Post_fdes): Declare.
1389         (Cie::write): Add post_fdes param.
1390         * ehframe.cc (Fde::write): Use plt_fde_location.
1391         (struct Post_fde): Define.
1392         (Cie::write): Stash FDEs added post merge mapping.
1393         (Eh_frame::add_ehframe_for_plt): Assert no new CIEs after mapping.
1394         Adjust Fde constructor call.  Bump final_data_size_ for post map FDEs.
1395         (Eh_frame::do_sized_write): Arrange to write post map FDES after
1396         other FDEs.
1397         * powerpc.cc (Target_powerpc::do_plt_fde_location): New function.
1398         (Target_powerpc::has_glink): New function.
1399         (Target_powerpc::do_relax): Add eh_frame info for stubs.
1400         (struct Eh_cie, eh_frame_cie, glink_eh_frame_fde_64,
1401         glink_eh_frame_fde_32, default_fde): New data.
1402         (Stub_table::eh_frame_added_): New var.
1403         (Stub_table::find_long_branch_entry, stub_address, stub_offset):
1404         Make const.
1405         (Stub_table::add_eh_frame): New function.
1406         (Output_data_glink::add_eh_frame): New function.
1407         (Target_powerpc::make_glink_section): Call add_eh_frame.
1408
1409 2013-02-15  Ian Lance Taylor  <iant@google.com>
1410
1411         * options.h (DEFINE_uint64_alias): Define.
1412         (class General_options): Add -Ttext-segment as an alias for
1413         -Ttext.
1414
1415 2013-02-15  Alan Modra  <amodra@gmail.com>
1416
1417         * powerpc.cc (Stub_table::plt_off): New function, extracted from..
1418         (Stub_table::do_write): ..here, two places.
1419         (Stub_table::plt_call_size): Use it here too.
1420
1421 2013-02-11  Ian Lance Taylor  <iant@google.com>
1422
1423         * descriptors.cc (Descriptors::close_all): New function.
1424         * descriptors.h (class Descriptors): Declare close_all.
1425         (close_all_descriptors): New inline function.
1426         * plugin.cc: Include "descriptors.h".
1427         (Plugin_manager::cleanup): Call close_all_descriptors.
1428
1429 2013-02-06  Alan Modra  <amodra@gmail.com>
1430
1431         * README: Update coding style link.
1432
1433 2013-01-28  Cary Coutant  <ccoutant@google.com>
1434
1435         * dwp.cc (File_list): New typedef.
1436         (Dwo_name_info_reader): New class.
1437         (Dwo_id_info_reader::Dwo_id_info_reader): Remove unused parameters.
1438         (Dwo_id_info_reader::visit_top_die): Remove unused member function.
1439         (Dwo_file::~Dwo_file): Delete input_file_ after obj_.
1440         (Dwo_file::read_executable): New function.
1441         (Dwo_file::read): Move common setup code to ...
1442         (Dwo_file::make_object): ... here.
1443         (dwp_options): Add --exec/-e.
1444         (usage): Likewise.
1445         (main): Likewise.
1446
1447 2013-01-24  Sriraman Tallam  <tmsriram@google.com>
1448
1449         * layout.cc (Layout::layout): Check for option text_reorder.
1450         (Layout::make_output_section): Ditto.
1451         * options.h (text_reorder): New option.
1452         * output.cc (Input_section_sort_compare): Remove special ordering
1453         of section names.
1454         (Output_section::
1455          Input_section_sort_section_name_special_ordering_compare::
1456          operator()): New function.
1457         (Output_section::sort_attached_input_sections): Use new sort function
1458         for .text.
1459         * output.h (Input_section_sort_section_name_special_ordering_compare):
1460         New struct.
1461         * testsuite/Makefile.am (text_section_grouping): Test option
1462         --no-text-reorder
1463         * testsuite/Makefile.in: Regenerate.
1464         * testsuite/text_section_grouping.sh: Check order of functions without
1465         default text reordering.
1466
1467 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
1468
1469         * options.h (General_options): Change default to true for new_dtags.
1470
1471 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
1472
1473         * layout.cc (Layout::finish_dynamic_section): Only add DT_RPATH
1474         when enable_new_dtags is false.  Only add DT_RUNPATH when
1475         enable_new_dtags is true.
1476
1477 2013-01-17  Serge Pavlov  <serge.v.pavlov@gmail.com>
1478
1479         * powerpc.cc (Stub_table::find_plt_call_entry): Make types
1480         used in declaration and definition consistent.
1481         (Target_powerpc::symval_for_branch): Ditto.
1482
1483 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
1484
1485         * testsuite/plugin_final_layout.cc: Fix comment.
1486
1487 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
1488
1489         * layout.cc (Layout::layout): Do not do default sorting for
1490         text sections when section ordering is specified.
1491         (make_output_section): Ditto.
1492         * testsuite/plugin_final_layout.cc: Name the function sections
1493         to catch reordering issues.
1494
1495 2013-01-15  Alan Modra  <amodra@gmail.com>
1496
1497         * powerpc.cc (Target_powerpc::do_relax): Default shared libs to
1498         plt-thread-safe.
1499
1500 2013-01-15  Alan Modra  <amodra@gmail.com>
1501
1502         * testsuite/Makefile.am (final_layout_script.lds): Handle .got section.
1503         * testsuite/Makefile.in: Regenerate.
1504
1505 2013-01-14  Alan Modra  <amodra@gmail.com>
1506
1507         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add various output files.
1508         * testsuite/Makefile.in: Regenerate.
1509
1510 2013-01-11  Pavel Chupin  <pavel.v.chupin@intel.com>
1511
1512         PR bfd/14430
1513         Fix mingw gold build with plugins enabled
1514         * Makefile.am: Replace -ldl with @DLOPEN_LIBS@.
1515         * configure.ac: Export DLOPEN_LIBS and add headers check.
1516         * plugin.cc: Handle non-dlfcn case.
1517         * Makefile.in: Regenerate.
1518         * config.in: Regenerate.
1519         * configure: Regenerate.
1520         * testsuite/Makefile.in: Regenerate.
1521
1522 2013-01-09  Sriraman Tallam  <tmsriram@google.com>
1523
1524         * output.h (sort_attached_input_sections): Change to be public.
1525         * script-sections.cc
1526         (Output_section_definition::set_section_addresses): Sort
1527         attached input sections according to section order before linker
1528         script assigns section addresses.
1529         (Orphan_output_section::set_section_addresses): Sort
1530         attached input sections according to section order before linker
1531         script assigns section addresses.
1532         * Makefile.am (final_layout.sh): Use a simple linker script to
1533         check if section ordering still works.
1534         * Makefile.in: Regenerate.
1535
1536 2013-01-09  Ben Cheng  <bccheng@google.com>
1537
1538         * arm.cc (Target_arm::attributes_accept_div): New function.
1539         (Target_arm::attributes_forbid_div): New function.
1540         (Target_arm::merge_object_attributes): Merge the Tag_DIV_use
1541         attribute using the same new functions as what bfd/elf32_arm.c
1542         does.
1543
1544 2013-01-07  Cary Coutant  <ccoutant@google.com>
1545
1546         PR gold/14993
1547         * output.cc (Output_section::add_input_section): For incremental
1548         updates, don't track input sections that are allocated from patch
1549         space.
1550
1551 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
1552             Ian Lance Taylor  <iant@google.com>
1553
1554         PR gold/14897
1555         * configure.ac (--enable-ld): Removed.
1556         (install_as_default): Set to yes only for --enable-gold=default
1557         or --disable-ld.
1558         * configure: Regenerated.
1559
1560 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
1561
1562         * options.h (General_options): Add -fuse-ld= for GCC linker
1563         option compatibility.
1564
1565 2013-01-04  Cary Coutant  <ccoutant@google.com>
1566
1567         * configure.ac: Fix typo restoring CXXFLAGS.
1568         * configure: Regenerate.
1569
1570 2013-01-04  Cary Coutant  <ccoutant@google.com>
1571
1572         * testsuite/Makefile.am (CXXLINK_S): New macro.
1573         (debug_msg_so.err, debug_msg_ndebug.err): Use CXXLINK_S.
1574         * testsuite/Makefile.in: Regenerate.
1575
1576 2013-01-02  H.J. Lu  <hongjiu.lu@intel.com>
1577
1578         * version.cc (print_version): Update copyright year to 2013.
1579
1580 2012-12-20  Ian Lance Taylor  <iant@google.com>
1581
1582         * layout.cc (Layout::special_ordering_of_input_section): New
1583         function.
1584         (Layout::layout): If input section requires special ordering, must
1585         sort input sections.
1586         (Layout::make_output_section): May sort .text input sections.
1587         (Layout::is_section_name_prefix_grouped): Remove.
1588         * layout.h (class Layout): Declare
1589         special_ordering_of_input_section.  Don't declare
1590         is_section_name_prefix_grouped.
1591         * output.cc (Output_section::add_input_section): Revert last
1592         change.
1593         (Output_section::Input_section_sort::match_file_name): Don't crash
1594         if called on output section data.
1595         (Output_section::Input_section_sort_compare): Sort based on
1596         special ordering.
1597         (Output_section::Input_section_sort_section_order_index_compare):
1598         Revert last patch.
1599         (Output_section::sort_attached_input_sections): Likewise.
1600
1601 2012-12-18  Sriraman Tallam  <tmsriram@google.com>
1602
1603         * layout.cc (Layout::is_section_name_prefix_grouped): New function.
1604         * layout.h (Layout::is_section_name_prefix_grouped): New function.
1605         * output.cc (Output_section::add_input_section): Check if section
1606         name contains special prefix.  Keep input sections to sort such
1607         sections.
1608         (Output_section::Input_section_sort_section_order_index_compare
1609          ::operator()): Group sections according to prefixes.
1610         (Output_section::sort_attached_input_sections): Add condition to
1611         Input_section_entry constructor call.
1612         * testsuite/Makefile.am (text_section_grouping): New test.
1613         * testsuite/Makefile.in: Regenerate.
1614         * testsuite/text_section_grouping.cc: New file.
1615         * testsuite/text_section_grouping.sh: New file.
1616
1617 2012-12-17  Nick Clifton  <nickc@redhat.com>
1618
1619         * Makefile.am: Add copyright notice.
1620         * NEWS: Likewise.
1621         * README: Likewise.
1622         * configure.ac: Likewise.
1623         * ftruncate.c: Likewise.
1624         * Makefile.in: Regenerate.
1625
1626 2012-12-14  Cary Coutant  <ccoutant@google.com>
1627
1628         * testsuite/Makefile.am (exception_separate_shared_12_test): Add
1629         --no-as-needed flag.
1630         (exception_separate_shared_12_test): Likewise.
1631         (incremental_copy_test): Likewise.
1632         * testsuite/Makefile.in: Regenerate.
1633
1634 2012-12-14  Cary Coutant  <ccoutant@google.com>
1635
1636         * dwp.cc (Dwp_output_file::add_cu_set): Check for duplicate CUs.
1637         (Dwp_output_file::Dwp_index::enter_set): Add assert.
1638
1639 2012-12-12  Alan Modra  <amodra@gmail.com>
1640
1641         * powerpc.cc (class Track_tls): New.
1642         (class Relocate, class Scan): Inherit Track_tls.
1643         (Target_powerpc::Scan::local, global): Track tls optimization
1644         and avoid creating plt entry for __tls_get_addr if all uses
1645         are optimized away.
1646         (Target_powerpc::Relocate::relocate): Update to use Track_tls.
1647
1648 2012-12-12  Alan Modra  <amodra@gmail.com>
1649
1650         * options.h (General_options): Add --toc-sort/--no-toc-sort.
1651         Replace no_toc_optimize with toc_optimize.
1652         * output.h (Output_section::input_sections): Provide non-const variant.
1653         * powerpc.cc (Powerpc_relobj::has_small_toc_reloc_,
1654         set_has_small_toc_reloc, has_small_toc_reloc): New variable and
1655         accessors.
1656         (Target_powerpc::Scan::local, global): Call set_has_small_toc_reloc.
1657         (class Sort_toc_sections): New.
1658         (Target_powerpc::do_finalize_sections): Sort toc sections.
1659         (Target_powerpc::Relocate::relocate): Update toc_optimize test.
1660
1661 2012-12-10  Roland McGrath  <mcgrathr@google.com>
1662
1663         * testsuite/binary_unittest.cc (read_all): New function.
1664         (Sized_binary_test): Use it instead of ::read.
1665         * fileread.cc (do_read): Don't assume pread always reads the whole
1666         amount in a single call.
1667
1668 2012-12-10  Alan Modra  <amodra@gmail.com>
1669
1670         * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
1671         Set EM_PPC64 or EM_PPC here.
1672         (Target_selector_powerpc::do_recognize): Delete.
1673
1674 2012-12-10  Alan Modra  <amodra@gmail.com>
1675
1676         * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
1677         stub_table_.
1678         (Target_powerpc::Branch_info::make_stub): Don't omit addend.
1679
1680 2012-12-07  Roland McGrath  <mcgrathr@google.com>
1681
1682         * testsuite/binary_unittest.cc (Sized_binary_test):
1683         Use open_descriptor rather than ::open.
1684
1685 2012-12-07  Alan Modra  <amodra@gmail.com>
1686
1687         * powerpc.cc (Stub_table::do_write): Delete redundant Address
1688         typedef and invalid_address constant.
1689         (Output_data_glink, Stub_table, Target_powerpc): Explicitly
1690         instantiate constants.
1691
1692 2012-12-06  Roland McGrath  <mcgrathr@google.com>
1693
1694         * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
1695         Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
1696         * aclocal.m4: Regenerate.
1697         * configure: Regenerate.
1698         * Makefile.in: Regenerate.
1699         * testsuite/Makefile.in: Regenerate.
1700
1701 2012-12-07  Alan Modra  <amodra@gmail.com>
1702
1703         * options.h (General_options): Add no_toc_optimize.
1704         * powerpc.cc (ok_lo_toc_insn): New function.
1705         (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
1706
1707 2012-12-06  Alan Modra  <amodra@gmail.com>
1708
1709         * options.h (General_options): Add plt_align, plt_static_chain,
1710         plt_thread_safe.  Update stub_group_size help text.
1711         * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
1712         for new plt_thread_safe_ var.
1713         (use_plt_offset): Correct comments.
1714         (Target_powerpc::do_relax): Look for thread creation symbols to
1715         determine default plt_thread_safe value.  Clear plt call stubs
1716         as well as branch stubs each iteration.
1717         (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
1718         insn constants.
1719         (l, hi, ha, write_insn): Move earlier.
1720         (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
1721         (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
1722         plt stubs too.
1723         (Stub_table::update_size): Adjust.
1724         (Stub_table::prev_size, set_prev_size): Delete.
1725         (Stub_table::stub_align): Let --plt-align affect result.
1726         (Stub_table::plt_call_size): Calculate sizes for various stubs.
1727         (Stub_table::branch_stub_size): Use last_plt_size in address calc.
1728         (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
1729         (Stub_table::do_write): Support more stub variants.
1730
1731 2012-12-04  Alan Modra  <amodra@gmail.com>
1732
1733         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
1734         (Target_powerpc::do_define_standard_symbols): New function.
1735
1736 2012-12-03  Alan Modra  <amodra@gmail.com>
1737
1738         * output.h: Formatting, whitespace.
1739
1740 2012-12-03  Alan Modra  <amodra@gmail.com>
1741
1742         * layout.h (Layout::get_executable_sections): Declare.
1743         * layout.cc (Layout::get_executable_sections): New function.
1744         * arm.cc (Target_arm::group_sections): Use it.
1745         (Arm_output_section::group_sections): Delete now redundant test.
1746         * output.cc (Output_reloc::Output_reloc): Add is_relative.
1747         param to handle relative relocs.
1748         * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
1749         (Output_data_reloc::add_absolute): Adjust.
1750         (Output_data_reloc::add_relative): New function.
1751         (Output_data::reset_data_size): New function.
1752         (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
1753         (Output_section::set_addralign): New function.
1754         (Output_section::checkpoint_set_addralign): New function.
1755         (Output_section::clear_section_offsets_need_adjustment): New function.
1756         (Output_section::input_sections): Make public.
1757         * powerpc.cc (class Output_data_brlt_powerpc): New.
1758         (class Stub_table, class Stub_control): New.
1759         (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
1760         stub_table_, set_stub_table, stub_table): New vectors and accessor
1761         functions.
1762         (Target_powerpc::do_may_relax, do_relax, push_branch,
1763         new_stub_table, stub_tables, brlt_section, group_sections,
1764         add_branch_lookup_table, find_branch_lookup_table,
1765         write_branch_lookup_table, make_brlt_section): New functions.
1766         (Target_powerpc::struct Sort_sections, class Branch_info): New.
1767         (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
1768         branch_info_): New vars.
1769         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
1770         make call stubs here.
1771         (Output_data_glink): Remove all call stub handling from this class.
1772         (Target_powerpc::Scan::local, global): Save interesting branch
1773         relocs and relocs for ifunc.  Adjust calls to plt entry functions.
1774         (Target_powerpc::do_finalize_sections): Only make reg save/restore
1775         functions on final link.
1776         (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
1777         Handle long branch destinations too.
1778         (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
1779         do_plt_address_for_local): Adjust lookup of plt call stubs.
1780
1781 2012-11-30  Alan Modra  <amodra@gmail.com>
1782
1783         * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
1784         relocs against protected symbols when building 32-bit shared libs.
1785
1786 2012-11-30  Alan Modra  <amodra@gmail.com>
1787
1788         * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
1789         param.  Call got_section() to make .got.  Update all callers
1790         and their callers and so on.
1791
1792 2012-11-30  Alan Modra  <amodra@gmail.com>
1793
1794         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
1795         _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
1796         (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
1797         value if it already exists.
1798
1799 2012-11-19  H.J. Lu  <hongjiu.lu@intel.com>
1800
1801         PR gold/14858
1802         * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
1803
1804 2012-11-14  Roland McGrath  <mcgrathr@google.com>
1805
1806         * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
1807         than bfc instruction for data sandboxing.
1808
1809 2012-11-08  Alan Modra  <amodra@gmail.com>
1810
1811         * po/POTFILES.in: Regenerate.
1812
1813 2012-11-05  Alan Modra  <amodra@gmail.com>
1814
1815         * configure.ac: Apply 2012-09-10 change to config.in here.
1816         * configure: Regenerate.
1817
1818 2012-11-05  Alan Modra  <amodra@gmail.com>
1819
1820         * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
1821         (struct Opd_ent): Use "Address" rather than "Offset".
1822         (Output_data_got_powerpc::got_base_offset): Return Valtype.
1823         (Target_powerpc::got_section): Make public.
1824         (Target_powerpc::scan_relocs): Move code setting symbols..
1825         (Powerpc_relobj::do_scan_relocs): ..to here, new function.
1826         Create _SDA_BASE_ only when referenced.
1827
1828 2012-11-02  Roland McGrath  <mcgrathr@google.com>
1829
1830         * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
1831         from last change.
1832
1833 2012-11-01  Roland McGrath  <mcgrathr@google.com>
1834
1835         * target.h (Sized_target::relocate_relocs): Use Elf_Off
1836         for offset_in_output_section parameter.
1837         (Sized_target::relocate_special_relocatable): Likewise.
1838         * arm.cc (Target_arm::relocate_relocs): Likewise.
1839         (Target_arm::relocate_special_relocatable): Likewise.
1840         * i386.cc (Target_i386::relocate_relocs): Likewise.
1841         * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
1842         * sparc.cc (Target_sparc::relocate_relocs): Likewise.
1843         * target-reloc.h (relocate_relocs): Likewise.
1844         * testsuite/testfile.cc (Target_test): Likewise.
1845         * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
1846         * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
1847
1848         * system.h: Move inclusion of <clocale> to after <libintl.h> in
1849         [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
1850
1851         * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
1852         parameter, which is unused in the [!F_SETFD] case.
1853
1854         * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
1855         SYMNDX to off_t before comparing it to this->data_size().
1856         * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
1857         * incremental.cc (Output_section_incremental_inputs::do_write):
1858         Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
1859
1860         * nacl.cc: Include "libiberty.h" for vasprintf declaration.
1861
1862 2012-10-30  Steve McIntyre  <steve.mcintyre@linaro.org>
1863
1864         * gold.cc (Target_arm::do_adjust_elf_header): Add the
1865         hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
1866         in EABI_VER5.
1867
1868 2012-10-29  Cary Coutant  <ccoutant@google.com>
1869
1870         * dwp.cc (usage): Add file and exit status parameters;
1871         add --help and --version options.
1872         (print_version): New function.
1873         (main): Add --help and --version options.
1874
1875 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1876
1877         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
1878         final_layout_sequence.txt.
1879         * testsuite/Makefile.in: Regenerated.
1880
1881 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1882
1883         * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
1884         COMPILE generated by automake.
1885         (LINK1): Likewise.
1886         (CXXCOMPILE1): Likewise.
1887         (CXXLINK1): Likewise.
1888         (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
1889         (LINK): Likewise.
1890         (CXXCOMPILE): Likewise.
1891         (CXXLINK): Likewise.
1892         * testsuite/Makefile.in: Regenerated.
1893
1894 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1895
1896         * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
1897         on bad fwrite return.
1898
1899 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1900
1901         * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
1902         on val.
1903
1904 2012-10-23  Cary Coutant  <ccoutant@google.com>
1905
1906         * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
1907         * testsuite/Makefile.in: Regenerate.
1908         * testsuite/dwp_test.h: New source file.
1909         * testsuite/dwp_test_1.cc: New source file.
1910         * testsuite/dwp_test_1.s: New source file.
1911         * testsuite/dwp_test_1.sh: New source file.
1912         * testsuite/dwp_test_1b.cc: New source file.
1913         * testsuite/dwp_test_1b.s: New source file.
1914         * testsuite/dwp_test_2.cc: New source file.
1915         * testsuite/dwp_test_2.s: New source file.
1916         * testsuite/dwp_test_2.sh: New source file.
1917         * testsuite/dwp_test_main.cc: New source file.
1918         * testsuite/dwp_test_main.s: New source file.
1919
1920 2012-10-23  Cary Coutant  <ccoutant@google.com>
1921
1922         * dwp.h: New header file.
1923         * dwp.cc: New source file.
1924         * gold.h: Move shared declarations to system.h.
1925         * system.h: New header file.
1926         * Makefile.am: Add dwp.
1927         * Makefile.in: Regenerate.
1928
1929 2012-10-23  Cary Coutant  <ccoutant@google.com>
1930
1931         * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
1932         Dwarf_info_reader::read_from_pointer.
1933         (Dwarf_pubnames_table::read_header): Likewise.
1934         (Dwarf_pubnames_table::next_name): Likewise.
1935         (Dwarf_die::read_attributes): Likewise.
1936         (Dwarf_die::skip_attributes): Likewise.
1937         (Dwarf_info_reader::read_from_pointer): New function template.
1938         * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
1939         (Dwarf_pubnames_table): Likewise.
1940         (Dwarf_info_reader::read_from_pointer): New function template.
1941         * gdb-index.cc (Gdb_index_info_reader): Adjust call to
1942         Dwarf_pubnames_table ctor.
1943
1944 2012-10-23  Cary Coutant  <ccoutant@google.com>
1945
1946         * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
1947         abbrev_shndx.
1948         * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
1949         abbrev_shndx_.
1950         (Dwarf_info_reader::set_abbrev_shndx): New method.
1951         (Dwarf_info_reader::abbrev_shndx_): New data member.
1952
1953 2012-10-23  Cary Coutant  <ccoutant@google.com>
1954
1955         * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
1956         from object, not parameters.
1957         (Dwarf_info_reader::parse): Likewise.
1958         * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
1959         (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
1960         (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
1961         methods.
1962
1963 2012-10-23  Cary Coutant  <ccoutant@google.com>
1964
1965         * fileread.cc (Input_file::Input_file): New constructor.
1966         * fileread.h (class Input_file): Add new constructor.
1967
1968 2012-10-18  Alan Modra  <amodra@gmail.com>
1969
1970         PR gold/14727
1971         * object.cc (Relobj::is_section_name_included): Also match
1972         .sdata personality section.
1973
1974 2012-10-18  Alan Modra  <amodra@gmail.com>
1975
1976         * target-reloc.h (class Default_comdat_behavior): New, package up..
1977         (get_comdat_behaviour): ..this.
1978         (relocate_section): Add Relocate_comdat_behavior template arg,
1979         adjust code to suit.
1980         * arm.cc (Target_arm::relocate_section): Adjust to suit.
1981         (Target_arm::scan_reloc_section): Likewise.
1982         * i386.cc (Target_i386::relocate_section): Likewise.
1983         * sparc.cc (Target_sparc::relocate_section): Likewise.
1984         * tilegx.cc (Target_tilegx::relocate_section): Likewise.
1985         * x86_64.cc (Target_x86_64::relocate_section): Likewise.
1986         * powerpc.cc (class Relocate_comdat_behavior): New.
1987         (Target_powerpc::relocate_section): Don't zap opd relocs.  Supply
1988         gold::relocate_section with new template arg.
1989
1990 2012-10-18  Alan Modra  <amodra@gmail.com>
1991
1992         * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
1993         dynamic relocs for GOT_TPREL got entries, without symbol if
1994         resolving locally.
1995         (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
1996         (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
1997         (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
1998
1999 2012-10-17  Alan Modra  <amodra@gmail.com>
2000
2001         PR gold/14726
2002         * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
2003
2004 2012-10-16  Sriraman Tallam  <tmsriram@google.com>
2005
2006         * layout.cc (Layout::include_section): Keep sections marked
2007         SHF_EXCLUDE when doing relocatable links.
2008
2009 2012-10-16  Alan Modra  <amodra@gmail.com>
2010
2011         * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
2012         (Target_powerpc::do_finalize_sections): Call it.
2013         (Output_data_save_res): New class and supporting functions.
2014         (Target_powerpc::symval_for_branch): Only look up .opd entry for
2015         normal symbols defined in object files.
2016
2017 2012-10-12  Alan Modra  <amodra@gmail.com>
2018
2019         * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
2020         (struct Opd_ent): Make "discard" a bit field.  Add "gc_mark".
2021         (Target_powerpc::do_gc_mark_symbol): Delay marking function code
2022         section if scan_opd_relocs not yet called.
2023         (Target_powerpc::gc_process_relocs): Call process_gc_mark.
2024
2025 2012-10-12  Alan Modra  <amodra@gmail.com>
2026
2027         * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
2028         add_local_ifunc_entry): Revert last change.
2029         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
2030
2031 2012-10-05  Alan Modra  <amodra@gmail.com>
2032
2033         * powerpc.cc (Target_powerpc::do_plt_address_for_local,
2034         do_plt_address_for_global): New functions.
2035         (Output_data_got_powerpc::do_write): Don't segfault when linking
2036         statically.
2037         (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
2038         add_local_ifunc_entry): Return true on adding entry..
2039         (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
2040         glink->add_entry call.  Remove unused symtab param.  Adjust calls.
2041         (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
2042         (Target_powerpc::make_iplt_section): Remove symtab param.  Don't
2043         set up symbols here.
2044         (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
2045         syms here.  Do so even when no .iplt.  Don't segfault when linking
2046         statically.
2047         (Output_data_glink::add_entry, find_entry): Rearrange params.  Add
2048         new variants without reloc param.
2049         (Glink_sym_ent::Glink_sym_ent): Likewise.
2050         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
2051         reloc when refs will resolve to plt call stub.
2052         (Target_powerpc::Scan::local): Correct ifunc handling.  Allow
2053         R_PPC_PLTREL24 to resolve locally.
2054         (Target_powerpc::Scan::global): Correct ifunc handling.
2055         (Target_powerpc::Relocate::relocate): Correct local sym glink
2056         lookup.  Don't destroy "value" when we have a plt call stub,
2057         and when checking plt call validity.
2058         (Target_powerpc::do_dynsym_value): Simplify.
2059
2060 2012-10-05  Alan Modra  <amodra@gmail.com>
2061
2062         * i386.cc (Output_data_plt_i386::address_for_global,
2063         address_for_local): Add plt offset to returned value.  Adjust uses.
2064         * sparc.cc (Output_data_plt_sparc::address_for_global,
2065         address_for_local): Likewise.
2066         * tilegx.cc (Output_data_plt_tilegx::address_for_global,
2067         address_for_local): Likewise.
2068         * x86_64.cc (Output_data_plt_x86_64::address_for_global,
2069         address_for_local): Likewise.
2070         * target.h (Target::plt_address_for_global, plt_address_for_local):
2071         Update comment.
2072         * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
2073         (Output_data_got::Got_entry::write): Nor here.
2074         * output.h: Comment fix.
2075
2076 2012-10-02  Jiong Wang  <jiwang@tilera.com>
2077
2078         * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
2079         global_offset_table_ value for larget got.
2080         (Target_tilegx::Relocate::relocate): Handle adjusted got value.
2081
2082 2012-09-29  Alan Modra  <amodra@gmail.com>
2083
2084         * powerpc.cc (Target_powerpc::iplt_): New output section.
2085         (Target_powerpc::iplt_section, make_iplt_section,
2086         reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
2087         (Target_powerpc::make_plt_entry): Handle ifunc syms.
2088         Target_powerpc::plt_entry_count): Count iplt entries too.
2089         (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
2090         reloc section in constructor.  New params.
2091         (Target_powerpc::make_plt_section): Create reloc section here instead.
2092         (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
2093         functions.
2094         (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
2095         (Output_data_glink::add_entry, find_entry): New functions to
2096         deal with local syms.
2097         (Glink_sym_ent): Add support for local syms.
2098         (Output_data_glink::do_write): Handle ifunc plt entries.
2099         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
2100         (Target_powerpc::Scan::local, global): Handle ifunc syms.
2101         (Target_powerpc::Relocate::relocate): Likewise.
2102         (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
2103
2104 2012-09-25  Alan Modra  <amodra@gmail.com>
2105
2106         * object.h (Sized_relobj_file::adjust_local_symbol,
2107         do_adjust_local_symbol): New functions.
2108         * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
2109         * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
2110         (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
2111         and irregular opd entry spacing.
2112         (Powerpc_relobj::do_read_relocs): Add opd size checks.
2113         (Global_symbol_visitor_opd): New functor.
2114         (Target_powerpc::do_finalize_sections): Omit global symbols defined
2115         on deleted opd entries.
2116
2117 2012-09-15  Jiong Wang  <jiwang@tilera.com>
2118
2119         * tilegx.cc: New file.
2120         * Makefile.am (TARGETSOURCES): Add tilegx.cc
2121         (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
2122         * configure.tgt: Add entries for tilegx*.
2123         * configure.ac: Likewise.
2124         * Makefile.in: Rebuild.
2125         * configure: Likewise.
2126         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
2127         tilegx.
2128
2129 2012-09-13  Alan Modra  <amodra@gmail.com>
2130
2131         * target-reloc.h (scan_relocs): Call scan.local for relocs
2132         against symbols in discarded sections.  Pass is_discarded
2133         param.
2134         * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
2135         Add is_discarded param.
2136         * powerpc (Target_powerpc::Scan::local): Likewise.  Use
2137         is_discarded to flag opd entry as discarded.  Don't emit dyn
2138         relocs on such entries.
2139         (Target_powerpc::Scan::global): Similarly detect and handle
2140         such opd entries.
2141         (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
2142         opd_ent_.  Update all uses.
2143         (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
2144         (Target_powerpc::relocate_section): Zero out discarded opd
2145         entry relocs.
2146
2147 2012-09-12  Ian Lance Taylor  <iant@google.com>
2148
2149         PR gold/14570
2150         * output.cc: Rename Output_data_got template parameter from size
2151         to got_size for all functions.  Compile all variants of
2152         Output_data_got.
2153         (Output_data_got::Got_entry::write): Correct use of size for
2154         symbol value.  Use local_is_tls rather than casting to
2155         Sized_relobj_file.
2156         * object.h (class Object): Add local_is_tls and do_local_is_tls.
2157         (class Sized_relobj_file): Add do_local_is_tls.
2158         * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
2159
2160 2012-09-11  Alan Modra  <amodra@gmail.com>
2161
2162         PR gold/14566
2163         * layout.cc (Layout::set_segment_offsets): When using
2164         common-page-size alignment, ensure we are on a new max-page-size
2165         page.
2166         * output.cc (Output_segment::set_section_addresses): Use
2167         abi_pagesize, not common_pagesize for relro boundary.
2168         (Output_segment::set_offset): Likewise.
2169
2170 2012-09-11  Alan Modra  <amodra@gmail.com>
2171
2172         * output.h (Output_data_got::add_global_tls, add_local_tls,
2173         add_local_tls_pair): New functions.
2174         (Output_data_got::add_local_pair_with_rel): Remove second
2175         reloc param.  Expand comment.
2176         (Output_data_got::Got_entry): Rename use_plt_offset_ to
2177         use_plt_or_tls_offset_, similarly for constructor param.
2178         (Output_data_got::Got_entry::write): Add got_index param.
2179         * output.cc (Output_data_got::add_global_tls, add_local_tls,
2180         add_local_tls_pair): New functions.
2181         (Output_data_got::Got_entry::write): Handle tls symbols
2182         with use_plt_or_tls_offset_ set specially.
2183         (Output_data_got::add_local_pair_with_rel): Only one reloc.
2184         (Output_data_got::do_write): Replace iterator with index, pass
2185         index to entry write function.
2186         * target.h (Target::tls_offset_for_local, tls_offset_for_global,
2187         do_tls_offset_for_local, do_tls_offset_for_global): New functions.
2188         * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
2189         call.
2190         * i386.cc (Target_i386::Scan::local): Likewise.
2191         * sparc.cc (Target_sparc::Scan::local): Likewise.
2192         * x86_64.cc (Target_x86_64::Scan::local): Likewise.
2193         * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
2194         do_tls_offset_for_global): New functions.
2195         (Target_powerpc::Scan::local): Correct TLS relocations and got
2196         entry values.
2197         (Target_powerpc::Scan::global): Don't emit unnecessary
2198         dynamic relocations on TLS GOT entries.
2199
2200 2012-09-10  Matthias Klose  <doko@ubuntu.com>
2201
2202         * config.in: Disable sanity check for kfreebsd.
2203
2204 2012-09-10  Sterling Augustine  <saugustine@google.com>
2205
2206         * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
2207         (Gdb_index::pubtypes_read): New parameter.
2208         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
2209         to calls.
2210         * gdb-index.h (Gdb_index): New fields pubnames_object_ and
2211         pubtypes_object_.
2212
2213 2012-09-09  Alan Modra  <amodra@gmail.com>
2214
2215         * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
2216         (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
2217         * gc.h (gc_process_relocs): Call target gc_add_reference.
2218         * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
2219         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
2220         (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
2221         unnecessary cast.
2222         * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
2223         to cater for when we don't need code offset.  Update use.
2224         (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
2225         (Powerpc_relobj::access_from_map, add_reference, opd_valid,
2226         set_opd_valid): New functions.
2227         (Target_powerpc::do_gc_add_reference): New function.
2228         (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
2229         stashed refs.
2230         (Target_powerpc::do_gc_mark_symbol): New function.
2231
2232 2012-09-06  Cary Coutant  <ccoutant@google.com>
2233
2234         * dwarf_reader.cc (Dwarf_die::read_attributes): Add
2235         DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
2236         (Dwarf_die::skip_attributes): Likewise.
2237         * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
2238         * testsuite/gdb_index_test.cc (inline_func_1): New function.
2239         (main): Call it.
2240         * testsuite/gdb_index_test_comm.sh: Check index for inline function.
2241
2242 2012-09-05  H.J. Lu  <hongjiu.lu@intel.com>
2243
2244         * testsuite/script_test_3.t: Add .got.plt output section
2245         statement.
2246         * testsuite/script_test_4.t: Likewise.
2247
2248 2012-09-05  Alan Modra  <amodra@gmail.com>
2249
2250         * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
2251         update all uses and lose "enum" when using type.
2252
2253 2012-09-05  Alan Modra  <amodra@gmail.com>
2254
2255         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
2256         * configure: Regenerate.
2257         * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
2258         (plugin_final_layout.stdout): Likewise.
2259         (memory_test): Set page sizes to 0x1000.
2260         * testsuite/Makefile.in: Regenerate.
2261         * testsuite/discard_locals_test.sh: Add FIXME comment.
2262         * testsuite/justsyms_exec.c: Disable function test for powerpc64.
2263         * testsuite/pr14265.t: Add .got output section statement.
2264         * testsuite/script_test_2.t: Likewise.
2265         * testsuite/script_test_3.t: Likewise.
2266         * testsuite/script_test_4.t: Likewise.
2267         * testsuite/script_test_5.t: Likewise.
2268         * testsuite/script_test_6.t: Likewise.
2269         * testsuite/script_test_7.t: Likewise.
2270         * testsuite/script_test_9.t: Likewise.
2271
2272 2012-09-05  Alan Modra  <amodra@gmail.com>
2273
2274         * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
2275         (Powerpc_relocate_functions::Status): New typedef.
2276         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
2277         (Target_powerpc::Scan::local): Handle REL64.
2278         (Target_powerpc::Scan::global): Likewise, and dynamic relocs
2279         for REL32 and REL64.
2280         (Target_powerpc::symval_for_branch): New function, extracted from..
2281         (Target_powerpc::Relocate::relocate): ..here.  Correct plt call
2282         checks.  Report overflow errors.
2283
2284 2012-09-05  Alan Modra  <amodra@gmail.com>
2285
2286         * object.h (Sized_relobj_file::emit_relocs): Delete.
2287         (Sized_relobj_file::emit_relocs_reltype): Delete.
2288         * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
2289         relocate_relocs for --emit-relocs.
2290         (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
2291         * output.h: Update comment.
2292         (Output_segment::first_section): New function.
2293         (Output_segment::first_section_load_address): Use first_section.
2294         * output.cc (Output_segment::first_section): New function extracted..
2295         (Output_segment::first_section_load_address): ..from here.  Delete.
2296         * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
2297         * target.h (Sized_target::relocate_for_relocatable): Likewise.
2298         * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
2299         adjust call to target.h function.
2300         * i386.cc (Target_i386): Likewise.
2301         * sparc.cc (Target_sparc): Likewise.
2302         * x86_64.cc (Target_x86_64): Likewise.
2303         * powerpc.cc (Target_powerpc): Likewise.
2304         (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS.  Ensure
2305         first tls section has section symbol for optimised local dynamic
2306         output relocs.
2307         (Target_powerpc::Relocate::relocate): Correct local dynamic value.
2308         (Target_powerpc::relocate_relocs): Adjust relocs emitted for
2309         optimised tls code.
2310         * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
2311         Rename to relocate_relocs.  Update error message.
2312
2313 2012-09-04  Andreas Schwab  <schwab@linux-m68k.org>
2314
2315         * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
2316         --just-symbols.
2317
2318 2012-08-31  Alan Modra  <amodra@gmail.com>
2319
2320         * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
2321         (Powerpc_relobj::toc_base_offset): New stub function.
2322         (Target_powerpc): Add tp_offset, dtp_offset.  Rename
2323         got_mod_index_offset to tlsld_got_offset.  Update all refs.
2324         (Target_powerpc::Relocate::enum skip_tls): New.
2325         (Target_powerpc::call_tls_get_addr_): New var.
2326         (Target_powerpc::is_branch_reloc): Move to file scope.
2327         (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
2328         (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
2329         New functions.
2330         (Target_powerpc::enum Got_type): Delete old values, add new ones.
2331         (powerpc_info): Correct common_pagesize for ppc64.
2332         (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
2333         (Powerpc_relocate_functions): Add overflow check enums and functions.
2334         Add non-shift version of rela, rela_ua.  Delete all rel public
2335         functions.  Delete addr16_lo.  Add addr64, addr64_u, addr32,
2336         addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
2337         addr16_ha3, addr14 functions.
2338         (Output_data_got_powerpc::add_constant_pair): New function.
2339         (Output_data_got_powerpc::got_base_offset): Likewise.
2340         (Output_data_got_powerpc::do_write): Correct 64-bit got header.
2341         (instruction constants): Sort, add some more.
2342         (Output_data_glink::do_write): Add and use Address typedef.  Use
2343         object->toc_base_offset() stub for 64-bit.
2344         (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
2345         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
2346         (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
2347         for R_PPC64_TOC.  Handle more relocs.  Generate got entries for TLS.
2348         Always treat .opd relocs as against locally defined symbol.
2349         Correct condition for RELATIVE relocs.
2350         (Target_powerpc::do_finalize_sections): Test for NULL sections.
2351         (Target_powerpc::Relocate::relocate): Use plt call stub as value
2352         for 32-bit syms with a plt entry.  Correct ppc64 toc base
2353         calculations.  Handle TLS relocs, and more.  Add overflow
2354         checking and adjust for Powerpc_relocate_functions changes.
2355         (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
2356         Reinstate --emit-relocs code with FIXME.
2357
2358 2012-08-30  Alan Modra  <amodra@gmail.com>
2359
2360         * layout.cc (Layout::set_segment_offsets): Set p_align to
2361         abi_pagesize, not common_pagesize.
2362         (Layout::relaxation_loop_body): Similarly use abi_pagesize
2363         to determine whether file header can go in segment.
2364
2365 2012-08-30  Alan Modra  <amodra@gmail.com>
2366
2367         * output.h (Output_reloc::Output_reloc <output section>): Add
2368         is_relative param.  Adjust calls.
2369         (Output_reloc::add_output_section_relative): New functions.
2370         * output.cc (Output_reloc::Output_reloc <output section>): Handle
2371         is_relative.
2372         (Output_reloc::symbol_value): Handle SECTION_CODE.
2373
2374 2012-08-24  Sriraman Tallam  <tmsriram@google.com>
2375
2376         * gold.cc (queue_middle_tasks): Call layout again when unique
2377         segments for sections is desired.
2378         * layout.cc (Layout::Layout): Initialize new members.
2379         (Layout::get_output_section_flags): New function.
2380         (Layout::choose_output_section): Call get_output_section_flags.
2381         (Layout::layout): Make output section for mapping to a unique segment.
2382         (Layout::insert_section_segment_map): New function.
2383         (Layout::attach_allocated_section_to_segment): Make unique segment for
2384         output sections marked so.
2385         (Layout::segment_precedes): Check for unique segments when sorting.
2386         * layout.h (Layout::Unique_segment_info): New struct.
2387         (Layout::Section_segment_map): New typedef.
2388         (Layout::insert_section_segment_map): New function.
2389         (Layout::get_output_section_flags): New function.
2390         (Layout::is_unique_segment_for_sections_specified): New function.
2391         (Layout::set_unique_segment_for_sections_specified): New function.
2392         (Layout::unique_segment_for_sections_specified_): New member.
2393         (Layout::section_segment_map_): New member.
2394         * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
2395         Rename is_gc_pass_one to is_pass_one.
2396         Rename is_gc_pass_two to is_pass_two.
2397         Rename is_gc_or_icf to is_two_pass.
2398         Check for which pass based on whether symbols data is present.
2399         Make it two pass when unique segments for sections is desired.
2400         * output.cc (Output_section::Output_section): Initialize new
2401         members.
2402         * output.h (Output_section::is_unique_segment): New function.
2403         (Output_section::set_is_unique_segment): New function.
2404         (Output_section::is_unique_segment_): New member.
2405         (Output_section::extra_segment_flags): New function.
2406         (Output_section::set_extra_segment_flags): New function.
2407         (Output_section::extra_segment_flags_): New member.
2408         (Output_section::segment_alignment): New function.
2409         (Output_section::set_segment_alignment): New function.
2410         (Output_section::segment_alignment_): New member.
2411         (Output_segment::Output_segment): Initialize is_unique_segment_.
2412         (Output_segment::is_unique_segment): New function.
2413         (Output_segment::set_is_unique_segment): New function.
2414         (Output_segment::is_unique_segment_): New member.
2415         * plugin.cc (allow_unique_segment_for_sections): New function.
2416         (unique_segment_for_sections): New function.
2417         (Plugin::load): Add new functions to transfer vector.
2418         * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
2419         * Makefile.in: Regenerate.
2420         * testsuite/plugin_final_layout.sh: Check if unique segment
2421         functionality works.
2422         * testsuite/plugin_section_order.c (onload): Check if new interfaces
2423         are available.
2424         (allow_unique_segment_for_sections): New global.
2425         (unique_segment_for_sections): New global.
2426         (claim_file_hook): Call allow_unique_segment_for_sections.
2427         (all_symbols_read_hook): Call unique_segment_for_sections.
2428
2429 2012-08-22  Cary Coutant  <ccoutant@google.com>
2430
2431         * layout.cc (Layout::include_section): Don't assert on GROUP
2432         sections with --emit-relocs.
2433
2434 2012-08-21  Cary Coutant  <ccoutant@google.com>
2435
2436         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
2437         if --export-dynamic-symbol names an undef symbol.
2438
2439 2012-08-18  Alan Modra  <amodra@gmail.com>
2440
2441         * powerpc.cc: Formatting and white space.
2442         (Powerpc_relobj): Rename got2_section_ to special_.
2443         Add opd_ent_shndx_ and opd_ent_off_ vectors.
2444         (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
2445         scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
2446         (Target_powerpc): Add Address typedef and invalid_address.  Use
2447         throughout.
2448         (Target_powerpc::is_branch_reloc): New function.
2449         (Powerpc_relocate_functions): Add Address typedef, use throughout.
2450         (Powerpc_relocate_functions:rela, rela_ua): Correct type used
2451         for dst_mask, value and addend.
2452         (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
2453         (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
2454         (Output_data_glink::do_write): Correct toc base.  Don't try to use
2455         uint16_t for 24-bit offset.  Use get_output_section_offset and
2456         check return.
2457         (Target_powerpc::Scan::local): Handle more relocs.
2458         (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
2459         (Target_powerpc::Relocate::relocate): Correct toc base calculation.
2460         Plug in toc restoring insn after plt calls.  Translate branches
2461         to function descriptor symbols to corresponding entry point.
2462         (Target_powerpc::relocate_for_relocatable): Check return from
2463         get_output_section_offset.
2464         * symtab.h: Comment typo.
2465
2466 2012-08-14  Ian Lance Taylor  <iant@google.com>
2467
2468         * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
2469         unsupported_relocal_local to call unsupported_reloc_global.
2470
2471 2012-08-14  Nick Clifton  <nickc@redhat.com>
2472
2473         PR ld/14265
2474         * script-sections.cc (Sections_element::output_section_name): Add
2475         keep return parameter.
2476         (Output_section_element::match_name): Add keep return parameter.
2477         Return the value of the keep_ member.
2478         * script-sections.h (class Output_section): Update
2479         output_section_name prototype.
2480         * layout.cc (Layout::keep_input_section): New public member
2481         function.
2482         (Layout::choose_output_section): Pass keep parameter to
2483         output_section_name.
2484         * layout.h (class Layout): Add keep_input_section.
2485         * object.cc (Sized_relobj_file::do_layout): Check for kept input
2486         sections.
2487         * testsuite/Makefile.am: Add a test.
2488         * testsuite/Makefile.in: Regenerate.
2489         * testsuite/pr14265.c: Source file for the test.
2490         * testsuite/pr14265.t: Linker script for the test.
2491         * testsuite/pr14265.sh: Shell script for the test.
2492
2493 2012-08-14  Alan Modra  <amodra@gmail.com>
2494
2495         * target.h (Target::output_section_name): New function.
2496         (Target::do_output_section_name): New function.
2497         * layout.cc (Layout::choose_output_section): Call the above.
2498         * powerpc.cc (Target_powerpc::do_output_section_name): New function.
2499
2500 2012-08-14  Alan Modra  <amodra@gmail.com>
2501
2502         * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
2503         (Output_data_got_powerpc::do_write): Don't rely on base class lookup
2504         for replace_constant call.
2505         (Output_data_plt_powerpc::do_print_to_mapfile): New function.
2506         (Output_data_glink::do_print_to_mapfile): New function.
2507         (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
2508         (Target_powerpc::Relocate::relocate): Likewise.
2509
2510 2012-08-14  Alan Modra  <amodra@gmail.com>
2511
2512         * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
2513         (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
2514         (Output_data_glink::add_entry,find_entry): Remove shndx param.
2515         (class Glink_sym_ent): Rename from struct Glink_sym_ent.  Remove
2516         all references to shndx_.  Handle special case for R_PPC_PLTREL24
2517         here.
2518         (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
2519         (Output_data_glink::do_write): Retrieve got2_shdnx from object.
2520         (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
2521         here.
2522         (Target_powerpc::Scan::global): Nor on make_plt_entry call.
2523         (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
2524
2525 2012-08-12  Alan Modra  <amodra@gmail.com>
2526
2527         * powerpc.cc: Whitespace fixes.  Wrap overly long lines.
2528         (glink insn constants): Use uint32_t.
2529         (Output_data_glink::add_entry): Use insert, not [] operator.
2530
2531 2012-08-11  Alan Modra  <amodra@gmail.com>
2532
2533         * object.h (Sized_relobj_file::find_shdr): New function.
2534         (Sized_relobj_file::find_special_sections): New function.
2535         * object.cc (Sized_relobj_file::find_shdr): New function.
2536         (Sized_relobj_file::find_eh_frame): Use find_shdr.
2537         (Sized_relobj_file::find_special_sections): New function, split out..
2538         (Sized_relobj_file::do_read_symbols): ..from here.
2539         * output.h (Output_data_got::replace_constant): New function.
2540         (Output_data_got::num_entries): New function.
2541         (Output_data_got::last_got_offset,set_got_size): Use num_entries.
2542         (Output_data_got::got_offset): Protected rather than private.
2543         (Output_data_got::replace_got_entry): New function.
2544         * output.cc (Output_data_got::replace_got_entry): New function.
2545         * powerpc.cc (class Powerpc_relobj): New.
2546         (class Powerpc_relocate_functions): Delete all psymval variants or
2547         convert to value,addend type.  Delete pcrela, pcrela_unaligned.
2548         Implement _ha functions using corresponding _hi function.
2549         (Powerpc_relobj::find_special_sections): New function.
2550         (Target_powerpc::do_make_elf_object): New function.
2551         (class Output_data_got_powerpc): New.
2552         (class Output_data_glink): New.
2553         (class Powerpc_scan_relocatable_reloc): New.
2554         Many more changes througout file.
2555
2556 2012-08-09  Nick Clifton  <nickc@redhat.com>
2557
2558         * po/vi.po: Updated Vietnamese translation.
2559
2560 2012-08-07  Ian Lance Taylor  <iant@google.com>
2561
2562         * layout.cc (Layout::add_target_dynamic_tags): If
2563         dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
2564         plt_rel.
2565
2566 2012-07-30  Nick Clifton  <nickc@redhat.com>
2567
2568         * po/gold.pot: Updated template.
2569         * po/es.po: Updated Spanish translation.
2570
2571 2012-07-18  Cary Coutant  <ccoutant@google.com>
2572
2573         PR gold/14344
2574         * configure.ac: Add check for -gpubnames support.
2575         * configure: Regenerate.
2576         * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
2577         support; force -gno-pubnames.
2578         (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
2579         support.
2580         (gdb_index_test_4): New test.
2581         * testsuite/Makefile.in: Regenerate.
2582         * testsuite/gdb_index_test_1.sh: Refactor code into common file.
2583         * testsuite/gdb_index_test_2.sh: Likewise.
2584         * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
2585         * testsuite/gdb_index_test_4.sh: New script.
2586         * testsuite/gdb_index_test_comm.sh: New script with common code;
2587         don't look for space after colon.
2588
2589 2012-07-16  Sriraman Tallam  <tmsriram@google.com>
2590
2591         * gold.cc (queue_middle_tasks): Update function order only after
2592         deferred objects due to plugins are processed.
2593
2594 2012-07-11  Ian Lance Taylor  <iant@google.com>
2595
2596         * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
2597         (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
2598         (Target_arm::scan_reloc_for_stub): Likewise.
2599         * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
2600         * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
2601         * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
2602         * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
2603         * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
2604
2605 2012-07-10  Dodji Seketeli  <dodji@redhat.com>
2606             Ian Lance Taylor  <iant@google.com>
2607
2608         PR gold/14309
2609         * configure.ac: Test whether std::tr1::hash<off_t> works.
2610         * gold.h: Add a specialization for std::tr1::hash<off_t> if
2611         needed.
2612         * output.h (class Output_fill): Add virtual destructor.
2613         * configure, config.in: Rebuild.
2614
2615 2012-06-22  Roland McGrath  <mcgrathr@google.com>
2616
2617         * layout.cc (finalize): Define __ehdr_start symbol if applicable.
2618
2619 2012-06-12  Rafael Ávila de Espíndola <respindola@mozilla.com>
2620
2621         * plugin.cc (Plugin::load): Handle position independent executables.
2622
2623 2012-06-06  Cary Coutant  <ccoutant@google.com>
2624
2625         * layout.cc (gdb_sections): Remove ".debug_" prefixes,
2626         add .debug_macro.
2627         (lines_only_debug_sections): Likewise.
2628         (gdb_fast_lookup_sections): New static array.
2629         (is_gdb_debug_section): Rename formal parameter.
2630         (is_lines_only_debug_section): Likewise.
2631         (is_gdb_fast_lookup_section): New function.
2632         (Layout::include_section): Check for ".zdebug_" prefix; pass
2633         section name suffix to is_gdb_debug_section, et al.; check for
2634         fast-lookup sections when building .gdb_index.
2635         * options.h (--strip-debug-gdb): Update GDB version number.
2636
2637 2012-06-06  Cary Coutant  <ccoutant@google.com>
2638
2639         * configure.ac: Add check for fallocate.
2640         * configure: Regenerate.
2641         * config.in: Regenerate.
2642
2643         * options.h (class General_options): Add --mmap-output-file and
2644         --posix-fallocate options.
2645         * output.cc: (posix_fallocate): Remove; replace with...
2646         (gold_fallocate): New function.
2647         (Output_file::map_no_anonymous): Call gold_fallocate.
2648         (Output_file::map): Check --mmap-output-file option.
2649
2650 2012-06-05  Jing Yu  <jingyu@google.com>
2651
2652         * gold.h (textdomain): Add do {} to empty while(0).
2653         (bindtextdomain): Likewise.
2654
2655 2012-06-04  Cary Coutant  <ccoutant@google.com>
2656
2657         * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
2658         has_dynsym_index.
2659
2660 2012-05-25  Sriraman Tallam  <tmsriram@google.com>
2661
2662         * symtab.cc (Symbol_table::define_special_symbol):
2663         Initialize *poldsym to prevent uninitialized variable errors.
2664
2665 2012-05-23  Cary Coutant  <ccoutant@google.com>
2666
2667         * layout.cc (Layout::section_name_mapping): Add rules to handle
2668         exact match on .data.rel.ro.local or .data.rel.ro.
2669         (Layout::output_section_name): Check for exact matches.
2670
2671 2012-05-23  Cary Coutant  <ccoutant@google.com>
2672
2673         * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
2674         more carefully.
2675
2676 2012-05-22  Cary Coutant  <ccoutant@google.com>
2677
2678         * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
2679         object before exporting symbol.
2680
2681 2012-05-21  H.J. Lu  <hongjiu.lu@intel.com>
2682
2683         * testsuite/tls_test.cc: Include "config.h" first.
2684         * testsuite/tls_test_c.c: Likewise.
2685
2686 2012-05-17  Daniel Richard G.  <skunk@iskunk.org>
2687             Nick Clifton  <nickc@redhat.com>
2688
2689         PR 14072
2690         * configure.in: Add check that sysdep.h has been included before
2691         any system header files.
2692         * configure: Regenerate.
2693         * config.in: Regenerate.
2694
2695 2012-05-14  Cary Coutant  <ccoutant@google.com>
2696
2697         * layout.cc (Layout::make_output_section): Mark .tdata section
2698         as RELRO.
2699         * testsuite/relro_test.cc: Add a TLS variable.
2700
2701 2012-05-10  H.J. Lu  <hongjiu.lu@intel.com>
2702
2703         PR gold/14091
2704         * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
2705         R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
2706         R_X86_64_64.
2707
2708 2012-05-08  Cary Coutant  <ccoutant@google.com>
2709
2710         * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
2711         (lines_only_debug_sections): Likewise.
2712
2713 2012-05-02  Roland McGrath  <mcgrathr@google.com>
2714
2715         * nacl.cc: New file.
2716         * nacl.h: New file.
2717         * Makefile.am (CCFILES, HFILES): Add them.
2718         * Makefile.in: Regenerate.
2719         * i386.cc (Output_data_plt_i386_nacl): New class.
2720         (Output_data_plt_i386_nacl_exec): New class.
2721         (Output_data_plt_i386_nacl_dyn): New class.
2722         (Target_i386_nacl): New class.
2723         (Target_selector_i386_nacl): New class.
2724         (target_selector_i386): Use it instead of Target_selector_i386.
2725         * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
2726         (Target_x86_64_nacl): New class.
2727         (Target_selector_x86_64_nacl): New class.
2728         (target_selector_x86_64, target_selector_x32): Use it instead of
2729         Target_selector_x86_64.
2730         * arm.cc (Output_data_plt_arm_nacl): New class.
2731         (Target_arm_nacl): New class.
2732         (Target_selector_arm_nacl): New class.
2733         (target_selector_arm, target_selector_armbe): Use it instead of
2734         Target_selector_arm.
2735
2736         * target-select.cc (select_target): Take new Input_file* and off_t
2737         arguments, pass them on to recognize method of selector.
2738         * object.cc (make_elf_sized_object): Update caller.
2739         * parameters.cc (parameters_force_valid_target): Likewise.
2740         * incremental.cc (make_sized_incremental_binary): Likewise.
2741         * target-select.h: Update decl.
2742         (Target_selector::recognize): Take new Input_file* argument,
2743         pass it on to do_recognize.
2744         (Target_selector::do_recognize): Take new Input_file* argument.
2745         * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
2746         * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
2747         * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
2748         * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
2749
2750         * target.h (Target::Target_info): New members isolate_execinstr
2751         and rosegment_gap.
2752         (Target::isolate_execinstr, Target::rosegment_gap): New methods.
2753         * arm.cc (Target_arm::arm_info): Update initializer.
2754         * i386.cc (Target_i386::i386_info): Likewise.
2755         * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
2756         * sparc.cc (Target_sparc::sparc_info): Likewise.
2757         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
2758         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
2759         * layout.cc (Layout::attach_allocated_section_to_segment):
2760         Take new const Target* argument.  If target->isolate_execinstr(), act
2761         like --rosegment.
2762         (Layout::find_first_load_seg): Take new const Target* argument;
2763         if target->isolate_execinstr(), reject PF_X segments.
2764         (Layout::relaxation_loop_body): Update caller.
2765         (Layout::set_segment_offsets): If target->isolate_execinstr(),
2766         reset file offset to zero when we hit LOAD_SEG, and then do a second
2767         loop over the segments before LOAD_SEG to reassign offsets after
2768         addresses have been determined.  Handle target->rosegment_gap().
2769         (Layout::attach_section_to_segment): Take new const Target* argument;
2770         pass it to attach_allocated_section_to_segment.
2771         (Layout::make_output_section): Update caller.
2772         (Layout::attach_sections_to_segments): Take new const Target* argument;
2773         pass it to attach_section_to_segment.
2774         * gold.cc (queue_middle_tasks): Update caller.
2775         * layout.h (Layout): Update method decls with new arguments.
2776
2777         * arm.cc (Target_arm::Target_arm): Take optional argument for the
2778         Target_info pointer to use.
2779         (Target_arm::do_make_data_plt): New virtual method.
2780         (Target_arm::make_data_plt): New method that calls it.
2781         (Target_arm::make_plt_entry): Use it.
2782         (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
2783         for the section alignment.
2784         (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
2785         method.
2786         (Output_data_plt_arm::first_plt_entry_offset): Call it.
2787         (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
2788         method.
2789         (Output_data_plt_arm::get_plt_entry_size): Call it.
2790         (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
2791         (Output_data_plt_arm::fill_plt_entry): New method that calls it.
2792         (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
2793         method.
2794         (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
2795         (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
2796         method instead of sizeof(plt_entry).
2797         (Output_data_plt_arm::add_entry): Likewise.
2798         Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
2799         (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
2800         than static method.
2801         (Target_arm::plt_entry_size): Likewise.
2802         (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
2803         Move to ...
2804         (Output_data_plt_arm_standard): ... here, new class.
2805         (Output_data_plt_arm::do_write): Move guts of PLT filling to...
2806         (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
2807         (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
2808
2809         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
2810         Take additional argument for the PLT entry size.
2811         (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
2812         Use get_plt_entry_size method rather than plt_entry_size variable.
2813         (Output_data_plt_x86_64::reserve_slot): Likewise.
2814         (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
2815         (Output_data_plt_x86_64::add_entry): Likewise.
2816         (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
2817         (Output_data_plt_x86_64::address_for_global): Likewise.
2818         (Output_data_plt_x86_64::address_for_local): Likewise.
2819         (Output_data_plt_x86_64::set_final_data_size): Likewise.
2820         (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
2821         Make method non-static.
2822         (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
2823         method.
2824         (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
2825         (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
2826         (Output_data_plt_x86_64::add_eh_frame): New method to call it.
2827         (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
2828         virtual method.
2829         (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
2830         (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
2831         virtual method.
2832         (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
2833         (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
2834         virtual method.
2835         (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
2836         (Output_data_plt_x86_64::plt_entry_size)
2837         (Output_data_plt_x86_64::first_plt_entry)
2838         (Output_data_plt_x86_64::plt_entry)
2839         (Output_data_plt_x86_64::tlsdesc_plt_entry)
2840         (Output_data_plt_x86_64::plt_eh_frame_fde_size)
2841         (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
2842         (Output_data_plt_x86_64_standard): ... here, new class.
2843         (Target_x86_64::Target_x86_64): Take optional argument for the
2844         Target_info pointer to use.
2845         (Target_x86_64::do_make_data_plt): New virtual method.
2846         (Target_x86_64::make_data_plt): New method to call it.
2847         (Target_x86_64::init_got_plt_for_update): Use that.
2848         Call this->plt_->add_eh_frame method here.
2849         (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
2850         (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
2851         rather than static method.
2852         (Target_x86_64::plt_entry_size): Likewise.
2853         (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
2854         rather than plt_entry_size variable.  Move guts of PLT filling to...
2855         (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
2856         (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
2857         (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
2858
2859         * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
2860         additional argument for the section alignment.
2861         Don't do add_eh_frame_for_plt here.
2862         (Output_data_plt_i386::first_plt_entry_offset): Make the method
2863         non-static.  Use get_plt_entry_size method rather than plt_entry_size
2864         variable.
2865         (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
2866         method.
2867         (Output_data_plt_i386::get_plt_entry_size): Call it.
2868         (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
2869         (Output_data_plt_i386::add_eh_frame): New method to call it.
2870         (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
2871         method.
2872         (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
2873         (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
2874         method.
2875         (Output_data_plt_i386::fill_plt_entry): New method to call it.
2876         (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
2877         method instead of plt_entry_size.
2878         (Output_data_plt_i386::plt_entry_size)
2879         (Output_data_plt_i386::plt_eh_frame_fde_size)
2880         (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
2881         (Output_data_plt_i386_standard): ... here, new class.
2882         (Output_data_plt_i386_exec): New class.
2883         (Output_data_plt_i386::exec_first_plt_entry): Move to ...
2884         (Output_data_plt_i386_exec::first_plt_entry): ... here.
2885         (Output_data_plt_i386::exec_plt_entry): Move to ...
2886         (Output_data_plt_i386_exec::plt_entry): ... here.
2887         (Output_data_plt_i386_dyn): New class.
2888         (Output_data_plt_i386::first_plt_entry): Move to ...
2889         (Output_data_plt_i386_dyn::first_plt_entry): ... here.
2890         (Output_data_plt_i386::dyn_plt_entry): Move to ...
2891         (Output_data_plt_i386_dyn::plt_entry): ... here.
2892         (Target_i386::Target_i386): Take optional argument for the Target_info
2893         pointer to use.
2894         (Target_i386::do_make_data_plt): New virtual method.
2895         (Target_i386::make_data_plt): New method to call it.
2896         (Target_i386::make_plt_section): Use that.
2897         Call this->plt_->add_eh_frame method here.
2898         (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
2899         rather than plt_entry_size variable.
2900         (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
2901         (Output_data_plt_i386::address_for_local): Likewise.
2902         (Output_data_plt_i386::do_write): Likewise.
2903         Move guts of PLT filling to...
2904         (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
2905         (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
2906         (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
2907         (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
2908
2909 2012-05-01  Cary Coutant  <ccoutant@google.com>
2910
2911         * dwarf_reader.cc (Dwarf_die::read_attributes)
2912         (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
2913         (Dwarf_die::uint_attribute): Remove DW_FORM_null.
2914         * reduced_debug_output.cc
2915         (Output_reduced_debug_info_section::get_die_end): Remove
2916         DW_FORM_GNU_ref_index.  Add default case.
2917
2918 2012-04-26  Mark Wielaard  <mjw@redhat.com>
2919
2920         * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
2921         * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
2922         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
2923         DW_AT_high_pc as offset from DW_AT_low_pc.
2924
2925         * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
2926         * testsuite/Makefile.in: Regenerate.
2927         * testsuite/gdb_index_test_3.c: New test source file.
2928         * testsuite/gdb_index_test_3.sh: New test source file.
2929
2930 2012-04-25  Ian Lance Taylor  <iant@google.com>
2931
2932         * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
2933         pointer.
2934         (Stub_addend_reader::operator()): Declare Arm_relocate_functions
2935         as a class, not a struct.
2936         (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
2937         (Target_arm::apply_cortex_a8_workaround): Likewise.
2938         * gc.h: Declare Reloc_types as a struct, not a class.
2939         * object.h: Declare Symbols_data as a struct.
2940         * reloc.h: Declare Read_relocs_data as a struct.
2941         * target.h: Declare Relocate_info as a struct.
2942
2943 2012-04-24  David S. Miller  <davem@davemloft.net>
2944
2945         * sparc.cc (Target_sparc::Relocate::relax_call): New function.
2946         (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
2947         and R_SPARC_WPLT30.
2948
2949 2012-04-24  Cary Coutant  <ccoutant@google.com>
2950
2951         * incremental-dump.cc (find_input_containing_global): Replace
2952         magic number with symbolic constant.
2953         (dump_incremental_inputs): Update version number.
2954         * incremental.cc (Output_section_incremental_inputs): Update version
2955         number; import symbolic constants from Incremental_inputs_reader.
2956         (Incremental_inputs::create_data_sections): Align relocations
2957         section correctly for 64-bit targets.
2958         (Output_section_incremental_inputs::set_final_data_size): Use symbolic
2959         constants; add padding.
2960         (Output_section_incremental_inputs::write_header): Add assert for
2961         header_size.
2962         (Output_section_incremental_inputs::write_input_files): Add assert
2963         for input_entry_size.
2964         (Output_section_incremental_inputs::write_info_blocks): Add padding;
2965         add assert for object_info_size, input_section_entry_size,
2966         global_sym_entry_size.
2967         * incremental.h (Incremental_inputs_reader): Add symbolic constants
2968         for data structure sizes; use them.
2969         (Incremental_input_entry_reader): Import symbolic constants from
2970         Incremental_inputs_reader; use them.
2971
2972 2012-04-23  David S. Miller  <davem@davemloft.net>
2973
2974         * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
2975         and elf_flags_set_.
2976         (Target_sparc::Target_sparc): Initialize new fields.
2977         (Target_sparc::do_make_elf_object): New function.
2978         (Target_sparc::do_adjust_elf_header): New function.
2979
2980 2012-04-23  Cary Coutant  <ccoutant@google.com>
2981
2982         * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
2983         CU range table of gdb index.
2984
2985 2012-04-20  David S. Miller  <davem@davemloft.net>
2986
2987         * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
2988         instead of false.
2989
2990 2012-04-16  David S. Miller  <davem@davemloft.net>
2991
2992         * sparc.cc (Target_sparc::got_address): New function.
2993         (Sparc_relocate_functions::gdop_hix22): New function.
2994         (Sparc_relocate_functions::gdop_lox10): New function.
2995         (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
2996         relocs.
2997         (Target_sparc::Scan::local): Likewise if the global symbol is not
2998         preemptible and is not IFUNC.
2999         (Target_sparc::Relocate::relocate): Perform GOTDATA code
3000         transformations for local and non-preemptible non-IFUNC global
3001         symbols.
3002
3003         * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
3004         writing out 64-bit part of ranges.
3005
3006         * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
3007         -fpic and -fpie respectively.
3008         * Makefile.in: Regenerate.
3009
3010         * sparc.cc (class Target_sparc): Add rela_ifunc_.
3011         (Target_sparc::Target_sparc): Initialize new field.
3012         (Target_sparc::do_plt_section_for_global): New function.
3013         (Target_sparc::do_plt_section_for_local): New function.
3014         (Target_sparc::reloc_needs_plt_for_ifunc): New function.
3015         (Target_sparc::make_plt_section): New function, broken out of
3016         make_plt_entry.  Use ORDER_NON_RELRO_FIRST for ".plt".
3017         (Target_sparc::make_plt_entry): Call make_plt_section.
3018         (Target_sparc::make_local_ifunc_plt_entry): New function.
3019         (Target_sparc::rela_ifunc_section): New function.
3020         (Target_sparc::plt_section): Remove const.
3021         (Output_data_plt_sparc): Update declarations.  Define Global_ifunc
3022         and Local_ifunc types.  Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
3023         and ifunc_count_ fields.
3024         (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
3025         (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
3026         (Output_data_plt_sparc::add_local_ifunc_entry): New function.
3027         (Output_data_plt_sparc::rela_ifunc): New function.
3028         (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
3029         (Output_data_plt_sparc::has_ifunc_section): New function.
3030         (Output_data_plt_sparc::entry_count): Include ifunc_count_.
3031         (Output_data_plt_sparc::address_for_global): New function.
3032         (Output_data_plt_sparc::address_for_local): New function.
3033         (Output_data_plt_sparc::plt_index_to_offset): New function.
3034         (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
3035         and entry_count.
3036         (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
3037         entry_count.
3038         (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
3039         R_SPARC_JMP_IREL to switch.
3040         (Target_sparc::Scan::check_non_pic): Likewise.
3041         (Target_sparc::Scan::local): Handle IFUNC symbols.
3042         (Target_sparc::Scan::local): Likewise.
3043         (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
3044         and plt_address_for_local.
3045         (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
3046         Define __rel_iplt_start and __rel_iplt_end if doing a static link.
3047
3048         * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
3049         (class Output_data_reloc): Adjust calls to Output_reloc_type.
3050         (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
3051         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
3052         global relocs too.
3053         (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
3054         * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
3055         calls.
3056         * sparc.cc (Target_sparc::Scan::global): Likewise.
3057         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
3058
3059 2012-04-16  Cary Coutant  <ccoutant@google.com>
3060
3061         * archive.cc (Library_base::should_include_member): Check for
3062         --export-dynamic-symbol.
3063         * options.h (class General_options): Add --export-dynamic-symbol.
3064         * symtab.cc (Symbol::should_add_dynsym_entry): Check for
3065         --export-dynamic-symbol.
3066         (Symbol_table::gc_mark_undef_symbols): Likewise.
3067         (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
3068
3069 2012-04-12  David S. Miller  <davem@davemloft.net>
3070
3071         * sparc.cc (Reloc::wdisp10): New relocation method.
3072         (Reloc::h34): Likewise.
3073         (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
3074         (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
3075         R_SPARC_WDISP10.
3076         (Target_sparc::Scan::local): Likewise.
3077         (Target_sparc::Scan::global): Likewise.
3078         (Target_sparc::Relocate::relocate): Likewise.
3079
3080 2012-04-09  Cary Coutant  <ccoutant@google.com>
3081
3082         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
3083         low_pc == 0.
3084
3085 2012-04-06  Ian Lance Taylor  <iant@google.com>
3086
3087         * timer.cc: #include <unistd.h>.
3088
3089 2012-04-06  Roland McGrath  <mcgrathr@google.com>
3090
3091         * configure.in (AC_CHECK_HEADERS): Add locale.h.
3092         * config.in: Regenerate.
3093         * configure: Regenerate.
3094
3095 2012-04-05  Nick Clifton  <nickc@redhat.com>
3096
3097         * configure.ac (AC_CHECK_FUNCS): Add setlocale.
3098         (AM_LC_MESSAGES): Add.
3099         * aclocal.m4: Regenerate.
3100         * config.in: Regenerate.
3101         * configure: Regenerate.
3102
3103 2012-03-21  Cary Coutant  <ccoutant@google.com>
3104
3105         * Makefile.am: Add gdb-index.cc, gdb-index.h.
3106         * Makefile.in: Regenerate.
3107         * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
3108         (Sized_elf_reloc_mapper::symbol_section): New function.
3109         (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
3110         (make_elf_reloc_mapper): New function.
3111         (Dwarf_abbrev_table::clear_abbrev_codes): New function.
3112         (Dwarf_abbrev_table::do_read_abbrevs): New function.
3113         (Dwarf_abbrev_table::do_get_abbrev): New function.
3114         (Dwarf_ranges_table::read_ranges_table): New function.
3115         (Dwarf_ranges_table::read_range_list): New function.
3116         (Dwarf_pubnames_table::read_section): New function.
3117         (Dwarf_pubnames_table::read_header): New function.
3118         (Dwarf_pubnames_table::next_name): New function.
3119         (Dwarf_die::Dwarf_die): New function.
3120         (Dwarf_die::read_attributes): New function.
3121         (Dwarf_die::skip_attributes): New function.
3122         (Dwarf_die::set_name): New function.
3123         (Dwarf_die::set_linkage_name): New function.
3124         (Dwarf_die::attribute): New function.
3125         (Dwarf_die::string_attribute): New function.
3126         (Dwarf_die::int_attribute): New function.
3127         (Dwarf_die::uint_attribute): New function.
3128         (Dwarf_die::ref_attribute): New function.
3129         (Dwarf_die::child_offset): New function.
3130         (Dwarf_die::sibling_offset): New function.
3131         (Dwarf_info_reader::check_buffer): New function.
3132         (Dwarf_info_reader::parse): New function.
3133         (Dwarf_info_reader::do_parse): New function.
3134         (Dwarf_info_reader::do_read_string_table): New function.
3135         (Dwarf_info_reader::lookup_reloc): New function.
3136         (Dwarf_info_reader::get_string): New function.
3137         (Dwarf_info_reader::visit_compilation_unit): New function.
3138         (Dwarf_info_reader::visit_type_unit): New function.
3139         (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
3140         Sized_elf_reloc_mapper.
3141         (Sized_dwarf_line_info::symbol_section): Remove function.
3142         (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
3143         (Sized_dwarf_line_info::read_line_mappings): Remove object
3144         parameter, adjust callers.
3145         (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
3146         * dwarf_reader.h: Include <sys/types.h>.
3147         (class Track_relocs): Remove forward declaration.
3148         (class Elf_reloc_mapper): New class.
3149         (class Sized_elf_reloc_mapper): New class.
3150         (class Dwarf_abbrev_table): New class.
3151         (class Dwarf_range_list): New class.
3152         (class Dwarf_ranges_table): New class.
3153         (class Dwarf_pubnames_table): New class.
3154         (class Dwarf_die): New class.
3155         (class Dwarf_info_reader): New class.
3156         (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
3157         (Sized_dwarf_line_info::symbol_section): Remove member function.
3158         * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
3159         base class.
3160         * gdb-index.cc: New source file.
3161         * gdb-index.h: New source file.
3162         * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
3163         and .debug_types sections, call Layout::add_to_gdb_index.
3164         (Sized_relobj_incr::do_section_name): Implement.
3165         (Sized_relobj_incr::do_section_contents): Adjust parameter list and
3166         return type; Implement.
3167         (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
3168         return type.
3169         * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
3170         parameter list and return type.
3171         (Sized_incr_dynobj::do_section_contents): Likewise.
3172         * layout.cc: Include gdb-index.h.
3173         (Layout::Layout): Initialize gdb_index_data_.
3174         (Layout::init_fixed_output_section): Check for .gdb_index section.
3175         (Layout::add_to_gdb_index): New function. Instantiate.
3176         * layout.h: Add forward declaration for class Gdb_index.
3177         (Layout::add_to_gdb_index): New member function.
3178         (Layout::gdb_index_data_): New data member.
3179         * main.cc: Include gdb-index.h.
3180         (main): Print statistics for gdb index.
3181         * object.cc (Object::section_contents): Move code into
3182         do_section_contents.
3183         (need_decompressed_section): Check for sections needed when building
3184         gdb index.
3185         (build_compressed_section_map): Likewise.
3186         (Sized_relobj_file::do_read_symbols): Need local symbols when building
3187         gdb index.
3188         (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
3189         sections; call Layout::add_to_gdb_index.
3190         (Sized_relobj_file::do_decompressed_section_contents): Call
3191         do_section_contents directly.
3192         * object.h (Object::do_section_contents): Adjust parameter list and
3193         return type.
3194         (Object::do_decompressed_section_contents): Call do_section_contents
3195         directly.
3196         (Sized_relobj_file::do_section_contents): Adjust parameter list and
3197         return type.
3198         * options.h (class General_options): Add --gdb-index option.
3199         * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
3200         list and return type.
3201         * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
3202         * reloc.h (Track_relocs::checkpoint): New function.
3203         (Track_relocs::reset): New function.
3204
3205         * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
3206         New test cases.
3207         * testsuite/Makefile.in: Regenerate.
3208         * testsuite/gdb_index_test.cc: New test source file.
3209         * testsuite/gdb_index_test_1.sh: New test source file.
3210         * testsuite/gdb_index_test_2.sh: New test source file.
3211
3212 2012-03-19  Doug Kwan  <dougkwan@google.com>
3213
3214         * arm.cc (Target_arm::do_define_standard_symbols): New method.
3215         (Target_arm::do_finalize_sections): Remove code which defines
3216         __exidx_start and __exidx_end.  Make symbol table parameter
3217         anonymous as it is not used.
3218         * gold.cc (queue_middle_tasks): Call target hook to define any
3219         target-specific symbols.
3220         * target.h (Target::define_standard_symbols): New method.
3221         (Target::do_define_standard_symbols): Same.
3222         * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
3223         * testsuite/Makefile.in: Regenerate.
3224         * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
3225         and __exidx_end.
3226         * testsuite/arm_exidx_test.sh: Check that no unused dynamic
3227         relocations are generated for __exidx_start and __exidx_end.
3228
3229 2012-03-16  Doug Kwan  <dougkwan@google.com>
3230
3231         * testsuite/Makefile.am: Disable test initpri3b.
3232         * testsuite/Makefile.in: Regenerate.
3233
3234 2012-03-15  Doug Kwan  <dougkwan@google.com>
3235
3236         * arm.cc (Target_arm::got_section): Make .got section read-only
3237         if -z now is given.
3238
3239 2012-03-15  Ian Lance Taylor  <iant@google.com>
3240
3241         PR gold/13850
3242         * layout.cc (Layout::make_output_section): Correctly mark
3243         SHT_INIT_ARRAY, et. al., as relro.
3244
3245 2012-03-14  Doug Kwan  <dougkwan@google.com>
3246
3247         * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
3248         dynamic relocations for protected symbols in shared objects.
3249
3250 2012-03-13  Ian Lance Taylor  <iant@google.com>
3251
3252         * resolve.cc (Symbol_table::resolve): When merging common symbols,
3253         keep the larger alignment.
3254
3255 2012-03-12  Cary Coutant  <ccoutant@google.com>
3256
3257         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
3258         handling of DW_LNE_define_file.
3259
3260 2012-03-12  Cary Coutant  <ccoutant@google.com>
3261
3262         * reduced_debug_output.cc
3263         (Output_reduced_debug_info_section::get_die_end): Add new FORM
3264         codes to switch.
3265
3266 2012-02-29  Cary Coutant  <ccoutant@google.com>
3267
3268         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
3269
3270 2012-02-29  Cary Coutant  <ccoutant@google.com>
3271
3272         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
3273         Call Object::decompressed_section_contents.
3274         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
3275         New dtor.
3276         (Sized_dwarf_line_info::buffer_start_): New data member.
3277         * merge.cc (Output_merge_data::do_add_input_section): Call
3278         Object::decompressed_section_contents.
3279         (Output_merge_string::do_add_input_section): Likewise.
3280         * object.cc (need_decompressed_section): New function.
3281         (build_compressed_section_map): Decompress sections needed later.
3282         (Sized_relobj_file::do_decompressed_section_contents): New function.
3283         (Sized_relobj_file::do_discard_decompressed_sections): New function.
3284         * object.h (Object::decompressed_section_contents): New function.
3285         (Object::discard_decompressed_sections): New function.
3286         (Object::do_decompressed_section_contents): New function.
3287         (Object::do_discard_decompressed_sections): New function.
3288         (Compressed_section_info): New type.
3289         (Compressed_section_map): Include decompressed section contents.
3290         (Sized_relobj_file::do_decompressed_section_contents): New function.
3291         (Sized_relobj_file::do_discard_decompressed_sections): New function.
3292
3293 2012-02-16  Cary Coutant  <ccoutant@google.com>
3294
3295         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
3296         * testsuite/Makefile.in: Regenerate.
3297
3298 2012-02-14  Cary Coutant  <ccoutant@google.com>
3299
3300         * options.cc (General_options::finalize): Disallow -pie and -static.
3301
3302 2012-02-03  Doug Kwan  <dougkwan@google.com>
3303
3304         * arm.cc (Arm_relocate_functions::abs8,
3305         Arm_relocate_functions::abs16): Use
3306         Bits::has_signed_unsigned_overflow32.
3307         (Arm_relocate_functions::thm_abs8): Correct range of
3308         overflow check.
3309         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
3310         in assertions.
3311
3312 2012-02-02  Doug Kwan  <dougkwan@google.com>
3313
3314         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
3315         position independent outputs, not just shared objects.
3316
3317 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
3318
3319         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
3320         * configure: Regenerated.
3321
3322 2012-01-27  Ian Lance Taylor  <iant@google.com>
3323
3324         * reloc.h (Bits): New class with static functions, copied from
3325         namespace utils in arm.cc.
3326         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
3327         instead.
3328
3329 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
3330
3331         * incremental.cc (write_info_blocks): Correct relocation offset.
3332
3333 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
3334
3335         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
3336         (Relocate::tls_gd_to_le): Likewise.
3337
3338 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
3339
3340         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
3341
3342 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
3343
3344         * configure.ac: Check if -mcmodel=medium works.
3345         * configure: Regenerated.
3346
3347 2012-01-24  Cary Coutant  <ccoutant@google.com>
3348
3349         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
3350         definition and ...
3351         (read_unsigned_LEB_128_x): ... this new function.
3352         (read_signed_LEB_128): Replaced with inline definition and ...
3353         (read_signed_LEB_128_x): ... this new function.
3354         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
3355         (read_unsigned_LEB_128): Add inline definition.
3356         (read_signed_LEB_128_x): New function.
3357         (read_signed_LEB_128): Add inline definition.
3358         * testsuite/Makefile.am (leb128_unittest): New unit test.
3359         * testsuite/Makefile.in: Regenerate.
3360         * testsuite/leb128_unittest.cc: New unit test.
3361
3362 2012-01-23  Ian Lance Taylor  <iant@google.com>
3363
3364         PR gold/13617
3365         * i386.cc (Target_i386::do_code_fill): When using a jmp
3366         instruction, pad with nop instructions.
3367         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
3368
3369 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
3370
3371         * x86_64.cc (gc_process_relocs): Add typename on types used in
3372         template.
3373         (scan_relocs): Likewise.
3374         (relocate_section): Likewise.
3375         (apply_relocation): Likewise.
3376
3377 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
3378
3379         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
3380         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
3381         under x32.
3382
3383 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
3384
3385         * x86_64.cc: Initial support for x32.
3386
3387 2012-01-03  Cary Coutant  <ccoutant@google.com>
3388
3389         * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
3390         Use abstract base class for GOT.
3391         * gold/output.h (class Output_data_got_base): New abstract base class.
3392         (class Output_data_got): Derive from new base class, adjust ctors.
3393         (Output_data_got::reserve_slot): Make virtual; rename to
3394         do_reserve_slot; Adjust callers.
3395         * gold/target.h (Sized_target::init_got_plt_for_update): Return
3396         pointer to abstract base class.
3397         * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
3398
3399 2011-12-18  Ian Lance Taylor  <iant@google.com>
3400
3401         * object.h (Relobj::local_symbol_value): New function.
3402         (Relobj::local_plt_offset): New function.
3403         (Relobj::local_has_got_offset): New function.
3404         (Relobj::local_got_offset): New function.
3405         (Relobj::set_local_got_offset): New function.
3406         (Relobj::do_local_symbol_value): New pure virtual function.
3407         (Relobj::do_local_plt_offset): Likewise.
3408         (Relobj::do_local_has_got_offset): Likewise.
3409         (Relobj::do_local_got_offset): Likewise.
3410         (Relobj::do_set_local_got_offset): Likewise.
3411         (Sized_relobj::do_local_has_got_offset): Rename from
3412         local_has_got_offset.
3413         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
3414         (Sized_relobj::do_set_local_got_offset): Rename from
3415         set_local_got_offset.
3416         (Sized_relobj_file::do_local_plt_offset): Rename from
3417         local_plt_offset.
3418         (Sized_relobj_file::do_local_symbol_value): New function.
3419         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
3420         local_plt_offset.
3421         * output.cc (Output_data_got::Got_entry::write): Change object to
3422         Relobj.  Use local_symbol_value.
3423         (Output_data_got::add_global_with_rel): Change rel_dyn to
3424         Output_data_reloc_generic*.  Use add_global_generic.
3425         (Output_data_got::add_global_with_rela): Remove.  Change all
3426         callers to use add_global_with_rel.
3427         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
3428         Output_data_reloc_generic*.  Use add_global_generic.
3429         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
3430         callers to use add_global_pair_with_rel.
3431         (Output_data_got::add_local): Change object to Relobj*.
3432         (Output_data_got::add_local_plt): Likewise.
3433         (Output_data_got::add_local_with_rel): Change object to Relobj*,
3434         change rel_dyn to Output_data_reloc_generic*.  Use
3435         add_local_generic.
3436         (Output_data_got::add_local_with_rela): Remove.  Change all
3437         callers to use all_local_with_rel.
3438         (Output_data_got::add_local_pair_with_rel): Change object to
3439         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
3440         add_output_section_generic.
3441         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
3442         callers to use add_local_pair_with_rel.
3443         (Output_data_got::reserve_local): Change object to Relobj*.
3444         * output.h: (class Output_data_reloc_generic): Add pure virtual
3445         declarations for add_global_generic, add_local_generic,
3446         add_output_section_generic.
3447         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
3448         functions for Output_data_reloc_generic.  Update declarations for
3449         changes listed in output.cc.
3450         (class Output_data_got): Change template parameter to got_size.
3451         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
3452         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
3453         function.
3454         (Sized_relobj_incr::do_local_plt_offset): New function.
3455         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
3456         add_global_generic.
3457
3458 2011-12-17  Cary Coutant  <ccoutant@google.com>
3459
3460         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
3461         * resolve.cc (Symbol_table::resolve): Likewise.
3462         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
3463         arrays.
3464         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
3465
3466 2011-12-16  Ian Lance Taylor  <iant@google.com>
3467
3468         * output.h (Output_data_reloc_generic::add): Only call
3469         add_dynamic_reloc if this is a dynamic reloc section.
3470
3471 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
3472
3473         PR gold/13505
3474         * target-reloc.h (apply_relocation): Replace <64, false> with
3475         <size, big_endian>.
3476
3477 2011-11-25  Nick Clifton  <nickc@redhat.com>
3478
3479         * po/it.po: New Italian translation.
3480
3481 2011-11-17  Sterling Augustine  <saugustine@google.com>
3482
3483         * script.cc (script_include_directive): Implement.
3484         (read_script_file): New local variables name and search_path. Update
3485         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
3486         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
3487         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
3488
3489 2011-11-11  Sterling Augustine  <saugustine@google.com>
3490
3491         * yyscript.y (section_cmd): Add support for INCLUDE directive.
3492         (file_or_sections_cmd): Likewise.
3493
3494 2011-11-11  Doug Kwan  <dougkwan@google.com>
3495
3496         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
3497         if --just-symbols is given.
3498
3499 2011-11-10  Doug Kwan  <dougkwan@google.com>
3500
3501         PR gold/13362
3502         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
3503         when processing data relocs.
3504         * reloc.h (Relocate_functions::rel_unaligned): New method.
3505         (Relocate_functions::pcrel_unaligned): Ditto.
3506         (Relocate_functions::rel32_unaligned): Ditto.
3507         (Relocate_functions::pcrel32_unaligned): Ditto.
3508
3509 2011-11-09  Doug Kwan  <dougkwan@google.com>
3510
3511         PR gold/13362
3512         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
3513         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
3514         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
3515         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
3516         (Relocate_functions::rel_unaligned): New.
3517         (Relocate_functions::rel32_unaligned): New.
3518         * target-reloc.h (relocate_for_relocatable): Add code to handle
3519         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
3520         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
3521         arm_unaligned_reloc_r): New targets.
3522         * testsuite/Makefile.in: Regenerate.
3523         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
3524         linking.
3525
3526 2011-11-02  Ian Lance Taylor  <iant@google.com>
3527
3528         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
3529         NATIVE_LINKER.
3530         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
3531         * options.cc (General_options::finalize): Use library search path
3532         from configure script if specified.  If not native and no sysroot,
3533         only search TOOLLIBDIR.
3534         * options.h (Search_directory::Search_directory): Change name to
3535         const std::string&.
3536         (General_options::add_to_library_path_with_sysroot): Change arg to
3537         const std::string&.
3538         * configure, Makefile.in, config.in: Rebuild.
3539
3540 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
3541
3542         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
3543         we are working around the ARM1176 Erratum.
3544         * options.h (General_options::fix_arm1176): Add option.
3545         * testsuite/Makefile.am: Add testcases, and keep current ones
3546         working.
3547         * testsuite/Makefile.in: Regenerate.
3548         * testsuite/arm_fix_1176.s: New file.
3549         * testsuite/arm_fix_1176.sh: Likewise.
3550
3551 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
3552
3553         * arm.cc (Target_arm::Target_arm): Remove initialisation of
3554         may_use_blx_.
3555         (Target_arm::may_use_blx): Remove method.
3556         (Target_arm::set_may_use_blx): Likewise.
3557         (Target_arm::may_use_v4t_interworking): New method.
3558         (Target_arm::may_use_v5t_interworking): Likewise.
3559         (Target_arm::may_use_blx_): Remove member variable.
3560         (Arm_relocate_functions::arm_branch_common): Check for v5T
3561         interworking.
3562         (Arm_relocate_functions::thumb_branch_common): Likewise.
3563         (Reloc_stub::stub_type_for_reloc): Likewise.
3564         (Target_arm::do_finalize_sections): Correct interworking checks.
3565         * testsuite/Makefile.am: Add new tests.
3566         * testsuite/Makefile.in: Regenerate.
3567         * testsuite/arm_farcall_arm_arm.s: New test.
3568         * testsuite/arm_farcall_arm_arm.sh: Likewise.
3569         * testsuite/arm_farcall_arm_thumb.s: Likewise.
3570         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
3571         * testsuite/arm_farcall_thumb_arm.s: Likewise.
3572         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
3573         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
3574         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
3575
3576 2011-10-31  Cary Coutant  <ccoutant@google.com>
3577
3578         PR gold/13023
3579         * expression.cc (Expression::eval_with_dot): Add
3580         is_section_dot_assignment parameter.
3581         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
3582         absolute and assigning to dot within a section.
3583         * script-sections.cc
3584         (Output_section_element_assignment::set_section_addresses): Pass
3585         dot_section to set_if_absolute.
3586         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
3587         as is_section_dot_assignment flag to eval_with_dot.
3588         (Output_section_element_dot_assignment::set_section_addresses):
3589         Likewise.
3590         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
3591         parameter.  Also set value if relative to dot_section; set the
3592         symbol's output_section.
3593         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
3594         parameter.  Adjust all callers.
3595         (Expression::eval_maybe_dot): Likewise.
3596         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
3597         Adjust all callers.
3598         * testsuite/script_test_2.t: Test assignment of an absolute value
3599         to dot within an output section element.
3600
3601 2011-10-31  Cary Coutant  <ccoutant@google.com>
3602
3603         * options.h (class General_options): Add --[no-]gnu-unique options.
3604         * symtab.cc (Symbol_table::sized_write_globals): Convert
3605         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
3606
3607 2011-10-31  Cary Coutant  <ccoutant@google.com>
3608
3609         PR gold/13359
3610         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
3611         unnecessary assertion.
3612         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
3613
3614 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
3615
3616         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
3617         gc_mark_symbol.
3618         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
3619         gc_mark_symbol.
3620         Change to just keep the section associated with symbol.
3621         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
3622         they are externally visible and --export-dynamic is turned on.
3623         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
3624
3625 2011-10-19  Ian Lance Taylor  <iant@google.com>
3626
3627         PR gold/13163
3628         * script-sections.cc
3629         (Output_section_element_dot_assignment::needs_output_section): New
3630         function.
3631
3632 2011-10-19  Ian Lance Taylor  <iant@google.com>
3633
3634         PR gold/13204
3635         * layout.cc (Layout::segment_precedes): Don't assert failure if a
3636         --section-start option was seen.
3637         * options.h (General_options::any_section_start): New function.
3638
3639 2011-10-18  David S. Miller  <davem@davemloft.net>
3640
3641         PR binutils/13301
3642         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
3643         member to track relocation locations that have moved during TLS
3644         reloc optimizations.
3645         (Target_sparc::Relocate::Relocate): Initialize to NULL.
3646         (Target_sparc::Relocate::relocate): Adjust view down by 4
3647         bytes if it matches reloc_adjust_addr_.
3648         (Target_sparc::Relocate::relocate_tls): Always move the
3649         __tls_get_addr call delay slot instruction forward 4 bytes when
3650         performing relaxation.
3651
3652 2011-10-18  Cary Coutant  <ccoutant@google.com>
3653
3654         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
3655         (Output_file::map_no_anonymous): Check for non-zero
3656         return code from posix_fallocate.
3657
3658 2011-10-17  Cary Coutant  <ccoutant@google.com>
3659
3660         PR gold/13245
3661         * plugin.cc (is_visible_from_outside): Check for symbols
3662         referenced from dynamic objects.
3663         * resolve.cc (Symbol_table::resolve): Don't count references
3664         from dynamic objects as references from real ELF files.
3665         * testsuite/plugin_test_2.sh: Adjust expected result.
3666
3667 2011-10-17  Cary Coutant  <ccoutant@google.com>
3668
3669         * gold.cc: Include timer.h.
3670         (queue_middle_tasks): Stamp time.
3671         (queue_final_tasks): Likewise.
3672         * main.cc (main): Store timer in parameters.  Print timers
3673         for each pass.
3674         * parameters.cc (Parameters::Parameters): Initialize timer_.
3675         (Parameters::set_timer): New function.
3676         (set_parameters_timer): New function.
3677         * parameters.h (Parameters::set_timer): New function.
3678         (Parameters::timer): New function.
3679         (Parameters::timer_): New data member.
3680         (set_parameters_timer): New function.
3681         * timer.cc (Timer::stamp): New function.
3682         (Timer::get_pass_time): New function.
3683         * timer.h (Timer::stamp): New function.
3684         (Timer::get_pass_time): New function.
3685         (Timer::pass_times_): New data member.
3686
3687 2011-10-17  Cary Coutant  <ccoutant@google.com>
3688
3689         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
3690         task for members of lib groups.
3691
3692 2011-10-17  Cary Coutant  <ccoutant@google.com>
3693
3694         PR gold/13288
3695         * fileread.cc (File_read::find_view): Add assert.
3696         (File_read::make_view): Move bounds check (replace with assert)...
3697         (File_read::find_or_make_view): ... to here.
3698
3699 2011-10-12  Cary Coutant  <ccoutant@google.com>
3700
3701         * output.cc (Output_file::open_base_file): Handle case where
3702         ::read returns less than requested size.
3703
3704 2011-10-10  Cary Coutant  <ccoutant@google.com>
3705
3706         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
3707         Initialize defined_count_.
3708         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
3709         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
3710         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
3711         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
3712         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
3713         * incremental.h (Sized_relobj_incr::defined_count_): New data
3714         member.
3715         (Sized_incr_dynobj::defined_count_): New data member.
3716         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
3717         Return zeroes instead of internal error.
3718
3719 2011-10-10  Cary Coutant  <ccoutant@google.com>
3720
3721         PR gold/13249
3722         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
3723         (Output_reloc::symbol_value): Return PLT offset if flag is set.
3724         * output.h (class Output_reloc): Add use_plt_offset flag.
3725         (Output_reloc::type_): Adjust size of bit field.
3726         (Output_reloc::use_plt_offset_): New bit field.
3727         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
3728         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
3729         flag.  Adjust all callers.
3730         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
3731         creating RELATIVE relocations.
3732
3733 2011-10-10  Nick Clifton  <nickc@redhat.com>
3734
3735         * po/es.po: Updated Spanish translation.
3736         * po/fi.po: Updated Finnish translation.
3737
3738 2011-10-03   Diego Novillo  <dnovillo@google.com>
3739
3740         * options.cc (parse_uint): Fix dereference of RETVAL.
3741
3742 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
3743
3744         * layout.h (section_order_map_): New member.
3745         (get_section_order_map): New member function.
3746         * output.cc (Output_section::add_input_section): Check for patterns
3747         only when --section-ordering-file is specified.
3748         * gold.cc (queue_middle_tasks): Delay updating order of sections till
3749         output_sections have been formed.
3750         * layout.cc (Layout_Layout): Initialize section_order_map_.
3751         * plugin.cc (update_section_order): Store order in order_map. Do not
3752         update the order.
3753         * testsuite/Makefile.am: Add test case for plugin_final_layout.
3754         * testsuite/Makefile.in: Regenerate.
3755         * testsuite/plugin_section_order.c: New file.
3756         * testsuite/plugin_final_layout.cc: New file.
3757         * testsuite/plugin_final_layout.sh: New file.
3758
3759 2011-09-29  Cary Coutant  <ccoutant@google.com>
3760
3761         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
3762         Check for NULL.
3763         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
3764         symbols during incremental update.
3765         (Symbol_table::add_from_dynobj): Likewise.
3766
3767 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3768             Ian Lance Taylor  <iant@google.com>
3769
3770         * symtab.cc (Symbol_table::define_special_symbol): Always
3771         canonicalize version string.
3772
3773 2011-09-26  Cary Coutant  <ccoutant@google.com>
3774
3775         * gold.cc (queue_initial_tasks): Move option checks ...
3776         * options.cc (General_options::finalize): ... to here. Disable
3777         some options; make others fatal.
3778
3779 2011-09-26  Cary Coutant  <ccoutant@google.com>
3780
3781         gcc PR lto/47247
3782         * plugin.cc (get_symbols_v2): New function.
3783         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
3784         (is_referenced_from_outside): New function.
3785         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
3786         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
3787         (get_symbols): Pass version parameter.
3788         (get_symbols_v2): New function.
3789         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
3790         parameter.
3791         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
3792         (onload): Add LDPT_GET_SYMBOLS_V2.
3793         (all_symbols_read_hook): Use get_symbols_v2; check for
3794         LDPR_PREVAILING_DEF_IRONLY_EXP.
3795         * testsuite/plugin_test_3.sh: Update expected results.
3796
3797 2011-09-23  Simon Baldwin  <simonb@google.com>
3798
3799         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
3800         configuration options.
3801         * configure: Regenerate.
3802         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
3803         * Makefile.in: Regenerate.
3804         * testsuite/Makefile.in: Regenerate.
3805
3806 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
3807
3808         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
3809
3810 2011-09-19  Cary Coutant  <ccoutant@google.com>
3811
3812         * incremental.cc (can_incremental_update): Fix typo in comment.
3813         * incremental.h (can_incremental_update): Likewise.
3814
3815 2011-09-18  Cary Coutant  <ccoutant@google.com>
3816
3817         * incremental.cc (can_incremental_update): New function.
3818         * incremental.h (can_incremental_update): New function.
3819         * layout.cc (Layout::init_fixed_output_section): Call it.
3820         (Layout::make_output_section): Don't allow patch space in .eh_frame.
3821         * object.cc (Sized_relobj_file::do_layout): Call
3822         can_incremental_update.
3823
3824 2011-09-13  Cary Coutant  <ccoutant@google.com>
3825
3826         * configure.ac: Check for glibc support for gnu_indirect_function
3827         support with static linking, setting automake conditional
3828         IFUNC_STATIC.
3829         * Makefile.in: Regenerate.
3830         * configure: Regenerate.
3831
3832         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
3833         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
3834         for IFUNC_STATIC.
3835         * testsuite/Makefile.in: Regenerate.
3836
3837 2011-09-13  Cary Coutant  <ccoutant@google.com>
3838
3839         * incremental.cc (Sized_relobj_incr::do_layout): Call
3840         report_comdat_group for kept comdat sections.
3841         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
3842         * testsuite/Makefile.in: Regenerate.
3843         * testsuite/incr_comdat_test_1.cc: New source file.
3844         * testsuite/incr_comdat_test_2_v1.cc: New source file.
3845         * testsuite/incr_comdat_test_2_v2.cc: New source file.
3846         * testsuite/incr_comdat_test_2_v3.cc: New source file.
3847
3848 2011-09-13  Ian Lance Taylor  <iant@google.com>
3849
3850         * object.cc (Sized_relobj_file::do_layout): Remove unused local
3851         variable external_symbols_offset.
3852
3853 2011-09-12  Ian Lance Taylor  <iant@google.com>
3854
3855         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
3856         triggered if object has no symbols.
3857
3858 2011-09-09  David S. Miller  <davem@davemloft.net>
3859
3860         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
3861         (Output_fill_debug_line::do_write): Likewise.
3862
3863 2011-08-29  Cary Coutant  <ccoutant@google.com>
3864
3865         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
3866         casts to match formatting specs.
3867         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
3868
3869 2011-08-26  Cary Coutant  <ccoutant@google.com>
3870
3871         * layout.cc (Free_list::allocate): Provide guarantee of minimum
3872         remaining hole size when allocating.
3873         (Layout::make_output_section): Set fill methods for debug sections.
3874         * layout.h (Free_list::Free_list_node): Move from private to
3875         public.
3876         (Free_list::set_min_hole_size): New function.
3877         (Free_list::begin, Free_list::end): New functions.
3878         (Free_list::min_hole_): New data member.
3879         * output.cc: Include dwarf.h.
3880         (Output_fill_debug_info::do_minimum_hole_size): New function.
3881         (Output_fill_debug_info::do_write): New function.
3882         (Output_fill_debug_line::do_minimum_hole_size): New function.
3883         (Output_fill_debug_line::do_write): New function.
3884         (Output_section::Output_section): Initialize new data member.
3885         (Output_section::set_final_data_size): Ensure patch space is larger
3886         than minimum hole size.
3887         (Output_section::do_write): Fill holes in debug sections.
3888         * output.h (Output_fill): New class.
3889         (Output_fill_debug_info): New class.
3890         (Output_fill_debug_line): New class.
3891         (Output_section::set_free_space_fill): New function.
3892         (Output_section::free_space_fill_): New data member.
3893         * testsuite/Makefile.am (incremental_test_3): Add
3894         --incremental-patch option.
3895         (incremental_test_4): Likewise.
3896         (incremental_test_5): Likewise.
3897         (incremental_test_6): Likewise.
3898         (incremental_copy_test): Likewise.
3899         (incremental_common_test_1): Likewise.
3900         * testsuite/Makefile.in: Regenerate.
3901
3902 2011-08-26  Nick Clifton  <nickc@redhat.com>
3903
3904         * po/es.po: Updated Spanish translation.
3905
3906 2011-08-01  Cary Coutant  <ccoutant@google.com>
3907
3908         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
3909         * gold/testsuite/Makefile.in: Regenerate.
3910         * gold/testsuite/justsyms_exec.c: New source file.
3911         * gold/testsuite/justsyms_lib.c: New source file.
3912
3913 2011-08-01  Cary Coutant  <ccoutant@google.com>
3914
3915         * layout.cc (Layout::set_segment_offsets): Don't realign text
3916         segment if -Ttext was specified.
3917         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
3918         file type.
3919         * object.h (Sized_relobj_file::e_type): New function.
3920         (Sized_relobj_file::e_type_): New data member.
3921         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
3922         base address for ET_EXEC files.
3923         * target.cc (Target::do_make_elf_object_implementation): Allow
3924         ET_EXEC files with --just-symbols option.
3925
3926 2011-07-28  Cary Coutant  <ccoutant@google.com>
3927
3928         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
3929         Add thread_number parameter.
3930         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
3931         * workqueue-threads.cc
3932         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
3933         current thread if its thread number is greater than desired thread
3934         count.
3935         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
3936         Add thread_number parameter.
3937         (Workqueue::should_cancel_thread): Likewise.
3938         (Workqueue::find_runnable_or_wait): Pass thread_number to
3939         should_cancel_thread.
3940         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
3941         parameter.
3942
3943 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
3944
3945         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
3946         only after checking if it cannot be forced local.
3947         * symtab.h (is_externally_visible): Check if the symbol is not forced
3948         local.
3949
3950 2011-07-15  Ian Lance Taylor  <iant@google.com>
3951
3952         * options.h (class General_options): Add --print-output-format.
3953         Move -EL next to -EB, for  better --help output.
3954         * target-select.cc: Include <cstdio>, "options.h", and
3955         "parameters.h".
3956         (Target_selector::do_target_bfd_name): New function.
3957         (print_output_format): New function.
3958         * target-select.h (class Target_selector): Update declarations.
3959         (Target_selector::target_bfd_name): New function.
3960         (print_output_format): Declare.
3961         * main.cc: Include "target-select.h".
3962         (main): Handle --print-output-format.
3963         * gold.cc: Include "target-select.h".
3964         (queue_initial_tasks): Handle --print-output-format when there are
3965         no input files.
3966         * parameters.cc (parameters_force_valid_target): Give a better
3967         error message if -EB/-EL does not match target.
3968         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
3969         function.
3970
3971 2011-07-15  Ian Lance Taylor  <iant@google.com>
3972
3973         * i386.cc (class Output_data_plt_i386): Add layout_ field.
3974         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
3975         (Output_data_plt_i386::do_write): Write address of .dynamic
3976         section to first entry in .got.plt section.
3977         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
3978         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
3979         Initialize layout_.
3980         (Output_data_plt_x86_64::do_write): Write address of .dynamic
3981         section to first entry in .got.plt section.
3982         * layout.h (Layout::dynamic_section): New function.
3983
3984 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
3985
3986         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
3987         to claim_file call.
3988         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
3989         input_section_position_, and input_section_glob_.
3990         (read_layout_from_file): Call function section_ordering_specified.
3991         * layout.h (is_section_ordering_specified): New function.
3992         (section_ordering_specified): New function.
3993         (section_ordering_specified_): New boolean member.
3994         * main.cc(main): Call load_plugins after layout object is defined.
3995         * output.cc (Output_section::add_input_section): Use
3996         function section_ordering_specified to check if section ordering is
3997         needed.
3998         * output.cc (Output_section::add_relaxed_input_section): Use
3999         function section_ordering_specified to check if section ordering is
4000         needed.
4001         (Output_section::update_section_layout): New function.
4002         (Output_section::sort_attached_input_sections): Check if input section
4003         must be reordered.
4004         * output.h (Output_section::update_section_layout): New function.
4005         * plugin.cc (get_section_count): New function.
4006         (get_section_type): New function.
4007         (get_section_name): New function.
4008         (get_section_contents): New function.
4009         (update_section_order): New function.
4010         (allow_section_ordering): New function.
4011         (Plugin::load): Add the new interfaces to the transfer vector.
4012         (Plugin_manager::load_plugins): New parameter.
4013         (Plugin_manager::all_symbols_read): New parameter.
4014         (Plugin_manager::claim_file): New parameter. Save the elf object for
4015         unclaimed objects.
4016         (Plugin_manager::get_elf_object): New function.
4017         (Plugin_manager::get_view): Change to directly use the bool to check
4018         if get_view is called from claim_file_hook.
4019         * plugin.h (input_objects): New function
4020         (Plugin__manager::load_plugins): New parameter.
4021         (Plugin_manager::claim_file): New parameter.
4022         (Plugin_manager::get_elf_object): New function.
4023         (Plugin_manager::in_claim_file_handler): New function.
4024         (Plugin_manager::in_claim_file_handler_): New member.
4025         (layout): New function.
4026         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
4027         handler with an extra parameter. Make the elf object before calling
4028         claim_file handler.
4029         * testsuite/plugin_test.c (get_section_count): New function pointer.
4030         (get_section_type): New function pointer.
4031         (get_section_name): New function pointer.
4032         (get_section_contents): New function pointer.
4033         (update_section_order): New function pointer.
4034         (allow_section_ordering): New function pointer.
4035         (onload): Check if the new interfaces exist.
4036
4037 2011-07-13  Ian Lance Taylor  <iant@google.com>
4038
4039         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
4040         relro section.
4041         * x86_64.cc (Target_x86_64::got_section): Likewise.
4042         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
4043         (relro_now_test_SOURCES): New variable.
4044         (relro_now_test_DEPENDENCIES): New variable.
4045         (relro_now_test_LDFLAGS): New variable.
4046         (relro_now_test_LDADD): New variable.
4047         (relro_now_test.so): New target.
4048         * testsuite/Makefile.in: Rebuild.
4049
4050 2011-07-12  Ian Lance Taylor  <iant@google.com>
4051
4052         PR gold/12980
4053         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
4054         GLOB_DAT relocation rather than a RELATIVE relocation for a
4055         protected symbol when creating a shared library.
4056         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
4057         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
4058         * testsuite/protected_main_1.cc (main): Test that protected
4059         function has same address.
4060
4061 2011-07-11  Ian Lance Taylor  <iant@google.com>
4062
4063         PR gold/12979
4064         * options.h (class General_options): Add -Bgroup.
4065         * options.cc (General_options::finalize): If -Bgroup is set,
4066         default to --unresolved-symbols=report-all.
4067         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
4068         * target-reloc.h (issue_undefined_symbol_error): Handle
4069         --unresolved-symbols=report-all.
4070
4071 2011-07-08  Ian Lance Taylor  <iant@google.com>
4072
4073         PR gold/11985
4074         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
4075         if linker script discards key sections.
4076         (Layout::create_dynamic_symtab): Likewise.
4077         (Layout::assign_local_dynsym_offsets): Likewise.
4078         (Layout::sized_create_version_sections): Likewise.
4079         (Layout::create_interp): Likewise.
4080         (Layout::finish_dynamic_section): Likewise.
4081         (Layout::set_dynamic_symbol_size): Likewise.
4082
4083 2011-07-08  Ian Lance Taylor  <iant@google.com>
4084
4085         PR gold/12386
4086         * options.h (class General_options): Add --unresolved-symbols.
4087         * target-reloc.h (issue_undefined_symbol_error): Check
4088         --unresolved-symbols.  Add comments.
4089
4090 2011-07-08  Ian Lance Taylor  <iant@google.com>
4091
4092         * testsuite/odr_violation2.cc (Ordering::operator()): Make
4093         expression more complex.
4094
4095 2011-07-08  Ian Lance Taylor  <iant@google.com>
4096
4097         PR gold/11317
4098         * target-reloc.h (issue_undefined_symbol_error): New inline
4099         function, broken out of relocate_section.
4100         (relocate_section): Call issue_undefined_symbol_error.
4101         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
4102         there is no TLS segment if we are about to issue an undefined
4103         symbol error.
4104         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
4105
4106 2011-07-08  Ian Lance Taylor  <iant@google.com>
4107
4108         PR gold/12279
4109         * resolve.cc (Symbol_table::should_override): Add fromtype
4110         parameter.  Change all callers.  Give error when linking together
4111         TLS and non-TLS symbol.
4112         (Symbol_table::should_override_with_special): Add fromtype
4113         parameter.  Change all callers.
4114         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
4115         there is no TLS segment if we have reported some errors.
4116         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
4117
4118 2011-07-08  Ian Lance Taylor  <iant@google.com>
4119
4120         PR gold/12372
4121         * target.h (Target::plt_address_for_global): New function.
4122         (Target::plt_address_for_local): New function.
4123         (Target::plt_section_for_global): Remove.
4124         (Target::plt_section_for_local): Remove.
4125         (Target::do_plt_address_for_global): New virtual function.
4126         (Target::do_plt_address_for_local): New virtual function.
4127         (Target::do_plt_section_for_global): Remove.
4128         (Target::do_plt_section_for_local): Remove.
4129         (Target::register_global_plt_entry): Add Symbol_table and Layout
4130         parameters.
4131         * output.cc (Output_data_got::Got_entry::write): Use
4132         plt_address_for_global and plt_address_for_local.
4133         * layout.cc (Layout::add_target_dynamic_tags): Use size and
4134         address of output section.
4135         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
4136         got_irelative_, and irelative_count_ fields.  Update
4137         declarations.
4138         (Output_data_plt_i386::has_irelative_section): New function.
4139         (Output_data_plt_i386::entry_count): Add irelative_count_.
4140         (Output_data_plt_i386::set_final_data_size): Likewise.
4141         (class Target_i386): Add got_irelative_ and rel_irelative_
4142         fields.  Update declarations.
4143         (Target_i386::Target_i386): Initialize new fields.
4144         (Target_i386::do_plt_address_for_global): New function replacing
4145         do_plt_section_for_global.
4146         (Target_i386::do_plt_address_for_local): New function replacing
4147         do_plt_section_for_local.
4148         (Target_i386::got_section): Create got_irelative_.
4149         (Target_i386::rel_irelative_section): New function.
4150         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
4151         fields.  Don't define __rel_iplt_{start,end}.
4152         (Output_data_plt_i386::add_entry): Add symtab and layout
4153         parameters.  Change all callers.  Use different PLT and GOT for
4154         IFUNC symbols.
4155         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
4156         layout parameters.  Change all callers.  Use different PLT and
4157         GOT.
4158         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
4159         (Output_data_plt_i386::rel_irelative): New function.
4160         (Output_data_plt_i386::address_for_global): New function.
4161         (Output_data_plt_i386::address_for_local): New function.
4162         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
4163         IRELATIVE GOT when changing IFUNC GOT entries.
4164         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
4165         reloc.
4166         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
4167         if we didn't create an IRELATIVE GOT.
4168         (Target_i386::Relocate::relocate): Use plt_address_for_global and
4169         plt_address_for_local.
4170         (Target_i386::do_dynsym_value): Use plt_address_for_global.
4171         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
4172         got_irelative_, and irelative_count_ fields.  Update
4173         declarations.
4174         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
4175         Initialize new fields.  Remove symtab parameter.  Change all
4176         callers.
4177         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
4178         irelative_count_.
4179         (Output_data_plt_x86_64::has_irelative_section): New function.
4180         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
4181         (class Target_x86_64): Add got_irelative_ and rel_irelative_
4182         fields.  Update declarations.
4183         (Target_x86_64::Target_x86_64): Initialize new fields.
4184         (Target_x86_64::do_plt_address_for_global): New function replacing
4185         do_plt_section_for_global.
4186         (Target_x86_64::do_plt_address_for_local): New function replacing
4187         do_plt_section_for_local.
4188         (Target_x86_64::got_section): Create got_irelative_.
4189         (Target_x86_64::rela_irelative_section): New function.
4190         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
4191         all callers.  Don't create __rel_iplt_{start,end}.
4192         (Output_data_plt_x86_64::add_entry): Add symtab and layout
4193         parameters.  Change all callers.  Use different PLT and GOT for
4194         IFUNC symbols.
4195         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
4196         layout parameters.  Change all callers.  Use different PLT and
4197         GOT.
4198         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
4199         parameters.  Change all callers.  Use different PLT and GOT for
4200         IFUNC symbols.
4201         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
4202         (Output_data_plt_x86_64::rela_irelative): New function.
4203         (Output_data_plt_x86_64::address_for_global): New function.
4204         (Output_data_plt_x86_64::address_for_local): New function.
4205         (Output_data_plt_x86_64::set_final_data_size): Likewise.
4206         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
4207         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
4208         (Target_x86_64::register_global_plt_entry): Add symtab and layout
4209         parameters.
4210         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
4211         reloc.
4212         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
4213         symbols if we didn't create an IRELATIVE GOT.
4214         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
4215         plt_address_for_local.
4216         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
4217         * testsuite/ifuncvar1.c: New test file.
4218         * testsuite/ifuncvar2.c: New test file.
4219         * testsuite/ifuncvar3.c: New test file.
4220         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
4221         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
4222         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
4223         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
4224         * testsuite/Makefile.in: Rebuild.
4225
4226 2011-07-07  Cary Coutant  <ccoutant@google.com>
4227
4228         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
4229         (two_file_test_1_ndebug.o): Likewise.
4230         (two_file_test_1b_ndebug.o): Likewise.
4231         (two_file_test_2_ndebug.o): Likewise.
4232         (two_file_test_main_ndebug.o): Likewise.
4233         (incremental_test_2): Link with no-debug versions.
4234
4235 2011-07-06  Cary Coutant  <ccoutant@google.com>
4236
4237         * gold/incremental.cc
4238         (Output_section_incremental_inputs::write_info_blocks): Check for
4239         hidden and internal symbols.
4240
4241 2011-07-06  Cary Coutant  <ccoutant@google.com>
4242
4243         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
4244         Check disposition for startup file.
4245         (Incremental_inputs::report_command_line): Ignore
4246         --incremental-startup-unchanged option.
4247         * options.cc (General_options::parse_incremental_startup_unchanged):
4248         New function.
4249         (General_options::General_options): Initialize new data member.
4250         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
4251         (General_options): Add --incremental-startup-unchanged option.
4252         (General_options::incremental_startup_disposition): New function.
4253         (General_options::incremental_startup_disposition_): New data member.
4254
4255 2011-07-06  Cary Coutant  <ccoutant@google.com>
4256
4257         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
4258         input file index to Script_info ctor.
4259         (Sized_incremental_binary::do_file_has_changed): Find the
4260         command-line argument for files named in scripts.
4261         * incremental.h (Script_info::Script_info): New ctor
4262         with input file index.
4263         (Script_info::input_file_index): New function.
4264         (Script_info::input_file_index_): New data member.
4265         (Incremental_binary::get_library): Add const.
4266         (Incremental_binary::get_script_info): Add const.
4267         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
4268         * testsuite/Makefile.am (incremental_test_5): New test case.
4269         (incremental_test_6): New test case.
4270         * testsuite/Makefile.in: Regenerate.
4271
4272 2011-07-06  Cary Coutant  <ccoutant@google.com>
4273
4274         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
4275         debug output when command lines differ.
4276
4277 2011-07-06  Cary Coutant  <ccoutant@google.com>
4278
4279         * incremental.cc (Incremental_inputs::report_command_line): Ignore
4280         --incremental-patch option.
4281         * layout.cc (Free_list::allocate): Extend allocation beyond original
4282         end if enabled.
4283         (Layout::make_output_section): Mark sections that should get
4284         patch space.
4285         * options.cc (parse_percent): New function.
4286         * options.h (parse_percent): New function.
4287         (DEFINE_percent): New macro.
4288         (General_options): Add --incremental-patch option.
4289         * output.cc (Output_section::Output_section): Initialize new data
4290         members.
4291         (Output_section::add_input_section): Print section name when out
4292         of patch space.
4293         (Output_section::add_output_section_data): Likewise.
4294         (Output_section::set_final_data_size): Add patch space when
4295         doing --incremental-full.
4296         (Output_section::do_reset_address_and_file_offset): Remove patch
4297         space.
4298         (Output_segment::set_section_list_addresses): Print debug output
4299         only if --incremental-update.
4300         * output.h (Output_section::set_is_patch_space_allowed): New function.
4301         (Output_section::is_patch_space_allowed_): New data member.
4302         (Output_section::patch_space_): New data member.
4303         * parameters.cc (Parameters::incremental_full): New function.
4304         * parameters.h (Parameters::incremental_full): New function
4305         * testsuite/Makefile.am (incremental_test_2): Add test for
4306         --incremental-patch option.
4307         * testsuite/Makefile.in: Regenerate.
4308         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
4309         (t18): Remove function body.
4310
4311 2011-07-05  Doug Kwan  <dougkwan@google.com>
4312
4313         PR gold/12771
4314         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
4315         Arm_Address type for relocation result.
4316         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
4317         overflow check.
4318         (Arm_relocate_functions::abs32): Use unaligned access.
4319         (Arm_relocate_functions::rel32): Ditto.
4320         (Arm_relocate_functions::prel31): Ditto.
4321         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
4322         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
4323         static data relocations.
4324         * testsuite/Makefile.in: Regnerate.
4325         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
4326
4327 2011-07-05  Ian Lance Taylor  <iant@google.com>
4328
4329         PR gold/12392
4330         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
4331         symbols if necessary.
4332         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
4333
4334 2011-07-05  Ian Lance Taylor  <iant@google.com>
4335
4336         PR gold/12952
4337         * resolve.cc (Symbol::override_base_with_special): Simply override
4338         version with special symbol version, ignoring previous version.
4339
4340 2011-07-05  Ian Lance Taylor  <iant@google.com>
4341
4342         * object.cc (Sized_relobj_file::include_section_group): Add
4343         information to comment about signature location.
4344
4345 2011-07-02  Ian Lance Taylor  <iant@google.com>
4346
4347         PR gold/12957
4348         * options.h (class General_options): Add -f and -F.
4349         * options.cc (General_options::finalize): Fatal error if -f/-F
4350         are used without -shared.
4351         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
4352
4353 2011-07-02  Ian Lance Taylor  <iant@google.com>
4354
4355         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
4356
4357 2011-07-01  Ian Lance Taylor  <iant@google.com>
4358
4359         PR gold/12525
4360         PR gold/12952
4361         * resolve.cc (Symbol::override_base_with_special): Don't override
4362         the version if the overriding symbol has a different name.
4363         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
4364         all callers.  If we give an error about an undefined version,
4365         define the base version if necessary.
4366         * dynobj.h (class Versions): Update declaration.
4367         * testsuite/weak_alias_test_5.cc: New file.
4368         * testsuite/weak_alias_test.script: New file.
4369         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
4370         and versioned_alias have the right value, and call t2.
4371         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
4372         weak_alias_test_5.so.
4373         (weak_alias_test_LDADD): Likewise.
4374         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
4375         * testsuite/Makefile.in: Rebuild.
4376
4377 2011-07-01  Ian Lance Taylor  <iant@google.com>
4378
4379         PR gold/12525
4380         * options.h (class General_options): Support -z notext.
4381         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
4382         -Wl,-z,notext.
4383         (two_file_shared_nonpic.so): Likewise.
4384         (two_file_shared_mixed.so): Likewise.
4385         (two_file_shared_mixed_1.so): Likewise.
4386         (weak_undef_lib_nonpic.so): Likewise.
4387         (alt/weak_undef_lib_nonpic.so): Likewise.
4388         (tls_test_shared_nonpic.so): Likewise.
4389         * testsuite/Makefile.in: Rebuild.
4390
4391 2011-07-01  Ian Lance Taylor  <iant@google.com>
4392
4393         PR gold/12525
4394         * configure.ac: Test whether static linking works, setting
4395         the automake conditional HAVE_STATIC.
4396         * testsuite/Makefile.am: Disable tests using -static if
4397         HAVE_STATIC is not true.
4398         * configure, testsuite/Makefile.in: Rebuild.
4399
4400 2011-07-01  Ian Lance Taylor  <iant@google.com>
4401
4402         PR gold/12525
4403         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
4404         Assert if we see DW_EH_PE_indirect.
4405         * target.h (Target::ehframe_datarel_base): New function.
4406         (Target::do_ehframe_datarel_base): New target function.
4407         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
4408         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
4409         function.
4410
4411 2011-07-01  Ian Lance Taylor  <iant@google.com>
4412
4413         PR gold/12571
4414         * options.h (class General_options): Add
4415         --ld-generated-unwind-info.
4416         * ehframe.cc (Fde::write): Add address parameter.  Change all
4417         callers.  If associated with PLT, fill in address and size.
4418         (Cie::set_output_offset): Only add merge mapping if there is an
4419         object.
4420         (Cie::write): Add address parameter.  Change all callers.
4421         (Eh_frame::add_ehframe_for_plt): New function.
4422         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
4423         input_offset_ fields into union u_, with new plt field.
4424         (Fde::Fde): Adjust for new union field.
4425         (Fde::Fde) [Output_data version]: New constructor.
4426         (Fde::add_mapping): Only add merge mapping if there is an object.
4427         (class Cie): Update declarations.
4428         (class Eh_frame): Declare add_ehframe_for_plt.
4429         * layout.cc (Layout::layout_eh_frame): Break out code into
4430         make_eh_frame_section, and call it.
4431         (Layout::make_eh_frame_section): New function.
4432         (Layout::add_eh_frame_for_plt): New function.
4433         * layout.h (class Layout): Update declarations.
4434         * merge.cc (Merge_map::add_mapping): Add assertion.
4435         * i386.cc: Include "dwarf.h".
4436         (class Output_data_plt_i386): Make first_plt_entry,
4437         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
4438         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
4439         and plt_eh_frame_fde.
4440         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
4441         boundary.  Call add_eh_frame_for_plt if appropriate.
4442         * x86_64.cc: Include "dwarf.h".
4443         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
4444         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
4445         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
4446         and plt_eh_frame_fde.
4447         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
4448         appropriate.
4449
4450 2011-06-29  Ian Lance Taylor  <iant@google.com>
4451
4452         PR gold/12629
4453         * object.cc (Sized_relobj_file::layout_section): Change shdr
4454         parameter to be const.
4455         (Sized_relobj_file::layout_eh_frame_section): New function, broken
4456         out of do_layout.
4457         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
4458         appropriate.  Call layout_eh_frame_section.
4459         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
4460         sections.
4461         * object.h (class Sized_relobj_file): Update declarations.
4462
4463 2011-06-29  Ian Lance Taylor  <iant@google.com>
4464
4465         PR gold/12652
4466         * script.cc (Token::integer_value): Accept trailing M/m/K/k
4467         modifier.
4468         (Lex::gather_token): Accept trailing M/m/K/k for integers.
4469
4470 2011-06-29  Ian Lance Taylor  <iant@google.com>
4471
4472         PR gold/12675
4473         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
4474         SHT_X86_64_UNWIND.
4475         * layout.cc (Layout::layout_eh_frame): Likewise.
4476
4477 2011-06-29  Ian Lance Taylor  <iant@google.com>
4478
4479         PR gold/12695
4480         * layout.cc (Layout::symtab_section_shndx): New function.
4481         * layout.h (class Layout): Declare symtab_section_shndx.
4482         * output.cc (Output_section::write_header): Call it.
4483
4484 2011-06-29  Ian Lance Taylor  <iant@google.com>
4485
4486         PR gold/12818
4487         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
4488         symbols which are not used in a relocation.
4489
4490 2011-06-28  Ian Lance Taylor  <iant@google.com>
4491
4492         PR gold/12898
4493         * layout.cc (Layout::segment_precedes): Don't crash if a linker
4494         script create indistinguishable segments.
4495         (Layout::set_segment_offsets): Use stable_sort when sorting
4496         segments.  Pass this to Compare_segments constructor.
4497         * layout.h (class Layout): Make segment_precedes non-static.
4498         (class Compare_segments): Change from struct to class.  Add
4499         layout_ field.  Add constructor.
4500         * script-sections.cc
4501         (Script_sections::attach_sections_using_phdrs_clause): Rename
4502         local orphan to is_orphan.  Don't report failure to put empty
4503         section in segment.  On attachment failure, report name of
4504         section, and attach to first PT_LOAD segment.
4505
4506 2011-06-28  Ian Lance Taylor  <iant@google.com>
4507
4508         PR gold/12934
4509         * target-select.cc (Target_selector::Target_selector): Add
4510         emulation parameter.  Change all callers.
4511         (select_target_by_bfd_name): Rename from select_target_by_name.
4512         Change all callers.
4513         (select_target_by_emulation): New function.
4514         (supported_emulation_names): New function.
4515         * target-select.h (class Target_selector): Add emulation_ field.
4516         Update declarations.
4517         (Target_selector::recognize_by_bfd_name): Rename from
4518         recognize_by_name.  Change all callers.
4519         (Target_selector::supported_bfd_names): Rename from
4520         supported_names.  Change all callers.
4521         (Target_selector::recognize_by_emulation): New function.
4522         (Target_selector::supported_emulations): New function.
4523         (Target_selector::emulation): New function.
4524         (Target_selector::do_recognize_by_bfd_name): Rename from
4525         do_recognize_by_name.  Change all callers.
4526         (Target_selector::do_supported_bfd_names): Rename from
4527         do_supported_names.  Change all callers.
4528         (Target_selector::do_recognize_by_emulation): New function.
4529         (Target_selector::do_supported_emulations): New function.
4530         (select_target_by_bfd_name): Change name in declaration.
4531         (select_target_by_emulation): Declare.
4532         (supported_emulation_names): Declare.
4533         * parameters.cc (parameters_force_valid_target): Try to find
4534         target based on emulation from -m option.
4535         * options.h (class General_options): Change doc string for -m.
4536         * options.cc (help): Print emulations.
4537         (General_options::parse_V): Likewise.
4538         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
4539         Add emulation parameter.  Change all callers.
4540
4541 2011-06-28  Ian Lance Taylor  <iant@google.com>
4542
4543         * target.h (class Target): Add osabi_ field.
4544         (Target::osabi): New function.
4545         (Target::set_osabi): New function.
4546         (Target::Target): Initialize osabi_.
4547         (Target::do_adjust_elf_header): Make pure virtual.
4548         (Sized_target::do_adjust_elf_header): Declare.
4549         * target.cc (Sized_target::do_adjust_elf_header): New function.
4550         (class Sized_target): Instantiate all versions.
4551         * freebsd.h (class Target_freebsd): Remove.
4552         (Target_selector_freebsd::do_recognize): Call set_osabi on
4553         Target.
4554         (Target_selector_freebsd::do_recognize_by_name): Likewise.
4555         (Target_selector_freebsd::set_osabi): Remove.
4556         * i386.cc (class Target_i386): Inherit from Sized_target rather
4557         than Target_freebsd.
4558         * x86_64.cc (class Target_x86_64): Likewise.
4559
4560 2011-06-28  Ian Lance Taylor  <iant@google.com>
4561
4562         * target.h (Target::can_check_for_function_pointers): Rewrite.
4563         Make non-virtual.
4564         (Target::can_icf_inline_merge_sections): Likewise.
4565         (Target::section_may_have_icf_unsafe_poineters): Likewise.
4566         (Target::Target_info): Add can_icf_inline_merge_sections field.
4567         (Target::do_can_check_for_function_pointers): New virtual
4568         function.
4569         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
4570         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
4571         from can_check_for_function_pointers, move in file.
4572         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
4573         section_may_have_icf_unsafe_poineters, move in file.
4574         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
4575         * i386.cc (Target_i386::do_can_check_for_function_pointers):
4576         Rename from can_check_for_function_pointers, move in file.
4577         (Target_i386::can_icf_inline_merge_sections): Remove.
4578         (Target_i386::i386_info): Initialize
4579         can_icf_inline_merge_sections.
4580         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
4581         Initialize can_icf_inline_merge_sections.
4582         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
4583         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
4584         Rename from can_check_for_function_pointers, move in file.
4585         (Target_x86_64::can_icf_inline_merge_sections): Remove.
4586         (Target_x86_64::x86_64_info): Initialize
4587         can_icf_inline_merge_sections.
4588         * testsuite/testfile.cc (Target_test::test_target_info):
4589         Likewise.
4590         * icf.cc (get_section_contents): Correct formatting.
4591
4592 2011-06-27  Ian Lance Taylor  <iant@google.com>
4593
4594         * symtab.cc (Symbol::versioned_name): New function.
4595         (Symbol_table::add_to_final_symtab): Use versioned_name when
4596         appropriate.
4597         (Symbol_table::sized_write_symbol): Likewise.
4598         * symtab.h (class Symbol): Declare versioned_name.
4599         * stringpool.h (class Stringpool_template): Add variant of add
4600         which takes a std::basic_string.
4601         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
4602         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
4603         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
4604         (ver_test_12.o): New target.
4605         * testsuite/Makefile.in: Rebuild.
4606
4607 2011-06-27  Doug Kwan  <dougkwan@google.com>
4608
4609         * arm.cc (Arm_relocate_functions::thm_jump8,
4610         Arm_relocate_functions::thm_jump11): Use a wider signed
4611         type to compute offset.
4612         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
4613         arm_thm_jump8.
4614         * testsuite/Makefile.in: Regenerate.
4615         * testsuite/arm_branch_in_range.sh: Check test results of
4616         arm_thm_jump11 and arm_thm_jump8.
4617         * testsuite/arm_thm_jump11.s: New test source file.
4618         * testsuite/arm_thm_jump11.t: New linker script.
4619         * testsuite/arm_thm_jump8.s: New test source file.
4620         * testsuite/arm_thm_jump8.t: New linker script.
4621
4622 2011-06-24  Ian Lance Taylor  <iant@google.com>
4623
4624         * layout.cc: Include "object.h".
4625         (ctors_sections_in_init_array): New static variable.
4626         (Layout::is_ctors_in_init_array): New function.
4627         (Layout::layout): Add entry to ctors_sections_in_init_array if
4628         appropriate.
4629         * layout.h (class Layout): Declare is_ctors_in_init_array.
4630         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
4631         is_ctors_reverse_view is set.
4632         (Sized_relobj_file::write_sections): Add layout parameter.  Change
4633         all callers.  Set is_ctors_reverse_view field of View_size.
4634         (Sized_relobj_file::reverse_words): New function.
4635         * object.h (Sized_relobj_file::View_size): Add
4636         is_ctors_reverse_view field.
4637         (class Sized_relobj_file): Update declarations.
4638         * testsuite/initpri3.c: New test.
4639         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
4640         initpri3b.
4641         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
4642         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
4643         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
4644         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
4645         * testsuite/Makefile.in: Rebuild.
4646
4647 2011-06-24  Cary Coutant  <ccoutant@google.com>
4648
4649         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
4650         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
4651         (debug_msg_cdebug.err): New targets.
4652         * testsuite/Makefile.in: Regenerate.
4653         * testsuite/debug_msg.sh: Check output of link with compressed debug.
4654         Fix checks for link with shared library.
4655
4656 2011-06-24  Doug Kwan  <dougkwan@google.com>
4657
4658         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
4659         skip empty text sections.
4660         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
4661
4662 2011-06-22  Ian Lance Taylor  <iant@google.com>
4663
4664         PR gold/12910
4665         * options.h (class General_options): Add --ctors-in-init-array.
4666         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
4667         friends as SHT_PROGBITS for merging sections.
4668         (Layout::layout): Remove special handling of .init_array and
4669         friends.  Don't sort if doing relocatable link.  Sort for .ctors
4670         and .dtors if ctors_in_init_array.
4671         (Layout::make_output_section): Force correct section types for
4672         .init_array and friends.  Don't sort if doing relocatable link,
4673         Don't sort .ctors and .dtors if ctors_in_init_array.
4674         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
4675         (Layout::output_section_name): Add relobj parameter.  Change all
4676         callers.  Handle .ctors. and .dtors. in code rather than table.
4677         Handle .ctors and .dtors if ctors_in_init_array.
4678         (Layout::match_file_name): New function, moved from output.cc.
4679         * layout.h (class Layout): Update declarations.
4680         * output.cc: Include "layout.h".
4681         (Input_section_sort_entry::get_priority): New function.
4682         (Input_section_sort_entry::match_file_name): Just call
4683         Layout::match_file_name.
4684         (Output_section::Input_section_sort_init_fini_compare::operator()):
4685         Handle .ctors and .dtors.  Sort by explicit priority rather than
4686         by name.
4687         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
4688         * testsuite/initpri2.c: New test.
4689         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
4690         (check_PROGRAMS): Add initpri2.
4691         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
4692         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
4693         * configure, testsuite/Makefile.in: Rebuild.
4694
4695 2011-06-19  Ian Lance Taylor  <iant@google.com>
4696
4697         PR gold/12880
4698         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
4699         .interp section to a PT_INTERP segment even if we have seen a
4700         --dynamic-linker option.  Don't do it if we have seen a PHDRS
4701         clause in a linker script.
4702         (Layout::finalize): Don't create a .interp section if we've
4703         already create a PT_INTERP segment.
4704         (Layout::create_interp): Always call choose_output_section (revert
4705         patch of 2011-06-17).  Don't create PT_INTERP segment.
4706         * script-sections.cc
4707         (Script_sections::create_note_and_tls_segments): Add a .interp
4708         section to a PT_INTERP segment even if we have seen a
4709         --dynamic-linker option.
4710
4711 2011-06-18  Ian Lance Taylor  <iant@google.com>
4712
4713         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
4714         merely because a non-PT_LOAD segment has a dynamic reloc.
4715
4716 2011-06-18  Ian Lance Taylor  <iant@google.com>
4717
4718         * layout.cc (Layout::finish_dynamic_section): Don't create
4719         DT_FLAGS entry if not needed.
4720
4721 2011-06-18  Ian Lance Taylor  <iant@google.com>
4722
4723         PR gold/12745
4724         * layout.cc (Layout::layout_eh_frame): Correct handling of
4725         writable .eh_frame section.
4726
4727 2011-06-17  Ian Lance Taylor  <iant@google.com>
4728
4729         PR gold/12893
4730         * resolve.cc (Symbol_table::resolve): Don't give an error if a
4731         symbol is redefined with the exact same object and value.
4732
4733 2011-06-17  Ian Lance Taylor  <iant@google.com>
4734
4735         PR gold/12880
4736         * layout.h (class Layout): Add interp_segment_ field.
4737         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
4738         (Layout::attach_allocated_section_to_segment): If making shared
4739         library, put .interp section in PT_INTERP segment.
4740         (Layout::finalize): Also call create_interp if -dynamic-linker
4741         option was used.
4742         (Layout::create_interp): Assert that there is no PT_INTERP
4743         segment.  If not using a SECTIONS clause, use make_output_section.
4744         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
4745         * script-sections.cc
4746         (Script_sections::create_note_and_tls_segments): If making shared
4747         library, put .interp section in PT_INTERP segment.
4748
4749 2011-06-17  Ian Lance Taylor  <iant@google.com>
4750
4751         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
4752         when making a shared library.
4753
4754 2011-06-17  Ian Lance Taylor  <iant@google.com>
4755
4756         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
4757         parameter.  Change all callers.  Don't issue warning about PC32
4758         against locally defined symbol.
4759
4760 2011-06-16  Ian Lance Taylor  <iant@google.com>
4761
4762         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
4763         occurs in same object.
4764
4765 2011-06-14  Alan Modra  <amodra@gmail.com>
4766
4767         * po/POTFILES.in: Regenerate.
4768
4769 2011-06-09  Ian Lance Taylor  <iant@google.com>
4770
4771         * script-sections.cc
4772         (Orphan_output_section::set_section_addresses): For a relocatable
4773         link set address to 0.
4774
4775 2011-06-09  Cary Coutant  <ccoutant@google.com>
4776
4777         PR gold/12804
4778         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
4779         used with --compress-debug-sections.
4780         * gold/object.cc (Sized_relobj_file::do_layout): Report
4781         uncompressed size of compressed input sections.
4782
4783 2011-06-08  Cary Coutant  <ccoutant@google.com>
4784
4785         PR gold/12804
4786         * testsuite/two_file_test_2_v1.cc: Change initialization of
4787         v2 to keep it in .data.
4788
4789 2011-06-07  Cary Coutant  <ccoutant@google.com>
4790
4791         * common.cc (Symbol_table::do_allocate_commons_list): Call
4792         gold_fallback.
4793         * errors.cc (Errors::fatal): Adjust call to gold_exit.
4794         (Errors::fallback): New function.
4795         (gold_fallback): New function.
4796         * errors.h (Errors::fallback): New function.
4797         * gold.cc (gold_exit): Change status parameter to enum; adjust
4798         all callers.
4799         (queue_initial_tasks): Call gold_fallback.
4800         * gold.h: Include cstdlib.
4801         (Exit_status): New enum type.
4802         (gold_exit): Change status parameter to enum.
4803         (gold_fallback): New function.
4804         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
4805         (Layout::create_symtab_sections): Likewise.
4806         (Layout::create_shdrs): Likewise.
4807         * main.cc (main): Adjust call to gold_exit.
4808         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
4809         (Output_data_got::add_got_entry_pair): Likewise.
4810         (Output_section::add_input_section): Likewise.
4811         (Output_section::add_output_section_data): Likewise.
4812         (Output_segment::set_section_list_addresses): Likewise.
4813         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
4814
4815 2011-06-07  Cary Coutant  <ccoutant@google.com>
4816
4817         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
4818         for incremental links.
4819         * output.cc (Output_segment::set_section_list_addresses): Remove
4820         FIXME and test for TLS or BSS.
4821
4822 2011-06-07  Cary Coutant  <ccoutant@google.com>
4823
4824         * testsuite/Makefile.am: Add incremental_copy_test,
4825         incremental_common_test_1.
4826         * testsuite/Makefile.in: Regenerate.
4827         * testsuite/common_test_1_v1.c: New source file.
4828         * testsuite/common_test_1_v2.c: New source file.
4829         * testsuite/copy_test_v1.cc: New source file.
4830
4831 2011-06-07  Cary Coutant  <ccoutant@google.com>
4832
4833         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
4834         update, allocate common from bss section's free list.
4835         * incremental-dump.cc (dump_incremental_inputs): Print flag for
4836         linker-defined symbols.
4837         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
4838         Skip GOT and PLT entries that are no longer referenced.
4839         (Output_section_incremental_inputs::write_info_blocks): Mark
4840         linker-defined symbols.
4841         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
4842         * output.cc (Output_section::allocate): New function.
4843         * output.h (Output_section::allocate): New function.
4844         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
4845         linker-defined symbols.
4846         (Symbol::override_base_with_special): Copy is_predefined_ flag.
4847         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
4848         (Symbol::init_base_output_data): Likewise.
4849         (Symbol::init_base_output_segment): Likewise.
4850         (Symbol::init_base_constant): Likewise.
4851         (Sized_symbol::init_output_data): Likewise.
4852         (Sized_symbol::init_output_segment): Likewise.
4853         (Sized_symbol::init_constant): Likewise.
4854         (Symbol_table::do_define_in_output_data): Likewise.
4855         (Symbol_table::do_define_in_output_segment): Likewise.
4856         (Symbol_table::do_define_as_constant): Likewise.
4857         * symtab.h (Symbol::is_predefined): New function.
4858         (Symbol::init_base_output_data): Add is_predefined parameter.
4859         (Symbol::init_base_output_segment): Likewise.
4860         (Symbol::init_base_constant): Likewise.
4861         (Symbol::is_predefined_): New data member.
4862         (Sized_symbol::init_output_data): Add is_predefined parameter.
4863         (Sized_symbol::init_output_segment): Likewise.
4864         (Sized_symbol::init_constant): Likewise.
4865         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
4866
4867 2011-06-07  Cary Coutant  <ccoutant@google.com>
4868
4869         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
4870         instead of emit_copy_reloc.
4871         (Copy_relocs::emit_copy_reloc): Refactor.
4872         (Copy_relocs::make_copy_reloc): New function.
4873         (Copy_relocs::add_copy_reloc): Remove.
4874         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
4875         section.
4876         (Copy_relocs::make_copy_reloc): New function.
4877         (Copy_relocs::add_copy_reloc): Remove.
4878         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
4879         unchanged input files.
4880         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
4881         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
4882         Reserve BSS space for COPY relocations.
4883         (Sized_incremental_binary::do_emit_copy_relocs): New function.
4884         (Output_section_incremental_inputs::write_info_blocks): Record
4885         whether a symbol is copied from a shared object.
4886         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
4887         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
4888         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
4889         (Incremental_input_entry_reader::get_output_symbol_index): Add
4890         is_copy parameter.
4891         (Incremental_binary::emit_copy_relocs): New function.
4892         (Incremental_binary::do_emit_copy_relocs): New function.
4893         (Sized_incremental_binary::Sized_incremental_binary): Initialize
4894         new data member.
4895         (Sized_incremental_binary::add_copy_reloc): New function.
4896         (Sized_incremental_binary::do_emit_copy_relocs): New function.
4897         (Sized_incremental_binary::Copy_reloc): New struct.
4898         (Sized_incremental_binary::Copy_relocs): New typedef.
4899         (Sized_incremental_binary::copy_relocs_): New data member.
4900         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
4901         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
4902         * target.h (Sized_target::emit_copy_reloc): New function.
4903         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
4904
4905 2011-06-02  Cary Coutant  <ccoutant@google.com>
4906
4907         PR gold/12163
4908         * gold/archive.cc (Archive::Archive): Initialize new data member.
4909         (Archive::include_all_members): Return if archive has already been
4910         included.
4911         * gold/archive.h (Archive::include_all_members_): New data member.
4912
4913 2011-06-02  Nick Clifton  <nickc@redhat.com>
4914
4915         * dynobj.h: Fix spelling mistake in comment.
4916         * output.cc: Likewise.
4917
4918 2011-05-31  Doug Kwan  <dougkwan@google.com>
4919             Asier Llano
4920
4921         PR gold/12826
4922         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
4923         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
4924         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
4925         redundant arm_exidx_test.so.
4926         * testsuite/Makefile.in: Regenerate.
4927         (check_SCRIPTS): Add pr12826.sh
4928         (check_DATA): Add pr12826.stdout
4929         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
4930         * testsuite/pr12826.sh: New file.
4931         * testsuite/pr12826_1.s: Ditto.
4932         * testsuite/pr12826_1.s: Ditto.
4933
4934 2011-05-30  Ian Lance Taylor  <iant@google.com>
4935
4936         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
4937         sections.
4938
4939 2011-05-29  Ian Lance Taylor  <iant@google.com>
4940
4941         PR gold/12804
4942         * testsuite/Makefile.am: Use different file name for two_file_test
4943         temporary file for each incremental test.
4944         * testsuite/Makefile.in: Rebuild.
4945
4946 2011-05-29  Ian Lance Taylor  <iant@google.com>
4947
4948         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
4949         binary input file is empty.
4950
4951 2011-05-27  Ian Lance Taylor  <iant@google.com>
4952
4953         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
4954         (ver_test_9.so): Likewise.
4955         * testsuite/Makefile.in: Rebuild.
4956
4957 2011-05-26 Cary Coutant  <ccoutant@google.com>
4958
4959         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
4960         * incremental.cc (Incremental_inputs::report_input_section): Fix
4961         comment, indentation.
4962         (Incremental_inputs::report_comdat_group): New function.
4963         (Output_section_incremental_inputs::set_final_data_size): Adjust size
4964         of data for incremental input file entry.
4965         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
4966         group count, COMDAT group signatures.
4967         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
4968         an unchanged input file.
4969         * incremental.h (Incremental_object_entry::Incremental_object_entry):
4970         Initialize new data member.
4971         (Incremental_object_entry::add_comdat_group): New function.
4972         (Incremental_object_entry::get_comdat_group_count): New function.
4973         (Incremental_object_entry::get_comdat_signature_key): New function.
4974         (Incremental_object_entry::groups_): New data member.
4975         (Incremental_inputs::report_comdat_group): New function.
4976         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
4977         data for incremental input file entry.
4978         (Incremental_input_entry_reader::get_comdat_group_count): New function.
4979         (Incremental_input_entry_reader::get_input_section): Adjust size of
4980         data for incremental input file entry.
4981         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
4982         (Incremental_input_entry_reader::get_comdat_group_signature): New
4983         function.
4984         * object.cc (Sized_relobj::include_section_group): Report kept
4985         COMDAT groups for incremental links.
4986
4987 2011-05-24  David Meyer  <pdox@google.com>
4988
4989         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
4990         with name parameter.  Add found_name parameter.
4991         * fileread.cc (Input_file::find_file): Adjust code accordingly.
4992         * dirsearch.h (class Dirsearch): Update declaration.
4993
4994 2011-05-24  Ian Lance Taylor  <iant@google.com>
4995
4996         * archive.cc (Library_base::should_include_member): Pull in object
4997         from archive if it defines the entry symbol.
4998         * parameters.cc (Parameters::entry): New function.
4999         * parameters.h (class Parameters): Declare entry.
5000         * output.h (class Output_file_header): Remove entry_ field.
5001         * output.cc (Output_file_header::Output_file_header): Remove entry
5002         parameter.  Change all callers.
5003         (Output_file_header::entry): Use parameters->entry.
5004         * gold.cc (queue_middle_tasks): Likewise.
5005         * plugin.cc (Plugin_hook::run): Likewise.
5006
5007 2011-05-24 Cary Coutant  <ccoutant@google.com>
5008
5009         * gold.cc (queue_initial_tasks): Pass incremental base filename
5010         to Output_file::open_base_file; don't print error message.
5011         * incremental-dump.cc (main): Adjust call to
5012         Output_file::open_for_modification.
5013         * incremental-dump.cc (main): Likewise.
5014         * incremental.cc (Incremental_inputs::report_command_line):
5015         Ignore --incremental-base option when comparing command lines.
5016         Ignore parameter when given as separate argument.
5017         * options.h (class General_options): Add --incremental-base.
5018         * output.cc (Output_file::Output_file):
5019         (Output_file::open_base_file): Add base_name and writable parameters;
5020         read base file into new file; print error message here.
5021         (Output_file::map_no_anonymous): Add writable parameter; adjust all
5022         callers.
5023         * output.h (Output_file::open_for_modification): Rename to...
5024         (Output_file::open_base_file): ...this; add base_name and
5025         writable parameters; adjust all callers.
5026         (Output_file::map_no_anonymous): Add writable parameter; adjust all
5027         callers.
5028         * testsuite/Makefile.am (incremental_test_4): Test
5029         --incremental-base.
5030         * testsuite/Makefile.in: Regenerate.
5031
5032 2011-05-24 Cary Coutant  <ccoutant@google.com>
5033
5034         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
5035         incremental_test_4.
5036         * testsuite/Makefile.in: Regenerate.
5037         * testsuite/two_file_test_1_v1.cc: New test source file.
5038         * testsuite/two_file_test_1b_v1.cc: New test source file.
5039         * testsuite/two_file_test_2_v1.cc: New test source file.
5040
5041 2011-05-24 Cary Coutant  <ccoutant@google.com>
5042
5043         * dynobj.h (Dynobj::do_dynobj): New function.
5044         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
5045         flag and soname for shared objects.
5046         * incremental.cc (Incremental_inputs::report_object): Make
5047         either Incremental_object_entry or Incremental_dynobj_entry; add
5048         soname to string table.
5049         (Incremental_inputs::report_input_section): Add assertion.
5050         (Output_section_incremental_inputs::set_final_data_size): Adjust
5051         type of input file entry for shared libraries; adjust size of
5052         shared library info entry.
5053         (Output_section_incremental_inputs::write_input_files): Write
5054         as_needed flag for shared libraries.
5055         (Output_section_incremental_inputs::write_info_blocks): Adjust type
5056         of input file entry for shared libraries; write soname.
5057         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
5058         soname from incremental info.
5059         * incremental.h (enum Incremental_input_flags): Add
5060         INCREMENTAL_INPUT_AS_NEEDED.
5061         (Incremental_input_entry::Incremental_input_entry): Initialize new
5062         data member.
5063         (Incremental_input_entry::set_as_needed): New function.
5064         (Incremental_input_entry::as_needed): New function.
5065         (Incremental_input_entry::do_dynobj_entry): New function.
5066         (Incremental_input_entry::as_needed_): New data member.
5067         (Incremental_object_entry::Incremental_object_entry): Don't check
5068         for shared library.
5069         (Incremental_object_entry::do_type): Likewise.
5070         (class Incremental_dynobj_entry): New class.
5071         (Incremental_input_entry_reader::as_needed): New function.
5072         (Incremental_input_entry_reader::get_soname): New function.
5073         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
5074         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
5075         size of shared library info entry.
5076         * layout.cc (Layout::finish_dynamic_section): Don't test for
5077         incremental link when adding DT_NEEDED entries.
5078         * object.h (Object::Object): Initialize new data member.
5079         (Object::dynobj): New function.
5080         (Object::set_as_needed): New function.
5081         (Object::as_needed): New function.
5082         (Object::do_dynobj): New function.
5083         (Object::as_needed_): New data member.
5084
5085 2011-05-24 Cary Coutant  <ccoutant@google.com>
5086
5087         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
5088         info; adjust display of GOT entries.
5089         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
5090         vector of input objects; remove file_status_.
5091         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
5092         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
5093         got_plt reader; call target hooks to reserve GOT entries.
5094         (Output_section_incremental_inputs::set_final_data_size): Adjust size
5095         of input file info header and GOT info entry.
5096         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
5097         relocation info.
5098         (Got_plt_view_info::got_descriptor): Remove.
5099         (Got_plt_view_info::sym_index): New data member.
5100         (Got_plt_view_info::input_index): New data member.
5101         (Local_got_offset_visitor::visit): Write input file index.
5102         (Global_got_offset_visitor::visit): Write 0 for input file index.
5103         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
5104         with sym_index and input_index.
5105         (Output_section_incremental_inputs::write_got_plt): Adjust size of
5106         incremental info GOT entry; replace got_descriptor with input_index.
5107         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
5108         map from input file index to object.
5109         (Sized_relobj_incr::do_layout): Replace direct data member reference
5110         with accessor function.
5111         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
5112         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
5113         Adjust size of input file info header.
5114         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
5115         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
5116         (Incremental_input_entry_reader::get_input_section): Adjust size of
5117         input file info header.
5118         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
5119         of incremental info GOT entry.
5120         (Incremental_got_plt_reader::get_got_desc): Remove.
5121         (Incremental_got_plt_reader::get_got_symndx): New function.
5122         (Incremental_got_plt_reader::get_got_input_index): New function.
5123         (Sized_incremental_binary::Sized_incremental_binary): Remove
5124         file_status_; add input_objects_.
5125         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
5126         (Sized_incremental_binary::set_file_is_unchanged): Remove.
5127         (Sized_incremental_binary::file_is_unchanged): Remove.
5128         (Sized_incremental_binary::set_input_object): New function.
5129         (Sized_incremental_binary::input_object): New function.
5130         (Sized_incremental_binary::file_status_): Remove.
5131         (Sized_incremental_binary::input_objects_): New data member.
5132         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
5133         references.
5134         (Sized_relobj_incr::invalid_address): Move to base class.
5135         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
5136         class.
5137         (Sized_relobj_incr::do_output_section_offset): Likewise.
5138         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
5139         (Sized_relobj_incr::section_offsets_): Likewise.
5140         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
5141         function.
5142         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
5143         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
5144         with accessor function.
5145         (Sized_relobj_file::do_layout): Likewise.
5146         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
5147         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
5148         (Sized_relobj_file::compute_final_local_value): Replace refs to
5149         section_offsets_ with accessor function.
5150         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
5151         * object.h (Relobj::Relobj): Initialize new data members.
5152         (Relobj::add_dyn_reloc): New function.
5153         (Relobj::first_dyn_reloc): New function.
5154         (Relobj::dyn_reloc_count): New function.
5155         (Relobj::first_dyn_reloc_): New data member.
5156         (Relobj::dyn_reloc_count_): New data member.
5157         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
5158         references.
5159         (Sized_relobj::Address): New typedef.
5160         (Sized_relobj::invalid_address): Move here from child class.
5161         (Sized_relobj::Sized_relobj): Initialize new data members.
5162         (Sized_relobj::sized_relobj): New function.
5163         (Sized_relobj::is_output_section_offset_invalid): Move here from
5164         child class.
5165         (Sized_relobj::get_output_section_offset): Likewise.
5166         (Sized_relobj::local_has_got_offset): Likewise.
5167         (Sized_relobj::local_got_offset): Likewise.
5168         (Sized_relobj::set_local_got_offset): Likewise.
5169         (Sized_relobj::do_for_all_local_got_entries): Likewise.
5170         (Sized_relobj::clear_got_offsets): New function.
5171         (Sized_relobj::section_offsets): Move here from child class.
5172         (Sized_relobj::do_output_section_offset): Likewise.
5173         (Sized_relobj::do_set_section_offset): Likewise.
5174         (Sized_relobj::Local_got_offsets): Likewise.
5175         (Sized_relobj::local_got_offsets_): Likewise.
5176         (Sized_relobj::section_offsets_): Likewise.
5177         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
5178         references.
5179         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
5180         class.
5181         (Sized_relobj_file::sized_relobj): New function
5182         (Sized_relobj_file::local_has_got_offset): Move to base class.
5183         (Sized_relobj_file::local_got_offset): Likewise.
5184         (Sized_relobj_file::set_local_got_offset): Likewise.
5185         (Sized_relobj_file::get_output_section_offset): Likewise.
5186         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
5187         (Sized_relobj_file::do_output_section_offset): Likewise.
5188         (Sized_relobj_file::do_set_section_offset): Likewise.
5189         (Sized_relobj_file::Local_got_offsets): Likewise.
5190         (Sized_relobj_file::local_got_offsets_): Likewise.
5191         (Sized_relobj_file::section_offsets_): Likewise.
5192         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
5193         (all constructors).
5194         (set_needs_dynsym_index): Convert relobj to derived class pointer.
5195         (Output_reloc::get_symbol_index): Likewise.
5196         (Output_reloc::local_section_offset): Likewise.
5197         (Output_reloc::get_address): Likewise.
5198         (Output_reloc::symbol_value): Likewise.
5199         (Output_data_got::reserve_slot): Move to class definition.
5200         (Output_data_got::reserve_local): New function.
5201         (Output_data_got::reserve_slot_for_global): Remove.
5202         (Output_data_got::reserve_global): New function.
5203         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
5204         (all constructors, two instantiations).
5205         (Output_reloc::get_relobj): New function (two instantiations).
5206         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
5207         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
5208         (Output_data_reloc::add_global): Adjust type of relobj.
5209         (Output_data_reloc::add_global_relative): Likewise.
5210         (Output_data_reloc::add_symbolless_global_addend): Likewise.
5211         (Output_data_reloc::add_local): Likewise.
5212         (Output_data_reloc::add_local_relative): Likewise.
5213         (Output_data_reloc::add_symbolless_local_addend): Likewise.
5214         (Output_data_reloc::add_local_section): Likewise.
5215         (Output_data_reloc::add_output_section): Likewise.
5216         (Output_data_reloc::add_absolute): Likewise.
5217         (Output_data_reloc::add_target_specific): Likewise.
5218         (Output_data_got::reserve_slot): Move definition here.
5219         (Output_data_got::reserve_local): New function.
5220         (Output_data_got::reserve_global): New function.
5221         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
5222         section_offsets_ with accessor function.
5223         (Sized_relobj_file::write_sections): Likewise.
5224         (Sized_relobj_file::do_relocate_sections): Likewise.
5225         * target.h (Sized_target::reserve_local_got_entry): New function.
5226         (Sized_target::reserve_global_got_entry): New function.
5227         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
5228         (Target_x86_64::reserve_global_got_entry): New function.
5229         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
5230
5231 2011-05-23 Cary Coutant  <ccoutant@google.com>
5232
5233         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
5234         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
5235         bit when checking got_type.
5236         * incremental.cc (Sized_incremental_binary::setup_readers):
5237         Store symbol table and string table locations; initialize bit vector
5238         of file status flags.
5239         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
5240         unchanged files.
5241         (Sized_incremental_binary::do_process_got_plt): New function.
5242         (Sized_incremental_binary::get_symtab_view): Use stored locations.
5243         (Output_section_incremental_inputs::set_final_data_size): Record
5244         file index for each input file.
5245         (Output_section_incremental_inputs::write_got_plt): Store file index
5246         instead of input entry offset for each GOT entry.
5247         * incremental.h
5248         (Incremental_input_entry::Incremental_input_entry): Initialize new
5249         data member.
5250         (Incremental_input_entry::set_offset): Store file index.
5251         (Incremental_input_entry::get_file_index): New function.
5252         (Incremental_input_entry::file_index_): New data member.
5253         (Incremental_binary::process_got_plt): New function.
5254         (Incremental_binary::do_process_got_plt): New function.
5255         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
5256         data members.
5257         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
5258         (Sized_incremental_binary::set_file_is_unchanged): New function.
5259         (Sized_incremental_binary::file_is_unchanged): New function.
5260         (Sized_incremental_binary::do_process_got_plt): New function.
5261         (Sized_incremental_binary::file_status_): New data member.
5262         (Sized_incremental_binary::main_symtab_loc_): New data member.
5263         (Sized_incremental_binary::main_strtab_loc_): New data member.
5264         * output.cc (Output_data_got::Got_entry::write): Add case
5265         RESERVED_CODE.
5266         (Output_data_got::add_global): Call add_got_entry.
5267         (Output_data_got::add_global_plt): Likewise.
5268         (Output_data_got::add_global_with_rel): Likewise.
5269         (Output_data_got::add_global_with_rela): Likewise.
5270         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
5271         (Output_data_got::add_global_pair_with_rela): Likewise.
5272         (Output_data_got::add_local): Call add_got_entry.
5273         (Output_data_got::add_local_plt): Likewise.
5274         (Output_data_got::add_local_with_rel): Likewise.
5275         (Output_data_got::add_local_with_rela): Likewise.
5276         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
5277         (Output_data_got::add_local_pair_with_rela): Likewise.
5278         (Output_data_got::reserve_slot): New function.
5279         (Output_data_got::reserve_slot_for_global): New function.
5280         (Output_data_got::add_got_entry): New function.
5281         (Output_data_got::add_got_entry_pair): New function.
5282         (Output_section::add_output_section_data): Edit FIXME.
5283         * output.h
5284         (Output_section_data_build::Output_section_data_build): New
5285         constructor with size parameter.
5286         (Output_data_space::Output_data_space): Likewise.
5287         (Output_data_got::Output_data_got): Initialize new data member; new
5288         constructor with size parameter.
5289         (Output_data_got::add_constant): Call add_got_entry.
5290         (Output_data_got::reserve_slot): New function.
5291         (Output_data_got::reserve_slot_for_global): New function.
5292         (class Output_data_got::Got_entry): Add RESERVED_CODE.
5293         (Output_data_got::add_got_entry): New function.
5294         (Output_data_got::add_got_entry_pair): New function.
5295         (Output_data_got::free_list_): New data member.
5296         * target.h (Sized_target::init_got_plt_for_update): New function.
5297         (Sized_target::register_global_plt_entry): New function.
5298         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
5299         Initialize new data member; call init; add constructor with PLT count.
5300         (Output_data_plt_x86_64::init): New function.
5301         (Output_data_plt_x86_64::add_relocation): New function.
5302         (Output_data_plt_x86_64::reserve_slot): New function.
5303         (Output_data_plt_x86_64::free_list_): New data member.
5304         (Target_x86_64::init_got_plt_for_update): New function.
5305         (Target_x86_64::register_global_plt_entry): New function.
5306         (Output_data_plt_x86_64::add_entry): Allocate from free list for
5307         incremental updates.
5308         (Output_data_plt_x86_64::add_relocation): New function.
5309         * testsuite/object_unittest.cc (Object_test): Set default options.
5310
5311 2011-05-16  Ian Lance Taylor  <iant@google.com>
5312
5313         * options.h (class General_options): Make -i a synonym for -r.
5314
5315 2011-05-16  Ian Lance Taylor  <iant@google.com>
5316
5317         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
5318
5319 2011-05-10 Cary Coutant  <ccoutant@google.com>
5320
5321         * object.cc (Sized_relobj::do_count_local_symbols): Check for
5322         strip_all (-s).
5323
5324 2011-05-06  Ian Lance Taylor  <iant@google.com>
5325
5326         * layout.cc (Layout::layout): If the output section flags change,
5327         update the ordering.
5328
5329 2011-04-25 Cary Coutant  <ccoutant@google.com>
5330
5331         * incremental-dump.cc (dump_incremental_inputs): Print local
5332         symbol info for each input file.
5333         * incremental.cc
5334         (Output_section_incremental_inputs::set_final_data_size): Add local
5335         symbol info to input file entries in incremental info.
5336         (Output_section_incremental_inputs::write_info_blocks): Likewise.
5337         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
5338         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
5339         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
5340         implementation.
5341         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
5342         (Sized_incr_relobj::do_relocate): Write the local symbols.
5343         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
5344         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
5345         Adjust size of input file header.
5346         (Incremental_inputs_reader::get_local_symbol_offset): New function.
5347         (Incremental_inputs_reader::get_local_symbol_count): New function.
5348         (Incremental_inputs_reader::get_input_section): Adjust size of input
5349         file header.
5350         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
5351         (Sized_incr_relobj::This): New typedef.
5352         (Sized_incr_relobj::sym_size): New const data member.
5353         (Sized_incr_relobj::Local_symbol): New struct.
5354         (Sized_incr_relobj::do_output_local_symbol_count): New function.
5355         (Sized_incr_relobj::do_local_symbol_offset): New function.
5356         (Sized_incr_relobj::local_symbol_count_): New data member.
5357         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
5358         (Sized_incr_relobj::local_symbol_index_): New data member.
5359         (Sized_incr_relobj::local_symbol_offset_): New data member.
5360         (Sized_incr_relobj::local_dynsym_offset_): New data member.
5361         (Sized_incr_relobj::local_symbols_): New data member.
5362         * object.h (Relobj::output_local_symbol_count): New function.
5363         (Relobj::local_symbol_offset): New function.
5364         (Relobj::do_output_local_symbol_count): New function.
5365         (Relobj::do_local_symbol_offset): New function.
5366         (Sized_relobj::do_output_local_symbol_count): New function.
5367         (Sized_relobj::do_local_symbol_offset): New function.
5368
5369 2011-04-22  Vladimir Simonov  <sv@sw.ru>
5370
5371         * descriptors.cc (set_close_on_exec): New function.
5372         (Descriptors::open): Use set_close_on_exec.
5373         * output.cc (S_ISLNK): Define if not defined.
5374
5375 2011-04-22 Cary Coutant  <ccoutant@google.com>
5376
5377         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
5378         global symbol map.
5379         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
5380         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
5381         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
5382         relocations.
5383         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
5384         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
5385         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
5386         * incremental.h
5387         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
5388         function.
5389         (Incremental_binary::apply_incremental_relocs): New function.
5390         (Incremental_binary::do_apply_incremental_relocs): New function.
5391         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
5392         data member.
5393         (Sized_incremental_binary::add_global_symbol): New function.
5394         (Sized_incremental_binary::global_symbol): New function.
5395         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
5396         (Sized_incremental_binary::symbol_map_): New data member.
5397         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
5398         * target.h (Sized_target::apply_relocation): New function.
5399         * target-reloc.h (apply_relocation): New function.
5400         * x86_64.cc (Target_x86_64::apply_relocation): New function.
5401
5402 2011-04-22  Doug Kwan  <dougkwan@google.com>
5403
5404         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
5405         flag of a SHT_ARM_EXIDX section.
5406         * testsuite/Makefile.am (arm_exidx_test): New test rules.
5407         * testsuite/Makefile.in: Regenerate.
5408         * testsuite/arm_exidx_test.s: New file.
5409         * testsuite/arm_exidx_test.sh: Same.
5410
5411 2011-04-20 Cary Coutant  <ccoutant@google.com>
5412
5413         PR gold/12689
5414         * archive.h (Incremental_archive_entry::Archive_member):
5415         Initialize arg_serial_ (second constructor).
5416
5417 2011-04-17  Ian Lance Taylor  <iant@google.com>
5418
5419         * object.cc (Relocate_info::location): Simplify location string.
5420         * errors.cc (Errors::error_at_location): Don't print program
5421         name.
5422         (Errors::warning_at_location): Likewise.
5423         (Errors::undefined_symbol): Likewise.
5424         * testsuite/debug_msg.sh: Update accordingly.
5425
5426 2011-04-14 Cary Coutant  <ccoutant@google.com>
5427
5428         * gold/layout.cc (Layout::symtab_section_offset): New function.
5429         * gold/layout.h (Layout::symtab_section_offset): New function.
5430         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
5431
5432 2011-04-12  Ian Lance Taylor  <iant@google.com>
5433
5434         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
5435         with MREMAP_MAYMOVE.
5436         * output.h (class Output_file): Add map_is_allocated_ field.
5437         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
5438         not available, provide stubs.  If mremap is not available, #define
5439         it to gold_mremap.
5440         (MREMAP_MAYMOVE): Define if not defined.
5441         (Output_file::Output_file): Initialize map_is_allocated_.
5442         (Output_file::resize): Check map_is_allocated_.
5443         (Output_file::map_anonymous): If mmap fails, use malloc.
5444         (Output_file::unmap): Don't do anything for an anonymous map.
5445         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
5446         is not available, provide stubs.
5447         (File_read::View::~View): Use free rather than delete[].
5448         (File_read::make_view): Use malloc rather than new[].  If mmap
5449         fails, use malloc.
5450         (File_read::find_or_make_view): Use malloc rather than new[].
5451         * gold.h: Remove HAVE_REMAP code.
5452         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
5453         exists.  Rename mremap to gold_mremap.  If mmap is not available
5454         don't do anything.
5455         * configure, config.in: Rebuild.
5456
5457 2011-04-11  Ian Lance Taylor  <iant@google.com>
5458
5459         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
5460         initialize local variable v.
5461
5462 2011-04-11  Cary Coutant  <ccoutant@google.com>
5463
5464         * archive.cc (Archive::include_member): Adjust call to
5465         report_object.
5466         (Add_archive_symbols::run): Track argument serial numbers.
5467         (Lib_group::include_member): Likewise.
5468         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
5469         * archive.h (Incremental_archive_entry::Archive_member):
5470         Initialize arg_serial_.
5471         (Archive_member::arg_serial_): New data member.
5472         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
5473         (Sized_dynobj::do_add_symbols): Track symbols when doing an
5474         incremental link.
5475         (Sized_dynobj::do_for_all_local_got_entries): New function.
5476         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
5477         function.
5478         * fileread.cc (get_mtime): New function.
5479         * fileread.h (get_mtime): New function.
5480         * gold.cc (queue_initial_tasks): Check for incremental update.
5481         (process_incremental_input): New function.
5482         (queue_middle_tasks): Don't force valid target for incremental
5483         update.
5484         * incremental-dump.cc (find_input_containing_global): Adjust
5485         size of symbol info entry.
5486         (dump_incremental_inputs): Dump argument serial number and
5487         in_system_directory flag; bias shndx by 1; print symbol names
5488         when dumping per-file symbol lists; use new symbol info readers.
5489         * incremental.cc
5490         (Output_section_incremental_inputs:update_data_size): New function.
5491         (Sized_incremental_binary::setup_readers): Setup input readers
5492         for each input file; build maps for files added from libraries
5493         and scripts.
5494         (Sized_incremental_binary::check_input_args): New function.
5495         (Sized_incremental_binary::do_check_inputs): Build map of argument
5496         serial numbers to input arguments.
5497         (Sized_incremental_binary::do_file_has_changed): Rename
5498         do_file_is_unchanged to this; compare file modification times.
5499         (Sized_incremental_binary::do_init_layout): New function.
5500         (Sized_incremental_binary::do_reserve_layout): New function.
5501         (Sized_incremental_binary::do_get_input_reader): Remove.
5502         (Sized_incremental_binary::get_symtab_view): New function.
5503         (Incremental_checker::can_incrementally_link_output_file): Remove.
5504         (Incremental_inputs::report_command_line): Exclude --debug options.
5505         (Incremental_inputs::report_archive_begin): Add parameter; track
5506         argument serial numbers; don't put input file entry for archive
5507         before archive members.
5508         (Incremental_inputs::report_archive_end): Put input file entry
5509         for archive after archive members.
5510         (Incremental_inputs::report_object): Add parameter; track argument
5511         serial numbers and in_system_directory flag.
5512         (Incremental_inputs::report_script): Add parameter; track argument
5513         serial numbers.
5514         (Output_section_incremental_inputs::set_final_data_size): Adjust
5515         size of symbol info entry; check for forwarding symbols.
5516         (Output_section_incremental_inputs::write_input_files): Write
5517         in_system_directory flag and argument serial number.
5518         (Output_section_incremental_inputs::write_info_blocks): Map section
5519         indices between incremental info and original input file; store
5520         input section index for each symbol.
5521         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
5522         change operator() to visit().
5523         (class Global_got_offset_visitor): Likewise.
5524         (class Global_symbol_visitor_got_plt):
5525         (Output_section_incremental_inputs::write_got_plt): Use new visitor
5526         classes.
5527         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
5528         (Sized_incr_relobj::do_read_symbols): New function.
5529         (Sized_incr_relobj::do_layout): New function.
5530         (Sized_incr_relobj::do_layout_deferred_sections): New function.
5531         (Sized_incr_relobj::do_add_symbols): New function.
5532         (Sized_incr_relobj::do_should_include_member): New function.
5533         (Sized_incr_relobj::do_for_all_global_symbols): New function.
5534         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
5535         (Sized_incr_relobj::do_section_size): New function.
5536         (Sized_incr_relobj::do_section_name): New function.
5537         (Sized_incr_relobj::do_section_contents): New function.
5538         (Sized_incr_relobj::do_section_flags): New function.
5539         (Sized_incr_relobj::do_section_entsize): New function.
5540         (Sized_incr_relobj::do_section_address): New function.
5541         (Sized_incr_relobj::do_section_type): New function.
5542         (Sized_incr_relobj::do_section_link): New function.
5543         (Sized_incr_relobj::do_section_info): New function.
5544         (Sized_incr_relobj::do_section_addralign): New function.
5545         (Sized_incr_relobj::do_initialize_xindex): New function.
5546         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
5547         (Sized_incr_relobj::do_read_relocs): New function.
5548         (Sized_incr_relobj::do_gc_process_relocs): New function.
5549         (Sized_incr_relobj::do_scan_relocs): New function.
5550         (Sized_incr_relobj::do_count_local_symbols): New function.
5551         (Sized_incr_relobj::do_finalize_local_symbols): New function.
5552         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
5553         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
5554         (Sized_incr_relobj::do_relocate): New function.
5555         (Sized_incr_relobj::do_set_section_offset): New function.
5556         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
5557         (Sized_incr_dynobj::do_read_symbols): New function.
5558         (Sized_incr_dynobj::do_layout): New function.
5559         (Sized_incr_dynobj::do_add_symbols): New function.
5560         (Sized_incr_dynobj::do_should_include_member): New function.
5561         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
5562         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
5563         (Sized_incr_dynobj::do_section_size): New function.
5564         (Sized_incr_dynobj::do_section_name): New function.
5565         (Sized_incr_dynobj::do_section_contents): New function.
5566         (Sized_incr_dynobj::do_section_flags): New function.
5567         (Sized_incr_dynobj::do_section_entsize): New function.
5568         (Sized_incr_dynobj::do_section_address): New function.
5569         (Sized_incr_dynobj::do_section_type): New function.
5570         (Sized_incr_dynobj::do_section_link): New function.
5571         (Sized_incr_dynobj::do_section_info): New function.
5572         (Sized_incr_dynobj::do_section_addralign): New function.
5573         (Sized_incr_dynobj::do_initialize_xindex): New function.
5574         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
5575         (make_sized_incremental_object): New function.
5576         (Incremental_library::copy_unused_symbols): New function.
5577         (Incremental_library::do_for_all_unused_symbols): New function.
5578         * incremental.h (enum Incremental_input_flags): New type.
5579         (class Incremental_checker): Remove.
5580         (Incremental_input_entry::Incremental_input_entry): Add argument
5581         serial number.
5582         (Incremental_input_entry::arg_serial): New function.
5583         (Incremental_input_entry::set_is_in_system_directory): New function.
5584         (Incremental_input_entry::is_in_system_directory): New function.
5585         (Incremental_input_entry::arg_serial_): New data member.
5586         (Incremental_input_entry::is_in_system_directory_): New data member.
5587         (class Script_info): Move here from script.h.
5588         (Script_info::Script_info): Add filename parameter.
5589         (Script_info::filename): New function.
5590         (Script_info::filename_): New data member.
5591         (Incremental_script_entry::Incremental_script_entry): Add argument
5592         serial number.
5593         (Incremental_object_entry::Incremental_object_entry): Likewise.
5594         (Incremental_object_entry::add_input_section): Build list of input
5595         sections with map to original shndx.
5596         (Incremental_object_entry::get_input_section_index): New function.
5597         (Incremental_object_entry::shndx_): New data member.
5598         (Incremental_object_entry::name_key_): Rename; adjust all refs.
5599         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
5600         (Incremental_archive_entry::Incremental_archive_entry): Add argument
5601         serial number.
5602         (Incremental_inputs::report_archive_begin): Likewise.
5603         (Incremental_inputs::report_object): Likewise.
5604         (Incremental_inputs::report_script): Likewise.
5605         (class Incremental_global_symbol_reader): New class.
5606         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
5607         and store flags and input file type.
5608         (Incremental_input_entry_reader::arg_serial): New function.
5609         (Incremental_input_entry_reader::type): Extract type from flags.
5610         (Incremental_input_entry_reader::is_in_system_directory): New function.
5611         (Incremental_input_entry_reader::get_input_section_count): Call
5612         accessor function for type.
5613         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
5614         function for type; adjust size of global symbol entry.
5615         (Incremental_input_entry_reader::get_global_symbol_count): Call
5616         accessor function for type.
5617         (Incremental_input_entry_reader::get_object_count): Likewise.
5618         (Incremental_input_entry_reader::get_object_offset): Likewise.
5619         (Incremental_input_entry_reader::get_member_count): Likewise.
5620         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
5621         (Incremental_input_entry_reader::get_member_offset): Likewise.
5622         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
5623         (Incremental_input_entry_reader::Global_symbol_info): Remove.
5624         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
5625         (Incremental_input_entry_reader::get_global_symbol_reader): New
5626         function.
5627         (Incremental_input_entry_reader::get_output_symbol_index): New
5628         function.
5629         (Incremental_input_entry_reader::type_): Remove.
5630         (Incremental_input_entry_reader::flags_): New data member.
5631         (Incremental_inputs_reader::input_file_offset): New function.
5632         (Incremental_inputs_reader::input_file_index): New function.
5633         (Incremental_inputs_reader::input_file): Call input_file_offset.
5634         (Incremental_inputs_reader::input_file_at_offset): New function.
5635         (Incremental_relocs_reader::get_r_type): Reformat.
5636         (Incremental_relocs_reader::get_r_shndx): Reformat.
5637         (Incremental_relocs_reader::get_r_offset): Reformat.
5638         (Incremental_relocs_reader::data): New function.
5639         (Incremental_binary::Incremental_binary): Initialize new data members.
5640         (Incremental_binary::check_inputs): Add cmdline parameter.
5641         (Incremental_binary::file_is_unchanged): Remove.
5642         (Input_reader::arg_serial): New function.
5643         (Input_reader::get_unused_symbol_count): New function.
5644         (Input_reader::get_unused_symbol): New function.
5645         (Input_reader::do_arg_serial): New function.
5646         (Input_reader::do_get_unused_symbol_count): New function.
5647         (Input_reader::do_get_unused_symbol): New function.
5648         (Incremental_binary::input_file_count): New function.
5649         (Incremental_binary::get_input_reader): Change signature to use
5650         index instead of filename.
5651         (Incremental_binary::file_has_changed): New function.
5652         (Incremental_binary::get_input_argument): New function.
5653         (Incremental_binary::get_library): New function.
5654         (Incremental_binary::get_script_info): New function.
5655         (Incremental_binary::init_layout): New function.
5656         (Incremental_binary::reserve_layout): New function.
5657         (Incremental_binary::output_file): New function.
5658         (Incremental_binary::do_check_inputs): New function.
5659         (Incremental_binary::do_file_is_unchanged): Remove.
5660         (Incremental_binary::do_file_has_changed): New function.
5661         (Incremental_binary::do_init_layout): New function.
5662         (Incremental_binary::do_reserve_layout): New function.
5663         (Incremental_binary::do_input_file_count): New function.
5664         (Incremental_binary::do_get_input_reader): Change signature.
5665         (Incremental_binary::input_args_map_): New data member.
5666         (Incremental_binary::library_map_): New data member.
5667         (Incremental_binary::script_map_): New data member.
5668         (Sized_incremental_binary::Sized_incremental_binary): Initialize
5669         new data members.
5670         (Sized_incremental_binary::output_section): New function.
5671         (Sized_incremental_binary::inputs_reader): Add const.
5672         (Sized_incremental_binary::symtab_reader): Add const.
5673         (Sized_incremental_binary::relocs_reader): Add const.
5674         (Sized_incremental_binary::got_plt_reader): Add const.
5675         (Sized_incremental_binary::get_symtab_view): New function.
5676         (Sized_incremental_binary::Inputs_reader): New typedef.
5677         (Sized_incremental_binary::Input_entry_reader): New typedef.
5678         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
5679         (Sized_incremental_binary::do_file_is_unchanged): Remove.
5680         (Sized_incremental_binary::do_file_has_changed): New function.
5681         (Sized_incremental_binary::do_init_layout): New function.
5682         (Sized_incremental_binary::do_reserve_layout): New function.
5683         (Sized_input_reader::Inputs_reader): Remove.
5684         (Sized_input_reader::Input_entry_reader): Remove.
5685         (Sized_input_reader::do_arg_serial): New function.
5686         (Sized_input_reader::do_get_unused_symbol_count): New function.
5687         (Sized_input_reader::do_get_unused_symbol): New function.
5688         (Sized_incremental_binary::do_input_file_count): New function.
5689         (Sized_incremental_binary::do_get_input_reader): Change signature;
5690         use index instead of filename.
5691         (Sized_incremental_binary::section_map_): New data member.
5692         (Sized_incremental_binary::input_entry_readers_): New data member.
5693         (class Sized_incr_relobj): New class.
5694         (class Sized_incr_dynobj): New class.
5695         (make_sized_incremental_object): New function.
5696         (class Incremental_library): New class.
5697         * layout.cc (Free_list::num_lists): New static data member.
5698         (Free_list::num_nodes): New static data member.
5699         (Free_list::num_removes): New static data member.
5700         (Free_list::num_remove_visits): New static data member.
5701         (Free_list::num_allocates): New static data member.
5702         (Free_list::num_allocate_visits): New static data member.
5703         (Free_list::init): New function.
5704         (Free_list::remove): New function.
5705         (Free_list::allocate): New function.
5706         (Free_list::dump): New function.
5707         (Free_list::print_stats): New function.
5708         (Layout_task_runner::run): Resize output file for incremental updates.
5709         (Layout::Layout): Initialize new data members.
5710         (Layout::set_incremental_base): New function.
5711         (Layout::init_fixed_output_section): New function.
5712         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
5713         incremental updates.
5714         (Layout::create_gold_note): Do not create gold note section for
5715         incremental updates.
5716         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
5717         for incremental updates.
5718         (Layout::set_section_offsets): For incremental updates, allocate space
5719         from free list.
5720         (Layout::create_symtab_sections): Layout with offsets relative to
5721         start of section; for incremental updates, allocate space from free
5722         list.
5723         (Layout::create_shdrs): For incremental updates, allocate space from
5724         free list.
5725         (Layout::finish_dynamic_section): For incremental updates, do not
5726         check --as-needed (fixed in subsequent patch).
5727         * layout.h (class Free_list): New class.
5728         (Layout::set_incremental_base): New function.
5729         (Layout::incremental_base): New function.
5730         (Layout::init_fixed_output_section): New function.
5731         (Layout::allocate): New function.
5732         (Layout::incremental_base_): New data member.
5733         (Layout::free_list_): New data member.
5734         * main.cc (main): Print Free_list statistics.
5735         * object.cc (Relobj::finalize_incremental_relocs): Add
5736         clear_counts parameter; clear counts only when clear_counts is set.
5737         (Sized_relobj::Sized_relobj): Initialize new base class.
5738         (Sized_relobj::do_layout): Don't report special sections.
5739         (Sized_relobj::do_for_all_local_got_entries): New function.
5740         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
5741         symtab_off to all symbol table offsets.
5742         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
5743         * object.h (class Got_offset_list): Move to top of file.
5744         (Object::Object): Allow case where input_file == NULL.
5745         (Object::~Object): Likewise.
5746         (Object::input_file): Assert that input_file != NULL.
5747         (Object::lock): Allow case where input_file == NULL.
5748         (Object::unlock): Likewise.
5749         (Object::is_locked): Likewise.
5750         (Object::token): Likewise.
5751         (Object::release): Likewise.
5752         (Object::is_incremental): New function.
5753         (Object::get_mtime): New function.
5754         (Object::for_all_local_got_entries): New function.
5755         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
5756         (Object::set_is_in_system_directory): New function.
5757         (Object::is_in_system_directory): New function.
5758         (Object::do_is_incremental): New function.
5759         (Object::do_get_mtime): New function.
5760         (Object::do_for_all_local_got_entries): New function.
5761         (Object::is_in_system_directory_): New data member.
5762         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
5763         (class Sized_relobj_base): New class.
5764         (class Sized_relobj): Derive from Sized_relobj_base.
5765         (class Sized_relobj::Symbols): Redeclare from base class.
5766         (class Sized_relobj::local_got_offset_list): Remove.
5767         (class Sized_relobj::Output_sections): Redeclare from base class.
5768         (class Sized_relobj::do_for_all_local_got_entries): New function.
5769         (class Sized_relobj::write_local_symbols): Add offset parameter.
5770         (class Sized_relobj::local_symbol_offset_): Update comment.
5771         (class Sized_relobj::local_dynsym_offset_): Update comment.
5772         * options.cc (Input_arguments::add_file): Remove const.
5773         * options.h (Input_file_argument::Input_file_argument):
5774         Initialize arg_serial_ (all constructors).
5775         (Input_file_argument::set_arg_serial): New function.
5776         (Input_file_argument::arg_serial): New function.
5777         (Input_file_argument::arg_serial_): New data member.
5778         (Input_arguments::Input_arguments): Initialize file_count_.
5779         (Input_arguments::add_file): Remove const.
5780         (Input_arguments::number_of_input_files): New function.
5781         (Input_arguments::file_count_): New data member.
5782         (Command_line::number_of_input_files): Call
5783         Input_arguments::number_of_input_files.
5784         * output.cc (Output_segment_headers::Output_segment_headers):
5785         Set current size.
5786         (Output_section::Input_section::current_data_size): New function.
5787         (Output_section::Output_section): Initialize new data members.
5788         (Output_section::add_input_section): Don't do merge sections for
5789         an incremental link; allocate space from free list for an
5790         incremental update.
5791         (Output_section::add_output_section_data): Allocate space from
5792         free list for an incremental update.
5793         (Output_section::update_data_size): New function.
5794         (Output_section::set_fixed_layout): New function.
5795         (Output_section::reserve): New function.
5796         (Output_segment::set_section_addresses): Remove const.
5797         (Output_segment::set_section_list_addresses): Remove const; allocate
5798         space from free list for an incremental update.
5799         (Output_segment::set_offset): Adjust size of RELRO segment for an
5800         incremental update.
5801         * output.h (Output_data::current_data_size): Move here from
5802         child classes.
5803         (Output_data::pre_finalize_data_size): New function.
5804         (Output_data::update_data_size): New function.
5805         (Output_section_headers::update_data_size): new function.
5806         (Output_section_data_build::current_data_size): Move to Output_data.
5807         (Output_data_strtab::update_data_size): New function.
5808         (Output_section::current_data_size): Move to Output_data.
5809         (Output_section::set_fixed_layout): New function.
5810         (Output_section::has_fixed_layout): New function.
5811         (Output_section::reserve): New function.
5812         (Output_section::update_data_size): New function.
5813         (Output_section::has_fixed_layout_): New data member.
5814         (Output_section::free_list_): New data member.
5815         (Output_segment::set_section_addresses): Remove const.
5816         (Output_segment::set_section_list_addresses): Remove const.
5817         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
5818         New function.
5819         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
5820         New function.
5821         * readsyms.cc (Read_symbols::do_read_symbols): Add library
5822         parameter when calling Add_symbols constructor; store argument
5823         serial number for members of a lib group.
5824         (Add_symbols::locks): Allow case where token == NULL.
5825         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
5826         (Read_member::~Read_member): New function.
5827         (Read_member::is_runnable): New function.
5828         (Read_member::locks): New function.
5829         (Read_member::run): New function.
5830         (Check_script::~Check_script): New function.
5831         (Check_script::is_runnable): New function.
5832         (Check_script::locks): New function.
5833         (Check_script::run): New function.
5834         (Check_library::~Check_library): New function.
5835         (Check_library::is_runnable): New function.
5836         (Check_library::locks): New function.
5837         (Check_library::run): New function.
5838         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
5839         (Add_symbols::library_): New data member.
5840         (class Read_member): New class.
5841         (class Check_script): New class.
5842         (class Check_library): New class.
5843         * reloc.cc (Read_relocs::is_runnable): Allow case where
5844         token == NULL.
5845         (Read_relocs::locks): Likewise.
5846         (Scan_relocs::locks): Likewise.
5847         (Relocate_task::locks): Likewise.
5848         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
5849         to clear counters.
5850         (Sized_relobj::incremental_relocs_scan): Fix comment.
5851         (Sized_relobj::do_relocate): Pass output file offset to
5852         write_local_symbols.
5853         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
5854         from class declaration.
5855         * script.cc (read_input_script): Allocate Script_info; pass
5856         argument serial number to report_script.
5857         * script.h (class Script_info): Move to incremental.h.
5858         * symtab.cc (Symbol_table::add_from_incrobj): New function.
5859         * symtab.h (Symbol_table::add_from_incrobj): New function.
5860         (Symbol_table::set_file_offset): New function.
5861
5862 2011-04-05  Cary Coutant  <ccoutant@google.com>
5863
5864         * incremental-dump.cc (dump_incremental_inputs): Change signature
5865         to take a Sized_incremental_binary; change caller.  Use readers
5866         in Sized_incremental_binary.
5867         * incremental.cc
5868         (Sized_incremental_binary::find_incremental_inputs_sections):
5869         Rename do_find_incremental_inputs_sections to this.
5870         (Sized_incremental_binary::setup_readers): New function.
5871         (Sized_incremental_binary::do_check_inputs): Check
5872         has_incremental_info_ flag; move setup code to setup_readers;
5873         use input readers.
5874         (Sized_incremental_binary::do_file_is_unchanged): New function.
5875         (Sized_incremental_binary::do_get_input_reader): New function.
5876         * incremental.h (class Incremental_binary): Move to end of file.
5877         (Incremental_binary::file_is_unchanged): New function.
5878         (Incremental_binary::do_file_is_unchanged): New function.
5879         (Incremental_binary::Input_reader): New class.
5880         (Incremental_binary::get_input_reader): New function.
5881         (class Sized_incremental_binary): Move to end of file.
5882         (Sized_incremental_binary::Sized_incremental_binary): Setup the
5883         input section reader classes.
5884         (Sized_incremental_binary::has_incremental_info): New function.
5885         (Sized_incremental_binary::inputs_reader): New function.
5886         (Sized_incremental_binary::symtab_reader): New function.
5887         (Sized_incremental_binary::relocs_reader): New function.
5888         (Sized_incremental_binary::got_plt_reader): New function.
5889         (Sized_incremental_binary::do_file_is_unchanged): New function.
5890         (Sized_incremental_binary::Sized_input_reader): New class.
5891         (Sized_incremental_binary::get_input_reader): New function.
5892         (Sized_incremental_binary::find_incremental_inputs_sections):
5893         Rename do_find_incremental_inputs_sections to this.
5894         (Sized_incremental_binary::setup_readers): New function.
5895         (Sized_incremental_binary::has_incremental_info_): New data member.
5896         (Sized_incremental_binary::inputs_reader_): New data member.
5897         (Sized_incremental_binary::symtab_reader_): New data member.
5898         (Sized_incremental_binary::relocs_reader_): New data member.
5899         (Sized_incremental_binary::got_plt_reader_): New data member.
5900         (Sized_incremental_binary::current_input_file_): New data member.
5901
5902 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
5903
5904         PR gold/12640
5905         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
5906         violation.
5907
5908 2011-03-30  Cary Coutant  <ccoutant@google.com>
5909
5910         * archive.cc (Archive::include_member): Adjust call to report_object.
5911         (Add_archive_symbols::run): Add script_info to call to
5912         report_archive_begin.
5913         (Lib_group::include_member): Adjust call to report_object.
5914         (Add_lib_group_symbols::run): Adjust call to report_object.
5915         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
5916         blocks.  Add object count for script input files.
5917         * incremental.cc (Incremental_inputs::report_archive_begin): Add
5918         script_info parameter; change all callers.
5919         (Incremental_inputs::report_object): Add script_info parameter;
5920         change all callers.
5921         (Incremental_inputs::report_script): Store backpointer to
5922         incremental info entry.
5923         (Output_section_incremental_inputs::set_final_data_size): Record
5924         additional information for scripts.
5925         (Output_section_incremental_inputs::write_info_blocks): Likewise.
5926         * incremental.h (Incremental_script_entry::add_object): New function.
5927         (Incremental_script_entry::get_object_count): New function.
5928         (Incremental_script_entry::get_object): New function.
5929         (Incremental_script_entry::objects_): New data member; adjust
5930         constructor.
5931         (Incremental_inputs::report_archive_begin): Add script_info parameter.
5932         (Incremental_inputs::report_object): Add script_info parameter.
5933         (Incremental_inputs_reader::get_object_count): New function.
5934         (Incremental_inputs_reader::get_object_offset): New function.
5935         * options.cc (Input_arguments::add_file): Return reference to
5936         new input argument.
5937         * options.h (Input_argument::set_script_info): New function.
5938         (Input_argument::script_info): New function.
5939         (Input_argument::script_info_): New data member; adjust all
5940         constructors.
5941         (Input_file_group::add_file): Return reference to new input argument.
5942         (Input_file_lib::add_file): Likewise.
5943         (Input_arguments::add_file): Likewise.
5944         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
5945         * script.cc (Parser_closure::Parser_closure): Add script_info
5946         parameter; adjust all callers.
5947         (Parser_closure::script_info): New function.
5948         (Parser_closure::script_info_): New data member.
5949         (read_input_script): Report scripts earlier to incremental info.
5950         (script_add_file): Set script_info in Input_argument.
5951         (script_add_library): Likewise.
5952         * script.h (Script_options::Script_info): Rewrite class.
5953
5954 2011-03-29  Cary Coutant  <ccoutant@google.com>
5955
5956         * archive.cc (Library_base::should_include_member): Move
5957         method here from class Archive.
5958         (Archive::Archive): Initialize base class.
5959         (Archive::should_include_member): Move to base class.
5960         (Archive::do_for_all_unused_symbols): New function.
5961         (Add_archive_symbols::run): Remove redundant access to
5962         incremental_inputs.
5963         (Lib_group::Lib_group): Initialize base class.
5964         (Lib_group::do_filename): New function.
5965         (Lib_group::include_member): Pass pointer to Lib_group to
5966         report_object.
5967         (Lib_group::do_for_all_unused_symbols): New function.
5968         (Add_lib_group_symbols::run): Report archive information for
5969         incremental links.
5970         * archive.h (class Library_base): New base class.
5971         (class Archive): Derive from Library_base.
5972         (Archive::filename): Move to base class.
5973         (Archive::set_incremental_info): Likewise.
5974         (Archive::incremental_info): Likewise.
5975         (Archive::Should_include): Likewise.
5976         (Archive::should_include_member): Likewise.
5977         (Archive::Armap_entry): Remove.
5978         (Archive::Unused_symbol_iterator): Remove.
5979         (Archive::unused_symbols_begin): Remove.
5980         (Archive::unused_symbols_end): Remove.
5981         (Archive::do_filename): New function.
5982         (Archive::do_get_mtime): New function.
5983         (Archive::do_for_all_unused_symbols): New function.
5984         (Archive::task_): Move to base class.
5985         (Archive::incremental_info_): Likewise.
5986         (class Lib_group): Derive from Library_base.
5987         (Lib_group::do_filename): New function.
5988         (Lib_group::do_get_mtime): New function.
5989         (Lib_group::do_for_all_unused_symbols): New function.
5990         (Lib_group::task_): Move to base class.
5991         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
5992         function.
5993         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
5994         function.
5995         * incremental.cc (Incremental_inputs::report_archive_begin):
5996         Use Library_base; call library's get_mtime; add incremental inputs
5997         entry before members.
5998         (class Unused_symbol_visitor): New class.
5999         (Incremental_inputs::report_archive_end): Use Library_base; use
6000         visitor class to record unused symbols; don't add incremental inputs
6001         entry after members.
6002         (Incremental_inputs::report_object): Use Library_base.
6003         * incremental.h
6004         (Incremental_archive_entry::Incremental_archive_entry): Remove
6005         unused Archive parameter.
6006         (Incremental_inputs::report_archive_begin): Use Library_base.
6007         (Incremental_inputs::report_archive_end): Likewise.
6008         (Incremental_inputs::report_object): Likewise.
6009         * object.cc (Sized_relobj::do_for_all_global_symbols): New
6010         function.
6011         * object.h (Object::for_all_global_symbols): New function.
6012         (Object::do_for_all_global_symbols): New function.
6013         (Sized_relobj::do_for_all_global_symbols): New function.
6014         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
6015         function.
6016         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
6017         function.
6018
6019 2011-03-27  Ian Lance Taylor  <iant@google.com>
6020
6021         * archive.cc (Archive::interpret_header): Return -1 if something
6022         goes wrong.  Change callers accordingly.
6023
6024 2011-03-25  Cary Coutant  <ccoutant@google.com>
6025
6026         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
6027         * testsuite/Makefile.in: Regenerate.
6028
6029 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
6030
6031         * plugin.cc (get_view): New.
6032         (Plugin::load): Pass get_view to the plugin.
6033         (Plugin_manager::get_view): New.
6034
6035 2011-03-21  Ian Lance Taylor  <iant@google.com>
6036
6037         * testsuite/final_layout.sh: Rewrite to not use dc.
6038         * testsuite/relro_test.sh: Fail if dc is not present.
6039
6040 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
6041
6042         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
6043         Change == to -eq.
6044         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
6045         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
6046         Change == to -eq.
6047         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
6048         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
6049
6050 2011-03-14  Ian Lance Taylor  <iant@google.com>
6051
6052         * script-sections.cc (Sort_output_sections::script_compare):
6053         Rename from is_before, change return type.
6054         (Sort_output_sections::operator()): Adjust accordingly.
6055
6056 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
6057
6058         PR gold/12572
6059         * testsuite/odr_violation2.cc: Add comment to make all error line
6060         numbers double digits.
6061         * testsuite/debug_msg.sh: Adjust expected errors.
6062
6063 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
6064
6065         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
6066         but mark earlier ones as non-canonical
6067         (offset_to_iterator): Update search target and example
6068         (do_addr2line): Return extra lines in a vector*
6069         (format_file_lineno): Extract from do_addr2line
6070         (one_addr2line): Add vector* out-param
6071         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
6072         when a lineno entry appeared last for its instruction
6073         (Dwarf_line_info): Add vector* out-param
6074         * object.cc (Relocate_info): Pass NULL for the vector* out-param
6075         * symtab.cc (Odr_violation_compare): Include the lineno in the
6076         comparison again.
6077         (linenos_from_loc): New. Combine the canonical line for an
6078         address with its other lines.
6079         (True_if_intersect): New. Helper functor to make
6080         std::set_intersection a query.
6081         (detect_odr_violations): Compare sets of lines instead of just
6082         one line for each function. This became less deterministic, but
6083         has fewer false positives.
6084         * symtab.h: Declarations.
6085         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
6086         mix an optimized and non-optimized object in the same binary
6087         (odr_violation2.so): Same.
6088         * testsuite/Makefile.in: Regenerate from Makefile.am.
6089         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
6090         * testsuite/debug_msg.sh: Update line numbers and add
6091         assertions.
6092         * testsuite/odr_violation1.cc: Use OdrDerived, in a
6093         non-optimized context.
6094         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
6095         isn't inlined, and use OdrDerived in an optimized context.
6096         * testsuite/odr_header1.h: Defines OdrDerived, where
6097         optimization will change the
6098         first-instruction-in-the-destructor's file and line number.
6099         * testsuite/odr_header2.h: Defines OdrBase.
6100
6101 2011-03-09  Ian Lance Taylor  <iant@google.com>
6102
6103         * fileread.cc (File_read::clear_views): Don't delete the whole
6104         file view.
6105
6106 2011-03-08  Ian Lance Taylor  <iant@google.com>
6107
6108         PR gold/12525
6109         * fileread.cc: #include <climits>.
6110         (GOLD_IOV_MAX): Define.
6111         (File_read::read_multiple): Limit number of entries by iov_max.
6112         * fileread.h (class File_read): Always set max_readv_entries to
6113         128.
6114
6115 2011-03-07  Ian Lance Taylor  <iant@google.com>
6116
6117         PR gold/12525
6118         * options.h (class General_options): Add -dy and -dn.
6119
6120 2011-03-02  Cary Coutant  <ccoutant@google.com>
6121
6122         * testsuite/script_test_9.t: Add TLS segment.
6123
6124 2011-03-02  Simon Baldwin  <simonb@google.com>
6125
6126         * configure.ac: Add check for gnu_indirect_function support in
6127         the toolchain building binutils.
6128         * configure: Rebuild.
6129
6130 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
6131
6132         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
6133         plugin only symbols.
6134         (Symbol_table::sized_finalize_symbol) Mark symbol only present
6135         in plugin files as not needed in the symbol table.
6136
6137 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
6138
6139         * output.cc (Output_section::add_input_section): Delay fill
6140         generation for section ordering.
6141
6142 2011-02-09  Ian Lance Taylor  <iant@google.com>
6143
6144         PR gold/12316
6145         * object.h (class Sized_relobj): Remove clear_local_symbols.
6146         * reloc.cc (Sized_relobj::do_relocate): Don't call
6147         clear_local_symbols.
6148
6149 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
6150
6151         * plugin.cc (is_visible_from_outside): Return true for symbols
6152         in the -u option.
6153
6154 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
6155
6156         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
6157         filename.
6158
6159 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
6160
6161         * icf.h (is_section_foldable_candidate): Change type of parameter
6162         to std::string.
6163         * icf.cc (Icf::find_identical_sections): Change type of local variable
6164         section_name to be std::string.
6165         (is_function_ctor_or_dtor): Change type of parameter to std::string.
6166
6167 2011-01-25  Ian Lance Taylor  <iant@google.com>
6168
6169         * script.cc (script_add_extern): Rewrite to use
6170         add_symbol_reference.
6171
6172 2011-01-25  Doug Kwan  <dougkwan@google.com>
6173
6174         * icf.cc (get_section_contents): Always lock section's object.
6175
6176 2011-01-24  Ian Lance Taylor  <iant@google.com>
6177
6178         * options.h (class General_options): Accept
6179         --no-detect-odr-violations.
6180
6181 2011-01-24  Ian Lance Taylor  <iant@google.com>
6182
6183         * version.cc (version_string): Bump to 1.11.
6184
6185 2011-01-24  Ian Lance Taylor  <iant@google.com>
6186
6187         * plugin.cc (class Plugin_rescan): Define new class.
6188         (Plugin_manager::claim_file): Set any_claimed_.
6189         (Plugin_manager::save_archive): New function.
6190         (Plugin_manager::save_input_group): New function.
6191         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
6192         necessary.
6193         (Plugin_manager::new_undefined_symbol): New function.
6194         (Plugin_manager::rescan): New function.
6195         (Plugin_manager::rescannable_defines): New function.
6196         (Plugin_manager::add_input_file): Set any_added_.
6197         * plugin.h (class Plugin_manager): define new fields rescannable_,
6198         undefined_symbols_, any_claimed_, and any_added_.  Declare
6199         Plugin_rescan as friend.  Declare new functions.
6200         (Plugin_manager::Rescannable): Define type.
6201         (Plugin_manager::Rescannable_list): Define type.
6202         (Plugin_manager::Undefined_symbol_list): Define type.
6203         (Plugin_manager::Plugin_manager): Initialize new fields.
6204         * archive.cc (Archive::defines_symbol): New function.
6205         (Add_archive_symbols::run): Pass archive to plugins if any.
6206         * archive.h (class Archive): Declare defines_symbol.
6207         * readsyms.cc (Input_group::~Input_group): New function.
6208         (Finish_group::run): Pass input_group to plugins if any.
6209         * readsyms.h (class Input_group): Declare destructor.
6210         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
6211         any.
6212
6213 2011-01-10  Ian Lance Taylor  <iant@google.com>
6214
6215         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
6216         section as relro.
6217         (Layout::set_segment_offsets): Reset increase_relro before calling
6218         set_section_addresses a second time.
6219
6220 2011-01-04  Cary Coutant  <ccoutant@google.com>
6221
6222         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
6223         sections before NOBITS sections.
6224
6225 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
6226
6227         * version.cc (print_version): Update copyright to 2011.
6228
6229 2010-12-23  Cary Coutant  <ccoutant@google.com>
6230
6231         * output.h (Output_data_reloc::add_output_section): Pass OD instead
6232         of OS to this->add.  Add OD parameter to second form of the function.
6233
6234 2010-12-20  Ian Lance Taylor  <iant@google.com>
6235
6236         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
6237         second of two consecutive entries with same offset.
6238
6239 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6240
6241         * testsuite/Makefile.am (ifuncmain2static_LDADD)
6242         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
6243         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
6244         to avoid unneeded links against $(LDADD).
6245         * testsuite/Makefile.in: Regenerate.
6246
6247 2010-12-15  Ian Lance Taylor  <iant@google.com>
6248
6249         PR gold/12324
6250         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
6251         for R_X86_64_32 and R_X86_64_PC32.
6252         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
6253         ver_matching_def_pic.o.
6254         (ver_matching_def_pic.o): New target.
6255
6256 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6257
6258         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
6259         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
6260         Move definition before File_read::View member definitions.
6261         (File_read::View::~View): Initialize and hold lock before
6262         updating current_mapped_bytes.
6263
6264 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6265
6266         * dwarf_reader.cc: Remove outdated comment.
6267         * gold-threads.cc: Fix typo in error message.
6268         * archive.cc: Fix typos in comments.
6269         * archive.h: Likewise.
6270         * arm-reloc-property.cc: Likewise.
6271         * arm-reloc-property.h: Likewise.
6272         * arm-reloc.def: Likewise.
6273         * arm.cc: Likewise.
6274         * attributes.h: Likewise.
6275         * cref.cc: Likewise.
6276         * ehframe.cc: Likewise.
6277         * fileread.h: Likewise.
6278         * gold.h: Likewise.
6279         * i386.cc: Likewise.
6280         * icf.cc: Likewise.
6281         * incremental.h: Likewise.
6282         * int_encoding.cc: Likewise.
6283         * layout.h: Likewise.
6284         * main.cc: Likewise.
6285         * merge.h: Likewise.
6286         * object.cc: Likewise.
6287         * object.h: Likewise.
6288         * options.cc: Likewise.
6289         * readsyms.cc: Likewise.
6290         * reduced_debug_output.cc: Likewise.
6291         * reloc.cc: Likewise.
6292         * script-sections.cc: Likewise.
6293         * sparc.cc: Likewise.
6294         * symtab.h: Likewise.
6295         * target-reloc.h: Likewise.
6296         * target.cc: Likewise.
6297         * target.h: Likewise.
6298         * timer.cc: Likewise.
6299         * timer.h: Likewise.
6300         * x86_64.cc: Likewise.
6301
6302 2010-12-09  Cary Coutant  <ccoutant@google.com>
6303
6304         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
6305         stack.
6306         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
6307         parameter; change all callers.
6308         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
6309         * options.h (warn_execstack): New option.
6310
6311 2010-12-07  Doug Kwan  <dougkwan@google.com>
6312
6313         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
6314         like function call relocations.
6315
6316 2010-12-07  Ian Lance Taylor  <iant@google.com>
6317
6318         * archive.cc (Archive::get_elf_object_for_member): Permit
6319         punconfigured to be NULL.
6320         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
6321         (Archive::include_member): Pass NULL to get_elf_object_for_member
6322         if we searched for the archive and this is the first included
6323         object.
6324
6325 2010-12-01  Ian Lance Taylor  <iant@google.com>
6326
6327         * dwarf_reader.h (class Sized_dwarf_line_info): Add
6328         track_relocs_type_ field.
6329         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
6330         Set track_relocs_type_.
6331         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
6332         contents when using RELA relocs.
6333         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
6334         reloc_map_.
6335         * reloc.cc (Track_relocs::next_addend): New function.
6336         * reloc.h (class Track_relocs): Declare next_addend.
6337
6338 2010-12-01  Ian Lance Taylor  <iant@google.com>
6339
6340         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
6341         virtual destructor.
6342
6343 2010-12-01  Ian Lance Taylor  <iant@google.com>
6344
6345         * README: Update compilers known to work and fail.
6346
6347 2010-11-23  Matthias Klose  <doko@ubuntu.com>
6348
6349         * configure.in: For --enable-gold, handle value `default' instead of
6350         `both*'.  Always install ld as ld.bfd, install as ld if gold is
6351         not the default.
6352         * configure: Regenerate.
6353
6354 2010-11-18  Doug Kwan  <dougkwan@google.com>
6355
6356         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
6357         and right_alignment to be zero.  Store result alignment only if it is
6358         greater than existing alignment.
6359
6360 2010-11-16  Cary Coutant  <ccoutant@google.com>
6361
6362         PR gold/12220
6363         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
6364         Check for ".zdebug_line".
6365
6366 2010-11-16  Doug Kwan  <dougkwan@google.com>
6367             Cary Coutant  <ccoutant@google.com>
6368
6369         * output.h (Output_segment::set_section_addresses): Pass increase_relro
6370         by reference; adjust all callers.
6371         * output.cc (Output_segment::set_section_addresses): Adjust references
6372         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
6373         list is empty.
6374         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
6375         end at page boundary.
6376
6377 2010-11-16  Cary Coutant  <ccoutant@google.com>
6378
6379         PR gold/12220
6380         * layout.cc (Layout::choose_output_section): Transform names of
6381         compressed sections even when using a script with a SECTIONS clause.
6382         (Layout::output_section_name): Remove code to transform
6383         compressed debug section names.
6384         * output.cc (Output_section::add_input_section): Use uncompressed
6385         section size when tracking input sections.
6386
6387 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
6388
6389         * symtab.h (Symbol::NON_PIC_REF): Remove.
6390         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
6391         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
6392         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
6393         (Symbol::use_plt_offset): Take a flags argument and pass it
6394         directly to needs_dynamic_reloc.  Restrict check for undefined
6395         weak symbols to function calls.
6396         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
6397         (Target_arm::Scan::global): Use it.
6398         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
6399         (Target_arm::Relocate::relocate): Likewise.
6400         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
6401         parameter with an r_type parameter.  Use get_reference_flags
6402         to get the flags.
6403         (Target_arm::Relocate::relocate): Update accordingly.
6404         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
6405         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
6406         (Target_i386::Scan::global): Likewise.
6407         (Target_i386::Relocate::relocate): Likewise.
6408         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
6409         parameter with an r_type parameter.  Use get_reference_flags
6410         to get the flags.
6411         (Target_i386::Relocate::relocate): Update accordingly.
6412         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
6413         (Target_powerpc::Scan::global): Use it.
6414         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
6415         (Target_powerpc::Relocate::relocate): Likewise.
6416         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
6417         (Target_sparc::Scan::global): Use it.
6418         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
6419         (Target_sparc::Relocate::relocate): Likewise.
6420         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
6421         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
6422         (Target_x86_64::Scan::global): Likewise.
6423         (Target_x86_64::Relocate::relocate): Likewise.
6424
6425 2010-11-08  Doug Kwan  <dougkwan@google.com>
6426             Cary Coutant  <ccoutant@google.com>
6427
6428         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
6429         (Arm_exidx_merge_section::section_contents_): New data member.
6430         (Arm_input_section::Arm_input_section): Initialize original_contents_.
6431         (Arm_input_section::~Arm_input_section): De-allocate memory.
6432         (Arm_input_section::original_contents_): New data member.
6433         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
6434         in parameters instead of calling Object::section_contents without
6435         locking.
6436         (Arm_output_section::group_section): New parameter TASK.  Pass it
6437         to callees that need locking objects.
6438         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
6439         to lock EXIDX input sections.  Fix a formatting issue.  Call
6440         Arm_exidx_merged_section::build_contents to create merged section
6441         contents.
6442         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
6443         to lock object of stub table owner.
6444         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
6445         TEXT_SIZE to initialize data member TEXT_SIZE_.
6446         (Arm_exidx_input_section::addralign): Fix typo in comment.
6447         (Arm_exidx_input_section::text_size): New method.
6448         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
6449         that require locking objects.  Lock objects before scanning for stubs
6450         and updating local symbols.
6451         (Arm_input_section<big_endian>::init): Copy contents of original
6452         input section.
6453         (Arm_input_section<big_endian>::do_write): Use saved contents of
6454         original input section instead of calling Object::section_contents
6455         without locking.
6456         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
6457         size without calling Object::section_size().
6458         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
6459         for size.  Allocate a buffer for merged EXIDX entries.
6460         (Arm_exidx_merged_section::build_contents): New method.
6461         (Arm_exidx_merged_section::do_write): Move merge section contents
6462         building code to Arm_exidx_merged_section::build_contetns.  Write
6463         out contetns in buffer instead of building it on the fly.
6464         (Arm_relobj::make_exidx_input_section): Also pass text section size
6465         to Arm_exidx_input_section constructor.
6466         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
6467         (Arm_dynobj::do_read_symbols): Fix memory leak.
6468         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
6469         * target.h: (class Task): Add forward declaration.
6470         (Target::relax): Add new parameter TASK and pass it to
6471         Target::do_relax().
6472         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
6473
6474 2010-11-05  Cary Coutant  <ccoutant@google.com>
6475
6476         PR gold/10708
6477         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
6478         object when reading from the file.
6479         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
6480         second layout pass.
6481         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
6482         when reading section contents.
6483         (get_section_contents): Likewise.
6484         (icf::find_identical_sections): Likewise.
6485         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
6486         object when reading from the file.
6487         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
6488         the object when doing deferred section layout.
6489
6490 2010-11-03  Nick Clifton  <nickc@redhat.com>
6491
6492         PR gold/12001
6493         * script.h (class Symbol_assignment: name): New member.  Returns
6494         the name of the symbol.
6495         * scrfipt.cc (Script_options::is_pending_assignment): New member.
6496         Returns true if the given symbol name is on the list of
6497         assignments wating to be processed.
6498         * archive.cc (should_incldue_member): If the symbol is undefined,
6499         check to see if it is on the list of symbols pending assignment.
6500
6501 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
6502
6503         * script-sections.cc (Script_sections::find_memory_region): Check
6504         for a NULL output section pointer.
6505
6506 2010-10-29  Doug Kwan  <dougkwan@google.com>
6507
6508         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
6509         Output_section::add_relaxed_input_section.
6510         * output.cc (Output_section::add_relaxed_input_section): Add new
6511         arguments LAYOUT and NAME.  Set section order index.
6512         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
6513         Copy section order index.
6514         * output.h (Output_section::add_relaxed_input_section): Add new
6515         arguments LAYOUT and NAME.
6516
6517 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6518
6519         * testsuite/Makefile.am: Move gcctestdir/ld rule to
6520         NATIVE_OR_CROSS_LINKER.
6521         * testsuite/Makefile.in: Regenerate.
6522
6523 2010-10-20  Doug Kwan  <dougkwan@google.com>
6524
6525         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
6526         without SHF_LINK_ORDER flags.
6527         * layout.cc (Layout::choose_output_section): Do not filter
6528         SHF_LINK_ORDER flag in a relocatable link.
6529
6530 2010-10-17  Cary Coutant  <ccoutant@google.com>
6531
6532         * output.h (Output_segment::set_section_addresses): Change function
6533         signature.  Update all callers.
6534         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
6535         sections.
6536         (Output_segment::set_section_addresses): Align after last TLS
6537         section.  Add padding before last relro section instead of after.
6538
6539 2010-10-17  Doug Kwan  <dougkwan@google.com>
6540
6541         * gold/arm.cc (Target_arm::got_section): Use correct order and set
6542         GOT output section to be writable.
6543
6544 2010-10-14  Cary Coutant  <ccoutant@google.com>
6545
6546         * debug.h (DEBUG_INCREMENTAL): New flag.
6547         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
6548         * gold.cc (queue_initial_tasks): Check parameters for incremental link
6549         mode.
6550         * incremental.cc (report_command_line): Ignore all forms of
6551         --incremental.
6552         * layout.cc (Layout::Layout): Check parameters for incremental link
6553         mode.
6554         * options.cc (General_options::parse_incremental): New function.
6555         (General_options::parse_no_incremental): New function.
6556         (General_options::parse_incremental_full): New function.
6557         (General_options::parse_incremental_update): New function.
6558         (General_options::incremental_mode_): New data member.
6559         (General_options::finalize): Check incremental_mode_.
6560         * options.h (General_options): Update help text for --incremental.
6561         Add --no-incremental, --incremental-full, --incremental-update.
6562         (General_options::Incremental_mode): New enum type.
6563         (General_options::incremental_mode): New function.
6564         (General_options::incremental_mode_): New data member.
6565         * parameters.cc (Parameters::incremental_mode_): New data member.
6566         (Parameters::set_options): Set incremental_mode_.
6567         (Parameters::set_incremental_full): New function.
6568         (Parameters::incremental): New function.
6569         (Parameters::incremental_update): New function.
6570         (set_parameters_incremental_full): New function.
6571         * parameters.h (Parameters::set_incremental_full): New function.
6572         (Parameters::incremental): New function.
6573         (Parameters::incremental_update): New function.
6574         (Parameters::incremental_mode_): New data member.
6575         (set_parameters_incremental_full): New function.
6576         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
6577         incremental link mode.
6578         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
6579         (Sized_relobj::do_relocate_sections): Likewise.
6580         * testsuite/Makefile.am (incremental_test): Use --incremental-full
6581         option.
6582         * testsuite/Makefile.in: Regenerate.
6583         * testsuite/incremental_test.sh: Filter all forms of --incremental.
6584
6585 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6586
6587         * script-sections.h (class Script_sections): Make
6588         Sections_elements typedef public.
6589         * script-sections.cc (class Sort_output_sections): Add elements_
6590         field.  Add constructor which sets it; change all callers.
6591         (Sort_output_sections::is_before): New function.
6592         (Sort_output_sections::operator()): Call is_before.
6593         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
6594         conditional.
6595         * testsuite/script_test_10.sh: New test. Test script section
6596         order.
6597         * testsuite/script_test_10.t: Likewise.
6598         * testsuite/script_test_10.s: Likewise.
6599         * testsuite/Makefile.am: Wrap the cross linker tests and the
6600         common tests into NATIVE_OR_CROSS_LINKER.
6601         (check_SCRIPTS): Add script_test_10.sh.
6602         (check_DATA): Add script_test_10.stdout.
6603         (script_test_10.o, script_test_10): New targets.
6604         (script_test_10.stdout): New target.
6605         * configure, testsuite/Makefile.in: Regenerate.
6606
6607 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6608
6609         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
6610         error for the deprecated relocations.
6611         (Target_arm::Scan::global): Likewise.
6612         (Target_arm::Relocate::relocate): Likewise.
6613
6614 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
6615
6616         * fileread.cc (Input_file::find_file): Initialize *found_name
6617         and *namep when using the fallback search for case 4.
6618
6619 2010-10-11  Cary Coutant  <ccoutant@google.com>
6620
6621         * options.h (class General_options): Redefine -z lazy as an alias for
6622         the negation of -z now.
6623
6624 2010-10-11  Ian Lance Taylor  <iant@google.com>
6625
6626         * resolve.cc (symbol_to_bits): Report the value of the unsupported
6627         binding.
6628
6629 2010-10-06  Nick Clifton  <nickc@redhat.com>
6630
6631         * script-sections.cc(class Memory_region): Remove
6632         current_lma_offset_ field.  Rename current_vma_offset_ to
6633         current_offset_.  Add last_section_ field.
6634         (Memory_region::get_current_vma_address): Rename to
6635         get_current_address.
6636         (Memory_region::get_current_lma_address): Delete.
6637         (Memory_region::increment_vma_offset): Rename to
6638         increment_offset.
6639         (Memory_region::increment_lma_offset): Delete.
6640         (Memory_region::attributes_compatible): New method.  Returns
6641         true if the provided section is compatible with the region.
6642         (Memory_region::get_last_section): New method.  Returns the last
6643         section to use the region.
6644         (Memory_region::set_last_section): New method.  Stores the last
6645         section to use the region.
6646         (Script_sections::block_in_region): New method.  Returns true if
6647         a block of memory is contained within a region.
6648         (Script_sections::find_memory_region): New method.  Locates a
6649         memory region to be used to set a VMA or LMA address.
6650         (Output_section_definition::set_section_addresses): Add code to
6651         check for addresses set by memory regions.
6652         (Output_segment::set_section_addresses): Remove memory region
6653         walking code.
6654         (Script_sections::create_segment): Add a warning if a header
6655         segment is created outside of any region.
6656         * script-sections.h (class Script_sections): Add prototypes for
6657         find_memory_region and block_in_region methods.
6658         * testsuite/memory_test.s: Use .long instead of .word.
6659         * testsuite/memory_test.t: Add some more output sections.
6660         * testsuite/memory_test.sh: Update expected output.
6661
6662 2010-10-02  Doug Kwan  <dougkwan@google.com>
6663
6664         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
6665         defintion to symtab.h
6666         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
6667         declaration to defintion.
6668
6669 2010-10-01  Nick Clifton  <nickc@redhat.com>
6670
6671         * expression.cc (eval): Replace dummy argument with NULL.
6672         (eval_maybe_dot): Check for a NULL result section pointer.
6673         (Symbol_expression::value): Likewise.
6674         (Dot_expression::value): Likewise.
6675         (BINARY_EXPRESSION): Likewise.
6676         (Max_expression::value): Likewise.
6677         (Min_expression::value): Likewise.
6678         (Absolute_expression::value): Likewise.
6679         (Addr_expression::value_from_output_section): Likewise.
6680         (Loaddddr_expression::value_from_output_section): Likewise.
6681         (Segment_start_expression::value): Likewise.
6682         * script-sections.cc
6683         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
6684         argument with NULL.
6685         (Sections_elememt_dot_assignment::set_section_addresses):
6686         Likewise.
6687         (Output_data_expression::do_write_to_buffer): Likewise.
6688         (Output_section_definition::finalize_symbols): Likewise.
6689         (Output_section_definition::set_section_addresses): Likewise.
6690
6691 2010-09-30  Doug Kwan  <dougkwan@google.com>
6692
6693         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
6694
6695 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
6696
6697         * target.h (Target::can_icf_inline_merge_sections): New virtual
6698         function.
6699         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
6700         virtual function.
6701         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
6702         virtual function.
6703         * icf.cc (get_section_contents): Inline merge sections only when
6704         target allows it.
6705
6706 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6707
6708         * configure: Regenerate.
6709
6710 2010-09-17  Ian Lance Taylor  <iant@google.com>
6711
6712         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
6713         * testsuite/Makefile.am (memory_test.o): New target.
6714         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
6715         memory_test.t.
6716         * testsuite/Makefile.in: Rebuild.
6717
6718 2010-09-17  Doug Kwan  <dougkwan@google.com>
6719
6720         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
6721         defintion if relocation uses GOT entries of the symbol.
6722         * testsuite/icf_safe_test.sh: Fix test.
6723         * testsuite/icf_safe_so_test.sh: Fix test.
6724
6725 2010-09-16  Cary Coutant  <ccoutant@google.com>
6726
6727         * script_sections.cc (class Memory_region): Remove "NULL" from
6728         vector initializations.
6729
6730 2010-09-15  Cary Coutant  <ccoutant@google.com>
6731
6732         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
6733         Resolve forwarding symbols.
6734
6735 2010-09-15  Doug Kwan  <dougkwan@google.com>
6736
6737         * gold/testsuite/script_test_3.t: Add ARM special sections.
6738         * gold/testsuite/script_test_4.t: Same.
6739         * gold/testsuite/script_test_5.t: Same.
6740         * gold/testsuite/script_test_6.t: Same.
6741         * gold/testsuite/script_test_7.t: Same.
6742         * gold/testsuite/script_test_7.t: Same.
6743         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
6744
6745 2010-09-14  Cary Coutant  <ccoutant@google.com>
6746
6747         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
6748         (Target_x86_64::Relocate::relocate_tls): Replace check for
6749         saw_tls_block_reloc_ with test for executable section.
6750
6751 2010-09-12  Cary Coutant  <ccoutant@google.com>
6752
6753         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
6754         position-independent executables to shared libraries need dynamic
6755         relocations.
6756         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
6757         position-independent executables.
6758         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
6759         * testsuite/Makefile.in: Regenerate.
6760
6761 2010-09-10  Nick Clifton  <nickc@redhat.com>
6762
6763         PR gold/11997
6764         * testsuite/memory_test.t: Discard any sections that are not
6765         needed.
6766
6767 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
6768
6769         PR gold/11996
6770         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
6771         "This::" to work around a bug in gcc 4.2.
6772
6773         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
6774
6775 2010-09-09  Rafael Espindola  <espindola@google.com>
6776
6777         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
6778         sections with different PF_X flags in the same segment.
6779         (Layout::find_first_load_seg): Search all segments to find the first
6780         one.
6781         * options.h (rosegment): New.
6782
6783 2010-09-08  Rafael Espindola  <espindola@google.com>
6784
6785         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
6786
6787 2010-09-08  Doug Kwan  <dougkwan@google.com>
6788
6789         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
6790         (Arm_relobj::do_relocate_sections): Add new parameter for output
6791         file to match the parent.
6792         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
6793         of local symbols instead of input values.  Update code to track
6794         changes in gold::relocate_section.
6795         * object.cc (Sized_relobj::compute_final_local_value): New methods.
6796         (Sized_relobj::compute_final_local_value_internal): New methods.
6797         (Sized_relobj::do_finalize_local_symbols): Move code from loop
6798         body into private version of Sized_relobj::compute_final_local_value.
6799         Call the inline method.
6800         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
6801         merged symbol value if there is one.
6802         (Symbol_value::has_output_value): New method defintiion.
6803         (Sized_relobj::Compute_final_local_value_status): New enum type.
6804         (Sized_relobj::compute_final_local_value): New methods.
6805         (Sized_relobj::compute_final_local_value_internal): New methods.
6806         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
6807         and arm_cortex_a8.sh.
6808         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
6809         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
6810         New tests.
6811         * Makefile.in: Regenerate.
6812         * testsuite/arm_bl_out_of_range.s: Update test.
6813         * testsuite/thumb_bl_out_of_range.s: Ditto.
6814         * testsuite/thumb_blx_out_of_range.s: Ditto.
6815         * testsuite/arm_branch_out_of_range.sh: New file.
6816         * testsuite/arm_cortex_a8.sh: Ditto.
6817         * testsuite/arm_cortex_a8_b.s: Ditto.
6818         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
6819         * testsuite/arm_cortex_a8_b_local.s: Ditto.
6820         * testsuite/arm_cortex_a8_bl.s: Ditto.
6821         * testsuite/arm_cortex_a8_blx.s: Ditto.
6822         * testsuite/arm_cortex_a8_local.s: Ditto.
6823         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
6824         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
6825
6826 2010-09-08  Rafael Espindola  <espindola@google.com>
6827
6828         * Makefile.am (memory_test.stdout): Run readelf with -W.
6829         * Makefile.in: Regenerate.
6830         * testsuite/memory_test.sh: Make the regexps accept both 32 and
6831         64 bit output.
6832
6833 2010-09-08  Rafael Espindola  <espindola@google.com>
6834
6835         * script-sections.cc (Script_sections::add_memory_region): Convert
6836         field precision to int.
6837         * script.cc (script_set_section_region, script_set_section_region):
6838         Convert field precision to int.
6839
6840 2010-09-08  Rafael Espindola  <espindola@google.com>
6841
6842         * arm.cc (do_finalize_sections): Create the __exidx_start and
6843         __exdix_end symbols even when the section is missing.
6844
6845 2010-09-08  Nick Clifton  <nickc@redhat.com>
6846
6847         * README: Remove claim that MEMORY is not supported.
6848         * expression.cc (script_exp_function_origin)
6849         (script_exp_function_length): Move from here to ...
6850         * script.cc: ... here.
6851         (script_set_section_region, script_add_memory)
6852         (script_parse_memory_attr, script_include_directive): New
6853         functions.
6854         * script-sections.cc
6855         (class Memory_region): New class.
6856         (class Output_section_definition): Add set_memory_region,
6857         set_section_vma, set_section_lma and get_section_name methods.
6858         (class Script_Sections): Add add_memory_region,
6859         find_memory_region, find_memory_region_origin,
6860         find_memory_region_length and set_memory_region methods.
6861         Have set_section_addresses method walk the list of set memory
6862         regions.
6863         Extend the print methos to display memory regions.
6864         * script-sections.h: Add prototypes for new methods.
6865         Add enum for MEMORY region attributes.
6866         * yyscript.y: Add support for parsing MEMORY regions.
6867         * script-c.h: Add prototypes for new functions.
6868         * testsuite/Makefile.am: Add test of MEMORY region functionality.
6869         * testsuite/Makefile.in: Regenerate.
6870         * testsuite/memory_test.sh: New script.
6871         * testsuite/memory_test.s: New assembler source file.
6872         * testsuite/memory_test.t: New linker script.
6873
6874 2010-08-27  Doug Kwan  <dougkwan@google.com>
6875
6876         * gold/resolve.cc (Symbol_table::should_override): Let a weak
6877         reference override an existing dynamic weak reference.
6878         * testsuite/Makefile.am: Add new test dyn_weak_ref.
6879         * testsuite/Makefile.in: Regenerate.
6880         * testsuite/dyn_weak_ref.sh: New file.
6881         * testsuite/dyn_weak_ref_1.c: Ditto.
6882         * testsuite/dyn_weak_ref_2.c: Ditto.
6883
6884 2010-08-27  Ian Lance Taylor  <iant@google.com>
6885
6886         * incremental.h (class Incremental_input_entry): Add virtual
6887         destructor.
6888
6889 2010-08-27  Ian Lance Taylor  <iant@google.com>
6890
6891         * testsuite/start_lib_test_3.c: Mark t3 as used.
6892
6893 2010-08-27  Nick Clifton  <nickc@redhat.com>
6894
6895         * options.cc (version_script): Fix small typo in previous
6896         whitespace tidyup.
6897
6898 2010-08-25  Nick Clifton  <nickc@redhat.com>
6899
6900         * archive.cc: Formatting fixes: Remove whitespace between
6901         typename and following asterisk.  Remove whitespace between
6902         function name and opening parenthesis.
6903         * archive.h: Likewise.
6904         * arm.cc: Likewise.
6905         * attributes.cc: Likewise.
6906         * attributes.h: Likewise.
6907         * common.cc: Likewise.
6908         * copy-relocs.cc: Likewise.
6909         * dirsearch.h: Likewise.
6910         * dynobj.cc: Likewise.
6911         * ehframe.cc: Likewise.
6912         * ehframe.h: Likewise.
6913         * expression.cc: Likewise.
6914         * fileread.cc: Likewise.
6915         * fileread.h: Likewise.
6916         * gc.h: Likewise.
6917         * gold-threads.cc: Likewise.
6918         * gold.cc: Likewise.
6919         * i386.cc: Likewise.
6920         * icf.h: Likewise.
6921         * incremental-dump.cc: Likewise.
6922         * incremental.cc: Likewise.
6923         * layout.cc: Likewise.
6924         * layout.h: Likewise.
6925         * main.cc: Likewise.
6926         * merge.cc: Likewise.
6927         * merge.h: Likewise.
6928         * object.cc: Likewise.
6929         * object.h: Likewise.
6930         * options.cc: Likewise.
6931         * options.h: Likewise.
6932         * output.cc: Likewise.
6933         * output.h: Likewise.
6934         * plugin.cc: Likewise.
6935         * plugin.h: Likewise.
6936         * powerpc.cc: Likewise.
6937         * reloc.cc: Likewise.
6938         * script-c.h: Likewise.
6939         * script-sections.cc: Likewise.
6940         * script.cc: Likewise.
6941         * stringpool.cc: Likewise.
6942         * symtab.cc: Likewise.
6943         * symtab.h: Likewise.
6944         * target.cc: Likewise.
6945         * timer.cc: Likewise.
6946         * timer.h: Likewise.
6947         * version.cc: Likewise.
6948         * x86_64.cc: Likewise.
6949
6950 2010-08-24  Nick Clifton  <nickc@redhat.com>
6951
6952         PR 11899
6953         * layout.cc (segment_precedes): Sort segments by their physical
6954         addresses, if they have been set.
6955
6956 2010-08-23  Cary Coutant  <ccoutant@google.com>
6957
6958         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
6959         symbols data.
6960         (Lib_group::include_member): Unlock object after deleting its
6961         symbols data.
6962         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
6963         the bug fixed here.
6964
6965 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
6966             Cary Coutant  <ccoutant@google.com>
6967
6968         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
6969         constructor, and set_blocker.
6970         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
6971         readsyms_blocker_.
6972         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
6973         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
6974         * testsuite/Makefile.am (start_lib_test): New test case.
6975         * testsuite/Makefile.in: Regenerate.
6976         * testsuite/start_lib_test_main.c: New file.
6977         * testsuite/start_lib_test_1.c: New file.
6978         * testsuite/start_lib_test_2.c: New file.
6979         * testsuite/start_lib_test_3.c: New file.
6980
6981 2010-08-19  Ian Lance Taylor  <iant@google.com>
6982
6983         * Makefile.in: Rebuild with automake 1.11.1.
6984         * aclocal.m4: Likewise.
6985         * testsuite/Makefile.in: Likewise.
6986
6987 2010-08-19  Ian Lance Taylor  <iant@google.com>
6988
6989         PR 10893
6990         * i386.cc (class Output_data_plt_i386): Update declarations.
6991         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
6992         local_ifuncs_ fields.
6993         (Target_i386::do_plt_section_for_global): New function.
6994         (Target_i386::do_plt_section_for_local): New function.
6995         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
6996         parameter; change all callers.  Initialize global_ifuncs_ and
6997         local_ifuncs_.  If doing a static link define __rel_iplt_start and
6998         __rel_iplt_end.
6999         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
7000         (Output_data_plt_i386::add_local_ifunc_entry): New function.
7001         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
7002         symbols.
7003         (Target_i386::make_plt_section): New function, broken out of
7004         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
7005         (Target_i386::make_plt_entry): Call make_plt_section.
7006         (Target_i386::make_local_ifunc_plt_entry): New function.
7007         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
7008         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
7009         R_386_IRELATIVE to switch.
7010         (Target_i386::Scan::global): Likewise.
7011         (Target_i386::Relocate::relocate): Likewise.
7012         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
7013         switch.
7014         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
7015         (Target_x86_64::do_plt_section_for_global): New function.
7016         (Target_x86_64::do_plt_section_for_local): New function.
7017         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
7018         parameter; change all callers.  If doing a static link define
7019         __rela_iplt_start and __rela_iplt_end.
7020         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
7021         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
7022         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
7023         to point to .plt.
7024         (Target_x86_64::make_local_ifunc_plt_entry): New function.
7025         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
7026         switch.
7027         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
7028         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
7029         R_X86_64_IRELATIVE to switch.
7030         (Target_x86_64::Scan::global): Likewise.
7031         (Target_x86_64::Relocate::relocate): Likewise.
7032         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
7033         switch.
7034         * target.h (class Target): Add plt_section_for_global and
7035         plt_section_for_local functions.  Add do_plt_section_for_global
7036         and do_plt_section_for_local virtual functions.
7037         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
7038         clarifying comments.
7039         (Symbol::use_plt_offset): Handle IFUNC symbol.
7040         * object.cc (Sized_relobj::Sized_relobj): Initialize
7041         local_plt_offsets_.
7042         (Sized_relobj::local_has_plt_offset): New function.
7043         (Sized_relobj::local_plt_offset): New function.
7044         (Sized_relobj::set_local_plt_offset): New function.
7045         (Sized_relobj::do_count): Handle IFUNC symbol.
7046         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
7047         a bit away from input_shndx_ field.  Add set_is_func_symbol and
7048         is_ifunc_symbol functions.
7049         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
7050         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
7051         local_plt_offsets_ field.
7052         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
7053         * output.h (class Output_section_data): Add non-const
7054         output_section function.
7055         (class Output_data_got): Update declarations.
7056         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
7057         Add use_plt_offset parameter to global and local constructors.
7058         Change all callers.  Change local_sym_index_ field to 31 bits.
7059         Change GSYM_CODE and CONSTANT_CODE accordingly.
7060         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
7061         doing a static link don't set sh_link field.
7062         (Output_data_got::Got_entry::write): Use PLT offset if
7063         appropriate.
7064         (Output_data_got::add_global_plt): New function.
7065         (Output_data_got::add_local_plt): New function.
7066         * target-reloc.h (relocate_section): Handle IFUNC symbol.
7067         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
7068         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
7069         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
7070         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
7071         IFUNC conditional.
7072         * testsuite/ifunc-sel.h: New file.
7073         * testsuite/ifuncmain1.c: New file.
7074         * testsuite/ifuncmain1vis.c: New file.
7075         * testsuite/ifuncmod1.c: New file.
7076         * testsuite/ifuncdep2.c: New file.
7077         * testsuite/ifuncmain2.c: New file.
7078         * testsuite/ifuncmain3.c: New file.
7079         * testsuite/ifuncmod3.c: New file.
7080         * testsuite/ifuncmain4.c: New file.
7081         * testsuite/ifuncmain5.c: New file.
7082         * testsuite/ifuncmod5.c: New file.
7083         * testsuite/ifuncmain6pie.c: New file.
7084         * testsuite/ifuncmod6.c: New file.
7085         * testsuite/ifuncmain7.c: New file.
7086         * configure, testsuite/Makefile.in: Rebuild.
7087
7088 2010-08-18  Ian Lance Taylor  <iant@google.com>
7089
7090         * incremental.cc
7091         (Output_section_incremental_inputs::write_input_files): Add cast
7092         to avoid signed/unsigned comparison warning.
7093         (Output_section_incremental_inputs::write_info_blocks): Likewise.
7094
7095 2010-08-12  Cary Coutant  <ccoutant@google.com>
7096
7097         * common.cc (Sort_commons::operator()): Remove unnecessary code.
7098
7099 2010-08-13  Ian Lance Taylor  <iant@google.com>
7100
7101         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
7102
7103 2010-08-12  Cary Coutant  <ccoutant@google.com>
7104             Doug Kwan  <dougkwan@google.com>
7105
7106         * resolve.cc (Symbol_table::should_override): When a weak dynamic
7107         defintion overrides non-weak undef, remember that the original undef
7108         is not weak.
7109         * symtab.cc (Symbol_table::sized_write_global): For undef without
7110         an original weak binding, set binding to global in output.
7111         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
7112         * testsuite/Makefile.in: Regenerate.
7113         * testsuite/strong_ref_weak_def.sh: New file.
7114         * testsuite/strong_ref_weak_def_1.c: Ditto.
7115         * testsuite/strong_ref_weak_def_2.c: Ditto.
7116
7117 2010-08-12  Cary Coutant  <ccoutant@google.com>
7118
7119         * testsuite/incremental_test.sh: Rewrite.
7120         * testsuite/incremental_test_1.c: Rewrite.
7121         * testsuite/incremental_test_2.c: Rewrite.
7122
7123 2010-08-12  Cary Coutant  <ccoutant@google.com>
7124
7125         * arm.cc (Target_arm::got_size): Add const.
7126         (Target_arm::got_entry_count): New function.
7127         (Target_arm::plt_entry_count): New function.
7128         (Target_arm::first_plt_entry_offset): New function.
7129         (Target_arm::plt_entry_size): New function.
7130         (Output_data_plt_arm::entry_count): New function.
7131         (Output_data_plt_arm::first_plt_entry_offset): New function.
7132         (Output_data_plt_arm::get_plt_entry_size): New function.
7133         * i386.cc (Target_i386::got_size): Add const.
7134         (Target_i386::got_entry_count): New function.
7135         (Target_i386::plt_entry_count): New function.
7136         (Target_i386::first_plt_entry_offset): New function.
7137         (Target_i386::plt_entry_size): New function.
7138         (Output_data_plt_i386::entry_count): New function.
7139         (Output_data_plt_i386::first_plt_entry_offset): New function.
7140         (Output_data_plt_i386::get_plt_entry_size): New function.
7141         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
7142         find_incremental_inputs_sections.  Dump incremental_got_plt section.
7143         * incremental.cc: Include target.h.
7144         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
7145         parameter.  Adjust all callers.  Find incremental_got_plt section.
7146         (Incremental_inputs::create_data_sections): Create incremental_got_plt
7147         section.
7148         (Output_section_incremental_inputs::set_final_data_size): Calculate
7149         size of incremental_got_plt section.
7150         (Output_section_incremental_inputs::do_write): Write the
7151         incremental_got_plt section.
7152         (Got_plt_view_info): New struct.
7153         (Local_got_offset_visitor): New class.
7154         (Global_got_offset_visitor): New class.
7155         (Global_symbol_visitor_got_plt): New class.
7156         (Output_section_incremental_inputs::write_got_plt): New function.
7157         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
7158         Add parameter.  Adjust all callers.
7159         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
7160         (Incremental_inputs::got_plt_section): New function.
7161         (Incremental_inputs::got_plt_section_): New data member.
7162         (Incremental_got_plt_reader): New class.
7163         * layout.cc (Layout::create_incremental_info_sections): Add the
7164         incremental_got_plt section.
7165         * object.h (Got_offset_list::get_list): New function.
7166         (Got offset_list::for_all_got_offsets): New function.
7167         (Sized_relobj::local_got_offset_list): New function.
7168         * powerpc.cc (Target_powerpc::got_size): Add const.
7169         (Target_powerpc::got_entry_count): New function.
7170         (Target_powerpc::plt_entry_count): New function.
7171         (Target_powerpc::first_plt_entry_offset): New function.
7172         (Target_powerpc::plt_entry_size): New function.
7173         (Output_data_plt_powerpc::entry_count): New function.
7174         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
7175         (Output_data_plt_powerpc::get_plt_entry_size): New function.
7176         * sparc.cc (Target_sparc::got_size): Add const.
7177         (Target_sparc::got_entry_count): New function.
7178         (Target_sparc::plt_entry_count): New function.
7179         (Target_sparc::first_plt_entry_offset): New function.
7180         (Target_sparc::plt_entry_size): New function.
7181         (Output_data_plt_sparc::entry_count): New function.
7182         (Output_data_plt_sparc::first_plt_entry_offset): New function.
7183         (Output_data_plt_sparc::get_plt_entry_size): New function.
7184         * symtab.h (Symbol::got_offset_list): New function.
7185         (Symbol_table::for_all_symbols): New function.
7186         * target.h (Sized_target::got_entry_count): New function.
7187         (Sized_target::plt_entry_count): New function.
7188         (Sized_target::plt_entry_size): New function.
7189         * x86_64.cc (Target_x86_64::got_size): Add const.
7190         (Target_x86_64::got_entry_count): New function.
7191         (Target_x86_64::plt_entry_count): New function.
7192         (Target_x86_64::first_plt_entry_offset): New function.
7193         (Target_x86_64::plt_entry_size): New function.
7194         (Output_data_plt_x86_64::entry_count): New function.
7195         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
7196         (Output_data_plt_x86_64::get_plt_entry_size): New function.
7197
7198 2010-08-12  Cary Coutant  <ccoutant@google.com>
7199
7200         * archive.cc: Include incremental.h.
7201         (Archive::Archive): Initialize incremental_info_.
7202         (Archive::include_member): Record archive members in incremental info.
7203         (Add_archive_symbols::run): Record begin and end of an archive in
7204         incremental info.
7205         (Lib_group::include_member): Record objects in incremental info.
7206         * archive.h (Incremental_archive_entry): Forward declaration.
7207         (Archive::set_incremental_info): New member function.
7208         (Archive::incremental_info): New member function.
7209         (Archive::Unused_symbol_iterator): New class.
7210         (Archive::unused_symbols_begin): New member function.
7211         (Archive::unused_symbols_end): New member function.
7212         (Archive::incremental_info_): New data member.
7213         * incremental-dump.cc (find_input_containing_global): New function.
7214         (dump_incremental_inputs): Dump new incremental info sections.
7215         * incremental.cc: Include symtab.h.
7216         (Output_section_incremental_inputs): New class.
7217         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
7218         new incremental info sections.
7219         (Sized_incremental_binary::do_check_inputs): Likewise.
7220         (Incremental_inputs::report_archive): Remove.
7221         (Incremental_inputs::report_archive_begin): New function.
7222         (Incremental_inputs::report_archive_end): New function.
7223         (Incremental_inputs::report_object): New function.
7224         (Incremental_inputs::finalize_inputs): Remove.
7225         (Incremental_inputs::report_input_section): New function.
7226         (Incremental_inputs::report_script): Rewrite.
7227         (Incremental_inputs::finalize): Do nothing but finalize string table.
7228         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
7229         (Incremental_inputs::sized_create_inputs_section_data): Remove.
7230         (Incremental_inputs::create_data_sections): New function.
7231         (Incremental_inputs::relocs_entsize): New function.
7232         (Output_section_incremental_inputs::set_final_data_size): New function.
7233         (Output_section_incremental_inputs::do_write): New function.
7234         (Output_section_incremental_inputs::write_header): New function.
7235         (Output_section_incremental_inputs::write_input_files): New function.
7236         (Output_section_incremental_inputs::write_info_blocks): New function.
7237         (Output_section_incremental_inputs::write_symtab): New function.
7238         * incremental.h (Incremental_script_entry): Forward declaration.
7239         (Incremental_object_entry): Forward declaration.
7240         (Incremental_archive_entry): Forward declaration.
7241         (Incremental_inputs): Forward declaration.
7242         (Incremental_inputs_header_data): Remove.
7243         (Incremental_inputs_header): Remove.
7244         (Incremental_inputs_header_write): Remove.
7245         (Incremental_inputs_entry_data): Remove.
7246         (Incremental_inputs_entry): Remove.
7247         (Incremental_inputs_entry_write): Remove.
7248         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
7249         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
7250         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
7251         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
7252         Likewise.
7253         (Incremental_input_entry): New class.
7254         (Incremental_script_entry): New class.
7255         (Incremental_object_entry): New class.
7256         (Incremental_archive_entry): New class.
7257         (Incremental_inputs::Incremental_inputs): Initialize new data members.
7258         (Incremental_inputs::report_inputs): Remove.
7259         (Incremental_inputs::report_archive): Remove.
7260         (Incremental_inputs::report_archive_begin): New function.
7261         (Incremental_inputs::report_archive_end): New function.
7262         (Incremental_inputs::report_object): Change prototype.
7263         (Incremental_inputs::report_input_section): New function.
7264         (Incremental_inputs::report_script): Change prototype.
7265         (Incremental_inputs::get_reloc_count): New function.
7266         (Incremental_inputs::set_reloc_count): New function.
7267         (Incremental_inputs::create_data_sections): New function.
7268         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
7269         (Incremental_inputs::inputs_section): New function.
7270         (Incremental_inputs::symtab_section): New function.
7271         (Incremental_inputs::relocs_section): New function.
7272         (Incremental_inputs::get_stringpool): Add const.
7273         (Incremental_inputs::command_line): Add const.
7274         (Incremental_inputs::inputs): Remove.
7275         (Incremental_inputs::command_line_key): New function.
7276         (Incremental_inputs::input_file_count): New function.
7277         (Incremental_inputs::input_files): New function.
7278         (Incremental_inputs::relocs_entsize): New function.
7279         (Incremental_inputs::sized_create_inputs_section_data): Remove.
7280         (Incremental_inputs::finalize_inputs): Remove.
7281         (Incremental_inputs::Input_info): Remove.
7282         (Incremental_inputs::lock_): Remove.
7283         (Incremental_inputs::inputs_): Change type.
7284         (Incremental_inputs::inputs_map_): Remove.
7285         (Incremental_inputs::current_object_entry_): New data member.
7286         (Incremental_inputs::inputs_section_): New data member.
7287         (Incremental_inputs::symtab_section_): New data member.
7288         (Incremental_inputs::relocs_section_): New data member.
7289         (Incremental_inputs::reloc_count_): New data member.
7290         (Incremental_inputs_reader): New class.
7291         (Incremental_symtab_reader): New class.
7292         (Incremental_relocs_reader): New class.
7293         * layout.cc (Layout::finalize): Move finalization of incremental info
7294         and creation of incremental info sections to follow finalization of
7295         symbol table.  Set offsets for postprocessing sections.
7296         (Layout::create_incremental_info_sections): Call
7297         Incremental_inputs::create_data_sections.  Add incremental symtab
7298         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
7299         sections to layout after input sections.
7300         * layout.h (struct Timespec): Forward declaration.
7301         (Layout::incremental_inputs): Add const.
7302         (Layout::create_incremental_info_sections): Add parameter.
7303         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
7304         * object.cc: Include incremental.h.
7305         (Relobj::finalize_incremental_relocs): New function.
7306         (Sized_relobj::do_layout): Record input sections in incremental info.
7307         * object.h (Object::output_section): New function.
7308         (Object::output_section_offset): Moved from Relobj.
7309         (Object::get_incremental_reloc_base): New function.
7310         (Object::get_incremental_reloc_count): New function.
7311         (Object::do_output_section): New function.
7312         (Object::do_output_section_offset): Moved from Relobj.
7313         (Object::do_get_incremental_reloc_base): New function.
7314         (Object::do_get_incremental_reloc_count): New function.
7315         (Object::Object): Initialize new data members.
7316         (Relobj::output_section): Renamed do_output_section and moved to
7317         protected.
7318         (Relobj::output_section_offset): Moved to Object.
7319         (Relobj::do_get_incremental_reloc_base): New function.
7320         (Relobj::do_get_incremental_reloc_count): New function.
7321         (Relobj::allocate_incremental_reloc_counts): New function.
7322         (Relobj::count_incremental_reloc): New function.
7323         (Relobj::finalize_incremental_relocs): New function.
7324         (Relobj::next_incremental_reloc_index): New function.
7325         (Relobj::reloc_counts_): New data member.
7326         (Relobj::reloc_bases_): New data member.
7327         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
7328         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
7329         (Sized_relobj::incremental_relocs_scan): New function.
7330         (Sized_relobj::incremental_relocs_scan_reltype): New function.
7331         (Sized_relobj::incremental_relocs_write): New function.
7332         (Sized_relobj::incremental_relocs_write_reltype): New function.
7333         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
7334         incremental link.
7335         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
7336         archives and object files elsewhere.
7337         (Add_symbols::run): Report object files here.
7338         (Finish_group::run): Report end of archive at end of group.
7339         * reloc.cc: Include layout.h, incremental.h.
7340         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
7341         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
7342         (Sized_relobj::incremental_relocs_scan): New function.
7343         (Sized_relobj::incremental_relocs_scan_reltype): New function.
7344         (Sized_relobj::do_relocate_sections): Write incremental relocations.
7345         (Sized_relobj::incremental_relocs_write): New function.
7346         (Sized_relobj::incremental_relocs_write_reltype): New function.
7347         * script.cc (read_input_script): Rewrite test for incremental link.
7348         Change call to Incremental_inputs::report_script.
7349         * symtab.h (Symbol_table::first_global_index): New function.
7350         (Symbol_table::output_count): New function.
7351
7352 2010-08-12  Doug Kwan  <dougkwan@google.com>
7353
7354         * arm.cc (Target_arm::merge_object_attributes): Check command line
7355         options --no-wchar-size-warning and --no-enum-size-warning.
7356         * options.h (General_options): Add ld-compatible options
7357         --no-enum-size-warning and --no-wchar-size-warning.
7358
7359 2010-08-04  Ian Lance Taylor  <iant@google.com>
7360
7361         * x86_64.cc (Target_x86_64::Scan::local): Use
7362         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
7363         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
7364         (Target_x86_64::Scan::global): Likewise.
7365         (Target_x86_64::Relocate::relocate): Likewise.
7366         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
7367         Likewise.
7368
7369 2010-08-03  Cary Coutant  <ccoutant@google.com>
7370
7371         * merge.cc (Output_merge_string::do_add_input_section): Count strings
7372         to reserve space in merged_strings vector. Keep total input size
7373         for stats.
7374         (Output_merge_string::do_print_merge_stats): Print total input size.
7375         * merge.h (Output_merge_string): Add input_size_ field.
7376         * stringpool.cc (Stringpool_template::string_length): Move
7377         implementations out of Stringpool_template class and place in
7378         stringpool.h.
7379         * stringpool.h (string_length): Move out of Stringpool_template.
7380
7381 2010-08-03  Ian Lance Taylor  <iant@google.com>
7382
7383         PR 11712
7384         * layout.cc (relaxation_loop_body): If address of load segment is
7385         set, adjust address to include headers if possible.
7386
7387 2010-08-03  Ian Lance Taylor  <iant@google.com>
7388
7389         * version.cc (version_string): Bump to 1.10.
7390
7391 2010-08-03  Ian Lance Taylor  <iant@google.com>
7392
7393         PR 11805
7394         * layout.h (enum Output_section_order): Define.
7395         (class Layout): Update declarations.
7396         * layout.cc (Layout::get_output_section): Add order parameter.
7397         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
7398         is_first_non_relro parameters.  Change all callers.
7399         (Layout::choose_output_section): Likewise.
7400         (Layout::add_output_section_data): Likewise.
7401         (Layout::make_output_section): Likewise.  Set order.
7402         (Layout::default_section_order): New function.
7403         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
7404         * output.cc (Output_section::Output_section): Initialize order_.
7405         Don't initialize deleted fields.
7406         (Output_segment::Output_segment): Don't initialize deleted
7407         fields.
7408         (Output_segment::add_output_section_to_load): New function
7409         replacing add_output_section.  Change all callers to call this or
7410         add_output_section_to_nonload.
7411         (Output_segment::add_output_section_to_nonload): New function.
7412         (Output_segment::remove_output_section): Rewrite.
7413         (Output_segment::add_initial_output_data): Likewise.
7414         (Output_segment::has_any_data_sections): Likewise.
7415         (Output_segment::is_first_section_relro): Likewise.
7416         (Output_segment::maximum_alignment): Likewise.
7417         (Output_segment::has_dynamic_reloc): New function replacing
7418         dynamic_reloc_count.  Change all callers.
7419         (Output_segment::has_dynamic_reloc_list): New function replacing
7420         dynamic_reloc_count_list.  Change all callers.
7421         (Output_segment::set_section_addresses): Rewrite.
7422         (Output_segment::set_offset): Rewrite.
7423         (Output_segment::find_first_and_last_list): Remove.
7424         (Output_segment::set_tls_offsets): Rewrite.
7425         (Output_segment::first_section_load_address): Likewise.
7426         (Output_segment::output_section_count): Likewise.
7427         (Output_segment::section_with_lowest_load_address): Likewise.
7428         (Output_segment::write_section_headers): Likewise.
7429         (Output_segment::print_sections_to_map): Likewise.
7430         * output.h (class Output_data): Remove dynamic_reloc_count_
7431         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
7432         (Output_data::add_dynamic_reloc): Rewrite.
7433         (Output_data::has_dynamic_reloc): New function.
7434         (Output_data::dynamic_reloc_count): Remove.
7435         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
7436         is_last_relro_, is_first_non_relro_, is_interp_,
7437         is_dynamic_linker_section_ fields.  Add order and set_order
7438         functions.  Remove is_relro_local, set_is_relro_local,
7439         is_last_relro, set_is_last_relro, is_first_non_relro,
7440         set_is_first_non_relro functions, is_interp, set_is_interp,
7441         is_dynamic_linker_section, and set_is_dynamic_linker_section
7442         functions.
7443         (class Output_segment): Change Output_data_list from std::list to
7444         std:;vector.  Add output_lists_ field.  Remove output_data_ and
7445         output_bss_ fields.  Update declarations.
7446
7447 2010-08-02  Ian Lance Taylor  <iant@google.com>
7448
7449         * arm.cc (Target_arm::gc_process_relocs): Use typename.
7450         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
7451         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
7452
7453 2010-08-02  Ian Lance Taylor  <iant@google.com>
7454
7455         PR 11855
7456         * script.cc (Script_options::Script_options): Initialize
7457         symbol_definitions_ and symbol_references_.
7458         (Script_options::add_symbol_assignment): Update
7459         symbol_definitions_ and symbol_references_.
7460         (Script_options::add_symbol_reference): New function.
7461         (script_symbol): New function.
7462         * script.h (class Script_options): Add symbol_definitions_ and
7463         symbol_references_ fields.
7464         (Script_options::referenced_const_iterator): New type.
7465         (Script_options::referenced_begin): New function.
7466         (Script_options::referenced_end): New function.
7467         (Script_options::is_referenced): New function.
7468         (Script_options::any_unreferenced): New function.
7469         * script-c.h (script_symbol): Declare.
7470         * yyscript.y (exp): Call script_symbol.
7471         * symtab.cc: Include "script.h".
7472         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
7473         Change all callers.  Check symbols referenced by scripts.
7474         (Symbol_table::add_undefined_symbols_from_command_line): Add
7475         layout parameter.  Change all callers.
7476         (Symbol_table::do_add_undefined_symbols_from_command_line):
7477         Likewise.  Break out loop body.  Check symbols referenced by
7478         scripts.
7479         (Symbol_table::add_undefined_symbol_from_command_line): New
7480         function broken out of
7481         do_add_undefined_symbols_from_command_line.
7482         * symtab.h (class Symbol_table): Update declarations.
7483         * archive.cc: Include "layout.h".
7484         (Archive::should_include_member): Add layout parameter.  Change
7485         all callers.  Check for symbol mentioned in expression.
7486         * archive.h (class Archive): Update declaration.
7487         * object.cc (Sized_relobj::do_should_include_member): Add layout
7488         parameter.
7489         * object.h (Object::should_include_member): Add layout parameter.
7490         Change all callers.
7491         (Object::do_should_include_member): Add layout parameter.
7492         (class Sized_relobj): Update declaration.
7493         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
7494         parameter.
7495         * dynobj.h (class Sized_dynobj): Update declaration.
7496         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
7497         layout parameter.
7498         * plugin.h (class Sized_pluginobj): Update declaration.
7499
7500 2010-08-02  Ian Lance Taylor  <iant@google.com>
7501
7502         PR 11866
7503         * output.cc (Output_segment::set_offset): Search for the first and
7504         last sections rather than assuming that the list is in order.
7505         (Output_segment::find_first_and_last_list): New function.
7506         * output.h (class Output_segment): Update declarations.
7507         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
7508         (relro_strip_test_SOURCES): New variable.
7509         (relro_strip_test_DEPENDENCIES): New variable.
7510         (relro_strip_test_LDFLAGS): New variable.
7511         (relro_strip_test_LDADD): New variable.
7512         (relro_strip_test.so): New target.
7513
7514 2010-08-02  Ian Lance Taylor  <iant@google.com>
7515
7516         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
7517         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
7518         (Target_i386::got_tlsdesc_section): New function.
7519         (Target_i386::got_section): Create space for GOT entries for
7520         TLSDESC relocations.
7521         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
7522         R_386_TLS_GOTDESC.
7523         (Target_i386::Scan::global): Likewise.
7524         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
7525         using TLSDESC GOT.
7526         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
7527         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
7528         (Target_x86_64::got_tlsdesc_section): New function.
7529         (Target_x86_64::got_section): Create space for GOT entries for
7530         TLSDESC relocations.
7531         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
7532         R_386_TLS_GOTDESC.
7533         (Target_x86_64::Scan::global): Likewise.
7534         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
7535         using TLSDESC GOT.
7536
7537 2010-08-02  Ian Lance Taylor  <iant@google.com>
7538
7539         * testsuite/final_layout.sh: Use dc to convert from hex to
7540         decimal.
7541
7542 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
7543
7544         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
7545         paramter to the call to gold::gc_process_relocs.
7546         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
7547         paramter to the call to gold::gc_process_relocs.
7548         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
7549         parameter to the call to gold::gc_process_relocs.
7550         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
7551         template parameter to the call to gold::gc_process_relocs.
7552         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
7553         paramter to the call to gold::gc_process_relocs.
7554         * gc.h (get_embedded_addend_size): New function.
7555         (gc_process_relocs): Save the size of the reloc for use by ICF.
7556         * icf.cc (get_section_contents): Get the addend from the text section
7557         for SHT_REL relocation sections.
7558         * icf.h (Icf::Reloc_addend_size_info): New typedef.
7559         (Icf::Reloc_info): Add new member reloc_addend_size_info.
7560         * int_encoding.h (read_from_pointer): New overloaded function.
7561         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
7562         * testsuite/icf_sht_rel_addend_test.sh: New file.
7563         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
7564         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
7565
7566 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7567
7568         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
7569         * Makefile.in: Regenerate.
7570         * testsuite/Makefile.in: Regenerate.
7571
7572 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
7573
7574         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
7575         * gold/testsuite/debug_msg.cc: Likewise.
7576         * gold/testsuite/odr_violation1.cc
7577         * gold/testsuite/odr_violation2.cc
7578
7579 2010-07-21  Cary Coutant  <ccoutant@google.com>
7580
7581         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
7582         string, and length fields.
7583         (Output_merge_string::Merged_strings_list): New type.
7584         (Output_merge_string::Merged_strings_lists): New typedef.
7585         (Output_merge_string): Replace merged_strings_ with
7586         merged_strings_lists_.
7587         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
7588         Merged_strings_list per input object and section.  Don't store pointer
7589         to the string.  Don't store length with each merged string entry.
7590         (Output_merge_string::finalize_merged_data): Loop over list of merged
7591         strings lists.  Recompute length of each merged string.
7592
7593 2010-07-15  Cary Coutant  <ccoutant@google.com>
7594
7595         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
7596         here.
7597
7598 2010-07-14  Ian Lance Taylor  <iant@google.com>
7599
7600         * descriptors.cc (Descriptors::open): Report correct name in error
7601         message.
7602
7603 2010-07-13  Doug Kwan  <dougkwan@google.com>
7604
7605         * arm.cc (Arm_input_section::Arm_input_section): For a
7606         SHT_ARM_EXIDX section, always keeps the input sections.
7607         (Arm_input_section::set_exidx_section_link): New method.
7608         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
7609         has_errors_ to false.
7610         (Arm_exidx_input_section::has_errors,
7611         Arm_exidx_input_section::set_has_errors): New methods.
7612         (Arm_exidx_input_section::has_errors_): New data member.
7613         (Arm_relobj::get_exidx_shndx_list): New method.
7614         (Arm_output_section::append_text_sections_to_list): Do not skip
7615         section without SHF_EXECINSTR.
7616         (Arm_output_section::fix_exidx_coverage): Skip input sections with
7617         errors.
7618         (Arm_relobj::make_exidx_input_section): Add new parameter for text
7619         section header.  Make error messages more verbose.  Check for
7620         a non-executable section linked to an EXIDX section.
7621         (Arm_relobj::do_read_symbols): Remove error checking, which has been
7622         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
7623         check that there is no deferred EXIDX section if we exit early.
7624         Instead of not making an EXIDX section in case of an error, make one
7625         and set the has_errors flag of it.
7626         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
7627         in a relocatable link.
7628         (Target_arm::do_relax): Look for the EXIDX output section instead of
7629         assuming that it is called .ARM.exidx.
7630         (Target_arm::fix_exidx_coverage): Add a new parameter for input
7631         section list.  Do not check for SHF_EXECINSTR section flags but
7632         skip any input section with errors.
7633         * output.cc (Output_section::Output_section): Initialize
7634         always_keeps_input_sections_ to false.
7635         (Output_section::add_input_section): Check for
7636         always_keeps_input_sections_.
7637         *  output.h (Output_section::always_keeps_input_sections,
7638         Output_section::set_always_keeps_input_sections): New methods.
7639         (Output_section::always_keeps_input_sections): New data member.
7640
7641 2010-07-13  Rafael Espindola  <espindola@google.com>
7642
7643         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
7644         * fileread.h (Input_file): Add try_extra_search_path and find_file.
7645
7646 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
7647             Ian Lance Taylor  <iant@google.com>
7648
7649         * output.h (Output_section_lookup_maps::add_merge_section):
7650         Correct check of whether value was inserted.
7651         (Output_section_lookup_maps::add_merge_input_section): Likewise.
7652         (Output_section_lookup_maps::add_relaxed_input_section):
7653         Likewise.
7654         * arm.cc (Target_arm::got_section): Remove used local os.
7655         * i386.cc (Target_i386::got_section): Likewise.
7656         * x86_64.cc (Target_x86_64::got_section): Likewise.
7657         * sparc.cc (Target_sparc::got_section): Likewise.
7658         (Target_sparc::relocate): Remove unused local have_got_offset.
7659         * powerpc.cc (Target_powerpc::relocate): Likewise.
7660
7661 2010-07-13  Ian Lance Taylor  <iant@google.com>
7662
7663         * compressed_output.cc (zlib_decompress): Fix signature in
7664         !HAVE_ZLIB_H case.
7665
7666         * archive.cc (Archive::include_member): Unlock an external member
7667         of a thin archive.  Don't bother to delete an object we know is
7668         NULL.
7669
7670 2010-07-12  Cary Coutant  <ccoutant@google.com>
7671
7672         * compressed_output.cc (zlib_decompress): New function.
7673         (get_uncompressed_size): New function.
7674         (decompress_input_section): New function.
7675         * compressed_output.h (get_uncompressed_size): New function.
7676         (decompress_input_section): New function.
7677         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
7678         Handle compressed debug sections.
7679         * layout.cc (is_compressed_debug_section): New function.
7680         (Layout::output_section_name): Map compressed section names to
7681         canonical names.
7682         * layout.h (is_compressed_debug_section): New function.
7683         (is_debug_info_section): Recognize compressed debug sections.
7684         * merge.cc: Include compressed_output.h.
7685         (Output_merge_data::do_add_input_section): Handle compressed
7686         debug sections.
7687         (Output_merge_string::do_add_input_section): Handle compressed
7688         debug sections.
7689         * object.cc: Include compressed_output.h.
7690         (Sized_relobj::Sized_relobj): Initialize new data members.
7691         (build_compressed_section_map): New function.
7692         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
7693         * object.h (Object::section_is_compressed): New method.
7694         (Object::do_section_is_compressed): New method.
7695         (Sized_relobj::Compressed_section_map): New type.
7696         (Sized_relobj::do_section_is_compressed): New method.
7697         (Sized_relobj::compressed_sections_): New data member.
7698         * output.cc (Output_section::add_input_section): Handle compressed
7699         debug sections.
7700         * reloc.cc: Include compressed_output.h.
7701         (Sized_relobj::write_sections): Handle compressed debug sections.
7702
7703 2010-07-08  Cary Coutant  <ccoutant@google.com>
7704
7705         * resolve.cc (Symbol_table::resolve): Remember whether undef was
7706         weak when resolving to a dynamic def.
7707         (Symbol_table::should_override): Add adjust_dyndef flag; set it
7708         for weak undef/dynamic def cases. Adjust callers.
7709         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
7710         undef_binding_weak_.
7711         (Symbol_table::sized_write_globals): Adjust symbol binding.
7712         (Symbol_table::sized_write_symbol): Add binding parameter.
7713         * symtab.h (Symbol::set_undef_binding): New method.
7714         (Symbol::is_undef_binding_weak): New method.
7715         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
7716         (Symbol_table::should_override): Add new parameter.
7717         (Symbol_table::sized_write_symbol): Add new parameter.
7718
7719         * testsuite/weak_undef_file1.cc: Add new test case.
7720         * testsuite/weak_undef_file2.cc: Fix header comment.
7721         * testsuite/weak_undef_test.cc: Add new test case.
7722
7723 2010-06-29  Doug Kwan  <dougkwan@google.com>
7724
7725         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
7726         Initialize USE_SYMBOL_.
7727         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
7728         definition.
7729         (Arm_reloc_property::uses_symbol_): New data member declaration.
7730         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
7731         uses symbol value and symbol is undefined but not weakly undefined.
7732
7733 2010-06-28  Rafael Espindola  <espindola@google.com>
7734
7735         * plugin.cc (Plugin::load): Use dlerror.
7736
7737 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
7738
7739         * symtab.cc (detect_odr_violations): When reporting an ODR
7740         violation, report an object where the symbol is defined.
7741
7742 2010-06-25  Doug Kwan  <dougkwan@google.com>
7743
7744         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
7745         (Target_arm::section_may_have_icf_unsafe_pointers): New method
7746         definition.
7747         (Target_arm::Scan::local_reloc_may_be_function_pointer,
7748         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
7749         target hook to detect function points.
7750         (Target_arm::Scan::possible_function_pointer_reloc): New method.
7751         * icf.h (Icf::check_section_for_function_pointers): Change type of
7752         parameter SECTION_NAME to const reference to std::string.  Use
7753         target hook to determine if section may have unsafe pointers.
7754         * target.h (Target::section_may_have_icf_unsafe_pointers): New
7755         method definition.
7756
7757 2010-06-21  Rafael Espindola  <espindola@google.com>
7758
7759         * fileread.cc (Input_file::find_fie): New
7760         (Input_file::open): Use Input_file::find_fie.
7761         * fileread.h (Input_file::find_fie): New
7762         * plugin.cc (set_extra_library_path): New.
7763         (Plugin::load): Add set_extra_library_path to the transfer vector.
7764         (Plugin_manager::set_extra_library_path): New.
7765         (Plugin_manager::add_input_file): Use the extra search path if set.
7766         (set_extra_library_path(): New.
7767         * plugin.h (Plugin_manager): Add set_extra_library_path and
7768         extra_search_path_.
7769
7770 2010-06-19  Cary Coutant  <ccoutant@google.com>
7771
7772         * layout.cc (gdb_sections): Add .debug_types.
7773         (lines_only_debug_sections): Likewise.
7774
7775 2010-06-18  Rafael Espindola  <espindola@google.com>
7776
7777         * plugin.cc (add_input_file,add_input_library)
7778         (Plugin_manager::add_input_file): Make filename arguments const.
7779         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
7780         const.
7781
7782 2010-06-16  Doug Kwan  <dougkwan@google.com>
7783
7784         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
7785         .ARM.attributes section if we have not merged any input
7786         attributes sections.
7787
7788 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7789
7790         * arm.cc: Allow combining objects with no EABI version
7791         information.
7792
7793 2010-06-15  Rafael Espindola  <espindola@google.com>
7794
7795         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
7796
7797 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7798
7799         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
7800         (struct iovec): Correct !HAVE_READV definition.
7801
7802 2010-06-10  Cary Coutant  <ccoutant@google.com>
7803
7804         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
7805         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
7806         reloc sections.
7807         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
7808
7809         PR 11683
7810         * symtab.h (Symbol::is_placeholder): New member function.
7811         * target-reloc.h (relocate_section): Check for placeholder symbols.
7812
7813         * testsuite/Makefile.am (plugin_test_8): New test.
7814         (plugin_test_9): New test.
7815         * testsuite/Makefile.in: Regenerate.
7816
7817 2010-06-09  Nick Clifton  <nickc@redhat.com>
7818
7819         * yyscript.y (input_list_element): Allow strings prefixed with
7820         the '-' character.  Treat these as libraries.
7821         * script.cc (script_add_library): New function.  Adds a library
7822         specified by "-l<name>" found in an input script.
7823         * script-c.h: Add prototype for script_add_library.
7824
7825 2010-06-07  Doug Kwan  <dougkwan@google.com>
7826
7827         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
7828         Restrict stub-group size to be within long conditional branch
7829         range when working around cortex-A8 erratum.
7830
7831 2010-06-07  Damien Diederen  <dd@crosstwine.com>
7832
7833         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
7834         #ifdef typo.
7835
7836 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
7837
7838         PR gold/11658
7839         * output.cc
7840         (Output_section::Input_section_sort_entry::compare_section_ordering):
7841         Change to return non-zero correctly.
7842         (Output_section::Input_section_sort_section_order_index_compare
7843         ::operator()): Change to fix ambiguity in comparisons.
7844
7845 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
7846
7847         * gold.h (is_wildcard_string): New function.
7848         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
7849         (Layout::layout_eh_frame): Ditto.
7850         (Layout::find_section_order_index): New method.
7851         (Layout::read_layout_from_file): New method.
7852         * layout.h (Layout::find_section_order_index): New method.
7853         (Layout::read_layout_from_file): New method.
7854         (Layout::input_section_position_): New private member.
7855         (Layout::input_section_glob_): New private member.
7856         * main.cc (main): Call read_layout_from_file here.
7857         * options.h (--section-ordering-file): New option.
7858         * output.cc (Output_section::input_section_order_specified_): New
7859         member.
7860         (Output_section::Output_section): Initialize new member.
7861         (Output_section::add_input_section): Add new parameter.
7862         Keep input sections when --section-ordering-file is used.
7863         (Output_section::set_final_data_size): Sort input sections when
7864         section ordering file is specified.
7865         (Output_section::Input_section_sort_entry): Add new parameter.
7866         Check sorting type.
7867         (Output_section::Input_section_sort_entry::compare_section_ordering):
7868         New method.
7869         (Output_section::Input_section_sort_compare::operator()): Change to
7870         consider section_order_index.
7871         (Output_section::Input_section_sort_init_fini_compare::operator()):
7872         Change to consider section_order_index.
7873         (Output_section::Input_section_sort_section_order_index_compare
7874         ::operator()): New method.
7875         (Output_section::sort_attached_input_sections): Change to sort
7876         according to section order when specified.
7877         (Output_section::add_input_section<32, true>): Add new parameter.
7878         (Output_section::add_input_section<64, true>): Add new parameter.
7879         (Output_section::add_input_section<32, false>): Add new parameter.
7880         (Output_section::add_input_section<64, false>): Add new parameter.
7881         * output.h (Output_section::add_input_section): Add new parameter.
7882         (Output_section::input_section_order_specified): New
7883         method.
7884         (Output_section::set_input_section_order_specified): New method.
7885         (Input_section::Input_section): Initialize section_order_index_.
7886         (Input_section::section_order_index): New method.
7887         (Input_section::set_section_order_index): New method.
7888         (Input_section::section_order_index_): New member.
7889         (Input_section::Input_section_sort_section_order_index_compare): New
7890         struct.
7891         (Output_section::input_section_order_specified_): New member.
7892         * script-sections.cc (is_wildcard_string): Delete and move modified
7893         method to gold.h.
7894         (Output_section_element_input::Output_section_element_input): Modify
7895         call to is_wildcard_string.
7896         (Output_section_element_input::Input_section_pattern
7897         ::Input_section_pattern): Ditto.
7898         (Output_section_element_input::Output_section_element_input): Ditto.
7899         * testsuite/Makefile.am (final_layout): New test case.
7900         * testsuite/Makefile.in: Regenerate.
7901         * testsuite/final_layout.cc: New file.
7902         * testsuite/final_layout.sh: New file.
7903
7904 2010-06-01  Rafael Espindola  <espindola@google.com>
7905
7906         * plugin.cc (Plugin::load): Pass the output name to the plugin.
7907
7908 2010-06-01  Rafael Espindola  <espindola@google.com>
7909
7910         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
7911         visibility of symbols.
7912
7913 2010-05-27  Doug Kwan  <dougkwan@google.com>
7914
7915         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
7916         from start of output section instead of address for a local symbol
7917         in a merged or relaxed section when doing a relocatable link.
7918
7919 2010-05-26  Rafael Espindola  <espindola@google.com>
7920
7921         PR 11604
7922         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
7923         adding sections the garbage collector removed.
7924         * gold/testsuite/Makefile.am: Add test.
7925         * gold/testsuite/Makefile.in: Regenerate.
7926         * gold/testsuite/plugin_test_7.sh: New.
7927         * gold/testsuite/plugin_test_7_1.c: New.
7928         * gold/testsuite/plugin_test_7_2.c: New.
7929
7930 2010-05-26  Rafael Espindola  <espindola@google.com>
7931
7932         * script-sections.cc (Output_section_definition::set_section_addresses):
7933         Check for --section-start.
7934
7935 2010-05-26  Doug Kwan  <dougkwan@google.com>
7936
7937         * arm.cc (Arm_scan_relocatable_relocs): New class.
7938         (Target_arm::relocate_special_relocatable): New method.
7939         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
7940         (Arm_relocate_functions::thumb_branch_common): Same.
7941         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
7942         instead of Default_scan_relocatable_relocs.
7943         * target-reloc.h (relocate_for_relocatable): Let target handle
7944         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
7945         * target.h (Sized_target::relocate_special_relocatable): New method.
7946
7947 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7948
7949         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
7950
7951 2010-05-23  Doug Kwan  <dougkwan@google.com>
7952
7953         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
7954         instead of a cast.
7955         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
7956         with a direct branch, not a conditional branch, to a stub.
7957         * merge.cc (Output_merge_base::record_input_section): New method
7958         defintion.
7959         (Output_merge_data::do_add_input_section): Record input section if
7960         keeps-input-sections flag is set.
7961         (Output_merge_string::do_add_input_section): Ditto.
7962         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
7963         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
7964         INPUT_SECTIONS_.
7965         (Output_merge_base::keeps_input_sections,
7966         Output_merge_base::set_keeps_input_sections,
7967         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
7968         method definitions.
7969         (Output_merge_base::Input_sections): New type declaration.
7970         (Output_merge_base::input_sections_begin,
7971         Output_merge_base::input_sections_end,
7972         Output_merge_base::do_set_keeps_input_sections): New method definitions.
7973         (Output_merge_base::bool keeps_input_sections_,
7974         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
7975         Output_merge_base::input_sections_): New data members.
7976         (Output_merge_data::do_set_keeps_input_sections): New method
7977         defintion.
7978         (Output_merge_string::do_set_keeps_input_sections): Ditto.
7979         * output.cc (Output_section::Input_section::relobj): Move method
7980         defintion from class declaration to here and handle merge sections.
7981         (Output_section::Input_section::shndx): Ditto.
7982         (Output_section::Output_section): Remove initializations of removed
7983         data members and initialize new data member LOOKUP_MAPS_.
7984         (Output_section::add_input_section): Set keeps-input-sections flag
7985         for a newly created merge output section as appropriate.  Adjust code
7986         to use Output_section_lookup_maps class.
7987         (Output_section::add_relaxed_input_section): Adjst code for lookup
7988         maps code refactoring.
7989         (Output_section::add_merge_input_section): Add a new parameter
7990         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
7991         class.  If adding input section to a newly created merge output
7992         section fails, remove the new merge section.
7993         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
7994         Adjust code for use of the Output_section_lookup_maps class.
7995         (Output_section::find_merge_section): Ditto.
7996         (Output_section::build_lookup_maps): New method defintion.
7997         (Output_section::find_relaxed_input_section): Adjust code to use
7998         Output_section_lookup_maps class.
7999         (Output_section::get_input_sections): Export merge sections.  Adjust
8000         code to use Output_section_lookup_maps class.
8001         (Output_section:::add_script_input_section): Adjust code to use
8002         Output_section_lookup_maps class.  Update lookup maps for merge
8003         sections also.
8004         (Output_section::discard_states): Use Output_section_lookup_maps.
8005         (Output_section::restore_states): Same.
8006         * output.h (Merge_section_properties): Move class defintion out of
8007         Output_section.
8008         (Output_section_lookup_maps): New class.
8009         (Output_section::Input_section::is_merge_section): New method
8010         defintion.
8011         (Output_section::Input_section::relobj): Move defintion out of class
8012         defintion.  Declare method only.
8013         (Output_section::Input_section::shndx): Ditto.
8014         (Output_section::Input_section::output_merge_base): New method defintion.
8015         (Output_section::Input_section::u2_.pomb): New union field.
8016         (Output_section::Merge_section_by_properties_map,
8017         Output_section::Output_section_data_by_input_section_map,
8018         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
8019         Remove types.
8020         (Output_section::add_merge_input_section): Add new parameter
8021         KEEPS_INPUT_SECTIONS.
8022         (Output_section::build_lookup_maps): New method declaration.
8023         (Output_section::merge_section_map_,
8024         Output_section::merge_section_by_properties_map_,
8025         Output_section::relaxed_input_section_map_,
8026         Output_section::is_relaxed_input_section_map_valid_): Remove data
8027         members.
8028         (Output_section::lookup_maps_): New data member.
8029
8030 2010-05-21  Doug Kwan  <dougkwan@google.com>
8031
8032         PR gold/11619
8033         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
8034         avoid a compilation error.
8035
8036 2010-05-19  Rafael Espindola  <espindola@google.com>
8037
8038         * script-sections.cc (Output_section_definition::allocate_to_segment):
8039         Update the phdrs_list even when the output section is NULL.
8040         * testsuite/Makefile.am: Add test.
8041         * testsuite/Makefile.in: Regenerate.
8042         * testsuite/script_test_9.cc: New.
8043         * testsuite/script_test_9.sh: New.
8044         * testsuite/script_test_9.t: New.
8045
8046 2010-05-19  Doug Kwan  <dougkwan@google.com>
8047
8048         * arm.cc (Arm_input_section::original_size): New method.
8049         (Arm_input_section::do_addralign): Add a cast.
8050         (Arm_input_section::do_output_offset): Remove static cast.
8051         (Arm_input_section::original_addralign,
8052          Arm_input_section::original_size_): Change type to uint32_t.
8053         (Arm_input_section::init): Add safe casts for section alignment
8054         and size.
8055         (Arm_input_section::set_final_data_size): Do not set address and
8056         offset of stub table.
8057         (Arm_output_section::fix_exidx_coverage): Change use of of
8058         Output_section::Simple_input_section to that of
8059         Output_section::Input_section.
8060         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
8061         except for the first pass.
8062         * output.cc (Output_section::get_input_sections): Change type of
8063         input_sections to std::list<Input_section>.
8064         (Output_section::add_script_input_section): Rename from
8065         Output_section::add_simple_input_section.  Change type of SIS
8066         parameter from Simple_input_section to Input_section.
8067         * output.h (Output_section::Simple_input_section): Remove class.
8068         (Output_section::Input_section): Change class visibility to public.
8069         (Output_section::Input_section::addralign): Use stored alignments
8070         for special input sections if set.
8071         (Output_section::Input_section::set_addralign): New method.
8072         (Output_section::get_input_sections): Change parameter type from
8073         list of Simple_input_section to list of Input_section.
8074         (Output_section::add_script_input_section): Rename from
8075         Output_section::add_simple_input_section. Change first parameter's
8076         type from Simple_input_section to Input_section and remove the
8077         second and third parameters.
8078         * script-sections.cc (Input_section::Input_section_list): Change
8079         type to list of Output_section::Input_section/
8080         (Input_section_info::Input_section_info): Change parameter type of
8081         INPUT_SECTION to Output_section::Input_section.
8082         (Input_section_info::input_section): Change return type.
8083         (Input_section_info::input_section_): Change type to
8084         Output_section::Input_section.
8085         (Output_section_element_input::set_section_addresses): Adjust code
8086         to use Output_section::Input_section instead of
8087         Output_section::Simple_input_section.  Adjust code for renaming
8088         of Output_section::add_simple_input_section.
8089         (Orphan_output_section::set_section_addresses): Ditto.
8090
8091 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8092
8093         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
8094         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
8095
8096 2010-05-18  Rafael Espindola  <espindola@google.com>
8097
8098         * options.cc (General_options::finalize): Handle -nostdlib.
8099         * options.h (nostdlib): New option.
8100         * script.cc (script_add_search_dir): Handle -nostdlib.
8101
8102 2010-05-12  Doug Kwan  <dougkwan@google.com>
8103
8104         * arm.cc (Target_arm::do_finalize_sections): Create an empty
8105         attributes section only if there no attributes section after merging.
8106         (Target_arm::merge_object_attributes): Move value of
8107         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
8108         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
8109         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
8110         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
8111         and arm_attr_merge_7.stdout.
8112         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
8113         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
8114         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
8115         arm_attr_merge_7b.o): New rules.
8116         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
8117         arm_attr_merge_7
8118         * testsuite/Makefile.in: Regenerate.
8119         * testsuite/arm_attr_merge.sh: New file.
8120         * testsuite/arm_attr_merge_[67][ab].s: Same.
8121
8122 2010-05-05  Nick Clifton  <nickc@redhat.com>
8123
8124         * po/es.po: Updated Spanish translation.
8125
8126 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
8127
8128         * Makefile.am (install-exec-local): Properly install gold as
8129         default cross linker.
8130         * Makefile.in: Regenerated.
8131
8132 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
8133             Nick Clifton  <nickc@redhat.com>
8134
8135         * configure.ac (install_as_default): Define and set to false
8136         unless --enable-gold or --enable-gold=both/gold has been
8137         specified.
8138         * configure: Regenerate.
8139
8140         * Makefile.am (install-exec-local): Install the executable as
8141         'ld.gold'.  If install_as_default is true then also install it as
8142         'ld'.
8143         * Makefile.in: Regenerated.
8144
8145 2010-04-24  Ian Lance Taylor  <iant@google.com>
8146
8147         * layout.cc (Layout::layout_reloc): In relocatable link don't
8148         combine reloc sections for grouped sections.
8149
8150 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
8151
8152         * gc.h (gc_process_relocs): Pass information on relocs pointing to
8153         sections that are not ordinary to icf.
8154         * icf.cc (get_section_contents): Handle relocation pointing to section
8155         with no object or shndx information.
8156         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
8157         * testsuite/Makefile.in: Regenerate.
8158         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
8159         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
8160
8161 2010-04-22  Ian Lance Taylor  <iant@google.com>
8162
8163         * expression.cc (Expression::Expression_eval_info): Add
8164         result_alignment_pointer field.
8165         (Expression::eval_with_dot): Add result_alignment_pointer
8166         parameter.  Change all callers.
8167         (Expression::eval_maybe_dot): Likewise.
8168         (class Binary_expression): Add alignment_pointer parameter to
8169         left_value and right_value.  Change all callers.
8170         (BINARY_EXPRESSION): Set result alignment.
8171         (class Trinary_expression): Add alignment_pointer parameter to
8172         arg2_value and arg3_value.  Change all callers.
8173         (Trinary_cond::value): Set result alignment.
8174         (Max_expression::value, Min_expression::value): Likewise.
8175         (Align_expression::value): Likewise.
8176         * script-sections.cc (class Sections_element): Add dot_alignment
8177         parameter to set_section_addresses virtual function.  Update
8178         instantiations.
8179         (class Output_section_element): Likewise.
8180         (Script_sections::create_segments): Add dot_alignment parameter.
8181         Change all callers.
8182         (Script_sections::create_segments_from_phdrs_clause): Likewise.
8183         (Script_sections::set_phdrs_clause_addresses): Likewise.
8184         * script-sections.h: Update declarations.
8185         * script.h: Update declarations.
8186         * output.h (Output_segment::set_minimum_p_align): Don't decrease
8187         min_p_align.
8188         * testsuite/script_test_3.t: Set large alignment.
8189         * testsuite/script_test_3.sh: Make sure that at least one LOAD
8190         segment has expected alignment.
8191
8192 2010-04-22  Nick Clifton  <nickc@redhat.com>
8193
8194         * po/gold.pot: Updated by the Translation project.
8195         * po/vi.po: Updated Vietnamese translation.
8196
8197 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
8198
8199         * testsuite/Makefile.am (check_PROGRAMS): Add
8200         icf_virtual_function_folding_test.
8201         * testsuite/Makefile.in: Regenerated.
8202
8203 2010-04-15  Andrew Haley  <aph@redhat.com>
8204
8205         * options.h (merge_exidx_entries): New option.
8206         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
8207         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
8208         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
8209         (Target_arm::merge_exidx_entries): New function.
8210         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
8211         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
8212         to Arm_exidx_fixup constructor.
8213         Add new arg, merge_exidx_entries.
8214         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
8215         Arm_output_section::fix_exidx_coverage.
8216
8217 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
8218
8219         * icf.cc (get_section_contents): Check for preemptible functions.
8220         Ignore addend when appropriate.
8221         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
8222         section folded.
8223         (add_from_relobj): Check for section folded.
8224         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
8225         * symtab.h (should_add_dynsym_entry): Add new parameter.
8226         * target-reloc.h (scan_relocs): Check for section folded.
8227         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
8228         Check reloc types for function pointers in shared objects.
8229         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
8230         case.
8231         (icf_preemptible_functions_test): New test case.
8232         (icf_string_merge_test): New test case.
8233         * testsuite.Makefile.in: Regenerate.
8234         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
8235         bar_glob.  Refactor code.
8236         * testsuite/icf_preemptible_functions_test.cc: New file.
8237         * testsuite/icf_preemptible_functions_test.sh: New file.
8238         * testsuite/icf_string_merge_test.cc: New file.
8239         * testsuite/icf_string_merge_test.sh: New file.
8240         * testsuite/icf_virtual_function_folding_test.cc: New file.
8241         * testsuite/icf_virtual_function_folding_test.sh: New file.
8242
8243 2010-04-14  Doug Kwan  <dougkwan@google.com>
8244
8245         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
8246         for local symbol recounting if we remove a section due to ICF.
8247         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
8248         there are no regular objects in input.
8249
8250 2010-04-13  Doug Kwan  <dougkwan@google.com>
8251
8252         * arm.cc (Arm_input_section::set_final_data_size): Compute
8253         accurate final data size instead of using current data size.
8254
8255 2010-04-09  Doug Kwan  <dougkwan@google.com>
8256
8257         * layout.cc (Layout::choose_output_section): Handle script section
8258         types.
8259         (Layout::make_output_section_for_script): Add section type parameter.
8260         Handle script section types.
8261         * layout.h (Layout::make_output_section_for_script): Add section
8262         type parameter.
8263         * output.cc (Output_section::Output_section): Initialize data member
8264         is_noload_.
8265         (Output_section::do_reset_address_and_file_offset): Do not set address
8266         to 0 if section is a NOLOAD section.
8267         * output.h (Output_section::is_noload): New method.
8268         (Output_section::set_is_noload): Ditto.
8269         (Output_section::is_noload_): New data member.
8270         * script-c.h (Script_section_type): New enum type.
8271         (struct Parser_output_section_header): Add new file section_type.
8272         * script-sections.cc (Sections_element::output_section_name): Add
8273         parameter for returning script section type.
8274         (Output_section_definition::output_section_name): Ditto.
8275         (Output_section_definition::section_type)P; New method.
8276         (Output_section_definiton::script_section_type_name): Ditto.
8277         (Output_section_definition::script_section_type_): New data member.
8278         (Output_section_definition::Output_section_definition): Initialize
8279         data member Output_section_definition::script_section_type_.
8280         (Output_section_definition::create_sections): Pass script section type
8281         to Layout::make_output_section_for_script.
8282         (Output_section_definition::output_section_name): Return script
8283         section type to caller.
8284         (Output_section_definition::set_section_address): Do not advance
8285         dot value and load address if section type is NOLOAD.  Set address
8286         of NOLOAD sections regardless of section flags.
8287         (Output_section_definition::print): Print section type if it is
8288         not SCRIPT_SECTION_TYPE_NONE.
8289         (Output_section_definition::section_type): New method.
8290         (Output_section_definition::script_section_type_name): Ditto.
8291         (Script_sections::output_section_name): Add new parameter
8292         PSECTION_TYPE for returning script section type.  Pass it to
8293         section elements.  Handle discard sections.
8294         (Sort_output_sections::operator()): Handle NOLOAD sections.
8295         * script-sections.h (Script_sections::Section_type): New enum type.
8296         (Script_sections::output_section_name): Add a new parameter for
8297         returning script section type.
8298         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
8299         INFO and NOLOAD.
8300         * yyscript.y (union): Add new field SECTION_TYPE.
8301         (COPY, DSECT, INFO, NOLOAD): New tokens.
8302         (opt_address_and_section_type): Change type to output_section_header.
8303         (section_type): New non-terminal
8304         (section_header): Handle section type.
8305         (opt_address_and_section_type): Return section type value.
8306
8307 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
8308
8309         * testsuite/plugin_common_test_1.c (foo): Add prototype.
8310         * testsuite/plugin_common_test_2.c (foo): Likewise.
8311
8312 2010-04-08  Doug Kwan  <dougkwan@google.com>
8313
8314         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
8315         Output_merge_data.
8316         * output.cc (Output_section::add_merge_input_section): Simplify
8317         code and return status of Output_merge_base::add_input_section.
8318         Update merge section map only if Output_merge_base::add_input_section
8319         returns true.
8320
8321 2010-04-07  Doug Kwan  <dougkwan@google.com>
8322
8323         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
8324         if section is marked as containing instructions but has no mapping
8325         symbols.
8326         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
8327         correct section index.
8328         (Arm_relobj::find_linked_text_section): Ditto.
8329
8330 2010-04-07  Cary Coutant  <ccoutant@google.com>
8331
8332         * archive.cc (include_member): Destroy Read_symbols_data object before
8333         releasing file.
8334         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
8335         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
8336         (Read_symbols_data::~Read_symbols_data) New destructor.
8337         (Section_relocs::Section_relocs) New constructor.
8338         (Section_relocs::~Section_relocs) New destructor.
8339         (Read_relocs_data::Read_relocs_data) New constructor.
8340         (Read_relocs_data::~Read_relocs_data) New destructor.
8341         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
8342         pointers to NULL after deleting.
8343
8344 2010-04-07  Doug Kwan  <dougkwan@google.com>
8345
8346         * arm.cc: Replace "endianity" with "endianness" in comments.
8347         (Arm_exidx_cantunwind): Ditto.
8348         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
8349         (Arm_relobj::merge_flags_and_attributes): New method.
8350         (Arm_relobj::merge_flags_and_attributes_): New data member.
8351         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
8352         (Arm_relobj::scan_sections_for_stubs): Ditto.
8353         (Arm_relobj::do_read_symbols): Check to see if we really want to
8354         merge processor-specific flags and attributes.  Exit early if
8355         an object is empty except for section names and the undefined symbol.
8356         (Target_arm::do_finalize_sections): Move check for ELF format to
8357         Arm_relobj::do_read_symbols.  Merge processor specific flags and
8358         attributes from a regular object only when we have determined that
8359         it is aapropriate.  Do not create an .ARM.attributes section in
8360         output if there is no regular input object.
8361         (Target_arm::merge_processor_specific_flags): Check
8362         --warn-mismatch before printing any error.
8363         (Target_arm::merge_object_attributes): Ditto.
8364         * gold.cc (queue_middle_tasks): Handle the case in which there is
8365         no regular object in input.
8366         * options.cc (General_options::parse_EB): New method.
8367         (General_options::parse_EL): Same.
8368         (General_options::General_options): Initialize endianness_.
8369         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
8370         New options.
8371         (General_options::Endianness): New enum.
8372         (General_options::endianness): New method.
8373         (General_options::endianness_): New data member.
8374         * parameters.cc (Parameters::set_options): Check target endianness.
8375         (Parameters::set_target_once): Ditto.
8376         (Parameters::check_target_endianness): New method.
8377         (parameters_force_valid_target): If either -EL or -EB is specified,
8378         use it to define endianness of default target.
8379         * parameters.h (Parameters::check_target_endianness): New method
8380         declaration.
8381         * target.h (class Target): Change "endianity" to "endianness"
8382         in comments.
8383
8384 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8385
8386         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
8387         * configure: Regenerate.
8388         * Makefile.in: Regenerate.
8389         * testsuite/Makefile.in: Regenerate.
8390
8391 2010-04-06  Cary Coutant  <ccoutant@google.com>
8392
8393         gcc PR lto/42757
8394         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
8395         prevailing definitions of common symbols.
8396         * testsuite/plugin_test_6.sh: New test case.
8397         * testsuite/plugin_common_test_1.c: New test case.
8398         * testsuite/plugin_common_test_2.c: New test case.
8399         * testsuite/Makefile.am (plugin_test_6): New test case.
8400         * testsuite/Makefile.in: Regenerate.
8401
8402 2010-04-06  Nick Clifton  <nickc@redhat.com>
8403
8404         * po/vi.po: New Vietnamese translation.
8405
8406 2010-03-30  Doug Kwan  <dougkwan@google.com>
8407
8408         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
8409
8410 2010-03-25  Doug Kwan  <dougkwan@google.com>
8411
8412         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
8413         to avoid a conversion warning on a 32-bit host.
8414
8415 2010-03-24  Ian Lance Taylor  <iant@google.com>
8416
8417         * testsuite/script_test_3.t: Add a TLS segment.
8418         * testsuite/Makefile.am (check_PROGRAMS): Add
8419         tls_phdrs_script_test.
8420         (tls_phdrs_script_test_SOURCES): Define.
8421         (tls_phdrs_script_test_DEPENDENCIES): Define.
8422         (tls_phdrs_script_test_LDFLAGS): Define.
8423         (tls_phdrs_script_test_LDADD): Define.
8424         * testsuite/Makefile.in: Rebuild.
8425
8426 2010-03-23  Cary Coutant  <ccoutant@google.com>
8427
8428         * fileread.cc (find_or_make_view): Fix comment.
8429
8430 2010-03-23  Ian Lance Taylor  <iant@google.com>
8431
8432         * script-sections.cc (class Orphan_section_placement): Define
8433         PLACE_TLS and PLACE_TLS_BSS.
8434         (Orphan_section_placement::Orphan_section_placement): Initialize
8435         new places.
8436         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
8437         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
8438         (tls_script_test_SOURCES): Define.
8439         (tls_script_test_DEPENDENCIES): Define.
8440         (tls_script_test_LDFLAGS): Define.
8441         (tls_script_test_LDADD): Define.
8442         * testsuite/Makefile.in: Rebuild.
8443
8444 2010-03-22  Doug Kwan  <dougkwan@google.com>
8445
8446         * arm.cc (Arm_relocate_functions::abs8,
8447         Arm_relocate_functions::abs16): Use correct check for overflow
8448         specified in the ARM ELF specs.
8449         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
8450         target of a BLX instruction specially.
8451         (Reloc_stub::stub_type_for_reloc): Ditto.
8452         (Relocate::relocate): Use symbolic names instead of numeric relocation
8453         codes to report error.
8454         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
8455         workaround.
8456         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
8457         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
8458         thumb2_blx_out_of_range.stdout
8459         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
8460         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
8461         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
8462         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
8463         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
8464         thumb2_blx_in_range, thumb2_blx_in_range.o,
8465         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
8466         thumb2_blx_out_of_range.o): New rules.
8467         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
8468         thumb2_blx_in_range and thumb2_blx_out_of_range.
8469         * testsuite/Makefile.in: Regenerate.
8470         * arm_branch_in_range.sh: Add tests for THUMB BLX.
8471         * testsuite/thumb_blx_in_range.s: New file.
8472         * testsuite/thumb_blx_out_of_range.s: New file.
8473
8474 2010-03-22  Rafael Espindola  <espindola@google.com>
8475
8476         * archive.cc (Should_include): Move to archive.h.
8477         (should_include_member): Make it a member of Archive.
8478         (Lib_group): New.
8479         (Add_lib_group_symbols): New.
8480         * archive.h: Include options.h.
8481         (Archive_member): Moved from Archive.
8482         (Should_include): Moved from archive.cc.
8483         (Lib_group): New.
8484         (Add_lib_group_symbols): New.
8485         * dynobj.cc (do_should_include_member): New.
8486         * dynobj.h (do_should_include_member): New.
8487         * gold.cc (queue_initial_tasks): Update call to queue.
8488         * main.cc (main): Print lib group stats.
8489         * object.cc (do_should_include_member): New.
8490         * object.h: Include archive.h.
8491         (Object::should_include_member): New.
8492         (Object::do_should_include_member): New.
8493         (Sized_relobj::do_should_include_member): New.
8494         * options.cc (General_options::parse_start_lib): New.
8495         (General_options::parse_end_lib): New.
8496         (Input_arguments::add_file): Handle lib groups.
8497         (Input_arguments::start_group): Check we are not in a lib.
8498         (Input_arguments::start_lib): New.
8499         (Input_arguments::end_lib): New.
8500         * options.h (General_options): Add start_lib and end_lib.
8501         (Input_argument::lib_): New.
8502         (Input_argument::lib): New.
8503         (Input_argument::is_lib): New.
8504         (Input_file_lib): New.
8505         (Input_arguments::in_lib_): New.
8506         (Input_arguments::in_lib): New.
8507         (Input_arguments::start_lib): New.
8508         (Input_arguments::end_lib_): New.
8509         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
8510         in unused members as preempted.
8511         (Sized_pluginobj::do_should_include_member): New.
8512         * plugin.h (Sized_pluginobj::do_should_include_member): New.
8513         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
8514         return the blocker.
8515         (Read_symbols::do_whole_lib_group): New.
8516         (Read_symbols::do_lib_group): New.
8517         (Read_symbols::do_read_symbols): Handle lib groups.
8518         (Read_symbols::get_name): Handle lib groups.
8519         * readsyms.h (Read_symbols): Add an archive member pointer.
8520         (Read_symbols::do_whole_lib_group): New.
8521         (Read_symbols::do_lib_group): New.
8522         (Read_symbols::member_): New.
8523         * script.cc (read_input_script): Update call to queue_soon.
8524
8525 2010-03-19  Doug Kwan  <dougkwan@google.com>
8526
8527         * arm.cc (Stub_table::Stub_table): Initialize new data members
8528         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
8529         (Stub_table::add_reloc_stub): Assign stub offset and update
8530         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
8531         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
8532         New data members.
8533         (Stub_table::update_data_size_and_addralign): Use
8534         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
8535         instead of going over all reloc stubs.
8536         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
8537         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
8538         Stringpool_template::offset_ to size of Stringpool_char.
8539         (Stringpool_template::new_key_offset): Remove code to initialize
8540         Stringpool_template::offset_.
8541         * stringpool.h (Stringpool_template::set_no_zero_null): Set
8542         Stringpool_template::offset_ to zero.
8543
8544 2010-03-15  Doug Kwan  <dougkwan@google.com>
8545
8546         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
8547         offset_.
8548         (Stringpool_template::new_key_offset): New method.
8549         (Stringpool_template::add_string): Assign offsets when adding new
8550         strings.
8551         (Stringpool_template::set_string_offsets): Do not set string offsets
8552         when not optimizing.
8553         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
8554         member size_.
8555         (Chunked_vector::clear): Clear size_.
8556         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
8557         (Chunked_vector::size): Return size_.
8558         (Chunked_vector::push_back): Use size_ to find insert position.
8559         (Chunked_vector::size_): New data member.
8560         (Stringpool_template::set_no_zero_null): Assert string set is empty.
8561         (Stringpool_template::new_key_offset): New method declaration.
8562         (Stringpool_template::offset_): New data member.
8563
8564 2010-03-15   Rafael Espindola  <espindola@google.com>
8565
8566         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
8567         Add_symbols' constructor.
8568         * readsyms.h (Add_symbols): Remove the input_group member.
8569
8570 2010-03-10  Ian Lance Taylor  <iant@google.com>
8571
8572         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
8573         target to ask whether a reference to a symbol requires a stack
8574         split.
8575         * target.h (Target::is_call_to_non_split): New function.
8576         (Target::do_is_call_to_non_split): Declare virtual function.
8577         * target.cc: Include "symtab.h".
8578         (Target::do_is_call_to_non_split): New function.
8579         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
8580
8581 2010-03-10  Cary Coutant  <ccoutant@google.com>
8582
8583         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
8584         (File_read::open[1]): Remove initial mapping of whole_file_view_.
8585         (File_read::open[2]): Add whole_file_view_ to list of views.
8586         (File_read::make_view): Remove test of whole_file_view_.
8587         (File_read::find_or_make_view): Create whole_file_view_ if
8588         necessary.
8589         (File_read::clear_views): Replace bool parameter with enum;
8590         adjust all callers.  Don't delete views with permanent data;
8591         do delete cached views and views from archives if
8592         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
8593         if clearing the corresponding view.
8594         * fileread.h (File_read::Clear_views_mode): New enum.
8595         (File_read::View::is_permanent_view): New method.
8596         (File_read::clear_views): Replace bool parameter
8597         with enum; adjust all callers.
8598         * options.h (General_options): Change keep_files_mapped option;
8599         add map_whole_files.
8600         * readsyms.cc (Add_symbols::run): Delete sd_ object before
8601         releasing the file.
8602         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
8603         the file.
8604
8605 2010-03-10  David S. Miller  <davem@davemloft.net>
8606
8607         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
8608
8609 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
8610
8611         * icf.cc (get_section_contents): Add '@' marker after processing the
8612         merge reloc.
8613
8614 2010-03-08  Doug Kwan  <dougkwan@google.com>
8615
8616         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
8617         due to a conversion warning.
8618         (Arm_relobj::update_output_local_symbol_count): Check for local
8619         symbol with unset output index.
8620
8621 2010-03-05  Ian Lance Taylor  <iant@google.com>
8622
8623         * options.h (class General_options): Add --spare-dynamic-tags.
8624         * output.cc (Output_data_dynamic::set_final_data_size): Implement
8625         --spare-dynamic-tags.
8626
8627 2010-03-05  Ian Lance Taylor  <iant@google.com>
8628
8629         * incremental.cc: Include "libiberty.h".
8630
8631 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
8632
8633         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
8634         function, is_info_ member.
8635         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
8636         (Versions::Versions): Update caller.
8637         (Versions::define_base_version): Likewise.
8638         (Versions::add_def): Likewise.
8639
8640 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
8641
8642         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
8643         (Scan::possible_function_pointer_reloc): New function.
8644         (Scan::local_reloc_may_be_function_pointer): Change to call
8645         possible_function_pointer_reloc.
8646         (Scan::global_reloc_may_be_function_pointer): Ditto.
8647         * icf.h (Icf::check_section_for_function_pointers): Change to reject
8648         relocations in ".data.rel.ro._ZTV" section.
8649         * testsuite/icf_safe_so_test.sh: Change to pass i386.
8650         * testsuite/icf_safe_so_test.cc: Ditto.
8651         * testsuite/icf_safe_test.cc: Ditto.
8652         * testsuite/icf_safe_test.sh: Ditto.
8653
8654 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8655             Ian Lance Taylor  <iant@google.com>
8656
8657         * target-reloc.h (relocate_section): Check the symbol table index
8658         for -1U before setting the local symbol index.
8659         (scan_relocatable_relocs): If copying the relocation, record that
8660         the local symbol is required.
8661         * object.h (Symbol_value::is_output_symtab_index_set): New
8662         function.
8663         (Symbol_value::may_be_discarded_from_output_symtab): New
8664         function.
8665         (Symbol_value::has_output_symtab_entry): New function.
8666         (Symbol_value::needs_output_symtab_entry): Remove.
8667         (Symbol_value::output_symtab_index): Make sure the symbol index is
8668         set.
8669         (Symbol_value::set_output_symtab_index): Make sure the symbol
8670         index is not set.  Make sure the new index is valid.
8671         (Symbol_value::set_must_have_output_symtab_entry): New function.
8672         (Symbol_value::has_output_dynsym_entry): New function.
8673         (Symbol_value::set_output_dynsym_index): Make sure the new index
8674         is valid.
8675         (Sized_relobj::set_must_have_output_symtab_entry): New function.
8676         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
8677         local symbol if permitted.
8678         (Sized_relobj::do_finalize_local_symbols): Call
8679         is_output_symtab_index_set rather than needs_output_symtab_entry.
8680         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
8681         rather than needs_output_symtab_entry.  Call
8682         has_output_dynsym_entry rather than needs_output_dynsym_entry.
8683         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
8684         is_output_symtab_index_set rather than needs_output_symtab_entry.
8685         * testsuite/discard_locals_relocatable_test.c: New file.
8686         * testsuite/discard_locals_test.sh: Test -r.
8687         * testsuite/Makefile.am (check_DATA): Add
8688         discard_locals_relocatable_test1.syms,
8689         discard_local_relocatable_test2.syms.
8690         (MOSTLYCLEANFILES): Likewise.  Also add
8691         discard_locals_relocatable_test1.lout and
8692         discard_locals_relocatable_test2.out.
8693         (discard_locals_relocatable_test1.syms): New target.
8694         (discard_locals_relocatable_test.o): New target.
8695         (discard_locals_relocatable_test1.out): New target.
8696         (discard_locals_relocatable_test2.syms): New target.
8697         (discard_locals_relocatable_test2.out): New target.
8698         (various): Add missing ../ld-new dependencies.
8699         * testsuite/Makefile.in: Rebuild.
8700
8701 2010-03-03  Nick Clifton  <nickc@redhat.com>
8702
8703         * po/fi.po: New Finnish translation.
8704
8705 2010-03-01  Doug Kwan  <dougkwan@google.com>
8706
8707         * layout.cc (Layout::Layout): Force section types of .init_array*,
8708         .preinit_array* and .fini_array* sections.
8709         * output.cc (Output_section::Input_section_sort_entry::has_priority):
8710         Fix check of return value of std::string::find.().
8711         (Output_section::Input_section_sort_compare::operator()): Remove
8712         comment about .init_array.
8713         (Output_section::Input_section_sort_init_fini_compare::operator()):
8714         New method.
8715         (Output_section::sort_attached_input_sections): Handle .init_array
8716         and .fini_array specially.
8717         * output.h (Output_section::Inut_section_sort_compare): Update
8718         comment.
8719         (Output_section::Input_section_sort_init_fini_compare): New struct.
8720
8721 2010-02-26  Doug Kwan  <dougkwan@google.com>
8722
8723         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
8724         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
8725         * testsuite/debug_msg.sh: Avoid matching source line number for
8726         use of global variable undef_int.
8727
8728 2010-02-26  Doug Kwan  <dougkwan@google.com>
8729
8730         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
8731         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
8732         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
8733         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
8734         * options.cc (General_options::General_options): Initialize member
8735         fix_v4bx_.
8736         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
8737         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
8738         and rm_no_fix_v4bx.stdout
8739         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
8740         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
8741         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
8742         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
8743         and arm_no_fix_v4bx.
8744         * Makefile.in: Regenerate.
8745         * testsuite/arm_fix_v4bx.s: New file.
8746         * testsuite/arm_fix_v4bx.sh: Ditto.
8747
8748 2010-02-24  Doug Kwan  <dougkwan@google.com>
8749
8750         * arm.cc (Target_arm::got_section): Make the .got section the first
8751         non RELRO section in the data segment.
8752         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
8753         suffixes of section names.
8754
8755 2010-02-24  Doug Kwan  <dougkwan@google.com>
8756
8757         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
8758         flags and attributes merging if an input file is a binary file.
8759         * fileread.cc (Input_file::open): Record format of original file.
8760         * fileread.h (Input_file::Format): New enum type.
8761         (Input_file::Input_file): Initialize data member format_.
8762         (Input_file::format): New method definition.
8763         (Input_file::format_):: New data member.
8764
8765 2010-02-24  Doug Kwan  <dougkwan@google.com>
8766
8767         * arm.cc (Arm_output_data_got): New class.
8768         (ARM_TCB_SIZE): New constant
8769         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
8770         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
8771         If user uses a script with a SECTIONS clause, issue only a warning
8772         for a misplaced EXIDX input section.  Otherwise, issue an error.
8773         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
8774         garbage collection.
8775         (Target_arm::got_mode_index_entry): Handle static linking.
8776         (Target_arm::Scan::local): Ditto.
8777         (Target_arm::Scan::global): Ditto.
8778         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
8779         all incorrectly implemented relocations.
8780         (Target_arm::fix_exidx_coverage): Pass layout to
8781         Arm_output_section::fix_exidx_coverage.
8782         * layout.cc (Layout::section_name_mapping): Remove trailing dots
8783         from ".ARM.exidx." and ".ARM.extab.".
8784
8785 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8786
8787         * arm.cc (Target_arm::do_finalize_sections): Create attribute
8788         section if it does not already exist.
8789         * attributes.cc (Attributes_section_data::Attributes_section_data):
8790         Don't crash if size is zero.
8791
8792 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8793             Ian Lance Taylor  <iant@google.com>
8794
8795         * gold.cc (queue_middle_tasks): If no input files were opened,
8796         exit.
8797         * workqueue.h (Task_function::Task_function): Assert that there is
8798         a blocker.
8799
8800 2010-02-22  Doug Kwan  <dougkwan@google.com>
8801
8802         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
8803         * icf.cc (get_section_contents): Cast snprintf arguments to long long
8804         types to avoid warnings due to different uint64_t implementations
8805         on different hosts.
8806
8807 2010-02-21  Doug Kwan  <dougkwan@google.com>
8808
8809         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
8810         handling of the maximum backward branch offset.
8811         (Arm_relocate_functions::thumb_branch_common): Ditto.
8812         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
8813         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
8814         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
8815         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
8816         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
8817         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
8818         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
8819         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
8820         thumb_bl_out_of_range thumb_bl_out_of_range.o,
8821         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
8822         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
8823         thumb2_bl_out_of_range.o): New rules.
8824         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
8825         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
8826         thumb2_bl_out_of_range
8827         * testsuite/Makefile.in: Regenerate.
8828         * testsuite/arm_bl_in_range.s: New file.
8829         * testsuite/arm_bl_out_of_range.s: Ditto.
8830         * testsuite/arm_branch_in_range.sh: Ditto.
8831         * testsuite/arm_branch_range.t: Ditto.
8832         * testsuite/thumb2_branch_range.t: Ditto.
8833         * testsuite/thumb_bl_in_range.s: Ditto.
8834         * testsuite/thumb_bl_out_of_range.s: Ditto.
8835         * testsuite/thumb_branch_range.t: Ditto.
8836
8837 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
8838
8839         * gc.h (gc_process_relocs): Change vectors to point to the new list.
8840         Add reloc offset information.
8841         * icf.cc (get_section_contents): Change iterators to point to the new
8842         vectors. Add reloc offset information to the contents.
8843         * icf.h (Icf::Sections_reachable_info): New typedef.
8844         (Icf::Sections_reachable_list): New typedef.
8845         (Icf::Offset_info): New typedef.
8846         (Icf::Reloc_info): New struct typedef.
8847         (Icf::Reloc_info_list): New typedef.
8848         (Icf::symbol_reloc_list): Delete method.
8849         (Icf::addend_reloc_list): Delete method.
8850         (Icf::section_reloc_list): Delete method.
8851         (Icf::reloc_info_list): New method.
8852         (Icf::reloc_info_list_): New member.
8853
8854 2010-02-19  Doug Kwan  <dougkwan@google.com>
8855
8856         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
8857         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
8858         * arm.cc (Arm_relocation_functions): New forward declaration.
8859         (Target_arm::Target_arm): Initialize new data members
8860         got_mod_index_offset_ and tls_base_symbol_defined_.
8861         (Target_arm::Relocate::relocate_tls): New method.
8862         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
8863          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
8864         New methods.
8865         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
8866         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
8867         (Target_arm::got_mod_index_offset_,
8868         Target_arm::tls_base_symbol_defined_): New data members.
8869         (Target_arm::Scan::local, Target::Scan::global,
8870         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
8871         relocations.
8872
8873 2010-02-18  Doug Kwan  <dougkwan@google.com>
8874
8875         * arm.cc (Arm_relobj::find_linked_text_section): New method.
8876         (Arm_relobj::make_exidx_input_section): Pass section index of linked
8877         text section as a parameter becuase some broken tools may not set
8878         the link in section header.
8879         (Target_arm::has_got_section): New method.
8880         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
8881         without any mapping symbol as data only.  Remove warning.
8882         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
8883         link in its section header, try to discover the link by inspecting the
8884         REL31 relocation at the beginning of the section.
8885         (Target_arm::Scan::check_non_pic): Report name of offending relocation
8886         in error message.
8887         (Target_arm::Scan::global): Treat any reference to the symbol
8888         _GLOBAL_OFFSET_TABLE_ as a GOT access.
8889
8890 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
8891
8892         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
8893         (Scan::global_reloc_may_be_function_pointer): New function.
8894         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
8895         (Scan::global_reloc_may_be_function_pointer): New function.
8896         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
8897         (Scan::global_reloc_may_be_function_pointer): New function.
8898         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
8899         (Scan::global_reloc_may_be_function_pointer): New function.
8900         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
8901         (Scan::global_reloc_may_be_function_pointer): New function.
8902         (Scan::possible_function_pointer_reloc): New function.
8903         (Target_x86_64::can_check_for_function_pointers): New function.
8904         * gc.h (gc_process_relocs): Scan relocation types to determine if
8905         function pointers were taken for targets that support it.
8906         * icf.cc (Icf::find_identical_sections): Include functions for
8907         folding in safe ICF whose pointer is not taken.
8908         * icf.h (Secn_fptr_taken_set): New typedef.
8909         (fptr_section_id_): New member.
8910         (section_has_function_pointers): New function.
8911         (set_section_has_function_pointers): New function.
8912         (check_section_for_function_pointers): New function.
8913         * options.h: Fix comment for safe ICF option.
8914         * target.h (can_check_for_function_pointers): New function.
8915         * testsuite/Makefile.am: Add icf_safe_so_test test case.
8916         Modify icf_safe_test for X86-64.
8917         * testsuite/Makefile.in: Regenerate.
8918         * testsuite/icf_safe_so_test.cc: New file.
8919         * testsuite/icf_safe_so_test.sh: New file.
8920         * testsuite/icf_safe_test.cc (kept_func_3): New function.
8921         (main): Change to take pointer to function kept_func_3.
8922         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
8923         folding is done correctly for X86-64.
8924
8925 2010-02-12  David S. Miller  <davem@davemloft.net>
8926
8927         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
8928         is_symbolless parameter.
8929         (Output_reloc<SHT_REL>::is_symbolless): New.
8930         (Output_reloc<SHT_REL>::is_symbolless_): New.
8931         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
8932         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
8933         (Output_reloc<SHT_RELA>::is_symbolless): New.
8934         (Output_data_reloc::add_global): Handle is_symbolless.
8935         (Output_data_reloc::add_global_relative): Likewise.
8936         (Output_data_reloc::add_local): Likewise.
8937         (Output_data_reloc::add_local_relative): Likewise.
8938         (Output_data_reloc::add_symbolless_global_addend): New.
8939         (Output_data_reloc::add_symbolless_local_addend): New.
8940         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
8941         is_symbolless.
8942         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
8943         instead of ->is_relative_
8944         (Output_reloc::write): Likewise.
8945         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
8946         (Output_reloc::write_rel): Simplify.
8947
8948         * sparc.cc (Target_sparc::Scan::local): Use
8949         ->add_symbolless_local_addend as needed.
8950         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
8951         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
8952         based upon relocation offset.
8953
8954 2010-02-11  Doug Kwan  <dougkwan@google.com>
8955
8956         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
8957         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
8958         beginning of function.
8959         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
8960         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
8961         parameter is_32bit in calls to should_apply_static_reloc.
8962         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
8963         (check_DATA): Add arm_abs_global.stdout.
8964         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
8965         arm_abs_global.stdout): New rules.
8966         (MOSTLLYCLEANFILES): Add arm_abs_global
8967         * Makefile.in: Regenerate.
8968         * testsuite/arm_abs_global.s: New file.
8969         * testsuite/arm_abs_global.sh: Ditto.
8970         * testsuite/arm_abs_lib.s: Ditto.
8971
8972 2010-02-11  Ian Lance Taylor  <iant@google.com>
8973
8974         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
8975         Read_relocs task.
8976         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
8977         Allocate_commons_task first.
8978         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
8979         task, rather than symtab_lock_.
8980         (Gc_process_relocs::~Gc_process_relocs): New function.
8981         (Gc_process_relocs::is_runnable): Check this_blocker_.
8982         (Gc_process_relocs::locks): Use next_blocker_ rather than
8983         blocker_.
8984         (Scan_relocs::~Scan_relocs): New function.
8985         (Scan_relocs::is_runnable): Check this_blocker_ rather than
8986         symtab_lock_.
8987         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
8988         next_blocker_.
8989         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
8990         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
8991         constructor accordingly.
8992         (class Gc_process_relocs): Likewise.
8993         (class Scan_relocs): Likewise.
8994         * common.h (class Allocate_commons_task): Remove symtab_lock_
8995         field, and corresponding constructor parameter.
8996         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
8997         symtab_lock_.
8998         (Allocate_commons_task::locks): Likewise.
8999
9000 2010-02-11  Ian Lance Taylor  <iant@google.com>
9001
9002         * gold-threads.h (class Once): Define.
9003         (class Initialize_lock): Rewrite as child of Once.
9004         * gold-threads.cc (class Once_initialize): Define.
9005         (once_pointer_control): New static variable.
9006         (once_pointer, once_arg): New static variables.
9007         (c_run_once): New static function.
9008         (Once::Once, Once::run_once, Once::internal_run): New functions.
9009         (class Initialize_lock_once): Remove.
9010         (initialize_lock_control): Remove.
9011         (initialize_lock_pointer): Remove.
9012         (initialize_lock_once): Remove.
9013         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
9014         (Initialize_lock::initialize): Rewrite.
9015         (Initialize_lock::do_run_once): New function.
9016         * archive.cc (Archive::interpret_header): Only clear name if it is
9017         not already empty.
9018         * fileread.cc: Include "gold-threads.h"
9019         (file_counts_lock): New static variable.
9020         (file_counts_initialize_lock): Likewise.
9021         (File_read::release): Only increment counts when using --stats.
9022         Use a lock around the increment.
9023         * parameters.cc (class Set_parameters_target_once): Define.
9024         (set_parameters_target_once): New static variable.
9025         (Parameters::Parameters): Move here from parameters.h.
9026         (Parameters::set_target): Rewrite.
9027         (Parameters::set_target_once): New function.
9028         (Parameters::clear_target): Move here and rewrite.
9029         * parameters.h (class Parameters): Update declarations.  Add
9030         set_parameters_target_once_ field.
9031         (Parameters::Parameters): Move to parameters.cc.
9032         (Parameters::clear_target): Likewise.
9033         * readsyms.cc (Read_symbols::do_group): Create a Start_group
9034         task.
9035         (Start_group::~Start_group): New function.
9036         (Start_group::is_runnable): New function.
9037         (Start_group::locks, Start_group::run): New functions.
9038         (Finish_group::run): Change saw_undefined to size_t.
9039         * readsyms.h (class Start_group): Define.
9040         (class Finish_group): Change saw_undefined_ field to size_t.
9041         (Finish_group::Finish_group): Remove saw_undefined and
9042         this_blocker parameters.  Change all callers.
9043         (Finish_group::set_saw_undefined): New function.
9044         (Finish_group::set_blocker): New function.
9045         * symtab.h (class Symbol_table): Change saw_undefined to return
9046         size_t.  Change saw_undefined_ field to size_t.
9047         * target-select.cc (Set_target_once::do_run_once): New function.
9048         (Target_selector::Target_selector): Initialize set_target_once_
9049         field.  Don't initialize lock_ and initialize_lock_ fields.
9050         (Target_selector::instantiate_target): Rewrite.
9051         (Target_selector::set_target): New function.
9052         * target-select.h (class Set_target_once): Define.
9053         (class Target_selector): Update declarations.  Make
9054         Set_target_once a friend.  Remove lock_ and initialize_lock_
9055         fields.  Add set_target_once_ field.
9056
9057 2010-02-10  Ian Lance Taylor  <iant@google.com>
9058
9059         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
9060         queueing any tasks.
9061         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
9062         (queue_middle_tasks): Add all blockers before queueing any tasks.
9063         (queue_final_tasks): Likewise.
9064         * token.h (Task_token::add_blockers): New function.
9065         * object.h (Input_objects::number_of_relobjs): New function.
9066
9067 2010-02-10  Ian Lance Taylor  <iant@google.com>
9068
9069         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
9070         shared, not if not position independent.
9071         * x86_64.cc (Relocate::relocate_tls): Likewise.
9072         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
9073         (tls_pie_pic_test): New target.
9074         * testsuite/Makefile.in: Rebuild.
9075
9076         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
9077         (tls_test_main_pie.o, tls_test_pie.o): New targets.
9078         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
9079         * testsuite/Makefile.in: Rebuild.
9080
9081 2010-02-09  David S. Miller  <davem@davemloft.net>
9082
9083         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
9084         R_SPARC_RELATIVE using ->add_local_relative().
9085         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
9086
9087         * output.h (Output_data_dynamic::add_section_size): New method
9088         that takes two Output_data objects.
9089         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
9090         entry param.  Handle it in initializers.
9091         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
9092         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
9093         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
9094         arg.
9095         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
9096         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
9097         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
9098         for dynrel_includes_plt.
9099         * i386.cc (Target_i386::do_finalize_sections): Likewise.
9100         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
9101         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
9102         before .rela.plt
9103         (Target_sparc::do_finalize_sections): Update to pass true for
9104         dynrel_includes_plt.
9105         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
9106         output before .rela.plt
9107         (Target_powerpc::do_finalize_sections): Update to pass true for
9108         dynrel_includes_plt when 32-bit.
9109
9110 2010-02-08  Doug Kwan  <dougkwan@google.com>
9111
9112         * arm.cc (Arm_relobj::simple_input_section_output_address): New
9113         method.
9114         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
9115         Arm_relobj::scan_section_for_cortex_a8_stubs,
9116         Arm_relobj::do_relocation_section): Instead of calling
9117         Output_section::output_address, use faster
9118         Arm_relobj::simple_input_section_output_address.
9119
9120 2010-02-08  David S. Miller  <davem@davemloft.net>
9121
9122         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
9123         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
9124         relocation helper function.
9125
9126         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
9127         just like R_SPARC_GOT{10,13,22}.
9128         (Target_sparc::Scan::local): Likewise.
9129         (Target_sparc::Relocate:relocate): Likewise.
9130
9131 2010-02-06  Ian Lance Taylor  <iant@google.com>
9132
9133         * configure.ac: Rewrite targetobjs duplicate removal code to use
9134         only shell constructs.
9135         * configure: Rebuild.
9136
9137 2010-02-05  Doug Kwan  <dougkwan@google.com>
9138
9139         PR 11247
9140         * arm.cc (Arm_relobj::section_is_scannable): New method.
9141         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
9142         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
9143
9144 2010-02-04  Doug Kwan  <dougkwan@google.com>
9145
9146         PR 11247
9147         * arm-reloc-property.cc (cstdio): Include.
9148         * configure.ac (targetobjs): Remove duplicates.
9149         * configure: Regenerate.
9150         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
9151         big and little endian version for a given address size.
9152
9153 2010-02-03  Doug Kwan  <dougkwan@google.com>
9154
9155         * arm-reloc-property.cc
9156         (Arm_reloc_property_table::reloc_name_in_error_message): New method
9157         definition.
9158         * arm-reloc-property.h
9159         (Arm_reloc_property_table::get_implemented_static_reloc_property):
9160         New method definition.
9161         (Arm_reloc_property_table::reloc_name_in_error_message): New method
9162         declaration.
9163         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
9164         overflow to N.
9165         (GOT_PREL): Change implemented to Y.
9166         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
9167         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
9168         (Arm_relocate_functions::movw_abs_nc): Remove method.
9169         (Arm_relocate_functions::movt_abs): Ditto.
9170         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
9171         (Arm_relocate_functions::thm_movt_abs): Ditto.
9172         (Arm_relocate_functions::movw_rel_nc): Ditto.
9173         (Arm_relocate_functions::movw_rel): Ditto.
9174         (Arm_relocate_functions::movt_rel): Ditto.
9175         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
9176         (Arm_relocate_functions:thm_movw_rel): Ditto.
9177         (Arm_relocate_functions:thm_movt_rel): Ditto.
9178         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
9179         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
9180         New method definitions.
9181         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
9182         (Arm_relocation_functions::arm_grp_ldr): Ditto.
9183         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
9184         (Arm_relocation_functions::arm_grp_ldc): Ditto.
9185         (Target_arm::Relocate::relocate): Check for non-static or
9186         unimplemented relocation code and exit early.  Change calls to
9187         Target_arm::reloc_uses_thumb_bit and
9188         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
9189         instead.  Refactor code to handle similar relocations to increase
9190         code sharing.  Remove check for unsupported relocation code in switch
9191         statement.
9192         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
9193         relocation property table to find out size.  Change error message to
9194         print out the name of a relocation code instead of the numeric value.
9195         (Target_arm::scan_reloc_for_stub): Use relocation property table
9196         instead of calling Target_arm::reloc_uses_thumb_bit().
9197
9198 2010-02-02  Doug Kwan  <dougkwan@google.com>
9199
9200         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
9201         types of relaxed input section.
9202
9203 2010-02-02  Doug Kwan  <dougkwan@google.com>
9204
9205         * Makefile.am (HFILES): Add arm-reloc-property.h.
9206         (DEFFILES): New.
9207         (TARGETSOURCES): Add arm-reloc-property.cc
9208         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
9209         (libgold_a_SOURCES): $(DEFFILES)
9210         * Makefile.in: Regenerate.
9211         * arm-reloc-property.cc: New file.
9212         * arm-reloc-property.h: New file.
9213         * arm-reloc.def: New file.
9214         * arm.cc: Update comments.
9215         (arm-reloc-property.h): New included header.
9216         (arm_reloc_property_table): New global variable.
9217         (Target_arm::do_select_as_default_target): New method definition.
9218         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
9219         arm-reloc-property to targ_extra_obj.
9220         * parameters.cc (set_parameters_target): Call
9221         Target::select_as_default_target().
9222         * target.h (Target::select_as_default_target): New method definition.
9223         (Target::do_select_as_default_target): Same.
9224
9225 2010-02-01  Doug Kwan  <dougkwan@google.com>
9226
9227         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
9228         first_output_text_section_.
9229         (Arm_exidx_fixup::first_output_text_section): New method definition.
9230         (Arm_exidx_fixup::first_output_text_section_): New data member.
9231         (Arm_exidx_fixup::process_exidx_section): Record the first text
9232         output section seen.
9233         (Arm_output_section::fix_exidx_coverage): Set correct linked section
9234         and entsize in output section header.
9235
9236 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9237
9238         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
9239         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
9240         (Arm_relocate_functions::thm_alu11): New Method.
9241         (Arm_relocate_functions::thm_pc8): New Method.
9242         (Arm_relocate_functions::thm_pc12): New Method.
9243         (Target_arm::Scan::local): Handle the relocations.
9244         (Target_arm::Scan::global): Likewise.
9245         (Target_arm::Relocate::relocate): Likewise.
9246         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9247
9248 2010-01-29  Doug Kwan  <dougkwan@google.com>
9249
9250         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
9251         of relocation types as ld.
9252
9253 2010-01-29  Doug Kwan  <dougkwan@google.com>
9254
9255         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
9256         to public.
9257         (Arm_relocate_functions::thumb_branch_common): Ditto.
9258         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
9259         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
9260         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
9261         Arm_relocate_functions::jump24): Remove.
9262         (Target_arm::Relocate::relocate): Adjust code to call
9263         Arm_relocation_functions::arm_branch_common and
9264         Arm_relocation_functions::thumb_branch_common instead of their removed
9265         wrappers.  Merge switch-cases together to reduce source code size.
9266
9267 2010-01-29  Doug Kwan  <dougkwan@google.com>
9268
9269         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
9270         output_local_symbol_count_needs_update_.
9271         (Arm_relobj::output_local_symbol_count_needs_update,
9272          Arm_relobj::set_output_local_symbol_count_needs_update,
9273          Arm_relobj::update_output_local_symbol_count): New methods.
9274         (Arm_relobj::output_local_symbol_count_needs_update_): New data
9275         member.
9276         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
9277         of pointed function as in a R_ARM_PREL31 relocation.
9278         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
9279         for output local symbol count updating.
9280         (Target_arm::do_relax): Update output local symbol counts in objects
9281         if necessary.
9282         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
9283
9284 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9285
9286         * arm.cc: Added support for the ARM relocations:
9287         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
9288         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
9289         (Arm_relocate_functions::movw_rel_nc): Renamed (was
9290         movw_prel_nc).
9291         (Arm_relocate_functions::movw_rel): New method.
9292         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
9293         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
9294         thm_movw_prel_nc).
9295         (Arm_relocate_functions::thm_movw_rel): New method.
9296         (Arm_relocate_functions::thm_movt_rel): Renamed (was
9297         thm_movt_prel).
9298         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
9299         relocations.
9300         (Target_arm::Scan::global): Likewise.
9301         (Target_arm::Relocate::relocate): Likewise.
9302         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9303         Likewise.
9304
9305 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9306
9307         * arm.cc: Added support for ARM group relocations.
9308         (Target_arm::reloc_needs_sym_origin): New method.
9309         (Arm_relocate_functions::calc_grp_kn): New method.
9310         (Arm_relocate_functions::calc_grp_residual): New method.
9311         (Arm_relocate_functions::calc_grp_gn): New method.
9312         (Arm_relocate_functions::arm_grp_alu): New Method.
9313         (Arm_relocate_functions::arm_grp_ldr): New Method.
9314         (Arm_relocate_functions::arm_grp_ldrs): New Method.
9315         (Arm_relocate_functions::arm_grp_ldc): New Method.
9316         (Target_arm::Scan::local): Handle the ARM group relocations.
9317         (Target_arm::Scan::global): Likewise.
9318         (Target_arm::Relocate::relocate): Likewise.
9319         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9320         Likewise.
9321
9322 2010-01-26  Doug Kwan  <dougkwan@google.com>
9323
9324         * arm.cc (set): Include.
9325         (class Arm_exidx_fixup): Change type of last_input_section_ to const
9326         pointer type.
9327         (Arm_output_section::Text_section_list): New type.
9328         (Arm_output_section::append_text_sections_to_list): New method.
9329         (Arm_output_section::fix_exidx_coverage): Ditto.
9330         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
9331         (Arm_relobj::convert_input_section_to_relaxed_section): Use
9332         Relobj::set_section_offset() instead of
9333         Sized_relobj::invalidate_section_offset().
9334         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
9335         parameter for section headers. Ignore relocation sections for
9336         unallocated sections and EXIDX sections.
9337         (Target_arm::fix_exidx_coverage): New method.
9338         (Target_arm::output_section_address_less_than): New type.
9339         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
9340         linked text section instead of the EXIDX section.
9341         (Arm_output_section::create_stub_group): Add an assertion to check
9342         that this is not an EXIDX output section.
9343         (Arm_output_section::append_text_sections_to_list): New method.
9344         (Arm_output_section::fix_exidx_coverage): Ditto.
9345         (Arm_relobj::scan_sections_for_stubs): Adjust call to
9346         Arm_relobj::section_needs_reloc_stub_scanning.
9347         (Target_arm::do_relax): Fix EXIDX output section coverage in the
9348         first pass.
9349         (Target_arm::fix_exidx_coverage): New method.
9350         * object.h (Relobj::set_output_section): New method.
9351         (Sized_relobj::invalidate_section_offset): Remove method.
9352         (Sized_relobj::do_invalidate_section_offset): Remove method.
9353         (Sized_relobj::do_set_section_offset): Handle offset value -1.
9354
9355 2010-01-25  Doug Kwan  <dougkwan@google.com>
9356
9357         * arm.cc (Arm_exidx_merged_section::do_output_offset):
9358         Fix warning due to signed and unsigned comparison on a 32-bit host.
9359
9360 2010-01-22  Doug Kwan  <dougkwan@google.com>
9361
9362         * arm.cc (Target_arm::do_relax): Record an output section for section
9363         offset adjustment it contains any stub table that has changed.
9364         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
9365         offsets in an output section if necessary.
9366         * output.cc (Output_section::Output_section): Initialize
9367         section_offsets_need_adjustments_.
9368         (Output_section::add_input_section_for_script): Renamed to
9369         Output_section::add_simple_input_section.
9370         (Output_section::save_states): Add a comment.
9371         (Output_section::discard_states): New method defintion.
9372         (Output_section::adjust_section_offsets): Same.
9373         * output.h (Output_section::add_input_section_for_script): Renamed to
9374         Output_section::add_simple_input_section.
9375         (Output_section::discard_states): New method declaration.
9376         (Output_section::adjust_section_offsets): Same.
9377         (Output_section::section_offsets_need_adjustment,
9378         Output_section::set_section_offsets_need_adjustment): New method
9379         definitions.
9380         (Output_section::section_offsets_need_adjustment_): New data member.
9381         * script-sections.cc
9382         (Output_section_element_input::set_section_address): Adjust code for
9383         renaming of Output_section::add_input_section_for_script.
9384         (Orphan_output_section::set_section_address): Same.
9385
9386 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9387
9388         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
9389         Fix_v4bx enum values .
9390         * gold/options.h (General_options): New option definitions.
9391         (General_options::fix_v4bx): New method.
9392         (General_options::Fix_v4bx): New enum.
9393         * gold/options.cc (General_options::parse_fix_v4bx): New method.
9394         (General_options::parse_fix_v4bx_interworking): New method.
9395
9396 2010-01-22  Doug Kwan  <dougkwan@google.com>
9397
9398         * arm.cc (Arm_exidx_fixup): New class.
9399
9400 2010-01-21  Doug Kwan  <dougkwan@google.com>
9401
9402         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
9403         classes.
9404         (Arm_exidx_section_offset_map): New type.
9405
9406 2010-01-21  Doug Kwan  <dougkwan@google.com>
9407
9408         * arm.cc (Arm_exidx_input_section): New class.
9409         (Arm_relobj::exidx_input_section_by_link,
9410         Arm_relobj::exidx_input_section_by_shndx,
9411         Arm_relobj::make_exidx_input_section): New methods.
9412         (read_arm_attributes_section): Remove.
9413         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
9414         information about them.
9415         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
9416         to here.
9417
9418 2010-01-20  Doug Kwan  <dougkwan@google.com>
9419
9420         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
9421         Input_section_specifier to Section_id.
9422         (Target_arm::new_arm_input_section: Adjust code for change of key
9423         type.
9424         (Target_arm::find_arm_input_section): Ditto.
9425         * gc.h (object.h): Include for Section_id nand Section_id_hash.
9426         (Section_id): Remove.
9427         (Garbage_collection::Section_id_hash): Remove.
9428         * icf.h (object.h): Include for Section_id nand Section_id_hash.
9429         (Section_id): Remove.
9430         (Icf::Section_id_hash): Remove.
9431         * object.h (Section_id, Const_section_id, Section_id_hash,
9432         Const_section_id_hash): New type definitions.
9433         * output.cc (Output_section::add_relaxed_input_section): Change to
9434         use Const_section_id instead of Input_section_specifier as key type.
9435         (Output_section::add_merge_input_section): Ditto.
9436         (Output_section::build_relaxation_map): Change to use Section_id
9437         instead of Input_section_specifier as key type.
9438         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
9439         Ditto.
9440         (Output_section::convert_input_sections_to_relaxed_sections): Change
9441         to use Const_section_id instead of Input_section_specifier as key type.
9442         (Output_section::find_merge_section): Ditto.
9443         (Output_section::find_relaxed_input_section): Ditto.
9444         * output.h (Input_section_specifier): Remove class.
9445         (Output_section::Output_section_data_by_input_section_map): Change
9446         key type to Const_section_id.
9447         (Output_section::Output_relaxed_input_section_by_input_section_map):
9448         Ditto.
9449         (Output_section::Relaxation_map): Change key type to Section_id.
9450
9451 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9452
9453         * gold/arm.cc: Added support for R_ARM_V4BX relocation
9454         (class Arm_v4bx_stub): New class.
9455         (DEF_STUBS): Updated definition to support v4_veneer_bx.
9456         (Stub_factory::make_arm_v4bx_stub): New method.
9457         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
9458         (Stub_table::empty): Handle v4bx stubs.
9459         (Stub_table::add_arm_v4bx_stub): New method.
9460         (Stub_table::find_arm_v4bx_stub): New method.
9461         (Arm_relocate_functions::v4bx): New method.
9462         (Target_arm::fix_v4bx): New method.
9463         (Target_arm::Target_arm): Handle R_ARM_V4BX.
9464         (Stub_table::relocate_stubs): Likewise.
9465         (Stub_table::do_write): Likewise.
9466         (Stub_table::update_data_size_and_addralign): Likewise.
9467         (Stub_table::finalize_stubs):  Likewise.
9468         (Target_arm::Scan::local): Likewise.
9469         (Target_arm::Scan::global): Likewise.
9470         (Target_arm::do_finalize_sections): Likewise.
9471         (Target_arm::Relocate::relocate): Likewise.
9472         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9473         Likewise.
9474         (Target_arm::scan_reloc_for_stub): Likewise.
9475         (Target_arm::scan_reloc_section_for_stubs): Likewise.
9476
9477 2010-01-19  Ian Lance Taylor  <iant@google.com>
9478
9479         * output.cc (Output_section_headers::do_sized_write): Write large
9480         segment count to sh_info field.
9481         (Output_file_header::do_sized_write): For large segment count,
9482         write PN_XNUM to e_phnum field.
9483
9484 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9485
9486         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
9487         (Arm_relocate_functions::thm_jump8): New function.
9488         (Arm_relocate_functions::thm_jump11): New function.
9489         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
9490         R_ARM_THM_JUMP11.
9491         (Target_arm::Scan::global): Likewise.
9492         (Target_arm::Relocate::relocate): Likewise.
9493         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9494         Likewise.
9495
9496 2010-01-14  Doug Kwan  <dougkwan@google.com>
9497
9498         * arm.cc (map, utility): Include headers.
9499         (Target_arm::apply_cortex_a8_workaround): New method.
9500         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
9501         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
9502         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
9503         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
9504         the --[no-]fix-cortex-a8 command line options.
9505         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
9506         (Target_arm::relocate_stub): Use addend in instruction template.
9507         * options.h (DEFINE_bool): Set the user-set flag.
9508         (General_options): Add --[no-]-fix-cortex options.
9509         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
9510         : Update fast look-up map after conversion.
9511
9512 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
9513
9514         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
9515         in the first pass of do_layout.
9516
9517 2010-01-13  Doug Kwan  <dougkwan@google.com>
9518
9519         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
9520         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
9521         apparent compiler problem of not folding static constant integral
9522         data members of elfcpp::Elf_sizes<32>.
9523
9524 2010-01-13  Doug Kwan  <dougkwan@google.com>
9525
9526         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
9527         Arm_relobj::section_needs_cortex_a8_stub_scanning,
9528         Arm_relobj::scan_section_for_cortex_a8_erratum,
9529         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
9530         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
9531         sections to scan for relocation stubs into a new method
9532         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
9533         relocation and Cortex-A8 stub scanning.
9534         (Target_arm::do_relax): Force stubs to be after stubbed sections
9535         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
9536         the beginning of a new relaxation pass.  Update a comment.
9537         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
9538
9539 2010-01-12  Ian Lance Taylor  <iant@google.com>
9540
9541         * target-reloc.h (visibility_error): New inline function.
9542         (relocate_section): Call visibility_error.
9543         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
9544         (MOSTLYCLEANFILES): Likewise.
9545         (protected_4_pic.o, protected_3.err): New targets.
9546         * testsuite/protected_4.cc: New file.
9547
9548 2010-01-12  Doug Kwan  <dougkwan@google.com>
9549
9550         * arm.cc (Cortex_a8_reloc): New class.
9551         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
9552         and cortex_a8_relocs_info_.
9553         (Target_arm::fix_cortex_a8): New method definition.
9554         (Target_arm::Cortex_a8_relocs_info): New type.
9555         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
9556         New data member declarations.
9557         (Target_arm::scan_reloc_for_stub): Record information about
9558         relocations for THUMB branches that might be exempted from the
9559         Cortex-A8 workaround.
9560         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
9561         at the beginning of a relaxation pass.
9562
9563 2010-01-12  Doug Kwan  <dougkwan@google.com>
9564
9565         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
9566         (Arm_relobj::Mapping_symbol_position,
9567          Arm_reloj::Mapping_symbol_position_less,
9568          Arm_relobj::Mapping_symbols_info): New types.
9569         (Target_arm::is_mapping_symbol_name): New method definition.
9570         (Arm_relobj::do_count_local_symbols): Save information about mapping
9571         symbols.
9572
9573 2010-01-11  Doug Kwan  <dougkwan@google.com>
9574
9575         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
9576         Arm_relocate_functions::thumb32_branch_upper,
9577         Arm_relocate_functions::thumb32_branch_lower,
9578         Arm_relocate_functions::thumb32_cond_branch_offset,
9579         Arm_relocate_functions::thumb32_cond_branch_upper,
9580         Arm_relocate_functions::thumb32_cond_branch_lower,
9581         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
9582         branch offset encoding.
9583         (Arm_relocate_functions::thumb_branch_common): Use new branch
9584         offset encoding methods to avoid code duplication.
9585         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
9586         (Stub_addend_reader::operator()): Use new branch encoding method
9587         to avoid code duplication.
9588
9589 2010-01-11  Doug Kwan  <dougkwan@google.com>
9590
9591         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
9592         (Target_arm::do_finalize_sections): Define special EXIDX section
9593         symbols only if referenced.
9594         * gc.h (Garbage_collection::add_reference): New method.
9595         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
9596         code duplication.
9597
9598 2010-01-11  Ian Lance Taylor  <iant@google.com>
9599
9600         * script.cc (Version_script_info::build_expression_list_lookup):
9601         Change complaing about duplicate wildcard match from error to
9602         warning.
9603
9604         * script.cc (class Lazy_demangler): Recreate--revert part of patch
9605         of 2009-12-30.
9606         (Version_script_info::Version_script_info): Initialize globs_,
9607         default_version_, default_is_global_, and exact_.  Don't
9608         initialize globals_ or locals_.
9609         (Version_script_info::build_lookup_tables): Build local symbols
9610         first.
9611         (Version_script_info::unquote): New function.
9612         (Version_script_info::add_exact_match): New function.
9613         (Version_script_info::build_expression_list_lookup): Remove lookup
9614         parameter.  Add is_global parameter.  Change all callers.  Handle
9615         wildcard pattern specially.  Unquote pattern.  Call
9616         add_exact_match.
9617         (Version_script_info::get_name_to_match): New function.
9618         (Version_script_info::get_symbol_version): New function.
9619         (Version_script_info::get_symbol_version_helper): Remove.
9620         (Version_script_info::check_unmatched_names): Call unquote.
9621         * script.h (class Version_script_info): Change get_symbol_version
9622         to be non-inline and add is_global parameter; change all callers.
9623         Rewrite symbol_is_local.  Update declarations.  Define struct
9624         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
9625         Remove globals_ and locals_ members.  Add exact_, globs_,
9626         default_version_, is_global_.
9627         (Version_script_info::Glob): Remove pattern, add expression and
9628         is_global.  Update constructor.  Change all callers.
9629         * dynobj.cc (Versions::finalize): Mark the version symbol as the
9630         default version.
9631         (Versions::symbol_section_contents): If a symbol is undefined, or
9632         defined in a dynamic object, set the version index to
9633         VER_NDX_LOCAL.
9634         * symtab.cc (Symbol_table::add_from_relobj): Don't call
9635         symbol_is_local.
9636         (Symbol_table::add_from_pluginobj): Likewise.
9637         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
9638
9639 2010-01-11  Doug Kwan  <dougkwan@google.com>
9640
9641         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
9642         (incremental_dump_LDADD): Add linking option for libintl.
9643         * Makefile.in: Regenerate.
9644
9645 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
9646
9647         PR gold/11144
9648         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
9649         instead of -Ds.
9650         * testsuite/Makefile.in: Regenerated.
9651
9652 2010-01-10  Doug Kwan  <dougkwan@google.com>
9653
9654         * options.h (DEFINE_var): Use parentheses around argument varname__
9655         in macro body to avoid any unintended subsequent substitutions.
9656
9657 2010-01-10  Ian Lance Taylor  <iant@google.com>
9658
9659         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
9660         candidates before doing symbol resolution.
9661
9662         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
9663         ODR candidates if only one is weak.
9664
9665 2010-01-08  Ian Lance Taylor  <iant@google.com>
9666
9667         * script.cc (Version_script_info::build_expression_list_lookup):
9668         Don't warn about ambiguous version, just record the ambiguity.
9669         (Version_script_info::get_symbol_version_helper): Give error if
9670         version is ambiguous.
9671
9672 2010-01-08  Doug Kwan  <dougkwan@google.com>
9673
9674         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
9675         prev_data_size_ and prev_addralign_.  Remove initializer for
9676         deleted data member has_been_changed_.
9677         (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
9678         to determine if the table is empty.
9679         (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
9680         Remove.
9681         (Stub_table::add_reloc_stub): Define method in class definition
9682         instead of just declaring it there.
9683         (Stub_table::add_cortex_a8_stub): New method definition.
9684         (Stub_table::update_data_size_and_addralign): Ditto.
9685         (Stub_table::finalize_stubs): Ditto.
9686         (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
9687         (Stub_table::do_addralign_): Return address alignment in the
9688         (Stub_table::do_reset_address_and_file_offset): Define method in
9689         class definition instead of declaring it there.  Set current data
9690         size to be the data size of the previous pass.
9691         (Stub_table::set_final_data_size): Use current data size as the
9692         final data size.
9693         (Stub_table::relocate_stub): Change parameter type of stub from
9694         Reloc_stub pointer to Stub pointer.
9695         (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
9696         (Stub_table::Cortex_a8_stub_list): New typedef.
9697         (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
9698          Stub_table::prev_addralign_): New data member.
9699         (Arm_relobj::Arm_relobj): Initialize data member
9700         section_has_cortex_a8_workaround_.
9701         (Arm_relobj::section_has_cortex_a8_workaround,
9702          Arm_relobj::mark_section_for_cortex_a8_workaround): New method
9703          definitions.
9704         (Arm_relobj::section_has_cortex_a8_workaround_): New data member
9705         declarations.
9706         (Target_arm::relocate_stub): Change parameter type of stub from
9707         Reloc_stub pointer to Stub pointer.
9708         (Insn_template::size, Insn_template::alignment): Handle
9709         THUMB16_SPECIAL_TYPE.
9710         (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
9711          Stub_table::update_data_size_and_addralign,
9712          Stub_table::apply_cortex_a8_workaround_to_address_range): New method
9713         definitions.
9714         (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
9715         (Stub_table::do_write): Ditto.
9716         (Target_arm::do_relax): Adjust code for changes in Stub_table.
9717
9718 2010-01-08  Ian Lance Taylor  <iant@google.com>
9719
9720         PR 11108
9721         * symtab.h (class Symbol): Remove fields is_target_special_ and
9722         has_plt_offset_.  Add field is_defined_in_discarded_section_.
9723         (Symbol::is_defined_in_discarded_section): New function.
9724         (Symbol::set_is_defined_in_discarded_section): New function.
9725         (Symbol::has_plt_offset): Rewrite.
9726         (Symbol::set_plt_offset): Verify that new offset is not -1U.
9727         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
9728         Don't initialize is_target_special_ or has_plt_offset_.
9729         Initialize is_defined_in_discarded_section_.
9730         (Symbol_table::add_from_relobj): If appropriate, set
9731         is_defined_in_discarded_section.
9732         * resolve.cc (Symbol::override_base_with_special): Don't test
9733         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
9734         * target-reloc.h (relocate_section): Do special handling for
9735         symbols defined in discarded sections for global symbols as well
9736         as local symbols.
9737
9738 2010-01-08  Ian Lance Taylor  <iant@google.com>
9739
9740         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
9741         the SHT_SYMTAB case.
9742
9743 2010-01-08  Ian Lance Taylor  <iant@google.com>
9744
9745         * object.cc (Sized_relobj::do_layout): Don't get confused if
9746         layout_eh_frame returns NULL.
9747
9748 2010-01-08  Ian Lance Taylor  <iant@google.com>
9749
9750         PR 11084
9751         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
9752         dynamic symbol table, use the normal symbol table.
9753         (Sized_dynobj::do_read_symbols): Remove assertion about type of
9754         symbol table.
9755
9756 2010-01-08  Ian Lance Taylor  <iant@google.com>
9757
9758         PR 11072
9759         * layout.cc (Layout::include_section): Remove .gnu_debuglink
9760         sections.
9761
9762 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
9763
9764         * version.cc (print_version): Change to "Copyright 2010".
9765
9766 2010-01-08  Ian Lance Taylor  <iant@google.com>
9767
9768         PR 10287
9769         PR 11063
9770         * i386.cc (class Target_i386): Change return type of plt_section
9771         to be non-const.
9772         (class Output_data_plt_i386): Add tls_desc_rel_ field.
9773         (Output_data_plt_i386::Output_data_plt_i386): Initialize
9774         tls_desc_rel_ field.
9775         (Output_data_plt_i386::rel_tls_desc): New function.
9776         (Target_i386::rel_tls_desc_section): New function.
9777         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
9778         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
9779         R_386_TLS_DESC reloc in rel_tls_desc_section.
9780         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
9781         Define struct Tlsdesc_info.
9782         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
9783         (Target_x86_64::do_reloc_symbol_index): New function.
9784         (Target_x86_64::add_tlsdesc_info): New function.
9785         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
9786         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
9787         tlsdesc_rel_ field.
9788         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
9789         all callers.
9790         (Output_data_plt_x86_64::rela_tlsdesc): New function.
9791         (Target_x86_64::rela_tlsdesc_section): New function.
9792         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
9793         handling.
9794         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
9795         (Target_x86_64::do_reloc_addend): New function.
9796         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
9797         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
9798         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
9799         (Output_reloc::type): New function.
9800         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
9801         (Output_reloc::is_target_specific): New function.
9802         (Output_reloc::target_arg): New function.
9803         (class Output_reloc) [SHT_RELA]: Add four new constructors for
9804         absolute relocs and target specific relocs.
9805         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
9806         add_target_specific.
9807         (class Output_data_reloc) [SHT_RELA]: Likewise.
9808         * output.cc (Output_reloc::Output_reloc): Add four new versions
9809         for absolute relocs and target specific relocs.
9810         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
9811         (Output_reloc::get_symbol_index): Likewise.
9812         (Output_reloc::local_section_offset): Check that local_sym_index_
9813         is not TARGET_CODE or 0.
9814         (Output_reloc::symbol_value): Likewise.
9815         (Output_reloc::write) [SHT_RELA]: Call target for target specific
9816         reloc.
9817         * target.h (class Target): Add reloc_symbol_index and reloc_addend
9818         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
9819         functions.
9820         * layout.cc (add_target_dynamic_tags): Use output section for
9821         DT_PLTRELSZ and DT_JMPREL.
9822
9823 2010-01-07  Ian Lance Taylor  <iant@google.com>
9824
9825         PR 11061
9826         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
9827         function.
9828         (class Output_data_reloc_generic): Define.
9829         (class Output_data_reloc_base): Change base class to
9830         Output_data_reloc_generic.  Change add() method to call
9831         bump_relative_reloc_count for a relative reloc.  Remove
9832         sort_relocs_ field.
9833         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
9834         to sort_relocs().
9835         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
9836         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
9837         appropriate.
9838         * layout.h (class Layout): Update declaration.
9839
9840 2010-01-07  Ian Lance Taylor  <iant@google.com>
9841
9842         * output.h (class Output_data): Add const version of
9843         output_section and do_output_section.
9844         (class Output_section_data): Add const version of
9845         do_output_section.
9846         (class Output_section): Likewise.
9847         * layout.cc (Layout::add_target_dynamic_tags): New function.
9848         * layout.h (class Layout): Update declarations.
9849         * arm.cc (Target_arm::do_finalize_sections): Use
9850         add_target_dynamic_tags.
9851         * i386.cc (Target_i386::do_finalize_sections): Likewise.
9852         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
9853         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
9854         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
9855
9856 2010-01-07  Ian Lance Taylor  <iant@google.com>
9857
9858         PR 11042
9859         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
9860         object as needed.
9861
9862 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
9863             Ian Lance Taylor  <iant@google.com>
9864
9865         PR 11019
9866         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
9867         Xindex::read_symtab_xindex.
9868
9869 2010-01-07  Doug Kwan  <dougkwan@google.com>
9870
9871         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
9872         (Insn_template::thumb16_bcond_insn): New method declaration.
9873         (Insn_template): Fix spelling.
9874         (Stub::thumb16_special): New method declaration.
9875         (Stub::do_write): Define virtual method which was previously pure
9876         virtual.
9877         (Stub::do_thumb16_special): New method declaration.
9878         (Stub::do_fixed_endian_write): New template member.
9879         (Reloc_stub::do_write): Remove.
9880         (Reloc_stub::do_fixed_endian_write): Remove.
9881         (Cortex_a8_stub): New class definition.
9882         (Stub_factory::make_cortex_a8_stub): New method definition.
9883         (Stub_factory::Stub_factory): Add missing static storage class
9884         qualifier for elf32_arm_stub_a8_veneer_blx.
9885
9886 2010-01-07  Ian Lance Taylor  <iant@google.com>
9887
9888         PR 10980
9889         * options.h (class General_options): Add --warn-unresolved-symbols
9890         and --error-unresolved-symbols.
9891         * errors.cc (Errors::undefined_symbol): Implement
9892         --warn-unresolved-symbols.
9893
9894         * options.h (class General_options): Add -z text and -z textoff.
9895         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
9896
9897 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
9898
9899         * gc.h (Garbage_collection::Cident_section_map): New typedef.
9900         (Garbage_collection::cident_sections): New function.
9901         (Garbage_collection::add_cident_section): New function.
9902         (Garbage_collection::cident_sections_): New member.
9903         (gc_process_relocs): Add references to sections whose names are C
9904         identifiers.
9905         * gold.h (cident_section_start_prefix): New constant.
9906         (cident_section_stop_prefix): New constant.
9907         (is_cident): New function.
9908         * layout.cc (Layout::define_section_symbols): Replace string constants
9909         with the newly defined constants.
9910         * object.cc (Sized_relobj::do_layout): Track sections whose names are
9911         C identifiers.
9912         * testsuite/Makefile.am: Add gc_orphan_section_test.
9913         * testsuite/Makefile.in: Regenerate.
9914         * testsuite/gc_orphan_section_test.cc: New file.
9915         * testsuite/gc_orphan_section_test.sh: New file.
9916
9917 2010-01-06  Ian Lance Taylor  <iant@google.com>
9918
9919         PR 10980
9920         * options.h (class General_options): Add --warn-shared-textrel.
9921         * layout.cc (Layout::finish_dynamic_section): Implement
9922         --warn-shared-textrel.
9923
9924         PR 10980
9925         * options.h (class General_options): Add --warn-multiple-gp.
9926
9927 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9928
9929         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
9930         $(THREADSLIB) and $(LIBDL).
9931         * Makefile.in: Rebuild.
9932
9933 2010-01-06  Ian Lance Taylor  <iant@google.com>
9934
9935         PR 10980
9936         * options.cc (General_options::parse_section_start): New function.
9937         (General_options::section_start): New function.
9938         (General_options::General_options): Initialize all members.
9939         * options.h: Include <map>
9940         (class General_options): Add --section-start.  Add section_starts_
9941         member.
9942         * layout.cc (Layout::attach_allocated_section_to_segment): If
9943         --section-start was used, set the address of the segment.  Remove
9944         local sort_sections.
9945         (Layout::relaxation_loop_body): If the address of the load segment
9946         has been set by --section-start, don't use it.
9947         * output.h (Output_segment::update_flags_for_output_section): New
9948         function.
9949         * output.cc (Output_segment::add_output_section): Call
9950         update_flags_for_output_section.
9951
9952 2010-01-05  Ian Lance Taylor  <iant@google.com>
9953
9954         PR 10980
9955         * options.h (class General_options): Add --undefined-version.
9956         * script.cc (struct Version_expression): Add was_matched_by_symbol
9957         field.
9958         (Version_script_info::matched_symbol): New function.
9959         (Version_script_info::get_symbol_version_helper): Call
9960         matched_symbol.
9961         (Version_script_info::check_unmatched_names): New function.
9962         * script.h (class Version_script_info): Update declarations.
9963         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
9964
9965         * options.h (class General_options): Use DEFINE_bool_alias for
9966         allow_multiple_definition.
9967         * resolve.cc (Symbol_table::should_override): Don't test
9968         allow_multiple_definition.
9969
9970         PR 10980
9971         * options.h (class General_options): Add --cref.
9972         * main.cc (main): Print cref table if --cref.  Don't close mapfile
9973         until after printing cref table.
9974         * cref.cc: Include "symtab.h".
9975         (class Cref_inputs): Define Cref_table_compare and Cref_table.
9976         (Cref_table_compare::operator()): New function.
9977         (Cref_inputs::gather_cref): New function.
9978         (filecol): New static const.
9979         (Cref_inputs::print_cref): New function.
9980         (Cref::print_cref): New function.
9981         * cref.h: Include <cstdio>.
9982         (class Cref): Update declarations.
9983         * mapfile.h (Mapfile::file): New function.
9984         * object.h (class Object): Define Symbols.  Declare virtual
9985         do_get_global_symbols.
9986         (Object::get_global_symbols): New function.
9987         * object.cc (Input_objects::add_object): Pass object to cref_ if
9988         --cref.
9989         (Input_objects::archive_start): Likewise.
9990         (Input_objects::archive_stop): Likewise.
9991         (Input_objects::print_cref): New function.
9992         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
9993         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
9994         --cref.
9995         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
9996         function.
9997         * plugin.h (class Sized_pluginobj): Update declarations.
9998
9999 2010-01-05  Ian Lance Taylor  <iant@google.com>
10000
10001         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
10002         to is_default_version.  Rename insdef to insdefault.
10003         (Symbol_table::add_from_relobj): Rename def to is_default_version
10004         and local to is_forced_local.
10005         (Symbol_table::add_from_pluginobj): Likewise.
10006         (Symbol_table::add_from_dynobj): Likewise.
10007         (Symbol_table::define_special_symbol): Rename insdef to
10008         insdefault.
10009
10010 2010-01-04  Ian Lance Taylor  <iant@google.com>
10011
10012         PR 10980
10013         * options.h (class General_options): Add
10014         --allow-multiple-definition and -z muldefs.
10015         * resolve.cc (Symbol_table::should_override): Don't warn about a
10016         multiple symbol definition if --allow-multiple-definition or -z
10017         muldefs.
10018
10019         PR 10980
10020         * options.h (class General_options): Add --add-needed and
10021         --copy-dt-needed-entries.  Tweak --as-needed help entry.
10022         * object.cc (Input_objects::check_dynamic_dependencies): Give an
10023         error if --copy-dt-needed-entries aka --add-needed is used and
10024         would cause a change in behaviour.
10025
10026         PR 10980
10027         * options.h (class General_options): Add -G as a short version of
10028         --shared.  Add no-op options -assert, -g, and -i.
10029
10030 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
10031
10032         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
10033         check for .text or .gnu.linkonce.t sections.
10034         * icf.cc (Icf::find_identical_sections): Ditto.
10035         Change the detection for mangled function name within the section
10036         name.
10037         * icf.h (is_section_foldable_candidate): New function.
10038
10039 2009-12-30  Ian Lance Taylor  <iant@google.com>
10040
10041         PR 10980
10042         * options.h (class General_options): Permit two dashes with
10043         --retain-symbols-file.
10044
10045 2009-12-30  Ian Lance Taylor  <iant@google.com>
10046
10047         PR 10979
10048         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
10049         don't put the file header and segment headers in the text
10050         segment.
10051
10052         PR 10979
10053         * common.cc (Sort_commons::operator()): Stabilize sort when both
10054         entries are NULL.
10055         (Symbol_table::do_allocate_commons_list): When allocating common
10056         symbols, skip a symbol which is no longer common.
10057         * symtab.h (Symbol::is_common): Test whether the symbol comes from
10058         an object before checking its type.
10059         * testsuite/common_test_2.c: New file.
10060         * testsuite/common_test_3.c: New file.
10061         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
10062         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
10063         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
10064         (common_test_2_pic.o, common_test_2.so): New targets.
10065         (common_test_3_pic.o, common_test_3.so): New targets.
10066         * testsuite/Makefile.in: Rebuild.
10067
10068         PR 10979
10069         * script.cc (read_input_script): If we see a new SECTIONS clause,
10070         and we have added an input section, give an error.
10071         * layout.h (class Layout): Add have_added_input_section function.
10072         Add have_added_input_section_ field.
10073         * layout.cc (Layout::Layout): Initialize
10074         have_added_input_section_.
10075         (Layout::layout): Set have_added_input_section_.
10076         (Layout::layout_eh_frame): Likewise.
10077
10078 2009-12-30  Ian Lance Taylor  <iant@google.com>
10079
10080         PR 10931
10081         * options.h (class General_options): Add --sort-common option.
10082         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
10083         * common.cc (Sort_common): Add sort_order parameter to
10084         constructor.  Add sort_order_ field.
10085         (Sort_commons::operator): Check sort_order_.
10086         (Symbol_table::allocate_commons): Determine the sort order.
10087         (Symbol_table::do_allocate_commons): Add sort_order parameter.
10088         Change all callers.
10089         (Symbol_table::do_allocate_commons_list): Likewise.
10090
10091 2009-12-30  Ian Lance Taylor  <iant@google.com>
10092
10093         PR 10916
10094         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
10095         symbols from this object, don't change the visibility of an
10096         undefined symbol.
10097         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
10098
10099 2009-12-30  Ian Lance Taylor  <iant@google.com>
10100
10101         PR 10861
10102         * script.h (class Version_script_info): Define Language enum.
10103         Update declarations.  Define Glob, Exact, and Lookup types.  Add
10104         new fields globals_, locals_, and is_finalized_.
10105         * script.cc: Various formatting fixes.
10106         (class Parser_closure): Change language_stack_ from a vector of
10107         std::string to one of Version_script_info::Language.  Adjust all
10108         uses accordingly.
10109         (class Lazy_demangler): Remove.
10110         (struct Version_expression): Change language from std::string to
10111         Version_script_info::Language.
10112         (Version_script_info::Version_script_info): New function.
10113         (Version_script_info::~Version_script_info): Don't call clear.
10114         (Version_script_info::finalize): New function.
10115         (Version_script_info::build_lookup_tables): New function.
10116         (Version_script_info::build_expression_list_lookup): New
10117         function.
10118         (Version_script_info::get_symbol_version_helper): Rewrite to use
10119         lookup tables.
10120         (Version_script_info::print_expression_list): Adjust to use
10121         Version_script_info::Language.
10122         (script_push_lex_into_version_mode): Check that the version script
10123         has not been finalized.
10124         (version_script_push_lang): Change language string to
10125         Version_script_info::Language.
10126         * options.cc (Command_line::version_script): New function.
10127         * options.h (class General_options): Add finalize_dynamic_list
10128         function.  Change version_script from declaration to definition.
10129         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
10130         * testsuite/version_script.map: Remove duplicate def of foo.
10131         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
10132         version_script.map.
10133         * testsuite/Makefile.in: Rebuild.
10134
10135 2009-12-30  Ian Lance Taylor  <iant@google.com>
10136
10137         PR 10843
10138         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
10139         if the input symbol index is 0, make the output symbol index 0.
10140
10141 2009-12-30  Ian Lance Taylor  <iant@google.com>
10142
10143         PR 10670
10144         * options.h (class General_options): Add -x/--discard-all.
10145         * object.cc (Sized_relobj::do_count_local_symbols): Handle
10146         --discard-all.  If the local symbol needs a dynamic entry, check
10147         that before handling --discard-locals.
10148
10149 2009-12-30  Ian Lance Taylor  <iant@google.com>
10150
10151         PR 10450
10152         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
10153         flags to PF_R.
10154         (Output_segment::add_output_section): Don't change the flags if
10155         the type is PT_TLS.
10156
10157         PR 10450
10158         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
10159         GNU hash table if they need a dynamic value.  Otherwise, don't add
10160         them if they are defined in a dynamic object or are forced local.
10161
10162 2009-12-29  Ian Lance Taylor  <iant@google.com>
10163
10164         PR 10450
10165         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
10166         .gnu.hash table for a 32-bit target.
10167
10168         PR 10450
10169         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
10170         regular and a dynamic object only needs a dynamic symbol table
10171         entry if it is externally visible.
10172
10173         PR 10450
10174         * i386.cc (class Target_i386): Initialize global_offset_table_ in
10175         constructor.  Add global_offset_table_ field.
10176         (Target_i386::got_section): Set global_offset_table_.
10177         (Target_i386::do_finalize_sections): Set global_offset_table_
10178         size.
10179         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
10180         in constructor.  Add global_offset_table_ field.
10181         (Target_x86_64::got_section): Set global_offset_table_.
10182         (Target_x86_64::do_finalize_sections): Set global_offset_table_
10183         size.
10184
10185         * layout.cc (Layout::Layout): Initialize increase_relro_.
10186         (Layout::get_output_section): Add is_relro, is_last_relro, and
10187         is_first_non_relro parameters.  Change all callers.
10188         (Layout::choose_output_section): Likewise.
10189         (Layout::add_output_section_data): Likewise.
10190         (Layout::make_output_section): Likewise.
10191         (Layout::set_segment_offsets): Clear increase_relro when using a
10192         linker script.
10193         * layout.h (class Layout): Add increase_relro method.  Add
10194         increase_relro_ field.  Update declarations.
10195         * output.cc (Output_section::Output_section): Initialize
10196         is_last_relro_ and is_first_non_relro_.
10197         (Output_segment::add_output_section): Group relro sections is
10198         do_sort is true.  Handle is_last_relro and is_first_non_relro.
10199         (Output_segment::maximum_alignment): Remove relro handling.
10200         (Output_segment::set_section_addresses): Add increase_relro
10201         parameter.  Change all callers.  Add initial alignment to align
10202         relro sections on separate page.  Remove old relro handling.
10203         (Output_segment::set_section_list_addresses): Remove in_relro
10204         parameter.  Change all callers.
10205         (Output_segment::set_offset): Add increase parameter.  Change all
10206         callers.  Remove old relro handling.
10207         * output.h (class Output_section): Add new methods: is_last_relro,
10208         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
10209         Add is_last_relro_ and is_first_non_relro_ fields.
10210         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
10211         Create separate .got.plt section.  Call increase_relro.
10212         * x86_64.cc (Target_x86_64::got_section): Likewise.
10213         * testsuite/relro_script_test.t: Add .got.plt.
10214
10215         PR 10450
10216         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
10217         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
10218         (Layout::finalize): Call set_dynamic_symbol_size.
10219         (Layout::set_dynamic_symbol_size): New function.
10220         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
10221         set_dynamic_symbol_size.
10222
10223         PR 10450
10224         * output.h (class Output_section): Add is_entsize_zero_ field.
10225         * output.cc (Output_section::Output_section): Initialize
10226         is_entsize_zero_.
10227         (Output_section::set_entsize): If two different entsizes are
10228         requested, force it to zero.
10229         (Output_section::add_input_section): Set flags for .debug_str
10230         before updating section flags.  Set entsize.
10231         (Output_section::update_flags_for_input_section): Set SHF_MERGE
10232         and SHF_STRING if all input sections have those flags.
10233
10234 2009-12-29   Rafael Espindola  <espindola@google.com>
10235
10236         * main.cc (main): Fix the sys time reporting.
10237         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
10238         reporting.
10239
10240 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
10241
10242         * options.cc (General_options::parse_version): Allow -v to exit
10243         without an error if there is nothing to link.
10244
10245 2009-12-29  Ian Lance Taylor  <iant@google.com>
10246
10247         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
10248         using a version of gcc before 4.1.
10249         * configure: Rebuild.
10250
10251 2009-12-28  Chris Demetriou  <cgd@google.com>
10252
10253         * attributes.cc (Output_attributes_section_data::do_write): Use
10254         std::vector::front rather than std::vector::data.
10255
10256 2009-12-28  Ian Lance Taylor  <iant@google.com>
10257
10258         * symtab.h (class Symbol_table): Add enum Defined.
10259         * resolve.cc (Symbol_table::should_override): Add defined
10260         parameter.  Change all callers.  Test whether object is NULL
10261         before calling a method on it.
10262         (Symbol_table::report_resolve_problem): Add defined parameter.
10263         Change all callers.
10264         (Symbol_table::should_override_with_special): Likewise.
10265         * symtab.cc (Symbol_table::define_in_output_data): Add defined
10266         parameter.  Change all callers.
10267         (Symbol_table::do_define_in_output_data): Likewise.
10268         (Symbol_table::define_in_output_segment): Likewise.
10269         (Symbol_table::do_define_in_output_segment): Likewise.
10270         (Symbol_table::define_as_constant): Likewise.
10271         (Symbol_table::do_define_as_constant): Likewise.
10272         * script.h (class Symbol_assignment): Add is_defsym parameter to
10273         constructor; change all callers.
10274         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
10275         parameter.  Change all callers.  Add is_defsym_ field.
10276         (class Parser_closure): Add parsing_defsym parameter to
10277         constructor; change all callers.  Add parsing_defsym accessor
10278         function.  Add parsing_defsym_ field.
10279
10280 2009-12-28  Ian Lance Taylor  <iant@google.com>
10281
10282         * gold.cc (queue_middle_tasks): Fix formatting.
10283         * object.cc (Relobj::is_section_name_included): Likewise.
10284
10285 2009-12-23  Ian Lance Taylor  <iant@google.com>
10286
10287         * i386.cc (Target_i386::do_calls_non_split): Recognize
10288         -fsplit-stack prologue for a function with a static chain.
10289         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
10290         -fsplit-stack prologue when using %r11.
10291
10292 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
10293
10294         * options.cc (General_options::parse_version): Make -v continue and do
10295         the link like GNU ld does.
10296
10297 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
10298
10299         * Makefile.am (CCFILES): Add timer.cc.
10300         (HFILES): Add timer.h.
10301         * configure.ac: Check for sysconf and times.
10302         * main.cc: include timer.h.
10303         (main): Use Timer instead of get_run_time.
10304         * timer.cc: New.
10305         * timer.h: New.
10306         * workqueue.cc: include timer.h.
10307         (Workqueue::find_and_run_task):
10308         Report user, sys and wall time.
10309         * Makefile.in: Regenerate.
10310         * config.in: Regenerate.
10311         * configure: Regenerate.
10312
10313 2009-12-16  Doug Kwan  <dougkwan@google.com>
10314
10315         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
10316         sections.
10317         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
10318         relaxed input sections.
10319         * output.cc (Output_section::find_relaxed_input_section): Change
10320         return type to Output_relaxed_input_section pointer.  Adjust code
10321         for new type of relaxed_input_section_map_.
10322         * output.h (Output_section::find_relaxed_input_section): Change
10323         return type to Output_relaxed_input_section pointer.
10324         (Output_section::Output_relaxed_input_section_by_input_section_map):
10325         New type.
10326         (Output_section::relaxed_input_section_map_): Change type to
10327         Output_section::Output_relaxed_input_section_by_input_section_map.
10328         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
10329         input section.
10330
10331 2009-12-15  Ian Lance Taylor  <iant@google.com>
10332
10333         * layout.cc (Layout::create_shstrtab): Only write out after input
10334         sections if we are compressing debug sections.
10335
10336 2009-12-15  Ian Lance Taylor  <iant@google.com>
10337
10338         * archive.cc (Archive::add_symbols): Only look up a symbol without
10339         a version if there is, in fact, a version.
10340
10341 2009-12-14  Ian Lance Taylor  <iant@google.com>
10342
10343         Revert -Wshadow changes, all changes from:
10344         2009-12-11  Doug Kwan  <dougkwan@google.com>
10345         2009-12-11  Nick Clifton  <nickc@redhat.com>
10346         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
10347
10348 2009-12-11  Doug Kwan  <dougkwan@google.com>
10349
10350         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
10351         due to -Wshadow.
10352         * attributes.cc (Object_attribute::size): Ditto.
10353         (Attributes_section_data::size): Ditto.
10354         (Attributes_section_data::Attributes_section_data): Ditto.
10355         (Output_attributes_section_data::do_write): Ditto.
10356         * attributes.h (Object_attribute::set_type): Ditto.
10357         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
10358
10359 2009-12-11  Nick Clifton  <nickc@redhat.com>
10360
10361         * archive.cc: Fix shadowed variable warnings.
10362         * arm.cc: Likewise.
10363         * compressed_output.cc: Likewise.
10364         * compressed_output.h: Likewise.
10365         * configure: Likewise.
10366         * dwarf_reader.cc: Likewise.
10367         * dynobj.cc: Likewise.
10368         * dynobj.h: Likewise.
10369         * ehframe.cc: Likewise.
10370         * ehframe.h: Likewise.
10371         * errors.cc: Likewise.
10372         * expression.cc: Likewise.
10373         * fileread.cc: Likewise.
10374         * fileread.h: Likewise.
10375         * freebsd.h: Likewise.
10376         * i386.cc: Likewise.
10377         * icf.cc: Likewise.
10378         * incremental.h: Likewise.
10379         * layout.cc: Likewise.
10380         * layout.h: Likewise.
10381         * mapfile.cc: Likewise.
10382         * merge.cc: Likewise.
10383         * merge.h: Likewise.
10384         * object.cc: Likewise.
10385         * object.h: Likewise.
10386         * options.h: Likewise.
10387         * output.cc: Likewise.
10388         * output.h: Likewise.
10389         * parameters.cc: Likewise.
10390         * plugin.cc: Likewise.
10391         * powerpc.cc: Likewise.
10392         * reduced_debug_output.cc: Likewise.
10393         * reduced_debug_output.h: Likewise.
10394         * reloc.cc: Likewise.
10395         * reloc.h: Likewise.
10396         * resolve.cc: Likewise.
10397         * script-sections.cc: Likewise.
10398         * script.cc: Likewise.
10399         * script.h: Likewise.
10400         * sparc.cc: Likewise.
10401         * symtab.cc: Likewise.
10402         * symtab.h: Likewise.
10403         * target-select.cc: Likewise.
10404         * target-select.h: Likewise.
10405         * token.h: Likewise.
10406         * workqueue.cc: Likewise.
10407         * workqueue.h: Likewise.
10408         * x86_64.cc: Likewise.
10409
10410 2009-12-10  Doug Kwan  <dougkwan@google.com>
10411
10412         * arm.cc (attributes.h): New include.
10413         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
10414         (Arm_relobj::~Arm_relobj): Delete object pointed by
10415         attributes_section_data_.
10416         (Arm_relobj::attributes_section_data): New method definition.
10417         (Arm_relobj::attributes_section_data_): New data member declaration.
10418         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
10419         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
10420         attributes_section_data_.
10421         (Arm_dynobj::attributes_section_data): New method definition.
10422         (Arm_dynobj::attributes_section_data_): New data member declaration.
10423         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
10424         initialization value of may_use_blx_ to false.
10425         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
10426         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
10427         object attributes to compute results instead of hard-coding.
10428         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
10429         Target_arm::get_secondary_compatible_arch,
10430         Target_arm::set_secondary_compatible_arch
10431         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
10432         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
10433         New method declarations.
10434         (Target_arm::get_aeabi_object_attribute): New method definition.
10435         (Target_arm::attributes_section_data_): New data member declaration.
10436         (read_arm_attributes_section): New template definition.
10437         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
10438         (Arm_dynobj::do_read_symbols): Ditto.
10439         (Target_arm::do_finalize_sections): Merge attributes sections from
10440         input.  Check for BLX use after attributes section merging.
10441         Fix __exidx_start and __exidx_end visibility.  Create an
10442         .ARM.attributes section if necessary.
10443         (Target_arm::get_secondary_compatible_arch,
10444         Target_arm::set_secondary_compatible_arch,
10445         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
10446         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
10447         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
10448         New method definitions.
10449
10450 2009-12-09  Ian Lance Taylor  <iant@google.com>
10451
10452         * plugin.cc (Plugin::load): Don't cast from void* to a function
10453         pointer.
10454
10455 2009-12-09  Ian Lance Taylor  <iant@google.com>
10456
10457         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
10458         information fields.
10459
10460 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
10461
10462         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
10463         Replace two_file_shared_1.so with two_file_shared_2.so.
10464         * testsuite/Makefile.in: Regenerated.
10465
10466 2009-12-08  Doug Kwan  <dougkwan@google.com>
10467
10468         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
10469         (HFILES): Add attributes.h and int_encoding.h.
10470         * Makefile.in: Regenerate.
10471         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
10472         function definitions to int_encoding.cc
10473         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
10474         prototypes to int_encoding.h
10475         * reduced_debug_output.cc (int_encoding.h): New include.
10476         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
10477         function definitions to int_encoding.cc
10478         (insert_into_vector, read_from_pointer): Move template definitions to
10479         int_encoding.h
10480         * attributes.cc: New file.
10481         * attributes.h: New file.
10482         * int_encoding.cc: New file.
10483         * int_encoding.h: New file.
10484
10485 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
10486
10487         PR gold/11055
10488         * incremental-dump.cc (dump_incremental_inputs): New.
10489         (main): Use dump_incremental_inputs.
10490
10491 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
10492
10493         PR gold/10893
10494         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
10495         checking elfcpp::STT_FUNC.
10496         (Target_i386::Relocate::relocate): Likewise.
10497         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
10498
10499         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
10500         symbols from shared libraries into normal FUNC symbols.
10501
10502         * symtab.h (Symbol): Add is_func and use it.
10503
10504 2009-12-05  Doug Kwan  <dougkwan@google.com>
10505
10506         * arm.cc (Target_arm::arm_info): Initialize new fields
10507         attributes_section and attributes_vendor.
10508         * i386.cc (Target_i386::i386_info): Same.
10509         * object.cc (Sized_relobj::do_layout): Skip attribute section.
10510         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
10511         fields attributes_section and attributes_vendor.
10512         * sparc.cc (Target_sparc::sparc_info): Same.
10513         * target.h (Target::attributes_section, Target::attributes_vendor,
10514         Target::is_attributes_section, Target::attribute_arg_type,
10515         Target::attributes_order): New method definitions.
10516         (Target::Target_info::attributes_section,
10517         Target::Target_info::attributes_vendor): New fields.
10518         (Target::do_attribute_arg_type, Target::do_attributes_order): New
10519         virtual method definitions.
10520         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
10521         attributes_section and attributes_vendor.
10522         * testsuite/testfile.cc (Target_test::test_target_info): Same.
10523
10524 2009-12-05  Doug Kwan  <dougkwan@google.com>
10525
10526         * arm.cc: Update comments about interworking and stub generation.
10527         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
10528         considered as non-PIC.
10529         (Arm_relocate_functions::base_abs): Fix formatting.
10530         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
10531         of function to use GOT entry address instead of offset.
10532         (Target_arm::Scan::global): Issue an error if a symbol would need a
10533         PLT does not get one because it is untyped.  Remove code to create
10534         dynamic symbols for relative branches.
10535         (Target_arm::Relocate::relocate: Use 0 instead of false since function
10536         takes unsigned integer instead of boolean.
10537
10538 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
10539
10540         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
10541         (two_file_test_LDADD): Likewise.
10542         (common_test_1_LDADD): Likewise.
10543         (exception_test_LDADD) Likewise.
10544         (weak_test_LDADD): Likewise.
10545         (many_sections_test_LDADD): Likewise.
10546         (initpri1_LDADD): Likewise.
10547         (script_test_1_LDADD): Likewise.
10548         (script_test_2_LDADD): Likewise.
10549         (justsyms_LDADD): Likewise.
10550         (binary_test_LDADD): Likewise.
10551         (large_LDADD): Likewise.
10552         * testsuite/Makefile.in: Regenerated.
10553
10554 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
10555
10556         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
10557         (Symbol_table::override_with_special): Likewise.
10558         (Symbol_table::add_from_object): Likewise.
10559
10560 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
10561
10562         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
10563         Don't set the data_offset twice.
10564
10565 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
10566
10567         * testsuite/Makefile.in: Regenerate.
10568
10569 2009-12-03  Doug Kwan  <dougkwan@google.com>
10570
10571         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
10572         (Target_arm::do_finalize_sections): Add parameter for symbol table
10573         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
10574         * i386.cc (Target_i386::do_finalize_sections): Add an additional
10575         parameter for symbol table pointer.
10576         * layout.cc (Layout::finalize): Call Target::finalize_sections with
10577         an additional parameter for a pointer to symbol table.
10578         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
10579         parameter for a symbol table pointer.
10580         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
10581         * target.h (Target::finalize_sections, Target::do_finalize_sections):
10582         Ditto.
10583         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
10584         parameter for a symbol table pointer.
10585
10586 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
10587
10588         * incremental.cc (Incremental_inputs_header)
10589         (Incremental_inputs_header_write, Incremental_inputs_entry)
10590         (Incremental_inputs_entry_write): Move ...
10591         * incremental.h (Incremental_inputs_header)
10592         (Incremental_inputs_header_write, Incremental_inputs_entry)
10593         (Incremental_inputs_entry_write): here.
10594
10595 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10596
10597         * incremental.cc (make_sized_incremental_binary): Set the target.
10598         Error if it is incompatible.
10599         * output.h (Output_file): Add filename method.
10600
10601 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10602
10603         * incremental.cc (Incremental_inputs_entry): Remove unused argument
10604         from the get_* methods.
10605
10606 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10607
10608         * incremental-dump.cc (main): Check that the offeset of a script is 0.
10609         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
10610         Write 0 for the data_offset of scripts.
10611
10612 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10613
10614         * testsuite/Makefile.am: Add the incremental_test.sh test.
10615         * testsuite/incremental_test.sh: New.
10616         * testsuite/incremental_test_1.c: New.
10617         * testsuite/incremental_test_2.c: New.
10618
10619 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
10620
10621         * incremental-dump.cc (main): Fix typos.
10622
10623 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
10624
10625         PR gold/11025
10626         * incremental-dump.cc (main): Use llu to print 64 bit values.
10627
10628 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
10629             H.J. Lu  <hongjiu.lu@intel.com>
10630
10631         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
10632         $(LIBDL).
10633         (incremental_dump_LDADD): Likewise.
10634         * Makefile.in: Regenerated.
10635
10636 2009-11-25  Doug Kwan  <dougkwan@google.com>
10637
10638         Revert:
10639
10640         2009-11-25  Doug Kwan  <dougkwan@google.com>
10641
10642                 * arm.cc (Target_arm::Target_arm): Move method definition
10643                 outside of class definition.  Add code to handle
10644                 --target1-rel, --target1-abs and --target2= options.
10645                 (Target_arm::get_reloc_reloc_type): Change method to be
10646                 non-static and const.
10647                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
10648                 New data member declaration.
10649                 (Target_arm::Scan::local, Target_arm::Scan::global,
10650                 Target_arm::Relocate::relocate,
10651                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10652                 Adjust call to Target_arm::get_real_reloc_type.
10653                 (Target_arm::get_real_reloc_type): Use command line options
10654                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
10655                 * options.h (--target1-rel, --target1-abs, --target2): New
10656                 ARM-only options.
10657
10658 2009-11-25  Doug Kwan  <dougkwan@google.com>
10659
10660         * arm.cc (Target_arm::Target_arm): Move method definition outside of
10661         class definition.  Add code to handle --target1-rel, --target1-abs
10662         and --target2= options.
10663         (Target_arm::get_reloc_reloc_type): Change method to be non-static
10664         and const.
10665         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
10666         member declaration.
10667         (Target_arm::Scan::local, Target_arm::Scan::global,
10668         Target_arm::Relocate::relocate,
10669         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
10670         call to Target_arm::get_real_reloc_type.
10671         (Target_arm::get_real_reloc_type): Use command line options to
10672         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
10673         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
10674         options.
10675
10676 2009-11-25  Doug Kwan  <dougkwan@google.com>
10677
10678         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
10679         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
10680         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
10681         formatting.
10682         (Arm_relocate_functions::thm_call): Replace body with a call to
10683         Arm_relocate_functions::thumb_branch_common.
10684         (Arm_relocate_functions::thm_jump24,
10685         Arm_relocate_functions::thm_xpc22): New method definitions.
10686         (Arm_relocate_functions::thumb_branch_common): New method definition.
10687         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
10688         operator.
10689         (Target_arm::Relocate::relocate): Adjust call to thm_call.
10690         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
10691
10692 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
10693
10694         * Makefile.am: Build incremental-dump
10695         * Makefile.in: Regenerate.
10696         * incremental-dump.cc: New.
10697         * incremental.cc (Incremental_inputs_header_data,
10698         Incremental_inputs_entry_data): Move to incremental.h
10699         * incremental.h: (Incremental_inputs_header_data,
10700         Incremental_inputs_entry_data): Move from incremental.cc
10701
10702 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
10703
10704         * incremental.cc (Incremental_inputs_header,
10705         Incremental_inputs_header_write, Incremental_inputs_entry,
10706         Incremental_inputs_entry_write): Add a typedef with the data type.
10707
10708 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
10709
10710         * incremental.cc (Incremental_inputs_header,
10711         Incremental_inputs_header_write, Incremental_inputs_entry,
10712         Incremental_inputs_entry_write): Update comment about which
10713         type has the filed descriptions.
10714
10715 2009-11-15  Doug Kwan  <dougkwan@google.com>
10716
10717         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
10718         (Arm_relocate_functions::arm_branch_common): Change method defintion
10719         in class definition to a method declaration and update list of formal
10720         parameters.
10721         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
10722         Arm_relocation_functions::jump24): Adjust call to
10723         Arm_relocate_functions::arm_branch_common.  Update list of formal
10724         parameters.
10725         (Arm_relocate_functions::xpc25): New method definition.
10726         (Arm_relocate_functions::arm_branch_common): Move method defintion
10727         out from class definition.  Use stubs for mode-switching and extending
10728         branch ranges.
10729         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
10730         specially.  Change code to enable use of stubs in ARM branches.
10731
10732 2009-11-10  Doug Kwan  <dougkwan@google.com>
10733
10734         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
10735         in method declaration.
10736         (Target_arm::relocate_stub): New method declaration.
10737         (Target_arm::default_target): Change to return a pointer instead of
10738         a const reference.
10739         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
10740         Target_arm::default_target.
10741         (Arm_Relobj::do_relocate_sections): Remove options paramater in
10742         method definition.
10743         (Target_arm::relocate_section): Adjust view.
10744         (Target_arm::relocate_stub): New method definition.
10745
10746 2009-11-10  Doug Kwan  <dougkwan@google.com>
10747
10748         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
10749         a format warning.
10750         * incremental.cc (open_incremental_binary): Initialized local
10751         variables to avoid warnings.
10752         * object.cc (make_elf_object): Ditto.
10753         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
10754         a format warning.
10755
10756 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
10757
10758         PR gold/10930
10759         * testsuite/plugin_test.c: Include "config.h".
10760
10761 2009-11-09  Doug Kwan  <dougkwan@google.com>
10762
10763         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
10764         (arm_symbol_value): Remove.
10765         (Arm_relocate_functions::arm_branch_common,
10766         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
10767         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
10768         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
10769         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
10770         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
10771         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
10772         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
10773         Arm_relocate_functions::thm_mobw_abs_nc,
10774         Arm_relocate_functions::thm_mov_abs,
10775         Arm_relocate_functions::movw_prel_nc,
10776         Arm_relocate_functions::thm_movt_abs,
10777         Arm_relocate_functions::movt_prel,
10778         Arm_relocate_functions::thm_movw_prel_nc,
10779         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
10780         (Target_arm::Relocate::relocate): Only decompose address into two
10781         parts if relocation type uses the thumb-bit and pass the actual
10782         bit instead of a flag indicating that the thumb-bit is used.  Adjust
10783         calls to methods in Arm_relocate_functions for this change.
10784
10785 2009-11-08  Ian Lance Taylor  <iant@google.com>
10786
10787         PR 10925
10788         * reloc.cc: Instantiate
10789         Sized_relobj::initialize_input_to_output_maps and
10790         Sized_relobj:free_input_to_output_maps.
10791
10792 2009-11-06  Ian Lance Taylor  <iant@google.com>
10793
10794         PR 10876
10795         * defstd.cc (in_segment): Set only_if_ref true for "end".
10796
10797 2009-11-06  Doug Kwan  <dougkwan@google.com>
10798
10799         * arm.cc (class Reloc_stub): Correct a comment.
10800         (Target_arm::Target_arm): Initialize arm_input_section_map_.
10801         (Target_arm::scan_section_for_stubs): New method declaration.
10802         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
10803         Change methods from private to protected.
10804         (Target_arm::do_may_relax): New method definition.
10805         (Target_arm::do_relax, Target_arm::group_sections,
10806         Target_arm::scan_reloc_for_stub,
10807         Target_arm::scan_reloc_section_for_stubs): New method declarations.
10808         (Target_arm::arm_input_section_map_): New data member declaration.
10809         (Target_arm::scan_reloc_for_stub,
10810         Target_arm::scan_reloc_section_for_stubs,
10811         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
10812         Target_arm::do_relax): New method definitions.
10813
10814 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
10815
10816         * configure.ac: Check for (struct stat)::st_mtim
10817         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
10818         * config.in: Regenerate.
10819         * configure: Regenerate.
10820
10821 2009-11-05  Ian Lance Taylor  <iant@google.com>
10822
10823         PR 10910
10824         * output.cc (Output_segment::add_output_section): Add missing
10825         return statement.
10826
10827 2009-11-04  Ian Lance Taylor  <iant@google.com>
10828
10829         PR 10880
10830         * object.h (class Object): Add is_needed and set_is_needed
10831         methods.  Add is_needed_ field.  Make bool fields into bitfields.
10832         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
10833         defined in a dynamic object and referenced by a regular object,
10834         set is_needed for the dynamic object.
10835         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
10836         if the file is marked with as_needed and it is not needed.
10837
10838 2009-11-04  Ian Lance Taylor  <iant@google.com>
10839
10840         PR 10887
10841         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
10842         tags if data is discarded by linker script.
10843         * i386.cc (Target_i386::do_finalize_sections): Likewise.
10844         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
10845         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
10846         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
10847
10848 2009-11-04  Ian Lance Taylor  <iant@google.com>
10849
10850         * layout.cc (Layout::get_output_section): Add is_interp and
10851         is_dynamic_linker_section parameters.  Change all callers.
10852         (Layout::choose_output_section): Likewise.
10853         (Layout::make_output_section): Likewise.
10854         (Layout::add_output_section_data): Add is_dynamic_linker_section
10855         parameter.  Change all callers.
10856         * layout.h (class Layout): Update declarations.
10857         * output.h (class Output_section): Add is_interp, set_is_interp,
10858         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
10859         Add is_interp_, is_dynamic_linker_section_ fields.  Change
10860         generate_code_fills_at_write_ to a bitfield.
10861         * output.cc (Output_section::Output_sections): Initialize new
10862         fields.
10863         (Output_segment::add_output_section): Add do_sort parameter.
10864         Change all callers.
10865
10866 2009-11-03  Ian Lance Taylor  <iant@google.com>
10867
10868         PR 10860
10869         * options.h (class General_options): Add --warn-common.
10870         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
10871         merging two common symbols.
10872         (Symbol_table::should_override): Handle --warn-common when merging
10873         a common symbol with a defined symbol.  Use report_resolve_problem
10874         for multiple definitions.
10875         (Symbol_table::report_resolve_problem): New function.
10876         * symtab.h (class Symbol_table): Declare report_resolve_problem.
10877
10878 2009-11-03  Doug Kwan  <dougkwan@google.com>
10879
10880         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
10881         stub_factory_.
10882         (Target_arm::stub_factory): New method definition.
10883         (Target_arm::new_arm_input_section,
10884         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
10885         Target_arm::reloc_uses_thumb_bit): New method declarations.
10886         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
10887         New type definitions.
10888         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
10889         member declarations.
10890         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
10891         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
10892         New method definitions.
10893
10894 2009-11-03  Ian Lance Taylor  <iant@google.com>
10895
10896         * options.h (class General_options): Add --warn_constructors.
10897
10898 2009-11-03  Ian Lance Taylor  <iant@google.com>
10899
10900         PR 10893
10901         * defstd.cc (in_section): Add entries for __rel_iplt_start,
10902         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
10903
10904 2009-11-03  Ian Lance Taylor  <iant@google.com>
10905
10906         PR 10895
10907         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
10908         --msgid-bugs-address.
10909         (install-pdf): New target.
10910         (install-data_yes): Look up one directory to find mkinstalldirs.
10911
10912 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
10913
10914         * po/Make-in (.po.gmo): Don't generate .gmo files in source
10915         tree.
10916
10917 2009-10-30  Doug Kwan  <dougkwan@google.com>
10918
10919         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
10920
10921 2009-10-30  Doug Kwan  <dougkwan@google.com>
10922
10923         * arm.cc (Stub_addend_reader): New struct template definition
10924         and partial specializations.
10925         (Stub_addend_reader::operator()): New method definition for a
10926         partially specialized template.
10927
10928 2009-10-30  Doug Kwan  <dougkwan@google.com>
10929
10930         * arm.cc (Arm_relobj::processor_specific_flags): New method
10931         definition.
10932         (Arm_relobj::do_read_symbols): New method declaration.
10933         (Arm_relobj::processor_specific_flags_): New data member declaration.
10934         (Arm_dynobj): New class definition.
10935         (Target_arm::do_finalize_sections): Add input_objects parameter.
10936         (Target_arm::do_adjust_elf_header): New method declaration.
10937         (Target_arm::are_eabi_versions_compatible,
10938         (Target_arm::merge_processor_specific_flags): New method declaration.
10939         (Target_arm::do_make_elf_object): New overloaded method definitions
10940         and declaration.
10941         (Arm_relobj::do_read_symbols): New method definition.
10942         (Arm_dynobj::do_read_symbols): Ditto.
10943         (Target_arm::do_finalize_sections): Add input_objects parameters.
10944         Merge processor-specific flags from all input objects.
10945         (Target_arm::are_eabi_versions_compatible,
10946         Target_arm::merge_processor_specific_flags,
10947         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
10948         New method definitions.
10949         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
10950         Input_objects pointer type parameter.
10951         * layout.cc (Layout::finalize): Pass input objects to target's.
10952         finalize_sections function.
10953         * output.cc (Output_file_header::do_sized_write): Set ELF file
10954         header's processor-specific flags.
10955         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
10956         Input_objects pointer type parameter.
10957         * sparc.cc (Target_sparc::do_finalize_sections): Same.
10958         * target.h (Input_objects): New forward class declaration.
10959         (Target::processor_specific_flags,
10960         Target::are_processor_specific_flags_sect): New method definitions.
10961         (Target::finalize_sections): Add input_objects parameter.
10962         (Target::Target): Initialize processor_specific_flags_ and
10963         are_processor_specific_flags_set_.
10964         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
10965         parameter.
10966         (Target::set_processor_specific_flags): New method definition.
10967         (Target::processor_specific_flags_,
10968         Target::are_processor_specific_flags_set_): New data member
10969         declarations.
10970         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
10971         Input_objects pointer type parameter.
10972
10973 2009-10-30  Doug Kwan  <dougkwan@google.com>
10974
10975         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
10976
10977 2009-10-28  Ian Lance Taylor  <iant@google.com>
10978
10979         * object.h (class Relobj): Drop options parameter from
10980         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
10981         do_scan_relocs, do_relocate.  Change all callers.
10982         (class Sized_relobj): Drop options parameters from
10983         do_gc_process_relocs, do_scan_relocs, do_relocate,
10984         do_relocate_sections, relocate_sections, emit_relocs_scan,
10985         emit_relocs_scan_reltype.  Change all callers.
10986         (struct Relocate_info): Remove options field and all references to
10987         it.
10988         * reloc.h (class Read_relocs): Remove options constructor
10989         parameter and options_ field.  Change all callers.
10990         (class Gc_process_relocs, class Scan_relocs): Likewise.
10991         (class Relocate_task): Likewise.
10992         * target-reloc.h (scan_relocs): Remove options parameter.  Change
10993         all callers.
10994         (scan_relocatable_relocs): Likewise.
10995         * target.h (class Sized_target): Remove options parameter from
10996         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
10997         all callers.
10998         * gc.h (gc_process_relocs): Remove options parameter.  Change all
10999         callers.
11000         * arm.cc: Update functions to remove options parameters.
11001         * i386.cc: Likewise.
11002         * powerpc.cc: Likewise.
11003         * sparc.cc: Likewise.
11004         * x86_64.cc: Likewise.
11005         * testsuite/testfile.cc: Likewise.
11006
11007 2009-10-28  Doug Kwan  <dougkwan@google.com>
11008
11009         * arm.cc (Arm_relobj): New class definition.
11010         (Arm_relobj::scan_sections_for_stubs,
11011         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
11012         New method definitions.
11013
11014 2009-10-28  Cary Coutant  <ccoutant@google.com>
11015
11016         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
11017         (Plugin::cleanup_done_): New member.
11018         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
11019         (Plugin_manager::cleanup_done_): Remove.
11020         (Plugin_manager::add_input_file): Edit error message.
11021         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
11022         (Plugin_manager::cleanup): Remove use of cleanup_done_.
11023
11024 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
11025
11026         * fileread.cc: (File_read::View::~View): Use the new
11027         data_ownership_ filed.
11028         (File_read::~File_read): Dispose the new whole_file_view_.
11029         (File_read::open): Mmap the whole file if needed.
11030         (File_read::open): Use whole_file_view_ instead of contents_.
11031         (File_read::find_view): Use whole_file_view_ if applicable.
11032         (File_read::do_read): Use whole_file_view_ instead of contents_.
11033         (File_read::make_view): Use whole_file_view_ instead of contents_,
11034         update File_read::View::View call.
11035         (File_read::find_or_make_view): Update File_read::View::View
11036         call.
11037         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
11038         remove contents_
11039         (File_read::View::Data_ownership): New enum.
11040         (File_read::View::View): Replace bool mapped_ with Data_ownership
11041         argument.
11042         (File_read::View::mapped_): Remove (replaced by data_ownership_).
11043         (File_read::View::data_ownership_): New field.
11044         (File_read::contents_): Remove (replaced by whole_file_view_).
11045         (File_read::whole_file_view_): New field.
11046         * options.h (class General_options): Add --keep-files-mapped.
11047
11048 2009-10-27  Cary Coutant  <ccoutant@google.com>
11049
11050         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
11051         * testsuite/Makefile.am (plugin_test_5): New test case.
11052         * testsuite/Makefile.in: Regenerate.
11053
11054 2009-10-25  Doug Kwan  <dougkwan@google.com>
11055
11056         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
11057         from private to protected to allow access by child class.
11058         (Sized_relobj::do_relocate_sections): New method declaration.
11059         (Sized_relobj::relocate_sections): Virtualize.
11060         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
11061         Sized_relobj::relocate_sections.  Instantiate template explicitly
11062         for different target sizes and endianity.
11063
11064 2009-10-24  Doug Kwan  <dougkwan@google.com>
11065
11066         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
11067         (Arm_input_section::as_arm_input_section): New method.
11068         (Arm_output_section): New class definition.
11069         (Arm_output_section::create_stub_group,
11070         Arm_output_section::group_sections): New method definitions.
11071
11072 2009-10-22  Doug Kwan  <dougkwan@google.com>
11073
11074         * arm.cc (Arm_input_section): New class definition.
11075         (Arm_input_section::init, Arm_input_section:do_write,
11076         Arm_input_section::set_final_data_size,
11077         Arm_input_section::do_reset_address_and_file_offset): New method
11078         definitions.
11079
11080 2009-10-21  Doug Kwan  <dougkwan@google.com>
11081
11082         * arm.cc (Stub_table, Arm_input_section): New forward class
11083         declarations.
11084         (Stub_table): New class defintion.
11085         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
11086         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
11087         New method definition.
11088
11089 2009-10-21  Doug Kwan  <dougkwan@google.com>
11090
11091         * arm.cc: Update copyright comments.
11092         (Target_arm): New forward class template declaration.
11093         (Arm_address): New type.
11094         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
11095         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
11096         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
11097         constants.
11098         (Insn_template): Same.
11099         (DEF_STUBS): New macro.
11100         (Stub_type): New enum type.
11101         (Stub_template): New class definition.
11102         (Stub): Same.
11103         (Reloc_stub): Same.
11104         (Stub_factory): Same.
11105         (Target_arm::Target_arm): Initialize may_use_blx_ and
11106         should_force_pic_veneer_.
11107         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
11108         Target_arm::should_force_pic_veneer,
11109         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
11110         Target_arm::using_thumb_only, Target_arm:;default_target): New
11111         method defintions.
11112         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
11113         New data member declarations.
11114         (Insn_template::size, Insn_template::alignment): New method defintions.
11115         (Stub_template::Stub_template): New method definition.
11116         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
11117         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
11118         (Stub_factory::Stub_factory): New method definition.
11119         * gold.h (string_hash): New template.
11120         * output.h (Input_section_specifier::hash_value): Use
11121         gold::string_hash.
11122         (Input_section_specifier::string_hash): Remove.
11123         * stringpool.cc (Stringpool_template::string_hash): Use
11124         gold::string_hash.
11125
11126 2009-10-20  Doug Kwan  <dougkwan@google.com>
11127
11128         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
11129         symbols of relaxed input sections.
11130         * output.h (Output_section::find_relaxed_input_section): Make
11131         method public.
11132
11133 2009-10-16  Doug Kwan  <dougkwan@google.com>
11134
11135         * dynobj.cc (Versions::Versions): Initialize version_script_.
11136         Only insert base version symbol definition for a shared object
11137         if version script defines any version versions.
11138         (Versions::define_base_version): New method definition.
11139         (Versions::add_def): Check that base version is not needed.
11140         (Versions::add_need): Define base version lazily.
11141         * dynobj.h (Versions::define_base_version): New method declaration.
11142         (Versions::needs_base_version_): New data member declaration.
11143         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
11144         (check_DATA): Add no_version_test.stdout.
11145         (libno_version_test.so, no_version_test.o no_version_test.stdout):
11146         New make rules.
11147         * testsuite/Makefile.in: Regenerate.
11148         * testsuite/no_version_test.c: New file.
11149         * testsuite/no_version_test.sh: Ditto.
11150
11151 2009-10-16  Doug Kwan  <dougkwan@google.com>
11152
11153         * expression.cc (class Segment_start_expression): New class definition.
11154         (Segment_start_expression::value): New method definition.
11155         (script_exp_function_segment_start): Return a new
11156         Segment_start_expression.
11157         * gold/script-c.h (script_saw_segment_start_expression): New function
11158         prototype.
11159         * script-sections.cc (Script_sections::Script_sections): Initialize
11160         SAW_SEGMENT_START_EXPRESSION_ to false.
11161         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
11162         and -Tbbs options to specify section addresses if given in
11163         command line and no SEGMENT_START expression is seen in a script.
11164         * script-sections.h (Script_sections::saw_segment_start_expression,
11165         Script_sections::set_saw_segment_start_expression): New method
11166         definition.
11167         (Script_sections::saw_segment_start_expression_): New data member
11168         declaration.
11169         * script.cc (script_saw_segment_start_expression): New function.
11170         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
11171         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
11172         script_test_7.sh and script_test_8.sh.
11173         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
11174         script_test_8.stdout.
11175         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
11176         (script_test_6, script_test_6.stdout, script_test_7,
11177         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
11178         * Makefile.in: Regenerate.
11179         * testsuite/script_test_6.sh: New file.
11180         * testsuite/script_test_6.t: Same.
11181         * testsuite/script_test_7.sh: Same.
11182         * testsuite/script_test_7.t: Same.
11183         * testsuite/script_test_8.sh: Same.
11184
11185 2009-10-16  Doug Kwan  <dougkwan@google.com>
11186
11187         * output.cc (Output_segment::set_section_list_address): Cast
11188         expressions to unsigned long long type to avoid format warnings.
11189
11190 2009-10-15  Ian Lance Taylor  <iant@google.com>
11191
11192         * script.cc (Script_options::add_symbol_assignment): Always add a
11193         dot assignment to script_sections_.
11194         * script-sections.cc (Script_sections::add_dot_assignment):
11195         Initialize if necessary.
11196
11197         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
11198         program headers with no load segment if there is a linker script.
11199
11200         * layout.cc (Layout::set_segment_offsets): Align the file offset
11201         to the segment aligment for -N or -n with no load segment.
11202         * output.cc (Output_segment::add_output_section): Don't crash if
11203         the first section is a TLS section.
11204         (Output_segment::set_section_list_addresses): Print an error
11205         message if the address moves backward in a linker script.
11206         * script-sections.cc
11207         (Output_section_element_input::set_section_addresses): Don't
11208         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
11209         (Orphan_output_section::set_section_addresses): Likewise.
11210
11211 2009-10-15  Doug Kwan  <dougkwan@google.com>
11212
11213         * layout.cc (Layout::finish_dynamic_section): Generate tags
11214         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
11215         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
11216         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
11217
11218 2009-10-14  Ian Lance Taylor  <iant@google.com>
11219
11220         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
11221         fields.
11222         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
11223         data_shdr fields of relinfo.
11224         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
11225         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
11226         R_386_TLS_LDO_32, adjust based on section flags.
11227         (Target_i386::Relocate::fix_up_ldo): Remove.
11228
11229 2009-10-13  Ian Lance Taylor  <iant@google.com>
11230
11231         Add support for -pie.
11232         * options.h (class General_options): Add -pie and
11233         --pic-executable.
11234         (General_options::output_is_position_independent): Test -pie.
11235         (General_options::output_is_executable): Return true if not shared
11236         and not relocatable.
11237         (General_options::output_is_pie): Remove.
11238         * options.cc (General_options::finalize): Reject incompatible uses
11239         of -pie.
11240         * gold.cc (queue_middle_tasks): A -pie link is not static.
11241         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
11242         * symtab.cc (Symbol::final_value_is_known): Return false if
11243         output_is_position_independent.
11244         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
11245         output_is_position_independent.
11246         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
11247         output_is_position_independent.
11248         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
11249         output_is_position_independent.
11250         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
11251         two_file_pie_test.
11252         (basic_pie_test.o, basic_pie_test): New targets.
11253         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
11254         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
11255         (two_file_pie_test): New target.
11256         * testsuite/Makefile.in: Rebuild.
11257         * README: Remove note saying that -pie is not supported.
11258
11259 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
11260
11261         * options.h (class General_options): Add -init and -fini.
11262         * layout.cc (Layout::finish_dynamic_section): Emit
11263         given init and fini functions.
11264
11265 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
11266
11267         * gc.h (gc_process_relocs): Check if icf is enabled using new
11268         function.
11269         * gold.cc (queue_initial_tasks): Likewise.
11270         (queue_middle_tasks): Likewise.
11271         * object.cc (do_layout): Likewise.
11272         * symtab.cc (is_section_folded): Likewise.
11273         * main.cc (main): Likewise.
11274         * reloc.cc (Read_relocs::run): Likewise.
11275         (Sized_relobj::do_scan_relocs): Likewise.
11276         * icf.cc (is_function_ctor_or_dtor): New function.
11277         (Icf::find_identical_sections): Check if function is ctor or dtor when
11278         safe icf is chosen.
11279         * options.h (General_options::icf): Change option to be an enum.
11280         (Icf_status): New enum.
11281         (icf_enabled): New method.
11282         (icf_safe_folding): New method.
11283         (set_icf_status): New method.
11284         (icf_status_): New variable.
11285         * (options.cc) (General_options::finalize): Set icf_status_.
11286         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
11287         icf_test and icf_keep_unique_test to use the --icf enum flag.
11288         * testsuite/icf_safe_test.sh: New file.
11289         * testsuite/icf_safe_test.cc: New file.
11290
11291 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
11292
11293         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
11294         includes to gc.h and icf.h.
11295         * arm.cc: Include gc.h.
11296         * gold.cc: Likewise.
11297         * i386.cc: Likewise.
11298         * powerpc.cc: Likewise.
11299         * sparc.cc: Likewise.
11300         * x86_64.cc: Likewise.
11301         * gc.h: Include icf.h.
11302
11303 2009-10-11  Ian Lance Taylor  <iant@google.com>
11304
11305         * plugin.cc: Include "gold.h" before other header files.
11306
11307 2009-10-10  Chris Demetriou  <cgd@google.com>
11308
11309         * options.h (Input_file_argument::Input_file_type): New enum.
11310         (Input_file_argument::is_lib_): Replace with...
11311         (Input_file_argument::type_): New member.
11312         (Input_file_argument::Input_file_argument): Take Input_file_type
11313         'type' rather than boolean 'is_lib' as second argument.
11314         (Input_file_argument::is_lib): Use type_.
11315         (Input_file_argument::is_searched_file): New function.
11316         (Input_file_argument::may_need_search): Handle is_searched_file.
11317         * options.cc (General_options::parse_library): Support -l:filename.
11318         (General_options::parse_just_symbols): Update for Input_file_argument
11319         changes.
11320         (Command_line::process): Likewise.
11321         * archive.cc (Archive::get_file_and_offset): Likewise.
11322         * plugin.cc (Plugin_manager::release_input_file): Likewise.
11323         * script.cc (read_script_file, script_add_file): Likewise.
11324         * fileread.cc (Input_file::Input_file): Likewise.
11325         (Input_file::will_search_for): Handle is_searched_file.
11326         (Input_file::open): Likewise.
11327         * readsyms.cc (Read_symbols::get_name): Likewise.
11328         * testsuite/Makefile.am (searched_file_test): New test.
11329         * testsuite/Makefile.in: Regenerate.
11330         * testsuite/searched_file_test.cc: New file.
11331         * testsuite/searched_file_test_lib.cc: New file.
11332
11333 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11334             Ian Lance Taylor  <iant@google.com>
11335
11336         * descriptor.cc: Include <cstdio> and "binary-io.h".
11337         (Descriptors::open): Open the files in binary mode always.
11338         * script.cc (Lex::get_token): Treat \r as whitespace.
11339
11340 2009-10-09  Ian Lance Taylor  <iant@google.com>
11341
11342         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
11343
11344 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11345             Ian Lance Taylor  <iant@google.com>
11346
11347         * configure.ac: Check for readv function also.
11348         * fileread.cc (readv): Define if not HAVE_READV.
11349         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
11350         does not exist.
11351         * config.in: Regenerate.
11352         * configure: Regenerate.
11353
11354 2009-10-09  Doug Kwan  <dougkwan@google.com>
11355
11356         * layout.cc (Layout::make_output_section): Call target hook to make
11357         ordinary output section.
11358         (Layout::finalize): Adjust parameter list of call the
11359         Target::may_relax().
11360         * layout.h (class Layout::section_list): New method.
11361         * merge.h (Output_merge_base::entsize): Change visibility to public.
11362         (Output_merge_base::is_string, Output_merge_base::do_is_string):
11363         New methods.
11364         (Output_merge_string::do_is_string): New method.
11365         * object.cc (Sized_relobj::do_setup): renamed from
11366         Sized_relobj::set_up.
11367         * object.h (Sized_relobj::adjust_shndx,
11368         Sized_relobj::initializ_input_to_output_maps,
11369         Sized_relobj::free_input_to_output_maps): Change visibilities to
11370         protected.
11371         (Sized_relobj::setup): Virtualize.
11372         (Sized_relobj::do_setup): New method declaration.
11373         (Sized_relobj::invalidate_section_offset,
11374         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
11375         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
11376         * options.cc (parse_int): New function.
11377         * options.h (parse_int): New declaration.
11378         (DEFINE_int): New macro.
11379         (stub_group_size): New option.
11380         * output.cc (Output_section::Output_section): Initialize memebers
11381         merge_section_map_, merge_section_by_properties_map_,
11382         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
11383         (Output_section::add_input_section): Handled deferred code-fill
11384         generation and remove an old comment.
11385         (Output_section::add_relaxed_input_section): New method definition.
11386         (Output_section::add_merge_input_section): Use merge section by
11387         properties map to speed to search.  Update merge section maps
11388         as appropriate.
11389         (Output_section::build_relaxation_map): New method definition.
11390         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
11391         Same.
11392         (Output_section::relax_input_section): Renamed to
11393         Output_section::convert_input_sections_to_relaxed_sections and change
11394         interface to take a vector of pointers to relaxed sections.
11395         (Output_section::find_merge_section,
11396         Output_section::find_relaxed_input_section): New method definitions.
11397         (Output_section::is_input_address_mapped,
11398         Output_section::output_offset, Output_section::output_address):
11399         Use output section data maps to speed up searching.
11400         (Output_section::find_starting_output_address): Add comments.
11401         (Output_section::do_write,
11402         Output_section::write_to_postprocessing_buffer): Do code-fill
11403         generation as appropriate.
11404         (Output_section::get_input_sections): Invalidate relaxed input section
11405         map.
11406         (Output_section::restore_states): Adjust type of checkpoint .
11407         Invalidate relaxed input section map.
11408         * output.h (Output_merge_base): New class declaration.
11409         (Input_section_specifier): New class defintion.
11410         (class Output_relaxed_input_section) Change base class to
11411         Output_section_data_build.
11412         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
11413         base class initializer.
11414         (Output_section::add_relaxed_input_section): New method declaration.
11415         (Output_section::Input_section): Change visibility to protected.
11416         (Output_section::Input_section::relobj,
11417         Output_section::Input_section::shndx): Handle relaxed input sections.
11418         Output_section::input_sections) Change visibility to protected.  Also
11419         define overload to return a non-const pointer.
11420         (Output_section::Merge_section_properties): New class defintion.
11421         (Output_section::Merge_section_by_properties_map,
11422         Output_section::Output_section_data_by_input_section_map,
11423         Output_section::Relaxation_map): New types.
11424         (Output_section::relax_input_section): Rename method to
11425         Output_section::convert_input_sections_to_relaxed_sections and change
11426         interface to take a vector of relaxed section pointers.
11427         (Output_section::find_merge_section,
11428         Output_section::find_relaxed_input_section,
11429         Output_section::build_relaxation_map,
11430         Output_section::convert_input_sections_in_list_to_relaxed_sections):
11431         New method declarations.
11432         (Output_section::merge_section_map_
11433         Output_section::merge_section_by_properties_map_,
11434         Output_section::relaxed_input_section_map_,
11435         Output_section::is_relaxed_input_section_map_valid_,
11436         Output_section::generate_code_fills_at_write_): New data members.
11437         * script-sections.cc
11438         (Output_section_element_input::set_section_addresses): Call
11439         current_data_size and addralign methods of relaxed input sections.
11440         (Orphan_output_section::set_section_addresses): Call current_data_size
11441         and addralign methods of relaxed input sections.
11442         * symtab.cc (Symbol_table::compute_final_value): Extract template
11443         from the body of Symbol_table::sized_finalize_symbol.
11444         (Symbol_table::sized_finalized_symbol): Call
11445         Symbol_table::compute_final_value.
11446         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
11447         (Symbol_table::compute_final_value): New templated method declaration.
11448         * target.cc (Target::do_make_output_section): New method defintion.
11449         * target.h (Target::make_output_section): New method declaration.
11450         (Target::relax): Add more parameters for input objects, symbol table
11451         and layout.  Adjust call to do_relax.
11452         (Target::do_make_output_section): New method declaration.
11453         (Target::do_relax): Add parameters for input objects, symbol table
11454         and layout.
11455
11456 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11457
11458         * pread.c: Include stdio.h.
11459
11460 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11461
11462         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
11463         defined.
11464
11465 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11466
11467         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
11468         Change read_shndx type to unsigned int.
11469         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
11470         int.
11471         (Sized_dwarf_line_info::read_line_mappings): Likewise.
11472         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
11473         Change read_shndx type to unsigned int.
11474         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
11475         int.
11476         (Sized_dwarf_line_info::read_line_mappings): Likewise.
11477         * layout.cc (Layout::create_symtab_sections): Cast the result of
11478         local_symcount * symsize to off_t in the gold_assert.
11479
11480 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11481
11482         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
11483         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
11484         R_ARM_BASE_ABS.
11485         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
11486         (Arm_relocate_functions::thm_abs5): New function.
11487         (Arm_relocate_functions::abs12): New function.
11488         (Arm_relocate_functions::abs16): New function.
11489         (Arm_relocate_functions::base_abs): New function.
11490         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
11491         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
11492         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
11493         R_ARM_BASE_ABS.
11494         (Scan::global): Likewise.
11495         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
11496         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
11497         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
11498         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
11499         R_ARM_BASE_ABS.
11500
11501 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11502
11503         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
11504         (Arm_relocate_functions::movt_prel): New function.
11505         (Arm_relocate_functions::thm_movw_prel_nc): New function.
11506         (Arm_relocate_functions::thm_movt_prel): New function.
11507         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
11508         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
11509         (Scan::global, Relocate::relocate): Likewise.
11510         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11511
11512 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
11513
11514         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
11515         Incremental_checker.
11516         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
11517         unsigned int.
11518         (class Incremental_inputs_header): New class.
11519         (Incremental_inputs_header_writer): Edit comment.
11520         (Incremental_inputs_entry): New class.
11521         (Incremental_inputs_entry_writer): Edit comment.
11522         (Sized_incremental_binary::do_find_incremental_inputs_section):
11523         Add *strtab_shndx parameter, fill it.
11524         (Sized_incremental_binary::do_check_inputs): New method.
11525         (Incremental_checker::can_incrementally_link_output_file): Use
11526         Sized_incremental_binary::check_inputs.
11527         (Incremental_inputs::report_command_line): Save command line in
11528         command_line_.
11529         * incremental.h:
11530         (Incremental_binary::find_incremental_inputs_section): New
11531         method.
11532         (Incremental_binary::do_find_incremental_inputs_section): Add
11533         strtab_shndx parameter.
11534         (Incremental_binary::do_check_inputs): New pure virtual method.
11535         (Sized_incremental_binary::do_check_inputs): Declare.
11536         (Incremental_checker::Incremental_checker): Add incremental_inputs
11537         parameter, use it to initialize incremental_inputs_.
11538         (Incremental_checker::incremental_inputs_): New field.
11539         (Incremental_checker::command_line): New method.
11540         (Incremental_checker::inputs): New method.
11541         (Incremental_checker::command_line_): New field.
11542
11543 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
11544
11545         * incremental.cc: Include <cstdarg> and "target-select.h".
11546         (vexplain_no_incremental): New function.
11547         (explain_no_incremental): New function.
11548         (Incremental_binary::error): New method.
11549         (Sized_incremental_binary::do_find_incremental_inputs_section): New
11550         method.
11551         (make_sized_incremental_binary): New function.
11552         (open_incremental_binary): New function.
11553         (can_incrementally_link_file): Add checks if output is ELF and has
11554         inputs section.
11555         * incremental.h: Include "elfcpp_file.h" and "output.h".
11556         (Incremental_binary): New class.
11557         (Sized_incremental_binary): New class.
11558         (open_incremental_binary): Declare.
11559         * object.cc (is_elf_object): Use
11560         elfcpp::Elf_recognizer::is_elf_file.
11561         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
11562         * output.h (Output_file::filesize): New method.
11563
11564 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11565
11566         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
11567         New function.
11568         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
11569         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
11570         function.
11571         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
11572         function.
11573         (Arm_relocate_functions::movw_abs_nc): New function.
11574         (Arm_relocate_functions::movt_abs): New function.
11575         (Arm_relocate_functions::thm_movw_abs_nc): New function.
11576         (Arm_relocate_functions::thm_movt_abs): New function.
11577         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
11578         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
11579         (Scan::global): Likewise.
11580         (Relocate::relocate): Likewise.
11581         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11582
11583 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11584
11585         * arm.cc (Arm_relocate_functions::got_prel) New function.
11586         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
11587         (Relocate::relocate): Likewise.
11588         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11589
11590 2009-10-06  Ian Lance Taylor  <iant@google.com>
11591
11592         * options.h (class General_options): Define
11593         split_stack_adjust_size parameter.
11594         * object.h (class Object): Add uses_split_stack_ and
11595         has_no_split_stack_ fields.  Add uses_split_stack and
11596         has_no_split_stack accessor functions.  Declare
11597         handle_split_stack_section.
11598         (class Reloc_symbol_changes): Define.
11599         (class Sized_relobj): Define Function_offsets.  Declare
11600         split_stack_adjust, split_stack_adjust_reltype, and
11601         find_functions.
11602         * object.cc (Object::handle_split_stack_section): New function.
11603         (Sized_relobj::do_layout): Call handle_split_stack_section.
11604         * dynobj.cc (Sized_dynobj::do_layout): Call
11605         handle_split_stack_section.
11606         * reloc.cc (Sized_relobj::relocate_sections): Call
11607         split_stack_adjust for executable sections in split_stack
11608         objects.  Pass reloc_map to relocate_section.
11609         (Sized_relobj::split_stack_adjust): New function.
11610         (Sized_relobj::split_stack_adjust_reltype): New function.
11611         (Sized_relobj::find_functions): New function.
11612         * target-reloc.h: Include "object.h".
11613         (relocate_section): Add reloc_symbol_changes parameter.  Change
11614         all callers.
11615         * target.h (class Target): Add calls_non_split method.  Declare
11616         do_calls_non_split virtual method.  Declare match_view and
11617         set_view_to_nop.
11618         * target.cc: Include "elfcpp.h".
11619         (Target::do_calls_non_split): New function.
11620         (Target::match_view): New function.
11621         (Target::set_view_to_nop): New function.
11622         * gold.cc (queue_middle_tasks): Give an error if mixing
11623         split-stack and non-split-stack objects with -r.
11624         * i386.cc (Target_i386::relocate_section): Add
11625         reloc_symbol_changes parameter.
11626         (Target_i386::do_calls_non_split): New function.
11627         * x86_64.cc (Target_x86_64::relocate_section): Add
11628         reloc_symbol_changes parameter.
11629         (Target_x86_64::do_calls_non_split): New function.
11630         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
11631         parameter.
11632         * powerpc.cc (Target_powerpc::relocate_section): Add
11633         reloc_symbol_changes parameter.
11634         * sparc.cc (Target_sparc::relocate_section): Add
11635         reloc_symbol_changes parameter.
11636         * configure.ac: Call AM_CONDITIONAL for the default target.
11637         * configure: Rebuild.
11638         * testsuite/Makefile.am (TEST_AS): New variable.
11639         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
11640         (check_DATA): Add split_i386 and split_x86_64 files.
11641         (SPLIT_DEFSYMS): Define.
11642         (split_i386_[1234n].o): New targets.
11643         (split_i386_[124]): New targets.
11644         (split_i386_[1234r].stdout): New targets.
11645         (split_x86_64_[1234n].o): New targets.
11646         (split_x86_64_[124]): New targets.
11647         (split_x86_64_[1234r].stdout): New targets.
11648         (MOSTLYCLEANFILES): Add new executables.
11649         * testsuite/split_i386.sh: New file.
11650         * testsuite/split_x86_64.sh: New file.
11651         * testsuite/split_i386_1.s: New file.
11652         * testsuite/split_i386_2.s: New file.
11653         * testsuite/split_i386_3.s: New file.
11654         * testsuite/split_i386_4.s: New file.
11655         * testsuite/split_i386_n.s: New file.
11656         * testsuite/split_x86_64_1.s: New file.
11657         * testsuite/split_x86_64_2.s: New file.
11658         * testsuite/split_x86_64_3.s: New file.
11659         * testsuite/split_x86_64_4.s: New file.
11660         * testsuite/split_x86_64_n.s: New file.
11661         * testsuite/testfile.cc (Target_test): Update relocation_section
11662         function.
11663         * testsuite/Makefile.in: Rebuild.
11664
11665 2009-10-06  Ian Lance Taylor  <iant@google.com>
11666
11667         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
11668         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
11669         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
11670         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
11671         the address on ldo_addrs_.
11672         (Target_i386::Relocate::fix_up_ldo): New function.
11673
11674 2009-10-06   Rafael Espindola  <espindola@google.com>
11675
11676         * plugin.cc (add_input_library): New.
11677         (Plugin::load): Add add_input_library to tv.
11678         (Plugin_manager::add_input_file): Add the is_lib argument.
11679         (add_input_file): Update call to Plugin_manager::add_input_file.
11680         (add_input_library): New.
11681         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
11682
11683 2009-09-30  Doug Kwan  <dougkwan@google.com>
11684
11685         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
11686         symbol and call Symbol::may_need_copy_reloc to determine if
11687         a copy reloc is needed.
11688         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
11689         nocopyreloc is given in command line.
11690         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
11691         given in command line.
11692         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
11693         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
11694         of the removed Target_i386::may_need_copy_reloc.
11695         * options.h (copyreloc): New option with default value false.
11696         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
11697         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
11698         instead of the removed Target_powerpc::may_need_copy_reloc.
11699         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
11700         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
11701         instead of the removed Target_sparc::may_need_copy_reloc.
11702         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
11703         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
11704         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
11705         instead of the removed Target_x86_64::may_need_copy_reloc.
11706
11707 2009-09-30  Ian Lance Taylor  <iant@google.com>
11708
11709         * object.h (class Object): Remove target_ field, and target,
11710         sized_target, and set_target methods.
11711         (Object::sized_target): Remove.
11712         (class Sized_relobj): Update declarations.  Remove sized_target.
11713         * object.cc (Sized_relobj::setup): Remove target parameter.
11714         Change all callers.
11715         (Input_objects::add_object): Don't do anything with the target.
11716         (make_elf_sized_object): Add punconfigured parameter.  Change all
11717         callers.  Set or test parameter target.
11718         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
11719         Change all callers.
11720         * parameters.cc (Parameters::set_target): Change parameter type to
11721         be non-const.
11722         (Parameters::default_target): Remove.
11723         (set_parameters_target): Change parameter type to be non-const.
11724         (parameters_force_valid_target): New function.
11725         (parameters_clear_target): New function.
11726         * parameters.h (class Parameters): Update declarations.  Remove
11727         default_target method.  Add sized_target and clear_target
11728         methods.  Change target_ to be non-const.
11729         (set_parameters_target): Update declaration.
11730         (parameters_force_valid_target): Declare.
11731         (parameters_clear_target): Declare.
11732         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
11733         as NULL if we aren't searching.
11734         (Add_symbols::run): Don't check for compatible target.
11735         * fileread.cc (Input_file::open_binary): Call
11736         parameters_force_valid_target.
11737         * gold.cc (queue_middle_tasks): Likewise.
11738         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
11739         set_target on object.
11740         * dynobj.h (class Sized_dynobj): Update declarations.
11741         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
11742         make_elf_object returns NULL.
11743         (Archive::include_member): Don't check whether object target is
11744         compatible.
11745         * output.cc (Output_section::add_input_section): Get target from
11746         parameters.
11747         (Output_section::relax_input_section): Likewise.
11748         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
11749         parameters.
11750         (Sized_relobj::do_scan_relocs): Likewise.
11751         (Sized_relobj::relocate_sections): Likewise.
11752         * resolve.cc (Symbol_table::resolve): Likewise.
11753         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
11754         parameter.  Change all callers.
11755         (Symbol_table::add_from_object): Get target from parameters.
11756         (Symbol_table::add_from_relobj): Don't check object target.
11757         (Symbol_table::add_from_dynobj): Likewise.
11758         (Symbol_table::define_special_symbol): Get target from
11759         parameters.
11760         * symtab.h (class Symbol_table): Update declaration.
11761         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
11762         parameter.  Change all callers.  Clear parameter target.
11763         (Binary_test): Test target here.
11764         * testsuite/object_unittest.cc (gold_testsuite): Remove
11765         target_test_pointer parameter.  Change all callers.
11766         (Object_test): Test target here.
11767
11768 2009-09-26  Ian Lance Taylor  <iant@google.com>
11769
11770         * testsuite/initpri1.c: Don't try to use constructor priorities if
11771         compiling with gcc before 4.3.
11772
11773 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
11774
11775         * testsuite/retain_symbols_file_test.sh (check_present): Change
11776         output file name to retain_symbols_file_test.stdout.
11777         (check_absent): Likewise.
11778
11779 2009-09-18  Craig Silverstein  <csilvers@google.com>
11780
11781         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
11782         * options.cc: Include <cerrno> and <fstream>.
11783         (General_options::finalize): Parse -retain-symbols-file tag.
11784         * options.h: New flag.
11785         (General_options): New method should_retain_symbol, new
11786         variable symbols_to_retain.
11787         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
11788         should_retain_symbol map.
11789         * testsuite/Makefile.am (retain_symbols_file_test): New test.
11790         * testsuite/Makefile.in: Regenerate.
11791         * testsuite/retain_symbols_file_test.sh: New file.
11792
11793 2009-09-18  Nick Clifton  <nickc@redhat.com>
11794
11795         * po/es.po: Updated Spanish translation.
11796
11797 2009-09-17  Doug Kwan  <dougkwan@google.com>
11798
11799         * debug.h (DEBUG_RELAXATION): New constant.
11800         (DEBUG_ALL): Add DEBUG_RELAXATION.
11801         (debug_string_to_enum): Add relaxation debug option.
11802         * layout.cc
11803         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
11804         Layout::Relaxation_debug_check::read_sections,
11805         Layout::Relaxation_debug_check::read_sections): New method definitions.
11806         (Layout::Layout): Initialize data members
11807         record_output_section_data_from_scrips_,
11808         script_output_section_data_list_ and relaxation_debug_check_.
11809         (Layout::save_segments, Layout::restore_segments,
11810         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
11811         Layout::relaxation_loop_body): New method definitions.
11812         (Layout::finalize): Support relaxation.  Move section layout code to
11813         Layout::relaxation_loop_body.
11814         (Layout::set_asection_address_from_script): Move code for orphan
11815         section placement out.
11816         (Layout::place_orphan_sections_in_script): New method definition.
11817         * layout.h (Output_segment_headers, Output_file_header):
11818         New forward class declarations.
11819         (Layout::~Layout): Define.
11820         (Layout::new_output_section_data_from_script): New method definition.
11821         (Layout::place_orphan_sections_in_script): New method declaration.
11822         (Layout::Segment_states): New type declaration.
11823         (Layout::save_segments, Layout::restore_segments,
11824         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
11825         Layout::relaxation_loop_body): New method declarations.
11826         (Layout::Output_section_data_list): New type declaration.
11827         (Layout::Relaxation_debug_check): New class definition.
11828         (Layout::record_output_section_data_from_script_,
11829         Layout::script_output_section_data_list_, Layout::segment_states_,
11830         Layout::relaxation_debug_check_): New data members.
11831         * output.cc: (Output_section_headers::do_size): New method definition.
11832         (Output_section_headers::Output_section_headers): Move size
11833         computation to Output_section_headers::do_size.
11834         (Output_segment_headers::do_size): New method definition.
11835         (Output_file_header::Output_file_header): Move size computation to
11836         Output_file_header::do_size and call it.
11837         (Output_file_header::do_size): New method definition.
11838         (Output_data_group::Output_data_group): Adjust call to
11839         Output_section_data.
11840         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
11841         (Output_symtab_xindex::do_write): Add array bound check.
11842         (Output_section::Input_section::print_to_mapfile): Handle
11843         RELAXED_INPUT_SECTION_CODE.
11844         (Output_section::Output_section): Initialize data member checkpoint_.
11845         (Output_section::~Output_section): Delete checkpoint object pointed
11846         by checkpoint_.
11847         (Output_section::add_input_section): Always add an Input_section if
11848         relaxing.
11849         (Output_section::add_merge_input_section): Add assert.
11850         (Output_section::relax_input_section): New method definition.
11851         (Output_section::set_final_data_size): Set load address to zero for
11852         an unallocated section.
11853         (Output_section::do_address_and_file_offset_have_reset_values):
11854         New method definition.
11855         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
11856         Handle relaxed input section.
11857         (Output_section::sort_attached_input_sections): Checkpoint input
11858         section list lazily.
11859         (Output_section::get_input_sections): Change type of input_sections to
11860         list of Simple_input_section pointers.  Checkpoint input section list
11861         lazily.  Also handle relaxed input sections.
11862         (Output_section::add_input_section_for_script): Take a reference to
11863         a Simple_input_section object instead of Relobj pointer and section
11864         index as parameter.  Handle relaxed input sections.
11865         (Output_section::save_states, Output_section::restore_states): New
11866         method definitions.
11867         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
11868         (Output_data::is_data_size_fixed): New method definition.
11869         (Output_data::reset_addresss_and_file_offset): Do not reset data size
11870         if it is fixed.
11871         (Output_data::address_and_file_offset_have_reset_values): New method
11872         definition.
11873         (Output_data::do_address_and_file_offset_have_reset_values): New method
11874         definition.
11875         (Output_data::set_data_size): Check that data size is not fixed.
11876         (Output_data::fix_data_size): New method definition.
11877         (Output_data::is_data_size_fixed_): New data member.
11878         (Output_section_headers::set_final_data_size): New method definition.
11879         (Output_section_headers::do_size): New method declaration.
11880         (Output_segment_headers::set_final_data_size): New method definition.
11881         (Output_segment_headers::do_size): New method declaration.
11882         (Output_file_header::set_final_data_size)::New method definition.
11883         (Output_file_header::do_size)::New method declaration.
11884         (Output_section_data::Output_section_data): Add new parameter
11885         is_data_size_fixed and use it to fix data size.
11886         (Output_data_const::Output_data_const): Adjust call to base class
11887         constructor and fix data size.
11888         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
11889         base class constructor and fix data size.
11890         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
11891         base class constructor and fix data size.
11892         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
11893         class constructor and fix data size.
11894         (Output_data_group::set_final_data_size): New method definition.
11895         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
11896         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
11897         class constructor and fix data size.
11898         (Output_relaxed_input_section): New class definition.
11899         (Output_section::Simple_input_section): New class definition.
11900         (Output_section::get_input_sections): Adjust parameter list.
11901         (Output_section::add_input_section_for_script): Same.
11902         (Output_section::save_states, Output_section::restore_states,
11903         Output_section::do_address_and_file_offset_have_reset_values,
11904         (Output_section::Input_section::Input_section): Handle
11905         RELAXED_INPUT_SECTION_CODE.  Add new overload for
11906         Output_relaxed_input_section.
11907         (Output_section::Input_section::is_input_section,
11908         Output_section::Input_section::set_output_section): Handle relaxed
11909         input section.
11910         (Output_section::Input_section::is_relaxed_input_section,
11911         Output_section::Input_section::output_section_data,
11912         Output_section::Input_section::relaxed_input_section): New method
11913         definitions.
11914         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
11915         value.
11916         (Output_section::Input_section::u1_): Update comments.
11917         (Output_section::Input_section::u2_): Add new union member poris.
11918         (Output_section::Checkpoint_output_section): New classs definition.
11919         (Output_section::relax_input_section): New method declaration.
11920         (Output_section::checkpoint_): New data member.
11921         (Output_segment): Update comments.
11922         (Output_segment::Output_segment): Un-privatize copy constructor.
11923         (Output_segment::operator=): Un-privatize.
11924         * script-sections.cc (Output_section_element::Input_section_list):
11925         Change element type to Output_section::Simple_input_section.
11926         (Output_section_element_dot_assignment::set_section_addresses):
11927         Register output section data for relaxation clean up.
11928         (Output_data_exression::Output_data_expression): Adjust call to base
11929         constructor to fix data size.
11930         (Output_section_element_data::set_section_addresses): Register
11931         Output_data_expression object for relaxation clean up.
11932         (struct Input_section_info): Replace Relobj pointer and section index
11933         pair with Output_section::Simple_input_section and Convert struct to a
11934         class.
11935         (Input_section_sorter::operator()): Adjust access to
11936         Input_section_info data member to use accessors.
11937         (Output_section_element_input::set_section_addresses): Use layout
11938         parameter.  Adjust code to use Output_section::Simple_input_section
11939         and Input_secction_info classes.  Register filler for relaxation
11940         clean up.
11941         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
11942         and section index pair with Output_section::Simple_input_section
11943         class.  Adjust code accordingly.
11944         (Phdrs_element::release_segment): New method definition.
11945         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
11946         segment list.
11947         (Script_sections::release_segments): New method definition.
11948         * gold/script-sections.h (Script_sections::release_segments): New
11949         method declaration.
11950         * gold/target.h (Target::may_relax, Target::relax,
11951         Target::do_may_relax, Target::do_relax): New method definitions.
11952
11953 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11954
11955         * arm.cc (has_signed_unsigned_overflow): New function.
11956         (Arm_relocate_functions::abs8): New function.
11957         (Target_arm::Scan::local): Handle R_ARM_ABS8.
11958         (Target_arm::Scan::global): Likewise.
11959         (Target_arm::relocate::relocate): Likewise.
11960         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
11961         Likewise.
11962
11963 2009-09-16  Cary Coutant  <ccoutant@google.com>
11964
11965         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
11966         * testsuite/Makefile.in: Regenerate.
11967
11968 2009-09-11  Nick Clifton  <nickc@redhat.com>
11969
11970         * po/gold.pot: Updated by the Translation project.
11971
11972 2009-09-08  Cary Coutant  <ccoutant@google.com>
11973
11974         * output.cc (Output_file::open): Add execute permission to empty file.
11975         * testsuite/Makefile.am (permission_test): New test.
11976         * testsuite/Makefile.in: Regenerate.
11977
11978 2009-09-02  Ian Lance Taylor  <iant@google.com>
11979
11980         * output.cc (Output_file::resize): Call map_no_anonymous rather
11981         than map.
11982
11983 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
11984
11985         * gold.cc: Include "incremental.h".
11986         (queue_initial_tasks): Call Incremental_checker methods.
11987         * incremental.cc: Include "output.h".
11988         (Incremental_checker::can_incrementally_link_output_file): New
11989         method.
11990         * incremental.h (Incremental_checker): New class.
11991
11992         * output.cc (Output_file::open_for_modification): New method.
11993         (Output_file::map_anonymous): Changed return type to bool.  Record
11994         map in base_ field.
11995         (Output_file::map_no_anonymous): New method, broken out of map.
11996         (Output_file::map): Use map_no_anonymous and map_anonymous.
11997         * output.h (class Output_file): Update declarations.
11998
11999 2009-08-24  Cary Coutant  <ccoutant@google.com>
12000
12001         * options.h (Command_line::Pre_options): New class.
12002         (Command_line::pre_options): New member.
12003         * options.cc (gold::options::ready_to_register): New variable.
12004         (One_option::register_option): Do nothing if not registering options.
12005         Assert if same short option registered twice.
12006         (General_options::General_options): Turn off option registration when
12007         done constructing.
12008         (Command_line::Pre_options::Pre_options): New constructor.
12009
12010 2009-08-24  Cary Coutant  <ccoutant@google.com>
12011
12012         * options.h (General_options::no_keep_memory): Remove incorrect
12013         short option.
12014
12015 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
12016
12017         * Makefile.am (am__skiplex, am__skipyacc): New.
12018         * Makefile.in: Regenerate.
12019
12020 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
12021
12022         * Makefile.am (AM_CPPFLAGS): Renamed from ...
12023         (INCLUDES): ... this.
12024         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
12025         (AM_CPPFLAGS): Renamed from ...
12026         (INCLUDE): ... this.
12027         * Makefile.in, testsuite/Makefile.in: Regenerate.
12028
12029         * Makefile.in: Regenerate.
12030         * aclocal.m4: Likewise.
12031         * config.in: Likewise.
12032         * configure: Likewise.
12033         * testsuite/Makefile.in: Likewise.
12034
12035         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
12036         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
12037         * Makefile.in: Regenerate.
12038         * testsuite/Makefile.in: Regenerate.
12039
12040 2009-08-19  Cary Coutant  <ccoutant@google.com>
12041
12042         * resolve.cc (Symbol_table::resolve): Don't complain about defined
12043         symbols in shared libraries overridden by hidden or internal symbols
12044         in the main program.
12045
12046 2009-08-19  Chris Demetriou  <cgd@google.com>
12047
12048         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
12049         checking source file names in error messages.
12050
12051 2009-08-18  Doug Kwan  <dougkwan@google.com>
12052
12053         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
12054         an elcpp::Ehdr as parameter.  Adjust call to set_target.
12055         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
12056         an elfcpp::Ehdr as parameter.
12057         * object.cc (Object::set_target): Remove the version that looks up
12058         a target and sets it.
12059         (Sized_relobj::setup): Take a Target object instead of
12060         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
12061         (make_elf_sized_object): Find target and ask target to
12062         make an ELF object.
12063         * object.h: (Object::set_target): Remove the version that looks up
12064         a target and sets it.
12065         (Sized_relobj::setup): Take a Target object instead of
12066         an elfcpp:Ehdr as parameter.
12067         * target.cc: Include dynobj.h.
12068         (Target::do_make_elf_object_implementation): New.
12069         (Target::do_make_elf_object): New.
12070         * target.h (Target::make_elf_object): New template declaration.
12071         (Target::do_make_elf_object): New method declarations.
12072         (Target::do_make_elf_object_implementation): New template declaration.
12073
12074 2009-08-14  Ian Lance Taylor  <iant@google.com>
12075
12076         * gold.h (FUNCTION_NAME): Define.
12077         (gold_unreachable): Use FUNCTION_NAME.
12078
12079 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
12080
12081         * icf.cc (Icf::find_identical_sections): Issue a warning when a
12082         symbol in the --keep-unique list is not found.
12083
12084 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
12085
12086         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
12087         been maked as --keep-unique.
12088         (Icf::unfold_section): New function.
12089         * icf.h (Icf::unfold_section): New function.
12090         * options.h (General_options::keep_unique): New option.
12091         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
12092         * testsuite/Makefile.in: Regenerate.
12093         * testsuite/icf_keep_unique_test.sh: New file.
12094         * testsuite/icf_keep_unique_test.cc: New file.
12095
12096 2009-08-12  Cary Coutant  <ccoutant@google.com>
12097
12098         PR 10471
12099         * resolve.cc (Symbol_table::resolve): Check for references from
12100         dynamic objects to hidden and internal symbols.
12101         * testsuite/Makefile.am (hidden_test.sh): New test.
12102         * testsuite/Makefile.in: Regenerate.
12103         * testsuite/hidden_test.sh: New script.
12104         * testsuite/hidden_test_1.c: New test source.
12105         * testsuite/hidden_test_main.c: New test source.
12106
12107 2009-08-11  Doug Kwan  <dougkwan@google.com>
12108
12109         * arm.cc: Update comments.
12110         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
12111         segment to locate the .ARM.exidx section if present.
12112
12113 2009-08-09  Doug Kwan  <dougkwan@google.com>
12114
12115         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
12116         patch.
12117
12118 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
12119         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
12120         compiler warnings.
12121
12122 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
12123
12124         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
12125         valid tls_segment only for non-debug-section relocations.
12126         * testsuite/Makefile.am: Add gc_tls_test.
12127         * testsuite/Makefile.in: Regenerate.
12128         * testsuite/gc_tls_test.cc: New file.
12129         * testsuite/gc_tls_test.sh: New file.
12130
12131 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
12132
12133         * icf.cc: New file.
12134         * icf.h: New file.
12135         * Makefile.am (CCFILES): Add icf.cc.
12136         (HFILES): Add icf.h
12137         * Makefile.in: Regenerate.
12138         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
12139         * gc.h (gc_process_relocs): Populate lists used by icf to contain
12140         section, symbol and addend information for the relocs.
12141         * gold.cc (queue_middle_tasks): Call identical code folding.
12142         * gold.h: Add defines for multimap.
12143         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
12144         to the call of finalize_local_symbols.
12145         * main.cc (main): Create object of class Icf.
12146         * object.cc (Sized_relobj::do_layout): Allow this function to be
12147         called twice during icf.
12148         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
12149         to sections marked as identical by icf.
12150         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
12151         when available.
12152         (Sized_relobj::do_section_entsize): New function.
12153         * object.h (Object::section_entsize): New function.
12154         (Object::do_section_entsize): New pure virtual function.
12155         (Relobj::finalize_local_symbols): Add new parameter.
12156         (Relobj::do_section_entsize): New function.
12157         * options.h (General_options::icf): New option.
12158         (General_options::icf_iterations): New option.
12159         (General_options::print_icf_sections): New option.
12160         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
12161         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
12162         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
12163         icf.
12164         * symtab.cc (Symbol_table::is_section_folded): New function.
12165         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
12166         to sections marked as identical by icf.
12167         * symtab.h (Symbol_table::set_icf): New function.
12168         (Symbol_table::icf): New function.
12169         (Symbol_table::is_section_folded): New function.
12170         (Symbol_table::icf_): New data member.
12171         * target-reloc.h (relocate_section): Ignore sections folded by icf.
12172         * testsuite/Makefile.am: Add commands to build icf_test.
12173         * testsuite/Makefile.in: Regenerate.
12174         * testsuite/icf_test.sh: New file.
12175         * testsuite/icf_test.cc: New file.
12176
12177 2009-07-24  Chris Demetriou  <cgd@google.com>
12178
12179         * layout.cc (is_compressible_debug_section): Fix incorrect
12180         comment about compressed section names.
12181
12182 2009-07-20  Ian Lance Taylor  <ian@airs.com>
12183
12184         PR 10419
12185         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
12186
12187 2009-07-16  Ian Lance Taylor  <iant@google.com>
12188
12189         PR 10400
12190         * layout.h: #include <map>.
12191         (class Kept_section): Change from struct to class.  Add accessors
12192         and setters.  Add section size to Comdat_group mapping.  Change
12193         Comdat_group to std::map.  Add is_comdat_ field.  Add
12194         linkonce_size field in union.
12195         (class Layout): Update declaration of find_or_add_kept_section.
12196         Don't declare find_kept_object.
12197         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
12198         parameter.  Add object, shndx, is_comdat, and is_group_name
12199         parameters.  Change all callers.  Adjust for new Kept_section.
12200         (Layout::find_kept_object): Remove.
12201         * object.cc (Sized_relobj::include_section_group): Update use of
12202         Kept_section.  Rename secnum to shndx.  Only record
12203         Kept_comdat_section if sections are the same size.
12204         (Sized_relobj::include_linkonce_section): Update use of
12205         Kept_section.  Only record Kept_comdat_section if sections are the
12206         same size.  Set size of linkonce section.
12207         (Sized_relobj::map_to_kept_section): Update call to
12208         get_kept_comdat_section.
12209         * object.h (class Sized_relobj): Rename fields in
12210         Kept_comdat_section to drop trailing underscores; change object
12211         field to Relobj*.  Change Kept_comdat_section_table to store
12212         struct rather than pointer.
12213         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
12214         Add kept_object and kept_shndx parameters.  Change all callers.
12215         (Sized_relobj::get_kept_comdat_section): Change return type to
12216         bool.  Add kept_object and kept_shndx parameters.  Change all
12217         callers.
12218         * plugin.cc (Pluginobj::include_comdat_group): Update call to
12219         Layout::find_or_add_kept_section.
12220
12221 2009-07-09  Ian Lance Taylor  <iant@google.com>
12222
12223         * merge.cc (Object_merge_map::initialize_input_to_output_map):
12224         Reserve space in the hash table.
12225
12226 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
12227
12228         * fileread.cc (File_read::get_mtime): New method.
12229         * fileread.h (Timespec): New structure.
12230         (File_read::get_mtime): New method.
12231         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
12232         Renamed from timestamp_nsec.
12233         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
12234         Elf_Xword.
12235         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
12236         timestamp_nsec.
12237         (Incremental_inputs::report_archive): Save mtime; style fix.
12238         (Incremental_inputs::report_obejct): Save mtime; style fix.
12239         (Incremental_inputs::report_script): Save mtime; style fix.
12240         (Incremental_inputs::finalize_inputs): Style fix.
12241         (Incremental_inputs::finalize): Style fix.
12242         (Incremental_inputs::create_input_section_data): Store inputs
12243         mtime.
12244         * incremental.h (Incremental_inputs::report_script): Add mtime
12245         argument.
12246         (Incremental_inputs::Input_info::Input_info): Intialize only one
12247         union member.
12248         (Incremental_inputs::Input_info::archive): Move to nameless
12249         union.
12250         (Incremental_inputs::Input_info::obejct): Move to nameless union.
12251         (Incremental_inputs::Input_info::script): Move to nameless union.
12252         (Incremental_inputs::mtime): New field.
12253         * script.cc (read_input_script): Pass file mtime to
12254         Incremental_input.
12255         * script.h (Script_info::inputs): Style fix.
12256
12257 2009-07-01  Ian Lance Taylor  <ian@airs.com>
12258
12259         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
12260         instead of 32.
12261
12262 2009-06-24  Ian Lance Taylor  <iant@google.com>
12263
12264         PR 10156
12265         * layout.cc (Layout::choose_output_section): If we find an
12266         existing section, update the flags.
12267         (Layout::create_notes): New function, broken out of
12268         Layout::finalize.
12269         (Layout::finalize): Don't create note sections.
12270         (Layout::create_note): Don't crash if linker script discards
12271         section.
12272         (Layout::create_gold_note): Likewise.
12273         (Layout::create_build_id): Likewise.  Don't set
12274         after_input_sections on the section.
12275         (Layout::create_executable_stack_info): Remove target parameter.
12276         Change caller.
12277         * layout.h (class Layout): Declare create_notes.  Update
12278         declaration of create_executable_stack_info.
12279         * gold.cc (queue_middle_tasks): Call create_notes.
12280         * output.cc (Output_section::update_flags_for_input_section): Move
12281         here from output.h.  If SHF_ALLOC flag is newly set, mark address
12282         invalid.
12283         * output.h (Output_data::mark_address_invalid): New function.
12284         (class Output_section): Only declare, not define,
12285         update_flags_for_input_section.  Remove set_flags.
12286
12287 2009-06-24  Ian Lance Taylor  <iant@google.com>
12288
12289         * script-sections.cc (Output_section_definition::
12290         set_section_addresses): Rename shadowing local load_address to
12291         laddr.
12292
12293 2009-06-24  Ian Lance Taylor  <iant@google.com>
12294
12295         PR 10244
12296         * reloc.cc (relocate_sections): Skip empty relocation sections.
12297
12298 2009-06-23  Ian Lance Taylor  <iant@google.com>
12299
12300         PR 10156
12301         * layout.cc (Layout::create_note): Use choose_output_section
12302         rather than make_output_section.
12303
12304 2009-06-23  Ian Lance Taylor  <iant@google.com>
12305
12306         PR 10237
12307         * options.cc (General_options::parse_V): Set printed_version_.
12308         (General_options::General_options): Initialize printed_version_.
12309         * options.h (class General_options): Add printed_version_ field.
12310         * gold.cc (queue_initial_tasks): If there are no input files,
12311         don't give a fatal error if we printed the version information.
12312         (queue_middle_tasks): If using -r with a shared object, give a
12313         fatal error rather than an ordinary error.
12314
12315 2009-06-23  Ian Lance Taylor  <iant@google.com>
12316
12317         PR 10219
12318         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
12319         (Layout::make_output_section): Set have_stabstr_section_ if we see
12320         a .stab*str section.
12321         (Layout::finalize): Call link_stabs_sections.
12322         (Layout::link_stabs_sections): New file.
12323         * layout.h (class Layout): Add have_stabstr_section_ field.
12324         Declare link_stabs_sections.
12325
12326 2009-06-23  Doug Kwan  <dougkwan@google.com>
12327
12328         * Makefile.am (libgold_a_LIBADD): New.
12329         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
12330         * Makefile.in: Regenerate.
12331         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
12332         * configure: Regenerate.
12333         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
12334         * fileread.cc: Include sys/state.h
12335         * gold.h: Declare memmem and strndup if found missing.
12336         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
12337
12338 2009-06-23  Ian Lance Taylor  <iant@google.com>
12339
12340         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
12341         * configure: Rebuild.
12342
12343 2009-06-23  Ian Lance Taylor  <iant@google.com>
12344
12345         PR 10147
12346         * object.cc (Object::section_contents): Don't try to get a view if
12347         the section has length zero.
12348         (Object::handle_gnu_warning_section): If the section is empty, use
12349         the name of the section as the warning.
12350
12351 2009-06-23  Ian Lance Taylor  <iant@google.com>
12352
12353         PR 10133
12354         * stringpool.h (class Stringpool_template): Add optimize_ field.
12355         (Stringpool_template::set_optimize): New function.
12356         * stringpool.cc (Stringpool_template::Stringpool_template):
12357         Initialize optimize_ field.
12358         (Stringpool_template::set_string_offsets): Test local optimize
12359         fild rather than parameter.
12360         * layout.cc (Layout::Layout): Call set_optimize on the section
12361         name stringpool.
12362
12363 2009-06-22  Ian Lance Taylor  <iant@google.com>
12364
12365         PR 10030
12366         * yyscript.y: Parse TARGET.
12367         * script.cc (script_set_target): New function.
12368         * script-c.h (script_set_target): Declare.
12369         * options.cc (General_options::string_to_object_format): Rename
12370         from string_to_object_format in anonymous namespace.  Change
12371         callers.
12372         * options.h (class General_options): Declare
12373         string_to_object_format.
12374
12375 2009-06-22  Ian Lance Taylor  <iant@google.com>
12376
12377         * script-sections.cc (Script_sections::create_segments): Don't put
12378         program headers in a PT_LOAD segment if -n or -N.
12379
12380 2009-06-22  Ian Lance Taylor  <iant@google.com>
12381
12382         PR 10141
12383         * options.h (class General_options): Add -z lazy and -z now.  Sort
12384         -z options into alphabetical order.
12385         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
12386
12387 2009-06-21  Ian Lance Taylor  <iant@google.com>
12388
12389         * layout.cc (Layout::make_output_section): Call
12390         Target::new_output_section.
12391         (Layout::attach_allocated_section_to_segment): Put large section
12392         sections in a separate load segment with the large segment flag
12393         set.
12394         (Layout::segment_precedes): Sort large data segments after other
12395         load segments.
12396         (align_file_offset): New static function.
12397         (Layout::set_segment_offsets): Use align_file_offset.
12398         * output.h (class Output_section): Add is_small_section_ and
12399         is_large_section_ fields.
12400         (Output_section::is_small_section): New function.
12401         (Output_section::set_is_small_section):  New function.
12402         (Output_section::is_large_section): New function.
12403         (Output_section::set_is_large_section): New function.
12404         (Output_section::is_large_data_section): New function.
12405         (class Output_segment): Add is_large_data_segment_ field.
12406         (Output_segment::is_large_data_segment): New function.
12407         (Output_segment::set_is_large_data_segment): New function.
12408         * output.cc (Output_section::Output_section): Initialize new
12409         fields.
12410         (Output_segment::Output_segment): Likewise.
12411         (Output_segment::add_output_section): Add assertion that large
12412         data sections always go in large data segments.  Force small data
12413         sections to the end of the list of data sections.  Force small BSS
12414         sections to the start of the list of BSS sections.  For large BSS
12415         sections to the end of the list of BSS sections.
12416         * symtab.h (class Symbol): Declare is_common_shndx.
12417         (Symbol::is_defined): Check Symbol::is_common_shndx.
12418         (Symbol::is_common): Likewise.
12419         (class Symbol_table): Define enum Commons_section_type.  Update
12420         declarations.  Add small_commons_ and large_commons_ fields.
12421         * symtab.cc (Symbol::is_common_shndx): New function.
12422         (Symbol_table::Symbol_table): Initialize new fields.
12423         (Symbol_table::add_from_object): Put small and large common
12424         symbols in the right list.
12425         (Symbol_table::sized_finalized_symbol): Check
12426         Symbol::is_common_shndx.
12427         (Symbol_table::sized_write_globals): Likewise.
12428         * common.cc (Symbol_table::do_allocate_commons): Allocate new
12429         common symbol lists.  Don't call do_allocate_commons_list if the
12430         list is empty.
12431         (Symbol_table::do_allocate_commons_list): Remove is_tls
12432         parameter.  Add comons_section_type parameter.  Change all
12433         callers.  Handle small and large common symbols.
12434         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
12435         Symbol::is_common_shndx.
12436         * resolve.cc (symbol_to_bits): Likewise.
12437         * target.h (Target::small_common_shndx): New function.
12438         (Target::small_common_section_flags): New function.
12439         (Target::large_common_shndx): New function.
12440         (Target::large_common_section_flags): New function.
12441         (Target::new_output_section): New function.
12442         (Target::Target_info): Add small_common_shndx, large_common_shndx,
12443         small_common_section_flags, and large_common_section_flags
12444         fields.
12445         (Target::do_new_output_section): New virtual function.
12446         * arm.cc (Target_arm::arm_info): Initialize new fields.
12447         * i386.cc (Target_i386::i386_info): Likewise.
12448         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
12449         Likewise.
12450         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
12451         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
12452         (Target_x86_64::do_new_output_section): New function.
12453         * configure.ac: Define conditional MCMODEL_MEDIUM.
12454         * testsuite/Makefile.am (check_PROGRAMS): Add large.
12455         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
12456         (large_LDFLAGS): Define.
12457         * testsuite/large.c: New file.
12458         * testsuite/testfile.cc (Target_test::test_target_info):
12459         Initialize new fields.
12460         * configure, testsuite/Makefile.in: Rebuild.
12461
12462 2009-06-05  Doug Kwan  <dougkwan@google.com>
12463
12464         * Makefile.am (CCFILES): Add target.cc.
12465         * Makefile.in: Regenerate.
12466         * i386.cc (class Target_i386): Define new virtual method to
12467         override do_is_local_label_name in parent.
12468         * object.cc (Sized_relobj::do_count_local_symbols): Discard
12469         local symbols if --discard-locals or -X is given.
12470         * options.h (class General_options): Declare new options
12471         '--discard-locals' and '-X' for discarding locals.
12472         * target.h (class Target): Define new methods is_local_label_name.
12473         Declare new virtual method do_is_local_label_name.
12474         * target.cc: New file.
12475         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
12476         (check_SCRIPTS): Add discard_locals_test.sh.
12477         (check_DATA): Add discard_local_tests.syms.
12478         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
12479         (discard_local_tests.syms, discard_locals_test.o): New make rules.
12480         * testsuite/Makefile.in: Regenerate.
12481         * testsuite/discard_locals_test.c: New file.
12482         * testsuite/discard_locals_test.sh: Same.
12483
12484 2009-06-05  Doug Kwan  <dougkwan@google.com>
12485
12486         * object.cc (Sized_relobj::Sized_relobj): Initialize
12487         discarded_eh_frame_shndx_ to -1U.
12488         (Sized_relobj::do_layout): Record index of a discard .eh_frame
12489         section.
12490         (Sized_relobj::do_count_local_symbols): Skip local symbols in
12491         a discarded .eh_frame section.
12492         (Sized_relobj::do_finalize_local_symbols): Ditto.
12493         * object.h (class Sized_relobj): Declare new member
12494         discarded_eh_frame_shndx_.
12495         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
12496         (local_labels_test.o, local_labels_test): New rules.
12497         * testsuite/Makefile.in: Regenerate.
12498
12499 2009-06-04  Doug Kwan  <dougkwan@google.com>
12500
12501         * layout.cc (Layout::section_name_mapping): Add mapping for
12502         special ARM sections.
12503
12504 2009-06-03  Doug Kwan  <dougkwan@google.com>
12505
12506         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
12507         (utils::has_overflow): Same.
12508
12509 2009-06-03  Ian Lance Taylor  <iant@google.com>
12510
12511         * layout.cc (Layout::section_name_mapping): New array, replacing
12512         Layout::linkonce_mapping.
12513         (Layout::section_name_mapping_count): New variable, replacing
12514         Layout::linkonce_mapping_count.
12515         (Layout::linkonce_output_name): Remove.
12516         (Layout::output_section_name): Rewrite.
12517         * layout.h (class Layout): Rename Linkonce_mapping to
12518         Section_name_mapping, linkonce_mapping to section_name_mapping,
12519         linkonce_mapping_count to section_name_mapping_count.  Don't
12520         declare linkonce_output_name.
12521
12522 2009-06-03  Doug Kwan  <dougkwan@google.com>
12523
12524         * gold/arm.cc (namespace utils): New.
12525         (Target_arm::reloc_is_non_pic): Define new method.
12526         (class Arm_relocate_functions): New.
12527         (Target_arm::Relocate::relocate): Handle relocation types used by
12528         Android.
12529
12530 2009-06-03  Ian Lance Taylor  <iant@google.com>
12531
12532         * arm.cc (Target_arm::scan::global): Use || instead of |.
12533
12534 2009-06-02  Doug Kwan  <dougkwan@google.com>
12535
12536         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
12537         issued_non_pic_error_.
12538         (class Target_arm::Scan): Declare new method check_non_pic.
12539         Define new method symbol_needs_plt_entry.
12540         Declare new data member issued_non_pic_error_.
12541         (class Target_arm::Relocate): Declare new method
12542         should_apply_static_reloc.
12543         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
12544         (Target_arm::Scan::check_non_pic): Define new method.
12545         (Target_arm::Scan::local): Handle a small subset of reloc types used
12546         by Android.
12547         (Target_arm::Scan::local): Same.
12548         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
12549
12550 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
12551
12552         * incremental.cc (Incremental_inputs::report_command_line): Filter
12553         out --incremental-* options.
12554
12555 2009-05-29  Doug Kwan  <dougkwan@google.com>
12556
12557         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
12558         template class.
12559         (class Target_arm): Update comment.
12560         (Target_arm::Target_arm): Initialize new data members GOT_,
12561         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
12562         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
12563         and Target_arm::rel_dyn_section.
12564         Declare new_enum Target_arm::Got_type.
12565         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
12566         and DYNBSS_.
12567         Update commments for member do_dynsym_value.
12568         (Target_arm::got_size, Target_arm::plt_section,
12569         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
12570         new methods inside class defintion.
12571         (Target_arm::got_section): Define new method.
12572         (Target_arm::rel_dyn_section): Same.
12573         (Output_data_plt_arm): New template class.
12574         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
12575         (Output_data_plt_arm:do_adjust_output_section): Define new method.
12576         (Output_data_plt_arm::add_entry): Same.
12577         (Output_data_plt_arm::first_plt_entry): Define new
12578         static data member for PLT instruction template.
12579         (Output_data_plt_arm::plt_entry): Same.
12580         (Output_data_plt_arm::do_write): Define new method.
12581         (Target_arm::make_plt_entry): Same.
12582         (Target_arm::do_finalize_sections): Same.
12583         (Target_arm::do_dynsym_value): Same.
12584
12585 2009-05-28  Doug Kwan  <dougkwan@google.com>
12586
12587         * Makefile.am (TARGETSOURCES): Add arm.cc.
12588         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
12589         * Makefile.in: Regenerate.
12590         * arm.cc: New file.
12591         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
12592
12593 2009-05-26  Doug Kwan  <dougkwan@google.com>
12594
12595         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
12596         (General_options::check_excluded_libs): Strip off directories in
12597         archive name before matching like GNU ld does.
12598         * testsuite/Makefile.am (MOSTLYCLEANFILES,
12599         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
12600         (exclude_libs_test_LDFLAGS): Add linker option
12601         -Wl,--exclude-libs,libexclude_libs_test_3
12602         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
12603         an explicit archive without using -l.
12604         (alt/libexclude_libs_test_3.a): New make rule.
12605         * testsuite/Makefile.in: Regenerate.
12606         * testsuite/exclude_libs_test.c : Declare lib3_default().
12607         (main): Call it.
12608         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
12609         * exclude_libs_test_3.c: New file.
12610
12611 2009-05-26  Nick Clifton  <nickc@redhat.com>
12612
12613         * po/id.po: New Indonesian translation.
12614         * po/gold.pot: Updated template file.
12615
12616 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
12617
12618         * testsuite/Makefile.am: Add -ffunction-sections to compile
12619         gc_comdat_test files.  Add -Wl,--gc-sections to build
12620         gc_comdat_test.
12621         * testsuite/Makefile.in: Regenerate.
12622         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
12623
12624 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
12625
12626         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
12627         kept comdat section was garbage collected.
12628         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
12629         * testsuite/Makefile.in: Regenerate.
12630         * testsuite/gc_comdat_test.sh: New file.
12631         * testsuite/gc_comdat_test_1.cc: New file.
12632         * testsuite/gc_comdat_test_2.cc: New file.
12633
12634 2009-05-19  Doug Kwan  <dougkwan@google.com>
12635
12636         * archive.cc (Archive::Archive): Move constructor from archive.h
12637         to here.  Initialize no_export_.
12638         (Archive::get_elf_object_for_member): Set no_export flag of object.
12639         * archive.h (Archive::Archive): Move constructor body to
12640         archive.cc.
12641         (Archive::no_export): New method.
12642         (Archive::no_export_): New field.
12643         * object.h (Object::Object): Initialize no_export_ to false.
12644         (Object::no_export, Object::set_no_export): New methods.
12645         (Object::no_export_): New field.
12646         * options.cc (General_options::parse_exclude_libs): New method.
12647         (General_options::check_excluded_libs) Same.
12648         * options.h (exclude_libs): New option.
12649         (General_options::check_excluded_libs): New method declaration.
12650         (General_options::excluded_libs_): New field.
12651         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
12652         default or protected visibility if an object has no-export flag set.
12653         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
12654         (check_SCRIPTS): Add exclude_libs_test.sh.
12655         (check_DATA): Add exclude_libs_test.syms.
12656         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
12657         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
12658         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
12659         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
12660         (exclude_libs_test.syms, libexclude_libs_test_1.a,
12661         libexclude_libs_test_2.a): New rules.
12662         * testsuite/Makefile.in: Regenerate.
12663         * testsuite/exclude_libs_test.c: New file.
12664         * testsuite/exclude_libs_test.sh: Ditto.
12665         * testsuite/exclude_libs_test_1.c: Ditto.
12666         * testsuite/exclude_libs_test_2.c: Ditto.
12667
12668 2009-05-15  Ian Lance Taylor  <iant@google.com>
12669
12670         * configure.ac: Check for declarations for cases where libiberty.h
12671         checks HAVE_DECL_xxx.
12672         * configure, config.in: Rebuild.
12673
12674 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
12675
12676         * gold.h (Incremental_argument_list): Remove (invalid) forward
12677         declaration.
12678         * incremental.cc (Incremental_inputs::report_achive): New method.
12679         (Incremental_inputs::report_object): New method.
12680         (Incremental_inputs::report_script): New method.
12681         (Incremental_inputs::finalize_inputs): New method.
12682         (Incremental_inputs::finalize): Call finalize_inputs().
12683         (Incremental_inputs::sized_create_incremental_inputs_section_data):
12684         Create inputs entries.
12685         * incremental.h (Incremental_input_type): New enum.
12686         (Incremental_inputs::Incremental_input): Initialize new fields.
12687         (Incremental_inputs::report_inputs): New method.
12688         (Incremental_inputs::report_achive): New method.
12689         (Incremental_inputs::report_object): New method.
12690         (Incremental_inputs::report_script): New method.
12691         (Incremental_inputs::finalize_inputs): New method.
12692         (Incremental_inputs::Input_info): New struct.
12693         (Incremental_inputs::Input_info_map): New typedef.
12694         (Incremental_inputs::lock_): New field.
12695         (Incremental_inputs::Inputs_): New field.
12696         (Incremental_inputs::Inputs_map): New field.
12697         * main.cc (main): Call Incremental_input::report_inputs.
12698         * options.h (Input_argument_list): Typedef moved from
12699         Input_arguments.
12700         (Input_file_group::Files): Remove, use ::Input_argument_list.
12701         (Input_file_group::Input_argument_list): Remove, use
12702         ::Input_argument_list.
12703         * plugin.cc (Plugin_manager::add_input_file): Add error in
12704         incremental build.
12705         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
12706         functions.
12707         * script.cc (read_input_script): Call
12708         Incremental_input::report_script.
12709         * script.h (Script_info): New class.
12710
12711 2009-04-27  Ian Lance Taylor  <iant@google.com>
12712
12713         * x86_64.cc (do_adjust_output_section): Set entsize to
12714         plt_entry_size.
12715
12716 2009-04-23  Elliott Hughes  <enh@google.com>
12717
12718         * output.cc (Output_file::close): After short writes, continue
12719         writing from the correct offset in the buffer being written.
12720
12721 2009-04-23  Chris Demetriou  <cgd@google.com>
12722
12723         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
12724         * configure: Regenerate.
12725         * config.in: Regenerate.
12726         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
12727         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
12728
12729 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
12730
12731         * incremental.cc (Incremental_inputs_header_data): Renamed from
12732         Incremental_input_header_data.
12733         (Incremental_inputs_header_data::data_size): New field.
12734         (Incremental_inputs_header_data::put_input_file_count): Renamed
12735         from input_file_count.
12736         (Incremental_inputs_header_data::put_command_line_offset): Renamed
12737         from command_line_offset.
12738         (Incremental_inputs_header_data::put_reserved): Renamed from
12739         put_reserved.
12740         (Incremental_inputs_entry_data): Renamed from
12741         Incremental_input_entry_data.
12742         (Incremental_inputs_entry_data::data_size): New field.
12743         (Incremental_inputs::report_command_line): New method.
12744         (Incremental_inputs::finalize): New method.
12745         (Incremental_inputs::create_incremental_inputs_data): New method.
12746         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
12747         * incremental.h: New file.
12748         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
12749         (Layout::finalize): Create incremental inputs section in
12750         incremental builds.
12751         (Layout::create_incremental_info_sections): New method.
12752         * layout.h (Layout::incremental_inputs): New method.
12753         (Layout::create_incremental_info_sections): New method.
12754         (Layout::incremental_inputs_): New field.
12755         * main.cc (main): Notify Incremental_input of the command line.
12756
12757 2009-04-01  Ian Lance Taylor  <iant@google.com>
12758             Mikolaj Zalewski  <mikolajz@google.com>
12759
12760         * gold.h (reserve_unordered_map): Define, three versions, one for
12761         each version of Unordered_map.
12762         * layout.cc (Layout::Layout): Remove options parameter.  Add
12763         number_of_input_files parameter.  Don't initialize options_.
12764         Initialize number_of_input_files_ and resized_signatures_.  Move
12765         sections_are_attached_.
12766         (Layout::layout_group): Reserve space for group_signatures_.
12767         (Layout::find_or_add_kept_section): Change name parameter to be a
12768         reference.  Resize signatures_ map when it gets large enough.
12769         (Layout::layout_eh_frame): Use parameters->options() instead of
12770         this->options_.
12771         (Layout::make_output_section): Likewise.
12772         (Layout::attach_allocated_section_to_segment): Likewise.
12773         (Layout::finalize, Layout::create_executable_stack): Likewise.
12774         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
12775         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
12776         * layout.h (class Layout): Update declarations.  Remove options_
12777         field.  Add number_of_input_files_ and resized_signatures_
12778         fields.  Move sections_are_attached_ field.
12779         * main.cc (main): Pass number of input files to Layout
12780         constructor.  Don't pass options.
12781
12782 2009-03-30  Ian Lance Taylor  <iant@google.com>
12783
12784         * ffsll.c (ffsll): Correct implementation.
12785
12786 2009-03-27  Ian Lance Taylor  <iant@google.com>
12787
12788         * ffsll.c: New file.
12789         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
12790         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
12791         * ftruncate.c (ftruncate): Declare before definition.
12792         * mremap.c (mremap): Likewise.
12793         * pread.c (pread): Likewise.
12794         * configure, Makefile.in, config.in: Rebuild.
12795
12796         * mremap.c: New file.
12797         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
12798         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
12799         (mremap): Declare if HAVE_MREMAP is not defined.
12800         * configure, Makefile.in, config.in: Rebuild.
12801
12802 2009-03-27  Cary Coutant  <ccoutant@google.com>
12803
12804         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
12805         position independent.
12806         * sparc.cc (Target_sparc::check_non_pic): Likewise.
12807         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
12808
12809 2009-03-24  Cary Coutant  <ccoutant@google.com>
12810
12811         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
12812         an executable.
12813         (needs_dynamic_reloc): Likewise.
12814
12815 2009-03-24  Ian Lance Taylor  <iant@google.com>
12816
12817         * yyscript.y (file_cmd): Recognize EXTERN.
12818         (extern_name_list, extern_name_list_body): New nonterminals.
12819         * script.cc (script_add_extern): Define.
12820         * script-c.h (script_add_extern): Declare.
12821
12822 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
12823
12824         * object.cc (is_elf_object): Define.
12825         * object.h (is_elf_object): Declare.
12826         * archive.cc (Archive::get_elf_object_for_member): Call
12827         is_elf_object.
12828         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
12829
12830 2009-03-24  Elliott Hughes  <enh@google.com>
12831
12832         * output.cc (Output_file::map_anonymous): Define.
12833         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
12834         try an anonymous one.  Report the size if the mmap fails.
12835         * output.h (class Output_file): Declare map_anonymous.
12836
12837 2009-03-24  Ian Lance Taylor  <iant@google.com>
12838
12839         * target-select.cc (instantiate_target): Don't acquire the lock if
12840         the instantiated_target_ field has already been set.
12841
12842 2009-03-23  Ian Lance Taylor  <iant@google.com>
12843
12844         * gold-threads.h (class Initialize_lock): Define.
12845         * gold-threads.cc (class Initialize_lock_once): Define.
12846         (initialize_lock_control): New static variable.
12847         (initialize_lock_pointer): New static variable.
12848         (initialize_lock_once): New static function.
12849         (Initialize_lock::Initialize_lock): Define.
12850         (Initialize_lock::initialize): Define.
12851         * target-select.h: Include "gold-threads.h".
12852         (class Target_selector): Add lock_ and initialize_lock_ fields.
12853         Don't define instantiate_target, just declare it.
12854         * target-select.cc (Target_selector::Target_selector): Initialize
12855         new fields.
12856         (Target_selector::instantiate_target): Define.
12857         * descriptors.h: Include "gold-threads.h".
12858         (class Descriptors): Add initialize_lock_ field.
12859         * descriptors.cc (Descriptors::Descriptors): Initialize new
12860         field.
12861         (Descriptors::open): Use initialize_lock_ field
12862         * errors.h (class Errors): Add initialize_lock_ field.
12863         * errors.cc (Errors::Errors): Initialize new field.
12864         (Errors::initialize_lock): Use initialize_lock_ field.
12865         * powerpc.cc (class Target_selector_powerpc): Remove
12866         instantiated_target_ field.  In do_recognize call
12867         instantiate_target rather than do_instantiate_target.  In
12868         do_instantiate_target just allocate a new target.
12869         * sparc.cc (class Target_selector_sparc): Likewise.
12870
12871         * freebsd.h: New file.
12872         * i386.cc: Include "freebsd.h".
12873         (Target_i386): Derive from Target_freebsd rather than
12874         Sized_target.
12875         (Target_selector_i386): Derive from Target_selector_freebsd rather
12876         than Target_selector.
12877         * x86_64.cc: Include "freebsd.h".
12878         (Target_x86_64): Derive from Target_freebsd rather than
12879         Sized_target.
12880         (Target_selector_x86_64): Derive from Target_selector_freebsd
12881         rather than Target_selector.
12882         * target.h (class Target): Add adjust_elf_header and
12883         do_adjust_elf_header.
12884         * output.cc (Output_file_header:: do_sized_write): Call target
12885         adjust_elf_header routine.
12886         * configure.tgt: Set targ_osabi.
12887         * configure.ac: Define GOLD_DEFAULT_OSABI.
12888         * parameters.cc (Parameters::default_target): Pass
12889         GOLD_DEFAULT_OSABI to select_target.
12890         * target-select.h (class Target_selector): Make instantiate_target
12891         protected rather than private.
12892         * Makefile.am (HFILES): Add freebsd.h.
12893         * configure, Makefile.in, config.in: Rebuild.
12894
12895         * merge.cc (do_add_input_section): Correct pend value.  Change
12896         message about last entry not being null terminated from error to
12897         warning.
12898
12899 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
12900
12901         * incremental.cc: New file.
12902         * Makefile.am (CCFILES): Add incremental.cc.
12903         * Makefile.in: Rebuild.
12904
12905 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
12906
12907         * layout.cc (Layout::output_section_name): Preserve names
12908         of '.note.' sections.
12909
12910 2009-03-19  Ian Lance Taylor  <iant@google.com>
12911
12912         * descriptors.cc (Descriptors::open): Check that the options are
12913         valid before using them.
12914
12915 2009-03-18  Ian Lance Taylor  <iant@google.com>
12916
12917         * script-sections.h: Include <list>.
12918         (class Script_sections): Change Sections_elements from std::vector
12919         to std::list.  Typedef public Elements_iterator.  Add
12920         orphan_section_placement_, data_segment_align_start_, and
12921         saw_data_segment_align_ fields.  Remove data_segment_align_index_
12922         field.
12923         * script-sections.cc (class Orphan_section_placement): New class.
12924         (class Sections_element): Add virtual functions is_relro and
12925         orphan_section_init.  Remove virtual function place_orphan_here.
12926         (class Output_section_definition): Add is_relro and
12927         orphan_section_init.  Remove place_orphan_here.
12928         (class Orphan_output_section): Likewise.
12929         (Script_sections::Script_sections): Update for field changes.
12930         (Script_sections::data_segment_align): Set saw_data_segment_align_
12931         and data_segment_align_start_, not data_segment_align_index.
12932         (Script_sections::data_segment_relro_end): Check
12933         saw_data_segment_align_.  Use data_segment_align_start_ rather
12934         than data_segment_align_index_.
12935         (Script_sections::place_orphan): Rewrite to use
12936         Orphan_section_placement.
12937
12938 2009-03-17  Ian Lance Taylor  <iant@google.com>
12939
12940         * archive.cc (Archive::add_symbols): Check for a version attached
12941         to the symbol name in the archive map.
12942         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
12943         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
12944         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
12945         (ver_test_11.a): New target.
12946         * testsuite/Makefile.in: Rebuild.
12947
12948         * configure.ac: Check for chsize and posix_fallocate.  Replace
12949         ftruncate.
12950         * ftruncate.c: New file, from gnulib.
12951         * output.cc (posix_fallocate): Define dummy version if not
12952         HAVE_POSIX_FALLOCATE.
12953         (Output_file::map): Call posix_fallocate rather than lseek and
12954         write.
12955         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
12956         * configure, Makefile.in, config.in: Rebuild.
12957
12958 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
12959
12960         * layout.h (Layout::create_note): Add section_name parameter.
12961         * layout.cc (Layout::create_note): Likewise.
12962         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
12963
12964 2009-03-17  Ian Lance Taylor  <iant@google.com>
12965
12966         * descriptors.cc: Include "options.h".
12967         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
12968         (Descriptors::open): Always use O_CLOEXEC when opening a new
12969         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
12970         then set FD_CLOEXEC.
12971
12972         * sparc.cc (class Target_sparc): Add has_got_section.
12973         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
12974         make sure we have a GOT section.
12975
12976         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
12977         (Target_sparc::Scan::local): Likewise.
12978         (Target_sparc::Scan::global): Likewise.
12979         (Target_sparc::Relocate::relocate): Likewise.
12980         (Target_sparc::Relocate::relocate_tls): Likewise.
12981
12982         * symtab.cc (Symbol_table::define_default_version): New function,
12983         broken out of add_from_object.
12984         (Symbol_table::add_from_object): Call define_default_version.
12985         (Symbol_table::define_special_symbol): Add resolve_oldsym
12986         parameter.  Change all callers.  If the version for a symbol comes
12987         from a version script, resolve it with the symbol with the same
12988         name with no version.  Also add the symbol without a version if
12989         appropriate.
12990         (do_define_in_output_data): If resolving with oldsym, don't delete
12991         sym.
12992         (do_define_in_output_segment): Likewise.
12993         (do_define_as_constant): Likewise.
12994         * symtab.h (class Symbol_table): Update declarations.
12995
12996 2009-03-13  Ian Lance Taylor  <iant@google.com>
12997
12998         * readsyms.cc (Read_symbols::incompatible_warning): New function.
12999         (Read_symbols::requeue): New function.
13000         (Read_symbols::do_read_symbols): If make_elf_object fails because
13001         the target type is not configured, and the file was searched for,
13002         issue a warning and retry with the next directory.
13003         (Add_symbols::run): If the file has an incompatible format, and
13004         it was searched for, requeue the Read_symbols task.  On error,
13005         release the object.
13006         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
13007         dirindex parameter to constructor.  Change all callers.  Declare
13008         incompatible_warning and requeue.
13009         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
13010         input_argument_ and input_group_ fields.  Add them to
13011         constructor.  Change all callers.
13012         (class Read_script): Add dirindex_ field.  Add it to constructor.
13013         Change all callers.
13014         * archive.cc (Archive::setup): Remove input_objects parameter.
13015         Change all callers.
13016         (Archive::get_file_and_offset): Likewise.
13017         (Archive::read_all_symbols): Likewise.
13018         (Archive::read_symbols): Likewise.
13019         (Archive::get_elf_object_for_member): Remove input_objects
13020         parameter.  Add punconfigured parameter.  Change all callers.
13021         (Archive::add_symbols): Change return type to bool.  Check return
13022         value of include_member.
13023         (Archive::include_all_members): Likewise.
13024         (Archive::include_member): Change return type to bool.  Return
13025         false if first included object has incompatible target.  Set
13026         included_member_ field.
13027         (Add_archive_symbols::run): If add_symbols returns false, requeue
13028         Read_symbols task.
13029         * archive.h (class Archive): Add included_member_ field.
13030         Initialize it in constructor.  Add input_file and searched_for
13031         methods.  Update declarations.
13032         (class Add_archive_symbols): Add dirpath_, dirindex_, and
13033         input_argument_ fields.  Add them to constructor.  Change all
13034         callers.
13035         * script.cc: Include "target-select.h".
13036         (class Parser_closure): Add skip_on_incompatible_target_ and
13037         found_incompatible_target_ fields.  Add
13038         skip_on_incompatible_target parameter to constructor.  Change all
13039         callers.  Add methods skip_on_incompatible_target,
13040         clear_skip_on_incompatible_target, found_incompatible_target, and
13041         set_found_incompatible_target.
13042         (read_input_script): Add dirindex parameter.  Change all callers.
13043         If parser finds an incompatible target, requeue Read_symbols
13044         task.
13045         (script_set_symbol): Clear skip_on_incompatible_target in
13046         closure.
13047         (script_add_assertion, script_parse_option): Likewise.
13048         (script_start_sections, script_add_phdr): Likewise.
13049         (script_check_output_format): New function.
13050         * script.h (read_input_script): Update declaration.
13051         * script-c.h (script_check_output_format): Declare.
13052         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
13053         (ignore_cmd): Remove OUTPUT_FORMAT.
13054         * fileread.cc (Input_file::Input_file): Add explicit this.
13055         (Input_file::will_search_for): New function.
13056         (Input_file::open): Add pindex parameter.  Change all callers.
13057         * fileread.h (class Input_file): Add input_file_argument method.
13058         Declare will_search_for.  Update declarations.
13059         * object.cc (make_elf_object): Add punconfigured parameter.
13060         Change all callers.
13061         * object.h (class Object): Make input_file public.  Add
13062         searched_for method.
13063         (make_elf_object): Update declaration.
13064         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
13065         restart search.
13066         * dirsearch.h (class Dirsearch): Update declaration.
13067         * options.h (class General_options): Add --warn-search-mismatch.
13068         * parameters.cc (Parameters::is_compatible_target): New function.
13069         * parameters.h (class Parameters): Declare is_compatible_target.
13070         * workqueue.cc (Workqueue::add_blocker): New function.
13071         * workqueue.h (class Workqueue): Declare add_blocker.
13072
13073         * fileread.cc (Input_file::open): Remove options parameter.
13074         Change all callers.
13075         (Input_file::open_binary): Likewise.
13076         * script.cc (read_input_script): Likewise.
13077         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
13078         options parameter from constructor.  Change all callers.
13079         (class Read_script): Likewise.
13080         * fileread.h (class Input_file): Update declarations.
13081         * script.h (read_input_script): Update declaration.
13082
13083 2009-03-10  Nick Clifton  <nickc@redhat.com>
13084
13085         * po/es.po: New Spanish translation.
13086
13087 2009-03-06  Cary Coutant  <ccoutant@google.com>
13088
13089         * options.cc (parse_short_option): Keep dash_z from registering itself.
13090
13091 2009-03-03  Ian Lance Taylor  <iant@google.com>
13092
13093         PR 9918
13094         * target-reloc.h (relocate_section): Pass output_section to
13095         relocate.
13096         * i386.cc (Target_i386::should_apply_static_reloc): Add
13097         output_section parameter.  Change all callers.
13098         (Target_i386::Relocate::relocate): Add output_section parameter.
13099         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
13100         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
13101         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
13102         * testsuite/two_file_shared.sh: New script.
13103         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
13104         (check_DATA): Add two_file_shared.dbg.
13105         (two_file_shared.dbg): New target.
13106         * testsuite/Makefile.in: Rebuild.
13107
13108 2009-03-01  Ian Lance Taylor  <iant@google.com>
13109
13110         * configure.ac: Check for byteswap.h.
13111         * configure: Rebuild.
13112         * config.in: Rebuild.
13113
13114 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
13115
13116         * layout.cc (Layout::find_or_add_kept_section): New function.
13117         (Layout::add_comdat): Removed.
13118         * layout.h (struct Kept_section): Move out of class Layout.
13119         Remove trailing underscores from field names.  Add group_sections
13120         field.  Rename group_ field to is_group.  Change all uses.
13121         (class Layout): Declare find_or_add_kept_section, not add_comdat.
13122         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
13123         comdat_groups_ field.
13124         (Sized_relobj::include_section_group): Use
13125         find_or_add_kept_section and Kept_section::group_sections.
13126         (Sized_relobj::include_linkonce_section): Likewise.
13127         * object.cc (class Sized_relobj): Don't define Comdat_group or
13128         Comdat_group_table.  Remove find_comdat_group and
13129         add_comdat_group.  Remove comdat_groups_ field.
13130         * plugin.cc (include_comdat_group): Use
13131         Layout::find_or_add_kept_section.
13132
13133 2009-02-28  Ian Lance Taylor  <iant@google.com>
13134
13135         * README: --gc-sections and map files are now supported.  Document
13136         some build requirements.
13137
13138         PR 6992
13139         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
13140         relocatable link set the value of the section symbol to zero.
13141         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
13142         relocatable link don't include the section address in the local
13143         symbol value.
13144
13145 2009-02-27  Ian Lance Taylor  <iant@google.com>
13146
13147         PR 6811
13148         * options.h (class Search_directory): Add is_system_directory.
13149         (class General_options): Declare is_in_system_directory.
13150         * options.cc (get_relative_sysroot): Make static.
13151         (get_default_sysroot): Make static.
13152         (General_optoins::is_in_system_directory): New function.
13153         * fileread.cc (Input_file::is_in_system_directory): New function.
13154         * fileread.h (class Input_file): Declare is_in_system_directory.
13155         * object.h (class Object): Add is_in_system_directory.
13156         (class Input_objects): Remove system_library_directory_ field.
13157         * object.cc (Input_objects::add_object): Don't set
13158         system_library_directory_.
13159         (input_objects::found_in_system_library_directory): Remove.
13160         * symtab.cc (Symbol_table::write_globals): Remove input_objects
13161         parameter.  Change all callers.
13162         (Symbol_table::sized_write_globals): Likewise.
13163         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
13164         Call Object::is_in_system_directory.
13165         * symtab.h (class Symbol_table): Update declarations.
13166
13167         PR 5990
13168         * descriptors.h (Open_descriptor): Add is_on_stack field.
13169         * descriptors.cc (Descriptors::open): If the descriptor is on the
13170         top of the stack, remove it.  Initialize is_on_stack field.
13171         (Descriptors::release): Only add pod to stack if it is not on the
13172         stack already.
13173         (Descriptors::close_some_descriptor): Clear stack_next and
13174         is_on_stack fields.
13175
13176         PR 7091
13177         * output.cc (Output_section::find_starting_output_address): Rename
13178         from starting_output_address; add PADDR parameter; change return
13179         type.
13180         * output.h (class Output_section): Declare
13181         find_starting_output_address instead of starting_output_address.
13182         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
13183         section symbol for which we can't find a merge section.
13184
13185         PR 9836
13186         * symtab.cc (Symbol_table::add_from_object): If the visibility is
13187         hidden or internal, force the symbol to be local.
13188         * resolve.cc (Symbol::override_visibility): Define.
13189         (Symbol::override_base): Use override_visibility.
13190         (Symbol_table::resolve): Likewise.
13191         (Symbol::override_base_with_special): Likewise.
13192         (Symbol_table::override_with_special): If the visibility is hidden
13193         or internal, force the symbol to be local.
13194         * symtab.h (class Symbol): Add set_visibility and
13195         override_visibility.
13196         * testsuite/ver_test_1.sh: New file.
13197         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
13198         (check_DATA): Add ver_test_1.syms.
13199         (ver_test_1.syms): New target.
13200         * testsuite/Makefile.in: Rebuild.
13201
13202 2009-02-25  Cary Coutant  <ccoutant@google.com>
13203
13204         * layout.cc (Layout::choose_output_section): Don't rename sections
13205         when using a linker script that has a SECTIONS clause.
13206         * Makefile.in: Regenerate.
13207
13208         * testsuite/Makefile.am (script_test_5.sh): New test case.
13209         * testsuite/Makefile.in: Regenerate.
13210         * testsuite/script_test_5.cc: New file.
13211         * testsuite/script_test_5.sh: New file.
13212         * testsuite/script_test_5.t: New file.
13213
13214 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
13215
13216         * archive.cc (Archive::include_member): Update calls to add_symbols.
13217         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
13218         the Layout argument.
13219         * dynobj.h (do_add_symbols): Add the Layout argument.
13220         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
13221         Layout argument.
13222         * object.h (Object::add_symbols): Add the Layout argument.
13223         (Object::do_add_symbols): Add the Layout argument.
13224         (Sized_relobj::do_add_symbols): Add the Layout argument.
13225         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
13226         Unify the two versions.
13227         (Add_plugin_symbols): Remove.
13228         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
13229         (Sized_pluginobj::do_add_symbols): Unify the two versions.
13230         (Add_plugin_symbols): Remove.
13231         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
13232         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
13233         (Add_symbols::run): Make it work with Pulginobj.
13234
13235 2009-02-06  Ian Lance Taylor  <iant@google.com>
13236
13237         * object.cc (Sized_relobj::do_layout): Make info message start
13238         with lower case letter.
13239
13240 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
13241
13242         * binary.cc: Fix file comment.
13243
13244         * options.h (enum Incremental_disposition): Define.
13245         (class General_options): Add new options: --incremental,
13246         --incremental_changed, --incremental_unchanged,
13247         --incremental_unknown.  Add incremental_disposition_ and
13248         implicit_incremental_ fields.
13249         (General_options::incremental_disposition): New function.
13250         (class Position_dependent_options): Add incremental_disposition
13251         option.
13252         (Position_dependent_options::copy_from_options): Set incremental
13253         dispositions.
13254         * options.cc (General_options::parse_incremental_changed): New
13255         function.
13256         (General_options::parse_incremental_unchanged): New function.
13257         (General_options::parse_incremental_unknown): New function.
13258         (General_options::General_options): Initialize new fields
13259         incremental_disposition_ and implicit_incremental_.
13260         (General_options::finalize): Check for uasge of --incremental-*
13261         without --incremental.
13262
13263 2009-02-06  Chris Demetriou  <cgd@google.com>
13264
13265         * gold.h (gold_undefined_symbol): Change to take only a Symbol
13266         pointer and to report location as the file name associated with
13267         the symbol.
13268         (gold_undefined_symbol_at_location): New function to replace the
13269         old gold_undefined_symbol functionality.
13270         * target-reloc.h (relocate_section): Update to use
13271         gold_undefined_symbol_at_location.
13272         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
13273         Call gold_undefined_symbol function rather than gold_error.
13274         * errors.h (Errors::undefined_symbol): Take location as a
13275         string, rather than calculating it from a relocation.
13276         * errors.cc (Errors::fatal): Print "fatal error:" before the
13277         formatted message.
13278         (Errors::error, Errors::error_at_location): Print "error: "
13279         before the formatted message.
13280         (Errors::undefined_symbol): Take location as a string, rather
13281         than calculating it from a relocation.
13282         (gold_undefined_symbol_at_location): New function akin to
13283         old gold_undefined_symbol, calculates location from relocation.
13284         (gold_undefined_symbol): Change to take only a Symbol pointer
13285         and to report location as the file name associated with the symbol.
13286         * testsuite/debug_msg.sh: Update for changed error messages.
13287         * testsuite/undef_symbol.sh: Likewise.
13288
13289 2009-02-04  Duncan Sands  <baldrick@free.fr>
13290
13291         PR 9812
13292         * reduced_debug_output.h
13293         (Output_reduced_debug_abbrev_section::failed): Use format for
13294         gold_warning.
13295         (Output_reduced_debug_info_section::faild): Likewise.
13296
13297 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
13298
13299         * script.cc (Lazy_demangler): New class.
13300         (Version_script_info::get_symbol_version_helper): Demangle a
13301         symbol only once.
13302
13303 2009-01-29  Cary Coutant  <ccoutant@google.com>
13304
13305         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
13306         to __tls_get_addr.
13307         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
13308
13309 2009-01-28  Ian Lance Taylor  <iant@google.com>
13310
13311         * version.cc (version_string): Bump to 1.9.
13312
13313         * gold.h: Include <cstring> and <stdint.h>.
13314         * version.cc: Include <cstdio>.
13315         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
13316         warning.
13317         * reduced_debug_output.cc (insert_into_vector): Rename from
13318         Insert_into_vector; change all callers.  Use Swap_unaligned to
13319         avoid aliasing issue; remove union since it is unnecessary.
13320
13321 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
13322
13323         * Makefile.am (CCFILES): Add gc.cc.
13324         (HFILES): Add gc.h.
13325         * Makefile.in: Regenerate.
13326         * gold.cc (Gc_runner): New class.
13327         (queue_initial_tasks): Call garbage collection related tasks
13328         when corresponding options are invoked.
13329         (queue_middle_gc_tasks): New function.
13330         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
13331         processed early before laying out sections during garbage collection.
13332         * gold.h (queue_middle_gc_tasks): New function.
13333         (is_prefix_of): Move from "layout.cc".
13334         * i386.cc (Target_i386::gc_process_relocs): New function.
13335         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
13336         * main.cc (main): Create object of class "Garbage_collection".
13337         * object.cc (Relobj::copy_symbols_data): New function.
13338         (Relobj::is_section_name_included): New function.
13339         (Sized_relobj::do_layout): Allow this function to be called twice
13340         during garbage collection and defer layout of section during the
13341         first call.
13342         * object.h (Relobj::get_symbols_data): New function.
13343         (Relobj::is_section_name_included): New function.
13344         (Relobj::copy_symbols_data): New function.
13345         (Relobj::set_symbols_data): New function.
13346         (Relobj::get_relocs_data): New function.
13347         (Relobj::set_relocs_data): New function.
13348         (Relobj::is_output_section_offset_invalid): New pure virtual function.
13349         (Relobj::gc_process_relocs): New function.
13350         (Relobj::do_gc_process_relocs): New pure virtual function.
13351         (Relobj::sd_): New data member.
13352         (Sized_relobj::is_output_section_offset_invalid): New function.
13353         (Sized_relobj::do_gc_process_relocs): New function.
13354         * options.h (General_options::gc_sections): Modify to not be a no-op.
13355         (General_options::print_gc_sections): New option.
13356         * plugin.cc (Plugin_finish::run): Remove function call to
13357         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
13358         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
13359         * reloc.cc (Read_relocs::run): Add task to process relocs and
13360         determine unreferenced sections when doing garbage collection.
13361         (Gc_process_relocs): New class.
13362         (Sized_relobj::do_gc_process_relocs): New function.
13363         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
13364         sections that are garbage collected.
13365         * reloc.h (Gc_process_relocs): New class.
13366         * sparc.cc (Target_sparc::gc_process_relocs): New function.
13367         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
13368         symbols whose corresponding sections are garbage collected.
13369         (Symbol_table::Symbol_table): Add new parameter for the garbage
13370         collection object.
13371         (Symbol_table::gc_mark_undef_symbols): New function.
13372         (Symbol_table::gc_mark_symbol_for_shlib): New function.
13373         (Symbol_table::gc_mark_dyn_syms): New function.
13374         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
13375         as garbage.
13376         (Symbol_table::add_from_object): Likewise.
13377         (Symbol_table::add_from_relobj): When building shared objects, do not
13378         treat externally visible symbols as garbage.
13379         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
13380         table information for static and relocatable links.
13381         * symtab.h (Symbol_table::set_gc): New function.
13382         (Symbol_table::gc): New function.
13383         (Symbol_table::gc_mark_undef_symbols): New function.
13384         (Symbol_table::gc_mark_symbol_for_shlib): New function.
13385         (Symbol_table::gc_mark_dyn_syms): New function.
13386         (Symbol_table::gc_): New data member.
13387         * target.h (Sized_target::gc_process_relocs): New pure virtual
13388         function.
13389         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
13390         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
13391
13392 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
13393
13394         * options.h (General_options::gc_sections): Define as a no-op for now.
13395         (General_options::no_keep_memory): Ditto.
13396         (General_options::Bshareable): Define.
13397         * options.cc (General_options::finalize): Honor -Bshareable.
13398
13399 2009-01-20  Andreas Schwab  <schwab@suse.de>
13400
13401         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
13402         read the value in the contents, since we don't use it.  Use the
13403         template endianness when writing.
13404         (Relocate::relocate): Use it for R_PPC_REL16_HA.
13405
13406 2009-01-19  Andreas Schwab  <schwab@suse.de>
13407
13408         * configure.tgt (powerpc64-*): Fix targ_obj.
13409
13410 2009-01-15  Ian Lance Taylor  <iant@google.com>
13411
13412         * object.cc (Sized_relobj::write_local_symbols): Don't write out
13413         local symbols when stripping all symbols.
13414
13415 2009-01-14  Cary Coutant  <ccoutant@google.com>
13416
13417         * output.cc (Output_reloc): Add explicit instantiations.
13418
13419 2009-01-14  Cary Coutant  <ccoutant@google.com>
13420
13421         * archive.cc (Archive::get_elf_object_for_member): Remove call
13422         to File_read::claim_for_plugin.
13423         * descriptors.cc (Descriptors::open): Remove reference to
13424         is_claimed.
13425         (Descriptors::claim_for_plugin): Remove.
13426         * descriptors.h (Descriptors::claim_for_plugin): Remove.
13427         (Descriptors::is_claimed): Remove.
13428         (claim_descriptor_for_plugin): Remove.
13429         * fileread.cc (File_read::claim_for_plugin): Remove.
13430         * fileread.h (File_read::claim_for_plugin): Remove.
13431         (File_read::descriptor): Reopen descriptor if necessary.
13432         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
13433         (Plugin_manager::all_symbols_read): Add task parameter. Change
13434         all callers.
13435         (Plugin_manager::get_input_file): New function.
13436         (Plugin_manager::release_input_file): New function.
13437         (Pluginobj::Pluginobj): Add filesize parameter and initialize
13438         corresponding data member.
13439         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
13440         and pass to base constructor. Change all callers.
13441         (get_input_file, release_input_file): New functions.
13442         (make_sized_plugin_object): Add filesize parameter. Change all callers.
13443         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
13444         (Plugin_manager::all_symbols_read): Add task parameter.
13445         (Plugin_manager::get_input_file): New function.
13446         (Plugin_manager::release_input_file): New function.
13447         (Plugin_manager::task_): New data member.
13448         (Pluginobj::Pluginobj): Add filesize parameter.
13449         (Pluginobj::filename): New function.
13450         (Pluginobj::descriptor): New function.
13451         (Pluginobj::filesize): New function.
13452         (Pluginobj::filesize_): New data member.
13453         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
13454         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
13455         File_read::claim_for_plugin; use Object::unlock to unlock the file.
13456
13457         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
13458         with archive libraries.
13459         * testsuite/Makefile.in: Regenerate.
13460         * testsuite/plugin_test.c (struct sym_info): New type.
13461         (get_input_file, release_input_file): New static variables.
13462         (onload): Capture new transfer vector entries.
13463         (claim_file_hook): Stop reading at end of file according to filesize.
13464         Factor out parsing of readelf output into separate function.
13465         (all_symbols_read_hook): Exercise get_input_file and release_input_file
13466         APIs and get the source file name from the symbol table.  Convert
13467         source file name to corresponding object file name.  Print info
13468         message when adding new input files.
13469         (parse_readelf_line): New function.
13470         * testsuite/plugin_test_1.sh: Add checks for new info messages.
13471         * testsuite/plugin_test_2.sh: Likewise.
13472         * testsuite/plugin_test_3.sh: Likewise.
13473         * testsuite/plugin_test_4.sh: New test case.
13474
13475 2009-01-07  Ian Lance Taylor  <iant@google.com>
13476
13477         * version.cc (version_string): Bump to 1.8.
13478
13479 2008-12-23  Cary Coutant  <ccoutant@google.com>
13480
13481         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
13482         * plugin.cc (Plugin_manager::finish): Rename as
13483         layout_deferred_objects.  Move cleanup to separate function.
13484         (Plugin_manager::cleanup): New function.
13485         (Plugin_finish::run): Call layout_deferred_objects and cleanup
13486         separately.
13487         * plugin.h (Plugin_manager::finish): Rename as
13488         layout_deferred_objects.
13489         (Plugin_manager::cleanup): New function.
13490         (Plugin_manager::cleanup_done): New field.
13491
13492 2008-12-23  Cary Coutant  <ccoutant@google.com>
13493
13494         * plugin.cc (is_visible_from_outside): New function.
13495         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
13496         so we don't return "IR only" status for exported symbols or -r links.
13497
13498         * testsuite/Makefile.am (plugin_test_3): New test case.
13499         * testsuite/Makefile.in: Regenerate.
13500         * testsuite/plugin_test_3.sh: New file.
13501
13502 2008-12-22  Cary Coutant  <ccoutant@google.com>
13503
13504         * object.cc (Sized_relobj::layout_section): New function.
13505         (Sized_relobj::do_layout): Defer layout of input sections until after
13506         plugin has provided replacement files.
13507         (Sized_relobj::do_layout_deferred_sections): New function.
13508         * object.h (Relobj::set_section_offset): Remove virtual keyword.
13509         (Relobj::layout_deferred_sections): New function.
13510         (Relobj::do_layout_deferred_sections): New function.
13511         (Sized_relobj::do_layout_deferred_sections): New function.
13512         (Sized_relobj::layout_section): New function.
13513         (Sized_relobj::Deferred_layout): New structure.
13514         (Sized_relobj::deferred_layout_): New field.
13515         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
13516         Change all callers.  Layout deferred sections.
13517         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
13518         references.
13519         (Plugin_hook::run): Move code from do_plugin_hook inline.
13520         (Plugin_hook::do_plugin_hook): Remove.
13521         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
13522         (Plugin_manager::finish): Renamed, was cleanup.
13523         (Plugin_manager::should_defer_layout): New function.
13524         (Plugin_manager::add_deferred_layout_object): New function.
13525         (Plugin_manager::Deferred_layout_list): New type.
13526         (Plugin_manager::deferred_layout_objects_): New field.
13527         (Plugin_hook::do_plugin_hook): Remove.
13528
13529 2008-12-17  Ian Lance Taylor  <iant@google.com>
13530
13531         * options.h (class General_options): Add --no case for
13532         --export-dynamic.
13533
13534 2008-12-16  Cary Coutant  <ccoutant@google.com>
13535
13536         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
13537         vector.
13538         (Plugin_manager::claim_file): Create plugin object even if
13539         plugin did not call the add_symbols callback.
13540         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
13541         asking for more symbols than were added.
13542         * testsuite/Makefile.am (plugin_test_1): Add test case with
13543         no global symbols.
13544         (empty.syms): New target.
13545         * testsuite/Makefile.in: Regenerate.
13546         * testsuite/plugin_test.c (claim_file_hook): Add new debug
13547         message. Don't call add_symbols if no globals.
13548         (all_symbols_read_hook): Don't provide replacement for empty
13549         claimed file.
13550
13551 2008-12-12  Ian Lance Taylor  <iant@google.com>
13552
13553         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
13554         r_type == 0 for a local symbol with r_sym == 0.
13555         (scan_relocatable_relocs): Pass r_sym to
13556         local_non_section_strategy.
13557         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
13558         r_sym parameter.
13559
13560         * configure.ac: Update test for TLS descriptors: they are
13561         supported as of glibc 2.9.
13562         * configure: Rebuild.
13563
13564 2008-12-11  Ian Lance Taylor  <iant@google.com>
13565
13566         PR 7091
13567         * target-reloc.h (Default_scan_relocatable_relocs): For each
13568         function, map r_type == 0 to RELOC_DISCARD.
13569
13570 2008-12-10  Cary Coutant  <ccoutant@google.com>
13571
13572         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
13573         object to override a kept COMDAT group from a plugin object.
13574
13575 2008-12-09  Ian Lance Taylor  <iant@google.com>
13576
13577         PR 7088
13578         * yyscript.y (file_cmd): Handle INPUT.
13579
13580         * testsuite/initpri1.c: Change all declarations to be full
13581         prototypes by adding void, to avoid compiler warnings.
13582
13583 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
13584
13585         * options.cc (General_options::parse_plugin_opt): New.
13586         (General_options::add_plugin): The argument now is just the filename.
13587         (General_options::add_plugin_option): New.
13588         * options.h (plugin_opt): New.
13589         (add_plugin): Change argument name.
13590         (add_plugin_option): New.
13591         * plugin.cc (Plugin::load): Don't parse the plugin option.
13592         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
13593         (Plugin::add_option): New.
13594         (Plugin::args_): Change type.
13595         (Plugin::filename_): New.
13596         (Plugin_manager::add_plugin_option): New.
13597         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
13598         * testsuite/Makefile.in: Regenerate.
13599
13600 2008-12-05  Cary Coutant  <ccoutant@google.com>
13601
13602         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
13603         Handle --strip-lto-sections option.
13604         * options.h (strip_lto_sections): New option.
13605
13606 2008-12-01  Cary Coutant  <ccoutant@google.com>
13607
13608         * plugin.cc (ld_plugin_message): Change format parameter to const.
13609         Fix mismatch between new[] and delete.
13610
13611 2008-11-14  Cary Coutant  <ccoutant@google.com>
13612
13613         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
13614         instead of -1U.
13615
13616 2008-11-05  Craig Silverstein  <csilvers@google.com>
13617
13618         * options.cc (General_options::parse_dynamic_list): New function.
13619         * options.h (General_options): New flags dynamic_list,
13620         dynamic_list_data, dynamic_list_cpp_new, and
13621         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
13622         (General_options::in_dynamic_list): New function.
13623         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
13624         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
13625         (Lex::can_continue_name): Likewise.
13626         (yylex): Likewise.
13627         (read_script_file): New parameter script_options.
13628         (read_dynamic_list): New function.
13629         (Script_options::define_dynamic_list): New function.
13630         (dynamic_list_keyword_parsecodes): New variable.
13631         (dynamic_list_keywords): New variable.
13632         * script.h (Script_options::define_dynamic_list): New function
13633         prototype.
13634         (read_dynamic_list): New function prototype.
13635         * symtab.cc (strprefix): New macro.
13636         (Symbol::should_add_dynsym_entry): Support dynamic_list,
13637         dynamic_list_data, dynamic_list_cpp_new, and
13638         dynamic_list_cpp_typeinfo.
13639         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
13640         (dynamic_list_expr): New rule.
13641         (dynamic_list_nodes): Likewise.
13642         (dynamic_list_node): Likewise.
13643         * testsuite/Makefile.am (dynamic_list): New test.
13644         * testsuite/Makefile.in: Regenerated.
13645         * testsuite/dynamic_list.t: New file.
13646         * testsuite/dynamic_list.sh: New file.
13647
13648 2008-11-05  Craig Silverstein  <csilvers@google.com>
13649
13650         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
13651         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
13652         (t11_last): Likewise.
13653         * testsuite/ver_test_6.c (main): Likewise.
13654
13655 2008-10-07  Cary Coutant  <ccoutant@google.com>
13656
13657         * options.c (General_options::finalize): Add check for -static and
13658         -shared.
13659         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
13660         is not empty.
13661
13662 2008-10-02  Cary Coutant  <ccoutant@google.com>
13663
13664         * plugin.cc (make_sized_plugin_object): Fix conditional
13665         compilation to work when not all targets are enabled.
13666
13667 2008-09-29  Cary Coutant  <ccoutant@google.com>
13668
13669         * archive.cc (Archive::get_file_and_offset): Use filename instead
13670         of name to get library path.
13671         (Archive::include_member): Unlock external member of a thin archive.
13672
13673         * testsuite/Makefile.am (TEST_AR): New variable.
13674         (thin_archive_test_1): New test.
13675         (thin_archive_test_2): New test.
13676         * testsuite/Makefile.in: Regenerate.
13677         * testsuite/thin_archive_main.cc: New file.
13678         * testsuite/thin_archive_test_1.cc: New file.
13679         * testsuite/thin_archive_test_2.cc: New file.
13680         * testsuite/thin_archive_test_3.cc: New file.
13681         * testsuite/thin_archive_test_4.cc: New file.
13682
13683 2008-09-29  Cary Coutant  <ccoutant@google.com>
13684
13685         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
13686         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
13687         instead of -1U.
13688         (Sized_relobj::do_finalize_local_symbols): Likewise.
13689         (Sized_relobj::map_to_kept_section): Likewise.
13690         * object.h (Sized_relobj::invalid_address): New constant.
13691         (Sized_relobj::do_output_section_offset): Check for invalid_address
13692         and return -1ULL.
13693         * output.cc (Output_reloc::local_section_offset): Use constant
13694         invalid_address instead of -1U.
13695         (Output_reloc::get_address): Likewise.
13696         (Output_section::output_address): Change -1U to -1ULL.
13697         * output.h (Output_reloc::invalid_address): New constant.
13698         * reloc.cc (Sized_relobj::write_sections): Use constant
13699         invalid_address instead of -1U.
13700         (Sized_relobj::relocate_sections): Likewise.
13701         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
13702         values for merge sections.
13703         * target-reloc.h (relocate_for_relocatable): Use constant
13704         invalid_address instead of -1U.
13705
13706 2008-09-19  Cary Coutant  <ccoutant@google.com>
13707
13708         Add plugin functionality for link-time optimization (LTO).
13709         * configure.ac (plugins): Add --enable-plugins option.
13710         * configure: Regenerate.
13711         * config.in: Regenerate.
13712         * Makefile.am (LIBDL): New variable.
13713         (CCFILES): Add plugin.cc.
13714         (HFILES): Add plugin.h.
13715         (ldadd_var): Add LIBDL.
13716         * Makefile.in: Regenerate.
13717
13718         * archive.cc: Include "plugin.h".
13719         (Archive::setup): Don't preread archive symbols when using a plugin.
13720         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
13721         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
13722         files.
13723         (Archive::include_member): Add symbols from plugin objects.
13724         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
13725         * descriptors.cc (Descriptors::open): Check for file descriptors
13726         abandoned by plugins.
13727         (Descriptors::claim_for_plugin): New function.
13728         * descriptors.h (Descriptors::claim_for_plugin): New function.
13729         (Open_descriptor::is_claimed): New field.
13730         (claim_descriptor_for_plugin): New function.
13731         * fileread.cc (File_read::claim_for_plugin): New function.
13732         * fileread.h (File_read::claim_for_plugin): New function.
13733         (File_read::descriptor): New function.
13734         * gold.cc: Include "plugin.h".
13735         (queue_initial_tasks): Add task to call plugin hooks for generating
13736         new object files.
13737         * main.cc: Include "plugin.h".
13738         (main): Load plugin libraries.
13739         * object.h (Pluginobj): Declare.
13740         (Object::pluginobj): New function.
13741         (Object::do_pluginobj): New function.
13742         (Object::set_target): New function.
13743         * options.cc: Include "plugin.h".
13744         (General_options::parse_plugin): New function.
13745         (General_options::General_options): Initialize plugins_ field.
13746         (General_options::add_plugin): New function.
13747         * options.h (Plugin_manager): Declare.
13748         (General_options): Add --plugin option.
13749         (General_options::has_plugins): New function.
13750         (General_options::plugins): New function.
13751         (General_options::add_plugin): New function.
13752         (General_options::plugins_): New field.
13753         * plugin.cc: New file.
13754         * plugin.h: New file.
13755         * readsyms.cc: Include "plugin.h".
13756         (Read_symbols::do_read_symbols): Check for archive before checking
13757         for ELF file.  Call plugin hooks to claim files.
13758         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
13759         from a real object file; force override when processing replacement
13760         files.
13761         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
13762         (Symbol::init_base_object): Likewise.
13763         (Symbol::init_base_output_data): Likewise.
13764         (Symbol::init_base_output_segment): Likewise.
13765         (Symbol::init_base_constant): Likewise.
13766         (Symbol::init_base_undefined): Likewise.
13767         (Symbol::output_section): Assert that object is not a plugin.
13768         (Symbol_table::add_from_pluginobj): New function.
13769         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
13770         undefined.
13771         (Symbol_table::sized_write_globals): Likewise.
13772         (Symbol_table::add_from_pluginobj): Instantiate template.
13773         * symtab.h (Sized_pluginobj): Declare.
13774         (Symbol::in_real_elf): New function.
13775         (Symbol::set_in_real_elf): New function.
13776         (Symbol::in_real_elf_): New field.
13777         (Symbol_table::add_from_pluginobj): New function.
13778
13779         * testsuite/Makefile.am (AM_CFLAGS): New variable.
13780         (LIBDL): New variable.
13781         (LDADD): Add LIBDL.
13782         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
13783         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
13784         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
13785         (MOSTLYCLEANFILES): Likewise.
13786         * testsuite/Makefile.in: Regenerate.
13787         * testsuite/plugin_test.c: New file.
13788         * testsuite/plugin_test_1.sh: New file.
13789         * testsuite/plugin_test_2.sh: New file.
13790
13791 2008-09-16  Ian Lance Taylor  <iant@google.com>
13792
13793         * target-reloc.h (relocate_section): Check whether a symbol is
13794         defined by the ABI before reporting an undefined symbol error.
13795         * target.h (Target::is_defined_by_abi): Make parameter const.
13796         (Target::do_is_defined_by_abi): Likewise.
13797         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
13798         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
13799         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
13800         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
13801         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
13802         * testsuite/Makefile.in: Rebuild.
13803
13804         * fileread.cc (make_view): Add casts to avoid warning.
13805
13806 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
13807
13808         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
13809         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
13810
13811 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
13812
13813         * options.h (General_options::output_is_executable): New.
13814         (General_options::output_is_pie): New.
13815         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
13816         for shared libraries.
13817         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
13818
13819 2008-09-11  Chris Demetriou  <cgd@google.com>
13820
13821         * options.h (origin): New -z option.
13822         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
13823         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
13824         in DT_FLAGS_1.
13825
13826 2008-09-05  Cary Coutant  <ccoutant@google.com>
13827
13828         * fileread.cc (File_read::make_view): Add check for attempt to map
13829         beyond end of file.
13830
13831 2008-09-05  Cary Coutant  <ccoutant@google.com>
13832
13833         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
13834         explicit instantiations.
13835
13836 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
13837
13838         PR gold/6858
13839         * options.cc (General_options::finalize): Allow undefined symbols
13840         in shlibs if linking -shared.
13841
13842         PR gold/6859
13843         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
13844         symbols as not needing a dynsym entry.
13845
13846 2008-08-20  Craig Silverstein  <csilvers@google.com>
13847
13848         * fileread.cc (File_read::open): Do not lock the file unless it
13849         was successfully opened.
13850
13851 2008-08-14  Cary Coutant  <ccoutant@google.com>
13852
13853         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
13854         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
13855         * testsuite/tls_test.cc (struct int128): 128-bit struct
13856         for testing TLS relocs with non-zero addend.
13857         (v12): New TLS variable.
13858         (t12): New test.
13859         (t_last): Add check for v12.
13860         * testsuite/tls_test.h (t12): New function.
13861         * testsuite/tls_test_main.cc (thread_routine): Call new test.
13862
13863 2008-08-13  Ian Lance Taylor  <iant@google.com>
13864
13865         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
13866         set tls_segment_ or relro_segment_.
13867         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
13868         when appropriate.
13869         * output.h (Output_section::clear_is_relro): New function.
13870         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
13871         sections specially even when output_data_ is empty.
13872         (Output_segment::maximum_alignment): When first section is relro,
13873         only force alignment for PT_LOAD segments.
13874         * script.cc (script_data_segment_align): New function.
13875         (script_data_segment_relro_end): New function.
13876         * script-c.h (script_data_segment_align): Declare.
13877         (script_data_segment_relro_end): Declare.
13878         * script-sections.h (class Script_sections): Declare
13879         data_segment_align and data_segment_relro_end.  Add fields
13880         segment_align_index_ and saw_relro_end_.
13881         * script-sections.cc (class Sections_element): Add set_is_relro
13882         virtual function.  Add new bool* parameter to place_orphan_here.
13883         Add get_output_section virtual function.
13884         (class Output_section_definition): Add set_is_relro.  Add new
13885         bool* parameter to place_orphan_here.  Add get_output_section.
13886         Add is_relro_ field.
13887         (Output_section_definition::Output_section_definition): Initialize
13888         evaluated_address_, evaluated_load_address, evaluated_addralign_,
13889         and is_relro_ fields.
13890         (Output_section_definition::place_orphan_here): Add is_relro
13891         parameter.
13892         (Output_section_definition::set_section_addresses): Set relro for
13893         output section.
13894         (Output_section_definition::alternate_constraint): Likewise.
13895         (class Orphan_output_section): Add new bool* parameter to
13896         place_orphan_here.  Add get_output_section.
13897         (Orphan_output_section::place_orphan_here): Add is_relro
13898         parameter.
13899         (Script_sections::Script_sections): Initialize
13900         data_segment_align_index_ and saw_relro_end_.
13901         (Script_sections::data_segment_align): New function.
13902         (Script_sections::data_segment_relro_end): New function.
13903         (Script_sections::place_orphan): Set or clear is_relro.
13904         (Script_sections::set_section_addresses): Force alignment of first
13905         TLS section.
13906         * yyscript.y (exp): Call script_data_segment_align and
13907         script_data_segment_relro_end.
13908         * testsuite/relro_script_test.t: New file.
13909         * testsuite/relro_test.cc (using_script): Declare.
13910         (t1, t2): Test using_script.
13911         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
13912         (relro_script_test_SOURCES): Define.
13913         (relro_script_test_DEPENDENCIES): Define.
13914         (relro_script_test_LDFLAGS): Define.
13915         (relro_script_test_LDADD): Define.
13916         (relro_script_test.so): New target.
13917         * testsuite/Makefile.in: Rebuild.
13918
13919 2008-08-06  Cary Coutant <ccoutant@google.com>
13920
13921         * archive.cc (Archive::total_archives, Archive::total_members)
13922         (Archive::total_members_loaded): New variables.
13923         (Archive::setup): Add parameter.  Add option to preread
13924         archive symbols.
13925         (Archive::read_armap): Add counter.
13926         (Archive::get_file_and_offset): New function.
13927         (Archive::get_elf_object_for_member): New function.
13928         (Archive::read_all_symbols): New function.
13929         (Archive::read_symbols): New function.
13930         (Archive::add_symbols): Add counters.
13931         (Archive::include_all_members): Use armap to find members if it's
13932         already built.
13933         (Archive::include_member): Skip reading symbols if already read.
13934         Factored code into Archive::get_file_and_offset and
13935         Archive::get_elf_object_for_member.  Changed call to
13936         Mapfile::report_include_archive_member.
13937         (Archive::print_stats): New function.
13938         * archive.h: Declare Object and Read_symbols_data classes.
13939         (Archive::Archive): Add initializers for new members.
13940         (Archive::setup): Add parameter.
13941         (Archive::print_stats): New function.
13942         (Archive::total_archives, Archive::total_members)
13943         (Archive::total_members_loaded): New variables.
13944         (Archive::get_file_and_offset): New function.
13945         (Archive::get_elf_object_for_member): New function.
13946         (Archive::read_all_symbols): New function.
13947         (Archive::read_symbols): New function.
13948         (Archive::Archive_member): New class.
13949         (Archive::members_): New member.
13950         (Archive::num_members_): New member.
13951         * main.cc: Include archive.h.
13952         (main): Call Archive::print_stats.
13953         * mapfile.cc (Mapfile::report_include_archive_member): Delete
13954         archive parameter; member_name is now the fully-decorated name.
13955         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
13956         * options.h: (General_options): Add --preread-archive-symbols option.
13957         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
13958         Archive::setup.
13959
13960 2008-08-04  Ian Lance Taylor  <iant@google.com>
13961
13962         * symtab.h (Symbol::use_plt_offset): New function.
13963         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
13964         * powerpc.cc (Relocate::relocate): Likewise.
13965         * sparc.cc (Relocate::relocate): Likewise.
13966         * x86_64.cc (Relocate::relocate): Likewise.
13967         * testsuite/weak_plt.sh: New test.
13968         * testsuite/weak_plt_main.cc: New test.
13969         * testsuite/weak_plt_shared.cc: New test.
13970         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
13971         (check_PROGRAMS): Add weak_plt.
13972         (check_DATA): Add weak_plt_shared.so.
13973         (weak_plt_main_pic.o, weak_plt): New targets.
13974         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
13975         * testsuite/Makefile.in: Rebuild.
13976
13977         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
13978         gcctestdir/ld.
13979         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
13980         * testsuite/Makefile.in: Rebuild.
13981
13982 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
13983
13984         * Makefile.am (POTFILES.in): Set LC_ALL=C.
13985         * Makefile.in: Regenerate.
13986         * po/POTFILES.in: Regenerate.
13987
13988 2008-07-29  Ian Lance Taylor  <iant@google.com>
13989
13990         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
13991         symbols before other symbols.
13992         * testsuite/script_test_2.cc (test_addr): Declare.
13993         (test_addr_alias): Declare.
13994         (main): Check that test_addr and test_addr_alias have the right
13995         values.
13996         * testsuite/script_test_2.t: Define test_addr_alias and
13997         test_addr.
13998
13999 2008-07-24  Ian Lance Taylor  <iant@google.com>
14000
14001         PR 5990
14002         * descriptors.cc: New file.
14003         * descriptors.h: New file.
14004         * gold-threads.h (class Hold_optional_lock): New class.
14005         * fileread.cc: Include "descriptors.h".
14006         (File_read::~File_read): Release descriptor rather than closing
14007         it.
14008         (File_read::open) [file]: Call open_descriptor rather than open.
14009         Set is_descriptor_opened_.
14010         (File_read::open) [memory]: Assert that descriptor is not open.
14011         (File_read::reopen_descriptor): New function.
14012         (File_read::release): Release descriptor.
14013         (File_read::do_read): Make non-const.  Reopen descriptor.
14014         (File_read::read): Make non-const.
14015         (File_read::make_view): Reopen descriptor.
14016         (File_read::do_readv): Likewise.
14017         * fileread.h (class File_read): Add is_descriptor_opened_ field.
14018         Update declarations.
14019         * layout.cc: Include "descriptors.h".
14020         (Layout::create_build_id): Use open_descriptor rather than open.
14021         * output.cc: Include "descriptors.h".
14022         (Output_file::open): Use open_descriptor rather than open.
14023         * archive.cc (Archive::const_iterator): Change Archive to be
14024         non-const.
14025         (Archive::begin, Archive::end): Make non-const.
14026         (Archive::count_members): Likewise.
14027         * archive.h (class Archive): Update declarations.
14028         * object.h (Object::read): Make non-const.
14029         * Makefile.am (CCFILES): Add descriptors.cc.
14030         (HFILES): Add descriptors.h.
14031         * Makefile.in: Rebuild.
14032
14033         PR 6716
14034         * gold.h: Always include <clocale>.  Add Solaris workarounds
14035         following code in binutils/sysdep.h.
14036
14037         PR 6048
14038         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
14039         this->eh_frame_hdr_ is NULL before using it.
14040
14041         * dynobj.cc (Versions::Versions): Update comment.
14042
14043         * dynobj.cc (Versions::Versions): If there is an soname, use it as
14044         the base version name.
14045
14046         * stringpool.cc (Stringpool_template::add_with_length): Set key to
14047         array size plus one.
14048         (Stringpool_template::set_string_offsets): Subtract one from key
14049         before using it as an array index.
14050         (Stringpool_template::get_offset_with_length): Likewise.
14051         (Stringpool_template::write_to_buffer): Likewise.
14052         * stringpool.h (Stringpool_template::get_offset_from_key):
14053         Likewise.
14054
14055 2008-07-23  Ian Lance Taylor  <iant@google.com>
14056
14057         PR 6658
14058         * object.h (Merged_symbol_value::value): Do our best to handle a
14059         negative addend.
14060
14061         PR 6647
14062         * script.cc (Version_script_info::get_versions): Don't add empty
14063         version tag to return value.
14064         (Version_script_info::get_symbol_version_helper): Change return
14065         type to bool.  Add pversion parameter.  Change all callers.
14066         (script_register_vers_node): Don't require a non-NULL tag.
14067         * script.h (class Version_script_info): Update declarations.
14068         (Version_script_info::get_symbol_version): Change return type to
14069         bool.  Add version parameter.  Change all callers.
14070         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
14071         handling.  Handle an empty version from a version script.
14072         (Symbol_table::define_special_symbol): Likewise.
14073         * testsuite/ver_test_10.script: New file.
14074         * testsuite/ver_test_10.sh: New file.
14075         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
14076         (check_DATA): Add ver_test_10.syms.
14077         (ver_test_10.syms, ver_test_10.so): New target.
14078         * testsuite/Makefile.in: Rebuild.
14079
14080 2008-07-23  Simon Baldwin  <simonb@google.com>
14081
14082         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
14083         to zero for undefined symbols from dynamic libraries.
14084
14085 2008-07-23  Ian Lance Taylor  <iant@google.com>
14086
14087         * symtab.cc (Symbol_table::resolve): Remove version parameter.
14088         Change all callers.
14089         * symtab.h (class Symbol_table): Update declaration.
14090         * testsuite/ver_test_9.cc: New file.
14091         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
14092         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
14093         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
14094         (ver_test_9.so, ver_test_9.o): New targets.
14095         * testsuite/Makefile.in: Rebuild.
14096
14097 2008-07-22  Ian Lance Taylor  <iant@google.com>
14098
14099         * options.h (class General_options): Define --check-sections.
14100         * layout.cc (Layout::set_segment_offsets): Handle
14101         --check-sections.
14102
14103         * options.h (class General_options): Define -n/--nmagic and
14104         -N/--omagic.
14105         * options.cc (General_options::finalize): For -n/--nmagic or
14106         -N/--omagic, set -static.
14107         * layout.cc (Layout::attach_allocated_section_to_segment): If
14108         -N/--omagic, don't put read-only and read-write sections in
14109         different segments.
14110         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
14111         finding a read-only segment.
14112         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
14113         don't set the minimum segment alignment to the common page size,
14114         and don't set the file offset to the address modulo the page size.
14115         * script-sections.cc (Script_sections::create_segments): If
14116         -n/--omagic, don't put read-only and read-write sections in
14117         different segments.
14118
14119         * cref.cc: New file.
14120         * cref.h: New file.
14121         * options.h (class General_options): Add --print-symbol-counts.
14122         * main.cc (main): Issue defined symbol report if requested.
14123         * archive.cc (Archive::interpret_header): Make into a const member
14124         function.
14125         (Archive::add_symbols): Call Input_objects::archive_start and
14126         archive_stop.
14127         (Archive::const_iterator): Define new class.
14128         (Archive::begin, Archive::end): New functions.
14129         (Archive::include_all_members): Rewrite to use iterator.
14130         (Archive::count_members): New function.
14131         * archive.h (class Archive): Update declarations.
14132         (Archive::filename): New function.
14133         * object.cc: Include "cref.h".
14134         (Sized_relobj::Sized_relobj): Initialize defined_count_.
14135         (Sized_relobj::do_get_global_symbol_counts): New function.
14136         (Input_objects::add_object): Add object to cross-referencer.
14137         (Input_objects::archive_start): New function.
14138         (Input_objects::archive_stop): New function.
14139         (Input_objects::print_symbol_counts): New function.
14140         * object.h: Declare Cref and Archive.
14141         (Object::get_global_symbol_counts): New function.
14142         (Object::do_get_global_symbol_counts): New pure virtual function.
14143         (class Sized_relobj): Add defined_count_ field.  Update
14144         declarations.
14145         (class Input_objects): Add cref_ field.  Update constructor.
14146         Update declarations.
14147         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
14148         defined_count_.
14149         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
14150         symbol counts.
14151         (Sized_dynobj::do_get_global_symbol_counts): New function.
14152         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
14153         defined_count_.  Update declarations.  Define Symbols typedef.
14154         * symtab.cc (Symbol_table::add_from_relobj): Add defined
14155         parameter.  Change all callers.
14156         (Symbol_table::add_from_dynobj): Add sympointers and defined
14157         parameters.  Change all callers.
14158         * symtab.h (class Symbol_table): Update declarations.
14159         * Makefile.am (CCFILES): Add cref.cc.
14160         (HFILES): Add cref.h.
14161         * Makefile.in: Rebuild.
14162
14163 2008-07-22  Simon Baldwin  <simonb@google.com>
14164
14165         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
14166         to zero when writing undefined symbols.
14167
14168 2008-07-22  Ian Lance Taylor  <iant@google.com>
14169
14170         * output.cc (Output_section::add_input_section): Don't try to
14171         merge empty merge sections.
14172
14173 2008-07-21  Craig Silverstein  <csilvers@google.com>
14174
14175         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
14176         Include symbol version in error message.
14177
14178 2008-07-20  Chris Demetriou  <cgd@google.com>
14179
14180         * configure.ac (gold_cv_c_random_seed): New configured variable.
14181         (RANDOM_SEED_CFLAGS): New substituted variable.
14182         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
14183         * configure: Rebuild.
14184         * Makefile.in: Likewise.
14185         * testsuite/Makefile.in: Likewise.
14186
14187 2008-07-18  Ian Lance Taylor  <iant@google.com>
14188
14189         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
14190         where we see NAME/NULL and NAME/VERSION  as separate symbols.
14191         * testsuite/ver_test_main.cc (main): Call t4.
14192         (t4, t4_2a): Define.
14193         * testsuite/ver_test_2.cc (t4_2): Define.
14194         * testsuite/ver_test_2.script: Put t4_2a in VER2.
14195         * testsuite/ver_test_4.cc (t4_2a): Define.
14196         * testsuite/ver_test_4.script: Put t4_2a in VER2.
14197         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
14198
14199 2008-07-17  Ian Lance Taylor  <iant@google.com>
14200
14201         * dynobj.cc (Versions::add_def): If we give an error about a
14202         missing version, go ahead and create the version anyhow.
14203
14204 2008-07-10  Ian Lance Taylor  <iant@google.com>
14205
14206         Handle output sections with more than 0x7fffffff bytes.
14207         * object.h (class Relobj): Change map_to_output_ to
14208         output_sections_, and just keep a section pointer.  Change all
14209         uses.  Move comdat group support to Sized_relobj.
14210         (Relobj::is_section_specially_mapped): Remove.
14211         (Relobj::output_section): Remove poff parameter.  Change all
14212         callers.
14213         (Relobj::output_section_offset): New function.
14214         (Relobj::set_section_offset): Rewrite.
14215         (Relobj::map_to_output): Remove.
14216         (Relobj::output_sections): New function.
14217         (Relobj::do_output_section_offset): New pure virtual function.
14218         (Relobj::do_set_section_offset): Likewise.
14219         (class Sized_relobj): Add section_offsets_ field.  Add comdat
14220         group support from Relobj.  Update declarations.
14221         (Sized_relobj::get_output_section_offset): New function.
14222         (Sized_relobj::do_output_section_offset): New function.
14223         (Sized_relobj::do_set_section_offset): New function.
14224         * object.cc (Relobj::output_section_address): Remove.
14225         (Sized_relobj::Sized_relobj): Initialize new fields.
14226         (Sized_relobj::include_section_group): Cast find_kept_object to
14227         Sized_relobj.
14228         (Sized_relobj::include_linkonce_section): Likewise.
14229         (Sized_relobj::do_layout): Use separate arrays for output section
14230         and output offset.
14231         (Sized_relobj::do_count_local_symbols): Change map_to_output to
14232         output_sections.
14233         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
14234         output_sections and section_offsets.
14235         (Sized_relobj::write_local_symbols): Likewise.
14236         (map_to_kept_section): Compute output address directly.
14237         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
14238         output_sections and section_offsets.
14239         (Sized_relobj::write_sections): Likewise.
14240         (Sized_relobj::relocate_sections): Likewise.
14241         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
14242         * output.h (class Output_reloc): Update declarations.  Change
14243         u2_.relobj to Sized_relobj*.
14244         (class Output_data_reloc): Change add functions to use
14245         Sized_relobj*.
14246         * output.cc (Output_reloc::Output_reloc): Change relobj to
14247         Sized_relobj*.
14248         (Output_reloc::local_section_offset): Change return type to
14249         Elf_Addr.  Use get_output_section_offset.
14250         (Output_reloc::get_address): Likewise.
14251         (Output_section::is_input_address_mapped): Don't call
14252         is_section_specially_mapped.
14253         (Output_section::output_offset): Likewise.
14254         (Output_section::output_address): Likewise.
14255         (Output_section::starting_output_address): Likewise.
14256         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
14257         parameter to Sized_relobj*.
14258         (Copy_relocs::need_copy_reloc): Likewise.
14259         (Copy_relocs::save): Likewise.
14260         * copy-relocs.h (class Copy_relocs): Update declarations.
14261         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
14262         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
14263         * target-reloc.h (relocate_for_relocatable): Change
14264         offset_in_output_section type to Elf_Addr.  Change code that uses
14265         it as well.
14266         * layout.cc (Layout::layout): Always set *off.
14267         * mapfile.cc (Mapfile::print_input_section): Use
14268         output_section_offset.
14269         * i386.cc (Target_i386::copy_reloc): Change object parameter to
14270         Sized_relobj*.
14271         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
14272         * sparc.cc (Target_sparc::copy_reloc): Likewise.
14273         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
14274
14275 2008-07-03  Ian Lance Taylor  <iant@google.com>
14276
14277         * layout.cc (Layout::include_section): Do not discard unrecognized
14278         SHT_STRTAB sections.
14279
14280 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
14281
14282         * script.cc (Lex::can_continue_name): Make '?' allowable in
14283         version-script names.
14284         * testsuite/version_script.map: Change glob pattern to use '?'
14285
14286 2008-06-30  Manish Singh  <yosh@gimp.org>
14287
14288         PR 6585
14289         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
14290         Correct typo.
14291
14292 2008-06-30  Ian Lance Taylor  <iant@google.com>
14293
14294         PR 6660
14295         PR 6682
14296         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
14297         versions]: Don't try to read the value in the contents, since we
14298         don't use it.  Use the template endianness when writing.
14299
14300 2008-06-25  Cary Coutant  <ccoutant@google.com>
14301
14302         * fileread.cc (File_read::make_view): Assert on zero-length view.
14303         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
14304         symbol table when there are no symbols to read.
14305
14306 2008-06-23  Craig Silverstein  <csilvers@google.com>
14307
14308         * version.cc (version_string): Bump to 1.7
14309
14310 2008-06-18  Craig Silverstein  <csilvers@google.com>
14311
14312         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
14313         constant 0xFFFF to type Valtype.
14314         (Powerpc_relocate_functions::rel16_ha): Likewise.
14315
14316 2008-06-17  Ian Lance Taylor  <iant@google.com>
14317
14318         * output.h (Output_section::Input_section): Initialize p2align_ to
14319         zero for Output_section_data constructors.
14320         (Output_section::Input_section::addralign): If not an input
14321         section, return the alignment of the Output_section_data.
14322         * testsuite/copy_test.cc: New file.
14323         * testsuite/copy_test_1.cc: New file.
14324         * testsuite/copy_test_2.cc: New file.
14325         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
14326         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
14327         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
14328         (copy_test_1_pic.o, copy_test_1.so): New targets.
14329         (copy_test_2_pic.o, copy_test_2.so): New targets.
14330         * testsuite/Makefile.in: Rebuild.
14331
14332         * script-sections.cc (Script_sections::place_orphan): Initialize
14333         local variable exact.
14334
14335 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
14336
14337         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
14338
14339 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
14340             David S. Miller  <davem@davemloft.net>
14341
14342         * powerpc.cc: New file.
14343         * Makefile.am (TARGETSOURCES): Add powerpc.cc
14344         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
14345         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
14346         * Makefile.in: Rebuild.
14347
14348 2008-06-09  Ian Lance Taylor  <iant@google.com>
14349
14350         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
14351         <exception>.
14352         (throwing, orig_terminate): New static variables.
14353         (terminate_handler): New static function.
14354         (t2): Set terminate handler.
14355
14356 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
14357
14358         PR 6584
14359         * binary.cc (Binary_to_elf::sized_convert): Fix .data
14360         alignment.
14361
14362 2008-05-30  Cary Coutant  <ccoutant@google.com>
14363
14364         * archive.cc (Archive::include_all_members) Correct to step
14365         over symbol table and extended name table in thin archives.
14366
14367 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
14368
14369         PR 6407
14370         * target-reloc.h (relocate_for_relocatable): Fix new_offset
14371         calculation.
14372
14373 2008-05-28  Caleb Howe  <cshowe@google.com>
14374
14375         * reduced_debug_output.cc: New file.
14376         * reduced_debug_output.h: New file.
14377         * options.h (class General_options): Add --strip-debug-non-line.
14378         * options.cc (General_options::finalize): Add strip_debug_non_line
14379         to the strip heirarchy.
14380         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
14381         fields.
14382         * layout.cc: Include "reduced_debug_output.h".
14383         (Layout::Layout): Initialize new fields.
14384         (line_only_debug_sections): New static array.
14385         (is_lines_only_debug_sections): New static inline function.
14386         (Layout::include_section): Handle --strip-debug-non-line.
14387         (Layout::make_output_section): If --strip-debug-non-line, build
14388         new output sections for .debug_abbrev and .debug_info.
14389         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
14390         gold.  Warn about possible overflow.
14391         (read_signed_LEB_128): Likewise.
14392         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
14393         (read_signed_LEB_128): Declare.
14394         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
14395         (HFILES): Add reduced_debug_output.h.
14396         * Makefile.in: Rebuild.
14397
14398 2008-05-21  Ian Lance Taylor  <iant@google.com>
14399
14400         * mapfile.cc: New file.
14401         * mapfile.h: New file.
14402         * options.h (class General_options): Add -M/--print-map and -Map.
14403         * options.cc (General_options::finalize): Make -M equivalent to
14404         -Map -.
14405         * main.cc: Include <cstdio> and "mapfile.h".
14406         (main): Open mapfile if requested.
14407         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
14408         constructor.  Change caller.
14409         (queue_initial_tasks): Add mapfile parameter.  Change caller.
14410         (queue_middle_tasks): Likewise.
14411         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
14412         declarations.
14413         * archive.cc: Include "mapfile.h".
14414         (Archive::add_symbols): Add mapfile parameter.  Change all
14415         callers.  Pass mapfile, symbol, and reason to include_member.
14416         (Archive::include_all_members): Add mapfile parameter.  Change all
14417         callers.
14418         (Archive::include_member): Add mapfile, sym, and why parameters.
14419         Change all callers.  Report inclusion to map file.
14420         * archive.h: Include "fileread.h".
14421         (class Archive): Update declarations.
14422         (Archive::file): New const method.
14423         (class Add_archive_symbols): Add mapfile_ field.  Update
14424         constructor.  Change all callers.
14425         * readsyms.h (class Read_symbols): Likewise.
14426         (class Finish_group): Likewise.
14427         (class Read_script): Likewise.
14428         * common.cc: Include "mapfile.h".
14429         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
14430         all callers.
14431         (Symbol_table::do_allocate_commons): Likewise.
14432         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
14433         symbol allocation to mapfile.
14434         * common.h (class Allocate_commons_task): Add mapfile_ field.
14435         Update constructor.  Change all callers.
14436         * symtab.h (class Symbol_table): Update declarations.
14437         * layout.cc: Include "mapfile.h".
14438         (Layout_task_runner::run): Print information to mapfile.
14439         (Layout::create_gold_note): Change Output_data_fixed_space to
14440         Output_data_zero_fill.
14441         (Layout::create_build_id): Likewise.
14442         (Layout::print_to_mapfile): New function.
14443         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
14444         constructor.  Change caller.
14445         (class Layout): Declare print_to_mapfile.
14446         * output.cc (Output_section::Input_section::print_to_mapfile): New
14447         function.
14448         (Output_section::add_input_section): If producing a map, always
14449         add to input_sections_ list.
14450         (Output_section::do_print_to_mapfile): New function.
14451         (Output_segment::print_sections_to_mapfile): New function.
14452         (Output_segment::print_section_list_to_mapfile): New function.
14453         * output.h: Include "mapfile.h".
14454         (Output_data::print_to_mapfile): New function.
14455         (Output_data::do_print_to_mapfile): New virtual function.
14456         (Output_segment_headers::do_print_to_mapfile): New function.
14457         (Output_file_header::do_print_to_mapfile): New function.
14458         (Output_data_const::do_print_to_mapfile): New function.
14459         (class Output_data_const_buffer): Add map_name_ field.  Update
14460         constructor.  Change all callers.  Add do_print_to_mapfile
14461         function.
14462         (class Output_data_fixed_space): Likewise.
14463         (class Output_data_space): Likewise.
14464         (class Output_data_zero_fill): New class.
14465         (Output_data_strtab::do_print_to_mapfile): New function.
14466         (Output_data_reloc_base::do_print_to_mapfile): New function.
14467         (Output_relocatable_relocs::do_print_to_mapfile): New function.
14468         (Output_data_group::do_print_to_mapfile): New function.
14469         (Output_data_got::do_print_to_mapfile): New function.
14470         (Output_data_dynamic::do_print_to_mapfile): New function.
14471         (Output_symtab_xindex::do_print_to_mapfile): New function.
14472         (class Output_section): Declare do_print_to_mapflie.  Declare
14473         print_to_mapfile in Input_section.
14474         (class Output_segment): Declare new functions.
14475         * object.h (Sized_relobj::symbol_count): New function.
14476         * script-sections.cc
14477         (Output_section_element_dot_assignment::set_section_addresses):
14478         Change Output_data_fixed_space to Output_data_zero_fill.
14479         (Output_data_expression::do_print_to_mapfile): New function.
14480         * script.cc (read_input_script): Add mapfile parameter.  Change
14481         all callers.
14482         * script.h (read_input_script): Update declaration.
14483         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
14484         (Eh_frame::do_print_to_mapfile): New function.
14485         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
14486         (Output_merge_string::do_print_to_mapfile): New function.
14487         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
14488         function.
14489         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
14490         function.
14491         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
14492         function.
14493         * Makefile.am (CCFILES): Add mapfile.cc.
14494         (HFILES): Add mapfile.h.
14495         * Makefile.in: Rebuild.
14496
14497 2008-05-19  Ian Lance Taylor  <iant@google.com>
14498
14499         * options.h (class General_options): Add -z relro.
14500         * layout.cc (Layout::Layout): Initialize relro_segment_.
14501         (Layout::add_output_section_data): Return the output section.
14502         (Layout::make_output_section): Rcognize relro sections and mark
14503         them appropriately.
14504         (Layout::attach_allocated_section_to_segment): Put relro sections
14505         in a PT_GNU_RELRO segment.
14506         (Layout::create_initial_dynamic_sections): Mark the .dynamic
14507         section as relro.
14508         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
14509         PT_TLS segments.
14510         (Layout::linkonce_mapping): Map d.rel.ro.local to
14511         .data.rel.ro.local.
14512         (Layout::output_section_name): Us .data.rel.ro.local for any
14513         section which begins with that.
14514         * layout.h (class Layout): Update add_output_section_data
14515         declaration.  Add relro_segment_ field.
14516         * output.cc (Output_section::Output_section): Initialize is_relro_
14517         and is_relro_local_ fields.
14518         (Output_segment::add_output_section): Group relro sections.
14519         (Output_segment::is_first_section_relro): New function.
14520         (Output_segment::maximum_alignment): If there is a relro section,
14521         align the segment to the common page size.
14522         (Output_segment::set_section_addresses): Track whether we are
14523         looking at relro sections.  If the last section is a relro
14524         section, align to the common page size.
14525         (Output_segment::set_section_list_addresses): Add in_relro
14526         parameter.  Change all callers.  Align to the page size when
14527         moving from relro to non-relro section.
14528         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
14529         segment.
14530         * output.h (class Output_section): Add is_relro_ and
14531         is_relro_local_ fields.
14532         (Output_section::is_relro): New function.
14533         (Output_section::set_is_relro): New function.
14534         (Output_section::is_relro_local): New function.
14535         (Output_section::set_is_relro_local): New function.
14536         (class Output_segment): Update declarations.
14537         * i386.cc (Target_i386::got_section): Mark .got section as relro.
14538         * sparc.cc (Target_sparc::got_section): Likewise.
14539         * x86_64.cc (Target_x86_64::got_section): Likewise.
14540         * testsuite/relro_test_main.cc: New file.
14541         * testsuite/relro_test.cc: New file.
14542         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
14543         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
14544         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
14545         (relro_test.so, relro_test_pic.o): New targets.
14546         * testsuite/Makefile.in: Rebuild.
14547
14548 2008-05-16  Ian Lance Taylor  <iant@google.com>
14549
14550         * output.cc (Output_segment::add_output_section): Remove front
14551         parameter.
14552         * output.h (class Output_segment): Remove
14553         add_initial_output_section and overloaded add_output_section.
14554         Update declaration of remaining add_output_section.
14555         * layout.cc (Layout::create_interp): Call add_output_section
14556         rather than add_initial_output_section.
14557         (Layout::finish_dynamic_section): Likewise.
14558
14559         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
14560         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
14561         know the dynamic type.
14562         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
14563         field.  Initialize it in constructor.
14564         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
14565         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
14566         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
14567         reloc.
14568
14569         * output.cc (Output_reloc::get_address): Change return type to
14570         Elf_Addr.
14571         * output.h (class Output_reloc): Update get_address declaration.
14572         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
14573         for section addresses.
14574
14575 2008-05-09  Ian Lance Taylor  <iant@google.com>
14576
14577         PR 6493
14578         * gold.cc (gold_nomem): Use return value of write.
14579
14580 2008-05-08  Ian Lance Taylor  <iant@google.com>
14581
14582         * symtab.c (Symbol::init_base_output_data): Add version
14583         parameter.  Change all callers.
14584         (Symbol::init_base_output_segment): Likewise.
14585         (Symbol::init_base_constant): Likewise.
14586         (Symbol::init_base_undefined): Likewise.
14587         (Sized_symbol::init_output_data): Likewise.
14588         (Sized_symbol::init_output_segment): Likewise.
14589         (Sized_symbol::init_constant): Likewise.
14590         (Sized_symbol::init_undefined): Likewise.
14591         (Symbol_table::do_define_in_output_data): If the new symbol has a
14592         version, mark it as the default.
14593         (Symbol_table::do_define_in_output_segment): Likewise.
14594         (Symbol_table::do_define_as_constant): Likewise.
14595         * symtab.h (class Symbol): Update declarations.
14596         (class Sized_symbol): Likewise.
14597         * resolve.cc (Symbol::override_version): New function.
14598         (Symbol::override_base): Call override_version.
14599         (Symbol::override_base_with_special): Likewise.
14600         * testsuite/ver_script_8.script: New file.
14601         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
14602         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
14603         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
14604         (ver_test_8_1.so, ver_test_8_2.so): New targets.
14605
14606 2008-05-06  Ian Lance Taylor  <iant@google.com>
14607
14608         PR 6049
14609         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
14610         functions.
14611         (class General_options): Remove existing --undefined, and add
14612         --no-undefined instead.  Add new --undefined as synonym for -u.
14613         * archive.cc (Archive::add_symbols): Check whether symbol was
14614         named with -u.
14615         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
14616         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
14617         all uses.  Add IS_UNDEFINED.  Update declarations to split
14618         different versions of init_base.  Declare init_base_undefined.
14619         (Symbol::is_defined): Handle IS_UNDEFINED.
14620         (Symbol::is_undefined): Likewise.
14621         (Symbol::is_weak_undefined): Call is_undefined.
14622         (Symbol::is_absolute): Handle IS_CONSTANT.
14623         (class Sized_symbol): Update declarations to split different
14624         versions of init.  Declare init_undefined.
14625         (class Symbol_table): Declare new functions.
14626         * symtab.cc (Symbol::init_base_object): Rename from init_base.
14627         Change all callers.
14628         (Symbol::init_base_output_data): Likewise.
14629         (Symbol::init_base_output_segment): Likewise.
14630         (Symbol::init_base_constant): Likewise.
14631         (Symbol::init_base_undefined): New function.
14632         (Sized_symbol::init_object): Rename from init.  Change all
14633         callers.
14634         (Sized_symbol::init_output_data): Likewise.
14635         (Sized_symbol::init_output_segment): Likewise.
14636         (Sized_symbol::init_constant): Likewise.
14637         (Sized_symbol::init_undefined): New function.
14638         (Symbol_table::add_undefined_symbols_from_command_line): New
14639         function.
14640         (Symbol_table::do_add_undefined_symbols_from_command_line): New
14641         function.
14642         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
14643         (Symbol::output_section): Likewise.
14644         (Symbol::set_output_section): Likewise.
14645         (Symbol_table::sized_finalize_symbol): Likewise.
14646         (Symbol_table::sized_write_globals): Likewise.
14647         * resolve.cc (Symbol_table::should_override): Likewise.
14648         (Symbol::override_base_with_special): Likewise.
14649
14650         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
14651         symbol, change it to have default visibility.
14652         * testsuite/protected_1.cc: New file.
14653         * testsuite/protected_2.cc: New file.
14654         * testsuite/protected_3.cc: New file.
14655         * testsuite/protected_main_1.cc: New file.
14656         * testsuite/protected_main_2.cc: New file.
14657         * testsuite/protected_main_3.cc: New file.
14658         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
14659         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
14660         (protected_1_LDFLAGS, protected_1_LDADD): Define.
14661         (protected_1.so): New target.
14662         (protected_1_pic.o, protected_2_pic.o): New targets.
14663         (protected_3_pic.o): New target.
14664         (check_PROGRAMS): Add protected_2.
14665         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
14666         (protected_2_LDFLAGS, protected_2_LDADD): Define.
14667         * testsuite/Makefile.in: Rebuild.
14668
14669         * options.h (DEFINE_var): Add set_user_set_##varname__.
14670         (DEFINE_bool_alias): New macro.
14671         (class General_options): Define -Bstatic using DEFINE_bool_alias
14672         rather than DEFINE_special.  Add --undefined as an alias for -z
14673         defs.
14674         * options.cc (General_options::parse_Bstatic): Remove.
14675
14676         * options.h (class General_options): Add --fatal-warnings.
14677         * main.cc (main): Implement --fatal-warnings.
14678         * errors.h (Errors::warning_count): New function.
14679
14680         * options.h (class General_options): Add -Bsymbolic-functions.
14681         * symtab.h (Symbol::is_preemptible): Check for
14682         -Bsymbolic-functions.
14683
14684 2008-05-05  Ian Lance Taylor  <iant@google.com>
14685
14686         * options.h (DEFINE_bool): For DASH_Z, create the negative option
14687         as noVARNAME rather than no-VARNAME.
14688         (class General_options): Add option -z combreloc.
14689         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
14690         get_address.
14691         (Output_reloc::sort_before) [SHT_REL]: New function.
14692         (Output_reloc::sort_before) [SHT_RELA]: New function.
14693         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
14694         Sort_relocs_comparison.
14695         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
14696         parameter.  Change all callers.
14697         (Output_data_reloc::Output_data_reloc) [both versions]: Add
14698         sort_relocs parameter.  Change all callers.
14699         * output.cc (Output_reloc::get_address): New function, broken out
14700         of write_rel.
14701         (Output_reloc::write_rel): Call it.
14702         (Output_reloc::compare): New function.
14703         (Output_data_reloc_base::do_write): Optionally sort relocs.
14704
14705         * configure.ac: If targ_extra_obj is set, link it in.
14706         * configure.tgt: Initialize all variables.
14707         (x86_64*): Set targ_extra_obj and targ_extra_size.
14708         * configure: Rebuild.
14709
14710         * object.cc (Sized_relobj::include_section_group): Adjust section
14711         indexes read from group data.  Build vector to pass to
14712         layout_group.
14713         * layout.cc (Layout::layout_group): Add flags and shndxes
14714         parameters.  Remove contents parameter.  Change caller.  Update
14715         explicit instantiations.
14716         * layout.h (class Layout): Update layout_group declaration.
14717         * output.cc (Output_data_group::Output_data_group): Add flags and
14718         input_shndxes parameters.  Remove contents parameter.  Change
14719         caller.
14720         (Output_data_group::do_write): Change input_sections_ to
14721         input_shndxes_.
14722         * output.h (class Output_data_group): Update constructor
14723         declaration.  Rename input_sections_ to input_shndxes_.
14724         * testsuite/many_sections_test.cc: Add template.
14725
14726 2008-04-30  Cary Coutant  <ccoutant@google.com>
14727
14728         * target-reloc.h (relocate_section): Fix dead-pointer bug.
14729
14730         * layout.cc (Layout::include_section): Refactored check for debug
14731         info section.
14732         (Layout::add_comdat): Add new parameters.  Change type
14733         of signature parameter.  Add object and shndx to signatures table.
14734         (Layout::find_kept_object): New function.
14735         * layout.h: Include <cstring>.
14736         (Layout::is_debug_info_section): New function.
14737         (Layout::add_comdat): Add new parameters.
14738         (Layout::find_kept_object): New function.
14739         (Layout::Kept_section): New struct.
14740         (Layout::Signatures): Change type of map range.
14741         * object.cc (Relobj::output_section_address): New function.
14742         (Sized_relobj::include_section_group): Add new parameters.  Change
14743         calls to Layout::add_comdat.  Change to build table of kept comdat
14744         groups and table mapping discarded sections to kept sections.
14745         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
14746         (Sized_relobj::do_layout): Change calls to include_section_group and
14747         include_linkonce_section.
14748         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
14749         value to zero when section is discarded.
14750         (Sized_relobj::map_to_kept_section): New function.
14751         * object.h (Relobj::output_section_address): New function.
14752         (Relobj::Comdat_group): New type.
14753         (Relobj::find_comdat_group): New function.
14754         (Relobj::Comdat_group_table): New type.
14755         (Relobj::Kept_comdat_section): New type.
14756         (Relobj::Kept_comdat_section_table): New type.
14757         (Relobj::add_comdat_group): New function.
14758         (Relobj::set_kept_comdat_section): New function.
14759         (Relobj::get_kept_comdat_section): New function.
14760         (Relobj::comdat_groups_): New field.
14761         (Relobj::kept_comdat_sections_): New field.
14762         (Symbol_value::input_value): Update comment.
14763         (Sized_relobj::map_to_kept_section) New function.
14764         (Sized_relobj::include_linkonce_section): Add new parameter.
14765         * target-reloc.h (Comdat_behavior): New type.
14766         (get_comdat_behavior): New function.
14767         (relocate_section): Add code to map a discarded section to the
14768         corresponding kept section when applying a relocation.
14769
14770 2008-04-30  Craig Silverstein  <csilvers@google.com>
14771
14772         * dwarf_reader.cc (next_generation_count): New static var.
14773         (Addr2line_cache_entry): New struct.
14774         (addr2line_cache): New static var.
14775         (Dwarf_line_info::one_addr2line): Added caching.
14776         (Dwarf_line_info::clear_addr2line_cache): New function.
14777         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
14778         cache-size parameter.
14779         (Dwarf_line_info::one_addr2line_cache): New function.
14780         * symtab.cc (Symbol_table::detect_odr_violations): Pass
14781         new cache-size argument to one_addr2line(), and clear cache.
14782
14783 2008-04-28  Cary Coutant  <ccoutant@google.com>
14784
14785         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
14786         R_386_PC8 relocations.
14787
14788 2008-04-23  Ian Lance Taylor  <iant@google.com>
14789
14790         * object.cc (Sized_relobj::include_section_group): Check for
14791         invalid section group.
14792
14793         * object.cc (make_elf_object): Correct test for 64-bit ELF file
14794         header size.
14795
14796         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
14797         than read for file header.
14798         * archive.cc (Archive::include_member): Likewise.
14799
14800 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
14801
14802         * aclocal.m4: Regenerate.
14803         * configure: Regenerate.
14804
14805 2008-04-19  Ian Lance Taylor  <iant@google.com>
14806
14807         * version.cc (version_string): Bump to 1.6.
14808
14809         * testsuite/Makefile.am (many_sections_r_test): New target.
14810         (many_sections_r_test_SOURCES): Remove.
14811         (many_sections_r_test_DEPENDENCIES): Remove.
14812         (many_sections_r_test_LDFLAGS): Remove.
14813         (many_sections_r_test_LDADD): Remove.
14814
14815         * object.cc (Sized_relobj::do_add_symbols): Always pass
14816         local_symbol_count_ to add_from_relobj.
14817
14818         * testsuite/Makefile.am (many_sections_check.h): Only check one in
14819         every thousand variables.
14820         * testsuite/Makefile.in: Rebuild.
14821
14822         * object.cc (Xindex::initialize_symtab_xindex): New function.
14823         (Xindex::read_symtab_xindex): New function.
14824         (Xindex::sym_xindex_to_shndx): New function.
14825         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
14826         available.
14827         (Sized_relobj::do_initialize_xindex): New function.
14828         (Sized_relobj::do_read_symbols): Adjust section links.
14829         (Sized_relobj::symbol_section_and_value): Add is_ordinary
14830         parameter.  Change all callers.
14831         (Sized_relobj::include_section_group): Adjust section links and
14832         symbol section indexes.
14833         (Sized_relobj::do_layout): Adjust section links.
14834         (Sized_relobj::do_count_local_symbols): Adjust section links and
14835         symbol section indexes.
14836         (Sized_relobj::do_finalize_local_symbols): Distinguish between
14837         ordinary and special symbols.
14838         (Sized_relobj::write_local_symbols): Add symtab_xindex and
14839         dynsym_xindex parameters.  Change all callers.  Adjust section
14840         links.  Use SHN_XINDEX when needed.
14841         (Sized_relobj::get_symbol_location_info): Adjust section links.
14842         Don't get fooled by special symbols.
14843         * object.h (class Xindex): Define.
14844         (class Object): Add xindex_ parameter.  Declare virtual functoin
14845         do_initialize_xindex.
14846         (Object::adjust_sym_shndx): New function.
14847         (Object::set_xindex): New protected function.
14848         (class Symbol_value): Add is_ordinary_shndx_ field.
14849         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
14850         (Symbol_value::value): Assert ordinary section.
14851         (Symbol_value::initialize_input_to_output_map): Likewise.
14852         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
14853         Change all callers.
14854         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
14855         all callers.
14856         (class Sized_relobj): Update declarations.
14857         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
14858         parameter.  Change all callers.
14859         (Sized_relobj::adjust_shndx): New function.
14860         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
14861         field.
14862         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
14863         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
14864         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
14865         (Sized_dynobj::read_dynsym_section): Adjust section links.
14866         (Sized_dynobj::read_dynamic): Likewise.
14867         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
14868         section links.
14869         (Sized_dynobj::do_initialize_xindex): New function.
14870         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
14871         do_initialize_xindex.
14872         (Sized_dynobj::adjust_shndx): New function.
14873         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
14874         dynsym_xindex_ fields.
14875         (Layout::finalize): Add a call to set_section_indexes before
14876         creating the symtab sections.
14877         (Layout::set_section_indexes): Don't do anything if the section
14878         already has a section index.
14879         (Layout::create_symtab_sections): Add shnum parameter.  Change
14880         caller.  Create .symtab_shndx section if needed.
14881         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
14882         caller.
14883         (Layout::allocated_output_section_count): New function.
14884         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
14885         needed.
14886         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
14887         fields.  Update declarations.
14888         (Layout::symtab_xindex): New function.
14889         (Layout::dynsym_xindex): New function.
14890         (class Write_symbols_task): Add layout_ field.
14891         (Write_symbols_task::Write_symbols_task): Add layout parameter.
14892         Change caller.
14893         * output.cc (Output_section_headers::Output_section_headers): Add
14894         shstrtab_section parameter.  Change all callers.
14895         (Output_section_headers::do_sized_write): Store overflow values
14896         for section count and section string table section index in
14897         section header zero.
14898         (Output_file_header::do_sized_write): Check for overflow of
14899         section count and section string table section index.
14900         (Output_symtab_xindex::do_write): New function.
14901         (Output_symtab_xindex::endian_do_write): New function.
14902         * output.h (class Output_section_headers): Add shstrtab_section_.
14903         Update declarations.
14904         (class Output_symtab_xindex): Define.
14905         (Output_section::has_out_shndx): New function.
14906         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
14907         field.
14908         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
14909         Change all callers.
14910         (Sized_symbol::init): Likewise.
14911         (Symbol::output_section): Check for ordinary symbol.
14912         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
14913         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
14914         callers.
14915         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
14916         Change all callers.  Simplify handling of symbols from sections
14917         not included in the link.
14918         (Symbol_table::add_from_dynobj): Handle ordinary symbol
14919         distinction.
14920         (Weak_alias_sorter::operator()): Assert that symbols are
14921         ordinary.
14922         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
14923         distinction.
14924         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
14925         parameters.  Change all callers.
14926         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
14927         symbol distinction.  Use SHN_XINDEX when needed.
14928         (Symbol_table::write_section_symbol): Add symtab_xindex
14929         parameter.  Change all callers.
14930         (Symbol_table::sized_write_section_symbol): Likewise.  Use
14931         SHN_XINDEX when needed.
14932         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
14933         declarations.
14934         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
14935         (Symbol::is_defined): Check is_ordinary.
14936         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
14937         (Symbol::is_absolute, Symbol::is_common): Likewise.
14938         (class Sized_symbol): Update declarations.
14939         (class Symbol_table): Update declarations.
14940         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
14941         parameters.  Change all callers.
14942         (Sized_symbol::override): Likewise.
14943         (Symbol_table::override): Likewise.
14944         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
14945         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
14946         is_ordinary, and orig_st_shndx parameters.  Change all callers.
14947         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
14948         to be in an ordinary section.
14949         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
14950         object and is_ordinary parameters.  Change all callers.
14951         (Sized_dwarf_line_info::read_relocs): Add object parameter.
14952         Change all callers.  Don't add undefined or non-ordinary symbols
14953         to reloc_map_.
14954         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
14955         Change all callers.
14956         * dwarf_reader.h (class Sized_dwarf_line_info): Update
14957         declarations.
14958         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
14959         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
14960         (Sized_relobj::relocate_sections): Likewise.
14961         * target-reloc.h (scan_relocs): Adjust section symbol index.
14962         (scan_relocatable_relocs): Likewise.
14963         * i386.cc (Scan::local): Check for ordinary symbols.
14964         * sparc.cc (Scan::local): Likewise.
14965         * x86_64.cc (Scan::local): Likewise.
14966         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
14967         to symbol_section_and_value.
14968         * testsuite/many_sections_test.cc: New file.
14969         * testsuite/Makefile.am (BUILT_SOURCES): Define.
14970         (check_PROGRAMS): Add many_sections_test.
14971         (many_sections_test_SOURCES): Define.
14972         (many_sections_test_DEPENDENCIES): Define.
14973         (many_sections_test_LDFLAGS): Define.
14974         (BUILT_SOURCES): Add many_sections_define.h.
14975         (many_sections_define.h): New target.
14976         (BUILT_SOURCES): Add many_sections_check.h.
14977         (many_sections_check.h): New target.
14978         (check_PROGRAMS): Add many_sections_r_test.
14979         (many_sections_r_test_SOURCES): Define.
14980         (many_sections_r_test_DEPENDENCIES): Define.
14981         (many_sections_r_test_LDFLAGS): Define.
14982         (many_sections_r_test_LDADD): Define.
14983         (many_sections_r_test.o): New target.
14984         * testsuite/Makefile.in: Rebuild.
14985
14986 2008-04-17  Cary Coutant  <ccoutant@google.com>
14987
14988         * errors.cc (Errors::info): New function.
14989         (gold_info): New function.
14990         * errors.h (Errors::info): New function.
14991         * gold.h (gold_info): New function.
14992         * object.cc (Input_objects::add_object): Print trace output.
14993         * options.cc (options::parse_set): New function.
14994         (General_options::parse_wrap): Deleted.
14995         (General_options::General_options): Deleted initializer.
14996         * options.h (options::String_set): New typedef.
14997         (options::parse_set): New function.
14998         (DEFINE_set): New macro.
14999         (General_options::wrap): Changed to use DEFINE_set. Changed
15000         callers of any_wrap_symbols and is_wrap_symbol.
15001         (General_options::trace, General_options::trace_symbol):
15002         New options.
15003         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
15004         (General_options::wrap_symbols_): Deleted.
15005         * symtab.cc (Symbol_table::add_from_object): Print trace output.
15006
15007 2008-04-17  David S. Miller  <davem@davemloft.net>
15008
15009         * options.cc (General_options::parse_V): New function.
15010         * options.h: Add entries for -V and -Qy.
15011
15012 2008-04-17  Ian Lance Taylor  <iant@google.com>
15013
15014         * common.cc (Symbol_table::allocate_commons): Remove options
15015         parameter.  Change caller.
15016         (Symbol_table::do_allocate_commons): Remove options parameter.
15017         Change caller.  Just call do_allocate_commons_list twice.
15018         (Symbol_table::do_allocate_commons_list): New function, broken out
15019         of do_allocate_commons.
15020         * common.h (class Allocate_commons_task): Remove options_ field.
15021         Update constructor.
15022         * symtab.cc (Symbol_table::Symbol_table): Initialize
15023         tls_commons_.
15024         (Symbol_table::add_from_object): Put TLS common symbols on
15025         tls_commons_ list.
15026         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
15027         which are IN_OUTPUT_DATA.
15028         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
15029         allocate_commons and do_allocate_commons declarations.  Declare
15030         do_allocate_commons_list.
15031         * gold.cc (queue_middle_tasks): Update creation of
15032         Allocate_commons_task to not pass options.
15033         * testsuite/Makefile.am (INCLUDES): Add -I.. .
15034         (TLS_TEST_C_FLAGS): New variable.
15035         (tls_test_c_pic.o): New target.
15036         (tls_test_shared.so): Link in tls_test_c_pic.o.
15037         (tls_test_c_pic_ie.o): New target.
15038         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
15039         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
15040         (tls_test_c.o): New target.
15041         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
15042         (tls_pic_test_LDADD): Likewise.
15043         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
15044         (tls_shared_gd_to_ie_test_LDADD): Likewise.
15045         (tls_test_c_gnu2.o): New target.
15046         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
15047         tls_test_c_gnu2.o.
15048         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
15049         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
15050         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
15051         * testsuite/tls_test.cc: Include "config.h".
15052         (t_last): Call t11_last.
15053         * testsuite/tls_test.h (t11, t11_last): Declare.
15054         * testsuite/tls_test_c.c: New file.
15055         * testsuite/tls_test_main.cc (thread_routine): Call t11.
15056         * configure.ac: Check for OpenMP support.
15057         * configure, config.in, Makefile.in: Rebuild.
15058         * testsuite/Makefile.in: Rebuild.
15059
15060 2008-04-16  Cary Coutant  <ccoutant@google.com>
15061
15062         * i386.cc (Target_i386::define_tls_base_symbol): New function.
15063         (Target_i386::tls_base_symbol_defined_): New field.
15064         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
15065         (Target_i386::Scan::global): Likewise.
15066         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
15067         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
15068         (Target_x86_64::tls_base_symbol_defined_): New field.
15069         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
15070         (Target_x86_64::Scan::global): Likewise.
15071
15072 2008-04-16  Cary Coutant  <ccoutant@google.com>
15073
15074         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
15075         (Symbol::needs_plt_entry): Allow weak undefined symbols.
15076         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
15077         building shared libraries.
15078         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
15079         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
15080         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
15081         * testsuite/Makefile.in: Rebuild.
15082         * testsuite/weak_undef.h: New file.
15083         * testsuite/weak_undef_file1.cc: Add extra test cases.
15084         * testsuite/weak_undef_file2.cc: Likewise.
15085         * testsuite/weak_undef_test.cc: Likewise.
15086
15087 2008-04-16  David S. Miller  <davem@davemloft.net>
15088
15089         * sparc.cc (Target_sparc::Scan): Change from struct to class.
15090         Add issued_non_pic_error_ field.  Declare check_non_pic.
15091         (Target_sparc::Scan::check_non_pic): New function.
15092         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
15093         (Target_sparc::Scan::global): Likewise.
15094
15095         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
15096         * configure: Rebuild.
15097
15098         * options.h (DEFINE_enable): New macro.
15099         (new_dtags): New enable option.
15100         (initfirst, interpose, loadfltr, nodefaultlib,
15101         nodelete, nodlopen, nodump): New -z options.
15102         * layout.cc (Layout:finish_dynamic_section): If new
15103         dtags enabled, emit DT_RUNPATH.  Also, emit a
15104         DT_FLAGS_1 containing any specified -z flags.
15105
15106 2008-04-16  Ian Lance Taylor  <iant@google.com>
15107
15108         * copy-relocs.cc: New file.
15109         * copy-relocs.h: New file.
15110         * reloc.cc: Remove Copy_relocs code.
15111         * reloc.h: Likewise.
15112         * reloc-types.h (struct Reloc_types) [both versions]: Add
15113         get_reloc_addend_noerror.
15114         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
15115         variants of add_global which take an addend which must be zero.
15116         * i386.cc: Include "copy-relocs.h".
15117         (class Target_i386): Change type of copy_relocs_ to variable,
15118         update initializer.
15119         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
15120         Change all callers.
15121         (Target_i386::do_finalize_sections): Change handling of
15122         copy_relocs_.
15123         * sparc.cc: Include "copy-relocs.h".
15124         (class Target_sparc): Change type of copy_relocs_ to variable,
15125         update initializer.
15126         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
15127         Change all callers.
15128         (Target_sparc::do_finalize_sections): Change handling of
15129         copy_relocs_.
15130         * x86_64.cc: Include "copy-relocs.h".
15131         (class Target_x86_64): Change type of copy_relocs_ to variable,
15132         update initializer.
15133         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
15134         class.  Change all callers.
15135         (Target_x86_64::do_finalize_sections): Change handling of
15136         copy_relocs_.
15137         * Makefile.am (CCFILES): Add copy-relocs.cc.
15138         (HFILES): Add copy-relocs.h.
15139
15140         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
15141
15142         * testsuite/script_test_4.sh: Permit leading zeroes.
15143
15144 2008-04-15  Ian Lance Taylor  <iant@google.com>
15145
15146         * script-sections.cc (Script_sections::create_segments): Use
15147         header_size_adjustment even when there is enough room for the
15148         headers.
15149         * testsuite/script_test_4.sh: New file.
15150         * testsuite/script_test_4.t: New file.
15151         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
15152         (check_DATA): Add script_test_4.stdout.
15153         (MOSTLYCLEANFILES): Likewise.
15154         (script_test_4): New target.
15155         (script_test_4.stdout): New target.
15156         * testsuite/Makefile.in: Rebuild.
15157
15158         * sparc.cc: Add definitions for Output_data_plt_sparc class
15159         constants.
15160
15161 2008-04-14  David S. Miller  <davem@davemloft.net>
15162
15163         * sparc.cc: New file.
15164         * Makefile.am (TARGETSOURCES): Add sparc.cc
15165         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
15166         * configure.tgt: Document targ_extra_size and
15167         targ_extra_big_endian.  Add entries for sparc-* and
15168         sparc64-*.
15169         * configure.ac: Handle targ_extra_size and
15170         targ_extra_big_endian.
15171         * Makefile.in: Rebuild.
15172         * configure: Likewise.
15173         * po/POTFILES.in: Likewise.
15174         * po/gold.pot: Likewise.
15175
15176 2008-04-14  Ian Lance Taylor  <iant@google.com>
15177
15178         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
15179         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
15180         in the name/type/flags to section mapping.  Don't call
15181         allocate_output_section.
15182         (Layout::choose_output_section): Change parameter from adjust_name
15183         to is_input_section.  Don't permit input sections after sections
15184         are attached to segments.  Don't call allocate_output_section.
15185         (Layout::layout_eh_frame): Call update_flags_for_input_section,
15186         not write_enable_output_section.
15187         (Layout::make_output_section): Don't push to
15188         unattached_section_list_ nor call attach_to_segment.  Call
15189         attach_section_to_segment if sections are attached.
15190         (Layout::attach_sections_to_segments): New function.
15191         (Layout::attach_section_to_segment): New function.
15192         (Layout::attach_allocated_section_to_segment): Rename from
15193         attach_to_segment.  Remove flags parameter.
15194         (Layout::allocate_output_section): Remove function.
15195         (Layout::write_enable_output_section): Remove function.
15196         * layout.h (class Layout): Update for above changes.  Add new
15197         field sections_are_attached_.
15198         * output.h (Output_section::update_flags_for_input_section): New
15199         function.
15200         * output.cc (Output_section::add_input_section): Call
15201         update_flags_for_input_section.
15202         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
15203
15204 2008-04-11  Cary Coutant  <ccoutant@google.com>
15205
15206         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
15207         thought unnecessary.
15208         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
15209
15210 2008-04-11  Ian Lance Taylor  <iant@google.com>
15211
15212         * output.h (class Output_section_data): Remove inline definition
15213         of set_addralign.
15214         * output.cc (Output_section_data::set_addralign): New function.
15215
15216 2008-04-11  Cary Coutant  <ccoutant@google.com>
15217
15218         Add support for TLS descriptors for i386 and x86_64.
15219         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
15220         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
15221         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
15222         GOT_TYPE_TLS_DESC.
15223         (Target_i386::got_mod_index_entry): Remove unnecessary code.
15224         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
15225         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
15226         relocations.
15227         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
15228         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
15229         Fix problem with initial-exec relocations.
15230         (Target_i386::Relocate::relocate_tls): Likewise.
15231         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
15232         relaxation.
15233         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
15234         support for section-plus-offset dynamic table entries.
15235         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
15236         (Output_data_dynamic::Dynamic_entry): Add support for
15237         section-plus-offset dynamic table entries.
15238         (Output_data_dynamic::Classification): Likewise.
15239         (Output_data_dynamic::classification_): Renamed offset_.
15240         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
15241         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
15242         (Target_x86_64::make_plt_section): New function.
15243         (Target_x86_64::reserve_tlsdesc_entries): New function.
15244         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
15245         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
15246         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
15247         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
15248         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
15249         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
15250         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
15251         add extra PLT entry for TLS descriptors.
15252         (Output_data_plt_x86_64::got_): New field.
15253         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
15254         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
15255         fields.
15256         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
15257         descriptors.
15258         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
15259         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
15260         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
15261         R_386_TLS_DESC_CALL relocations.
15262         (Target_x86_64::Scan::global): Likewise.
15263         (Target_x86_64::do_finalize_sections): Add dynamic table entries
15264         for TLS descriptors.
15265         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
15266         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
15267         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
15268         GD-to-IE relaxation.
15269         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
15270         and TLS_DESCRIPTORS.
15271         * Makefile.in: Rebuild.
15272         * configure: Rebuild.
15273         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
15274         (tls_test_shared2.so): New target.
15275         (tls_shared_gd_to_ie_test_SOURCES): New variable.
15276         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
15277         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
15278         (tls_shared_gd_to_ie_test_LDADD): New variable.
15279         (tls_shared_gnu2_gd_to_ie_test): New target.
15280         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
15281         New targets.
15282         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
15283         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
15284         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
15285         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
15286         (tls_shared_gnu2_test): New target.
15287         (tls_test_gnu2_shared.so): New target.
15288         (tls_shared_gnu2_test_SOURCES): New variable.
15289         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
15290         (tls_shared_gnu2_test_LDFLAGS): New variable.
15291         (tls_shared_gnu2_test_LDADD): New variable.
15292         * testsuite/Makefile.in: Rebuild.
15293         * testsuite/Makefile.
15294
15295 2008-04-11  Ian Lance Taylor  <iant@google.com>
15296
15297         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
15298         justsyms.t.
15299         * testsuite/Makefile.in: Rebuild.
15300
15301         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
15302         long.
15303         * testsuite/script_test_2.cc (main): Adjust test.
15304
15305 2008-04-11  David S. Miller  <davem@davemloft.net>
15306             Ian Lance Taylor  <iant@google.com>
15307
15308         * options.h (General_options): Add entries for '-Y' and
15309         '-relax'.
15310         * options.cc (General_options:finalize): If -Y was used, add those
15311         entries to the library path instead of the default "/lib" and
15312         "/usr/lib".
15313
15314 2008-04-11  David S. Miller  <davem@davemloft.net>
15315
15316         * testsuite/justsyms.t: Start at 0x100.
15317         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
15318         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
15319         long.
15320         * testsuite/script_test_2.cc: Adjust string and section length
15321         checks.
15322
15323 2008-04-09  Ian Lance Taylor  <iant@google.com>
15324
15325         PR gold/5996
15326         * script-sections.cc (Sections_element::allocate_to_segment): Add
15327         orphan parameter.
15328         (Output_section_definition::allocate_to_segment): Likewise.
15329         (Orphan_output_section::allocate_to_segment): Likewise.
15330         (Script_sections::attach_sections_using_phdrs_clause): Don't
15331         propagate non-PT_LOAD segments to orphan sections.
15332         * testsuite/Makefile.am (script_test_3.stdout): Generate using
15333         readelf rather than objdump.
15334         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
15335         .interp section and PT_INTERP segment are the same size.
15336         * testsuite/Makefile.in: Rebuild.
15337
15338         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
15339         aliases for symbols defined in the same object.
15340         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
15341         (weak_alias_test_SOURCES): New variable.
15342         (weak_alias_test_DEPENDENCIES): New variable.
15343         (weak_alias_test_LDFLAGS): New variable.
15344         (weak_alias_test_LDADD): New variable.
15345         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
15346         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
15347         (weak_alias_test_3.o): New target.
15348         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
15349         * testsuite/weak_alias_test_main.cc: New file.
15350         * testsuite/weak_alias_test_1.cc: New file.
15351         * testsuite/weak_alias_test_2.cc: New file.
15352         * testsuite/weak_alias_test_3.cc: New file.
15353
15354 2008-04-08  Ian Lance Taylor  <iant@google.com>
15355
15356         * options.h (class General_options): Add --noinhibit-exec option.
15357         * main.cc (main): Check --noinhibit-exec.
15358
15359         * options.h (class General_options): Define --wrap as a special
15360         option.  Add wrap_symbols_ field.
15361         (General_options::any_wrap_symbols): New function.
15362         (General_options::is_wrap_symbol): New function.
15363         * options.cc (General_options::parse_wrap): New function.
15364         (General_options::General_options): Initialize wrap_symbols_.
15365         * symtab.cc (Symbol_table::wrap_symbol): New function.
15366         (Symbol_table::add_from_object): Handle --wrap.
15367         * symtab.h (class Symbol_table): Declare wrap_symbol.
15368         * target.h (Target::wrap_char): New function.
15369         (Target::Target_info): Add wrap_char field.
15370         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
15371         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
15372         * testsuite/testfile.cc (Target_test::test_target_info):
15373         Likewise.
15374
15375         * errors.cc (Errors::undefined_symbol): Mention symbol version if
15376         there is one.
15377
15378         * layout.h (class Layout): Add added_eh_frame_data_ field.
15379         * layout.cc (Layout::Layout): Initialize new field.
15380         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
15381         output section until we find a section we merged successfully.
15382         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
15383         that the size be non-zero.
15384
15385         * merge.cc (Object_merge_map::get_output_offset): Remove inline
15386         qualifier.
15387
15388 2008-04-08  Craig Silverstein  <csilvers@google.com>
15389
15390         * configure.ac: Export new conditional variable HAVE_ZLIB.
15391         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
15392         on HAVE_ZLIB.
15393         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
15394         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15395
15396 2008-04-07  Ian Lance Taylor  <iant@google.com>
15397
15398         * version.cc (version_string): Set to "1.5".
15399
15400         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
15401         Add issued_non_pic_error_ field.  Declare check_non_pic.
15402         (Target_x86_64::Scan::check_non_pic): New function.
15403         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
15404         (Target_x86_64::Scan::global): Likewise.
15405
15406         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
15407         addend parameter.  Change caller.  Handle merge sections.
15408         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
15409         Address to Addend.  Don't add in the result of
15410         local_section_offset, pass down the addend and use the returned
15411         value.
15412         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
15413         Update declarations of local_section_offset and symbol_value.
15414         * testsuite/two_file_test_1.cc (t18): New function.
15415         * testsuite/two_file_test_2.cc (f18): New function.
15416         * testsuite/two_file_test_main.cc (main): Call t18.
15417         * testsuite/two_file_test.h (t18, f18): Declare.
15418
15419         * configure.ac: Don't test for objdump, c++filt, or readelf.
15420         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
15421         conditionals.
15422         (TEST_READELF): New variable.
15423         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
15424         (check_PROGRAMS): Add two_file_strip_test.
15425         (two_file_strip_test): New target.
15426         (check_PROGRAMS): Add two_file_same_shared_strip_test.
15427         (two_file_same_shared_strip_test_SOURCES): New variable.
15428         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
15429         (two_file_same_shared_strip_test_LDFLAGS): New variable.
15430         (two_file_same_shared_strip_test_LDADD): New variable.
15431         (two_file_shared_strip.so): New target.
15432         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
15433         (ver_test_5.syms, ver_test_7.syms): Likewise.
15434         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
15435         (strip_test_3.stdout): Use TEST_OBJDUMP.
15436         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15437
15438 2008-04-04  Cary Coutant  <ccoutant@google.com>
15439
15440         * symtab.h (Symbol::is_weak_undefined): New function.
15441         (Symbol::is_strong_undefined): New function.
15442         (Symbol::is_absolute): New function.
15443         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
15444         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
15445         absolute symbols.
15446         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
15447         (weak_undef_test): New target.
15448         * testsuite/Makefile.in: Rebuild.
15449         * testsuite/weak_undef_file1.cc: New file.
15450         * testsuite/weak_undef_file2.cc: New file.
15451         * testsuite/weak_undef_test.cc: New file.
15452
15453 2008-04-03  Craig Silverstein  <csilvers@google.com>
15454
15455         * compressed_output.h (class Output_compressed_section): Use
15456         unsigned buffer.
15457         * compressed_output.cc (zlib_compress): Use unsigned buffers,
15458         add zlib header.
15459         (zlib_compressed_suffix): Removed.
15460         (Output_compressed_section::set_final_data_size): Use unsigned
15461         buffers.
15462         * testsuite/Makefile.am (flagstest_compress_debug_sections):
15463         Fix linker invocation.
15464         (flagstest_o_specialfile_and_compress_debug_sections):
15465         Likewise.
15466         * testsuite/Makefile.in: Regenerated.
15467
15468 2008-04-02  David S. Miller  <davem@davemloft.net>
15469
15470         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
15471         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
15472
15473 2008-04-02  Craig Silverstein  <csilvers@google.com>
15474
15475         * TODO: New file.
15476
15477 2008-04-02  Ian Lance Taylor  <iant@google.com>
15478
15479         * fileread.cc (File_read::find_view): Add byteshift and vshifted
15480         parameters.  Update for new key type to views_.  Change all
15481         callers.
15482         (File_read::read): Adjust for byteshift in returned view.
15483         (File_read::add_view): New function, broken out of
15484         find_and_make_view.
15485         (File_read::make_view): New function, broken out of
15486         find_and_make_view.
15487         (File_read::find_or_make_view): Add offset and aligned
15488         parameters.  Rewrite accordingly.  Change all callers.
15489         (File_read::get_view): Add offset and aligned parameters.  Adjust
15490         for byteshift in return value.
15491         (File_read::get_lasting_view): Likewise.
15492         * fileread.h (class File_read): Update declarations.
15493         (class File_read::View): Add byteshift_ field.  Add byteshift to
15494         constructor.  Add byteshift method.
15495         * archive.h (Archive::clear_uncached_views): New function.
15496         (Archive::get_view): Add aligned parameter.  Change all callers.
15497         * object.h (Object::get_view): Add aligned parameter.  Change all
15498         callers.
15499         (Object::get_lasting_view): Likewise.
15500
15501         * fileread.cc (File_read::release): Don't call clear_views if
15502         there are multiple objects.
15503         * fileread.h (File_read::clear_uncached_views): New function.
15504         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
15505         on the archive.
15506
15507 2008-03-31  Cary Coutant  <ccoutant@google.com>
15508
15509         Add thin archive support.
15510         * archive.cc (Archive::armagt): New const.
15511         (Archive::setup): Remove task parameter and calls to unlock.
15512         (Archive::unlock_nested_archives): New function.
15513         (Archive::read_header): Add nested_off parameter. Change
15514         all callers.
15515         (Archive::interpret_header): Likewise.
15516         (Archive::include_all_members): Change to handle thin
15517         archives.
15518         (Archive::include_member): Likewise.
15519         * archive.h (Archive::Archive): Add new parameters and
15520         initializers.
15521         (Archive::armagt): New const.
15522         (Archive::setup): Remove task parameter.
15523         (Archive::unlock_nested_archives): New function.
15524         (Archive::read_header): Add nested_off parameter.
15525         (Archive::interpret_header): Likewise.
15526         (Archive::Nested_archive_table): New typedef.
15527         (Archive::is_thin_archive_): New field.
15528         (Archive::nested_archives_): New field.
15529         (Archive::options_): New field.
15530         (Archive::dirpath_): New field.
15531         (Archive::task_): New field.
15532         * readsyms.cc (Read_symbols::do_read_symbols): Add check
15533         for thin archives.  Pass additional parameters to
15534         Archive::Archive.  Unlock the archive file after calling
15535         Archive::setup.
15536
15537 2008-03-29  Ian Lance Taylor  <iant@google.com>
15538
15539         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
15540         version symbol to be local.
15541         * testsuite/ver_test_4.sh: New file.
15542         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
15543         (check_DATA): Add ver_test_4.syms.
15544         (ver_test_4.syms): New target.
15545         * testsuite/Makefile.in: Rebuild.
15546
15547         * output.cc
15548         (Output_section::Input_section_sort_entry::has_priority): New
15549         function.
15550         (Output_section::Input_section_sort_entry::match_file_name): New
15551         function.
15552         (Output_section::Input_section_sort_entry::match_section_name):
15553         Remove.
15554         (Output_section::Input_section_sort_entry::match_section_name_prefix):
15555         Remove.
15556         (Output_section::Input_section_sort_entry::match_section_file):
15557         Remove.
15558         (Output_section::Input_section_sort_compare::operator()): Rewrite
15559         using new Input_section_sort_entry functions.  Sort crtbegin and
15560         crtend first.  Sort sections with no priority before sections with
15561         a priority.
15562         * testsuite/initpri1.c (d3): Check j != 4.
15563         (cd5): New constructor/destructor function.
15564         (main): Check j != 2.
15565
15566         * symtab.cc (Symbol_table::add_from_object): If we don't use the
15567         new symbol when resolving, don't call set_is_default.
15568         * testsuite/ver_test_7.cc: New file.
15569         * testsuite/ver_test_7.sh: New file.
15570         * testsuite/Makefile.am (ver_test_7.so): New target.
15571         (ver_test_7.o): New target.
15572         (check_SCRIPTS): Add ver_test_7.sh.
15573         (check_DATA): Add ver_test_7.syms.
15574         (ver_test_7.syms): New target.
15575
15576 2008-03-28  Ian Lance Taylor  <iant@google.com>
15577
15578         * layout.cc (Layout::layout): If we see an input section with a
15579         name that needs sorting, set the must_sort flag for the output
15580         section.
15581         (Layout::make_output_section): If the name of the output section
15582         indicates that it might require sorting, set the may_sort flag.
15583         * output.h (Output_section::may_sort_attached_input_sections): New
15584         function.
15585         (Output_section::set_may_sort_attached_input_sections): New
15586         function.
15587         (Output_section::must_sort_attached_input_sections): New
15588         function.
15589         (Output_section::set_must_sort_attached_input_sections): New
15590         function.
15591         (class Output_section): Declare Input_section_sort_entry.  Define
15592         Input_section_sort_compare.  Declare
15593         sort_attached_input_sections.  Add new fields:
15594         may_sort_attached_input_sections_,
15595         must_sort_attached_input_sections_,
15596         attached_input_sections_are_sorted_.
15597         * output.cc (Output_section::Output_section): Initialize new
15598         fields.
15599         (Output_section::add_input_section): Add an entry to
15600         input_sections_ if may_sort or must_sort are true.
15601         (Output_section::set_final_data_size): Call
15602         sort_attached_input_sections if necessary.
15603         (Output_section::Input_section_sort_entry): Define new class.
15604         (Output_section::Input_section_sort_compare::operator()): New
15605         function.
15606         (Output_section::sort_attached_input_sections): New function.
15607         * configure.ac: Check whether the compiler supports constructor
15608         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
15609         * testsuite/initpri1.c: New file.
15610         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
15611         CONSTRUCTOR_PRIORITY.
15612         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
15613         (initpri1_LDFLAGS): New variable.
15614         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15615
15616 2008-03-27  Ian Lance Taylor  <iant@google.com>
15617
15618         * common.cc (Sort_commons::operator): Correct sorting algorithm.
15619         * testsuite/common_test_1.c: New file.
15620         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
15621         (common_test_1_SOURCES): New variable.
15622         (common_test_1_DEPENDENCIES): New variable.
15623         (common_test_1_LDFLAGS): New variable.
15624
15625         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
15626         and commons_ correctly when NAME/VERSION does not override
15627         NAME/NULL.
15628         * testsuite/ver_test_6.c: New file.
15629         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
15630         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
15631         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
15632
15633 2008-03-26  Ian Lance Taylor  <iant@google.com>
15634
15635         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
15636         of an undefined symbol from a version script.
15637         * testsuite/Makefile.am (ver_test_5.so): New target.
15638         (ver_test_5.o): New target.
15639         (check_SCRIPTS): Add ver_test_5.sh.
15640         (check_DATA): Add ver_test_5.syms.
15641         (ver_test_5.syms): New target.
15642         * testsuite/ver_test_5.cc: New file.
15643         * testsuite/ver_test_5.script: New file.
15644         * testsuite/ver_test_5.sh: New file.
15645         * Makefile.in, testsuite/Makefile.in: Rebuild.
15646
15647         PR gold/5986
15648         Fix problems building gold with gcc 4.3.0.
15649         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
15650         (gold_error_at_location, gold_warning_at_location): Use it.
15651         * configure.ac: Check whether we can compile and use a template
15652         function with a printf attribute.
15653         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
15654         when jumping over bytes.
15655         * object.cc: Instantiate Object::read_section_data.
15656         * debug.h: Include <cstring>
15657         * dwarf_reader.cc: Include <algorithm>
15658         * main.cc: Include <cstring>.
15659         * options.cc: Include <cstring>.
15660         * output.cc: Include <cstring>.
15661         * script.cc: Include <cstring>.
15662         * script.h: Include <string>.
15663         * symtab.cc: Include <cstring> and <algorithm>.
15664         * target-select.cc: Include <cstring>.
15665         * version.cc: Include <string>.
15666         * testsuite/testmain.cc: Include <cstdlib>.
15667         * configure, config.in: Rebuild.
15668
15669 2008-03-25  Ian Lance Taylor  <iant@google.com>
15670
15671         * options.cc: Include "../bfd/bfdver.h".
15672         (options::help): Print bug reporting address.
15673
15674         * version.cc (print_version): Adjust output for current value of
15675         BFD_VERSION_STRING.
15676
15677         * NEWS: New file.
15678
15679         * options.cc (options::help): Print list of supported targets.
15680         * target-select.h: Include <vector>.
15681         (class Target_selector): Make machine_, size_, and is_big_endian_
15682         fields const.  Add bfd_name_ and instantiated_target_ fields.
15683         (Target_selector::Target_selector): Add bfd_name parameter.
15684         (Target_selector::recognize): Make non-virtual, call
15685         do_recognize.
15686         (Target_selector::recognize_by_name): Make non-virtual, call
15687         do_recognize_by_name.
15688         (Target_selector::supported_names): New function.
15689         (Target_selector::bfd_name): New function.
15690         (Target_selector::do_instantiate_target): New pure virtual
15691         function.
15692         (Target_selector::do_recognize): New virtual function.
15693         (Target_selector::do_recognize_by_name): New virtual function.
15694         (Target_selector::instantiate_target): New private function.
15695         (supported_target_names): Declare.
15696         * target-select.cc (Target_selector::Target_selector): Update for
15697         new parameter and fields.
15698         (select_target_by_name): Check that the name matches before
15699         calling recognize_by_name.
15700         (supported_target_names): New function.
15701         * i386.cc (class Target_selector_i386): Update Target_selector
15702         constructor call.  Remove recognize and recognize_by_name.  Add
15703         do_instantiate_target.
15704         * x86_64.cc (class Target_selector_x86_64): Likewise.
15705         * testsuite/testfile.cc (class Target_selector_test): Update for
15706         changes to Target_selector.
15707
15708         * README: Rewrite, with some notes on unsupported features.
15709
15710 2008-03-24  Cary Coutant  <ccoutant@google.com>
15711
15712         * i386.cc (Target_i386::Got_type): New enum declaration.
15713         (Target_i386::Scan::local): Updated callers of Output_data_got
15714         member functions.
15715         (Target_i386::Scan::global): Likewise.
15716         (Target_i386::Relocate::relocate): Likewise.
15717         (Target_i386::Relocate::relocate_tls): Likewise.
15718         * object.h (Got_offset_list): New class.
15719         (Sized_relobj::local_has_got_offset): Added got_type parameter.
15720         (Sized_relobj::local_got_offset): Likewise.
15721         (Sized_relobj::set_local_got_offset): Likewise.
15722         (Sized_relobj::local_has_tls_got_offset): Removed.
15723         (Sized_relobj::local_tls_got_offset): Removed.
15724         (Sized_relobj::set_local_tls_got_offset): Removed.
15725         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
15726         * output.cc (Output_data_got::add_global): Added got_type parameter.
15727         (Output_data_got::add_global_with_rel): Likewise.
15728         (Output_data_got::add_global_with_rela): Likewise.
15729         (Output_data_got::add_global_pair_with_rel): New function.
15730         (Output_data_got::add_global_pair_with_rela): New function.
15731         (Output_data_got::add_local): Added got_type parameter.
15732         (Output_data_got::add_local_with_rel): Likewise.
15733         (Output_data_got::add_local_with_rela): Likewise.
15734         (Output_data_got::add_local_pair_with_rel): New function.
15735         (Output_data_got::add_local_pair_with_rela): New function.
15736         (Output_data_got::add_global_tls): Removed.
15737         (Output_data_got::add_global_tls_with_rel): Removed.
15738         (Output_data_got::add_global_tls_with_rela): Removed.
15739         (Output_data_got::add_local_tls): Removed.
15740         (Output_data_got::add_local_tls_with_rel): Removed.
15741         (Output_data_got::add_local_tls_with_rela): Removed.
15742         * output.h (Output_data_got::add_global): Added got_type parameter.
15743         (Output_data_got::add_global_with_rel): Likewise.
15744         (Output_data_got::add_global_with_rela): Likewise.
15745         (Output_data_got::add_global_pair_with_rel): New function.
15746         (Output_data_got::add_global_pair_with_rela): New function.
15747         (Output_data_got::add_local): Added got_type parameter.
15748         (Output_data_got::add_local_with_rel): Likewise.
15749         (Output_data_got::add_local_with_rela): Likewise.
15750         (Output_data_got::add_local_pair_with_rel): New function.
15751         (Output_data_got::add_local_pair_with_rela): New function.
15752         (Output_data_got::add_global_tls): Removed.
15753         (Output_data_got::add_global_tls_with_rel): Removed.
15754         (Output_data_got::add_global_tls_with_rela): Removed.
15755         (Output_data_got::add_local_tls): Removed.
15756         (Output_data_got::add_local_tls_with_rel): Removed.
15757         (Output_data_got::add_local_tls_with_rela): Removed.
15758         * resolve.cc (Symbol::override_base_with_special): Removed
15759         reference to has_got_offset_ field.
15760         * symtab.cc (Symbol::init_fields): Replaced initialization
15761         of got_offset_ with got_offsets_.  Removed initialization
15762         of has_got_offset_
15763         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
15764         (Symbol::got_offset): Likewise.
15765         (Symbol::set_got_offset): Likewise.
15766         (Symbol::has_tls_got_offset): Removed.
15767         (Symbol::tls_got_offset): Removed.
15768         (Symbol::set_tls_got_offset): Removed.
15769         (Symbol::got_offset_): Removed.
15770         (Symbol::tls_mod_got_offset_): Removed.
15771         (Symbol::tls_pair_got_offset_): Removed.
15772         (Symbol::got_offsets_): New field.
15773         (Symbol::has_got_offset): Removed.
15774         (Symbol::has_tls_mod_got_offset): Removed.
15775         (Symbol::has_tls_pair_got_offset): Removed.
15776         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
15777         (Target_x86_64::Scan::local): Updated callers of Output_data_got
15778         member functions.
15779         (Target_x86_64::Scan::global): Likewise.
15780         (Target_x86_64::Relocate::relocate): Likewise.
15781         (Target_x86_64::Relocate::relocate_tls): Likewise.
15782
15783 2008-03-25  Ben Elliston  <bje@au.ibm.com>
15784
15785         * yyscript.y: Fix spelling error in comment.
15786
15787 2008-03-24  Ian Lance Taylor  <iant@google.com>
15788
15789         * options.h (class General_options): Define build_id option.
15790         * layout.h (class Layout): Declare write_build_id, create_note,
15791         create_build_id.  Add build_id_note_ member.
15792         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
15793         "libiberty.h", "md5.h", "sha1.h".
15794         (Layout::Layout): Initialize eh_frame_data_,
15795         eh_frame_hdr_section_, and build_id_note_.
15796         (Layout::finalize): Call create_build_id.
15797         (Layout::create_note): New function, broken out of
15798         Layout::create_gold_note.
15799         (Layout::create_gold_note): Call create_note.
15800         (Layout::create_build_id): New function.
15801         (Layout::write_build_id): New function.
15802         (Close_task_runner::run): Call write_build_id.
15803
15804         * x86_64.cc: Correct license to GPLv3.
15805
15806 2008-03-23  Ian Lance Taylor  <iant@google.com>
15807
15808         * options.cc: Include "demangle.h".
15809         (parse_optional_string): New function.
15810         (parse_long_option): Handle takes_optional_argument.
15811         (parse_short_option): Update dash_z initializer.  Handle
15812         takes_optional_argument.
15813         (General_options::General_options): Initialize do_demangle_.
15814         (General_options::finalize): Set do_demangle_.  Handle demangling
15815         style.
15816         * options.h (parse_optional_string): Declare.
15817         (struct One_option): Add optional_arg field.  Update constructor.
15818         Update call constructor calls.  Add takes_optional_argument
15819         function.
15820         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
15821         (DEFINE_optional_string): Define.
15822         (General_options::demangle): Change from DEFINE_bool to
15823         DEFINE_optional_string.
15824         (General_options::no_demangle): New function.
15825         (General_options::do_demangle): New function.
15826         (General_options::set_do_demangle): New function.
15827         (General_options::execstack_status_): Move definition to end of
15828         class definition.
15829         (General_options::static_): Likewise.
15830         (General_options::do_demangle_): New field.
15831         * object.cc (big_endian>::get_symbol_location_info): Call
15832         Options::do_demangle, not Options::demangle.
15833         * symtab.cc (demangle): Likewise.
15834
15835 2008-03-22  Ian Lance Taylor  <iant@google.com>
15836
15837         * gold.h: Include <cstddef> and <sys/types.h>
15838         * options.h: Include <cstring>.
15839
15840 2008-03-21  Ian Lance Taylor  <iant@google.com>
15841
15842         * Added source code to GNU binutils.
15843 \f
15844 Copyright (C) 2008-2014 Free Software Foundation, Inc.
15845
15846 Copying and distribution of this file, with or without modification,
15847 are permitted in any medium without royalty provided the copyright
15848 notice and this notice are preserved.
15849
15850 Local Variables:
15851 mode: change-log
15852 left-margin: 8
15853 fill-column: 74
15854 version-control: never
15855 End: