Fix dwp to allow intermediate .dwp files with no .debug_types sections.
[external/binutils.git] / gold / ChangeLog
1 2014-06-24  Cary Coutant  <ccoutant@google.com>
2
3         * dwp.cc (Dwo_file::read): Allow files with no .debug_types
4         sections.
5         (Dwo_file::sized_read_unit_index): Likewise.
6
7 2014-06-23  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
8
9         * mips.cc: New file.
10         * Makefile.am (TARGETSOURCES): Add mips.cc
11         (ALL_TARGETOBJS): Add mips.$(OBJEXT)
12         * configure.tgt: Add entries for mips*.
13         * configure.ac: Likewise.
14         * Makefile.in: Regenerate.
15         * configure: Likewise.
16
17 2014-06-09  Cary Coutant  <ccoutant@google.com>
18
19         * dwarf_reader.cc (Dwarf_pubnames_table::read_header): Check that
20         unit_length is within section bounds.
21
22 2014-06-09  Cary Coutant  <ccoutant@google.com>
23
24         PR gold/16980
25         * layout.cc (Layout::print_to_mapfile): Print unattached sections in
26         map.
27
28 2014-06-07  Alan Modra  <amodra@gmail.com>
29
30         * powerpc.cc (relocate): Treat field of cmpli insn as a bitfield.
31
32 2014-06-06  Cary Coutant  <ccoutant@google.com>
33
34         * dwarf_reader.h (Dwarf_pubnames_table): Remove output_section_offset_.
35         * dwarf_reader.cc (Dwarf_pubnames_table::read_section): Likewise.
36         (Dwarf_pubnames_table::read_header): Likewise.
37         * layout.cc (gdb_fast_lookup_sections): Add .debug_gnu_pubnames and
38         .debug_gnu_pubtypes.
39
40 2014-06-05  Joel Brobecker  <brobecker@adacore.com>
41
42         * Makefile.am (CONFIG_STATUS_DEPENDENCIES): New.
43         * Makefile.in, configure: Regenerate.
44
45 2014-06-03  Alan Modra  <amodra@gmail.com>
46
47         * powerpc.cc (addis_12_2): Define.
48         (Stub_table::do_write): Support fusion on ELFv2 stubs.
49
50 2014-06-03  Alan Modra  <amodra@gmail.com>
51
52         * testsuite/plugin_test.c (parse_readelf_line): Skip non-visibility
53         st_other output.
54
55 2014-06-02  Alan Modra  <amodra@gmail.com>
56
57         * powerpc.cc (Target_powerpc::local_reloc_may_be_function_pointer):
58         Only ignore relocs on ELFv1.
59         (Target_powerpc::global_reloc_may_be_function_pointer): Likewise.
60
61 2014-05-30  Cary Coutant  <ccoutant@google.com>
62
63         * testsuite/Makefile.am (ehdr_start_test_4): Fix typo in -B option.
64         * testsuite/Makefile.in: Regenerate.
65         * testsuite/ehdr_start_test_4.sh: Look for "U" instead of "w".
66
67 2014-05-27  H.J. Lu  <hongjiu.lu@intel.com>
68
69         PR gold/16945
70         * x86_64.cc (Target_x86_64::Relocate::relocate): Use signed int
71         for got_offset.  Properly get GOT address for R_X86_64_PLTOFF64.
72
73 2014-05-15  Alan Modra  <amodra@gmail.com>
74
75         * powerpc.cc (do_plt_fde_location): Handle zero length .glink.
76         Compare FDE contents with DW_CFA_nop rather than 0.
77
78 2014-05-13  Sriraman Tallam  <tmsriram@google.com>
79
80         * symtab.h (may_need_copy_reloc): Remove check for position independent
81         code.
82         * x86_64.cc (Target_x86_64<size>::Scan::global): Add check for no
83         position independence before pc absolute may_need_copy_reloc call.
84         Add check for executable output befor pc relative may_need_copy_reloc
85         call.
86         * i386.cc: Ditto.
87         * arm.cc: Ditto.
88         * sparc.cc: Ditto.
89         * tilegx.cc: Ditto.
90         * powerpc.cc: Add check for no position independence before
91         may_need_copy_reloc calls.
92         * testsuite/pie_copyrelocs_test.cc: New file.
93         * testsuite/pie_copyrelocs_shared_test.cc: New file.
94         * Makefile.am (pie_copyrelocs_test): New test.
95         * Makefile.in: Regenerate.
96
97 2014-05-08  Martin Liška  <mliska@suse.cz>
98
99         * output.cc (Sized_relobj_file::do_layout): Fix typo in info message.
100
101 2014-05-06  Cary Coutant  <ccoutant@google.com>
102
103         PR gold/16900
104         * i386.cc (Output_data_got_plt_i386): New class.
105         (Output_data_plt_i386::Output_data_plt_i386): Change type of got_plt
106         parameter. Change all callers.
107         (Output_data_plt_i386::layout_): Remove.
108         (Output_data_plt_i386::got_plt_): Change type.
109         (Target_i386::got_plt_): Change type. Change all references.
110         (Target_i386::got_section): Create instance of new class.
111         (Output_data_got_plt_i386::do_write): New function.
112         * x86_64.cc (Output_data_got_plt_x86_64): New class.
113         (Output_data_plt_x86_64::Output_data_plt_x86_64): Change type of got_plt
114         parameter. Change all callers.
115         (Output_data_plt_x86_64::layout_): Remove.
116         (Output_data_plt_x86_64::got_plt_): Change type.
117         (Target_x86_64::got_plt_): Change type. Change all references.
118         (Target_x86_64::got_section): Create instance of new class.
119         (Output_data_got_plt_x86_64::do_write): New function.
120         (Output_data_plt_x86_64::do_write): Don't write reserved words in GOT.
121         (Target_x86_64<size>::init_got_plt_for_update): Create instance of new
122         class.
123
124 2014-05-05  Cary Coutant  <ccoutant@google.com>
125
126         * gdb-index.cc (Gdb_index_info_reader): Don't complain about language
127         if we have pubnames/pubtypes.
128
129 2014-05-02  Cary Coutant  <ccoutant@google.com>
130
131         * defstd.cc (in_segment): Define __ehdr_start here...
132         * layout.cc (Layout::finalize): ...Instead of here.  Set the
133         output segment when known.
134         * resolve.cc (Symbol::override_base_with_special): Remember
135         the original binding.
136         * symtab.cc (Symbol::set_output_segment): New function.
137         (Symbol::set_undefined): New function.
138         * symtab.h (Symbol::is_weak_undefined): Check original undef
139         binding.
140         (Symbol::is_strong_undefined): New function.
141         (Symbol::set_output_segment): New function.
142         (Symbol::set_undefined): New function.
143         * target-reloc.h (is_strong_undefined): Remove.
144         (issue_undefined_symbol_error): Call Symbol::is_weak_undefined.
145         Check for hidden undefs.
146         (relocate_section): Call Symbol::is_strong_undefined.
147
148         * testsuite/Makefile.am (ehdr_start_test_1)
149         (ehdr_start_test_2, ehdr_start_test_3)
150         (ehdr_start_test_4, ehdr_start_test_5): New test cases.
151         * testsuite/Makefile.in: Regenerate.
152         * testsuite/ehdr_start_def.cc: New source file.
153         * testsuite/ehdr_start_test.cc: New source file.
154         * testsuite/ehdr_start_test.t: New linker script.
155         * testsuite/ehdr_start_test_4.sh: New shell script.
156
157 2014-04-23  Cary Coutant  <ccoutant@google.com>
158
159         PR gold/16870
160         * x86_64.cc (Target_x86_64::Relocate::relocate): Add missing break.
161
162 2014-04-15  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
163
164         * layout.cc (Layout::include_section): Allow a target to decide
165         whether to include a section.
166         * target.h (Target::should_include_section): New function.
167         (Target::do_should_include_section): New function.
168
169 2014-04-15  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
170
171         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Remove and
172         inline into ...
173         (Copy_relocs::emit): ... here.
174         * copy-relocs.h (Copy_reloc_entry): Change from class to struct.
175         (Copy_reloc_entry::make_copy_reloc): Change from private to protected.
176         (Copy_reloc_entry::entries_): Change from private to protected.
177
178 2014-04-02  Sriraman Tallam  <tmsriram@google.com>
179
180         * icf.cc (get_section_contents): Replace copies of reloc
181         vectors with const references.
182
183 2014-04-02  Cary Coutant  <ccoutant@google.com>
184
185         * configure.ac (HAVE_PUBNAMES): Use C instead of C++.
186         (HAVE_NO_USE_LINKER_PLUGIN): Check for -fno-use-linker-plugin.
187         * configure: Regenerate.
188         * testsuite/Makefile.am (OPT_NO_PLUGINS): New macro for
189         -fno-use-linker-plugin.
190         (LINK1, CXXLINK1): Add it to the link command.
191         * testsuite/Makefile.in: Regenerate.
192
193 2014-03-12  Alan Modra  <amodra@gmail.com>
194
195         * Makefile.in: Regenerate.
196
197 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
198
199         * symtab.h (Symbol::set_nonvis): New function.
200
201 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
202
203         * symtab.cc (Sized_symbol<32>::init_output_data):
204         Instantiate the template.
205         (Sized_symbol<64>::init_output_data): Likewise.
206
207 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
208
209         * symtab.cc (Symbol_table::sized_write_globals): Allow a target to
210         adjust dynamic symbol value.
211         * target.h (Target::adjust_dyn_symbol): New function.
212         (Target::do_adjust_dyn_symbol): New function.
213
214 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
215
216         * output.cc (Output_data_dynamic::Dynamic_entry::write):
217         Get the value of DYNAMIC_CUSTOM dynamic entry.
218         * output.h (Output_data_dynamic::add_custom): New function.
219         (Dynamic_entry::Dynamic_entry): New constructor for DYNAMIC_CUSTOM
220         dynamic entry.
221         (enum Dynamic_entry::Classification): Add DYNAMIC_CUSTOM.
222         * target.h (Target::dynamic_tag_custom_value): New function.
223         (Target::do_dynamic_tag_custom_value): New function.
224
225 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
226
227         * symtab.cc (Symbol_table::set_dynsym_indexes): Allow a target to set
228         dynsym indexes.
229         * target.h (Target::has_custom_set_dynsym_indexes): New function.
230         (Target::do_has_custom_set_dynsym_indexes): New function.
231         (Target::set_dynsym_indexes): New function.
232         (Target::do_set_dynsym_indexes): New function.
233
234 2014-03-07  Alan Modra  <amodra@gmail.com>
235
236         * powerpc.cc (Powerpc_relocate_functions::Overflow_check): Add
237         CHECK_UNSIGNED, CHECK_LOW_INSN, CHECK_HIGH_INSN.
238         (Powerpc_relocate_functions::has_overflow_unsigned): New function.
239         (Powerpc_relocate_functions::has_overflow_bitfield,
240         overflowed): Use the above.
241         (Target_powerpc::Relocate::relocate): Correct overflow checking
242         for a number of relocations.  Modify overflow test for 16-bit
243         fields in instructions to signed/unsigned according to whether
244         the field takes a signed or unsigned value.
245
246 2014-03-05  Alan Modra  <amodra@gmail.com>
247
248         Update copyright years.
249
250 2014-03-05  Alan Modra  <amodra@gmail.com>
251
252         * powerpc.cc (Target_powerpc::Scan::local, global): Support
253         R_PPC64_ADDR64_LOCAL.
254         (Target_powerpc::Relocate::relocate): Likewise.
255
256 2014-03-03  Alan Modra  <amodra@gmail.com>
257
258         * dwp.cc (print_version): Update copyright year to current.
259
260 2014-02-10  Alan Modra  <amodra@gmail.com>
261
262         * po/gold.pot: Regenerate.
263
264 2014-02-06  Cary Coutant  <ccoutant@google.com>
265
266         Fix problem where -u is ignored when a weak undef is seen.
267
268         * archive.cc (Library_base::should_include_member): Reorder
269         code to check for -u option if a weak undef has already been seen.
270         * testsuite/Makefile.am (weak_undef_test_2): New test case.
271         * testsuite/Makefile.in: Regenerate.
272         * testsuite/weak_undef_file3.cc: New file.
273         * testsuite/weak_undef_file4.cc: New file.
274         * testsuite/weak_undef_test_2.cc: New file.
275
276 2014-02-05  Cary Coutant  <ccoutant@google.com>
277
278         Fix issues with gold undefined symbol diagnostics.
279
280         PR binutils/15435
281         * errors.cc (Errors::undefined_symbol): Move undef vtable symbol
282         check to here.
283         * target-reloc.h (is_strong_undefined): New function.
284         (relocate_section): Move undef vtable symbol check from here.
285         Check for is_strong_undefined.
286
287 2014-02-05  Cary Coutant  <ccoutant@google.com>
288
289         Fix problems with the --dynamic-list option.
290
291         PR gold/13577
292         * options.cc (General_options::parse_dynamic_list):
293         Set have_dynamic_list_.
294         (General_options::General_options): Initialize have_dynamic_list_.
295         (General_options::finalize): Turn off -Bsymbolic and
296         -Bsymbolic-functions if --dynamic-list provided.
297         * options.h (General_options::have_dynamic_list): New function.
298         (General_options::have_dynamic_list_): New data member.
299         * symtab.h (Symbol::is_preemptible): Handle --dynamic-list
300         correctly.
301
302         PR gold/16530
303         * symtab.cc (Symbol_table::add_from_relobj): If symbol is named
304         in --dynamic-list, mark it.
305
306         * testsuite/Makefile.am (gc_dynamic_list_test.sh): New test case.
307         (dynamic_list_2): New test case.
308         * testsuite/Makefile.in: Regenerate.
309         * testsuite/dynamic_list_2.cc: New file.
310         * testsuite/dynamic_list_2.t: New file.
311         * testsuite/dynamic_list_lib1.cc: New file.
312         * testsuite/dynamic_list_lib2.cc: New file.
313         * testsuite/gc_dynamic_list_test.c: New file.
314         * testsuite/gc_dynamic_list_test.sh: New file.
315         * testsuite/gc_dynamic_list_test.t: New file.
316
317 2014-01-28  Cary Coutant  <ccoutant@google.com>
318
319         Add .gdb_index version 7 support.
320
321         * gold/dwarf_reader.cc: include <utility> (for make_pair).
322         (Dwarf_abbrev_table::do_read_abbrevs): Check for compressed
323         debug sections.
324         (Dwarf_ranges_table::read_ranges_table): Likewise.
325         (Dwarf_pubnames_table::read_section): Check for GNU-style
326         sections, and for compressed debug sections.
327         (Dwarf_pubnames_table::read_header): Compute end address of table.
328         (Dwarf_pubnames_table::next_name): Return flag_byte.  Check
329         for end of list by offset, not by offset == 0.
330         (Dwarf_info_reader::do_read_string_table): Check for compressed
331         debug sections.
332         * gold/dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
333         Initialize new data members.
334         (Dwarf_pubnames_table::next_name): return flag_byte.
335         (Dwarf_pubnames_table::end_of_table_): New data member.
336         (Dwarf_pubnames_table::is_gnu_style_): New data member.
337         * gold/gdb-index.cc (gdb_index_version): Update to version 7.
338         (Gdb_index_info_reader::read_pubtable): Read flag_byte.
339         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Don't
340         read skeleton type unit DIEs.
341         (Gdb_index::add_symbol): Add flag_byte; adjust all callers.
342         (Gdb_index::do_write): Write flag_byte.
343         * gold/gdb-index.h (Gdb_index::add_symbol): Add flags parameter.
344         (Gdb_index::Cu_vector): Store flags along with cu indexes.
345         * gold/testsuite/gdb_index_test_3.sh: Allow versions 4-7.
346         * gold/testsuite/gdb_index_test_comm.sh: Likewise.
347
348 2014-01-08  H.J. Lu  <hongjiu.lu@intel.com>
349
350         * version.cc (print_version): Update copyright year to 2014.
351
352 2013-12-19  Dimitry Andric  <dimitry@andric.com>
353
354         * stringpool.cc (Stringpool_template::reserve): Add
355         HAVE_UNORDERED_MAP case.
356         * stringpool.cc (Stringpool_template::print_stats): Likewise.
357
358 2013-12-18  Cary Coutant  <ccoutant@google.com>
359
360         * configure.ac: Check for <unordered_set> and <unordered_map>.
361         * config.in: Regenerate.
362         * configure: Regenerate.
363         * system.h: Use <unordered_set> and <unordered_map> if available.
364
365 2013-12-10  Roland McGrath  <mcgrathr@google.com>
366
367         * Makefile.am (install-exec-local): Prefix $(INSTALL_PROGRAM) uses
368         with $(INSTALL_PROGRAM_ENV).
369         * Makefile.in: Regenerate.
370
371 2013-11-22  Cary Coutant  <ccoutant@google.com>
372
373         * configure.ac: Add check for which library is needed for
374         dlopen.
375         * configure: Regenerate.
376
377 2013-11-22  Cary Coutant  <ccoutant@google.com>
378
379         * testsuite/Makefile.am (exception_x86_64_bnd_test): Use in-tree
380         assembler.
381         * testsuite/Makefile.in: Regenerate.
382
383 2013-11-17  H.J. Lu  <hongjiu.lu@intel.com>
384
385         * x86_64.cc (Target_x86_64<size>::Scan::get_reference_flags):
386         Handle R_X86_64_PC32_BND and R_X86_64_PLT32_BND just like
387         R_X86_64_PC32 and R_X86_64_PLT32, respectively.
388         (Target_x86_64<size>::Scan::local): Likewise.
389         (Target_x86_64<size>::Scan::global): Likewise.
390         (Target_x86_64<size>::Relocate::relocate): Likewise.
391         (Target_x86_64<size>::Relocatable_size_for_reloc::get_size_for_reloc):
392         Likewise.
393         (Target_x86_64<size>::Scan::check_non_pic(): Handle
394         R_X86_64_PC32_BND.
395
396         * testsuite/Makefile.am (check_PROGRAMS): Add
397         exception_x86_64_bnd_test.
398         (exception_x86_64_bnd_test_SOURCES): New macro.
399         (exception_x86_64_bnd_test_DEPENDENCIES): Likewise.
400         (exception_x86_64_bnd_test_LDFLAGS): Likewise.
401         (exception_x86_64_bnd_test_LDADD): Likewise.
402         (exception_x86_64_bnd_1.o): New rule.
403         (exception_x86_64_bnd_2.o): Likewise.
404         * testsuite/Makefile.in: Regenerated.
405
406 2013-11-15  Alan Modra  <amodra@gmail.com>
407
408         * powerpc.cc (Target_powerpc::glink_section): Provide non-const
409         accessor.
410         (Target_powerpc::Branch_info::make_stub): Make global entry stubs.
411         Only call ppc64_local_entry_offset for 64-bit.  Restrict
412         symval_for_branch lookup to ELFv1.
413         (Stub_table::add_plt_call_entry): Use unsigned int off.
414         (Output_data_glink::Address, invalid_address): New.
415         (Output_data_glink::add_eh_frame): Move out of line.  Add
416         support for ELFv2.
417         (Output_data_glink::add_global_entry, find_global_entry,
418         global_entry_address): New functions.
419         (Output_data_glink::global_entry_stubs_, end_branch_table_,
420         ge_size): New variables.
421         (Output_data_glink::set_final_data_size): Add global entry
422         stub sizing.
423         (Output_data_glink::do_write): Write global entry stubs.
424         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Add target
425         parameter.  Return true for ELFv2.  Adjust callers.
426         (Target_powerpc::Scan::local, global): Restrict opd lookup to
427         ELFv1.  Similarly for ifunc and dynamic relocation processing
428         specific to ELFv1.  Recognize that symbols are defined on
429         their plt entries for ELFv2.
430         (Target_powerpc::symval_for_branch): Assert if called for
431         ELFv2 or ppc32.
432         (Target_powerpc::Relocate::relocate): Use global entry plt
433         stub for symbol value if such exists on ELFv2.
434         (Target_powerpc::Relocate::relocate): Don't call
435         symval_for_branch when ELFv2.  Do adjust for local entry
436         offset when ELFv2.
437         (Target_powerpc::do_dynsym_value): Set symbols to global entry
438         plt stub for ELFv2.
439         (Target_powerpc::do_plt_address_for_global): Similarly.
440
441 2013-11-14  Cary Coutant  <ccoutant@google.com>
442
443         Revert patch -- this did not fix the problem, and there is
444         no race there.
445
446         2013-11-14  Cary Coutant  <ccoutant@google.com>
447
448             PR gold/14860
449             * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
450             (Ehframe_hdr::set_final_data_size): Allocate a Lock.
451             * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
452             updating fde_offsets_.
453             (Eh_frame_hdr::lock_): New data member.
454
455 2013-11-14  Cary Coutant  <ccoutant@google.com>
456
457         * dwp.cc (Dwo_file_entry): New type.
458         (File_list): Use Dwo_file_entry.
459         (Dwo_file::verify): New function.
460         (Dwo_file::verify_dwo_list): New function.
461         (Dwo_file::sized_verify_dwo_list): New function.
462         (Dwo_name_info_reader::visit_compilation_unit): Add dwo_id to file
463         list.
464         (Dwp_options): New enum type.
465         (dwp_options): Add --verify-only.
466         (usage): Likewise.
467         (main): Likewise.
468         * dwp.h (gold_info): Add declaration.
469
470 2013-11-14  Cary Coutant  <ccoutant@google.com>
471
472         PR gold/14860
473         * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
474         (Ehframe_hdr::set_final_data_size): Allocate a Lock.
475         * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
476         updating fde_offsets_.
477         (Eh_frame_hdr::lock_): New data member.
478
479 2013-11-06  Cary Coutant  <ccoutant@google.com>
480
481         PR gold/15758
482         * object.cc (Sized_relobj_file::do_layout): Handle .eh_frame sections
483         before reloc sections.
484
485 2013-11-04  Alan Modra  <amodra@gmail.com>
486
487         * symtab.h (Symbol::Reference_flags): Add FUNC_DESC_ABI.
488         (Symbol::needs_dynamic_reloc): Test new flag.
489         * powerpc.cc (needs_dynamic_reloc, use_plt_offset): Delete.
490         (Target_powerpc::Scan::get_reference_flags): Add target param.
491         Return FUNC_DESC_ABI for 64-bit ELFv1.
492         (Target_powerpc::Branch_info::make_stub): Adjust get_reference_flags
493         call.
494         (Target_powerpc::Scan::global): Use Symbol::needs_dynamic_reloc.
495         (Target_powerpc::Relocate::relocate): Use Symbol::use_plt_offset.
496
497 2013-10-31  Cary Coutant  <ccoutant@google.com>
498
499         Restore support for dwp v2 DWARF package file format.
500
501         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
502         tu_length parameter.  Adjust all callers.
503         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
504         * dwp.cc: Include dwarf.h.
505         (Section_bounds): New struct type.
506         (Unit_set): New struct type.
507         (Dwo_file::Dwo_file): Initialize new data member.
508         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
509         Combine and rename to...
510         (Dwo_file::read_unit_index): ...this.
511         (Dwo_file::sized_read_compunit_index)
512         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
513         (Dwo_file::sized_read_unit_index): ...this.
514         (Dwo_file::copy_section): Remove section_name, is_str_offsets
515         parameters; add section_id parameter.
516         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
517         (Dwo_file::add_unit_set): ...this.
518         (Dwo_file::shndx_map_): Remove.
519         (Dwo_file::sect_offsets_): New data member.
520         (Dwp_output_file::Dwp_output_file): Initialize new data members.
521         (Dwp_output_file::add_section): Rename to...
522         (Dwp_output_file::add_contribution): ...this.
523         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
524         (Dwp_output_file::add_tu_set): Likewise.
525         (Dwp_output_file::Contribution): New type.
526         (Dwp_output_file::Section::contributions): New data member.
527         (Dwp_output_file::Cu_or_tu_set): Remove.
528         (Dwp_output_file::Section::Section): New ctor.
529         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
530         (Dwp_output_file::Dwp_index::Section_table): New type.
531         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
532         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
533         parameter.
534         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
535         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
536         (Dwp_output_file::Dwp_index::section_table): New member function.
537         (Dwp_output_file::Dwp_index::section_table_end): New member function.
538         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
539         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
540         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
541         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
542         (Dwp_output_file::Dwp_index::section_table_): New data member.
543         (Dwp_output_file::Dwp_index::section_mask_): New data member.
544         (Dwp_output_file::add_output_section): New member function.
545         (Dwp_output_file::write_new_section): New member function.
546         (Dwp_output_file::write_contributions): New member function.
547         (Dwp_output_file::section_id_map_): New data member.
548         (class Dwo_id_info_reader): Remove.
549         (class Unit_reader): New class.
550         (get_dwarf_section_name): New function.
551         (Dwo_file::read_executable): Adjust initializations of class data.
552         (Dwo_file::read): Add support for v2 package file format.
553         (Dwo_file::read_unit_index): Likewise.
554         (Dwo_file::sized_read_unit_index): Likewise.
555         (Dwo_file::copy_section): Likewise.
556         (Dwo_file::add_unit_set): Likewise.
557         (Dwp_output_file::add_output_section): Likewise.
558         (Dwp_output_file::add_contribution): Likewise.
559         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
560         for empty slot.
561         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
562         file format.
563         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
564         slot.
565         (Dwp_output_file::initialize): Remove unused function.
566         (Dwp_output_file::finalize): Add support for v2 package file format.
567         (Dwp_output_file::write_index): Likewise.
568         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
569         function prototype.
570
571 2013-10-31  Cary Coutant  <ccoutant@google.com>
572
573         * configure.ac: Fix check for -fmerge-constants.
574         * configure.ac: Regenerate.
575
576 2013-10-30  Roland McGrath  <mcgrathr@google.com>
577
578         * x86_64.cc (Output_data_plt_x86_64_nacl::first_plt_entry):
579         Correct 9-byte nop sequence to match what the assembler generates.
580
581 2013-10-30  Alan Modra  <amodra@gmail.com>
582
583         * powerpc.cc (Powerpc_relobj::abiversion, set_abiversion,
584         ppc64_local_entry_offset, ppc64_local_entry_offset,
585         do_read_symbols): New functions.
586         (Powerpc_relobj::e_flags_, st_other_): New vars.
587         (Powerpc_relobj::Powerpc_relobj): Call set_abiversion.
588         (Powerpc_dynobj::abiversion, set_abiversion): New functions.
589         (Powerpc_relobj::e_flags_): New var.
590         (Target_powerpc::first_plt_entry_offset, plt_entry_size): Inline
591         and adjust for ELFv2.
592         (Target_powerpc::abiversion, set_abiversion, stk_toc): New functions.
593         (Powerpc_relobj::do_find_special_sections): Check no .opd in ELFv2.
594         (Powerpc_dynobj::do_find_special_sections): Likewise.
595         (Target_powerpc::do_define_standard_symbols): Define ".TOC.".
596         (Target_powerpc::Branch_info::make_stub): Adjust stub destination
597         to ELFv2 local entry.
598         (Target_powerpc::do_relax): No thread safe barriers needed for
599         ELFv2.
600         (Output_data_plt_powerpc::initial_plt_entry_size_,
601         plt_entry_size): Delete.  Replace all uses with
602         first_plt_entry_offset() and plt_entry_size().
603         (Output_data_plt_powerpc::Output_data_plt_powerpc): Remove
604         reserved_size parm.  Update callers.
605         (Output_data_plt_powerpc::entry_count): Update.
606         (Output_data_plt_powerpc::first_plt_entry_offset): Make private
607         and use Target_powerpc::first_plt_entry_offset().
608         (Output_data_plt_powerpc::get_plt_entry_size): Similarly and
609         rename to plt_entry_size.
610         (Output_data_plt_powerpc::add_ifunc_entry,
611         add_local_ifunc_entry): Adjust reloc for ELFv2.
612         (glink_eh_frame_fde_64): Rename to glink_eh_frame_fde_64v1.
613         (glink_eh_frame_fde_64v2): New.
614         (Stub_table::plt_call_size): Support ELFv2 sizing.
615         (Output_data_glink::add_eh_frame): Use the new FDE.
616         (Output_data_glink::set_final_data_size): Adjust for ELFv2 glink.
617         (Stub_table::do_write): Write ELFv2 stubs and glink.
618         (Target_powerpc::Relocate::relocate): Replaces nop after call
619         with ld 2,24(1) and adjust local offset destination for ELFv2.
620
621 2013-10-30  Alan Modra  <amodra@gmail.com>
622
623         * powerpc.cc (Target_powerpc::Scan::check_non_pic): Handle new relocs.
624         (Target_powerpc::Scan::global, local): Likewise.
625         (Target_powerpc::Relocate::relocate): Likewise.  Check for overflow
626         on all ppc64 @h and @ha relocs.
627
628 2013-10-14  Alan Modra  <amodra@gmail.com>
629
630         * output.h (Output_data_got::add_constant): Tidy.
631         (Output_data_got::add_constant_pair): New function.
632         * powerpc.cc (Output_data_got_powerpc): Override all Output_data_got
633         methods used so as to first call reserve_ent().
634
635 2013-10-11  Roland McGrath  <mcgrathr@google.com>
636
637         * powerpc.cc (Output_data_got_powerpc): Remove unused methods
638         add_got_entry and add_got_entry_pair.
639
640         * configure.ac (TLS_GNU2_DIALECT): Use -Werror in test.
641         (HAVE_PUBNAMES): Likewise.
642         * configure: Regenerate.
643
644         * testsuite/Makefile.am: Replace '-T foo' with '-Wl,-T,foo' throughout.
645         * testsuite/Makefile.in: Regenerate.
646
647         * target.h (Target::adjust_elf_header, Target::do_adjust_elf_header):
648         Remove const from declaration.
649         * target.cc (Sized_target::do_adjust_elf_header): Update definition.
650         * sparc.cc (Target_sparc::do_adjust_elf_header): Likewise.
651         * output.h (Output_file_header): Remove const from member target_
652         and corresponding constructor argument.
653         * output.cc (Output_file_header::Output_file_header): Update prototype.
654         (Output_file_header::do_sized_write): Use this->target_ in place
655         of parameters()->target().
656
657         * testsuite/undef_symbol.cc (Foo::get_a): New method.
658
659         * configure.ac (MERGE_CONSTANTS_FLAG): New check.
660         * configure: Regenerate.
661         * Makefile.in: Regenerate.
662         * testsuite/merge_string_literals_1.c: Renamed to have .cc suffix.
663         * testsuite/merge_string_literals_2.c: Likewise.
664         * testsuite/Makefile.am
665         (merge_string_literals_1.o, merge_string_literals_2.o): Update deps.
666         (AM_CFLAGS, AM_CXXFLAGS): Use $(MERGE_CONSTANTS_FLAG) in place of
667         literal -fmerge-constants.
668         * testsuite/Makefile.in: Regenerate.
669
670         * i386.cc (Target_i386): Remove unused member dynbss_.
671         * arm.cc (Target_arm): Likewise.
672         * powerpc.cc (Target_powerpc): Likewise.
673         * sparc.cc (Target_sparc): Likewise.
674         * tilegx.cc (Target_tilegx): Likewise.
675         * x86_64.cc (Target_x86_64): Likewise.
676         * dwarf_reader.h (Dwarf_info_reader): Remove unused members
677         type_signature_, type_offset_.
678         * plugin.h (Plugin_hook): Remove unused member layout_.
679         * readsyms.h (Add_symbols): Remove unused members dirpath_, dirindex_,
680         mapfile_.
681         (Read_member): Remove unused members input_objects_, symtab_,
682         mapfile_, layout_.
683         (Check_library): Remove unused member symtab_.
684         * archive.h (Lib_group): Remove unused member lib_.
685         * archive.cc (Lib_group::Lib_group): Update initializer.
686         * incremental.h (Incremental_binary): Remove unused member target_.
687         (Incremental_script_entry): Removed unused member script_.
688         * layout.h (Write_symbols_task): Remove unused member input_objects_.
689         * icf.h (Icf): Remove unused member num_tracked_relocs.
690
691         * gold-threads.h (Once): Conditionalize member was_run_lock_ on
692         [ENABLE_THREADS && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4], matching
693         its only use.
694         * gold-threads.cc (Once::Once): Likewise conditionalize initializer.
695
696         * archive.h: Use struct rather than class for forward declaration
697         of Read_symbols_data.
698
699 2013-10-07  Cary Coutant  <ccoutant@google.com>
700
701         PR gold/16010
702         * testsuite/Makefile.am (icf_test): Fix dependencies.
703         (icf_safe_test): Likewise.
704         (icf_safe_so_test): Likewise.
705         (large_symbol_alignment): Add empty _LDADD rule.
706         * testsuite/Makefile.in: Regenerate.
707
708 2013-09-03  Pavel Chupin  <pavel.v.chupin@intel.com>
709
710         PR gold/15927
711         * x86_64.cc (Target_x86_64<size>::Scan::global): Use relative
712         relocation for R_X86_64_32 on x32.
713
714 2013-08-27  Roland McGrath  <mcgrathr@google.com>
715
716         * output.cc (Output_segment::set_section_addresses): Take new
717         Target* argument.  If target->isolate_execinstr() and the segment
718         is executable and starts at a target->abi_pagesize() boundary,
719         pad its end out to a target->abi_pagesize() boundary with code fill.
720         * output.h (Output_segment::set_section_addresses): Update decl.
721         * layout.h (Layout::check_output_data_for_reset_values): Take new
722         argument RELAX_OUTPUTS.
723         (Layout): New member relax_output_list_.
724         (Layout::add_relax_output): New method.
725         * layout.cc (Layout::Layout): Update constructor.
726         (Layout::reset_relax_output): New method.
727         (Layout::clean_up_after_relaxation): Call it.
728         (Layout::prepare_for_relaxation): Update caller.
729         (Layout::set_segment_offsets): Update callers of set_section_addresses.
730         Call reset_relax_output before re-processing segments for
731         isolate_execinstr case.
732         (Layout::write_data): Handle relax_output_list_.
733         (Layout::Relaxation_debug_check::check_output_data_for_reset_values):
734         Take new argument RELAX_OUTPUTS.  Assert it's an empty collection.
735
736 2013-08-23  Yuri Chornoivan  <yurchor@ukr.net>
737
738         PR binutils/15834
739         * object.h: Fix typos.
740
741 2013-08-16  Roland McGrath  <mcgrathr@google.com>
742
743         * i386.cc (Target_i386_nacl::do_code_fill): New virtual function.
744         * x86_64.cc (Target_x86_64_nacl::do_code_fill): New virtual function.
745
746 2013-08-07  Cary Coutant  <ccoutant@google.com>
747
748         Revert support for v2 DWP files:
749
750         2013-03-01  Cary Coutant  <ccoutant@google.com>
751
752             Add dwp support for v2 DWARF package file format.
753             * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
754             tu_length parameter.  Adjust all callers.
755             * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
756             * dwp.cc: Include dwarf.h.
757             (Section_bounds): New struct type.
758             (Unit_set): New struct type.
759             (Dwo_file::Dwo_file): Initialize new data member.
760             (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
761             Combine and rename to...
762             (Dwo_file::read_unit_index): ...this.
763             (Dwo_file::sized_read_compunit_index)
764             (Dwo_file::sized_read_typeunit_index): Combine and rename to...
765             (Dwo_file::sized_read_unit_index): ...this.
766             (Dwo_file::copy_section): Remove section_name, is_str_offsets
767             parameters; add section_id parameter.
768             (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
769             (Dwo_file::add_unit_set): ...this.
770             (Dwo_file::shndx_map_): Remove.
771             (Dwo_file::sect_offsets_): New data member.
772             (Dwp_output_file::Dwp_output_file): Initialize new data members.
773             (Dwp_output_file::add_section): Rename to...
774             (Dwp_output_file::add_contribution): ...this.
775             (Dwp_output_file::add_cu_set): Combine parameters into a struct.
776             (Dwp_output_file::add_tu_set): Likewise.
777             (Dwp_output_file::Contribution): New type.
778             (Dwp_output_file::Section::contributions): New data member.
779             (Dwp_output_file::Cu_or_tu_set): Remove.
780             (Dwp_output_file::Section::Section): New ctor.
781             (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
782             (Dwp_output_file::Dwp_index::Section_table): New type.
783             (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
784             (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
785             parameter.
786             (Dwp_output_file::Dwp_index::shndx_pool): Remove.
787             (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
788             (Dwp_output_file::Dwp_index::section_table): New member function.
789             (Dwp_output_file::Dwp_index::section_table_end): New member function.
790             (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
791             (Dwp_output_file::Dwp_index::section_table_rows): New member function.
792             (Dwp_output_file::Dwp_index::section_table_cols): New member function.
793             (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
794             (Dwp_output_file::Dwp_index::section_table_): New data member.
795             (Dwp_output_file::Dwp_index::section_mask_): New data member.
796             (Dwp_output_file::add_output_section): New member function.
797             (Dwp_output_file::write_new_section): New member function.
798             (Dwp_output_file::write_contributions): New member function.
799             (Dwp_output_file::section_id_map_): New data member.
800             (class Dwo_id_info_reader): Remove.
801             (class Unit_reader): New class.
802             (get_dwarf_section_name): New function.
803             (Dwo_file::read_executable): Adjust initializations of class data.
804             (Dwo_file::read): Add support for v2 package file format.
805             (Dwo_file::read_unit_index): Likewise.
806             (Dwo_file::sized_read_unit_index): Likewise.
807             (Dwo_file::copy_section): Likewise.
808             (Dwo_file::add_unit_set): Likewise.
809             (Dwp_output_file::add_output_section): Likewise.
810             (Dwp_output_file::add_contribution): Likewise.
811             (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
812             for empty slot.
813             (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
814             file format.
815             (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
816             slot.
817             (Dwp_output_file::initialize): Remove unused function.
818             (Dwp_output_file::finalize): Add support for v2 package file format.
819             (Dwp_output_file::write_index): Likewise.
820             * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
821             function prototype.
822
823 2013-07-31  Cary Coutant  <ccoutant@google.com>
824
825         * object.cc (Sized_relobj::do_output_section_address): New function.
826         (Sized_relobj): Instantiate explicitly.
827         * object.h (Object::output_section_address): New function.
828         (Object::do_output_section_address): New function.
829         (Sized_relobj::do_output_section_address): New function.
830         * powerpc.cc (Target_powerpc::symval_for_branch): Use it.
831
832 2013-07-30  Cary Coutant  <ccoutant@google.com>
833             Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
834
835         * parameters.cc (Parameters::entry): Return target-specific entry
836         symbol name.
837         * target.h (Target::entry_symbol_name): New function.
838         (Target_info::entry_symbol_name): New data member.
839
840         * arm.cc (Target_arm::arm_info): Add entry_symbol_name.
841         * i386.cc (Target_i386::i386_info): Likewise.
842         (Target_i386_nacl::i386_nacl_info): Likewise.
843         * sparc.cc (Target_sparc::sparc_info): Likewise.
844         * tilegx.cc (Target_tilegx::tilegx_info): Likewise.
845         * x86_64.cc: (Target_x86_64::x86_64_info) Likewise.
846         (Target_x86_64_nacl::x86_64_nacl_info) Likewise.
847         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
848
849 2013-07-22  Sterling Augustine  <saugustine@google.com>
850
851         * dwarf_reader.cc (Dwarf_pubnames_table::read_section):
852         Convert parameter shndx to local variable. Add parameters symtab
853         and symtab_size.  Scan over section names.  Find relocation
854         section corresponding to current section.  Create and initialize
855         reloc_mapper_ and reloc_type_.
856         (Dwarf_pubnames_table::read_header):  Add assertion.  Change
857         unit_length to off_t.  Initialize member unit_length_.  Fill in field
858         cu_offset_.
859         * dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
860         Initialize new fields unit_length_ and cu_offset_.
861         (Dwarf_pubnames_table::read_section): Update prototype.
862         (Dwarf_pubnames_table::cu_offset): New member function.
863         (Dwarf_pubnames_table::subsection_size): Likewise.
864         (Dwarf_pubnames_table::cu_offset_, Dwarf_pubnames_table::unit_length):
865         New fields.
866         (Dwarf_info_reader::symtab, Dwarf_info_reader::symtab_size): Make
867         member functions public.
868         * gdb_index.cc (Gdb_index_info_reader::read_pubnames_and_pubtypes):
869         Update comment.  Rework logic.  Move repeated parts to...
870         (Gdb_index_info_reader::read_pubtable): ...here. New function.
871         (Gdb_index::Gdb_index): Initialize new fields, pubnames_table_,
872         pubtypes_table_, and stmt_list_offset.
873         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
874         Gdb_index::find_pubtype_offset,
875         Gdb_index::map_pubnames_and_types_to_dies): Define new functions.
876         (Gdb_index::pubnames_read): Update prototype and rework logic.
877         * gdb_index.h (Gdb_index_info_reader, Dwarf_pubnames_table):
878         Forward declare.
879         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
880         Gdb_index::find_pubtype_offset, Gdb_index::pubnames_table)
881         Gdb_index::pubtypes_table, Gdb_index::map_pubnames_and_types_to_dies,
882         Gdb_index::map_pubtable_to_dies):
883         Declare functions.
884         (Gdb_index::pubnames_read): Update declaration.
885         (Gdb_index::Pubname_offset_map): New type.
886         (Gdb_index::cu_pubname_map_, Gdb_index::cu_pubtype_map_,
887         Gdb_index::pubnames_table_, Gdb_index::pubtypes_table_,
888         Gdb_index::stmt_list_offset): Declare.
889         (Gdb_index::pubnames_shndx_, Gdb_index::pubnames_offet_,
890         Gdb_index::pubtypes_object_, Gdb_index::pubtypes_shndx_)
891         Gdb_index::pubtypes_offset_): Remove.
892
893 2013-07-19  Roland McGrath  <mcgrathr@google.com>
894
895         * options.h (General_options): Add -Trodata-segment option.
896         * parameters.cc (Parameters::check_rodata_segment): New function.
897         (Parameters::set_target_once): Call it.
898         * parameters.h (Parameters): Declare it (private member function).
899         * layout.cc (load_seg_unusable_for_headers): New function, broken
900         out of Layout::relaxation_loop_body.  If TARGET->isolate_execinstr()
901         then validate rodata segment rather than text segment.
902         (relaxation_loop_body): Call that.
903         (is_text_segment): New function.  Don't admit a non-executable
904         segment if TARGET->isolate_execinstr().
905         (set_segment_offsets): Call it.  Honor -Trodata-segment option.
906
907 2013-07-15  Shawn Landden  <shawnlandden@gmail.com>
908
909         PR gold/15070
910         * fileread.h (File_read::get_view): Clarify comment about ALIGNED.
911         * nacl.h (Sniff_file::View::View): Request aligned view.
912
913 2013-07-11  Cary Coutant  <ccoutant@google.com>
914
915         * powerpc.cc (Target_powerpc::write_branch_lookup_table): Use
916         correct BRLT entry size.
917
918 2013-07-03  Alan Modra  <amodra@gmail.com>
919
920         * powerpc.cc (Target_powerpc::Relocate::relocate): Update self-call
921         comment.
922
923 2013-07-01  Cary Coutant  <ccoutant@google.com>
924
925         * dwarf_reader.cc (Dwarf_ranges_table::read_ranges_table): Save
926         reloc_type_.
927         (Dwarf_ranges_table::read_range_list): Call lookup_reloc.
928         (Dwarf_ranges_table::lookup_reloc): New function.
929         * dwarf_reader.h (Dwarf_ranges_table::Dwarf_ranges_table): Initialize
930         reloc_type_.
931         (Dwarf_ranges_table::lookup_reloc): New function.
932         (Dwarf_ranges_table::reloc_type_): New data member.
933
934 2013-06-27  Jing Yu  <jingyu@google.com>
935
936         PR gold/15662
937         * powerpc.cc (Output_data_brlt_powerpc::reset_brlt_sizes): New
938         function.
939         (Output_data_brlt_powerpc::finalize_brlt_sizes): New function.
940         (Target_powerpc::do_relax): Call the above.
941
942 2013-06-27  Cary Coutant  <ccoutant@google.com>
943
944         * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
945         on garbage collected .opd section.
946
947 2013-06-27  Alan Modra  <amodra@gmail.com>
948
949         * powerpc.cc (Target_powerpc::do_gc_add_reference): Test dst_shndx
950         is non-zero.
951         (Target_powerpc::do_gc_mark_symbols): Likewise for sym->shndx().
952         (Target_powerpc::do_function_location): Likewise for loc->shndx.
953
954 2013-06-14  Cary Coutant  <ccoutant@google.com>
955
956         * resolve.cc (Symbol::override_base): Don't override st_type
957         from plugin placeholder symbols.
958         (Symbol_table::resolve): Likewise.
959         (Symbol_table::should_override): Don't complain about TLS mismatch
960         if the TO symbol is a plugin placeholder.
961         * testsuite/Makefile.am (plugin_test_tls): New test.
962         * testsuite/Makefile.in: Regenerate.
963         * testsuite/plugin_test_tls.sh: New test script.
964         * testsuite/two_file_test_2_tls.cc: New test source.
965         * testsuite/two_file_test_tls.cc: New test source.
966
967 2013-06-05  Alexander Ivchenko  <alexander.ivchenko@intel.com>
968
969         * layout.cc (Layout::set_segment_offsets): Taking care of the case when
970         the maximum segment alignment is larger than the page size.
971         * testsuite/Makefile.am (large_symbol_alignment): Test that Gold
972         correctly aligns the symbols with large alignemnt.
973         * testsuite/Makefile.in: Regenerate.
974         * testsuite/large_symbol_alignment.cc: New file.
975
976 2013-05-30  Alexander Ivchenko  <alexander.ivchenko@intel.com>
977             Sriraman Tallam  <tmsriram@google.com>
978
979         * options.h (sort_section): New option.
980         * output.h (Input_section_sort_section_prefix_special_ordering_compare):
981         Rename from Input_section_sort_section_name_special_ordering_compare.
982         (Input_section_sort_section_name_compare): New struct.
983         * output.cc (Output_section::Input_section_sort_section_name_compare::
984         operator()): New function.
985         (Output_section::sort_attached_input_sections): Use new sort function
986         for .text if --sort-section=name is specified.
987         * layout.cc (Layout::make_output_section):
988         Add sorting by name when --sort-section=name is specified.
989         * testsuite/Makefile.am (text_section_grouping): Test option
990         --sort-section=name.
991         * testsuite/Makefile.in: Regenerate.
992         * testsuite/section_sorting_name.cc: New file.
993         * testsuite/section_sorting_name.sh: New file.
994
995 2013-05-21  Cary Coutant  <ccoutant@google.com>
996
997         * symtab.h (Symbol::is_cxx_vtable): New function.
998         * target-reloc.h (relocate_section): Check for vtable symbol.
999         * testsuite/Makefile.am (missing_key_func.sh): New test case.
1000         * testsuite/Makefile.in: Regenerate.
1001         * testsuite/missing_key_func.cc: New test source.
1002         * testsuite/missing_key_func.sh: New test script.
1003
1004 2013-05-21  Cary Coutant  <ccoutant@google.com>
1005
1006         * object.cc (Sized_relobj_file::get_symbol_location_info): Set
1007         type of enclosing symbol.
1008         (Relocate_info::location): Check symbol type when describing symbol.
1009         * object.h (Symbol_location_info): Remove unused line_number;
1010         add enclosing_symbol_type.
1011         * testsuite/debug_msg.sh: Adjust expected output.
1012
1013 2013-05-13  Cary Coutant  <ccoutant@google.com>
1014
1015         * configure.ac: Export DEFAULT_TARGET.
1016         * configure: Regenerate.
1017         * Makefile.in: Regenerate.
1018         * testsuite/Makefile.am: Add .EXPORT_ALL_VARIABLES.
1019         * testsuite/Makefile.in: Regenerate.
1020         * testsuite/debug_msg.sh: Delete duplicate tests.
1021         Don't check undef_int error message match for powerpc where the
1022         source file and line number aren't available.
1023
1024 2013-05-10  Roland McGrath  <mcgrathr@google.com>
1025
1026         * options.h (General_options): Add --rosegment-gap option.
1027         * options.cc (finalize): --rosegment-gap implies --rosegment.
1028         * layout.cc (set_segment_offsets): Let user option override
1029         target->rosegment_gap().
1030
1031 2013-05-10  Roland McGrath  <mcgrathr@google.com>
1032
1033         * options.h (General_options): Remove leading space from help
1034         messages for -nostdlib and --rosegment.
1035
1036 2013-05-03  Maciej W. Rozycki  <macro@codesourcery.com>
1037
1038         PR ld/15365
1039         * layout.cc (Layout::finalize): Make __ehdr_start STV_HIDDEN.
1040
1041 2013-05-03  Alan Modra  <amodra@gmail.com>
1042
1043         * merge.cc (Output_merge_string::do_add_input_section): Correct
1044         scan for number of strings.  Rename vars to avoid shadowing.
1045         Include missing terminator in input_size_.
1046
1047 2013-05-01  H.J. Lu  <hongjiu.lu@intel.com>
1048
1049         * merge.cc (Output_merge_string<Char_type>::do_add_input_section):
1050         Restore empty string handling.
1051
1052 2013-05-01  Cary Coutant  <ccoutant@google.com>
1053
1054         * stringpool.cc (Stringpool_template::new_key_offset): Fix
1055         uninitialized warning.
1056
1057 2013-04-29  Alexander Ivchenko  <alexander.ivchenko@intel.com>
1058
1059         * output.cc (Output_section::add_merge_input_section): Allow
1060         to merge sections if the alignment is more than character size.
1061         * merge.h (Output_merge_string::Output_merge_string): Remove
1062         assert.
1063         * merge.cc (Output_merge_string<Char_type>::do_add_input_section): Count
1064         only not-null strings. Check the alignment of strings.
1065         * stringpool.h
1066         (Stringpool_template<Stringpool_char>::Stringpool_template): Add
1067         alignment as the argument.
1068         (Stringpool_template<Stringpool_char>::addralign_): New class member.
1069         * stringpool.cc (Stringpool_template<Stringpool_char>::new_key_offset):
1070         Align non-zero length strings according to the addralign_.
1071         (Stringpool_template<Stringpool_char>::set_string_offsets):
1072         Updating offsets according to the given alignment.
1073         * testsuite/Makefile.am (text_section_grouping): Test if string
1074         literals are getting merged.
1075         * testsuite/Makefile.in: Regenerate.
1076         * testsuite/merge_string_literals_1.c: New file.
1077         * testsuite/merge_string_literals_2.c: Ditto.
1078         * testsuite/merge_string_literals.sh: Ditto.
1079
1080 2013-04-26  Ian Lance Taylor  <iant@google.com>
1081
1082         * target-reloc.h (relocate_section): If the reloc offset is out of
1083         range, pass VIEW as NULL to relocate.relocate.
1084         * arm.cc (Target_arm:Relocate::relocate): Check for a NULL view.
1085         * i386.cc (Target_i386::Relocate::relocate): Likewise.
1086         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
1087         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
1088         * tilegx.cc (Target_tilegx::Relocate::relocate): Likewise.
1089         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
1090
1091 2013-04-26  Geoff Pike  <gpike@chromium.org>
1092
1093         * gold.cc (queue_final_tasks): invoke layout->queue_build_id_tasks().
1094         * layout.cc (Hash_task): New class.
1095         (Layout::queue_build_id_tasks): New function.
1096         (Layout::write_build_id): Handle single-thread portion of build ID
1097         computation.  (In some cases, all of it is single-threaded.)  Replace
1098         {sha1,md5}_process_bytes with {sha1,md5}_buffer to get the same
1099         functionality in fewer lines of code.
1100         * layout.h (Layout::queue_build_id_tasks): New function declaration.
1101         * options.h (General_options): make "--build-id" default to tree
1102         rather than sha1.  Add two new options related to --build-id=tree:
1103         --build-id-chunk-size-for-treehash and
1104         --build-id-min-file-size-for-treehash.
1105         * Makefile.am: add testing of --build-id=tree and related new options
1106         (these tests will be invoked by "make check").
1107         * Makefile.in: Regenerate.
1108
1109 2013-04-25  Alan Modra  <amodra@gmail.com>
1110
1111         * configure.tgt: Add powerpcle and powerpc64le.
1112
1113 2013-04-22  Alan Modra  <amodra@gmail.com>
1114
1115         PR gold/15355
1116         * layout.cc (Layout::segment_precedes): Allow more than one
1117         segment with the same type and flags.
1118
1119 2013-04-15  Cary Coutant  <ccoutant@google.com>
1120
1121         * layout.cc (Layout::set_relocatable_section_offsets): Don't
1122         allocate space in file for BSS sections.
1123
1124 2013-04-15  Cary Coutant  <ccoutant@google.com>
1125
1126         * script-sections.cc (Orphan_output_section): Reset address
1127         to zero after each orphaned section for relocatable links.
1128
1129 2013-04-15  Cary Coutant  <ccoutant@google.com>
1130
1131         * symtab.cc (Symbol_table::sized_write_globals): Subtract
1132         section starting address for relocatable link.
1133         * testsuite/Makefile.am (script_test_11): New test.
1134         * testsuite/Makefile.in: Regenerate.
1135         * testsuite/script_test_11.c: New source file.
1136         * testsuite/script_test_11.t: New linker script.
1137
1138 2013-04-13  Alan Modra  <amodra@gmail.com>
1139
1140         * powerpc.cc (Stub_control::can_add_to_stub_group): Don't set
1141         owner when sections are not adjacent and exceed group size.
1142         (Target_powerpc::group_sections): Handle corner case.
1143         (Target_powerpc::Branch_info::make_stub): Handle case where
1144         stub table doesn't exist due to branches in non-exec sections.
1145         (Target_powerpc::Relocate::relocate): Likewise.
1146
1147 2013-04-11  Alan Modra  <amodra@gmail.com>
1148
1149         PR gold/15354
1150         * powerpc.cc (Target_powerpc::make_brlt_section): Name section
1151         .branch_lt to match bfd ld.  Adjust comments throughout file.
1152
1153 2013-04-04  Ian Lance Taylor  <iant@google.com>
1154
1155         GCC PR c++/56840
1156         * object.cc (do_layout_deferred_sections): Handle .eh_frame
1157         sections before checking whether they are included in the link.
1158
1159 2013-03-29  Sriraman Tallam  <tmsriram@google.com>
1160
1161         * archive.cc (Archive::get_elf_object_for_member):  Create the elf
1162         object before calling the plugin claim_file handler.  Pass the elf
1163         object of the archive to the plugin. Delete the elf object if the
1164         plugin claims the file.
1165
1166 2013-03-21  Alan Modra  <amodra@gmail.com>
1167
1168         * layout.cc (Layout::set_segment_offsets): Accept writable .text
1169         segment when omagic.
1170
1171 2013-03-21  Alan Modra  <amodra@gmail.com>
1172
1173         * dwp.cc (Dwp_output_file::add_contribution): Avoid signed/unsigned
1174         comparison warning.
1175         * layout.cc (Layout::create_dynamic_symtab): Avoid "may be used
1176         uninitialized" warning.
1177
1178 2013-03-20  Alan Modra  <amodra@gmail.com>
1179
1180         * symtab.h (Symbol::clear_version): New function.
1181         * symtab.cc (Symbol_table::set_dynsym_indexes): Don't set object
1182         is_needed by weak references.  Clear version for symbols defined
1183         in as-needed objects that are not needed.
1184
1185 2013-03-15  Alan Modra  <amodra@gmail.com>
1186
1187         * powerpc.cc (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Make
1188         static and public.  Add report_err param.  Return false for data refs.
1189         (Target_powerpc::rela_dyn_section): New overloaded function.
1190         (Target_powerpc::plt_, iplt_): Elucidate.
1191         (Output_data_plt_powerpc::entry_count): Handle current_data_size()==0.
1192         (Output_data_plt_powerpc::do_write): Don't write .iplt.
1193         (Output_data_plt_powerpc::plt_entry_count): Don't add .iplt entries.
1194         (Target_powerpc::Scan::local, global): Adjust reloc_needs_plt_for_ifunc
1195         calls.  Put ifunc dynamic relocs in irela_dyn_section.  Only
1196         push_branch and make_plt_entry for ifunc syms when
1197         reloc_needs_plt_for_ifunc.
1198         (Target_powerpc::Relocate::relocate): Don't use plt entry value
1199         for ifunc unless reloc_needs_plt_for_ifunc.
1200
1201 2013-03-15  Alan Modra  <amodra@gmail.com>
1202
1203         * gc.h (gc_process_relocs): Don't look through function descriptors.
1204         * icf.cc (get_section_contents): Do so here instead.
1205
1206 2013-03-13  Alan Modra  <amodra@gmail.com>
1207
1208         * powerpc.cc (is_branch_reloc): Forward declare.
1209         (Target_powerpc::do_can_check_for_function_pointers): New predicate.
1210         (Target_powerpc::Scan::local_reloc_may_be_function_pointer): Return
1211         false for 64-bit, true for 32-bit non-branch relocs.
1212         (Target_powerpc::Scan::global_reloc_may_be_function_pointer): Likewise.
1213         * testsuite/Makefile.am (icf_test): Use linker map file instead of
1214         nm output.
1215         (icf_safe_test): Generate linker map file as well as nm output.
1216         (icf_safe_so_test): Likewise.
1217         * testsuite/Makefile.in: Regenerate.
1218         * testsuite/icf_test.sh: Parse linker map file to determine
1219         section folding.
1220         * testsuite/icf_safe_test.sh: Likewise.  Expect folding for PowerPC.
1221         * testsuite/icf_safe_so_test.sh: Likewise.
1222         (X86_32_or_ARM_specific_safe_fold): Merge into..
1223         (arch_specific_safe_fold): ..this.
1224         (X86_64_specific_safe_fold): Delete unused function.
1225
1226 2013-03-12  Alan Modra  <amodra@gmail.com>
1227
1228         * gc.h (gc_process_relocs): Look through function descriptors
1229         to determine shndx, symvalue and addend used by ICF.  Tidy
1230         variable duplication.
1231
1232 2013-03-11  Alan Modra  <amodra@gmail.com>
1233
1234         * gold.cc (queue_middle_tasks): Move detect_odr_violations..
1235         * layout.cc (Layout_task_runner::run): ..to here.
1236         * symtab.h (struct Symbol_location): Extract from..
1237         (class Symbol_table): ..here.
1238         * symtab.cc (Symbol_table::linenos_from_loc): Invoke function_location.
1239         * target.h (class Target): Add function_location and
1240         do_function_location functions.
1241         (class Sized_target): Add do_function_location.
1242         * object.h (class Sized_relobj_file): Move find_shdr..
1243         (class Object): ..to here.
1244         * object.cc: Likewise.  Update to suit.  Instantiate.
1245         (Sized_relobj_file::find_eh_frame): Update find_shdr call.
1246         * powerpc.cc (class Powerpc_dynobj): New.
1247         (Target_powerpc::do_function_location): New function.
1248         (Powerpc_relobj::do_find_special_sections): Update find_shdr call.
1249         (Powerpc_dynobj::do_read_symbols): New function.
1250         (Target_powerpc::do_make_elf_object): Make a Powerpc_dynobj.
1251
1252 2013-03-08  Ian Lance Taylor  <iant@google.com>
1253
1254         * options.cc (General_options::string_to_object_format): Accept
1255         "default".
1256
1257 2013-03-08  Alan Modra  <amodra@gmail.com>
1258
1259         * ehframe.h (Post_fdes) Make it a vector of Post_fde rather than
1260         pointer to Post_fde.
1261         (struct Post_fde): Move definition to here..
1262         * ehframe.cc (struct Post_fde): ..from here.
1263         (Cie::write): Don't alloc Post_fde.
1264         (Eh_frame::do_sized_write): Update.  Don't free Post_fde.
1265
1266 2013-03-07  Alan Modra  <amodra@gmail.com>
1267
1268         * testsuite/discard_locals_relocatable_test.c: Add a powerpc
1269         relocation referencing .LC0.
1270         * testsuite/discard_locals_test.sh: Remove FIXMEs.
1271
1272 2013-03-07  Alan Modra  <amodra@gmail.com>
1273
1274         * testsuite/ifunc-sel.h (ifunc_sel, ifunc_one): Mark
1275         always_inline.  Add assembly for powerpc to avoid GOT.
1276
1277 2013-03-07  Alan Modra  <amodra@gmail.com>
1278
1279         * testsuite/script_test_10.sh: Don't test .bss section
1280         header number.
1281
1282 2013-03-06  Alan Modra  <amodra@gmail.com>
1283
1284         * powerpc.cc (class Powerpc_relobj): Move some member functions.
1285         (Target_powerpc::symval_for_branch):  Add symtab param.  Update
1286         all callers.  Handle folded sections.
1287         (Target_powerpc::do_gc_add_reference): Don't cast dynamic object
1288         to Powerpc_relobj.
1289         (Global_symbol_visitor_opd::operator()): Likewise.
1290
1291 2013-03-04  Alan Modra  <amodra@gmail.com>
1292
1293         * testsuite/Makefile.am (final_layout_script.lds): Add .sbss.
1294         * testsuite/Makefile.in: Regenerate.
1295
1296 2013-03-01  Cary Coutant  <ccoutant@google.com>
1297
1298         Add dwp support for v2 DWARF package file format.
1299         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
1300         tu_length parameter.  Adjust all callers.
1301         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
1302         * dwp.cc: Include dwarf.h.
1303         (Section_bounds): New struct type.
1304         (Unit_set): New struct type.
1305         (Dwo_file::Dwo_file): Initialize new data member.
1306         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
1307         Combine and rename to...
1308         (Dwo_file::read_unit_index): ...this.
1309         (Dwo_file::sized_read_compunit_index)
1310         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
1311         (Dwo_file::sized_read_unit_index): ...this.
1312         (Dwo_file::copy_section): Remove section_name, is_str_offsets
1313         parameters; add section_id parameter.
1314         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
1315         (Dwo_file::add_unit_set): ...this.
1316         (Dwo_file::shndx_map_): Remove.
1317         (Dwo_file::sect_offsets_): New data member.
1318         (Dwp_output_file::Dwp_output_file): Initialize new data members.
1319         (Dwp_output_file::add_section): Rename to...
1320         (Dwp_output_file::add_contribution): ...this.
1321         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
1322         (Dwp_output_file::add_tu_set): Likewise.
1323         (Dwp_output_file::Contribution): New type.
1324         (Dwp_output_file::Section::contributions): New data member.
1325         (Dwp_output_file::Cu_or_tu_set): Remove.
1326         (Dwp_output_file::Section::Section): New ctor.
1327         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
1328         (Dwp_output_file::Dwp_index::Section_table): New type.
1329         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
1330         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
1331         parameter.
1332         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
1333         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
1334         (Dwp_output_file::Dwp_index::section_table): New member function.
1335         (Dwp_output_file::Dwp_index::section_table_end): New member function.
1336         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
1337         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
1338         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
1339         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
1340         (Dwp_output_file::Dwp_index::section_table_): New data member.
1341         (Dwp_output_file::Dwp_index::section_mask_): New data member.
1342         (Dwp_output_file::add_output_section): New member function.
1343         (Dwp_output_file::write_new_section): New member function.
1344         (Dwp_output_file::write_contributions): New member function.
1345         (Dwp_output_file::section_id_map_): New data member.
1346         (class Dwo_id_info_reader): Remove.
1347         (class Unit_reader): New class.
1348         (get_dwarf_section_name): New function.
1349         (Dwo_file::read_executable): Adjust initializations of class data.
1350         (Dwo_file::read): Add support for v2 package file format.
1351         (Dwo_file::read_unit_index): Likewise.
1352         (Dwo_file::sized_read_unit_index): Likewise.
1353         (Dwo_file::copy_section): Likewise.
1354         (Dwo_file::add_unit_set): Likewise.
1355         (Dwp_output_file::add_output_section): Likewise.
1356         (Dwp_output_file::add_contribution): Likewise.
1357         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
1358         for empty slot.
1359         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
1360         file format.
1361         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
1362         slot.
1363         (Dwp_output_file::initialize): Remove unused function.
1364         (Dwp_output_file::finalize): Add support for v2 package file format.
1365         (Dwp_output_file::write_index): Likewise.
1366         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
1367         function prototype.
1368
1369 2013-03-01  Cary Coutant  <ccoutant@google.com>
1370
1371         * dwarf_reader.cc (Dwarf_info_reader::check_buffer): Move
1372         function into class definition in header file.
1373         (Dwarf_info_reader::warn_corrupt_debug_section): New function.
1374         * dwarf_reader.h (Dwarf_info_reader::warn_corrupt_debug_section):
1375         New function.
1376         (Dwarf_info_reader::check_buffer): Move here from .cc file.
1377
1378 2013-02-28  Alan Modra  <amodra@gmail.com>
1379
1380         * target.h (Target::plt_fde_location, do_plt_fde_location): Declare.
1381         * target.cc (Target::do_plt_fde_location): New function.
1382         * ehframe.h (class FDE): Add post_map field to u_.from_linker,
1383         accessor function, and constructor param.
1384         (struct Post_fde, Post_fdes): Declare.
1385         (Cie::write): Add post_fdes param.
1386         * ehframe.cc (Fde::write): Use plt_fde_location.
1387         (struct Post_fde): Define.
1388         (Cie::write): Stash FDEs added post merge mapping.
1389         (Eh_frame::add_ehframe_for_plt): Assert no new CIEs after mapping.
1390         Adjust Fde constructor call.  Bump final_data_size_ for post map FDEs.
1391         (Eh_frame::do_sized_write): Arrange to write post map FDES after
1392         other FDEs.
1393         * powerpc.cc (Target_powerpc::do_plt_fde_location): New function.
1394         (Target_powerpc::has_glink): New function.
1395         (Target_powerpc::do_relax): Add eh_frame info for stubs.
1396         (struct Eh_cie, eh_frame_cie, glink_eh_frame_fde_64,
1397         glink_eh_frame_fde_32, default_fde): New data.
1398         (Stub_table::eh_frame_added_): New var.
1399         (Stub_table::find_long_branch_entry, stub_address, stub_offset):
1400         Make const.
1401         (Stub_table::add_eh_frame): New function.
1402         (Output_data_glink::add_eh_frame): New function.
1403         (Target_powerpc::make_glink_section): Call add_eh_frame.
1404
1405 2013-02-15  Ian Lance Taylor  <iant@google.com>
1406
1407         * options.h (DEFINE_uint64_alias): Define.
1408         (class General_options): Add -Ttext-segment as an alias for
1409         -Ttext.
1410
1411 2013-02-15  Alan Modra  <amodra@gmail.com>
1412
1413         * powerpc.cc (Stub_table::plt_off): New function, extracted from..
1414         (Stub_table::do_write): ..here, two places.
1415         (Stub_table::plt_call_size): Use it here too.
1416
1417 2013-02-11  Ian Lance Taylor  <iant@google.com>
1418
1419         * descriptors.cc (Descriptors::close_all): New function.
1420         * descriptors.h (class Descriptors): Declare close_all.
1421         (close_all_descriptors): New inline function.
1422         * plugin.cc: Include "descriptors.h".
1423         (Plugin_manager::cleanup): Call close_all_descriptors.
1424
1425 2013-02-06  Alan Modra  <amodra@gmail.com>
1426
1427         * README: Update coding style link.
1428
1429 2013-01-28  Cary Coutant  <ccoutant@google.com>
1430
1431         * dwp.cc (File_list): New typedef.
1432         (Dwo_name_info_reader): New class.
1433         (Dwo_id_info_reader::Dwo_id_info_reader): Remove unused parameters.
1434         (Dwo_id_info_reader::visit_top_die): Remove unused member function.
1435         (Dwo_file::~Dwo_file): Delete input_file_ after obj_.
1436         (Dwo_file::read_executable): New function.
1437         (Dwo_file::read): Move common setup code to ...
1438         (Dwo_file::make_object): ... here.
1439         (dwp_options): Add --exec/-e.
1440         (usage): Likewise.
1441         (main): Likewise.
1442
1443 2013-01-24  Sriraman Tallam  <tmsriram@google.com>
1444
1445         * layout.cc (Layout::layout): Check for option text_reorder.
1446         (Layout::make_output_section): Ditto.
1447         * options.h (text_reorder): New option.
1448         * output.cc (Input_section_sort_compare): Remove special ordering
1449         of section names.
1450         (Output_section::
1451          Input_section_sort_section_name_special_ordering_compare::
1452          operator()): New function.
1453         (Output_section::sort_attached_input_sections): Use new sort function
1454         for .text.
1455         * output.h (Input_section_sort_section_name_special_ordering_compare):
1456         New struct.
1457         * testsuite/Makefile.am (text_section_grouping): Test option
1458         --no-text-reorder
1459         * testsuite/Makefile.in: Regenerate.
1460         * testsuite/text_section_grouping.sh: Check order of functions without
1461         default text reordering.
1462
1463 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
1464
1465         * options.h (General_options): Change default to true for new_dtags.
1466
1467 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
1468
1469         * layout.cc (Layout::finish_dynamic_section): Only add DT_RPATH
1470         when enable_new_dtags is false.  Only add DT_RUNPATH when
1471         enable_new_dtags is true.
1472
1473 2013-01-17  Serge Pavlov  <serge.v.pavlov@gmail.com>
1474
1475         * powerpc.cc (Stub_table::find_plt_call_entry): Make types
1476         used in declaration and definition consistent.
1477         (Target_powerpc::symval_for_branch): Ditto.
1478
1479 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
1480
1481         * testsuite/plugin_final_layout.cc: Fix comment.
1482
1483 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
1484
1485         * layout.cc (Layout::layout): Do not do default sorting for
1486         text sections when section ordering is specified.
1487         (make_output_section): Ditto.
1488         * testsuite/plugin_final_layout.cc: Name the function sections
1489         to catch reordering issues.
1490
1491 2013-01-15  Alan Modra  <amodra@gmail.com>
1492
1493         * powerpc.cc (Target_powerpc::do_relax): Default shared libs to
1494         plt-thread-safe.
1495
1496 2013-01-15  Alan Modra  <amodra@gmail.com>
1497
1498         * testsuite/Makefile.am (final_layout_script.lds): Handle .got section.
1499         * testsuite/Makefile.in: Regenerate.
1500
1501 2013-01-14  Alan Modra  <amodra@gmail.com>
1502
1503         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add various output files.
1504         * testsuite/Makefile.in: Regenerate.
1505
1506 2013-01-11  Pavel Chupin  <pavel.v.chupin@intel.com>
1507
1508         PR bfd/14430
1509         Fix mingw gold build with plugins enabled
1510         * Makefile.am: Replace -ldl with @DLOPEN_LIBS@.
1511         * configure.ac: Export DLOPEN_LIBS and add headers check.
1512         * plugin.cc: Handle non-dlfcn case.
1513         * Makefile.in: Regenerate.
1514         * config.in: Regenerate.
1515         * configure: Regenerate.
1516         * testsuite/Makefile.in: Regenerate.
1517
1518 2013-01-09  Sriraman Tallam  <tmsriram@google.com>
1519
1520         * output.h (sort_attached_input_sections): Change to be public.
1521         * script-sections.cc
1522         (Output_section_definition::set_section_addresses): Sort
1523         attached input sections according to section order before linker
1524         script assigns section addresses.
1525         (Orphan_output_section::set_section_addresses): Sort
1526         attached input sections according to section order before linker
1527         script assigns section addresses.
1528         * Makefile.am (final_layout.sh): Use a simple linker script to
1529         check if section ordering still works.
1530         * Makefile.in: Regenerate.
1531
1532 2013-01-09  Ben Cheng  <bccheng@google.com>
1533
1534         * arm.cc (Target_arm::attributes_accept_div): New function.
1535         (Target_arm::attributes_forbid_div): New function.
1536         (Target_arm::merge_object_attributes): Merge the Tag_DIV_use
1537         attribute using the same new functions as what bfd/elf32_arm.c
1538         does.
1539
1540 2013-01-07  Cary Coutant  <ccoutant@google.com>
1541
1542         PR gold/14993
1543         * output.cc (Output_section::add_input_section): For incremental
1544         updates, don't track input sections that are allocated from patch
1545         space.
1546
1547 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
1548             Ian Lance Taylor  <iant@google.com>
1549
1550         PR gold/14897
1551         * configure.ac (--enable-ld): Removed.
1552         (install_as_default): Set to yes only for --enable-gold=default
1553         or --disable-ld.
1554         * configure: Regenerated.
1555
1556 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
1557
1558         * options.h (General_options): Add -fuse-ld= for GCC linker
1559         option compatibility.
1560
1561 2013-01-04  Cary Coutant  <ccoutant@google.com>
1562
1563         * configure.ac: Fix typo restoring CXXFLAGS.
1564         * configure: Regenerate.
1565
1566 2013-01-04  Cary Coutant  <ccoutant@google.com>
1567
1568         * testsuite/Makefile.am (CXXLINK_S): New macro.
1569         (debug_msg_so.err, debug_msg_ndebug.err): Use CXXLINK_S.
1570         * testsuite/Makefile.in: Regenerate.
1571
1572 2013-01-02  H.J. Lu  <hongjiu.lu@intel.com>
1573
1574         * version.cc (print_version): Update copyright year to 2013.
1575
1576 2012-12-20  Ian Lance Taylor  <iant@google.com>
1577
1578         * layout.cc (Layout::special_ordering_of_input_section): New
1579         function.
1580         (Layout::layout): If input section requires special ordering, must
1581         sort input sections.
1582         (Layout::make_output_section): May sort .text input sections.
1583         (Layout::is_section_name_prefix_grouped): Remove.
1584         * layout.h (class Layout): Declare
1585         special_ordering_of_input_section.  Don't declare
1586         is_section_name_prefix_grouped.
1587         * output.cc (Output_section::add_input_section): Revert last
1588         change.
1589         (Output_section::Input_section_sort::match_file_name): Don't crash
1590         if called on output section data.
1591         (Output_section::Input_section_sort_compare): Sort based on
1592         special ordering.
1593         (Output_section::Input_section_sort_section_order_index_compare):
1594         Revert last patch.
1595         (Output_section::sort_attached_input_sections): Likewise.
1596
1597 2012-12-18  Sriraman Tallam  <tmsriram@google.com>
1598
1599         * layout.cc (Layout::is_section_name_prefix_grouped): New function.
1600         * layout.h (Layout::is_section_name_prefix_grouped): New function.
1601         * output.cc (Output_section::add_input_section): Check if section
1602         name contains special prefix.  Keep input sections to sort such
1603         sections.
1604         (Output_section::Input_section_sort_section_order_index_compare
1605          ::operator()): Group sections according to prefixes.
1606         (Output_section::sort_attached_input_sections): Add condition to
1607         Input_section_entry constructor call.
1608         * testsuite/Makefile.am (text_section_grouping): New test.
1609         * testsuite/Makefile.in: Regenerate.
1610         * testsuite/text_section_grouping.cc: New file.
1611         * testsuite/text_section_grouping.sh: New file.
1612
1613 2012-12-17  Nick Clifton  <nickc@redhat.com>
1614
1615         * Makefile.am: Add copyright notice.
1616         * NEWS: Likewise.
1617         * README: Likewise.
1618         * configure.ac: Likewise.
1619         * ftruncate.c: Likewise.
1620         * Makefile.in: Regenerate.
1621
1622 2012-12-14  Cary Coutant  <ccoutant@google.com>
1623
1624         * testsuite/Makefile.am (exception_separate_shared_12_test): Add
1625         --no-as-needed flag.
1626         (exception_separate_shared_12_test): Likewise.
1627         (incremental_copy_test): Likewise.
1628         * testsuite/Makefile.in: Regenerate.
1629
1630 2012-12-14  Cary Coutant  <ccoutant@google.com>
1631
1632         * dwp.cc (Dwp_output_file::add_cu_set): Check for duplicate CUs.
1633         (Dwp_output_file::Dwp_index::enter_set): Add assert.
1634
1635 2012-12-12  Alan Modra  <amodra@gmail.com>
1636
1637         * powerpc.cc (class Track_tls): New.
1638         (class Relocate, class Scan): Inherit Track_tls.
1639         (Target_powerpc::Scan::local, global): Track tls optimization
1640         and avoid creating plt entry for __tls_get_addr if all uses
1641         are optimized away.
1642         (Target_powerpc::Relocate::relocate): Update to use Track_tls.
1643
1644 2012-12-12  Alan Modra  <amodra@gmail.com>
1645
1646         * options.h (General_options): Add --toc-sort/--no-toc-sort.
1647         Replace no_toc_optimize with toc_optimize.
1648         * output.h (Output_section::input_sections): Provide non-const variant.
1649         * powerpc.cc (Powerpc_relobj::has_small_toc_reloc_,
1650         set_has_small_toc_reloc, has_small_toc_reloc): New variable and
1651         accessors.
1652         (Target_powerpc::Scan::local, global): Call set_has_small_toc_reloc.
1653         (class Sort_toc_sections): New.
1654         (Target_powerpc::do_finalize_sections): Sort toc sections.
1655         (Target_powerpc::Relocate::relocate): Update toc_optimize test.
1656
1657 2012-12-10  Roland McGrath  <mcgrathr@google.com>
1658
1659         * testsuite/binary_unittest.cc (read_all): New function.
1660         (Sized_binary_test): Use it instead of ::read.
1661         * fileread.cc (do_read): Don't assume pread always reads the whole
1662         amount in a single call.
1663
1664 2012-12-10  Alan Modra  <amodra@gmail.com>
1665
1666         * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
1667         Set EM_PPC64 or EM_PPC here.
1668         (Target_selector_powerpc::do_recognize): Delete.
1669
1670 2012-12-10  Alan Modra  <amodra@gmail.com>
1671
1672         * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
1673         stub_table_.
1674         (Target_powerpc::Branch_info::make_stub): Don't omit addend.
1675
1676 2012-12-07  Roland McGrath  <mcgrathr@google.com>
1677
1678         * testsuite/binary_unittest.cc (Sized_binary_test):
1679         Use open_descriptor rather than ::open.
1680
1681 2012-12-07  Alan Modra  <amodra@gmail.com>
1682
1683         * powerpc.cc (Stub_table::do_write): Delete redundant Address
1684         typedef and invalid_address constant.
1685         (Output_data_glink, Stub_table, Target_powerpc): Explicitly
1686         instantiate constants.
1687
1688 2012-12-06  Roland McGrath  <mcgrathr@google.com>
1689
1690         * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
1691         Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
1692         * aclocal.m4: Regenerate.
1693         * configure: Regenerate.
1694         * Makefile.in: Regenerate.
1695         * testsuite/Makefile.in: Regenerate.
1696
1697 2012-12-07  Alan Modra  <amodra@gmail.com>
1698
1699         * options.h (General_options): Add no_toc_optimize.
1700         * powerpc.cc (ok_lo_toc_insn): New function.
1701         (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
1702
1703 2012-12-06  Alan Modra  <amodra@gmail.com>
1704
1705         * options.h (General_options): Add plt_align, plt_static_chain,
1706         plt_thread_safe.  Update stub_group_size help text.
1707         * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
1708         for new plt_thread_safe_ var.
1709         (use_plt_offset): Correct comments.
1710         (Target_powerpc::do_relax): Look for thread creation symbols to
1711         determine default plt_thread_safe value.  Clear plt call stubs
1712         as well as branch stubs each iteration.
1713         (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
1714         insn constants.
1715         (l, hi, ha, write_insn): Move earlier.
1716         (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
1717         (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
1718         plt stubs too.
1719         (Stub_table::update_size): Adjust.
1720         (Stub_table::prev_size, set_prev_size): Delete.
1721         (Stub_table::stub_align): Let --plt-align affect result.
1722         (Stub_table::plt_call_size): Calculate sizes for various stubs.
1723         (Stub_table::branch_stub_size): Use last_plt_size in address calc.
1724         (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
1725         (Stub_table::do_write): Support more stub variants.
1726
1727 2012-12-04  Alan Modra  <amodra@gmail.com>
1728
1729         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
1730         (Target_powerpc::do_define_standard_symbols): New function.
1731
1732 2012-12-03  Alan Modra  <amodra@gmail.com>
1733
1734         * output.h: Formatting, whitespace.
1735
1736 2012-12-03  Alan Modra  <amodra@gmail.com>
1737
1738         * layout.h (Layout::get_executable_sections): Declare.
1739         * layout.cc (Layout::get_executable_sections): New function.
1740         * arm.cc (Target_arm::group_sections): Use it.
1741         (Arm_output_section::group_sections): Delete now redundant test.
1742         * output.cc (Output_reloc::Output_reloc): Add is_relative.
1743         param to handle relative relocs.
1744         * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
1745         (Output_data_reloc::add_absolute): Adjust.
1746         (Output_data_reloc::add_relative): New function.
1747         (Output_data::reset_data_size): New function.
1748         (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
1749         (Output_section::set_addralign): New function.
1750         (Output_section::checkpoint_set_addralign): New function.
1751         (Output_section::clear_section_offsets_need_adjustment): New function.
1752         (Output_section::input_sections): Make public.
1753         * powerpc.cc (class Output_data_brlt_powerpc): New.
1754         (class Stub_table, class Stub_control): New.
1755         (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
1756         stub_table_, set_stub_table, stub_table): New vectors and accessor
1757         functions.
1758         (Target_powerpc::do_may_relax, do_relax, push_branch,
1759         new_stub_table, stub_tables, brlt_section, group_sections,
1760         add_branch_lookup_table, find_branch_lookup_table,
1761         write_branch_lookup_table, make_brlt_section): New functions.
1762         (Target_powerpc::struct Sort_sections, class Branch_info): New.
1763         (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
1764         branch_info_): New vars.
1765         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
1766         make call stubs here.
1767         (Output_data_glink): Remove all call stub handling from this class.
1768         (Target_powerpc::Scan::local, global): Save interesting branch
1769         relocs and relocs for ifunc.  Adjust calls to plt entry functions.
1770         (Target_powerpc::do_finalize_sections): Only make reg save/restore
1771         functions on final link.
1772         (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
1773         Handle long branch destinations too.
1774         (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
1775         do_plt_address_for_local): Adjust lookup of plt call stubs.
1776
1777 2012-11-30  Alan Modra  <amodra@gmail.com>
1778
1779         * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
1780         relocs against protected symbols when building 32-bit shared libs.
1781
1782 2012-11-30  Alan Modra  <amodra@gmail.com>
1783
1784         * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
1785         param.  Call got_section() to make .got.  Update all callers
1786         and their callers and so on.
1787
1788 2012-11-30  Alan Modra  <amodra@gmail.com>
1789
1790         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
1791         _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
1792         (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
1793         value if it already exists.
1794
1795 2012-11-19  H.J. Lu  <hongjiu.lu@intel.com>
1796
1797         PR gold/14858
1798         * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
1799
1800 2012-11-14  Roland McGrath  <mcgrathr@google.com>
1801
1802         * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
1803         than bfc instruction for data sandboxing.
1804
1805 2012-11-08  Alan Modra  <amodra@gmail.com>
1806
1807         * po/POTFILES.in: Regenerate.
1808
1809 2012-11-05  Alan Modra  <amodra@gmail.com>
1810
1811         * configure.ac: Apply 2012-09-10 change to config.in here.
1812         * configure: Regenerate.
1813
1814 2012-11-05  Alan Modra  <amodra@gmail.com>
1815
1816         * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
1817         (struct Opd_ent): Use "Address" rather than "Offset".
1818         (Output_data_got_powerpc::got_base_offset): Return Valtype.
1819         (Target_powerpc::got_section): Make public.
1820         (Target_powerpc::scan_relocs): Move code setting symbols..
1821         (Powerpc_relobj::do_scan_relocs): ..to here, new function.
1822         Create _SDA_BASE_ only when referenced.
1823
1824 2012-11-02  Roland McGrath  <mcgrathr@google.com>
1825
1826         * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
1827         from last change.
1828
1829 2012-11-01  Roland McGrath  <mcgrathr@google.com>
1830
1831         * target.h (Sized_target::relocate_relocs): Use Elf_Off
1832         for offset_in_output_section parameter.
1833         (Sized_target::relocate_special_relocatable): Likewise.
1834         * arm.cc (Target_arm::relocate_relocs): Likewise.
1835         (Target_arm::relocate_special_relocatable): Likewise.
1836         * i386.cc (Target_i386::relocate_relocs): Likewise.
1837         * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
1838         * sparc.cc (Target_sparc::relocate_relocs): Likewise.
1839         * target-reloc.h (relocate_relocs): Likewise.
1840         * testsuite/testfile.cc (Target_test): Likewise.
1841         * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
1842         * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
1843
1844         * system.h: Move inclusion of <clocale> to after <libintl.h> in
1845         [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
1846
1847         * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
1848         parameter, which is unused in the [!F_SETFD] case.
1849
1850         * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
1851         SYMNDX to off_t before comparing it to this->data_size().
1852         * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
1853         * incremental.cc (Output_section_incremental_inputs::do_write):
1854         Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
1855
1856         * nacl.cc: Include "libiberty.h" for vasprintf declaration.
1857
1858 2012-10-30  Steve McIntyre  <steve.mcintyre@linaro.org>
1859
1860         * gold.cc (Target_arm::do_adjust_elf_header): Add the
1861         hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
1862         in EABI_VER5.
1863
1864 2012-10-29  Cary Coutant  <ccoutant@google.com>
1865
1866         * dwp.cc (usage): Add file and exit status parameters;
1867         add --help and --version options.
1868         (print_version): New function.
1869         (main): Add --help and --version options.
1870
1871 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1872
1873         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
1874         final_layout_sequence.txt.
1875         * testsuite/Makefile.in: Regenerated.
1876
1877 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1878
1879         * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
1880         COMPILE generated by automake.
1881         (LINK1): Likewise.
1882         (CXXCOMPILE1): Likewise.
1883         (CXXLINK1): Likewise.
1884         (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
1885         (LINK): Likewise.
1886         (CXXCOMPILE): Likewise.
1887         (CXXLINK): Likewise.
1888         * testsuite/Makefile.in: Regenerated.
1889
1890 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1891
1892         * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
1893         on bad fwrite return.
1894
1895 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1896
1897         * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
1898         on val.
1899
1900 2012-10-23  Cary Coutant  <ccoutant@google.com>
1901
1902         * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
1903         * testsuite/Makefile.in: Regenerate.
1904         * testsuite/dwp_test.h: New source file.
1905         * testsuite/dwp_test_1.cc: New source file.
1906         * testsuite/dwp_test_1.s: New source file.
1907         * testsuite/dwp_test_1.sh: New source file.
1908         * testsuite/dwp_test_1b.cc: New source file.
1909         * testsuite/dwp_test_1b.s: New source file.
1910         * testsuite/dwp_test_2.cc: New source file.
1911         * testsuite/dwp_test_2.s: New source file.
1912         * testsuite/dwp_test_2.sh: New source file.
1913         * testsuite/dwp_test_main.cc: New source file.
1914         * testsuite/dwp_test_main.s: New source file.
1915
1916 2012-10-23  Cary Coutant  <ccoutant@google.com>
1917
1918         * dwp.h: New header file.
1919         * dwp.cc: New source file.
1920         * gold.h: Move shared declarations to system.h.
1921         * system.h: New header file.
1922         * Makefile.am: Add dwp.
1923         * Makefile.in: Regenerate.
1924
1925 2012-10-23  Cary Coutant  <ccoutant@google.com>
1926
1927         * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
1928         Dwarf_info_reader::read_from_pointer.
1929         (Dwarf_pubnames_table::read_header): Likewise.
1930         (Dwarf_pubnames_table::next_name): Likewise.
1931         (Dwarf_die::read_attributes): Likewise.
1932         (Dwarf_die::skip_attributes): Likewise.
1933         (Dwarf_info_reader::read_from_pointer): New function template.
1934         * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
1935         (Dwarf_pubnames_table): Likewise.
1936         (Dwarf_info_reader::read_from_pointer): New function template.
1937         * gdb-index.cc (Gdb_index_info_reader): Adjust call to
1938         Dwarf_pubnames_table ctor.
1939
1940 2012-10-23  Cary Coutant  <ccoutant@google.com>
1941
1942         * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
1943         abbrev_shndx.
1944         * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
1945         abbrev_shndx_.
1946         (Dwarf_info_reader::set_abbrev_shndx): New method.
1947         (Dwarf_info_reader::abbrev_shndx_): New data member.
1948
1949 2012-10-23  Cary Coutant  <ccoutant@google.com>
1950
1951         * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
1952         from object, not parameters.
1953         (Dwarf_info_reader::parse): Likewise.
1954         * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
1955         (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
1956         (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
1957         methods.
1958
1959 2012-10-23  Cary Coutant  <ccoutant@google.com>
1960
1961         * fileread.cc (Input_file::Input_file): New constructor.
1962         * fileread.h (class Input_file): Add new constructor.
1963
1964 2012-10-18  Alan Modra  <amodra@gmail.com>
1965
1966         PR gold/14727
1967         * object.cc (Relobj::is_section_name_included): Also match
1968         .sdata personality section.
1969
1970 2012-10-18  Alan Modra  <amodra@gmail.com>
1971
1972         * target-reloc.h (class Default_comdat_behavior): New, package up..
1973         (get_comdat_behaviour): ..this.
1974         (relocate_section): Add Relocate_comdat_behavior template arg,
1975         adjust code to suit.
1976         * arm.cc (Target_arm::relocate_section): Adjust to suit.
1977         (Target_arm::scan_reloc_section): Likewise.
1978         * i386.cc (Target_i386::relocate_section): Likewise.
1979         * sparc.cc (Target_sparc::relocate_section): Likewise.
1980         * tilegx.cc (Target_tilegx::relocate_section): Likewise.
1981         * x86_64.cc (Target_x86_64::relocate_section): Likewise.
1982         * powerpc.cc (class Relocate_comdat_behavior): New.
1983         (Target_powerpc::relocate_section): Don't zap opd relocs.  Supply
1984         gold::relocate_section with new template arg.
1985
1986 2012-10-18  Alan Modra  <amodra@gmail.com>
1987
1988         * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
1989         dynamic relocs for GOT_TPREL got entries, without symbol if
1990         resolving locally.
1991         (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
1992         (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
1993         (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
1994
1995 2012-10-17  Alan Modra  <amodra@gmail.com>
1996
1997         PR gold/14726
1998         * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
1999
2000 2012-10-16  Sriraman Tallam  <tmsriram@google.com>
2001
2002         * layout.cc (Layout::include_section): Keep sections marked
2003         SHF_EXCLUDE when doing relocatable links.
2004
2005 2012-10-16  Alan Modra  <amodra@gmail.com>
2006
2007         * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
2008         (Target_powerpc::do_finalize_sections): Call it.
2009         (Output_data_save_res): New class and supporting functions.
2010         (Target_powerpc::symval_for_branch): Only look up .opd entry for
2011         normal symbols defined in object files.
2012
2013 2012-10-12  Alan Modra  <amodra@gmail.com>
2014
2015         * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
2016         (struct Opd_ent): Make "discard" a bit field.  Add "gc_mark".
2017         (Target_powerpc::do_gc_mark_symbol): Delay marking function code
2018         section if scan_opd_relocs not yet called.
2019         (Target_powerpc::gc_process_relocs): Call process_gc_mark.
2020
2021 2012-10-12  Alan Modra  <amodra@gmail.com>
2022
2023         * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
2024         add_local_ifunc_entry): Revert last change.
2025         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
2026
2027 2012-10-05  Alan Modra  <amodra@gmail.com>
2028
2029         * powerpc.cc (Target_powerpc::do_plt_address_for_local,
2030         do_plt_address_for_global): New functions.
2031         (Output_data_got_powerpc::do_write): Don't segfault when linking
2032         statically.
2033         (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
2034         add_local_ifunc_entry): Return true on adding entry..
2035         (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
2036         glink->add_entry call.  Remove unused symtab param.  Adjust calls.
2037         (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
2038         (Target_powerpc::make_iplt_section): Remove symtab param.  Don't
2039         set up symbols here.
2040         (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
2041         syms here.  Do so even when no .iplt.  Don't segfault when linking
2042         statically.
2043         (Output_data_glink::add_entry, find_entry): Rearrange params.  Add
2044         new variants without reloc param.
2045         (Glink_sym_ent::Glink_sym_ent): Likewise.
2046         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
2047         reloc when refs will resolve to plt call stub.
2048         (Target_powerpc::Scan::local): Correct ifunc handling.  Allow
2049         R_PPC_PLTREL24 to resolve locally.
2050         (Target_powerpc::Scan::global): Correct ifunc handling.
2051         (Target_powerpc::Relocate::relocate): Correct local sym glink
2052         lookup.  Don't destroy "value" when we have a plt call stub,
2053         and when checking plt call validity.
2054         (Target_powerpc::do_dynsym_value): Simplify.
2055
2056 2012-10-05  Alan Modra  <amodra@gmail.com>
2057
2058         * i386.cc (Output_data_plt_i386::address_for_global,
2059         address_for_local): Add plt offset to returned value.  Adjust uses.
2060         * sparc.cc (Output_data_plt_sparc::address_for_global,
2061         address_for_local): Likewise.
2062         * tilegx.cc (Output_data_plt_tilegx::address_for_global,
2063         address_for_local): Likewise.
2064         * x86_64.cc (Output_data_plt_x86_64::address_for_global,
2065         address_for_local): Likewise.
2066         * target.h (Target::plt_address_for_global, plt_address_for_local):
2067         Update comment.
2068         * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
2069         (Output_data_got::Got_entry::write): Nor here.
2070         * output.h: Comment fix.
2071
2072 2012-10-02  Jiong Wang  <jiwang@tilera.com>
2073
2074         * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
2075         global_offset_table_ value for larget got.
2076         (Target_tilegx::Relocate::relocate): Handle adjusted got value.
2077
2078 2012-09-29  Alan Modra  <amodra@gmail.com>
2079
2080         * powerpc.cc (Target_powerpc::iplt_): New output section.
2081         (Target_powerpc::iplt_section, make_iplt_section,
2082         reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
2083         (Target_powerpc::make_plt_entry): Handle ifunc syms.
2084         Target_powerpc::plt_entry_count): Count iplt entries too.
2085         (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
2086         reloc section in constructor.  New params.
2087         (Target_powerpc::make_plt_section): Create reloc section here instead.
2088         (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
2089         functions.
2090         (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
2091         (Output_data_glink::add_entry, find_entry): New functions to
2092         deal with local syms.
2093         (Glink_sym_ent): Add support for local syms.
2094         (Output_data_glink::do_write): Handle ifunc plt entries.
2095         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
2096         (Target_powerpc::Scan::local, global): Handle ifunc syms.
2097         (Target_powerpc::Relocate::relocate): Likewise.
2098         (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
2099
2100 2012-09-25  Alan Modra  <amodra@gmail.com>
2101
2102         * object.h (Sized_relobj_file::adjust_local_symbol,
2103         do_adjust_local_symbol): New functions.
2104         * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
2105         * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
2106         (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
2107         and irregular opd entry spacing.
2108         (Powerpc_relobj::do_read_relocs): Add opd size checks.
2109         (Global_symbol_visitor_opd): New functor.
2110         (Target_powerpc::do_finalize_sections): Omit global symbols defined
2111         on deleted opd entries.
2112
2113 2012-09-15  Jiong Wang  <jiwang@tilera.com>
2114
2115         * tilegx.cc: New file.
2116         * Makefile.am (TARGETSOURCES): Add tilegx.cc
2117         (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
2118         * configure.tgt: Add entries for tilegx*.
2119         * configure.ac: Likewise.
2120         * Makefile.in: Rebuild.
2121         * configure: Likewise.
2122         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
2123         tilegx.
2124
2125 2012-09-13  Alan Modra  <amodra@gmail.com>
2126
2127         * target-reloc.h (scan_relocs): Call scan.local for relocs
2128         against symbols in discarded sections.  Pass is_discarded
2129         param.
2130         * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
2131         Add is_discarded param.
2132         * powerpc (Target_powerpc::Scan::local): Likewise.  Use
2133         is_discarded to flag opd entry as discarded.  Don't emit dyn
2134         relocs on such entries.
2135         (Target_powerpc::Scan::global): Similarly detect and handle
2136         such opd entries.
2137         (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
2138         opd_ent_.  Update all uses.
2139         (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
2140         (Target_powerpc::relocate_section): Zero out discarded opd
2141         entry relocs.
2142
2143 2012-09-12  Ian Lance Taylor  <iant@google.com>
2144
2145         PR gold/14570
2146         * output.cc: Rename Output_data_got template parameter from size
2147         to got_size for all functions.  Compile all variants of
2148         Output_data_got.
2149         (Output_data_got::Got_entry::write): Correct use of size for
2150         symbol value.  Use local_is_tls rather than casting to
2151         Sized_relobj_file.
2152         * object.h (class Object): Add local_is_tls and do_local_is_tls.
2153         (class Sized_relobj_file): Add do_local_is_tls.
2154         * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
2155
2156 2012-09-11  Alan Modra  <amodra@gmail.com>
2157
2158         PR gold/14566
2159         * layout.cc (Layout::set_segment_offsets): When using
2160         common-page-size alignment, ensure we are on a new max-page-size
2161         page.
2162         * output.cc (Output_segment::set_section_addresses): Use
2163         abi_pagesize, not common_pagesize for relro boundary.
2164         (Output_segment::set_offset): Likewise.
2165
2166 2012-09-11  Alan Modra  <amodra@gmail.com>
2167
2168         * output.h (Output_data_got::add_global_tls, add_local_tls,
2169         add_local_tls_pair): New functions.
2170         (Output_data_got::add_local_pair_with_rel): Remove second
2171         reloc param.  Expand comment.
2172         (Output_data_got::Got_entry): Rename use_plt_offset_ to
2173         use_plt_or_tls_offset_, similarly for constructor param.
2174         (Output_data_got::Got_entry::write): Add got_index param.
2175         * output.cc (Output_data_got::add_global_tls, add_local_tls,
2176         add_local_tls_pair): New functions.
2177         (Output_data_got::Got_entry::write): Handle tls symbols
2178         with use_plt_or_tls_offset_ set specially.
2179         (Output_data_got::add_local_pair_with_rel): Only one reloc.
2180         (Output_data_got::do_write): Replace iterator with index, pass
2181         index to entry write function.
2182         * target.h (Target::tls_offset_for_local, tls_offset_for_global,
2183         do_tls_offset_for_local, do_tls_offset_for_global): New functions.
2184         * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
2185         call.
2186         * i386.cc (Target_i386::Scan::local): Likewise.
2187         * sparc.cc (Target_sparc::Scan::local): Likewise.
2188         * x86_64.cc (Target_x86_64::Scan::local): Likewise.
2189         * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
2190         do_tls_offset_for_global): New functions.
2191         (Target_powerpc::Scan::local): Correct TLS relocations and got
2192         entry values.
2193         (Target_powerpc::Scan::global): Don't emit unnecessary
2194         dynamic relocations on TLS GOT entries.
2195
2196 2012-09-10  Matthias Klose  <doko@ubuntu.com>
2197
2198         * config.in: Disable sanity check for kfreebsd.
2199
2200 2012-09-10  Sterling Augustine  <saugustine@google.com>
2201
2202         * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
2203         (Gdb_index::pubtypes_read): New parameter.
2204         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
2205         to calls.
2206         * gdb-index.h (Gdb_index): New fields pubnames_object_ and
2207         pubtypes_object_.
2208
2209 2012-09-09  Alan Modra  <amodra@gmail.com>
2210
2211         * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
2212         (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
2213         * gc.h (gc_process_relocs): Call target gc_add_reference.
2214         * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
2215         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
2216         (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
2217         unnecessary cast.
2218         * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
2219         to cater for when we don't need code offset.  Update use.
2220         (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
2221         (Powerpc_relobj::access_from_map, add_reference, opd_valid,
2222         set_opd_valid): New functions.
2223         (Target_powerpc::do_gc_add_reference): New function.
2224         (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
2225         stashed refs.
2226         (Target_powerpc::do_gc_mark_symbol): New function.
2227
2228 2012-09-06  Cary Coutant  <ccoutant@google.com>
2229
2230         * dwarf_reader.cc (Dwarf_die::read_attributes): Add
2231         DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
2232         (Dwarf_die::skip_attributes): Likewise.
2233         * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
2234         * testsuite/gdb_index_test.cc (inline_func_1): New function.
2235         (main): Call it.
2236         * testsuite/gdb_index_test_comm.sh: Check index for inline function.
2237
2238 2012-09-05  H.J. Lu  <hongjiu.lu@intel.com>
2239
2240         * testsuite/script_test_3.t: Add .got.plt output section
2241         statement.
2242         * testsuite/script_test_4.t: Likewise.
2243
2244 2012-09-05  Alan Modra  <amodra@gmail.com>
2245
2246         * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
2247         update all uses and lose "enum" when using type.
2248
2249 2012-09-05  Alan Modra  <amodra@gmail.com>
2250
2251         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
2252         * configure: Regenerate.
2253         * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
2254         (plugin_final_layout.stdout): Likewise.
2255         (memory_test): Set page sizes to 0x1000.
2256         * testsuite/Makefile.in: Regenerate.
2257         * testsuite/discard_locals_test.sh: Add FIXME comment.
2258         * testsuite/justsyms_exec.c: Disable function test for powerpc64.
2259         * testsuite/pr14265.t: Add .got output section statement.
2260         * testsuite/script_test_2.t: Likewise.
2261         * testsuite/script_test_3.t: Likewise.
2262         * testsuite/script_test_4.t: Likewise.
2263         * testsuite/script_test_5.t: Likewise.
2264         * testsuite/script_test_6.t: Likewise.
2265         * testsuite/script_test_7.t: Likewise.
2266         * testsuite/script_test_9.t: Likewise.
2267
2268 2012-09-05  Alan Modra  <amodra@gmail.com>
2269
2270         * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
2271         (Powerpc_relocate_functions::Status): New typedef.
2272         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
2273         (Target_powerpc::Scan::local): Handle REL64.
2274         (Target_powerpc::Scan::global): Likewise, and dynamic relocs
2275         for REL32 and REL64.
2276         (Target_powerpc::symval_for_branch): New function, extracted from..
2277         (Target_powerpc::Relocate::relocate): ..here.  Correct plt call
2278         checks.  Report overflow errors.
2279
2280 2012-09-05  Alan Modra  <amodra@gmail.com>
2281
2282         * object.h (Sized_relobj_file::emit_relocs): Delete.
2283         (Sized_relobj_file::emit_relocs_reltype): Delete.
2284         * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
2285         relocate_relocs for --emit-relocs.
2286         (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
2287         * output.h: Update comment.
2288         (Output_segment::first_section): New function.
2289         (Output_segment::first_section_load_address): Use first_section.
2290         * output.cc (Output_segment::first_section): New function extracted..
2291         (Output_segment::first_section_load_address): ..from here.  Delete.
2292         * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
2293         * target.h (Sized_target::relocate_for_relocatable): Likewise.
2294         * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
2295         adjust call to target.h function.
2296         * i386.cc (Target_i386): Likewise.
2297         * sparc.cc (Target_sparc): Likewise.
2298         * x86_64.cc (Target_x86_64): Likewise.
2299         * powerpc.cc (Target_powerpc): Likewise.
2300         (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS.  Ensure
2301         first tls section has section symbol for optimised local dynamic
2302         output relocs.
2303         (Target_powerpc::Relocate::relocate): Correct local dynamic value.
2304         (Target_powerpc::relocate_relocs): Adjust relocs emitted for
2305         optimised tls code.
2306         * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
2307         Rename to relocate_relocs.  Update error message.
2308
2309 2012-09-04  Andreas Schwab  <schwab@linux-m68k.org>
2310
2311         * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
2312         --just-symbols.
2313
2314 2012-08-31  Alan Modra  <amodra@gmail.com>
2315
2316         * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
2317         (Powerpc_relobj::toc_base_offset): New stub function.
2318         (Target_powerpc): Add tp_offset, dtp_offset.  Rename
2319         got_mod_index_offset to tlsld_got_offset.  Update all refs.
2320         (Target_powerpc::Relocate::enum skip_tls): New.
2321         (Target_powerpc::call_tls_get_addr_): New var.
2322         (Target_powerpc::is_branch_reloc): Move to file scope.
2323         (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
2324         (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
2325         New functions.
2326         (Target_powerpc::enum Got_type): Delete old values, add new ones.
2327         (powerpc_info): Correct common_pagesize for ppc64.
2328         (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
2329         (Powerpc_relocate_functions): Add overflow check enums and functions.
2330         Add non-shift version of rela, rela_ua.  Delete all rel public
2331         functions.  Delete addr16_lo.  Add addr64, addr64_u, addr32,
2332         addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
2333         addr16_ha3, addr14 functions.
2334         (Output_data_got_powerpc::add_constant_pair): New function.
2335         (Output_data_got_powerpc::got_base_offset): Likewise.
2336         (Output_data_got_powerpc::do_write): Correct 64-bit got header.
2337         (instruction constants): Sort, add some more.
2338         (Output_data_glink::do_write): Add and use Address typedef.  Use
2339         object->toc_base_offset() stub for 64-bit.
2340         (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
2341         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
2342         (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
2343         for R_PPC64_TOC.  Handle more relocs.  Generate got entries for TLS.
2344         Always treat .opd relocs as against locally defined symbol.
2345         Correct condition for RELATIVE relocs.
2346         (Target_powerpc::do_finalize_sections): Test for NULL sections.
2347         (Target_powerpc::Relocate::relocate): Use plt call stub as value
2348         for 32-bit syms with a plt entry.  Correct ppc64 toc base
2349         calculations.  Handle TLS relocs, and more.  Add overflow
2350         checking and adjust for Powerpc_relocate_functions changes.
2351         (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
2352         Reinstate --emit-relocs code with FIXME.
2353
2354 2012-08-30  Alan Modra  <amodra@gmail.com>
2355
2356         * layout.cc (Layout::set_segment_offsets): Set p_align to
2357         abi_pagesize, not common_pagesize.
2358         (Layout::relaxation_loop_body): Similarly use abi_pagesize
2359         to determine whether file header can go in segment.
2360
2361 2012-08-30  Alan Modra  <amodra@gmail.com>
2362
2363         * output.h (Output_reloc::Output_reloc <output section>): Add
2364         is_relative param.  Adjust calls.
2365         (Output_reloc::add_output_section_relative): New functions.
2366         * output.cc (Output_reloc::Output_reloc <output section>): Handle
2367         is_relative.
2368         (Output_reloc::symbol_value): Handle SECTION_CODE.
2369
2370 2012-08-24  Sriraman Tallam  <tmsriram@google.com>
2371
2372         * gold.cc (queue_middle_tasks): Call layout again when unique
2373         segments for sections is desired.
2374         * layout.cc (Layout::Layout): Initialize new members.
2375         (Layout::get_output_section_flags): New function.
2376         (Layout::choose_output_section): Call get_output_section_flags.
2377         (Layout::layout): Make output section for mapping to a unique segment.
2378         (Layout::insert_section_segment_map): New function.
2379         (Layout::attach_allocated_section_to_segment): Make unique segment for
2380         output sections marked so.
2381         (Layout::segment_precedes): Check for unique segments when sorting.
2382         * layout.h (Layout::Unique_segment_info): New struct.
2383         (Layout::Section_segment_map): New typedef.
2384         (Layout::insert_section_segment_map): New function.
2385         (Layout::get_output_section_flags): New function.
2386         (Layout::is_unique_segment_for_sections_specified): New function.
2387         (Layout::set_unique_segment_for_sections_specified): New function.
2388         (Layout::unique_segment_for_sections_specified_): New member.
2389         (Layout::section_segment_map_): New member.
2390         * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
2391         Rename is_gc_pass_one to is_pass_one.
2392         Rename is_gc_pass_two to is_pass_two.
2393         Rename is_gc_or_icf to is_two_pass.
2394         Check for which pass based on whether symbols data is present.
2395         Make it two pass when unique segments for sections is desired.
2396         * output.cc (Output_section::Output_section): Initialize new
2397         members.
2398         * output.h (Output_section::is_unique_segment): New function.
2399         (Output_section::set_is_unique_segment): New function.
2400         (Output_section::is_unique_segment_): New member.
2401         (Output_section::extra_segment_flags): New function.
2402         (Output_section::set_extra_segment_flags): New function.
2403         (Output_section::extra_segment_flags_): New member.
2404         (Output_section::segment_alignment): New function.
2405         (Output_section::set_segment_alignment): New function.
2406         (Output_section::segment_alignment_): New member.
2407         (Output_segment::Output_segment): Initialize is_unique_segment_.
2408         (Output_segment::is_unique_segment): New function.
2409         (Output_segment::set_is_unique_segment): New function.
2410         (Output_segment::is_unique_segment_): New member.
2411         * plugin.cc (allow_unique_segment_for_sections): New function.
2412         (unique_segment_for_sections): New function.
2413         (Plugin::load): Add new functions to transfer vector.
2414         * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
2415         * Makefile.in: Regenerate.
2416         * testsuite/plugin_final_layout.sh: Check if unique segment
2417         functionality works.
2418         * testsuite/plugin_section_order.c (onload): Check if new interfaces
2419         are available.
2420         (allow_unique_segment_for_sections): New global.
2421         (unique_segment_for_sections): New global.
2422         (claim_file_hook): Call allow_unique_segment_for_sections.
2423         (all_symbols_read_hook): Call unique_segment_for_sections.
2424
2425 2012-08-22  Cary Coutant  <ccoutant@google.com>
2426
2427         * layout.cc (Layout::include_section): Don't assert on GROUP
2428         sections with --emit-relocs.
2429
2430 2012-08-21  Cary Coutant  <ccoutant@google.com>
2431
2432         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
2433         if --export-dynamic-symbol names an undef symbol.
2434
2435 2012-08-18  Alan Modra  <amodra@gmail.com>
2436
2437         * powerpc.cc: Formatting and white space.
2438         (Powerpc_relobj): Rename got2_section_ to special_.
2439         Add opd_ent_shndx_ and opd_ent_off_ vectors.
2440         (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
2441         scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
2442         (Target_powerpc): Add Address typedef and invalid_address.  Use
2443         throughout.
2444         (Target_powerpc::is_branch_reloc): New function.
2445         (Powerpc_relocate_functions): Add Address typedef, use throughout.
2446         (Powerpc_relocate_functions:rela, rela_ua): Correct type used
2447         for dst_mask, value and addend.
2448         (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
2449         (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
2450         (Output_data_glink::do_write): Correct toc base.  Don't try to use
2451         uint16_t for 24-bit offset.  Use get_output_section_offset and
2452         check return.
2453         (Target_powerpc::Scan::local): Handle more relocs.
2454         (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
2455         (Target_powerpc::Relocate::relocate): Correct toc base calculation.
2456         Plug in toc restoring insn after plt calls.  Translate branches
2457         to function descriptor symbols to corresponding entry point.
2458         (Target_powerpc::relocate_for_relocatable): Check return from
2459         get_output_section_offset.
2460         * symtab.h: Comment typo.
2461
2462 2012-08-14  Ian Lance Taylor  <iant@google.com>
2463
2464         * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
2465         unsupported_relocal_local to call unsupported_reloc_global.
2466
2467 2012-08-14  Nick Clifton  <nickc@redhat.com>
2468
2469         PR ld/14265
2470         * script-sections.cc (Sections_element::output_section_name): Add
2471         keep return parameter.
2472         (Output_section_element::match_name): Add keep return parameter.
2473         Return the value of the keep_ member.
2474         * script-sections.h (class Output_section): Update
2475         output_section_name prototype.
2476         * layout.cc (Layout::keep_input_section): New public member
2477         function.
2478         (Layout::choose_output_section): Pass keep parameter to
2479         output_section_name.
2480         * layout.h (class Layout): Add keep_input_section.
2481         * object.cc (Sized_relobj_file::do_layout): Check for kept input
2482         sections.
2483         * testsuite/Makefile.am: Add a test.
2484         * testsuite/Makefile.in: Regenerate.
2485         * testsuite/pr14265.c: Source file for the test.
2486         * testsuite/pr14265.t: Linker script for the test.
2487         * testsuite/pr14265.sh: Shell script for the test.
2488
2489 2012-08-14  Alan Modra  <amodra@gmail.com>
2490
2491         * target.h (Target::output_section_name): New function.
2492         (Target::do_output_section_name): New function.
2493         * layout.cc (Layout::choose_output_section): Call the above.
2494         * powerpc.cc (Target_powerpc::do_output_section_name): New function.
2495
2496 2012-08-14  Alan Modra  <amodra@gmail.com>
2497
2498         * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
2499         (Output_data_got_powerpc::do_write): Don't rely on base class lookup
2500         for replace_constant call.
2501         (Output_data_plt_powerpc::do_print_to_mapfile): New function.
2502         (Output_data_glink::do_print_to_mapfile): New function.
2503         (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
2504         (Target_powerpc::Relocate::relocate): Likewise.
2505
2506 2012-08-14  Alan Modra  <amodra@gmail.com>
2507
2508         * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
2509         (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
2510         (Output_data_glink::add_entry,find_entry): Remove shndx param.
2511         (class Glink_sym_ent): Rename from struct Glink_sym_ent.  Remove
2512         all references to shndx_.  Handle special case for R_PPC_PLTREL24
2513         here.
2514         (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
2515         (Output_data_glink::do_write): Retrieve got2_shdnx from object.
2516         (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
2517         here.
2518         (Target_powerpc::Scan::global): Nor on make_plt_entry call.
2519         (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
2520
2521 2012-08-12  Alan Modra  <amodra@gmail.com>
2522
2523         * powerpc.cc: Whitespace fixes.  Wrap overly long lines.
2524         (glink insn constants): Use uint32_t.
2525         (Output_data_glink::add_entry): Use insert, not [] operator.
2526
2527 2012-08-11  Alan Modra  <amodra@gmail.com>
2528
2529         * object.h (Sized_relobj_file::find_shdr): New function.
2530         (Sized_relobj_file::find_special_sections): New function.
2531         * object.cc (Sized_relobj_file::find_shdr): New function.
2532         (Sized_relobj_file::find_eh_frame): Use find_shdr.
2533         (Sized_relobj_file::find_special_sections): New function, split out..
2534         (Sized_relobj_file::do_read_symbols): ..from here.
2535         * output.h (Output_data_got::replace_constant): New function.
2536         (Output_data_got::num_entries): New function.
2537         (Output_data_got::last_got_offset,set_got_size): Use num_entries.
2538         (Output_data_got::got_offset): Protected rather than private.
2539         (Output_data_got::replace_got_entry): New function.
2540         * output.cc (Output_data_got::replace_got_entry): New function.
2541         * powerpc.cc (class Powerpc_relobj): New.
2542         (class Powerpc_relocate_functions): Delete all psymval variants or
2543         convert to value,addend type.  Delete pcrela, pcrela_unaligned.
2544         Implement _ha functions using corresponding _hi function.
2545         (Powerpc_relobj::find_special_sections): New function.
2546         (Target_powerpc::do_make_elf_object): New function.
2547         (class Output_data_got_powerpc): New.
2548         (class Output_data_glink): New.
2549         (class Powerpc_scan_relocatable_reloc): New.
2550         Many more changes througout file.
2551
2552 2012-08-09  Nick Clifton  <nickc@redhat.com>
2553
2554         * po/vi.po: Updated Vietnamese translation.
2555
2556 2012-08-07  Ian Lance Taylor  <iant@google.com>
2557
2558         * layout.cc (Layout::add_target_dynamic_tags): If
2559         dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
2560         plt_rel.
2561
2562 2012-07-30  Nick Clifton  <nickc@redhat.com>
2563
2564         * po/gold.pot: Updated template.
2565         * po/es.po: Updated Spanish translation.
2566
2567 2012-07-18  Cary Coutant  <ccoutant@google.com>
2568
2569         PR gold/14344
2570         * configure.ac: Add check for -gpubnames support.
2571         * configure: Regenerate.
2572         * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
2573         support; force -gno-pubnames.
2574         (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
2575         support.
2576         (gdb_index_test_4): New test.
2577         * testsuite/Makefile.in: Regenerate.
2578         * testsuite/gdb_index_test_1.sh: Refactor code into common file.
2579         * testsuite/gdb_index_test_2.sh: Likewise.
2580         * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
2581         * testsuite/gdb_index_test_4.sh: New script.
2582         * testsuite/gdb_index_test_comm.sh: New script with common code;
2583         don't look for space after colon.
2584
2585 2012-07-16  Sriraman Tallam  <tmsriram@google.com>
2586
2587         * gold.cc (queue_middle_tasks): Update function order only after
2588         deferred objects due to plugins are processed.
2589
2590 2012-07-11  Ian Lance Taylor  <iant@google.com>
2591
2592         * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
2593         (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
2594         (Target_arm::scan_reloc_for_stub): Likewise.
2595         * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
2596         * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
2597         * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
2598         * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
2599         * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
2600
2601 2012-07-10  Dodji Seketeli  <dodji@redhat.com>
2602             Ian Lance Taylor  <iant@google.com>
2603
2604         PR gold/14309
2605         * configure.ac: Test whether std::tr1::hash<off_t> works.
2606         * gold.h: Add a specialization for std::tr1::hash<off_t> if
2607         needed.
2608         * output.h (class Output_fill): Add virtual destructor.
2609         * configure, config.in: Rebuild.
2610
2611 2012-06-22  Roland McGrath  <mcgrathr@google.com>
2612
2613         * layout.cc (finalize): Define __ehdr_start symbol if applicable.
2614
2615 2012-06-12  Rafael Ávila de Espíndola <respindola@mozilla.com>
2616
2617         * plugin.cc (Plugin::load): Handle position independent executables.
2618
2619 2012-06-06  Cary Coutant  <ccoutant@google.com>
2620
2621         * layout.cc (gdb_sections): Remove ".debug_" prefixes,
2622         add .debug_macro.
2623         (lines_only_debug_sections): Likewise.
2624         (gdb_fast_lookup_sections): New static array.
2625         (is_gdb_debug_section): Rename formal parameter.
2626         (is_lines_only_debug_section): Likewise.
2627         (is_gdb_fast_lookup_section): New function.
2628         (Layout::include_section): Check for ".zdebug_" prefix; pass
2629         section name suffix to is_gdb_debug_section, et al.; check for
2630         fast-lookup sections when building .gdb_index.
2631         * options.h (--strip-debug-gdb): Update GDB version number.
2632
2633 2012-06-06  Cary Coutant  <ccoutant@google.com>
2634
2635         * configure.ac: Add check for fallocate.
2636         * configure: Regenerate.
2637         * config.in: Regenerate.
2638
2639         * options.h (class General_options): Add --mmap-output-file and
2640         --posix-fallocate options.
2641         * output.cc: (posix_fallocate): Remove; replace with...
2642         (gold_fallocate): New function.
2643         (Output_file::map_no_anonymous): Call gold_fallocate.
2644         (Output_file::map): Check --mmap-output-file option.
2645
2646 2012-06-05  Jing Yu  <jingyu@google.com>
2647
2648         * gold.h (textdomain): Add do {} to empty while(0).
2649         (bindtextdomain): Likewise.
2650
2651 2012-06-04  Cary Coutant  <ccoutant@google.com>
2652
2653         * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
2654         has_dynsym_index.
2655
2656 2012-05-25  Sriraman Tallam  <tmsriram@google.com>
2657
2658         * symtab.cc (Symbol_table::define_special_symbol):
2659         Initialize *poldsym to prevent uninitialized variable errors.
2660
2661 2012-05-23  Cary Coutant  <ccoutant@google.com>
2662
2663         * layout.cc (Layout::section_name_mapping): Add rules to handle
2664         exact match on .data.rel.ro.local or .data.rel.ro.
2665         (Layout::output_section_name): Check for exact matches.
2666
2667 2012-05-23  Cary Coutant  <ccoutant@google.com>
2668
2669         * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
2670         more carefully.
2671
2672 2012-05-22  Cary Coutant  <ccoutant@google.com>
2673
2674         * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
2675         object before exporting symbol.
2676
2677 2012-05-21  H.J. Lu  <hongjiu.lu@intel.com>
2678
2679         * testsuite/tls_test.cc: Include "config.h" first.
2680         * testsuite/tls_test_c.c: Likewise.
2681
2682 2012-05-17  Daniel Richard G.  <skunk@iskunk.org>
2683             Nick Clifton  <nickc@redhat.com>
2684
2685         PR 14072
2686         * configure.in: Add check that sysdep.h has been included before
2687         any system header files.
2688         * configure: Regenerate.
2689         * config.in: Regenerate.
2690
2691 2012-05-14  Cary Coutant  <ccoutant@google.com>
2692
2693         * layout.cc (Layout::make_output_section): Mark .tdata section
2694         as RELRO.
2695         * testsuite/relro_test.cc: Add a TLS variable.
2696
2697 2012-05-10  H.J. Lu  <hongjiu.lu@intel.com>
2698
2699         PR gold/14091
2700         * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
2701         R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
2702         R_X86_64_64.
2703
2704 2012-05-08  Cary Coutant  <ccoutant@google.com>
2705
2706         * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
2707         (lines_only_debug_sections): Likewise.
2708
2709 2012-05-02  Roland McGrath  <mcgrathr@google.com>
2710
2711         * nacl.cc: New file.
2712         * nacl.h: New file.
2713         * Makefile.am (CCFILES, HFILES): Add them.
2714         * Makefile.in: Regenerate.
2715         * i386.cc (Output_data_plt_i386_nacl): New class.
2716         (Output_data_plt_i386_nacl_exec): New class.
2717         (Output_data_plt_i386_nacl_dyn): New class.
2718         (Target_i386_nacl): New class.
2719         (Target_selector_i386_nacl): New class.
2720         (target_selector_i386): Use it instead of Target_selector_i386.
2721         * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
2722         (Target_x86_64_nacl): New class.
2723         (Target_selector_x86_64_nacl): New class.
2724         (target_selector_x86_64, target_selector_x32): Use it instead of
2725         Target_selector_x86_64.
2726         * arm.cc (Output_data_plt_arm_nacl): New class.
2727         (Target_arm_nacl): New class.
2728         (Target_selector_arm_nacl): New class.
2729         (target_selector_arm, target_selector_armbe): Use it instead of
2730         Target_selector_arm.
2731
2732         * target-select.cc (select_target): Take new Input_file* and off_t
2733         arguments, pass them on to recognize method of selector.
2734         * object.cc (make_elf_sized_object): Update caller.
2735         * parameters.cc (parameters_force_valid_target): Likewise.
2736         * incremental.cc (make_sized_incremental_binary): Likewise.
2737         * target-select.h: Update decl.
2738         (Target_selector::recognize): Take new Input_file* argument,
2739         pass it on to do_recognize.
2740         (Target_selector::do_recognize): Take new Input_file* argument.
2741         * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
2742         * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
2743         * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
2744         * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
2745
2746         * target.h (Target::Target_info): New members isolate_execinstr
2747         and rosegment_gap.
2748         (Target::isolate_execinstr, Target::rosegment_gap): New methods.
2749         * arm.cc (Target_arm::arm_info): Update initializer.
2750         * i386.cc (Target_i386::i386_info): Likewise.
2751         * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
2752         * sparc.cc (Target_sparc::sparc_info): Likewise.
2753         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
2754         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
2755         * layout.cc (Layout::attach_allocated_section_to_segment):
2756         Take new const Target* argument.  If target->isolate_execinstr(), act
2757         like --rosegment.
2758         (Layout::find_first_load_seg): Take new const Target* argument;
2759         if target->isolate_execinstr(), reject PF_X segments.
2760         (Layout::relaxation_loop_body): Update caller.
2761         (Layout::set_segment_offsets): If target->isolate_execinstr(),
2762         reset file offset to zero when we hit LOAD_SEG, and then do a second
2763         loop over the segments before LOAD_SEG to reassign offsets after
2764         addresses have been determined.  Handle target->rosegment_gap().
2765         (Layout::attach_section_to_segment): Take new const Target* argument;
2766         pass it to attach_allocated_section_to_segment.
2767         (Layout::make_output_section): Update caller.
2768         (Layout::attach_sections_to_segments): Take new const Target* argument;
2769         pass it to attach_section_to_segment.
2770         * gold.cc (queue_middle_tasks): Update caller.
2771         * layout.h (Layout): Update method decls with new arguments.
2772
2773         * arm.cc (Target_arm::Target_arm): Take optional argument for the
2774         Target_info pointer to use.
2775         (Target_arm::do_make_data_plt): New virtual method.
2776         (Target_arm::make_data_plt): New method that calls it.
2777         (Target_arm::make_plt_entry): Use it.
2778         (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
2779         for the section alignment.
2780         (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
2781         method.
2782         (Output_data_plt_arm::first_plt_entry_offset): Call it.
2783         (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
2784         method.
2785         (Output_data_plt_arm::get_plt_entry_size): Call it.
2786         (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
2787         (Output_data_plt_arm::fill_plt_entry): New method that calls it.
2788         (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
2789         method.
2790         (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
2791         (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
2792         method instead of sizeof(plt_entry).
2793         (Output_data_plt_arm::add_entry): Likewise.
2794         Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
2795         (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
2796         than static method.
2797         (Target_arm::plt_entry_size): Likewise.
2798         (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
2799         Move to ...
2800         (Output_data_plt_arm_standard): ... here, new class.
2801         (Output_data_plt_arm::do_write): Move guts of PLT filling to...
2802         (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
2803         (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
2804
2805         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
2806         Take additional argument for the PLT entry size.
2807         (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
2808         Use get_plt_entry_size method rather than plt_entry_size variable.
2809         (Output_data_plt_x86_64::reserve_slot): Likewise.
2810         (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
2811         (Output_data_plt_x86_64::add_entry): Likewise.
2812         (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
2813         (Output_data_plt_x86_64::address_for_global): Likewise.
2814         (Output_data_plt_x86_64::address_for_local): Likewise.
2815         (Output_data_plt_x86_64::set_final_data_size): Likewise.
2816         (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
2817         Make method non-static.
2818         (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
2819         method.
2820         (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
2821         (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
2822         (Output_data_plt_x86_64::add_eh_frame): New method to call it.
2823         (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
2824         virtual method.
2825         (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
2826         (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
2827         virtual method.
2828         (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
2829         (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
2830         virtual method.
2831         (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
2832         (Output_data_plt_x86_64::plt_entry_size)
2833         (Output_data_plt_x86_64::first_plt_entry)
2834         (Output_data_plt_x86_64::plt_entry)
2835         (Output_data_plt_x86_64::tlsdesc_plt_entry)
2836         (Output_data_plt_x86_64::plt_eh_frame_fde_size)
2837         (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
2838         (Output_data_plt_x86_64_standard): ... here, new class.
2839         (Target_x86_64::Target_x86_64): Take optional argument for the
2840         Target_info pointer to use.
2841         (Target_x86_64::do_make_data_plt): New virtual method.
2842         (Target_x86_64::make_data_plt): New method to call it.
2843         (Target_x86_64::init_got_plt_for_update): Use that.
2844         Call this->plt_->add_eh_frame method here.
2845         (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
2846         (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
2847         rather than static method.
2848         (Target_x86_64::plt_entry_size): Likewise.
2849         (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
2850         rather than plt_entry_size variable.  Move guts of PLT filling to...
2851         (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
2852         (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
2853         (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
2854
2855         * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
2856         additional argument for the section alignment.
2857         Don't do add_eh_frame_for_plt here.
2858         (Output_data_plt_i386::first_plt_entry_offset): Make the method
2859         non-static.  Use get_plt_entry_size method rather than plt_entry_size
2860         variable.
2861         (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
2862         method.
2863         (Output_data_plt_i386::get_plt_entry_size): Call it.
2864         (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
2865         (Output_data_plt_i386::add_eh_frame): New method to call it.
2866         (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
2867         method.
2868         (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
2869         (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
2870         method.
2871         (Output_data_plt_i386::fill_plt_entry): New method to call it.
2872         (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
2873         method instead of plt_entry_size.
2874         (Output_data_plt_i386::plt_entry_size)
2875         (Output_data_plt_i386::plt_eh_frame_fde_size)
2876         (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
2877         (Output_data_plt_i386_standard): ... here, new class.
2878         (Output_data_plt_i386_exec): New class.
2879         (Output_data_plt_i386::exec_first_plt_entry): Move to ...
2880         (Output_data_plt_i386_exec::first_plt_entry): ... here.
2881         (Output_data_plt_i386::exec_plt_entry): Move to ...
2882         (Output_data_plt_i386_exec::plt_entry): ... here.
2883         (Output_data_plt_i386_dyn): New class.
2884         (Output_data_plt_i386::first_plt_entry): Move to ...
2885         (Output_data_plt_i386_dyn::first_plt_entry): ... here.
2886         (Output_data_plt_i386::dyn_plt_entry): Move to ...
2887         (Output_data_plt_i386_dyn::plt_entry): ... here.
2888         (Target_i386::Target_i386): Take optional argument for the Target_info
2889         pointer to use.
2890         (Target_i386::do_make_data_plt): New virtual method.
2891         (Target_i386::make_data_plt): New method to call it.
2892         (Target_i386::make_plt_section): Use that.
2893         Call this->plt_->add_eh_frame method here.
2894         (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
2895         rather than plt_entry_size variable.
2896         (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
2897         (Output_data_plt_i386::address_for_local): Likewise.
2898         (Output_data_plt_i386::do_write): Likewise.
2899         Move guts of PLT filling to...
2900         (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
2901         (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
2902         (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
2903         (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
2904
2905 2012-05-01  Cary Coutant  <ccoutant@google.com>
2906
2907         * dwarf_reader.cc (Dwarf_die::read_attributes)
2908         (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
2909         (Dwarf_die::uint_attribute): Remove DW_FORM_null.
2910         * reduced_debug_output.cc
2911         (Output_reduced_debug_info_section::get_die_end): Remove
2912         DW_FORM_GNU_ref_index.  Add default case.
2913
2914 2012-04-26  Mark Wielaard  <mjw@redhat.com>
2915
2916         * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
2917         * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
2918         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
2919         DW_AT_high_pc as offset from DW_AT_low_pc.
2920
2921         * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
2922         * testsuite/Makefile.in: Regenerate.
2923         * testsuite/gdb_index_test_3.c: New test source file.
2924         * testsuite/gdb_index_test_3.sh: New test source file.
2925
2926 2012-04-25  Ian Lance Taylor  <iant@google.com>
2927
2928         * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
2929         pointer.
2930         (Stub_addend_reader::operator()): Declare Arm_relocate_functions
2931         as a class, not a struct.
2932         (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
2933         (Target_arm::apply_cortex_a8_workaround): Likewise.
2934         * gc.h: Declare Reloc_types as a struct, not a class.
2935         * object.h: Declare Symbols_data as a struct.
2936         * reloc.h: Declare Read_relocs_data as a struct.
2937         * target.h: Declare Relocate_info as a struct.
2938
2939 2012-04-24  David S. Miller  <davem@davemloft.net>
2940
2941         * sparc.cc (Target_sparc::Relocate::relax_call): New function.
2942         (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
2943         and R_SPARC_WPLT30.
2944
2945 2012-04-24  Cary Coutant  <ccoutant@google.com>
2946
2947         * incremental-dump.cc (find_input_containing_global): Replace
2948         magic number with symbolic constant.
2949         (dump_incremental_inputs): Update version number.
2950         * incremental.cc (Output_section_incremental_inputs): Update version
2951         number; import symbolic constants from Incremental_inputs_reader.
2952         (Incremental_inputs::create_data_sections): Align relocations
2953         section correctly for 64-bit targets.
2954         (Output_section_incremental_inputs::set_final_data_size): Use symbolic
2955         constants; add padding.
2956         (Output_section_incremental_inputs::write_header): Add assert for
2957         header_size.
2958         (Output_section_incremental_inputs::write_input_files): Add assert
2959         for input_entry_size.
2960         (Output_section_incremental_inputs::write_info_blocks): Add padding;
2961         add assert for object_info_size, input_section_entry_size,
2962         global_sym_entry_size.
2963         * incremental.h (Incremental_inputs_reader): Add symbolic constants
2964         for data structure sizes; use them.
2965         (Incremental_input_entry_reader): Import symbolic constants from
2966         Incremental_inputs_reader; use them.
2967
2968 2012-04-23  David S. Miller  <davem@davemloft.net>
2969
2970         * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
2971         and elf_flags_set_.
2972         (Target_sparc::Target_sparc): Initialize new fields.
2973         (Target_sparc::do_make_elf_object): New function.
2974         (Target_sparc::do_adjust_elf_header): New function.
2975
2976 2012-04-23  Cary Coutant  <ccoutant@google.com>
2977
2978         * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
2979         CU range table of gdb index.
2980
2981 2012-04-20  David S. Miller  <davem@davemloft.net>
2982
2983         * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
2984         instead of false.
2985
2986 2012-04-16  David S. Miller  <davem@davemloft.net>
2987
2988         * sparc.cc (Target_sparc::got_address): New function.
2989         (Sparc_relocate_functions::gdop_hix22): New function.
2990         (Sparc_relocate_functions::gdop_lox10): New function.
2991         (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
2992         relocs.
2993         (Target_sparc::Scan::local): Likewise if the global symbol is not
2994         preemptible and is not IFUNC.
2995         (Target_sparc::Relocate::relocate): Perform GOTDATA code
2996         transformations for local and non-preemptible non-IFUNC global
2997         symbols.
2998
2999         * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
3000         writing out 64-bit part of ranges.
3001
3002         * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
3003         -fpic and -fpie respectively.
3004         * Makefile.in: Regenerate.
3005
3006         * sparc.cc (class Target_sparc): Add rela_ifunc_.
3007         (Target_sparc::Target_sparc): Initialize new field.
3008         (Target_sparc::do_plt_section_for_global): New function.
3009         (Target_sparc::do_plt_section_for_local): New function.
3010         (Target_sparc::reloc_needs_plt_for_ifunc): New function.
3011         (Target_sparc::make_plt_section): New function, broken out of
3012         make_plt_entry.  Use ORDER_NON_RELRO_FIRST for ".plt".
3013         (Target_sparc::make_plt_entry): Call make_plt_section.
3014         (Target_sparc::make_local_ifunc_plt_entry): New function.
3015         (Target_sparc::rela_ifunc_section): New function.
3016         (Target_sparc::plt_section): Remove const.
3017         (Output_data_plt_sparc): Update declarations.  Define Global_ifunc
3018         and Local_ifunc types.  Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
3019         and ifunc_count_ fields.
3020         (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
3021         (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
3022         (Output_data_plt_sparc::add_local_ifunc_entry): New function.
3023         (Output_data_plt_sparc::rela_ifunc): New function.
3024         (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
3025         (Output_data_plt_sparc::has_ifunc_section): New function.
3026         (Output_data_plt_sparc::entry_count): Include ifunc_count_.
3027         (Output_data_plt_sparc::address_for_global): New function.
3028         (Output_data_plt_sparc::address_for_local): New function.
3029         (Output_data_plt_sparc::plt_index_to_offset): New function.
3030         (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
3031         and entry_count.
3032         (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
3033         entry_count.
3034         (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
3035         R_SPARC_JMP_IREL to switch.
3036         (Target_sparc::Scan::check_non_pic): Likewise.
3037         (Target_sparc::Scan::local): Handle IFUNC symbols.
3038         (Target_sparc::Scan::local): Likewise.
3039         (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
3040         and plt_address_for_local.
3041         (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
3042         Define __rel_iplt_start and __rel_iplt_end if doing a static link.
3043
3044         * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
3045         (class Output_data_reloc): Adjust calls to Output_reloc_type.
3046         (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
3047         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
3048         global relocs too.
3049         (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
3050         * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
3051         calls.
3052         * sparc.cc (Target_sparc::Scan::global): Likewise.
3053         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
3054
3055 2012-04-16  Cary Coutant  <ccoutant@google.com>
3056
3057         * archive.cc (Library_base::should_include_member): Check for
3058         --export-dynamic-symbol.
3059         * options.h (class General_options): Add --export-dynamic-symbol.
3060         * symtab.cc (Symbol::should_add_dynsym_entry): Check for
3061         --export-dynamic-symbol.
3062         (Symbol_table::gc_mark_undef_symbols): Likewise.
3063         (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
3064
3065 2012-04-12  David S. Miller  <davem@davemloft.net>
3066
3067         * sparc.cc (Reloc::wdisp10): New relocation method.
3068         (Reloc::h34): Likewise.
3069         (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
3070         (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
3071         R_SPARC_WDISP10.
3072         (Target_sparc::Scan::local): Likewise.
3073         (Target_sparc::Scan::global): Likewise.
3074         (Target_sparc::Relocate::relocate): Likewise.
3075
3076 2012-04-09  Cary Coutant  <ccoutant@google.com>
3077
3078         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
3079         low_pc == 0.
3080
3081 2012-04-06  Ian Lance Taylor  <iant@google.com>
3082
3083         * timer.cc: #include <unistd.h>.
3084
3085 2012-04-06  Roland McGrath  <mcgrathr@google.com>
3086
3087         * configure.in (AC_CHECK_HEADERS): Add locale.h.
3088         * config.in: Regenerate.
3089         * configure: Regenerate.
3090
3091 2012-04-05  Nick Clifton  <nickc@redhat.com>
3092
3093         * configure.ac (AC_CHECK_FUNCS): Add setlocale.
3094         (AM_LC_MESSAGES): Add.
3095         * aclocal.m4: Regenerate.
3096         * config.in: Regenerate.
3097         * configure: Regenerate.
3098
3099 2012-03-21  Cary Coutant  <ccoutant@google.com>
3100
3101         * Makefile.am: Add gdb-index.cc, gdb-index.h.
3102         * Makefile.in: Regenerate.
3103         * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
3104         (Sized_elf_reloc_mapper::symbol_section): New function.
3105         (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
3106         (make_elf_reloc_mapper): New function.
3107         (Dwarf_abbrev_table::clear_abbrev_codes): New function.
3108         (Dwarf_abbrev_table::do_read_abbrevs): New function.
3109         (Dwarf_abbrev_table::do_get_abbrev): New function.
3110         (Dwarf_ranges_table::read_ranges_table): New function.
3111         (Dwarf_ranges_table::read_range_list): New function.
3112         (Dwarf_pubnames_table::read_section): New function.
3113         (Dwarf_pubnames_table::read_header): New function.
3114         (Dwarf_pubnames_table::next_name): New function.
3115         (Dwarf_die::Dwarf_die): New function.
3116         (Dwarf_die::read_attributes): New function.
3117         (Dwarf_die::skip_attributes): New function.
3118         (Dwarf_die::set_name): New function.
3119         (Dwarf_die::set_linkage_name): New function.
3120         (Dwarf_die::attribute): New function.
3121         (Dwarf_die::string_attribute): New function.
3122         (Dwarf_die::int_attribute): New function.
3123         (Dwarf_die::uint_attribute): New function.
3124         (Dwarf_die::ref_attribute): New function.
3125         (Dwarf_die::child_offset): New function.
3126         (Dwarf_die::sibling_offset): New function.
3127         (Dwarf_info_reader::check_buffer): New function.
3128         (Dwarf_info_reader::parse): New function.
3129         (Dwarf_info_reader::do_parse): New function.
3130         (Dwarf_info_reader::do_read_string_table): New function.
3131         (Dwarf_info_reader::lookup_reloc): New function.
3132         (Dwarf_info_reader::get_string): New function.
3133         (Dwarf_info_reader::visit_compilation_unit): New function.
3134         (Dwarf_info_reader::visit_type_unit): New function.
3135         (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
3136         Sized_elf_reloc_mapper.
3137         (Sized_dwarf_line_info::symbol_section): Remove function.
3138         (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
3139         (Sized_dwarf_line_info::read_line_mappings): Remove object
3140         parameter, adjust callers.
3141         (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
3142         * dwarf_reader.h: Include <sys/types.h>.
3143         (class Track_relocs): Remove forward declaration.
3144         (class Elf_reloc_mapper): New class.
3145         (class Sized_elf_reloc_mapper): New class.
3146         (class Dwarf_abbrev_table): New class.
3147         (class Dwarf_range_list): New class.
3148         (class Dwarf_ranges_table): New class.
3149         (class Dwarf_pubnames_table): New class.
3150         (class Dwarf_die): New class.
3151         (class Dwarf_info_reader): New class.
3152         (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
3153         (Sized_dwarf_line_info::symbol_section): Remove member function.
3154         * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
3155         base class.
3156         * gdb-index.cc: New source file.
3157         * gdb-index.h: New source file.
3158         * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
3159         and .debug_types sections, call Layout::add_to_gdb_index.
3160         (Sized_relobj_incr::do_section_name): Implement.
3161         (Sized_relobj_incr::do_section_contents): Adjust parameter list and
3162         return type; Implement.
3163         (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
3164         return type.
3165         * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
3166         parameter list and return type.
3167         (Sized_incr_dynobj::do_section_contents): Likewise.
3168         * layout.cc: Include gdb-index.h.
3169         (Layout::Layout): Initialize gdb_index_data_.
3170         (Layout::init_fixed_output_section): Check for .gdb_index section.
3171         (Layout::add_to_gdb_index): New function. Instantiate.
3172         * layout.h: Add forward declaration for class Gdb_index.
3173         (Layout::add_to_gdb_index): New member function.
3174         (Layout::gdb_index_data_): New data member.
3175         * main.cc: Include gdb-index.h.
3176         (main): Print statistics for gdb index.
3177         * object.cc (Object::section_contents): Move code into
3178         do_section_contents.
3179         (need_decompressed_section): Check for sections needed when building
3180         gdb index.
3181         (build_compressed_section_map): Likewise.
3182         (Sized_relobj_file::do_read_symbols): Need local symbols when building
3183         gdb index.
3184         (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
3185         sections; call Layout::add_to_gdb_index.
3186         (Sized_relobj_file::do_decompressed_section_contents): Call
3187         do_section_contents directly.
3188         * object.h (Object::do_section_contents): Adjust parameter list and
3189         return type.
3190         (Object::do_decompressed_section_contents): Call do_section_contents
3191         directly.
3192         (Sized_relobj_file::do_section_contents): Adjust parameter list and
3193         return type.
3194         * options.h (class General_options): Add --gdb-index option.
3195         * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
3196         list and return type.
3197         * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
3198         * reloc.h (Track_relocs::checkpoint): New function.
3199         (Track_relocs::reset): New function.
3200
3201         * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
3202         New test cases.
3203         * testsuite/Makefile.in: Regenerate.
3204         * testsuite/gdb_index_test.cc: New test source file.
3205         * testsuite/gdb_index_test_1.sh: New test source file.
3206         * testsuite/gdb_index_test_2.sh: New test source file.
3207
3208 2012-03-19  Doug Kwan  <dougkwan@google.com>
3209
3210         * arm.cc (Target_arm::do_define_standard_symbols): New method.
3211         (Target_arm::do_finalize_sections): Remove code which defines
3212         __exidx_start and __exidx_end.  Make symbol table parameter
3213         anonymous as it is not used.
3214         * gold.cc (queue_middle_tasks): Call target hook to define any
3215         target-specific symbols.
3216         * target.h (Target::define_standard_symbols): New method.
3217         (Target::do_define_standard_symbols): Same.
3218         * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
3219         * testsuite/Makefile.in: Regenerate.
3220         * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
3221         and __exidx_end.
3222         * testsuite/arm_exidx_test.sh: Check that no unused dynamic
3223         relocations are generated for __exidx_start and __exidx_end.
3224
3225 2012-03-16  Doug Kwan  <dougkwan@google.com>
3226
3227         * testsuite/Makefile.am: Disable test initpri3b.
3228         * testsuite/Makefile.in: Regenerate.
3229
3230 2012-03-15  Doug Kwan  <dougkwan@google.com>
3231
3232         * arm.cc (Target_arm::got_section): Make .got section read-only
3233         if -z now is given.
3234
3235 2012-03-15  Ian Lance Taylor  <iant@google.com>
3236
3237         PR gold/13850
3238         * layout.cc (Layout::make_output_section): Correctly mark
3239         SHT_INIT_ARRAY, et. al., as relro.
3240
3241 2012-03-14  Doug Kwan  <dougkwan@google.com>
3242
3243         * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
3244         dynamic relocations for protected symbols in shared objects.
3245
3246 2012-03-13  Ian Lance Taylor  <iant@google.com>
3247
3248         * resolve.cc (Symbol_table::resolve): When merging common symbols,
3249         keep the larger alignment.
3250
3251 2012-03-12  Cary Coutant  <ccoutant@google.com>
3252
3253         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
3254         handling of DW_LNE_define_file.
3255
3256 2012-03-12  Cary Coutant  <ccoutant@google.com>
3257
3258         * reduced_debug_output.cc
3259         (Output_reduced_debug_info_section::get_die_end): Add new FORM
3260         codes to switch.
3261
3262 2012-02-29  Cary Coutant  <ccoutant@google.com>
3263
3264         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
3265
3266 2012-02-29  Cary Coutant  <ccoutant@google.com>
3267
3268         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
3269         Call Object::decompressed_section_contents.
3270         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
3271         New dtor.
3272         (Sized_dwarf_line_info::buffer_start_): New data member.
3273         * merge.cc (Output_merge_data::do_add_input_section): Call
3274         Object::decompressed_section_contents.
3275         (Output_merge_string::do_add_input_section): Likewise.
3276         * object.cc (need_decompressed_section): New function.
3277         (build_compressed_section_map): Decompress sections needed later.
3278         (Sized_relobj_file::do_decompressed_section_contents): New function.
3279         (Sized_relobj_file::do_discard_decompressed_sections): New function.
3280         * object.h (Object::decompressed_section_contents): New function.
3281         (Object::discard_decompressed_sections): New function.
3282         (Object::do_decompressed_section_contents): New function.
3283         (Object::do_discard_decompressed_sections): New function.
3284         (Compressed_section_info): New type.
3285         (Compressed_section_map): Include decompressed section contents.
3286         (Sized_relobj_file::do_decompressed_section_contents): New function.
3287         (Sized_relobj_file::do_discard_decompressed_sections): New function.
3288
3289 2012-02-16  Cary Coutant  <ccoutant@google.com>
3290
3291         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
3292         * testsuite/Makefile.in: Regenerate.
3293
3294 2012-02-14  Cary Coutant  <ccoutant@google.com>
3295
3296         * options.cc (General_options::finalize): Disallow -pie and -static.
3297
3298 2012-02-03  Doug Kwan  <dougkwan@google.com>
3299
3300         * arm.cc (Arm_relocate_functions::abs8,
3301         Arm_relocate_functions::abs16): Use
3302         Bits::has_signed_unsigned_overflow32.
3303         (Arm_relocate_functions::thm_abs8): Correct range of
3304         overflow check.
3305         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
3306         in assertions.
3307
3308 2012-02-02  Doug Kwan  <dougkwan@google.com>
3309
3310         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
3311         position independent outputs, not just shared objects.
3312
3313 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
3314
3315         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
3316         * configure: Regenerated.
3317
3318 2012-01-27  Ian Lance Taylor  <iant@google.com>
3319
3320         * reloc.h (Bits): New class with static functions, copied from
3321         namespace utils in arm.cc.
3322         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
3323         instead.
3324
3325 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
3326
3327         * incremental.cc (write_info_blocks): Correct relocation offset.
3328
3329 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
3330
3331         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
3332         (Relocate::tls_gd_to_le): Likewise.
3333
3334 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
3335
3336         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
3337
3338 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
3339
3340         * configure.ac: Check if -mcmodel=medium works.
3341         * configure: Regenerated.
3342
3343 2012-01-24  Cary Coutant  <ccoutant@google.com>
3344
3345         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
3346         definition and ...
3347         (read_unsigned_LEB_128_x): ... this new function.
3348         (read_signed_LEB_128): Replaced with inline definition and ...
3349         (read_signed_LEB_128_x): ... this new function.
3350         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
3351         (read_unsigned_LEB_128): Add inline definition.
3352         (read_signed_LEB_128_x): New function.
3353         (read_signed_LEB_128): Add inline definition.
3354         * testsuite/Makefile.am (leb128_unittest): New unit test.
3355         * testsuite/Makefile.in: Regenerate.
3356         * testsuite/leb128_unittest.cc: New unit test.
3357
3358 2012-01-23  Ian Lance Taylor  <iant@google.com>
3359
3360         PR gold/13617
3361         * i386.cc (Target_i386::do_code_fill): When using a jmp
3362         instruction, pad with nop instructions.
3363         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
3364
3365 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
3366
3367         * x86_64.cc (gc_process_relocs): Add typename on types used in
3368         template.
3369         (scan_relocs): Likewise.
3370         (relocate_section): Likewise.
3371         (apply_relocation): Likewise.
3372
3373 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
3374
3375         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
3376         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
3377         under x32.
3378
3379 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
3380
3381         * x86_64.cc: Initial support for x32.
3382
3383 2012-01-03  Cary Coutant  <ccoutant@google.com>
3384
3385         * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
3386         Use abstract base class for GOT.
3387         * gold/output.h (class Output_data_got_base): New abstract base class.
3388         (class Output_data_got): Derive from new base class, adjust ctors.
3389         (Output_data_got::reserve_slot): Make virtual; rename to
3390         do_reserve_slot; Adjust callers.
3391         * gold/target.h (Sized_target::init_got_plt_for_update): Return
3392         pointer to abstract base class.
3393         * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
3394
3395 2011-12-18  Ian Lance Taylor  <iant@google.com>
3396
3397         * object.h (Relobj::local_symbol_value): New function.
3398         (Relobj::local_plt_offset): New function.
3399         (Relobj::local_has_got_offset): New function.
3400         (Relobj::local_got_offset): New function.
3401         (Relobj::set_local_got_offset): New function.
3402         (Relobj::do_local_symbol_value): New pure virtual function.
3403         (Relobj::do_local_plt_offset): Likewise.
3404         (Relobj::do_local_has_got_offset): Likewise.
3405         (Relobj::do_local_got_offset): Likewise.
3406         (Relobj::do_set_local_got_offset): Likewise.
3407         (Sized_relobj::do_local_has_got_offset): Rename from
3408         local_has_got_offset.
3409         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
3410         (Sized_relobj::do_set_local_got_offset): Rename from
3411         set_local_got_offset.
3412         (Sized_relobj_file::do_local_plt_offset): Rename from
3413         local_plt_offset.
3414         (Sized_relobj_file::do_local_symbol_value): New function.
3415         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
3416         local_plt_offset.
3417         * output.cc (Output_data_got::Got_entry::write): Change object to
3418         Relobj.  Use local_symbol_value.
3419         (Output_data_got::add_global_with_rel): Change rel_dyn to
3420         Output_data_reloc_generic*.  Use add_global_generic.
3421         (Output_data_got::add_global_with_rela): Remove.  Change all
3422         callers to use add_global_with_rel.
3423         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
3424         Output_data_reloc_generic*.  Use add_global_generic.
3425         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
3426         callers to use add_global_pair_with_rel.
3427         (Output_data_got::add_local): Change object to Relobj*.
3428         (Output_data_got::add_local_plt): Likewise.
3429         (Output_data_got::add_local_with_rel): Change object to Relobj*,
3430         change rel_dyn to Output_data_reloc_generic*.  Use
3431         add_local_generic.
3432         (Output_data_got::add_local_with_rela): Remove.  Change all
3433         callers to use all_local_with_rel.
3434         (Output_data_got::add_local_pair_with_rel): Change object to
3435         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
3436         add_output_section_generic.
3437         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
3438         callers to use add_local_pair_with_rel.
3439         (Output_data_got::reserve_local): Change object to Relobj*.
3440         * output.h: (class Output_data_reloc_generic): Add pure virtual
3441         declarations for add_global_generic, add_local_generic,
3442         add_output_section_generic.
3443         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
3444         functions for Output_data_reloc_generic.  Update declarations for
3445         changes listed in output.cc.
3446         (class Output_data_got): Change template parameter to got_size.
3447         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
3448         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
3449         function.
3450         (Sized_relobj_incr::do_local_plt_offset): New function.
3451         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
3452         add_global_generic.
3453
3454 2011-12-17  Cary Coutant  <ccoutant@google.com>
3455
3456         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
3457         * resolve.cc (Symbol_table::resolve): Likewise.
3458         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
3459         arrays.
3460         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
3461
3462 2011-12-16  Ian Lance Taylor  <iant@google.com>
3463
3464         * output.h (Output_data_reloc_generic::add): Only call
3465         add_dynamic_reloc if this is a dynamic reloc section.
3466
3467 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
3468
3469         PR gold/13505
3470         * target-reloc.h (apply_relocation): Replace <64, false> with
3471         <size, big_endian>.
3472
3473 2011-11-25  Nick Clifton  <nickc@redhat.com>
3474
3475         * po/it.po: New Italian translation.
3476
3477 2011-11-17  Sterling Augustine  <saugustine@google.com>
3478
3479         * script.cc (script_include_directive): Implement.
3480         (read_script_file): New local variables name and search_path. Update
3481         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
3482         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
3483         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
3484
3485 2011-11-11  Sterling Augustine  <saugustine@google.com>
3486
3487         * yyscript.y (section_cmd): Add support for INCLUDE directive.
3488         (file_or_sections_cmd): Likewise.
3489
3490 2011-11-11  Doug Kwan  <dougkwan@google.com>
3491
3492         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
3493         if --just-symbols is given.
3494
3495 2011-11-10  Doug Kwan  <dougkwan@google.com>
3496
3497         PR gold/13362
3498         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
3499         when processing data relocs.
3500         * reloc.h (Relocate_functions::rel_unaligned): New method.
3501         (Relocate_functions::pcrel_unaligned): Ditto.
3502         (Relocate_functions::rel32_unaligned): Ditto.
3503         (Relocate_functions::pcrel32_unaligned): Ditto.
3504
3505 2011-11-09  Doug Kwan  <dougkwan@google.com>
3506
3507         PR gold/13362
3508         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
3509         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
3510         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
3511         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
3512         (Relocate_functions::rel_unaligned): New.
3513         (Relocate_functions::rel32_unaligned): New.
3514         * target-reloc.h (relocate_for_relocatable): Add code to handle
3515         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
3516         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
3517         arm_unaligned_reloc_r): New targets.
3518         * testsuite/Makefile.in: Regenerate.
3519         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
3520         linking.
3521
3522 2011-11-02  Ian Lance Taylor  <iant@google.com>
3523
3524         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
3525         NATIVE_LINKER.
3526         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
3527         * options.cc (General_options::finalize): Use library search path
3528         from configure script if specified.  If not native and no sysroot,
3529         only search TOOLLIBDIR.
3530         * options.h (Search_directory::Search_directory): Change name to
3531         const std::string&.
3532         (General_options::add_to_library_path_with_sysroot): Change arg to
3533         const std::string&.
3534         * configure, Makefile.in, config.in: Rebuild.
3535
3536 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
3537
3538         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
3539         we are working around the ARM1176 Erratum.
3540         * options.h (General_options::fix_arm1176): Add option.
3541         * testsuite/Makefile.am: Add testcases, and keep current ones
3542         working.
3543         * testsuite/Makefile.in: Regenerate.
3544         * testsuite/arm_fix_1176.s: New file.
3545         * testsuite/arm_fix_1176.sh: Likewise.
3546
3547 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
3548
3549         * arm.cc (Target_arm::Target_arm): Remove initialisation of
3550         may_use_blx_.
3551         (Target_arm::may_use_blx): Remove method.
3552         (Target_arm::set_may_use_blx): Likewise.
3553         (Target_arm::may_use_v4t_interworking): New method.
3554         (Target_arm::may_use_v5t_interworking): Likewise.
3555         (Target_arm::may_use_blx_): Remove member variable.
3556         (Arm_relocate_functions::arm_branch_common): Check for v5T
3557         interworking.
3558         (Arm_relocate_functions::thumb_branch_common): Likewise.
3559         (Reloc_stub::stub_type_for_reloc): Likewise.
3560         (Target_arm::do_finalize_sections): Correct interworking checks.
3561         * testsuite/Makefile.am: Add new tests.
3562         * testsuite/Makefile.in: Regenerate.
3563         * testsuite/arm_farcall_arm_arm.s: New test.
3564         * testsuite/arm_farcall_arm_arm.sh: Likewise.
3565         * testsuite/arm_farcall_arm_thumb.s: Likewise.
3566         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
3567         * testsuite/arm_farcall_thumb_arm.s: Likewise.
3568         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
3569         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
3570         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
3571
3572 2011-10-31  Cary Coutant  <ccoutant@google.com>
3573
3574         PR gold/13023
3575         * expression.cc (Expression::eval_with_dot): Add
3576         is_section_dot_assignment parameter.
3577         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
3578         absolute and assigning to dot within a section.
3579         * script-sections.cc
3580         (Output_section_element_assignment::set_section_addresses): Pass
3581         dot_section to set_if_absolute.
3582         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
3583         as is_section_dot_assignment flag to eval_with_dot.
3584         (Output_section_element_dot_assignment::set_section_addresses):
3585         Likewise.
3586         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
3587         parameter.  Also set value if relative to dot_section; set the
3588         symbol's output_section.
3589         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
3590         parameter.  Adjust all callers.
3591         (Expression::eval_maybe_dot): Likewise.
3592         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
3593         Adjust all callers.
3594         * testsuite/script_test_2.t: Test assignment of an absolute value
3595         to dot within an output section element.
3596
3597 2011-10-31  Cary Coutant  <ccoutant@google.com>
3598
3599         * options.h (class General_options): Add --[no-]gnu-unique options.
3600         * symtab.cc (Symbol_table::sized_write_globals): Convert
3601         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
3602
3603 2011-10-31  Cary Coutant  <ccoutant@google.com>
3604
3605         PR gold/13359
3606         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
3607         unnecessary assertion.
3608         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
3609
3610 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
3611
3612         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
3613         gc_mark_symbol.
3614         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
3615         gc_mark_symbol.
3616         Change to just keep the section associated with symbol.
3617         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
3618         they are externally visible and --export-dynamic is turned on.
3619         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
3620
3621 2011-10-19  Ian Lance Taylor  <iant@google.com>
3622
3623         PR gold/13163
3624         * script-sections.cc
3625         (Output_section_element_dot_assignment::needs_output_section): New
3626         function.
3627
3628 2011-10-19  Ian Lance Taylor  <iant@google.com>
3629
3630         PR gold/13204
3631         * layout.cc (Layout::segment_precedes): Don't assert failure if a
3632         --section-start option was seen.
3633         * options.h (General_options::any_section_start): New function.
3634
3635 2011-10-18  David S. Miller  <davem@davemloft.net>
3636
3637         PR binutils/13301
3638         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
3639         member to track relocation locations that have moved during TLS
3640         reloc optimizations.
3641         (Target_sparc::Relocate::Relocate): Initialize to NULL.
3642         (Target_sparc::Relocate::relocate): Adjust view down by 4
3643         bytes if it matches reloc_adjust_addr_.
3644         (Target_sparc::Relocate::relocate_tls): Always move the
3645         __tls_get_addr call delay slot instruction forward 4 bytes when
3646         performing relaxation.
3647
3648 2011-10-18  Cary Coutant  <ccoutant@google.com>
3649
3650         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
3651         (Output_file::map_no_anonymous): Check for non-zero
3652         return code from posix_fallocate.
3653
3654 2011-10-17  Cary Coutant  <ccoutant@google.com>
3655
3656         PR gold/13245
3657         * plugin.cc (is_visible_from_outside): Check for symbols
3658         referenced from dynamic objects.
3659         * resolve.cc (Symbol_table::resolve): Don't count references
3660         from dynamic objects as references from real ELF files.
3661         * testsuite/plugin_test_2.sh: Adjust expected result.
3662
3663 2011-10-17  Cary Coutant  <ccoutant@google.com>
3664
3665         * gold.cc: Include timer.h.
3666         (queue_middle_tasks): Stamp time.
3667         (queue_final_tasks): Likewise.
3668         * main.cc (main): Store timer in parameters.  Print timers
3669         for each pass.
3670         * parameters.cc (Parameters::Parameters): Initialize timer_.
3671         (Parameters::set_timer): New function.
3672         (set_parameters_timer): New function.
3673         * parameters.h (Parameters::set_timer): New function.
3674         (Parameters::timer): New function.
3675         (Parameters::timer_): New data member.
3676         (set_parameters_timer): New function.
3677         * timer.cc (Timer::stamp): New function.
3678         (Timer::get_pass_time): New function.
3679         * timer.h (Timer::stamp): New function.
3680         (Timer::get_pass_time): New function.
3681         (Timer::pass_times_): New data member.
3682
3683 2011-10-17  Cary Coutant  <ccoutant@google.com>
3684
3685         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
3686         task for members of lib groups.
3687
3688 2011-10-17  Cary Coutant  <ccoutant@google.com>
3689
3690         PR gold/13288
3691         * fileread.cc (File_read::find_view): Add assert.
3692         (File_read::make_view): Move bounds check (replace with assert)...
3693         (File_read::find_or_make_view): ... to here.
3694
3695 2011-10-12  Cary Coutant  <ccoutant@google.com>
3696
3697         * output.cc (Output_file::open_base_file): Handle case where
3698         ::read returns less than requested size.
3699
3700 2011-10-10  Cary Coutant  <ccoutant@google.com>
3701
3702         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
3703         Initialize defined_count_.
3704         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
3705         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
3706         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
3707         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
3708         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
3709         * incremental.h (Sized_relobj_incr::defined_count_): New data
3710         member.
3711         (Sized_incr_dynobj::defined_count_): New data member.
3712         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
3713         Return zeroes instead of internal error.
3714
3715 2011-10-10  Cary Coutant  <ccoutant@google.com>
3716
3717         PR gold/13249
3718         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
3719         (Output_reloc::symbol_value): Return PLT offset if flag is set.
3720         * output.h (class Output_reloc): Add use_plt_offset flag.
3721         (Output_reloc::type_): Adjust size of bit field.
3722         (Output_reloc::use_plt_offset_): New bit field.
3723         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
3724         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
3725         flag.  Adjust all callers.
3726         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
3727         creating RELATIVE relocations.
3728
3729 2011-10-10  Nick Clifton  <nickc@redhat.com>
3730
3731         * po/es.po: Updated Spanish translation.
3732         * po/fi.po: Updated Finnish translation.
3733
3734 2011-10-03   Diego Novillo  <dnovillo@google.com>
3735
3736         * options.cc (parse_uint): Fix dereference of RETVAL.
3737
3738 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
3739
3740         * layout.h (section_order_map_): New member.
3741         (get_section_order_map): New member function.
3742         * output.cc (Output_section::add_input_section): Check for patterns
3743         only when --section-ordering-file is specified.
3744         * gold.cc (queue_middle_tasks): Delay updating order of sections till
3745         output_sections have been formed.
3746         * layout.cc (Layout_Layout): Initialize section_order_map_.
3747         * plugin.cc (update_section_order): Store order in order_map. Do not
3748         update the order.
3749         * testsuite/Makefile.am: Add test case for plugin_final_layout.
3750         * testsuite/Makefile.in: Regenerate.
3751         * testsuite/plugin_section_order.c: New file.
3752         * testsuite/plugin_final_layout.cc: New file.
3753         * testsuite/plugin_final_layout.sh: New file.
3754
3755 2011-09-29  Cary Coutant  <ccoutant@google.com>
3756
3757         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
3758         Check for NULL.
3759         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
3760         symbols during incremental update.
3761         (Symbol_table::add_from_dynobj): Likewise.
3762
3763 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3764             Ian Lance Taylor  <iant@google.com>
3765
3766         * symtab.cc (Symbol_table::define_special_symbol): Always
3767         canonicalize version string.
3768
3769 2011-09-26  Cary Coutant  <ccoutant@google.com>
3770
3771         * gold.cc (queue_initial_tasks): Move option checks ...
3772         * options.cc (General_options::finalize): ... to here. Disable
3773         some options; make others fatal.
3774
3775 2011-09-26  Cary Coutant  <ccoutant@google.com>
3776
3777         gcc PR lto/47247
3778         * plugin.cc (get_symbols_v2): New function.
3779         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
3780         (is_referenced_from_outside): New function.
3781         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
3782         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
3783         (get_symbols): Pass version parameter.
3784         (get_symbols_v2): New function.
3785         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
3786         parameter.
3787         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
3788         (onload): Add LDPT_GET_SYMBOLS_V2.
3789         (all_symbols_read_hook): Use get_symbols_v2; check for
3790         LDPR_PREVAILING_DEF_IRONLY_EXP.
3791         * testsuite/plugin_test_3.sh: Update expected results.
3792
3793 2011-09-23  Simon Baldwin  <simonb@google.com>
3794
3795         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
3796         configuration options.
3797         * configure: Regenerate.
3798         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
3799         * Makefile.in: Regenerate.
3800         * testsuite/Makefile.in: Regenerate.
3801
3802 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
3803
3804         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
3805
3806 2011-09-19  Cary Coutant  <ccoutant@google.com>
3807
3808         * incremental.cc (can_incremental_update): Fix typo in comment.
3809         * incremental.h (can_incremental_update): Likewise.
3810
3811 2011-09-18  Cary Coutant  <ccoutant@google.com>
3812
3813         * incremental.cc (can_incremental_update): New function.
3814         * incremental.h (can_incremental_update): New function.
3815         * layout.cc (Layout::init_fixed_output_section): Call it.
3816         (Layout::make_output_section): Don't allow patch space in .eh_frame.
3817         * object.cc (Sized_relobj_file::do_layout): Call
3818         can_incremental_update.
3819
3820 2011-09-13  Cary Coutant  <ccoutant@google.com>
3821
3822         * configure.ac: Check for glibc support for gnu_indirect_function
3823         support with static linking, setting automake conditional
3824         IFUNC_STATIC.
3825         * Makefile.in: Regenerate.
3826         * configure: Regenerate.
3827
3828         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
3829         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
3830         for IFUNC_STATIC.
3831         * testsuite/Makefile.in: Regenerate.
3832
3833 2011-09-13  Cary Coutant  <ccoutant@google.com>
3834
3835         * incremental.cc (Sized_relobj_incr::do_layout): Call
3836         report_comdat_group for kept comdat sections.
3837         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
3838         * testsuite/Makefile.in: Regenerate.
3839         * testsuite/incr_comdat_test_1.cc: New source file.
3840         * testsuite/incr_comdat_test_2_v1.cc: New source file.
3841         * testsuite/incr_comdat_test_2_v2.cc: New source file.
3842         * testsuite/incr_comdat_test_2_v3.cc: New source file.
3843
3844 2011-09-13  Ian Lance Taylor  <iant@google.com>
3845
3846         * object.cc (Sized_relobj_file::do_layout): Remove unused local
3847         variable external_symbols_offset.
3848
3849 2011-09-12  Ian Lance Taylor  <iant@google.com>
3850
3851         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
3852         triggered if object has no symbols.
3853
3854 2011-09-09  David S. Miller  <davem@davemloft.net>
3855
3856         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
3857         (Output_fill_debug_line::do_write): Likewise.
3858
3859 2011-08-29  Cary Coutant  <ccoutant@google.com>
3860
3861         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
3862         casts to match formatting specs.
3863         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
3864
3865 2011-08-26  Cary Coutant  <ccoutant@google.com>
3866
3867         * layout.cc (Free_list::allocate): Provide guarantee of minimum
3868         remaining hole size when allocating.
3869         (Layout::make_output_section): Set fill methods for debug sections.
3870         * layout.h (Free_list::Free_list_node): Move from private to
3871         public.
3872         (Free_list::set_min_hole_size): New function.
3873         (Free_list::begin, Free_list::end): New functions.
3874         (Free_list::min_hole_): New data member.
3875         * output.cc: Include dwarf.h.
3876         (Output_fill_debug_info::do_minimum_hole_size): New function.
3877         (Output_fill_debug_info::do_write): New function.
3878         (Output_fill_debug_line::do_minimum_hole_size): New function.
3879         (Output_fill_debug_line::do_write): New function.
3880         (Output_section::Output_section): Initialize new data member.
3881         (Output_section::set_final_data_size): Ensure patch space is larger
3882         than minimum hole size.
3883         (Output_section::do_write): Fill holes in debug sections.
3884         * output.h (Output_fill): New class.
3885         (Output_fill_debug_info): New class.
3886         (Output_fill_debug_line): New class.
3887         (Output_section::set_free_space_fill): New function.
3888         (Output_section::free_space_fill_): New data member.
3889         * testsuite/Makefile.am (incremental_test_3): Add
3890         --incremental-patch option.
3891         (incremental_test_4): Likewise.
3892         (incremental_test_5): Likewise.
3893         (incremental_test_6): Likewise.
3894         (incremental_copy_test): Likewise.
3895         (incremental_common_test_1): Likewise.
3896         * testsuite/Makefile.in: Regenerate.
3897
3898 2011-08-26  Nick Clifton  <nickc@redhat.com>
3899
3900         * po/es.po: Updated Spanish translation.
3901
3902 2011-08-01  Cary Coutant  <ccoutant@google.com>
3903
3904         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
3905         * gold/testsuite/Makefile.in: Regenerate.
3906         * gold/testsuite/justsyms_exec.c: New source file.
3907         * gold/testsuite/justsyms_lib.c: New source file.
3908
3909 2011-08-01  Cary Coutant  <ccoutant@google.com>
3910
3911         * layout.cc (Layout::set_segment_offsets): Don't realign text
3912         segment if -Ttext was specified.
3913         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
3914         file type.
3915         * object.h (Sized_relobj_file::e_type): New function.
3916         (Sized_relobj_file::e_type_): New data member.
3917         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
3918         base address for ET_EXEC files.
3919         * target.cc (Target::do_make_elf_object_implementation): Allow
3920         ET_EXEC files with --just-symbols option.
3921
3922 2011-07-28  Cary Coutant  <ccoutant@google.com>
3923
3924         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
3925         Add thread_number parameter.
3926         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
3927         * workqueue-threads.cc
3928         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
3929         current thread if its thread number is greater than desired thread
3930         count.
3931         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
3932         Add thread_number parameter.
3933         (Workqueue::should_cancel_thread): Likewise.
3934         (Workqueue::find_runnable_or_wait): Pass thread_number to
3935         should_cancel_thread.
3936         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
3937         parameter.
3938
3939 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
3940
3941         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
3942         only after checking if it cannot be forced local.
3943         * symtab.h (is_externally_visible): Check if the symbol is not forced
3944         local.
3945
3946 2011-07-15  Ian Lance Taylor  <iant@google.com>
3947
3948         * options.h (class General_options): Add --print-output-format.
3949         Move -EL next to -EB, for  better --help output.
3950         * target-select.cc: Include <cstdio>, "options.h", and
3951         "parameters.h".
3952         (Target_selector::do_target_bfd_name): New function.
3953         (print_output_format): New function.
3954         * target-select.h (class Target_selector): Update declarations.
3955         (Target_selector::target_bfd_name): New function.
3956         (print_output_format): Declare.
3957         * main.cc: Include "target-select.h".
3958         (main): Handle --print-output-format.
3959         * gold.cc: Include "target-select.h".
3960         (queue_initial_tasks): Handle --print-output-format when there are
3961         no input files.
3962         * parameters.cc (parameters_force_valid_target): Give a better
3963         error message if -EB/-EL does not match target.
3964         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
3965         function.
3966
3967 2011-07-15  Ian Lance Taylor  <iant@google.com>
3968
3969         * i386.cc (class Output_data_plt_i386): Add layout_ field.
3970         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
3971         (Output_data_plt_i386::do_write): Write address of .dynamic
3972         section to first entry in .got.plt section.
3973         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
3974         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
3975         Initialize layout_.
3976         (Output_data_plt_x86_64::do_write): Write address of .dynamic
3977         section to first entry in .got.plt section.
3978         * layout.h (Layout::dynamic_section): New function.
3979
3980 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
3981
3982         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
3983         to claim_file call.
3984         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
3985         input_section_position_, and input_section_glob_.
3986         (read_layout_from_file): Call function section_ordering_specified.
3987         * layout.h (is_section_ordering_specified): New function.
3988         (section_ordering_specified): New function.
3989         (section_ordering_specified_): New boolean member.
3990         * main.cc(main): Call load_plugins after layout object is defined.
3991         * output.cc (Output_section::add_input_section): Use
3992         function section_ordering_specified to check if section ordering is
3993         needed.
3994         * output.cc (Output_section::add_relaxed_input_section): Use
3995         function section_ordering_specified to check if section ordering is
3996         needed.
3997         (Output_section::update_section_layout): New function.
3998         (Output_section::sort_attached_input_sections): Check if input section
3999         must be reordered.
4000         * output.h (Output_section::update_section_layout): New function.
4001         * plugin.cc (get_section_count): New function.
4002         (get_section_type): New function.
4003         (get_section_name): New function.
4004         (get_section_contents): New function.
4005         (update_section_order): New function.
4006         (allow_section_ordering): New function.
4007         (Plugin::load): Add the new interfaces to the transfer vector.
4008         (Plugin_manager::load_plugins): New parameter.
4009         (Plugin_manager::all_symbols_read): New parameter.
4010         (Plugin_manager::claim_file): New parameter. Save the elf object for
4011         unclaimed objects.
4012         (Plugin_manager::get_elf_object): New function.
4013         (Plugin_manager::get_view): Change to directly use the bool to check
4014         if get_view is called from claim_file_hook.
4015         * plugin.h (input_objects): New function
4016         (Plugin__manager::load_plugins): New parameter.
4017         (Plugin_manager::claim_file): New parameter.
4018         (Plugin_manager::get_elf_object): New function.
4019         (Plugin_manager::in_claim_file_handler): New function.
4020         (Plugin_manager::in_claim_file_handler_): New member.
4021         (layout): New function.
4022         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
4023         handler with an extra parameter. Make the elf object before calling
4024         claim_file handler.
4025         * testsuite/plugin_test.c (get_section_count): New function pointer.
4026         (get_section_type): New function pointer.
4027         (get_section_name): New function pointer.
4028         (get_section_contents): New function pointer.
4029         (update_section_order): New function pointer.
4030         (allow_section_ordering): New function pointer.
4031         (onload): Check if the new interfaces exist.
4032
4033 2011-07-13  Ian Lance Taylor  <iant@google.com>
4034
4035         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
4036         relro section.
4037         * x86_64.cc (Target_x86_64::got_section): Likewise.
4038         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
4039         (relro_now_test_SOURCES): New variable.
4040         (relro_now_test_DEPENDENCIES): New variable.
4041         (relro_now_test_LDFLAGS): New variable.
4042         (relro_now_test_LDADD): New variable.
4043         (relro_now_test.so): New target.
4044         * testsuite/Makefile.in: Rebuild.
4045
4046 2011-07-12  Ian Lance Taylor  <iant@google.com>
4047
4048         PR gold/12980
4049         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
4050         GLOB_DAT relocation rather than a RELATIVE relocation for a
4051         protected symbol when creating a shared library.
4052         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
4053         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
4054         * testsuite/protected_main_1.cc (main): Test that protected
4055         function has same address.
4056
4057 2011-07-11  Ian Lance Taylor  <iant@google.com>
4058
4059         PR gold/12979
4060         * options.h (class General_options): Add -Bgroup.
4061         * options.cc (General_options::finalize): If -Bgroup is set,
4062         default to --unresolved-symbols=report-all.
4063         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
4064         * target-reloc.h (issue_undefined_symbol_error): Handle
4065         --unresolved-symbols=report-all.
4066
4067 2011-07-08  Ian Lance Taylor  <iant@google.com>
4068
4069         PR gold/11985
4070         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
4071         if linker script discards key sections.
4072         (Layout::create_dynamic_symtab): Likewise.
4073         (Layout::assign_local_dynsym_offsets): Likewise.
4074         (Layout::sized_create_version_sections): Likewise.
4075         (Layout::create_interp): Likewise.
4076         (Layout::finish_dynamic_section): Likewise.
4077         (Layout::set_dynamic_symbol_size): Likewise.
4078
4079 2011-07-08  Ian Lance Taylor  <iant@google.com>
4080
4081         PR gold/12386
4082         * options.h (class General_options): Add --unresolved-symbols.
4083         * target-reloc.h (issue_undefined_symbol_error): Check
4084         --unresolved-symbols.  Add comments.
4085
4086 2011-07-08  Ian Lance Taylor  <iant@google.com>
4087
4088         * testsuite/odr_violation2.cc (Ordering::operator()): Make
4089         expression more complex.
4090
4091 2011-07-08  Ian Lance Taylor  <iant@google.com>
4092
4093         PR gold/11317
4094         * target-reloc.h (issue_undefined_symbol_error): New inline
4095         function, broken out of relocate_section.
4096         (relocate_section): Call issue_undefined_symbol_error.
4097         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
4098         there is no TLS segment if we are about to issue an undefined
4099         symbol error.
4100         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
4101
4102 2011-07-08  Ian Lance Taylor  <iant@google.com>
4103
4104         PR gold/12279
4105         * resolve.cc (Symbol_table::should_override): Add fromtype
4106         parameter.  Change all callers.  Give error when linking together
4107         TLS and non-TLS symbol.
4108         (Symbol_table::should_override_with_special): Add fromtype
4109         parameter.  Change all callers.
4110         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
4111         there is no TLS segment if we have reported some errors.
4112         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
4113
4114 2011-07-08  Ian Lance Taylor  <iant@google.com>
4115
4116         PR gold/12372
4117         * target.h (Target::plt_address_for_global): New function.
4118         (Target::plt_address_for_local): New function.
4119         (Target::plt_section_for_global): Remove.
4120         (Target::plt_section_for_local): Remove.
4121         (Target::do_plt_address_for_global): New virtual function.
4122         (Target::do_plt_address_for_local): New virtual function.
4123         (Target::do_plt_section_for_global): Remove.
4124         (Target::do_plt_section_for_local): Remove.
4125         (Target::register_global_plt_entry): Add Symbol_table and Layout
4126         parameters.
4127         * output.cc (Output_data_got::Got_entry::write): Use
4128         plt_address_for_global and plt_address_for_local.
4129         * layout.cc (Layout::add_target_dynamic_tags): Use size and
4130         address of output section.
4131         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
4132         got_irelative_, and irelative_count_ fields.  Update
4133         declarations.
4134         (Output_data_plt_i386::has_irelative_section): New function.
4135         (Output_data_plt_i386::entry_count): Add irelative_count_.
4136         (Output_data_plt_i386::set_final_data_size): Likewise.
4137         (class Target_i386): Add got_irelative_ and rel_irelative_
4138         fields.  Update declarations.
4139         (Target_i386::Target_i386): Initialize new fields.
4140         (Target_i386::do_plt_address_for_global): New function replacing
4141         do_plt_section_for_global.
4142         (Target_i386::do_plt_address_for_local): New function replacing
4143         do_plt_section_for_local.
4144         (Target_i386::got_section): Create got_irelative_.
4145         (Target_i386::rel_irelative_section): New function.
4146         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
4147         fields.  Don't define __rel_iplt_{start,end}.
4148         (Output_data_plt_i386::add_entry): Add symtab and layout
4149         parameters.  Change all callers.  Use different PLT and GOT for
4150         IFUNC symbols.
4151         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
4152         layout parameters.  Change all callers.  Use different PLT and
4153         GOT.
4154         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
4155         (Output_data_plt_i386::rel_irelative): New function.
4156         (Output_data_plt_i386::address_for_global): New function.
4157         (Output_data_plt_i386::address_for_local): New function.
4158         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
4159         IRELATIVE GOT when changing IFUNC GOT entries.
4160         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
4161         reloc.
4162         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
4163         if we didn't create an IRELATIVE GOT.
4164         (Target_i386::Relocate::relocate): Use plt_address_for_global and
4165         plt_address_for_local.
4166         (Target_i386::do_dynsym_value): Use plt_address_for_global.
4167         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
4168         got_irelative_, and irelative_count_ fields.  Update
4169         declarations.
4170         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
4171         Initialize new fields.  Remove symtab parameter.  Change all
4172         callers.
4173         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
4174         irelative_count_.
4175         (Output_data_plt_x86_64::has_irelative_section): New function.
4176         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
4177         (class Target_x86_64): Add got_irelative_ and rel_irelative_
4178         fields.  Update declarations.
4179         (Target_x86_64::Target_x86_64): Initialize new fields.
4180         (Target_x86_64::do_plt_address_for_global): New function replacing
4181         do_plt_section_for_global.
4182         (Target_x86_64::do_plt_address_for_local): New function replacing
4183         do_plt_section_for_local.
4184         (Target_x86_64::got_section): Create got_irelative_.
4185         (Target_x86_64::rela_irelative_section): New function.
4186         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
4187         all callers.  Don't create __rel_iplt_{start,end}.
4188         (Output_data_plt_x86_64::add_entry): Add symtab and layout
4189         parameters.  Change all callers.  Use different PLT and GOT for
4190         IFUNC symbols.
4191         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
4192         layout parameters.  Change all callers.  Use different PLT and
4193         GOT.
4194         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
4195         parameters.  Change all callers.  Use different PLT and GOT for
4196         IFUNC symbols.
4197         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
4198         (Output_data_plt_x86_64::rela_irelative): New function.
4199         (Output_data_plt_x86_64::address_for_global): New function.
4200         (Output_data_plt_x86_64::address_for_local): New function.
4201         (Output_data_plt_x86_64::set_final_data_size): Likewise.
4202         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
4203         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
4204         (Target_x86_64::register_global_plt_entry): Add symtab and layout
4205         parameters.
4206         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
4207         reloc.
4208         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
4209         symbols if we didn't create an IRELATIVE GOT.
4210         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
4211         plt_address_for_local.
4212         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
4213         * testsuite/ifuncvar1.c: New test file.
4214         * testsuite/ifuncvar2.c: New test file.
4215         * testsuite/ifuncvar3.c: New test file.
4216         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
4217         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
4218         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
4219         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
4220         * testsuite/Makefile.in: Rebuild.
4221
4222 2011-07-07  Cary Coutant  <ccoutant@google.com>
4223
4224         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
4225         (two_file_test_1_ndebug.o): Likewise.
4226         (two_file_test_1b_ndebug.o): Likewise.
4227         (two_file_test_2_ndebug.o): Likewise.
4228         (two_file_test_main_ndebug.o): Likewise.
4229         (incremental_test_2): Link with no-debug versions.
4230
4231 2011-07-06  Cary Coutant  <ccoutant@google.com>
4232
4233         * gold/incremental.cc
4234         (Output_section_incremental_inputs::write_info_blocks): Check for
4235         hidden and internal symbols.
4236
4237 2011-07-06  Cary Coutant  <ccoutant@google.com>
4238
4239         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
4240         Check disposition for startup file.
4241         (Incremental_inputs::report_command_line): Ignore
4242         --incremental-startup-unchanged option.
4243         * options.cc (General_options::parse_incremental_startup_unchanged):
4244         New function.
4245         (General_options::General_options): Initialize new data member.
4246         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
4247         (General_options): Add --incremental-startup-unchanged option.
4248         (General_options::incremental_startup_disposition): New function.
4249         (General_options::incremental_startup_disposition_): New data member.
4250
4251 2011-07-06  Cary Coutant  <ccoutant@google.com>
4252
4253         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
4254         input file index to Script_info ctor.
4255         (Sized_incremental_binary::do_file_has_changed): Find the
4256         command-line argument for files named in scripts.
4257         * incremental.h (Script_info::Script_info): New ctor
4258         with input file index.
4259         (Script_info::input_file_index): New function.
4260         (Script_info::input_file_index_): New data member.
4261         (Incremental_binary::get_library): Add const.
4262         (Incremental_binary::get_script_info): Add const.
4263         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
4264         * testsuite/Makefile.am (incremental_test_5): New test case.
4265         (incremental_test_6): New test case.
4266         * testsuite/Makefile.in: Regenerate.
4267
4268 2011-07-06  Cary Coutant  <ccoutant@google.com>
4269
4270         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
4271         debug output when command lines differ.
4272
4273 2011-07-06  Cary Coutant  <ccoutant@google.com>
4274
4275         * incremental.cc (Incremental_inputs::report_command_line): Ignore
4276         --incremental-patch option.
4277         * layout.cc (Free_list::allocate): Extend allocation beyond original
4278         end if enabled.
4279         (Layout::make_output_section): Mark sections that should get
4280         patch space.
4281         * options.cc (parse_percent): New function.
4282         * options.h (parse_percent): New function.
4283         (DEFINE_percent): New macro.
4284         (General_options): Add --incremental-patch option.
4285         * output.cc (Output_section::Output_section): Initialize new data
4286         members.
4287         (Output_section::add_input_section): Print section name when out
4288         of patch space.
4289         (Output_section::add_output_section_data): Likewise.
4290         (Output_section::set_final_data_size): Add patch space when
4291         doing --incremental-full.
4292         (Output_section::do_reset_address_and_file_offset): Remove patch
4293         space.
4294         (Output_segment::set_section_list_addresses): Print debug output
4295         only if --incremental-update.
4296         * output.h (Output_section::set_is_patch_space_allowed): New function.
4297         (Output_section::is_patch_space_allowed_): New data member.
4298         (Output_section::patch_space_): New data member.
4299         * parameters.cc (Parameters::incremental_full): New function.
4300         * parameters.h (Parameters::incremental_full): New function
4301         * testsuite/Makefile.am (incremental_test_2): Add test for
4302         --incremental-patch option.
4303         * testsuite/Makefile.in: Regenerate.
4304         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
4305         (t18): Remove function body.
4306
4307 2011-07-05  Doug Kwan  <dougkwan@google.com>
4308
4309         PR gold/12771
4310         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
4311         Arm_Address type for relocation result.
4312         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
4313         overflow check.
4314         (Arm_relocate_functions::abs32): Use unaligned access.
4315         (Arm_relocate_functions::rel32): Ditto.
4316         (Arm_relocate_functions::prel31): Ditto.
4317         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
4318         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
4319         static data relocations.
4320         * testsuite/Makefile.in: Regnerate.
4321         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
4322
4323 2011-07-05  Ian Lance Taylor  <iant@google.com>
4324
4325         PR gold/12392
4326         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
4327         symbols if necessary.
4328         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
4329
4330 2011-07-05  Ian Lance Taylor  <iant@google.com>
4331
4332         PR gold/12952
4333         * resolve.cc (Symbol::override_base_with_special): Simply override
4334         version with special symbol version, ignoring previous version.
4335
4336 2011-07-05  Ian Lance Taylor  <iant@google.com>
4337
4338         * object.cc (Sized_relobj_file::include_section_group): Add
4339         information to comment about signature location.
4340
4341 2011-07-02  Ian Lance Taylor  <iant@google.com>
4342
4343         PR gold/12957
4344         * options.h (class General_options): Add -f and -F.
4345         * options.cc (General_options::finalize): Fatal error if -f/-F
4346         are used without -shared.
4347         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
4348
4349 2011-07-02  Ian Lance Taylor  <iant@google.com>
4350
4351         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
4352
4353 2011-07-01  Ian Lance Taylor  <iant@google.com>
4354
4355         PR gold/12525
4356         PR gold/12952
4357         * resolve.cc (Symbol::override_base_with_special): Don't override
4358         the version if the overriding symbol has a different name.
4359         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
4360         all callers.  If we give an error about an undefined version,
4361         define the base version if necessary.
4362         * dynobj.h (class Versions): Update declaration.
4363         * testsuite/weak_alias_test_5.cc: New file.
4364         * testsuite/weak_alias_test.script: New file.
4365         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
4366         and versioned_alias have the right value, and call t2.
4367         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
4368         weak_alias_test_5.so.
4369         (weak_alias_test_LDADD): Likewise.
4370         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
4371         * testsuite/Makefile.in: Rebuild.
4372
4373 2011-07-01  Ian Lance Taylor  <iant@google.com>
4374
4375         PR gold/12525
4376         * options.h (class General_options): Support -z notext.
4377         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
4378         -Wl,-z,notext.
4379         (two_file_shared_nonpic.so): Likewise.
4380         (two_file_shared_mixed.so): Likewise.
4381         (two_file_shared_mixed_1.so): Likewise.
4382         (weak_undef_lib_nonpic.so): Likewise.
4383         (alt/weak_undef_lib_nonpic.so): Likewise.
4384         (tls_test_shared_nonpic.so): Likewise.
4385         * testsuite/Makefile.in: Rebuild.
4386
4387 2011-07-01  Ian Lance Taylor  <iant@google.com>
4388
4389         PR gold/12525
4390         * configure.ac: Test whether static linking works, setting
4391         the automake conditional HAVE_STATIC.
4392         * testsuite/Makefile.am: Disable tests using -static if
4393         HAVE_STATIC is not true.
4394         * configure, testsuite/Makefile.in: Rebuild.
4395
4396 2011-07-01  Ian Lance Taylor  <iant@google.com>
4397
4398         PR gold/12525
4399         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
4400         Assert if we see DW_EH_PE_indirect.
4401         * target.h (Target::ehframe_datarel_base): New function.
4402         (Target::do_ehframe_datarel_base): New target function.
4403         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
4404         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
4405         function.
4406
4407 2011-07-01  Ian Lance Taylor  <iant@google.com>
4408
4409         PR gold/12571
4410         * options.h (class General_options): Add
4411         --ld-generated-unwind-info.
4412         * ehframe.cc (Fde::write): Add address parameter.  Change all
4413         callers.  If associated with PLT, fill in address and size.
4414         (Cie::set_output_offset): Only add merge mapping if there is an
4415         object.
4416         (Cie::write): Add address parameter.  Change all callers.
4417         (Eh_frame::add_ehframe_for_plt): New function.
4418         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
4419         input_offset_ fields into union u_, with new plt field.
4420         (Fde::Fde): Adjust for new union field.
4421         (Fde::Fde) [Output_data version]: New constructor.
4422         (Fde::add_mapping): Only add merge mapping if there is an object.
4423         (class Cie): Update declarations.
4424         (class Eh_frame): Declare add_ehframe_for_plt.
4425         * layout.cc (Layout::layout_eh_frame): Break out code into
4426         make_eh_frame_section, and call it.
4427         (Layout::make_eh_frame_section): New function.
4428         (Layout::add_eh_frame_for_plt): New function.
4429         * layout.h (class Layout): Update declarations.
4430         * merge.cc (Merge_map::add_mapping): Add assertion.
4431         * i386.cc: Include "dwarf.h".
4432         (class Output_data_plt_i386): Make first_plt_entry,
4433         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
4434         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
4435         and plt_eh_frame_fde.
4436         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
4437         boundary.  Call add_eh_frame_for_plt if appropriate.
4438         * x86_64.cc: Include "dwarf.h".
4439         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
4440         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
4441         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
4442         and plt_eh_frame_fde.
4443         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
4444         appropriate.
4445
4446 2011-06-29  Ian Lance Taylor  <iant@google.com>
4447
4448         PR gold/12629
4449         * object.cc (Sized_relobj_file::layout_section): Change shdr
4450         parameter to be const.
4451         (Sized_relobj_file::layout_eh_frame_section): New function, broken
4452         out of do_layout.
4453         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
4454         appropriate.  Call layout_eh_frame_section.
4455         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
4456         sections.
4457         * object.h (class Sized_relobj_file): Update declarations.
4458
4459 2011-06-29  Ian Lance Taylor  <iant@google.com>
4460
4461         PR gold/12652
4462         * script.cc (Token::integer_value): Accept trailing M/m/K/k
4463         modifier.
4464         (Lex::gather_token): Accept trailing M/m/K/k for integers.
4465
4466 2011-06-29  Ian Lance Taylor  <iant@google.com>
4467
4468         PR gold/12675
4469         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
4470         SHT_X86_64_UNWIND.
4471         * layout.cc (Layout::layout_eh_frame): Likewise.
4472
4473 2011-06-29  Ian Lance Taylor  <iant@google.com>
4474
4475         PR gold/12695
4476         * layout.cc (Layout::symtab_section_shndx): New function.
4477         * layout.h (class Layout): Declare symtab_section_shndx.
4478         * output.cc (Output_section::write_header): Call it.
4479
4480 2011-06-29  Ian Lance Taylor  <iant@google.com>
4481
4482         PR gold/12818
4483         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
4484         symbols which are not used in a relocation.
4485
4486 2011-06-28  Ian Lance Taylor  <iant@google.com>
4487
4488         PR gold/12898
4489         * layout.cc (Layout::segment_precedes): Don't crash if a linker
4490         script create indistinguishable segments.
4491         (Layout::set_segment_offsets): Use stable_sort when sorting
4492         segments.  Pass this to Compare_segments constructor.
4493         * layout.h (class Layout): Make segment_precedes non-static.
4494         (class Compare_segments): Change from struct to class.  Add
4495         layout_ field.  Add constructor.
4496         * script-sections.cc
4497         (Script_sections::attach_sections_using_phdrs_clause): Rename
4498         local orphan to is_orphan.  Don't report failure to put empty
4499         section in segment.  On attachment failure, report name of
4500         section, and attach to first PT_LOAD segment.
4501
4502 2011-06-28  Ian Lance Taylor  <iant@google.com>
4503
4504         PR gold/12934
4505         * target-select.cc (Target_selector::Target_selector): Add
4506         emulation parameter.  Change all callers.
4507         (select_target_by_bfd_name): Rename from select_target_by_name.
4508         Change all callers.
4509         (select_target_by_emulation): New function.
4510         (supported_emulation_names): New function.
4511         * target-select.h (class Target_selector): Add emulation_ field.
4512         Update declarations.
4513         (Target_selector::recognize_by_bfd_name): Rename from
4514         recognize_by_name.  Change all callers.
4515         (Target_selector::supported_bfd_names): Rename from
4516         supported_names.  Change all callers.
4517         (Target_selector::recognize_by_emulation): New function.
4518         (Target_selector::supported_emulations): New function.
4519         (Target_selector::emulation): New function.
4520         (Target_selector::do_recognize_by_bfd_name): Rename from
4521         do_recognize_by_name.  Change all callers.
4522         (Target_selector::do_supported_bfd_names): Rename from
4523         do_supported_names.  Change all callers.
4524         (Target_selector::do_recognize_by_emulation): New function.
4525         (Target_selector::do_supported_emulations): New function.
4526         (select_target_by_bfd_name): Change name in declaration.
4527         (select_target_by_emulation): Declare.
4528         (supported_emulation_names): Declare.
4529         * parameters.cc (parameters_force_valid_target): Try to find
4530         target based on emulation from -m option.
4531         * options.h (class General_options): Change doc string for -m.
4532         * options.cc (help): Print emulations.
4533         (General_options::parse_V): Likewise.
4534         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
4535         Add emulation parameter.  Change all callers.
4536
4537 2011-06-28  Ian Lance Taylor  <iant@google.com>
4538
4539         * target.h (class Target): Add osabi_ field.
4540         (Target::osabi): New function.
4541         (Target::set_osabi): New function.
4542         (Target::Target): Initialize osabi_.
4543         (Target::do_adjust_elf_header): Make pure virtual.
4544         (Sized_target::do_adjust_elf_header): Declare.
4545         * target.cc (Sized_target::do_adjust_elf_header): New function.
4546         (class Sized_target): Instantiate all versions.
4547         * freebsd.h (class Target_freebsd): Remove.
4548         (Target_selector_freebsd::do_recognize): Call set_osabi on
4549         Target.
4550         (Target_selector_freebsd::do_recognize_by_name): Likewise.
4551         (Target_selector_freebsd::set_osabi): Remove.
4552         * i386.cc (class Target_i386): Inherit from Sized_target rather
4553         than Target_freebsd.
4554         * x86_64.cc (class Target_x86_64): Likewise.
4555
4556 2011-06-28  Ian Lance Taylor  <iant@google.com>
4557
4558         * target.h (Target::can_check_for_function_pointers): Rewrite.
4559         Make non-virtual.
4560         (Target::can_icf_inline_merge_sections): Likewise.
4561         (Target::section_may_have_icf_unsafe_poineters): Likewise.
4562         (Target::Target_info): Add can_icf_inline_merge_sections field.
4563         (Target::do_can_check_for_function_pointers): New virtual
4564         function.
4565         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
4566         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
4567         from can_check_for_function_pointers, move in file.
4568         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
4569         section_may_have_icf_unsafe_poineters, move in file.
4570         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
4571         * i386.cc (Target_i386::do_can_check_for_function_pointers):
4572         Rename from can_check_for_function_pointers, move in file.
4573         (Target_i386::can_icf_inline_merge_sections): Remove.
4574         (Target_i386::i386_info): Initialize
4575         can_icf_inline_merge_sections.
4576         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
4577         Initialize can_icf_inline_merge_sections.
4578         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
4579         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
4580         Rename from can_check_for_function_pointers, move in file.
4581         (Target_x86_64::can_icf_inline_merge_sections): Remove.
4582         (Target_x86_64::x86_64_info): Initialize
4583         can_icf_inline_merge_sections.
4584         * testsuite/testfile.cc (Target_test::test_target_info):
4585         Likewise.
4586         * icf.cc (get_section_contents): Correct formatting.
4587
4588 2011-06-27  Ian Lance Taylor  <iant@google.com>
4589
4590         * symtab.cc (Symbol::versioned_name): New function.
4591         (Symbol_table::add_to_final_symtab): Use versioned_name when
4592         appropriate.
4593         (Symbol_table::sized_write_symbol): Likewise.
4594         * symtab.h (class Symbol): Declare versioned_name.
4595         * stringpool.h (class Stringpool_template): Add variant of add
4596         which takes a std::basic_string.
4597         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
4598         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
4599         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
4600         (ver_test_12.o): New target.
4601         * testsuite/Makefile.in: Rebuild.
4602
4603 2011-06-27  Doug Kwan  <dougkwan@google.com>
4604
4605         * arm.cc (Arm_relocate_functions::thm_jump8,
4606         Arm_relocate_functions::thm_jump11): Use a wider signed
4607         type to compute offset.
4608         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
4609         arm_thm_jump8.
4610         * testsuite/Makefile.in: Regenerate.
4611         * testsuite/arm_branch_in_range.sh: Check test results of
4612         arm_thm_jump11 and arm_thm_jump8.
4613         * testsuite/arm_thm_jump11.s: New test source file.
4614         * testsuite/arm_thm_jump11.t: New linker script.
4615         * testsuite/arm_thm_jump8.s: New test source file.
4616         * testsuite/arm_thm_jump8.t: New linker script.
4617
4618 2011-06-24  Ian Lance Taylor  <iant@google.com>
4619
4620         * layout.cc: Include "object.h".
4621         (ctors_sections_in_init_array): New static variable.
4622         (Layout::is_ctors_in_init_array): New function.
4623         (Layout::layout): Add entry to ctors_sections_in_init_array if
4624         appropriate.
4625         * layout.h (class Layout): Declare is_ctors_in_init_array.
4626         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
4627         is_ctors_reverse_view is set.
4628         (Sized_relobj_file::write_sections): Add layout parameter.  Change
4629         all callers.  Set is_ctors_reverse_view field of View_size.
4630         (Sized_relobj_file::reverse_words): New function.
4631         * object.h (Sized_relobj_file::View_size): Add
4632         is_ctors_reverse_view field.
4633         (class Sized_relobj_file): Update declarations.
4634         * testsuite/initpri3.c: New test.
4635         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
4636         initpri3b.
4637         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
4638         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
4639         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
4640         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
4641         * testsuite/Makefile.in: Rebuild.
4642
4643 2011-06-24  Cary Coutant  <ccoutant@google.com>
4644
4645         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
4646         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
4647         (debug_msg_cdebug.err): New targets.
4648         * testsuite/Makefile.in: Regenerate.
4649         * testsuite/debug_msg.sh: Check output of link with compressed debug.
4650         Fix checks for link with shared library.
4651
4652 2011-06-24  Doug Kwan  <dougkwan@google.com>
4653
4654         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
4655         skip empty text sections.
4656         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
4657
4658 2011-06-22  Ian Lance Taylor  <iant@google.com>
4659
4660         PR gold/12910
4661         * options.h (class General_options): Add --ctors-in-init-array.
4662         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
4663         friends as SHT_PROGBITS for merging sections.
4664         (Layout::layout): Remove special handling of .init_array and
4665         friends.  Don't sort if doing relocatable link.  Sort for .ctors
4666         and .dtors if ctors_in_init_array.
4667         (Layout::make_output_section): Force correct section types for
4668         .init_array and friends.  Don't sort if doing relocatable link,
4669         Don't sort .ctors and .dtors if ctors_in_init_array.
4670         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
4671         (Layout::output_section_name): Add relobj parameter.  Change all
4672         callers.  Handle .ctors. and .dtors. in code rather than table.
4673         Handle .ctors and .dtors if ctors_in_init_array.
4674         (Layout::match_file_name): New function, moved from output.cc.
4675         * layout.h (class Layout): Update declarations.
4676         * output.cc: Include "layout.h".
4677         (Input_section_sort_entry::get_priority): New function.
4678         (Input_section_sort_entry::match_file_name): Just call
4679         Layout::match_file_name.
4680         (Output_section::Input_section_sort_init_fini_compare::operator()):
4681         Handle .ctors and .dtors.  Sort by explicit priority rather than
4682         by name.
4683         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
4684         * testsuite/initpri2.c: New test.
4685         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
4686         (check_PROGRAMS): Add initpri2.
4687         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
4688         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
4689         * configure, testsuite/Makefile.in: Rebuild.
4690
4691 2011-06-19  Ian Lance Taylor  <iant@google.com>
4692
4693         PR gold/12880
4694         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
4695         .interp section to a PT_INTERP segment even if we have seen a
4696         --dynamic-linker option.  Don't do it if we have seen a PHDRS
4697         clause in a linker script.
4698         (Layout::finalize): Don't create a .interp section if we've
4699         already create a PT_INTERP segment.
4700         (Layout::create_interp): Always call choose_output_section (revert
4701         patch of 2011-06-17).  Don't create PT_INTERP segment.
4702         * script-sections.cc
4703         (Script_sections::create_note_and_tls_segments): Add a .interp
4704         section to a PT_INTERP segment even if we have seen a
4705         --dynamic-linker option.
4706
4707 2011-06-18  Ian Lance Taylor  <iant@google.com>
4708
4709         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
4710         merely because a non-PT_LOAD segment has a dynamic reloc.
4711
4712 2011-06-18  Ian Lance Taylor  <iant@google.com>
4713
4714         * layout.cc (Layout::finish_dynamic_section): Don't create
4715         DT_FLAGS entry if not needed.
4716
4717 2011-06-18  Ian Lance Taylor  <iant@google.com>
4718
4719         PR gold/12745
4720         * layout.cc (Layout::layout_eh_frame): Correct handling of
4721         writable .eh_frame section.
4722
4723 2011-06-17  Ian Lance Taylor  <iant@google.com>
4724
4725         PR gold/12893
4726         * resolve.cc (Symbol_table::resolve): Don't give an error if a
4727         symbol is redefined with the exact same object and value.
4728
4729 2011-06-17  Ian Lance Taylor  <iant@google.com>
4730
4731         PR gold/12880
4732         * layout.h (class Layout): Add interp_segment_ field.
4733         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
4734         (Layout::attach_allocated_section_to_segment): If making shared
4735         library, put .interp section in PT_INTERP segment.
4736         (Layout::finalize): Also call create_interp if -dynamic-linker
4737         option was used.
4738         (Layout::create_interp): Assert that there is no PT_INTERP
4739         segment.  If not using a SECTIONS clause, use make_output_section.
4740         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
4741         * script-sections.cc
4742         (Script_sections::create_note_and_tls_segments): If making shared
4743         library, put .interp section in PT_INTERP segment.
4744
4745 2011-06-17  Ian Lance Taylor  <iant@google.com>
4746
4747         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
4748         when making a shared library.
4749
4750 2011-06-17  Ian Lance Taylor  <iant@google.com>
4751
4752         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
4753         parameter.  Change all callers.  Don't issue warning about PC32
4754         against locally defined symbol.
4755
4756 2011-06-16  Ian Lance Taylor  <iant@google.com>
4757
4758         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
4759         occurs in same object.
4760
4761 2011-06-14  Alan Modra  <amodra@gmail.com>
4762
4763         * po/POTFILES.in: Regenerate.
4764
4765 2011-06-09  Ian Lance Taylor  <iant@google.com>
4766
4767         * script-sections.cc
4768         (Orphan_output_section::set_section_addresses): For a relocatable
4769         link set address to 0.
4770
4771 2011-06-09  Cary Coutant  <ccoutant@google.com>
4772
4773         PR gold/12804
4774         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
4775         used with --compress-debug-sections.
4776         * gold/object.cc (Sized_relobj_file::do_layout): Report
4777         uncompressed size of compressed input sections.
4778
4779 2011-06-08  Cary Coutant  <ccoutant@google.com>
4780
4781         PR gold/12804
4782         * testsuite/two_file_test_2_v1.cc: Change initialization of
4783         v2 to keep it in .data.
4784
4785 2011-06-07  Cary Coutant  <ccoutant@google.com>
4786
4787         * common.cc (Symbol_table::do_allocate_commons_list): Call
4788         gold_fallback.
4789         * errors.cc (Errors::fatal): Adjust call to gold_exit.
4790         (Errors::fallback): New function.
4791         (gold_fallback): New function.
4792         * errors.h (Errors::fallback): New function.
4793         * gold.cc (gold_exit): Change status parameter to enum; adjust
4794         all callers.
4795         (queue_initial_tasks): Call gold_fallback.
4796         * gold.h: Include cstdlib.
4797         (Exit_status): New enum type.
4798         (gold_exit): Change status parameter to enum.
4799         (gold_fallback): New function.
4800         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
4801         (Layout::create_symtab_sections): Likewise.
4802         (Layout::create_shdrs): Likewise.
4803         * main.cc (main): Adjust call to gold_exit.
4804         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
4805         (Output_data_got::add_got_entry_pair): Likewise.
4806         (Output_section::add_input_section): Likewise.
4807         (Output_section::add_output_section_data): Likewise.
4808         (Output_segment::set_section_list_addresses): Likewise.
4809         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
4810
4811 2011-06-07  Cary Coutant  <ccoutant@google.com>
4812
4813         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
4814         for incremental links.
4815         * output.cc (Output_segment::set_section_list_addresses): Remove
4816         FIXME and test for TLS or BSS.
4817
4818 2011-06-07  Cary Coutant  <ccoutant@google.com>
4819
4820         * testsuite/Makefile.am: Add incremental_copy_test,
4821         incremental_common_test_1.
4822         * testsuite/Makefile.in: Regenerate.
4823         * testsuite/common_test_1_v1.c: New source file.
4824         * testsuite/common_test_1_v2.c: New source file.
4825         * testsuite/copy_test_v1.cc: New source file.
4826
4827 2011-06-07  Cary Coutant  <ccoutant@google.com>
4828
4829         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
4830         update, allocate common from bss section's free list.
4831         * incremental-dump.cc (dump_incremental_inputs): Print flag for
4832         linker-defined symbols.
4833         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
4834         Skip GOT and PLT entries that are no longer referenced.
4835         (Output_section_incremental_inputs::write_info_blocks): Mark
4836         linker-defined symbols.
4837         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
4838         * output.cc (Output_section::allocate): New function.
4839         * output.h (Output_section::allocate): New function.
4840         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
4841         linker-defined symbols.
4842         (Symbol::override_base_with_special): Copy is_predefined_ flag.
4843         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
4844         (Symbol::init_base_output_data): Likewise.
4845         (Symbol::init_base_output_segment): Likewise.
4846         (Symbol::init_base_constant): Likewise.
4847         (Sized_symbol::init_output_data): Likewise.
4848         (Sized_symbol::init_output_segment): Likewise.
4849         (Sized_symbol::init_constant): Likewise.
4850         (Symbol_table::do_define_in_output_data): Likewise.
4851         (Symbol_table::do_define_in_output_segment): Likewise.
4852         (Symbol_table::do_define_as_constant): Likewise.
4853         * symtab.h (Symbol::is_predefined): New function.
4854         (Symbol::init_base_output_data): Add is_predefined parameter.
4855         (Symbol::init_base_output_segment): Likewise.
4856         (Symbol::init_base_constant): Likewise.
4857         (Symbol::is_predefined_): New data member.
4858         (Sized_symbol::init_output_data): Add is_predefined parameter.
4859         (Sized_symbol::init_output_segment): Likewise.
4860         (Sized_symbol::init_constant): Likewise.
4861         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
4862
4863 2011-06-07  Cary Coutant  <ccoutant@google.com>
4864
4865         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
4866         instead of emit_copy_reloc.
4867         (Copy_relocs::emit_copy_reloc): Refactor.
4868         (Copy_relocs::make_copy_reloc): New function.
4869         (Copy_relocs::add_copy_reloc): Remove.
4870         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
4871         section.
4872         (Copy_relocs::make_copy_reloc): New function.
4873         (Copy_relocs::add_copy_reloc): Remove.
4874         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
4875         unchanged input files.
4876         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
4877         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
4878         Reserve BSS space for COPY relocations.
4879         (Sized_incremental_binary::do_emit_copy_relocs): New function.
4880         (Output_section_incremental_inputs::write_info_blocks): Record
4881         whether a symbol is copied from a shared object.
4882         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
4883         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
4884         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
4885         (Incremental_input_entry_reader::get_output_symbol_index): Add
4886         is_copy parameter.
4887         (Incremental_binary::emit_copy_relocs): New function.
4888         (Incremental_binary::do_emit_copy_relocs): New function.
4889         (Sized_incremental_binary::Sized_incremental_binary): Initialize
4890         new data member.
4891         (Sized_incremental_binary::add_copy_reloc): New function.
4892         (Sized_incremental_binary::do_emit_copy_relocs): New function.
4893         (Sized_incremental_binary::Copy_reloc): New struct.
4894         (Sized_incremental_binary::Copy_relocs): New typedef.
4895         (Sized_incremental_binary::copy_relocs_): New data member.
4896         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
4897         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
4898         * target.h (Sized_target::emit_copy_reloc): New function.
4899         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
4900
4901 2011-06-02  Cary Coutant  <ccoutant@google.com>
4902
4903         PR gold/12163
4904         * gold/archive.cc (Archive::Archive): Initialize new data member.
4905         (Archive::include_all_members): Return if archive has already been
4906         included.
4907         * gold/archive.h (Archive::include_all_members_): New data member.
4908
4909 2011-06-02  Nick Clifton  <nickc@redhat.com>
4910
4911         * dynobj.h: Fix spelling mistake in comment.
4912         * output.cc: Likewise.
4913
4914 2011-05-31  Doug Kwan  <dougkwan@google.com>
4915             Asier Llano
4916
4917         PR gold/12826
4918         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
4919         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
4920         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
4921         redundant arm_exidx_test.so.
4922         * testsuite/Makefile.in: Regenerate.
4923         (check_SCRIPTS): Add pr12826.sh
4924         (check_DATA): Add pr12826.stdout
4925         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
4926         * testsuite/pr12826.sh: New file.
4927         * testsuite/pr12826_1.s: Ditto.
4928         * testsuite/pr12826_1.s: Ditto.
4929
4930 2011-05-30  Ian Lance Taylor  <iant@google.com>
4931
4932         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
4933         sections.
4934
4935 2011-05-29  Ian Lance Taylor  <iant@google.com>
4936
4937         PR gold/12804
4938         * testsuite/Makefile.am: Use different file name for two_file_test
4939         temporary file for each incremental test.
4940         * testsuite/Makefile.in: Rebuild.
4941
4942 2011-05-29  Ian Lance Taylor  <iant@google.com>
4943
4944         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
4945         binary input file is empty.
4946
4947 2011-05-27  Ian Lance Taylor  <iant@google.com>
4948
4949         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
4950         (ver_test_9.so): Likewise.
4951         * testsuite/Makefile.in: Rebuild.
4952
4953 2011-05-26 Cary Coutant  <ccoutant@google.com>
4954
4955         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
4956         * incremental.cc (Incremental_inputs::report_input_section): Fix
4957         comment, indentation.
4958         (Incremental_inputs::report_comdat_group): New function.
4959         (Output_section_incremental_inputs::set_final_data_size): Adjust size
4960         of data for incremental input file entry.
4961         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
4962         group count, COMDAT group signatures.
4963         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
4964         an unchanged input file.
4965         * incremental.h (Incremental_object_entry::Incremental_object_entry):
4966         Initialize new data member.
4967         (Incremental_object_entry::add_comdat_group): New function.
4968         (Incremental_object_entry::get_comdat_group_count): New function.
4969         (Incremental_object_entry::get_comdat_signature_key): New function.
4970         (Incremental_object_entry::groups_): New data member.
4971         (Incremental_inputs::report_comdat_group): New function.
4972         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
4973         data for incremental input file entry.
4974         (Incremental_input_entry_reader::get_comdat_group_count): New function.
4975         (Incremental_input_entry_reader::get_input_section): Adjust size of
4976         data for incremental input file entry.
4977         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
4978         (Incremental_input_entry_reader::get_comdat_group_signature): New
4979         function.
4980         * object.cc (Sized_relobj::include_section_group): Report kept
4981         COMDAT groups for incremental links.
4982
4983 2011-05-24  David Meyer  <pdox@google.com>
4984
4985         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
4986         with name parameter.  Add found_name parameter.
4987         * fileread.cc (Input_file::find_file): Adjust code accordingly.
4988         * dirsearch.h (class Dirsearch): Update declaration.
4989
4990 2011-05-24  Ian Lance Taylor  <iant@google.com>
4991
4992         * archive.cc (Library_base::should_include_member): Pull in object
4993         from archive if it defines the entry symbol.
4994         * parameters.cc (Parameters::entry): New function.
4995         * parameters.h (class Parameters): Declare entry.
4996         * output.h (class Output_file_header): Remove entry_ field.
4997         * output.cc (Output_file_header::Output_file_header): Remove entry
4998         parameter.  Change all callers.
4999         (Output_file_header::entry): Use parameters->entry.
5000         * gold.cc (queue_middle_tasks): Likewise.
5001         * plugin.cc (Plugin_hook::run): Likewise.
5002
5003 2011-05-24 Cary Coutant  <ccoutant@google.com>
5004
5005         * gold.cc (queue_initial_tasks): Pass incremental base filename
5006         to Output_file::open_base_file; don't print error message.
5007         * incremental-dump.cc (main): Adjust call to
5008         Output_file::open_for_modification.
5009         * incremental-dump.cc (main): Likewise.
5010         * incremental.cc (Incremental_inputs::report_command_line):
5011         Ignore --incremental-base option when comparing command lines.
5012         Ignore parameter when given as separate argument.
5013         * options.h (class General_options): Add --incremental-base.
5014         * output.cc (Output_file::Output_file):
5015         (Output_file::open_base_file): Add base_name and writable parameters;
5016         read base file into new file; print error message here.
5017         (Output_file::map_no_anonymous): Add writable parameter; adjust all
5018         callers.
5019         * output.h (Output_file::open_for_modification): Rename to...
5020         (Output_file::open_base_file): ...this; add base_name and
5021         writable parameters; adjust all callers.
5022         (Output_file::map_no_anonymous): Add writable parameter; adjust all
5023         callers.
5024         * testsuite/Makefile.am (incremental_test_4): Test
5025         --incremental-base.
5026         * testsuite/Makefile.in: Regenerate.
5027
5028 2011-05-24 Cary Coutant  <ccoutant@google.com>
5029
5030         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
5031         incremental_test_4.
5032         * testsuite/Makefile.in: Regenerate.
5033         * testsuite/two_file_test_1_v1.cc: New test source file.
5034         * testsuite/two_file_test_1b_v1.cc: New test source file.
5035         * testsuite/two_file_test_2_v1.cc: New test source file.
5036
5037 2011-05-24 Cary Coutant  <ccoutant@google.com>
5038
5039         * dynobj.h (Dynobj::do_dynobj): New function.
5040         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
5041         flag and soname for shared objects.
5042         * incremental.cc (Incremental_inputs::report_object): Make
5043         either Incremental_object_entry or Incremental_dynobj_entry; add
5044         soname to string table.
5045         (Incremental_inputs::report_input_section): Add assertion.
5046         (Output_section_incremental_inputs::set_final_data_size): Adjust
5047         type of input file entry for shared libraries; adjust size of
5048         shared library info entry.
5049         (Output_section_incremental_inputs::write_input_files): Write
5050         as_needed flag for shared libraries.
5051         (Output_section_incremental_inputs::write_info_blocks): Adjust type
5052         of input file entry for shared libraries; write soname.
5053         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
5054         soname from incremental info.
5055         * incremental.h (enum Incremental_input_flags): Add
5056         INCREMENTAL_INPUT_AS_NEEDED.
5057         (Incremental_input_entry::Incremental_input_entry): Initialize new
5058         data member.
5059         (Incremental_input_entry::set_as_needed): New function.
5060         (Incremental_input_entry::as_needed): New function.
5061         (Incremental_input_entry::do_dynobj_entry): New function.
5062         (Incremental_input_entry::as_needed_): New data member.
5063         (Incremental_object_entry::Incremental_object_entry): Don't check
5064         for shared library.
5065         (Incremental_object_entry::do_type): Likewise.
5066         (class Incremental_dynobj_entry): New class.
5067         (Incremental_input_entry_reader::as_needed): New function.
5068         (Incremental_input_entry_reader::get_soname): New function.
5069         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
5070         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
5071         size of shared library info entry.
5072         * layout.cc (Layout::finish_dynamic_section): Don't test for
5073         incremental link when adding DT_NEEDED entries.
5074         * object.h (Object::Object): Initialize new data member.
5075         (Object::dynobj): New function.
5076         (Object::set_as_needed): New function.
5077         (Object::as_needed): New function.
5078         (Object::do_dynobj): New function.
5079         (Object::as_needed_): New data member.
5080
5081 2011-05-24 Cary Coutant  <ccoutant@google.com>
5082
5083         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
5084         info; adjust display of GOT entries.
5085         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
5086         vector of input objects; remove file_status_.
5087         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
5088         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
5089         got_plt reader; call target hooks to reserve GOT entries.
5090         (Output_section_incremental_inputs::set_final_data_size): Adjust size
5091         of input file info header and GOT info entry.
5092         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
5093         relocation info.
5094         (Got_plt_view_info::got_descriptor): Remove.
5095         (Got_plt_view_info::sym_index): New data member.
5096         (Got_plt_view_info::input_index): New data member.
5097         (Local_got_offset_visitor::visit): Write input file index.
5098         (Global_got_offset_visitor::visit): Write 0 for input file index.
5099         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
5100         with sym_index and input_index.
5101         (Output_section_incremental_inputs::write_got_plt): Adjust size of
5102         incremental info GOT entry; replace got_descriptor with input_index.
5103         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
5104         map from input file index to object.
5105         (Sized_relobj_incr::do_layout): Replace direct data member reference
5106         with accessor function.
5107         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
5108         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
5109         Adjust size of input file info header.
5110         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
5111         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
5112         (Incremental_input_entry_reader::get_input_section): Adjust size of
5113         input file info header.
5114         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
5115         of incremental info GOT entry.
5116         (Incremental_got_plt_reader::get_got_desc): Remove.
5117         (Incremental_got_plt_reader::get_got_symndx): New function.
5118         (Incremental_got_plt_reader::get_got_input_index): New function.
5119         (Sized_incremental_binary::Sized_incremental_binary): Remove
5120         file_status_; add input_objects_.
5121         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
5122         (Sized_incremental_binary::set_file_is_unchanged): Remove.
5123         (Sized_incremental_binary::file_is_unchanged): Remove.
5124         (Sized_incremental_binary::set_input_object): New function.
5125         (Sized_incremental_binary::input_object): New function.
5126         (Sized_incremental_binary::file_status_): Remove.
5127         (Sized_incremental_binary::input_objects_): New data member.
5128         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
5129         references.
5130         (Sized_relobj_incr::invalid_address): Move to base class.
5131         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
5132         class.
5133         (Sized_relobj_incr::do_output_section_offset): Likewise.
5134         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
5135         (Sized_relobj_incr::section_offsets_): Likewise.
5136         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
5137         function.
5138         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
5139         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
5140         with accessor function.
5141         (Sized_relobj_file::do_layout): Likewise.
5142         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
5143         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
5144         (Sized_relobj_file::compute_final_local_value): Replace refs to
5145         section_offsets_ with accessor function.
5146         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
5147         * object.h (Relobj::Relobj): Initialize new data members.
5148         (Relobj::add_dyn_reloc): New function.
5149         (Relobj::first_dyn_reloc): New function.
5150         (Relobj::dyn_reloc_count): New function.
5151         (Relobj::first_dyn_reloc_): New data member.
5152         (Relobj::dyn_reloc_count_): New data member.
5153         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
5154         references.
5155         (Sized_relobj::Address): New typedef.
5156         (Sized_relobj::invalid_address): Move here from child class.
5157         (Sized_relobj::Sized_relobj): Initialize new data members.
5158         (Sized_relobj::sized_relobj): New function.
5159         (Sized_relobj::is_output_section_offset_invalid): Move here from
5160         child class.
5161         (Sized_relobj::get_output_section_offset): Likewise.
5162         (Sized_relobj::local_has_got_offset): Likewise.
5163         (Sized_relobj::local_got_offset): Likewise.
5164         (Sized_relobj::set_local_got_offset): Likewise.
5165         (Sized_relobj::do_for_all_local_got_entries): Likewise.
5166         (Sized_relobj::clear_got_offsets): New function.
5167         (Sized_relobj::section_offsets): Move here from child class.
5168         (Sized_relobj::do_output_section_offset): Likewise.
5169         (Sized_relobj::do_set_section_offset): Likewise.
5170         (Sized_relobj::Local_got_offsets): Likewise.
5171         (Sized_relobj::local_got_offsets_): Likewise.
5172         (Sized_relobj::section_offsets_): Likewise.
5173         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
5174         references.
5175         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
5176         class.
5177         (Sized_relobj_file::sized_relobj): New function
5178         (Sized_relobj_file::local_has_got_offset): Move to base class.
5179         (Sized_relobj_file::local_got_offset): Likewise.
5180         (Sized_relobj_file::set_local_got_offset): Likewise.
5181         (Sized_relobj_file::get_output_section_offset): Likewise.
5182         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
5183         (Sized_relobj_file::do_output_section_offset): Likewise.
5184         (Sized_relobj_file::do_set_section_offset): Likewise.
5185         (Sized_relobj_file::Local_got_offsets): Likewise.
5186         (Sized_relobj_file::local_got_offsets_): Likewise.
5187         (Sized_relobj_file::section_offsets_): Likewise.
5188         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
5189         (all constructors).
5190         (set_needs_dynsym_index): Convert relobj to derived class pointer.
5191         (Output_reloc::get_symbol_index): Likewise.
5192         (Output_reloc::local_section_offset): Likewise.
5193         (Output_reloc::get_address): Likewise.
5194         (Output_reloc::symbol_value): Likewise.
5195         (Output_data_got::reserve_slot): Move to class definition.
5196         (Output_data_got::reserve_local): New function.
5197         (Output_data_got::reserve_slot_for_global): Remove.
5198         (Output_data_got::reserve_global): New function.
5199         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
5200         (all constructors, two instantiations).
5201         (Output_reloc::get_relobj): New function (two instantiations).
5202         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
5203         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
5204         (Output_data_reloc::add_global): Adjust type of relobj.
5205         (Output_data_reloc::add_global_relative): Likewise.
5206         (Output_data_reloc::add_symbolless_global_addend): Likewise.
5207         (Output_data_reloc::add_local): Likewise.
5208         (Output_data_reloc::add_local_relative): Likewise.
5209         (Output_data_reloc::add_symbolless_local_addend): Likewise.
5210         (Output_data_reloc::add_local_section): Likewise.
5211         (Output_data_reloc::add_output_section): Likewise.
5212         (Output_data_reloc::add_absolute): Likewise.
5213         (Output_data_reloc::add_target_specific): Likewise.
5214         (Output_data_got::reserve_slot): Move definition here.
5215         (Output_data_got::reserve_local): New function.
5216         (Output_data_got::reserve_global): New function.
5217         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
5218         section_offsets_ with accessor function.
5219         (Sized_relobj_file::write_sections): Likewise.
5220         (Sized_relobj_file::do_relocate_sections): Likewise.
5221         * target.h (Sized_target::reserve_local_got_entry): New function.
5222         (Sized_target::reserve_global_got_entry): New function.
5223         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
5224         (Target_x86_64::reserve_global_got_entry): New function.
5225         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
5226
5227 2011-05-23 Cary Coutant  <ccoutant@google.com>
5228
5229         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
5230         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
5231         bit when checking got_type.
5232         * incremental.cc (Sized_incremental_binary::setup_readers):
5233         Store symbol table and string table locations; initialize bit vector
5234         of file status flags.
5235         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
5236         unchanged files.
5237         (Sized_incremental_binary::do_process_got_plt): New function.
5238         (Sized_incremental_binary::get_symtab_view): Use stored locations.
5239         (Output_section_incremental_inputs::set_final_data_size): Record
5240         file index for each input file.
5241         (Output_section_incremental_inputs::write_got_plt): Store file index
5242         instead of input entry offset for each GOT entry.
5243         * incremental.h
5244         (Incremental_input_entry::Incremental_input_entry): Initialize new
5245         data member.
5246         (Incremental_input_entry::set_offset): Store file index.
5247         (Incremental_input_entry::get_file_index): New function.
5248         (Incremental_input_entry::file_index_): New data member.
5249         (Incremental_binary::process_got_plt): New function.
5250         (Incremental_binary::do_process_got_plt): New function.
5251         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
5252         data members.
5253         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
5254         (Sized_incremental_binary::set_file_is_unchanged): New function.
5255         (Sized_incremental_binary::file_is_unchanged): New function.
5256         (Sized_incremental_binary::do_process_got_plt): New function.
5257         (Sized_incremental_binary::file_status_): New data member.
5258         (Sized_incremental_binary::main_symtab_loc_): New data member.
5259         (Sized_incremental_binary::main_strtab_loc_): New data member.
5260         * output.cc (Output_data_got::Got_entry::write): Add case
5261         RESERVED_CODE.
5262         (Output_data_got::add_global): Call add_got_entry.
5263         (Output_data_got::add_global_plt): Likewise.
5264         (Output_data_got::add_global_with_rel): Likewise.
5265         (Output_data_got::add_global_with_rela): Likewise.
5266         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
5267         (Output_data_got::add_global_pair_with_rela): Likewise.
5268         (Output_data_got::add_local): Call add_got_entry.
5269         (Output_data_got::add_local_plt): Likewise.
5270         (Output_data_got::add_local_with_rel): Likewise.
5271         (Output_data_got::add_local_with_rela): Likewise.
5272         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
5273         (Output_data_got::add_local_pair_with_rela): Likewise.
5274         (Output_data_got::reserve_slot): New function.
5275         (Output_data_got::reserve_slot_for_global): New function.
5276         (Output_data_got::add_got_entry): New function.
5277         (Output_data_got::add_got_entry_pair): New function.
5278         (Output_section::add_output_section_data): Edit FIXME.
5279         * output.h
5280         (Output_section_data_build::Output_section_data_build): New
5281         constructor with size parameter.
5282         (Output_data_space::Output_data_space): Likewise.
5283         (Output_data_got::Output_data_got): Initialize new data member; new
5284         constructor with size parameter.
5285         (Output_data_got::add_constant): Call add_got_entry.
5286         (Output_data_got::reserve_slot): New function.
5287         (Output_data_got::reserve_slot_for_global): New function.
5288         (class Output_data_got::Got_entry): Add RESERVED_CODE.
5289         (Output_data_got::add_got_entry): New function.
5290         (Output_data_got::add_got_entry_pair): New function.
5291         (Output_data_got::free_list_): New data member.
5292         * target.h (Sized_target::init_got_plt_for_update): New function.
5293         (Sized_target::register_global_plt_entry): New function.
5294         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
5295         Initialize new data member; call init; add constructor with PLT count.
5296         (Output_data_plt_x86_64::init): New function.
5297         (Output_data_plt_x86_64::add_relocation): New function.
5298         (Output_data_plt_x86_64::reserve_slot): New function.
5299         (Output_data_plt_x86_64::free_list_): New data member.
5300         (Target_x86_64::init_got_plt_for_update): New function.
5301         (Target_x86_64::register_global_plt_entry): New function.
5302         (Output_data_plt_x86_64::add_entry): Allocate from free list for
5303         incremental updates.
5304         (Output_data_plt_x86_64::add_relocation): New function.
5305         * testsuite/object_unittest.cc (Object_test): Set default options.
5306
5307 2011-05-16  Ian Lance Taylor  <iant@google.com>
5308
5309         * options.h (class General_options): Make -i a synonym for -r.
5310
5311 2011-05-16  Ian Lance Taylor  <iant@google.com>
5312
5313         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
5314
5315 2011-05-10 Cary Coutant  <ccoutant@google.com>
5316
5317         * object.cc (Sized_relobj::do_count_local_symbols): Check for
5318         strip_all (-s).
5319
5320 2011-05-06  Ian Lance Taylor  <iant@google.com>
5321
5322         * layout.cc (Layout::layout): If the output section flags change,
5323         update the ordering.
5324
5325 2011-04-25 Cary Coutant  <ccoutant@google.com>
5326
5327         * incremental-dump.cc (dump_incremental_inputs): Print local
5328         symbol info for each input file.
5329         * incremental.cc
5330         (Output_section_incremental_inputs::set_final_data_size): Add local
5331         symbol info to input file entries in incremental info.
5332         (Output_section_incremental_inputs::write_info_blocks): Likewise.
5333         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
5334         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
5335         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
5336         implementation.
5337         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
5338         (Sized_incr_relobj::do_relocate): Write the local symbols.
5339         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
5340         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
5341         Adjust size of input file header.
5342         (Incremental_inputs_reader::get_local_symbol_offset): New function.
5343         (Incremental_inputs_reader::get_local_symbol_count): New function.
5344         (Incremental_inputs_reader::get_input_section): Adjust size of input
5345         file header.
5346         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
5347         (Sized_incr_relobj::This): New typedef.
5348         (Sized_incr_relobj::sym_size): New const data member.
5349         (Sized_incr_relobj::Local_symbol): New struct.
5350         (Sized_incr_relobj::do_output_local_symbol_count): New function.
5351         (Sized_incr_relobj::do_local_symbol_offset): New function.
5352         (Sized_incr_relobj::local_symbol_count_): New data member.
5353         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
5354         (Sized_incr_relobj::local_symbol_index_): New data member.
5355         (Sized_incr_relobj::local_symbol_offset_): New data member.
5356         (Sized_incr_relobj::local_dynsym_offset_): New data member.
5357         (Sized_incr_relobj::local_symbols_): New data member.
5358         * object.h (Relobj::output_local_symbol_count): New function.
5359         (Relobj::local_symbol_offset): New function.
5360         (Relobj::do_output_local_symbol_count): New function.
5361         (Relobj::do_local_symbol_offset): New function.
5362         (Sized_relobj::do_output_local_symbol_count): New function.
5363         (Sized_relobj::do_local_symbol_offset): New function.
5364
5365 2011-04-22  Vladimir Simonov  <sv@sw.ru>
5366
5367         * descriptors.cc (set_close_on_exec): New function.
5368         (Descriptors::open): Use set_close_on_exec.
5369         * output.cc (S_ISLNK): Define if not defined.
5370
5371 2011-04-22 Cary Coutant  <ccoutant@google.com>
5372
5373         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
5374         global symbol map.
5375         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
5376         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
5377         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
5378         relocations.
5379         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
5380         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
5381         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
5382         * incremental.h
5383         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
5384         function.
5385         (Incremental_binary::apply_incremental_relocs): New function.
5386         (Incremental_binary::do_apply_incremental_relocs): New function.
5387         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
5388         data member.
5389         (Sized_incremental_binary::add_global_symbol): New function.
5390         (Sized_incremental_binary::global_symbol): New function.
5391         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
5392         (Sized_incremental_binary::symbol_map_): New data member.
5393         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
5394         * target.h (Sized_target::apply_relocation): New function.
5395         * target-reloc.h (apply_relocation): New function.
5396         * x86_64.cc (Target_x86_64::apply_relocation): New function.
5397
5398 2011-04-22  Doug Kwan  <dougkwan@google.com>
5399
5400         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
5401         flag of a SHT_ARM_EXIDX section.
5402         * testsuite/Makefile.am (arm_exidx_test): New test rules.
5403         * testsuite/Makefile.in: Regenerate.
5404         * testsuite/arm_exidx_test.s: New file.
5405         * testsuite/arm_exidx_test.sh: Same.
5406
5407 2011-04-20 Cary Coutant  <ccoutant@google.com>
5408
5409         PR gold/12689
5410         * archive.h (Incremental_archive_entry::Archive_member):
5411         Initialize arg_serial_ (second constructor).
5412
5413 2011-04-17  Ian Lance Taylor  <iant@google.com>
5414
5415         * object.cc (Relocate_info::location): Simplify location string.
5416         * errors.cc (Errors::error_at_location): Don't print program
5417         name.
5418         (Errors::warning_at_location): Likewise.
5419         (Errors::undefined_symbol): Likewise.
5420         * testsuite/debug_msg.sh: Update accordingly.
5421
5422 2011-04-14 Cary Coutant  <ccoutant@google.com>
5423
5424         * gold/layout.cc (Layout::symtab_section_offset): New function.
5425         * gold/layout.h (Layout::symtab_section_offset): New function.
5426         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
5427
5428 2011-04-12  Ian Lance Taylor  <iant@google.com>
5429
5430         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
5431         with MREMAP_MAYMOVE.
5432         * output.h (class Output_file): Add map_is_allocated_ field.
5433         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
5434         not available, provide stubs.  If mremap is not available, #define
5435         it to gold_mremap.
5436         (MREMAP_MAYMOVE): Define if not defined.
5437         (Output_file::Output_file): Initialize map_is_allocated_.
5438         (Output_file::resize): Check map_is_allocated_.
5439         (Output_file::map_anonymous): If mmap fails, use malloc.
5440         (Output_file::unmap): Don't do anything for an anonymous map.
5441         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
5442         is not available, provide stubs.
5443         (File_read::View::~View): Use free rather than delete[].
5444         (File_read::make_view): Use malloc rather than new[].  If mmap
5445         fails, use malloc.
5446         (File_read::find_or_make_view): Use malloc rather than new[].
5447         * gold.h: Remove HAVE_REMAP code.
5448         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
5449         exists.  Rename mremap to gold_mremap.  If mmap is not available
5450         don't do anything.
5451         * configure, config.in: Rebuild.
5452
5453 2011-04-11  Ian Lance Taylor  <iant@google.com>
5454
5455         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
5456         initialize local variable v.
5457
5458 2011-04-11  Cary Coutant  <ccoutant@google.com>
5459
5460         * archive.cc (Archive::include_member): Adjust call to
5461         report_object.
5462         (Add_archive_symbols::run): Track argument serial numbers.
5463         (Lib_group::include_member): Likewise.
5464         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
5465         * archive.h (Incremental_archive_entry::Archive_member):
5466         Initialize arg_serial_.
5467         (Archive_member::arg_serial_): New data member.
5468         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
5469         (Sized_dynobj::do_add_symbols): Track symbols when doing an
5470         incremental link.
5471         (Sized_dynobj::do_for_all_local_got_entries): New function.
5472         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
5473         function.
5474         * fileread.cc (get_mtime): New function.
5475         * fileread.h (get_mtime): New function.
5476         * gold.cc (queue_initial_tasks): Check for incremental update.
5477         (process_incremental_input): New function.
5478         (queue_middle_tasks): Don't force valid target for incremental
5479         update.
5480         * incremental-dump.cc (find_input_containing_global): Adjust
5481         size of symbol info entry.
5482         (dump_incremental_inputs): Dump argument serial number and
5483         in_system_directory flag; bias shndx by 1; print symbol names
5484         when dumping per-file symbol lists; use new symbol info readers.
5485         * incremental.cc
5486         (Output_section_incremental_inputs:update_data_size): New function.
5487         (Sized_incremental_binary::setup_readers): Setup input readers
5488         for each input file; build maps for files added from libraries
5489         and scripts.
5490         (Sized_incremental_binary::check_input_args): New function.
5491         (Sized_incremental_binary::do_check_inputs): Build map of argument
5492         serial numbers to input arguments.
5493         (Sized_incremental_binary::do_file_has_changed): Rename
5494         do_file_is_unchanged to this; compare file modification times.
5495         (Sized_incremental_binary::do_init_layout): New function.
5496         (Sized_incremental_binary::do_reserve_layout): New function.
5497         (Sized_incremental_binary::do_get_input_reader): Remove.
5498         (Sized_incremental_binary::get_symtab_view): New function.
5499         (Incremental_checker::can_incrementally_link_output_file): Remove.
5500         (Incremental_inputs::report_command_line): Exclude --debug options.
5501         (Incremental_inputs::report_archive_begin): Add parameter; track
5502         argument serial numbers; don't put input file entry for archive
5503         before archive members.
5504         (Incremental_inputs::report_archive_end): Put input file entry
5505         for archive after archive members.
5506         (Incremental_inputs::report_object): Add parameter; track argument
5507         serial numbers and in_system_directory flag.
5508         (Incremental_inputs::report_script): Add parameter; track argument
5509         serial numbers.
5510         (Output_section_incremental_inputs::set_final_data_size): Adjust
5511         size of symbol info entry; check for forwarding symbols.
5512         (Output_section_incremental_inputs::write_input_files): Write
5513         in_system_directory flag and argument serial number.
5514         (Output_section_incremental_inputs::write_info_blocks): Map section
5515         indices between incremental info and original input file; store
5516         input section index for each symbol.
5517         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
5518         change operator() to visit().
5519         (class Global_got_offset_visitor): Likewise.
5520         (class Global_symbol_visitor_got_plt):
5521         (Output_section_incremental_inputs::write_got_plt): Use new visitor
5522         classes.
5523         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
5524         (Sized_incr_relobj::do_read_symbols): New function.
5525         (Sized_incr_relobj::do_layout): New function.
5526         (Sized_incr_relobj::do_layout_deferred_sections): New function.
5527         (Sized_incr_relobj::do_add_symbols): New function.
5528         (Sized_incr_relobj::do_should_include_member): New function.
5529         (Sized_incr_relobj::do_for_all_global_symbols): New function.
5530         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
5531         (Sized_incr_relobj::do_section_size): New function.
5532         (Sized_incr_relobj::do_section_name): New function.
5533         (Sized_incr_relobj::do_section_contents): New function.
5534         (Sized_incr_relobj::do_section_flags): New function.
5535         (Sized_incr_relobj::do_section_entsize): New function.
5536         (Sized_incr_relobj::do_section_address): New function.
5537         (Sized_incr_relobj::do_section_type): New function.
5538         (Sized_incr_relobj::do_section_link): New function.
5539         (Sized_incr_relobj::do_section_info): New function.
5540         (Sized_incr_relobj::do_section_addralign): New function.
5541         (Sized_incr_relobj::do_initialize_xindex): New function.
5542         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
5543         (Sized_incr_relobj::do_read_relocs): New function.
5544         (Sized_incr_relobj::do_gc_process_relocs): New function.
5545         (Sized_incr_relobj::do_scan_relocs): New function.
5546         (Sized_incr_relobj::do_count_local_symbols): New function.
5547         (Sized_incr_relobj::do_finalize_local_symbols): New function.
5548         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
5549         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
5550         (Sized_incr_relobj::do_relocate): New function.
5551         (Sized_incr_relobj::do_set_section_offset): New function.
5552         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
5553         (Sized_incr_dynobj::do_read_symbols): New function.
5554         (Sized_incr_dynobj::do_layout): New function.
5555         (Sized_incr_dynobj::do_add_symbols): New function.
5556         (Sized_incr_dynobj::do_should_include_member): New function.
5557         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
5558         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
5559         (Sized_incr_dynobj::do_section_size): New function.
5560         (Sized_incr_dynobj::do_section_name): New function.
5561         (Sized_incr_dynobj::do_section_contents): New function.
5562         (Sized_incr_dynobj::do_section_flags): New function.
5563         (Sized_incr_dynobj::do_section_entsize): New function.
5564         (Sized_incr_dynobj::do_section_address): New function.
5565         (Sized_incr_dynobj::do_section_type): New function.
5566         (Sized_incr_dynobj::do_section_link): New function.
5567         (Sized_incr_dynobj::do_section_info): New function.
5568         (Sized_incr_dynobj::do_section_addralign): New function.
5569         (Sized_incr_dynobj::do_initialize_xindex): New function.
5570         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
5571         (make_sized_incremental_object): New function.
5572         (Incremental_library::copy_unused_symbols): New function.
5573         (Incremental_library::do_for_all_unused_symbols): New function.
5574         * incremental.h (enum Incremental_input_flags): New type.
5575         (class Incremental_checker): Remove.
5576         (Incremental_input_entry::Incremental_input_entry): Add argument
5577         serial number.
5578         (Incremental_input_entry::arg_serial): New function.
5579         (Incremental_input_entry::set_is_in_system_directory): New function.
5580         (Incremental_input_entry::is_in_system_directory): New function.
5581         (Incremental_input_entry::arg_serial_): New data member.
5582         (Incremental_input_entry::is_in_system_directory_): New data member.
5583         (class Script_info): Move here from script.h.
5584         (Script_info::Script_info): Add filename parameter.
5585         (Script_info::filename): New function.
5586         (Script_info::filename_): New data member.
5587         (Incremental_script_entry::Incremental_script_entry): Add argument
5588         serial number.
5589         (Incremental_object_entry::Incremental_object_entry): Likewise.
5590         (Incremental_object_entry::add_input_section): Build list of input
5591         sections with map to original shndx.
5592         (Incremental_object_entry::get_input_section_index): New function.
5593         (Incremental_object_entry::shndx_): New data member.
5594         (Incremental_object_entry::name_key_): Rename; adjust all refs.
5595         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
5596         (Incremental_archive_entry::Incremental_archive_entry): Add argument
5597         serial number.
5598         (Incremental_inputs::report_archive_begin): Likewise.
5599         (Incremental_inputs::report_object): Likewise.
5600         (Incremental_inputs::report_script): Likewise.
5601         (class Incremental_global_symbol_reader): New class.
5602         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
5603         and store flags and input file type.
5604         (Incremental_input_entry_reader::arg_serial): New function.
5605         (Incremental_input_entry_reader::type): Extract type from flags.
5606         (Incremental_input_entry_reader::is_in_system_directory): New function.
5607         (Incremental_input_entry_reader::get_input_section_count): Call
5608         accessor function for type.
5609         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
5610         function for type; adjust size of global symbol entry.
5611         (Incremental_input_entry_reader::get_global_symbol_count): Call
5612         accessor function for type.
5613         (Incremental_input_entry_reader::get_object_count): Likewise.
5614         (Incremental_input_entry_reader::get_object_offset): Likewise.
5615         (Incremental_input_entry_reader::get_member_count): Likewise.
5616         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
5617         (Incremental_input_entry_reader::get_member_offset): Likewise.
5618         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
5619         (Incremental_input_entry_reader::Global_symbol_info): Remove.
5620         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
5621         (Incremental_input_entry_reader::get_global_symbol_reader): New
5622         function.
5623         (Incremental_input_entry_reader::get_output_symbol_index): New
5624         function.
5625         (Incremental_input_entry_reader::type_): Remove.
5626         (Incremental_input_entry_reader::flags_): New data member.
5627         (Incremental_inputs_reader::input_file_offset): New function.
5628         (Incremental_inputs_reader::input_file_index): New function.
5629         (Incremental_inputs_reader::input_file): Call input_file_offset.
5630         (Incremental_inputs_reader::input_file_at_offset): New function.
5631         (Incremental_relocs_reader::get_r_type): Reformat.
5632         (Incremental_relocs_reader::get_r_shndx): Reformat.
5633         (Incremental_relocs_reader::get_r_offset): Reformat.
5634         (Incremental_relocs_reader::data): New function.
5635         (Incremental_binary::Incremental_binary): Initialize new data members.
5636         (Incremental_binary::check_inputs): Add cmdline parameter.
5637         (Incremental_binary::file_is_unchanged): Remove.
5638         (Input_reader::arg_serial): New function.
5639         (Input_reader::get_unused_symbol_count): New function.
5640         (Input_reader::get_unused_symbol): New function.
5641         (Input_reader::do_arg_serial): New function.
5642         (Input_reader::do_get_unused_symbol_count): New function.
5643         (Input_reader::do_get_unused_symbol): New function.
5644         (Incremental_binary::input_file_count): New function.
5645         (Incremental_binary::get_input_reader): Change signature to use
5646         index instead of filename.
5647         (Incremental_binary::file_has_changed): New function.
5648         (Incremental_binary::get_input_argument): New function.
5649         (Incremental_binary::get_library): New function.
5650         (Incremental_binary::get_script_info): New function.
5651         (Incremental_binary::init_layout): New function.
5652         (Incremental_binary::reserve_layout): New function.
5653         (Incremental_binary::output_file): New function.
5654         (Incremental_binary::do_check_inputs): New function.
5655         (Incremental_binary::do_file_is_unchanged): Remove.
5656         (Incremental_binary::do_file_has_changed): New function.
5657         (Incremental_binary::do_init_layout): New function.
5658         (Incremental_binary::do_reserve_layout): New function.
5659         (Incremental_binary::do_input_file_count): New function.
5660         (Incremental_binary::do_get_input_reader): Change signature.
5661         (Incremental_binary::input_args_map_): New data member.
5662         (Incremental_binary::library_map_): New data member.
5663         (Incremental_binary::script_map_): New data member.
5664         (Sized_incremental_binary::Sized_incremental_binary): Initialize
5665         new data members.
5666         (Sized_incremental_binary::output_section): New function.
5667         (Sized_incremental_binary::inputs_reader): Add const.
5668         (Sized_incremental_binary::symtab_reader): Add const.
5669         (Sized_incremental_binary::relocs_reader): Add const.
5670         (Sized_incremental_binary::got_plt_reader): Add const.
5671         (Sized_incremental_binary::get_symtab_view): New function.
5672         (Sized_incremental_binary::Inputs_reader): New typedef.
5673         (Sized_incremental_binary::Input_entry_reader): New typedef.
5674         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
5675         (Sized_incremental_binary::do_file_is_unchanged): Remove.
5676         (Sized_incremental_binary::do_file_has_changed): New function.
5677         (Sized_incremental_binary::do_init_layout): New function.
5678         (Sized_incremental_binary::do_reserve_layout): New function.
5679         (Sized_input_reader::Inputs_reader): Remove.
5680         (Sized_input_reader::Input_entry_reader): Remove.
5681         (Sized_input_reader::do_arg_serial): New function.
5682         (Sized_input_reader::do_get_unused_symbol_count): New function.
5683         (Sized_input_reader::do_get_unused_symbol): New function.
5684         (Sized_incremental_binary::do_input_file_count): New function.
5685         (Sized_incremental_binary::do_get_input_reader): Change signature;
5686         use index instead of filename.
5687         (Sized_incremental_binary::section_map_): New data member.
5688         (Sized_incremental_binary::input_entry_readers_): New data member.
5689         (class Sized_incr_relobj): New class.
5690         (class Sized_incr_dynobj): New class.
5691         (make_sized_incremental_object): New function.
5692         (class Incremental_library): New class.
5693         * layout.cc (Free_list::num_lists): New static data member.
5694         (Free_list::num_nodes): New static data member.
5695         (Free_list::num_removes): New static data member.
5696         (Free_list::num_remove_visits): New static data member.
5697         (Free_list::num_allocates): New static data member.
5698         (Free_list::num_allocate_visits): New static data member.
5699         (Free_list::init): New function.
5700         (Free_list::remove): New function.
5701         (Free_list::allocate): New function.
5702         (Free_list::dump): New function.
5703         (Free_list::print_stats): New function.
5704         (Layout_task_runner::run): Resize output file for incremental updates.
5705         (Layout::Layout): Initialize new data members.
5706         (Layout::set_incremental_base): New function.
5707         (Layout::init_fixed_output_section): New function.
5708         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
5709         incremental updates.
5710         (Layout::create_gold_note): Do not create gold note section for
5711         incremental updates.
5712         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
5713         for incremental updates.
5714         (Layout::set_section_offsets): For incremental updates, allocate space
5715         from free list.
5716         (Layout::create_symtab_sections): Layout with offsets relative to
5717         start of section; for incremental updates, allocate space from free
5718         list.
5719         (Layout::create_shdrs): For incremental updates, allocate space from
5720         free list.
5721         (Layout::finish_dynamic_section): For incremental updates, do not
5722         check --as-needed (fixed in subsequent patch).
5723         * layout.h (class Free_list): New class.
5724         (Layout::set_incremental_base): New function.
5725         (Layout::incremental_base): New function.
5726         (Layout::init_fixed_output_section): New function.
5727         (Layout::allocate): New function.
5728         (Layout::incremental_base_): New data member.
5729         (Layout::free_list_): New data member.
5730         * main.cc (main): Print Free_list statistics.
5731         * object.cc (Relobj::finalize_incremental_relocs): Add
5732         clear_counts parameter; clear counts only when clear_counts is set.
5733         (Sized_relobj::Sized_relobj): Initialize new base class.
5734         (Sized_relobj::do_layout): Don't report special sections.
5735         (Sized_relobj::do_for_all_local_got_entries): New function.
5736         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
5737         symtab_off to all symbol table offsets.
5738         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
5739         * object.h (class Got_offset_list): Move to top of file.
5740         (Object::Object): Allow case where input_file == NULL.
5741         (Object::~Object): Likewise.
5742         (Object::input_file): Assert that input_file != NULL.
5743         (Object::lock): Allow case where input_file == NULL.
5744         (Object::unlock): Likewise.
5745         (Object::is_locked): Likewise.
5746         (Object::token): Likewise.
5747         (Object::release): Likewise.
5748         (Object::is_incremental): New function.
5749         (Object::get_mtime): New function.
5750         (Object::for_all_local_got_entries): New function.
5751         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
5752         (Object::set_is_in_system_directory): New function.
5753         (Object::is_in_system_directory): New function.
5754         (Object::do_is_incremental): New function.
5755         (Object::do_get_mtime): New function.
5756         (Object::do_for_all_local_got_entries): New function.
5757         (Object::is_in_system_directory_): New data member.
5758         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
5759         (class Sized_relobj_base): New class.
5760         (class Sized_relobj): Derive from Sized_relobj_base.
5761         (class Sized_relobj::Symbols): Redeclare from base class.
5762         (class Sized_relobj::local_got_offset_list): Remove.
5763         (class Sized_relobj::Output_sections): Redeclare from base class.
5764         (class Sized_relobj::do_for_all_local_got_entries): New function.
5765         (class Sized_relobj::write_local_symbols): Add offset parameter.
5766         (class Sized_relobj::local_symbol_offset_): Update comment.
5767         (class Sized_relobj::local_dynsym_offset_): Update comment.
5768         * options.cc (Input_arguments::add_file): Remove const.
5769         * options.h (Input_file_argument::Input_file_argument):
5770         Initialize arg_serial_ (all constructors).
5771         (Input_file_argument::set_arg_serial): New function.
5772         (Input_file_argument::arg_serial): New function.
5773         (Input_file_argument::arg_serial_): New data member.
5774         (Input_arguments::Input_arguments): Initialize file_count_.
5775         (Input_arguments::add_file): Remove const.
5776         (Input_arguments::number_of_input_files): New function.
5777         (Input_arguments::file_count_): New data member.
5778         (Command_line::number_of_input_files): Call
5779         Input_arguments::number_of_input_files.
5780         * output.cc (Output_segment_headers::Output_segment_headers):
5781         Set current size.
5782         (Output_section::Input_section::current_data_size): New function.
5783         (Output_section::Output_section): Initialize new data members.
5784         (Output_section::add_input_section): Don't do merge sections for
5785         an incremental link; allocate space from free list for an
5786         incremental update.
5787         (Output_section::add_output_section_data): Allocate space from
5788         free list for an incremental update.
5789         (Output_section::update_data_size): New function.
5790         (Output_section::set_fixed_layout): New function.
5791         (Output_section::reserve): New function.
5792         (Output_segment::set_section_addresses): Remove const.
5793         (Output_segment::set_section_list_addresses): Remove const; allocate
5794         space from free list for an incremental update.
5795         (Output_segment::set_offset): Adjust size of RELRO segment for an
5796         incremental update.
5797         * output.h (Output_data::current_data_size): Move here from
5798         child classes.
5799         (Output_data::pre_finalize_data_size): New function.
5800         (Output_data::update_data_size): New function.
5801         (Output_section_headers::update_data_size): new function.
5802         (Output_section_data_build::current_data_size): Move to Output_data.
5803         (Output_data_strtab::update_data_size): New function.
5804         (Output_section::current_data_size): Move to Output_data.
5805         (Output_section::set_fixed_layout): New function.
5806         (Output_section::has_fixed_layout): New function.
5807         (Output_section::reserve): New function.
5808         (Output_section::update_data_size): New function.
5809         (Output_section::has_fixed_layout_): New data member.
5810         (Output_section::free_list_): New data member.
5811         (Output_segment::set_section_addresses): Remove const.
5812         (Output_segment::set_section_list_addresses): Remove const.
5813         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
5814         New function.
5815         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
5816         New function.
5817         * readsyms.cc (Read_symbols::do_read_symbols): Add library
5818         parameter when calling Add_symbols constructor; store argument
5819         serial number for members of a lib group.
5820         (Add_symbols::locks): Allow case where token == NULL.
5821         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
5822         (Read_member::~Read_member): New function.
5823         (Read_member::is_runnable): New function.
5824         (Read_member::locks): New function.
5825         (Read_member::run): New function.
5826         (Check_script::~Check_script): New function.
5827         (Check_script::is_runnable): New function.
5828         (Check_script::locks): New function.
5829         (Check_script::run): New function.
5830         (Check_library::~Check_library): New function.
5831         (Check_library::is_runnable): New function.
5832         (Check_library::locks): New function.
5833         (Check_library::run): New function.
5834         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
5835         (Add_symbols::library_): New data member.
5836         (class Read_member): New class.
5837         (class Check_script): New class.
5838         (class Check_library): New class.
5839         * reloc.cc (Read_relocs::is_runnable): Allow case where
5840         token == NULL.
5841         (Read_relocs::locks): Likewise.
5842         (Scan_relocs::locks): Likewise.
5843         (Relocate_task::locks): Likewise.
5844         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
5845         to clear counters.
5846         (Sized_relobj::incremental_relocs_scan): Fix comment.
5847         (Sized_relobj::do_relocate): Pass output file offset to
5848         write_local_symbols.
5849         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
5850         from class declaration.
5851         * script.cc (read_input_script): Allocate Script_info; pass
5852         argument serial number to report_script.
5853         * script.h (class Script_info): Move to incremental.h.
5854         * symtab.cc (Symbol_table::add_from_incrobj): New function.
5855         * symtab.h (Symbol_table::add_from_incrobj): New function.
5856         (Symbol_table::set_file_offset): New function.
5857
5858 2011-04-05  Cary Coutant  <ccoutant@google.com>
5859
5860         * incremental-dump.cc (dump_incremental_inputs): Change signature
5861         to take a Sized_incremental_binary; change caller.  Use readers
5862         in Sized_incremental_binary.
5863         * incremental.cc
5864         (Sized_incremental_binary::find_incremental_inputs_sections):
5865         Rename do_find_incremental_inputs_sections to this.
5866         (Sized_incremental_binary::setup_readers): New function.
5867         (Sized_incremental_binary::do_check_inputs): Check
5868         has_incremental_info_ flag; move setup code to setup_readers;
5869         use input readers.
5870         (Sized_incremental_binary::do_file_is_unchanged): New function.
5871         (Sized_incremental_binary::do_get_input_reader): New function.
5872         * incremental.h (class Incremental_binary): Move to end of file.
5873         (Incremental_binary::file_is_unchanged): New function.
5874         (Incremental_binary::do_file_is_unchanged): New function.
5875         (Incremental_binary::Input_reader): New class.
5876         (Incremental_binary::get_input_reader): New function.
5877         (class Sized_incremental_binary): Move to end of file.
5878         (Sized_incremental_binary::Sized_incremental_binary): Setup the
5879         input section reader classes.
5880         (Sized_incremental_binary::has_incremental_info): New function.
5881         (Sized_incremental_binary::inputs_reader): New function.
5882         (Sized_incremental_binary::symtab_reader): New function.
5883         (Sized_incremental_binary::relocs_reader): New function.
5884         (Sized_incremental_binary::got_plt_reader): New function.
5885         (Sized_incremental_binary::do_file_is_unchanged): New function.
5886         (Sized_incremental_binary::Sized_input_reader): New class.
5887         (Sized_incremental_binary::get_input_reader): New function.
5888         (Sized_incremental_binary::find_incremental_inputs_sections):
5889         Rename do_find_incremental_inputs_sections to this.
5890         (Sized_incremental_binary::setup_readers): New function.
5891         (Sized_incremental_binary::has_incremental_info_): New data member.
5892         (Sized_incremental_binary::inputs_reader_): New data member.
5893         (Sized_incremental_binary::symtab_reader_): New data member.
5894         (Sized_incremental_binary::relocs_reader_): New data member.
5895         (Sized_incremental_binary::got_plt_reader_): New data member.
5896         (Sized_incremental_binary::current_input_file_): New data member.
5897
5898 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
5899
5900         PR gold/12640
5901         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
5902         violation.
5903
5904 2011-03-30  Cary Coutant  <ccoutant@google.com>
5905
5906         * archive.cc (Archive::include_member): Adjust call to report_object.
5907         (Add_archive_symbols::run): Add script_info to call to
5908         report_archive_begin.
5909         (Lib_group::include_member): Adjust call to report_object.
5910         (Add_lib_group_symbols::run): Adjust call to report_object.
5911         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
5912         blocks.  Add object count for script input files.
5913         * incremental.cc (Incremental_inputs::report_archive_begin): Add
5914         script_info parameter; change all callers.
5915         (Incremental_inputs::report_object): Add script_info parameter;
5916         change all callers.
5917         (Incremental_inputs::report_script): Store backpointer to
5918         incremental info entry.
5919         (Output_section_incremental_inputs::set_final_data_size): Record
5920         additional information for scripts.
5921         (Output_section_incremental_inputs::write_info_blocks): Likewise.
5922         * incremental.h (Incremental_script_entry::add_object): New function.
5923         (Incremental_script_entry::get_object_count): New function.
5924         (Incremental_script_entry::get_object): New function.
5925         (Incremental_script_entry::objects_): New data member; adjust
5926         constructor.
5927         (Incremental_inputs::report_archive_begin): Add script_info parameter.
5928         (Incremental_inputs::report_object): Add script_info parameter.
5929         (Incremental_inputs_reader::get_object_count): New function.
5930         (Incremental_inputs_reader::get_object_offset): New function.
5931         * options.cc (Input_arguments::add_file): Return reference to
5932         new input argument.
5933         * options.h (Input_argument::set_script_info): New function.
5934         (Input_argument::script_info): New function.
5935         (Input_argument::script_info_): New data member; adjust all
5936         constructors.
5937         (Input_file_group::add_file): Return reference to new input argument.
5938         (Input_file_lib::add_file): Likewise.
5939         (Input_arguments::add_file): Likewise.
5940         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
5941         * script.cc (Parser_closure::Parser_closure): Add script_info
5942         parameter; adjust all callers.
5943         (Parser_closure::script_info): New function.
5944         (Parser_closure::script_info_): New data member.
5945         (read_input_script): Report scripts earlier to incremental info.
5946         (script_add_file): Set script_info in Input_argument.
5947         (script_add_library): Likewise.
5948         * script.h (Script_options::Script_info): Rewrite class.
5949
5950 2011-03-29  Cary Coutant  <ccoutant@google.com>
5951
5952         * archive.cc (Library_base::should_include_member): Move
5953         method here from class Archive.
5954         (Archive::Archive): Initialize base class.
5955         (Archive::should_include_member): Move to base class.
5956         (Archive::do_for_all_unused_symbols): New function.
5957         (Add_archive_symbols::run): Remove redundant access to
5958         incremental_inputs.
5959         (Lib_group::Lib_group): Initialize base class.
5960         (Lib_group::do_filename): New function.
5961         (Lib_group::include_member): Pass pointer to Lib_group to
5962         report_object.
5963         (Lib_group::do_for_all_unused_symbols): New function.
5964         (Add_lib_group_symbols::run): Report archive information for
5965         incremental links.
5966         * archive.h (class Library_base): New base class.
5967         (class Archive): Derive from Library_base.
5968         (Archive::filename): Move to base class.
5969         (Archive::set_incremental_info): Likewise.
5970         (Archive::incremental_info): Likewise.
5971         (Archive::Should_include): Likewise.
5972         (Archive::should_include_member): Likewise.
5973         (Archive::Armap_entry): Remove.
5974         (Archive::Unused_symbol_iterator): Remove.
5975         (Archive::unused_symbols_begin): Remove.
5976         (Archive::unused_symbols_end): Remove.
5977         (Archive::do_filename): New function.
5978         (Archive::do_get_mtime): New function.
5979         (Archive::do_for_all_unused_symbols): New function.
5980         (Archive::task_): Move to base class.
5981         (Archive::incremental_info_): Likewise.
5982         (class Lib_group): Derive from Library_base.
5983         (Lib_group::do_filename): New function.
5984         (Lib_group::do_get_mtime): New function.
5985         (Lib_group::do_for_all_unused_symbols): New function.
5986         (Lib_group::task_): Move to base class.
5987         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
5988         function.
5989         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
5990         function.
5991         * incremental.cc (Incremental_inputs::report_archive_begin):
5992         Use Library_base; call library's get_mtime; add incremental inputs
5993         entry before members.
5994         (class Unused_symbol_visitor): New class.
5995         (Incremental_inputs::report_archive_end): Use Library_base; use
5996         visitor class to record unused symbols; don't add incremental inputs
5997         entry after members.
5998         (Incremental_inputs::report_object): Use Library_base.
5999         * incremental.h
6000         (Incremental_archive_entry::Incremental_archive_entry): Remove
6001         unused Archive parameter.
6002         (Incremental_inputs::report_archive_begin): Use Library_base.
6003         (Incremental_inputs::report_archive_end): Likewise.
6004         (Incremental_inputs::report_object): Likewise.
6005         * object.cc (Sized_relobj::do_for_all_global_symbols): New
6006         function.
6007         * object.h (Object::for_all_global_symbols): New function.
6008         (Object::do_for_all_global_symbols): New function.
6009         (Sized_relobj::do_for_all_global_symbols): New function.
6010         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
6011         function.
6012         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
6013         function.
6014
6015 2011-03-27  Ian Lance Taylor  <iant@google.com>
6016
6017         * archive.cc (Archive::interpret_header): Return -1 if something
6018         goes wrong.  Change callers accordingly.
6019
6020 2011-03-25  Cary Coutant  <ccoutant@google.com>
6021
6022         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
6023         * testsuite/Makefile.in: Regenerate.
6024
6025 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
6026
6027         * plugin.cc (get_view): New.
6028         (Plugin::load): Pass get_view to the plugin.
6029         (Plugin_manager::get_view): New.
6030
6031 2011-03-21  Ian Lance Taylor  <iant@google.com>
6032
6033         * testsuite/final_layout.sh: Rewrite to not use dc.
6034         * testsuite/relro_test.sh: Fail if dc is not present.
6035
6036 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
6037
6038         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
6039         Change == to -eq.
6040         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
6041         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
6042         Change == to -eq.
6043         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
6044         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
6045
6046 2011-03-14  Ian Lance Taylor  <iant@google.com>
6047
6048         * script-sections.cc (Sort_output_sections::script_compare):
6049         Rename from is_before, change return type.
6050         (Sort_output_sections::operator()): Adjust accordingly.
6051
6052 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
6053
6054         PR gold/12572
6055         * testsuite/odr_violation2.cc: Add comment to make all error line
6056         numbers double digits.
6057         * testsuite/debug_msg.sh: Adjust expected errors.
6058
6059 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
6060
6061         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
6062         but mark earlier ones as non-canonical
6063         (offset_to_iterator): Update search target and example
6064         (do_addr2line): Return extra lines in a vector*
6065         (format_file_lineno): Extract from do_addr2line
6066         (one_addr2line): Add vector* out-param
6067         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
6068         when a lineno entry appeared last for its instruction
6069         (Dwarf_line_info): Add vector* out-param
6070         * object.cc (Relocate_info): Pass NULL for the vector* out-param
6071         * symtab.cc (Odr_violation_compare): Include the lineno in the
6072         comparison again.
6073         (linenos_from_loc): New. Combine the canonical line for an
6074         address with its other lines.
6075         (True_if_intersect): New. Helper functor to make
6076         std::set_intersection a query.
6077         (detect_odr_violations): Compare sets of lines instead of just
6078         one line for each function. This became less deterministic, but
6079         has fewer false positives.
6080         * symtab.h: Declarations.
6081         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
6082         mix an optimized and non-optimized object in the same binary
6083         (odr_violation2.so): Same.
6084         * testsuite/Makefile.in: Regenerate from Makefile.am.
6085         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
6086         * testsuite/debug_msg.sh: Update line numbers and add
6087         assertions.
6088         * testsuite/odr_violation1.cc: Use OdrDerived, in a
6089         non-optimized context.
6090         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
6091         isn't inlined, and use OdrDerived in an optimized context.
6092         * testsuite/odr_header1.h: Defines OdrDerived, where
6093         optimization will change the
6094         first-instruction-in-the-destructor's file and line number.
6095         * testsuite/odr_header2.h: Defines OdrBase.
6096
6097 2011-03-09  Ian Lance Taylor  <iant@google.com>
6098
6099         * fileread.cc (File_read::clear_views): Don't delete the whole
6100         file view.
6101
6102 2011-03-08  Ian Lance Taylor  <iant@google.com>
6103
6104         PR gold/12525
6105         * fileread.cc: #include <climits>.
6106         (GOLD_IOV_MAX): Define.
6107         (File_read::read_multiple): Limit number of entries by iov_max.
6108         * fileread.h (class File_read): Always set max_readv_entries to
6109         128.
6110
6111 2011-03-07  Ian Lance Taylor  <iant@google.com>
6112
6113         PR gold/12525
6114         * options.h (class General_options): Add -dy and -dn.
6115
6116 2011-03-02  Cary Coutant  <ccoutant@google.com>
6117
6118         * testsuite/script_test_9.t: Add TLS segment.
6119
6120 2011-03-02  Simon Baldwin  <simonb@google.com>
6121
6122         * configure.ac: Add check for gnu_indirect_function support in
6123         the toolchain building binutils.
6124         * configure: Rebuild.
6125
6126 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
6127
6128         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
6129         plugin only symbols.
6130         (Symbol_table::sized_finalize_symbol) Mark symbol only present
6131         in plugin files as not needed in the symbol table.
6132
6133 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
6134
6135         * output.cc (Output_section::add_input_section): Delay fill
6136         generation for section ordering.
6137
6138 2011-02-09  Ian Lance Taylor  <iant@google.com>
6139
6140         PR gold/12316
6141         * object.h (class Sized_relobj): Remove clear_local_symbols.
6142         * reloc.cc (Sized_relobj::do_relocate): Don't call
6143         clear_local_symbols.
6144
6145 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
6146
6147         * plugin.cc (is_visible_from_outside): Return true for symbols
6148         in the -u option.
6149
6150 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
6151
6152         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
6153         filename.
6154
6155 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
6156
6157         * icf.h (is_section_foldable_candidate): Change type of parameter
6158         to std::string.
6159         * icf.cc (Icf::find_identical_sections): Change type of local variable
6160         section_name to be std::string.
6161         (is_function_ctor_or_dtor): Change type of parameter to std::string.
6162
6163 2011-01-25  Ian Lance Taylor  <iant@google.com>
6164
6165         * script.cc (script_add_extern): Rewrite to use
6166         add_symbol_reference.
6167
6168 2011-01-25  Doug Kwan  <dougkwan@google.com>
6169
6170         * icf.cc (get_section_contents): Always lock section's object.
6171
6172 2011-01-24  Ian Lance Taylor  <iant@google.com>
6173
6174         * options.h (class General_options): Accept
6175         --no-detect-odr-violations.
6176
6177 2011-01-24  Ian Lance Taylor  <iant@google.com>
6178
6179         * version.cc (version_string): Bump to 1.11.
6180
6181 2011-01-24  Ian Lance Taylor  <iant@google.com>
6182
6183         * plugin.cc (class Plugin_rescan): Define new class.
6184         (Plugin_manager::claim_file): Set any_claimed_.
6185         (Plugin_manager::save_archive): New function.
6186         (Plugin_manager::save_input_group): New function.
6187         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
6188         necessary.
6189         (Plugin_manager::new_undefined_symbol): New function.
6190         (Plugin_manager::rescan): New function.
6191         (Plugin_manager::rescannable_defines): New function.
6192         (Plugin_manager::add_input_file): Set any_added_.
6193         * plugin.h (class Plugin_manager): define new fields rescannable_,
6194         undefined_symbols_, any_claimed_, and any_added_.  Declare
6195         Plugin_rescan as friend.  Declare new functions.
6196         (Plugin_manager::Rescannable): Define type.
6197         (Plugin_manager::Rescannable_list): Define type.
6198         (Plugin_manager::Undefined_symbol_list): Define type.
6199         (Plugin_manager::Plugin_manager): Initialize new fields.
6200         * archive.cc (Archive::defines_symbol): New function.
6201         (Add_archive_symbols::run): Pass archive to plugins if any.
6202         * archive.h (class Archive): Declare defines_symbol.
6203         * readsyms.cc (Input_group::~Input_group): New function.
6204         (Finish_group::run): Pass input_group to plugins if any.
6205         * readsyms.h (class Input_group): Declare destructor.
6206         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
6207         any.
6208
6209 2011-01-10  Ian Lance Taylor  <iant@google.com>
6210
6211         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
6212         section as relro.
6213         (Layout::set_segment_offsets): Reset increase_relro before calling
6214         set_section_addresses a second time.
6215
6216 2011-01-04  Cary Coutant  <ccoutant@google.com>
6217
6218         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
6219         sections before NOBITS sections.
6220
6221 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
6222
6223         * version.cc (print_version): Update copyright to 2011.
6224
6225 2010-12-23  Cary Coutant  <ccoutant@google.com>
6226
6227         * output.h (Output_data_reloc::add_output_section): Pass OD instead
6228         of OS to this->add.  Add OD parameter to second form of the function.
6229
6230 2010-12-20  Ian Lance Taylor  <iant@google.com>
6231
6232         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
6233         second of two consecutive entries with same offset.
6234
6235 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6236
6237         * testsuite/Makefile.am (ifuncmain2static_LDADD)
6238         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
6239         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
6240         to avoid unneeded links against $(LDADD).
6241         * testsuite/Makefile.in: Regenerate.
6242
6243 2010-12-15  Ian Lance Taylor  <iant@google.com>
6244
6245         PR gold/12324
6246         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
6247         for R_X86_64_32 and R_X86_64_PC32.
6248         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
6249         ver_matching_def_pic.o.
6250         (ver_matching_def_pic.o): New target.
6251
6252 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6253
6254         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
6255         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
6256         Move definition before File_read::View member definitions.
6257         (File_read::View::~View): Initialize and hold lock before
6258         updating current_mapped_bytes.
6259
6260 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6261
6262         * dwarf_reader.cc: Remove outdated comment.
6263         * gold-threads.cc: Fix typo in error message.
6264         * archive.cc: Fix typos in comments.
6265         * archive.h: Likewise.
6266         * arm-reloc-property.cc: Likewise.
6267         * arm-reloc-property.h: Likewise.
6268         * arm-reloc.def: Likewise.
6269         * arm.cc: Likewise.
6270         * attributes.h: Likewise.
6271         * cref.cc: Likewise.
6272         * ehframe.cc: Likewise.
6273         * fileread.h: Likewise.
6274         * gold.h: Likewise.
6275         * i386.cc: Likewise.
6276         * icf.cc: Likewise.
6277         * incremental.h: Likewise.
6278         * int_encoding.cc: Likewise.
6279         * layout.h: Likewise.
6280         * main.cc: Likewise.
6281         * merge.h: Likewise.
6282         * object.cc: Likewise.
6283         * object.h: Likewise.
6284         * options.cc: Likewise.
6285         * readsyms.cc: Likewise.
6286         * reduced_debug_output.cc: Likewise.
6287         * reloc.cc: Likewise.
6288         * script-sections.cc: Likewise.
6289         * sparc.cc: Likewise.
6290         * symtab.h: Likewise.
6291         * target-reloc.h: Likewise.
6292         * target.cc: Likewise.
6293         * target.h: Likewise.
6294         * timer.cc: Likewise.
6295         * timer.h: Likewise.
6296         * x86_64.cc: Likewise.
6297
6298 2010-12-09  Cary Coutant  <ccoutant@google.com>
6299
6300         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
6301         stack.
6302         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
6303         parameter; change all callers.
6304         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
6305         * options.h (warn_execstack): New option.
6306
6307 2010-12-07  Doug Kwan  <dougkwan@google.com>
6308
6309         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
6310         like function call relocations.
6311
6312 2010-12-07  Ian Lance Taylor  <iant@google.com>
6313
6314         * archive.cc (Archive::get_elf_object_for_member): Permit
6315         punconfigured to be NULL.
6316         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
6317         (Archive::include_member): Pass NULL to get_elf_object_for_member
6318         if we searched for the archive and this is the first included
6319         object.
6320
6321 2010-12-01  Ian Lance Taylor  <iant@google.com>
6322
6323         * dwarf_reader.h (class Sized_dwarf_line_info): Add
6324         track_relocs_type_ field.
6325         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
6326         Set track_relocs_type_.
6327         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
6328         contents when using RELA relocs.
6329         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
6330         reloc_map_.
6331         * reloc.cc (Track_relocs::next_addend): New function.
6332         * reloc.h (class Track_relocs): Declare next_addend.
6333
6334 2010-12-01  Ian Lance Taylor  <iant@google.com>
6335
6336         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
6337         virtual destructor.
6338
6339 2010-12-01  Ian Lance Taylor  <iant@google.com>
6340
6341         * README: Update compilers known to work and fail.
6342
6343 2010-11-23  Matthias Klose  <doko@ubuntu.com>
6344
6345         * configure.in: For --enable-gold, handle value `default' instead of
6346         `both*'.  Always install ld as ld.bfd, install as ld if gold is
6347         not the default.
6348         * configure: Regenerate.
6349
6350 2010-11-18  Doug Kwan  <dougkwan@google.com>
6351
6352         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
6353         and right_alignment to be zero.  Store result alignment only if it is
6354         greater than existing alignment.
6355
6356 2010-11-16  Cary Coutant  <ccoutant@google.com>
6357
6358         PR gold/12220
6359         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
6360         Check for ".zdebug_line".
6361
6362 2010-11-16  Doug Kwan  <dougkwan@google.com>
6363             Cary Coutant  <ccoutant@google.com>
6364
6365         * output.h (Output_segment::set_section_addresses): Pass increase_relro
6366         by reference; adjust all callers.
6367         * output.cc (Output_segment::set_section_addresses): Adjust references
6368         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
6369         list is empty.
6370         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
6371         end at page boundary.
6372
6373 2010-11-16  Cary Coutant  <ccoutant@google.com>
6374
6375         PR gold/12220
6376         * layout.cc (Layout::choose_output_section): Transform names of
6377         compressed sections even when using a script with a SECTIONS clause.
6378         (Layout::output_section_name): Remove code to transform
6379         compressed debug section names.
6380         * output.cc (Output_section::add_input_section): Use uncompressed
6381         section size when tracking input sections.
6382
6383 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
6384
6385         * symtab.h (Symbol::NON_PIC_REF): Remove.
6386         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
6387         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
6388         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
6389         (Symbol::use_plt_offset): Take a flags argument and pass it
6390         directly to needs_dynamic_reloc.  Restrict check for undefined
6391         weak symbols to function calls.
6392         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
6393         (Target_arm::Scan::global): Use it.
6394         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
6395         (Target_arm::Relocate::relocate): Likewise.
6396         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
6397         parameter with an r_type parameter.  Use get_reference_flags
6398         to get the flags.
6399         (Target_arm::Relocate::relocate): Update accordingly.
6400         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
6401         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
6402         (Target_i386::Scan::global): Likewise.
6403         (Target_i386::Relocate::relocate): Likewise.
6404         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
6405         parameter with an r_type parameter.  Use get_reference_flags
6406         to get the flags.
6407         (Target_i386::Relocate::relocate): Update accordingly.
6408         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
6409         (Target_powerpc::Scan::global): Use it.
6410         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
6411         (Target_powerpc::Relocate::relocate): Likewise.
6412         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
6413         (Target_sparc::Scan::global): Use it.
6414         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
6415         (Target_sparc::Relocate::relocate): Likewise.
6416         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
6417         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
6418         (Target_x86_64::Scan::global): Likewise.
6419         (Target_x86_64::Relocate::relocate): Likewise.
6420
6421 2010-11-08  Doug Kwan  <dougkwan@google.com>
6422             Cary Coutant  <ccoutant@google.com>
6423
6424         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
6425         (Arm_exidx_merge_section::section_contents_): New data member.
6426         (Arm_input_section::Arm_input_section): Initialize original_contents_.
6427         (Arm_input_section::~Arm_input_section): De-allocate memory.
6428         (Arm_input_section::original_contents_): New data member.
6429         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
6430         in parameters instead of calling Object::section_contents without
6431         locking.
6432         (Arm_output_section::group_section): New parameter TASK.  Pass it
6433         to callees that need locking objects.
6434         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
6435         to lock EXIDX input sections.  Fix a formatting issue.  Call
6436         Arm_exidx_merged_section::build_contents to create merged section
6437         contents.
6438         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
6439         to lock object of stub table owner.
6440         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
6441         TEXT_SIZE to initialize data member TEXT_SIZE_.
6442         (Arm_exidx_input_section::addralign): Fix typo in comment.
6443         (Arm_exidx_input_section::text_size): New method.
6444         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
6445         that require locking objects.  Lock objects before scanning for stubs
6446         and updating local symbols.
6447         (Arm_input_section<big_endian>::init): Copy contents of original
6448         input section.
6449         (Arm_input_section<big_endian>::do_write): Use saved contents of
6450         original input section instead of calling Object::section_contents
6451         without locking.
6452         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
6453         size without calling Object::section_size().
6454         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
6455         for size.  Allocate a buffer for merged EXIDX entries.
6456         (Arm_exidx_merged_section::build_contents): New method.
6457         (Arm_exidx_merged_section::do_write): Move merge section contents
6458         building code to Arm_exidx_merged_section::build_contetns.  Write
6459         out contetns in buffer instead of building it on the fly.
6460         (Arm_relobj::make_exidx_input_section): Also pass text section size
6461         to Arm_exidx_input_section constructor.
6462         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
6463         (Arm_dynobj::do_read_symbols): Fix memory leak.
6464         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
6465         * target.h: (class Task): Add forward declaration.
6466         (Target::relax): Add new parameter TASK and pass it to
6467         Target::do_relax().
6468         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
6469
6470 2010-11-05  Cary Coutant  <ccoutant@google.com>
6471
6472         PR gold/10708
6473         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
6474         object when reading from the file.
6475         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
6476         second layout pass.
6477         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
6478         when reading section contents.
6479         (get_section_contents): Likewise.
6480         (icf::find_identical_sections): Likewise.
6481         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
6482         object when reading from the file.
6483         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
6484         the object when doing deferred section layout.
6485
6486 2010-11-03  Nick Clifton  <nickc@redhat.com>
6487
6488         PR gold/12001
6489         * script.h (class Symbol_assignment: name): New member.  Returns
6490         the name of the symbol.
6491         * scrfipt.cc (Script_options::is_pending_assignment): New member.
6492         Returns true if the given symbol name is on the list of
6493         assignments wating to be processed.
6494         * archive.cc (should_incldue_member): If the symbol is undefined,
6495         check to see if it is on the list of symbols pending assignment.
6496
6497 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
6498
6499         * script-sections.cc (Script_sections::find_memory_region): Check
6500         for a NULL output section pointer.
6501
6502 2010-10-29  Doug Kwan  <dougkwan@google.com>
6503
6504         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
6505         Output_section::add_relaxed_input_section.
6506         * output.cc (Output_section::add_relaxed_input_section): Add new
6507         arguments LAYOUT and NAME.  Set section order index.
6508         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
6509         Copy section order index.
6510         * output.h (Output_section::add_relaxed_input_section): Add new
6511         arguments LAYOUT and NAME.
6512
6513 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6514
6515         * testsuite/Makefile.am: Move gcctestdir/ld rule to
6516         NATIVE_OR_CROSS_LINKER.
6517         * testsuite/Makefile.in: Regenerate.
6518
6519 2010-10-20  Doug Kwan  <dougkwan@google.com>
6520
6521         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
6522         without SHF_LINK_ORDER flags.
6523         * layout.cc (Layout::choose_output_section): Do not filter
6524         SHF_LINK_ORDER flag in a relocatable link.
6525
6526 2010-10-17  Cary Coutant  <ccoutant@google.com>
6527
6528         * output.h (Output_segment::set_section_addresses): Change function
6529         signature.  Update all callers.
6530         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
6531         sections.
6532         (Output_segment::set_section_addresses): Align after last TLS
6533         section.  Add padding before last relro section instead of after.
6534
6535 2010-10-17  Doug Kwan  <dougkwan@google.com>
6536
6537         * gold/arm.cc (Target_arm::got_section): Use correct order and set
6538         GOT output section to be writable.
6539
6540 2010-10-14  Cary Coutant  <ccoutant@google.com>
6541
6542         * debug.h (DEBUG_INCREMENTAL): New flag.
6543         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
6544         * gold.cc (queue_initial_tasks): Check parameters for incremental link
6545         mode.
6546         * incremental.cc (report_command_line): Ignore all forms of
6547         --incremental.
6548         * layout.cc (Layout::Layout): Check parameters for incremental link
6549         mode.
6550         * options.cc (General_options::parse_incremental): New function.
6551         (General_options::parse_no_incremental): New function.
6552         (General_options::parse_incremental_full): New function.
6553         (General_options::parse_incremental_update): New function.
6554         (General_options::incremental_mode_): New data member.
6555         (General_options::finalize): Check incremental_mode_.
6556         * options.h (General_options): Update help text for --incremental.
6557         Add --no-incremental, --incremental-full, --incremental-update.
6558         (General_options::Incremental_mode): New enum type.
6559         (General_options::incremental_mode): New function.
6560         (General_options::incremental_mode_): New data member.
6561         * parameters.cc (Parameters::incremental_mode_): New data member.
6562         (Parameters::set_options): Set incremental_mode_.
6563         (Parameters::set_incremental_full): New function.
6564         (Parameters::incremental): New function.
6565         (Parameters::incremental_update): New function.
6566         (set_parameters_incremental_full): New function.
6567         * parameters.h (Parameters::set_incremental_full): New function.
6568         (Parameters::incremental): New function.
6569         (Parameters::incremental_update): New function.
6570         (Parameters::incremental_mode_): New data member.
6571         (set_parameters_incremental_full): New function.
6572         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
6573         incremental link mode.
6574         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
6575         (Sized_relobj::do_relocate_sections): Likewise.
6576         * testsuite/Makefile.am (incremental_test): Use --incremental-full
6577         option.
6578         * testsuite/Makefile.in: Regenerate.
6579         * testsuite/incremental_test.sh: Filter all forms of --incremental.
6580
6581 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6582
6583         * script-sections.h (class Script_sections): Make
6584         Sections_elements typedef public.
6585         * script-sections.cc (class Sort_output_sections): Add elements_
6586         field.  Add constructor which sets it; change all callers.
6587         (Sort_output_sections::is_before): New function.
6588         (Sort_output_sections::operator()): Call is_before.
6589         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
6590         conditional.
6591         * testsuite/script_test_10.sh: New test. Test script section
6592         order.
6593         * testsuite/script_test_10.t: Likewise.
6594         * testsuite/script_test_10.s: Likewise.
6595         * testsuite/Makefile.am: Wrap the cross linker tests and the
6596         common tests into NATIVE_OR_CROSS_LINKER.
6597         (check_SCRIPTS): Add script_test_10.sh.
6598         (check_DATA): Add script_test_10.stdout.
6599         (script_test_10.o, script_test_10): New targets.
6600         (script_test_10.stdout): New target.
6601         * configure, testsuite/Makefile.in: Regenerate.
6602
6603 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6604
6605         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
6606         error for the deprecated relocations.
6607         (Target_arm::Scan::global): Likewise.
6608         (Target_arm::Relocate::relocate): Likewise.
6609
6610 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
6611
6612         * fileread.cc (Input_file::find_file): Initialize *found_name
6613         and *namep when using the fallback search for case 4.
6614
6615 2010-10-11  Cary Coutant  <ccoutant@google.com>
6616
6617         * options.h (class General_options): Redefine -z lazy as an alias for
6618         the negation of -z now.
6619
6620 2010-10-11  Ian Lance Taylor  <iant@google.com>
6621
6622         * resolve.cc (symbol_to_bits): Report the value of the unsupported
6623         binding.
6624
6625 2010-10-06  Nick Clifton  <nickc@redhat.com>
6626
6627         * script-sections.cc(class Memory_region): Remove
6628         current_lma_offset_ field.  Rename current_vma_offset_ to
6629         current_offset_.  Add last_section_ field.
6630         (Memory_region::get_current_vma_address): Rename to
6631         get_current_address.
6632         (Memory_region::get_current_lma_address): Delete.
6633         (Memory_region::increment_vma_offset): Rename to
6634         increment_offset.
6635         (Memory_region::increment_lma_offset): Delete.
6636         (Memory_region::attributes_compatible): New method.  Returns
6637         true if the provided section is compatible with the region.
6638         (Memory_region::get_last_section): New method.  Returns the last
6639         section to use the region.
6640         (Memory_region::set_last_section): New method.  Stores the last
6641         section to use the region.
6642         (Script_sections::block_in_region): New method.  Returns true if
6643         a block of memory is contained within a region.
6644         (Script_sections::find_memory_region): New method.  Locates a
6645         memory region to be used to set a VMA or LMA address.
6646         (Output_section_definition::set_section_addresses): Add code to
6647         check for addresses set by memory regions.
6648         (Output_segment::set_section_addresses): Remove memory region
6649         walking code.
6650         (Script_sections::create_segment): Add a warning if a header
6651         segment is created outside of any region.
6652         * script-sections.h (class Script_sections): Add prototypes for
6653         find_memory_region and block_in_region methods.
6654         * testsuite/memory_test.s: Use .long instead of .word.
6655         * testsuite/memory_test.t: Add some more output sections.
6656         * testsuite/memory_test.sh: Update expected output.
6657
6658 2010-10-02  Doug Kwan  <dougkwan@google.com>
6659
6660         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
6661         defintion to symtab.h
6662         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
6663         declaration to defintion.
6664
6665 2010-10-01  Nick Clifton  <nickc@redhat.com>
6666
6667         * expression.cc (eval): Replace dummy argument with NULL.
6668         (eval_maybe_dot): Check for a NULL result section pointer.
6669         (Symbol_expression::value): Likewise.
6670         (Dot_expression::value): Likewise.
6671         (BINARY_EXPRESSION): Likewise.
6672         (Max_expression::value): Likewise.
6673         (Min_expression::value): Likewise.
6674         (Absolute_expression::value): Likewise.
6675         (Addr_expression::value_from_output_section): Likewise.
6676         (Loaddddr_expression::value_from_output_section): Likewise.
6677         (Segment_start_expression::value): Likewise.
6678         * script-sections.cc
6679         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
6680         argument with NULL.
6681         (Sections_elememt_dot_assignment::set_section_addresses):
6682         Likewise.
6683         (Output_data_expression::do_write_to_buffer): Likewise.
6684         (Output_section_definition::finalize_symbols): Likewise.
6685         (Output_section_definition::set_section_addresses): Likewise.
6686
6687 2010-09-30  Doug Kwan  <dougkwan@google.com>
6688
6689         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
6690
6691 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
6692
6693         * target.h (Target::can_icf_inline_merge_sections): New virtual
6694         function.
6695         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
6696         virtual function.
6697         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
6698         virtual function.
6699         * icf.cc (get_section_contents): Inline merge sections only when
6700         target allows it.
6701
6702 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6703
6704         * configure: Regenerate.
6705
6706 2010-09-17  Ian Lance Taylor  <iant@google.com>
6707
6708         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
6709         * testsuite/Makefile.am (memory_test.o): New target.
6710         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
6711         memory_test.t.
6712         * testsuite/Makefile.in: Rebuild.
6713
6714 2010-09-17  Doug Kwan  <dougkwan@google.com>
6715
6716         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
6717         defintion if relocation uses GOT entries of the symbol.
6718         * testsuite/icf_safe_test.sh: Fix test.
6719         * testsuite/icf_safe_so_test.sh: Fix test.
6720
6721 2010-09-16  Cary Coutant  <ccoutant@google.com>
6722
6723         * script_sections.cc (class Memory_region): Remove "NULL" from
6724         vector initializations.
6725
6726 2010-09-15  Cary Coutant  <ccoutant@google.com>
6727
6728         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
6729         Resolve forwarding symbols.
6730
6731 2010-09-15  Doug Kwan  <dougkwan@google.com>
6732
6733         * gold/testsuite/script_test_3.t: Add ARM special sections.
6734         * gold/testsuite/script_test_4.t: Same.
6735         * gold/testsuite/script_test_5.t: Same.
6736         * gold/testsuite/script_test_6.t: Same.
6737         * gold/testsuite/script_test_7.t: Same.
6738         * gold/testsuite/script_test_7.t: Same.
6739         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
6740
6741 2010-09-14  Cary Coutant  <ccoutant@google.com>
6742
6743         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
6744         (Target_x86_64::Relocate::relocate_tls): Replace check for
6745         saw_tls_block_reloc_ with test for executable section.
6746
6747 2010-09-12  Cary Coutant  <ccoutant@google.com>
6748
6749         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
6750         position-independent executables to shared libraries need dynamic
6751         relocations.
6752         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
6753         position-independent executables.
6754         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
6755         * testsuite/Makefile.in: Regenerate.
6756
6757 2010-09-10  Nick Clifton  <nickc@redhat.com>
6758
6759         PR gold/11997
6760         * testsuite/memory_test.t: Discard any sections that are not
6761         needed.
6762
6763 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
6764
6765         PR gold/11996
6766         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
6767         "This::" to work around a bug in gcc 4.2.
6768
6769         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
6770
6771 2010-09-09  Rafael Espindola  <espindola@google.com>
6772
6773         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
6774         sections with different PF_X flags in the same segment.
6775         (Layout::find_first_load_seg): Search all segments to find the first
6776         one.
6777         * options.h (rosegment): New.
6778
6779 2010-09-08  Rafael Espindola  <espindola@google.com>
6780
6781         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
6782
6783 2010-09-08  Doug Kwan  <dougkwan@google.com>
6784
6785         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
6786         (Arm_relobj::do_relocate_sections): Add new parameter for output
6787         file to match the parent.
6788         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
6789         of local symbols instead of input values.  Update code to track
6790         changes in gold::relocate_section.
6791         * object.cc (Sized_relobj::compute_final_local_value): New methods.
6792         (Sized_relobj::compute_final_local_value_internal): New methods.
6793         (Sized_relobj::do_finalize_local_symbols): Move code from loop
6794         body into private version of Sized_relobj::compute_final_local_value.
6795         Call the inline method.
6796         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
6797         merged symbol value if there is one.
6798         (Symbol_value::has_output_value): New method defintiion.
6799         (Sized_relobj::Compute_final_local_value_status): New enum type.
6800         (Sized_relobj::compute_final_local_value): New methods.
6801         (Sized_relobj::compute_final_local_value_internal): New methods.
6802         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
6803         and arm_cortex_a8.sh.
6804         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
6805         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
6806         New tests.
6807         * Makefile.in: Regenerate.
6808         * testsuite/arm_bl_out_of_range.s: Update test.
6809         * testsuite/thumb_bl_out_of_range.s: Ditto.
6810         * testsuite/thumb_blx_out_of_range.s: Ditto.
6811         * testsuite/arm_branch_out_of_range.sh: New file.
6812         * testsuite/arm_cortex_a8.sh: Ditto.
6813         * testsuite/arm_cortex_a8_b.s: Ditto.
6814         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
6815         * testsuite/arm_cortex_a8_b_local.s: Ditto.
6816         * testsuite/arm_cortex_a8_bl.s: Ditto.
6817         * testsuite/arm_cortex_a8_blx.s: Ditto.
6818         * testsuite/arm_cortex_a8_local.s: Ditto.
6819         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
6820         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
6821
6822 2010-09-08  Rafael Espindola  <espindola@google.com>
6823
6824         * Makefile.am (memory_test.stdout): Run readelf with -W.
6825         * Makefile.in: Regenerate.
6826         * testsuite/memory_test.sh: Make the regexps accept both 32 and
6827         64 bit output.
6828
6829 2010-09-08  Rafael Espindola  <espindola@google.com>
6830
6831         * script-sections.cc (Script_sections::add_memory_region): Convert
6832         field precision to int.
6833         * script.cc (script_set_section_region, script_set_section_region):
6834         Convert field precision to int.
6835
6836 2010-09-08  Rafael Espindola  <espindola@google.com>
6837
6838         * arm.cc (do_finalize_sections): Create the __exidx_start and
6839         __exdix_end symbols even when the section is missing.
6840
6841 2010-09-08  Nick Clifton  <nickc@redhat.com>
6842
6843         * README: Remove claim that MEMORY is not supported.
6844         * expression.cc (script_exp_function_origin)
6845         (script_exp_function_length): Move from here to ...
6846         * script.cc: ... here.
6847         (script_set_section_region, script_add_memory)
6848         (script_parse_memory_attr, script_include_directive): New
6849         functions.
6850         * script-sections.cc
6851         (class Memory_region): New class.
6852         (class Output_section_definition): Add set_memory_region,
6853         set_section_vma, set_section_lma and get_section_name methods.
6854         (class Script_Sections): Add add_memory_region,
6855         find_memory_region, find_memory_region_origin,
6856         find_memory_region_length and set_memory_region methods.
6857         Have set_section_addresses method walk the list of set memory
6858         regions.
6859         Extend the print methos to display memory regions.
6860         * script-sections.h: Add prototypes for new methods.
6861         Add enum for MEMORY region attributes.
6862         * yyscript.y: Add support for parsing MEMORY regions.
6863         * script-c.h: Add prototypes for new functions.
6864         * testsuite/Makefile.am: Add test of MEMORY region functionality.
6865         * testsuite/Makefile.in: Regenerate.
6866         * testsuite/memory_test.sh: New script.
6867         * testsuite/memory_test.s: New assembler source file.
6868         * testsuite/memory_test.t: New linker script.
6869
6870 2010-08-27  Doug Kwan  <dougkwan@google.com>
6871
6872         * gold/resolve.cc (Symbol_table::should_override): Let a weak
6873         reference override an existing dynamic weak reference.
6874         * testsuite/Makefile.am: Add new test dyn_weak_ref.
6875         * testsuite/Makefile.in: Regenerate.
6876         * testsuite/dyn_weak_ref.sh: New file.
6877         * testsuite/dyn_weak_ref_1.c: Ditto.
6878         * testsuite/dyn_weak_ref_2.c: Ditto.
6879
6880 2010-08-27  Ian Lance Taylor  <iant@google.com>
6881
6882         * incremental.h (class Incremental_input_entry): Add virtual
6883         destructor.
6884
6885 2010-08-27  Ian Lance Taylor  <iant@google.com>
6886
6887         * testsuite/start_lib_test_3.c: Mark t3 as used.
6888
6889 2010-08-27  Nick Clifton  <nickc@redhat.com>
6890
6891         * options.cc (version_script): Fix small typo in previous
6892         whitespace tidyup.
6893
6894 2010-08-25  Nick Clifton  <nickc@redhat.com>
6895
6896         * archive.cc: Formatting fixes: Remove whitespace between
6897         typename and following asterisk.  Remove whitespace between
6898         function name and opening parenthesis.
6899         * archive.h: Likewise.
6900         * arm.cc: Likewise.
6901         * attributes.cc: Likewise.
6902         * attributes.h: Likewise.
6903         * common.cc: Likewise.
6904         * copy-relocs.cc: Likewise.
6905         * dirsearch.h: Likewise.
6906         * dynobj.cc: Likewise.
6907         * ehframe.cc: Likewise.
6908         * ehframe.h: Likewise.
6909         * expression.cc: Likewise.
6910         * fileread.cc: Likewise.
6911         * fileread.h: Likewise.
6912         * gc.h: Likewise.
6913         * gold-threads.cc: Likewise.
6914         * gold.cc: Likewise.
6915         * i386.cc: Likewise.
6916         * icf.h: Likewise.
6917         * incremental-dump.cc: Likewise.
6918         * incremental.cc: Likewise.
6919         * layout.cc: Likewise.
6920         * layout.h: Likewise.
6921         * main.cc: Likewise.
6922         * merge.cc: Likewise.
6923         * merge.h: Likewise.
6924         * object.cc: Likewise.
6925         * object.h: Likewise.
6926         * options.cc: Likewise.
6927         * options.h: Likewise.
6928         * output.cc: Likewise.
6929         * output.h: Likewise.
6930         * plugin.cc: Likewise.
6931         * plugin.h: Likewise.
6932         * powerpc.cc: Likewise.
6933         * reloc.cc: Likewise.
6934         * script-c.h: Likewise.
6935         * script-sections.cc: Likewise.
6936         * script.cc: Likewise.
6937         * stringpool.cc: Likewise.
6938         * symtab.cc: Likewise.
6939         * symtab.h: Likewise.
6940         * target.cc: Likewise.
6941         * timer.cc: Likewise.
6942         * timer.h: Likewise.
6943         * version.cc: Likewise.
6944         * x86_64.cc: Likewise.
6945
6946 2010-08-24  Nick Clifton  <nickc@redhat.com>
6947
6948         PR 11899
6949         * layout.cc (segment_precedes): Sort segments by their physical
6950         addresses, if they have been set.
6951
6952 2010-08-23  Cary Coutant  <ccoutant@google.com>
6953
6954         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
6955         symbols data.
6956         (Lib_group::include_member): Unlock object after deleting its
6957         symbols data.
6958         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
6959         the bug fixed here.
6960
6961 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
6962             Cary Coutant  <ccoutant@google.com>
6963
6964         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
6965         constructor, and set_blocker.
6966         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
6967         readsyms_blocker_.
6968         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
6969         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
6970         * testsuite/Makefile.am (start_lib_test): New test case.
6971         * testsuite/Makefile.in: Regenerate.
6972         * testsuite/start_lib_test_main.c: New file.
6973         * testsuite/start_lib_test_1.c: New file.
6974         * testsuite/start_lib_test_2.c: New file.
6975         * testsuite/start_lib_test_3.c: New file.
6976
6977 2010-08-19  Ian Lance Taylor  <iant@google.com>
6978
6979         * Makefile.in: Rebuild with automake 1.11.1.
6980         * aclocal.m4: Likewise.
6981         * testsuite/Makefile.in: Likewise.
6982
6983 2010-08-19  Ian Lance Taylor  <iant@google.com>
6984
6985         PR 10893
6986         * i386.cc (class Output_data_plt_i386): Update declarations.
6987         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
6988         local_ifuncs_ fields.
6989         (Target_i386::do_plt_section_for_global): New function.
6990         (Target_i386::do_plt_section_for_local): New function.
6991         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
6992         parameter; change all callers.  Initialize global_ifuncs_ and
6993         local_ifuncs_.  If doing a static link define __rel_iplt_start and
6994         __rel_iplt_end.
6995         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
6996         (Output_data_plt_i386::add_local_ifunc_entry): New function.
6997         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
6998         symbols.
6999         (Target_i386::make_plt_section): New function, broken out of
7000         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
7001         (Target_i386::make_plt_entry): Call make_plt_section.
7002         (Target_i386::make_local_ifunc_plt_entry): New function.
7003         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
7004         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
7005         R_386_IRELATIVE to switch.
7006         (Target_i386::Scan::global): Likewise.
7007         (Target_i386::Relocate::relocate): Likewise.
7008         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
7009         switch.
7010         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
7011         (Target_x86_64::do_plt_section_for_global): New function.
7012         (Target_x86_64::do_plt_section_for_local): New function.
7013         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
7014         parameter; change all callers.  If doing a static link define
7015         __rela_iplt_start and __rela_iplt_end.
7016         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
7017         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
7018         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
7019         to point to .plt.
7020         (Target_x86_64::make_local_ifunc_plt_entry): New function.
7021         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
7022         switch.
7023         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
7024         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
7025         R_X86_64_IRELATIVE to switch.
7026         (Target_x86_64::Scan::global): Likewise.
7027         (Target_x86_64::Relocate::relocate): Likewise.
7028         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
7029         switch.
7030         * target.h (class Target): Add plt_section_for_global and
7031         plt_section_for_local functions.  Add do_plt_section_for_global
7032         and do_plt_section_for_local virtual functions.
7033         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
7034         clarifying comments.
7035         (Symbol::use_plt_offset): Handle IFUNC symbol.
7036         * object.cc (Sized_relobj::Sized_relobj): Initialize
7037         local_plt_offsets_.
7038         (Sized_relobj::local_has_plt_offset): New function.
7039         (Sized_relobj::local_plt_offset): New function.
7040         (Sized_relobj::set_local_plt_offset): New function.
7041         (Sized_relobj::do_count): Handle IFUNC symbol.
7042         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
7043         a bit away from input_shndx_ field.  Add set_is_func_symbol and
7044         is_ifunc_symbol functions.
7045         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
7046         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
7047         local_plt_offsets_ field.
7048         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
7049         * output.h (class Output_section_data): Add non-const
7050         output_section function.
7051         (class Output_data_got): Update declarations.
7052         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
7053         Add use_plt_offset parameter to global and local constructors.
7054         Change all callers.  Change local_sym_index_ field to 31 bits.
7055         Change GSYM_CODE and CONSTANT_CODE accordingly.
7056         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
7057         doing a static link don't set sh_link field.
7058         (Output_data_got::Got_entry::write): Use PLT offset if
7059         appropriate.
7060         (Output_data_got::add_global_plt): New function.
7061         (Output_data_got::add_local_plt): New function.
7062         * target-reloc.h (relocate_section): Handle IFUNC symbol.
7063         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
7064         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
7065         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
7066         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
7067         IFUNC conditional.
7068         * testsuite/ifunc-sel.h: New file.
7069         * testsuite/ifuncmain1.c: New file.
7070         * testsuite/ifuncmain1vis.c: New file.
7071         * testsuite/ifuncmod1.c: New file.
7072         * testsuite/ifuncdep2.c: New file.
7073         * testsuite/ifuncmain2.c: New file.
7074         * testsuite/ifuncmain3.c: New file.
7075         * testsuite/ifuncmod3.c: New file.
7076         * testsuite/ifuncmain4.c: New file.
7077         * testsuite/ifuncmain5.c: New file.
7078         * testsuite/ifuncmod5.c: New file.
7079         * testsuite/ifuncmain6pie.c: New file.
7080         * testsuite/ifuncmod6.c: New file.
7081         * testsuite/ifuncmain7.c: New file.
7082         * configure, testsuite/Makefile.in: Rebuild.
7083
7084 2010-08-18  Ian Lance Taylor  <iant@google.com>
7085
7086         * incremental.cc
7087         (Output_section_incremental_inputs::write_input_files): Add cast
7088         to avoid signed/unsigned comparison warning.
7089         (Output_section_incremental_inputs::write_info_blocks): Likewise.
7090
7091 2010-08-12  Cary Coutant  <ccoutant@google.com>
7092
7093         * common.cc (Sort_commons::operator()): Remove unnecessary code.
7094
7095 2010-08-13  Ian Lance Taylor  <iant@google.com>
7096
7097         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
7098
7099 2010-08-12  Cary Coutant  <ccoutant@google.com>
7100             Doug Kwan  <dougkwan@google.com>
7101
7102         * resolve.cc (Symbol_table::should_override): When a weak dynamic
7103         defintion overrides non-weak undef, remember that the original undef
7104         is not weak.
7105         * symtab.cc (Symbol_table::sized_write_global): For undef without
7106         an original weak binding, set binding to global in output.
7107         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
7108         * testsuite/Makefile.in: Regenerate.
7109         * testsuite/strong_ref_weak_def.sh: New file.
7110         * testsuite/strong_ref_weak_def_1.c: Ditto.
7111         * testsuite/strong_ref_weak_def_2.c: Ditto.
7112
7113 2010-08-12  Cary Coutant  <ccoutant@google.com>
7114
7115         * testsuite/incremental_test.sh: Rewrite.
7116         * testsuite/incremental_test_1.c: Rewrite.
7117         * testsuite/incremental_test_2.c: Rewrite.
7118
7119 2010-08-12  Cary Coutant  <ccoutant@google.com>
7120
7121         * arm.cc (Target_arm::got_size): Add const.
7122         (Target_arm::got_entry_count): New function.
7123         (Target_arm::plt_entry_count): New function.
7124         (Target_arm::first_plt_entry_offset): New function.
7125         (Target_arm::plt_entry_size): New function.
7126         (Output_data_plt_arm::entry_count): New function.
7127         (Output_data_plt_arm::first_plt_entry_offset): New function.
7128         (Output_data_plt_arm::get_plt_entry_size): New function.
7129         * i386.cc (Target_i386::got_size): Add const.
7130         (Target_i386::got_entry_count): New function.
7131         (Target_i386::plt_entry_count): New function.
7132         (Target_i386::first_plt_entry_offset): New function.
7133         (Target_i386::plt_entry_size): New function.
7134         (Output_data_plt_i386::entry_count): New function.
7135         (Output_data_plt_i386::first_plt_entry_offset): New function.
7136         (Output_data_plt_i386::get_plt_entry_size): New function.
7137         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
7138         find_incremental_inputs_sections.  Dump incremental_got_plt section.
7139         * incremental.cc: Include target.h.
7140         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
7141         parameter.  Adjust all callers.  Find incremental_got_plt section.
7142         (Incremental_inputs::create_data_sections): Create incremental_got_plt
7143         section.
7144         (Output_section_incremental_inputs::set_final_data_size): Calculate
7145         size of incremental_got_plt section.
7146         (Output_section_incremental_inputs::do_write): Write the
7147         incremental_got_plt section.
7148         (Got_plt_view_info): New struct.
7149         (Local_got_offset_visitor): New class.
7150         (Global_got_offset_visitor): New class.
7151         (Global_symbol_visitor_got_plt): New class.
7152         (Output_section_incremental_inputs::write_got_plt): New function.
7153         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
7154         Add parameter.  Adjust all callers.
7155         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
7156         (Incremental_inputs::got_plt_section): New function.
7157         (Incremental_inputs::got_plt_section_): New data member.
7158         (Incremental_got_plt_reader): New class.
7159         * layout.cc (Layout::create_incremental_info_sections): Add the
7160         incremental_got_plt section.
7161         * object.h (Got_offset_list::get_list): New function.
7162         (Got offset_list::for_all_got_offsets): New function.
7163         (Sized_relobj::local_got_offset_list): New function.
7164         * powerpc.cc (Target_powerpc::got_size): Add const.
7165         (Target_powerpc::got_entry_count): New function.
7166         (Target_powerpc::plt_entry_count): New function.
7167         (Target_powerpc::first_plt_entry_offset): New function.
7168         (Target_powerpc::plt_entry_size): New function.
7169         (Output_data_plt_powerpc::entry_count): New function.
7170         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
7171         (Output_data_plt_powerpc::get_plt_entry_size): New function.
7172         * sparc.cc (Target_sparc::got_size): Add const.
7173         (Target_sparc::got_entry_count): New function.
7174         (Target_sparc::plt_entry_count): New function.
7175         (Target_sparc::first_plt_entry_offset): New function.
7176         (Target_sparc::plt_entry_size): New function.
7177         (Output_data_plt_sparc::entry_count): New function.
7178         (Output_data_plt_sparc::first_plt_entry_offset): New function.
7179         (Output_data_plt_sparc::get_plt_entry_size): New function.
7180         * symtab.h (Symbol::got_offset_list): New function.
7181         (Symbol_table::for_all_symbols): New function.
7182         * target.h (Sized_target::got_entry_count): New function.
7183         (Sized_target::plt_entry_count): New function.
7184         (Sized_target::plt_entry_size): New function.
7185         * x86_64.cc (Target_x86_64::got_size): Add const.
7186         (Target_x86_64::got_entry_count): New function.
7187         (Target_x86_64::plt_entry_count): New function.
7188         (Target_x86_64::first_plt_entry_offset): New function.
7189         (Target_x86_64::plt_entry_size): New function.
7190         (Output_data_plt_x86_64::entry_count): New function.
7191         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
7192         (Output_data_plt_x86_64::get_plt_entry_size): New function.
7193
7194 2010-08-12  Cary Coutant  <ccoutant@google.com>
7195
7196         * archive.cc: Include incremental.h.
7197         (Archive::Archive): Initialize incremental_info_.
7198         (Archive::include_member): Record archive members in incremental info.
7199         (Add_archive_symbols::run): Record begin and end of an archive in
7200         incremental info.
7201         (Lib_group::include_member): Record objects in incremental info.
7202         * archive.h (Incremental_archive_entry): Forward declaration.
7203         (Archive::set_incremental_info): New member function.
7204         (Archive::incremental_info): New member function.
7205         (Archive::Unused_symbol_iterator): New class.
7206         (Archive::unused_symbols_begin): New member function.
7207         (Archive::unused_symbols_end): New member function.
7208         (Archive::incremental_info_): New data member.
7209         * incremental-dump.cc (find_input_containing_global): New function.
7210         (dump_incremental_inputs): Dump new incremental info sections.
7211         * incremental.cc: Include symtab.h.
7212         (Output_section_incremental_inputs): New class.
7213         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
7214         new incremental info sections.
7215         (Sized_incremental_binary::do_check_inputs): Likewise.
7216         (Incremental_inputs::report_archive): Remove.
7217         (Incremental_inputs::report_archive_begin): New function.
7218         (Incremental_inputs::report_archive_end): New function.
7219         (Incremental_inputs::report_object): New function.
7220         (Incremental_inputs::finalize_inputs): Remove.
7221         (Incremental_inputs::report_input_section): New function.
7222         (Incremental_inputs::report_script): Rewrite.
7223         (Incremental_inputs::finalize): Do nothing but finalize string table.
7224         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
7225         (Incremental_inputs::sized_create_inputs_section_data): Remove.
7226         (Incremental_inputs::create_data_sections): New function.
7227         (Incremental_inputs::relocs_entsize): New function.
7228         (Output_section_incremental_inputs::set_final_data_size): New function.
7229         (Output_section_incremental_inputs::do_write): New function.
7230         (Output_section_incremental_inputs::write_header): New function.
7231         (Output_section_incremental_inputs::write_input_files): New function.
7232         (Output_section_incremental_inputs::write_info_blocks): New function.
7233         (Output_section_incremental_inputs::write_symtab): New function.
7234         * incremental.h (Incremental_script_entry): Forward declaration.
7235         (Incremental_object_entry): Forward declaration.
7236         (Incremental_archive_entry): Forward declaration.
7237         (Incremental_inputs): Forward declaration.
7238         (Incremental_inputs_header_data): Remove.
7239         (Incremental_inputs_header): Remove.
7240         (Incremental_inputs_header_write): Remove.
7241         (Incremental_inputs_entry_data): Remove.
7242         (Incremental_inputs_entry): Remove.
7243         (Incremental_inputs_entry_write): Remove.
7244         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
7245         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
7246         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
7247         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
7248         Likewise.
7249         (Incremental_input_entry): New class.
7250         (Incremental_script_entry): New class.
7251         (Incremental_object_entry): New class.
7252         (Incremental_archive_entry): New class.
7253         (Incremental_inputs::Incremental_inputs): Initialize new data members.
7254         (Incremental_inputs::report_inputs): Remove.
7255         (Incremental_inputs::report_archive): Remove.
7256         (Incremental_inputs::report_archive_begin): New function.
7257         (Incremental_inputs::report_archive_end): New function.
7258         (Incremental_inputs::report_object): Change prototype.
7259         (Incremental_inputs::report_input_section): New function.
7260         (Incremental_inputs::report_script): Change prototype.
7261         (Incremental_inputs::get_reloc_count): New function.
7262         (Incremental_inputs::set_reloc_count): New function.
7263         (Incremental_inputs::create_data_sections): New function.
7264         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
7265         (Incremental_inputs::inputs_section): New function.
7266         (Incremental_inputs::symtab_section): New function.
7267         (Incremental_inputs::relocs_section): New function.
7268         (Incremental_inputs::get_stringpool): Add const.
7269         (Incremental_inputs::command_line): Add const.
7270         (Incremental_inputs::inputs): Remove.
7271         (Incremental_inputs::command_line_key): New function.
7272         (Incremental_inputs::input_file_count): New function.
7273         (Incremental_inputs::input_files): New function.
7274         (Incremental_inputs::relocs_entsize): New function.
7275         (Incremental_inputs::sized_create_inputs_section_data): Remove.
7276         (Incremental_inputs::finalize_inputs): Remove.
7277         (Incremental_inputs::Input_info): Remove.
7278         (Incremental_inputs::lock_): Remove.
7279         (Incremental_inputs::inputs_): Change type.
7280         (Incremental_inputs::inputs_map_): Remove.
7281         (Incremental_inputs::current_object_entry_): New data member.
7282         (Incremental_inputs::inputs_section_): New data member.
7283         (Incremental_inputs::symtab_section_): New data member.
7284         (Incremental_inputs::relocs_section_): New data member.
7285         (Incremental_inputs::reloc_count_): New data member.
7286         (Incremental_inputs_reader): New class.
7287         (Incremental_symtab_reader): New class.
7288         (Incremental_relocs_reader): New class.
7289         * layout.cc (Layout::finalize): Move finalization of incremental info
7290         and creation of incremental info sections to follow finalization of
7291         symbol table.  Set offsets for postprocessing sections.
7292         (Layout::create_incremental_info_sections): Call
7293         Incremental_inputs::create_data_sections.  Add incremental symtab
7294         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
7295         sections to layout after input sections.
7296         * layout.h (struct Timespec): Forward declaration.
7297         (Layout::incremental_inputs): Add const.
7298         (Layout::create_incremental_info_sections): Add parameter.
7299         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
7300         * object.cc: Include incremental.h.
7301         (Relobj::finalize_incremental_relocs): New function.
7302         (Sized_relobj::do_layout): Record input sections in incremental info.
7303         * object.h (Object::output_section): New function.
7304         (Object::output_section_offset): Moved from Relobj.
7305         (Object::get_incremental_reloc_base): New function.
7306         (Object::get_incremental_reloc_count): New function.
7307         (Object::do_output_section): New function.
7308         (Object::do_output_section_offset): Moved from Relobj.
7309         (Object::do_get_incremental_reloc_base): New function.
7310         (Object::do_get_incremental_reloc_count): New function.
7311         (Object::Object): Initialize new data members.
7312         (Relobj::output_section): Renamed do_output_section and moved to
7313         protected.
7314         (Relobj::output_section_offset): Moved to Object.
7315         (Relobj::do_get_incremental_reloc_base): New function.
7316         (Relobj::do_get_incremental_reloc_count): New function.
7317         (Relobj::allocate_incremental_reloc_counts): New function.
7318         (Relobj::count_incremental_reloc): New function.
7319         (Relobj::finalize_incremental_relocs): New function.
7320         (Relobj::next_incremental_reloc_index): New function.
7321         (Relobj::reloc_counts_): New data member.
7322         (Relobj::reloc_bases_): New data member.
7323         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
7324         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
7325         (Sized_relobj::incremental_relocs_scan): New function.
7326         (Sized_relobj::incremental_relocs_scan_reltype): New function.
7327         (Sized_relobj::incremental_relocs_write): New function.
7328         (Sized_relobj::incremental_relocs_write_reltype): New function.
7329         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
7330         incremental link.
7331         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
7332         archives and object files elsewhere.
7333         (Add_symbols::run): Report object files here.
7334         (Finish_group::run): Report end of archive at end of group.
7335         * reloc.cc: Include layout.h, incremental.h.
7336         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
7337         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
7338         (Sized_relobj::incremental_relocs_scan): New function.
7339         (Sized_relobj::incremental_relocs_scan_reltype): New function.
7340         (Sized_relobj::do_relocate_sections): Write incremental relocations.
7341         (Sized_relobj::incremental_relocs_write): New function.
7342         (Sized_relobj::incremental_relocs_write_reltype): New function.
7343         * script.cc (read_input_script): Rewrite test for incremental link.
7344         Change call to Incremental_inputs::report_script.
7345         * symtab.h (Symbol_table::first_global_index): New function.
7346         (Symbol_table::output_count): New function.
7347
7348 2010-08-12  Doug Kwan  <dougkwan@google.com>
7349
7350         * arm.cc (Target_arm::merge_object_attributes): Check command line
7351         options --no-wchar-size-warning and --no-enum-size-warning.
7352         * options.h (General_options): Add ld-compatible options
7353         --no-enum-size-warning and --no-wchar-size-warning.
7354
7355 2010-08-04  Ian Lance Taylor  <iant@google.com>
7356
7357         * x86_64.cc (Target_x86_64::Scan::local): Use
7358         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
7359         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
7360         (Target_x86_64::Scan::global): Likewise.
7361         (Target_x86_64::Relocate::relocate): Likewise.
7362         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
7363         Likewise.
7364
7365 2010-08-03  Cary Coutant  <ccoutant@google.com>
7366
7367         * merge.cc (Output_merge_string::do_add_input_section): Count strings
7368         to reserve space in merged_strings vector. Keep total input size
7369         for stats.
7370         (Output_merge_string::do_print_merge_stats): Print total input size.
7371         * merge.h (Output_merge_string): Add input_size_ field.
7372         * stringpool.cc (Stringpool_template::string_length): Move
7373         implementations out of Stringpool_template class and place in
7374         stringpool.h.
7375         * stringpool.h (string_length): Move out of Stringpool_template.
7376
7377 2010-08-03  Ian Lance Taylor  <iant@google.com>
7378
7379         PR 11712
7380         * layout.cc (relaxation_loop_body): If address of load segment is
7381         set, adjust address to include headers if possible.
7382
7383 2010-08-03  Ian Lance Taylor  <iant@google.com>
7384
7385         * version.cc (version_string): Bump to 1.10.
7386
7387 2010-08-03  Ian Lance Taylor  <iant@google.com>
7388
7389         PR 11805
7390         * layout.h (enum Output_section_order): Define.
7391         (class Layout): Update declarations.
7392         * layout.cc (Layout::get_output_section): Add order parameter.
7393         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
7394         is_first_non_relro parameters.  Change all callers.
7395         (Layout::choose_output_section): Likewise.
7396         (Layout::add_output_section_data): Likewise.
7397         (Layout::make_output_section): Likewise.  Set order.
7398         (Layout::default_section_order): New function.
7399         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
7400         * output.cc (Output_section::Output_section): Initialize order_.
7401         Don't initialize deleted fields.
7402         (Output_segment::Output_segment): Don't initialize deleted
7403         fields.
7404         (Output_segment::add_output_section_to_load): New function
7405         replacing add_output_section.  Change all callers to call this or
7406         add_output_section_to_nonload.
7407         (Output_segment::add_output_section_to_nonload): New function.
7408         (Output_segment::remove_output_section): Rewrite.
7409         (Output_segment::add_initial_output_data): Likewise.
7410         (Output_segment::has_any_data_sections): Likewise.
7411         (Output_segment::is_first_section_relro): Likewise.
7412         (Output_segment::maximum_alignment): Likewise.
7413         (Output_segment::has_dynamic_reloc): New function replacing
7414         dynamic_reloc_count.  Change all callers.
7415         (Output_segment::has_dynamic_reloc_list): New function replacing
7416         dynamic_reloc_count_list.  Change all callers.
7417         (Output_segment::set_section_addresses): Rewrite.
7418         (Output_segment::set_offset): Rewrite.
7419         (Output_segment::find_first_and_last_list): Remove.
7420         (Output_segment::set_tls_offsets): Rewrite.
7421         (Output_segment::first_section_load_address): Likewise.
7422         (Output_segment::output_section_count): Likewise.
7423         (Output_segment::section_with_lowest_load_address): Likewise.
7424         (Output_segment::write_section_headers): Likewise.
7425         (Output_segment::print_sections_to_map): Likewise.
7426         * output.h (class Output_data): Remove dynamic_reloc_count_
7427         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
7428         (Output_data::add_dynamic_reloc): Rewrite.
7429         (Output_data::has_dynamic_reloc): New function.
7430         (Output_data::dynamic_reloc_count): Remove.
7431         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
7432         is_last_relro_, is_first_non_relro_, is_interp_,
7433         is_dynamic_linker_section_ fields.  Add order and set_order
7434         functions.  Remove is_relro_local, set_is_relro_local,
7435         is_last_relro, set_is_last_relro, is_first_non_relro,
7436         set_is_first_non_relro functions, is_interp, set_is_interp,
7437         is_dynamic_linker_section, and set_is_dynamic_linker_section
7438         functions.
7439         (class Output_segment): Change Output_data_list from std::list to
7440         std:;vector.  Add output_lists_ field.  Remove output_data_ and
7441         output_bss_ fields.  Update declarations.
7442
7443 2010-08-02  Ian Lance Taylor  <iant@google.com>
7444
7445         * arm.cc (Target_arm::gc_process_relocs): Use typename.
7446         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
7447         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
7448
7449 2010-08-02  Ian Lance Taylor  <iant@google.com>
7450
7451         PR 11855
7452         * script.cc (Script_options::Script_options): Initialize
7453         symbol_definitions_ and symbol_references_.
7454         (Script_options::add_symbol_assignment): Update
7455         symbol_definitions_ and symbol_references_.
7456         (Script_options::add_symbol_reference): New function.
7457         (script_symbol): New function.
7458         * script.h (class Script_options): Add symbol_definitions_ and
7459         symbol_references_ fields.
7460         (Script_options::referenced_const_iterator): New type.
7461         (Script_options::referenced_begin): New function.
7462         (Script_options::referenced_end): New function.
7463         (Script_options::is_referenced): New function.
7464         (Script_options::any_unreferenced): New function.
7465         * script-c.h (script_symbol): Declare.
7466         * yyscript.y (exp): Call script_symbol.
7467         * symtab.cc: Include "script.h".
7468         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
7469         Change all callers.  Check symbols referenced by scripts.
7470         (Symbol_table::add_undefined_symbols_from_command_line): Add
7471         layout parameter.  Change all callers.
7472         (Symbol_table::do_add_undefined_symbols_from_command_line):
7473         Likewise.  Break out loop body.  Check symbols referenced by
7474         scripts.
7475         (Symbol_table::add_undefined_symbol_from_command_line): New
7476         function broken out of
7477         do_add_undefined_symbols_from_command_line.
7478         * symtab.h (class Symbol_table): Update declarations.
7479         * archive.cc: Include "layout.h".
7480         (Archive::should_include_member): Add layout parameter.  Change
7481         all callers.  Check for symbol mentioned in expression.
7482         * archive.h (class Archive): Update declaration.
7483         * object.cc (Sized_relobj::do_should_include_member): Add layout
7484         parameter.
7485         * object.h (Object::should_include_member): Add layout parameter.
7486         Change all callers.
7487         (Object::do_should_include_member): Add layout parameter.
7488         (class Sized_relobj): Update declaration.
7489         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
7490         parameter.
7491         * dynobj.h (class Sized_dynobj): Update declaration.
7492         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
7493         layout parameter.
7494         * plugin.h (class Sized_pluginobj): Update declaration.
7495
7496 2010-08-02  Ian Lance Taylor  <iant@google.com>
7497
7498         PR 11866
7499         * output.cc (Output_segment::set_offset): Search for the first and
7500         last sections rather than assuming that the list is in order.
7501         (Output_segment::find_first_and_last_list): New function.
7502         * output.h (class Output_segment): Update declarations.
7503         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
7504         (relro_strip_test_SOURCES): New variable.
7505         (relro_strip_test_DEPENDENCIES): New variable.
7506         (relro_strip_test_LDFLAGS): New variable.
7507         (relro_strip_test_LDADD): New variable.
7508         (relro_strip_test.so): New target.
7509
7510 2010-08-02  Ian Lance Taylor  <iant@google.com>
7511
7512         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
7513         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
7514         (Target_i386::got_tlsdesc_section): New function.
7515         (Target_i386::got_section): Create space for GOT entries for
7516         TLSDESC relocations.
7517         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
7518         R_386_TLS_GOTDESC.
7519         (Target_i386::Scan::global): Likewise.
7520         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
7521         using TLSDESC GOT.
7522         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
7523         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
7524         (Target_x86_64::got_tlsdesc_section): New function.
7525         (Target_x86_64::got_section): Create space for GOT entries for
7526         TLSDESC relocations.
7527         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
7528         R_386_TLS_GOTDESC.
7529         (Target_x86_64::Scan::global): Likewise.
7530         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
7531         using TLSDESC GOT.
7532
7533 2010-08-02  Ian Lance Taylor  <iant@google.com>
7534
7535         * testsuite/final_layout.sh: Use dc to convert from hex to
7536         decimal.
7537
7538 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
7539
7540         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
7541         paramter to the call to gold::gc_process_relocs.
7542         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
7543         paramter to the call to gold::gc_process_relocs.
7544         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
7545         parameter to the call to gold::gc_process_relocs.
7546         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
7547         template parameter to the call to gold::gc_process_relocs.
7548         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
7549         paramter to the call to gold::gc_process_relocs.
7550         * gc.h (get_embedded_addend_size): New function.
7551         (gc_process_relocs): Save the size of the reloc for use by ICF.
7552         * icf.cc (get_section_contents): Get the addend from the text section
7553         for SHT_REL relocation sections.
7554         * icf.h (Icf::Reloc_addend_size_info): New typedef.
7555         (Icf::Reloc_info): Add new member reloc_addend_size_info.
7556         * int_encoding.h (read_from_pointer): New overloaded function.
7557         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
7558         * testsuite/icf_sht_rel_addend_test.sh: New file.
7559         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
7560         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
7561
7562 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7563
7564         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
7565         * Makefile.in: Regenerate.
7566         * testsuite/Makefile.in: Regenerate.
7567
7568 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
7569
7570         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
7571         * gold/testsuite/debug_msg.cc: Likewise.
7572         * gold/testsuite/odr_violation1.cc
7573         * gold/testsuite/odr_violation2.cc
7574
7575 2010-07-21  Cary Coutant  <ccoutant@google.com>
7576
7577         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
7578         string, and length fields.
7579         (Output_merge_string::Merged_strings_list): New type.
7580         (Output_merge_string::Merged_strings_lists): New typedef.
7581         (Output_merge_string): Replace merged_strings_ with
7582         merged_strings_lists_.
7583         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
7584         Merged_strings_list per input object and section.  Don't store pointer
7585         to the string.  Don't store length with each merged string entry.
7586         (Output_merge_string::finalize_merged_data): Loop over list of merged
7587         strings lists.  Recompute length of each merged string.
7588
7589 2010-07-15  Cary Coutant  <ccoutant@google.com>
7590
7591         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
7592         here.
7593
7594 2010-07-14  Ian Lance Taylor  <iant@google.com>
7595
7596         * descriptors.cc (Descriptors::open): Report correct name in error
7597         message.
7598
7599 2010-07-13  Doug Kwan  <dougkwan@google.com>
7600
7601         * arm.cc (Arm_input_section::Arm_input_section): For a
7602         SHT_ARM_EXIDX section, always keeps the input sections.
7603         (Arm_input_section::set_exidx_section_link): New method.
7604         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
7605         has_errors_ to false.
7606         (Arm_exidx_input_section::has_errors,
7607         Arm_exidx_input_section::set_has_errors): New methods.
7608         (Arm_exidx_input_section::has_errors_): New data member.
7609         (Arm_relobj::get_exidx_shndx_list): New method.
7610         (Arm_output_section::append_text_sections_to_list): Do not skip
7611         section without SHF_EXECINSTR.
7612         (Arm_output_section::fix_exidx_coverage): Skip input sections with
7613         errors.
7614         (Arm_relobj::make_exidx_input_section): Add new parameter for text
7615         section header.  Make error messages more verbose.  Check for
7616         a non-executable section linked to an EXIDX section.
7617         (Arm_relobj::do_read_symbols): Remove error checking, which has been
7618         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
7619         check that there is no deferred EXIDX section if we exit early.
7620         Instead of not making an EXIDX section in case of an error, make one
7621         and set the has_errors flag of it.
7622         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
7623         in a relocatable link.
7624         (Target_arm::do_relax): Look for the EXIDX output section instead of
7625         assuming that it is called .ARM.exidx.
7626         (Target_arm::fix_exidx_coverage): Add a new parameter for input
7627         section list.  Do not check for SHF_EXECINSTR section flags but
7628         skip any input section with errors.
7629         * output.cc (Output_section::Output_section): Initialize
7630         always_keeps_input_sections_ to false.
7631         (Output_section::add_input_section): Check for
7632         always_keeps_input_sections_.
7633         *  output.h (Output_section::always_keeps_input_sections,
7634         Output_section::set_always_keeps_input_sections): New methods.
7635         (Output_section::always_keeps_input_sections): New data member.
7636
7637 2010-07-13  Rafael Espindola  <espindola@google.com>
7638
7639         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
7640         * fileread.h (Input_file): Add try_extra_search_path and find_file.
7641
7642 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
7643             Ian Lance Taylor  <iant@google.com>
7644
7645         * output.h (Output_section_lookup_maps::add_merge_section):
7646         Correct check of whether value was inserted.
7647         (Output_section_lookup_maps::add_merge_input_section): Likewise.
7648         (Output_section_lookup_maps::add_relaxed_input_section):
7649         Likewise.
7650         * arm.cc (Target_arm::got_section): Remove used local os.
7651         * i386.cc (Target_i386::got_section): Likewise.
7652         * x86_64.cc (Target_x86_64::got_section): Likewise.
7653         * sparc.cc (Target_sparc::got_section): Likewise.
7654         (Target_sparc::relocate): Remove unused local have_got_offset.
7655         * powerpc.cc (Target_powerpc::relocate): Likewise.
7656
7657 2010-07-13  Ian Lance Taylor  <iant@google.com>
7658
7659         * compressed_output.cc (zlib_decompress): Fix signature in
7660         !HAVE_ZLIB_H case.
7661
7662         * archive.cc (Archive::include_member): Unlock an external member
7663         of a thin archive.  Don't bother to delete an object we know is
7664         NULL.
7665
7666 2010-07-12  Cary Coutant  <ccoutant@google.com>
7667
7668         * compressed_output.cc (zlib_decompress): New function.
7669         (get_uncompressed_size): New function.
7670         (decompress_input_section): New function.
7671         * compressed_output.h (get_uncompressed_size): New function.
7672         (decompress_input_section): New function.
7673         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
7674         Handle compressed debug sections.
7675         * layout.cc (is_compressed_debug_section): New function.
7676         (Layout::output_section_name): Map compressed section names to
7677         canonical names.
7678         * layout.h (is_compressed_debug_section): New function.
7679         (is_debug_info_section): Recognize compressed debug sections.
7680         * merge.cc: Include compressed_output.h.
7681         (Output_merge_data::do_add_input_section): Handle compressed
7682         debug sections.
7683         (Output_merge_string::do_add_input_section): Handle compressed
7684         debug sections.
7685         * object.cc: Include compressed_output.h.
7686         (Sized_relobj::Sized_relobj): Initialize new data members.
7687         (build_compressed_section_map): New function.
7688         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
7689         * object.h (Object::section_is_compressed): New method.
7690         (Object::do_section_is_compressed): New method.
7691         (Sized_relobj::Compressed_section_map): New type.
7692         (Sized_relobj::do_section_is_compressed): New method.
7693         (Sized_relobj::compressed_sections_): New data member.
7694         * output.cc (Output_section::add_input_section): Handle compressed
7695         debug sections.
7696         * reloc.cc: Include compressed_output.h.
7697         (Sized_relobj::write_sections): Handle compressed debug sections.
7698
7699 2010-07-08  Cary Coutant  <ccoutant@google.com>
7700
7701         * resolve.cc (Symbol_table::resolve): Remember whether undef was
7702         weak when resolving to a dynamic def.
7703         (Symbol_table::should_override): Add adjust_dyndef flag; set it
7704         for weak undef/dynamic def cases. Adjust callers.
7705         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
7706         undef_binding_weak_.
7707         (Symbol_table::sized_write_globals): Adjust symbol binding.
7708         (Symbol_table::sized_write_symbol): Add binding parameter.
7709         * symtab.h (Symbol::set_undef_binding): New method.
7710         (Symbol::is_undef_binding_weak): New method.
7711         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
7712         (Symbol_table::should_override): Add new parameter.
7713         (Symbol_table::sized_write_symbol): Add new parameter.
7714
7715         * testsuite/weak_undef_file1.cc: Add new test case.
7716         * testsuite/weak_undef_file2.cc: Fix header comment.
7717         * testsuite/weak_undef_test.cc: Add new test case.
7718
7719 2010-06-29  Doug Kwan  <dougkwan@google.com>
7720
7721         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
7722         Initialize USE_SYMBOL_.
7723         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
7724         definition.
7725         (Arm_reloc_property::uses_symbol_): New data member declaration.
7726         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
7727         uses symbol value and symbol is undefined but not weakly undefined.
7728
7729 2010-06-28  Rafael Espindola  <espindola@google.com>
7730
7731         * plugin.cc (Plugin::load): Use dlerror.
7732
7733 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
7734
7735         * symtab.cc (detect_odr_violations): When reporting an ODR
7736         violation, report an object where the symbol is defined.
7737
7738 2010-06-25  Doug Kwan  <dougkwan@google.com>
7739
7740         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
7741         (Target_arm::section_may_have_icf_unsafe_pointers): New method
7742         definition.
7743         (Target_arm::Scan::local_reloc_may_be_function_pointer,
7744         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
7745         target hook to detect function points.
7746         (Target_arm::Scan::possible_function_pointer_reloc): New method.
7747         * icf.h (Icf::check_section_for_function_pointers): Change type of
7748         parameter SECTION_NAME to const reference to std::string.  Use
7749         target hook to determine if section may have unsafe pointers.
7750         * target.h (Target::section_may_have_icf_unsafe_pointers): New
7751         method definition.
7752
7753 2010-06-21  Rafael Espindola  <espindola@google.com>
7754
7755         * fileread.cc (Input_file::find_fie): New
7756         (Input_file::open): Use Input_file::find_fie.
7757         * fileread.h (Input_file::find_fie): New
7758         * plugin.cc (set_extra_library_path): New.
7759         (Plugin::load): Add set_extra_library_path to the transfer vector.
7760         (Plugin_manager::set_extra_library_path): New.
7761         (Plugin_manager::add_input_file): Use the extra search path if set.
7762         (set_extra_library_path(): New.
7763         * plugin.h (Plugin_manager): Add set_extra_library_path and
7764         extra_search_path_.
7765
7766 2010-06-19  Cary Coutant  <ccoutant@google.com>
7767
7768         * layout.cc (gdb_sections): Add .debug_types.
7769         (lines_only_debug_sections): Likewise.
7770
7771 2010-06-18  Rafael Espindola  <espindola@google.com>
7772
7773         * plugin.cc (add_input_file,add_input_library)
7774         (Plugin_manager::add_input_file): Make filename arguments const.
7775         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
7776         const.
7777
7778 2010-06-16  Doug Kwan  <dougkwan@google.com>
7779
7780         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
7781         .ARM.attributes section if we have not merged any input
7782         attributes sections.
7783
7784 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7785
7786         * arm.cc: Allow combining objects with no EABI version
7787         information.
7788
7789 2010-06-15  Rafael Espindola  <espindola@google.com>
7790
7791         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
7792
7793 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7794
7795         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
7796         (struct iovec): Correct !HAVE_READV definition.
7797
7798 2010-06-10  Cary Coutant  <ccoutant@google.com>
7799
7800         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
7801         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
7802         reloc sections.
7803         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
7804
7805         PR 11683
7806         * symtab.h (Symbol::is_placeholder): New member function.
7807         * target-reloc.h (relocate_section): Check for placeholder symbols.
7808
7809         * testsuite/Makefile.am (plugin_test_8): New test.
7810         (plugin_test_9): New test.
7811         * testsuite/Makefile.in: Regenerate.
7812
7813 2010-06-09  Nick Clifton  <nickc@redhat.com>
7814
7815         * yyscript.y (input_list_element): Allow strings prefixed with
7816         the '-' character.  Treat these as libraries.
7817         * script.cc (script_add_library): New function.  Adds a library
7818         specified by "-l<name>" found in an input script.
7819         * script-c.h: Add prototype for script_add_library.
7820
7821 2010-06-07  Doug Kwan  <dougkwan@google.com>
7822
7823         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
7824         Restrict stub-group size to be within long conditional branch
7825         range when working around cortex-A8 erratum.
7826
7827 2010-06-07  Damien Diederen  <dd@crosstwine.com>
7828
7829         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
7830         #ifdef typo.
7831
7832 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
7833
7834         PR gold/11658
7835         * output.cc
7836         (Output_section::Input_section_sort_entry::compare_section_ordering):
7837         Change to return non-zero correctly.
7838         (Output_section::Input_section_sort_section_order_index_compare
7839         ::operator()): Change to fix ambiguity in comparisons.
7840
7841 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
7842
7843         * gold.h (is_wildcard_string): New function.
7844         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
7845         (Layout::layout_eh_frame): Ditto.
7846         (Layout::find_section_order_index): New method.
7847         (Layout::read_layout_from_file): New method.
7848         * layout.h (Layout::find_section_order_index): New method.
7849         (Layout::read_layout_from_file): New method.
7850         (Layout::input_section_position_): New private member.
7851         (Layout::input_section_glob_): New private member.
7852         * main.cc (main): Call read_layout_from_file here.
7853         * options.h (--section-ordering-file): New option.
7854         * output.cc (Output_section::input_section_order_specified_): New
7855         member.
7856         (Output_section::Output_section): Initialize new member.
7857         (Output_section::add_input_section): Add new parameter.
7858         Keep input sections when --section-ordering-file is used.
7859         (Output_section::set_final_data_size): Sort input sections when
7860         section ordering file is specified.
7861         (Output_section::Input_section_sort_entry): Add new parameter.
7862         Check sorting type.
7863         (Output_section::Input_section_sort_entry::compare_section_ordering):
7864         New method.
7865         (Output_section::Input_section_sort_compare::operator()): Change to
7866         consider section_order_index.
7867         (Output_section::Input_section_sort_init_fini_compare::operator()):
7868         Change to consider section_order_index.
7869         (Output_section::Input_section_sort_section_order_index_compare
7870         ::operator()): New method.
7871         (Output_section::sort_attached_input_sections): Change to sort
7872         according to section order when specified.
7873         (Output_section::add_input_section<32, true>): Add new parameter.
7874         (Output_section::add_input_section<64, true>): Add new parameter.
7875         (Output_section::add_input_section<32, false>): Add new parameter.
7876         (Output_section::add_input_section<64, false>): Add new parameter.
7877         * output.h (Output_section::add_input_section): Add new parameter.
7878         (Output_section::input_section_order_specified): New
7879         method.
7880         (Output_section::set_input_section_order_specified): New method.
7881         (Input_section::Input_section): Initialize section_order_index_.
7882         (Input_section::section_order_index): New method.
7883         (Input_section::set_section_order_index): New method.
7884         (Input_section::section_order_index_): New member.
7885         (Input_section::Input_section_sort_section_order_index_compare): New
7886         struct.
7887         (Output_section::input_section_order_specified_): New member.
7888         * script-sections.cc (is_wildcard_string): Delete and move modified
7889         method to gold.h.
7890         (Output_section_element_input::Output_section_element_input): Modify
7891         call to is_wildcard_string.
7892         (Output_section_element_input::Input_section_pattern
7893         ::Input_section_pattern): Ditto.
7894         (Output_section_element_input::Output_section_element_input): Ditto.
7895         * testsuite/Makefile.am (final_layout): New test case.
7896         * testsuite/Makefile.in: Regenerate.
7897         * testsuite/final_layout.cc: New file.
7898         * testsuite/final_layout.sh: New file.
7899
7900 2010-06-01  Rafael Espindola  <espindola@google.com>
7901
7902         * plugin.cc (Plugin::load): Pass the output name to the plugin.
7903
7904 2010-06-01  Rafael Espindola  <espindola@google.com>
7905
7906         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
7907         visibility of symbols.
7908
7909 2010-05-27  Doug Kwan  <dougkwan@google.com>
7910
7911         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
7912         from start of output section instead of address for a local symbol
7913         in a merged or relaxed section when doing a relocatable link.
7914
7915 2010-05-26  Rafael Espindola  <espindola@google.com>
7916
7917         PR 11604
7918         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
7919         adding sections the garbage collector removed.
7920         * gold/testsuite/Makefile.am: Add test.
7921         * gold/testsuite/Makefile.in: Regenerate.
7922         * gold/testsuite/plugin_test_7.sh: New.
7923         * gold/testsuite/plugin_test_7_1.c: New.
7924         * gold/testsuite/plugin_test_7_2.c: New.
7925
7926 2010-05-26  Rafael Espindola  <espindola@google.com>
7927
7928         * script-sections.cc (Output_section_definition::set_section_addresses):
7929         Check for --section-start.
7930
7931 2010-05-26  Doug Kwan  <dougkwan@google.com>
7932
7933         * arm.cc (Arm_scan_relocatable_relocs): New class.
7934         (Target_arm::relocate_special_relocatable): New method.
7935         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
7936         (Arm_relocate_functions::thumb_branch_common): Same.
7937         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
7938         instead of Default_scan_relocatable_relocs.
7939         * target-reloc.h (relocate_for_relocatable): Let target handle
7940         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
7941         * target.h (Sized_target::relocate_special_relocatable): New method.
7942
7943 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7944
7945         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
7946
7947 2010-05-23  Doug Kwan  <dougkwan@google.com>
7948
7949         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
7950         instead of a cast.
7951         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
7952         with a direct branch, not a conditional branch, to a stub.
7953         * merge.cc (Output_merge_base::record_input_section): New method
7954         defintion.
7955         (Output_merge_data::do_add_input_section): Record input section if
7956         keeps-input-sections flag is set.
7957         (Output_merge_string::do_add_input_section): Ditto.
7958         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
7959         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
7960         INPUT_SECTIONS_.
7961         (Output_merge_base::keeps_input_sections,
7962         Output_merge_base::set_keeps_input_sections,
7963         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
7964         method definitions.
7965         (Output_merge_base::Input_sections): New type declaration.
7966         (Output_merge_base::input_sections_begin,
7967         Output_merge_base::input_sections_end,
7968         Output_merge_base::do_set_keeps_input_sections): New method definitions.
7969         (Output_merge_base::bool keeps_input_sections_,
7970         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
7971         Output_merge_base::input_sections_): New data members.
7972         (Output_merge_data::do_set_keeps_input_sections): New method
7973         defintion.
7974         (Output_merge_string::do_set_keeps_input_sections): Ditto.
7975         * output.cc (Output_section::Input_section::relobj): Move method
7976         defintion from class declaration to here and handle merge sections.
7977         (Output_section::Input_section::shndx): Ditto.
7978         (Output_section::Output_section): Remove initializations of removed
7979         data members and initialize new data member LOOKUP_MAPS_.
7980         (Output_section::add_input_section): Set keeps-input-sections flag
7981         for a newly created merge output section as appropriate.  Adjust code
7982         to use Output_section_lookup_maps class.
7983         (Output_section::add_relaxed_input_section): Adjst code for lookup
7984         maps code refactoring.
7985         (Output_section::add_merge_input_section): Add a new parameter
7986         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
7987         class.  If adding input section to a newly created merge output
7988         section fails, remove the new merge section.
7989         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
7990         Adjust code for use of the Output_section_lookup_maps class.
7991         (Output_section::find_merge_section): Ditto.
7992         (Output_section::build_lookup_maps): New method defintion.
7993         (Output_section::find_relaxed_input_section): Adjust code to use
7994         Output_section_lookup_maps class.
7995         (Output_section::get_input_sections): Export merge sections.  Adjust
7996         code to use Output_section_lookup_maps class.
7997         (Output_section:::add_script_input_section): Adjust code to use
7998         Output_section_lookup_maps class.  Update lookup maps for merge
7999         sections also.
8000         (Output_section::discard_states): Use Output_section_lookup_maps.
8001         (Output_section::restore_states): Same.
8002         * output.h (Merge_section_properties): Move class defintion out of
8003         Output_section.
8004         (Output_section_lookup_maps): New class.
8005         (Output_section::Input_section::is_merge_section): New method
8006         defintion.
8007         (Output_section::Input_section::relobj): Move defintion out of class
8008         defintion.  Declare method only.
8009         (Output_section::Input_section::shndx): Ditto.
8010         (Output_section::Input_section::output_merge_base): New method defintion.
8011         (Output_section::Input_section::u2_.pomb): New union field.
8012         (Output_section::Merge_section_by_properties_map,
8013         Output_section::Output_section_data_by_input_section_map,
8014         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
8015         Remove types.
8016         (Output_section::add_merge_input_section): Add new parameter
8017         KEEPS_INPUT_SECTIONS.
8018         (Output_section::build_lookup_maps): New method declaration.
8019         (Output_section::merge_section_map_,
8020         Output_section::merge_section_by_properties_map_,
8021         Output_section::relaxed_input_section_map_,
8022         Output_section::is_relaxed_input_section_map_valid_): Remove data
8023         members.
8024         (Output_section::lookup_maps_): New data member.
8025
8026 2010-05-21  Doug Kwan  <dougkwan@google.com>
8027
8028         PR gold/11619
8029         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
8030         avoid a compilation error.
8031
8032 2010-05-19  Rafael Espindola  <espindola@google.com>
8033
8034         * script-sections.cc (Output_section_definition::allocate_to_segment):
8035         Update the phdrs_list even when the output section is NULL.
8036         * testsuite/Makefile.am: Add test.
8037         * testsuite/Makefile.in: Regenerate.
8038         * testsuite/script_test_9.cc: New.
8039         * testsuite/script_test_9.sh: New.
8040         * testsuite/script_test_9.t: New.
8041
8042 2010-05-19  Doug Kwan  <dougkwan@google.com>
8043
8044         * arm.cc (Arm_input_section::original_size): New method.
8045         (Arm_input_section::do_addralign): Add a cast.
8046         (Arm_input_section::do_output_offset): Remove static cast.
8047         (Arm_input_section::original_addralign,
8048          Arm_input_section::original_size_): Change type to uint32_t.
8049         (Arm_input_section::init): Add safe casts for section alignment
8050         and size.
8051         (Arm_input_section::set_final_data_size): Do not set address and
8052         offset of stub table.
8053         (Arm_output_section::fix_exidx_coverage): Change use of of
8054         Output_section::Simple_input_section to that of
8055         Output_section::Input_section.
8056         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
8057         except for the first pass.
8058         * output.cc (Output_section::get_input_sections): Change type of
8059         input_sections to std::list<Input_section>.
8060         (Output_section::add_script_input_section): Rename from
8061         Output_section::add_simple_input_section.  Change type of SIS
8062         parameter from Simple_input_section to Input_section.
8063         * output.h (Output_section::Simple_input_section): Remove class.
8064         (Output_section::Input_section): Change class visibility to public.
8065         (Output_section::Input_section::addralign): Use stored alignments
8066         for special input sections if set.
8067         (Output_section::Input_section::set_addralign): New method.
8068         (Output_section::get_input_sections): Change parameter type from
8069         list of Simple_input_section to list of Input_section.
8070         (Output_section::add_script_input_section): Rename from
8071         Output_section::add_simple_input_section. Change first parameter's
8072         type from Simple_input_section to Input_section and remove the
8073         second and third parameters.
8074         * script-sections.cc (Input_section::Input_section_list): Change
8075         type to list of Output_section::Input_section/
8076         (Input_section_info::Input_section_info): Change parameter type of
8077         INPUT_SECTION to Output_section::Input_section.
8078         (Input_section_info::input_section): Change return type.
8079         (Input_section_info::input_section_): Change type to
8080         Output_section::Input_section.
8081         (Output_section_element_input::set_section_addresses): Adjust code
8082         to use Output_section::Input_section instead of
8083         Output_section::Simple_input_section.  Adjust code for renaming
8084         of Output_section::add_simple_input_section.
8085         (Orphan_output_section::set_section_addresses): Ditto.
8086
8087 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8088
8089         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
8090         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
8091
8092 2010-05-18  Rafael Espindola  <espindola@google.com>
8093
8094         * options.cc (General_options::finalize): Handle -nostdlib.
8095         * options.h (nostdlib): New option.
8096         * script.cc (script_add_search_dir): Handle -nostdlib.
8097
8098 2010-05-12  Doug Kwan  <dougkwan@google.com>
8099
8100         * arm.cc (Target_arm::do_finalize_sections): Create an empty
8101         attributes section only if there no attributes section after merging.
8102         (Target_arm::merge_object_attributes): Move value of
8103         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
8104         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
8105         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
8106         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
8107         and arm_attr_merge_7.stdout.
8108         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
8109         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
8110         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
8111         arm_attr_merge_7b.o): New rules.
8112         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
8113         arm_attr_merge_7
8114         * testsuite/Makefile.in: Regenerate.
8115         * testsuite/arm_attr_merge.sh: New file.
8116         * testsuite/arm_attr_merge_[67][ab].s: Same.
8117
8118 2010-05-05  Nick Clifton  <nickc@redhat.com>
8119
8120         * po/es.po: Updated Spanish translation.
8121
8122 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
8123
8124         * Makefile.am (install-exec-local): Properly install gold as
8125         default cross linker.
8126         * Makefile.in: Regenerated.
8127
8128 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
8129             Nick Clifton  <nickc@redhat.com>
8130
8131         * configure.ac (install_as_default): Define and set to false
8132         unless --enable-gold or --enable-gold=both/gold has been
8133         specified.
8134         * configure: Regenerate.
8135
8136         * Makefile.am (install-exec-local): Install the executable as
8137         'ld.gold'.  If install_as_default is true then also install it as
8138         'ld'.
8139         * Makefile.in: Regenerated.
8140
8141 2010-04-24  Ian Lance Taylor  <iant@google.com>
8142
8143         * layout.cc (Layout::layout_reloc): In relocatable link don't
8144         combine reloc sections for grouped sections.
8145
8146 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
8147
8148         * gc.h (gc_process_relocs): Pass information on relocs pointing to
8149         sections that are not ordinary to icf.
8150         * icf.cc (get_section_contents): Handle relocation pointing to section
8151         with no object or shndx information.
8152         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
8153         * testsuite/Makefile.in: Regenerate.
8154         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
8155         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
8156
8157 2010-04-22  Ian Lance Taylor  <iant@google.com>
8158
8159         * expression.cc (Expression::Expression_eval_info): Add
8160         result_alignment_pointer field.
8161         (Expression::eval_with_dot): Add result_alignment_pointer
8162         parameter.  Change all callers.
8163         (Expression::eval_maybe_dot): Likewise.
8164         (class Binary_expression): Add alignment_pointer parameter to
8165         left_value and right_value.  Change all callers.
8166         (BINARY_EXPRESSION): Set result alignment.
8167         (class Trinary_expression): Add alignment_pointer parameter to
8168         arg2_value and arg3_value.  Change all callers.
8169         (Trinary_cond::value): Set result alignment.
8170         (Max_expression::value, Min_expression::value): Likewise.
8171         (Align_expression::value): Likewise.
8172         * script-sections.cc (class Sections_element): Add dot_alignment
8173         parameter to set_section_addresses virtual function.  Update
8174         instantiations.
8175         (class Output_section_element): Likewise.
8176         (Script_sections::create_segments): Add dot_alignment parameter.
8177         Change all callers.
8178         (Script_sections::create_segments_from_phdrs_clause): Likewise.
8179         (Script_sections::set_phdrs_clause_addresses): Likewise.
8180         * script-sections.h: Update declarations.
8181         * script.h: Update declarations.
8182         * output.h (Output_segment::set_minimum_p_align): Don't decrease
8183         min_p_align.
8184         * testsuite/script_test_3.t: Set large alignment.
8185         * testsuite/script_test_3.sh: Make sure that at least one LOAD
8186         segment has expected alignment.
8187
8188 2010-04-22  Nick Clifton  <nickc@redhat.com>
8189
8190         * po/gold.pot: Updated by the Translation project.
8191         * po/vi.po: Updated Vietnamese translation.
8192
8193 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
8194
8195         * testsuite/Makefile.am (check_PROGRAMS): Add
8196         icf_virtual_function_folding_test.
8197         * testsuite/Makefile.in: Regenerated.
8198
8199 2010-04-15  Andrew Haley  <aph@redhat.com>
8200
8201         * options.h (merge_exidx_entries): New option.
8202         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
8203         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
8204         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
8205         (Target_arm::merge_exidx_entries): New function.
8206         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
8207         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
8208         to Arm_exidx_fixup constructor.
8209         Add new arg, merge_exidx_entries.
8210         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
8211         Arm_output_section::fix_exidx_coverage.
8212
8213 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
8214
8215         * icf.cc (get_section_contents): Check for preemptible functions.
8216         Ignore addend when appropriate.
8217         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
8218         section folded.
8219         (add_from_relobj): Check for section folded.
8220         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
8221         * symtab.h (should_add_dynsym_entry): Add new parameter.
8222         * target-reloc.h (scan_relocs): Check for section folded.
8223         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
8224         Check reloc types for function pointers in shared objects.
8225         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
8226         case.
8227         (icf_preemptible_functions_test): New test case.
8228         (icf_string_merge_test): New test case.
8229         * testsuite.Makefile.in: Regenerate.
8230         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
8231         bar_glob.  Refactor code.
8232         * testsuite/icf_preemptible_functions_test.cc: New file.
8233         * testsuite/icf_preemptible_functions_test.sh: New file.
8234         * testsuite/icf_string_merge_test.cc: New file.
8235         * testsuite/icf_string_merge_test.sh: New file.
8236         * testsuite/icf_virtual_function_folding_test.cc: New file.
8237         * testsuite/icf_virtual_function_folding_test.sh: New file.
8238
8239 2010-04-14  Doug Kwan  <dougkwan@google.com>
8240
8241         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
8242         for local symbol recounting if we remove a section due to ICF.
8243         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
8244         there are no regular objects in input.
8245
8246 2010-04-13  Doug Kwan  <dougkwan@google.com>
8247
8248         * arm.cc (Arm_input_section::set_final_data_size): Compute
8249         accurate final data size instead of using current data size.
8250
8251 2010-04-09  Doug Kwan  <dougkwan@google.com>
8252
8253         * layout.cc (Layout::choose_output_section): Handle script section
8254         types.
8255         (Layout::make_output_section_for_script): Add section type parameter.
8256         Handle script section types.
8257         * layout.h (Layout::make_output_section_for_script): Add section
8258         type parameter.
8259         * output.cc (Output_section::Output_section): Initialize data member
8260         is_noload_.
8261         (Output_section::do_reset_address_and_file_offset): Do not set address
8262         to 0 if section is a NOLOAD section.
8263         * output.h (Output_section::is_noload): New method.
8264         (Output_section::set_is_noload): Ditto.
8265         (Output_section::is_noload_): New data member.
8266         * script-c.h (Script_section_type): New enum type.
8267         (struct Parser_output_section_header): Add new file section_type.
8268         * script-sections.cc (Sections_element::output_section_name): Add
8269         parameter for returning script section type.
8270         (Output_section_definition::output_section_name): Ditto.
8271         (Output_section_definition::section_type)P; New method.
8272         (Output_section_definiton::script_section_type_name): Ditto.
8273         (Output_section_definition::script_section_type_): New data member.
8274         (Output_section_definition::Output_section_definition): Initialize
8275         data member Output_section_definition::script_section_type_.
8276         (Output_section_definition::create_sections): Pass script section type
8277         to Layout::make_output_section_for_script.
8278         (Output_section_definition::output_section_name): Return script
8279         section type to caller.
8280         (Output_section_definition::set_section_address): Do not advance
8281         dot value and load address if section type is NOLOAD.  Set address
8282         of NOLOAD sections regardless of section flags.
8283         (Output_section_definition::print): Print section type if it is
8284         not SCRIPT_SECTION_TYPE_NONE.
8285         (Output_section_definition::section_type): New method.
8286         (Output_section_definition::script_section_type_name): Ditto.
8287         (Script_sections::output_section_name): Add new parameter
8288         PSECTION_TYPE for returning script section type.  Pass it to
8289         section elements.  Handle discard sections.
8290         (Sort_output_sections::operator()): Handle NOLOAD sections.
8291         * script-sections.h (Script_sections::Section_type): New enum type.
8292         (Script_sections::output_section_name): Add a new parameter for
8293         returning script section type.
8294         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
8295         INFO and NOLOAD.
8296         * yyscript.y (union): Add new field SECTION_TYPE.
8297         (COPY, DSECT, INFO, NOLOAD): New tokens.
8298         (opt_address_and_section_type): Change type to output_section_header.
8299         (section_type): New non-terminal
8300         (section_header): Handle section type.
8301         (opt_address_and_section_type): Return section type value.
8302
8303 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
8304
8305         * testsuite/plugin_common_test_1.c (foo): Add prototype.
8306         * testsuite/plugin_common_test_2.c (foo): Likewise.
8307
8308 2010-04-08  Doug Kwan  <dougkwan@google.com>
8309
8310         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
8311         Output_merge_data.
8312         * output.cc (Output_section::add_merge_input_section): Simplify
8313         code and return status of Output_merge_base::add_input_section.
8314         Update merge section map only if Output_merge_base::add_input_section
8315         returns true.
8316
8317 2010-04-07  Doug Kwan  <dougkwan@google.com>
8318
8319         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
8320         if section is marked as containing instructions but has no mapping
8321         symbols.
8322         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
8323         correct section index.
8324         (Arm_relobj::find_linked_text_section): Ditto.
8325
8326 2010-04-07  Cary Coutant  <ccoutant@google.com>
8327
8328         * archive.cc (include_member): Destroy Read_symbols_data object before
8329         releasing file.
8330         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
8331         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
8332         (Read_symbols_data::~Read_symbols_data) New destructor.
8333         (Section_relocs::Section_relocs) New constructor.
8334         (Section_relocs::~Section_relocs) New destructor.
8335         (Read_relocs_data::Read_relocs_data) New constructor.
8336         (Read_relocs_data::~Read_relocs_data) New destructor.
8337         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
8338         pointers to NULL after deleting.
8339
8340 2010-04-07  Doug Kwan  <dougkwan@google.com>
8341
8342         * arm.cc: Replace "endianity" with "endianness" in comments.
8343         (Arm_exidx_cantunwind): Ditto.
8344         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
8345         (Arm_relobj::merge_flags_and_attributes): New method.
8346         (Arm_relobj::merge_flags_and_attributes_): New data member.
8347         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
8348         (Arm_relobj::scan_sections_for_stubs): Ditto.
8349         (Arm_relobj::do_read_symbols): Check to see if we really want to
8350         merge processor-specific flags and attributes.  Exit early if
8351         an object is empty except for section names and the undefined symbol.
8352         (Target_arm::do_finalize_sections): Move check for ELF format to
8353         Arm_relobj::do_read_symbols.  Merge processor specific flags and
8354         attributes from a regular object only when we have determined that
8355         it is aapropriate.  Do not create an .ARM.attributes section in
8356         output if there is no regular input object.
8357         (Target_arm::merge_processor_specific_flags): Check
8358         --warn-mismatch before printing any error.
8359         (Target_arm::merge_object_attributes): Ditto.
8360         * gold.cc (queue_middle_tasks): Handle the case in which there is
8361         no regular object in input.
8362         * options.cc (General_options::parse_EB): New method.
8363         (General_options::parse_EL): Same.
8364         (General_options::General_options): Initialize endianness_.
8365         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
8366         New options.
8367         (General_options::Endianness): New enum.
8368         (General_options::endianness): New method.
8369         (General_options::endianness_): New data member.
8370         * parameters.cc (Parameters::set_options): Check target endianness.
8371         (Parameters::set_target_once): Ditto.
8372         (Parameters::check_target_endianness): New method.
8373         (parameters_force_valid_target): If either -EL or -EB is specified,
8374         use it to define endianness of default target.
8375         * parameters.h (Parameters::check_target_endianness): New method
8376         declaration.
8377         * target.h (class Target): Change "endianity" to "endianness"
8378         in comments.
8379
8380 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8381
8382         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
8383         * configure: Regenerate.
8384         * Makefile.in: Regenerate.
8385         * testsuite/Makefile.in: Regenerate.
8386
8387 2010-04-06  Cary Coutant  <ccoutant@google.com>
8388
8389         gcc PR lto/42757
8390         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
8391         prevailing definitions of common symbols.
8392         * testsuite/plugin_test_6.sh: New test case.
8393         * testsuite/plugin_common_test_1.c: New test case.
8394         * testsuite/plugin_common_test_2.c: New test case.
8395         * testsuite/Makefile.am (plugin_test_6): New test case.
8396         * testsuite/Makefile.in: Regenerate.
8397
8398 2010-04-06  Nick Clifton  <nickc@redhat.com>
8399
8400         * po/vi.po: New Vietnamese translation.
8401
8402 2010-03-30  Doug Kwan  <dougkwan@google.com>
8403
8404         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
8405
8406 2010-03-25  Doug Kwan  <dougkwan@google.com>
8407
8408         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
8409         to avoid a conversion warning on a 32-bit host.
8410
8411 2010-03-24  Ian Lance Taylor  <iant@google.com>
8412
8413         * testsuite/script_test_3.t: Add a TLS segment.
8414         * testsuite/Makefile.am (check_PROGRAMS): Add
8415         tls_phdrs_script_test.
8416         (tls_phdrs_script_test_SOURCES): Define.
8417         (tls_phdrs_script_test_DEPENDENCIES): Define.
8418         (tls_phdrs_script_test_LDFLAGS): Define.
8419         (tls_phdrs_script_test_LDADD): Define.
8420         * testsuite/Makefile.in: Rebuild.
8421
8422 2010-03-23  Cary Coutant  <ccoutant@google.com>
8423
8424         * fileread.cc (find_or_make_view): Fix comment.
8425
8426 2010-03-23  Ian Lance Taylor  <iant@google.com>
8427
8428         * script-sections.cc (class Orphan_section_placement): Define
8429         PLACE_TLS and PLACE_TLS_BSS.
8430         (Orphan_section_placement::Orphan_section_placement): Initialize
8431         new places.
8432         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
8433         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
8434         (tls_script_test_SOURCES): Define.
8435         (tls_script_test_DEPENDENCIES): Define.
8436         (tls_script_test_LDFLAGS): Define.
8437         (tls_script_test_LDADD): Define.
8438         * testsuite/Makefile.in: Rebuild.
8439
8440 2010-03-22  Doug Kwan  <dougkwan@google.com>
8441
8442         * arm.cc (Arm_relocate_functions::abs8,
8443         Arm_relocate_functions::abs16): Use correct check for overflow
8444         specified in the ARM ELF specs.
8445         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
8446         target of a BLX instruction specially.
8447         (Reloc_stub::stub_type_for_reloc): Ditto.
8448         (Relocate::relocate): Use symbolic names instead of numeric relocation
8449         codes to report error.
8450         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
8451         workaround.
8452         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
8453         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
8454         thumb2_blx_out_of_range.stdout
8455         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
8456         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
8457         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
8458         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
8459         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
8460         thumb2_blx_in_range, thumb2_blx_in_range.o,
8461         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
8462         thumb2_blx_out_of_range.o): New rules.
8463         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
8464         thumb2_blx_in_range and thumb2_blx_out_of_range.
8465         * testsuite/Makefile.in: Regenerate.
8466         * arm_branch_in_range.sh: Add tests for THUMB BLX.
8467         * testsuite/thumb_blx_in_range.s: New file.
8468         * testsuite/thumb_blx_out_of_range.s: New file.
8469
8470 2010-03-22  Rafael Espindola  <espindola@google.com>
8471
8472         * archive.cc (Should_include): Move to archive.h.
8473         (should_include_member): Make it a member of Archive.
8474         (Lib_group): New.
8475         (Add_lib_group_symbols): New.
8476         * archive.h: Include options.h.
8477         (Archive_member): Moved from Archive.
8478         (Should_include): Moved from archive.cc.
8479         (Lib_group): New.
8480         (Add_lib_group_symbols): New.
8481         * dynobj.cc (do_should_include_member): New.
8482         * dynobj.h (do_should_include_member): New.
8483         * gold.cc (queue_initial_tasks): Update call to queue.
8484         * main.cc (main): Print lib group stats.
8485         * object.cc (do_should_include_member): New.
8486         * object.h: Include archive.h.
8487         (Object::should_include_member): New.
8488         (Object::do_should_include_member): New.
8489         (Sized_relobj::do_should_include_member): New.
8490         * options.cc (General_options::parse_start_lib): New.
8491         (General_options::parse_end_lib): New.
8492         (Input_arguments::add_file): Handle lib groups.
8493         (Input_arguments::start_group): Check we are not in a lib.
8494         (Input_arguments::start_lib): New.
8495         (Input_arguments::end_lib): New.
8496         * options.h (General_options): Add start_lib and end_lib.
8497         (Input_argument::lib_): New.
8498         (Input_argument::lib): New.
8499         (Input_argument::is_lib): New.
8500         (Input_file_lib): New.
8501         (Input_arguments::in_lib_): New.
8502         (Input_arguments::in_lib): New.
8503         (Input_arguments::start_lib): New.
8504         (Input_arguments::end_lib_): New.
8505         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
8506         in unused members as preempted.
8507         (Sized_pluginobj::do_should_include_member): New.
8508         * plugin.h (Sized_pluginobj::do_should_include_member): New.
8509         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
8510         return the blocker.
8511         (Read_symbols::do_whole_lib_group): New.
8512         (Read_symbols::do_lib_group): New.
8513         (Read_symbols::do_read_symbols): Handle lib groups.
8514         (Read_symbols::get_name): Handle lib groups.
8515         * readsyms.h (Read_symbols): Add an archive member pointer.
8516         (Read_symbols::do_whole_lib_group): New.
8517         (Read_symbols::do_lib_group): New.
8518         (Read_symbols::member_): New.
8519         * script.cc (read_input_script): Update call to queue_soon.
8520
8521 2010-03-19  Doug Kwan  <dougkwan@google.com>
8522
8523         * arm.cc (Stub_table::Stub_table): Initialize new data members
8524         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
8525         (Stub_table::add_reloc_stub): Assign stub offset and update
8526         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
8527         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
8528         New data members.
8529         (Stub_table::update_data_size_and_addralign): Use
8530         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
8531         instead of going over all reloc stubs.
8532         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
8533         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
8534         Stringpool_template::offset_ to size of Stringpool_char.
8535         (Stringpool_template::new_key_offset): Remove code to initialize
8536         Stringpool_template::offset_.
8537         * stringpool.h (Stringpool_template::set_no_zero_null): Set
8538         Stringpool_template::offset_ to zero.
8539
8540 2010-03-15  Doug Kwan  <dougkwan@google.com>
8541
8542         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
8543         offset_.
8544         (Stringpool_template::new_key_offset): New method.
8545         (Stringpool_template::add_string): Assign offsets when adding new
8546         strings.
8547         (Stringpool_template::set_string_offsets): Do not set string offsets
8548         when not optimizing.
8549         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
8550         member size_.
8551         (Chunked_vector::clear): Clear size_.
8552         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
8553         (Chunked_vector::size): Return size_.
8554         (Chunked_vector::push_back): Use size_ to find insert position.
8555         (Chunked_vector::size_): New data member.
8556         (Stringpool_template::set_no_zero_null): Assert string set is empty.
8557         (Stringpool_template::new_key_offset): New method declaration.
8558         (Stringpool_template::offset_): New data member.
8559
8560 2010-03-15   Rafael Espindola  <espindola@google.com>
8561
8562         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
8563         Add_symbols' constructor.
8564         * readsyms.h (Add_symbols): Remove the input_group member.
8565
8566 2010-03-10  Ian Lance Taylor  <iant@google.com>
8567
8568         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
8569         target to ask whether a reference to a symbol requires a stack
8570         split.
8571         * target.h (Target::is_call_to_non_split): New function.
8572         (Target::do_is_call_to_non_split): Declare virtual function.
8573         * target.cc: Include "symtab.h".
8574         (Target::do_is_call_to_non_split): New function.
8575         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
8576
8577 2010-03-10  Cary Coutant  <ccoutant@google.com>
8578
8579         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
8580         (File_read::open[1]): Remove initial mapping of whole_file_view_.
8581         (File_read::open[2]): Add whole_file_view_ to list of views.
8582         (File_read::make_view): Remove test of whole_file_view_.
8583         (File_read::find_or_make_view): Create whole_file_view_ if
8584         necessary.
8585         (File_read::clear_views): Replace bool parameter with enum;
8586         adjust all callers.  Don't delete views with permanent data;
8587         do delete cached views and views from archives if
8588         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
8589         if clearing the corresponding view.
8590         * fileread.h (File_read::Clear_views_mode): New enum.
8591         (File_read::View::is_permanent_view): New method.
8592         (File_read::clear_views): Replace bool parameter
8593         with enum; adjust all callers.
8594         * options.h (General_options): Change keep_files_mapped option;
8595         add map_whole_files.
8596         * readsyms.cc (Add_symbols::run): Delete sd_ object before
8597         releasing the file.
8598         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
8599         the file.
8600
8601 2010-03-10  David S. Miller  <davem@davemloft.net>
8602
8603         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
8604
8605 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
8606
8607         * icf.cc (get_section_contents): Add '@' marker after processing the
8608         merge reloc.
8609
8610 2010-03-08  Doug Kwan  <dougkwan@google.com>
8611
8612         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
8613         due to a conversion warning.
8614         (Arm_relobj::update_output_local_symbol_count): Check for local
8615         symbol with unset output index.
8616
8617 2010-03-05  Ian Lance Taylor  <iant@google.com>
8618
8619         * options.h (class General_options): Add --spare-dynamic-tags.
8620         * output.cc (Output_data_dynamic::set_final_data_size): Implement
8621         --spare-dynamic-tags.
8622
8623 2010-03-05  Ian Lance Taylor  <iant@google.com>
8624
8625         * incremental.cc: Include "libiberty.h".
8626
8627 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
8628
8629         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
8630         function, is_info_ member.
8631         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
8632         (Versions::Versions): Update caller.
8633         (Versions::define_base_version): Likewise.
8634         (Versions::add_def): Likewise.
8635
8636 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
8637
8638         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
8639         (Scan::possible_function_pointer_reloc): New function.
8640         (Scan::local_reloc_may_be_function_pointer): Change to call
8641         possible_function_pointer_reloc.
8642         (Scan::global_reloc_may_be_function_pointer): Ditto.
8643         * icf.h (Icf::check_section_for_function_pointers): Change to reject
8644         relocations in ".data.rel.ro._ZTV" section.
8645         * testsuite/icf_safe_so_test.sh: Change to pass i386.
8646         * testsuite/icf_safe_so_test.cc: Ditto.
8647         * testsuite/icf_safe_test.cc: Ditto.
8648         * testsuite/icf_safe_test.sh: Ditto.
8649
8650 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8651             Ian Lance Taylor  <iant@google.com>
8652
8653         * target-reloc.h (relocate_section): Check the symbol table index
8654         for -1U before setting the local symbol index.
8655         (scan_relocatable_relocs): If copying the relocation, record that
8656         the local symbol is required.
8657         * object.h (Symbol_value::is_output_symtab_index_set): New
8658         function.
8659         (Symbol_value::may_be_discarded_from_output_symtab): New
8660         function.
8661         (Symbol_value::has_output_symtab_entry): New function.
8662         (Symbol_value::needs_output_symtab_entry): Remove.
8663         (Symbol_value::output_symtab_index): Make sure the symbol index is
8664         set.
8665         (Symbol_value::set_output_symtab_index): Make sure the symbol
8666         index is not set.  Make sure the new index is valid.
8667         (Symbol_value::set_must_have_output_symtab_entry): New function.
8668         (Symbol_value::has_output_dynsym_entry): New function.
8669         (Symbol_value::set_output_dynsym_index): Make sure the new index
8670         is valid.
8671         (Sized_relobj::set_must_have_output_symtab_entry): New function.
8672         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
8673         local symbol if permitted.
8674         (Sized_relobj::do_finalize_local_symbols): Call
8675         is_output_symtab_index_set rather than needs_output_symtab_entry.
8676         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
8677         rather than needs_output_symtab_entry.  Call
8678         has_output_dynsym_entry rather than needs_output_dynsym_entry.
8679         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
8680         is_output_symtab_index_set rather than needs_output_symtab_entry.
8681         * testsuite/discard_locals_relocatable_test.c: New file.
8682         * testsuite/discard_locals_test.sh: Test -r.
8683         * testsuite/Makefile.am (check_DATA): Add
8684         discard_locals_relocatable_test1.syms,
8685         discard_local_relocatable_test2.syms.
8686         (MOSTLYCLEANFILES): Likewise.  Also add
8687         discard_locals_relocatable_test1.lout and
8688         discard_locals_relocatable_test2.out.
8689         (discard_locals_relocatable_test1.syms): New target.
8690         (discard_locals_relocatable_test.o): New target.
8691         (discard_locals_relocatable_test1.out): New target.
8692         (discard_locals_relocatable_test2.syms): New target.
8693         (discard_locals_relocatable_test2.out): New target.
8694         (various): Add missing ../ld-new dependencies.
8695         * testsuite/Makefile.in: Rebuild.
8696
8697 2010-03-03  Nick Clifton  <nickc@redhat.com>
8698
8699         * po/fi.po: New Finnish translation.
8700
8701 2010-03-01  Doug Kwan  <dougkwan@google.com>
8702
8703         * layout.cc (Layout::Layout): Force section types of .init_array*,
8704         .preinit_array* and .fini_array* sections.
8705         * output.cc (Output_section::Input_section_sort_entry::has_priority):
8706         Fix check of return value of std::string::find.().
8707         (Output_section::Input_section_sort_compare::operator()): Remove
8708         comment about .init_array.
8709         (Output_section::Input_section_sort_init_fini_compare::operator()):
8710         New method.
8711         (Output_section::sort_attached_input_sections): Handle .init_array
8712         and .fini_array specially.
8713         * output.h (Output_section::Inut_section_sort_compare): Update
8714         comment.
8715         (Output_section::Input_section_sort_init_fini_compare): New struct.
8716
8717 2010-02-26  Doug Kwan  <dougkwan@google.com>
8718
8719         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
8720         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
8721         * testsuite/debug_msg.sh: Avoid matching source line number for
8722         use of global variable undef_int.
8723
8724 2010-02-26  Doug Kwan  <dougkwan@google.com>
8725
8726         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
8727         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
8728         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
8729         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
8730         * options.cc (General_options::General_options): Initialize member
8731         fix_v4bx_.
8732         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
8733         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
8734         and rm_no_fix_v4bx.stdout
8735         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
8736         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
8737         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
8738         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
8739         and arm_no_fix_v4bx.
8740         * Makefile.in: Regenerate.
8741         * testsuite/arm_fix_v4bx.s: New file.
8742         * testsuite/arm_fix_v4bx.sh: Ditto.
8743
8744 2010-02-24  Doug Kwan  <dougkwan@google.com>
8745
8746         * arm.cc (Target_arm::got_section): Make the .got section the first
8747         non RELRO section in the data segment.
8748         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
8749         suffixes of section names.
8750
8751 2010-02-24  Doug Kwan  <dougkwan@google.com>
8752
8753         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
8754         flags and attributes merging if an input file is a binary file.
8755         * fileread.cc (Input_file::open): Record format of original file.
8756         * fileread.h (Input_file::Format): New enum type.
8757         (Input_file::Input_file): Initialize data member format_.
8758         (Input_file::format): New method definition.
8759         (Input_file::format_):: New data member.
8760
8761 2010-02-24  Doug Kwan  <dougkwan@google.com>
8762
8763         * arm.cc (Arm_output_data_got): New class.
8764         (ARM_TCB_SIZE): New constant
8765         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
8766         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
8767         If user uses a script with a SECTIONS clause, issue only a warning
8768         for a misplaced EXIDX input section.  Otherwise, issue an error.
8769         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
8770         garbage collection.
8771         (Target_arm::got_mode_index_entry): Handle static linking.
8772         (Target_arm::Scan::local): Ditto.
8773         (Target_arm::Scan::global): Ditto.
8774         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
8775         all incorrectly implemented relocations.
8776         (Target_arm::fix_exidx_coverage): Pass layout to
8777         Arm_output_section::fix_exidx_coverage.
8778         * layout.cc (Layout::section_name_mapping): Remove trailing dots
8779         from ".ARM.exidx." and ".ARM.extab.".
8780
8781 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8782
8783         * arm.cc (Target_arm::do_finalize_sections): Create attribute
8784         section if it does not already exist.
8785         * attributes.cc (Attributes_section_data::Attributes_section_data):
8786         Don't crash if size is zero.
8787
8788 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8789             Ian Lance Taylor  <iant@google.com>
8790
8791         * gold.cc (queue_middle_tasks): If no input files were opened,
8792         exit.
8793         * workqueue.h (Task_function::Task_function): Assert that there is
8794         a blocker.
8795
8796 2010-02-22  Doug Kwan  <dougkwan@google.com>
8797
8798         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
8799         * icf.cc (get_section_contents): Cast snprintf arguments to long long
8800         types to avoid warnings due to different uint64_t implementations
8801         on different hosts.
8802
8803 2010-02-21  Doug Kwan  <dougkwan@google.com>
8804
8805         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
8806         handling of the maximum backward branch offset.
8807         (Arm_relocate_functions::thumb_branch_common): Ditto.
8808         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
8809         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
8810         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
8811         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
8812         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
8813         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
8814         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
8815         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
8816         thumb_bl_out_of_range thumb_bl_out_of_range.o,
8817         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
8818         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
8819         thumb2_bl_out_of_range.o): New rules.
8820         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
8821         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
8822         thumb2_bl_out_of_range
8823         * testsuite/Makefile.in: Regenerate.
8824         * testsuite/arm_bl_in_range.s: New file.
8825         * testsuite/arm_bl_out_of_range.s: Ditto.
8826         * testsuite/arm_branch_in_range.sh: Ditto.
8827         * testsuite/arm_branch_range.t: Ditto.
8828         * testsuite/thumb2_branch_range.t: Ditto.
8829         * testsuite/thumb_bl_in_range.s: Ditto.
8830         * testsuite/thumb_bl_out_of_range.s: Ditto.
8831         * testsuite/thumb_branch_range.t: Ditto.
8832
8833 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
8834
8835         * gc.h (gc_process_relocs): Change vectors to point to the new list.
8836         Add reloc offset information.
8837         * icf.cc (get_section_contents): Change iterators to point to the new
8838         vectors. Add reloc offset information to the contents.
8839         * icf.h (Icf::Sections_reachable_info): New typedef.
8840         (Icf::Sections_reachable_list): New typedef.
8841         (Icf::Offset_info): New typedef.
8842         (Icf::Reloc_info): New struct typedef.
8843         (Icf::Reloc_info_list): New typedef.
8844         (Icf::symbol_reloc_list): Delete method.
8845         (Icf::addend_reloc_list): Delete method.
8846         (Icf::section_reloc_list): Delete method.
8847         (Icf::reloc_info_list): New method.
8848         (Icf::reloc_info_list_): New member.
8849
8850 2010-02-19  Doug Kwan  <dougkwan@google.com>
8851
8852         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
8853         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
8854         * arm.cc (Arm_relocation_functions): New forward declaration.
8855         (Target_arm::Target_arm): Initialize new data members
8856         got_mod_index_offset_ and tls_base_symbol_defined_.
8857         (Target_arm::Relocate::relocate_tls): New method.
8858         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
8859          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
8860         New methods.
8861         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
8862         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
8863         (Target_arm::got_mod_index_offset_,
8864         Target_arm::tls_base_symbol_defined_): New data members.
8865         (Target_arm::Scan::local, Target::Scan::global,
8866         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
8867         relocations.
8868
8869 2010-02-18  Doug Kwan  <dougkwan@google.com>
8870
8871         * arm.cc (Arm_relobj::find_linked_text_section): New method.
8872         (Arm_relobj::make_exidx_input_section): Pass section index of linked
8873         text section as a parameter becuase some broken tools may not set
8874         the link in section header.
8875         (Target_arm::has_got_section): New method.
8876         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
8877         without any mapping symbol as data only.  Remove warning.
8878         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
8879         link in its section header, try to discover the link by inspecting the
8880         REL31 relocation at the beginning of the section.
8881         (Target_arm::Scan::check_non_pic): Report name of offending relocation
8882         in error message.
8883         (Target_arm::Scan::global): Treat any reference to the symbol
8884         _GLOBAL_OFFSET_TABLE_ as a GOT access.
8885
8886 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
8887
8888         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
8889         (Scan::global_reloc_may_be_function_pointer): New function.
8890         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
8891         (Scan::global_reloc_may_be_function_pointer): New function.
8892         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
8893         (Scan::global_reloc_may_be_function_pointer): New function.
8894         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
8895         (Scan::global_reloc_may_be_function_pointer): New function.
8896         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
8897         (Scan::global_reloc_may_be_function_pointer): New function.
8898         (Scan::possible_function_pointer_reloc): New function.
8899         (Target_x86_64::can_check_for_function_pointers): New function.
8900         * gc.h (gc_process_relocs): Scan relocation types to determine if
8901         function pointers were taken for targets that support it.
8902         * icf.cc (Icf::find_identical_sections): Include functions for
8903         folding in safe ICF whose pointer is not taken.
8904         * icf.h (Secn_fptr_taken_set): New typedef.
8905         (fptr_section_id_): New member.
8906         (section_has_function_pointers): New function.
8907         (set_section_has_function_pointers): New function.
8908         (check_section_for_function_pointers): New function.
8909         * options.h: Fix comment for safe ICF option.
8910         * target.h (can_check_for_function_pointers): New function.
8911         * testsuite/Makefile.am: Add icf_safe_so_test test case.
8912         Modify icf_safe_test for X86-64.
8913         * testsuite/Makefile.in: Regenerate.
8914         * testsuite/icf_safe_so_test.cc: New file.
8915         * testsuite/icf_safe_so_test.sh: New file.
8916         * testsuite/icf_safe_test.cc (kept_func_3): New function.
8917         (main): Change to take pointer to function kept_func_3.
8918         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
8919         folding is done correctly for X86-64.
8920
8921 2010-02-12  David S. Miller  <davem@davemloft.net>
8922
8923         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
8924         is_symbolless parameter.
8925         (Output_reloc<SHT_REL>::is_symbolless): New.
8926         (Output_reloc<SHT_REL>::is_symbolless_): New.
8927         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
8928         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
8929         (Output_reloc<SHT_RELA>::is_symbolless): New.
8930         (Output_data_reloc::add_global): Handle is_symbolless.
8931         (Output_data_reloc::add_global_relative): Likewise.
8932         (Output_data_reloc::add_local): Likewise.
8933         (Output_data_reloc::add_local_relative): Likewise.
8934         (Output_data_reloc::add_symbolless_global_addend): New.
8935         (Output_data_reloc::add_symbolless_local_addend): New.
8936         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
8937         is_symbolless.
8938         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
8939         instead of ->is_relative_
8940         (Output_reloc::write): Likewise.
8941         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
8942         (Output_reloc::write_rel): Simplify.
8943
8944         * sparc.cc (Target_sparc::Scan::local): Use
8945         ->add_symbolless_local_addend as needed.
8946         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
8947         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
8948         based upon relocation offset.
8949
8950 2010-02-11  Doug Kwan  <dougkwan@google.com>
8951
8952         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
8953         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
8954         beginning of function.
8955         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
8956         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
8957         parameter is_32bit in calls to should_apply_static_reloc.
8958         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
8959         (check_DATA): Add arm_abs_global.stdout.
8960         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
8961         arm_abs_global.stdout): New rules.
8962         (MOSTLLYCLEANFILES): Add arm_abs_global
8963         * Makefile.in: Regenerate.
8964         * testsuite/arm_abs_global.s: New file.
8965         * testsuite/arm_abs_global.sh: Ditto.
8966         * testsuite/arm_abs_lib.s: Ditto.
8967
8968 2010-02-11  Ian Lance Taylor  <iant@google.com>
8969
8970         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
8971         Read_relocs task.
8972         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
8973         Allocate_commons_task first.
8974         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
8975         task, rather than symtab_lock_.
8976         (Gc_process_relocs::~Gc_process_relocs): New function.
8977         (Gc_process_relocs::is_runnable): Check this_blocker_.
8978         (Gc_process_relocs::locks): Use next_blocker_ rather than
8979         blocker_.
8980         (Scan_relocs::~Scan_relocs): New function.
8981         (Scan_relocs::is_runnable): Check this_blocker_ rather than
8982         symtab_lock_.
8983         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
8984         next_blocker_.
8985         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
8986         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
8987         constructor accordingly.
8988         (class Gc_process_relocs): Likewise.
8989         (class Scan_relocs): Likewise.
8990         * common.h (class Allocate_commons_task): Remove symtab_lock_
8991         field, and corresponding constructor parameter.
8992         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
8993         symtab_lock_.
8994         (Allocate_commons_task::locks): Likewise.
8995
8996 2010-02-11  Ian Lance Taylor  <iant@google.com>
8997
8998         * gold-threads.h (class Once): Define.
8999         (class Initialize_lock): Rewrite as child of Once.
9000         * gold-threads.cc (class Once_initialize): Define.
9001         (once_pointer_control): New static variable.
9002         (once_pointer, once_arg): New static variables.
9003         (c_run_once): New static function.
9004         (Once::Once, Once::run_once, Once::internal_run): New functions.
9005         (class Initialize_lock_once): Remove.
9006         (initialize_lock_control): Remove.
9007         (initialize_lock_pointer): Remove.
9008         (initialize_lock_once): Remove.
9009         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
9010         (Initialize_lock::initialize): Rewrite.
9011         (Initialize_lock::do_run_once): New function.
9012         * archive.cc (Archive::interpret_header): Only clear name if it is
9013         not already empty.
9014         * fileread.cc: Include "gold-threads.h"
9015         (file_counts_lock): New static variable.
9016         (file_counts_initialize_lock): Likewise.
9017         (File_read::release): Only increment counts when using --stats.
9018         Use a lock around the increment.
9019         * parameters.cc (class Set_parameters_target_once): Define.
9020         (set_parameters_target_once): New static variable.
9021         (Parameters::Parameters): Move here from parameters.h.
9022         (Parameters::set_target): Rewrite.
9023         (Parameters::set_target_once): New function.
9024         (Parameters::clear_target): Move here and rewrite.
9025         * parameters.h (class Parameters): Update declarations.  Add
9026         set_parameters_target_once_ field.
9027         (Parameters::Parameters): Move to parameters.cc.
9028         (Parameters::clear_target): Likewise.
9029         * readsyms.cc (Read_symbols::do_group): Create a Start_group
9030         task.
9031         (Start_group::~Start_group): New function.
9032         (Start_group::is_runnable): New function.
9033         (Start_group::locks, Start_group::run): New functions.
9034         (Finish_group::run): Change saw_undefined to size_t.
9035         * readsyms.h (class Start_group): Define.
9036         (class Finish_group): Change saw_undefined_ field to size_t.
9037         (Finish_group::Finish_group): Remove saw_undefined and
9038         this_blocker parameters.  Change all callers.
9039         (Finish_group::set_saw_undefined): New function.
9040         (Finish_group::set_blocker): New function.
9041         * symtab.h (class Symbol_table): Change saw_undefined to return
9042         size_t.  Change saw_undefined_ field to size_t.
9043         * target-select.cc (Set_target_once::do_run_once): New function.
9044         (Target_selector::Target_selector): Initialize set_target_once_
9045         field.  Don't initialize lock_ and initialize_lock_ fields.
9046         (Target_selector::instantiate_target): Rewrite.
9047         (Target_selector::set_target): New function.
9048         * target-select.h (class Set_target_once): Define.
9049         (class Target_selector): Update declarations.  Make
9050         Set_target_once a friend.  Remove lock_ and initialize_lock_
9051         fields.  Add set_target_once_ field.
9052
9053 2010-02-10  Ian Lance Taylor  <iant@google.com>
9054
9055         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
9056         queueing any tasks.
9057         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
9058         (queue_middle_tasks): Add all blockers before queueing any tasks.
9059         (queue_final_tasks): Likewise.
9060         * token.h (Task_token::add_blockers): New function.
9061         * object.h (Input_objects::number_of_relobjs): New function.
9062
9063 2010-02-10  Ian Lance Taylor  <iant@google.com>
9064
9065         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
9066         shared, not if not position independent.
9067         * x86_64.cc (Relocate::relocate_tls): Likewise.
9068         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
9069         (tls_pie_pic_test): New target.
9070         * testsuite/Makefile.in: Rebuild.
9071
9072         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
9073         (tls_test_main_pie.o, tls_test_pie.o): New targets.
9074         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
9075         * testsuite/Makefile.in: Rebuild.
9076
9077 2010-02-09  David S. Miller  <davem@davemloft.net>
9078
9079         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
9080         R_SPARC_RELATIVE using ->add_local_relative().
9081         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
9082
9083         * output.h (Output_data_dynamic::add_section_size): New method
9084         that takes two Output_data objects.
9085         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
9086         entry param.  Handle it in initializers.
9087         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
9088         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
9089         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
9090         arg.
9091         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
9092         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
9093         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
9094         for dynrel_includes_plt.
9095         * i386.cc (Target_i386::do_finalize_sections): Likewise.
9096         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
9097         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
9098         before .rela.plt
9099         (Target_sparc::do_finalize_sections): Update to pass true for
9100         dynrel_includes_plt.
9101         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
9102         output before .rela.plt
9103         (Target_powerpc::do_finalize_sections): Update to pass true for
9104         dynrel_includes_plt when 32-bit.
9105
9106 2010-02-08  Doug Kwan  <dougkwan@google.com>
9107
9108         * arm.cc (Arm_relobj::simple_input_section_output_address): New
9109         method.
9110         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
9111         Arm_relobj::scan_section_for_cortex_a8_stubs,
9112         Arm_relobj::do_relocation_section): Instead of calling
9113         Output_section::output_address, use faster
9114         Arm_relobj::simple_input_section_output_address.
9115
9116 2010-02-08  David S. Miller  <davem@davemloft.net>
9117
9118         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
9119         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
9120         relocation helper function.
9121
9122         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
9123         just like R_SPARC_GOT{10,13,22}.
9124         (Target_sparc::Scan::local): Likewise.
9125         (Target_sparc::Relocate:relocate): Likewise.
9126
9127 2010-02-06  Ian Lance Taylor  <iant@google.com>
9128
9129         * configure.ac: Rewrite targetobjs duplicate removal code to use
9130         only shell constructs.
9131         * configure: Rebuild.
9132
9133 2010-02-05  Doug Kwan  <dougkwan@google.com>
9134
9135         PR 11247
9136         * arm.cc (Arm_relobj::section_is_scannable): New method.
9137         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
9138         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
9139
9140 2010-02-04  Doug Kwan  <dougkwan@google.com>
9141
9142         PR 11247
9143         * arm-reloc-property.cc (cstdio): Include.
9144         * configure.ac (targetobjs): Remove duplicates.
9145         * configure: Regenerate.
9146         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
9147         big and little endian version for a given address size.
9148
9149 2010-02-03  Doug Kwan  <dougkwan@google.com>
9150
9151         * arm-reloc-property.cc
9152         (Arm_reloc_property_table::reloc_name_in_error_message): New method
9153         definition.
9154         * arm-reloc-property.h
9155         (Arm_reloc_property_table::get_implemented_static_reloc_property):
9156         New method definition.
9157         (Arm_reloc_property_table::reloc_name_in_error_message): New method
9158         declaration.
9159         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
9160         overflow to N.
9161         (GOT_PREL): Change implemented to Y.
9162         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
9163         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
9164         (Arm_relocate_functions::movw_abs_nc): Remove method.
9165         (Arm_relocate_functions::movt_abs): Ditto.
9166         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
9167         (Arm_relocate_functions::thm_movt_abs): Ditto.
9168         (Arm_relocate_functions::movw_rel_nc): Ditto.
9169         (Arm_relocate_functions::movw_rel): Ditto.
9170         (Arm_relocate_functions::movt_rel): Ditto.
9171         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
9172         (Arm_relocate_functions:thm_movw_rel): Ditto.
9173         (Arm_relocate_functions:thm_movt_rel): Ditto.
9174         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
9175         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
9176         New method definitions.
9177         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
9178         (Arm_relocation_functions::arm_grp_ldr): Ditto.
9179         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
9180         (Arm_relocation_functions::arm_grp_ldc): Ditto.
9181         (Target_arm::Relocate::relocate): Check for non-static or
9182         unimplemented relocation code and exit early.  Change calls to
9183         Target_arm::reloc_uses_thumb_bit and
9184         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
9185         instead.  Refactor code to handle similar relocations to increase
9186         code sharing.  Remove check for unsupported relocation code in switch
9187         statement.
9188         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
9189         relocation property table to find out size.  Change error message to
9190         print out the name of a relocation code instead of the numeric value.
9191         (Target_arm::scan_reloc_for_stub): Use relocation property table
9192         instead of calling Target_arm::reloc_uses_thumb_bit().
9193
9194 2010-02-02  Doug Kwan  <dougkwan@google.com>
9195
9196         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
9197         types of relaxed input section.
9198
9199 2010-02-02  Doug Kwan  <dougkwan@google.com>
9200
9201         * Makefile.am (HFILES): Add arm-reloc-property.h.
9202         (DEFFILES): New.
9203         (TARGETSOURCES): Add arm-reloc-property.cc
9204         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
9205         (libgold_a_SOURCES): $(DEFFILES)
9206         * Makefile.in: Regenerate.
9207         * arm-reloc-property.cc: New file.
9208         * arm-reloc-property.h: New file.
9209         * arm-reloc.def: New file.
9210         * arm.cc: Update comments.
9211         (arm-reloc-property.h): New included header.
9212         (arm_reloc_property_table): New global variable.
9213         (Target_arm::do_select_as_default_target): New method definition.
9214         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
9215         arm-reloc-property to targ_extra_obj.
9216         * parameters.cc (set_parameters_target): Call
9217         Target::select_as_default_target().
9218         * target.h (Target::select_as_default_target): New method definition.
9219         (Target::do_select_as_default_target): Same.
9220
9221 2010-02-01  Doug Kwan  <dougkwan@google.com>
9222
9223         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
9224         first_output_text_section_.
9225         (Arm_exidx_fixup::first_output_text_section): New method definition.
9226         (Arm_exidx_fixup::first_output_text_section_): New data member.
9227         (Arm_exidx_fixup::process_exidx_section): Record the first text
9228         output section seen.
9229         (Arm_output_section::fix_exidx_coverage): Set correct linked section
9230         and entsize in output section header.
9231
9232 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9233
9234         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
9235         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
9236         (Arm_relocate_functions::thm_alu11): New Method.
9237         (Arm_relocate_functions::thm_pc8): New Method.
9238         (Arm_relocate_functions::thm_pc12): New Method.
9239         (Target_arm::Scan::local): Handle the relocations.
9240         (Target_arm::Scan::global): Likewise.
9241         (Target_arm::Relocate::relocate): Likewise.
9242         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9243
9244 2010-01-29  Doug Kwan  <dougkwan@google.com>
9245
9246         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
9247         of relocation types as ld.
9248
9249 2010-01-29  Doug Kwan  <dougkwan@google.com>
9250
9251         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
9252         to public.
9253         (Arm_relocate_functions::thumb_branch_common): Ditto.
9254         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
9255         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
9256         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
9257         Arm_relocate_functions::jump24): Remove.
9258         (Target_arm::Relocate::relocate): Adjust code to call
9259         Arm_relocation_functions::arm_branch_common and
9260         Arm_relocation_functions::thumb_branch_common instead of their removed
9261         wrappers.  Merge switch-cases together to reduce source code size.
9262
9263 2010-01-29  Doug Kwan  <dougkwan@google.com>
9264
9265         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
9266         output_local_symbol_count_needs_update_.
9267         (Arm_relobj::output_local_symbol_count_needs_update,
9268          Arm_relobj::set_output_local_symbol_count_needs_update,
9269          Arm_relobj::update_output_local_symbol_count): New methods.
9270         (Arm_relobj::output_local_symbol_count_needs_update_): New data
9271         member.
9272         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
9273         of pointed function as in a R_ARM_PREL31 relocation.
9274         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
9275         for output local symbol count updating.
9276         (Target_arm::do_relax): Update output local symbol counts in objects
9277         if necessary.
9278         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
9279
9280 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9281
9282         * arm.cc: Added support for the ARM relocations:
9283         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
9284         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
9285         (Arm_relocate_functions::movw_rel_nc): Renamed (was
9286         movw_prel_nc).
9287         (Arm_relocate_functions::movw_rel): New method.
9288         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
9289         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
9290         thm_movw_prel_nc).
9291         (Arm_relocate_functions::thm_movw_rel): New method.
9292         (Arm_relocate_functions::thm_movt_rel): Renamed (was
9293         thm_movt_prel).
9294         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
9295         relocations.
9296         (Target_arm::Scan::global): Likewise.
9297         (Target_arm::Relocate::relocate): Likewise.
9298         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9299         Likewise.
9300
9301 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9302
9303         * arm.cc: Added support for ARM group relocations.
9304         (Target_arm::reloc_needs_sym_origin): New method.
9305         (Arm_relocate_functions::calc_grp_kn): New method.
9306         (Arm_relocate_functions::calc_grp_residual): New method.
9307         (Arm_relocate_functions::calc_grp_gn): New method.
9308         (Arm_relocate_functions::arm_grp_alu): New Method.
9309         (Arm_relocate_functions::arm_grp_ldr): New Method.
9310         (Arm_relocate_functions::arm_grp_ldrs): New Method.
9311         (Arm_relocate_functions::arm_grp_ldc): New Method.
9312         (Target_arm::Scan::local): Handle the ARM group relocations.
9313         (Target_arm::Scan::global): Likewise.
9314         (Target_arm::Relocate::relocate): Likewise.
9315         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9316         Likewise.
9317
9318 2010-01-26  Doug Kwan  <dougkwan@google.com>
9319
9320         * arm.cc (set): Include.
9321         (class Arm_exidx_fixup): Change type of last_input_section_ to const
9322         pointer type.
9323         (Arm_output_section::Text_section_list): New type.
9324         (Arm_output_section::append_text_sections_to_list): New method.
9325         (Arm_output_section::fix_exidx_coverage): Ditto.
9326         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
9327         (Arm_relobj::convert_input_section_to_relaxed_section): Use
9328         Relobj::set_section_offset() instead of
9329         Sized_relobj::invalidate_section_offset().
9330         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
9331         parameter for section headers. Ignore relocation sections for
9332         unallocated sections and EXIDX sections.
9333         (Target_arm::fix_exidx_coverage): New method.
9334         (Target_arm::output_section_address_less_than): New type.
9335         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
9336         linked text section instead of the EXIDX section.
9337         (Arm_output_section::create_stub_group): Add an assertion to check
9338         that this is not an EXIDX output section.
9339         (Arm_output_section::append_text_sections_to_list): New method.
9340         (Arm_output_section::fix_exidx_coverage): Ditto.
9341         (Arm_relobj::scan_sections_for_stubs): Adjust call to
9342         Arm_relobj::section_needs_reloc_stub_scanning.
9343         (Target_arm::do_relax): Fix EXIDX output section coverage in the
9344         first pass.
9345         (Target_arm::fix_exidx_coverage): New method.
9346         * object.h (Relobj::set_output_section): New method.
9347         (Sized_relobj::invalidate_section_offset): Remove method.
9348         (Sized_relobj::do_invalidate_section_offset): Remove method.
9349         (Sized_relobj::do_set_section_offset): Handle offset value -1.
9350
9351 2010-01-25  Doug Kwan  <dougkwan@google.com>
9352
9353         * arm.cc (Arm_exidx_merged_section::do_output_offset):
9354         Fix warning due to signed and unsigned comparison on a 32-bit host.
9355
9356 2010-01-22  Doug Kwan  <dougkwan@google.com>
9357
9358         * arm.cc (Target_arm::do_relax): Record an output section for section
9359         offset adjustment it contains any stub table that has changed.
9360         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
9361         offsets in an output section if necessary.
9362         * output.cc (Output_section::Output_section): Initialize
9363         section_offsets_need_adjustments_.
9364         (Output_section::add_input_section_for_script): Renamed to
9365         Output_section::add_simple_input_section.
9366         (Output_section::save_states): Add a comment.
9367         (Output_section::discard_states): New method defintion.
9368         (Output_section::adjust_section_offsets): Same.
9369         * output.h (Output_section::add_input_section_for_script): Renamed to
9370         Output_section::add_simple_input_section.
9371         (Output_section::discard_states): New method declaration.
9372         (Output_section::adjust_section_offsets): Same.
9373         (Output_section::section_offsets_need_adjustment,
9374         Output_section::set_section_offsets_need_adjustment): New method
9375         definitions.
9376         (Output_section::section_offsets_need_adjustment_): New data member.
9377         * script-sections.cc
9378         (Output_section_element_input::set_section_address): Adjust code for
9379         renaming of Output_section::add_input_section_for_script.
9380         (Orphan_output_section::set_section_address): Same.
9381
9382 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9383
9384         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
9385         Fix_v4bx enum values .
9386         * gold/options.h (General_options): New option definitions.
9387         (General_options::fix_v4bx): New method.
9388         (General_options::Fix_v4bx): New enum.
9389         * gold/options.cc (General_options::parse_fix_v4bx): New method.
9390         (General_options::parse_fix_v4bx_interworking): New method.
9391
9392 2010-01-22  Doug Kwan  <dougkwan@google.com>
9393
9394         * arm.cc (Arm_exidx_fixup): New class.
9395
9396 2010-01-21  Doug Kwan  <dougkwan@google.com>
9397
9398         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
9399         classes.
9400         (Arm_exidx_section_offset_map): New type.
9401
9402 2010-01-21  Doug Kwan  <dougkwan@google.com>
9403
9404         * arm.cc (Arm_exidx_input_section): New class.
9405         (Arm_relobj::exidx_input_section_by_link,
9406         Arm_relobj::exidx_input_section_by_shndx,
9407         Arm_relobj::make_exidx_input_section): New methods.
9408         (read_arm_attributes_section): Remove.
9409         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
9410         information about them.
9411         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
9412         to here.
9413
9414 2010-01-20  Doug Kwan  <dougkwan@google.com>
9415
9416         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
9417         Input_section_specifier to Section_id.
9418         (Target_arm::new_arm_input_section: Adjust code for change of key
9419         type.
9420         (Target_arm::find_arm_input_section): Ditto.
9421         * gc.h (object.h): Include for Section_id nand Section_id_hash.
9422         (Section_id): Remove.
9423         (Garbage_collection::Section_id_hash): Remove.
9424         * icf.h (object.h): Include for Section_id nand Section_id_hash.
9425         (Section_id): Remove.
9426         (Icf::Section_id_hash): Remove.
9427         * object.h (Section_id, Const_section_id, Section_id_hash,
9428         Const_section_id_hash): New type definitions.
9429         * output.cc (Output_section::add_relaxed_input_section): Change to
9430         use Const_section_id instead of Input_section_specifier as key type.
9431         (Output_section::add_merge_input_section): Ditto.
9432         (Output_section::build_relaxation_map): Change to use Section_id
9433         instead of Input_section_specifier as key type.
9434         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
9435         Ditto.
9436         (Output_section::convert_input_sections_to_relaxed_sections): Change
9437         to use Const_section_id instead of Input_section_specifier as key type.
9438         (Output_section::find_merge_section): Ditto.
9439         (Output_section::find_relaxed_input_section): Ditto.
9440         * output.h (Input_section_specifier): Remove class.
9441         (Output_section::Output_section_data_by_input_section_map): Change
9442         key type to Const_section_id.
9443         (Output_section::Output_relaxed_input_section_by_input_section_map):
9444         Ditto.
9445         (Output_section::Relaxation_map): Change key type to Section_id.
9446
9447 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9448
9449         * gold/arm.cc: Added support for R_ARM_V4BX relocation
9450         (class Arm_v4bx_stub): New class.
9451         (DEF_STUBS): Updated definition to support v4_veneer_bx.
9452         (Stub_factory::make_arm_v4bx_stub): New method.
9453         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
9454         (Stub_table::empty): Handle v4bx stubs.
9455         (Stub_table::add_arm_v4bx_stub): New method.
9456         (Stub_table::find_arm_v4bx_stub): New method.
9457         (Arm_relocate_functions::v4bx): New method.
9458         (Target_arm::fix_v4bx): New method.
9459         (Target_arm::Target_arm): Handle R_ARM_V4BX.
9460         (Stub_table::relocate_stubs): Likewise.
9461         (Stub_table::do_write): Likewise.
9462         (Stub_table::update_data_size_and_addralign): Likewise.
9463         (Stub_table::finalize_stubs):  Likewise.
9464         (Target_arm::Scan::local): Likewise.
9465         (Target_arm::Scan::global): Likewise.
9466         (Target_arm::do_finalize_sections): Likewise.
9467         (Target_arm::Relocate::relocate): Likewise.
9468         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9469         Likewise.
9470         (Target_arm::scan_reloc_for_stub): Likewise.
9471         (Target_arm::scan_reloc_section_for_stubs): Likewise.
9472
9473 2010-01-19  Ian Lance Taylor  <iant@google.com>
9474
9475         * output.cc (Output_section_headers::do_sized_write): Write large
9476         segment count to sh_info field.
9477         (Output_file_header::do_sized_write): For large segment count,
9478         write PN_XNUM to e_phnum field.
9479
9480 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9481
9482         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
9483         (Arm_relocate_functions::thm_jump8): New function.
9484         (Arm_relocate_functions::thm_jump11): New function.
9485         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
9486         R_ARM_THM_JUMP11.
9487         (Target_arm::Scan::global): Likewise.
9488         (Target_arm::Relocate::relocate): Likewise.
9489         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9490         Likewise.
9491
9492 2010-01-14  Doug Kwan  <dougkwan@google.com>
9493
9494         * arm.cc (map, utility): Include headers.
9495         (Target_arm::apply_cortex_a8_workaround): New method.
9496         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
9497         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
9498         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
9499         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
9500         the --[no-]fix-cortex-a8 command line options.
9501         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
9502         (Target_arm::relocate_stub): Use addend in instruction template.
9503         * options.h (DEFINE_bool): Set the user-set flag.
9504         (General_options): Add --[no-]-fix-cortex options.
9505         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
9506         : Update fast look-up map after conversion.
9507
9508 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
9509
9510         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
9511         in the first pass of do_layout.
9512
9513 2010-01-13  Doug Kwan  <dougkwan@google.com>
9514
9515         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
9516         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
9517         apparent compiler problem of not folding static constant integral
9518         data members of elfcpp::Elf_sizes<32>.
9519
9520 2010-01-13  Doug Kwan  <dougkwan@google.com>
9521
9522         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
9523         Arm_relobj::section_needs_cortex_a8_stub_scanning,
9524         Arm_relobj::scan_section_for_cortex_a8_erratum,
9525         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
9526         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
9527         sections to scan for relocation stubs into a new method
9528         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
9529         relocation and Cortex-A8 stub scanning.
9530         (Target_arm::do_relax): Force stubs to be after stubbed sections
9531         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
9532         the beginning of a new relaxation pass.  Update a comment.
9533         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
9534
9535 2010-01-12  Ian Lance Taylor  <iant@google.com>
9536
9537         * target-reloc.h (visibility_error): New inline function.
9538         (relocate_section): Call visibility_error.
9539         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
9540         (MOSTLYCLEANFILES): Likewise.
9541         (protected_4_pic.o, protected_3.err): New targets.
9542         * testsuite/protected_4.cc: New file.
9543
9544 2010-01-12  Doug Kwan  <dougkwan@google.com>
9545
9546         * arm.cc (Cortex_a8_reloc): New class.
9547         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
9548         and cortex_a8_relocs_info_.
9549         (Target_arm::fix_cortex_a8): New method definition.
9550         (Target_arm::Cortex_a8_relocs_info): New type.
9551         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
9552         New data member declarations.
9553         (Target_arm::scan_reloc_for_stub): Record information about
9554         relocations for THUMB branches that might be exempted from the
9555         Cortex-A8 workaround.
9556         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
9557         at the beginning of a relaxation pass.
9558
9559 2010-01-12  Doug Kwan  <dougkwan@google.com>
9560
9561         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
9562         (Arm_relobj::Mapping_symbol_position,
9563          Arm_reloj::Mapping_symbol_position_less,
9564          Arm_relobj::Mapping_symbols_info): New types.
9565         (Target_arm::is_mapping_symbol_name): New method definition.
9566         (Arm_relobj::do_count_local_symbols): Save information about mapping
9567         symbols.
9568
9569 2010-01-11  Doug Kwan  <dougkwan@google.com>
9570
9571         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
9572         Arm_relocate_functions::thumb32_branch_upper,
9573         Arm_relocate_functions::thumb32_branch_lower,
9574         Arm_relocate_functions::thumb32_cond_branch_offset,
9575         Arm_relocate_functions::thumb32_cond_branch_upper,
9576         Arm_relocate_functions::thumb32_cond_branch_lower,
9577         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
9578         branch offset encoding.
9579         (Arm_relocate_functions::thumb_branch_common): Use new branch
9580         offset encoding methods to avoid code duplication.
9581         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
9582         (Stub_addend_reader::operator()): Use new branch encoding method
9583         to avoid code duplication.
9584
9585 2010-01-11  Doug Kwan  <dougkwan@google.com>
9586
9587         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
9588         (Target_arm::do_finalize_sections): Define special EXIDX section
9589         symbols only if referenced.
9590         * gc.h (Garbage_collection::add_reference): New method.
9591         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
9592         code duplication.
9593
9594 2010-01-11  Ian Lance Taylor  <iant@google.com>
9595
9596         * script.cc (Version_script_info::build_expression_list_lookup):
9597         Change complaing about duplicate wildcard match from error to
9598         warning.
9599
9600         * script.cc (class Lazy_demangler): Recreate--revert part of patch
9601         of 2009-12-30.
9602         (Version_script_info::Version_script_info): Initialize globs_,
9603         default_version_, default_is_global_, and exact_.  Don't
9604         initialize globals_ or locals_.
9605         (Version_script_info::build_lookup_tables): Build local symbols
9606         first.
9607         (Version_script_info::unquote): New function.
9608         (Version_script_info::add_exact_match): New function.
9609         (Version_script_info::build_expression_list_lookup): Remove lookup
9610         parameter.  Add is_global parameter.  Change all callers.  Handle
9611         wildcard pattern specially.  Unquote pattern.  Call
9612         add_exact_match.
9613         (Version_script_info::get_name_to_match): New function.
9614         (Version_script_info::get_symbol_version): New function.
9615         (Version_script_info::get_symbol_version_helper): Remove.
9616         (Version_script_info::check_unmatched_names): Call unquote.
9617         * script.h (class Version_script_info): Change get_symbol_version
9618         to be non-inline and add is_global parameter; change all callers.
9619         Rewrite symbol_is_local.  Update declarations.  Define struct
9620         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
9621         Remove globals_ and locals_ members.  Add exact_, globs_,
9622         default_version_, is_global_.
9623         (Version_script_info::Glob): Remove pattern, add expression and
9624         is_global.  Update constructor.  Change all callers.
9625         * dynobj.cc (Versions::finalize): Mark the version symbol as the
9626         default version.
9627         (Versions::symbol_section_contents): If a symbol is undefined, or
9628         defined in a dynamic object, set the version index to
9629         VER_NDX_LOCAL.
9630         * symtab.cc (Symbol_table::add_from_relobj): Don't call
9631         symbol_is_local.
9632         (Symbol_table::add_from_pluginobj): Likewise.
9633         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
9634
9635 2010-01-11  Doug Kwan  <dougkwan@google.com>
9636
9637         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
9638         (incremental_dump_LDADD): Add linking option for libintl.
9639         * Makefile.in: Regenerate.
9640
9641 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
9642
9643         PR gold/11144
9644         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
9645         instead of -Ds.
9646         * testsuite/Makefile.in: Regenerated.
9647
9648 2010-01-10  Doug Kwan  <dougkwan@google.com>
9649
9650         * options.h (DEFINE_var): Use parentheses around argument varname__
9651         in macro body to avoid any unintended subsequent substitutions.
9652
9653 2010-01-10  Ian Lance Taylor  <iant@google.com>
9654
9655         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
9656         candidates before doing symbol resolution.
9657
9658         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
9659         ODR candidates if only one is weak.
9660
9661 2010-01-08  Ian Lance Taylor  <iant@google.com>
9662
9663         * script.cc (Version_script_info::build_expression_list_lookup):
9664         Don't warn about ambiguous version, just record the ambiguity.
9665         (Version_script_info::get_symbol_version_helper): Give error if
9666         version is ambiguous.
9667
9668 2010-01-08  Doug Kwan  <dougkwan@google.com>
9669
9670         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
9671         prev_data_size_ and prev_addralign_.  Remove initializer for
9672         deleted data member has_been_changed_.
9673         (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
9674         to determine if the table is empty.
9675         (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
9676         Remove.
9677         (Stub_table::add_reloc_stub): Define method in class definition
9678         instead of just declaring it there.
9679         (Stub_table::add_cortex_a8_stub): New method definition.
9680         (Stub_table::update_data_size_and_addralign): Ditto.
9681         (Stub_table::finalize_stubs): Ditto.
9682         (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
9683         (Stub_table::do_addralign_): Return address alignment in the
9684         (Stub_table::do_reset_address_and_file_offset): Define method in
9685         class definition instead of declaring it there.  Set current data
9686         size to be the data size of the previous pass.
9687         (Stub_table::set_final_data_size): Use current data size as the
9688         final data size.
9689         (Stub_table::relocate_stub): Change parameter type of stub from
9690         Reloc_stub pointer to Stub pointer.
9691         (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
9692         (Stub_table::Cortex_a8_stub_list): New typedef.
9693         (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
9694          Stub_table::prev_addralign_): New data member.
9695         (Arm_relobj::Arm_relobj): Initialize data member
9696         section_has_cortex_a8_workaround_.
9697         (Arm_relobj::section_has_cortex_a8_workaround,
9698          Arm_relobj::mark_section_for_cortex_a8_workaround): New method
9699          definitions.
9700         (Arm_relobj::section_has_cortex_a8_workaround_): New data member
9701         declarations.
9702         (Target_arm::relocate_stub): Change parameter type of stub from
9703         Reloc_stub pointer to Stub pointer.
9704         (Insn_template::size, Insn_template::alignment): Handle
9705         THUMB16_SPECIAL_TYPE.
9706         (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
9707          Stub_table::update_data_size_and_addralign,
9708          Stub_table::apply_cortex_a8_workaround_to_address_range): New method
9709         definitions.
9710         (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
9711         (Stub_table::do_write): Ditto.
9712         (Target_arm::do_relax): Adjust code for changes in Stub_table.
9713
9714 2010-01-08  Ian Lance Taylor  <iant@google.com>
9715
9716         PR 11108
9717         * symtab.h (class Symbol): Remove fields is_target_special_ and
9718         has_plt_offset_.  Add field is_defined_in_discarded_section_.
9719         (Symbol::is_defined_in_discarded_section): New function.
9720         (Symbol::set_is_defined_in_discarded_section): New function.
9721         (Symbol::has_plt_offset): Rewrite.
9722         (Symbol::set_plt_offset): Verify that new offset is not -1U.
9723         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
9724         Don't initialize is_target_special_ or has_plt_offset_.
9725         Initialize is_defined_in_discarded_section_.
9726         (Symbol_table::add_from_relobj): If appropriate, set
9727         is_defined_in_discarded_section.
9728         * resolve.cc (Symbol::override_base_with_special): Don't test
9729         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
9730         * target-reloc.h (relocate_section): Do special handling for
9731         symbols defined in discarded sections for global symbols as well
9732         as local symbols.
9733
9734 2010-01-08  Ian Lance Taylor  <iant@google.com>
9735
9736         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
9737         the SHT_SYMTAB case.
9738
9739 2010-01-08  Ian Lance Taylor  <iant@google.com>
9740
9741         * object.cc (Sized_relobj::do_layout): Don't get confused if
9742         layout_eh_frame returns NULL.
9743
9744 2010-01-08  Ian Lance Taylor  <iant@google.com>
9745
9746         PR 11084
9747         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
9748         dynamic symbol table, use the normal symbol table.
9749         (Sized_dynobj::do_read_symbols): Remove assertion about type of
9750         symbol table.
9751
9752 2010-01-08  Ian Lance Taylor  <iant@google.com>
9753
9754         PR 11072
9755         * layout.cc (Layout::include_section): Remove .gnu_debuglink
9756         sections.
9757
9758 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
9759
9760         * version.cc (print_version): Change to "Copyright 2010".
9761
9762 2010-01-08  Ian Lance Taylor  <iant@google.com>
9763
9764         PR 10287
9765         PR 11063
9766         * i386.cc (class Target_i386): Change return type of plt_section
9767         to be non-const.
9768         (class Output_data_plt_i386): Add tls_desc_rel_ field.
9769         (Output_data_plt_i386::Output_data_plt_i386): Initialize
9770         tls_desc_rel_ field.
9771         (Output_data_plt_i386::rel_tls_desc): New function.
9772         (Target_i386::rel_tls_desc_section): New function.
9773         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
9774         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
9775         R_386_TLS_DESC reloc in rel_tls_desc_section.
9776         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
9777         Define struct Tlsdesc_info.
9778         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
9779         (Target_x86_64::do_reloc_symbol_index): New function.
9780         (Target_x86_64::add_tlsdesc_info): New function.
9781         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
9782         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
9783         tlsdesc_rel_ field.
9784         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
9785         all callers.
9786         (Output_data_plt_x86_64::rela_tlsdesc): New function.
9787         (Target_x86_64::rela_tlsdesc_section): New function.
9788         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
9789         handling.
9790         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
9791         (Target_x86_64::do_reloc_addend): New function.
9792         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
9793         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
9794         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
9795         (Output_reloc::type): New function.
9796         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
9797         (Output_reloc::is_target_specific): New function.
9798         (Output_reloc::target_arg): New function.
9799         (class Output_reloc) [SHT_RELA]: Add four new constructors for
9800         absolute relocs and target specific relocs.
9801         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
9802         add_target_specific.
9803         (class Output_data_reloc) [SHT_RELA]: Likewise.
9804         * output.cc (Output_reloc::Output_reloc): Add four new versions
9805         for absolute relocs and target specific relocs.
9806         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
9807         (Output_reloc::get_symbol_index): Likewise.
9808         (Output_reloc::local_section_offset): Check that local_sym_index_
9809         is not TARGET_CODE or 0.
9810         (Output_reloc::symbol_value): Likewise.
9811         (Output_reloc::write) [SHT_RELA]: Call target for target specific
9812         reloc.
9813         * target.h (class Target): Add reloc_symbol_index and reloc_addend
9814         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
9815         functions.
9816         * layout.cc (add_target_dynamic_tags): Use output section for
9817         DT_PLTRELSZ and DT_JMPREL.
9818
9819 2010-01-07  Ian Lance Taylor  <iant@google.com>
9820
9821         PR 11061
9822         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
9823         function.
9824         (class Output_data_reloc_generic): Define.
9825         (class Output_data_reloc_base): Change base class to
9826         Output_data_reloc_generic.  Change add() method to call
9827         bump_relative_reloc_count for a relative reloc.  Remove
9828         sort_relocs_ field.
9829         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
9830         to sort_relocs().
9831         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
9832         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
9833         appropriate.
9834         * layout.h (class Layout): Update declaration.
9835
9836 2010-01-07  Ian Lance Taylor  <iant@google.com>
9837
9838         * output.h (class Output_data): Add const version of
9839         output_section and do_output_section.
9840         (class Output_section_data): Add const version of
9841         do_output_section.
9842         (class Output_section): Likewise.
9843         * layout.cc (Layout::add_target_dynamic_tags): New function.
9844         * layout.h (class Layout): Update declarations.
9845         * arm.cc (Target_arm::do_finalize_sections): Use
9846         add_target_dynamic_tags.
9847         * i386.cc (Target_i386::do_finalize_sections): Likewise.
9848         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
9849         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
9850         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
9851
9852 2010-01-07  Ian Lance Taylor  <iant@google.com>
9853
9854         PR 11042
9855         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
9856         object as needed.
9857
9858 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
9859             Ian Lance Taylor  <iant@google.com>
9860
9861         PR 11019
9862         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
9863         Xindex::read_symtab_xindex.
9864
9865 2010-01-07  Doug Kwan  <dougkwan@google.com>
9866
9867         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
9868         (Insn_template::thumb16_bcond_insn): New method declaration.
9869         (Insn_template): Fix spelling.
9870         (Stub::thumb16_special): New method declaration.
9871         (Stub::do_write): Define virtual method which was previously pure
9872         virtual.
9873         (Stub::do_thumb16_special): New method declaration.
9874         (Stub::do_fixed_endian_write): New template member.
9875         (Reloc_stub::do_write): Remove.
9876         (Reloc_stub::do_fixed_endian_write): Remove.
9877         (Cortex_a8_stub): New class definition.
9878         (Stub_factory::make_cortex_a8_stub): New method definition.
9879         (Stub_factory::Stub_factory): Add missing static storage class
9880         qualifier for elf32_arm_stub_a8_veneer_blx.
9881
9882 2010-01-07  Ian Lance Taylor  <iant@google.com>
9883
9884         PR 10980
9885         * options.h (class General_options): Add --warn-unresolved-symbols
9886         and --error-unresolved-symbols.
9887         * errors.cc (Errors::undefined_symbol): Implement
9888         --warn-unresolved-symbols.
9889
9890         * options.h (class General_options): Add -z text and -z textoff.
9891         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
9892
9893 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
9894
9895         * gc.h (Garbage_collection::Cident_section_map): New typedef.
9896         (Garbage_collection::cident_sections): New function.
9897         (Garbage_collection::add_cident_section): New function.
9898         (Garbage_collection::cident_sections_): New member.
9899         (gc_process_relocs): Add references to sections whose names are C
9900         identifiers.
9901         * gold.h (cident_section_start_prefix): New constant.
9902         (cident_section_stop_prefix): New constant.
9903         (is_cident): New function.
9904         * layout.cc (Layout::define_section_symbols): Replace string constants
9905         with the newly defined constants.
9906         * object.cc (Sized_relobj::do_layout): Track sections whose names are
9907         C identifiers.
9908         * testsuite/Makefile.am: Add gc_orphan_section_test.
9909         * testsuite/Makefile.in: Regenerate.
9910         * testsuite/gc_orphan_section_test.cc: New file.
9911         * testsuite/gc_orphan_section_test.sh: New file.
9912
9913 2010-01-06  Ian Lance Taylor  <iant@google.com>
9914
9915         PR 10980
9916         * options.h (class General_options): Add --warn-shared-textrel.
9917         * layout.cc (Layout::finish_dynamic_section): Implement
9918         --warn-shared-textrel.
9919
9920         PR 10980
9921         * options.h (class General_options): Add --warn-multiple-gp.
9922
9923 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9924
9925         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
9926         $(THREADSLIB) and $(LIBDL).
9927         * Makefile.in: Rebuild.
9928
9929 2010-01-06  Ian Lance Taylor  <iant@google.com>
9930
9931         PR 10980
9932         * options.cc (General_options::parse_section_start): New function.
9933         (General_options::section_start): New function.
9934         (General_options::General_options): Initialize all members.
9935         * options.h: Include <map>
9936         (class General_options): Add --section-start.  Add section_starts_
9937         member.
9938         * layout.cc (Layout::attach_allocated_section_to_segment): If
9939         --section-start was used, set the address of the segment.  Remove
9940         local sort_sections.
9941         (Layout::relaxation_loop_body): If the address of the load segment
9942         has been set by --section-start, don't use it.
9943         * output.h (Output_segment::update_flags_for_output_section): New
9944         function.
9945         * output.cc (Output_segment::add_output_section): Call
9946         update_flags_for_output_section.
9947
9948 2010-01-05  Ian Lance Taylor  <iant@google.com>
9949
9950         PR 10980
9951         * options.h (class General_options): Add --undefined-version.
9952         * script.cc (struct Version_expression): Add was_matched_by_symbol
9953         field.
9954         (Version_script_info::matched_symbol): New function.
9955         (Version_script_info::get_symbol_version_helper): Call
9956         matched_symbol.
9957         (Version_script_info::check_unmatched_names): New function.
9958         * script.h (class Version_script_info): Update declarations.
9959         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
9960
9961         * options.h (class General_options): Use DEFINE_bool_alias for
9962         allow_multiple_definition.
9963         * resolve.cc (Symbol_table::should_override): Don't test
9964         allow_multiple_definition.
9965
9966         PR 10980
9967         * options.h (class General_options): Add --cref.
9968         * main.cc (main): Print cref table if --cref.  Don't close mapfile
9969         until after printing cref table.
9970         * cref.cc: Include "symtab.h".
9971         (class Cref_inputs): Define Cref_table_compare and Cref_table.
9972         (Cref_table_compare::operator()): New function.
9973         (Cref_inputs::gather_cref): New function.
9974         (filecol): New static const.
9975         (Cref_inputs::print_cref): New function.
9976         (Cref::print_cref): New function.
9977         * cref.h: Include <cstdio>.
9978         (class Cref): Update declarations.
9979         * mapfile.h (Mapfile::file): New function.
9980         * object.h (class Object): Define Symbols.  Declare virtual
9981         do_get_global_symbols.
9982         (Object::get_global_symbols): New function.
9983         * object.cc (Input_objects::add_object): Pass object to cref_ if
9984         --cref.
9985         (Input_objects::archive_start): Likewise.
9986         (Input_objects::archive_stop): Likewise.
9987         (Input_objects::print_cref): New function.
9988         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
9989         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
9990         --cref.
9991         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
9992         function.
9993         * plugin.h (class Sized_pluginobj): Update declarations.
9994
9995 2010-01-05  Ian Lance Taylor  <iant@google.com>
9996
9997         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
9998         to is_default_version.  Rename insdef to insdefault.
9999         (Symbol_table::add_from_relobj): Rename def to is_default_version
10000         and local to is_forced_local.
10001         (Symbol_table::add_from_pluginobj): Likewise.
10002         (Symbol_table::add_from_dynobj): Likewise.
10003         (Symbol_table::define_special_symbol): Rename insdef to
10004         insdefault.
10005
10006 2010-01-04  Ian Lance Taylor  <iant@google.com>
10007
10008         PR 10980
10009         * options.h (class General_options): Add
10010         --allow-multiple-definition and -z muldefs.
10011         * resolve.cc (Symbol_table::should_override): Don't warn about a
10012         multiple symbol definition if --allow-multiple-definition or -z
10013         muldefs.
10014
10015         PR 10980
10016         * options.h (class General_options): Add --add-needed and
10017         --copy-dt-needed-entries.  Tweak --as-needed help entry.
10018         * object.cc (Input_objects::check_dynamic_dependencies): Give an
10019         error if --copy-dt-needed-entries aka --add-needed is used and
10020         would cause a change in behaviour.
10021
10022         PR 10980
10023         * options.h (class General_options): Add -G as a short version of
10024         --shared.  Add no-op options -assert, -g, and -i.
10025
10026 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
10027
10028         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
10029         check for .text or .gnu.linkonce.t sections.
10030         * icf.cc (Icf::find_identical_sections): Ditto.
10031         Change the detection for mangled function name within the section
10032         name.
10033         * icf.h (is_section_foldable_candidate): New function.
10034
10035 2009-12-30  Ian Lance Taylor  <iant@google.com>
10036
10037         PR 10980
10038         * options.h (class General_options): Permit two dashes with
10039         --retain-symbols-file.
10040
10041 2009-12-30  Ian Lance Taylor  <iant@google.com>
10042
10043         PR 10979
10044         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
10045         don't put the file header and segment headers in the text
10046         segment.
10047
10048         PR 10979
10049         * common.cc (Sort_commons::operator()): Stabilize sort when both
10050         entries are NULL.
10051         (Symbol_table::do_allocate_commons_list): When allocating common
10052         symbols, skip a symbol which is no longer common.
10053         * symtab.h (Symbol::is_common): Test whether the symbol comes from
10054         an object before checking its type.
10055         * testsuite/common_test_2.c: New file.
10056         * testsuite/common_test_3.c: New file.
10057         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
10058         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
10059         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
10060         (common_test_2_pic.o, common_test_2.so): New targets.
10061         (common_test_3_pic.o, common_test_3.so): New targets.
10062         * testsuite/Makefile.in: Rebuild.
10063
10064         PR 10979
10065         * script.cc (read_input_script): If we see a new SECTIONS clause,
10066         and we have added an input section, give an error.
10067         * layout.h (class Layout): Add have_added_input_section function.
10068         Add have_added_input_section_ field.
10069         * layout.cc (Layout::Layout): Initialize
10070         have_added_input_section_.
10071         (Layout::layout): Set have_added_input_section_.
10072         (Layout::layout_eh_frame): Likewise.
10073
10074 2009-12-30  Ian Lance Taylor  <iant@google.com>
10075
10076         PR 10931
10077         * options.h (class General_options): Add --sort-common option.
10078         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
10079         * common.cc (Sort_common): Add sort_order parameter to
10080         constructor.  Add sort_order_ field.
10081         (Sort_commons::operator): Check sort_order_.
10082         (Symbol_table::allocate_commons): Determine the sort order.
10083         (Symbol_table::do_allocate_commons): Add sort_order parameter.
10084         Change all callers.
10085         (Symbol_table::do_allocate_commons_list): Likewise.
10086
10087 2009-12-30  Ian Lance Taylor  <iant@google.com>
10088
10089         PR 10916
10090         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
10091         symbols from this object, don't change the visibility of an
10092         undefined symbol.
10093         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
10094
10095 2009-12-30  Ian Lance Taylor  <iant@google.com>
10096
10097         PR 10861
10098         * script.h (class Version_script_info): Define Language enum.
10099         Update declarations.  Define Glob, Exact, and Lookup types.  Add
10100         new fields globals_, locals_, and is_finalized_.
10101         * script.cc: Various formatting fixes.
10102         (class Parser_closure): Change language_stack_ from a vector of
10103         std::string to one of Version_script_info::Language.  Adjust all
10104         uses accordingly.
10105         (class Lazy_demangler): Remove.
10106         (struct Version_expression): Change language from std::string to
10107         Version_script_info::Language.
10108         (Version_script_info::Version_script_info): New function.
10109         (Version_script_info::~Version_script_info): Don't call clear.
10110         (Version_script_info::finalize): New function.
10111         (Version_script_info::build_lookup_tables): New function.
10112         (Version_script_info::build_expression_list_lookup): New
10113         function.
10114         (Version_script_info::get_symbol_version_helper): Rewrite to use
10115         lookup tables.
10116         (Version_script_info::print_expression_list): Adjust to use
10117         Version_script_info::Language.
10118         (script_push_lex_into_version_mode): Check that the version script
10119         has not been finalized.
10120         (version_script_push_lang): Change language string to
10121         Version_script_info::Language.
10122         * options.cc (Command_line::version_script): New function.
10123         * options.h (class General_options): Add finalize_dynamic_list
10124         function.  Change version_script from declaration to definition.
10125         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
10126         * testsuite/version_script.map: Remove duplicate def of foo.
10127         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
10128         version_script.map.
10129         * testsuite/Makefile.in: Rebuild.
10130
10131 2009-12-30  Ian Lance Taylor  <iant@google.com>
10132
10133         PR 10843
10134         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
10135         if the input symbol index is 0, make the output symbol index 0.
10136
10137 2009-12-30  Ian Lance Taylor  <iant@google.com>
10138
10139         PR 10670
10140         * options.h (class General_options): Add -x/--discard-all.
10141         * object.cc (Sized_relobj::do_count_local_symbols): Handle
10142         --discard-all.  If the local symbol needs a dynamic entry, check
10143         that before handling --discard-locals.
10144
10145 2009-12-30  Ian Lance Taylor  <iant@google.com>
10146
10147         PR 10450
10148         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
10149         flags to PF_R.
10150         (Output_segment::add_output_section): Don't change the flags if
10151         the type is PT_TLS.
10152
10153         PR 10450
10154         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
10155         GNU hash table if they need a dynamic value.  Otherwise, don't add
10156         them if they are defined in a dynamic object or are forced local.
10157
10158 2009-12-29  Ian Lance Taylor  <iant@google.com>
10159
10160         PR 10450
10161         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
10162         .gnu.hash table for a 32-bit target.
10163
10164         PR 10450
10165         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
10166         regular and a dynamic object only needs a dynamic symbol table
10167         entry if it is externally visible.
10168
10169         PR 10450
10170         * i386.cc (class Target_i386): Initialize global_offset_table_ in
10171         constructor.  Add global_offset_table_ field.
10172         (Target_i386::got_section): Set global_offset_table_.
10173         (Target_i386::do_finalize_sections): Set global_offset_table_
10174         size.
10175         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
10176         in constructor.  Add global_offset_table_ field.
10177         (Target_x86_64::got_section): Set global_offset_table_.
10178         (Target_x86_64::do_finalize_sections): Set global_offset_table_
10179         size.
10180
10181         * layout.cc (Layout::Layout): Initialize increase_relro_.
10182         (Layout::get_output_section): Add is_relro, is_last_relro, and
10183         is_first_non_relro parameters.  Change all callers.
10184         (Layout::choose_output_section): Likewise.
10185         (Layout::add_output_section_data): Likewise.
10186         (Layout::make_output_section): Likewise.
10187         (Layout::set_segment_offsets): Clear increase_relro when using a
10188         linker script.
10189         * layout.h (class Layout): Add increase_relro method.  Add
10190         increase_relro_ field.  Update declarations.
10191         * output.cc (Output_section::Output_section): Initialize
10192         is_last_relro_ and is_first_non_relro_.
10193         (Output_segment::add_output_section): Group relro sections is
10194         do_sort is true.  Handle is_last_relro and is_first_non_relro.
10195         (Output_segment::maximum_alignment): Remove relro handling.
10196         (Output_segment::set_section_addresses): Add increase_relro
10197         parameter.  Change all callers.  Add initial alignment to align
10198         relro sections on separate page.  Remove old relro handling.
10199         (Output_segment::set_section_list_addresses): Remove in_relro
10200         parameter.  Change all callers.
10201         (Output_segment::set_offset): Add increase parameter.  Change all
10202         callers.  Remove old relro handling.
10203         * output.h (class Output_section): Add new methods: is_last_relro,
10204         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
10205         Add is_last_relro_ and is_first_non_relro_ fields.
10206         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
10207         Create separate .got.plt section.  Call increase_relro.
10208         * x86_64.cc (Target_x86_64::got_section): Likewise.
10209         * testsuite/relro_script_test.t: Add .got.plt.
10210
10211         PR 10450
10212         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
10213         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
10214         (Layout::finalize): Call set_dynamic_symbol_size.
10215         (Layout::set_dynamic_symbol_size): New function.
10216         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
10217         set_dynamic_symbol_size.
10218
10219         PR 10450
10220         * output.h (class Output_section): Add is_entsize_zero_ field.
10221         * output.cc (Output_section::Output_section): Initialize
10222         is_entsize_zero_.
10223         (Output_section::set_entsize): If two different entsizes are
10224         requested, force it to zero.
10225         (Output_section::add_input_section): Set flags for .debug_str
10226         before updating section flags.  Set entsize.
10227         (Output_section::update_flags_for_input_section): Set SHF_MERGE
10228         and SHF_STRING if all input sections have those flags.
10229
10230 2009-12-29   Rafael Espindola  <espindola@google.com>
10231
10232         * main.cc (main): Fix the sys time reporting.
10233         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
10234         reporting.
10235
10236 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
10237
10238         * options.cc (General_options::parse_version): Allow -v to exit
10239         without an error if there is nothing to link.
10240
10241 2009-12-29  Ian Lance Taylor  <iant@google.com>
10242
10243         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
10244         using a version of gcc before 4.1.
10245         * configure: Rebuild.
10246
10247 2009-12-28  Chris Demetriou  <cgd@google.com>
10248
10249         * attributes.cc (Output_attributes_section_data::do_write): Use
10250         std::vector::front rather than std::vector::data.
10251
10252 2009-12-28  Ian Lance Taylor  <iant@google.com>
10253
10254         * symtab.h (class Symbol_table): Add enum Defined.
10255         * resolve.cc (Symbol_table::should_override): Add defined
10256         parameter.  Change all callers.  Test whether object is NULL
10257         before calling a method on it.
10258         (Symbol_table::report_resolve_problem): Add defined parameter.
10259         Change all callers.
10260         (Symbol_table::should_override_with_special): Likewise.
10261         * symtab.cc (Symbol_table::define_in_output_data): Add defined
10262         parameter.  Change all callers.
10263         (Symbol_table::do_define_in_output_data): Likewise.
10264         (Symbol_table::define_in_output_segment): Likewise.
10265         (Symbol_table::do_define_in_output_segment): Likewise.
10266         (Symbol_table::define_as_constant): Likewise.
10267         (Symbol_table::do_define_as_constant): Likewise.
10268         * script.h (class Symbol_assignment): Add is_defsym parameter to
10269         constructor; change all callers.
10270         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
10271         parameter.  Change all callers.  Add is_defsym_ field.
10272         (class Parser_closure): Add parsing_defsym parameter to
10273         constructor; change all callers.  Add parsing_defsym accessor
10274         function.  Add parsing_defsym_ field.
10275
10276 2009-12-28  Ian Lance Taylor  <iant@google.com>
10277
10278         * gold.cc (queue_middle_tasks): Fix formatting.
10279         * object.cc (Relobj::is_section_name_included): Likewise.
10280
10281 2009-12-23  Ian Lance Taylor  <iant@google.com>
10282
10283         * i386.cc (Target_i386::do_calls_non_split): Recognize
10284         -fsplit-stack prologue for a function with a static chain.
10285         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
10286         -fsplit-stack prologue when using %r11.
10287
10288 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
10289
10290         * options.cc (General_options::parse_version): Make -v continue and do
10291         the link like GNU ld does.
10292
10293 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
10294
10295         * Makefile.am (CCFILES): Add timer.cc.
10296         (HFILES): Add timer.h.
10297         * configure.ac: Check for sysconf and times.
10298         * main.cc: include timer.h.
10299         (main): Use Timer instead of get_run_time.
10300         * timer.cc: New.
10301         * timer.h: New.
10302         * workqueue.cc: include timer.h.
10303         (Workqueue::find_and_run_task):
10304         Report user, sys and wall time.
10305         * Makefile.in: Regenerate.
10306         * config.in: Regenerate.
10307         * configure: Regenerate.
10308
10309 2009-12-16  Doug Kwan  <dougkwan@google.com>
10310
10311         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
10312         sections.
10313         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
10314         relaxed input sections.
10315         * output.cc (Output_section::find_relaxed_input_section): Change
10316         return type to Output_relaxed_input_section pointer.  Adjust code
10317         for new type of relaxed_input_section_map_.
10318         * output.h (Output_section::find_relaxed_input_section): Change
10319         return type to Output_relaxed_input_section pointer.
10320         (Output_section::Output_relaxed_input_section_by_input_section_map):
10321         New type.
10322         (Output_section::relaxed_input_section_map_): Change type to
10323         Output_section::Output_relaxed_input_section_by_input_section_map.
10324         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
10325         input section.
10326
10327 2009-12-15  Ian Lance Taylor  <iant@google.com>
10328
10329         * layout.cc (Layout::create_shstrtab): Only write out after input
10330         sections if we are compressing debug sections.
10331
10332 2009-12-15  Ian Lance Taylor  <iant@google.com>
10333
10334         * archive.cc (Archive::add_symbols): Only look up a symbol without
10335         a version if there is, in fact, a version.
10336
10337 2009-12-14  Ian Lance Taylor  <iant@google.com>
10338
10339         Revert -Wshadow changes, all changes from:
10340         2009-12-11  Doug Kwan  <dougkwan@google.com>
10341         2009-12-11  Nick Clifton  <nickc@redhat.com>
10342         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
10343
10344 2009-12-11  Doug Kwan  <dougkwan@google.com>
10345
10346         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
10347         due to -Wshadow.
10348         * attributes.cc (Object_attribute::size): Ditto.
10349         (Attributes_section_data::size): Ditto.
10350         (Attributes_section_data::Attributes_section_data): Ditto.
10351         (Output_attributes_section_data::do_write): Ditto.
10352         * attributes.h (Object_attribute::set_type): Ditto.
10353         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
10354
10355 2009-12-11  Nick Clifton  <nickc@redhat.com>
10356
10357         * archive.cc: Fix shadowed variable warnings.
10358         * arm.cc: Likewise.
10359         * compressed_output.cc: Likewise.
10360         * compressed_output.h: Likewise.
10361         * configure: Likewise.
10362         * dwarf_reader.cc: Likewise.
10363         * dynobj.cc: Likewise.
10364         * dynobj.h: Likewise.
10365         * ehframe.cc: Likewise.
10366         * ehframe.h: Likewise.
10367         * errors.cc: Likewise.
10368         * expression.cc: Likewise.
10369         * fileread.cc: Likewise.
10370         * fileread.h: Likewise.
10371         * freebsd.h: Likewise.
10372         * i386.cc: Likewise.
10373         * icf.cc: Likewise.
10374         * incremental.h: Likewise.
10375         * layout.cc: Likewise.
10376         * layout.h: Likewise.
10377         * mapfile.cc: Likewise.
10378         * merge.cc: Likewise.
10379         * merge.h: Likewise.
10380         * object.cc: Likewise.
10381         * object.h: Likewise.
10382         * options.h: Likewise.
10383         * output.cc: Likewise.
10384         * output.h: Likewise.
10385         * parameters.cc: Likewise.
10386         * plugin.cc: Likewise.
10387         * powerpc.cc: Likewise.
10388         * reduced_debug_output.cc: Likewise.
10389         * reduced_debug_output.h: Likewise.
10390         * reloc.cc: Likewise.
10391         * reloc.h: Likewise.
10392         * resolve.cc: Likewise.
10393         * script-sections.cc: Likewise.
10394         * script.cc: Likewise.
10395         * script.h: Likewise.
10396         * sparc.cc: Likewise.
10397         * symtab.cc: Likewise.
10398         * symtab.h: Likewise.
10399         * target-select.cc: Likewise.
10400         * target-select.h: Likewise.
10401         * token.h: Likewise.
10402         * workqueue.cc: Likewise.
10403         * workqueue.h: Likewise.
10404         * x86_64.cc: Likewise.
10405
10406 2009-12-10  Doug Kwan  <dougkwan@google.com>
10407
10408         * arm.cc (attributes.h): New include.
10409         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
10410         (Arm_relobj::~Arm_relobj): Delete object pointed by
10411         attributes_section_data_.
10412         (Arm_relobj::attributes_section_data): New method definition.
10413         (Arm_relobj::attributes_section_data_): New data member declaration.
10414         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
10415         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
10416         attributes_section_data_.
10417         (Arm_dynobj::attributes_section_data): New method definition.
10418         (Arm_dynobj::attributes_section_data_): New data member declaration.
10419         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
10420         initialization value of may_use_blx_ to false.
10421         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
10422         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
10423         object attributes to compute results instead of hard-coding.
10424         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
10425         Target_arm::get_secondary_compatible_arch,
10426         Target_arm::set_secondary_compatible_arch
10427         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
10428         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
10429         New method declarations.
10430         (Target_arm::get_aeabi_object_attribute): New method definition.
10431         (Target_arm::attributes_section_data_): New data member declaration.
10432         (read_arm_attributes_section): New template definition.
10433         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
10434         (Arm_dynobj::do_read_symbols): Ditto.
10435         (Target_arm::do_finalize_sections): Merge attributes sections from
10436         input.  Check for BLX use after attributes section merging.
10437         Fix __exidx_start and __exidx_end visibility.  Create an
10438         .ARM.attributes section if necessary.
10439         (Target_arm::get_secondary_compatible_arch,
10440         Target_arm::set_secondary_compatible_arch,
10441         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
10442         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
10443         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
10444         New method definitions.
10445
10446 2009-12-09  Ian Lance Taylor  <iant@google.com>
10447
10448         * plugin.cc (Plugin::load): Don't cast from void* to a function
10449         pointer.
10450
10451 2009-12-09  Ian Lance Taylor  <iant@google.com>
10452
10453         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
10454         information fields.
10455
10456 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
10457
10458         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
10459         Replace two_file_shared_1.so with two_file_shared_2.so.
10460         * testsuite/Makefile.in: Regenerated.
10461
10462 2009-12-08  Doug Kwan  <dougkwan@google.com>
10463
10464         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
10465         (HFILES): Add attributes.h and int_encoding.h.
10466         * Makefile.in: Regenerate.
10467         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
10468         function definitions to int_encoding.cc
10469         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
10470         prototypes to int_encoding.h
10471         * reduced_debug_output.cc (int_encoding.h): New include.
10472         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
10473         function definitions to int_encoding.cc
10474         (insert_into_vector, read_from_pointer): Move template definitions to
10475         int_encoding.h
10476         * attributes.cc: New file.
10477         * attributes.h: New file.
10478         * int_encoding.cc: New file.
10479         * int_encoding.h: New file.
10480
10481 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
10482
10483         PR gold/11055
10484         * incremental-dump.cc (dump_incremental_inputs): New.
10485         (main): Use dump_incremental_inputs.
10486
10487 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
10488
10489         PR gold/10893
10490         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
10491         checking elfcpp::STT_FUNC.
10492         (Target_i386::Relocate::relocate): Likewise.
10493         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
10494
10495         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
10496         symbols from shared libraries into normal FUNC symbols.
10497
10498         * symtab.h (Symbol): Add is_func and use it.
10499
10500 2009-12-05  Doug Kwan  <dougkwan@google.com>
10501
10502         * arm.cc (Target_arm::arm_info): Initialize new fields
10503         attributes_section and attributes_vendor.
10504         * i386.cc (Target_i386::i386_info): Same.
10505         * object.cc (Sized_relobj::do_layout): Skip attribute section.
10506         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
10507         fields attributes_section and attributes_vendor.
10508         * sparc.cc (Target_sparc::sparc_info): Same.
10509         * target.h (Target::attributes_section, Target::attributes_vendor,
10510         Target::is_attributes_section, Target::attribute_arg_type,
10511         Target::attributes_order): New method definitions.
10512         (Target::Target_info::attributes_section,
10513         Target::Target_info::attributes_vendor): New fields.
10514         (Target::do_attribute_arg_type, Target::do_attributes_order): New
10515         virtual method definitions.
10516         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
10517         attributes_section and attributes_vendor.
10518         * testsuite/testfile.cc (Target_test::test_target_info): Same.
10519
10520 2009-12-05  Doug Kwan  <dougkwan@google.com>
10521
10522         * arm.cc: Update comments about interworking and stub generation.
10523         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
10524         considered as non-PIC.
10525         (Arm_relocate_functions::base_abs): Fix formatting.
10526         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
10527         of function to use GOT entry address instead of offset.
10528         (Target_arm::Scan::global): Issue an error if a symbol would need a
10529         PLT does not get one because it is untyped.  Remove code to create
10530         dynamic symbols for relative branches.
10531         (Target_arm::Relocate::relocate: Use 0 instead of false since function
10532         takes unsigned integer instead of boolean.
10533
10534 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
10535
10536         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
10537         (two_file_test_LDADD): Likewise.
10538         (common_test_1_LDADD): Likewise.
10539         (exception_test_LDADD) Likewise.
10540         (weak_test_LDADD): Likewise.
10541         (many_sections_test_LDADD): Likewise.
10542         (initpri1_LDADD): Likewise.
10543         (script_test_1_LDADD): Likewise.
10544         (script_test_2_LDADD): Likewise.
10545         (justsyms_LDADD): Likewise.
10546         (binary_test_LDADD): Likewise.
10547         (large_LDADD): Likewise.
10548         * testsuite/Makefile.in: Regenerated.
10549
10550 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
10551
10552         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
10553         (Symbol_table::override_with_special): Likewise.
10554         (Symbol_table::add_from_object): Likewise.
10555
10556 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
10557
10558         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
10559         Don't set the data_offset twice.
10560
10561 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
10562
10563         * testsuite/Makefile.in: Regenerate.
10564
10565 2009-12-03  Doug Kwan  <dougkwan@google.com>
10566
10567         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
10568         (Target_arm::do_finalize_sections): Add parameter for symbol table
10569         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
10570         * i386.cc (Target_i386::do_finalize_sections): Add an additional
10571         parameter for symbol table pointer.
10572         * layout.cc (Layout::finalize): Call Target::finalize_sections with
10573         an additional parameter for a pointer to symbol table.
10574         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
10575         parameter for a symbol table pointer.
10576         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
10577         * target.h (Target::finalize_sections, Target::do_finalize_sections):
10578         Ditto.
10579         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
10580         parameter for a symbol table pointer.
10581
10582 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
10583
10584         * incremental.cc (Incremental_inputs_header)
10585         (Incremental_inputs_header_write, Incremental_inputs_entry)
10586         (Incremental_inputs_entry_write): Move ...
10587         * incremental.h (Incremental_inputs_header)
10588         (Incremental_inputs_header_write, Incremental_inputs_entry)
10589         (Incremental_inputs_entry_write): here.
10590
10591 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10592
10593         * incremental.cc (make_sized_incremental_binary): Set the target.
10594         Error if it is incompatible.
10595         * output.h (Output_file): Add filename method.
10596
10597 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10598
10599         * incremental.cc (Incremental_inputs_entry): Remove unused argument
10600         from the get_* methods.
10601
10602 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10603
10604         * incremental-dump.cc (main): Check that the offeset of a script is 0.
10605         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
10606         Write 0 for the data_offset of scripts.
10607
10608 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10609
10610         * testsuite/Makefile.am: Add the incremental_test.sh test.
10611         * testsuite/incremental_test.sh: New.
10612         * testsuite/incremental_test_1.c: New.
10613         * testsuite/incremental_test_2.c: New.
10614
10615 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
10616
10617         * incremental-dump.cc (main): Fix typos.
10618
10619 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
10620
10621         PR gold/11025
10622         * incremental-dump.cc (main): Use llu to print 64 bit values.
10623
10624 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
10625             H.J. Lu  <hongjiu.lu@intel.com>
10626
10627         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
10628         $(LIBDL).
10629         (incremental_dump_LDADD): Likewise.
10630         * Makefile.in: Regenerated.
10631
10632 2009-11-25  Doug Kwan  <dougkwan@google.com>
10633
10634         Revert:
10635
10636         2009-11-25  Doug Kwan  <dougkwan@google.com>
10637
10638                 * arm.cc (Target_arm::Target_arm): Move method definition
10639                 outside of class definition.  Add code to handle
10640                 --target1-rel, --target1-abs and --target2= options.
10641                 (Target_arm::get_reloc_reloc_type): Change method to be
10642                 non-static and const.
10643                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
10644                 New data member declaration.
10645                 (Target_arm::Scan::local, Target_arm::Scan::global,
10646                 Target_arm::Relocate::relocate,
10647                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10648                 Adjust call to Target_arm::get_real_reloc_type.
10649                 (Target_arm::get_real_reloc_type): Use command line options
10650                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
10651                 * options.h (--target1-rel, --target1-abs, --target2): New
10652                 ARM-only options.
10653
10654 2009-11-25  Doug Kwan  <dougkwan@google.com>
10655
10656         * arm.cc (Target_arm::Target_arm): Move method definition outside of
10657         class definition.  Add code to handle --target1-rel, --target1-abs
10658         and --target2= options.
10659         (Target_arm::get_reloc_reloc_type): Change method to be non-static
10660         and const.
10661         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
10662         member declaration.
10663         (Target_arm::Scan::local, Target_arm::Scan::global,
10664         Target_arm::Relocate::relocate,
10665         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
10666         call to Target_arm::get_real_reloc_type.
10667         (Target_arm::get_real_reloc_type): Use command line options to
10668         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
10669         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
10670         options.
10671
10672 2009-11-25  Doug Kwan  <dougkwan@google.com>
10673
10674         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
10675         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
10676         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
10677         formatting.
10678         (Arm_relocate_functions::thm_call): Replace body with a call to
10679         Arm_relocate_functions::thumb_branch_common.
10680         (Arm_relocate_functions::thm_jump24,
10681         Arm_relocate_functions::thm_xpc22): New method definitions.
10682         (Arm_relocate_functions::thumb_branch_common): New method definition.
10683         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
10684         operator.
10685         (Target_arm::Relocate::relocate): Adjust call to thm_call.
10686         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
10687
10688 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
10689
10690         * Makefile.am: Build incremental-dump
10691         * Makefile.in: Regenerate.
10692         * incremental-dump.cc: New.
10693         * incremental.cc (Incremental_inputs_header_data,
10694         Incremental_inputs_entry_data): Move to incremental.h
10695         * incremental.h: (Incremental_inputs_header_data,
10696         Incremental_inputs_entry_data): Move from incremental.cc
10697
10698 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
10699
10700         * incremental.cc (Incremental_inputs_header,
10701         Incremental_inputs_header_write, Incremental_inputs_entry,
10702         Incremental_inputs_entry_write): Add a typedef with the data type.
10703
10704 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
10705
10706         * incremental.cc (Incremental_inputs_header,
10707         Incremental_inputs_header_write, Incremental_inputs_entry,
10708         Incremental_inputs_entry_write): Update comment about which
10709         type has the filed descriptions.
10710
10711 2009-11-15  Doug Kwan  <dougkwan@google.com>
10712
10713         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
10714         (Arm_relocate_functions::arm_branch_common): Change method defintion
10715         in class definition to a method declaration and update list of formal
10716         parameters.
10717         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
10718         Arm_relocation_functions::jump24): Adjust call to
10719         Arm_relocate_functions::arm_branch_common.  Update list of formal
10720         parameters.
10721         (Arm_relocate_functions::xpc25): New method definition.
10722         (Arm_relocate_functions::arm_branch_common): Move method defintion
10723         out from class definition.  Use stubs for mode-switching and extending
10724         branch ranges.
10725         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
10726         specially.  Change code to enable use of stubs in ARM branches.
10727
10728 2009-11-10  Doug Kwan  <dougkwan@google.com>
10729
10730         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
10731         in method declaration.
10732         (Target_arm::relocate_stub): New method declaration.
10733         (Target_arm::default_target): Change to return a pointer instead of
10734         a const reference.
10735         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
10736         Target_arm::default_target.
10737         (Arm_Relobj::do_relocate_sections): Remove options paramater in
10738         method definition.
10739         (Target_arm::relocate_section): Adjust view.
10740         (Target_arm::relocate_stub): New method definition.
10741
10742 2009-11-10  Doug Kwan  <dougkwan@google.com>
10743
10744         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
10745         a format warning.
10746         * incremental.cc (open_incremental_binary): Initialized local
10747         variables to avoid warnings.
10748         * object.cc (make_elf_object): Ditto.
10749         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
10750         a format warning.
10751
10752 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
10753
10754         PR gold/10930
10755         * testsuite/plugin_test.c: Include "config.h".
10756
10757 2009-11-09  Doug Kwan  <dougkwan@google.com>
10758
10759         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
10760         (arm_symbol_value): Remove.
10761         (Arm_relocate_functions::arm_branch_common,
10762         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
10763         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
10764         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
10765         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
10766         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
10767         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
10768         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
10769         Arm_relocate_functions::thm_mobw_abs_nc,
10770         Arm_relocate_functions::thm_mov_abs,
10771         Arm_relocate_functions::movw_prel_nc,
10772         Arm_relocate_functions::thm_movt_abs,
10773         Arm_relocate_functions::movt_prel,
10774         Arm_relocate_functions::thm_movw_prel_nc,
10775         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
10776         (Target_arm::Relocate::relocate): Only decompose address into two
10777         parts if relocation type uses the thumb-bit and pass the actual
10778         bit instead of a flag indicating that the thumb-bit is used.  Adjust
10779         calls to methods in Arm_relocate_functions for this change.
10780
10781 2009-11-08  Ian Lance Taylor  <iant@google.com>
10782
10783         PR 10925
10784         * reloc.cc: Instantiate
10785         Sized_relobj::initialize_input_to_output_maps and
10786         Sized_relobj:free_input_to_output_maps.
10787
10788 2009-11-06  Ian Lance Taylor  <iant@google.com>
10789
10790         PR 10876
10791         * defstd.cc (in_segment): Set only_if_ref true for "end".
10792
10793 2009-11-06  Doug Kwan  <dougkwan@google.com>
10794
10795         * arm.cc (class Reloc_stub): Correct a comment.
10796         (Target_arm::Target_arm): Initialize arm_input_section_map_.
10797         (Target_arm::scan_section_for_stubs): New method declaration.
10798         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
10799         Change methods from private to protected.
10800         (Target_arm::do_may_relax): New method definition.
10801         (Target_arm::do_relax, Target_arm::group_sections,
10802         Target_arm::scan_reloc_for_stub,
10803         Target_arm::scan_reloc_section_for_stubs): New method declarations.
10804         (Target_arm::arm_input_section_map_): New data member declaration.
10805         (Target_arm::scan_reloc_for_stub,
10806         Target_arm::scan_reloc_section_for_stubs,
10807         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
10808         Target_arm::do_relax): New method definitions.
10809
10810 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
10811
10812         * configure.ac: Check for (struct stat)::st_mtim
10813         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
10814         * config.in: Regenerate.
10815         * configure: Regenerate.
10816
10817 2009-11-05  Ian Lance Taylor  <iant@google.com>
10818
10819         PR 10910
10820         * output.cc (Output_segment::add_output_section): Add missing
10821         return statement.
10822
10823 2009-11-04  Ian Lance Taylor  <iant@google.com>
10824
10825         PR 10880
10826         * object.h (class Object): Add is_needed and set_is_needed
10827         methods.  Add is_needed_ field.  Make bool fields into bitfields.
10828         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
10829         defined in a dynamic object and referenced by a regular object,
10830         set is_needed for the dynamic object.
10831         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
10832         if the file is marked with as_needed and it is not needed.
10833
10834 2009-11-04  Ian Lance Taylor  <iant@google.com>
10835
10836         PR 10887
10837         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
10838         tags if data is discarded by linker script.
10839         * i386.cc (Target_i386::do_finalize_sections): Likewise.
10840         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
10841         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
10842         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
10843
10844 2009-11-04  Ian Lance Taylor  <iant@google.com>
10845
10846         * layout.cc (Layout::get_output_section): Add is_interp and
10847         is_dynamic_linker_section parameters.  Change all callers.
10848         (Layout::choose_output_section): Likewise.
10849         (Layout::make_output_section): Likewise.
10850         (Layout::add_output_section_data): Add is_dynamic_linker_section
10851         parameter.  Change all callers.
10852         * layout.h (class Layout): Update declarations.
10853         * output.h (class Output_section): Add is_interp, set_is_interp,
10854         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
10855         Add is_interp_, is_dynamic_linker_section_ fields.  Change
10856         generate_code_fills_at_write_ to a bitfield.
10857         * output.cc (Output_section::Output_sections): Initialize new
10858         fields.
10859         (Output_segment::add_output_section): Add do_sort parameter.
10860         Change all callers.
10861
10862 2009-11-03  Ian Lance Taylor  <iant@google.com>
10863
10864         PR 10860
10865         * options.h (class General_options): Add --warn-common.
10866         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
10867         merging two common symbols.
10868         (Symbol_table::should_override): Handle --warn-common when merging
10869         a common symbol with a defined symbol.  Use report_resolve_problem
10870         for multiple definitions.
10871         (Symbol_table::report_resolve_problem): New function.
10872         * symtab.h (class Symbol_table): Declare report_resolve_problem.
10873
10874 2009-11-03  Doug Kwan  <dougkwan@google.com>
10875
10876         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
10877         stub_factory_.
10878         (Target_arm::stub_factory): New method definition.
10879         (Target_arm::new_arm_input_section,
10880         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
10881         Target_arm::reloc_uses_thumb_bit): New method declarations.
10882         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
10883         New type definitions.
10884         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
10885         member declarations.
10886         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
10887         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
10888         New method definitions.
10889
10890 2009-11-03  Ian Lance Taylor  <iant@google.com>
10891
10892         * options.h (class General_options): Add --warn_constructors.
10893
10894 2009-11-03  Ian Lance Taylor  <iant@google.com>
10895
10896         PR 10893
10897         * defstd.cc (in_section): Add entries for __rel_iplt_start,
10898         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
10899
10900 2009-11-03  Ian Lance Taylor  <iant@google.com>
10901
10902         PR 10895
10903         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
10904         --msgid-bugs-address.
10905         (install-pdf): New target.
10906         (install-data_yes): Look up one directory to find mkinstalldirs.
10907
10908 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
10909
10910         * po/Make-in (.po.gmo): Don't generate .gmo files in source
10911         tree.
10912
10913 2009-10-30  Doug Kwan  <dougkwan@google.com>
10914
10915         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
10916
10917 2009-10-30  Doug Kwan  <dougkwan@google.com>
10918
10919         * arm.cc (Stub_addend_reader): New struct template definition
10920         and partial specializations.
10921         (Stub_addend_reader::operator()): New method definition for a
10922         partially specialized template.
10923
10924 2009-10-30  Doug Kwan  <dougkwan@google.com>
10925
10926         * arm.cc (Arm_relobj::processor_specific_flags): New method
10927         definition.
10928         (Arm_relobj::do_read_symbols): New method declaration.
10929         (Arm_relobj::processor_specific_flags_): New data member declaration.
10930         (Arm_dynobj): New class definition.
10931         (Target_arm::do_finalize_sections): Add input_objects parameter.
10932         (Target_arm::do_adjust_elf_header): New method declaration.
10933         (Target_arm::are_eabi_versions_compatible,
10934         (Target_arm::merge_processor_specific_flags): New method declaration.
10935         (Target_arm::do_make_elf_object): New overloaded method definitions
10936         and declaration.
10937         (Arm_relobj::do_read_symbols): New method definition.
10938         (Arm_dynobj::do_read_symbols): Ditto.
10939         (Target_arm::do_finalize_sections): Add input_objects parameters.
10940         Merge processor-specific flags from all input objects.
10941         (Target_arm::are_eabi_versions_compatible,
10942         Target_arm::merge_processor_specific_flags,
10943         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
10944         New method definitions.
10945         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
10946         Input_objects pointer type parameter.
10947         * layout.cc (Layout::finalize): Pass input objects to target's.
10948         finalize_sections function.
10949         * output.cc (Output_file_header::do_sized_write): Set ELF file
10950         header's processor-specific flags.
10951         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
10952         Input_objects pointer type parameter.
10953         * sparc.cc (Target_sparc::do_finalize_sections): Same.
10954         * target.h (Input_objects): New forward class declaration.
10955         (Target::processor_specific_flags,
10956         Target::are_processor_specific_flags_sect): New method definitions.
10957         (Target::finalize_sections): Add input_objects parameter.
10958         (Target::Target): Initialize processor_specific_flags_ and
10959         are_processor_specific_flags_set_.
10960         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
10961         parameter.
10962         (Target::set_processor_specific_flags): New method definition.
10963         (Target::processor_specific_flags_,
10964         Target::are_processor_specific_flags_set_): New data member
10965         declarations.
10966         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
10967         Input_objects pointer type parameter.
10968
10969 2009-10-30  Doug Kwan  <dougkwan@google.com>
10970
10971         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
10972
10973 2009-10-28  Ian Lance Taylor  <iant@google.com>
10974
10975         * object.h (class Relobj): Drop options parameter from
10976         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
10977         do_scan_relocs, do_relocate.  Change all callers.
10978         (class Sized_relobj): Drop options parameters from
10979         do_gc_process_relocs, do_scan_relocs, do_relocate,
10980         do_relocate_sections, relocate_sections, emit_relocs_scan,
10981         emit_relocs_scan_reltype.  Change all callers.
10982         (struct Relocate_info): Remove options field and all references to
10983         it.
10984         * reloc.h (class Read_relocs): Remove options constructor
10985         parameter and options_ field.  Change all callers.
10986         (class Gc_process_relocs, class Scan_relocs): Likewise.
10987         (class Relocate_task): Likewise.
10988         * target-reloc.h (scan_relocs): Remove options parameter.  Change
10989         all callers.
10990         (scan_relocatable_relocs): Likewise.
10991         * target.h (class Sized_target): Remove options parameter from
10992         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
10993         all callers.
10994         * gc.h (gc_process_relocs): Remove options parameter.  Change all
10995         callers.
10996         * arm.cc: Update functions to remove options parameters.
10997         * i386.cc: Likewise.
10998         * powerpc.cc: Likewise.
10999         * sparc.cc: Likewise.
11000         * x86_64.cc: Likewise.
11001         * testsuite/testfile.cc: Likewise.
11002
11003 2009-10-28  Doug Kwan  <dougkwan@google.com>
11004
11005         * arm.cc (Arm_relobj): New class definition.
11006         (Arm_relobj::scan_sections_for_stubs,
11007         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
11008         New method definitions.
11009
11010 2009-10-28  Cary Coutant  <ccoutant@google.com>
11011
11012         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
11013         (Plugin::cleanup_done_): New member.
11014         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
11015         (Plugin_manager::cleanup_done_): Remove.
11016         (Plugin_manager::add_input_file): Edit error message.
11017         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
11018         (Plugin_manager::cleanup): Remove use of cleanup_done_.
11019
11020 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
11021
11022         * fileread.cc: (File_read::View::~View): Use the new
11023         data_ownership_ filed.
11024         (File_read::~File_read): Dispose the new whole_file_view_.
11025         (File_read::open): Mmap the whole file if needed.
11026         (File_read::open): Use whole_file_view_ instead of contents_.
11027         (File_read::find_view): Use whole_file_view_ if applicable.
11028         (File_read::do_read): Use whole_file_view_ instead of contents_.
11029         (File_read::make_view): Use whole_file_view_ instead of contents_,
11030         update File_read::View::View call.
11031         (File_read::find_or_make_view): Update File_read::View::View
11032         call.
11033         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
11034         remove contents_
11035         (File_read::View::Data_ownership): New enum.
11036         (File_read::View::View): Replace bool mapped_ with Data_ownership
11037         argument.
11038         (File_read::View::mapped_): Remove (replaced by data_ownership_).
11039         (File_read::View::data_ownership_): New field.
11040         (File_read::contents_): Remove (replaced by whole_file_view_).
11041         (File_read::whole_file_view_): New field.
11042         * options.h (class General_options): Add --keep-files-mapped.
11043
11044 2009-10-27  Cary Coutant  <ccoutant@google.com>
11045
11046         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
11047         * testsuite/Makefile.am (plugin_test_5): New test case.
11048         * testsuite/Makefile.in: Regenerate.
11049
11050 2009-10-25  Doug Kwan  <dougkwan@google.com>
11051
11052         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
11053         from private to protected to allow access by child class.
11054         (Sized_relobj::do_relocate_sections): New method declaration.
11055         (Sized_relobj::relocate_sections): Virtualize.
11056         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
11057         Sized_relobj::relocate_sections.  Instantiate template explicitly
11058         for different target sizes and endianity.
11059
11060 2009-10-24  Doug Kwan  <dougkwan@google.com>
11061
11062         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
11063         (Arm_input_section::as_arm_input_section): New method.
11064         (Arm_output_section): New class definition.
11065         (Arm_output_section::create_stub_group,
11066         Arm_output_section::group_sections): New method definitions.
11067
11068 2009-10-22  Doug Kwan  <dougkwan@google.com>
11069
11070         * arm.cc (Arm_input_section): New class definition.
11071         (Arm_input_section::init, Arm_input_section:do_write,
11072         Arm_input_section::set_final_data_size,
11073         Arm_input_section::do_reset_address_and_file_offset): New method
11074         definitions.
11075
11076 2009-10-21  Doug Kwan  <dougkwan@google.com>
11077
11078         * arm.cc (Stub_table, Arm_input_section): New forward class
11079         declarations.
11080         (Stub_table): New class defintion.
11081         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
11082         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
11083         New method definition.
11084
11085 2009-10-21  Doug Kwan  <dougkwan@google.com>
11086
11087         * arm.cc: Update copyright comments.
11088         (Target_arm): New forward class template declaration.
11089         (Arm_address): New type.
11090         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
11091         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
11092         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
11093         constants.
11094         (Insn_template): Same.
11095         (DEF_STUBS): New macro.
11096         (Stub_type): New enum type.
11097         (Stub_template): New class definition.
11098         (Stub): Same.
11099         (Reloc_stub): Same.
11100         (Stub_factory): Same.
11101         (Target_arm::Target_arm): Initialize may_use_blx_ and
11102         should_force_pic_veneer_.
11103         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
11104         Target_arm::should_force_pic_veneer,
11105         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
11106         Target_arm::using_thumb_only, Target_arm:;default_target): New
11107         method defintions.
11108         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
11109         New data member declarations.
11110         (Insn_template::size, Insn_template::alignment): New method defintions.
11111         (Stub_template::Stub_template): New method definition.
11112         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
11113         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
11114         (Stub_factory::Stub_factory): New method definition.
11115         * gold.h (string_hash): New template.
11116         * output.h (Input_section_specifier::hash_value): Use
11117         gold::string_hash.
11118         (Input_section_specifier::string_hash): Remove.
11119         * stringpool.cc (Stringpool_template::string_hash): Use
11120         gold::string_hash.
11121
11122 2009-10-20  Doug Kwan  <dougkwan@google.com>
11123
11124         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
11125         symbols of relaxed input sections.
11126         * output.h (Output_section::find_relaxed_input_section): Make
11127         method public.
11128
11129 2009-10-16  Doug Kwan  <dougkwan@google.com>
11130
11131         * dynobj.cc (Versions::Versions): Initialize version_script_.
11132         Only insert base version symbol definition for a shared object
11133         if version script defines any version versions.
11134         (Versions::define_base_version): New method definition.
11135         (Versions::add_def): Check that base version is not needed.
11136         (Versions::add_need): Define base version lazily.
11137         * dynobj.h (Versions::define_base_version): New method declaration.
11138         (Versions::needs_base_version_): New data member declaration.
11139         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
11140         (check_DATA): Add no_version_test.stdout.
11141         (libno_version_test.so, no_version_test.o no_version_test.stdout):
11142         New make rules.
11143         * testsuite/Makefile.in: Regenerate.
11144         * testsuite/no_version_test.c: New file.
11145         * testsuite/no_version_test.sh: Ditto.
11146
11147 2009-10-16  Doug Kwan  <dougkwan@google.com>
11148
11149         * expression.cc (class Segment_start_expression): New class definition.
11150         (Segment_start_expression::value): New method definition.
11151         (script_exp_function_segment_start): Return a new
11152         Segment_start_expression.
11153         * gold/script-c.h (script_saw_segment_start_expression): New function
11154         prototype.
11155         * script-sections.cc (Script_sections::Script_sections): Initialize
11156         SAW_SEGMENT_START_EXPRESSION_ to false.
11157         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
11158         and -Tbbs options to specify section addresses if given in
11159         command line and no SEGMENT_START expression is seen in a script.
11160         * script-sections.h (Script_sections::saw_segment_start_expression,
11161         Script_sections::set_saw_segment_start_expression): New method
11162         definition.
11163         (Script_sections::saw_segment_start_expression_): New data member
11164         declaration.
11165         * script.cc (script_saw_segment_start_expression): New function.
11166         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
11167         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
11168         script_test_7.sh and script_test_8.sh.
11169         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
11170         script_test_8.stdout.
11171         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
11172         (script_test_6, script_test_6.stdout, script_test_7,
11173         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
11174         * Makefile.in: Regenerate.
11175         * testsuite/script_test_6.sh: New file.
11176         * testsuite/script_test_6.t: Same.
11177         * testsuite/script_test_7.sh: Same.
11178         * testsuite/script_test_7.t: Same.
11179         * testsuite/script_test_8.sh: Same.
11180
11181 2009-10-16  Doug Kwan  <dougkwan@google.com>
11182
11183         * output.cc (Output_segment::set_section_list_address): Cast
11184         expressions to unsigned long long type to avoid format warnings.
11185
11186 2009-10-15  Ian Lance Taylor  <iant@google.com>
11187
11188         * script.cc (Script_options::add_symbol_assignment): Always add a
11189         dot assignment to script_sections_.
11190         * script-sections.cc (Script_sections::add_dot_assignment):
11191         Initialize if necessary.
11192
11193         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
11194         program headers with no load segment if there is a linker script.
11195
11196         * layout.cc (Layout::set_segment_offsets): Align the file offset
11197         to the segment aligment for -N or -n with no load segment.
11198         * output.cc (Output_segment::add_output_section): Don't crash if
11199         the first section is a TLS section.
11200         (Output_segment::set_section_list_addresses): Print an error
11201         message if the address moves backward in a linker script.
11202         * script-sections.cc
11203         (Output_section_element_input::set_section_addresses): Don't
11204         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
11205         (Orphan_output_section::set_section_addresses): Likewise.
11206
11207 2009-10-15  Doug Kwan  <dougkwan@google.com>
11208
11209         * layout.cc (Layout::finish_dynamic_section): Generate tags
11210         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
11211         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
11212         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
11213
11214 2009-10-14  Ian Lance Taylor  <iant@google.com>
11215
11216         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
11217         fields.
11218         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
11219         data_shdr fields of relinfo.
11220         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
11221         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
11222         R_386_TLS_LDO_32, adjust based on section flags.
11223         (Target_i386::Relocate::fix_up_ldo): Remove.
11224
11225 2009-10-13  Ian Lance Taylor  <iant@google.com>
11226
11227         Add support for -pie.
11228         * options.h (class General_options): Add -pie and
11229         --pic-executable.
11230         (General_options::output_is_position_independent): Test -pie.
11231         (General_options::output_is_executable): Return true if not shared
11232         and not relocatable.
11233         (General_options::output_is_pie): Remove.
11234         * options.cc (General_options::finalize): Reject incompatible uses
11235         of -pie.
11236         * gold.cc (queue_middle_tasks): A -pie link is not static.
11237         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
11238         * symtab.cc (Symbol::final_value_is_known): Return false if
11239         output_is_position_independent.
11240         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
11241         output_is_position_independent.
11242         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
11243         output_is_position_independent.
11244         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
11245         output_is_position_independent.
11246         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
11247         two_file_pie_test.
11248         (basic_pie_test.o, basic_pie_test): New targets.
11249         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
11250         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
11251         (two_file_pie_test): New target.
11252         * testsuite/Makefile.in: Rebuild.
11253         * README: Remove note saying that -pie is not supported.
11254
11255 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
11256
11257         * options.h (class General_options): Add -init and -fini.
11258         * layout.cc (Layout::finish_dynamic_section): Emit
11259         given init and fini functions.
11260
11261 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
11262
11263         * gc.h (gc_process_relocs): Check if icf is enabled using new
11264         function.
11265         * gold.cc (queue_initial_tasks): Likewise.
11266         (queue_middle_tasks): Likewise.
11267         * object.cc (do_layout): Likewise.
11268         * symtab.cc (is_section_folded): Likewise.
11269         * main.cc (main): Likewise.
11270         * reloc.cc (Read_relocs::run): Likewise.
11271         (Sized_relobj::do_scan_relocs): Likewise.
11272         * icf.cc (is_function_ctor_or_dtor): New function.
11273         (Icf::find_identical_sections): Check if function is ctor or dtor when
11274         safe icf is chosen.
11275         * options.h (General_options::icf): Change option to be an enum.
11276         (Icf_status): New enum.
11277         (icf_enabled): New method.
11278         (icf_safe_folding): New method.
11279         (set_icf_status): New method.
11280         (icf_status_): New variable.
11281         * (options.cc) (General_options::finalize): Set icf_status_.
11282         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
11283         icf_test and icf_keep_unique_test to use the --icf enum flag.
11284         * testsuite/icf_safe_test.sh: New file.
11285         * testsuite/icf_safe_test.cc: New file.
11286
11287 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
11288
11289         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
11290         includes to gc.h and icf.h.
11291         * arm.cc: Include gc.h.
11292         * gold.cc: Likewise.
11293         * i386.cc: Likewise.
11294         * powerpc.cc: Likewise.
11295         * sparc.cc: Likewise.
11296         * x86_64.cc: Likewise.
11297         * gc.h: Include icf.h.
11298
11299 2009-10-11  Ian Lance Taylor  <iant@google.com>
11300
11301         * plugin.cc: Include "gold.h" before other header files.
11302
11303 2009-10-10  Chris Demetriou  <cgd@google.com>
11304
11305         * options.h (Input_file_argument::Input_file_type): New enum.
11306         (Input_file_argument::is_lib_): Replace with...
11307         (Input_file_argument::type_): New member.
11308         (Input_file_argument::Input_file_argument): Take Input_file_type
11309         'type' rather than boolean 'is_lib' as second argument.
11310         (Input_file_argument::is_lib): Use type_.
11311         (Input_file_argument::is_searched_file): New function.
11312         (Input_file_argument::may_need_search): Handle is_searched_file.
11313         * options.cc (General_options::parse_library): Support -l:filename.
11314         (General_options::parse_just_symbols): Update for Input_file_argument
11315         changes.
11316         (Command_line::process): Likewise.
11317         * archive.cc (Archive::get_file_and_offset): Likewise.
11318         * plugin.cc (Plugin_manager::release_input_file): Likewise.
11319         * script.cc (read_script_file, script_add_file): Likewise.
11320         * fileread.cc (Input_file::Input_file): Likewise.
11321         (Input_file::will_search_for): Handle is_searched_file.
11322         (Input_file::open): Likewise.
11323         * readsyms.cc (Read_symbols::get_name): Likewise.
11324         * testsuite/Makefile.am (searched_file_test): New test.
11325         * testsuite/Makefile.in: Regenerate.
11326         * testsuite/searched_file_test.cc: New file.
11327         * testsuite/searched_file_test_lib.cc: New file.
11328
11329 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11330             Ian Lance Taylor  <iant@google.com>
11331
11332         * descriptor.cc: Include <cstdio> and "binary-io.h".
11333         (Descriptors::open): Open the files in binary mode always.
11334         * script.cc (Lex::get_token): Treat \r as whitespace.
11335
11336 2009-10-09  Ian Lance Taylor  <iant@google.com>
11337
11338         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
11339
11340 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11341             Ian Lance Taylor  <iant@google.com>
11342
11343         * configure.ac: Check for readv function also.
11344         * fileread.cc (readv): Define if not HAVE_READV.
11345         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
11346         does not exist.
11347         * config.in: Regenerate.
11348         * configure: Regenerate.
11349
11350 2009-10-09  Doug Kwan  <dougkwan@google.com>
11351
11352         * layout.cc (Layout::make_output_section): Call target hook to make
11353         ordinary output section.
11354         (Layout::finalize): Adjust parameter list of call the
11355         Target::may_relax().
11356         * layout.h (class Layout::section_list): New method.
11357         * merge.h (Output_merge_base::entsize): Change visibility to public.
11358         (Output_merge_base::is_string, Output_merge_base::do_is_string):
11359         New methods.
11360         (Output_merge_string::do_is_string): New method.
11361         * object.cc (Sized_relobj::do_setup): renamed from
11362         Sized_relobj::set_up.
11363         * object.h (Sized_relobj::adjust_shndx,
11364         Sized_relobj::initializ_input_to_output_maps,
11365         Sized_relobj::free_input_to_output_maps): Change visibilities to
11366         protected.
11367         (Sized_relobj::setup): Virtualize.
11368         (Sized_relobj::do_setup): New method declaration.
11369         (Sized_relobj::invalidate_section_offset,
11370         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
11371         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
11372         * options.cc (parse_int): New function.
11373         * options.h (parse_int): New declaration.
11374         (DEFINE_int): New macro.
11375         (stub_group_size): New option.
11376         * output.cc (Output_section::Output_section): Initialize memebers
11377         merge_section_map_, merge_section_by_properties_map_,
11378         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
11379         (Output_section::add_input_section): Handled deferred code-fill
11380         generation and remove an old comment.
11381         (Output_section::add_relaxed_input_section): New method definition.
11382         (Output_section::add_merge_input_section): Use merge section by
11383         properties map to speed to search.  Update merge section maps
11384         as appropriate.
11385         (Output_section::build_relaxation_map): New method definition.
11386         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
11387         Same.
11388         (Output_section::relax_input_section): Renamed to
11389         Output_section::convert_input_sections_to_relaxed_sections and change
11390         interface to take a vector of pointers to relaxed sections.
11391         (Output_section::find_merge_section,
11392         Output_section::find_relaxed_input_section): New method definitions.
11393         (Output_section::is_input_address_mapped,
11394         Output_section::output_offset, Output_section::output_address):
11395         Use output section data maps to speed up searching.
11396         (Output_section::find_starting_output_address): Add comments.
11397         (Output_section::do_write,
11398         Output_section::write_to_postprocessing_buffer): Do code-fill
11399         generation as appropriate.
11400         (Output_section::get_input_sections): Invalidate relaxed input section
11401         map.
11402         (Output_section::restore_states): Adjust type of checkpoint .
11403         Invalidate relaxed input section map.
11404         * output.h (Output_merge_base): New class declaration.
11405         (Input_section_specifier): New class defintion.
11406         (class Output_relaxed_input_section) Change base class to
11407         Output_section_data_build.
11408         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
11409         base class initializer.
11410         (Output_section::add_relaxed_input_section): New method declaration.
11411         (Output_section::Input_section): Change visibility to protected.
11412         (Output_section::Input_section::relobj,
11413         Output_section::Input_section::shndx): Handle relaxed input sections.
11414         Output_section::input_sections) Change visibility to protected.  Also
11415         define overload to return a non-const pointer.
11416         (Output_section::Merge_section_properties): New class defintion.
11417         (Output_section::Merge_section_by_properties_map,
11418         Output_section::Output_section_data_by_input_section_map,
11419         Output_section::Relaxation_map): New types.
11420         (Output_section::relax_input_section): Rename method to
11421         Output_section::convert_input_sections_to_relaxed_sections and change
11422         interface to take a vector of relaxed section pointers.
11423         (Output_section::find_merge_section,
11424         Output_section::find_relaxed_input_section,
11425         Output_section::build_relaxation_map,
11426         Output_section::convert_input_sections_in_list_to_relaxed_sections):
11427         New method declarations.
11428         (Output_section::merge_section_map_
11429         Output_section::merge_section_by_properties_map_,
11430         Output_section::relaxed_input_section_map_,
11431         Output_section::is_relaxed_input_section_map_valid_,
11432         Output_section::generate_code_fills_at_write_): New data members.
11433         * script-sections.cc
11434         (Output_section_element_input::set_section_addresses): Call
11435         current_data_size and addralign methods of relaxed input sections.
11436         (Orphan_output_section::set_section_addresses): Call current_data_size
11437         and addralign methods of relaxed input sections.
11438         * symtab.cc (Symbol_table::compute_final_value): Extract template
11439         from the body of Symbol_table::sized_finalize_symbol.
11440         (Symbol_table::sized_finalized_symbol): Call
11441         Symbol_table::compute_final_value.
11442         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
11443         (Symbol_table::compute_final_value): New templated method declaration.
11444         * target.cc (Target::do_make_output_section): New method defintion.
11445         * target.h (Target::make_output_section): New method declaration.
11446         (Target::relax): Add more parameters for input objects, symbol table
11447         and layout.  Adjust call to do_relax.
11448         (Target::do_make_output_section): New method declaration.
11449         (Target::do_relax): Add parameters for input objects, symbol table
11450         and layout.
11451
11452 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11453
11454         * pread.c: Include stdio.h.
11455
11456 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11457
11458         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
11459         defined.
11460
11461 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11462
11463         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
11464         Change read_shndx type to unsigned int.
11465         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
11466         int.
11467         (Sized_dwarf_line_info::read_line_mappings): Likewise.
11468         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
11469         Change read_shndx type to unsigned int.
11470         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
11471         int.
11472         (Sized_dwarf_line_info::read_line_mappings): Likewise.
11473         * layout.cc (Layout::create_symtab_sections): Cast the result of
11474         local_symcount * symsize to off_t in the gold_assert.
11475
11476 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11477
11478         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
11479         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
11480         R_ARM_BASE_ABS.
11481         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
11482         (Arm_relocate_functions::thm_abs5): New function.
11483         (Arm_relocate_functions::abs12): New function.
11484         (Arm_relocate_functions::abs16): New function.
11485         (Arm_relocate_functions::base_abs): New function.
11486         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
11487         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
11488         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
11489         R_ARM_BASE_ABS.
11490         (Scan::global): Likewise.
11491         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
11492         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
11493         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
11494         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
11495         R_ARM_BASE_ABS.
11496
11497 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11498
11499         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
11500         (Arm_relocate_functions::movt_prel): New function.
11501         (Arm_relocate_functions::thm_movw_prel_nc): New function.
11502         (Arm_relocate_functions::thm_movt_prel): New function.
11503         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
11504         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
11505         (Scan::global, Relocate::relocate): Likewise.
11506         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11507
11508 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
11509
11510         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
11511         Incremental_checker.
11512         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
11513         unsigned int.
11514         (class Incremental_inputs_header): New class.
11515         (Incremental_inputs_header_writer): Edit comment.
11516         (Incremental_inputs_entry): New class.
11517         (Incremental_inputs_entry_writer): Edit comment.
11518         (Sized_incremental_binary::do_find_incremental_inputs_section):
11519         Add *strtab_shndx parameter, fill it.
11520         (Sized_incremental_binary::do_check_inputs): New method.
11521         (Incremental_checker::can_incrementally_link_output_file): Use
11522         Sized_incremental_binary::check_inputs.
11523         (Incremental_inputs::report_command_line): Save command line in
11524         command_line_.
11525         * incremental.h:
11526         (Incremental_binary::find_incremental_inputs_section): New
11527         method.
11528         (Incremental_binary::do_find_incremental_inputs_section): Add
11529         strtab_shndx parameter.
11530         (Incremental_binary::do_check_inputs): New pure virtual method.
11531         (Sized_incremental_binary::do_check_inputs): Declare.
11532         (Incremental_checker::Incremental_checker): Add incremental_inputs
11533         parameter, use it to initialize incremental_inputs_.
11534         (Incremental_checker::incremental_inputs_): New field.
11535         (Incremental_checker::command_line): New method.
11536         (Incremental_checker::inputs): New method.
11537         (Incremental_checker::command_line_): New field.
11538
11539 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
11540
11541         * incremental.cc: Include <cstdarg> and "target-select.h".
11542         (vexplain_no_incremental): New function.
11543         (explain_no_incremental): New function.
11544         (Incremental_binary::error): New method.
11545         (Sized_incremental_binary::do_find_incremental_inputs_section): New
11546         method.
11547         (make_sized_incremental_binary): New function.
11548         (open_incremental_binary): New function.
11549         (can_incrementally_link_file): Add checks if output is ELF and has
11550         inputs section.
11551         * incremental.h: Include "elfcpp_file.h" and "output.h".
11552         (Incremental_binary): New class.
11553         (Sized_incremental_binary): New class.
11554         (open_incremental_binary): Declare.
11555         * object.cc (is_elf_object): Use
11556         elfcpp::Elf_recognizer::is_elf_file.
11557         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
11558         * output.h (Output_file::filesize): New method.
11559
11560 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11561
11562         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
11563         New function.
11564         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
11565         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
11566         function.
11567         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
11568         function.
11569         (Arm_relocate_functions::movw_abs_nc): New function.
11570         (Arm_relocate_functions::movt_abs): New function.
11571         (Arm_relocate_functions::thm_movw_abs_nc): New function.
11572         (Arm_relocate_functions::thm_movt_abs): New function.
11573         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
11574         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
11575         (Scan::global): Likewise.
11576         (Relocate::relocate): Likewise.
11577         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11578
11579 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11580
11581         * arm.cc (Arm_relocate_functions::got_prel) New function.
11582         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
11583         (Relocate::relocate): Likewise.
11584         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11585
11586 2009-10-06  Ian Lance Taylor  <iant@google.com>
11587
11588         * options.h (class General_options): Define
11589         split_stack_adjust_size parameter.
11590         * object.h (class Object): Add uses_split_stack_ and
11591         has_no_split_stack_ fields.  Add uses_split_stack and
11592         has_no_split_stack accessor functions.  Declare
11593         handle_split_stack_section.
11594         (class Reloc_symbol_changes): Define.
11595         (class Sized_relobj): Define Function_offsets.  Declare
11596         split_stack_adjust, split_stack_adjust_reltype, and
11597         find_functions.
11598         * object.cc (Object::handle_split_stack_section): New function.
11599         (Sized_relobj::do_layout): Call handle_split_stack_section.
11600         * dynobj.cc (Sized_dynobj::do_layout): Call
11601         handle_split_stack_section.
11602         * reloc.cc (Sized_relobj::relocate_sections): Call
11603         split_stack_adjust for executable sections in split_stack
11604         objects.  Pass reloc_map to relocate_section.
11605         (Sized_relobj::split_stack_adjust): New function.
11606         (Sized_relobj::split_stack_adjust_reltype): New function.
11607         (Sized_relobj::find_functions): New function.
11608         * target-reloc.h: Include "object.h".
11609         (relocate_section): Add reloc_symbol_changes parameter.  Change
11610         all callers.
11611         * target.h (class Target): Add calls_non_split method.  Declare
11612         do_calls_non_split virtual method.  Declare match_view and
11613         set_view_to_nop.
11614         * target.cc: Include "elfcpp.h".
11615         (Target::do_calls_non_split): New function.
11616         (Target::match_view): New function.
11617         (Target::set_view_to_nop): New function.
11618         * gold.cc (queue_middle_tasks): Give an error if mixing
11619         split-stack and non-split-stack objects with -r.
11620         * i386.cc (Target_i386::relocate_section): Add
11621         reloc_symbol_changes parameter.
11622         (Target_i386::do_calls_non_split): New function.
11623         * x86_64.cc (Target_x86_64::relocate_section): Add
11624         reloc_symbol_changes parameter.
11625         (Target_x86_64::do_calls_non_split): New function.
11626         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
11627         parameter.
11628         * powerpc.cc (Target_powerpc::relocate_section): Add
11629         reloc_symbol_changes parameter.
11630         * sparc.cc (Target_sparc::relocate_section): Add
11631         reloc_symbol_changes parameter.
11632         * configure.ac: Call AM_CONDITIONAL for the default target.
11633         * configure: Rebuild.
11634         * testsuite/Makefile.am (TEST_AS): New variable.
11635         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
11636         (check_DATA): Add split_i386 and split_x86_64 files.
11637         (SPLIT_DEFSYMS): Define.
11638         (split_i386_[1234n].o): New targets.
11639         (split_i386_[124]): New targets.
11640         (split_i386_[1234r].stdout): New targets.
11641         (split_x86_64_[1234n].o): New targets.
11642         (split_x86_64_[124]): New targets.
11643         (split_x86_64_[1234r].stdout): New targets.
11644         (MOSTLYCLEANFILES): Add new executables.
11645         * testsuite/split_i386.sh: New file.
11646         * testsuite/split_x86_64.sh: New file.
11647         * testsuite/split_i386_1.s: New file.
11648         * testsuite/split_i386_2.s: New file.
11649         * testsuite/split_i386_3.s: New file.
11650         * testsuite/split_i386_4.s: New file.
11651         * testsuite/split_i386_n.s: New file.
11652         * testsuite/split_x86_64_1.s: New file.
11653         * testsuite/split_x86_64_2.s: New file.
11654         * testsuite/split_x86_64_3.s: New file.
11655         * testsuite/split_x86_64_4.s: New file.
11656         * testsuite/split_x86_64_n.s: New file.
11657         * testsuite/testfile.cc (Target_test): Update relocation_section
11658         function.
11659         * testsuite/Makefile.in: Rebuild.
11660
11661 2009-10-06  Ian Lance Taylor  <iant@google.com>
11662
11663         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
11664         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
11665         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
11666         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
11667         the address on ldo_addrs_.
11668         (Target_i386::Relocate::fix_up_ldo): New function.
11669
11670 2009-10-06   Rafael Espindola  <espindola@google.com>
11671
11672         * plugin.cc (add_input_library): New.
11673         (Plugin::load): Add add_input_library to tv.
11674         (Plugin_manager::add_input_file): Add the is_lib argument.
11675         (add_input_file): Update call to Plugin_manager::add_input_file.
11676         (add_input_library): New.
11677         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
11678
11679 2009-09-30  Doug Kwan  <dougkwan@google.com>
11680
11681         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
11682         symbol and call Symbol::may_need_copy_reloc to determine if
11683         a copy reloc is needed.
11684         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
11685         nocopyreloc is given in command line.
11686         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
11687         given in command line.
11688         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
11689         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
11690         of the removed Target_i386::may_need_copy_reloc.
11691         * options.h (copyreloc): New option with default value false.
11692         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
11693         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
11694         instead of the removed Target_powerpc::may_need_copy_reloc.
11695         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
11696         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
11697         instead of the removed Target_sparc::may_need_copy_reloc.
11698         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
11699         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
11700         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
11701         instead of the removed Target_x86_64::may_need_copy_reloc.
11702
11703 2009-09-30  Ian Lance Taylor  <iant@google.com>
11704
11705         * object.h (class Object): Remove target_ field, and target,
11706         sized_target, and set_target methods.
11707         (Object::sized_target): Remove.
11708         (class Sized_relobj): Update declarations.  Remove sized_target.
11709         * object.cc (Sized_relobj::setup): Remove target parameter.
11710         Change all callers.
11711         (Input_objects::add_object): Don't do anything with the target.
11712         (make_elf_sized_object): Add punconfigured parameter.  Change all
11713         callers.  Set or test parameter target.
11714         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
11715         Change all callers.
11716         * parameters.cc (Parameters::set_target): Change parameter type to
11717         be non-const.
11718         (Parameters::default_target): Remove.
11719         (set_parameters_target): Change parameter type to be non-const.
11720         (parameters_force_valid_target): New function.
11721         (parameters_clear_target): New function.
11722         * parameters.h (class Parameters): Update declarations.  Remove
11723         default_target method.  Add sized_target and clear_target
11724         methods.  Change target_ to be non-const.
11725         (set_parameters_target): Update declaration.
11726         (parameters_force_valid_target): Declare.
11727         (parameters_clear_target): Declare.
11728         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
11729         as NULL if we aren't searching.
11730         (Add_symbols::run): Don't check for compatible target.
11731         * fileread.cc (Input_file::open_binary): Call
11732         parameters_force_valid_target.
11733         * gold.cc (queue_middle_tasks): Likewise.
11734         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
11735         set_target on object.
11736         * dynobj.h (class Sized_dynobj): Update declarations.
11737         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
11738         make_elf_object returns NULL.
11739         (Archive::include_member): Don't check whether object target is
11740         compatible.
11741         * output.cc (Output_section::add_input_section): Get target from
11742         parameters.
11743         (Output_section::relax_input_section): Likewise.
11744         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
11745         parameters.
11746         (Sized_relobj::do_scan_relocs): Likewise.
11747         (Sized_relobj::relocate_sections): Likewise.
11748         * resolve.cc (Symbol_table::resolve): Likewise.
11749         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
11750         parameter.  Change all callers.
11751         (Symbol_table::add_from_object): Get target from parameters.
11752         (Symbol_table::add_from_relobj): Don't check object target.
11753         (Symbol_table::add_from_dynobj): Likewise.
11754         (Symbol_table::define_special_symbol): Get target from
11755         parameters.
11756         * symtab.h (class Symbol_table): Update declaration.
11757         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
11758         parameter.  Change all callers.  Clear parameter target.
11759         (Binary_test): Test target here.
11760         * testsuite/object_unittest.cc (gold_testsuite): Remove
11761         target_test_pointer parameter.  Change all callers.
11762         (Object_test): Test target here.
11763
11764 2009-09-26  Ian Lance Taylor  <iant@google.com>
11765
11766         * testsuite/initpri1.c: Don't try to use constructor priorities if
11767         compiling with gcc before 4.3.
11768
11769 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
11770
11771         * testsuite/retain_symbols_file_test.sh (check_present): Change
11772         output file name to retain_symbols_file_test.stdout.
11773         (check_absent): Likewise.
11774
11775 2009-09-18  Craig Silverstein  <csilvers@google.com>
11776
11777         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
11778         * options.cc: Include <cerrno> and <fstream>.
11779         (General_options::finalize): Parse -retain-symbols-file tag.
11780         * options.h: New flag.
11781         (General_options): New method should_retain_symbol, new
11782         variable symbols_to_retain.
11783         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
11784         should_retain_symbol map.
11785         * testsuite/Makefile.am (retain_symbols_file_test): New test.
11786         * testsuite/Makefile.in: Regenerate.
11787         * testsuite/retain_symbols_file_test.sh: New file.
11788
11789 2009-09-18  Nick Clifton  <nickc@redhat.com>
11790
11791         * po/es.po: Updated Spanish translation.
11792
11793 2009-09-17  Doug Kwan  <dougkwan@google.com>
11794
11795         * debug.h (DEBUG_RELAXATION): New constant.
11796         (DEBUG_ALL): Add DEBUG_RELAXATION.
11797         (debug_string_to_enum): Add relaxation debug option.
11798         * layout.cc
11799         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
11800         Layout::Relaxation_debug_check::read_sections,
11801         Layout::Relaxation_debug_check::read_sections): New method definitions.
11802         (Layout::Layout): Initialize data members
11803         record_output_section_data_from_scrips_,
11804         script_output_section_data_list_ and relaxation_debug_check_.
11805         (Layout::save_segments, Layout::restore_segments,
11806         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
11807         Layout::relaxation_loop_body): New method definitions.
11808         (Layout::finalize): Support relaxation.  Move section layout code to
11809         Layout::relaxation_loop_body.
11810         (Layout::set_asection_address_from_script): Move code for orphan
11811         section placement out.
11812         (Layout::place_orphan_sections_in_script): New method definition.
11813         * layout.h (Output_segment_headers, Output_file_header):
11814         New forward class declarations.
11815         (Layout::~Layout): Define.
11816         (Layout::new_output_section_data_from_script): New method definition.
11817         (Layout::place_orphan_sections_in_script): New method declaration.
11818         (Layout::Segment_states): New type declaration.
11819         (Layout::save_segments, Layout::restore_segments,
11820         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
11821         Layout::relaxation_loop_body): New method declarations.
11822         (Layout::Output_section_data_list): New type declaration.
11823         (Layout::Relaxation_debug_check): New class definition.
11824         (Layout::record_output_section_data_from_script_,
11825         Layout::script_output_section_data_list_, Layout::segment_states_,
11826         Layout::relaxation_debug_check_): New data members.
11827         * output.cc: (Output_section_headers::do_size): New method definition.
11828         (Output_section_headers::Output_section_headers): Move size
11829         computation to Output_section_headers::do_size.
11830         (Output_segment_headers::do_size): New method definition.
11831         (Output_file_header::Output_file_header): Move size computation to
11832         Output_file_header::do_size and call it.
11833         (Output_file_header::do_size): New method definition.
11834         (Output_data_group::Output_data_group): Adjust call to
11835         Output_section_data.
11836         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
11837         (Output_symtab_xindex::do_write): Add array bound check.
11838         (Output_section::Input_section::print_to_mapfile): Handle
11839         RELAXED_INPUT_SECTION_CODE.
11840         (Output_section::Output_section): Initialize data member checkpoint_.
11841         (Output_section::~Output_section): Delete checkpoint object pointed
11842         by checkpoint_.
11843         (Output_section::add_input_section): Always add an Input_section if
11844         relaxing.
11845         (Output_section::add_merge_input_section): Add assert.
11846         (Output_section::relax_input_section): New method definition.
11847         (Output_section::set_final_data_size): Set load address to zero for
11848         an unallocated section.
11849         (Output_section::do_address_and_file_offset_have_reset_values):
11850         New method definition.
11851         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
11852         Handle relaxed input section.
11853         (Output_section::sort_attached_input_sections): Checkpoint input
11854         section list lazily.
11855         (Output_section::get_input_sections): Change type of input_sections to
11856         list of Simple_input_section pointers.  Checkpoint input section list
11857         lazily.  Also handle relaxed input sections.
11858         (Output_section::add_input_section_for_script): Take a reference to
11859         a Simple_input_section object instead of Relobj pointer and section
11860         index as parameter.  Handle relaxed input sections.
11861         (Output_section::save_states, Output_section::restore_states): New
11862         method definitions.
11863         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
11864         (Output_data::is_data_size_fixed): New method definition.
11865         (Output_data::reset_addresss_and_file_offset): Do not reset data size
11866         if it is fixed.
11867         (Output_data::address_and_file_offset_have_reset_values): New method
11868         definition.
11869         (Output_data::do_address_and_file_offset_have_reset_values): New method
11870         definition.
11871         (Output_data::set_data_size): Check that data size is not fixed.
11872         (Output_data::fix_data_size): New method definition.
11873         (Output_data::is_data_size_fixed_): New data member.
11874         (Output_section_headers::set_final_data_size): New method definition.
11875         (Output_section_headers::do_size): New method declaration.
11876         (Output_segment_headers::set_final_data_size): New method definition.
11877         (Output_segment_headers::do_size): New method declaration.
11878         (Output_file_header::set_final_data_size)::New method definition.
11879         (Output_file_header::do_size)::New method declaration.
11880         (Output_section_data::Output_section_data): Add new parameter
11881         is_data_size_fixed and use it to fix data size.
11882         (Output_data_const::Output_data_const): Adjust call to base class
11883         constructor and fix data size.
11884         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
11885         base class constructor and fix data size.
11886         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
11887         base class constructor and fix data size.
11888         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
11889         class constructor and fix data size.
11890         (Output_data_group::set_final_data_size): New method definition.
11891         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
11892         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
11893         class constructor and fix data size.
11894         (Output_relaxed_input_section): New class definition.
11895         (Output_section::Simple_input_section): New class definition.
11896         (Output_section::get_input_sections): Adjust parameter list.
11897         (Output_section::add_input_section_for_script): Same.
11898         (Output_section::save_states, Output_section::restore_states,
11899         Output_section::do_address_and_file_offset_have_reset_values,
11900         (Output_section::Input_section::Input_section): Handle
11901         RELAXED_INPUT_SECTION_CODE.  Add new overload for
11902         Output_relaxed_input_section.
11903         (Output_section::Input_section::is_input_section,
11904         Output_section::Input_section::set_output_section): Handle relaxed
11905         input section.
11906         (Output_section::Input_section::is_relaxed_input_section,
11907         Output_section::Input_section::output_section_data,
11908         Output_section::Input_section::relaxed_input_section): New method
11909         definitions.
11910         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
11911         value.
11912         (Output_section::Input_section::u1_): Update comments.
11913         (Output_section::Input_section::u2_): Add new union member poris.
11914         (Output_section::Checkpoint_output_section): New classs definition.
11915         (Output_section::relax_input_section): New method declaration.
11916         (Output_section::checkpoint_): New data member.
11917         (Output_segment): Update comments.
11918         (Output_segment::Output_segment): Un-privatize copy constructor.
11919         (Output_segment::operator=): Un-privatize.
11920         * script-sections.cc (Output_section_element::Input_section_list):
11921         Change element type to Output_section::Simple_input_section.
11922         (Output_section_element_dot_assignment::set_section_addresses):
11923         Register output section data for relaxation clean up.
11924         (Output_data_exression::Output_data_expression): Adjust call to base
11925         constructor to fix data size.
11926         (Output_section_element_data::set_section_addresses): Register
11927         Output_data_expression object for relaxation clean up.
11928         (struct Input_section_info): Replace Relobj pointer and section index
11929         pair with Output_section::Simple_input_section and Convert struct to a
11930         class.
11931         (Input_section_sorter::operator()): Adjust access to
11932         Input_section_info data member to use accessors.
11933         (Output_section_element_input::set_section_addresses): Use layout
11934         parameter.  Adjust code to use Output_section::Simple_input_section
11935         and Input_secction_info classes.  Register filler for relaxation
11936         clean up.
11937         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
11938         and section index pair with Output_section::Simple_input_section
11939         class.  Adjust code accordingly.
11940         (Phdrs_element::release_segment): New method definition.
11941         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
11942         segment list.
11943         (Script_sections::release_segments): New method definition.
11944         * gold/script-sections.h (Script_sections::release_segments): New
11945         method declaration.
11946         * gold/target.h (Target::may_relax, Target::relax,
11947         Target::do_may_relax, Target::do_relax): New method definitions.
11948
11949 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11950
11951         * arm.cc (has_signed_unsigned_overflow): New function.
11952         (Arm_relocate_functions::abs8): New function.
11953         (Target_arm::Scan::local): Handle R_ARM_ABS8.
11954         (Target_arm::Scan::global): Likewise.
11955         (Target_arm::relocate::relocate): Likewise.
11956         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
11957         Likewise.
11958
11959 2009-09-16  Cary Coutant  <ccoutant@google.com>
11960
11961         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
11962         * testsuite/Makefile.in: Regenerate.
11963
11964 2009-09-11  Nick Clifton  <nickc@redhat.com>
11965
11966         * po/gold.pot: Updated by the Translation project.
11967
11968 2009-09-08  Cary Coutant  <ccoutant@google.com>
11969
11970         * output.cc (Output_file::open): Add execute permission to empty file.
11971         * testsuite/Makefile.am (permission_test): New test.
11972         * testsuite/Makefile.in: Regenerate.
11973
11974 2009-09-02  Ian Lance Taylor  <iant@google.com>
11975
11976         * output.cc (Output_file::resize): Call map_no_anonymous rather
11977         than map.
11978
11979 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
11980
11981         * gold.cc: Include "incremental.h".
11982         (queue_initial_tasks): Call Incremental_checker methods.
11983         * incremental.cc: Include "output.h".
11984         (Incremental_checker::can_incrementally_link_output_file): New
11985         method.
11986         * incremental.h (Incremental_checker): New class.
11987
11988         * output.cc (Output_file::open_for_modification): New method.
11989         (Output_file::map_anonymous): Changed return type to bool.  Record
11990         map in base_ field.
11991         (Output_file::map_no_anonymous): New method, broken out of map.
11992         (Output_file::map): Use map_no_anonymous and map_anonymous.
11993         * output.h (class Output_file): Update declarations.
11994
11995 2009-08-24  Cary Coutant  <ccoutant@google.com>
11996
11997         * options.h (Command_line::Pre_options): New class.
11998         (Command_line::pre_options): New member.
11999         * options.cc (gold::options::ready_to_register): New variable.
12000         (One_option::register_option): Do nothing if not registering options.
12001         Assert if same short option registered twice.
12002         (General_options::General_options): Turn off option registration when
12003         done constructing.
12004         (Command_line::Pre_options::Pre_options): New constructor.
12005
12006 2009-08-24  Cary Coutant  <ccoutant@google.com>
12007
12008         * options.h (General_options::no_keep_memory): Remove incorrect
12009         short option.
12010
12011 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
12012
12013         * Makefile.am (am__skiplex, am__skipyacc): New.
12014         * Makefile.in: Regenerate.
12015
12016 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
12017
12018         * Makefile.am (AM_CPPFLAGS): Renamed from ...
12019         (INCLUDES): ... this.
12020         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
12021         (AM_CPPFLAGS): Renamed from ...
12022         (INCLUDE): ... this.
12023         * Makefile.in, testsuite/Makefile.in: Regenerate.
12024
12025         * Makefile.in: Regenerate.
12026         * aclocal.m4: Likewise.
12027         * config.in: Likewise.
12028         * configure: Likewise.
12029         * testsuite/Makefile.in: Likewise.
12030
12031         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
12032         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
12033         * Makefile.in: Regenerate.
12034         * testsuite/Makefile.in: Regenerate.
12035
12036 2009-08-19  Cary Coutant  <ccoutant@google.com>
12037
12038         * resolve.cc (Symbol_table::resolve): Don't complain about defined
12039         symbols in shared libraries overridden by hidden or internal symbols
12040         in the main program.
12041
12042 2009-08-19  Chris Demetriou  <cgd@google.com>
12043
12044         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
12045         checking source file names in error messages.
12046
12047 2009-08-18  Doug Kwan  <dougkwan@google.com>
12048
12049         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
12050         an elcpp::Ehdr as parameter.  Adjust call to set_target.
12051         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
12052         an elfcpp::Ehdr as parameter.
12053         * object.cc (Object::set_target): Remove the version that looks up
12054         a target and sets it.
12055         (Sized_relobj::setup): Take a Target object instead of
12056         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
12057         (make_elf_sized_object): Find target and ask target to
12058         make an ELF object.
12059         * object.h: (Object::set_target): Remove the version that looks up
12060         a target and sets it.
12061         (Sized_relobj::setup): Take a Target object instead of
12062         an elfcpp:Ehdr as parameter.
12063         * target.cc: Include dynobj.h.
12064         (Target::do_make_elf_object_implementation): New.
12065         (Target::do_make_elf_object): New.
12066         * target.h (Target::make_elf_object): New template declaration.
12067         (Target::do_make_elf_object): New method declarations.
12068         (Target::do_make_elf_object_implementation): New template declaration.
12069
12070 2009-08-14  Ian Lance Taylor  <iant@google.com>
12071
12072         * gold.h (FUNCTION_NAME): Define.
12073         (gold_unreachable): Use FUNCTION_NAME.
12074
12075 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
12076
12077         * icf.cc (Icf::find_identical_sections): Issue a warning when a
12078         symbol in the --keep-unique list is not found.
12079
12080 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
12081
12082         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
12083         been maked as --keep-unique.
12084         (Icf::unfold_section): New function.
12085         * icf.h (Icf::unfold_section): New function.
12086         * options.h (General_options::keep_unique): New option.
12087         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
12088         * testsuite/Makefile.in: Regenerate.
12089         * testsuite/icf_keep_unique_test.sh: New file.
12090         * testsuite/icf_keep_unique_test.cc: New file.
12091
12092 2009-08-12  Cary Coutant  <ccoutant@google.com>
12093
12094         PR 10471
12095         * resolve.cc (Symbol_table::resolve): Check for references from
12096         dynamic objects to hidden and internal symbols.
12097         * testsuite/Makefile.am (hidden_test.sh): New test.
12098         * testsuite/Makefile.in: Regenerate.
12099         * testsuite/hidden_test.sh: New script.
12100         * testsuite/hidden_test_1.c: New test source.
12101         * testsuite/hidden_test_main.c: New test source.
12102
12103 2009-08-11  Doug Kwan  <dougkwan@google.com>
12104
12105         * arm.cc: Update comments.
12106         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
12107         segment to locate the .ARM.exidx section if present.
12108
12109 2009-08-09  Doug Kwan  <dougkwan@google.com>
12110
12111         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
12112         patch.
12113
12114 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
12115         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
12116         compiler warnings.
12117
12118 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
12119
12120         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
12121         valid tls_segment only for non-debug-section relocations.
12122         * testsuite/Makefile.am: Add gc_tls_test.
12123         * testsuite/Makefile.in: Regenerate.
12124         * testsuite/gc_tls_test.cc: New file.
12125         * testsuite/gc_tls_test.sh: New file.
12126
12127 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
12128
12129         * icf.cc: New file.
12130         * icf.h: New file.
12131         * Makefile.am (CCFILES): Add icf.cc.
12132         (HFILES): Add icf.h
12133         * Makefile.in: Regenerate.
12134         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
12135         * gc.h (gc_process_relocs): Populate lists used by icf to contain
12136         section, symbol and addend information for the relocs.
12137         * gold.cc (queue_middle_tasks): Call identical code folding.
12138         * gold.h: Add defines for multimap.
12139         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
12140         to the call of finalize_local_symbols.
12141         * main.cc (main): Create object of class Icf.
12142         * object.cc (Sized_relobj::do_layout): Allow this function to be
12143         called twice during icf.
12144         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
12145         to sections marked as identical by icf.
12146         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
12147         when available.
12148         (Sized_relobj::do_section_entsize): New function.
12149         * object.h (Object::section_entsize): New function.
12150         (Object::do_section_entsize): New pure virtual function.
12151         (Relobj::finalize_local_symbols): Add new parameter.
12152         (Relobj::do_section_entsize): New function.
12153         * options.h (General_options::icf): New option.
12154         (General_options::icf_iterations): New option.
12155         (General_options::print_icf_sections): New option.
12156         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
12157         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
12158         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
12159         icf.
12160         * symtab.cc (Symbol_table::is_section_folded): New function.
12161         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
12162         to sections marked as identical by icf.
12163         * symtab.h (Symbol_table::set_icf): New function.
12164         (Symbol_table::icf): New function.
12165         (Symbol_table::is_section_folded): New function.
12166         (Symbol_table::icf_): New data member.
12167         * target-reloc.h (relocate_section): Ignore sections folded by icf.
12168         * testsuite/Makefile.am: Add commands to build icf_test.
12169         * testsuite/Makefile.in: Regenerate.
12170         * testsuite/icf_test.sh: New file.
12171         * testsuite/icf_test.cc: New file.
12172
12173 2009-07-24  Chris Demetriou  <cgd@google.com>
12174
12175         * layout.cc (is_compressible_debug_section): Fix incorrect
12176         comment about compressed section names.
12177
12178 2009-07-20  Ian Lance Taylor  <ian@airs.com>
12179
12180         PR 10419
12181         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
12182
12183 2009-07-16  Ian Lance Taylor  <iant@google.com>
12184
12185         PR 10400
12186         * layout.h: #include <map>.
12187         (class Kept_section): Change from struct to class.  Add accessors
12188         and setters.  Add section size to Comdat_group mapping.  Change
12189         Comdat_group to std::map.  Add is_comdat_ field.  Add
12190         linkonce_size field in union.
12191         (class Layout): Update declaration of find_or_add_kept_section.
12192         Don't declare find_kept_object.
12193         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
12194         parameter.  Add object, shndx, is_comdat, and is_group_name
12195         parameters.  Change all callers.  Adjust for new Kept_section.
12196         (Layout::find_kept_object): Remove.
12197         * object.cc (Sized_relobj::include_section_group): Update use of
12198         Kept_section.  Rename secnum to shndx.  Only record
12199         Kept_comdat_section if sections are the same size.
12200         (Sized_relobj::include_linkonce_section): Update use of
12201         Kept_section.  Only record Kept_comdat_section if sections are the
12202         same size.  Set size of linkonce section.
12203         (Sized_relobj::map_to_kept_section): Update call to
12204         get_kept_comdat_section.
12205         * object.h (class Sized_relobj): Rename fields in
12206         Kept_comdat_section to drop trailing underscores; change object
12207         field to Relobj*.  Change Kept_comdat_section_table to store
12208         struct rather than pointer.
12209         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
12210         Add kept_object and kept_shndx parameters.  Change all callers.
12211         (Sized_relobj::get_kept_comdat_section): Change return type to
12212         bool.  Add kept_object and kept_shndx parameters.  Change all
12213         callers.
12214         * plugin.cc (Pluginobj::include_comdat_group): Update call to
12215         Layout::find_or_add_kept_section.
12216
12217 2009-07-09  Ian Lance Taylor  <iant@google.com>
12218
12219         * merge.cc (Object_merge_map::initialize_input_to_output_map):
12220         Reserve space in the hash table.
12221
12222 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
12223
12224         * fileread.cc (File_read::get_mtime): New method.
12225         * fileread.h (Timespec): New structure.
12226         (File_read::get_mtime): New method.
12227         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
12228         Renamed from timestamp_nsec.
12229         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
12230         Elf_Xword.
12231         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
12232         timestamp_nsec.
12233         (Incremental_inputs::report_archive): Save mtime; style fix.
12234         (Incremental_inputs::report_obejct): Save mtime; style fix.
12235         (Incremental_inputs::report_script): Save mtime; style fix.
12236         (Incremental_inputs::finalize_inputs): Style fix.
12237         (Incremental_inputs::finalize): Style fix.
12238         (Incremental_inputs::create_input_section_data): Store inputs
12239         mtime.
12240         * incremental.h (Incremental_inputs::report_script): Add mtime
12241         argument.
12242         (Incremental_inputs::Input_info::Input_info): Intialize only one
12243         union member.
12244         (Incremental_inputs::Input_info::archive): Move to nameless
12245         union.
12246         (Incremental_inputs::Input_info::obejct): Move to nameless union.
12247         (Incremental_inputs::Input_info::script): Move to nameless union.
12248         (Incremental_inputs::mtime): New field.
12249         * script.cc (read_input_script): Pass file mtime to
12250         Incremental_input.
12251         * script.h (Script_info::inputs): Style fix.
12252
12253 2009-07-01  Ian Lance Taylor  <ian@airs.com>
12254
12255         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
12256         instead of 32.
12257
12258 2009-06-24  Ian Lance Taylor  <iant@google.com>
12259
12260         PR 10156
12261         * layout.cc (Layout::choose_output_section): If we find an
12262         existing section, update the flags.
12263         (Layout::create_notes): New function, broken out of
12264         Layout::finalize.
12265         (Layout::finalize): Don't create note sections.
12266         (Layout::create_note): Don't crash if linker script discards
12267         section.
12268         (Layout::create_gold_note): Likewise.
12269         (Layout::create_build_id): Likewise.  Don't set
12270         after_input_sections on the section.
12271         (Layout::create_executable_stack_info): Remove target parameter.
12272         Change caller.
12273         * layout.h (class Layout): Declare create_notes.  Update
12274         declaration of create_executable_stack_info.
12275         * gold.cc (queue_middle_tasks): Call create_notes.
12276         * output.cc (Output_section::update_flags_for_input_section): Move
12277         here from output.h.  If SHF_ALLOC flag is newly set, mark address
12278         invalid.
12279         * output.h (Output_data::mark_address_invalid): New function.
12280         (class Output_section): Only declare, not define,
12281         update_flags_for_input_section.  Remove set_flags.
12282
12283 2009-06-24  Ian Lance Taylor  <iant@google.com>
12284
12285         * script-sections.cc (Output_section_definition::
12286         set_section_addresses): Rename shadowing local load_address to
12287         laddr.
12288
12289 2009-06-24  Ian Lance Taylor  <iant@google.com>
12290
12291         PR 10244
12292         * reloc.cc (relocate_sections): Skip empty relocation sections.
12293
12294 2009-06-23  Ian Lance Taylor  <iant@google.com>
12295
12296         PR 10156
12297         * layout.cc (Layout::create_note): Use choose_output_section
12298         rather than make_output_section.
12299
12300 2009-06-23  Ian Lance Taylor  <iant@google.com>
12301
12302         PR 10237
12303         * options.cc (General_options::parse_V): Set printed_version_.
12304         (General_options::General_options): Initialize printed_version_.
12305         * options.h (class General_options): Add printed_version_ field.
12306         * gold.cc (queue_initial_tasks): If there are no input files,
12307         don't give a fatal error if we printed the version information.
12308         (queue_middle_tasks): If using -r with a shared object, give a
12309         fatal error rather than an ordinary error.
12310
12311 2009-06-23  Ian Lance Taylor  <iant@google.com>
12312
12313         PR 10219
12314         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
12315         (Layout::make_output_section): Set have_stabstr_section_ if we see
12316         a .stab*str section.
12317         (Layout::finalize): Call link_stabs_sections.
12318         (Layout::link_stabs_sections): New file.
12319         * layout.h (class Layout): Add have_stabstr_section_ field.
12320         Declare link_stabs_sections.
12321
12322 2009-06-23  Doug Kwan  <dougkwan@google.com>
12323
12324         * Makefile.am (libgold_a_LIBADD): New.
12325         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
12326         * Makefile.in: Regenerate.
12327         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
12328         * configure: Regenerate.
12329         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
12330         * fileread.cc: Include sys/state.h
12331         * gold.h: Declare memmem and strndup if found missing.
12332         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
12333
12334 2009-06-23  Ian Lance Taylor  <iant@google.com>
12335
12336         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
12337         * configure: Rebuild.
12338
12339 2009-06-23  Ian Lance Taylor  <iant@google.com>
12340
12341         PR 10147
12342         * object.cc (Object::section_contents): Don't try to get a view if
12343         the section has length zero.
12344         (Object::handle_gnu_warning_section): If the section is empty, use
12345         the name of the section as the warning.
12346
12347 2009-06-23  Ian Lance Taylor  <iant@google.com>
12348
12349         PR 10133
12350         * stringpool.h (class Stringpool_template): Add optimize_ field.
12351         (Stringpool_template::set_optimize): New function.
12352         * stringpool.cc (Stringpool_template::Stringpool_template):
12353         Initialize optimize_ field.
12354         (Stringpool_template::set_string_offsets): Test local optimize
12355         fild rather than parameter.
12356         * layout.cc (Layout::Layout): Call set_optimize on the section
12357         name stringpool.
12358
12359 2009-06-22  Ian Lance Taylor  <iant@google.com>
12360
12361         PR 10030
12362         * yyscript.y: Parse TARGET.
12363         * script.cc (script_set_target): New function.
12364         * script-c.h (script_set_target): Declare.
12365         * options.cc (General_options::string_to_object_format): Rename
12366         from string_to_object_format in anonymous namespace.  Change
12367         callers.
12368         * options.h (class General_options): Declare
12369         string_to_object_format.
12370
12371 2009-06-22  Ian Lance Taylor  <iant@google.com>
12372
12373         * script-sections.cc (Script_sections::create_segments): Don't put
12374         program headers in a PT_LOAD segment if -n or -N.
12375
12376 2009-06-22  Ian Lance Taylor  <iant@google.com>
12377
12378         PR 10141
12379         * options.h (class General_options): Add -z lazy and -z now.  Sort
12380         -z options into alphabetical order.
12381         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
12382
12383 2009-06-21  Ian Lance Taylor  <iant@google.com>
12384
12385         * layout.cc (Layout::make_output_section): Call
12386         Target::new_output_section.
12387         (Layout::attach_allocated_section_to_segment): Put large section
12388         sections in a separate load segment with the large segment flag
12389         set.
12390         (Layout::segment_precedes): Sort large data segments after other
12391         load segments.
12392         (align_file_offset): New static function.
12393         (Layout::set_segment_offsets): Use align_file_offset.
12394         * output.h (class Output_section): Add is_small_section_ and
12395         is_large_section_ fields.
12396         (Output_section::is_small_section): New function.
12397         (Output_section::set_is_small_section):  New function.
12398         (Output_section::is_large_section): New function.
12399         (Output_section::set_is_large_section): New function.
12400         (Output_section::is_large_data_section): New function.
12401         (class Output_segment): Add is_large_data_segment_ field.
12402         (Output_segment::is_large_data_segment): New function.
12403         (Output_segment::set_is_large_data_segment): New function.
12404         * output.cc (Output_section::Output_section): Initialize new
12405         fields.
12406         (Output_segment::Output_segment): Likewise.
12407         (Output_segment::add_output_section): Add assertion that large
12408         data sections always go in large data segments.  Force small data
12409         sections to the end of the list of data sections.  Force small BSS
12410         sections to the start of the list of BSS sections.  For large BSS
12411         sections to the end of the list of BSS sections.
12412         * symtab.h (class Symbol): Declare is_common_shndx.
12413         (Symbol::is_defined): Check Symbol::is_common_shndx.
12414         (Symbol::is_common): Likewise.
12415         (class Symbol_table): Define enum Commons_section_type.  Update
12416         declarations.  Add small_commons_ and large_commons_ fields.
12417         * symtab.cc (Symbol::is_common_shndx): New function.
12418         (Symbol_table::Symbol_table): Initialize new fields.
12419         (Symbol_table::add_from_object): Put small and large common
12420         symbols in the right list.
12421         (Symbol_table::sized_finalized_symbol): Check
12422         Symbol::is_common_shndx.
12423         (Symbol_table::sized_write_globals): Likewise.
12424         * common.cc (Symbol_table::do_allocate_commons): Allocate new
12425         common symbol lists.  Don't call do_allocate_commons_list if the
12426         list is empty.
12427         (Symbol_table::do_allocate_commons_list): Remove is_tls
12428         parameter.  Add comons_section_type parameter.  Change all
12429         callers.  Handle small and large common symbols.
12430         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
12431         Symbol::is_common_shndx.
12432         * resolve.cc (symbol_to_bits): Likewise.
12433         * target.h (Target::small_common_shndx): New function.
12434         (Target::small_common_section_flags): New function.
12435         (Target::large_common_shndx): New function.
12436         (Target::large_common_section_flags): New function.
12437         (Target::new_output_section): New function.
12438         (Target::Target_info): Add small_common_shndx, large_common_shndx,
12439         small_common_section_flags, and large_common_section_flags
12440         fields.
12441         (Target::do_new_output_section): New virtual function.
12442         * arm.cc (Target_arm::arm_info): Initialize new fields.
12443         * i386.cc (Target_i386::i386_info): Likewise.
12444         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
12445         Likewise.
12446         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
12447         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
12448         (Target_x86_64::do_new_output_section): New function.
12449         * configure.ac: Define conditional MCMODEL_MEDIUM.
12450         * testsuite/Makefile.am (check_PROGRAMS): Add large.
12451         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
12452         (large_LDFLAGS): Define.
12453         * testsuite/large.c: New file.
12454         * testsuite/testfile.cc (Target_test::test_target_info):
12455         Initialize new fields.
12456         * configure, testsuite/Makefile.in: Rebuild.
12457
12458 2009-06-05  Doug Kwan  <dougkwan@google.com>
12459
12460         * Makefile.am (CCFILES): Add target.cc.
12461         * Makefile.in: Regenerate.
12462         * i386.cc (class Target_i386): Define new virtual method to
12463         override do_is_local_label_name in parent.
12464         * object.cc (Sized_relobj::do_count_local_symbols): Discard
12465         local symbols if --discard-locals or -X is given.
12466         * options.h (class General_options): Declare new options
12467         '--discard-locals' and '-X' for discarding locals.
12468         * target.h (class Target): Define new methods is_local_label_name.
12469         Declare new virtual method do_is_local_label_name.
12470         * target.cc: New file.
12471         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
12472         (check_SCRIPTS): Add discard_locals_test.sh.
12473         (check_DATA): Add discard_local_tests.syms.
12474         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
12475         (discard_local_tests.syms, discard_locals_test.o): New make rules.
12476         * testsuite/Makefile.in: Regenerate.
12477         * testsuite/discard_locals_test.c: New file.
12478         * testsuite/discard_locals_test.sh: Same.
12479
12480 2009-06-05  Doug Kwan  <dougkwan@google.com>
12481
12482         * object.cc (Sized_relobj::Sized_relobj): Initialize
12483         discarded_eh_frame_shndx_ to -1U.
12484         (Sized_relobj::do_layout): Record index of a discard .eh_frame
12485         section.
12486         (Sized_relobj::do_count_local_symbols): Skip local symbols in
12487         a discarded .eh_frame section.
12488         (Sized_relobj::do_finalize_local_symbols): Ditto.
12489         * object.h (class Sized_relobj): Declare new member
12490         discarded_eh_frame_shndx_.
12491         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
12492         (local_labels_test.o, local_labels_test): New rules.
12493         * testsuite/Makefile.in: Regenerate.
12494
12495 2009-06-04  Doug Kwan  <dougkwan@google.com>
12496
12497         * layout.cc (Layout::section_name_mapping): Add mapping for
12498         special ARM sections.
12499
12500 2009-06-03  Doug Kwan  <dougkwan@google.com>
12501
12502         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
12503         (utils::has_overflow): Same.
12504
12505 2009-06-03  Ian Lance Taylor  <iant@google.com>
12506
12507         * layout.cc (Layout::section_name_mapping): New array, replacing
12508         Layout::linkonce_mapping.
12509         (Layout::section_name_mapping_count): New variable, replacing
12510         Layout::linkonce_mapping_count.
12511         (Layout::linkonce_output_name): Remove.
12512         (Layout::output_section_name): Rewrite.
12513         * layout.h (class Layout): Rename Linkonce_mapping to
12514         Section_name_mapping, linkonce_mapping to section_name_mapping,
12515         linkonce_mapping_count to section_name_mapping_count.  Don't
12516         declare linkonce_output_name.
12517
12518 2009-06-03  Doug Kwan  <dougkwan@google.com>
12519
12520         * gold/arm.cc (namespace utils): New.
12521         (Target_arm::reloc_is_non_pic): Define new method.
12522         (class Arm_relocate_functions): New.
12523         (Target_arm::Relocate::relocate): Handle relocation types used by
12524         Android.
12525
12526 2009-06-03  Ian Lance Taylor  <iant@google.com>
12527
12528         * arm.cc (Target_arm::scan::global): Use || instead of |.
12529
12530 2009-06-02  Doug Kwan  <dougkwan@google.com>
12531
12532         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
12533         issued_non_pic_error_.
12534         (class Target_arm::Scan): Declare new method check_non_pic.
12535         Define new method symbol_needs_plt_entry.
12536         Declare new data member issued_non_pic_error_.
12537         (class Target_arm::Relocate): Declare new method
12538         should_apply_static_reloc.
12539         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
12540         (Target_arm::Scan::check_non_pic): Define new method.
12541         (Target_arm::Scan::local): Handle a small subset of reloc types used
12542         by Android.
12543         (Target_arm::Scan::local): Same.
12544         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
12545
12546 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
12547
12548         * incremental.cc (Incremental_inputs::report_command_line): Filter
12549         out --incremental-* options.
12550
12551 2009-05-29  Doug Kwan  <dougkwan@google.com>
12552
12553         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
12554         template class.
12555         (class Target_arm): Update comment.
12556         (Target_arm::Target_arm): Initialize new data members GOT_,
12557         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
12558         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
12559         and Target_arm::rel_dyn_section.
12560         Declare new_enum Target_arm::Got_type.
12561         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
12562         and DYNBSS_.
12563         Update commments for member do_dynsym_value.
12564         (Target_arm::got_size, Target_arm::plt_section,
12565         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
12566         new methods inside class defintion.
12567         (Target_arm::got_section): Define new method.
12568         (Target_arm::rel_dyn_section): Same.
12569         (Output_data_plt_arm): New template class.
12570         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
12571         (Output_data_plt_arm:do_adjust_output_section): Define new method.
12572         (Output_data_plt_arm::add_entry): Same.
12573         (Output_data_plt_arm::first_plt_entry): Define new
12574         static data member for PLT instruction template.
12575         (Output_data_plt_arm::plt_entry): Same.
12576         (Output_data_plt_arm::do_write): Define new method.
12577         (Target_arm::make_plt_entry): Same.
12578         (Target_arm::do_finalize_sections): Same.
12579         (Target_arm::do_dynsym_value): Same.
12580
12581 2009-05-28  Doug Kwan  <dougkwan@google.com>
12582
12583         * Makefile.am (TARGETSOURCES): Add arm.cc.
12584         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
12585         * Makefile.in: Regenerate.
12586         * arm.cc: New file.
12587         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
12588
12589 2009-05-26  Doug Kwan  <dougkwan@google.com>
12590
12591         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
12592         (General_options::check_excluded_libs): Strip off directories in
12593         archive name before matching like GNU ld does.
12594         * testsuite/Makefile.am (MOSTLYCLEANFILES,
12595         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
12596         (exclude_libs_test_LDFLAGS): Add linker option
12597         -Wl,--exclude-libs,libexclude_libs_test_3
12598         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
12599         an explicit archive without using -l.
12600         (alt/libexclude_libs_test_3.a): New make rule.
12601         * testsuite/Makefile.in: Regenerate.
12602         * testsuite/exclude_libs_test.c : Declare lib3_default().
12603         (main): Call it.
12604         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
12605         * exclude_libs_test_3.c: New file.
12606
12607 2009-05-26  Nick Clifton  <nickc@redhat.com>
12608
12609         * po/id.po: New Indonesian translation.
12610         * po/gold.pot: Updated template file.
12611
12612 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
12613
12614         * testsuite/Makefile.am: Add -ffunction-sections to compile
12615         gc_comdat_test files.  Add -Wl,--gc-sections to build
12616         gc_comdat_test.
12617         * testsuite/Makefile.in: Regenerate.
12618         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
12619
12620 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
12621
12622         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
12623         kept comdat section was garbage collected.
12624         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
12625         * testsuite/Makefile.in: Regenerate.
12626         * testsuite/gc_comdat_test.sh: New file.
12627         * testsuite/gc_comdat_test_1.cc: New file.
12628         * testsuite/gc_comdat_test_2.cc: New file.
12629
12630 2009-05-19  Doug Kwan  <dougkwan@google.com>
12631
12632         * archive.cc (Archive::Archive): Move constructor from archive.h
12633         to here.  Initialize no_export_.
12634         (Archive::get_elf_object_for_member): Set no_export flag of object.
12635         * archive.h (Archive::Archive): Move constructor body to
12636         archive.cc.
12637         (Archive::no_export): New method.
12638         (Archive::no_export_): New field.
12639         * object.h (Object::Object): Initialize no_export_ to false.
12640         (Object::no_export, Object::set_no_export): New methods.
12641         (Object::no_export_): New field.
12642         * options.cc (General_options::parse_exclude_libs): New method.
12643         (General_options::check_excluded_libs) Same.
12644         * options.h (exclude_libs): New option.
12645         (General_options::check_excluded_libs): New method declaration.
12646         (General_options::excluded_libs_): New field.
12647         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
12648         default or protected visibility if an object has no-export flag set.
12649         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
12650         (check_SCRIPTS): Add exclude_libs_test.sh.
12651         (check_DATA): Add exclude_libs_test.syms.
12652         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
12653         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
12654         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
12655         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
12656         (exclude_libs_test.syms, libexclude_libs_test_1.a,
12657         libexclude_libs_test_2.a): New rules.
12658         * testsuite/Makefile.in: Regenerate.
12659         * testsuite/exclude_libs_test.c: New file.
12660         * testsuite/exclude_libs_test.sh: Ditto.
12661         * testsuite/exclude_libs_test_1.c: Ditto.
12662         * testsuite/exclude_libs_test_2.c: Ditto.
12663
12664 2009-05-15  Ian Lance Taylor  <iant@google.com>
12665
12666         * configure.ac: Check for declarations for cases where libiberty.h
12667         checks HAVE_DECL_xxx.
12668         * configure, config.in: Rebuild.
12669
12670 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
12671
12672         * gold.h (Incremental_argument_list): Remove (invalid) forward
12673         declaration.
12674         * incremental.cc (Incremental_inputs::report_achive): New method.
12675         (Incremental_inputs::report_object): New method.
12676         (Incremental_inputs::report_script): New method.
12677         (Incremental_inputs::finalize_inputs): New method.
12678         (Incremental_inputs::finalize): Call finalize_inputs().
12679         (Incremental_inputs::sized_create_incremental_inputs_section_data):
12680         Create inputs entries.
12681         * incremental.h (Incremental_input_type): New enum.
12682         (Incremental_inputs::Incremental_input): Initialize new fields.
12683         (Incremental_inputs::report_inputs): New method.
12684         (Incremental_inputs::report_achive): New method.
12685         (Incremental_inputs::report_object): New method.
12686         (Incremental_inputs::report_script): New method.
12687         (Incremental_inputs::finalize_inputs): New method.
12688         (Incremental_inputs::Input_info): New struct.
12689         (Incremental_inputs::Input_info_map): New typedef.
12690         (Incremental_inputs::lock_): New field.
12691         (Incremental_inputs::Inputs_): New field.
12692         (Incremental_inputs::Inputs_map): New field.
12693         * main.cc (main): Call Incremental_input::report_inputs.
12694         * options.h (Input_argument_list): Typedef moved from
12695         Input_arguments.
12696         (Input_file_group::Files): Remove, use ::Input_argument_list.
12697         (Input_file_group::Input_argument_list): Remove, use
12698         ::Input_argument_list.
12699         * plugin.cc (Plugin_manager::add_input_file): Add error in
12700         incremental build.
12701         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
12702         functions.
12703         * script.cc (read_input_script): Call
12704         Incremental_input::report_script.
12705         * script.h (Script_info): New class.
12706
12707 2009-04-27  Ian Lance Taylor  <iant@google.com>
12708
12709         * x86_64.cc (do_adjust_output_section): Set entsize to
12710         plt_entry_size.
12711
12712 2009-04-23  Elliott Hughes  <enh@google.com>
12713
12714         * output.cc (Output_file::close): After short writes, continue
12715         writing from the correct offset in the buffer being written.
12716
12717 2009-04-23  Chris Demetriou  <cgd@google.com>
12718
12719         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
12720         * configure: Regenerate.
12721         * config.in: Regenerate.
12722         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
12723         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
12724
12725 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
12726
12727         * incremental.cc (Incremental_inputs_header_data): Renamed from
12728         Incremental_input_header_data.
12729         (Incremental_inputs_header_data::data_size): New field.
12730         (Incremental_inputs_header_data::put_input_file_count): Renamed
12731         from input_file_count.
12732         (Incremental_inputs_header_data::put_command_line_offset): Renamed
12733         from command_line_offset.
12734         (Incremental_inputs_header_data::put_reserved): Renamed from
12735         put_reserved.
12736         (Incremental_inputs_entry_data): Renamed from
12737         Incremental_input_entry_data.
12738         (Incremental_inputs_entry_data::data_size): New field.
12739         (Incremental_inputs::report_command_line): New method.
12740         (Incremental_inputs::finalize): New method.
12741         (Incremental_inputs::create_incremental_inputs_data): New method.
12742         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
12743         * incremental.h: New file.
12744         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
12745         (Layout::finalize): Create incremental inputs section in
12746         incremental builds.
12747         (Layout::create_incremental_info_sections): New method.
12748         * layout.h (Layout::incremental_inputs): New method.
12749         (Layout::create_incremental_info_sections): New method.
12750         (Layout::incremental_inputs_): New field.
12751         * main.cc (main): Notify Incremental_input of the command line.
12752
12753 2009-04-01  Ian Lance Taylor  <iant@google.com>
12754             Mikolaj Zalewski  <mikolajz@google.com>
12755
12756         * gold.h (reserve_unordered_map): Define, three versions, one for
12757         each version of Unordered_map.
12758         * layout.cc (Layout::Layout): Remove options parameter.  Add
12759         number_of_input_files parameter.  Don't initialize options_.
12760         Initialize number_of_input_files_ and resized_signatures_.  Move
12761         sections_are_attached_.
12762         (Layout::layout_group): Reserve space for group_signatures_.
12763         (Layout::find_or_add_kept_section): Change name parameter to be a
12764         reference.  Resize signatures_ map when it gets large enough.
12765         (Layout::layout_eh_frame): Use parameters->options() instead of
12766         this->options_.
12767         (Layout::make_output_section): Likewise.
12768         (Layout::attach_allocated_section_to_segment): Likewise.
12769         (Layout::finalize, Layout::create_executable_stack): Likewise.
12770         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
12771         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
12772         * layout.h (class Layout): Update declarations.  Remove options_
12773         field.  Add number_of_input_files_ and resized_signatures_
12774         fields.  Move sections_are_attached_ field.
12775         * main.cc (main): Pass number of input files to Layout
12776         constructor.  Don't pass options.
12777
12778 2009-03-30  Ian Lance Taylor  <iant@google.com>
12779
12780         * ffsll.c (ffsll): Correct implementation.
12781
12782 2009-03-27  Ian Lance Taylor  <iant@google.com>
12783
12784         * ffsll.c: New file.
12785         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
12786         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
12787         * ftruncate.c (ftruncate): Declare before definition.
12788         * mremap.c (mremap): Likewise.
12789         * pread.c (pread): Likewise.
12790         * configure, Makefile.in, config.in: Rebuild.
12791
12792         * mremap.c: New file.
12793         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
12794         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
12795         (mremap): Declare if HAVE_MREMAP is not defined.
12796         * configure, Makefile.in, config.in: Rebuild.
12797
12798 2009-03-27  Cary Coutant  <ccoutant@google.com>
12799
12800         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
12801         position independent.
12802         * sparc.cc (Target_sparc::check_non_pic): Likewise.
12803         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
12804
12805 2009-03-24  Cary Coutant  <ccoutant@google.com>
12806
12807         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
12808         an executable.
12809         (needs_dynamic_reloc): Likewise.
12810
12811 2009-03-24  Ian Lance Taylor  <iant@google.com>
12812
12813         * yyscript.y (file_cmd): Recognize EXTERN.
12814         (extern_name_list, extern_name_list_body): New nonterminals.
12815         * script.cc (script_add_extern): Define.
12816         * script-c.h (script_add_extern): Declare.
12817
12818 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
12819
12820         * object.cc (is_elf_object): Define.
12821         * object.h (is_elf_object): Declare.
12822         * archive.cc (Archive::get_elf_object_for_member): Call
12823         is_elf_object.
12824         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
12825
12826 2009-03-24  Elliott Hughes  <enh@google.com>
12827
12828         * output.cc (Output_file::map_anonymous): Define.
12829         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
12830         try an anonymous one.  Report the size if the mmap fails.
12831         * output.h (class Output_file): Declare map_anonymous.
12832
12833 2009-03-24  Ian Lance Taylor  <iant@google.com>
12834
12835         * target-select.cc (instantiate_target): Don't acquire the lock if
12836         the instantiated_target_ field has already been set.
12837
12838 2009-03-23  Ian Lance Taylor  <iant@google.com>
12839
12840         * gold-threads.h (class Initialize_lock): Define.
12841         * gold-threads.cc (class Initialize_lock_once): Define.
12842         (initialize_lock_control): New static variable.
12843         (initialize_lock_pointer): New static variable.
12844         (initialize_lock_once): New static function.
12845         (Initialize_lock::Initialize_lock): Define.
12846         (Initialize_lock::initialize): Define.
12847         * target-select.h: Include "gold-threads.h".
12848         (class Target_selector): Add lock_ and initialize_lock_ fields.
12849         Don't define instantiate_target, just declare it.
12850         * target-select.cc (Target_selector::Target_selector): Initialize
12851         new fields.
12852         (Target_selector::instantiate_target): Define.
12853         * descriptors.h: Include "gold-threads.h".
12854         (class Descriptors): Add initialize_lock_ field.
12855         * descriptors.cc (Descriptors::Descriptors): Initialize new
12856         field.
12857         (Descriptors::open): Use initialize_lock_ field
12858         * errors.h (class Errors): Add initialize_lock_ field.
12859         * errors.cc (Errors::Errors): Initialize new field.
12860         (Errors::initialize_lock): Use initialize_lock_ field.
12861         * powerpc.cc (class Target_selector_powerpc): Remove
12862         instantiated_target_ field.  In do_recognize call
12863         instantiate_target rather than do_instantiate_target.  In
12864         do_instantiate_target just allocate a new target.
12865         * sparc.cc (class Target_selector_sparc): Likewise.
12866
12867         * freebsd.h: New file.
12868         * i386.cc: Include "freebsd.h".
12869         (Target_i386): Derive from Target_freebsd rather than
12870         Sized_target.
12871         (Target_selector_i386): Derive from Target_selector_freebsd rather
12872         than Target_selector.
12873         * x86_64.cc: Include "freebsd.h".
12874         (Target_x86_64): Derive from Target_freebsd rather than
12875         Sized_target.
12876         (Target_selector_x86_64): Derive from Target_selector_freebsd
12877         rather than Target_selector.
12878         * target.h (class Target): Add adjust_elf_header and
12879         do_adjust_elf_header.
12880         * output.cc (Output_file_header:: do_sized_write): Call target
12881         adjust_elf_header routine.
12882         * configure.tgt: Set targ_osabi.
12883         * configure.ac: Define GOLD_DEFAULT_OSABI.
12884         * parameters.cc (Parameters::default_target): Pass
12885         GOLD_DEFAULT_OSABI to select_target.
12886         * target-select.h (class Target_selector): Make instantiate_target
12887         protected rather than private.
12888         * Makefile.am (HFILES): Add freebsd.h.
12889         * configure, Makefile.in, config.in: Rebuild.
12890
12891         * merge.cc (do_add_input_section): Correct pend value.  Change
12892         message about last entry not being null terminated from error to
12893         warning.
12894
12895 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
12896
12897         * incremental.cc: New file.
12898         * Makefile.am (CCFILES): Add incremental.cc.
12899         * Makefile.in: Rebuild.
12900
12901 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
12902
12903         * layout.cc (Layout::output_section_name): Preserve names
12904         of '.note.' sections.
12905
12906 2009-03-19  Ian Lance Taylor  <iant@google.com>
12907
12908         * descriptors.cc (Descriptors::open): Check that the options are
12909         valid before using them.
12910
12911 2009-03-18  Ian Lance Taylor  <iant@google.com>
12912
12913         * script-sections.h: Include <list>.
12914         (class Script_sections): Change Sections_elements from std::vector
12915         to std::list.  Typedef public Elements_iterator.  Add
12916         orphan_section_placement_, data_segment_align_start_, and
12917         saw_data_segment_align_ fields.  Remove data_segment_align_index_
12918         field.
12919         * script-sections.cc (class Orphan_section_placement): New class.
12920         (class Sections_element): Add virtual functions is_relro and
12921         orphan_section_init.  Remove virtual function place_orphan_here.
12922         (class Output_section_definition): Add is_relro and
12923         orphan_section_init.  Remove place_orphan_here.
12924         (class Orphan_output_section): Likewise.
12925         (Script_sections::Script_sections): Update for field changes.
12926         (Script_sections::data_segment_align): Set saw_data_segment_align_
12927         and data_segment_align_start_, not data_segment_align_index.
12928         (Script_sections::data_segment_relro_end): Check
12929         saw_data_segment_align_.  Use data_segment_align_start_ rather
12930         than data_segment_align_index_.
12931         (Script_sections::place_orphan): Rewrite to use
12932         Orphan_section_placement.
12933
12934 2009-03-17  Ian Lance Taylor  <iant@google.com>
12935
12936         * archive.cc (Archive::add_symbols): Check for a version attached
12937         to the symbol name in the archive map.
12938         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
12939         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
12940         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
12941         (ver_test_11.a): New target.
12942         * testsuite/Makefile.in: Rebuild.
12943
12944         * configure.ac: Check for chsize and posix_fallocate.  Replace
12945         ftruncate.
12946         * ftruncate.c: New file, from gnulib.
12947         * output.cc (posix_fallocate): Define dummy version if not
12948         HAVE_POSIX_FALLOCATE.
12949         (Output_file::map): Call posix_fallocate rather than lseek and
12950         write.
12951         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
12952         * configure, Makefile.in, config.in: Rebuild.
12953
12954 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
12955
12956         * layout.h (Layout::create_note): Add section_name parameter.
12957         * layout.cc (Layout::create_note): Likewise.
12958         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
12959
12960 2009-03-17  Ian Lance Taylor  <iant@google.com>
12961
12962         * descriptors.cc: Include "options.h".
12963         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
12964         (Descriptors::open): Always use O_CLOEXEC when opening a new
12965         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
12966         then set FD_CLOEXEC.
12967
12968         * sparc.cc (class Target_sparc): Add has_got_section.
12969         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
12970         make sure we have a GOT section.
12971
12972         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
12973         (Target_sparc::Scan::local): Likewise.
12974         (Target_sparc::Scan::global): Likewise.
12975         (Target_sparc::Relocate::relocate): Likewise.
12976         (Target_sparc::Relocate::relocate_tls): Likewise.
12977
12978         * symtab.cc (Symbol_table::define_default_version): New function,
12979         broken out of add_from_object.
12980         (Symbol_table::add_from_object): Call define_default_version.
12981         (Symbol_table::define_special_symbol): Add resolve_oldsym
12982         parameter.  Change all callers.  If the version for a symbol comes
12983         from a version script, resolve it with the symbol with the same
12984         name with no version.  Also add the symbol without a version if
12985         appropriate.
12986         (do_define_in_output_data): If resolving with oldsym, don't delete
12987         sym.
12988         (do_define_in_output_segment): Likewise.
12989         (do_define_as_constant): Likewise.
12990         * symtab.h (class Symbol_table): Update declarations.
12991
12992 2009-03-13  Ian Lance Taylor  <iant@google.com>
12993
12994         * readsyms.cc (Read_symbols::incompatible_warning): New function.
12995         (Read_symbols::requeue): New function.
12996         (Read_symbols::do_read_symbols): If make_elf_object fails because
12997         the target type is not configured, and the file was searched for,
12998         issue a warning and retry with the next directory.
12999         (Add_symbols::run): If the file has an incompatible format, and
13000         it was searched for, requeue the Read_symbols task.  On error,
13001         release the object.
13002         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
13003         dirindex parameter to constructor.  Change all callers.  Declare
13004         incompatible_warning and requeue.
13005         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
13006         input_argument_ and input_group_ fields.  Add them to
13007         constructor.  Change all callers.
13008         (class Read_script): Add dirindex_ field.  Add it to constructor.
13009         Change all callers.
13010         * archive.cc (Archive::setup): Remove input_objects parameter.
13011         Change all callers.
13012         (Archive::get_file_and_offset): Likewise.
13013         (Archive::read_all_symbols): Likewise.
13014         (Archive::read_symbols): Likewise.
13015         (Archive::get_elf_object_for_member): Remove input_objects
13016         parameter.  Add punconfigured parameter.  Change all callers.
13017         (Archive::add_symbols): Change return type to bool.  Check return
13018         value of include_member.
13019         (Archive::include_all_members): Likewise.
13020         (Archive::include_member): Change return type to bool.  Return
13021         false if first included object has incompatible target.  Set
13022         included_member_ field.
13023         (Add_archive_symbols::run): If add_symbols returns false, requeue
13024         Read_symbols task.
13025         * archive.h (class Archive): Add included_member_ field.
13026         Initialize it in constructor.  Add input_file and searched_for
13027         methods.  Update declarations.
13028         (class Add_archive_symbols): Add dirpath_, dirindex_, and
13029         input_argument_ fields.  Add them to constructor.  Change all
13030         callers.
13031         * script.cc: Include "target-select.h".
13032         (class Parser_closure): Add skip_on_incompatible_target_ and
13033         found_incompatible_target_ fields.  Add
13034         skip_on_incompatible_target parameter to constructor.  Change all
13035         callers.  Add methods skip_on_incompatible_target,
13036         clear_skip_on_incompatible_target, found_incompatible_target, and
13037         set_found_incompatible_target.
13038         (read_input_script): Add dirindex parameter.  Change all callers.
13039         If parser finds an incompatible target, requeue Read_symbols
13040         task.
13041         (script_set_symbol): Clear skip_on_incompatible_target in
13042         closure.
13043         (script_add_assertion, script_parse_option): Likewise.
13044         (script_start_sections, script_add_phdr): Likewise.
13045         (script_check_output_format): New function.
13046         * script.h (read_input_script): Update declaration.
13047         * script-c.h (script_check_output_format): Declare.
13048         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
13049         (ignore_cmd): Remove OUTPUT_FORMAT.
13050         * fileread.cc (Input_file::Input_file): Add explicit this.
13051         (Input_file::will_search_for): New function.
13052         (Input_file::open): Add pindex parameter.  Change all callers.
13053         * fileread.h (class Input_file): Add input_file_argument method.
13054         Declare will_search_for.  Update declarations.
13055         * object.cc (make_elf_object): Add punconfigured parameter.
13056         Change all callers.
13057         * object.h (class Object): Make input_file public.  Add
13058         searched_for method.
13059         (make_elf_object): Update declaration.
13060         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
13061         restart search.
13062         * dirsearch.h (class Dirsearch): Update declaration.
13063         * options.h (class General_options): Add --warn-search-mismatch.
13064         * parameters.cc (Parameters::is_compatible_target): New function.
13065         * parameters.h (class Parameters): Declare is_compatible_target.
13066         * workqueue.cc (Workqueue::add_blocker): New function.
13067         * workqueue.h (class Workqueue): Declare add_blocker.
13068
13069         * fileread.cc (Input_file::open): Remove options parameter.
13070         Change all callers.
13071         (Input_file::open_binary): Likewise.
13072         * script.cc (read_input_script): Likewise.
13073         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
13074         options parameter from constructor.  Change all callers.
13075         (class Read_script): Likewise.
13076         * fileread.h (class Input_file): Update declarations.
13077         * script.h (read_input_script): Update declaration.
13078
13079 2009-03-10  Nick Clifton  <nickc@redhat.com>
13080
13081         * po/es.po: New Spanish translation.
13082
13083 2009-03-06  Cary Coutant  <ccoutant@google.com>
13084
13085         * options.cc (parse_short_option): Keep dash_z from registering itself.
13086
13087 2009-03-03  Ian Lance Taylor  <iant@google.com>
13088
13089         PR 9918
13090         * target-reloc.h (relocate_section): Pass output_section to
13091         relocate.
13092         * i386.cc (Target_i386::should_apply_static_reloc): Add
13093         output_section parameter.  Change all callers.
13094         (Target_i386::Relocate::relocate): Add output_section parameter.
13095         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
13096         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
13097         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
13098         * testsuite/two_file_shared.sh: New script.
13099         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
13100         (check_DATA): Add two_file_shared.dbg.
13101         (two_file_shared.dbg): New target.
13102         * testsuite/Makefile.in: Rebuild.
13103
13104 2009-03-01  Ian Lance Taylor  <iant@google.com>
13105
13106         * configure.ac: Check for byteswap.h.
13107         * configure: Rebuild.
13108         * config.in: Rebuild.
13109
13110 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
13111
13112         * layout.cc (Layout::find_or_add_kept_section): New function.
13113         (Layout::add_comdat): Removed.
13114         * layout.h (struct Kept_section): Move out of class Layout.
13115         Remove trailing underscores from field names.  Add group_sections
13116         field.  Rename group_ field to is_group.  Change all uses.
13117         (class Layout): Declare find_or_add_kept_section, not add_comdat.
13118         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
13119         comdat_groups_ field.
13120         (Sized_relobj::include_section_group): Use
13121         find_or_add_kept_section and Kept_section::group_sections.
13122         (Sized_relobj::include_linkonce_section): Likewise.
13123         * object.cc (class Sized_relobj): Don't define Comdat_group or
13124         Comdat_group_table.  Remove find_comdat_group and
13125         add_comdat_group.  Remove comdat_groups_ field.
13126         * plugin.cc (include_comdat_group): Use
13127         Layout::find_or_add_kept_section.
13128
13129 2009-02-28  Ian Lance Taylor  <iant@google.com>
13130
13131         * README: --gc-sections and map files are now supported.  Document
13132         some build requirements.
13133
13134         PR 6992
13135         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
13136         relocatable link set the value of the section symbol to zero.
13137         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
13138         relocatable link don't include the section address in the local
13139         symbol value.
13140
13141 2009-02-27  Ian Lance Taylor  <iant@google.com>
13142
13143         PR 6811
13144         * options.h (class Search_directory): Add is_system_directory.
13145         (class General_options): Declare is_in_system_directory.
13146         * options.cc (get_relative_sysroot): Make static.
13147         (get_default_sysroot): Make static.
13148         (General_optoins::is_in_system_directory): New function.
13149         * fileread.cc (Input_file::is_in_system_directory): New function.
13150         * fileread.h (class Input_file): Declare is_in_system_directory.
13151         * object.h (class Object): Add is_in_system_directory.
13152         (class Input_objects): Remove system_library_directory_ field.
13153         * object.cc (Input_objects::add_object): Don't set
13154         system_library_directory_.
13155         (input_objects::found_in_system_library_directory): Remove.
13156         * symtab.cc (Symbol_table::write_globals): Remove input_objects
13157         parameter.  Change all callers.
13158         (Symbol_table::sized_write_globals): Likewise.
13159         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
13160         Call Object::is_in_system_directory.
13161         * symtab.h (class Symbol_table): Update declarations.
13162
13163         PR 5990
13164         * descriptors.h (Open_descriptor): Add is_on_stack field.
13165         * descriptors.cc (Descriptors::open): If the descriptor is on the
13166         top of the stack, remove it.  Initialize is_on_stack field.
13167         (Descriptors::release): Only add pod to stack if it is not on the
13168         stack already.
13169         (Descriptors::close_some_descriptor): Clear stack_next and
13170         is_on_stack fields.
13171
13172         PR 7091
13173         * output.cc (Output_section::find_starting_output_address): Rename
13174         from starting_output_address; add PADDR parameter; change return
13175         type.
13176         * output.h (class Output_section): Declare
13177         find_starting_output_address instead of starting_output_address.
13178         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
13179         section symbol for which we can't find a merge section.
13180
13181         PR 9836
13182         * symtab.cc (Symbol_table::add_from_object): If the visibility is
13183         hidden or internal, force the symbol to be local.
13184         * resolve.cc (Symbol::override_visibility): Define.
13185         (Symbol::override_base): Use override_visibility.
13186         (Symbol_table::resolve): Likewise.
13187         (Symbol::override_base_with_special): Likewise.
13188         (Symbol_table::override_with_special): If the visibility is hidden
13189         or internal, force the symbol to be local.
13190         * symtab.h (class Symbol): Add set_visibility and
13191         override_visibility.
13192         * testsuite/ver_test_1.sh: New file.
13193         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
13194         (check_DATA): Add ver_test_1.syms.
13195         (ver_test_1.syms): New target.
13196         * testsuite/Makefile.in: Rebuild.
13197
13198 2009-02-25  Cary Coutant  <ccoutant@google.com>
13199
13200         * layout.cc (Layout::choose_output_section): Don't rename sections
13201         when using a linker script that has a SECTIONS clause.
13202         * Makefile.in: Regenerate.
13203
13204         * testsuite/Makefile.am (script_test_5.sh): New test case.
13205         * testsuite/Makefile.in: Regenerate.
13206         * testsuite/script_test_5.cc: New file.
13207         * testsuite/script_test_5.sh: New file.
13208         * testsuite/script_test_5.t: New file.
13209
13210 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
13211
13212         * archive.cc (Archive::include_member): Update calls to add_symbols.
13213         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
13214         the Layout argument.
13215         * dynobj.h (do_add_symbols): Add the Layout argument.
13216         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
13217         Layout argument.
13218         * object.h (Object::add_symbols): Add the Layout argument.
13219         (Object::do_add_symbols): Add the Layout argument.
13220         (Sized_relobj::do_add_symbols): Add the Layout argument.
13221         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
13222         Unify the two versions.
13223         (Add_plugin_symbols): Remove.
13224         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
13225         (Sized_pluginobj::do_add_symbols): Unify the two versions.
13226         (Add_plugin_symbols): Remove.
13227         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
13228         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
13229         (Add_symbols::run): Make it work with Pulginobj.
13230
13231 2009-02-06  Ian Lance Taylor  <iant@google.com>
13232
13233         * object.cc (Sized_relobj::do_layout): Make info message start
13234         with lower case letter.
13235
13236 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
13237
13238         * binary.cc: Fix file comment.
13239
13240         * options.h (enum Incremental_disposition): Define.
13241         (class General_options): Add new options: --incremental,
13242         --incremental_changed, --incremental_unchanged,
13243         --incremental_unknown.  Add incremental_disposition_ and
13244         implicit_incremental_ fields.
13245         (General_options::incremental_disposition): New function.
13246         (class Position_dependent_options): Add incremental_disposition
13247         option.
13248         (Position_dependent_options::copy_from_options): Set incremental
13249         dispositions.
13250         * options.cc (General_options::parse_incremental_changed): New
13251         function.
13252         (General_options::parse_incremental_unchanged): New function.
13253         (General_options::parse_incremental_unknown): New function.
13254         (General_options::General_options): Initialize new fields
13255         incremental_disposition_ and implicit_incremental_.
13256         (General_options::finalize): Check for uasge of --incremental-*
13257         without --incremental.
13258
13259 2009-02-06  Chris Demetriou  <cgd@google.com>
13260
13261         * gold.h (gold_undefined_symbol): Change to take only a Symbol
13262         pointer and to report location as the file name associated with
13263         the symbol.
13264         (gold_undefined_symbol_at_location): New function to replace the
13265         old gold_undefined_symbol functionality.
13266         * target-reloc.h (relocate_section): Update to use
13267         gold_undefined_symbol_at_location.
13268         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
13269         Call gold_undefined_symbol function rather than gold_error.
13270         * errors.h (Errors::undefined_symbol): Take location as a
13271         string, rather than calculating it from a relocation.
13272         * errors.cc (Errors::fatal): Print "fatal error:" before the
13273         formatted message.
13274         (Errors::error, Errors::error_at_location): Print "error: "
13275         before the formatted message.
13276         (Errors::undefined_symbol): Take location as a string, rather
13277         than calculating it from a relocation.
13278         (gold_undefined_symbol_at_location): New function akin to
13279         old gold_undefined_symbol, calculates location from relocation.
13280         (gold_undefined_symbol): Change to take only a Symbol pointer
13281         and to report location as the file name associated with the symbol.
13282         * testsuite/debug_msg.sh: Update for changed error messages.
13283         * testsuite/undef_symbol.sh: Likewise.
13284
13285 2009-02-04  Duncan Sands  <baldrick@free.fr>
13286
13287         PR 9812
13288         * reduced_debug_output.h
13289         (Output_reduced_debug_abbrev_section::failed): Use format for
13290         gold_warning.
13291         (Output_reduced_debug_info_section::faild): Likewise.
13292
13293 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
13294
13295         * script.cc (Lazy_demangler): New class.
13296         (Version_script_info::get_symbol_version_helper): Demangle a
13297         symbol only once.
13298
13299 2009-01-29  Cary Coutant  <ccoutant@google.com>
13300
13301         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
13302         to __tls_get_addr.
13303         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
13304
13305 2009-01-28  Ian Lance Taylor  <iant@google.com>
13306
13307         * version.cc (version_string): Bump to 1.9.
13308
13309         * gold.h: Include <cstring> and <stdint.h>.
13310         * version.cc: Include <cstdio>.
13311         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
13312         warning.
13313         * reduced_debug_output.cc (insert_into_vector): Rename from
13314         Insert_into_vector; change all callers.  Use Swap_unaligned to
13315         avoid aliasing issue; remove union since it is unnecessary.
13316
13317 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
13318
13319         * Makefile.am (CCFILES): Add gc.cc.
13320         (HFILES): Add gc.h.
13321         * Makefile.in: Regenerate.
13322         * gold.cc (Gc_runner): New class.
13323         (queue_initial_tasks): Call garbage collection related tasks
13324         when corresponding options are invoked.
13325         (queue_middle_gc_tasks): New function.
13326         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
13327         processed early before laying out sections during garbage collection.
13328         * gold.h (queue_middle_gc_tasks): New function.
13329         (is_prefix_of): Move from "layout.cc".
13330         * i386.cc (Target_i386::gc_process_relocs): New function.
13331         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
13332         * main.cc (main): Create object of class "Garbage_collection".
13333         * object.cc (Relobj::copy_symbols_data): New function.
13334         (Relobj::is_section_name_included): New function.
13335         (Sized_relobj::do_layout): Allow this function to be called twice
13336         during garbage collection and defer layout of section during the
13337         first call.
13338         * object.h (Relobj::get_symbols_data): New function.
13339         (Relobj::is_section_name_included): New function.
13340         (Relobj::copy_symbols_data): New function.
13341         (Relobj::set_symbols_data): New function.
13342         (Relobj::get_relocs_data): New function.
13343         (Relobj::set_relocs_data): New function.
13344         (Relobj::is_output_section_offset_invalid): New pure virtual function.
13345         (Relobj::gc_process_relocs): New function.
13346         (Relobj::do_gc_process_relocs): New pure virtual function.
13347         (Relobj::sd_): New data member.
13348         (Sized_relobj::is_output_section_offset_invalid): New function.
13349         (Sized_relobj::do_gc_process_relocs): New function.
13350         * options.h (General_options::gc_sections): Modify to not be a no-op.
13351         (General_options::print_gc_sections): New option.
13352         * plugin.cc (Plugin_finish::run): Remove function call to
13353         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
13354         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
13355         * reloc.cc (Read_relocs::run): Add task to process relocs and
13356         determine unreferenced sections when doing garbage collection.
13357         (Gc_process_relocs): New class.
13358         (Sized_relobj::do_gc_process_relocs): New function.
13359         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
13360         sections that are garbage collected.
13361         * reloc.h (Gc_process_relocs): New class.
13362         * sparc.cc (Target_sparc::gc_process_relocs): New function.
13363         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
13364         symbols whose corresponding sections are garbage collected.
13365         (Symbol_table::Symbol_table): Add new parameter for the garbage
13366         collection object.
13367         (Symbol_table::gc_mark_undef_symbols): New function.
13368         (Symbol_table::gc_mark_symbol_for_shlib): New function.
13369         (Symbol_table::gc_mark_dyn_syms): New function.
13370         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
13371         as garbage.
13372         (Symbol_table::add_from_object): Likewise.
13373         (Symbol_table::add_from_relobj): When building shared objects, do not
13374         treat externally visible symbols as garbage.
13375         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
13376         table information for static and relocatable links.
13377         * symtab.h (Symbol_table::set_gc): New function.
13378         (Symbol_table::gc): New function.
13379         (Symbol_table::gc_mark_undef_symbols): New function.
13380         (Symbol_table::gc_mark_symbol_for_shlib): New function.
13381         (Symbol_table::gc_mark_dyn_syms): New function.
13382         (Symbol_table::gc_): New data member.
13383         * target.h (Sized_target::gc_process_relocs): New pure virtual
13384         function.
13385         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
13386         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
13387
13388 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
13389
13390         * options.h (General_options::gc_sections): Define as a no-op for now.
13391         (General_options::no_keep_memory): Ditto.
13392         (General_options::Bshareable): Define.
13393         * options.cc (General_options::finalize): Honor -Bshareable.
13394
13395 2009-01-20  Andreas Schwab  <schwab@suse.de>
13396
13397         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
13398         read the value in the contents, since we don't use it.  Use the
13399         template endianness when writing.
13400         (Relocate::relocate): Use it for R_PPC_REL16_HA.
13401
13402 2009-01-19  Andreas Schwab  <schwab@suse.de>
13403
13404         * configure.tgt (powerpc64-*): Fix targ_obj.
13405
13406 2009-01-15  Ian Lance Taylor  <iant@google.com>
13407
13408         * object.cc (Sized_relobj::write_local_symbols): Don't write out
13409         local symbols when stripping all symbols.
13410
13411 2009-01-14  Cary Coutant  <ccoutant@google.com>
13412
13413         * output.cc (Output_reloc): Add explicit instantiations.
13414
13415 2009-01-14  Cary Coutant  <ccoutant@google.com>
13416
13417         * archive.cc (Archive::get_elf_object_for_member): Remove call
13418         to File_read::claim_for_plugin.
13419         * descriptors.cc (Descriptors::open): Remove reference to
13420         is_claimed.
13421         (Descriptors::claim_for_plugin): Remove.
13422         * descriptors.h (Descriptors::claim_for_plugin): Remove.
13423         (Descriptors::is_claimed): Remove.
13424         (claim_descriptor_for_plugin): Remove.
13425         * fileread.cc (File_read::claim_for_plugin): Remove.
13426         * fileread.h (File_read::claim_for_plugin): Remove.
13427         (File_read::descriptor): Reopen descriptor if necessary.
13428         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
13429         (Plugin_manager::all_symbols_read): Add task parameter. Change
13430         all callers.
13431         (Plugin_manager::get_input_file): New function.
13432         (Plugin_manager::release_input_file): New function.
13433         (Pluginobj::Pluginobj): Add filesize parameter and initialize
13434         corresponding data member.
13435         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
13436         and pass to base constructor. Change all callers.
13437         (get_input_file, release_input_file): New functions.
13438         (make_sized_plugin_object): Add filesize parameter. Change all callers.
13439         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
13440         (Plugin_manager::all_symbols_read): Add task parameter.
13441         (Plugin_manager::get_input_file): New function.
13442         (Plugin_manager::release_input_file): New function.
13443         (Plugin_manager::task_): New data member.
13444         (Pluginobj::Pluginobj): Add filesize parameter.
13445         (Pluginobj::filename): New function.
13446         (Pluginobj::descriptor): New function.
13447         (Pluginobj::filesize): New function.
13448         (Pluginobj::filesize_): New data member.
13449         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
13450         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
13451         File_read::claim_for_plugin; use Object::unlock to unlock the file.
13452
13453         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
13454         with archive libraries.
13455         * testsuite/Makefile.in: Regenerate.
13456         * testsuite/plugin_test.c (struct sym_info): New type.
13457         (get_input_file, release_input_file): New static variables.
13458         (onload): Capture new transfer vector entries.
13459         (claim_file_hook): Stop reading at end of file according to filesize.
13460         Factor out parsing of readelf output into separate function.
13461         (all_symbols_read_hook): Exercise get_input_file and release_input_file
13462         APIs and get the source file name from the symbol table.  Convert
13463         source file name to corresponding object file name.  Print info
13464         message when adding new input files.
13465         (parse_readelf_line): New function.
13466         * testsuite/plugin_test_1.sh: Add checks for new info messages.
13467         * testsuite/plugin_test_2.sh: Likewise.
13468         * testsuite/plugin_test_3.sh: Likewise.
13469         * testsuite/plugin_test_4.sh: New test case.
13470
13471 2009-01-07  Ian Lance Taylor  <iant@google.com>
13472
13473         * version.cc (version_string): Bump to 1.8.
13474
13475 2008-12-23  Cary Coutant  <ccoutant@google.com>
13476
13477         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
13478         * plugin.cc (Plugin_manager::finish): Rename as
13479         layout_deferred_objects.  Move cleanup to separate function.
13480         (Plugin_manager::cleanup): New function.
13481         (Plugin_finish::run): Call layout_deferred_objects and cleanup
13482         separately.
13483         * plugin.h (Plugin_manager::finish): Rename as
13484         layout_deferred_objects.
13485         (Plugin_manager::cleanup): New function.
13486         (Plugin_manager::cleanup_done): New field.
13487
13488 2008-12-23  Cary Coutant  <ccoutant@google.com>
13489
13490         * plugin.cc (is_visible_from_outside): New function.
13491         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
13492         so we don't return "IR only" status for exported symbols or -r links.
13493
13494         * testsuite/Makefile.am (plugin_test_3): New test case.
13495         * testsuite/Makefile.in: Regenerate.
13496         * testsuite/plugin_test_3.sh: New file.
13497
13498 2008-12-22  Cary Coutant  <ccoutant@google.com>
13499
13500         * object.cc (Sized_relobj::layout_section): New function.
13501         (Sized_relobj::do_layout): Defer layout of input sections until after
13502         plugin has provided replacement files.
13503         (Sized_relobj::do_layout_deferred_sections): New function.
13504         * object.h (Relobj::set_section_offset): Remove virtual keyword.
13505         (Relobj::layout_deferred_sections): New function.
13506         (Relobj::do_layout_deferred_sections): New function.
13507         (Sized_relobj::do_layout_deferred_sections): New function.
13508         (Sized_relobj::layout_section): New function.
13509         (Sized_relobj::Deferred_layout): New structure.
13510         (Sized_relobj::deferred_layout_): New field.
13511         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
13512         Change all callers.  Layout deferred sections.
13513         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
13514         references.
13515         (Plugin_hook::run): Move code from do_plugin_hook inline.
13516         (Plugin_hook::do_plugin_hook): Remove.
13517         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
13518         (Plugin_manager::finish): Renamed, was cleanup.
13519         (Plugin_manager::should_defer_layout): New function.
13520         (Plugin_manager::add_deferred_layout_object): New function.
13521         (Plugin_manager::Deferred_layout_list): New type.
13522         (Plugin_manager::deferred_layout_objects_): New field.
13523         (Plugin_hook::do_plugin_hook): Remove.
13524
13525 2008-12-17  Ian Lance Taylor  <iant@google.com>
13526
13527         * options.h (class General_options): Add --no case for
13528         --export-dynamic.
13529
13530 2008-12-16  Cary Coutant  <ccoutant@google.com>
13531
13532         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
13533         vector.
13534         (Plugin_manager::claim_file): Create plugin object even if
13535         plugin did not call the add_symbols callback.
13536         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
13537         asking for more symbols than were added.
13538         * testsuite/Makefile.am (plugin_test_1): Add test case with
13539         no global symbols.
13540         (empty.syms): New target.
13541         * testsuite/Makefile.in: Regenerate.
13542         * testsuite/plugin_test.c (claim_file_hook): Add new debug
13543         message. Don't call add_symbols if no globals.
13544         (all_symbols_read_hook): Don't provide replacement for empty
13545         claimed file.
13546
13547 2008-12-12  Ian Lance Taylor  <iant@google.com>
13548
13549         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
13550         r_type == 0 for a local symbol with r_sym == 0.
13551         (scan_relocatable_relocs): Pass r_sym to
13552         local_non_section_strategy.
13553         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
13554         r_sym parameter.
13555
13556         * configure.ac: Update test for TLS descriptors: they are
13557         supported as of glibc 2.9.
13558         * configure: Rebuild.
13559
13560 2008-12-11  Ian Lance Taylor  <iant@google.com>
13561
13562         PR 7091
13563         * target-reloc.h (Default_scan_relocatable_relocs): For each
13564         function, map r_type == 0 to RELOC_DISCARD.
13565
13566 2008-12-10  Cary Coutant  <ccoutant@google.com>
13567
13568         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
13569         object to override a kept COMDAT group from a plugin object.
13570
13571 2008-12-09  Ian Lance Taylor  <iant@google.com>
13572
13573         PR 7088
13574         * yyscript.y (file_cmd): Handle INPUT.
13575
13576         * testsuite/initpri1.c: Change all declarations to be full
13577         prototypes by adding void, to avoid compiler warnings.
13578
13579 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
13580
13581         * options.cc (General_options::parse_plugin_opt): New.
13582         (General_options::add_plugin): The argument now is just the filename.
13583         (General_options::add_plugin_option): New.
13584         * options.h (plugin_opt): New.
13585         (add_plugin): Change argument name.
13586         (add_plugin_option): New.
13587         * plugin.cc (Plugin::load): Don't parse the plugin option.
13588         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
13589         (Plugin::add_option): New.
13590         (Plugin::args_): Change type.
13591         (Plugin::filename_): New.
13592         (Plugin_manager::add_plugin_option): New.
13593         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
13594         * testsuite/Makefile.in: Regenerate.
13595
13596 2008-12-05  Cary Coutant  <ccoutant@google.com>
13597
13598         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
13599         Handle --strip-lto-sections option.
13600         * options.h (strip_lto_sections): New option.
13601
13602 2008-12-01  Cary Coutant  <ccoutant@google.com>
13603
13604         * plugin.cc (ld_plugin_message): Change format parameter to const.
13605         Fix mismatch between new[] and delete.
13606
13607 2008-11-14  Cary Coutant  <ccoutant@google.com>
13608
13609         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
13610         instead of -1U.
13611
13612 2008-11-05  Craig Silverstein  <csilvers@google.com>
13613
13614         * options.cc (General_options::parse_dynamic_list): New function.
13615         * options.h (General_options): New flags dynamic_list,
13616         dynamic_list_data, dynamic_list_cpp_new, and
13617         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
13618         (General_options::in_dynamic_list): New function.
13619         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
13620         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
13621         (Lex::can_continue_name): Likewise.
13622         (yylex): Likewise.
13623         (read_script_file): New parameter script_options.
13624         (read_dynamic_list): New function.
13625         (Script_options::define_dynamic_list): New function.
13626         (dynamic_list_keyword_parsecodes): New variable.
13627         (dynamic_list_keywords): New variable.
13628         * script.h (Script_options::define_dynamic_list): New function
13629         prototype.
13630         (read_dynamic_list): New function prototype.
13631         * symtab.cc (strprefix): New macro.
13632         (Symbol::should_add_dynsym_entry): Support dynamic_list,
13633         dynamic_list_data, dynamic_list_cpp_new, and
13634         dynamic_list_cpp_typeinfo.
13635         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
13636         (dynamic_list_expr): New rule.
13637         (dynamic_list_nodes): Likewise.
13638         (dynamic_list_node): Likewise.
13639         * testsuite/Makefile.am (dynamic_list): New test.
13640         * testsuite/Makefile.in: Regenerated.
13641         * testsuite/dynamic_list.t: New file.
13642         * testsuite/dynamic_list.sh: New file.
13643
13644 2008-11-05  Craig Silverstein  <csilvers@google.com>
13645
13646         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
13647         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
13648         (t11_last): Likewise.
13649         * testsuite/ver_test_6.c (main): Likewise.
13650
13651 2008-10-07  Cary Coutant  <ccoutant@google.com>
13652
13653         * options.c (General_options::finalize): Add check for -static and
13654         -shared.
13655         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
13656         is not empty.
13657
13658 2008-10-02  Cary Coutant  <ccoutant@google.com>
13659
13660         * plugin.cc (make_sized_plugin_object): Fix conditional
13661         compilation to work when not all targets are enabled.
13662
13663 2008-09-29  Cary Coutant  <ccoutant@google.com>
13664
13665         * archive.cc (Archive::get_file_and_offset): Use filename instead
13666         of name to get library path.
13667         (Archive::include_member): Unlock external member of a thin archive.
13668
13669         * testsuite/Makefile.am (TEST_AR): New variable.
13670         (thin_archive_test_1): New test.
13671         (thin_archive_test_2): New test.
13672         * testsuite/Makefile.in: Regenerate.
13673         * testsuite/thin_archive_main.cc: New file.
13674         * testsuite/thin_archive_test_1.cc: New file.
13675         * testsuite/thin_archive_test_2.cc: New file.
13676         * testsuite/thin_archive_test_3.cc: New file.
13677         * testsuite/thin_archive_test_4.cc: New file.
13678
13679 2008-09-29  Cary Coutant  <ccoutant@google.com>
13680
13681         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
13682         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
13683         instead of -1U.
13684         (Sized_relobj::do_finalize_local_symbols): Likewise.
13685         (Sized_relobj::map_to_kept_section): Likewise.
13686         * object.h (Sized_relobj::invalid_address): New constant.
13687         (Sized_relobj::do_output_section_offset): Check for invalid_address
13688         and return -1ULL.
13689         * output.cc (Output_reloc::local_section_offset): Use constant
13690         invalid_address instead of -1U.
13691         (Output_reloc::get_address): Likewise.
13692         (Output_section::output_address): Change -1U to -1ULL.
13693         * output.h (Output_reloc::invalid_address): New constant.
13694         * reloc.cc (Sized_relobj::write_sections): Use constant
13695         invalid_address instead of -1U.
13696         (Sized_relobj::relocate_sections): Likewise.
13697         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
13698         values for merge sections.
13699         * target-reloc.h (relocate_for_relocatable): Use constant
13700         invalid_address instead of -1U.
13701
13702 2008-09-19  Cary Coutant  <ccoutant@google.com>
13703
13704         Add plugin functionality for link-time optimization (LTO).
13705         * configure.ac (plugins): Add --enable-plugins option.
13706         * configure: Regenerate.
13707         * config.in: Regenerate.
13708         * Makefile.am (LIBDL): New variable.
13709         (CCFILES): Add plugin.cc.
13710         (HFILES): Add plugin.h.
13711         (ldadd_var): Add LIBDL.
13712         * Makefile.in: Regenerate.
13713
13714         * archive.cc: Include "plugin.h".
13715         (Archive::setup): Don't preread archive symbols when using a plugin.
13716         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
13717         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
13718         files.
13719         (Archive::include_member): Add symbols from plugin objects.
13720         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
13721         * descriptors.cc (Descriptors::open): Check for file descriptors
13722         abandoned by plugins.
13723         (Descriptors::claim_for_plugin): New function.
13724         * descriptors.h (Descriptors::claim_for_plugin): New function.
13725         (Open_descriptor::is_claimed): New field.
13726         (claim_descriptor_for_plugin): New function.
13727         * fileread.cc (File_read::claim_for_plugin): New function.
13728         * fileread.h (File_read::claim_for_plugin): New function.
13729         (File_read::descriptor): New function.
13730         * gold.cc: Include "plugin.h".
13731         (queue_initial_tasks): Add task to call plugin hooks for generating
13732         new object files.
13733         * main.cc: Include "plugin.h".
13734         (main): Load plugin libraries.
13735         * object.h (Pluginobj): Declare.
13736         (Object::pluginobj): New function.
13737         (Object::do_pluginobj): New function.
13738         (Object::set_target): New function.
13739         * options.cc: Include "plugin.h".
13740         (General_options::parse_plugin): New function.
13741         (General_options::General_options): Initialize plugins_ field.
13742         (General_options::add_plugin): New function.
13743         * options.h (Plugin_manager): Declare.
13744         (General_options): Add --plugin option.
13745         (General_options::has_plugins): New function.
13746         (General_options::plugins): New function.
13747         (General_options::add_plugin): New function.
13748         (General_options::plugins_): New field.
13749         * plugin.cc: New file.
13750         * plugin.h: New file.
13751         * readsyms.cc: Include "plugin.h".
13752         (Read_symbols::do_read_symbols): Check for archive before checking
13753         for ELF file.  Call plugin hooks to claim files.
13754         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
13755         from a real object file; force override when processing replacement
13756         files.
13757         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
13758         (Symbol::init_base_object): Likewise.
13759         (Symbol::init_base_output_data): Likewise.
13760         (Symbol::init_base_output_segment): Likewise.
13761         (Symbol::init_base_constant): Likewise.
13762         (Symbol::init_base_undefined): Likewise.
13763         (Symbol::output_section): Assert that object is not a plugin.
13764         (Symbol_table::add_from_pluginobj): New function.
13765         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
13766         undefined.
13767         (Symbol_table::sized_write_globals): Likewise.
13768         (Symbol_table::add_from_pluginobj): Instantiate template.
13769         * symtab.h (Sized_pluginobj): Declare.
13770         (Symbol::in_real_elf): New function.
13771         (Symbol::set_in_real_elf): New function.
13772         (Symbol::in_real_elf_): New field.
13773         (Symbol_table::add_from_pluginobj): New function.
13774
13775         * testsuite/Makefile.am (AM_CFLAGS): New variable.
13776         (LIBDL): New variable.
13777         (LDADD): Add LIBDL.
13778         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
13779         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
13780         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
13781         (MOSTLYCLEANFILES): Likewise.
13782         * testsuite/Makefile.in: Regenerate.
13783         * testsuite/plugin_test.c: New file.
13784         * testsuite/plugin_test_1.sh: New file.
13785         * testsuite/plugin_test_2.sh: New file.
13786
13787 2008-09-16  Ian Lance Taylor  <iant@google.com>
13788
13789         * target-reloc.h (relocate_section): Check whether a symbol is
13790         defined by the ABI before reporting an undefined symbol error.
13791         * target.h (Target::is_defined_by_abi): Make parameter const.
13792         (Target::do_is_defined_by_abi): Likewise.
13793         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
13794         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
13795         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
13796         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
13797         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
13798         * testsuite/Makefile.in: Rebuild.
13799
13800         * fileread.cc (make_view): Add casts to avoid warning.
13801
13802 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
13803
13804         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
13805         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
13806
13807 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
13808
13809         * options.h (General_options::output_is_executable): New.
13810         (General_options::output_is_pie): New.
13811         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
13812         for shared libraries.
13813         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
13814
13815 2008-09-11  Chris Demetriou  <cgd@google.com>
13816
13817         * options.h (origin): New -z option.
13818         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
13819         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
13820         in DT_FLAGS_1.
13821
13822 2008-09-05  Cary Coutant  <ccoutant@google.com>
13823
13824         * fileread.cc (File_read::make_view): Add check for attempt to map
13825         beyond end of file.
13826
13827 2008-09-05  Cary Coutant  <ccoutant@google.com>
13828
13829         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
13830         explicit instantiations.
13831
13832 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
13833
13834         PR gold/6858
13835         * options.cc (General_options::finalize): Allow undefined symbols
13836         in shlibs if linking -shared.
13837
13838         PR gold/6859
13839         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
13840         symbols as not needing a dynsym entry.
13841
13842 2008-08-20  Craig Silverstein  <csilvers@google.com>
13843
13844         * fileread.cc (File_read::open): Do not lock the file unless it
13845         was successfully opened.
13846
13847 2008-08-14  Cary Coutant  <ccoutant@google.com>
13848
13849         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
13850         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
13851         * testsuite/tls_test.cc (struct int128): 128-bit struct
13852         for testing TLS relocs with non-zero addend.
13853         (v12): New TLS variable.
13854         (t12): New test.
13855         (t_last): Add check for v12.
13856         * testsuite/tls_test.h (t12): New function.
13857         * testsuite/tls_test_main.cc (thread_routine): Call new test.
13858
13859 2008-08-13  Ian Lance Taylor  <iant@google.com>
13860
13861         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
13862         set tls_segment_ or relro_segment_.
13863         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
13864         when appropriate.
13865         * output.h (Output_section::clear_is_relro): New function.
13866         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
13867         sections specially even when output_data_ is empty.
13868         (Output_segment::maximum_alignment): When first section is relro,
13869         only force alignment for PT_LOAD segments.
13870         * script.cc (script_data_segment_align): New function.
13871         (script_data_segment_relro_end): New function.
13872         * script-c.h (script_data_segment_align): Declare.
13873         (script_data_segment_relro_end): Declare.
13874         * script-sections.h (class Script_sections): Declare
13875         data_segment_align and data_segment_relro_end.  Add fields
13876         segment_align_index_ and saw_relro_end_.
13877         * script-sections.cc (class Sections_element): Add set_is_relro
13878         virtual function.  Add new bool* parameter to place_orphan_here.
13879         Add get_output_section virtual function.
13880         (class Output_section_definition): Add set_is_relro.  Add new
13881         bool* parameter to place_orphan_here.  Add get_output_section.
13882         Add is_relro_ field.
13883         (Output_section_definition::Output_section_definition): Initialize
13884         evaluated_address_, evaluated_load_address, evaluated_addralign_,
13885         and is_relro_ fields.
13886         (Output_section_definition::place_orphan_here): Add is_relro
13887         parameter.
13888         (Output_section_definition::set_section_addresses): Set relro for
13889         output section.
13890         (Output_section_definition::alternate_constraint): Likewise.
13891         (class Orphan_output_section): Add new bool* parameter to
13892         place_orphan_here.  Add get_output_section.
13893         (Orphan_output_section::place_orphan_here): Add is_relro
13894         parameter.
13895         (Script_sections::Script_sections): Initialize
13896         data_segment_align_index_ and saw_relro_end_.
13897         (Script_sections::data_segment_align): New function.
13898         (Script_sections::data_segment_relro_end): New function.
13899         (Script_sections::place_orphan): Set or clear is_relro.
13900         (Script_sections::set_section_addresses): Force alignment of first
13901         TLS section.
13902         * yyscript.y (exp): Call script_data_segment_align and
13903         script_data_segment_relro_end.
13904         * testsuite/relro_script_test.t: New file.
13905         * testsuite/relro_test.cc (using_script): Declare.
13906         (t1, t2): Test using_script.
13907         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
13908         (relro_script_test_SOURCES): Define.
13909         (relro_script_test_DEPENDENCIES): Define.
13910         (relro_script_test_LDFLAGS): Define.
13911         (relro_script_test_LDADD): Define.
13912         (relro_script_test.so): New target.
13913         * testsuite/Makefile.in: Rebuild.
13914
13915 2008-08-06  Cary Coutant <ccoutant@google.com>
13916
13917         * archive.cc (Archive::total_archives, Archive::total_members)
13918         (Archive::total_members_loaded): New variables.
13919         (Archive::setup): Add parameter.  Add option to preread
13920         archive symbols.
13921         (Archive::read_armap): Add counter.
13922         (Archive::get_file_and_offset): New function.
13923         (Archive::get_elf_object_for_member): New function.
13924         (Archive::read_all_symbols): New function.
13925         (Archive::read_symbols): New function.
13926         (Archive::add_symbols): Add counters.
13927         (Archive::include_all_members): Use armap to find members if it's
13928         already built.
13929         (Archive::include_member): Skip reading symbols if already read.
13930         Factored code into Archive::get_file_and_offset and
13931         Archive::get_elf_object_for_member.  Changed call to
13932         Mapfile::report_include_archive_member.
13933         (Archive::print_stats): New function.
13934         * archive.h: Declare Object and Read_symbols_data classes.
13935         (Archive::Archive): Add initializers for new members.
13936         (Archive::setup): Add parameter.
13937         (Archive::print_stats): New function.
13938         (Archive::total_archives, Archive::total_members)
13939         (Archive::total_members_loaded): New variables.
13940         (Archive::get_file_and_offset): New function.
13941         (Archive::get_elf_object_for_member): New function.
13942         (Archive::read_all_symbols): New function.
13943         (Archive::read_symbols): New function.
13944         (Archive::Archive_member): New class.
13945         (Archive::members_): New member.
13946         (Archive::num_members_): New member.
13947         * main.cc: Include archive.h.
13948         (main): Call Archive::print_stats.
13949         * mapfile.cc (Mapfile::report_include_archive_member): Delete
13950         archive parameter; member_name is now the fully-decorated name.
13951         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
13952         * options.h: (General_options): Add --preread-archive-symbols option.
13953         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
13954         Archive::setup.
13955
13956 2008-08-04  Ian Lance Taylor  <iant@google.com>
13957
13958         * symtab.h (Symbol::use_plt_offset): New function.
13959         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
13960         * powerpc.cc (Relocate::relocate): Likewise.
13961         * sparc.cc (Relocate::relocate): Likewise.
13962         * x86_64.cc (Relocate::relocate): Likewise.
13963         * testsuite/weak_plt.sh: New test.
13964         * testsuite/weak_plt_main.cc: New test.
13965         * testsuite/weak_plt_shared.cc: New test.
13966         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
13967         (check_PROGRAMS): Add weak_plt.
13968         (check_DATA): Add weak_plt_shared.so.
13969         (weak_plt_main_pic.o, weak_plt): New targets.
13970         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
13971         * testsuite/Makefile.in: Rebuild.
13972
13973         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
13974         gcctestdir/ld.
13975         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
13976         * testsuite/Makefile.in: Rebuild.
13977
13978 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
13979
13980         * Makefile.am (POTFILES.in): Set LC_ALL=C.
13981         * Makefile.in: Regenerate.
13982         * po/POTFILES.in: Regenerate.
13983
13984 2008-07-29  Ian Lance Taylor  <iant@google.com>
13985
13986         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
13987         symbols before other symbols.
13988         * testsuite/script_test_2.cc (test_addr): Declare.
13989         (test_addr_alias): Declare.
13990         (main): Check that test_addr and test_addr_alias have the right
13991         values.
13992         * testsuite/script_test_2.t: Define test_addr_alias and
13993         test_addr.
13994
13995 2008-07-24  Ian Lance Taylor  <iant@google.com>
13996
13997         PR 5990
13998         * descriptors.cc: New file.
13999         * descriptors.h: New file.
14000         * gold-threads.h (class Hold_optional_lock): New class.
14001         * fileread.cc: Include "descriptors.h".
14002         (File_read::~File_read): Release descriptor rather than closing
14003         it.
14004         (File_read::open) [file]: Call open_descriptor rather than open.
14005         Set is_descriptor_opened_.
14006         (File_read::open) [memory]: Assert that descriptor is not open.
14007         (File_read::reopen_descriptor): New function.
14008         (File_read::release): Release descriptor.
14009         (File_read::do_read): Make non-const.  Reopen descriptor.
14010         (File_read::read): Make non-const.
14011         (File_read::make_view): Reopen descriptor.
14012         (File_read::do_readv): Likewise.
14013         * fileread.h (class File_read): Add is_descriptor_opened_ field.
14014         Update declarations.
14015         * layout.cc: Include "descriptors.h".
14016         (Layout::create_build_id): Use open_descriptor rather than open.
14017         * output.cc: Include "descriptors.h".
14018         (Output_file::open): Use open_descriptor rather than open.
14019         * archive.cc (Archive::const_iterator): Change Archive to be
14020         non-const.
14021         (Archive::begin, Archive::end): Make non-const.
14022         (Archive::count_members): Likewise.
14023         * archive.h (class Archive): Update declarations.
14024         * object.h (Object::read): Make non-const.
14025         * Makefile.am (CCFILES): Add descriptors.cc.
14026         (HFILES): Add descriptors.h.
14027         * Makefile.in: Rebuild.
14028
14029         PR 6716
14030         * gold.h: Always include <clocale>.  Add Solaris workarounds
14031         following code in binutils/sysdep.h.
14032
14033         PR 6048
14034         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
14035         this->eh_frame_hdr_ is NULL before using it.
14036
14037         * dynobj.cc (Versions::Versions): Update comment.
14038
14039         * dynobj.cc (Versions::Versions): If there is an soname, use it as
14040         the base version name.
14041
14042         * stringpool.cc (Stringpool_template::add_with_length): Set key to
14043         array size plus one.
14044         (Stringpool_template::set_string_offsets): Subtract one from key
14045         before using it as an array index.
14046         (Stringpool_template::get_offset_with_length): Likewise.
14047         (Stringpool_template::write_to_buffer): Likewise.
14048         * stringpool.h (Stringpool_template::get_offset_from_key):
14049         Likewise.
14050
14051 2008-07-23  Ian Lance Taylor  <iant@google.com>
14052
14053         PR 6658
14054         * object.h (Merged_symbol_value::value): Do our best to handle a
14055         negative addend.
14056
14057         PR 6647
14058         * script.cc (Version_script_info::get_versions): Don't add empty
14059         version tag to return value.
14060         (Version_script_info::get_symbol_version_helper): Change return
14061         type to bool.  Add pversion parameter.  Change all callers.
14062         (script_register_vers_node): Don't require a non-NULL tag.
14063         * script.h (class Version_script_info): Update declarations.
14064         (Version_script_info::get_symbol_version): Change return type to
14065         bool.  Add version parameter.  Change all callers.
14066         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
14067         handling.  Handle an empty version from a version script.
14068         (Symbol_table::define_special_symbol): Likewise.
14069         * testsuite/ver_test_10.script: New file.
14070         * testsuite/ver_test_10.sh: New file.
14071         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
14072         (check_DATA): Add ver_test_10.syms.
14073         (ver_test_10.syms, ver_test_10.so): New target.
14074         * testsuite/Makefile.in: Rebuild.
14075
14076 2008-07-23  Simon Baldwin  <simonb@google.com>
14077
14078         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
14079         to zero for undefined symbols from dynamic libraries.
14080
14081 2008-07-23  Ian Lance Taylor  <iant@google.com>
14082
14083         * symtab.cc (Symbol_table::resolve): Remove version parameter.
14084         Change all callers.
14085         * symtab.h (class Symbol_table): Update declaration.
14086         * testsuite/ver_test_9.cc: New file.
14087         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
14088         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
14089         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
14090         (ver_test_9.so, ver_test_9.o): New targets.
14091         * testsuite/Makefile.in: Rebuild.
14092
14093 2008-07-22  Ian Lance Taylor  <iant@google.com>
14094
14095         * options.h (class General_options): Define --check-sections.
14096         * layout.cc (Layout::set_segment_offsets): Handle
14097         --check-sections.
14098
14099         * options.h (class General_options): Define -n/--nmagic and
14100         -N/--omagic.
14101         * options.cc (General_options::finalize): For -n/--nmagic or
14102         -N/--omagic, set -static.
14103         * layout.cc (Layout::attach_allocated_section_to_segment): If
14104         -N/--omagic, don't put read-only and read-write sections in
14105         different segments.
14106         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
14107         finding a read-only segment.
14108         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
14109         don't set the minimum segment alignment to the common page size,
14110         and don't set the file offset to the address modulo the page size.
14111         * script-sections.cc (Script_sections::create_segments): If
14112         -n/--omagic, don't put read-only and read-write sections in
14113         different segments.
14114
14115         * cref.cc: New file.
14116         * cref.h: New file.
14117         * options.h (class General_options): Add --print-symbol-counts.
14118         * main.cc (main): Issue defined symbol report if requested.
14119         * archive.cc (Archive::interpret_header): Make into a const member
14120         function.
14121         (Archive::add_symbols): Call Input_objects::archive_start and
14122         archive_stop.
14123         (Archive::const_iterator): Define new class.
14124         (Archive::begin, Archive::end): New functions.
14125         (Archive::include_all_members): Rewrite to use iterator.
14126         (Archive::count_members): New function.
14127         * archive.h (class Archive): Update declarations.
14128         (Archive::filename): New function.
14129         * object.cc: Include "cref.h".
14130         (Sized_relobj::Sized_relobj): Initialize defined_count_.
14131         (Sized_relobj::do_get_global_symbol_counts): New function.
14132         (Input_objects::add_object): Add object to cross-referencer.
14133         (Input_objects::archive_start): New function.
14134         (Input_objects::archive_stop): New function.
14135         (Input_objects::print_symbol_counts): New function.
14136         * object.h: Declare Cref and Archive.
14137         (Object::get_global_symbol_counts): New function.
14138         (Object::do_get_global_symbol_counts): New pure virtual function.
14139         (class Sized_relobj): Add defined_count_ field.  Update
14140         declarations.
14141         (class Input_objects): Add cref_ field.  Update constructor.
14142         Update declarations.
14143         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
14144         defined_count_.
14145         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
14146         symbol counts.
14147         (Sized_dynobj::do_get_global_symbol_counts): New function.
14148         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
14149         defined_count_.  Update declarations.  Define Symbols typedef.
14150         * symtab.cc (Symbol_table::add_from_relobj): Add defined
14151         parameter.  Change all callers.
14152         (Symbol_table::add_from_dynobj): Add sympointers and defined
14153         parameters.  Change all callers.
14154         * symtab.h (class Symbol_table): Update declarations.
14155         * Makefile.am (CCFILES): Add cref.cc.
14156         (HFILES): Add cref.h.
14157         * Makefile.in: Rebuild.
14158
14159 2008-07-22  Simon Baldwin  <simonb@google.com>
14160
14161         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
14162         to zero when writing undefined symbols.
14163
14164 2008-07-22  Ian Lance Taylor  <iant@google.com>
14165
14166         * output.cc (Output_section::add_input_section): Don't try to
14167         merge empty merge sections.
14168
14169 2008-07-21  Craig Silverstein  <csilvers@google.com>
14170
14171         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
14172         Include symbol version in error message.
14173
14174 2008-07-20  Chris Demetriou  <cgd@google.com>
14175
14176         * configure.ac (gold_cv_c_random_seed): New configured variable.
14177         (RANDOM_SEED_CFLAGS): New substituted variable.
14178         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
14179         * configure: Rebuild.
14180         * Makefile.in: Likewise.
14181         * testsuite/Makefile.in: Likewise.
14182
14183 2008-07-18  Ian Lance Taylor  <iant@google.com>
14184
14185         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
14186         where we see NAME/NULL and NAME/VERSION  as separate symbols.
14187         * testsuite/ver_test_main.cc (main): Call t4.
14188         (t4, t4_2a): Define.
14189         * testsuite/ver_test_2.cc (t4_2): Define.
14190         * testsuite/ver_test_2.script: Put t4_2a in VER2.
14191         * testsuite/ver_test_4.cc (t4_2a): Define.
14192         * testsuite/ver_test_4.script: Put t4_2a in VER2.
14193         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
14194
14195 2008-07-17  Ian Lance Taylor  <iant@google.com>
14196
14197         * dynobj.cc (Versions::add_def): If we give an error about a
14198         missing version, go ahead and create the version anyhow.
14199
14200 2008-07-10  Ian Lance Taylor  <iant@google.com>
14201
14202         Handle output sections with more than 0x7fffffff bytes.
14203         * object.h (class Relobj): Change map_to_output_ to
14204         output_sections_, and just keep a section pointer.  Change all
14205         uses.  Move comdat group support to Sized_relobj.
14206         (Relobj::is_section_specially_mapped): Remove.
14207         (Relobj::output_section): Remove poff parameter.  Change all
14208         callers.
14209         (Relobj::output_section_offset): New function.
14210         (Relobj::set_section_offset): Rewrite.
14211         (Relobj::map_to_output): Remove.
14212         (Relobj::output_sections): New function.
14213         (Relobj::do_output_section_offset): New pure virtual function.
14214         (Relobj::do_set_section_offset): Likewise.
14215         (class Sized_relobj): Add section_offsets_ field.  Add comdat
14216         group support from Relobj.  Update declarations.
14217         (Sized_relobj::get_output_section_offset): New function.
14218         (Sized_relobj::do_output_section_offset): New function.
14219         (Sized_relobj::do_set_section_offset): New function.
14220         * object.cc (Relobj::output_section_address): Remove.
14221         (Sized_relobj::Sized_relobj): Initialize new fields.
14222         (Sized_relobj::include_section_group): Cast find_kept_object to
14223         Sized_relobj.
14224         (Sized_relobj::include_linkonce_section): Likewise.
14225         (Sized_relobj::do_layout): Use separate arrays for output section
14226         and output offset.
14227         (Sized_relobj::do_count_local_symbols): Change map_to_output to
14228         output_sections.
14229         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
14230         output_sections and section_offsets.
14231         (Sized_relobj::write_local_symbols): Likewise.
14232         (map_to_kept_section): Compute output address directly.
14233         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
14234         output_sections and section_offsets.
14235         (Sized_relobj::write_sections): Likewise.
14236         (Sized_relobj::relocate_sections): Likewise.
14237         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
14238         * output.h (class Output_reloc): Update declarations.  Change
14239         u2_.relobj to Sized_relobj*.
14240         (class Output_data_reloc): Change add functions to use
14241         Sized_relobj*.
14242         * output.cc (Output_reloc::Output_reloc): Change relobj to
14243         Sized_relobj*.
14244         (Output_reloc::local_section_offset): Change return type to
14245         Elf_Addr.  Use get_output_section_offset.
14246         (Output_reloc::get_address): Likewise.
14247         (Output_section::is_input_address_mapped): Don't call
14248         is_section_specially_mapped.
14249         (Output_section::output_offset): Likewise.
14250         (Output_section::output_address): Likewise.
14251         (Output_section::starting_output_address): Likewise.
14252         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
14253         parameter to Sized_relobj*.
14254         (Copy_relocs::need_copy_reloc): Likewise.
14255         (Copy_relocs::save): Likewise.
14256         * copy-relocs.h (class Copy_relocs): Update declarations.
14257         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
14258         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
14259         * target-reloc.h (relocate_for_relocatable): Change
14260         offset_in_output_section type to Elf_Addr.  Change code that uses
14261         it as well.
14262         * layout.cc (Layout::layout): Always set *off.
14263         * mapfile.cc (Mapfile::print_input_section): Use
14264         output_section_offset.
14265         * i386.cc (Target_i386::copy_reloc): Change object parameter to
14266         Sized_relobj*.
14267         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
14268         * sparc.cc (Target_sparc::copy_reloc): Likewise.
14269         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
14270
14271 2008-07-03  Ian Lance Taylor  <iant@google.com>
14272
14273         * layout.cc (Layout::include_section): Do not discard unrecognized
14274         SHT_STRTAB sections.
14275
14276 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
14277
14278         * script.cc (Lex::can_continue_name): Make '?' allowable in
14279         version-script names.
14280         * testsuite/version_script.map: Change glob pattern to use '?'
14281
14282 2008-06-30  Manish Singh  <yosh@gimp.org>
14283
14284         PR 6585
14285         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
14286         Correct typo.
14287
14288 2008-06-30  Ian Lance Taylor  <iant@google.com>
14289
14290         PR 6660
14291         PR 6682
14292         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
14293         versions]: Don't try to read the value in the contents, since we
14294         don't use it.  Use the template endianness when writing.
14295
14296 2008-06-25  Cary Coutant  <ccoutant@google.com>
14297
14298         * fileread.cc (File_read::make_view): Assert on zero-length view.
14299         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
14300         symbol table when there are no symbols to read.
14301
14302 2008-06-23  Craig Silverstein  <csilvers@google.com>
14303
14304         * version.cc (version_string): Bump to 1.7
14305
14306 2008-06-18  Craig Silverstein  <csilvers@google.com>
14307
14308         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
14309         constant 0xFFFF to type Valtype.
14310         (Powerpc_relocate_functions::rel16_ha): Likewise.
14311
14312 2008-06-17  Ian Lance Taylor  <iant@google.com>
14313
14314         * output.h (Output_section::Input_section): Initialize p2align_ to
14315         zero for Output_section_data constructors.
14316         (Output_section::Input_section::addralign): If not an input
14317         section, return the alignment of the Output_section_data.
14318         * testsuite/copy_test.cc: New file.
14319         * testsuite/copy_test_1.cc: New file.
14320         * testsuite/copy_test_2.cc: New file.
14321         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
14322         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
14323         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
14324         (copy_test_1_pic.o, copy_test_1.so): New targets.
14325         (copy_test_2_pic.o, copy_test_2.so): New targets.
14326         * testsuite/Makefile.in: Rebuild.
14327
14328         * script-sections.cc (Script_sections::place_orphan): Initialize
14329         local variable exact.
14330
14331 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
14332
14333         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
14334
14335 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
14336             David S. Miller  <davem@davemloft.net>
14337
14338         * powerpc.cc: New file.
14339         * Makefile.am (TARGETSOURCES): Add powerpc.cc
14340         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
14341         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
14342         * Makefile.in: Rebuild.
14343
14344 2008-06-09  Ian Lance Taylor  <iant@google.com>
14345
14346         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
14347         <exception>.
14348         (throwing, orig_terminate): New static variables.
14349         (terminate_handler): New static function.
14350         (t2): Set terminate handler.
14351
14352 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
14353
14354         PR 6584
14355         * binary.cc (Binary_to_elf::sized_convert): Fix .data
14356         alignment.
14357
14358 2008-05-30  Cary Coutant  <ccoutant@google.com>
14359
14360         * archive.cc (Archive::include_all_members) Correct to step
14361         over symbol table and extended name table in thin archives.
14362
14363 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
14364
14365         PR 6407
14366         * target-reloc.h (relocate_for_relocatable): Fix new_offset
14367         calculation.
14368
14369 2008-05-28  Caleb Howe  <cshowe@google.com>
14370
14371         * reduced_debug_output.cc: New file.
14372         * reduced_debug_output.h: New file.
14373         * options.h (class General_options): Add --strip-debug-non-line.
14374         * options.cc (General_options::finalize): Add strip_debug_non_line
14375         to the strip heirarchy.
14376         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
14377         fields.
14378         * layout.cc: Include "reduced_debug_output.h".
14379         (Layout::Layout): Initialize new fields.
14380         (line_only_debug_sections): New static array.
14381         (is_lines_only_debug_sections): New static inline function.
14382         (Layout::include_section): Handle --strip-debug-non-line.
14383         (Layout::make_output_section): If --strip-debug-non-line, build
14384         new output sections for .debug_abbrev and .debug_info.
14385         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
14386         gold.  Warn about possible overflow.
14387         (read_signed_LEB_128): Likewise.
14388         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
14389         (read_signed_LEB_128): Declare.
14390         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
14391         (HFILES): Add reduced_debug_output.h.
14392         * Makefile.in: Rebuild.
14393
14394 2008-05-21  Ian Lance Taylor  <iant@google.com>
14395
14396         * mapfile.cc: New file.
14397         * mapfile.h: New file.
14398         * options.h (class General_options): Add -M/--print-map and -Map.
14399         * options.cc (General_options::finalize): Make -M equivalent to
14400         -Map -.
14401         * main.cc: Include <cstdio> and "mapfile.h".
14402         (main): Open mapfile if requested.
14403         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
14404         constructor.  Change caller.
14405         (queue_initial_tasks): Add mapfile parameter.  Change caller.
14406         (queue_middle_tasks): Likewise.
14407         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
14408         declarations.
14409         * archive.cc: Include "mapfile.h".
14410         (Archive::add_symbols): Add mapfile parameter.  Change all
14411         callers.  Pass mapfile, symbol, and reason to include_member.
14412         (Archive::include_all_members): Add mapfile parameter.  Change all
14413         callers.
14414         (Archive::include_member): Add mapfile, sym, and why parameters.
14415         Change all callers.  Report inclusion to map file.
14416         * archive.h: Include "fileread.h".
14417         (class Archive): Update declarations.
14418         (Archive::file): New const method.
14419         (class Add_archive_symbols): Add mapfile_ field.  Update
14420         constructor.  Change all callers.
14421         * readsyms.h (class Read_symbols): Likewise.
14422         (class Finish_group): Likewise.
14423         (class Read_script): Likewise.
14424         * common.cc: Include "mapfile.h".
14425         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
14426         all callers.
14427         (Symbol_table::do_allocate_commons): Likewise.
14428         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
14429         symbol allocation to mapfile.
14430         * common.h (class Allocate_commons_task): Add mapfile_ field.
14431         Update constructor.  Change all callers.
14432         * symtab.h (class Symbol_table): Update declarations.
14433         * layout.cc: Include "mapfile.h".
14434         (Layout_task_runner::run): Print information to mapfile.
14435         (Layout::create_gold_note): Change Output_data_fixed_space to
14436         Output_data_zero_fill.
14437         (Layout::create_build_id): Likewise.
14438         (Layout::print_to_mapfile): New function.
14439         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
14440         constructor.  Change caller.
14441         (class Layout): Declare print_to_mapfile.
14442         * output.cc (Output_section::Input_section::print_to_mapfile): New
14443         function.
14444         (Output_section::add_input_section): If producing a map, always
14445         add to input_sections_ list.
14446         (Output_section::do_print_to_mapfile): New function.
14447         (Output_segment::print_sections_to_mapfile): New function.
14448         (Output_segment::print_section_list_to_mapfile): New function.
14449         * output.h: Include "mapfile.h".
14450         (Output_data::print_to_mapfile): New function.
14451         (Output_data::do_print_to_mapfile): New virtual function.
14452         (Output_segment_headers::do_print_to_mapfile): New function.
14453         (Output_file_header::do_print_to_mapfile): New function.
14454         (Output_data_const::do_print_to_mapfile): New function.
14455         (class Output_data_const_buffer): Add map_name_ field.  Update
14456         constructor.  Change all callers.  Add do_print_to_mapfile
14457         function.
14458         (class Output_data_fixed_space): Likewise.
14459         (class Output_data_space): Likewise.
14460         (class Output_data_zero_fill): New class.
14461         (Output_data_strtab::do_print_to_mapfile): New function.
14462         (Output_data_reloc_base::do_print_to_mapfile): New function.
14463         (Output_relocatable_relocs::do_print_to_mapfile): New function.
14464         (Output_data_group::do_print_to_mapfile): New function.
14465         (Output_data_got::do_print_to_mapfile): New function.
14466         (Output_data_dynamic::do_print_to_mapfile): New function.
14467         (Output_symtab_xindex::do_print_to_mapfile): New function.
14468         (class Output_section): Declare do_print_to_mapflie.  Declare
14469         print_to_mapfile in Input_section.
14470         (class Output_segment): Declare new functions.
14471         * object.h (Sized_relobj::symbol_count): New function.
14472         * script-sections.cc
14473         (Output_section_element_dot_assignment::set_section_addresses):
14474         Change Output_data_fixed_space to Output_data_zero_fill.
14475         (Output_data_expression::do_print_to_mapfile): New function.
14476         * script.cc (read_input_script): Add mapfile parameter.  Change
14477         all callers.
14478         * script.h (read_input_script): Update declaration.
14479         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
14480         (Eh_frame::do_print_to_mapfile): New function.
14481         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
14482         (Output_merge_string::do_print_to_mapfile): New function.
14483         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
14484         function.
14485         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
14486         function.
14487         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
14488         function.
14489         * Makefile.am (CCFILES): Add mapfile.cc.
14490         (HFILES): Add mapfile.h.
14491         * Makefile.in: Rebuild.
14492
14493 2008-05-19  Ian Lance Taylor  <iant@google.com>
14494
14495         * options.h (class General_options): Add -z relro.
14496         * layout.cc (Layout::Layout): Initialize relro_segment_.
14497         (Layout::add_output_section_data): Return the output section.
14498         (Layout::make_output_section): Rcognize relro sections and mark
14499         them appropriately.
14500         (Layout::attach_allocated_section_to_segment): Put relro sections
14501         in a PT_GNU_RELRO segment.
14502         (Layout::create_initial_dynamic_sections): Mark the .dynamic
14503         section as relro.
14504         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
14505         PT_TLS segments.
14506         (Layout::linkonce_mapping): Map d.rel.ro.local to
14507         .data.rel.ro.local.
14508         (Layout::output_section_name): Us .data.rel.ro.local for any
14509         section which begins with that.
14510         * layout.h (class Layout): Update add_output_section_data
14511         declaration.  Add relro_segment_ field.
14512         * output.cc (Output_section::Output_section): Initialize is_relro_
14513         and is_relro_local_ fields.
14514         (Output_segment::add_output_section): Group relro sections.
14515         (Output_segment::is_first_section_relro): New function.
14516         (Output_segment::maximum_alignment): If there is a relro section,
14517         align the segment to the common page size.
14518         (Output_segment::set_section_addresses): Track whether we are
14519         looking at relro sections.  If the last section is a relro
14520         section, align to the common page size.
14521         (Output_segment::set_section_list_addresses): Add in_relro
14522         parameter.  Change all callers.  Align to the page size when
14523         moving from relro to non-relro section.
14524         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
14525         segment.
14526         * output.h (class Output_section): Add is_relro_ and
14527         is_relro_local_ fields.
14528         (Output_section::is_relro): New function.
14529         (Output_section::set_is_relro): New function.
14530         (Output_section::is_relro_local): New function.
14531         (Output_section::set_is_relro_local): New function.
14532         (class Output_segment): Update declarations.
14533         * i386.cc (Target_i386::got_section): Mark .got section as relro.
14534         * sparc.cc (Target_sparc::got_section): Likewise.
14535         * x86_64.cc (Target_x86_64::got_section): Likewise.
14536         * testsuite/relro_test_main.cc: New file.
14537         * testsuite/relro_test.cc: New file.
14538         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
14539         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
14540         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
14541         (relro_test.so, relro_test_pic.o): New targets.
14542         * testsuite/Makefile.in: Rebuild.
14543
14544 2008-05-16  Ian Lance Taylor  <iant@google.com>
14545
14546         * output.cc (Output_segment::add_output_section): Remove front
14547         parameter.
14548         * output.h (class Output_segment): Remove
14549         add_initial_output_section and overloaded add_output_section.
14550         Update declaration of remaining add_output_section.
14551         * layout.cc (Layout::create_interp): Call add_output_section
14552         rather than add_initial_output_section.
14553         (Layout::finish_dynamic_section): Likewise.
14554
14555         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
14556         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
14557         know the dynamic type.
14558         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
14559         field.  Initialize it in constructor.
14560         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
14561         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
14562         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
14563         reloc.
14564
14565         * output.cc (Output_reloc::get_address): Change return type to
14566         Elf_Addr.
14567         * output.h (class Output_reloc): Update get_address declaration.
14568         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
14569         for section addresses.
14570
14571 2008-05-09  Ian Lance Taylor  <iant@google.com>
14572
14573         PR 6493
14574         * gold.cc (gold_nomem): Use return value of write.
14575
14576 2008-05-08  Ian Lance Taylor  <iant@google.com>
14577
14578         * symtab.c (Symbol::init_base_output_data): Add version
14579         parameter.  Change all callers.
14580         (Symbol::init_base_output_segment): Likewise.
14581         (Symbol::init_base_constant): Likewise.
14582         (Symbol::init_base_undefined): Likewise.
14583         (Sized_symbol::init_output_data): Likewise.
14584         (Sized_symbol::init_output_segment): Likewise.
14585         (Sized_symbol::init_constant): Likewise.
14586         (Sized_symbol::init_undefined): Likewise.
14587         (Symbol_table::do_define_in_output_data): If the new symbol has a
14588         version, mark it as the default.
14589         (Symbol_table::do_define_in_output_segment): Likewise.
14590         (Symbol_table::do_define_as_constant): Likewise.
14591         * symtab.h (class Symbol): Update declarations.
14592         (class Sized_symbol): Likewise.
14593         * resolve.cc (Symbol::override_version): New function.
14594         (Symbol::override_base): Call override_version.
14595         (Symbol::override_base_with_special): Likewise.
14596         * testsuite/ver_script_8.script: New file.
14597         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
14598         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
14599         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
14600         (ver_test_8_1.so, ver_test_8_2.so): New targets.
14601
14602 2008-05-06  Ian Lance Taylor  <iant@google.com>
14603
14604         PR 6049
14605         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
14606         functions.
14607         (class General_options): Remove existing --undefined, and add
14608         --no-undefined instead.  Add new --undefined as synonym for -u.
14609         * archive.cc (Archive::add_symbols): Check whether symbol was
14610         named with -u.
14611         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
14612         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
14613         all uses.  Add IS_UNDEFINED.  Update declarations to split
14614         different versions of init_base.  Declare init_base_undefined.
14615         (Symbol::is_defined): Handle IS_UNDEFINED.
14616         (Symbol::is_undefined): Likewise.
14617         (Symbol::is_weak_undefined): Call is_undefined.
14618         (Symbol::is_absolute): Handle IS_CONSTANT.
14619         (class Sized_symbol): Update declarations to split different
14620         versions of init.  Declare init_undefined.
14621         (class Symbol_table): Declare new functions.
14622         * symtab.cc (Symbol::init_base_object): Rename from init_base.
14623         Change all callers.
14624         (Symbol::init_base_output_data): Likewise.
14625         (Symbol::init_base_output_segment): Likewise.
14626         (Symbol::init_base_constant): Likewise.
14627         (Symbol::init_base_undefined): New function.
14628         (Sized_symbol::init_object): Rename from init.  Change all
14629         callers.
14630         (Sized_symbol::init_output_data): Likewise.
14631         (Sized_symbol::init_output_segment): Likewise.
14632         (Sized_symbol::init_constant): Likewise.
14633         (Sized_symbol::init_undefined): New function.
14634         (Symbol_table::add_undefined_symbols_from_command_line): New
14635         function.
14636         (Symbol_table::do_add_undefined_symbols_from_command_line): New
14637         function.
14638         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
14639         (Symbol::output_section): Likewise.
14640         (Symbol::set_output_section): Likewise.
14641         (Symbol_table::sized_finalize_symbol): Likewise.
14642         (Symbol_table::sized_write_globals): Likewise.
14643         * resolve.cc (Symbol_table::should_override): Likewise.
14644         (Symbol::override_base_with_special): Likewise.
14645
14646         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
14647         symbol, change it to have default visibility.
14648         * testsuite/protected_1.cc: New file.
14649         * testsuite/protected_2.cc: New file.
14650         * testsuite/protected_3.cc: New file.
14651         * testsuite/protected_main_1.cc: New file.
14652         * testsuite/protected_main_2.cc: New file.
14653         * testsuite/protected_main_3.cc: New file.
14654         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
14655         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
14656         (protected_1_LDFLAGS, protected_1_LDADD): Define.
14657         (protected_1.so): New target.
14658         (protected_1_pic.o, protected_2_pic.o): New targets.
14659         (protected_3_pic.o): New target.
14660         (check_PROGRAMS): Add protected_2.
14661         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
14662         (protected_2_LDFLAGS, protected_2_LDADD): Define.
14663         * testsuite/Makefile.in: Rebuild.
14664
14665         * options.h (DEFINE_var): Add set_user_set_##varname__.
14666         (DEFINE_bool_alias): New macro.
14667         (class General_options): Define -Bstatic using DEFINE_bool_alias
14668         rather than DEFINE_special.  Add --undefined as an alias for -z
14669         defs.
14670         * options.cc (General_options::parse_Bstatic): Remove.
14671
14672         * options.h (class General_options): Add --fatal-warnings.
14673         * main.cc (main): Implement --fatal-warnings.
14674         * errors.h (Errors::warning_count): New function.
14675
14676         * options.h (class General_options): Add -Bsymbolic-functions.
14677         * symtab.h (Symbol::is_preemptible): Check for
14678         -Bsymbolic-functions.
14679
14680 2008-05-05  Ian Lance Taylor  <iant@google.com>
14681
14682         * options.h (DEFINE_bool): For DASH_Z, create the negative option
14683         as noVARNAME rather than no-VARNAME.
14684         (class General_options): Add option -z combreloc.
14685         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
14686         get_address.
14687         (Output_reloc::sort_before) [SHT_REL]: New function.
14688         (Output_reloc::sort_before) [SHT_RELA]: New function.
14689         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
14690         Sort_relocs_comparison.
14691         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
14692         parameter.  Change all callers.
14693         (Output_data_reloc::Output_data_reloc) [both versions]: Add
14694         sort_relocs parameter.  Change all callers.
14695         * output.cc (Output_reloc::get_address): New function, broken out
14696         of write_rel.
14697         (Output_reloc::write_rel): Call it.
14698         (Output_reloc::compare): New function.
14699         (Output_data_reloc_base::do_write): Optionally sort relocs.
14700
14701         * configure.ac: If targ_extra_obj is set, link it in.
14702         * configure.tgt: Initialize all variables.
14703         (x86_64*): Set targ_extra_obj and targ_extra_size.
14704         * configure: Rebuild.
14705
14706         * object.cc (Sized_relobj::include_section_group): Adjust section
14707         indexes read from group data.  Build vector to pass to
14708         layout_group.
14709         * layout.cc (Layout::layout_group): Add flags and shndxes
14710         parameters.  Remove contents parameter.  Change caller.  Update
14711         explicit instantiations.
14712         * layout.h (class Layout): Update layout_group declaration.
14713         * output.cc (Output_data_group::Output_data_group): Add flags and
14714         input_shndxes parameters.  Remove contents parameter.  Change
14715         caller.
14716         (Output_data_group::do_write): Change input_sections_ to
14717         input_shndxes_.
14718         * output.h (class Output_data_group): Update constructor
14719         declaration.  Rename input_sections_ to input_shndxes_.
14720         * testsuite/many_sections_test.cc: Add template.
14721
14722 2008-04-30  Cary Coutant  <ccoutant@google.com>
14723
14724         * target-reloc.h (relocate_section): Fix dead-pointer bug.
14725
14726         * layout.cc (Layout::include_section): Refactored check for debug
14727         info section.
14728         (Layout::add_comdat): Add new parameters.  Change type
14729         of signature parameter.  Add object and shndx to signatures table.
14730         (Layout::find_kept_object): New function.
14731         * layout.h: Include <cstring>.
14732         (Layout::is_debug_info_section): New function.
14733         (Layout::add_comdat): Add new parameters.
14734         (Layout::find_kept_object): New function.
14735         (Layout::Kept_section): New struct.
14736         (Layout::Signatures): Change type of map range.
14737         * object.cc (Relobj::output_section_address): New function.
14738         (Sized_relobj::include_section_group): Add new parameters.  Change
14739         calls to Layout::add_comdat.  Change to build table of kept comdat
14740         groups and table mapping discarded sections to kept sections.
14741         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
14742         (Sized_relobj::do_layout): Change calls to include_section_group and
14743         include_linkonce_section.
14744         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
14745         value to zero when section is discarded.
14746         (Sized_relobj::map_to_kept_section): New function.
14747         * object.h (Relobj::output_section_address): New function.
14748         (Relobj::Comdat_group): New type.
14749         (Relobj::find_comdat_group): New function.
14750         (Relobj::Comdat_group_table): New type.
14751         (Relobj::Kept_comdat_section): New type.
14752         (Relobj::Kept_comdat_section_table): New type.
14753         (Relobj::add_comdat_group): New function.
14754         (Relobj::set_kept_comdat_section): New function.
14755         (Relobj::get_kept_comdat_section): New function.
14756         (Relobj::comdat_groups_): New field.
14757         (Relobj::kept_comdat_sections_): New field.
14758         (Symbol_value::input_value): Update comment.
14759         (Sized_relobj::map_to_kept_section) New function.
14760         (Sized_relobj::include_linkonce_section): Add new parameter.
14761         * target-reloc.h (Comdat_behavior): New type.
14762         (get_comdat_behavior): New function.
14763         (relocate_section): Add code to map a discarded section to the
14764         corresponding kept section when applying a relocation.
14765
14766 2008-04-30  Craig Silverstein  <csilvers@google.com>
14767
14768         * dwarf_reader.cc (next_generation_count): New static var.
14769         (Addr2line_cache_entry): New struct.
14770         (addr2line_cache): New static var.
14771         (Dwarf_line_info::one_addr2line): Added caching.
14772         (Dwarf_line_info::clear_addr2line_cache): New function.
14773         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
14774         cache-size parameter.
14775         (Dwarf_line_info::one_addr2line_cache): New function.
14776         * symtab.cc (Symbol_table::detect_odr_violations): Pass
14777         new cache-size argument to one_addr2line(), and clear cache.
14778
14779 2008-04-28  Cary Coutant  <ccoutant@google.com>
14780
14781         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
14782         R_386_PC8 relocations.
14783
14784 2008-04-23  Ian Lance Taylor  <iant@google.com>
14785
14786         * object.cc (Sized_relobj::include_section_group): Check for
14787         invalid section group.
14788
14789         * object.cc (make_elf_object): Correct test for 64-bit ELF file
14790         header size.
14791
14792         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
14793         than read for file header.
14794         * archive.cc (Archive::include_member): Likewise.
14795
14796 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
14797
14798         * aclocal.m4: Regenerate.
14799         * configure: Regenerate.
14800
14801 2008-04-19  Ian Lance Taylor  <iant@google.com>
14802
14803         * version.cc (version_string): Bump to 1.6.
14804
14805         * testsuite/Makefile.am (many_sections_r_test): New target.
14806         (many_sections_r_test_SOURCES): Remove.
14807         (many_sections_r_test_DEPENDENCIES): Remove.
14808         (many_sections_r_test_LDFLAGS): Remove.
14809         (many_sections_r_test_LDADD): Remove.
14810
14811         * object.cc (Sized_relobj::do_add_symbols): Always pass
14812         local_symbol_count_ to add_from_relobj.
14813
14814         * testsuite/Makefile.am (many_sections_check.h): Only check one in
14815         every thousand variables.
14816         * testsuite/Makefile.in: Rebuild.
14817
14818         * object.cc (Xindex::initialize_symtab_xindex): New function.
14819         (Xindex::read_symtab_xindex): New function.
14820         (Xindex::sym_xindex_to_shndx): New function.
14821         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
14822         available.
14823         (Sized_relobj::do_initialize_xindex): New function.
14824         (Sized_relobj::do_read_symbols): Adjust section links.
14825         (Sized_relobj::symbol_section_and_value): Add is_ordinary
14826         parameter.  Change all callers.
14827         (Sized_relobj::include_section_group): Adjust section links and
14828         symbol section indexes.
14829         (Sized_relobj::do_layout): Adjust section links.
14830         (Sized_relobj::do_count_local_symbols): Adjust section links and
14831         symbol section indexes.
14832         (Sized_relobj::do_finalize_local_symbols): Distinguish between
14833         ordinary and special symbols.
14834         (Sized_relobj::write_local_symbols): Add symtab_xindex and
14835         dynsym_xindex parameters.  Change all callers.  Adjust section
14836         links.  Use SHN_XINDEX when needed.
14837         (Sized_relobj::get_symbol_location_info): Adjust section links.
14838         Don't get fooled by special symbols.
14839         * object.h (class Xindex): Define.
14840         (class Object): Add xindex_ parameter.  Declare virtual functoin
14841         do_initialize_xindex.
14842         (Object::adjust_sym_shndx): New function.
14843         (Object::set_xindex): New protected function.
14844         (class Symbol_value): Add is_ordinary_shndx_ field.
14845         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
14846         (Symbol_value::value): Assert ordinary section.
14847         (Symbol_value::initialize_input_to_output_map): Likewise.
14848         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
14849         Change all callers.
14850         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
14851         all callers.
14852         (class Sized_relobj): Update declarations.
14853         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
14854         parameter.  Change all callers.
14855         (Sized_relobj::adjust_shndx): New function.
14856         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
14857         field.
14858         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
14859         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
14860         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
14861         (Sized_dynobj::read_dynsym_section): Adjust section links.
14862         (Sized_dynobj::read_dynamic): Likewise.
14863         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
14864         section links.
14865         (Sized_dynobj::do_initialize_xindex): New function.
14866         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
14867         do_initialize_xindex.
14868         (Sized_dynobj::adjust_shndx): New function.
14869         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
14870         dynsym_xindex_ fields.
14871         (Layout::finalize): Add a call to set_section_indexes before
14872         creating the symtab sections.
14873         (Layout::set_section_indexes): Don't do anything if the section
14874         already has a section index.
14875         (Layout::create_symtab_sections): Add shnum parameter.  Change
14876         caller.  Create .symtab_shndx section if needed.
14877         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
14878         caller.
14879         (Layout::allocated_output_section_count): New function.
14880         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
14881         needed.
14882         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
14883         fields.  Update declarations.
14884         (Layout::symtab_xindex): New function.
14885         (Layout::dynsym_xindex): New function.
14886         (class Write_symbols_task): Add layout_ field.
14887         (Write_symbols_task::Write_symbols_task): Add layout parameter.
14888         Change caller.
14889         * output.cc (Output_section_headers::Output_section_headers): Add
14890         shstrtab_section parameter.  Change all callers.
14891         (Output_section_headers::do_sized_write): Store overflow values
14892         for section count and section string table section index in
14893         section header zero.
14894         (Output_file_header::do_sized_write): Check for overflow of
14895         section count and section string table section index.
14896         (Output_symtab_xindex::do_write): New function.
14897         (Output_symtab_xindex::endian_do_write): New function.
14898         * output.h (class Output_section_headers): Add shstrtab_section_.
14899         Update declarations.
14900         (class Output_symtab_xindex): Define.
14901         (Output_section::has_out_shndx): New function.
14902         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
14903         field.
14904         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
14905         Change all callers.
14906         (Sized_symbol::init): Likewise.
14907         (Symbol::output_section): Check for ordinary symbol.
14908         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
14909         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
14910         callers.
14911         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
14912         Change all callers.  Simplify handling of symbols from sections
14913         not included in the link.
14914         (Symbol_table::add_from_dynobj): Handle ordinary symbol
14915         distinction.
14916         (Weak_alias_sorter::operator()): Assert that symbols are
14917         ordinary.
14918         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
14919         distinction.
14920         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
14921         parameters.  Change all callers.
14922         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
14923         symbol distinction.  Use SHN_XINDEX when needed.
14924         (Symbol_table::write_section_symbol): Add symtab_xindex
14925         parameter.  Change all callers.
14926         (Symbol_table::sized_write_section_symbol): Likewise.  Use
14927         SHN_XINDEX when needed.
14928         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
14929         declarations.
14930         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
14931         (Symbol::is_defined): Check is_ordinary.
14932         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
14933         (Symbol::is_absolute, Symbol::is_common): Likewise.
14934         (class Sized_symbol): Update declarations.
14935         (class Symbol_table): Update declarations.
14936         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
14937         parameters.  Change all callers.
14938         (Sized_symbol::override): Likewise.
14939         (Symbol_table::override): Likewise.
14940         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
14941         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
14942         is_ordinary, and orig_st_shndx parameters.  Change all callers.
14943         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
14944         to be in an ordinary section.
14945         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
14946         object and is_ordinary parameters.  Change all callers.
14947         (Sized_dwarf_line_info::read_relocs): Add object parameter.
14948         Change all callers.  Don't add undefined or non-ordinary symbols
14949         to reloc_map_.
14950         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
14951         Change all callers.
14952         * dwarf_reader.h (class Sized_dwarf_line_info): Update
14953         declarations.
14954         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
14955         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
14956         (Sized_relobj::relocate_sections): Likewise.
14957         * target-reloc.h (scan_relocs): Adjust section symbol index.
14958         (scan_relocatable_relocs): Likewise.
14959         * i386.cc (Scan::local): Check for ordinary symbols.
14960         * sparc.cc (Scan::local): Likewise.
14961         * x86_64.cc (Scan::local): Likewise.
14962         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
14963         to symbol_section_and_value.
14964         * testsuite/many_sections_test.cc: New file.
14965         * testsuite/Makefile.am (BUILT_SOURCES): Define.
14966         (check_PROGRAMS): Add many_sections_test.
14967         (many_sections_test_SOURCES): Define.
14968         (many_sections_test_DEPENDENCIES): Define.
14969         (many_sections_test_LDFLAGS): Define.
14970         (BUILT_SOURCES): Add many_sections_define.h.
14971         (many_sections_define.h): New target.
14972         (BUILT_SOURCES): Add many_sections_check.h.
14973         (many_sections_check.h): New target.
14974         (check_PROGRAMS): Add many_sections_r_test.
14975         (many_sections_r_test_SOURCES): Define.
14976         (many_sections_r_test_DEPENDENCIES): Define.
14977         (many_sections_r_test_LDFLAGS): Define.
14978         (many_sections_r_test_LDADD): Define.
14979         (many_sections_r_test.o): New target.
14980         * testsuite/Makefile.in: Rebuild.
14981
14982 2008-04-17  Cary Coutant  <ccoutant@google.com>
14983
14984         * errors.cc (Errors::info): New function.
14985         (gold_info): New function.
14986         * errors.h (Errors::info): New function.
14987         * gold.h (gold_info): New function.
14988         * object.cc (Input_objects::add_object): Print trace output.
14989         * options.cc (options::parse_set): New function.
14990         (General_options::parse_wrap): Deleted.
14991         (General_options::General_options): Deleted initializer.
14992         * options.h (options::String_set): New typedef.
14993         (options::parse_set): New function.
14994         (DEFINE_set): New macro.
14995         (General_options::wrap): Changed to use DEFINE_set. Changed
14996         callers of any_wrap_symbols and is_wrap_symbol.
14997         (General_options::trace, General_options::trace_symbol):
14998         New options.
14999         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
15000         (General_options::wrap_symbols_): Deleted.
15001         * symtab.cc (Symbol_table::add_from_object): Print trace output.
15002
15003 2008-04-17  David S. Miller  <davem@davemloft.net>
15004
15005         * options.cc (General_options::parse_V): New function.
15006         * options.h: Add entries for -V and -Qy.
15007
15008 2008-04-17  Ian Lance Taylor  <iant@google.com>
15009
15010         * common.cc (Symbol_table::allocate_commons): Remove options
15011         parameter.  Change caller.
15012         (Symbol_table::do_allocate_commons): Remove options parameter.
15013         Change caller.  Just call do_allocate_commons_list twice.
15014         (Symbol_table::do_allocate_commons_list): New function, broken out
15015         of do_allocate_commons.
15016         * common.h (class Allocate_commons_task): Remove options_ field.
15017         Update constructor.
15018         * symtab.cc (Symbol_table::Symbol_table): Initialize
15019         tls_commons_.
15020         (Symbol_table::add_from_object): Put TLS common symbols on
15021         tls_commons_ list.
15022         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
15023         which are IN_OUTPUT_DATA.
15024         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
15025         allocate_commons and do_allocate_commons declarations.  Declare
15026         do_allocate_commons_list.
15027         * gold.cc (queue_middle_tasks): Update creation of
15028         Allocate_commons_task to not pass options.
15029         * testsuite/Makefile.am (INCLUDES): Add -I.. .
15030         (TLS_TEST_C_FLAGS): New variable.
15031         (tls_test_c_pic.o): New target.
15032         (tls_test_shared.so): Link in tls_test_c_pic.o.
15033         (tls_test_c_pic_ie.o): New target.
15034         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
15035         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
15036         (tls_test_c.o): New target.
15037         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
15038         (tls_pic_test_LDADD): Likewise.
15039         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
15040         (tls_shared_gd_to_ie_test_LDADD): Likewise.
15041         (tls_test_c_gnu2.o): New target.
15042         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
15043         tls_test_c_gnu2.o.
15044         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
15045         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
15046         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
15047         * testsuite/tls_test.cc: Include "config.h".
15048         (t_last): Call t11_last.
15049         * testsuite/tls_test.h (t11, t11_last): Declare.
15050         * testsuite/tls_test_c.c: New file.
15051         * testsuite/tls_test_main.cc (thread_routine): Call t11.
15052         * configure.ac: Check for OpenMP support.
15053         * configure, config.in, Makefile.in: Rebuild.
15054         * testsuite/Makefile.in: Rebuild.
15055
15056 2008-04-16  Cary Coutant  <ccoutant@google.com>
15057
15058         * i386.cc (Target_i386::define_tls_base_symbol): New function.
15059         (Target_i386::tls_base_symbol_defined_): New field.
15060         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
15061         (Target_i386::Scan::global): Likewise.
15062         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
15063         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
15064         (Target_x86_64::tls_base_symbol_defined_): New field.
15065         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
15066         (Target_x86_64::Scan::global): Likewise.
15067
15068 2008-04-16  Cary Coutant  <ccoutant@google.com>
15069
15070         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
15071         (Symbol::needs_plt_entry): Allow weak undefined symbols.
15072         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
15073         building shared libraries.
15074         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
15075         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
15076         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
15077         * testsuite/Makefile.in: Rebuild.
15078         * testsuite/weak_undef.h: New file.
15079         * testsuite/weak_undef_file1.cc: Add extra test cases.
15080         * testsuite/weak_undef_file2.cc: Likewise.
15081         * testsuite/weak_undef_test.cc: Likewise.
15082
15083 2008-04-16  David S. Miller  <davem@davemloft.net>
15084
15085         * sparc.cc (Target_sparc::Scan): Change from struct to class.
15086         Add issued_non_pic_error_ field.  Declare check_non_pic.
15087         (Target_sparc::Scan::check_non_pic): New function.
15088         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
15089         (Target_sparc::Scan::global): Likewise.
15090
15091         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
15092         * configure: Rebuild.
15093
15094         * options.h (DEFINE_enable): New macro.
15095         (new_dtags): New enable option.
15096         (initfirst, interpose, loadfltr, nodefaultlib,
15097         nodelete, nodlopen, nodump): New -z options.
15098         * layout.cc (Layout:finish_dynamic_section): If new
15099         dtags enabled, emit DT_RUNPATH.  Also, emit a
15100         DT_FLAGS_1 containing any specified -z flags.
15101
15102 2008-04-16  Ian Lance Taylor  <iant@google.com>
15103
15104         * copy-relocs.cc: New file.
15105         * copy-relocs.h: New file.
15106         * reloc.cc: Remove Copy_relocs code.
15107         * reloc.h: Likewise.
15108         * reloc-types.h (struct Reloc_types) [both versions]: Add
15109         get_reloc_addend_noerror.
15110         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
15111         variants of add_global which take an addend which must be zero.
15112         * i386.cc: Include "copy-relocs.h".
15113         (class Target_i386): Change type of copy_relocs_ to variable,
15114         update initializer.
15115         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
15116         Change all callers.
15117         (Target_i386::do_finalize_sections): Change handling of
15118         copy_relocs_.
15119         * sparc.cc: Include "copy-relocs.h".
15120         (class Target_sparc): Change type of copy_relocs_ to variable,
15121         update initializer.
15122         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
15123         Change all callers.
15124         (Target_sparc::do_finalize_sections): Change handling of
15125         copy_relocs_.
15126         * x86_64.cc: Include "copy-relocs.h".
15127         (class Target_x86_64): Change type of copy_relocs_ to variable,
15128         update initializer.
15129         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
15130         class.  Change all callers.
15131         (Target_x86_64::do_finalize_sections): Change handling of
15132         copy_relocs_.
15133         * Makefile.am (CCFILES): Add copy-relocs.cc.
15134         (HFILES): Add copy-relocs.h.
15135
15136         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
15137
15138         * testsuite/script_test_4.sh: Permit leading zeroes.
15139
15140 2008-04-15  Ian Lance Taylor  <iant@google.com>
15141
15142         * script-sections.cc (Script_sections::create_segments): Use
15143         header_size_adjustment even when there is enough room for the
15144         headers.
15145         * testsuite/script_test_4.sh: New file.
15146         * testsuite/script_test_4.t: New file.
15147         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
15148         (check_DATA): Add script_test_4.stdout.
15149         (MOSTLYCLEANFILES): Likewise.
15150         (script_test_4): New target.
15151         (script_test_4.stdout): New target.
15152         * testsuite/Makefile.in: Rebuild.
15153
15154         * sparc.cc: Add definitions for Output_data_plt_sparc class
15155         constants.
15156
15157 2008-04-14  David S. Miller  <davem@davemloft.net>
15158
15159         * sparc.cc: New file.
15160         * Makefile.am (TARGETSOURCES): Add sparc.cc
15161         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
15162         * configure.tgt: Document targ_extra_size and
15163         targ_extra_big_endian.  Add entries for sparc-* and
15164         sparc64-*.
15165         * configure.ac: Handle targ_extra_size and
15166         targ_extra_big_endian.
15167         * Makefile.in: Rebuild.
15168         * configure: Likewise.
15169         * po/POTFILES.in: Likewise.
15170         * po/gold.pot: Likewise.
15171
15172 2008-04-14  Ian Lance Taylor  <iant@google.com>
15173
15174         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
15175         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
15176         in the name/type/flags to section mapping.  Don't call
15177         allocate_output_section.
15178         (Layout::choose_output_section): Change parameter from adjust_name
15179         to is_input_section.  Don't permit input sections after sections
15180         are attached to segments.  Don't call allocate_output_section.
15181         (Layout::layout_eh_frame): Call update_flags_for_input_section,
15182         not write_enable_output_section.
15183         (Layout::make_output_section): Don't push to
15184         unattached_section_list_ nor call attach_to_segment.  Call
15185         attach_section_to_segment if sections are attached.
15186         (Layout::attach_sections_to_segments): New function.
15187         (Layout::attach_section_to_segment): New function.
15188         (Layout::attach_allocated_section_to_segment): Rename from
15189         attach_to_segment.  Remove flags parameter.
15190         (Layout::allocate_output_section): Remove function.
15191         (Layout::write_enable_output_section): Remove function.
15192         * layout.h (class Layout): Update for above changes.  Add new
15193         field sections_are_attached_.
15194         * output.h (Output_section::update_flags_for_input_section): New
15195         function.
15196         * output.cc (Output_section::add_input_section): Call
15197         update_flags_for_input_section.
15198         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
15199
15200 2008-04-11  Cary Coutant  <ccoutant@google.com>
15201
15202         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
15203         thought unnecessary.
15204         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
15205
15206 2008-04-11  Ian Lance Taylor  <iant@google.com>
15207
15208         * output.h (class Output_section_data): Remove inline definition
15209         of set_addralign.
15210         * output.cc (Output_section_data::set_addralign): New function.
15211
15212 2008-04-11  Cary Coutant  <ccoutant@google.com>
15213
15214         Add support for TLS descriptors for i386 and x86_64.
15215         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
15216         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
15217         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
15218         GOT_TYPE_TLS_DESC.
15219         (Target_i386::got_mod_index_entry): Remove unnecessary code.
15220         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
15221         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
15222         relocations.
15223         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
15224         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
15225         Fix problem with initial-exec relocations.
15226         (Target_i386::Relocate::relocate_tls): Likewise.
15227         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
15228         relaxation.
15229         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
15230         support for section-plus-offset dynamic table entries.
15231         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
15232         (Output_data_dynamic::Dynamic_entry): Add support for
15233         section-plus-offset dynamic table entries.
15234         (Output_data_dynamic::Classification): Likewise.
15235         (Output_data_dynamic::classification_): Renamed offset_.
15236         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
15237         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
15238         (Target_x86_64::make_plt_section): New function.
15239         (Target_x86_64::reserve_tlsdesc_entries): New function.
15240         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
15241         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
15242         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
15243         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
15244         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
15245         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
15246         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
15247         add extra PLT entry for TLS descriptors.
15248         (Output_data_plt_x86_64::got_): New field.
15249         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
15250         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
15251         fields.
15252         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
15253         descriptors.
15254         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
15255         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
15256         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
15257         R_386_TLS_DESC_CALL relocations.
15258         (Target_x86_64::Scan::global): Likewise.
15259         (Target_x86_64::do_finalize_sections): Add dynamic table entries
15260         for TLS descriptors.
15261         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
15262         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
15263         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
15264         GD-to-IE relaxation.
15265         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
15266         and TLS_DESCRIPTORS.
15267         * Makefile.in: Rebuild.
15268         * configure: Rebuild.
15269         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
15270         (tls_test_shared2.so): New target.
15271         (tls_shared_gd_to_ie_test_SOURCES): New variable.
15272         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
15273         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
15274         (tls_shared_gd_to_ie_test_LDADD): New variable.
15275         (tls_shared_gnu2_gd_to_ie_test): New target.
15276         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
15277         New targets.
15278         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
15279         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
15280         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
15281         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
15282         (tls_shared_gnu2_test): New target.
15283         (tls_test_gnu2_shared.so): New target.
15284         (tls_shared_gnu2_test_SOURCES): New variable.
15285         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
15286         (tls_shared_gnu2_test_LDFLAGS): New variable.
15287         (tls_shared_gnu2_test_LDADD): New variable.
15288         * testsuite/Makefile.in: Rebuild.
15289         * testsuite/Makefile.
15290
15291 2008-04-11  Ian Lance Taylor  <iant@google.com>
15292
15293         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
15294         justsyms.t.
15295         * testsuite/Makefile.in: Rebuild.
15296
15297         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
15298         long.
15299         * testsuite/script_test_2.cc (main): Adjust test.
15300
15301 2008-04-11  David S. Miller  <davem@davemloft.net>
15302             Ian Lance Taylor  <iant@google.com>
15303
15304         * options.h (General_options): Add entries for '-Y' and
15305         '-relax'.
15306         * options.cc (General_options:finalize): If -Y was used, add those
15307         entries to the library path instead of the default "/lib" and
15308         "/usr/lib".
15309
15310 2008-04-11  David S. Miller  <davem@davemloft.net>
15311
15312         * testsuite/justsyms.t: Start at 0x100.
15313         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
15314         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
15315         long.
15316         * testsuite/script_test_2.cc: Adjust string and section length
15317         checks.
15318
15319 2008-04-09  Ian Lance Taylor  <iant@google.com>
15320
15321         PR gold/5996
15322         * script-sections.cc (Sections_element::allocate_to_segment): Add
15323         orphan parameter.
15324         (Output_section_definition::allocate_to_segment): Likewise.
15325         (Orphan_output_section::allocate_to_segment): Likewise.
15326         (Script_sections::attach_sections_using_phdrs_clause): Don't
15327         propagate non-PT_LOAD segments to orphan sections.
15328         * testsuite/Makefile.am (script_test_3.stdout): Generate using
15329         readelf rather than objdump.
15330         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
15331         .interp section and PT_INTERP segment are the same size.
15332         * testsuite/Makefile.in: Rebuild.
15333
15334         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
15335         aliases for symbols defined in the same object.
15336         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
15337         (weak_alias_test_SOURCES): New variable.
15338         (weak_alias_test_DEPENDENCIES): New variable.
15339         (weak_alias_test_LDFLAGS): New variable.
15340         (weak_alias_test_LDADD): New variable.
15341         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
15342         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
15343         (weak_alias_test_3.o): New target.
15344         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
15345         * testsuite/weak_alias_test_main.cc: New file.
15346         * testsuite/weak_alias_test_1.cc: New file.
15347         * testsuite/weak_alias_test_2.cc: New file.
15348         * testsuite/weak_alias_test_3.cc: New file.
15349
15350 2008-04-08  Ian Lance Taylor  <iant@google.com>
15351
15352         * options.h (class General_options): Add --noinhibit-exec option.
15353         * main.cc (main): Check --noinhibit-exec.
15354
15355         * options.h (class General_options): Define --wrap as a special
15356         option.  Add wrap_symbols_ field.
15357         (General_options::any_wrap_symbols): New function.
15358         (General_options::is_wrap_symbol): New function.
15359         * options.cc (General_options::parse_wrap): New function.
15360         (General_options::General_options): Initialize wrap_symbols_.
15361         * symtab.cc (Symbol_table::wrap_symbol): New function.
15362         (Symbol_table::add_from_object): Handle --wrap.
15363         * symtab.h (class Symbol_table): Declare wrap_symbol.
15364         * target.h (Target::wrap_char): New function.
15365         (Target::Target_info): Add wrap_char field.
15366         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
15367         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
15368         * testsuite/testfile.cc (Target_test::test_target_info):
15369         Likewise.
15370
15371         * errors.cc (Errors::undefined_symbol): Mention symbol version if
15372         there is one.
15373
15374         * layout.h (class Layout): Add added_eh_frame_data_ field.
15375         * layout.cc (Layout::Layout): Initialize new field.
15376         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
15377         output section until we find a section we merged successfully.
15378         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
15379         that the size be non-zero.
15380
15381         * merge.cc (Object_merge_map::get_output_offset): Remove inline
15382         qualifier.
15383
15384 2008-04-08  Craig Silverstein  <csilvers@google.com>
15385
15386         * configure.ac: Export new conditional variable HAVE_ZLIB.
15387         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
15388         on HAVE_ZLIB.
15389         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
15390         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15391
15392 2008-04-07  Ian Lance Taylor  <iant@google.com>
15393
15394         * version.cc (version_string): Set to "1.5".
15395
15396         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
15397         Add issued_non_pic_error_ field.  Declare check_non_pic.
15398         (Target_x86_64::Scan::check_non_pic): New function.
15399         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
15400         (Target_x86_64::Scan::global): Likewise.
15401
15402         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
15403         addend parameter.  Change caller.  Handle merge sections.
15404         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
15405         Address to Addend.  Don't add in the result of
15406         local_section_offset, pass down the addend and use the returned
15407         value.
15408         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
15409         Update declarations of local_section_offset and symbol_value.
15410         * testsuite/two_file_test_1.cc (t18): New function.
15411         * testsuite/two_file_test_2.cc (f18): New function.
15412         * testsuite/two_file_test_main.cc (main): Call t18.
15413         * testsuite/two_file_test.h (t18, f18): Declare.
15414
15415         * configure.ac: Don't test for objdump, c++filt, or readelf.
15416         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
15417         conditionals.
15418         (TEST_READELF): New variable.
15419         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
15420         (check_PROGRAMS): Add two_file_strip_test.
15421         (two_file_strip_test): New target.
15422         (check_PROGRAMS): Add two_file_same_shared_strip_test.
15423         (two_file_same_shared_strip_test_SOURCES): New variable.
15424         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
15425         (two_file_same_shared_strip_test_LDFLAGS): New variable.
15426         (two_file_same_shared_strip_test_LDADD): New variable.
15427         (two_file_shared_strip.so): New target.
15428         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
15429         (ver_test_5.syms, ver_test_7.syms): Likewise.
15430         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
15431         (strip_test_3.stdout): Use TEST_OBJDUMP.
15432         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15433
15434 2008-04-04  Cary Coutant  <ccoutant@google.com>
15435
15436         * symtab.h (Symbol::is_weak_undefined): New function.
15437         (Symbol::is_strong_undefined): New function.
15438         (Symbol::is_absolute): New function.
15439         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
15440         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
15441         absolute symbols.
15442         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
15443         (weak_undef_test): New target.
15444         * testsuite/Makefile.in: Rebuild.
15445         * testsuite/weak_undef_file1.cc: New file.
15446         * testsuite/weak_undef_file2.cc: New file.
15447         * testsuite/weak_undef_test.cc: New file.
15448
15449 2008-04-03  Craig Silverstein  <csilvers@google.com>
15450
15451         * compressed_output.h (class Output_compressed_section): Use
15452         unsigned buffer.
15453         * compressed_output.cc (zlib_compress): Use unsigned buffers,
15454         add zlib header.
15455         (zlib_compressed_suffix): Removed.
15456         (Output_compressed_section::set_final_data_size): Use unsigned
15457         buffers.
15458         * testsuite/Makefile.am (flagstest_compress_debug_sections):
15459         Fix linker invocation.
15460         (flagstest_o_specialfile_and_compress_debug_sections):
15461         Likewise.
15462         * testsuite/Makefile.in: Regenerated.
15463
15464 2008-04-02  David S. Miller  <davem@davemloft.net>
15465
15466         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
15467         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
15468
15469 2008-04-02  Craig Silverstein  <csilvers@google.com>
15470
15471         * TODO: New file.
15472
15473 2008-04-02  Ian Lance Taylor  <iant@google.com>
15474
15475         * fileread.cc (File_read::find_view): Add byteshift and vshifted
15476         parameters.  Update for new key type to views_.  Change all
15477         callers.
15478         (File_read::read): Adjust for byteshift in returned view.
15479         (File_read::add_view): New function, broken out of
15480         find_and_make_view.
15481         (File_read::make_view): New function, broken out of
15482         find_and_make_view.
15483         (File_read::find_or_make_view): Add offset and aligned
15484         parameters.  Rewrite accordingly.  Change all callers.
15485         (File_read::get_view): Add offset and aligned parameters.  Adjust
15486         for byteshift in return value.
15487         (File_read::get_lasting_view): Likewise.
15488         * fileread.h (class File_read): Update declarations.
15489         (class File_read::View): Add byteshift_ field.  Add byteshift to
15490         constructor.  Add byteshift method.
15491         * archive.h (Archive::clear_uncached_views): New function.
15492         (Archive::get_view): Add aligned parameter.  Change all callers.
15493         * object.h (Object::get_view): Add aligned parameter.  Change all
15494         callers.
15495         (Object::get_lasting_view): Likewise.
15496
15497         * fileread.cc (File_read::release): Don't call clear_views if
15498         there are multiple objects.
15499         * fileread.h (File_read::clear_uncached_views): New function.
15500         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
15501         on the archive.
15502
15503 2008-03-31  Cary Coutant  <ccoutant@google.com>
15504
15505         Add thin archive support.
15506         * archive.cc (Archive::armagt): New const.
15507         (Archive::setup): Remove task parameter and calls to unlock.
15508         (Archive::unlock_nested_archives): New function.
15509         (Archive::read_header): Add nested_off parameter. Change
15510         all callers.
15511         (Archive::interpret_header): Likewise.
15512         (Archive::include_all_members): Change to handle thin
15513         archives.
15514         (Archive::include_member): Likewise.
15515         * archive.h (Archive::Archive): Add new parameters and
15516         initializers.
15517         (Archive::armagt): New const.
15518         (Archive::setup): Remove task parameter.
15519         (Archive::unlock_nested_archives): New function.
15520         (Archive::read_header): Add nested_off parameter.
15521         (Archive::interpret_header): Likewise.
15522         (Archive::Nested_archive_table): New typedef.
15523         (Archive::is_thin_archive_): New field.
15524         (Archive::nested_archives_): New field.
15525         (Archive::options_): New field.
15526         (Archive::dirpath_): New field.
15527         (Archive::task_): New field.
15528         * readsyms.cc (Read_symbols::do_read_symbols): Add check
15529         for thin archives.  Pass additional parameters to
15530         Archive::Archive.  Unlock the archive file after calling
15531         Archive::setup.
15532
15533 2008-03-29  Ian Lance Taylor  <iant@google.com>
15534
15535         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
15536         version symbol to be local.
15537         * testsuite/ver_test_4.sh: New file.
15538         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
15539         (check_DATA): Add ver_test_4.syms.
15540         (ver_test_4.syms): New target.
15541         * testsuite/Makefile.in: Rebuild.
15542
15543         * output.cc
15544         (Output_section::Input_section_sort_entry::has_priority): New
15545         function.
15546         (Output_section::Input_section_sort_entry::match_file_name): New
15547         function.
15548         (Output_section::Input_section_sort_entry::match_section_name):
15549         Remove.
15550         (Output_section::Input_section_sort_entry::match_section_name_prefix):
15551         Remove.
15552         (Output_section::Input_section_sort_entry::match_section_file):
15553         Remove.
15554         (Output_section::Input_section_sort_compare::operator()): Rewrite
15555         using new Input_section_sort_entry functions.  Sort crtbegin and
15556         crtend first.  Sort sections with no priority before sections with
15557         a priority.
15558         * testsuite/initpri1.c (d3): Check j != 4.
15559         (cd5): New constructor/destructor function.
15560         (main): Check j != 2.
15561
15562         * symtab.cc (Symbol_table::add_from_object): If we don't use the
15563         new symbol when resolving, don't call set_is_default.
15564         * testsuite/ver_test_7.cc: New file.
15565         * testsuite/ver_test_7.sh: New file.
15566         * testsuite/Makefile.am (ver_test_7.so): New target.
15567         (ver_test_7.o): New target.
15568         (check_SCRIPTS): Add ver_test_7.sh.
15569         (check_DATA): Add ver_test_7.syms.
15570         (ver_test_7.syms): New target.
15571
15572 2008-03-28  Ian Lance Taylor  <iant@google.com>
15573
15574         * layout.cc (Layout::layout): If we see an input section with a
15575         name that needs sorting, set the must_sort flag for the output
15576         section.
15577         (Layout::make_output_section): If the name of the output section
15578         indicates that it might require sorting, set the may_sort flag.
15579         * output.h (Output_section::may_sort_attached_input_sections): New
15580         function.
15581         (Output_section::set_may_sort_attached_input_sections): New
15582         function.
15583         (Output_section::must_sort_attached_input_sections): New
15584         function.
15585         (Output_section::set_must_sort_attached_input_sections): New
15586         function.
15587         (class Output_section): Declare Input_section_sort_entry.  Define
15588         Input_section_sort_compare.  Declare
15589         sort_attached_input_sections.  Add new fields:
15590         may_sort_attached_input_sections_,
15591         must_sort_attached_input_sections_,
15592         attached_input_sections_are_sorted_.
15593         * output.cc (Output_section::Output_section): Initialize new
15594         fields.
15595         (Output_section::add_input_section): Add an entry to
15596         input_sections_ if may_sort or must_sort are true.
15597         (Output_section::set_final_data_size): Call
15598         sort_attached_input_sections if necessary.
15599         (Output_section::Input_section_sort_entry): Define new class.
15600         (Output_section::Input_section_sort_compare::operator()): New
15601         function.
15602         (Output_section::sort_attached_input_sections): New function.
15603         * configure.ac: Check whether the compiler supports constructor
15604         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
15605         * testsuite/initpri1.c: New file.
15606         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
15607         CONSTRUCTOR_PRIORITY.
15608         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
15609         (initpri1_LDFLAGS): New variable.
15610         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15611
15612 2008-03-27  Ian Lance Taylor  <iant@google.com>
15613
15614         * common.cc (Sort_commons::operator): Correct sorting algorithm.
15615         * testsuite/common_test_1.c: New file.
15616         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
15617         (common_test_1_SOURCES): New variable.
15618         (common_test_1_DEPENDENCIES): New variable.
15619         (common_test_1_LDFLAGS): New variable.
15620
15621         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
15622         and commons_ correctly when NAME/VERSION does not override
15623         NAME/NULL.
15624         * testsuite/ver_test_6.c: New file.
15625         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
15626         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
15627         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
15628
15629 2008-03-26  Ian Lance Taylor  <iant@google.com>
15630
15631         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
15632         of an undefined symbol from a version script.
15633         * testsuite/Makefile.am (ver_test_5.so): New target.
15634         (ver_test_5.o): New target.
15635         (check_SCRIPTS): Add ver_test_5.sh.
15636         (check_DATA): Add ver_test_5.syms.
15637         (ver_test_5.syms): New target.
15638         * testsuite/ver_test_5.cc: New file.
15639         * testsuite/ver_test_5.script: New file.
15640         * testsuite/ver_test_5.sh: New file.
15641         * Makefile.in, testsuite/Makefile.in: Rebuild.
15642
15643         PR gold/5986
15644         Fix problems building gold with gcc 4.3.0.
15645         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
15646         (gold_error_at_location, gold_warning_at_location): Use it.
15647         * configure.ac: Check whether we can compile and use a template
15648         function with a printf attribute.
15649         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
15650         when jumping over bytes.
15651         * object.cc: Instantiate Object::read_section_data.
15652         * debug.h: Include <cstring>
15653         * dwarf_reader.cc: Include <algorithm>
15654         * main.cc: Include <cstring>.
15655         * options.cc: Include <cstring>.
15656         * output.cc: Include <cstring>.
15657         * script.cc: Include <cstring>.
15658         * script.h: Include <string>.
15659         * symtab.cc: Include <cstring> and <algorithm>.
15660         * target-select.cc: Include <cstring>.
15661         * version.cc: Include <string>.
15662         * testsuite/testmain.cc: Include <cstdlib>.
15663         * configure, config.in: Rebuild.
15664
15665 2008-03-25  Ian Lance Taylor  <iant@google.com>
15666
15667         * options.cc: Include "../bfd/bfdver.h".
15668         (options::help): Print bug reporting address.
15669
15670         * version.cc (print_version): Adjust output for current value of
15671         BFD_VERSION_STRING.
15672
15673         * NEWS: New file.
15674
15675         * options.cc (options::help): Print list of supported targets.
15676         * target-select.h: Include <vector>.
15677         (class Target_selector): Make machine_, size_, and is_big_endian_
15678         fields const.  Add bfd_name_ and instantiated_target_ fields.
15679         (Target_selector::Target_selector): Add bfd_name parameter.
15680         (Target_selector::recognize): Make non-virtual, call
15681         do_recognize.
15682         (Target_selector::recognize_by_name): Make non-virtual, call
15683         do_recognize_by_name.
15684         (Target_selector::supported_names): New function.
15685         (Target_selector::bfd_name): New function.
15686         (Target_selector::do_instantiate_target): New pure virtual
15687         function.
15688         (Target_selector::do_recognize): New virtual function.
15689         (Target_selector::do_recognize_by_name): New virtual function.
15690         (Target_selector::instantiate_target): New private function.
15691         (supported_target_names): Declare.
15692         * target-select.cc (Target_selector::Target_selector): Update for
15693         new parameter and fields.
15694         (select_target_by_name): Check that the name matches before
15695         calling recognize_by_name.
15696         (supported_target_names): New function.
15697         * i386.cc (class Target_selector_i386): Update Target_selector
15698         constructor call.  Remove recognize and recognize_by_name.  Add
15699         do_instantiate_target.
15700         * x86_64.cc (class Target_selector_x86_64): Likewise.
15701         * testsuite/testfile.cc (class Target_selector_test): Update for
15702         changes to Target_selector.
15703
15704         * README: Rewrite, with some notes on unsupported features.
15705
15706 2008-03-24  Cary Coutant  <ccoutant@google.com>
15707
15708         * i386.cc (Target_i386::Got_type): New enum declaration.
15709         (Target_i386::Scan::local): Updated callers of Output_data_got
15710         member functions.
15711         (Target_i386::Scan::global): Likewise.
15712         (Target_i386::Relocate::relocate): Likewise.
15713         (Target_i386::Relocate::relocate_tls): Likewise.
15714         * object.h (Got_offset_list): New class.
15715         (Sized_relobj::local_has_got_offset): Added got_type parameter.
15716         (Sized_relobj::local_got_offset): Likewise.
15717         (Sized_relobj::set_local_got_offset): Likewise.
15718         (Sized_relobj::local_has_tls_got_offset): Removed.
15719         (Sized_relobj::local_tls_got_offset): Removed.
15720         (Sized_relobj::set_local_tls_got_offset): Removed.
15721         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
15722         * output.cc (Output_data_got::add_global): Added got_type parameter.
15723         (Output_data_got::add_global_with_rel): Likewise.
15724         (Output_data_got::add_global_with_rela): Likewise.
15725         (Output_data_got::add_global_pair_with_rel): New function.
15726         (Output_data_got::add_global_pair_with_rela): New function.
15727         (Output_data_got::add_local): Added got_type parameter.
15728         (Output_data_got::add_local_with_rel): Likewise.
15729         (Output_data_got::add_local_with_rela): Likewise.
15730         (Output_data_got::add_local_pair_with_rel): New function.
15731         (Output_data_got::add_local_pair_with_rela): New function.
15732         (Output_data_got::add_global_tls): Removed.
15733         (Output_data_got::add_global_tls_with_rel): Removed.
15734         (Output_data_got::add_global_tls_with_rela): Removed.
15735         (Output_data_got::add_local_tls): Removed.
15736         (Output_data_got::add_local_tls_with_rel): Removed.
15737         (Output_data_got::add_local_tls_with_rela): Removed.
15738         * output.h (Output_data_got::add_global): Added got_type parameter.
15739         (Output_data_got::add_global_with_rel): Likewise.
15740         (Output_data_got::add_global_with_rela): Likewise.
15741         (Output_data_got::add_global_pair_with_rel): New function.
15742         (Output_data_got::add_global_pair_with_rela): New function.
15743         (Output_data_got::add_local): Added got_type parameter.
15744         (Output_data_got::add_local_with_rel): Likewise.
15745         (Output_data_got::add_local_with_rela): Likewise.
15746         (Output_data_got::add_local_pair_with_rel): New function.
15747         (Output_data_got::add_local_pair_with_rela): New function.
15748         (Output_data_got::add_global_tls): Removed.
15749         (Output_data_got::add_global_tls_with_rel): Removed.
15750         (Output_data_got::add_global_tls_with_rela): Removed.
15751         (Output_data_got::add_local_tls): Removed.
15752         (Output_data_got::add_local_tls_with_rel): Removed.
15753         (Output_data_got::add_local_tls_with_rela): Removed.
15754         * resolve.cc (Symbol::override_base_with_special): Removed
15755         reference to has_got_offset_ field.
15756         * symtab.cc (Symbol::init_fields): Replaced initialization
15757         of got_offset_ with got_offsets_.  Removed initialization
15758         of has_got_offset_
15759         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
15760         (Symbol::got_offset): Likewise.
15761         (Symbol::set_got_offset): Likewise.
15762         (Symbol::has_tls_got_offset): Removed.
15763         (Symbol::tls_got_offset): Removed.
15764         (Symbol::set_tls_got_offset): Removed.
15765         (Symbol::got_offset_): Removed.
15766         (Symbol::tls_mod_got_offset_): Removed.
15767         (Symbol::tls_pair_got_offset_): Removed.
15768         (Symbol::got_offsets_): New field.
15769         (Symbol::has_got_offset): Removed.
15770         (Symbol::has_tls_mod_got_offset): Removed.
15771         (Symbol::has_tls_pair_got_offset): Removed.
15772         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
15773         (Target_x86_64::Scan::local): Updated callers of Output_data_got
15774         member functions.
15775         (Target_x86_64::Scan::global): Likewise.
15776         (Target_x86_64::Relocate::relocate): Likewise.
15777         (Target_x86_64::Relocate::relocate_tls): Likewise.
15778
15779 2008-03-25  Ben Elliston  <bje@au.ibm.com>
15780
15781         * yyscript.y: Fix spelling error in comment.
15782
15783 2008-03-24  Ian Lance Taylor  <iant@google.com>
15784
15785         * options.h (class General_options): Define build_id option.
15786         * layout.h (class Layout): Declare write_build_id, create_note,
15787         create_build_id.  Add build_id_note_ member.
15788         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
15789         "libiberty.h", "md5.h", "sha1.h".
15790         (Layout::Layout): Initialize eh_frame_data_,
15791         eh_frame_hdr_section_, and build_id_note_.
15792         (Layout::finalize): Call create_build_id.
15793         (Layout::create_note): New function, broken out of
15794         Layout::create_gold_note.
15795         (Layout::create_gold_note): Call create_note.
15796         (Layout::create_build_id): New function.
15797         (Layout::write_build_id): New function.
15798         (Close_task_runner::run): Call write_build_id.
15799
15800         * x86_64.cc: Correct license to GPLv3.
15801
15802 2008-03-23  Ian Lance Taylor  <iant@google.com>
15803
15804         * options.cc: Include "demangle.h".
15805         (parse_optional_string): New function.
15806         (parse_long_option): Handle takes_optional_argument.
15807         (parse_short_option): Update dash_z initializer.  Handle
15808         takes_optional_argument.
15809         (General_options::General_options): Initialize do_demangle_.
15810         (General_options::finalize): Set do_demangle_.  Handle demangling
15811         style.
15812         * options.h (parse_optional_string): Declare.
15813         (struct One_option): Add optional_arg field.  Update constructor.
15814         Update call constructor calls.  Add takes_optional_argument
15815         function.
15816         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
15817         (DEFINE_optional_string): Define.
15818         (General_options::demangle): Change from DEFINE_bool to
15819         DEFINE_optional_string.
15820         (General_options::no_demangle): New function.
15821         (General_options::do_demangle): New function.
15822         (General_options::set_do_demangle): New function.
15823         (General_options::execstack_status_): Move definition to end of
15824         class definition.
15825         (General_options::static_): Likewise.
15826         (General_options::do_demangle_): New field.
15827         * object.cc (big_endian>::get_symbol_location_info): Call
15828         Options::do_demangle, not Options::demangle.
15829         * symtab.cc (demangle): Likewise.
15830
15831 2008-03-22  Ian Lance Taylor  <iant@google.com>
15832
15833         * gold.h: Include <cstddef> and <sys/types.h>
15834         * options.h: Include <cstring>.
15835
15836 2008-03-21  Ian Lance Taylor  <iant@google.com>
15837
15838         * Added source code to GNU binutils.
15839 \f
15840 Copyright (C) 2008-2014 Free Software Foundation, Inc.
15841
15842 Copying and distribution of this file, with or without modification,
15843 are permitted in any medium without royalty provided the copyright
15844 notice and this notice are preserved.
15845
15846 Local Variables:
15847 mode: change-log
15848 left-margin: 8
15849 fill-column: 74
15850 version-control: never
15851 End: