aa95b77e00e3372dfa2b1230cd17f6967f796003
[external/binutils.git] / gold / ChangeLog
1 2014-07-04  Alan Modra  <amodra@gmail.com>
2
3         * po/POTFILES.in: Regenerate.
4
5 2014-07-02  Jing Yu  <jingyu@google.com>
6
7         * aarch64.cc: New file
8         * Makefile.am (TARGETSOURCES): Add aarch64.cc
9         (ALL_TARGETOBJS): Add aarch64.$(OBJEXT)
10         * Makefile.in: Regenerate.
11         * configure.tgt: Add entries for aarch64*.
12         * configure.ac:  Likewise.
13         * configure: Likewise.
14
15 2014-06-27  Alan Modra  <amodra@gmail.com>
16
17         * symtab.cc (Symbol::should_add_dynsym_entry): Don't make inline.
18
19 2014-06-24  Cary Coutant  <ccoutant@google.com>
20
21         * dwp.cc (Dwo_file::read): Allow files with no .debug_types
22         sections.
23         (Dwo_file::sized_read_unit_index): Likewise.
24
25 2014-06-23  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
26
27         * mips.cc: New file.
28         * Makefile.am (TARGETSOURCES): Add mips.cc
29         (ALL_TARGETOBJS): Add mips.$(OBJEXT)
30         * configure.tgt: Add entries for mips*.
31         * configure.ac: Likewise.
32         * Makefile.in: Regenerate.
33         * configure: Likewise.
34
35 2014-06-09  Cary Coutant  <ccoutant@google.com>
36
37         * dwarf_reader.cc (Dwarf_pubnames_table::read_header): Check that
38         unit_length is within section bounds.
39
40 2014-06-09  Cary Coutant  <ccoutant@google.com>
41
42         PR gold/16980
43         * layout.cc (Layout::print_to_mapfile): Print unattached sections in
44         map.
45
46 2014-06-07  Alan Modra  <amodra@gmail.com>
47
48         * powerpc.cc (relocate): Treat field of cmpli insn as a bitfield.
49
50 2014-06-06  Cary Coutant  <ccoutant@google.com>
51
52         * dwarf_reader.h (Dwarf_pubnames_table): Remove output_section_offset_.
53         * dwarf_reader.cc (Dwarf_pubnames_table::read_section): Likewise.
54         (Dwarf_pubnames_table::read_header): Likewise.
55         * layout.cc (gdb_fast_lookup_sections): Add .debug_gnu_pubnames and
56         .debug_gnu_pubtypes.
57
58 2014-06-05  Joel Brobecker  <brobecker@adacore.com>
59
60         * Makefile.am (CONFIG_STATUS_DEPENDENCIES): New.
61         * Makefile.in, configure: Regenerate.
62
63 2014-06-03  Alan Modra  <amodra@gmail.com>
64
65         * powerpc.cc (addis_12_2): Define.
66         (Stub_table::do_write): Support fusion on ELFv2 stubs.
67
68 2014-06-03  Alan Modra  <amodra@gmail.com>
69
70         * testsuite/plugin_test.c (parse_readelf_line): Skip non-visibility
71         st_other output.
72
73 2014-06-02  Alan Modra  <amodra@gmail.com>
74
75         * powerpc.cc (Target_powerpc::local_reloc_may_be_function_pointer):
76         Only ignore relocs on ELFv1.
77         (Target_powerpc::global_reloc_may_be_function_pointer): Likewise.
78
79 2014-05-30  Cary Coutant  <ccoutant@google.com>
80
81         * testsuite/Makefile.am (ehdr_start_test_4): Fix typo in -B option.
82         * testsuite/Makefile.in: Regenerate.
83         * testsuite/ehdr_start_test_4.sh: Look for "U" instead of "w".
84
85 2014-05-27  H.J. Lu  <hongjiu.lu@intel.com>
86
87         PR gold/16945
88         * x86_64.cc (Target_x86_64::Relocate::relocate): Use signed int
89         for got_offset.  Properly get GOT address for R_X86_64_PLTOFF64.
90
91 2014-05-15  Alan Modra  <amodra@gmail.com>
92
93         * powerpc.cc (do_plt_fde_location): Handle zero length .glink.
94         Compare FDE contents with DW_CFA_nop rather than 0.
95
96 2014-05-13  Sriraman Tallam  <tmsriram@google.com>
97
98         * symtab.h (may_need_copy_reloc): Remove check for position independent
99         code.
100         * x86_64.cc (Target_x86_64<size>::Scan::global): Add check for no
101         position independence before pc absolute may_need_copy_reloc call.
102         Add check for executable output befor pc relative may_need_copy_reloc
103         call.
104         * i386.cc: Ditto.
105         * arm.cc: Ditto.
106         * sparc.cc: Ditto.
107         * tilegx.cc: Ditto.
108         * powerpc.cc: Add check for no position independence before
109         may_need_copy_reloc calls.
110         * testsuite/pie_copyrelocs_test.cc: New file.
111         * testsuite/pie_copyrelocs_shared_test.cc: New file.
112         * Makefile.am (pie_copyrelocs_test): New test.
113         * Makefile.in: Regenerate.
114
115 2014-05-08  Martin Liška  <mliska@suse.cz>
116
117         * output.cc (Sized_relobj_file::do_layout): Fix typo in info message.
118
119 2014-05-06  Cary Coutant  <ccoutant@google.com>
120
121         PR gold/16900
122         * i386.cc (Output_data_got_plt_i386): New class.
123         (Output_data_plt_i386::Output_data_plt_i386): Change type of got_plt
124         parameter. Change all callers.
125         (Output_data_plt_i386::layout_): Remove.
126         (Output_data_plt_i386::got_plt_): Change type.
127         (Target_i386::got_plt_): Change type. Change all references.
128         (Target_i386::got_section): Create instance of new class.
129         (Output_data_got_plt_i386::do_write): New function.
130         * x86_64.cc (Output_data_got_plt_x86_64): New class.
131         (Output_data_plt_x86_64::Output_data_plt_x86_64): Change type of got_plt
132         parameter. Change all callers.
133         (Output_data_plt_x86_64::layout_): Remove.
134         (Output_data_plt_x86_64::got_plt_): Change type.
135         (Target_x86_64::got_plt_): Change type. Change all references.
136         (Target_x86_64::got_section): Create instance of new class.
137         (Output_data_got_plt_x86_64::do_write): New function.
138         (Output_data_plt_x86_64::do_write): Don't write reserved words in GOT.
139         (Target_x86_64<size>::init_got_plt_for_update): Create instance of new
140         class.
141
142 2014-05-05  Cary Coutant  <ccoutant@google.com>
143
144         * gdb-index.cc (Gdb_index_info_reader): Don't complain about language
145         if we have pubnames/pubtypes.
146
147 2014-05-02  Cary Coutant  <ccoutant@google.com>
148
149         * defstd.cc (in_segment): Define __ehdr_start here...
150         * layout.cc (Layout::finalize): ...Instead of here.  Set the
151         output segment when known.
152         * resolve.cc (Symbol::override_base_with_special): Remember
153         the original binding.
154         * symtab.cc (Symbol::set_output_segment): New function.
155         (Symbol::set_undefined): New function.
156         * symtab.h (Symbol::is_weak_undefined): Check original undef
157         binding.
158         (Symbol::is_strong_undefined): New function.
159         (Symbol::set_output_segment): New function.
160         (Symbol::set_undefined): New function.
161         * target-reloc.h (is_strong_undefined): Remove.
162         (issue_undefined_symbol_error): Call Symbol::is_weak_undefined.
163         Check for hidden undefs.
164         (relocate_section): Call Symbol::is_strong_undefined.
165
166         * testsuite/Makefile.am (ehdr_start_test_1)
167         (ehdr_start_test_2, ehdr_start_test_3)
168         (ehdr_start_test_4, ehdr_start_test_5): New test cases.
169         * testsuite/Makefile.in: Regenerate.
170         * testsuite/ehdr_start_def.cc: New source file.
171         * testsuite/ehdr_start_test.cc: New source file.
172         * testsuite/ehdr_start_test.t: New linker script.
173         * testsuite/ehdr_start_test_4.sh: New shell script.
174
175 2014-04-23  Cary Coutant  <ccoutant@google.com>
176
177         PR gold/16870
178         * x86_64.cc (Target_x86_64::Relocate::relocate): Add missing break.
179
180 2014-04-15  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
181
182         * layout.cc (Layout::include_section): Allow a target to decide
183         whether to include a section.
184         * target.h (Target::should_include_section): New function.
185         (Target::do_should_include_section): New function.
186
187 2014-04-15  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
188
189         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Remove and
190         inline into ...
191         (Copy_relocs::emit): ... here.
192         * copy-relocs.h (Copy_reloc_entry): Change from class to struct.
193         (Copy_reloc_entry::make_copy_reloc): Change from private to protected.
194         (Copy_reloc_entry::entries_): Change from private to protected.
195
196 2014-04-02  Sriraman Tallam  <tmsriram@google.com>
197
198         * icf.cc (get_section_contents): Replace copies of reloc
199         vectors with const references.
200
201 2014-04-02  Cary Coutant  <ccoutant@google.com>
202
203         * configure.ac (HAVE_PUBNAMES): Use C instead of C++.
204         (HAVE_NO_USE_LINKER_PLUGIN): Check for -fno-use-linker-plugin.
205         * configure: Regenerate.
206         * testsuite/Makefile.am (OPT_NO_PLUGINS): New macro for
207         -fno-use-linker-plugin.
208         (LINK1, CXXLINK1): Add it to the link command.
209         * testsuite/Makefile.in: Regenerate.
210
211 2014-03-12  Alan Modra  <amodra@gmail.com>
212
213         * Makefile.in: Regenerate.
214
215 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
216
217         * symtab.h (Symbol::set_nonvis): New function.
218
219 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
220
221         * symtab.cc (Sized_symbol<32>::init_output_data):
222         Instantiate the template.
223         (Sized_symbol<64>::init_output_data): Likewise.
224
225 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
226
227         * symtab.cc (Symbol_table::sized_write_globals): Allow a target to
228         adjust dynamic symbol value.
229         * target.h (Target::adjust_dyn_symbol): New function.
230         (Target::do_adjust_dyn_symbol): New function.
231
232 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
233
234         * output.cc (Output_data_dynamic::Dynamic_entry::write):
235         Get the value of DYNAMIC_CUSTOM dynamic entry.
236         * output.h (Output_data_dynamic::add_custom): New function.
237         (Dynamic_entry::Dynamic_entry): New constructor for DYNAMIC_CUSTOM
238         dynamic entry.
239         (enum Dynamic_entry::Classification): Add DYNAMIC_CUSTOM.
240         * target.h (Target::dynamic_tag_custom_value): New function.
241         (Target::do_dynamic_tag_custom_value): New function.
242
243 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
244
245         * symtab.cc (Symbol_table::set_dynsym_indexes): Allow a target to set
246         dynsym indexes.
247         * target.h (Target::has_custom_set_dynsym_indexes): New function.
248         (Target::do_has_custom_set_dynsym_indexes): New function.
249         (Target::set_dynsym_indexes): New function.
250         (Target::do_set_dynsym_indexes): New function.
251
252 2014-03-07  Alan Modra  <amodra@gmail.com>
253
254         * powerpc.cc (Powerpc_relocate_functions::Overflow_check): Add
255         CHECK_UNSIGNED, CHECK_LOW_INSN, CHECK_HIGH_INSN.
256         (Powerpc_relocate_functions::has_overflow_unsigned): New function.
257         (Powerpc_relocate_functions::has_overflow_bitfield,
258         overflowed): Use the above.
259         (Target_powerpc::Relocate::relocate): Correct overflow checking
260         for a number of relocations.  Modify overflow test for 16-bit
261         fields in instructions to signed/unsigned according to whether
262         the field takes a signed or unsigned value.
263
264 2014-03-05  Alan Modra  <amodra@gmail.com>
265
266         Update copyright years.
267
268 2014-03-05  Alan Modra  <amodra@gmail.com>
269
270         * powerpc.cc (Target_powerpc::Scan::local, global): Support
271         R_PPC64_ADDR64_LOCAL.
272         (Target_powerpc::Relocate::relocate): Likewise.
273
274 2014-03-03  Alan Modra  <amodra@gmail.com>
275
276         * dwp.cc (print_version): Update copyright year to current.
277
278 2014-02-10  Alan Modra  <amodra@gmail.com>
279
280         * po/gold.pot: Regenerate.
281
282 2014-02-06  Cary Coutant  <ccoutant@google.com>
283
284         Fix problem where -u is ignored when a weak undef is seen.
285
286         * archive.cc (Library_base::should_include_member): Reorder
287         code to check for -u option if a weak undef has already been seen.
288         * testsuite/Makefile.am (weak_undef_test_2): New test case.
289         * testsuite/Makefile.in: Regenerate.
290         * testsuite/weak_undef_file3.cc: New file.
291         * testsuite/weak_undef_file4.cc: New file.
292         * testsuite/weak_undef_test_2.cc: New file.
293
294 2014-02-05  Cary Coutant  <ccoutant@google.com>
295
296         Fix issues with gold undefined symbol diagnostics.
297
298         PR binutils/15435
299         * errors.cc (Errors::undefined_symbol): Move undef vtable symbol
300         check to here.
301         * target-reloc.h (is_strong_undefined): New function.
302         (relocate_section): Move undef vtable symbol check from here.
303         Check for is_strong_undefined.
304
305 2014-02-05  Cary Coutant  <ccoutant@google.com>
306
307         Fix problems with the --dynamic-list option.
308
309         PR gold/13577
310         * options.cc (General_options::parse_dynamic_list):
311         Set have_dynamic_list_.
312         (General_options::General_options): Initialize have_dynamic_list_.
313         (General_options::finalize): Turn off -Bsymbolic and
314         -Bsymbolic-functions if --dynamic-list provided.
315         * options.h (General_options::have_dynamic_list): New function.
316         (General_options::have_dynamic_list_): New data member.
317         * symtab.h (Symbol::is_preemptible): Handle --dynamic-list
318         correctly.
319
320         PR gold/16530
321         * symtab.cc (Symbol_table::add_from_relobj): If symbol is named
322         in --dynamic-list, mark it.
323
324         * testsuite/Makefile.am (gc_dynamic_list_test.sh): New test case.
325         (dynamic_list_2): New test case.
326         * testsuite/Makefile.in: Regenerate.
327         * testsuite/dynamic_list_2.cc: New file.
328         * testsuite/dynamic_list_2.t: New file.
329         * testsuite/dynamic_list_lib1.cc: New file.
330         * testsuite/dynamic_list_lib2.cc: New file.
331         * testsuite/gc_dynamic_list_test.c: New file.
332         * testsuite/gc_dynamic_list_test.sh: New file.
333         * testsuite/gc_dynamic_list_test.t: New file.
334
335 2014-01-28  Cary Coutant  <ccoutant@google.com>
336
337         Add .gdb_index version 7 support.
338
339         * gold/dwarf_reader.cc: include <utility> (for make_pair).
340         (Dwarf_abbrev_table::do_read_abbrevs): Check for compressed
341         debug sections.
342         (Dwarf_ranges_table::read_ranges_table): Likewise.
343         (Dwarf_pubnames_table::read_section): Check for GNU-style
344         sections, and for compressed debug sections.
345         (Dwarf_pubnames_table::read_header): Compute end address of table.
346         (Dwarf_pubnames_table::next_name): Return flag_byte.  Check
347         for end of list by offset, not by offset == 0.
348         (Dwarf_info_reader::do_read_string_table): Check for compressed
349         debug sections.
350         * gold/dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
351         Initialize new data members.
352         (Dwarf_pubnames_table::next_name): return flag_byte.
353         (Dwarf_pubnames_table::end_of_table_): New data member.
354         (Dwarf_pubnames_table::is_gnu_style_): New data member.
355         * gold/gdb-index.cc (gdb_index_version): Update to version 7.
356         (Gdb_index_info_reader::read_pubtable): Read flag_byte.
357         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Don't
358         read skeleton type unit DIEs.
359         (Gdb_index::add_symbol): Add flag_byte; adjust all callers.
360         (Gdb_index::do_write): Write flag_byte.
361         * gold/gdb-index.h (Gdb_index::add_symbol): Add flags parameter.
362         (Gdb_index::Cu_vector): Store flags along with cu indexes.
363         * gold/testsuite/gdb_index_test_3.sh: Allow versions 4-7.
364         * gold/testsuite/gdb_index_test_comm.sh: Likewise.
365
366 2014-01-08  H.J. Lu  <hongjiu.lu@intel.com>
367
368         * version.cc (print_version): Update copyright year to 2014.
369
370 2013-12-19  Dimitry Andric  <dimitry@andric.com>
371
372         * stringpool.cc (Stringpool_template::reserve): Add
373         HAVE_UNORDERED_MAP case.
374         * stringpool.cc (Stringpool_template::print_stats): Likewise.
375
376 2013-12-18  Cary Coutant  <ccoutant@google.com>
377
378         * configure.ac: Check for <unordered_set> and <unordered_map>.
379         * config.in: Regenerate.
380         * configure: Regenerate.
381         * system.h: Use <unordered_set> and <unordered_map> if available.
382
383 2013-12-10  Roland McGrath  <mcgrathr@google.com>
384
385         * Makefile.am (install-exec-local): Prefix $(INSTALL_PROGRAM) uses
386         with $(INSTALL_PROGRAM_ENV).
387         * Makefile.in: Regenerate.
388
389 2013-11-22  Cary Coutant  <ccoutant@google.com>
390
391         * configure.ac: Add check for which library is needed for
392         dlopen.
393         * configure: Regenerate.
394
395 2013-11-22  Cary Coutant  <ccoutant@google.com>
396
397         * testsuite/Makefile.am (exception_x86_64_bnd_test): Use in-tree
398         assembler.
399         * testsuite/Makefile.in: Regenerate.
400
401 2013-11-17  H.J. Lu  <hongjiu.lu@intel.com>
402
403         * x86_64.cc (Target_x86_64<size>::Scan::get_reference_flags):
404         Handle R_X86_64_PC32_BND and R_X86_64_PLT32_BND just like
405         R_X86_64_PC32 and R_X86_64_PLT32, respectively.
406         (Target_x86_64<size>::Scan::local): Likewise.
407         (Target_x86_64<size>::Scan::global): Likewise.
408         (Target_x86_64<size>::Relocate::relocate): Likewise.
409         (Target_x86_64<size>::Relocatable_size_for_reloc::get_size_for_reloc):
410         Likewise.
411         (Target_x86_64<size>::Scan::check_non_pic(): Handle
412         R_X86_64_PC32_BND.
413
414         * testsuite/Makefile.am (check_PROGRAMS): Add
415         exception_x86_64_bnd_test.
416         (exception_x86_64_bnd_test_SOURCES): New macro.
417         (exception_x86_64_bnd_test_DEPENDENCIES): Likewise.
418         (exception_x86_64_bnd_test_LDFLAGS): Likewise.
419         (exception_x86_64_bnd_test_LDADD): Likewise.
420         (exception_x86_64_bnd_1.o): New rule.
421         (exception_x86_64_bnd_2.o): Likewise.
422         * testsuite/Makefile.in: Regenerated.
423
424 2013-11-15  Alan Modra  <amodra@gmail.com>
425
426         * powerpc.cc (Target_powerpc::glink_section): Provide non-const
427         accessor.
428         (Target_powerpc::Branch_info::make_stub): Make global entry stubs.
429         Only call ppc64_local_entry_offset for 64-bit.  Restrict
430         symval_for_branch lookup to ELFv1.
431         (Stub_table::add_plt_call_entry): Use unsigned int off.
432         (Output_data_glink::Address, invalid_address): New.
433         (Output_data_glink::add_eh_frame): Move out of line.  Add
434         support for ELFv2.
435         (Output_data_glink::add_global_entry, find_global_entry,
436         global_entry_address): New functions.
437         (Output_data_glink::global_entry_stubs_, end_branch_table_,
438         ge_size): New variables.
439         (Output_data_glink::set_final_data_size): Add global entry
440         stub sizing.
441         (Output_data_glink::do_write): Write global entry stubs.
442         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Add target
443         parameter.  Return true for ELFv2.  Adjust callers.
444         (Target_powerpc::Scan::local, global): Restrict opd lookup to
445         ELFv1.  Similarly for ifunc and dynamic relocation processing
446         specific to ELFv1.  Recognize that symbols are defined on
447         their plt entries for ELFv2.
448         (Target_powerpc::symval_for_branch): Assert if called for
449         ELFv2 or ppc32.
450         (Target_powerpc::Relocate::relocate): Use global entry plt
451         stub for symbol value if such exists on ELFv2.
452         (Target_powerpc::Relocate::relocate): Don't call
453         symval_for_branch when ELFv2.  Do adjust for local entry
454         offset when ELFv2.
455         (Target_powerpc::do_dynsym_value): Set symbols to global entry
456         plt stub for ELFv2.
457         (Target_powerpc::do_plt_address_for_global): Similarly.
458
459 2013-11-14  Cary Coutant  <ccoutant@google.com>
460
461         Revert patch -- this did not fix the problem, and there is
462         no race there.
463
464         2013-11-14  Cary Coutant  <ccoutant@google.com>
465
466             PR gold/14860
467             * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
468             (Ehframe_hdr::set_final_data_size): Allocate a Lock.
469             * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
470             updating fde_offsets_.
471             (Eh_frame_hdr::lock_): New data member.
472
473 2013-11-14  Cary Coutant  <ccoutant@google.com>
474
475         * dwp.cc (Dwo_file_entry): New type.
476         (File_list): Use Dwo_file_entry.
477         (Dwo_file::verify): New function.
478         (Dwo_file::verify_dwo_list): New function.
479         (Dwo_file::sized_verify_dwo_list): New function.
480         (Dwo_name_info_reader::visit_compilation_unit): Add dwo_id to file
481         list.
482         (Dwp_options): New enum type.
483         (dwp_options): Add --verify-only.
484         (usage): Likewise.
485         (main): Likewise.
486         * dwp.h (gold_info): Add declaration.
487
488 2013-11-14  Cary Coutant  <ccoutant@google.com>
489
490         PR gold/14860
491         * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
492         (Ehframe_hdr::set_final_data_size): Allocate a Lock.
493         * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
494         updating fde_offsets_.
495         (Eh_frame_hdr::lock_): New data member.
496
497 2013-11-06  Cary Coutant  <ccoutant@google.com>
498
499         PR gold/15758
500         * object.cc (Sized_relobj_file::do_layout): Handle .eh_frame sections
501         before reloc sections.
502
503 2013-11-04  Alan Modra  <amodra@gmail.com>
504
505         * symtab.h (Symbol::Reference_flags): Add FUNC_DESC_ABI.
506         (Symbol::needs_dynamic_reloc): Test new flag.
507         * powerpc.cc (needs_dynamic_reloc, use_plt_offset): Delete.
508         (Target_powerpc::Scan::get_reference_flags): Add target param.
509         Return FUNC_DESC_ABI for 64-bit ELFv1.
510         (Target_powerpc::Branch_info::make_stub): Adjust get_reference_flags
511         call.
512         (Target_powerpc::Scan::global): Use Symbol::needs_dynamic_reloc.
513         (Target_powerpc::Relocate::relocate): Use Symbol::use_plt_offset.
514
515 2013-10-31  Cary Coutant  <ccoutant@google.com>
516
517         Restore support for dwp v2 DWARF package file format.
518
519         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
520         tu_length parameter.  Adjust all callers.
521         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
522         * dwp.cc: Include dwarf.h.
523         (Section_bounds): New struct type.
524         (Unit_set): New struct type.
525         (Dwo_file::Dwo_file): Initialize new data member.
526         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
527         Combine and rename to...
528         (Dwo_file::read_unit_index): ...this.
529         (Dwo_file::sized_read_compunit_index)
530         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
531         (Dwo_file::sized_read_unit_index): ...this.
532         (Dwo_file::copy_section): Remove section_name, is_str_offsets
533         parameters; add section_id parameter.
534         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
535         (Dwo_file::add_unit_set): ...this.
536         (Dwo_file::shndx_map_): Remove.
537         (Dwo_file::sect_offsets_): New data member.
538         (Dwp_output_file::Dwp_output_file): Initialize new data members.
539         (Dwp_output_file::add_section): Rename to...
540         (Dwp_output_file::add_contribution): ...this.
541         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
542         (Dwp_output_file::add_tu_set): Likewise.
543         (Dwp_output_file::Contribution): New type.
544         (Dwp_output_file::Section::contributions): New data member.
545         (Dwp_output_file::Cu_or_tu_set): Remove.
546         (Dwp_output_file::Section::Section): New ctor.
547         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
548         (Dwp_output_file::Dwp_index::Section_table): New type.
549         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
550         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
551         parameter.
552         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
553         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
554         (Dwp_output_file::Dwp_index::section_table): New member function.
555         (Dwp_output_file::Dwp_index::section_table_end): New member function.
556         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
557         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
558         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
559         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
560         (Dwp_output_file::Dwp_index::section_table_): New data member.
561         (Dwp_output_file::Dwp_index::section_mask_): New data member.
562         (Dwp_output_file::add_output_section): New member function.
563         (Dwp_output_file::write_new_section): New member function.
564         (Dwp_output_file::write_contributions): New member function.
565         (Dwp_output_file::section_id_map_): New data member.
566         (class Dwo_id_info_reader): Remove.
567         (class Unit_reader): New class.
568         (get_dwarf_section_name): New function.
569         (Dwo_file::read_executable): Adjust initializations of class data.
570         (Dwo_file::read): Add support for v2 package file format.
571         (Dwo_file::read_unit_index): Likewise.
572         (Dwo_file::sized_read_unit_index): Likewise.
573         (Dwo_file::copy_section): Likewise.
574         (Dwo_file::add_unit_set): Likewise.
575         (Dwp_output_file::add_output_section): Likewise.
576         (Dwp_output_file::add_contribution): Likewise.
577         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
578         for empty slot.
579         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
580         file format.
581         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
582         slot.
583         (Dwp_output_file::initialize): Remove unused function.
584         (Dwp_output_file::finalize): Add support for v2 package file format.
585         (Dwp_output_file::write_index): Likewise.
586         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
587         function prototype.
588
589 2013-10-31  Cary Coutant  <ccoutant@google.com>
590
591         * configure.ac: Fix check for -fmerge-constants.
592         * configure.ac: Regenerate.
593
594 2013-10-30  Roland McGrath  <mcgrathr@google.com>
595
596         * x86_64.cc (Output_data_plt_x86_64_nacl::first_plt_entry):
597         Correct 9-byte nop sequence to match what the assembler generates.
598
599 2013-10-30  Alan Modra  <amodra@gmail.com>
600
601         * powerpc.cc (Powerpc_relobj::abiversion, set_abiversion,
602         ppc64_local_entry_offset, ppc64_local_entry_offset,
603         do_read_symbols): New functions.
604         (Powerpc_relobj::e_flags_, st_other_): New vars.
605         (Powerpc_relobj::Powerpc_relobj): Call set_abiversion.
606         (Powerpc_dynobj::abiversion, set_abiversion): New functions.
607         (Powerpc_relobj::e_flags_): New var.
608         (Target_powerpc::first_plt_entry_offset, plt_entry_size): Inline
609         and adjust for ELFv2.
610         (Target_powerpc::abiversion, set_abiversion, stk_toc): New functions.
611         (Powerpc_relobj::do_find_special_sections): Check no .opd in ELFv2.
612         (Powerpc_dynobj::do_find_special_sections): Likewise.
613         (Target_powerpc::do_define_standard_symbols): Define ".TOC.".
614         (Target_powerpc::Branch_info::make_stub): Adjust stub destination
615         to ELFv2 local entry.
616         (Target_powerpc::do_relax): No thread safe barriers needed for
617         ELFv2.
618         (Output_data_plt_powerpc::initial_plt_entry_size_,
619         plt_entry_size): Delete.  Replace all uses with
620         first_plt_entry_offset() and plt_entry_size().
621         (Output_data_plt_powerpc::Output_data_plt_powerpc): Remove
622         reserved_size parm.  Update callers.
623         (Output_data_plt_powerpc::entry_count): Update.
624         (Output_data_plt_powerpc::first_plt_entry_offset): Make private
625         and use Target_powerpc::first_plt_entry_offset().
626         (Output_data_plt_powerpc::get_plt_entry_size): Similarly and
627         rename to plt_entry_size.
628         (Output_data_plt_powerpc::add_ifunc_entry,
629         add_local_ifunc_entry): Adjust reloc for ELFv2.
630         (glink_eh_frame_fde_64): Rename to glink_eh_frame_fde_64v1.
631         (glink_eh_frame_fde_64v2): New.
632         (Stub_table::plt_call_size): Support ELFv2 sizing.
633         (Output_data_glink::add_eh_frame): Use the new FDE.
634         (Output_data_glink::set_final_data_size): Adjust for ELFv2 glink.
635         (Stub_table::do_write): Write ELFv2 stubs and glink.
636         (Target_powerpc::Relocate::relocate): Replaces nop after call
637         with ld 2,24(1) and adjust local offset destination for ELFv2.
638
639 2013-10-30  Alan Modra  <amodra@gmail.com>
640
641         * powerpc.cc (Target_powerpc::Scan::check_non_pic): Handle new relocs.
642         (Target_powerpc::Scan::global, local): Likewise.
643         (Target_powerpc::Relocate::relocate): Likewise.  Check for overflow
644         on all ppc64 @h and @ha relocs.
645
646 2013-10-14  Alan Modra  <amodra@gmail.com>
647
648         * output.h (Output_data_got::add_constant): Tidy.
649         (Output_data_got::add_constant_pair): New function.
650         * powerpc.cc (Output_data_got_powerpc): Override all Output_data_got
651         methods used so as to first call reserve_ent().
652
653 2013-10-11  Roland McGrath  <mcgrathr@google.com>
654
655         * powerpc.cc (Output_data_got_powerpc): Remove unused methods
656         add_got_entry and add_got_entry_pair.
657
658         * configure.ac (TLS_GNU2_DIALECT): Use -Werror in test.
659         (HAVE_PUBNAMES): Likewise.
660         * configure: Regenerate.
661
662         * testsuite/Makefile.am: Replace '-T foo' with '-Wl,-T,foo' throughout.
663         * testsuite/Makefile.in: Regenerate.
664
665         * target.h (Target::adjust_elf_header, Target::do_adjust_elf_header):
666         Remove const from declaration.
667         * target.cc (Sized_target::do_adjust_elf_header): Update definition.
668         * sparc.cc (Target_sparc::do_adjust_elf_header): Likewise.
669         * output.h (Output_file_header): Remove const from member target_
670         and corresponding constructor argument.
671         * output.cc (Output_file_header::Output_file_header): Update prototype.
672         (Output_file_header::do_sized_write): Use this->target_ in place
673         of parameters()->target().
674
675         * testsuite/undef_symbol.cc (Foo::get_a): New method.
676
677         * configure.ac (MERGE_CONSTANTS_FLAG): New check.
678         * configure: Regenerate.
679         * Makefile.in: Regenerate.
680         * testsuite/merge_string_literals_1.c: Renamed to have .cc suffix.
681         * testsuite/merge_string_literals_2.c: Likewise.
682         * testsuite/Makefile.am
683         (merge_string_literals_1.o, merge_string_literals_2.o): Update deps.
684         (AM_CFLAGS, AM_CXXFLAGS): Use $(MERGE_CONSTANTS_FLAG) in place of
685         literal -fmerge-constants.
686         * testsuite/Makefile.in: Regenerate.
687
688         * i386.cc (Target_i386): Remove unused member dynbss_.
689         * arm.cc (Target_arm): Likewise.
690         * powerpc.cc (Target_powerpc): Likewise.
691         * sparc.cc (Target_sparc): Likewise.
692         * tilegx.cc (Target_tilegx): Likewise.
693         * x86_64.cc (Target_x86_64): Likewise.
694         * dwarf_reader.h (Dwarf_info_reader): Remove unused members
695         type_signature_, type_offset_.
696         * plugin.h (Plugin_hook): Remove unused member layout_.
697         * readsyms.h (Add_symbols): Remove unused members dirpath_, dirindex_,
698         mapfile_.
699         (Read_member): Remove unused members input_objects_, symtab_,
700         mapfile_, layout_.
701         (Check_library): Remove unused member symtab_.
702         * archive.h (Lib_group): Remove unused member lib_.
703         * archive.cc (Lib_group::Lib_group): Update initializer.
704         * incremental.h (Incremental_binary): Remove unused member target_.
705         (Incremental_script_entry): Removed unused member script_.
706         * layout.h (Write_symbols_task): Remove unused member input_objects_.
707         * icf.h (Icf): Remove unused member num_tracked_relocs.
708
709         * gold-threads.h (Once): Conditionalize member was_run_lock_ on
710         [ENABLE_THREADS && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4], matching
711         its only use.
712         * gold-threads.cc (Once::Once): Likewise conditionalize initializer.
713
714         * archive.h: Use struct rather than class for forward declaration
715         of Read_symbols_data.
716
717 2013-10-07  Cary Coutant  <ccoutant@google.com>
718
719         PR gold/16010
720         * testsuite/Makefile.am (icf_test): Fix dependencies.
721         (icf_safe_test): Likewise.
722         (icf_safe_so_test): Likewise.
723         (large_symbol_alignment): Add empty _LDADD rule.
724         * testsuite/Makefile.in: Regenerate.
725
726 2013-09-03  Pavel Chupin  <pavel.v.chupin@intel.com>
727
728         PR gold/15927
729         * x86_64.cc (Target_x86_64<size>::Scan::global): Use relative
730         relocation for R_X86_64_32 on x32.
731
732 2013-08-27  Roland McGrath  <mcgrathr@google.com>
733
734         * output.cc (Output_segment::set_section_addresses): Take new
735         Target* argument.  If target->isolate_execinstr() and the segment
736         is executable and starts at a target->abi_pagesize() boundary,
737         pad its end out to a target->abi_pagesize() boundary with code fill.
738         * output.h (Output_segment::set_section_addresses): Update decl.
739         * layout.h (Layout::check_output_data_for_reset_values): Take new
740         argument RELAX_OUTPUTS.
741         (Layout): New member relax_output_list_.
742         (Layout::add_relax_output): New method.
743         * layout.cc (Layout::Layout): Update constructor.
744         (Layout::reset_relax_output): New method.
745         (Layout::clean_up_after_relaxation): Call it.
746         (Layout::prepare_for_relaxation): Update caller.
747         (Layout::set_segment_offsets): Update callers of set_section_addresses.
748         Call reset_relax_output before re-processing segments for
749         isolate_execinstr case.
750         (Layout::write_data): Handle relax_output_list_.
751         (Layout::Relaxation_debug_check::check_output_data_for_reset_values):
752         Take new argument RELAX_OUTPUTS.  Assert it's an empty collection.
753
754 2013-08-23  Yuri Chornoivan  <yurchor@ukr.net>
755
756         PR binutils/15834
757         * object.h: Fix typos.
758
759 2013-08-16  Roland McGrath  <mcgrathr@google.com>
760
761         * i386.cc (Target_i386_nacl::do_code_fill): New virtual function.
762         * x86_64.cc (Target_x86_64_nacl::do_code_fill): New virtual function.
763
764 2013-08-07  Cary Coutant  <ccoutant@google.com>
765
766         Revert support for v2 DWP files:
767
768         2013-03-01  Cary Coutant  <ccoutant@google.com>
769
770             Add dwp support for v2 DWARF package file format.
771             * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
772             tu_length parameter.  Adjust all callers.
773             * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
774             * dwp.cc: Include dwarf.h.
775             (Section_bounds): New struct type.
776             (Unit_set): New struct type.
777             (Dwo_file::Dwo_file): Initialize new data member.
778             (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
779             Combine and rename to...
780             (Dwo_file::read_unit_index): ...this.
781             (Dwo_file::sized_read_compunit_index)
782             (Dwo_file::sized_read_typeunit_index): Combine and rename to...
783             (Dwo_file::sized_read_unit_index): ...this.
784             (Dwo_file::copy_section): Remove section_name, is_str_offsets
785             parameters; add section_id parameter.
786             (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
787             (Dwo_file::add_unit_set): ...this.
788             (Dwo_file::shndx_map_): Remove.
789             (Dwo_file::sect_offsets_): New data member.
790             (Dwp_output_file::Dwp_output_file): Initialize new data members.
791             (Dwp_output_file::add_section): Rename to...
792             (Dwp_output_file::add_contribution): ...this.
793             (Dwp_output_file::add_cu_set): Combine parameters into a struct.
794             (Dwp_output_file::add_tu_set): Likewise.
795             (Dwp_output_file::Contribution): New type.
796             (Dwp_output_file::Section::contributions): New data member.
797             (Dwp_output_file::Cu_or_tu_set): Remove.
798             (Dwp_output_file::Section::Section): New ctor.
799             (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
800             (Dwp_output_file::Dwp_index::Section_table): New type.
801             (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
802             (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
803             parameter.
804             (Dwp_output_file::Dwp_index::shndx_pool): Remove.
805             (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
806             (Dwp_output_file::Dwp_index::section_table): New member function.
807             (Dwp_output_file::Dwp_index::section_table_end): New member function.
808             (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
809             (Dwp_output_file::Dwp_index::section_table_rows): New member function.
810             (Dwp_output_file::Dwp_index::section_table_cols): New member function.
811             (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
812             (Dwp_output_file::Dwp_index::section_table_): New data member.
813             (Dwp_output_file::Dwp_index::section_mask_): New data member.
814             (Dwp_output_file::add_output_section): New member function.
815             (Dwp_output_file::write_new_section): New member function.
816             (Dwp_output_file::write_contributions): New member function.
817             (Dwp_output_file::section_id_map_): New data member.
818             (class Dwo_id_info_reader): Remove.
819             (class Unit_reader): New class.
820             (get_dwarf_section_name): New function.
821             (Dwo_file::read_executable): Adjust initializations of class data.
822             (Dwo_file::read): Add support for v2 package file format.
823             (Dwo_file::read_unit_index): Likewise.
824             (Dwo_file::sized_read_unit_index): Likewise.
825             (Dwo_file::copy_section): Likewise.
826             (Dwo_file::add_unit_set): Likewise.
827             (Dwp_output_file::add_output_section): Likewise.
828             (Dwp_output_file::add_contribution): Likewise.
829             (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
830             for empty slot.
831             (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
832             file format.
833             (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
834             slot.
835             (Dwp_output_file::initialize): Remove unused function.
836             (Dwp_output_file::finalize): Add support for v2 package file format.
837             (Dwp_output_file::write_index): Likewise.
838             * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
839             function prototype.
840
841 2013-07-31  Cary Coutant  <ccoutant@google.com>
842
843         * object.cc (Sized_relobj::do_output_section_address): New function.
844         (Sized_relobj): Instantiate explicitly.
845         * object.h (Object::output_section_address): New function.
846         (Object::do_output_section_address): New function.
847         (Sized_relobj::do_output_section_address): New function.
848         * powerpc.cc (Target_powerpc::symval_for_branch): Use it.
849
850 2013-07-30  Cary Coutant  <ccoutant@google.com>
851             Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
852
853         * parameters.cc (Parameters::entry): Return target-specific entry
854         symbol name.
855         * target.h (Target::entry_symbol_name): New function.
856         (Target_info::entry_symbol_name): New data member.
857
858         * arm.cc (Target_arm::arm_info): Add entry_symbol_name.
859         * i386.cc (Target_i386::i386_info): Likewise.
860         (Target_i386_nacl::i386_nacl_info): Likewise.
861         * sparc.cc (Target_sparc::sparc_info): Likewise.
862         * tilegx.cc (Target_tilegx::tilegx_info): Likewise.
863         * x86_64.cc: (Target_x86_64::x86_64_info) Likewise.
864         (Target_x86_64_nacl::x86_64_nacl_info) Likewise.
865         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
866
867 2013-07-22  Sterling Augustine  <saugustine@google.com>
868
869         * dwarf_reader.cc (Dwarf_pubnames_table::read_section):
870         Convert parameter shndx to local variable. Add parameters symtab
871         and symtab_size.  Scan over section names.  Find relocation
872         section corresponding to current section.  Create and initialize
873         reloc_mapper_ and reloc_type_.
874         (Dwarf_pubnames_table::read_header):  Add assertion.  Change
875         unit_length to off_t.  Initialize member unit_length_.  Fill in field
876         cu_offset_.
877         * dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
878         Initialize new fields unit_length_ and cu_offset_.
879         (Dwarf_pubnames_table::read_section): Update prototype.
880         (Dwarf_pubnames_table::cu_offset): New member function.
881         (Dwarf_pubnames_table::subsection_size): Likewise.
882         (Dwarf_pubnames_table::cu_offset_, Dwarf_pubnames_table::unit_length):
883         New fields.
884         (Dwarf_info_reader::symtab, Dwarf_info_reader::symtab_size): Make
885         member functions public.
886         * gdb_index.cc (Gdb_index_info_reader::read_pubnames_and_pubtypes):
887         Update comment.  Rework logic.  Move repeated parts to...
888         (Gdb_index_info_reader::read_pubtable): ...here. New function.
889         (Gdb_index::Gdb_index): Initialize new fields, pubnames_table_,
890         pubtypes_table_, and stmt_list_offset.
891         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
892         Gdb_index::find_pubtype_offset,
893         Gdb_index::map_pubnames_and_types_to_dies): Define new functions.
894         (Gdb_index::pubnames_read): Update prototype and rework logic.
895         * gdb_index.h (Gdb_index_info_reader, Dwarf_pubnames_table):
896         Forward declare.
897         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
898         Gdb_index::find_pubtype_offset, Gdb_index::pubnames_table)
899         Gdb_index::pubtypes_table, Gdb_index::map_pubnames_and_types_to_dies,
900         Gdb_index::map_pubtable_to_dies):
901         Declare functions.
902         (Gdb_index::pubnames_read): Update declaration.
903         (Gdb_index::Pubname_offset_map): New type.
904         (Gdb_index::cu_pubname_map_, Gdb_index::cu_pubtype_map_,
905         Gdb_index::pubnames_table_, Gdb_index::pubtypes_table_,
906         Gdb_index::stmt_list_offset): Declare.
907         (Gdb_index::pubnames_shndx_, Gdb_index::pubnames_offet_,
908         Gdb_index::pubtypes_object_, Gdb_index::pubtypes_shndx_)
909         Gdb_index::pubtypes_offset_): Remove.
910
911 2013-07-19  Roland McGrath  <mcgrathr@google.com>
912
913         * options.h (General_options): Add -Trodata-segment option.
914         * parameters.cc (Parameters::check_rodata_segment): New function.
915         (Parameters::set_target_once): Call it.
916         * parameters.h (Parameters): Declare it (private member function).
917         * layout.cc (load_seg_unusable_for_headers): New function, broken
918         out of Layout::relaxation_loop_body.  If TARGET->isolate_execinstr()
919         then validate rodata segment rather than text segment.
920         (relaxation_loop_body): Call that.
921         (is_text_segment): New function.  Don't admit a non-executable
922         segment if TARGET->isolate_execinstr().
923         (set_segment_offsets): Call it.  Honor -Trodata-segment option.
924
925 2013-07-15  Shawn Landden  <shawnlandden@gmail.com>
926
927         PR gold/15070
928         * fileread.h (File_read::get_view): Clarify comment about ALIGNED.
929         * nacl.h (Sniff_file::View::View): Request aligned view.
930
931 2013-07-11  Cary Coutant  <ccoutant@google.com>
932
933         * powerpc.cc (Target_powerpc::write_branch_lookup_table): Use
934         correct BRLT entry size.
935
936 2013-07-03  Alan Modra  <amodra@gmail.com>
937
938         * powerpc.cc (Target_powerpc::Relocate::relocate): Update self-call
939         comment.
940
941 2013-07-01  Cary Coutant  <ccoutant@google.com>
942
943         * dwarf_reader.cc (Dwarf_ranges_table::read_ranges_table): Save
944         reloc_type_.
945         (Dwarf_ranges_table::read_range_list): Call lookup_reloc.
946         (Dwarf_ranges_table::lookup_reloc): New function.
947         * dwarf_reader.h (Dwarf_ranges_table::Dwarf_ranges_table): Initialize
948         reloc_type_.
949         (Dwarf_ranges_table::lookup_reloc): New function.
950         (Dwarf_ranges_table::reloc_type_): New data member.
951
952 2013-06-27  Jing Yu  <jingyu@google.com>
953
954         PR gold/15662
955         * powerpc.cc (Output_data_brlt_powerpc::reset_brlt_sizes): New
956         function.
957         (Output_data_brlt_powerpc::finalize_brlt_sizes): New function.
958         (Target_powerpc::do_relax): Call the above.
959
960 2013-06-27  Cary Coutant  <ccoutant@google.com>
961
962         * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
963         on garbage collected .opd section.
964
965 2013-06-27  Alan Modra  <amodra@gmail.com>
966
967         * powerpc.cc (Target_powerpc::do_gc_add_reference): Test dst_shndx
968         is non-zero.
969         (Target_powerpc::do_gc_mark_symbols): Likewise for sym->shndx().
970         (Target_powerpc::do_function_location): Likewise for loc->shndx.
971
972 2013-06-14  Cary Coutant  <ccoutant@google.com>
973
974         * resolve.cc (Symbol::override_base): Don't override st_type
975         from plugin placeholder symbols.
976         (Symbol_table::resolve): Likewise.
977         (Symbol_table::should_override): Don't complain about TLS mismatch
978         if the TO symbol is a plugin placeholder.
979         * testsuite/Makefile.am (plugin_test_tls): New test.
980         * testsuite/Makefile.in: Regenerate.
981         * testsuite/plugin_test_tls.sh: New test script.
982         * testsuite/two_file_test_2_tls.cc: New test source.
983         * testsuite/two_file_test_tls.cc: New test source.
984
985 2013-06-05  Alexander Ivchenko  <alexander.ivchenko@intel.com>
986
987         * layout.cc (Layout::set_segment_offsets): Taking care of the case when
988         the maximum segment alignment is larger than the page size.
989         * testsuite/Makefile.am (large_symbol_alignment): Test that Gold
990         correctly aligns the symbols with large alignemnt.
991         * testsuite/Makefile.in: Regenerate.
992         * testsuite/large_symbol_alignment.cc: New file.
993
994 2013-05-30  Alexander Ivchenko  <alexander.ivchenko@intel.com>
995             Sriraman Tallam  <tmsriram@google.com>
996
997         * options.h (sort_section): New option.
998         * output.h (Input_section_sort_section_prefix_special_ordering_compare):
999         Rename from Input_section_sort_section_name_special_ordering_compare.
1000         (Input_section_sort_section_name_compare): New struct.
1001         * output.cc (Output_section::Input_section_sort_section_name_compare::
1002         operator()): New function.
1003         (Output_section::sort_attached_input_sections): Use new sort function
1004         for .text if --sort-section=name is specified.
1005         * layout.cc (Layout::make_output_section):
1006         Add sorting by name when --sort-section=name is specified.
1007         * testsuite/Makefile.am (text_section_grouping): Test option
1008         --sort-section=name.
1009         * testsuite/Makefile.in: Regenerate.
1010         * testsuite/section_sorting_name.cc: New file.
1011         * testsuite/section_sorting_name.sh: New file.
1012
1013 2013-05-21  Cary Coutant  <ccoutant@google.com>
1014
1015         * symtab.h (Symbol::is_cxx_vtable): New function.
1016         * target-reloc.h (relocate_section): Check for vtable symbol.
1017         * testsuite/Makefile.am (missing_key_func.sh): New test case.
1018         * testsuite/Makefile.in: Regenerate.
1019         * testsuite/missing_key_func.cc: New test source.
1020         * testsuite/missing_key_func.sh: New test script.
1021
1022 2013-05-21  Cary Coutant  <ccoutant@google.com>
1023
1024         * object.cc (Sized_relobj_file::get_symbol_location_info): Set
1025         type of enclosing symbol.
1026         (Relocate_info::location): Check symbol type when describing symbol.
1027         * object.h (Symbol_location_info): Remove unused line_number;
1028         add enclosing_symbol_type.
1029         * testsuite/debug_msg.sh: Adjust expected output.
1030
1031 2013-05-13  Cary Coutant  <ccoutant@google.com>
1032
1033         * configure.ac: Export DEFAULT_TARGET.
1034         * configure: Regenerate.
1035         * Makefile.in: Regenerate.
1036         * testsuite/Makefile.am: Add .EXPORT_ALL_VARIABLES.
1037         * testsuite/Makefile.in: Regenerate.
1038         * testsuite/debug_msg.sh: Delete duplicate tests.
1039         Don't check undef_int error message match for powerpc where the
1040         source file and line number aren't available.
1041
1042 2013-05-10  Roland McGrath  <mcgrathr@google.com>
1043
1044         * options.h (General_options): Add --rosegment-gap option.
1045         * options.cc (finalize): --rosegment-gap implies --rosegment.
1046         * layout.cc (set_segment_offsets): Let user option override
1047         target->rosegment_gap().
1048
1049 2013-05-10  Roland McGrath  <mcgrathr@google.com>
1050
1051         * options.h (General_options): Remove leading space from help
1052         messages for -nostdlib and --rosegment.
1053
1054 2013-05-03  Maciej W. Rozycki  <macro@codesourcery.com>
1055
1056         PR ld/15365
1057         * layout.cc (Layout::finalize): Make __ehdr_start STV_HIDDEN.
1058
1059 2013-05-03  Alan Modra  <amodra@gmail.com>
1060
1061         * merge.cc (Output_merge_string::do_add_input_section): Correct
1062         scan for number of strings.  Rename vars to avoid shadowing.
1063         Include missing terminator in input_size_.
1064
1065 2013-05-01  H.J. Lu  <hongjiu.lu@intel.com>
1066
1067         * merge.cc (Output_merge_string<Char_type>::do_add_input_section):
1068         Restore empty string handling.
1069
1070 2013-05-01  Cary Coutant  <ccoutant@google.com>
1071
1072         * stringpool.cc (Stringpool_template::new_key_offset): Fix
1073         uninitialized warning.
1074
1075 2013-04-29  Alexander Ivchenko  <alexander.ivchenko@intel.com>
1076
1077         * output.cc (Output_section::add_merge_input_section): Allow
1078         to merge sections if the alignment is more than character size.
1079         * merge.h (Output_merge_string::Output_merge_string): Remove
1080         assert.
1081         * merge.cc (Output_merge_string<Char_type>::do_add_input_section): Count
1082         only not-null strings. Check the alignment of strings.
1083         * stringpool.h
1084         (Stringpool_template<Stringpool_char>::Stringpool_template): Add
1085         alignment as the argument.
1086         (Stringpool_template<Stringpool_char>::addralign_): New class member.
1087         * stringpool.cc (Stringpool_template<Stringpool_char>::new_key_offset):
1088         Align non-zero length strings according to the addralign_.
1089         (Stringpool_template<Stringpool_char>::set_string_offsets):
1090         Updating offsets according to the given alignment.
1091         * testsuite/Makefile.am (text_section_grouping): Test if string
1092         literals are getting merged.
1093         * testsuite/Makefile.in: Regenerate.
1094         * testsuite/merge_string_literals_1.c: New file.
1095         * testsuite/merge_string_literals_2.c: Ditto.
1096         * testsuite/merge_string_literals.sh: Ditto.
1097
1098 2013-04-26  Ian Lance Taylor  <iant@google.com>
1099
1100         * target-reloc.h (relocate_section): If the reloc offset is out of
1101         range, pass VIEW as NULL to relocate.relocate.
1102         * arm.cc (Target_arm:Relocate::relocate): Check for a NULL view.
1103         * i386.cc (Target_i386::Relocate::relocate): Likewise.
1104         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
1105         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
1106         * tilegx.cc (Target_tilegx::Relocate::relocate): Likewise.
1107         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
1108
1109 2013-04-26  Geoff Pike  <gpike@chromium.org>
1110
1111         * gold.cc (queue_final_tasks): invoke layout->queue_build_id_tasks().
1112         * layout.cc (Hash_task): New class.
1113         (Layout::queue_build_id_tasks): New function.
1114         (Layout::write_build_id): Handle single-thread portion of build ID
1115         computation.  (In some cases, all of it is single-threaded.)  Replace
1116         {sha1,md5}_process_bytes with {sha1,md5}_buffer to get the same
1117         functionality in fewer lines of code.
1118         * layout.h (Layout::queue_build_id_tasks): New function declaration.
1119         * options.h (General_options): make "--build-id" default to tree
1120         rather than sha1.  Add two new options related to --build-id=tree:
1121         --build-id-chunk-size-for-treehash and
1122         --build-id-min-file-size-for-treehash.
1123         * Makefile.am: add testing of --build-id=tree and related new options
1124         (these tests will be invoked by "make check").
1125         * Makefile.in: Regenerate.
1126
1127 2013-04-25  Alan Modra  <amodra@gmail.com>
1128
1129         * configure.tgt: Add powerpcle and powerpc64le.
1130
1131 2013-04-22  Alan Modra  <amodra@gmail.com>
1132
1133         PR gold/15355
1134         * layout.cc (Layout::segment_precedes): Allow more than one
1135         segment with the same type and flags.
1136
1137 2013-04-15  Cary Coutant  <ccoutant@google.com>
1138
1139         * layout.cc (Layout::set_relocatable_section_offsets): Don't
1140         allocate space in file for BSS sections.
1141
1142 2013-04-15  Cary Coutant  <ccoutant@google.com>
1143
1144         * script-sections.cc (Orphan_output_section): Reset address
1145         to zero after each orphaned section for relocatable links.
1146
1147 2013-04-15  Cary Coutant  <ccoutant@google.com>
1148
1149         * symtab.cc (Symbol_table::sized_write_globals): Subtract
1150         section starting address for relocatable link.
1151         * testsuite/Makefile.am (script_test_11): New test.
1152         * testsuite/Makefile.in: Regenerate.
1153         * testsuite/script_test_11.c: New source file.
1154         * testsuite/script_test_11.t: New linker script.
1155
1156 2013-04-13  Alan Modra  <amodra@gmail.com>
1157
1158         * powerpc.cc (Stub_control::can_add_to_stub_group): Don't set
1159         owner when sections are not adjacent and exceed group size.
1160         (Target_powerpc::group_sections): Handle corner case.
1161         (Target_powerpc::Branch_info::make_stub): Handle case where
1162         stub table doesn't exist due to branches in non-exec sections.
1163         (Target_powerpc::Relocate::relocate): Likewise.
1164
1165 2013-04-11  Alan Modra  <amodra@gmail.com>
1166
1167         PR gold/15354
1168         * powerpc.cc (Target_powerpc::make_brlt_section): Name section
1169         .branch_lt to match bfd ld.  Adjust comments throughout file.
1170
1171 2013-04-04  Ian Lance Taylor  <iant@google.com>
1172
1173         GCC PR c++/56840
1174         * object.cc (do_layout_deferred_sections): Handle .eh_frame
1175         sections before checking whether they are included in the link.
1176
1177 2013-03-29  Sriraman Tallam  <tmsriram@google.com>
1178
1179         * archive.cc (Archive::get_elf_object_for_member):  Create the elf
1180         object before calling the plugin claim_file handler.  Pass the elf
1181         object of the archive to the plugin. Delete the elf object if the
1182         plugin claims the file.
1183
1184 2013-03-21  Alan Modra  <amodra@gmail.com>
1185
1186         * layout.cc (Layout::set_segment_offsets): Accept writable .text
1187         segment when omagic.
1188
1189 2013-03-21  Alan Modra  <amodra@gmail.com>
1190
1191         * dwp.cc (Dwp_output_file::add_contribution): Avoid signed/unsigned
1192         comparison warning.
1193         * layout.cc (Layout::create_dynamic_symtab): Avoid "may be used
1194         uninitialized" warning.
1195
1196 2013-03-20  Alan Modra  <amodra@gmail.com>
1197
1198         * symtab.h (Symbol::clear_version): New function.
1199         * symtab.cc (Symbol_table::set_dynsym_indexes): Don't set object
1200         is_needed by weak references.  Clear version for symbols defined
1201         in as-needed objects that are not needed.
1202
1203 2013-03-15  Alan Modra  <amodra@gmail.com>
1204
1205         * powerpc.cc (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Make
1206         static and public.  Add report_err param.  Return false for data refs.
1207         (Target_powerpc::rela_dyn_section): New overloaded function.
1208         (Target_powerpc::plt_, iplt_): Elucidate.
1209         (Output_data_plt_powerpc::entry_count): Handle current_data_size()==0.
1210         (Output_data_plt_powerpc::do_write): Don't write .iplt.
1211         (Output_data_plt_powerpc::plt_entry_count): Don't add .iplt entries.
1212         (Target_powerpc::Scan::local, global): Adjust reloc_needs_plt_for_ifunc
1213         calls.  Put ifunc dynamic relocs in irela_dyn_section.  Only
1214         push_branch and make_plt_entry for ifunc syms when
1215         reloc_needs_plt_for_ifunc.
1216         (Target_powerpc::Relocate::relocate): Don't use plt entry value
1217         for ifunc unless reloc_needs_plt_for_ifunc.
1218
1219 2013-03-15  Alan Modra  <amodra@gmail.com>
1220
1221         * gc.h (gc_process_relocs): Don't look through function descriptors.
1222         * icf.cc (get_section_contents): Do so here instead.
1223
1224 2013-03-13  Alan Modra  <amodra@gmail.com>
1225
1226         * powerpc.cc (is_branch_reloc): Forward declare.
1227         (Target_powerpc::do_can_check_for_function_pointers): New predicate.
1228         (Target_powerpc::Scan::local_reloc_may_be_function_pointer): Return
1229         false for 64-bit, true for 32-bit non-branch relocs.
1230         (Target_powerpc::Scan::global_reloc_may_be_function_pointer): Likewise.
1231         * testsuite/Makefile.am (icf_test): Use linker map file instead of
1232         nm output.
1233         (icf_safe_test): Generate linker map file as well as nm output.
1234         (icf_safe_so_test): Likewise.
1235         * testsuite/Makefile.in: Regenerate.
1236         * testsuite/icf_test.sh: Parse linker map file to determine
1237         section folding.
1238         * testsuite/icf_safe_test.sh: Likewise.  Expect folding for PowerPC.
1239         * testsuite/icf_safe_so_test.sh: Likewise.
1240         (X86_32_or_ARM_specific_safe_fold): Merge into..
1241         (arch_specific_safe_fold): ..this.
1242         (X86_64_specific_safe_fold): Delete unused function.
1243
1244 2013-03-12  Alan Modra  <amodra@gmail.com>
1245
1246         * gc.h (gc_process_relocs): Look through function descriptors
1247         to determine shndx, symvalue and addend used by ICF.  Tidy
1248         variable duplication.
1249
1250 2013-03-11  Alan Modra  <amodra@gmail.com>
1251
1252         * gold.cc (queue_middle_tasks): Move detect_odr_violations..
1253         * layout.cc (Layout_task_runner::run): ..to here.
1254         * symtab.h (struct Symbol_location): Extract from..
1255         (class Symbol_table): ..here.
1256         * symtab.cc (Symbol_table::linenos_from_loc): Invoke function_location.
1257         * target.h (class Target): Add function_location and
1258         do_function_location functions.
1259         (class Sized_target): Add do_function_location.
1260         * object.h (class Sized_relobj_file): Move find_shdr..
1261         (class Object): ..to here.
1262         * object.cc: Likewise.  Update to suit.  Instantiate.
1263         (Sized_relobj_file::find_eh_frame): Update find_shdr call.
1264         * powerpc.cc (class Powerpc_dynobj): New.
1265         (Target_powerpc::do_function_location): New function.
1266         (Powerpc_relobj::do_find_special_sections): Update find_shdr call.
1267         (Powerpc_dynobj::do_read_symbols): New function.
1268         (Target_powerpc::do_make_elf_object): Make a Powerpc_dynobj.
1269
1270 2013-03-08  Ian Lance Taylor  <iant@google.com>
1271
1272         * options.cc (General_options::string_to_object_format): Accept
1273         "default".
1274
1275 2013-03-08  Alan Modra  <amodra@gmail.com>
1276
1277         * ehframe.h (Post_fdes) Make it a vector of Post_fde rather than
1278         pointer to Post_fde.
1279         (struct Post_fde): Move definition to here..
1280         * ehframe.cc (struct Post_fde): ..from here.
1281         (Cie::write): Don't alloc Post_fde.
1282         (Eh_frame::do_sized_write): Update.  Don't free Post_fde.
1283
1284 2013-03-07  Alan Modra  <amodra@gmail.com>
1285
1286         * testsuite/discard_locals_relocatable_test.c: Add a powerpc
1287         relocation referencing .LC0.
1288         * testsuite/discard_locals_test.sh: Remove FIXMEs.
1289
1290 2013-03-07  Alan Modra  <amodra@gmail.com>
1291
1292         * testsuite/ifunc-sel.h (ifunc_sel, ifunc_one): Mark
1293         always_inline.  Add assembly for powerpc to avoid GOT.
1294
1295 2013-03-07  Alan Modra  <amodra@gmail.com>
1296
1297         * testsuite/script_test_10.sh: Don't test .bss section
1298         header number.
1299
1300 2013-03-06  Alan Modra  <amodra@gmail.com>
1301
1302         * powerpc.cc (class Powerpc_relobj): Move some member functions.
1303         (Target_powerpc::symval_for_branch):  Add symtab param.  Update
1304         all callers.  Handle folded sections.
1305         (Target_powerpc::do_gc_add_reference): Don't cast dynamic object
1306         to Powerpc_relobj.
1307         (Global_symbol_visitor_opd::operator()): Likewise.
1308
1309 2013-03-04  Alan Modra  <amodra@gmail.com>
1310
1311         * testsuite/Makefile.am (final_layout_script.lds): Add .sbss.
1312         * testsuite/Makefile.in: Regenerate.
1313
1314 2013-03-01  Cary Coutant  <ccoutant@google.com>
1315
1316         Add dwp support for v2 DWARF package file format.
1317         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
1318         tu_length parameter.  Adjust all callers.
1319         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
1320         * dwp.cc: Include dwarf.h.
1321         (Section_bounds): New struct type.
1322         (Unit_set): New struct type.
1323         (Dwo_file::Dwo_file): Initialize new data member.
1324         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
1325         Combine and rename to...
1326         (Dwo_file::read_unit_index): ...this.
1327         (Dwo_file::sized_read_compunit_index)
1328         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
1329         (Dwo_file::sized_read_unit_index): ...this.
1330         (Dwo_file::copy_section): Remove section_name, is_str_offsets
1331         parameters; add section_id parameter.
1332         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
1333         (Dwo_file::add_unit_set): ...this.
1334         (Dwo_file::shndx_map_): Remove.
1335         (Dwo_file::sect_offsets_): New data member.
1336         (Dwp_output_file::Dwp_output_file): Initialize new data members.
1337         (Dwp_output_file::add_section): Rename to...
1338         (Dwp_output_file::add_contribution): ...this.
1339         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
1340         (Dwp_output_file::add_tu_set): Likewise.
1341         (Dwp_output_file::Contribution): New type.
1342         (Dwp_output_file::Section::contributions): New data member.
1343         (Dwp_output_file::Cu_or_tu_set): Remove.
1344         (Dwp_output_file::Section::Section): New ctor.
1345         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
1346         (Dwp_output_file::Dwp_index::Section_table): New type.
1347         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
1348         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
1349         parameter.
1350         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
1351         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
1352         (Dwp_output_file::Dwp_index::section_table): New member function.
1353         (Dwp_output_file::Dwp_index::section_table_end): New member function.
1354         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
1355         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
1356         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
1357         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
1358         (Dwp_output_file::Dwp_index::section_table_): New data member.
1359         (Dwp_output_file::Dwp_index::section_mask_): New data member.
1360         (Dwp_output_file::add_output_section): New member function.
1361         (Dwp_output_file::write_new_section): New member function.
1362         (Dwp_output_file::write_contributions): New member function.
1363         (Dwp_output_file::section_id_map_): New data member.
1364         (class Dwo_id_info_reader): Remove.
1365         (class Unit_reader): New class.
1366         (get_dwarf_section_name): New function.
1367         (Dwo_file::read_executable): Adjust initializations of class data.
1368         (Dwo_file::read): Add support for v2 package file format.
1369         (Dwo_file::read_unit_index): Likewise.
1370         (Dwo_file::sized_read_unit_index): Likewise.
1371         (Dwo_file::copy_section): Likewise.
1372         (Dwo_file::add_unit_set): Likewise.
1373         (Dwp_output_file::add_output_section): Likewise.
1374         (Dwp_output_file::add_contribution): Likewise.
1375         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
1376         for empty slot.
1377         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
1378         file format.
1379         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
1380         slot.
1381         (Dwp_output_file::initialize): Remove unused function.
1382         (Dwp_output_file::finalize): Add support for v2 package file format.
1383         (Dwp_output_file::write_index): Likewise.
1384         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
1385         function prototype.
1386
1387 2013-03-01  Cary Coutant  <ccoutant@google.com>
1388
1389         * dwarf_reader.cc (Dwarf_info_reader::check_buffer): Move
1390         function into class definition in header file.
1391         (Dwarf_info_reader::warn_corrupt_debug_section): New function.
1392         * dwarf_reader.h (Dwarf_info_reader::warn_corrupt_debug_section):
1393         New function.
1394         (Dwarf_info_reader::check_buffer): Move here from .cc file.
1395
1396 2013-02-28  Alan Modra  <amodra@gmail.com>
1397
1398         * target.h (Target::plt_fde_location, do_plt_fde_location): Declare.
1399         * target.cc (Target::do_plt_fde_location): New function.
1400         * ehframe.h (class FDE): Add post_map field to u_.from_linker,
1401         accessor function, and constructor param.
1402         (struct Post_fde, Post_fdes): Declare.
1403         (Cie::write): Add post_fdes param.
1404         * ehframe.cc (Fde::write): Use plt_fde_location.
1405         (struct Post_fde): Define.
1406         (Cie::write): Stash FDEs added post merge mapping.
1407         (Eh_frame::add_ehframe_for_plt): Assert no new CIEs after mapping.
1408         Adjust Fde constructor call.  Bump final_data_size_ for post map FDEs.
1409         (Eh_frame::do_sized_write): Arrange to write post map FDES after
1410         other FDEs.
1411         * powerpc.cc (Target_powerpc::do_plt_fde_location): New function.
1412         (Target_powerpc::has_glink): New function.
1413         (Target_powerpc::do_relax): Add eh_frame info for stubs.
1414         (struct Eh_cie, eh_frame_cie, glink_eh_frame_fde_64,
1415         glink_eh_frame_fde_32, default_fde): New data.
1416         (Stub_table::eh_frame_added_): New var.
1417         (Stub_table::find_long_branch_entry, stub_address, stub_offset):
1418         Make const.
1419         (Stub_table::add_eh_frame): New function.
1420         (Output_data_glink::add_eh_frame): New function.
1421         (Target_powerpc::make_glink_section): Call add_eh_frame.
1422
1423 2013-02-15  Ian Lance Taylor  <iant@google.com>
1424
1425         * options.h (DEFINE_uint64_alias): Define.
1426         (class General_options): Add -Ttext-segment as an alias for
1427         -Ttext.
1428
1429 2013-02-15  Alan Modra  <amodra@gmail.com>
1430
1431         * powerpc.cc (Stub_table::plt_off): New function, extracted from..
1432         (Stub_table::do_write): ..here, two places.
1433         (Stub_table::plt_call_size): Use it here too.
1434
1435 2013-02-11  Ian Lance Taylor  <iant@google.com>
1436
1437         * descriptors.cc (Descriptors::close_all): New function.
1438         * descriptors.h (class Descriptors): Declare close_all.
1439         (close_all_descriptors): New inline function.
1440         * plugin.cc: Include "descriptors.h".
1441         (Plugin_manager::cleanup): Call close_all_descriptors.
1442
1443 2013-02-06  Alan Modra  <amodra@gmail.com>
1444
1445         * README: Update coding style link.
1446
1447 2013-01-28  Cary Coutant  <ccoutant@google.com>
1448
1449         * dwp.cc (File_list): New typedef.
1450         (Dwo_name_info_reader): New class.
1451         (Dwo_id_info_reader::Dwo_id_info_reader): Remove unused parameters.
1452         (Dwo_id_info_reader::visit_top_die): Remove unused member function.
1453         (Dwo_file::~Dwo_file): Delete input_file_ after obj_.
1454         (Dwo_file::read_executable): New function.
1455         (Dwo_file::read): Move common setup code to ...
1456         (Dwo_file::make_object): ... here.
1457         (dwp_options): Add --exec/-e.
1458         (usage): Likewise.
1459         (main): Likewise.
1460
1461 2013-01-24  Sriraman Tallam  <tmsriram@google.com>
1462
1463         * layout.cc (Layout::layout): Check for option text_reorder.
1464         (Layout::make_output_section): Ditto.
1465         * options.h (text_reorder): New option.
1466         * output.cc (Input_section_sort_compare): Remove special ordering
1467         of section names.
1468         (Output_section::
1469          Input_section_sort_section_name_special_ordering_compare::
1470          operator()): New function.
1471         (Output_section::sort_attached_input_sections): Use new sort function
1472         for .text.
1473         * output.h (Input_section_sort_section_name_special_ordering_compare):
1474         New struct.
1475         * testsuite/Makefile.am (text_section_grouping): Test option
1476         --no-text-reorder
1477         * testsuite/Makefile.in: Regenerate.
1478         * testsuite/text_section_grouping.sh: Check order of functions without
1479         default text reordering.
1480
1481 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
1482
1483         * options.h (General_options): Change default to true for new_dtags.
1484
1485 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
1486
1487         * layout.cc (Layout::finish_dynamic_section): Only add DT_RPATH
1488         when enable_new_dtags is false.  Only add DT_RUNPATH when
1489         enable_new_dtags is true.
1490
1491 2013-01-17  Serge Pavlov  <serge.v.pavlov@gmail.com>
1492
1493         * powerpc.cc (Stub_table::find_plt_call_entry): Make types
1494         used in declaration and definition consistent.
1495         (Target_powerpc::symval_for_branch): Ditto.
1496
1497 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
1498
1499         * testsuite/plugin_final_layout.cc: Fix comment.
1500
1501 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
1502
1503         * layout.cc (Layout::layout): Do not do default sorting for
1504         text sections when section ordering is specified.
1505         (make_output_section): Ditto.
1506         * testsuite/plugin_final_layout.cc: Name the function sections
1507         to catch reordering issues.
1508
1509 2013-01-15  Alan Modra  <amodra@gmail.com>
1510
1511         * powerpc.cc (Target_powerpc::do_relax): Default shared libs to
1512         plt-thread-safe.
1513
1514 2013-01-15  Alan Modra  <amodra@gmail.com>
1515
1516         * testsuite/Makefile.am (final_layout_script.lds): Handle .got section.
1517         * testsuite/Makefile.in: Regenerate.
1518
1519 2013-01-14  Alan Modra  <amodra@gmail.com>
1520
1521         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add various output files.
1522         * testsuite/Makefile.in: Regenerate.
1523
1524 2013-01-11  Pavel Chupin  <pavel.v.chupin@intel.com>
1525
1526         PR bfd/14430
1527         Fix mingw gold build with plugins enabled
1528         * Makefile.am: Replace -ldl with @DLOPEN_LIBS@.
1529         * configure.ac: Export DLOPEN_LIBS and add headers check.
1530         * plugin.cc: Handle non-dlfcn case.
1531         * Makefile.in: Regenerate.
1532         * config.in: Regenerate.
1533         * configure: Regenerate.
1534         * testsuite/Makefile.in: Regenerate.
1535
1536 2013-01-09  Sriraman Tallam  <tmsriram@google.com>
1537
1538         * output.h (sort_attached_input_sections): Change to be public.
1539         * script-sections.cc
1540         (Output_section_definition::set_section_addresses): Sort
1541         attached input sections according to section order before linker
1542         script assigns section addresses.
1543         (Orphan_output_section::set_section_addresses): Sort
1544         attached input sections according to section order before linker
1545         script assigns section addresses.
1546         * Makefile.am (final_layout.sh): Use a simple linker script to
1547         check if section ordering still works.
1548         * Makefile.in: Regenerate.
1549
1550 2013-01-09  Ben Cheng  <bccheng@google.com>
1551
1552         * arm.cc (Target_arm::attributes_accept_div): New function.
1553         (Target_arm::attributes_forbid_div): New function.
1554         (Target_arm::merge_object_attributes): Merge the Tag_DIV_use
1555         attribute using the same new functions as what bfd/elf32_arm.c
1556         does.
1557
1558 2013-01-07  Cary Coutant  <ccoutant@google.com>
1559
1560         PR gold/14993
1561         * output.cc (Output_section::add_input_section): For incremental
1562         updates, don't track input sections that are allocated from patch
1563         space.
1564
1565 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
1566             Ian Lance Taylor  <iant@google.com>
1567
1568         PR gold/14897
1569         * configure.ac (--enable-ld): Removed.
1570         (install_as_default): Set to yes only for --enable-gold=default
1571         or --disable-ld.
1572         * configure: Regenerated.
1573
1574 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
1575
1576         * options.h (General_options): Add -fuse-ld= for GCC linker
1577         option compatibility.
1578
1579 2013-01-04  Cary Coutant  <ccoutant@google.com>
1580
1581         * configure.ac: Fix typo restoring CXXFLAGS.
1582         * configure: Regenerate.
1583
1584 2013-01-04  Cary Coutant  <ccoutant@google.com>
1585
1586         * testsuite/Makefile.am (CXXLINK_S): New macro.
1587         (debug_msg_so.err, debug_msg_ndebug.err): Use CXXLINK_S.
1588         * testsuite/Makefile.in: Regenerate.
1589
1590 2013-01-02  H.J. Lu  <hongjiu.lu@intel.com>
1591
1592         * version.cc (print_version): Update copyright year to 2013.
1593
1594 2012-12-20  Ian Lance Taylor  <iant@google.com>
1595
1596         * layout.cc (Layout::special_ordering_of_input_section): New
1597         function.
1598         (Layout::layout): If input section requires special ordering, must
1599         sort input sections.
1600         (Layout::make_output_section): May sort .text input sections.
1601         (Layout::is_section_name_prefix_grouped): Remove.
1602         * layout.h (class Layout): Declare
1603         special_ordering_of_input_section.  Don't declare
1604         is_section_name_prefix_grouped.
1605         * output.cc (Output_section::add_input_section): Revert last
1606         change.
1607         (Output_section::Input_section_sort::match_file_name): Don't crash
1608         if called on output section data.
1609         (Output_section::Input_section_sort_compare): Sort based on
1610         special ordering.
1611         (Output_section::Input_section_sort_section_order_index_compare):
1612         Revert last patch.
1613         (Output_section::sort_attached_input_sections): Likewise.
1614
1615 2012-12-18  Sriraman Tallam  <tmsriram@google.com>
1616
1617         * layout.cc (Layout::is_section_name_prefix_grouped): New function.
1618         * layout.h (Layout::is_section_name_prefix_grouped): New function.
1619         * output.cc (Output_section::add_input_section): Check if section
1620         name contains special prefix.  Keep input sections to sort such
1621         sections.
1622         (Output_section::Input_section_sort_section_order_index_compare
1623          ::operator()): Group sections according to prefixes.
1624         (Output_section::sort_attached_input_sections): Add condition to
1625         Input_section_entry constructor call.
1626         * testsuite/Makefile.am (text_section_grouping): New test.
1627         * testsuite/Makefile.in: Regenerate.
1628         * testsuite/text_section_grouping.cc: New file.
1629         * testsuite/text_section_grouping.sh: New file.
1630
1631 2012-12-17  Nick Clifton  <nickc@redhat.com>
1632
1633         * Makefile.am: Add copyright notice.
1634         * NEWS: Likewise.
1635         * README: Likewise.
1636         * configure.ac: Likewise.
1637         * ftruncate.c: Likewise.
1638         * Makefile.in: Regenerate.
1639
1640 2012-12-14  Cary Coutant  <ccoutant@google.com>
1641
1642         * testsuite/Makefile.am (exception_separate_shared_12_test): Add
1643         --no-as-needed flag.
1644         (exception_separate_shared_12_test): Likewise.
1645         (incremental_copy_test): Likewise.
1646         * testsuite/Makefile.in: Regenerate.
1647
1648 2012-12-14  Cary Coutant  <ccoutant@google.com>
1649
1650         * dwp.cc (Dwp_output_file::add_cu_set): Check for duplicate CUs.
1651         (Dwp_output_file::Dwp_index::enter_set): Add assert.
1652
1653 2012-12-12  Alan Modra  <amodra@gmail.com>
1654
1655         * powerpc.cc (class Track_tls): New.
1656         (class Relocate, class Scan): Inherit Track_tls.
1657         (Target_powerpc::Scan::local, global): Track tls optimization
1658         and avoid creating plt entry for __tls_get_addr if all uses
1659         are optimized away.
1660         (Target_powerpc::Relocate::relocate): Update to use Track_tls.
1661
1662 2012-12-12  Alan Modra  <amodra@gmail.com>
1663
1664         * options.h (General_options): Add --toc-sort/--no-toc-sort.
1665         Replace no_toc_optimize with toc_optimize.
1666         * output.h (Output_section::input_sections): Provide non-const variant.
1667         * powerpc.cc (Powerpc_relobj::has_small_toc_reloc_,
1668         set_has_small_toc_reloc, has_small_toc_reloc): New variable and
1669         accessors.
1670         (Target_powerpc::Scan::local, global): Call set_has_small_toc_reloc.
1671         (class Sort_toc_sections): New.
1672         (Target_powerpc::do_finalize_sections): Sort toc sections.
1673         (Target_powerpc::Relocate::relocate): Update toc_optimize test.
1674
1675 2012-12-10  Roland McGrath  <mcgrathr@google.com>
1676
1677         * testsuite/binary_unittest.cc (read_all): New function.
1678         (Sized_binary_test): Use it instead of ::read.
1679         * fileread.cc (do_read): Don't assume pread always reads the whole
1680         amount in a single call.
1681
1682 2012-12-10  Alan Modra  <amodra@gmail.com>
1683
1684         * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
1685         Set EM_PPC64 or EM_PPC here.
1686         (Target_selector_powerpc::do_recognize): Delete.
1687
1688 2012-12-10  Alan Modra  <amodra@gmail.com>
1689
1690         * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
1691         stub_table_.
1692         (Target_powerpc::Branch_info::make_stub): Don't omit addend.
1693
1694 2012-12-07  Roland McGrath  <mcgrathr@google.com>
1695
1696         * testsuite/binary_unittest.cc (Sized_binary_test):
1697         Use open_descriptor rather than ::open.
1698
1699 2012-12-07  Alan Modra  <amodra@gmail.com>
1700
1701         * powerpc.cc (Stub_table::do_write): Delete redundant Address
1702         typedef and invalid_address constant.
1703         (Output_data_glink, Stub_table, Target_powerpc): Explicitly
1704         instantiate constants.
1705
1706 2012-12-06  Roland McGrath  <mcgrathr@google.com>
1707
1708         * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
1709         Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
1710         * aclocal.m4: Regenerate.
1711         * configure: Regenerate.
1712         * Makefile.in: Regenerate.
1713         * testsuite/Makefile.in: Regenerate.
1714
1715 2012-12-07  Alan Modra  <amodra@gmail.com>
1716
1717         * options.h (General_options): Add no_toc_optimize.
1718         * powerpc.cc (ok_lo_toc_insn): New function.
1719         (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
1720
1721 2012-12-06  Alan Modra  <amodra@gmail.com>
1722
1723         * options.h (General_options): Add plt_align, plt_static_chain,
1724         plt_thread_safe.  Update stub_group_size help text.
1725         * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
1726         for new plt_thread_safe_ var.
1727         (use_plt_offset): Correct comments.
1728         (Target_powerpc::do_relax): Look for thread creation symbols to
1729         determine default plt_thread_safe value.  Clear plt call stubs
1730         as well as branch stubs each iteration.
1731         (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
1732         insn constants.
1733         (l, hi, ha, write_insn): Move earlier.
1734         (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
1735         (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
1736         plt stubs too.
1737         (Stub_table::update_size): Adjust.
1738         (Stub_table::prev_size, set_prev_size): Delete.
1739         (Stub_table::stub_align): Let --plt-align affect result.
1740         (Stub_table::plt_call_size): Calculate sizes for various stubs.
1741         (Stub_table::branch_stub_size): Use last_plt_size in address calc.
1742         (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
1743         (Stub_table::do_write): Support more stub variants.
1744
1745 2012-12-04  Alan Modra  <amodra@gmail.com>
1746
1747         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
1748         (Target_powerpc::do_define_standard_symbols): New function.
1749
1750 2012-12-03  Alan Modra  <amodra@gmail.com>
1751
1752         * output.h: Formatting, whitespace.
1753
1754 2012-12-03  Alan Modra  <amodra@gmail.com>
1755
1756         * layout.h (Layout::get_executable_sections): Declare.
1757         * layout.cc (Layout::get_executable_sections): New function.
1758         * arm.cc (Target_arm::group_sections): Use it.
1759         (Arm_output_section::group_sections): Delete now redundant test.
1760         * output.cc (Output_reloc::Output_reloc): Add is_relative.
1761         param to handle relative relocs.
1762         * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
1763         (Output_data_reloc::add_absolute): Adjust.
1764         (Output_data_reloc::add_relative): New function.
1765         (Output_data::reset_data_size): New function.
1766         (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
1767         (Output_section::set_addralign): New function.
1768         (Output_section::checkpoint_set_addralign): New function.
1769         (Output_section::clear_section_offsets_need_adjustment): New function.
1770         (Output_section::input_sections): Make public.
1771         * powerpc.cc (class Output_data_brlt_powerpc): New.
1772         (class Stub_table, class Stub_control): New.
1773         (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
1774         stub_table_, set_stub_table, stub_table): New vectors and accessor
1775         functions.
1776         (Target_powerpc::do_may_relax, do_relax, push_branch,
1777         new_stub_table, stub_tables, brlt_section, group_sections,
1778         add_branch_lookup_table, find_branch_lookup_table,
1779         write_branch_lookup_table, make_brlt_section): New functions.
1780         (Target_powerpc::struct Sort_sections, class Branch_info): New.
1781         (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
1782         branch_info_): New vars.
1783         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
1784         make call stubs here.
1785         (Output_data_glink): Remove all call stub handling from this class.
1786         (Target_powerpc::Scan::local, global): Save interesting branch
1787         relocs and relocs for ifunc.  Adjust calls to plt entry functions.
1788         (Target_powerpc::do_finalize_sections): Only make reg save/restore
1789         functions on final link.
1790         (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
1791         Handle long branch destinations too.
1792         (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
1793         do_plt_address_for_local): Adjust lookup of plt call stubs.
1794
1795 2012-11-30  Alan Modra  <amodra@gmail.com>
1796
1797         * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
1798         relocs against protected symbols when building 32-bit shared libs.
1799
1800 2012-11-30  Alan Modra  <amodra@gmail.com>
1801
1802         * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
1803         param.  Call got_section() to make .got.  Update all callers
1804         and their callers and so on.
1805
1806 2012-11-30  Alan Modra  <amodra@gmail.com>
1807
1808         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
1809         _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
1810         (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
1811         value if it already exists.
1812
1813 2012-11-19  H.J. Lu  <hongjiu.lu@intel.com>
1814
1815         PR gold/14858
1816         * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
1817
1818 2012-11-14  Roland McGrath  <mcgrathr@google.com>
1819
1820         * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
1821         than bfc instruction for data sandboxing.
1822
1823 2012-11-08  Alan Modra  <amodra@gmail.com>
1824
1825         * po/POTFILES.in: Regenerate.
1826
1827 2012-11-05  Alan Modra  <amodra@gmail.com>
1828
1829         * configure.ac: Apply 2012-09-10 change to config.in here.
1830         * configure: Regenerate.
1831
1832 2012-11-05  Alan Modra  <amodra@gmail.com>
1833
1834         * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
1835         (struct Opd_ent): Use "Address" rather than "Offset".
1836         (Output_data_got_powerpc::got_base_offset): Return Valtype.
1837         (Target_powerpc::got_section): Make public.
1838         (Target_powerpc::scan_relocs): Move code setting symbols..
1839         (Powerpc_relobj::do_scan_relocs): ..to here, new function.
1840         Create _SDA_BASE_ only when referenced.
1841
1842 2012-11-02  Roland McGrath  <mcgrathr@google.com>
1843
1844         * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
1845         from last change.
1846
1847 2012-11-01  Roland McGrath  <mcgrathr@google.com>
1848
1849         * target.h (Sized_target::relocate_relocs): Use Elf_Off
1850         for offset_in_output_section parameter.
1851         (Sized_target::relocate_special_relocatable): Likewise.
1852         * arm.cc (Target_arm::relocate_relocs): Likewise.
1853         (Target_arm::relocate_special_relocatable): Likewise.
1854         * i386.cc (Target_i386::relocate_relocs): Likewise.
1855         * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
1856         * sparc.cc (Target_sparc::relocate_relocs): Likewise.
1857         * target-reloc.h (relocate_relocs): Likewise.
1858         * testsuite/testfile.cc (Target_test): Likewise.
1859         * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
1860         * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
1861
1862         * system.h: Move inclusion of <clocale> to after <libintl.h> in
1863         [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
1864
1865         * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
1866         parameter, which is unused in the [!F_SETFD] case.
1867
1868         * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
1869         SYMNDX to off_t before comparing it to this->data_size().
1870         * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
1871         * incremental.cc (Output_section_incremental_inputs::do_write):
1872         Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
1873
1874         * nacl.cc: Include "libiberty.h" for vasprintf declaration.
1875
1876 2012-10-30  Steve McIntyre  <steve.mcintyre@linaro.org>
1877
1878         * gold.cc (Target_arm::do_adjust_elf_header): Add the
1879         hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
1880         in EABI_VER5.
1881
1882 2012-10-29  Cary Coutant  <ccoutant@google.com>
1883
1884         * dwp.cc (usage): Add file and exit status parameters;
1885         add --help and --version options.
1886         (print_version): New function.
1887         (main): Add --help and --version options.
1888
1889 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1890
1891         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
1892         final_layout_sequence.txt.
1893         * testsuite/Makefile.in: Regenerated.
1894
1895 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1896
1897         * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
1898         COMPILE generated by automake.
1899         (LINK1): Likewise.
1900         (CXXCOMPILE1): Likewise.
1901         (CXXLINK1): Likewise.
1902         (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
1903         (LINK): Likewise.
1904         (CXXCOMPILE): Likewise.
1905         (CXXLINK): Likewise.
1906         * testsuite/Makefile.in: Regenerated.
1907
1908 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1909
1910         * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
1911         on bad fwrite return.
1912
1913 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1914
1915         * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
1916         on val.
1917
1918 2012-10-23  Cary Coutant  <ccoutant@google.com>
1919
1920         * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
1921         * testsuite/Makefile.in: Regenerate.
1922         * testsuite/dwp_test.h: New source file.
1923         * testsuite/dwp_test_1.cc: New source file.
1924         * testsuite/dwp_test_1.s: New source file.
1925         * testsuite/dwp_test_1.sh: New source file.
1926         * testsuite/dwp_test_1b.cc: New source file.
1927         * testsuite/dwp_test_1b.s: New source file.
1928         * testsuite/dwp_test_2.cc: New source file.
1929         * testsuite/dwp_test_2.s: New source file.
1930         * testsuite/dwp_test_2.sh: New source file.
1931         * testsuite/dwp_test_main.cc: New source file.
1932         * testsuite/dwp_test_main.s: New source file.
1933
1934 2012-10-23  Cary Coutant  <ccoutant@google.com>
1935
1936         * dwp.h: New header file.
1937         * dwp.cc: New source file.
1938         * gold.h: Move shared declarations to system.h.
1939         * system.h: New header file.
1940         * Makefile.am: Add dwp.
1941         * Makefile.in: Regenerate.
1942
1943 2012-10-23  Cary Coutant  <ccoutant@google.com>
1944
1945         * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
1946         Dwarf_info_reader::read_from_pointer.
1947         (Dwarf_pubnames_table::read_header): Likewise.
1948         (Dwarf_pubnames_table::next_name): Likewise.
1949         (Dwarf_die::read_attributes): Likewise.
1950         (Dwarf_die::skip_attributes): Likewise.
1951         (Dwarf_info_reader::read_from_pointer): New function template.
1952         * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
1953         (Dwarf_pubnames_table): Likewise.
1954         (Dwarf_info_reader::read_from_pointer): New function template.
1955         * gdb-index.cc (Gdb_index_info_reader): Adjust call to
1956         Dwarf_pubnames_table ctor.
1957
1958 2012-10-23  Cary Coutant  <ccoutant@google.com>
1959
1960         * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
1961         abbrev_shndx.
1962         * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
1963         abbrev_shndx_.
1964         (Dwarf_info_reader::set_abbrev_shndx): New method.
1965         (Dwarf_info_reader::abbrev_shndx_): New data member.
1966
1967 2012-10-23  Cary Coutant  <ccoutant@google.com>
1968
1969         * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
1970         from object, not parameters.
1971         (Dwarf_info_reader::parse): Likewise.
1972         * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
1973         (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
1974         (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
1975         methods.
1976
1977 2012-10-23  Cary Coutant  <ccoutant@google.com>
1978
1979         * fileread.cc (Input_file::Input_file): New constructor.
1980         * fileread.h (class Input_file): Add new constructor.
1981
1982 2012-10-18  Alan Modra  <amodra@gmail.com>
1983
1984         PR gold/14727
1985         * object.cc (Relobj::is_section_name_included): Also match
1986         .sdata personality section.
1987
1988 2012-10-18  Alan Modra  <amodra@gmail.com>
1989
1990         * target-reloc.h (class Default_comdat_behavior): New, package up..
1991         (get_comdat_behaviour): ..this.
1992         (relocate_section): Add Relocate_comdat_behavior template arg,
1993         adjust code to suit.
1994         * arm.cc (Target_arm::relocate_section): Adjust to suit.
1995         (Target_arm::scan_reloc_section): Likewise.
1996         * i386.cc (Target_i386::relocate_section): Likewise.
1997         * sparc.cc (Target_sparc::relocate_section): Likewise.
1998         * tilegx.cc (Target_tilegx::relocate_section): Likewise.
1999         * x86_64.cc (Target_x86_64::relocate_section): Likewise.
2000         * powerpc.cc (class Relocate_comdat_behavior): New.
2001         (Target_powerpc::relocate_section): Don't zap opd relocs.  Supply
2002         gold::relocate_section with new template arg.
2003
2004 2012-10-18  Alan Modra  <amodra@gmail.com>
2005
2006         * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
2007         dynamic relocs for GOT_TPREL got entries, without symbol if
2008         resolving locally.
2009         (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
2010         (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
2011         (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
2012
2013 2012-10-17  Alan Modra  <amodra@gmail.com>
2014
2015         PR gold/14726
2016         * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
2017
2018 2012-10-16  Sriraman Tallam  <tmsriram@google.com>
2019
2020         * layout.cc (Layout::include_section): Keep sections marked
2021         SHF_EXCLUDE when doing relocatable links.
2022
2023 2012-10-16  Alan Modra  <amodra@gmail.com>
2024
2025         * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
2026         (Target_powerpc::do_finalize_sections): Call it.
2027         (Output_data_save_res): New class and supporting functions.
2028         (Target_powerpc::symval_for_branch): Only look up .opd entry for
2029         normal symbols defined in object files.
2030
2031 2012-10-12  Alan Modra  <amodra@gmail.com>
2032
2033         * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
2034         (struct Opd_ent): Make "discard" a bit field.  Add "gc_mark".
2035         (Target_powerpc::do_gc_mark_symbol): Delay marking function code
2036         section if scan_opd_relocs not yet called.
2037         (Target_powerpc::gc_process_relocs): Call process_gc_mark.
2038
2039 2012-10-12  Alan Modra  <amodra@gmail.com>
2040
2041         * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
2042         add_local_ifunc_entry): Revert last change.
2043         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
2044
2045 2012-10-05  Alan Modra  <amodra@gmail.com>
2046
2047         * powerpc.cc (Target_powerpc::do_plt_address_for_local,
2048         do_plt_address_for_global): New functions.
2049         (Output_data_got_powerpc::do_write): Don't segfault when linking
2050         statically.
2051         (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
2052         add_local_ifunc_entry): Return true on adding entry..
2053         (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
2054         glink->add_entry call.  Remove unused symtab param.  Adjust calls.
2055         (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
2056         (Target_powerpc::make_iplt_section): Remove symtab param.  Don't
2057         set up symbols here.
2058         (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
2059         syms here.  Do so even when no .iplt.  Don't segfault when linking
2060         statically.
2061         (Output_data_glink::add_entry, find_entry): Rearrange params.  Add
2062         new variants without reloc param.
2063         (Glink_sym_ent::Glink_sym_ent): Likewise.
2064         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
2065         reloc when refs will resolve to plt call stub.
2066         (Target_powerpc::Scan::local): Correct ifunc handling.  Allow
2067         R_PPC_PLTREL24 to resolve locally.
2068         (Target_powerpc::Scan::global): Correct ifunc handling.
2069         (Target_powerpc::Relocate::relocate): Correct local sym glink
2070         lookup.  Don't destroy "value" when we have a plt call stub,
2071         and when checking plt call validity.
2072         (Target_powerpc::do_dynsym_value): Simplify.
2073
2074 2012-10-05  Alan Modra  <amodra@gmail.com>
2075
2076         * i386.cc (Output_data_plt_i386::address_for_global,
2077         address_for_local): Add plt offset to returned value.  Adjust uses.
2078         * sparc.cc (Output_data_plt_sparc::address_for_global,
2079         address_for_local): Likewise.
2080         * tilegx.cc (Output_data_plt_tilegx::address_for_global,
2081         address_for_local): Likewise.
2082         * x86_64.cc (Output_data_plt_x86_64::address_for_global,
2083         address_for_local): Likewise.
2084         * target.h (Target::plt_address_for_global, plt_address_for_local):
2085         Update comment.
2086         * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
2087         (Output_data_got::Got_entry::write): Nor here.
2088         * output.h: Comment fix.
2089
2090 2012-10-02  Jiong Wang  <jiwang@tilera.com>
2091
2092         * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
2093         global_offset_table_ value for larget got.
2094         (Target_tilegx::Relocate::relocate): Handle adjusted got value.
2095
2096 2012-09-29  Alan Modra  <amodra@gmail.com>
2097
2098         * powerpc.cc (Target_powerpc::iplt_): New output section.
2099         (Target_powerpc::iplt_section, make_iplt_section,
2100         reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
2101         (Target_powerpc::make_plt_entry): Handle ifunc syms.
2102         Target_powerpc::plt_entry_count): Count iplt entries too.
2103         (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
2104         reloc section in constructor.  New params.
2105         (Target_powerpc::make_plt_section): Create reloc section here instead.
2106         (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
2107         functions.
2108         (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
2109         (Output_data_glink::add_entry, find_entry): New functions to
2110         deal with local syms.
2111         (Glink_sym_ent): Add support for local syms.
2112         (Output_data_glink::do_write): Handle ifunc plt entries.
2113         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
2114         (Target_powerpc::Scan::local, global): Handle ifunc syms.
2115         (Target_powerpc::Relocate::relocate): Likewise.
2116         (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
2117
2118 2012-09-25  Alan Modra  <amodra@gmail.com>
2119
2120         * object.h (Sized_relobj_file::adjust_local_symbol,
2121         do_adjust_local_symbol): New functions.
2122         * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
2123         * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
2124         (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
2125         and irregular opd entry spacing.
2126         (Powerpc_relobj::do_read_relocs): Add opd size checks.
2127         (Global_symbol_visitor_opd): New functor.
2128         (Target_powerpc::do_finalize_sections): Omit global symbols defined
2129         on deleted opd entries.
2130
2131 2012-09-15  Jiong Wang  <jiwang@tilera.com>
2132
2133         * tilegx.cc: New file.
2134         * Makefile.am (TARGETSOURCES): Add tilegx.cc
2135         (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
2136         * configure.tgt: Add entries for tilegx*.
2137         * configure.ac: Likewise.
2138         * Makefile.in: Rebuild.
2139         * configure: Likewise.
2140         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
2141         tilegx.
2142
2143 2012-09-13  Alan Modra  <amodra@gmail.com>
2144
2145         * target-reloc.h (scan_relocs): Call scan.local for relocs
2146         against symbols in discarded sections.  Pass is_discarded
2147         param.
2148         * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
2149         Add is_discarded param.
2150         * powerpc (Target_powerpc::Scan::local): Likewise.  Use
2151         is_discarded to flag opd entry as discarded.  Don't emit dyn
2152         relocs on such entries.
2153         (Target_powerpc::Scan::global): Similarly detect and handle
2154         such opd entries.
2155         (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
2156         opd_ent_.  Update all uses.
2157         (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
2158         (Target_powerpc::relocate_section): Zero out discarded opd
2159         entry relocs.
2160
2161 2012-09-12  Ian Lance Taylor  <iant@google.com>
2162
2163         PR gold/14570
2164         * output.cc: Rename Output_data_got template parameter from size
2165         to got_size for all functions.  Compile all variants of
2166         Output_data_got.
2167         (Output_data_got::Got_entry::write): Correct use of size for
2168         symbol value.  Use local_is_tls rather than casting to
2169         Sized_relobj_file.
2170         * object.h (class Object): Add local_is_tls and do_local_is_tls.
2171         (class Sized_relobj_file): Add do_local_is_tls.
2172         * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
2173
2174 2012-09-11  Alan Modra  <amodra@gmail.com>
2175
2176         PR gold/14566
2177         * layout.cc (Layout::set_segment_offsets): When using
2178         common-page-size alignment, ensure we are on a new max-page-size
2179         page.
2180         * output.cc (Output_segment::set_section_addresses): Use
2181         abi_pagesize, not common_pagesize for relro boundary.
2182         (Output_segment::set_offset): Likewise.
2183
2184 2012-09-11  Alan Modra  <amodra@gmail.com>
2185
2186         * output.h (Output_data_got::add_global_tls, add_local_tls,
2187         add_local_tls_pair): New functions.
2188         (Output_data_got::add_local_pair_with_rel): Remove second
2189         reloc param.  Expand comment.
2190         (Output_data_got::Got_entry): Rename use_plt_offset_ to
2191         use_plt_or_tls_offset_, similarly for constructor param.
2192         (Output_data_got::Got_entry::write): Add got_index param.
2193         * output.cc (Output_data_got::add_global_tls, add_local_tls,
2194         add_local_tls_pair): New functions.
2195         (Output_data_got::Got_entry::write): Handle tls symbols
2196         with use_plt_or_tls_offset_ set specially.
2197         (Output_data_got::add_local_pair_with_rel): Only one reloc.
2198         (Output_data_got::do_write): Replace iterator with index, pass
2199         index to entry write function.
2200         * target.h (Target::tls_offset_for_local, tls_offset_for_global,
2201         do_tls_offset_for_local, do_tls_offset_for_global): New functions.
2202         * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
2203         call.
2204         * i386.cc (Target_i386::Scan::local): Likewise.
2205         * sparc.cc (Target_sparc::Scan::local): Likewise.
2206         * x86_64.cc (Target_x86_64::Scan::local): Likewise.
2207         * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
2208         do_tls_offset_for_global): New functions.
2209         (Target_powerpc::Scan::local): Correct TLS relocations and got
2210         entry values.
2211         (Target_powerpc::Scan::global): Don't emit unnecessary
2212         dynamic relocations on TLS GOT entries.
2213
2214 2012-09-10  Matthias Klose  <doko@ubuntu.com>
2215
2216         * config.in: Disable sanity check for kfreebsd.
2217
2218 2012-09-10  Sterling Augustine  <saugustine@google.com>
2219
2220         * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
2221         (Gdb_index::pubtypes_read): New parameter.
2222         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
2223         to calls.
2224         * gdb-index.h (Gdb_index): New fields pubnames_object_ and
2225         pubtypes_object_.
2226
2227 2012-09-09  Alan Modra  <amodra@gmail.com>
2228
2229         * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
2230         (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
2231         * gc.h (gc_process_relocs): Call target gc_add_reference.
2232         * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
2233         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
2234         (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
2235         unnecessary cast.
2236         * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
2237         to cater for when we don't need code offset.  Update use.
2238         (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
2239         (Powerpc_relobj::access_from_map, add_reference, opd_valid,
2240         set_opd_valid): New functions.
2241         (Target_powerpc::do_gc_add_reference): New function.
2242         (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
2243         stashed refs.
2244         (Target_powerpc::do_gc_mark_symbol): New function.
2245
2246 2012-09-06  Cary Coutant  <ccoutant@google.com>
2247
2248         * dwarf_reader.cc (Dwarf_die::read_attributes): Add
2249         DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
2250         (Dwarf_die::skip_attributes): Likewise.
2251         * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
2252         * testsuite/gdb_index_test.cc (inline_func_1): New function.
2253         (main): Call it.
2254         * testsuite/gdb_index_test_comm.sh: Check index for inline function.
2255
2256 2012-09-05  H.J. Lu  <hongjiu.lu@intel.com>
2257
2258         * testsuite/script_test_3.t: Add .got.plt output section
2259         statement.
2260         * testsuite/script_test_4.t: Likewise.
2261
2262 2012-09-05  Alan Modra  <amodra@gmail.com>
2263
2264         * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
2265         update all uses and lose "enum" when using type.
2266
2267 2012-09-05  Alan Modra  <amodra@gmail.com>
2268
2269         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
2270         * configure: Regenerate.
2271         * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
2272         (plugin_final_layout.stdout): Likewise.
2273         (memory_test): Set page sizes to 0x1000.
2274         * testsuite/Makefile.in: Regenerate.
2275         * testsuite/discard_locals_test.sh: Add FIXME comment.
2276         * testsuite/justsyms_exec.c: Disable function test for powerpc64.
2277         * testsuite/pr14265.t: Add .got output section statement.
2278         * testsuite/script_test_2.t: Likewise.
2279         * testsuite/script_test_3.t: Likewise.
2280         * testsuite/script_test_4.t: Likewise.
2281         * testsuite/script_test_5.t: Likewise.
2282         * testsuite/script_test_6.t: Likewise.
2283         * testsuite/script_test_7.t: Likewise.
2284         * testsuite/script_test_9.t: Likewise.
2285
2286 2012-09-05  Alan Modra  <amodra@gmail.com>
2287
2288         * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
2289         (Powerpc_relocate_functions::Status): New typedef.
2290         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
2291         (Target_powerpc::Scan::local): Handle REL64.
2292         (Target_powerpc::Scan::global): Likewise, and dynamic relocs
2293         for REL32 and REL64.
2294         (Target_powerpc::symval_for_branch): New function, extracted from..
2295         (Target_powerpc::Relocate::relocate): ..here.  Correct plt call
2296         checks.  Report overflow errors.
2297
2298 2012-09-05  Alan Modra  <amodra@gmail.com>
2299
2300         * object.h (Sized_relobj_file::emit_relocs): Delete.
2301         (Sized_relobj_file::emit_relocs_reltype): Delete.
2302         * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
2303         relocate_relocs for --emit-relocs.
2304         (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
2305         * output.h: Update comment.
2306         (Output_segment::first_section): New function.
2307         (Output_segment::first_section_load_address): Use first_section.
2308         * output.cc (Output_segment::first_section): New function extracted..
2309         (Output_segment::first_section_load_address): ..from here.  Delete.
2310         * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
2311         * target.h (Sized_target::relocate_for_relocatable): Likewise.
2312         * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
2313         adjust call to target.h function.
2314         * i386.cc (Target_i386): Likewise.
2315         * sparc.cc (Target_sparc): Likewise.
2316         * x86_64.cc (Target_x86_64): Likewise.
2317         * powerpc.cc (Target_powerpc): Likewise.
2318         (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS.  Ensure
2319         first tls section has section symbol for optimised local dynamic
2320         output relocs.
2321         (Target_powerpc::Relocate::relocate): Correct local dynamic value.
2322         (Target_powerpc::relocate_relocs): Adjust relocs emitted for
2323         optimised tls code.
2324         * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
2325         Rename to relocate_relocs.  Update error message.
2326
2327 2012-09-04  Andreas Schwab  <schwab@linux-m68k.org>
2328
2329         * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
2330         --just-symbols.
2331
2332 2012-08-31  Alan Modra  <amodra@gmail.com>
2333
2334         * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
2335         (Powerpc_relobj::toc_base_offset): New stub function.
2336         (Target_powerpc): Add tp_offset, dtp_offset.  Rename
2337         got_mod_index_offset to tlsld_got_offset.  Update all refs.
2338         (Target_powerpc::Relocate::enum skip_tls): New.
2339         (Target_powerpc::call_tls_get_addr_): New var.
2340         (Target_powerpc::is_branch_reloc): Move to file scope.
2341         (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
2342         (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
2343         New functions.
2344         (Target_powerpc::enum Got_type): Delete old values, add new ones.
2345         (powerpc_info): Correct common_pagesize for ppc64.
2346         (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
2347         (Powerpc_relocate_functions): Add overflow check enums and functions.
2348         Add non-shift version of rela, rela_ua.  Delete all rel public
2349         functions.  Delete addr16_lo.  Add addr64, addr64_u, addr32,
2350         addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
2351         addr16_ha3, addr14 functions.
2352         (Output_data_got_powerpc::add_constant_pair): New function.
2353         (Output_data_got_powerpc::got_base_offset): Likewise.
2354         (Output_data_got_powerpc::do_write): Correct 64-bit got header.
2355         (instruction constants): Sort, add some more.
2356         (Output_data_glink::do_write): Add and use Address typedef.  Use
2357         object->toc_base_offset() stub for 64-bit.
2358         (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
2359         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
2360         (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
2361         for R_PPC64_TOC.  Handle more relocs.  Generate got entries for TLS.
2362         Always treat .opd relocs as against locally defined symbol.
2363         Correct condition for RELATIVE relocs.
2364         (Target_powerpc::do_finalize_sections): Test for NULL sections.
2365         (Target_powerpc::Relocate::relocate): Use plt call stub as value
2366         for 32-bit syms with a plt entry.  Correct ppc64 toc base
2367         calculations.  Handle TLS relocs, and more.  Add overflow
2368         checking and adjust for Powerpc_relocate_functions changes.
2369         (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
2370         Reinstate --emit-relocs code with FIXME.
2371
2372 2012-08-30  Alan Modra  <amodra@gmail.com>
2373
2374         * layout.cc (Layout::set_segment_offsets): Set p_align to
2375         abi_pagesize, not common_pagesize.
2376         (Layout::relaxation_loop_body): Similarly use abi_pagesize
2377         to determine whether file header can go in segment.
2378
2379 2012-08-30  Alan Modra  <amodra@gmail.com>
2380
2381         * output.h (Output_reloc::Output_reloc <output section>): Add
2382         is_relative param.  Adjust calls.
2383         (Output_reloc::add_output_section_relative): New functions.
2384         * output.cc (Output_reloc::Output_reloc <output section>): Handle
2385         is_relative.
2386         (Output_reloc::symbol_value): Handle SECTION_CODE.
2387
2388 2012-08-24  Sriraman Tallam  <tmsriram@google.com>
2389
2390         * gold.cc (queue_middle_tasks): Call layout again when unique
2391         segments for sections is desired.
2392         * layout.cc (Layout::Layout): Initialize new members.
2393         (Layout::get_output_section_flags): New function.
2394         (Layout::choose_output_section): Call get_output_section_flags.
2395         (Layout::layout): Make output section for mapping to a unique segment.
2396         (Layout::insert_section_segment_map): New function.
2397         (Layout::attach_allocated_section_to_segment): Make unique segment for
2398         output sections marked so.
2399         (Layout::segment_precedes): Check for unique segments when sorting.
2400         * layout.h (Layout::Unique_segment_info): New struct.
2401         (Layout::Section_segment_map): New typedef.
2402         (Layout::insert_section_segment_map): New function.
2403         (Layout::get_output_section_flags): New function.
2404         (Layout::is_unique_segment_for_sections_specified): New function.
2405         (Layout::set_unique_segment_for_sections_specified): New function.
2406         (Layout::unique_segment_for_sections_specified_): New member.
2407         (Layout::section_segment_map_): New member.
2408         * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
2409         Rename is_gc_pass_one to is_pass_one.
2410         Rename is_gc_pass_two to is_pass_two.
2411         Rename is_gc_or_icf to is_two_pass.
2412         Check for which pass based on whether symbols data is present.
2413         Make it two pass when unique segments for sections is desired.
2414         * output.cc (Output_section::Output_section): Initialize new
2415         members.
2416         * output.h (Output_section::is_unique_segment): New function.
2417         (Output_section::set_is_unique_segment): New function.
2418         (Output_section::is_unique_segment_): New member.
2419         (Output_section::extra_segment_flags): New function.
2420         (Output_section::set_extra_segment_flags): New function.
2421         (Output_section::extra_segment_flags_): New member.
2422         (Output_section::segment_alignment): New function.
2423         (Output_section::set_segment_alignment): New function.
2424         (Output_section::segment_alignment_): New member.
2425         (Output_segment::Output_segment): Initialize is_unique_segment_.
2426         (Output_segment::is_unique_segment): New function.
2427         (Output_segment::set_is_unique_segment): New function.
2428         (Output_segment::is_unique_segment_): New member.
2429         * plugin.cc (allow_unique_segment_for_sections): New function.
2430         (unique_segment_for_sections): New function.
2431         (Plugin::load): Add new functions to transfer vector.
2432         * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
2433         * Makefile.in: Regenerate.
2434         * testsuite/plugin_final_layout.sh: Check if unique segment
2435         functionality works.
2436         * testsuite/plugin_section_order.c (onload): Check if new interfaces
2437         are available.
2438         (allow_unique_segment_for_sections): New global.
2439         (unique_segment_for_sections): New global.
2440         (claim_file_hook): Call allow_unique_segment_for_sections.
2441         (all_symbols_read_hook): Call unique_segment_for_sections.
2442
2443 2012-08-22  Cary Coutant  <ccoutant@google.com>
2444
2445         * layout.cc (Layout::include_section): Don't assert on GROUP
2446         sections with --emit-relocs.
2447
2448 2012-08-21  Cary Coutant  <ccoutant@google.com>
2449
2450         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
2451         if --export-dynamic-symbol names an undef symbol.
2452
2453 2012-08-18  Alan Modra  <amodra@gmail.com>
2454
2455         * powerpc.cc: Formatting and white space.
2456         (Powerpc_relobj): Rename got2_section_ to special_.
2457         Add opd_ent_shndx_ and opd_ent_off_ vectors.
2458         (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
2459         scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
2460         (Target_powerpc): Add Address typedef and invalid_address.  Use
2461         throughout.
2462         (Target_powerpc::is_branch_reloc): New function.
2463         (Powerpc_relocate_functions): Add Address typedef, use throughout.
2464         (Powerpc_relocate_functions:rela, rela_ua): Correct type used
2465         for dst_mask, value and addend.
2466         (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
2467         (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
2468         (Output_data_glink::do_write): Correct toc base.  Don't try to use
2469         uint16_t for 24-bit offset.  Use get_output_section_offset and
2470         check return.
2471         (Target_powerpc::Scan::local): Handle more relocs.
2472         (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
2473         (Target_powerpc::Relocate::relocate): Correct toc base calculation.
2474         Plug in toc restoring insn after plt calls.  Translate branches
2475         to function descriptor symbols to corresponding entry point.
2476         (Target_powerpc::relocate_for_relocatable): Check return from
2477         get_output_section_offset.
2478         * symtab.h: Comment typo.
2479
2480 2012-08-14  Ian Lance Taylor  <iant@google.com>
2481
2482         * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
2483         unsupported_relocal_local to call unsupported_reloc_global.
2484
2485 2012-08-14  Nick Clifton  <nickc@redhat.com>
2486
2487         PR ld/14265
2488         * script-sections.cc (Sections_element::output_section_name): Add
2489         keep return parameter.
2490         (Output_section_element::match_name): Add keep return parameter.
2491         Return the value of the keep_ member.
2492         * script-sections.h (class Output_section): Update
2493         output_section_name prototype.
2494         * layout.cc (Layout::keep_input_section): New public member
2495         function.
2496         (Layout::choose_output_section): Pass keep parameter to
2497         output_section_name.
2498         * layout.h (class Layout): Add keep_input_section.
2499         * object.cc (Sized_relobj_file::do_layout): Check for kept input
2500         sections.
2501         * testsuite/Makefile.am: Add a test.
2502         * testsuite/Makefile.in: Regenerate.
2503         * testsuite/pr14265.c: Source file for the test.
2504         * testsuite/pr14265.t: Linker script for the test.
2505         * testsuite/pr14265.sh: Shell script for the test.
2506
2507 2012-08-14  Alan Modra  <amodra@gmail.com>
2508
2509         * target.h (Target::output_section_name): New function.
2510         (Target::do_output_section_name): New function.
2511         * layout.cc (Layout::choose_output_section): Call the above.
2512         * powerpc.cc (Target_powerpc::do_output_section_name): New function.
2513
2514 2012-08-14  Alan Modra  <amodra@gmail.com>
2515
2516         * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
2517         (Output_data_got_powerpc::do_write): Don't rely on base class lookup
2518         for replace_constant call.
2519         (Output_data_plt_powerpc::do_print_to_mapfile): New function.
2520         (Output_data_glink::do_print_to_mapfile): New function.
2521         (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
2522         (Target_powerpc::Relocate::relocate): Likewise.
2523
2524 2012-08-14  Alan Modra  <amodra@gmail.com>
2525
2526         * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
2527         (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
2528         (Output_data_glink::add_entry,find_entry): Remove shndx param.
2529         (class Glink_sym_ent): Rename from struct Glink_sym_ent.  Remove
2530         all references to shndx_.  Handle special case for R_PPC_PLTREL24
2531         here.
2532         (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
2533         (Output_data_glink::do_write): Retrieve got2_shdnx from object.
2534         (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
2535         here.
2536         (Target_powerpc::Scan::global): Nor on make_plt_entry call.
2537         (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
2538
2539 2012-08-12  Alan Modra  <amodra@gmail.com>
2540
2541         * powerpc.cc: Whitespace fixes.  Wrap overly long lines.
2542         (glink insn constants): Use uint32_t.
2543         (Output_data_glink::add_entry): Use insert, not [] operator.
2544
2545 2012-08-11  Alan Modra  <amodra@gmail.com>
2546
2547         * object.h (Sized_relobj_file::find_shdr): New function.
2548         (Sized_relobj_file::find_special_sections): New function.
2549         * object.cc (Sized_relobj_file::find_shdr): New function.
2550         (Sized_relobj_file::find_eh_frame): Use find_shdr.
2551         (Sized_relobj_file::find_special_sections): New function, split out..
2552         (Sized_relobj_file::do_read_symbols): ..from here.
2553         * output.h (Output_data_got::replace_constant): New function.
2554         (Output_data_got::num_entries): New function.
2555         (Output_data_got::last_got_offset,set_got_size): Use num_entries.
2556         (Output_data_got::got_offset): Protected rather than private.
2557         (Output_data_got::replace_got_entry): New function.
2558         * output.cc (Output_data_got::replace_got_entry): New function.
2559         * powerpc.cc (class Powerpc_relobj): New.
2560         (class Powerpc_relocate_functions): Delete all psymval variants or
2561         convert to value,addend type.  Delete pcrela, pcrela_unaligned.
2562         Implement _ha functions using corresponding _hi function.
2563         (Powerpc_relobj::find_special_sections): New function.
2564         (Target_powerpc::do_make_elf_object): New function.
2565         (class Output_data_got_powerpc): New.
2566         (class Output_data_glink): New.
2567         (class Powerpc_scan_relocatable_reloc): New.
2568         Many more changes througout file.
2569
2570 2012-08-09  Nick Clifton  <nickc@redhat.com>
2571
2572         * po/vi.po: Updated Vietnamese translation.
2573
2574 2012-08-07  Ian Lance Taylor  <iant@google.com>
2575
2576         * layout.cc (Layout::add_target_dynamic_tags): If
2577         dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
2578         plt_rel.
2579
2580 2012-07-30  Nick Clifton  <nickc@redhat.com>
2581
2582         * po/gold.pot: Updated template.
2583         * po/es.po: Updated Spanish translation.
2584
2585 2012-07-18  Cary Coutant  <ccoutant@google.com>
2586
2587         PR gold/14344
2588         * configure.ac: Add check for -gpubnames support.
2589         * configure: Regenerate.
2590         * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
2591         support; force -gno-pubnames.
2592         (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
2593         support.
2594         (gdb_index_test_4): New test.
2595         * testsuite/Makefile.in: Regenerate.
2596         * testsuite/gdb_index_test_1.sh: Refactor code into common file.
2597         * testsuite/gdb_index_test_2.sh: Likewise.
2598         * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
2599         * testsuite/gdb_index_test_4.sh: New script.
2600         * testsuite/gdb_index_test_comm.sh: New script with common code;
2601         don't look for space after colon.
2602
2603 2012-07-16  Sriraman Tallam  <tmsriram@google.com>
2604
2605         * gold.cc (queue_middle_tasks): Update function order only after
2606         deferred objects due to plugins are processed.
2607
2608 2012-07-11  Ian Lance Taylor  <iant@google.com>
2609
2610         * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
2611         (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
2612         (Target_arm::scan_reloc_for_stub): Likewise.
2613         * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
2614         * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
2615         * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
2616         * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
2617         * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
2618
2619 2012-07-10  Dodji Seketeli  <dodji@redhat.com>
2620             Ian Lance Taylor  <iant@google.com>
2621
2622         PR gold/14309
2623         * configure.ac: Test whether std::tr1::hash<off_t> works.
2624         * gold.h: Add a specialization for std::tr1::hash<off_t> if
2625         needed.
2626         * output.h (class Output_fill): Add virtual destructor.
2627         * configure, config.in: Rebuild.
2628
2629 2012-06-22  Roland McGrath  <mcgrathr@google.com>
2630
2631         * layout.cc (finalize): Define __ehdr_start symbol if applicable.
2632
2633 2012-06-12  Rafael Ávila de Espíndola <respindola@mozilla.com>
2634
2635         * plugin.cc (Plugin::load): Handle position independent executables.
2636
2637 2012-06-06  Cary Coutant  <ccoutant@google.com>
2638
2639         * layout.cc (gdb_sections): Remove ".debug_" prefixes,
2640         add .debug_macro.
2641         (lines_only_debug_sections): Likewise.
2642         (gdb_fast_lookup_sections): New static array.
2643         (is_gdb_debug_section): Rename formal parameter.
2644         (is_lines_only_debug_section): Likewise.
2645         (is_gdb_fast_lookup_section): New function.
2646         (Layout::include_section): Check for ".zdebug_" prefix; pass
2647         section name suffix to is_gdb_debug_section, et al.; check for
2648         fast-lookup sections when building .gdb_index.
2649         * options.h (--strip-debug-gdb): Update GDB version number.
2650
2651 2012-06-06  Cary Coutant  <ccoutant@google.com>
2652
2653         * configure.ac: Add check for fallocate.
2654         * configure: Regenerate.
2655         * config.in: Regenerate.
2656
2657         * options.h (class General_options): Add --mmap-output-file and
2658         --posix-fallocate options.
2659         * output.cc: (posix_fallocate): Remove; replace with...
2660         (gold_fallocate): New function.
2661         (Output_file::map_no_anonymous): Call gold_fallocate.
2662         (Output_file::map): Check --mmap-output-file option.
2663
2664 2012-06-05  Jing Yu  <jingyu@google.com>
2665
2666         * gold.h (textdomain): Add do {} to empty while(0).
2667         (bindtextdomain): Likewise.
2668
2669 2012-06-04  Cary Coutant  <ccoutant@google.com>
2670
2671         * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
2672         has_dynsym_index.
2673
2674 2012-05-25  Sriraman Tallam  <tmsriram@google.com>
2675
2676         * symtab.cc (Symbol_table::define_special_symbol):
2677         Initialize *poldsym to prevent uninitialized variable errors.
2678
2679 2012-05-23  Cary Coutant  <ccoutant@google.com>
2680
2681         * layout.cc (Layout::section_name_mapping): Add rules to handle
2682         exact match on .data.rel.ro.local or .data.rel.ro.
2683         (Layout::output_section_name): Check for exact matches.
2684
2685 2012-05-23  Cary Coutant  <ccoutant@google.com>
2686
2687         * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
2688         more carefully.
2689
2690 2012-05-22  Cary Coutant  <ccoutant@google.com>
2691
2692         * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
2693         object before exporting symbol.
2694
2695 2012-05-21  H.J. Lu  <hongjiu.lu@intel.com>
2696
2697         * testsuite/tls_test.cc: Include "config.h" first.
2698         * testsuite/tls_test_c.c: Likewise.
2699
2700 2012-05-17  Daniel Richard G.  <skunk@iskunk.org>
2701             Nick Clifton  <nickc@redhat.com>
2702
2703         PR 14072
2704         * configure.in: Add check that sysdep.h has been included before
2705         any system header files.
2706         * configure: Regenerate.
2707         * config.in: Regenerate.
2708
2709 2012-05-14  Cary Coutant  <ccoutant@google.com>
2710
2711         * layout.cc (Layout::make_output_section): Mark .tdata section
2712         as RELRO.
2713         * testsuite/relro_test.cc: Add a TLS variable.
2714
2715 2012-05-10  H.J. Lu  <hongjiu.lu@intel.com>
2716
2717         PR gold/14091
2718         * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
2719         R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
2720         R_X86_64_64.
2721
2722 2012-05-08  Cary Coutant  <ccoutant@google.com>
2723
2724         * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
2725         (lines_only_debug_sections): Likewise.
2726
2727 2012-05-02  Roland McGrath  <mcgrathr@google.com>
2728
2729         * nacl.cc: New file.
2730         * nacl.h: New file.
2731         * Makefile.am (CCFILES, HFILES): Add them.
2732         * Makefile.in: Regenerate.
2733         * i386.cc (Output_data_plt_i386_nacl): New class.
2734         (Output_data_plt_i386_nacl_exec): New class.
2735         (Output_data_plt_i386_nacl_dyn): New class.
2736         (Target_i386_nacl): New class.
2737         (Target_selector_i386_nacl): New class.
2738         (target_selector_i386): Use it instead of Target_selector_i386.
2739         * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
2740         (Target_x86_64_nacl): New class.
2741         (Target_selector_x86_64_nacl): New class.
2742         (target_selector_x86_64, target_selector_x32): Use it instead of
2743         Target_selector_x86_64.
2744         * arm.cc (Output_data_plt_arm_nacl): New class.
2745         (Target_arm_nacl): New class.
2746         (Target_selector_arm_nacl): New class.
2747         (target_selector_arm, target_selector_armbe): Use it instead of
2748         Target_selector_arm.
2749
2750         * target-select.cc (select_target): Take new Input_file* and off_t
2751         arguments, pass them on to recognize method of selector.
2752         * object.cc (make_elf_sized_object): Update caller.
2753         * parameters.cc (parameters_force_valid_target): Likewise.
2754         * incremental.cc (make_sized_incremental_binary): Likewise.
2755         * target-select.h: Update decl.
2756         (Target_selector::recognize): Take new Input_file* argument,
2757         pass it on to do_recognize.
2758         (Target_selector::do_recognize): Take new Input_file* argument.
2759         * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
2760         * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
2761         * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
2762         * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
2763
2764         * target.h (Target::Target_info): New members isolate_execinstr
2765         and rosegment_gap.
2766         (Target::isolate_execinstr, Target::rosegment_gap): New methods.
2767         * arm.cc (Target_arm::arm_info): Update initializer.
2768         * i386.cc (Target_i386::i386_info): Likewise.
2769         * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
2770         * sparc.cc (Target_sparc::sparc_info): Likewise.
2771         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
2772         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
2773         * layout.cc (Layout::attach_allocated_section_to_segment):
2774         Take new const Target* argument.  If target->isolate_execinstr(), act
2775         like --rosegment.
2776         (Layout::find_first_load_seg): Take new const Target* argument;
2777         if target->isolate_execinstr(), reject PF_X segments.
2778         (Layout::relaxation_loop_body): Update caller.
2779         (Layout::set_segment_offsets): If target->isolate_execinstr(),
2780         reset file offset to zero when we hit LOAD_SEG, and then do a second
2781         loop over the segments before LOAD_SEG to reassign offsets after
2782         addresses have been determined.  Handle target->rosegment_gap().
2783         (Layout::attach_section_to_segment): Take new const Target* argument;
2784         pass it to attach_allocated_section_to_segment.
2785         (Layout::make_output_section): Update caller.
2786         (Layout::attach_sections_to_segments): Take new const Target* argument;
2787         pass it to attach_section_to_segment.
2788         * gold.cc (queue_middle_tasks): Update caller.
2789         * layout.h (Layout): Update method decls with new arguments.
2790
2791         * arm.cc (Target_arm::Target_arm): Take optional argument for the
2792         Target_info pointer to use.
2793         (Target_arm::do_make_data_plt): New virtual method.
2794         (Target_arm::make_data_plt): New method that calls it.
2795         (Target_arm::make_plt_entry): Use it.
2796         (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
2797         for the section alignment.
2798         (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
2799         method.
2800         (Output_data_plt_arm::first_plt_entry_offset): Call it.
2801         (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
2802         method.
2803         (Output_data_plt_arm::get_plt_entry_size): Call it.
2804         (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
2805         (Output_data_plt_arm::fill_plt_entry): New method that calls it.
2806         (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
2807         method.
2808         (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
2809         (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
2810         method instead of sizeof(plt_entry).
2811         (Output_data_plt_arm::add_entry): Likewise.
2812         Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
2813         (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
2814         than static method.
2815         (Target_arm::plt_entry_size): Likewise.
2816         (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
2817         Move to ...
2818         (Output_data_plt_arm_standard): ... here, new class.
2819         (Output_data_plt_arm::do_write): Move guts of PLT filling to...
2820         (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
2821         (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
2822
2823         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
2824         Take additional argument for the PLT entry size.
2825         (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
2826         Use get_plt_entry_size method rather than plt_entry_size variable.
2827         (Output_data_plt_x86_64::reserve_slot): Likewise.
2828         (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
2829         (Output_data_plt_x86_64::add_entry): Likewise.
2830         (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
2831         (Output_data_plt_x86_64::address_for_global): Likewise.
2832         (Output_data_plt_x86_64::address_for_local): Likewise.
2833         (Output_data_plt_x86_64::set_final_data_size): Likewise.
2834         (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
2835         Make method non-static.
2836         (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
2837         method.
2838         (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
2839         (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
2840         (Output_data_plt_x86_64::add_eh_frame): New method to call it.
2841         (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
2842         virtual method.
2843         (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
2844         (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
2845         virtual method.
2846         (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
2847         (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
2848         virtual method.
2849         (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
2850         (Output_data_plt_x86_64::plt_entry_size)
2851         (Output_data_plt_x86_64::first_plt_entry)
2852         (Output_data_plt_x86_64::plt_entry)
2853         (Output_data_plt_x86_64::tlsdesc_plt_entry)
2854         (Output_data_plt_x86_64::plt_eh_frame_fde_size)
2855         (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
2856         (Output_data_plt_x86_64_standard): ... here, new class.
2857         (Target_x86_64::Target_x86_64): Take optional argument for the
2858         Target_info pointer to use.
2859         (Target_x86_64::do_make_data_plt): New virtual method.
2860         (Target_x86_64::make_data_plt): New method to call it.
2861         (Target_x86_64::init_got_plt_for_update): Use that.
2862         Call this->plt_->add_eh_frame method here.
2863         (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
2864         (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
2865         rather than static method.
2866         (Target_x86_64::plt_entry_size): Likewise.
2867         (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
2868         rather than plt_entry_size variable.  Move guts of PLT filling to...
2869         (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
2870         (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
2871         (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
2872
2873         * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
2874         additional argument for the section alignment.
2875         Don't do add_eh_frame_for_plt here.
2876         (Output_data_plt_i386::first_plt_entry_offset): Make the method
2877         non-static.  Use get_plt_entry_size method rather than plt_entry_size
2878         variable.
2879         (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
2880         method.
2881         (Output_data_plt_i386::get_plt_entry_size): Call it.
2882         (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
2883         (Output_data_plt_i386::add_eh_frame): New method to call it.
2884         (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
2885         method.
2886         (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
2887         (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
2888         method.
2889         (Output_data_plt_i386::fill_plt_entry): New method to call it.
2890         (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
2891         method instead of plt_entry_size.
2892         (Output_data_plt_i386::plt_entry_size)
2893         (Output_data_plt_i386::plt_eh_frame_fde_size)
2894         (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
2895         (Output_data_plt_i386_standard): ... here, new class.
2896         (Output_data_plt_i386_exec): New class.
2897         (Output_data_plt_i386::exec_first_plt_entry): Move to ...
2898         (Output_data_plt_i386_exec::first_plt_entry): ... here.
2899         (Output_data_plt_i386::exec_plt_entry): Move to ...
2900         (Output_data_plt_i386_exec::plt_entry): ... here.
2901         (Output_data_plt_i386_dyn): New class.
2902         (Output_data_plt_i386::first_plt_entry): Move to ...
2903         (Output_data_plt_i386_dyn::first_plt_entry): ... here.
2904         (Output_data_plt_i386::dyn_plt_entry): Move to ...
2905         (Output_data_plt_i386_dyn::plt_entry): ... here.
2906         (Target_i386::Target_i386): Take optional argument for the Target_info
2907         pointer to use.
2908         (Target_i386::do_make_data_plt): New virtual method.
2909         (Target_i386::make_data_plt): New method to call it.
2910         (Target_i386::make_plt_section): Use that.
2911         Call this->plt_->add_eh_frame method here.
2912         (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
2913         rather than plt_entry_size variable.
2914         (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
2915         (Output_data_plt_i386::address_for_local): Likewise.
2916         (Output_data_plt_i386::do_write): Likewise.
2917         Move guts of PLT filling to...
2918         (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
2919         (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
2920         (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
2921         (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
2922
2923 2012-05-01  Cary Coutant  <ccoutant@google.com>
2924
2925         * dwarf_reader.cc (Dwarf_die::read_attributes)
2926         (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
2927         (Dwarf_die::uint_attribute): Remove DW_FORM_null.
2928         * reduced_debug_output.cc
2929         (Output_reduced_debug_info_section::get_die_end): Remove
2930         DW_FORM_GNU_ref_index.  Add default case.
2931
2932 2012-04-26  Mark Wielaard  <mjw@redhat.com>
2933
2934         * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
2935         * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
2936         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
2937         DW_AT_high_pc as offset from DW_AT_low_pc.
2938
2939         * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
2940         * testsuite/Makefile.in: Regenerate.
2941         * testsuite/gdb_index_test_3.c: New test source file.
2942         * testsuite/gdb_index_test_3.sh: New test source file.
2943
2944 2012-04-25  Ian Lance Taylor  <iant@google.com>
2945
2946         * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
2947         pointer.
2948         (Stub_addend_reader::operator()): Declare Arm_relocate_functions
2949         as a class, not a struct.
2950         (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
2951         (Target_arm::apply_cortex_a8_workaround): Likewise.
2952         * gc.h: Declare Reloc_types as a struct, not a class.
2953         * object.h: Declare Symbols_data as a struct.
2954         * reloc.h: Declare Read_relocs_data as a struct.
2955         * target.h: Declare Relocate_info as a struct.
2956
2957 2012-04-24  David S. Miller  <davem@davemloft.net>
2958
2959         * sparc.cc (Target_sparc::Relocate::relax_call): New function.
2960         (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
2961         and R_SPARC_WPLT30.
2962
2963 2012-04-24  Cary Coutant  <ccoutant@google.com>
2964
2965         * incremental-dump.cc (find_input_containing_global): Replace
2966         magic number with symbolic constant.
2967         (dump_incremental_inputs): Update version number.
2968         * incremental.cc (Output_section_incremental_inputs): Update version
2969         number; import symbolic constants from Incremental_inputs_reader.
2970         (Incremental_inputs::create_data_sections): Align relocations
2971         section correctly for 64-bit targets.
2972         (Output_section_incremental_inputs::set_final_data_size): Use symbolic
2973         constants; add padding.
2974         (Output_section_incremental_inputs::write_header): Add assert for
2975         header_size.
2976         (Output_section_incremental_inputs::write_input_files): Add assert
2977         for input_entry_size.
2978         (Output_section_incremental_inputs::write_info_blocks): Add padding;
2979         add assert for object_info_size, input_section_entry_size,
2980         global_sym_entry_size.
2981         * incremental.h (Incremental_inputs_reader): Add symbolic constants
2982         for data structure sizes; use them.
2983         (Incremental_input_entry_reader): Import symbolic constants from
2984         Incremental_inputs_reader; use them.
2985
2986 2012-04-23  David S. Miller  <davem@davemloft.net>
2987
2988         * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
2989         and elf_flags_set_.
2990         (Target_sparc::Target_sparc): Initialize new fields.
2991         (Target_sparc::do_make_elf_object): New function.
2992         (Target_sparc::do_adjust_elf_header): New function.
2993
2994 2012-04-23  Cary Coutant  <ccoutant@google.com>
2995
2996         * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
2997         CU range table of gdb index.
2998
2999 2012-04-20  David S. Miller  <davem@davemloft.net>
3000
3001         * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
3002         instead of false.
3003
3004 2012-04-16  David S. Miller  <davem@davemloft.net>
3005
3006         * sparc.cc (Target_sparc::got_address): New function.
3007         (Sparc_relocate_functions::gdop_hix22): New function.
3008         (Sparc_relocate_functions::gdop_lox10): New function.
3009         (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
3010         relocs.
3011         (Target_sparc::Scan::local): Likewise if the global symbol is not
3012         preemptible and is not IFUNC.
3013         (Target_sparc::Relocate::relocate): Perform GOTDATA code
3014         transformations for local and non-preemptible non-IFUNC global
3015         symbols.
3016
3017         * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
3018         writing out 64-bit part of ranges.
3019
3020         * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
3021         -fpic and -fpie respectively.
3022         * Makefile.in: Regenerate.
3023
3024         * sparc.cc (class Target_sparc): Add rela_ifunc_.
3025         (Target_sparc::Target_sparc): Initialize new field.
3026         (Target_sparc::do_plt_section_for_global): New function.
3027         (Target_sparc::do_plt_section_for_local): New function.
3028         (Target_sparc::reloc_needs_plt_for_ifunc): New function.
3029         (Target_sparc::make_plt_section): New function, broken out of
3030         make_plt_entry.  Use ORDER_NON_RELRO_FIRST for ".plt".
3031         (Target_sparc::make_plt_entry): Call make_plt_section.
3032         (Target_sparc::make_local_ifunc_plt_entry): New function.
3033         (Target_sparc::rela_ifunc_section): New function.
3034         (Target_sparc::plt_section): Remove const.
3035         (Output_data_plt_sparc): Update declarations.  Define Global_ifunc
3036         and Local_ifunc types.  Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
3037         and ifunc_count_ fields.
3038         (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
3039         (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
3040         (Output_data_plt_sparc::add_local_ifunc_entry): New function.
3041         (Output_data_plt_sparc::rela_ifunc): New function.
3042         (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
3043         (Output_data_plt_sparc::has_ifunc_section): New function.
3044         (Output_data_plt_sparc::entry_count): Include ifunc_count_.
3045         (Output_data_plt_sparc::address_for_global): New function.
3046         (Output_data_plt_sparc::address_for_local): New function.
3047         (Output_data_plt_sparc::plt_index_to_offset): New function.
3048         (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
3049         and entry_count.
3050         (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
3051         entry_count.
3052         (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
3053         R_SPARC_JMP_IREL to switch.
3054         (Target_sparc::Scan::check_non_pic): Likewise.
3055         (Target_sparc::Scan::local): Handle IFUNC symbols.
3056         (Target_sparc::Scan::local): Likewise.
3057         (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
3058         and plt_address_for_local.
3059         (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
3060         Define __rel_iplt_start and __rel_iplt_end if doing a static link.
3061
3062         * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
3063         (class Output_data_reloc): Adjust calls to Output_reloc_type.
3064         (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
3065         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
3066         global relocs too.
3067         (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
3068         * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
3069         calls.
3070         * sparc.cc (Target_sparc::Scan::global): Likewise.
3071         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
3072
3073 2012-04-16  Cary Coutant  <ccoutant@google.com>
3074
3075         * archive.cc (Library_base::should_include_member): Check for
3076         --export-dynamic-symbol.
3077         * options.h (class General_options): Add --export-dynamic-symbol.
3078         * symtab.cc (Symbol::should_add_dynsym_entry): Check for
3079         --export-dynamic-symbol.
3080         (Symbol_table::gc_mark_undef_symbols): Likewise.
3081         (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
3082
3083 2012-04-12  David S. Miller  <davem@davemloft.net>
3084
3085         * sparc.cc (Reloc::wdisp10): New relocation method.
3086         (Reloc::h34): Likewise.
3087         (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
3088         (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
3089         R_SPARC_WDISP10.
3090         (Target_sparc::Scan::local): Likewise.
3091         (Target_sparc::Scan::global): Likewise.
3092         (Target_sparc::Relocate::relocate): Likewise.
3093
3094 2012-04-09  Cary Coutant  <ccoutant@google.com>
3095
3096         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
3097         low_pc == 0.
3098
3099 2012-04-06  Ian Lance Taylor  <iant@google.com>
3100
3101         * timer.cc: #include <unistd.h>.
3102
3103 2012-04-06  Roland McGrath  <mcgrathr@google.com>
3104
3105         * configure.in (AC_CHECK_HEADERS): Add locale.h.
3106         * config.in: Regenerate.
3107         * configure: Regenerate.
3108
3109 2012-04-05  Nick Clifton  <nickc@redhat.com>
3110
3111         * configure.ac (AC_CHECK_FUNCS): Add setlocale.
3112         (AM_LC_MESSAGES): Add.
3113         * aclocal.m4: Regenerate.
3114         * config.in: Regenerate.
3115         * configure: Regenerate.
3116
3117 2012-03-21  Cary Coutant  <ccoutant@google.com>
3118
3119         * Makefile.am: Add gdb-index.cc, gdb-index.h.
3120         * Makefile.in: Regenerate.
3121         * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
3122         (Sized_elf_reloc_mapper::symbol_section): New function.
3123         (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
3124         (make_elf_reloc_mapper): New function.
3125         (Dwarf_abbrev_table::clear_abbrev_codes): New function.
3126         (Dwarf_abbrev_table::do_read_abbrevs): New function.
3127         (Dwarf_abbrev_table::do_get_abbrev): New function.
3128         (Dwarf_ranges_table::read_ranges_table): New function.
3129         (Dwarf_ranges_table::read_range_list): New function.
3130         (Dwarf_pubnames_table::read_section): New function.
3131         (Dwarf_pubnames_table::read_header): New function.
3132         (Dwarf_pubnames_table::next_name): New function.
3133         (Dwarf_die::Dwarf_die): New function.
3134         (Dwarf_die::read_attributes): New function.
3135         (Dwarf_die::skip_attributes): New function.
3136         (Dwarf_die::set_name): New function.
3137         (Dwarf_die::set_linkage_name): New function.
3138         (Dwarf_die::attribute): New function.
3139         (Dwarf_die::string_attribute): New function.
3140         (Dwarf_die::int_attribute): New function.
3141         (Dwarf_die::uint_attribute): New function.
3142         (Dwarf_die::ref_attribute): New function.
3143         (Dwarf_die::child_offset): New function.
3144         (Dwarf_die::sibling_offset): New function.
3145         (Dwarf_info_reader::check_buffer): New function.
3146         (Dwarf_info_reader::parse): New function.
3147         (Dwarf_info_reader::do_parse): New function.
3148         (Dwarf_info_reader::do_read_string_table): New function.
3149         (Dwarf_info_reader::lookup_reloc): New function.
3150         (Dwarf_info_reader::get_string): New function.
3151         (Dwarf_info_reader::visit_compilation_unit): New function.
3152         (Dwarf_info_reader::visit_type_unit): New function.
3153         (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
3154         Sized_elf_reloc_mapper.
3155         (Sized_dwarf_line_info::symbol_section): Remove function.
3156         (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
3157         (Sized_dwarf_line_info::read_line_mappings): Remove object
3158         parameter, adjust callers.
3159         (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
3160         * dwarf_reader.h: Include <sys/types.h>.
3161         (class Track_relocs): Remove forward declaration.
3162         (class Elf_reloc_mapper): New class.
3163         (class Sized_elf_reloc_mapper): New class.
3164         (class Dwarf_abbrev_table): New class.
3165         (class Dwarf_range_list): New class.
3166         (class Dwarf_ranges_table): New class.
3167         (class Dwarf_pubnames_table): New class.
3168         (class Dwarf_die): New class.
3169         (class Dwarf_info_reader): New class.
3170         (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
3171         (Sized_dwarf_line_info::symbol_section): Remove member function.
3172         * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
3173         base class.
3174         * gdb-index.cc: New source file.
3175         * gdb-index.h: New source file.
3176         * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
3177         and .debug_types sections, call Layout::add_to_gdb_index.
3178         (Sized_relobj_incr::do_section_name): Implement.
3179         (Sized_relobj_incr::do_section_contents): Adjust parameter list and
3180         return type; Implement.
3181         (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
3182         return type.
3183         * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
3184         parameter list and return type.
3185         (Sized_incr_dynobj::do_section_contents): Likewise.
3186         * layout.cc: Include gdb-index.h.
3187         (Layout::Layout): Initialize gdb_index_data_.
3188         (Layout::init_fixed_output_section): Check for .gdb_index section.
3189         (Layout::add_to_gdb_index): New function. Instantiate.
3190         * layout.h: Add forward declaration for class Gdb_index.
3191         (Layout::add_to_gdb_index): New member function.
3192         (Layout::gdb_index_data_): New data member.
3193         * main.cc: Include gdb-index.h.
3194         (main): Print statistics for gdb index.
3195         * object.cc (Object::section_contents): Move code into
3196         do_section_contents.
3197         (need_decompressed_section): Check for sections needed when building
3198         gdb index.
3199         (build_compressed_section_map): Likewise.
3200         (Sized_relobj_file::do_read_symbols): Need local symbols when building
3201         gdb index.
3202         (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
3203         sections; call Layout::add_to_gdb_index.
3204         (Sized_relobj_file::do_decompressed_section_contents): Call
3205         do_section_contents directly.
3206         * object.h (Object::do_section_contents): Adjust parameter list and
3207         return type.
3208         (Object::do_decompressed_section_contents): Call do_section_contents
3209         directly.
3210         (Sized_relobj_file::do_section_contents): Adjust parameter list and
3211         return type.
3212         * options.h (class General_options): Add --gdb-index option.
3213         * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
3214         list and return type.
3215         * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
3216         * reloc.h (Track_relocs::checkpoint): New function.
3217         (Track_relocs::reset): New function.
3218
3219         * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
3220         New test cases.
3221         * testsuite/Makefile.in: Regenerate.
3222         * testsuite/gdb_index_test.cc: New test source file.
3223         * testsuite/gdb_index_test_1.sh: New test source file.
3224         * testsuite/gdb_index_test_2.sh: New test source file.
3225
3226 2012-03-19  Doug Kwan  <dougkwan@google.com>
3227
3228         * arm.cc (Target_arm::do_define_standard_symbols): New method.
3229         (Target_arm::do_finalize_sections): Remove code which defines
3230         __exidx_start and __exidx_end.  Make symbol table parameter
3231         anonymous as it is not used.
3232         * gold.cc (queue_middle_tasks): Call target hook to define any
3233         target-specific symbols.
3234         * target.h (Target::define_standard_symbols): New method.
3235         (Target::do_define_standard_symbols): Same.
3236         * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
3237         * testsuite/Makefile.in: Regenerate.
3238         * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
3239         and __exidx_end.
3240         * testsuite/arm_exidx_test.sh: Check that no unused dynamic
3241         relocations are generated for __exidx_start and __exidx_end.
3242
3243 2012-03-16  Doug Kwan  <dougkwan@google.com>
3244
3245         * testsuite/Makefile.am: Disable test initpri3b.
3246         * testsuite/Makefile.in: Regenerate.
3247
3248 2012-03-15  Doug Kwan  <dougkwan@google.com>
3249
3250         * arm.cc (Target_arm::got_section): Make .got section read-only
3251         if -z now is given.
3252
3253 2012-03-15  Ian Lance Taylor  <iant@google.com>
3254
3255         PR gold/13850
3256         * layout.cc (Layout::make_output_section): Correctly mark
3257         SHT_INIT_ARRAY, et. al., as relro.
3258
3259 2012-03-14  Doug Kwan  <dougkwan@google.com>
3260
3261         * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
3262         dynamic relocations for protected symbols in shared objects.
3263
3264 2012-03-13  Ian Lance Taylor  <iant@google.com>
3265
3266         * resolve.cc (Symbol_table::resolve): When merging common symbols,
3267         keep the larger alignment.
3268
3269 2012-03-12  Cary Coutant  <ccoutant@google.com>
3270
3271         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
3272         handling of DW_LNE_define_file.
3273
3274 2012-03-12  Cary Coutant  <ccoutant@google.com>
3275
3276         * reduced_debug_output.cc
3277         (Output_reduced_debug_info_section::get_die_end): Add new FORM
3278         codes to switch.
3279
3280 2012-02-29  Cary Coutant  <ccoutant@google.com>
3281
3282         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
3283
3284 2012-02-29  Cary Coutant  <ccoutant@google.com>
3285
3286         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
3287         Call Object::decompressed_section_contents.
3288         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
3289         New dtor.
3290         (Sized_dwarf_line_info::buffer_start_): New data member.
3291         * merge.cc (Output_merge_data::do_add_input_section): Call
3292         Object::decompressed_section_contents.
3293         (Output_merge_string::do_add_input_section): Likewise.
3294         * object.cc (need_decompressed_section): New function.
3295         (build_compressed_section_map): Decompress sections needed later.
3296         (Sized_relobj_file::do_decompressed_section_contents): New function.
3297         (Sized_relobj_file::do_discard_decompressed_sections): New function.
3298         * object.h (Object::decompressed_section_contents): New function.
3299         (Object::discard_decompressed_sections): New function.
3300         (Object::do_decompressed_section_contents): New function.
3301         (Object::do_discard_decompressed_sections): New function.
3302         (Compressed_section_info): New type.
3303         (Compressed_section_map): Include decompressed section contents.
3304         (Sized_relobj_file::do_decompressed_section_contents): New function.
3305         (Sized_relobj_file::do_discard_decompressed_sections): New function.
3306
3307 2012-02-16  Cary Coutant  <ccoutant@google.com>
3308
3309         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
3310         * testsuite/Makefile.in: Regenerate.
3311
3312 2012-02-14  Cary Coutant  <ccoutant@google.com>
3313
3314         * options.cc (General_options::finalize): Disallow -pie and -static.
3315
3316 2012-02-03  Doug Kwan  <dougkwan@google.com>
3317
3318         * arm.cc (Arm_relocate_functions::abs8,
3319         Arm_relocate_functions::abs16): Use
3320         Bits::has_signed_unsigned_overflow32.
3321         (Arm_relocate_functions::thm_abs8): Correct range of
3322         overflow check.
3323         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
3324         in assertions.
3325
3326 2012-02-02  Doug Kwan  <dougkwan@google.com>
3327
3328         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
3329         position independent outputs, not just shared objects.
3330
3331 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
3332
3333         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
3334         * configure: Regenerated.
3335
3336 2012-01-27  Ian Lance Taylor  <iant@google.com>
3337
3338         * reloc.h (Bits): New class with static functions, copied from
3339         namespace utils in arm.cc.
3340         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
3341         instead.
3342
3343 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
3344
3345         * incremental.cc (write_info_blocks): Correct relocation offset.
3346
3347 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
3348
3349         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
3350         (Relocate::tls_gd_to_le): Likewise.
3351
3352 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
3353
3354         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
3355
3356 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
3357
3358         * configure.ac: Check if -mcmodel=medium works.
3359         * configure: Regenerated.
3360
3361 2012-01-24  Cary Coutant  <ccoutant@google.com>
3362
3363         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
3364         definition and ...
3365         (read_unsigned_LEB_128_x): ... this new function.
3366         (read_signed_LEB_128): Replaced with inline definition and ...
3367         (read_signed_LEB_128_x): ... this new function.
3368         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
3369         (read_unsigned_LEB_128): Add inline definition.
3370         (read_signed_LEB_128_x): New function.
3371         (read_signed_LEB_128): Add inline definition.
3372         * testsuite/Makefile.am (leb128_unittest): New unit test.
3373         * testsuite/Makefile.in: Regenerate.
3374         * testsuite/leb128_unittest.cc: New unit test.
3375
3376 2012-01-23  Ian Lance Taylor  <iant@google.com>
3377
3378         PR gold/13617
3379         * i386.cc (Target_i386::do_code_fill): When using a jmp
3380         instruction, pad with nop instructions.
3381         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
3382
3383 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
3384
3385         * x86_64.cc (gc_process_relocs): Add typename on types used in
3386         template.
3387         (scan_relocs): Likewise.
3388         (relocate_section): Likewise.
3389         (apply_relocation): Likewise.
3390
3391 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
3392
3393         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
3394         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
3395         under x32.
3396
3397 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
3398
3399         * x86_64.cc: Initial support for x32.
3400
3401 2012-01-03  Cary Coutant  <ccoutant@google.com>
3402
3403         * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
3404         Use abstract base class for GOT.
3405         * gold/output.h (class Output_data_got_base): New abstract base class.
3406         (class Output_data_got): Derive from new base class, adjust ctors.
3407         (Output_data_got::reserve_slot): Make virtual; rename to
3408         do_reserve_slot; Adjust callers.
3409         * gold/target.h (Sized_target::init_got_plt_for_update): Return
3410         pointer to abstract base class.
3411         * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
3412
3413 2011-12-18  Ian Lance Taylor  <iant@google.com>
3414
3415         * object.h (Relobj::local_symbol_value): New function.
3416         (Relobj::local_plt_offset): New function.
3417         (Relobj::local_has_got_offset): New function.
3418         (Relobj::local_got_offset): New function.
3419         (Relobj::set_local_got_offset): New function.
3420         (Relobj::do_local_symbol_value): New pure virtual function.
3421         (Relobj::do_local_plt_offset): Likewise.
3422         (Relobj::do_local_has_got_offset): Likewise.
3423         (Relobj::do_local_got_offset): Likewise.
3424         (Relobj::do_set_local_got_offset): Likewise.
3425         (Sized_relobj::do_local_has_got_offset): Rename from
3426         local_has_got_offset.
3427         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
3428         (Sized_relobj::do_set_local_got_offset): Rename from
3429         set_local_got_offset.
3430         (Sized_relobj_file::do_local_plt_offset): Rename from
3431         local_plt_offset.
3432         (Sized_relobj_file::do_local_symbol_value): New function.
3433         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
3434         local_plt_offset.
3435         * output.cc (Output_data_got::Got_entry::write): Change object to
3436         Relobj.  Use local_symbol_value.
3437         (Output_data_got::add_global_with_rel): Change rel_dyn to
3438         Output_data_reloc_generic*.  Use add_global_generic.
3439         (Output_data_got::add_global_with_rela): Remove.  Change all
3440         callers to use add_global_with_rel.
3441         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
3442         Output_data_reloc_generic*.  Use add_global_generic.
3443         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
3444         callers to use add_global_pair_with_rel.
3445         (Output_data_got::add_local): Change object to Relobj*.
3446         (Output_data_got::add_local_plt): Likewise.
3447         (Output_data_got::add_local_with_rel): Change object to Relobj*,
3448         change rel_dyn to Output_data_reloc_generic*.  Use
3449         add_local_generic.
3450         (Output_data_got::add_local_with_rela): Remove.  Change all
3451         callers to use all_local_with_rel.
3452         (Output_data_got::add_local_pair_with_rel): Change object to
3453         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
3454         add_output_section_generic.
3455         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
3456         callers to use add_local_pair_with_rel.
3457         (Output_data_got::reserve_local): Change object to Relobj*.
3458         * output.h: (class Output_data_reloc_generic): Add pure virtual
3459         declarations for add_global_generic, add_local_generic,
3460         add_output_section_generic.
3461         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
3462         functions for Output_data_reloc_generic.  Update declarations for
3463         changes listed in output.cc.
3464         (class Output_data_got): Change template parameter to got_size.
3465         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
3466         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
3467         function.
3468         (Sized_relobj_incr::do_local_plt_offset): New function.
3469         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
3470         add_global_generic.
3471
3472 2011-12-17  Cary Coutant  <ccoutant@google.com>
3473
3474         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
3475         * resolve.cc (Symbol_table::resolve): Likewise.
3476         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
3477         arrays.
3478         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
3479
3480 2011-12-16  Ian Lance Taylor  <iant@google.com>
3481
3482         * output.h (Output_data_reloc_generic::add): Only call
3483         add_dynamic_reloc if this is a dynamic reloc section.
3484
3485 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
3486
3487         PR gold/13505
3488         * target-reloc.h (apply_relocation): Replace <64, false> with
3489         <size, big_endian>.
3490
3491 2011-11-25  Nick Clifton  <nickc@redhat.com>
3492
3493         * po/it.po: New Italian translation.
3494
3495 2011-11-17  Sterling Augustine  <saugustine@google.com>
3496
3497         * script.cc (script_include_directive): Implement.
3498         (read_script_file): New local variables name and search_path. Update
3499         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
3500         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
3501         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
3502
3503 2011-11-11  Sterling Augustine  <saugustine@google.com>
3504
3505         * yyscript.y (section_cmd): Add support for INCLUDE directive.
3506         (file_or_sections_cmd): Likewise.
3507
3508 2011-11-11  Doug Kwan  <dougkwan@google.com>
3509
3510         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
3511         if --just-symbols is given.
3512
3513 2011-11-10  Doug Kwan  <dougkwan@google.com>
3514
3515         PR gold/13362
3516         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
3517         when processing data relocs.
3518         * reloc.h (Relocate_functions::rel_unaligned): New method.
3519         (Relocate_functions::pcrel_unaligned): Ditto.
3520         (Relocate_functions::rel32_unaligned): Ditto.
3521         (Relocate_functions::pcrel32_unaligned): Ditto.
3522
3523 2011-11-09  Doug Kwan  <dougkwan@google.com>
3524
3525         PR gold/13362
3526         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
3527         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
3528         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
3529         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
3530         (Relocate_functions::rel_unaligned): New.
3531         (Relocate_functions::rel32_unaligned): New.
3532         * target-reloc.h (relocate_for_relocatable): Add code to handle
3533         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
3534         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
3535         arm_unaligned_reloc_r): New targets.
3536         * testsuite/Makefile.in: Regenerate.
3537         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
3538         linking.
3539
3540 2011-11-02  Ian Lance Taylor  <iant@google.com>
3541
3542         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
3543         NATIVE_LINKER.
3544         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
3545         * options.cc (General_options::finalize): Use library search path
3546         from configure script if specified.  If not native and no sysroot,
3547         only search TOOLLIBDIR.
3548         * options.h (Search_directory::Search_directory): Change name to
3549         const std::string&.
3550         (General_options::add_to_library_path_with_sysroot): Change arg to
3551         const std::string&.
3552         * configure, Makefile.in, config.in: Rebuild.
3553
3554 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
3555
3556         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
3557         we are working around the ARM1176 Erratum.
3558         * options.h (General_options::fix_arm1176): Add option.
3559         * testsuite/Makefile.am: Add testcases, and keep current ones
3560         working.
3561         * testsuite/Makefile.in: Regenerate.
3562         * testsuite/arm_fix_1176.s: New file.
3563         * testsuite/arm_fix_1176.sh: Likewise.
3564
3565 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
3566
3567         * arm.cc (Target_arm::Target_arm): Remove initialisation of
3568         may_use_blx_.
3569         (Target_arm::may_use_blx): Remove method.
3570         (Target_arm::set_may_use_blx): Likewise.
3571         (Target_arm::may_use_v4t_interworking): New method.
3572         (Target_arm::may_use_v5t_interworking): Likewise.
3573         (Target_arm::may_use_blx_): Remove member variable.
3574         (Arm_relocate_functions::arm_branch_common): Check for v5T
3575         interworking.
3576         (Arm_relocate_functions::thumb_branch_common): Likewise.
3577         (Reloc_stub::stub_type_for_reloc): Likewise.
3578         (Target_arm::do_finalize_sections): Correct interworking checks.
3579         * testsuite/Makefile.am: Add new tests.
3580         * testsuite/Makefile.in: Regenerate.
3581         * testsuite/arm_farcall_arm_arm.s: New test.
3582         * testsuite/arm_farcall_arm_arm.sh: Likewise.
3583         * testsuite/arm_farcall_arm_thumb.s: Likewise.
3584         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
3585         * testsuite/arm_farcall_thumb_arm.s: Likewise.
3586         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
3587         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
3588         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
3589
3590 2011-10-31  Cary Coutant  <ccoutant@google.com>
3591
3592         PR gold/13023
3593         * expression.cc (Expression::eval_with_dot): Add
3594         is_section_dot_assignment parameter.
3595         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
3596         absolute and assigning to dot within a section.
3597         * script-sections.cc
3598         (Output_section_element_assignment::set_section_addresses): Pass
3599         dot_section to set_if_absolute.
3600         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
3601         as is_section_dot_assignment flag to eval_with_dot.
3602         (Output_section_element_dot_assignment::set_section_addresses):
3603         Likewise.
3604         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
3605         parameter.  Also set value if relative to dot_section; set the
3606         symbol's output_section.
3607         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
3608         parameter.  Adjust all callers.
3609         (Expression::eval_maybe_dot): Likewise.
3610         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
3611         Adjust all callers.
3612         * testsuite/script_test_2.t: Test assignment of an absolute value
3613         to dot within an output section element.
3614
3615 2011-10-31  Cary Coutant  <ccoutant@google.com>
3616
3617         * options.h (class General_options): Add --[no-]gnu-unique options.
3618         * symtab.cc (Symbol_table::sized_write_globals): Convert
3619         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
3620
3621 2011-10-31  Cary Coutant  <ccoutant@google.com>
3622
3623         PR gold/13359
3624         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
3625         unnecessary assertion.
3626         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
3627
3628 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
3629
3630         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
3631         gc_mark_symbol.
3632         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
3633         gc_mark_symbol.
3634         Change to just keep the section associated with symbol.
3635         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
3636         they are externally visible and --export-dynamic is turned on.
3637         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
3638
3639 2011-10-19  Ian Lance Taylor  <iant@google.com>
3640
3641         PR gold/13163
3642         * script-sections.cc
3643         (Output_section_element_dot_assignment::needs_output_section): New
3644         function.
3645
3646 2011-10-19  Ian Lance Taylor  <iant@google.com>
3647
3648         PR gold/13204
3649         * layout.cc (Layout::segment_precedes): Don't assert failure if a
3650         --section-start option was seen.
3651         * options.h (General_options::any_section_start): New function.
3652
3653 2011-10-18  David S. Miller  <davem@davemloft.net>
3654
3655         PR binutils/13301
3656         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
3657         member to track relocation locations that have moved during TLS
3658         reloc optimizations.
3659         (Target_sparc::Relocate::Relocate): Initialize to NULL.
3660         (Target_sparc::Relocate::relocate): Adjust view down by 4
3661         bytes if it matches reloc_adjust_addr_.
3662         (Target_sparc::Relocate::relocate_tls): Always move the
3663         __tls_get_addr call delay slot instruction forward 4 bytes when
3664         performing relaxation.
3665
3666 2011-10-18  Cary Coutant  <ccoutant@google.com>
3667
3668         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
3669         (Output_file::map_no_anonymous): Check for non-zero
3670         return code from posix_fallocate.
3671
3672 2011-10-17  Cary Coutant  <ccoutant@google.com>
3673
3674         PR gold/13245
3675         * plugin.cc (is_visible_from_outside): Check for symbols
3676         referenced from dynamic objects.
3677         * resolve.cc (Symbol_table::resolve): Don't count references
3678         from dynamic objects as references from real ELF files.
3679         * testsuite/plugin_test_2.sh: Adjust expected result.
3680
3681 2011-10-17  Cary Coutant  <ccoutant@google.com>
3682
3683         * gold.cc: Include timer.h.
3684         (queue_middle_tasks): Stamp time.
3685         (queue_final_tasks): Likewise.
3686         * main.cc (main): Store timer in parameters.  Print timers
3687         for each pass.
3688         * parameters.cc (Parameters::Parameters): Initialize timer_.
3689         (Parameters::set_timer): New function.
3690         (set_parameters_timer): New function.
3691         * parameters.h (Parameters::set_timer): New function.
3692         (Parameters::timer): New function.
3693         (Parameters::timer_): New data member.
3694         (set_parameters_timer): New function.
3695         * timer.cc (Timer::stamp): New function.
3696         (Timer::get_pass_time): New function.
3697         * timer.h (Timer::stamp): New function.
3698         (Timer::get_pass_time): New function.
3699         (Timer::pass_times_): New data member.
3700
3701 2011-10-17  Cary Coutant  <ccoutant@google.com>
3702
3703         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
3704         task for members of lib groups.
3705
3706 2011-10-17  Cary Coutant  <ccoutant@google.com>
3707
3708         PR gold/13288
3709         * fileread.cc (File_read::find_view): Add assert.
3710         (File_read::make_view): Move bounds check (replace with assert)...
3711         (File_read::find_or_make_view): ... to here.
3712
3713 2011-10-12  Cary Coutant  <ccoutant@google.com>
3714
3715         * output.cc (Output_file::open_base_file): Handle case where
3716         ::read returns less than requested size.
3717
3718 2011-10-10  Cary Coutant  <ccoutant@google.com>
3719
3720         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
3721         Initialize defined_count_.
3722         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
3723         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
3724         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
3725         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
3726         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
3727         * incremental.h (Sized_relobj_incr::defined_count_): New data
3728         member.
3729         (Sized_incr_dynobj::defined_count_): New data member.
3730         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
3731         Return zeroes instead of internal error.
3732
3733 2011-10-10  Cary Coutant  <ccoutant@google.com>
3734
3735         PR gold/13249
3736         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
3737         (Output_reloc::symbol_value): Return PLT offset if flag is set.
3738         * output.h (class Output_reloc): Add use_plt_offset flag.
3739         (Output_reloc::type_): Adjust size of bit field.
3740         (Output_reloc::use_plt_offset_): New bit field.
3741         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
3742         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
3743         flag.  Adjust all callers.
3744         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
3745         creating RELATIVE relocations.
3746
3747 2011-10-10  Nick Clifton  <nickc@redhat.com>
3748
3749         * po/es.po: Updated Spanish translation.
3750         * po/fi.po: Updated Finnish translation.
3751
3752 2011-10-03   Diego Novillo  <dnovillo@google.com>
3753
3754         * options.cc (parse_uint): Fix dereference of RETVAL.
3755
3756 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
3757
3758         * layout.h (section_order_map_): New member.
3759         (get_section_order_map): New member function.
3760         * output.cc (Output_section::add_input_section): Check for patterns
3761         only when --section-ordering-file is specified.
3762         * gold.cc (queue_middle_tasks): Delay updating order of sections till
3763         output_sections have been formed.
3764         * layout.cc (Layout_Layout): Initialize section_order_map_.
3765         * plugin.cc (update_section_order): Store order in order_map. Do not
3766         update the order.
3767         * testsuite/Makefile.am: Add test case for plugin_final_layout.
3768         * testsuite/Makefile.in: Regenerate.
3769         * testsuite/plugin_section_order.c: New file.
3770         * testsuite/plugin_final_layout.cc: New file.
3771         * testsuite/plugin_final_layout.sh: New file.
3772
3773 2011-09-29  Cary Coutant  <ccoutant@google.com>
3774
3775         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
3776         Check for NULL.
3777         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
3778         symbols during incremental update.
3779         (Symbol_table::add_from_dynobj): Likewise.
3780
3781 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3782             Ian Lance Taylor  <iant@google.com>
3783
3784         * symtab.cc (Symbol_table::define_special_symbol): Always
3785         canonicalize version string.
3786
3787 2011-09-26  Cary Coutant  <ccoutant@google.com>
3788
3789         * gold.cc (queue_initial_tasks): Move option checks ...
3790         * options.cc (General_options::finalize): ... to here. Disable
3791         some options; make others fatal.
3792
3793 2011-09-26  Cary Coutant  <ccoutant@google.com>
3794
3795         gcc PR lto/47247
3796         * plugin.cc (get_symbols_v2): New function.
3797         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
3798         (is_referenced_from_outside): New function.
3799         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
3800         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
3801         (get_symbols): Pass version parameter.
3802         (get_symbols_v2): New function.
3803         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
3804         parameter.
3805         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
3806         (onload): Add LDPT_GET_SYMBOLS_V2.
3807         (all_symbols_read_hook): Use get_symbols_v2; check for
3808         LDPR_PREVAILING_DEF_IRONLY_EXP.
3809         * testsuite/plugin_test_3.sh: Update expected results.
3810
3811 2011-09-23  Simon Baldwin  <simonb@google.com>
3812
3813         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
3814         configuration options.
3815         * configure: Regenerate.
3816         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
3817         * Makefile.in: Regenerate.
3818         * testsuite/Makefile.in: Regenerate.
3819
3820 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
3821
3822         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
3823
3824 2011-09-19  Cary Coutant  <ccoutant@google.com>
3825
3826         * incremental.cc (can_incremental_update): Fix typo in comment.
3827         * incremental.h (can_incremental_update): Likewise.
3828
3829 2011-09-18  Cary Coutant  <ccoutant@google.com>
3830
3831         * incremental.cc (can_incremental_update): New function.
3832         * incremental.h (can_incremental_update): New function.
3833         * layout.cc (Layout::init_fixed_output_section): Call it.
3834         (Layout::make_output_section): Don't allow patch space in .eh_frame.
3835         * object.cc (Sized_relobj_file::do_layout): Call
3836         can_incremental_update.
3837
3838 2011-09-13  Cary Coutant  <ccoutant@google.com>
3839
3840         * configure.ac: Check for glibc support for gnu_indirect_function
3841         support with static linking, setting automake conditional
3842         IFUNC_STATIC.
3843         * Makefile.in: Regenerate.
3844         * configure: Regenerate.
3845
3846         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
3847         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
3848         for IFUNC_STATIC.
3849         * testsuite/Makefile.in: Regenerate.
3850
3851 2011-09-13  Cary Coutant  <ccoutant@google.com>
3852
3853         * incremental.cc (Sized_relobj_incr::do_layout): Call
3854         report_comdat_group for kept comdat sections.
3855         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
3856         * testsuite/Makefile.in: Regenerate.
3857         * testsuite/incr_comdat_test_1.cc: New source file.
3858         * testsuite/incr_comdat_test_2_v1.cc: New source file.
3859         * testsuite/incr_comdat_test_2_v2.cc: New source file.
3860         * testsuite/incr_comdat_test_2_v3.cc: New source file.
3861
3862 2011-09-13  Ian Lance Taylor  <iant@google.com>
3863
3864         * object.cc (Sized_relobj_file::do_layout): Remove unused local
3865         variable external_symbols_offset.
3866
3867 2011-09-12  Ian Lance Taylor  <iant@google.com>
3868
3869         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
3870         triggered if object has no symbols.
3871
3872 2011-09-09  David S. Miller  <davem@davemloft.net>
3873
3874         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
3875         (Output_fill_debug_line::do_write): Likewise.
3876
3877 2011-08-29  Cary Coutant  <ccoutant@google.com>
3878
3879         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
3880         casts to match formatting specs.
3881         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
3882
3883 2011-08-26  Cary Coutant  <ccoutant@google.com>
3884
3885         * layout.cc (Free_list::allocate): Provide guarantee of minimum
3886         remaining hole size when allocating.
3887         (Layout::make_output_section): Set fill methods for debug sections.
3888         * layout.h (Free_list::Free_list_node): Move from private to
3889         public.
3890         (Free_list::set_min_hole_size): New function.
3891         (Free_list::begin, Free_list::end): New functions.
3892         (Free_list::min_hole_): New data member.
3893         * output.cc: Include dwarf.h.
3894         (Output_fill_debug_info::do_minimum_hole_size): New function.
3895         (Output_fill_debug_info::do_write): New function.
3896         (Output_fill_debug_line::do_minimum_hole_size): New function.
3897         (Output_fill_debug_line::do_write): New function.
3898         (Output_section::Output_section): Initialize new data member.
3899         (Output_section::set_final_data_size): Ensure patch space is larger
3900         than minimum hole size.
3901         (Output_section::do_write): Fill holes in debug sections.
3902         * output.h (Output_fill): New class.
3903         (Output_fill_debug_info): New class.
3904         (Output_fill_debug_line): New class.
3905         (Output_section::set_free_space_fill): New function.
3906         (Output_section::free_space_fill_): New data member.
3907         * testsuite/Makefile.am (incremental_test_3): Add
3908         --incremental-patch option.
3909         (incremental_test_4): Likewise.
3910         (incremental_test_5): Likewise.
3911         (incremental_test_6): Likewise.
3912         (incremental_copy_test): Likewise.
3913         (incremental_common_test_1): Likewise.
3914         * testsuite/Makefile.in: Regenerate.
3915
3916 2011-08-26  Nick Clifton  <nickc@redhat.com>
3917
3918         * po/es.po: Updated Spanish translation.
3919
3920 2011-08-01  Cary Coutant  <ccoutant@google.com>
3921
3922         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
3923         * gold/testsuite/Makefile.in: Regenerate.
3924         * gold/testsuite/justsyms_exec.c: New source file.
3925         * gold/testsuite/justsyms_lib.c: New source file.
3926
3927 2011-08-01  Cary Coutant  <ccoutant@google.com>
3928
3929         * layout.cc (Layout::set_segment_offsets): Don't realign text
3930         segment if -Ttext was specified.
3931         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
3932         file type.
3933         * object.h (Sized_relobj_file::e_type): New function.
3934         (Sized_relobj_file::e_type_): New data member.
3935         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
3936         base address for ET_EXEC files.
3937         * target.cc (Target::do_make_elf_object_implementation): Allow
3938         ET_EXEC files with --just-symbols option.
3939
3940 2011-07-28  Cary Coutant  <ccoutant@google.com>
3941
3942         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
3943         Add thread_number parameter.
3944         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
3945         * workqueue-threads.cc
3946         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
3947         current thread if its thread number is greater than desired thread
3948         count.
3949         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
3950         Add thread_number parameter.
3951         (Workqueue::should_cancel_thread): Likewise.
3952         (Workqueue::find_runnable_or_wait): Pass thread_number to
3953         should_cancel_thread.
3954         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
3955         parameter.
3956
3957 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
3958
3959         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
3960         only after checking if it cannot be forced local.
3961         * symtab.h (is_externally_visible): Check if the symbol is not forced
3962         local.
3963
3964 2011-07-15  Ian Lance Taylor  <iant@google.com>
3965
3966         * options.h (class General_options): Add --print-output-format.
3967         Move -EL next to -EB, for  better --help output.
3968         * target-select.cc: Include <cstdio>, "options.h", and
3969         "parameters.h".
3970         (Target_selector::do_target_bfd_name): New function.
3971         (print_output_format): New function.
3972         * target-select.h (class Target_selector): Update declarations.
3973         (Target_selector::target_bfd_name): New function.
3974         (print_output_format): Declare.
3975         * main.cc: Include "target-select.h".
3976         (main): Handle --print-output-format.
3977         * gold.cc: Include "target-select.h".
3978         (queue_initial_tasks): Handle --print-output-format when there are
3979         no input files.
3980         * parameters.cc (parameters_force_valid_target): Give a better
3981         error message if -EB/-EL does not match target.
3982         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
3983         function.
3984
3985 2011-07-15  Ian Lance Taylor  <iant@google.com>
3986
3987         * i386.cc (class Output_data_plt_i386): Add layout_ field.
3988         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
3989         (Output_data_plt_i386::do_write): Write address of .dynamic
3990         section to first entry in .got.plt section.
3991         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
3992         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
3993         Initialize layout_.
3994         (Output_data_plt_x86_64::do_write): Write address of .dynamic
3995         section to first entry in .got.plt section.
3996         * layout.h (Layout::dynamic_section): New function.
3997
3998 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
3999
4000         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
4001         to claim_file call.
4002         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
4003         input_section_position_, and input_section_glob_.
4004         (read_layout_from_file): Call function section_ordering_specified.
4005         * layout.h (is_section_ordering_specified): New function.
4006         (section_ordering_specified): New function.
4007         (section_ordering_specified_): New boolean member.
4008         * main.cc(main): Call load_plugins after layout object is defined.
4009         * output.cc (Output_section::add_input_section): Use
4010         function section_ordering_specified to check if section ordering is
4011         needed.
4012         * output.cc (Output_section::add_relaxed_input_section): Use
4013         function section_ordering_specified to check if section ordering is
4014         needed.
4015         (Output_section::update_section_layout): New function.
4016         (Output_section::sort_attached_input_sections): Check if input section
4017         must be reordered.
4018         * output.h (Output_section::update_section_layout): New function.
4019         * plugin.cc (get_section_count): New function.
4020         (get_section_type): New function.
4021         (get_section_name): New function.
4022         (get_section_contents): New function.
4023         (update_section_order): New function.
4024         (allow_section_ordering): New function.
4025         (Plugin::load): Add the new interfaces to the transfer vector.
4026         (Plugin_manager::load_plugins): New parameter.
4027         (Plugin_manager::all_symbols_read): New parameter.
4028         (Plugin_manager::claim_file): New parameter. Save the elf object for
4029         unclaimed objects.
4030         (Plugin_manager::get_elf_object): New function.
4031         (Plugin_manager::get_view): Change to directly use the bool to check
4032         if get_view is called from claim_file_hook.
4033         * plugin.h (input_objects): New function
4034         (Plugin__manager::load_plugins): New parameter.
4035         (Plugin_manager::claim_file): New parameter.
4036         (Plugin_manager::get_elf_object): New function.
4037         (Plugin_manager::in_claim_file_handler): New function.
4038         (Plugin_manager::in_claim_file_handler_): New member.
4039         (layout): New function.
4040         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
4041         handler with an extra parameter. Make the elf object before calling
4042         claim_file handler.
4043         * testsuite/plugin_test.c (get_section_count): New function pointer.
4044         (get_section_type): New function pointer.
4045         (get_section_name): New function pointer.
4046         (get_section_contents): New function pointer.
4047         (update_section_order): New function pointer.
4048         (allow_section_ordering): New function pointer.
4049         (onload): Check if the new interfaces exist.
4050
4051 2011-07-13  Ian Lance Taylor  <iant@google.com>
4052
4053         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
4054         relro section.
4055         * x86_64.cc (Target_x86_64::got_section): Likewise.
4056         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
4057         (relro_now_test_SOURCES): New variable.
4058         (relro_now_test_DEPENDENCIES): New variable.
4059         (relro_now_test_LDFLAGS): New variable.
4060         (relro_now_test_LDADD): New variable.
4061         (relro_now_test.so): New target.
4062         * testsuite/Makefile.in: Rebuild.
4063
4064 2011-07-12  Ian Lance Taylor  <iant@google.com>
4065
4066         PR gold/12980
4067         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
4068         GLOB_DAT relocation rather than a RELATIVE relocation for a
4069         protected symbol when creating a shared library.
4070         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
4071         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
4072         * testsuite/protected_main_1.cc (main): Test that protected
4073         function has same address.
4074
4075 2011-07-11  Ian Lance Taylor  <iant@google.com>
4076
4077         PR gold/12979
4078         * options.h (class General_options): Add -Bgroup.
4079         * options.cc (General_options::finalize): If -Bgroup is set,
4080         default to --unresolved-symbols=report-all.
4081         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
4082         * target-reloc.h (issue_undefined_symbol_error): Handle
4083         --unresolved-symbols=report-all.
4084
4085 2011-07-08  Ian Lance Taylor  <iant@google.com>
4086
4087         PR gold/11985
4088         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
4089         if linker script discards key sections.
4090         (Layout::create_dynamic_symtab): Likewise.
4091         (Layout::assign_local_dynsym_offsets): Likewise.
4092         (Layout::sized_create_version_sections): Likewise.
4093         (Layout::create_interp): Likewise.
4094         (Layout::finish_dynamic_section): Likewise.
4095         (Layout::set_dynamic_symbol_size): Likewise.
4096
4097 2011-07-08  Ian Lance Taylor  <iant@google.com>
4098
4099         PR gold/12386
4100         * options.h (class General_options): Add --unresolved-symbols.
4101         * target-reloc.h (issue_undefined_symbol_error): Check
4102         --unresolved-symbols.  Add comments.
4103
4104 2011-07-08  Ian Lance Taylor  <iant@google.com>
4105
4106         * testsuite/odr_violation2.cc (Ordering::operator()): Make
4107         expression more complex.
4108
4109 2011-07-08  Ian Lance Taylor  <iant@google.com>
4110
4111         PR gold/11317
4112         * target-reloc.h (issue_undefined_symbol_error): New inline
4113         function, broken out of relocate_section.
4114         (relocate_section): Call issue_undefined_symbol_error.
4115         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
4116         there is no TLS segment if we are about to issue an undefined
4117         symbol error.
4118         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
4119
4120 2011-07-08  Ian Lance Taylor  <iant@google.com>
4121
4122         PR gold/12279
4123         * resolve.cc (Symbol_table::should_override): Add fromtype
4124         parameter.  Change all callers.  Give error when linking together
4125         TLS and non-TLS symbol.
4126         (Symbol_table::should_override_with_special): Add fromtype
4127         parameter.  Change all callers.
4128         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
4129         there is no TLS segment if we have reported some errors.
4130         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
4131
4132 2011-07-08  Ian Lance Taylor  <iant@google.com>
4133
4134         PR gold/12372
4135         * target.h (Target::plt_address_for_global): New function.
4136         (Target::plt_address_for_local): New function.
4137         (Target::plt_section_for_global): Remove.
4138         (Target::plt_section_for_local): Remove.
4139         (Target::do_plt_address_for_global): New virtual function.
4140         (Target::do_plt_address_for_local): New virtual function.
4141         (Target::do_plt_section_for_global): Remove.
4142         (Target::do_plt_section_for_local): Remove.
4143         (Target::register_global_plt_entry): Add Symbol_table and Layout
4144         parameters.
4145         * output.cc (Output_data_got::Got_entry::write): Use
4146         plt_address_for_global and plt_address_for_local.
4147         * layout.cc (Layout::add_target_dynamic_tags): Use size and
4148         address of output section.
4149         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
4150         got_irelative_, and irelative_count_ fields.  Update
4151         declarations.
4152         (Output_data_plt_i386::has_irelative_section): New function.
4153         (Output_data_plt_i386::entry_count): Add irelative_count_.
4154         (Output_data_plt_i386::set_final_data_size): Likewise.
4155         (class Target_i386): Add got_irelative_ and rel_irelative_
4156         fields.  Update declarations.
4157         (Target_i386::Target_i386): Initialize new fields.
4158         (Target_i386::do_plt_address_for_global): New function replacing
4159         do_plt_section_for_global.
4160         (Target_i386::do_plt_address_for_local): New function replacing
4161         do_plt_section_for_local.
4162         (Target_i386::got_section): Create got_irelative_.
4163         (Target_i386::rel_irelative_section): New function.
4164         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
4165         fields.  Don't define __rel_iplt_{start,end}.
4166         (Output_data_plt_i386::add_entry): Add symtab and layout
4167         parameters.  Change all callers.  Use different PLT and GOT for
4168         IFUNC symbols.
4169         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
4170         layout parameters.  Change all callers.  Use different PLT and
4171         GOT.
4172         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
4173         (Output_data_plt_i386::rel_irelative): New function.
4174         (Output_data_plt_i386::address_for_global): New function.
4175         (Output_data_plt_i386::address_for_local): New function.
4176         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
4177         IRELATIVE GOT when changing IFUNC GOT entries.
4178         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
4179         reloc.
4180         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
4181         if we didn't create an IRELATIVE GOT.
4182         (Target_i386::Relocate::relocate): Use plt_address_for_global and
4183         plt_address_for_local.
4184         (Target_i386::do_dynsym_value): Use plt_address_for_global.
4185         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
4186         got_irelative_, and irelative_count_ fields.  Update
4187         declarations.
4188         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
4189         Initialize new fields.  Remove symtab parameter.  Change all
4190         callers.
4191         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
4192         irelative_count_.
4193         (Output_data_plt_x86_64::has_irelative_section): New function.
4194         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
4195         (class Target_x86_64): Add got_irelative_ and rel_irelative_
4196         fields.  Update declarations.
4197         (Target_x86_64::Target_x86_64): Initialize new fields.
4198         (Target_x86_64::do_plt_address_for_global): New function replacing
4199         do_plt_section_for_global.
4200         (Target_x86_64::do_plt_address_for_local): New function replacing
4201         do_plt_section_for_local.
4202         (Target_x86_64::got_section): Create got_irelative_.
4203         (Target_x86_64::rela_irelative_section): New function.
4204         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
4205         all callers.  Don't create __rel_iplt_{start,end}.
4206         (Output_data_plt_x86_64::add_entry): Add symtab and layout
4207         parameters.  Change all callers.  Use different PLT and GOT for
4208         IFUNC symbols.
4209         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
4210         layout parameters.  Change all callers.  Use different PLT and
4211         GOT.
4212         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
4213         parameters.  Change all callers.  Use different PLT and GOT for
4214         IFUNC symbols.
4215         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
4216         (Output_data_plt_x86_64::rela_irelative): New function.
4217         (Output_data_plt_x86_64::address_for_global): New function.
4218         (Output_data_plt_x86_64::address_for_local): New function.
4219         (Output_data_plt_x86_64::set_final_data_size): Likewise.
4220         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
4221         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
4222         (Target_x86_64::register_global_plt_entry): Add symtab and layout
4223         parameters.
4224         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
4225         reloc.
4226         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
4227         symbols if we didn't create an IRELATIVE GOT.
4228         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
4229         plt_address_for_local.
4230         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
4231         * testsuite/ifuncvar1.c: New test file.
4232         * testsuite/ifuncvar2.c: New test file.
4233         * testsuite/ifuncvar3.c: New test file.
4234         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
4235         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
4236         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
4237         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
4238         * testsuite/Makefile.in: Rebuild.
4239
4240 2011-07-07  Cary Coutant  <ccoutant@google.com>
4241
4242         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
4243         (two_file_test_1_ndebug.o): Likewise.
4244         (two_file_test_1b_ndebug.o): Likewise.
4245         (two_file_test_2_ndebug.o): Likewise.
4246         (two_file_test_main_ndebug.o): Likewise.
4247         (incremental_test_2): Link with no-debug versions.
4248
4249 2011-07-06  Cary Coutant  <ccoutant@google.com>
4250
4251         * gold/incremental.cc
4252         (Output_section_incremental_inputs::write_info_blocks): Check for
4253         hidden and internal symbols.
4254
4255 2011-07-06  Cary Coutant  <ccoutant@google.com>
4256
4257         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
4258         Check disposition for startup file.
4259         (Incremental_inputs::report_command_line): Ignore
4260         --incremental-startup-unchanged option.
4261         * options.cc (General_options::parse_incremental_startup_unchanged):
4262         New function.
4263         (General_options::General_options): Initialize new data member.
4264         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
4265         (General_options): Add --incremental-startup-unchanged option.
4266         (General_options::incremental_startup_disposition): New function.
4267         (General_options::incremental_startup_disposition_): New data member.
4268
4269 2011-07-06  Cary Coutant  <ccoutant@google.com>
4270
4271         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
4272         input file index to Script_info ctor.
4273         (Sized_incremental_binary::do_file_has_changed): Find the
4274         command-line argument for files named in scripts.
4275         * incremental.h (Script_info::Script_info): New ctor
4276         with input file index.
4277         (Script_info::input_file_index): New function.
4278         (Script_info::input_file_index_): New data member.
4279         (Incremental_binary::get_library): Add const.
4280         (Incremental_binary::get_script_info): Add const.
4281         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
4282         * testsuite/Makefile.am (incremental_test_5): New test case.
4283         (incremental_test_6): New test case.
4284         * testsuite/Makefile.in: Regenerate.
4285
4286 2011-07-06  Cary Coutant  <ccoutant@google.com>
4287
4288         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
4289         debug output when command lines differ.
4290
4291 2011-07-06  Cary Coutant  <ccoutant@google.com>
4292
4293         * incremental.cc (Incremental_inputs::report_command_line): Ignore
4294         --incremental-patch option.
4295         * layout.cc (Free_list::allocate): Extend allocation beyond original
4296         end if enabled.
4297         (Layout::make_output_section): Mark sections that should get
4298         patch space.
4299         * options.cc (parse_percent): New function.
4300         * options.h (parse_percent): New function.
4301         (DEFINE_percent): New macro.
4302         (General_options): Add --incremental-patch option.
4303         * output.cc (Output_section::Output_section): Initialize new data
4304         members.
4305         (Output_section::add_input_section): Print section name when out
4306         of patch space.
4307         (Output_section::add_output_section_data): Likewise.
4308         (Output_section::set_final_data_size): Add patch space when
4309         doing --incremental-full.
4310         (Output_section::do_reset_address_and_file_offset): Remove patch
4311         space.
4312         (Output_segment::set_section_list_addresses): Print debug output
4313         only if --incremental-update.
4314         * output.h (Output_section::set_is_patch_space_allowed): New function.
4315         (Output_section::is_patch_space_allowed_): New data member.
4316         (Output_section::patch_space_): New data member.
4317         * parameters.cc (Parameters::incremental_full): New function.
4318         * parameters.h (Parameters::incremental_full): New function
4319         * testsuite/Makefile.am (incremental_test_2): Add test for
4320         --incremental-patch option.
4321         * testsuite/Makefile.in: Regenerate.
4322         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
4323         (t18): Remove function body.
4324
4325 2011-07-05  Doug Kwan  <dougkwan@google.com>
4326
4327         PR gold/12771
4328         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
4329         Arm_Address type for relocation result.
4330         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
4331         overflow check.
4332         (Arm_relocate_functions::abs32): Use unaligned access.
4333         (Arm_relocate_functions::rel32): Ditto.
4334         (Arm_relocate_functions::prel31): Ditto.
4335         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
4336         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
4337         static data relocations.
4338         * testsuite/Makefile.in: Regnerate.
4339         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
4340
4341 2011-07-05  Ian Lance Taylor  <iant@google.com>
4342
4343         PR gold/12392
4344         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
4345         symbols if necessary.
4346         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
4347
4348 2011-07-05  Ian Lance Taylor  <iant@google.com>
4349
4350         PR gold/12952
4351         * resolve.cc (Symbol::override_base_with_special): Simply override
4352         version with special symbol version, ignoring previous version.
4353
4354 2011-07-05  Ian Lance Taylor  <iant@google.com>
4355
4356         * object.cc (Sized_relobj_file::include_section_group): Add
4357         information to comment about signature location.
4358
4359 2011-07-02  Ian Lance Taylor  <iant@google.com>
4360
4361         PR gold/12957
4362         * options.h (class General_options): Add -f and -F.
4363         * options.cc (General_options::finalize): Fatal error if -f/-F
4364         are used without -shared.
4365         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
4366
4367 2011-07-02  Ian Lance Taylor  <iant@google.com>
4368
4369         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
4370
4371 2011-07-01  Ian Lance Taylor  <iant@google.com>
4372
4373         PR gold/12525
4374         PR gold/12952
4375         * resolve.cc (Symbol::override_base_with_special): Don't override
4376         the version if the overriding symbol has a different name.
4377         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
4378         all callers.  If we give an error about an undefined version,
4379         define the base version if necessary.
4380         * dynobj.h (class Versions): Update declaration.
4381         * testsuite/weak_alias_test_5.cc: New file.
4382         * testsuite/weak_alias_test.script: New file.
4383         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
4384         and versioned_alias have the right value, and call t2.
4385         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
4386         weak_alias_test_5.so.
4387         (weak_alias_test_LDADD): Likewise.
4388         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
4389         * testsuite/Makefile.in: Rebuild.
4390
4391 2011-07-01  Ian Lance Taylor  <iant@google.com>
4392
4393         PR gold/12525
4394         * options.h (class General_options): Support -z notext.
4395         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
4396         -Wl,-z,notext.
4397         (two_file_shared_nonpic.so): Likewise.
4398         (two_file_shared_mixed.so): Likewise.
4399         (two_file_shared_mixed_1.so): Likewise.
4400         (weak_undef_lib_nonpic.so): Likewise.
4401         (alt/weak_undef_lib_nonpic.so): Likewise.
4402         (tls_test_shared_nonpic.so): Likewise.
4403         * testsuite/Makefile.in: Rebuild.
4404
4405 2011-07-01  Ian Lance Taylor  <iant@google.com>
4406
4407         PR gold/12525
4408         * configure.ac: Test whether static linking works, setting
4409         the automake conditional HAVE_STATIC.
4410         * testsuite/Makefile.am: Disable tests using -static if
4411         HAVE_STATIC is not true.
4412         * configure, testsuite/Makefile.in: Rebuild.
4413
4414 2011-07-01  Ian Lance Taylor  <iant@google.com>
4415
4416         PR gold/12525
4417         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
4418         Assert if we see DW_EH_PE_indirect.
4419         * target.h (Target::ehframe_datarel_base): New function.
4420         (Target::do_ehframe_datarel_base): New target function.
4421         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
4422         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
4423         function.
4424
4425 2011-07-01  Ian Lance Taylor  <iant@google.com>
4426
4427         PR gold/12571
4428         * options.h (class General_options): Add
4429         --ld-generated-unwind-info.
4430         * ehframe.cc (Fde::write): Add address parameter.  Change all
4431         callers.  If associated with PLT, fill in address and size.
4432         (Cie::set_output_offset): Only add merge mapping if there is an
4433         object.
4434         (Cie::write): Add address parameter.  Change all callers.
4435         (Eh_frame::add_ehframe_for_plt): New function.
4436         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
4437         input_offset_ fields into union u_, with new plt field.
4438         (Fde::Fde): Adjust for new union field.
4439         (Fde::Fde) [Output_data version]: New constructor.
4440         (Fde::add_mapping): Only add merge mapping if there is an object.
4441         (class Cie): Update declarations.
4442         (class Eh_frame): Declare add_ehframe_for_plt.
4443         * layout.cc (Layout::layout_eh_frame): Break out code into
4444         make_eh_frame_section, and call it.
4445         (Layout::make_eh_frame_section): New function.
4446         (Layout::add_eh_frame_for_plt): New function.
4447         * layout.h (class Layout): Update declarations.
4448         * merge.cc (Merge_map::add_mapping): Add assertion.
4449         * i386.cc: Include "dwarf.h".
4450         (class Output_data_plt_i386): Make first_plt_entry,
4451         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
4452         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
4453         and plt_eh_frame_fde.
4454         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
4455         boundary.  Call add_eh_frame_for_plt if appropriate.
4456         * x86_64.cc: Include "dwarf.h".
4457         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
4458         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
4459         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
4460         and plt_eh_frame_fde.
4461         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
4462         appropriate.
4463
4464 2011-06-29  Ian Lance Taylor  <iant@google.com>
4465
4466         PR gold/12629
4467         * object.cc (Sized_relobj_file::layout_section): Change shdr
4468         parameter to be const.
4469         (Sized_relobj_file::layout_eh_frame_section): New function, broken
4470         out of do_layout.
4471         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
4472         appropriate.  Call layout_eh_frame_section.
4473         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
4474         sections.
4475         * object.h (class Sized_relobj_file): Update declarations.
4476
4477 2011-06-29  Ian Lance Taylor  <iant@google.com>
4478
4479         PR gold/12652
4480         * script.cc (Token::integer_value): Accept trailing M/m/K/k
4481         modifier.
4482         (Lex::gather_token): Accept trailing M/m/K/k for integers.
4483
4484 2011-06-29  Ian Lance Taylor  <iant@google.com>
4485
4486         PR gold/12675
4487         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
4488         SHT_X86_64_UNWIND.
4489         * layout.cc (Layout::layout_eh_frame): Likewise.
4490
4491 2011-06-29  Ian Lance Taylor  <iant@google.com>
4492
4493         PR gold/12695
4494         * layout.cc (Layout::symtab_section_shndx): New function.
4495         * layout.h (class Layout): Declare symtab_section_shndx.
4496         * output.cc (Output_section::write_header): Call it.
4497
4498 2011-06-29  Ian Lance Taylor  <iant@google.com>
4499
4500         PR gold/12818
4501         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
4502         symbols which are not used in a relocation.
4503
4504 2011-06-28  Ian Lance Taylor  <iant@google.com>
4505
4506         PR gold/12898
4507         * layout.cc (Layout::segment_precedes): Don't crash if a linker
4508         script create indistinguishable segments.
4509         (Layout::set_segment_offsets): Use stable_sort when sorting
4510         segments.  Pass this to Compare_segments constructor.
4511         * layout.h (class Layout): Make segment_precedes non-static.
4512         (class Compare_segments): Change from struct to class.  Add
4513         layout_ field.  Add constructor.
4514         * script-sections.cc
4515         (Script_sections::attach_sections_using_phdrs_clause): Rename
4516         local orphan to is_orphan.  Don't report failure to put empty
4517         section in segment.  On attachment failure, report name of
4518         section, and attach to first PT_LOAD segment.
4519
4520 2011-06-28  Ian Lance Taylor  <iant@google.com>
4521
4522         PR gold/12934
4523         * target-select.cc (Target_selector::Target_selector): Add
4524         emulation parameter.  Change all callers.
4525         (select_target_by_bfd_name): Rename from select_target_by_name.
4526         Change all callers.
4527         (select_target_by_emulation): New function.
4528         (supported_emulation_names): New function.
4529         * target-select.h (class Target_selector): Add emulation_ field.
4530         Update declarations.
4531         (Target_selector::recognize_by_bfd_name): Rename from
4532         recognize_by_name.  Change all callers.
4533         (Target_selector::supported_bfd_names): Rename from
4534         supported_names.  Change all callers.
4535         (Target_selector::recognize_by_emulation): New function.
4536         (Target_selector::supported_emulations): New function.
4537         (Target_selector::emulation): New function.
4538         (Target_selector::do_recognize_by_bfd_name): Rename from
4539         do_recognize_by_name.  Change all callers.
4540         (Target_selector::do_supported_bfd_names): Rename from
4541         do_supported_names.  Change all callers.
4542         (Target_selector::do_recognize_by_emulation): New function.
4543         (Target_selector::do_supported_emulations): New function.
4544         (select_target_by_bfd_name): Change name in declaration.
4545         (select_target_by_emulation): Declare.
4546         (supported_emulation_names): Declare.
4547         * parameters.cc (parameters_force_valid_target): Try to find
4548         target based on emulation from -m option.
4549         * options.h (class General_options): Change doc string for -m.
4550         * options.cc (help): Print emulations.
4551         (General_options::parse_V): Likewise.
4552         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
4553         Add emulation parameter.  Change all callers.
4554
4555 2011-06-28  Ian Lance Taylor  <iant@google.com>
4556
4557         * target.h (class Target): Add osabi_ field.
4558         (Target::osabi): New function.
4559         (Target::set_osabi): New function.
4560         (Target::Target): Initialize osabi_.
4561         (Target::do_adjust_elf_header): Make pure virtual.
4562         (Sized_target::do_adjust_elf_header): Declare.
4563         * target.cc (Sized_target::do_adjust_elf_header): New function.
4564         (class Sized_target): Instantiate all versions.
4565         * freebsd.h (class Target_freebsd): Remove.
4566         (Target_selector_freebsd::do_recognize): Call set_osabi on
4567         Target.
4568         (Target_selector_freebsd::do_recognize_by_name): Likewise.
4569         (Target_selector_freebsd::set_osabi): Remove.
4570         * i386.cc (class Target_i386): Inherit from Sized_target rather
4571         than Target_freebsd.
4572         * x86_64.cc (class Target_x86_64): Likewise.
4573
4574 2011-06-28  Ian Lance Taylor  <iant@google.com>
4575
4576         * target.h (Target::can_check_for_function_pointers): Rewrite.
4577         Make non-virtual.
4578         (Target::can_icf_inline_merge_sections): Likewise.
4579         (Target::section_may_have_icf_unsafe_poineters): Likewise.
4580         (Target::Target_info): Add can_icf_inline_merge_sections field.
4581         (Target::do_can_check_for_function_pointers): New virtual
4582         function.
4583         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
4584         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
4585         from can_check_for_function_pointers, move in file.
4586         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
4587         section_may_have_icf_unsafe_poineters, move in file.
4588         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
4589         * i386.cc (Target_i386::do_can_check_for_function_pointers):
4590         Rename from can_check_for_function_pointers, move in file.
4591         (Target_i386::can_icf_inline_merge_sections): Remove.
4592         (Target_i386::i386_info): Initialize
4593         can_icf_inline_merge_sections.
4594         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
4595         Initialize can_icf_inline_merge_sections.
4596         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
4597         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
4598         Rename from can_check_for_function_pointers, move in file.
4599         (Target_x86_64::can_icf_inline_merge_sections): Remove.
4600         (Target_x86_64::x86_64_info): Initialize
4601         can_icf_inline_merge_sections.
4602         * testsuite/testfile.cc (Target_test::test_target_info):
4603         Likewise.
4604         * icf.cc (get_section_contents): Correct formatting.
4605
4606 2011-06-27  Ian Lance Taylor  <iant@google.com>
4607
4608         * symtab.cc (Symbol::versioned_name): New function.
4609         (Symbol_table::add_to_final_symtab): Use versioned_name when
4610         appropriate.
4611         (Symbol_table::sized_write_symbol): Likewise.
4612         * symtab.h (class Symbol): Declare versioned_name.
4613         * stringpool.h (class Stringpool_template): Add variant of add
4614         which takes a std::basic_string.
4615         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
4616         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
4617         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
4618         (ver_test_12.o): New target.
4619         * testsuite/Makefile.in: Rebuild.
4620
4621 2011-06-27  Doug Kwan  <dougkwan@google.com>
4622
4623         * arm.cc (Arm_relocate_functions::thm_jump8,
4624         Arm_relocate_functions::thm_jump11): Use a wider signed
4625         type to compute offset.
4626         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
4627         arm_thm_jump8.
4628         * testsuite/Makefile.in: Regenerate.
4629         * testsuite/arm_branch_in_range.sh: Check test results of
4630         arm_thm_jump11 and arm_thm_jump8.
4631         * testsuite/arm_thm_jump11.s: New test source file.
4632         * testsuite/arm_thm_jump11.t: New linker script.
4633         * testsuite/arm_thm_jump8.s: New test source file.
4634         * testsuite/arm_thm_jump8.t: New linker script.
4635
4636 2011-06-24  Ian Lance Taylor  <iant@google.com>
4637
4638         * layout.cc: Include "object.h".
4639         (ctors_sections_in_init_array): New static variable.
4640         (Layout::is_ctors_in_init_array): New function.
4641         (Layout::layout): Add entry to ctors_sections_in_init_array if
4642         appropriate.
4643         * layout.h (class Layout): Declare is_ctors_in_init_array.
4644         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
4645         is_ctors_reverse_view is set.
4646         (Sized_relobj_file::write_sections): Add layout parameter.  Change
4647         all callers.  Set is_ctors_reverse_view field of View_size.
4648         (Sized_relobj_file::reverse_words): New function.
4649         * object.h (Sized_relobj_file::View_size): Add
4650         is_ctors_reverse_view field.
4651         (class Sized_relobj_file): Update declarations.
4652         * testsuite/initpri3.c: New test.
4653         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
4654         initpri3b.
4655         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
4656         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
4657         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
4658         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
4659         * testsuite/Makefile.in: Rebuild.
4660
4661 2011-06-24  Cary Coutant  <ccoutant@google.com>
4662
4663         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
4664         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
4665         (debug_msg_cdebug.err): New targets.
4666         * testsuite/Makefile.in: Regenerate.
4667         * testsuite/debug_msg.sh: Check output of link with compressed debug.
4668         Fix checks for link with shared library.
4669
4670 2011-06-24  Doug Kwan  <dougkwan@google.com>
4671
4672         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
4673         skip empty text sections.
4674         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
4675
4676 2011-06-22  Ian Lance Taylor  <iant@google.com>
4677
4678         PR gold/12910
4679         * options.h (class General_options): Add --ctors-in-init-array.
4680         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
4681         friends as SHT_PROGBITS for merging sections.
4682         (Layout::layout): Remove special handling of .init_array and
4683         friends.  Don't sort if doing relocatable link.  Sort for .ctors
4684         and .dtors if ctors_in_init_array.
4685         (Layout::make_output_section): Force correct section types for
4686         .init_array and friends.  Don't sort if doing relocatable link,
4687         Don't sort .ctors and .dtors if ctors_in_init_array.
4688         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
4689         (Layout::output_section_name): Add relobj parameter.  Change all
4690         callers.  Handle .ctors. and .dtors. in code rather than table.
4691         Handle .ctors and .dtors if ctors_in_init_array.
4692         (Layout::match_file_name): New function, moved from output.cc.
4693         * layout.h (class Layout): Update declarations.
4694         * output.cc: Include "layout.h".
4695         (Input_section_sort_entry::get_priority): New function.
4696         (Input_section_sort_entry::match_file_name): Just call
4697         Layout::match_file_name.
4698         (Output_section::Input_section_sort_init_fini_compare::operator()):
4699         Handle .ctors and .dtors.  Sort by explicit priority rather than
4700         by name.
4701         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
4702         * testsuite/initpri2.c: New test.
4703         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
4704         (check_PROGRAMS): Add initpri2.
4705         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
4706         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
4707         * configure, testsuite/Makefile.in: Rebuild.
4708
4709 2011-06-19  Ian Lance Taylor  <iant@google.com>
4710
4711         PR gold/12880
4712         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
4713         .interp section to a PT_INTERP segment even if we have seen a
4714         --dynamic-linker option.  Don't do it if we have seen a PHDRS
4715         clause in a linker script.
4716         (Layout::finalize): Don't create a .interp section if we've
4717         already create a PT_INTERP segment.
4718         (Layout::create_interp): Always call choose_output_section (revert
4719         patch of 2011-06-17).  Don't create PT_INTERP segment.
4720         * script-sections.cc
4721         (Script_sections::create_note_and_tls_segments): Add a .interp
4722         section to a PT_INTERP segment even if we have seen a
4723         --dynamic-linker option.
4724
4725 2011-06-18  Ian Lance Taylor  <iant@google.com>
4726
4727         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
4728         merely because a non-PT_LOAD segment has a dynamic reloc.
4729
4730 2011-06-18  Ian Lance Taylor  <iant@google.com>
4731
4732         * layout.cc (Layout::finish_dynamic_section): Don't create
4733         DT_FLAGS entry if not needed.
4734
4735 2011-06-18  Ian Lance Taylor  <iant@google.com>
4736
4737         PR gold/12745
4738         * layout.cc (Layout::layout_eh_frame): Correct handling of
4739         writable .eh_frame section.
4740
4741 2011-06-17  Ian Lance Taylor  <iant@google.com>
4742
4743         PR gold/12893
4744         * resolve.cc (Symbol_table::resolve): Don't give an error if a
4745         symbol is redefined with the exact same object and value.
4746
4747 2011-06-17  Ian Lance Taylor  <iant@google.com>
4748
4749         PR gold/12880
4750         * layout.h (class Layout): Add interp_segment_ field.
4751         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
4752         (Layout::attach_allocated_section_to_segment): If making shared
4753         library, put .interp section in PT_INTERP segment.
4754         (Layout::finalize): Also call create_interp if -dynamic-linker
4755         option was used.
4756         (Layout::create_interp): Assert that there is no PT_INTERP
4757         segment.  If not using a SECTIONS clause, use make_output_section.
4758         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
4759         * script-sections.cc
4760         (Script_sections::create_note_and_tls_segments): If making shared
4761         library, put .interp section in PT_INTERP segment.
4762
4763 2011-06-17  Ian Lance Taylor  <iant@google.com>
4764
4765         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
4766         when making a shared library.
4767
4768 2011-06-17  Ian Lance Taylor  <iant@google.com>
4769
4770         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
4771         parameter.  Change all callers.  Don't issue warning about PC32
4772         against locally defined symbol.
4773
4774 2011-06-16  Ian Lance Taylor  <iant@google.com>
4775
4776         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
4777         occurs in same object.
4778
4779 2011-06-14  Alan Modra  <amodra@gmail.com>
4780
4781         * po/POTFILES.in: Regenerate.
4782
4783 2011-06-09  Ian Lance Taylor  <iant@google.com>
4784
4785         * script-sections.cc
4786         (Orphan_output_section::set_section_addresses): For a relocatable
4787         link set address to 0.
4788
4789 2011-06-09  Cary Coutant  <ccoutant@google.com>
4790
4791         PR gold/12804
4792         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
4793         used with --compress-debug-sections.
4794         * gold/object.cc (Sized_relobj_file::do_layout): Report
4795         uncompressed size of compressed input sections.
4796
4797 2011-06-08  Cary Coutant  <ccoutant@google.com>
4798
4799         PR gold/12804
4800         * testsuite/two_file_test_2_v1.cc: Change initialization of
4801         v2 to keep it in .data.
4802
4803 2011-06-07  Cary Coutant  <ccoutant@google.com>
4804
4805         * common.cc (Symbol_table::do_allocate_commons_list): Call
4806         gold_fallback.
4807         * errors.cc (Errors::fatal): Adjust call to gold_exit.
4808         (Errors::fallback): New function.
4809         (gold_fallback): New function.
4810         * errors.h (Errors::fallback): New function.
4811         * gold.cc (gold_exit): Change status parameter to enum; adjust
4812         all callers.
4813         (queue_initial_tasks): Call gold_fallback.
4814         * gold.h: Include cstdlib.
4815         (Exit_status): New enum type.
4816         (gold_exit): Change status parameter to enum.
4817         (gold_fallback): New function.
4818         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
4819         (Layout::create_symtab_sections): Likewise.
4820         (Layout::create_shdrs): Likewise.
4821         * main.cc (main): Adjust call to gold_exit.
4822         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
4823         (Output_data_got::add_got_entry_pair): Likewise.
4824         (Output_section::add_input_section): Likewise.
4825         (Output_section::add_output_section_data): Likewise.
4826         (Output_segment::set_section_list_addresses): Likewise.
4827         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
4828
4829 2011-06-07  Cary Coutant  <ccoutant@google.com>
4830
4831         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
4832         for incremental links.
4833         * output.cc (Output_segment::set_section_list_addresses): Remove
4834         FIXME and test for TLS or BSS.
4835
4836 2011-06-07  Cary Coutant  <ccoutant@google.com>
4837
4838         * testsuite/Makefile.am: Add incremental_copy_test,
4839         incremental_common_test_1.
4840         * testsuite/Makefile.in: Regenerate.
4841         * testsuite/common_test_1_v1.c: New source file.
4842         * testsuite/common_test_1_v2.c: New source file.
4843         * testsuite/copy_test_v1.cc: New source file.
4844
4845 2011-06-07  Cary Coutant  <ccoutant@google.com>
4846
4847         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
4848         update, allocate common from bss section's free list.
4849         * incremental-dump.cc (dump_incremental_inputs): Print flag for
4850         linker-defined symbols.
4851         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
4852         Skip GOT and PLT entries that are no longer referenced.
4853         (Output_section_incremental_inputs::write_info_blocks): Mark
4854         linker-defined symbols.
4855         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
4856         * output.cc (Output_section::allocate): New function.
4857         * output.h (Output_section::allocate): New function.
4858         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
4859         linker-defined symbols.
4860         (Symbol::override_base_with_special): Copy is_predefined_ flag.
4861         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
4862         (Symbol::init_base_output_data): Likewise.
4863         (Symbol::init_base_output_segment): Likewise.
4864         (Symbol::init_base_constant): Likewise.
4865         (Sized_symbol::init_output_data): Likewise.
4866         (Sized_symbol::init_output_segment): Likewise.
4867         (Sized_symbol::init_constant): Likewise.
4868         (Symbol_table::do_define_in_output_data): Likewise.
4869         (Symbol_table::do_define_in_output_segment): Likewise.
4870         (Symbol_table::do_define_as_constant): Likewise.
4871         * symtab.h (Symbol::is_predefined): New function.
4872         (Symbol::init_base_output_data): Add is_predefined parameter.
4873         (Symbol::init_base_output_segment): Likewise.
4874         (Symbol::init_base_constant): Likewise.
4875         (Symbol::is_predefined_): New data member.
4876         (Sized_symbol::init_output_data): Add is_predefined parameter.
4877         (Sized_symbol::init_output_segment): Likewise.
4878         (Sized_symbol::init_constant): Likewise.
4879         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
4880
4881 2011-06-07  Cary Coutant  <ccoutant@google.com>
4882
4883         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
4884         instead of emit_copy_reloc.
4885         (Copy_relocs::emit_copy_reloc): Refactor.
4886         (Copy_relocs::make_copy_reloc): New function.
4887         (Copy_relocs::add_copy_reloc): Remove.
4888         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
4889         section.
4890         (Copy_relocs::make_copy_reloc): New function.
4891         (Copy_relocs::add_copy_reloc): Remove.
4892         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
4893         unchanged input files.
4894         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
4895         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
4896         Reserve BSS space for COPY relocations.
4897         (Sized_incremental_binary::do_emit_copy_relocs): New function.
4898         (Output_section_incremental_inputs::write_info_blocks): Record
4899         whether a symbol is copied from a shared object.
4900         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
4901         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
4902         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
4903         (Incremental_input_entry_reader::get_output_symbol_index): Add
4904         is_copy parameter.
4905         (Incremental_binary::emit_copy_relocs): New function.
4906         (Incremental_binary::do_emit_copy_relocs): New function.
4907         (Sized_incremental_binary::Sized_incremental_binary): Initialize
4908         new data member.
4909         (Sized_incremental_binary::add_copy_reloc): New function.
4910         (Sized_incremental_binary::do_emit_copy_relocs): New function.
4911         (Sized_incremental_binary::Copy_reloc): New struct.
4912         (Sized_incremental_binary::Copy_relocs): New typedef.
4913         (Sized_incremental_binary::copy_relocs_): New data member.
4914         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
4915         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
4916         * target.h (Sized_target::emit_copy_reloc): New function.
4917         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
4918
4919 2011-06-02  Cary Coutant  <ccoutant@google.com>
4920
4921         PR gold/12163
4922         * gold/archive.cc (Archive::Archive): Initialize new data member.
4923         (Archive::include_all_members): Return if archive has already been
4924         included.
4925         * gold/archive.h (Archive::include_all_members_): New data member.
4926
4927 2011-06-02  Nick Clifton  <nickc@redhat.com>
4928
4929         * dynobj.h: Fix spelling mistake in comment.
4930         * output.cc: Likewise.
4931
4932 2011-05-31  Doug Kwan  <dougkwan@google.com>
4933             Asier Llano
4934
4935         PR gold/12826
4936         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
4937         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
4938         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
4939         redundant arm_exidx_test.so.
4940         * testsuite/Makefile.in: Regenerate.
4941         (check_SCRIPTS): Add pr12826.sh
4942         (check_DATA): Add pr12826.stdout
4943         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
4944         * testsuite/pr12826.sh: New file.
4945         * testsuite/pr12826_1.s: Ditto.
4946         * testsuite/pr12826_1.s: Ditto.
4947
4948 2011-05-30  Ian Lance Taylor  <iant@google.com>
4949
4950         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
4951         sections.
4952
4953 2011-05-29  Ian Lance Taylor  <iant@google.com>
4954
4955         PR gold/12804
4956         * testsuite/Makefile.am: Use different file name for two_file_test
4957         temporary file for each incremental test.
4958         * testsuite/Makefile.in: Rebuild.
4959
4960 2011-05-29  Ian Lance Taylor  <iant@google.com>
4961
4962         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
4963         binary input file is empty.
4964
4965 2011-05-27  Ian Lance Taylor  <iant@google.com>
4966
4967         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
4968         (ver_test_9.so): Likewise.
4969         * testsuite/Makefile.in: Rebuild.
4970
4971 2011-05-26 Cary Coutant  <ccoutant@google.com>
4972
4973         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
4974         * incremental.cc (Incremental_inputs::report_input_section): Fix
4975         comment, indentation.
4976         (Incremental_inputs::report_comdat_group): New function.
4977         (Output_section_incremental_inputs::set_final_data_size): Adjust size
4978         of data for incremental input file entry.
4979         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
4980         group count, COMDAT group signatures.
4981         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
4982         an unchanged input file.
4983         * incremental.h (Incremental_object_entry::Incremental_object_entry):
4984         Initialize new data member.
4985         (Incremental_object_entry::add_comdat_group): New function.
4986         (Incremental_object_entry::get_comdat_group_count): New function.
4987         (Incremental_object_entry::get_comdat_signature_key): New function.
4988         (Incremental_object_entry::groups_): New data member.
4989         (Incremental_inputs::report_comdat_group): New function.
4990         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
4991         data for incremental input file entry.
4992         (Incremental_input_entry_reader::get_comdat_group_count): New function.
4993         (Incremental_input_entry_reader::get_input_section): Adjust size of
4994         data for incremental input file entry.
4995         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
4996         (Incremental_input_entry_reader::get_comdat_group_signature): New
4997         function.
4998         * object.cc (Sized_relobj::include_section_group): Report kept
4999         COMDAT groups for incremental links.
5000
5001 2011-05-24  David Meyer  <pdox@google.com>
5002
5003         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
5004         with name parameter.  Add found_name parameter.
5005         * fileread.cc (Input_file::find_file): Adjust code accordingly.
5006         * dirsearch.h (class Dirsearch): Update declaration.
5007
5008 2011-05-24  Ian Lance Taylor  <iant@google.com>
5009
5010         * archive.cc (Library_base::should_include_member): Pull in object
5011         from archive if it defines the entry symbol.
5012         * parameters.cc (Parameters::entry): New function.
5013         * parameters.h (class Parameters): Declare entry.
5014         * output.h (class Output_file_header): Remove entry_ field.
5015         * output.cc (Output_file_header::Output_file_header): Remove entry
5016         parameter.  Change all callers.
5017         (Output_file_header::entry): Use parameters->entry.
5018         * gold.cc (queue_middle_tasks): Likewise.
5019         * plugin.cc (Plugin_hook::run): Likewise.
5020
5021 2011-05-24 Cary Coutant  <ccoutant@google.com>
5022
5023         * gold.cc (queue_initial_tasks): Pass incremental base filename
5024         to Output_file::open_base_file; don't print error message.
5025         * incremental-dump.cc (main): Adjust call to
5026         Output_file::open_for_modification.
5027         * incremental-dump.cc (main): Likewise.
5028         * incremental.cc (Incremental_inputs::report_command_line):
5029         Ignore --incremental-base option when comparing command lines.
5030         Ignore parameter when given as separate argument.
5031         * options.h (class General_options): Add --incremental-base.
5032         * output.cc (Output_file::Output_file):
5033         (Output_file::open_base_file): Add base_name and writable parameters;
5034         read base file into new file; print error message here.
5035         (Output_file::map_no_anonymous): Add writable parameter; adjust all
5036         callers.
5037         * output.h (Output_file::open_for_modification): Rename to...
5038         (Output_file::open_base_file): ...this; add base_name and
5039         writable parameters; adjust all callers.
5040         (Output_file::map_no_anonymous): Add writable parameter; adjust all
5041         callers.
5042         * testsuite/Makefile.am (incremental_test_4): Test
5043         --incremental-base.
5044         * testsuite/Makefile.in: Regenerate.
5045
5046 2011-05-24 Cary Coutant  <ccoutant@google.com>
5047
5048         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
5049         incremental_test_4.
5050         * testsuite/Makefile.in: Regenerate.
5051         * testsuite/two_file_test_1_v1.cc: New test source file.
5052         * testsuite/two_file_test_1b_v1.cc: New test source file.
5053         * testsuite/two_file_test_2_v1.cc: New test source file.
5054
5055 2011-05-24 Cary Coutant  <ccoutant@google.com>
5056
5057         * dynobj.h (Dynobj::do_dynobj): New function.
5058         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
5059         flag and soname for shared objects.
5060         * incremental.cc (Incremental_inputs::report_object): Make
5061         either Incremental_object_entry or Incremental_dynobj_entry; add
5062         soname to string table.
5063         (Incremental_inputs::report_input_section): Add assertion.
5064         (Output_section_incremental_inputs::set_final_data_size): Adjust
5065         type of input file entry for shared libraries; adjust size of
5066         shared library info entry.
5067         (Output_section_incremental_inputs::write_input_files): Write
5068         as_needed flag for shared libraries.
5069         (Output_section_incremental_inputs::write_info_blocks): Adjust type
5070         of input file entry for shared libraries; write soname.
5071         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
5072         soname from incremental info.
5073         * incremental.h (enum Incremental_input_flags): Add
5074         INCREMENTAL_INPUT_AS_NEEDED.
5075         (Incremental_input_entry::Incremental_input_entry): Initialize new
5076         data member.
5077         (Incremental_input_entry::set_as_needed): New function.
5078         (Incremental_input_entry::as_needed): New function.
5079         (Incremental_input_entry::do_dynobj_entry): New function.
5080         (Incremental_input_entry::as_needed_): New data member.
5081         (Incremental_object_entry::Incremental_object_entry): Don't check
5082         for shared library.
5083         (Incremental_object_entry::do_type): Likewise.
5084         (class Incremental_dynobj_entry): New class.
5085         (Incremental_input_entry_reader::as_needed): New function.
5086         (Incremental_input_entry_reader::get_soname): New function.
5087         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
5088         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
5089         size of shared library info entry.
5090         * layout.cc (Layout::finish_dynamic_section): Don't test for
5091         incremental link when adding DT_NEEDED entries.
5092         * object.h (Object::Object): Initialize new data member.
5093         (Object::dynobj): New function.
5094         (Object::set_as_needed): New function.
5095         (Object::as_needed): New function.
5096         (Object::do_dynobj): New function.
5097         (Object::as_needed_): New data member.
5098
5099 2011-05-24 Cary Coutant  <ccoutant@google.com>
5100
5101         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
5102         info; adjust display of GOT entries.
5103         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
5104         vector of input objects; remove file_status_.
5105         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
5106         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
5107         got_plt reader; call target hooks to reserve GOT entries.
5108         (Output_section_incremental_inputs::set_final_data_size): Adjust size
5109         of input file info header and GOT info entry.
5110         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
5111         relocation info.
5112         (Got_plt_view_info::got_descriptor): Remove.
5113         (Got_plt_view_info::sym_index): New data member.
5114         (Got_plt_view_info::input_index): New data member.
5115         (Local_got_offset_visitor::visit): Write input file index.
5116         (Global_got_offset_visitor::visit): Write 0 for input file index.
5117         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
5118         with sym_index and input_index.
5119         (Output_section_incremental_inputs::write_got_plt): Adjust size of
5120         incremental info GOT entry; replace got_descriptor with input_index.
5121         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
5122         map from input file index to object.
5123         (Sized_relobj_incr::do_layout): Replace direct data member reference
5124         with accessor function.
5125         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
5126         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
5127         Adjust size of input file info header.
5128         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
5129         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
5130         (Incremental_input_entry_reader::get_input_section): Adjust size of
5131         input file info header.
5132         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
5133         of incremental info GOT entry.
5134         (Incremental_got_plt_reader::get_got_desc): Remove.
5135         (Incremental_got_plt_reader::get_got_symndx): New function.
5136         (Incremental_got_plt_reader::get_got_input_index): New function.
5137         (Sized_incremental_binary::Sized_incremental_binary): Remove
5138         file_status_; add input_objects_.
5139         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
5140         (Sized_incremental_binary::set_file_is_unchanged): Remove.
5141         (Sized_incremental_binary::file_is_unchanged): Remove.
5142         (Sized_incremental_binary::set_input_object): New function.
5143         (Sized_incremental_binary::input_object): New function.
5144         (Sized_incremental_binary::file_status_): Remove.
5145         (Sized_incremental_binary::input_objects_): New data member.
5146         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
5147         references.
5148         (Sized_relobj_incr::invalid_address): Move to base class.
5149         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
5150         class.
5151         (Sized_relobj_incr::do_output_section_offset): Likewise.
5152         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
5153         (Sized_relobj_incr::section_offsets_): Likewise.
5154         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
5155         function.
5156         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
5157         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
5158         with accessor function.
5159         (Sized_relobj_file::do_layout): Likewise.
5160         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
5161         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
5162         (Sized_relobj_file::compute_final_local_value): Replace refs to
5163         section_offsets_ with accessor function.
5164         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
5165         * object.h (Relobj::Relobj): Initialize new data members.
5166         (Relobj::add_dyn_reloc): New function.
5167         (Relobj::first_dyn_reloc): New function.
5168         (Relobj::dyn_reloc_count): New function.
5169         (Relobj::first_dyn_reloc_): New data member.
5170         (Relobj::dyn_reloc_count_): New data member.
5171         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
5172         references.
5173         (Sized_relobj::Address): New typedef.
5174         (Sized_relobj::invalid_address): Move here from child class.
5175         (Sized_relobj::Sized_relobj): Initialize new data members.
5176         (Sized_relobj::sized_relobj): New function.
5177         (Sized_relobj::is_output_section_offset_invalid): Move here from
5178         child class.
5179         (Sized_relobj::get_output_section_offset): Likewise.
5180         (Sized_relobj::local_has_got_offset): Likewise.
5181         (Sized_relobj::local_got_offset): Likewise.
5182         (Sized_relobj::set_local_got_offset): Likewise.
5183         (Sized_relobj::do_for_all_local_got_entries): Likewise.
5184         (Sized_relobj::clear_got_offsets): New function.
5185         (Sized_relobj::section_offsets): Move here from child class.
5186         (Sized_relobj::do_output_section_offset): Likewise.
5187         (Sized_relobj::do_set_section_offset): Likewise.
5188         (Sized_relobj::Local_got_offsets): Likewise.
5189         (Sized_relobj::local_got_offsets_): Likewise.
5190         (Sized_relobj::section_offsets_): Likewise.
5191         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
5192         references.
5193         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
5194         class.
5195         (Sized_relobj_file::sized_relobj): New function
5196         (Sized_relobj_file::local_has_got_offset): Move to base class.
5197         (Sized_relobj_file::local_got_offset): Likewise.
5198         (Sized_relobj_file::set_local_got_offset): Likewise.
5199         (Sized_relobj_file::get_output_section_offset): Likewise.
5200         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
5201         (Sized_relobj_file::do_output_section_offset): Likewise.
5202         (Sized_relobj_file::do_set_section_offset): Likewise.
5203         (Sized_relobj_file::Local_got_offsets): Likewise.
5204         (Sized_relobj_file::local_got_offsets_): Likewise.
5205         (Sized_relobj_file::section_offsets_): Likewise.
5206         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
5207         (all constructors).
5208         (set_needs_dynsym_index): Convert relobj to derived class pointer.
5209         (Output_reloc::get_symbol_index): Likewise.
5210         (Output_reloc::local_section_offset): Likewise.
5211         (Output_reloc::get_address): Likewise.
5212         (Output_reloc::symbol_value): Likewise.
5213         (Output_data_got::reserve_slot): Move to class definition.
5214         (Output_data_got::reserve_local): New function.
5215         (Output_data_got::reserve_slot_for_global): Remove.
5216         (Output_data_got::reserve_global): New function.
5217         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
5218         (all constructors, two instantiations).
5219         (Output_reloc::get_relobj): New function (two instantiations).
5220         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
5221         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
5222         (Output_data_reloc::add_global): Adjust type of relobj.
5223         (Output_data_reloc::add_global_relative): Likewise.
5224         (Output_data_reloc::add_symbolless_global_addend): Likewise.
5225         (Output_data_reloc::add_local): Likewise.
5226         (Output_data_reloc::add_local_relative): Likewise.
5227         (Output_data_reloc::add_symbolless_local_addend): Likewise.
5228         (Output_data_reloc::add_local_section): Likewise.
5229         (Output_data_reloc::add_output_section): Likewise.
5230         (Output_data_reloc::add_absolute): Likewise.
5231         (Output_data_reloc::add_target_specific): Likewise.
5232         (Output_data_got::reserve_slot): Move definition here.
5233         (Output_data_got::reserve_local): New function.
5234         (Output_data_got::reserve_global): New function.
5235         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
5236         section_offsets_ with accessor function.
5237         (Sized_relobj_file::write_sections): Likewise.
5238         (Sized_relobj_file::do_relocate_sections): Likewise.
5239         * target.h (Sized_target::reserve_local_got_entry): New function.
5240         (Sized_target::reserve_global_got_entry): New function.
5241         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
5242         (Target_x86_64::reserve_global_got_entry): New function.
5243         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
5244
5245 2011-05-23 Cary Coutant  <ccoutant@google.com>
5246
5247         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
5248         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
5249         bit when checking got_type.
5250         * incremental.cc (Sized_incremental_binary::setup_readers):
5251         Store symbol table and string table locations; initialize bit vector
5252         of file status flags.
5253         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
5254         unchanged files.
5255         (Sized_incremental_binary::do_process_got_plt): New function.
5256         (Sized_incremental_binary::get_symtab_view): Use stored locations.
5257         (Output_section_incremental_inputs::set_final_data_size): Record
5258         file index for each input file.
5259         (Output_section_incremental_inputs::write_got_plt): Store file index
5260         instead of input entry offset for each GOT entry.
5261         * incremental.h
5262         (Incremental_input_entry::Incremental_input_entry): Initialize new
5263         data member.
5264         (Incremental_input_entry::set_offset): Store file index.
5265         (Incremental_input_entry::get_file_index): New function.
5266         (Incremental_input_entry::file_index_): New data member.
5267         (Incremental_binary::process_got_plt): New function.
5268         (Incremental_binary::do_process_got_plt): New function.
5269         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
5270         data members.
5271         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
5272         (Sized_incremental_binary::set_file_is_unchanged): New function.
5273         (Sized_incremental_binary::file_is_unchanged): New function.
5274         (Sized_incremental_binary::do_process_got_plt): New function.
5275         (Sized_incremental_binary::file_status_): New data member.
5276         (Sized_incremental_binary::main_symtab_loc_): New data member.
5277         (Sized_incremental_binary::main_strtab_loc_): New data member.
5278         * output.cc (Output_data_got::Got_entry::write): Add case
5279         RESERVED_CODE.
5280         (Output_data_got::add_global): Call add_got_entry.
5281         (Output_data_got::add_global_plt): Likewise.
5282         (Output_data_got::add_global_with_rel): Likewise.
5283         (Output_data_got::add_global_with_rela): Likewise.
5284         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
5285         (Output_data_got::add_global_pair_with_rela): Likewise.
5286         (Output_data_got::add_local): Call add_got_entry.
5287         (Output_data_got::add_local_plt): Likewise.
5288         (Output_data_got::add_local_with_rel): Likewise.
5289         (Output_data_got::add_local_with_rela): Likewise.
5290         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
5291         (Output_data_got::add_local_pair_with_rela): Likewise.
5292         (Output_data_got::reserve_slot): New function.
5293         (Output_data_got::reserve_slot_for_global): New function.
5294         (Output_data_got::add_got_entry): New function.
5295         (Output_data_got::add_got_entry_pair): New function.
5296         (Output_section::add_output_section_data): Edit FIXME.
5297         * output.h
5298         (Output_section_data_build::Output_section_data_build): New
5299         constructor with size parameter.
5300         (Output_data_space::Output_data_space): Likewise.
5301         (Output_data_got::Output_data_got): Initialize new data member; new
5302         constructor with size parameter.
5303         (Output_data_got::add_constant): Call add_got_entry.
5304         (Output_data_got::reserve_slot): New function.
5305         (Output_data_got::reserve_slot_for_global): New function.
5306         (class Output_data_got::Got_entry): Add RESERVED_CODE.
5307         (Output_data_got::add_got_entry): New function.
5308         (Output_data_got::add_got_entry_pair): New function.
5309         (Output_data_got::free_list_): New data member.
5310         * target.h (Sized_target::init_got_plt_for_update): New function.
5311         (Sized_target::register_global_plt_entry): New function.
5312         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
5313         Initialize new data member; call init; add constructor with PLT count.
5314         (Output_data_plt_x86_64::init): New function.
5315         (Output_data_plt_x86_64::add_relocation): New function.
5316         (Output_data_plt_x86_64::reserve_slot): New function.
5317         (Output_data_plt_x86_64::free_list_): New data member.
5318         (Target_x86_64::init_got_plt_for_update): New function.
5319         (Target_x86_64::register_global_plt_entry): New function.
5320         (Output_data_plt_x86_64::add_entry): Allocate from free list for
5321         incremental updates.
5322         (Output_data_plt_x86_64::add_relocation): New function.
5323         * testsuite/object_unittest.cc (Object_test): Set default options.
5324
5325 2011-05-16  Ian Lance Taylor  <iant@google.com>
5326
5327         * options.h (class General_options): Make -i a synonym for -r.
5328
5329 2011-05-16  Ian Lance Taylor  <iant@google.com>
5330
5331         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
5332
5333 2011-05-10 Cary Coutant  <ccoutant@google.com>
5334
5335         * object.cc (Sized_relobj::do_count_local_symbols): Check for
5336         strip_all (-s).
5337
5338 2011-05-06  Ian Lance Taylor  <iant@google.com>
5339
5340         * layout.cc (Layout::layout): If the output section flags change,
5341         update the ordering.
5342
5343 2011-04-25 Cary Coutant  <ccoutant@google.com>
5344
5345         * incremental-dump.cc (dump_incremental_inputs): Print local
5346         symbol info for each input file.
5347         * incremental.cc
5348         (Output_section_incremental_inputs::set_final_data_size): Add local
5349         symbol info to input file entries in incremental info.
5350         (Output_section_incremental_inputs::write_info_blocks): Likewise.
5351         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
5352         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
5353         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
5354         implementation.
5355         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
5356         (Sized_incr_relobj::do_relocate): Write the local symbols.
5357         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
5358         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
5359         Adjust size of input file header.
5360         (Incremental_inputs_reader::get_local_symbol_offset): New function.
5361         (Incremental_inputs_reader::get_local_symbol_count): New function.
5362         (Incremental_inputs_reader::get_input_section): Adjust size of input
5363         file header.
5364         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
5365         (Sized_incr_relobj::This): New typedef.
5366         (Sized_incr_relobj::sym_size): New const data member.
5367         (Sized_incr_relobj::Local_symbol): New struct.
5368         (Sized_incr_relobj::do_output_local_symbol_count): New function.
5369         (Sized_incr_relobj::do_local_symbol_offset): New function.
5370         (Sized_incr_relobj::local_symbol_count_): New data member.
5371         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
5372         (Sized_incr_relobj::local_symbol_index_): New data member.
5373         (Sized_incr_relobj::local_symbol_offset_): New data member.
5374         (Sized_incr_relobj::local_dynsym_offset_): New data member.
5375         (Sized_incr_relobj::local_symbols_): New data member.
5376         * object.h (Relobj::output_local_symbol_count): New function.
5377         (Relobj::local_symbol_offset): New function.
5378         (Relobj::do_output_local_symbol_count): New function.
5379         (Relobj::do_local_symbol_offset): New function.
5380         (Sized_relobj::do_output_local_symbol_count): New function.
5381         (Sized_relobj::do_local_symbol_offset): New function.
5382
5383 2011-04-22  Vladimir Simonov  <sv@sw.ru>
5384
5385         * descriptors.cc (set_close_on_exec): New function.
5386         (Descriptors::open): Use set_close_on_exec.
5387         * output.cc (S_ISLNK): Define if not defined.
5388
5389 2011-04-22 Cary Coutant  <ccoutant@google.com>
5390
5391         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
5392         global symbol map.
5393         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
5394         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
5395         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
5396         relocations.
5397         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
5398         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
5399         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
5400         * incremental.h
5401         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
5402         function.
5403         (Incremental_binary::apply_incremental_relocs): New function.
5404         (Incremental_binary::do_apply_incremental_relocs): New function.
5405         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
5406         data member.
5407         (Sized_incremental_binary::add_global_symbol): New function.
5408         (Sized_incremental_binary::global_symbol): New function.
5409         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
5410         (Sized_incremental_binary::symbol_map_): New data member.
5411         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
5412         * target.h (Sized_target::apply_relocation): New function.
5413         * target-reloc.h (apply_relocation): New function.
5414         * x86_64.cc (Target_x86_64::apply_relocation): New function.
5415
5416 2011-04-22  Doug Kwan  <dougkwan@google.com>
5417
5418         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
5419         flag of a SHT_ARM_EXIDX section.
5420         * testsuite/Makefile.am (arm_exidx_test): New test rules.
5421         * testsuite/Makefile.in: Regenerate.
5422         * testsuite/arm_exidx_test.s: New file.
5423         * testsuite/arm_exidx_test.sh: Same.
5424
5425 2011-04-20 Cary Coutant  <ccoutant@google.com>
5426
5427         PR gold/12689
5428         * archive.h (Incremental_archive_entry::Archive_member):
5429         Initialize arg_serial_ (second constructor).
5430
5431 2011-04-17  Ian Lance Taylor  <iant@google.com>
5432
5433         * object.cc (Relocate_info::location): Simplify location string.
5434         * errors.cc (Errors::error_at_location): Don't print program
5435         name.
5436         (Errors::warning_at_location): Likewise.
5437         (Errors::undefined_symbol): Likewise.
5438         * testsuite/debug_msg.sh: Update accordingly.
5439
5440 2011-04-14 Cary Coutant  <ccoutant@google.com>
5441
5442         * gold/layout.cc (Layout::symtab_section_offset): New function.
5443         * gold/layout.h (Layout::symtab_section_offset): New function.
5444         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
5445
5446 2011-04-12  Ian Lance Taylor  <iant@google.com>
5447
5448         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
5449         with MREMAP_MAYMOVE.
5450         * output.h (class Output_file): Add map_is_allocated_ field.
5451         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
5452         not available, provide stubs.  If mremap is not available, #define
5453         it to gold_mremap.
5454         (MREMAP_MAYMOVE): Define if not defined.
5455         (Output_file::Output_file): Initialize map_is_allocated_.
5456         (Output_file::resize): Check map_is_allocated_.
5457         (Output_file::map_anonymous): If mmap fails, use malloc.
5458         (Output_file::unmap): Don't do anything for an anonymous map.
5459         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
5460         is not available, provide stubs.
5461         (File_read::View::~View): Use free rather than delete[].
5462         (File_read::make_view): Use malloc rather than new[].  If mmap
5463         fails, use malloc.
5464         (File_read::find_or_make_view): Use malloc rather than new[].
5465         * gold.h: Remove HAVE_REMAP code.
5466         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
5467         exists.  Rename mremap to gold_mremap.  If mmap is not available
5468         don't do anything.
5469         * configure, config.in: Rebuild.
5470
5471 2011-04-11  Ian Lance Taylor  <iant@google.com>
5472
5473         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
5474         initialize local variable v.
5475
5476 2011-04-11  Cary Coutant  <ccoutant@google.com>
5477
5478         * archive.cc (Archive::include_member): Adjust call to
5479         report_object.
5480         (Add_archive_symbols::run): Track argument serial numbers.
5481         (Lib_group::include_member): Likewise.
5482         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
5483         * archive.h (Incremental_archive_entry::Archive_member):
5484         Initialize arg_serial_.
5485         (Archive_member::arg_serial_): New data member.
5486         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
5487         (Sized_dynobj::do_add_symbols): Track symbols when doing an
5488         incremental link.
5489         (Sized_dynobj::do_for_all_local_got_entries): New function.
5490         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
5491         function.
5492         * fileread.cc (get_mtime): New function.
5493         * fileread.h (get_mtime): New function.
5494         * gold.cc (queue_initial_tasks): Check for incremental update.
5495         (process_incremental_input): New function.
5496         (queue_middle_tasks): Don't force valid target for incremental
5497         update.
5498         * incremental-dump.cc (find_input_containing_global): Adjust
5499         size of symbol info entry.
5500         (dump_incremental_inputs): Dump argument serial number and
5501         in_system_directory flag; bias shndx by 1; print symbol names
5502         when dumping per-file symbol lists; use new symbol info readers.
5503         * incremental.cc
5504         (Output_section_incremental_inputs:update_data_size): New function.
5505         (Sized_incremental_binary::setup_readers): Setup input readers
5506         for each input file; build maps for files added from libraries
5507         and scripts.
5508         (Sized_incremental_binary::check_input_args): New function.
5509         (Sized_incremental_binary::do_check_inputs): Build map of argument
5510         serial numbers to input arguments.
5511         (Sized_incremental_binary::do_file_has_changed): Rename
5512         do_file_is_unchanged to this; compare file modification times.
5513         (Sized_incremental_binary::do_init_layout): New function.
5514         (Sized_incremental_binary::do_reserve_layout): New function.
5515         (Sized_incremental_binary::do_get_input_reader): Remove.
5516         (Sized_incremental_binary::get_symtab_view): New function.
5517         (Incremental_checker::can_incrementally_link_output_file): Remove.
5518         (Incremental_inputs::report_command_line): Exclude --debug options.
5519         (Incremental_inputs::report_archive_begin): Add parameter; track
5520         argument serial numbers; don't put input file entry for archive
5521         before archive members.
5522         (Incremental_inputs::report_archive_end): Put input file entry
5523         for archive after archive members.
5524         (Incremental_inputs::report_object): Add parameter; track argument
5525         serial numbers and in_system_directory flag.
5526         (Incremental_inputs::report_script): Add parameter; track argument
5527         serial numbers.
5528         (Output_section_incremental_inputs::set_final_data_size): Adjust
5529         size of symbol info entry; check for forwarding symbols.
5530         (Output_section_incremental_inputs::write_input_files): Write
5531         in_system_directory flag and argument serial number.
5532         (Output_section_incremental_inputs::write_info_blocks): Map section
5533         indices between incremental info and original input file; store
5534         input section index for each symbol.
5535         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
5536         change operator() to visit().
5537         (class Global_got_offset_visitor): Likewise.
5538         (class Global_symbol_visitor_got_plt):
5539         (Output_section_incremental_inputs::write_got_plt): Use new visitor
5540         classes.
5541         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
5542         (Sized_incr_relobj::do_read_symbols): New function.
5543         (Sized_incr_relobj::do_layout): New function.
5544         (Sized_incr_relobj::do_layout_deferred_sections): New function.
5545         (Sized_incr_relobj::do_add_symbols): New function.
5546         (Sized_incr_relobj::do_should_include_member): New function.
5547         (Sized_incr_relobj::do_for_all_global_symbols): New function.
5548         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
5549         (Sized_incr_relobj::do_section_size): New function.
5550         (Sized_incr_relobj::do_section_name): New function.
5551         (Sized_incr_relobj::do_section_contents): New function.
5552         (Sized_incr_relobj::do_section_flags): New function.
5553         (Sized_incr_relobj::do_section_entsize): New function.
5554         (Sized_incr_relobj::do_section_address): New function.
5555         (Sized_incr_relobj::do_section_type): New function.
5556         (Sized_incr_relobj::do_section_link): New function.
5557         (Sized_incr_relobj::do_section_info): New function.
5558         (Sized_incr_relobj::do_section_addralign): New function.
5559         (Sized_incr_relobj::do_initialize_xindex): New function.
5560         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
5561         (Sized_incr_relobj::do_read_relocs): New function.
5562         (Sized_incr_relobj::do_gc_process_relocs): New function.
5563         (Sized_incr_relobj::do_scan_relocs): New function.
5564         (Sized_incr_relobj::do_count_local_symbols): New function.
5565         (Sized_incr_relobj::do_finalize_local_symbols): New function.
5566         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
5567         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
5568         (Sized_incr_relobj::do_relocate): New function.
5569         (Sized_incr_relobj::do_set_section_offset): New function.
5570         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
5571         (Sized_incr_dynobj::do_read_symbols): New function.
5572         (Sized_incr_dynobj::do_layout): New function.
5573         (Sized_incr_dynobj::do_add_symbols): New function.
5574         (Sized_incr_dynobj::do_should_include_member): New function.
5575         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
5576         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
5577         (Sized_incr_dynobj::do_section_size): New function.
5578         (Sized_incr_dynobj::do_section_name): New function.
5579         (Sized_incr_dynobj::do_section_contents): New function.
5580         (Sized_incr_dynobj::do_section_flags): New function.
5581         (Sized_incr_dynobj::do_section_entsize): New function.
5582         (Sized_incr_dynobj::do_section_address): New function.
5583         (Sized_incr_dynobj::do_section_type): New function.
5584         (Sized_incr_dynobj::do_section_link): New function.
5585         (Sized_incr_dynobj::do_section_info): New function.
5586         (Sized_incr_dynobj::do_section_addralign): New function.
5587         (Sized_incr_dynobj::do_initialize_xindex): New function.
5588         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
5589         (make_sized_incremental_object): New function.
5590         (Incremental_library::copy_unused_symbols): New function.
5591         (Incremental_library::do_for_all_unused_symbols): New function.
5592         * incremental.h (enum Incremental_input_flags): New type.
5593         (class Incremental_checker): Remove.
5594         (Incremental_input_entry::Incremental_input_entry): Add argument
5595         serial number.
5596         (Incremental_input_entry::arg_serial): New function.
5597         (Incremental_input_entry::set_is_in_system_directory): New function.
5598         (Incremental_input_entry::is_in_system_directory): New function.
5599         (Incremental_input_entry::arg_serial_): New data member.
5600         (Incremental_input_entry::is_in_system_directory_): New data member.
5601         (class Script_info): Move here from script.h.
5602         (Script_info::Script_info): Add filename parameter.
5603         (Script_info::filename): New function.
5604         (Script_info::filename_): New data member.
5605         (Incremental_script_entry::Incremental_script_entry): Add argument
5606         serial number.
5607         (Incremental_object_entry::Incremental_object_entry): Likewise.
5608         (Incremental_object_entry::add_input_section): Build list of input
5609         sections with map to original shndx.
5610         (Incremental_object_entry::get_input_section_index): New function.
5611         (Incremental_object_entry::shndx_): New data member.
5612         (Incremental_object_entry::name_key_): Rename; adjust all refs.
5613         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
5614         (Incremental_archive_entry::Incremental_archive_entry): Add argument
5615         serial number.
5616         (Incremental_inputs::report_archive_begin): Likewise.
5617         (Incremental_inputs::report_object): Likewise.
5618         (Incremental_inputs::report_script): Likewise.
5619         (class Incremental_global_symbol_reader): New class.
5620         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
5621         and store flags and input file type.
5622         (Incremental_input_entry_reader::arg_serial): New function.
5623         (Incremental_input_entry_reader::type): Extract type from flags.
5624         (Incremental_input_entry_reader::is_in_system_directory): New function.
5625         (Incremental_input_entry_reader::get_input_section_count): Call
5626         accessor function for type.
5627         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
5628         function for type; adjust size of global symbol entry.
5629         (Incremental_input_entry_reader::get_global_symbol_count): Call
5630         accessor function for type.
5631         (Incremental_input_entry_reader::get_object_count): Likewise.
5632         (Incremental_input_entry_reader::get_object_offset): Likewise.
5633         (Incremental_input_entry_reader::get_member_count): Likewise.
5634         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
5635         (Incremental_input_entry_reader::get_member_offset): Likewise.
5636         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
5637         (Incremental_input_entry_reader::Global_symbol_info): Remove.
5638         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
5639         (Incremental_input_entry_reader::get_global_symbol_reader): New
5640         function.
5641         (Incremental_input_entry_reader::get_output_symbol_index): New
5642         function.
5643         (Incremental_input_entry_reader::type_): Remove.
5644         (Incremental_input_entry_reader::flags_): New data member.
5645         (Incremental_inputs_reader::input_file_offset): New function.
5646         (Incremental_inputs_reader::input_file_index): New function.
5647         (Incremental_inputs_reader::input_file): Call input_file_offset.
5648         (Incremental_inputs_reader::input_file_at_offset): New function.
5649         (Incremental_relocs_reader::get_r_type): Reformat.
5650         (Incremental_relocs_reader::get_r_shndx): Reformat.
5651         (Incremental_relocs_reader::get_r_offset): Reformat.
5652         (Incremental_relocs_reader::data): New function.
5653         (Incremental_binary::Incremental_binary): Initialize new data members.
5654         (Incremental_binary::check_inputs): Add cmdline parameter.
5655         (Incremental_binary::file_is_unchanged): Remove.
5656         (Input_reader::arg_serial): New function.
5657         (Input_reader::get_unused_symbol_count): New function.
5658         (Input_reader::get_unused_symbol): New function.
5659         (Input_reader::do_arg_serial): New function.
5660         (Input_reader::do_get_unused_symbol_count): New function.
5661         (Input_reader::do_get_unused_symbol): New function.
5662         (Incremental_binary::input_file_count): New function.
5663         (Incremental_binary::get_input_reader): Change signature to use
5664         index instead of filename.
5665         (Incremental_binary::file_has_changed): New function.
5666         (Incremental_binary::get_input_argument): New function.
5667         (Incremental_binary::get_library): New function.
5668         (Incremental_binary::get_script_info): New function.
5669         (Incremental_binary::init_layout): New function.
5670         (Incremental_binary::reserve_layout): New function.
5671         (Incremental_binary::output_file): New function.
5672         (Incremental_binary::do_check_inputs): New function.
5673         (Incremental_binary::do_file_is_unchanged): Remove.
5674         (Incremental_binary::do_file_has_changed): New function.
5675         (Incremental_binary::do_init_layout): New function.
5676         (Incremental_binary::do_reserve_layout): New function.
5677         (Incremental_binary::do_input_file_count): New function.
5678         (Incremental_binary::do_get_input_reader): Change signature.
5679         (Incremental_binary::input_args_map_): New data member.
5680         (Incremental_binary::library_map_): New data member.
5681         (Incremental_binary::script_map_): New data member.
5682         (Sized_incremental_binary::Sized_incremental_binary): Initialize
5683         new data members.
5684         (Sized_incremental_binary::output_section): New function.
5685         (Sized_incremental_binary::inputs_reader): Add const.
5686         (Sized_incremental_binary::symtab_reader): Add const.
5687         (Sized_incremental_binary::relocs_reader): Add const.
5688         (Sized_incremental_binary::got_plt_reader): Add const.
5689         (Sized_incremental_binary::get_symtab_view): New function.
5690         (Sized_incremental_binary::Inputs_reader): New typedef.
5691         (Sized_incremental_binary::Input_entry_reader): New typedef.
5692         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
5693         (Sized_incremental_binary::do_file_is_unchanged): Remove.
5694         (Sized_incremental_binary::do_file_has_changed): New function.
5695         (Sized_incremental_binary::do_init_layout): New function.
5696         (Sized_incremental_binary::do_reserve_layout): New function.
5697         (Sized_input_reader::Inputs_reader): Remove.
5698         (Sized_input_reader::Input_entry_reader): Remove.
5699         (Sized_input_reader::do_arg_serial): New function.
5700         (Sized_input_reader::do_get_unused_symbol_count): New function.
5701         (Sized_input_reader::do_get_unused_symbol): New function.
5702         (Sized_incremental_binary::do_input_file_count): New function.
5703         (Sized_incremental_binary::do_get_input_reader): Change signature;
5704         use index instead of filename.
5705         (Sized_incremental_binary::section_map_): New data member.
5706         (Sized_incremental_binary::input_entry_readers_): New data member.
5707         (class Sized_incr_relobj): New class.
5708         (class Sized_incr_dynobj): New class.
5709         (make_sized_incremental_object): New function.
5710         (class Incremental_library): New class.
5711         * layout.cc (Free_list::num_lists): New static data member.
5712         (Free_list::num_nodes): New static data member.
5713         (Free_list::num_removes): New static data member.
5714         (Free_list::num_remove_visits): New static data member.
5715         (Free_list::num_allocates): New static data member.
5716         (Free_list::num_allocate_visits): New static data member.
5717         (Free_list::init): New function.
5718         (Free_list::remove): New function.
5719         (Free_list::allocate): New function.
5720         (Free_list::dump): New function.
5721         (Free_list::print_stats): New function.
5722         (Layout_task_runner::run): Resize output file for incremental updates.
5723         (Layout::Layout): Initialize new data members.
5724         (Layout::set_incremental_base): New function.
5725         (Layout::init_fixed_output_section): New function.
5726         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
5727         incremental updates.
5728         (Layout::create_gold_note): Do not create gold note section for
5729         incremental updates.
5730         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
5731         for incremental updates.
5732         (Layout::set_section_offsets): For incremental updates, allocate space
5733         from free list.
5734         (Layout::create_symtab_sections): Layout with offsets relative to
5735         start of section; for incremental updates, allocate space from free
5736         list.
5737         (Layout::create_shdrs): For incremental updates, allocate space from
5738         free list.
5739         (Layout::finish_dynamic_section): For incremental updates, do not
5740         check --as-needed (fixed in subsequent patch).
5741         * layout.h (class Free_list): New class.
5742         (Layout::set_incremental_base): New function.
5743         (Layout::incremental_base): New function.
5744         (Layout::init_fixed_output_section): New function.
5745         (Layout::allocate): New function.
5746         (Layout::incremental_base_): New data member.
5747         (Layout::free_list_): New data member.
5748         * main.cc (main): Print Free_list statistics.
5749         * object.cc (Relobj::finalize_incremental_relocs): Add
5750         clear_counts parameter; clear counts only when clear_counts is set.
5751         (Sized_relobj::Sized_relobj): Initialize new base class.
5752         (Sized_relobj::do_layout): Don't report special sections.
5753         (Sized_relobj::do_for_all_local_got_entries): New function.
5754         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
5755         symtab_off to all symbol table offsets.
5756         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
5757         * object.h (class Got_offset_list): Move to top of file.
5758         (Object::Object): Allow case where input_file == NULL.
5759         (Object::~Object): Likewise.
5760         (Object::input_file): Assert that input_file != NULL.
5761         (Object::lock): Allow case where input_file == NULL.
5762         (Object::unlock): Likewise.
5763         (Object::is_locked): Likewise.
5764         (Object::token): Likewise.
5765         (Object::release): Likewise.
5766         (Object::is_incremental): New function.
5767         (Object::get_mtime): New function.
5768         (Object::for_all_local_got_entries): New function.
5769         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
5770         (Object::set_is_in_system_directory): New function.
5771         (Object::is_in_system_directory): New function.
5772         (Object::do_is_incremental): New function.
5773         (Object::do_get_mtime): New function.
5774         (Object::do_for_all_local_got_entries): New function.
5775         (Object::is_in_system_directory_): New data member.
5776         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
5777         (class Sized_relobj_base): New class.
5778         (class Sized_relobj): Derive from Sized_relobj_base.
5779         (class Sized_relobj::Symbols): Redeclare from base class.
5780         (class Sized_relobj::local_got_offset_list): Remove.
5781         (class Sized_relobj::Output_sections): Redeclare from base class.
5782         (class Sized_relobj::do_for_all_local_got_entries): New function.
5783         (class Sized_relobj::write_local_symbols): Add offset parameter.
5784         (class Sized_relobj::local_symbol_offset_): Update comment.
5785         (class Sized_relobj::local_dynsym_offset_): Update comment.
5786         * options.cc (Input_arguments::add_file): Remove const.
5787         * options.h (Input_file_argument::Input_file_argument):
5788         Initialize arg_serial_ (all constructors).
5789         (Input_file_argument::set_arg_serial): New function.
5790         (Input_file_argument::arg_serial): New function.
5791         (Input_file_argument::arg_serial_): New data member.
5792         (Input_arguments::Input_arguments): Initialize file_count_.
5793         (Input_arguments::add_file): Remove const.
5794         (Input_arguments::number_of_input_files): New function.
5795         (Input_arguments::file_count_): New data member.
5796         (Command_line::number_of_input_files): Call
5797         Input_arguments::number_of_input_files.
5798         * output.cc (Output_segment_headers::Output_segment_headers):
5799         Set current size.
5800         (Output_section::Input_section::current_data_size): New function.
5801         (Output_section::Output_section): Initialize new data members.
5802         (Output_section::add_input_section): Don't do merge sections for
5803         an incremental link; allocate space from free list for an
5804         incremental update.
5805         (Output_section::add_output_section_data): Allocate space from
5806         free list for an incremental update.
5807         (Output_section::update_data_size): New function.
5808         (Output_section::set_fixed_layout): New function.
5809         (Output_section::reserve): New function.
5810         (Output_segment::set_section_addresses): Remove const.
5811         (Output_segment::set_section_list_addresses): Remove const; allocate
5812         space from free list for an incremental update.
5813         (Output_segment::set_offset): Adjust size of RELRO segment for an
5814         incremental update.
5815         * output.h (Output_data::current_data_size): Move here from
5816         child classes.
5817         (Output_data::pre_finalize_data_size): New function.
5818         (Output_data::update_data_size): New function.
5819         (Output_section_headers::update_data_size): new function.
5820         (Output_section_data_build::current_data_size): Move to Output_data.
5821         (Output_data_strtab::update_data_size): New function.
5822         (Output_section::current_data_size): Move to Output_data.
5823         (Output_section::set_fixed_layout): New function.
5824         (Output_section::has_fixed_layout): New function.
5825         (Output_section::reserve): New function.
5826         (Output_section::update_data_size): New function.
5827         (Output_section::has_fixed_layout_): New data member.
5828         (Output_section::free_list_): New data member.
5829         (Output_segment::set_section_addresses): Remove const.
5830         (Output_segment::set_section_list_addresses): Remove const.
5831         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
5832         New function.
5833         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
5834         New function.
5835         * readsyms.cc (Read_symbols::do_read_symbols): Add library
5836         parameter when calling Add_symbols constructor; store argument
5837         serial number for members of a lib group.
5838         (Add_symbols::locks): Allow case where token == NULL.
5839         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
5840         (Read_member::~Read_member): New function.
5841         (Read_member::is_runnable): New function.
5842         (Read_member::locks): New function.
5843         (Read_member::run): New function.
5844         (Check_script::~Check_script): New function.
5845         (Check_script::is_runnable): New function.
5846         (Check_script::locks): New function.
5847         (Check_script::run): New function.
5848         (Check_library::~Check_library): New function.
5849         (Check_library::is_runnable): New function.
5850         (Check_library::locks): New function.
5851         (Check_library::run): New function.
5852         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
5853         (Add_symbols::library_): New data member.
5854         (class Read_member): New class.
5855         (class Check_script): New class.
5856         (class Check_library): New class.
5857         * reloc.cc (Read_relocs::is_runnable): Allow case where
5858         token == NULL.
5859         (Read_relocs::locks): Likewise.
5860         (Scan_relocs::locks): Likewise.
5861         (Relocate_task::locks): Likewise.
5862         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
5863         to clear counters.
5864         (Sized_relobj::incremental_relocs_scan): Fix comment.
5865         (Sized_relobj::do_relocate): Pass output file offset to
5866         write_local_symbols.
5867         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
5868         from class declaration.
5869         * script.cc (read_input_script): Allocate Script_info; pass
5870         argument serial number to report_script.
5871         * script.h (class Script_info): Move to incremental.h.
5872         * symtab.cc (Symbol_table::add_from_incrobj): New function.
5873         * symtab.h (Symbol_table::add_from_incrobj): New function.
5874         (Symbol_table::set_file_offset): New function.
5875
5876 2011-04-05  Cary Coutant  <ccoutant@google.com>
5877
5878         * incremental-dump.cc (dump_incremental_inputs): Change signature
5879         to take a Sized_incremental_binary; change caller.  Use readers
5880         in Sized_incremental_binary.
5881         * incremental.cc
5882         (Sized_incremental_binary::find_incremental_inputs_sections):
5883         Rename do_find_incremental_inputs_sections to this.
5884         (Sized_incremental_binary::setup_readers): New function.
5885         (Sized_incremental_binary::do_check_inputs): Check
5886         has_incremental_info_ flag; move setup code to setup_readers;
5887         use input readers.
5888         (Sized_incremental_binary::do_file_is_unchanged): New function.
5889         (Sized_incremental_binary::do_get_input_reader): New function.
5890         * incremental.h (class Incremental_binary): Move to end of file.
5891         (Incremental_binary::file_is_unchanged): New function.
5892         (Incremental_binary::do_file_is_unchanged): New function.
5893         (Incremental_binary::Input_reader): New class.
5894         (Incremental_binary::get_input_reader): New function.
5895         (class Sized_incremental_binary): Move to end of file.
5896         (Sized_incremental_binary::Sized_incremental_binary): Setup the
5897         input section reader classes.
5898         (Sized_incremental_binary::has_incremental_info): New function.
5899         (Sized_incremental_binary::inputs_reader): New function.
5900         (Sized_incremental_binary::symtab_reader): New function.
5901         (Sized_incremental_binary::relocs_reader): New function.
5902         (Sized_incremental_binary::got_plt_reader): New function.
5903         (Sized_incremental_binary::do_file_is_unchanged): New function.
5904         (Sized_incremental_binary::Sized_input_reader): New class.
5905         (Sized_incremental_binary::get_input_reader): New function.
5906         (Sized_incremental_binary::find_incremental_inputs_sections):
5907         Rename do_find_incremental_inputs_sections to this.
5908         (Sized_incremental_binary::setup_readers): New function.
5909         (Sized_incremental_binary::has_incremental_info_): New data member.
5910         (Sized_incremental_binary::inputs_reader_): New data member.
5911         (Sized_incremental_binary::symtab_reader_): New data member.
5912         (Sized_incremental_binary::relocs_reader_): New data member.
5913         (Sized_incremental_binary::got_plt_reader_): New data member.
5914         (Sized_incremental_binary::current_input_file_): New data member.
5915
5916 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
5917
5918         PR gold/12640
5919         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
5920         violation.
5921
5922 2011-03-30  Cary Coutant  <ccoutant@google.com>
5923
5924         * archive.cc (Archive::include_member): Adjust call to report_object.
5925         (Add_archive_symbols::run): Add script_info to call to
5926         report_archive_begin.
5927         (Lib_group::include_member): Adjust call to report_object.
5928         (Add_lib_group_symbols::run): Adjust call to report_object.
5929         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
5930         blocks.  Add object count for script input files.
5931         * incremental.cc (Incremental_inputs::report_archive_begin): Add
5932         script_info parameter; change all callers.
5933         (Incremental_inputs::report_object): Add script_info parameter;
5934         change all callers.
5935         (Incremental_inputs::report_script): Store backpointer to
5936         incremental info entry.
5937         (Output_section_incremental_inputs::set_final_data_size): Record
5938         additional information for scripts.
5939         (Output_section_incremental_inputs::write_info_blocks): Likewise.
5940         * incremental.h (Incremental_script_entry::add_object): New function.
5941         (Incremental_script_entry::get_object_count): New function.
5942         (Incremental_script_entry::get_object): New function.
5943         (Incremental_script_entry::objects_): New data member; adjust
5944         constructor.
5945         (Incremental_inputs::report_archive_begin): Add script_info parameter.
5946         (Incremental_inputs::report_object): Add script_info parameter.
5947         (Incremental_inputs_reader::get_object_count): New function.
5948         (Incremental_inputs_reader::get_object_offset): New function.
5949         * options.cc (Input_arguments::add_file): Return reference to
5950         new input argument.
5951         * options.h (Input_argument::set_script_info): New function.
5952         (Input_argument::script_info): New function.
5953         (Input_argument::script_info_): New data member; adjust all
5954         constructors.
5955         (Input_file_group::add_file): Return reference to new input argument.
5956         (Input_file_lib::add_file): Likewise.
5957         (Input_arguments::add_file): Likewise.
5958         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
5959         * script.cc (Parser_closure::Parser_closure): Add script_info
5960         parameter; adjust all callers.
5961         (Parser_closure::script_info): New function.
5962         (Parser_closure::script_info_): New data member.
5963         (read_input_script): Report scripts earlier to incremental info.
5964         (script_add_file): Set script_info in Input_argument.
5965         (script_add_library): Likewise.
5966         * script.h (Script_options::Script_info): Rewrite class.
5967
5968 2011-03-29  Cary Coutant  <ccoutant@google.com>
5969
5970         * archive.cc (Library_base::should_include_member): Move
5971         method here from class Archive.
5972         (Archive::Archive): Initialize base class.
5973         (Archive::should_include_member): Move to base class.
5974         (Archive::do_for_all_unused_symbols): New function.
5975         (Add_archive_symbols::run): Remove redundant access to
5976         incremental_inputs.
5977         (Lib_group::Lib_group): Initialize base class.
5978         (Lib_group::do_filename): New function.
5979         (Lib_group::include_member): Pass pointer to Lib_group to
5980         report_object.
5981         (Lib_group::do_for_all_unused_symbols): New function.
5982         (Add_lib_group_symbols::run): Report archive information for
5983         incremental links.
5984         * archive.h (class Library_base): New base class.
5985         (class Archive): Derive from Library_base.
5986         (Archive::filename): Move to base class.
5987         (Archive::set_incremental_info): Likewise.
5988         (Archive::incremental_info): Likewise.
5989         (Archive::Should_include): Likewise.
5990         (Archive::should_include_member): Likewise.
5991         (Archive::Armap_entry): Remove.
5992         (Archive::Unused_symbol_iterator): Remove.
5993         (Archive::unused_symbols_begin): Remove.
5994         (Archive::unused_symbols_end): Remove.
5995         (Archive::do_filename): New function.
5996         (Archive::do_get_mtime): New function.
5997         (Archive::do_for_all_unused_symbols): New function.
5998         (Archive::task_): Move to base class.
5999         (Archive::incremental_info_): Likewise.
6000         (class Lib_group): Derive from Library_base.
6001         (Lib_group::do_filename): New function.
6002         (Lib_group::do_get_mtime): New function.
6003         (Lib_group::do_for_all_unused_symbols): New function.
6004         (Lib_group::task_): Move to base class.
6005         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
6006         function.
6007         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
6008         function.
6009         * incremental.cc (Incremental_inputs::report_archive_begin):
6010         Use Library_base; call library's get_mtime; add incremental inputs
6011         entry before members.
6012         (class Unused_symbol_visitor): New class.
6013         (Incremental_inputs::report_archive_end): Use Library_base; use
6014         visitor class to record unused symbols; don't add incremental inputs
6015         entry after members.
6016         (Incremental_inputs::report_object): Use Library_base.
6017         * incremental.h
6018         (Incremental_archive_entry::Incremental_archive_entry): Remove
6019         unused Archive parameter.
6020         (Incremental_inputs::report_archive_begin): Use Library_base.
6021         (Incremental_inputs::report_archive_end): Likewise.
6022         (Incremental_inputs::report_object): Likewise.
6023         * object.cc (Sized_relobj::do_for_all_global_symbols): New
6024         function.
6025         * object.h (Object::for_all_global_symbols): New function.
6026         (Object::do_for_all_global_symbols): New function.
6027         (Sized_relobj::do_for_all_global_symbols): New function.
6028         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
6029         function.
6030         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
6031         function.
6032
6033 2011-03-27  Ian Lance Taylor  <iant@google.com>
6034
6035         * archive.cc (Archive::interpret_header): Return -1 if something
6036         goes wrong.  Change callers accordingly.
6037
6038 2011-03-25  Cary Coutant  <ccoutant@google.com>
6039
6040         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
6041         * testsuite/Makefile.in: Regenerate.
6042
6043 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
6044
6045         * plugin.cc (get_view): New.
6046         (Plugin::load): Pass get_view to the plugin.
6047         (Plugin_manager::get_view): New.
6048
6049 2011-03-21  Ian Lance Taylor  <iant@google.com>
6050
6051         * testsuite/final_layout.sh: Rewrite to not use dc.
6052         * testsuite/relro_test.sh: Fail if dc is not present.
6053
6054 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
6055
6056         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
6057         Change == to -eq.
6058         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
6059         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
6060         Change == to -eq.
6061         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
6062         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
6063
6064 2011-03-14  Ian Lance Taylor  <iant@google.com>
6065
6066         * script-sections.cc (Sort_output_sections::script_compare):
6067         Rename from is_before, change return type.
6068         (Sort_output_sections::operator()): Adjust accordingly.
6069
6070 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
6071
6072         PR gold/12572
6073         * testsuite/odr_violation2.cc: Add comment to make all error line
6074         numbers double digits.
6075         * testsuite/debug_msg.sh: Adjust expected errors.
6076
6077 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
6078
6079         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
6080         but mark earlier ones as non-canonical
6081         (offset_to_iterator): Update search target and example
6082         (do_addr2line): Return extra lines in a vector*
6083         (format_file_lineno): Extract from do_addr2line
6084         (one_addr2line): Add vector* out-param
6085         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
6086         when a lineno entry appeared last for its instruction
6087         (Dwarf_line_info): Add vector* out-param
6088         * object.cc (Relocate_info): Pass NULL for the vector* out-param
6089         * symtab.cc (Odr_violation_compare): Include the lineno in the
6090         comparison again.
6091         (linenos_from_loc): New. Combine the canonical line for an
6092         address with its other lines.
6093         (True_if_intersect): New. Helper functor to make
6094         std::set_intersection a query.
6095         (detect_odr_violations): Compare sets of lines instead of just
6096         one line for each function. This became less deterministic, but
6097         has fewer false positives.
6098         * symtab.h: Declarations.
6099         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
6100         mix an optimized and non-optimized object in the same binary
6101         (odr_violation2.so): Same.
6102         * testsuite/Makefile.in: Regenerate from Makefile.am.
6103         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
6104         * testsuite/debug_msg.sh: Update line numbers and add
6105         assertions.
6106         * testsuite/odr_violation1.cc: Use OdrDerived, in a
6107         non-optimized context.
6108         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
6109         isn't inlined, and use OdrDerived in an optimized context.
6110         * testsuite/odr_header1.h: Defines OdrDerived, where
6111         optimization will change the
6112         first-instruction-in-the-destructor's file and line number.
6113         * testsuite/odr_header2.h: Defines OdrBase.
6114
6115 2011-03-09  Ian Lance Taylor  <iant@google.com>
6116
6117         * fileread.cc (File_read::clear_views): Don't delete the whole
6118         file view.
6119
6120 2011-03-08  Ian Lance Taylor  <iant@google.com>
6121
6122         PR gold/12525
6123         * fileread.cc: #include <climits>.
6124         (GOLD_IOV_MAX): Define.
6125         (File_read::read_multiple): Limit number of entries by iov_max.
6126         * fileread.h (class File_read): Always set max_readv_entries to
6127         128.
6128
6129 2011-03-07  Ian Lance Taylor  <iant@google.com>
6130
6131         PR gold/12525
6132         * options.h (class General_options): Add -dy and -dn.
6133
6134 2011-03-02  Cary Coutant  <ccoutant@google.com>
6135
6136         * testsuite/script_test_9.t: Add TLS segment.
6137
6138 2011-03-02  Simon Baldwin  <simonb@google.com>
6139
6140         * configure.ac: Add check for gnu_indirect_function support in
6141         the toolchain building binutils.
6142         * configure: Rebuild.
6143
6144 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
6145
6146         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
6147         plugin only symbols.
6148         (Symbol_table::sized_finalize_symbol) Mark symbol only present
6149         in plugin files as not needed in the symbol table.
6150
6151 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
6152
6153         * output.cc (Output_section::add_input_section): Delay fill
6154         generation for section ordering.
6155
6156 2011-02-09  Ian Lance Taylor  <iant@google.com>
6157
6158         PR gold/12316
6159         * object.h (class Sized_relobj): Remove clear_local_symbols.
6160         * reloc.cc (Sized_relobj::do_relocate): Don't call
6161         clear_local_symbols.
6162
6163 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
6164
6165         * plugin.cc (is_visible_from_outside): Return true for symbols
6166         in the -u option.
6167
6168 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
6169
6170         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
6171         filename.
6172
6173 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
6174
6175         * icf.h (is_section_foldable_candidate): Change type of parameter
6176         to std::string.
6177         * icf.cc (Icf::find_identical_sections): Change type of local variable
6178         section_name to be std::string.
6179         (is_function_ctor_or_dtor): Change type of parameter to std::string.
6180
6181 2011-01-25  Ian Lance Taylor  <iant@google.com>
6182
6183         * script.cc (script_add_extern): Rewrite to use
6184         add_symbol_reference.
6185
6186 2011-01-25  Doug Kwan  <dougkwan@google.com>
6187
6188         * icf.cc (get_section_contents): Always lock section's object.
6189
6190 2011-01-24  Ian Lance Taylor  <iant@google.com>
6191
6192         * options.h (class General_options): Accept
6193         --no-detect-odr-violations.
6194
6195 2011-01-24  Ian Lance Taylor  <iant@google.com>
6196
6197         * version.cc (version_string): Bump to 1.11.
6198
6199 2011-01-24  Ian Lance Taylor  <iant@google.com>
6200
6201         * plugin.cc (class Plugin_rescan): Define new class.
6202         (Plugin_manager::claim_file): Set any_claimed_.
6203         (Plugin_manager::save_archive): New function.
6204         (Plugin_manager::save_input_group): New function.
6205         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
6206         necessary.
6207         (Plugin_manager::new_undefined_symbol): New function.
6208         (Plugin_manager::rescan): New function.
6209         (Plugin_manager::rescannable_defines): New function.
6210         (Plugin_manager::add_input_file): Set any_added_.
6211         * plugin.h (class Plugin_manager): define new fields rescannable_,
6212         undefined_symbols_, any_claimed_, and any_added_.  Declare
6213         Plugin_rescan as friend.  Declare new functions.
6214         (Plugin_manager::Rescannable): Define type.
6215         (Plugin_manager::Rescannable_list): Define type.
6216         (Plugin_manager::Undefined_symbol_list): Define type.
6217         (Plugin_manager::Plugin_manager): Initialize new fields.
6218         * archive.cc (Archive::defines_symbol): New function.
6219         (Add_archive_symbols::run): Pass archive to plugins if any.
6220         * archive.h (class Archive): Declare defines_symbol.
6221         * readsyms.cc (Input_group::~Input_group): New function.
6222         (Finish_group::run): Pass input_group to plugins if any.
6223         * readsyms.h (class Input_group): Declare destructor.
6224         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
6225         any.
6226
6227 2011-01-10  Ian Lance Taylor  <iant@google.com>
6228
6229         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
6230         section as relro.
6231         (Layout::set_segment_offsets): Reset increase_relro before calling
6232         set_section_addresses a second time.
6233
6234 2011-01-04  Cary Coutant  <ccoutant@google.com>
6235
6236         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
6237         sections before NOBITS sections.
6238
6239 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
6240
6241         * version.cc (print_version): Update copyright to 2011.
6242
6243 2010-12-23  Cary Coutant  <ccoutant@google.com>
6244
6245         * output.h (Output_data_reloc::add_output_section): Pass OD instead
6246         of OS to this->add.  Add OD parameter to second form of the function.
6247
6248 2010-12-20  Ian Lance Taylor  <iant@google.com>
6249
6250         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
6251         second of two consecutive entries with same offset.
6252
6253 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6254
6255         * testsuite/Makefile.am (ifuncmain2static_LDADD)
6256         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
6257         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
6258         to avoid unneeded links against $(LDADD).
6259         * testsuite/Makefile.in: Regenerate.
6260
6261 2010-12-15  Ian Lance Taylor  <iant@google.com>
6262
6263         PR gold/12324
6264         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
6265         for R_X86_64_32 and R_X86_64_PC32.
6266         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
6267         ver_matching_def_pic.o.
6268         (ver_matching_def_pic.o): New target.
6269
6270 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6271
6272         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
6273         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
6274         Move definition before File_read::View member definitions.
6275         (File_read::View::~View): Initialize and hold lock before
6276         updating current_mapped_bytes.
6277
6278 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6279
6280         * dwarf_reader.cc: Remove outdated comment.
6281         * gold-threads.cc: Fix typo in error message.
6282         * archive.cc: Fix typos in comments.
6283         * archive.h: Likewise.
6284         * arm-reloc-property.cc: Likewise.
6285         * arm-reloc-property.h: Likewise.
6286         * arm-reloc.def: Likewise.
6287         * arm.cc: Likewise.
6288         * attributes.h: Likewise.
6289         * cref.cc: Likewise.
6290         * ehframe.cc: Likewise.
6291         * fileread.h: Likewise.
6292         * gold.h: Likewise.
6293         * i386.cc: Likewise.
6294         * icf.cc: Likewise.
6295         * incremental.h: Likewise.
6296         * int_encoding.cc: Likewise.
6297         * layout.h: Likewise.
6298         * main.cc: Likewise.
6299         * merge.h: Likewise.
6300         * object.cc: Likewise.
6301         * object.h: Likewise.
6302         * options.cc: Likewise.
6303         * readsyms.cc: Likewise.
6304         * reduced_debug_output.cc: Likewise.
6305         * reloc.cc: Likewise.
6306         * script-sections.cc: Likewise.
6307         * sparc.cc: Likewise.
6308         * symtab.h: Likewise.
6309         * target-reloc.h: Likewise.
6310         * target.cc: Likewise.
6311         * target.h: Likewise.
6312         * timer.cc: Likewise.
6313         * timer.h: Likewise.
6314         * x86_64.cc: Likewise.
6315
6316 2010-12-09  Cary Coutant  <ccoutant@google.com>
6317
6318         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
6319         stack.
6320         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
6321         parameter; change all callers.
6322         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
6323         * options.h (warn_execstack): New option.
6324
6325 2010-12-07  Doug Kwan  <dougkwan@google.com>
6326
6327         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
6328         like function call relocations.
6329
6330 2010-12-07  Ian Lance Taylor  <iant@google.com>
6331
6332         * archive.cc (Archive::get_elf_object_for_member): Permit
6333         punconfigured to be NULL.
6334         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
6335         (Archive::include_member): Pass NULL to get_elf_object_for_member
6336         if we searched for the archive and this is the first included
6337         object.
6338
6339 2010-12-01  Ian Lance Taylor  <iant@google.com>
6340
6341         * dwarf_reader.h (class Sized_dwarf_line_info): Add
6342         track_relocs_type_ field.
6343         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
6344         Set track_relocs_type_.
6345         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
6346         contents when using RELA relocs.
6347         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
6348         reloc_map_.
6349         * reloc.cc (Track_relocs::next_addend): New function.
6350         * reloc.h (class Track_relocs): Declare next_addend.
6351
6352 2010-12-01  Ian Lance Taylor  <iant@google.com>
6353
6354         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
6355         virtual destructor.
6356
6357 2010-12-01  Ian Lance Taylor  <iant@google.com>
6358
6359         * README: Update compilers known to work and fail.
6360
6361 2010-11-23  Matthias Klose  <doko@ubuntu.com>
6362
6363         * configure.in: For --enable-gold, handle value `default' instead of
6364         `both*'.  Always install ld as ld.bfd, install as ld if gold is
6365         not the default.
6366         * configure: Regenerate.
6367
6368 2010-11-18  Doug Kwan  <dougkwan@google.com>
6369
6370         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
6371         and right_alignment to be zero.  Store result alignment only if it is
6372         greater than existing alignment.
6373
6374 2010-11-16  Cary Coutant  <ccoutant@google.com>
6375
6376         PR gold/12220
6377         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
6378         Check for ".zdebug_line".
6379
6380 2010-11-16  Doug Kwan  <dougkwan@google.com>
6381             Cary Coutant  <ccoutant@google.com>
6382
6383         * output.h (Output_segment::set_section_addresses): Pass increase_relro
6384         by reference; adjust all callers.
6385         * output.cc (Output_segment::set_section_addresses): Adjust references
6386         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
6387         list is empty.
6388         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
6389         end at page boundary.
6390
6391 2010-11-16  Cary Coutant  <ccoutant@google.com>
6392
6393         PR gold/12220
6394         * layout.cc (Layout::choose_output_section): Transform names of
6395         compressed sections even when using a script with a SECTIONS clause.
6396         (Layout::output_section_name): Remove code to transform
6397         compressed debug section names.
6398         * output.cc (Output_section::add_input_section): Use uncompressed
6399         section size when tracking input sections.
6400
6401 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
6402
6403         * symtab.h (Symbol::NON_PIC_REF): Remove.
6404         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
6405         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
6406         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
6407         (Symbol::use_plt_offset): Take a flags argument and pass it
6408         directly to needs_dynamic_reloc.  Restrict check for undefined
6409         weak symbols to function calls.
6410         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
6411         (Target_arm::Scan::global): Use it.
6412         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
6413         (Target_arm::Relocate::relocate): Likewise.
6414         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
6415         parameter with an r_type parameter.  Use get_reference_flags
6416         to get the flags.
6417         (Target_arm::Relocate::relocate): Update accordingly.
6418         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
6419         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
6420         (Target_i386::Scan::global): Likewise.
6421         (Target_i386::Relocate::relocate): Likewise.
6422         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
6423         parameter with an r_type parameter.  Use get_reference_flags
6424         to get the flags.
6425         (Target_i386::Relocate::relocate): Update accordingly.
6426         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
6427         (Target_powerpc::Scan::global): Use it.
6428         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
6429         (Target_powerpc::Relocate::relocate): Likewise.
6430         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
6431         (Target_sparc::Scan::global): Use it.
6432         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
6433         (Target_sparc::Relocate::relocate): Likewise.
6434         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
6435         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
6436         (Target_x86_64::Scan::global): Likewise.
6437         (Target_x86_64::Relocate::relocate): Likewise.
6438
6439 2010-11-08  Doug Kwan  <dougkwan@google.com>
6440             Cary Coutant  <ccoutant@google.com>
6441
6442         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
6443         (Arm_exidx_merge_section::section_contents_): New data member.
6444         (Arm_input_section::Arm_input_section): Initialize original_contents_.
6445         (Arm_input_section::~Arm_input_section): De-allocate memory.
6446         (Arm_input_section::original_contents_): New data member.
6447         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
6448         in parameters instead of calling Object::section_contents without
6449         locking.
6450         (Arm_output_section::group_section): New parameter TASK.  Pass it
6451         to callees that need locking objects.
6452         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
6453         to lock EXIDX input sections.  Fix a formatting issue.  Call
6454         Arm_exidx_merged_section::build_contents to create merged section
6455         contents.
6456         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
6457         to lock object of stub table owner.
6458         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
6459         TEXT_SIZE to initialize data member TEXT_SIZE_.
6460         (Arm_exidx_input_section::addralign): Fix typo in comment.
6461         (Arm_exidx_input_section::text_size): New method.
6462         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
6463         that require locking objects.  Lock objects before scanning for stubs
6464         and updating local symbols.
6465         (Arm_input_section<big_endian>::init): Copy contents of original
6466         input section.
6467         (Arm_input_section<big_endian>::do_write): Use saved contents of
6468         original input section instead of calling Object::section_contents
6469         without locking.
6470         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
6471         size without calling Object::section_size().
6472         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
6473         for size.  Allocate a buffer for merged EXIDX entries.
6474         (Arm_exidx_merged_section::build_contents): New method.
6475         (Arm_exidx_merged_section::do_write): Move merge section contents
6476         building code to Arm_exidx_merged_section::build_contetns.  Write
6477         out contetns in buffer instead of building it on the fly.
6478         (Arm_relobj::make_exidx_input_section): Also pass text section size
6479         to Arm_exidx_input_section constructor.
6480         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
6481         (Arm_dynobj::do_read_symbols): Fix memory leak.
6482         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
6483         * target.h: (class Task): Add forward declaration.
6484         (Target::relax): Add new parameter TASK and pass it to
6485         Target::do_relax().
6486         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
6487
6488 2010-11-05  Cary Coutant  <ccoutant@google.com>
6489
6490         PR gold/10708
6491         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
6492         object when reading from the file.
6493         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
6494         second layout pass.
6495         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
6496         when reading section contents.
6497         (get_section_contents): Likewise.
6498         (icf::find_identical_sections): Likewise.
6499         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
6500         object when reading from the file.
6501         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
6502         the object when doing deferred section layout.
6503
6504 2010-11-03  Nick Clifton  <nickc@redhat.com>
6505
6506         PR gold/12001
6507         * script.h (class Symbol_assignment: name): New member.  Returns
6508         the name of the symbol.
6509         * scrfipt.cc (Script_options::is_pending_assignment): New member.
6510         Returns true if the given symbol name is on the list of
6511         assignments wating to be processed.
6512         * archive.cc (should_incldue_member): If the symbol is undefined,
6513         check to see if it is on the list of symbols pending assignment.
6514
6515 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
6516
6517         * script-sections.cc (Script_sections::find_memory_region): Check
6518         for a NULL output section pointer.
6519
6520 2010-10-29  Doug Kwan  <dougkwan@google.com>
6521
6522         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
6523         Output_section::add_relaxed_input_section.
6524         * output.cc (Output_section::add_relaxed_input_section): Add new
6525         arguments LAYOUT and NAME.  Set section order index.
6526         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
6527         Copy section order index.
6528         * output.h (Output_section::add_relaxed_input_section): Add new
6529         arguments LAYOUT and NAME.
6530
6531 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6532
6533         * testsuite/Makefile.am: Move gcctestdir/ld rule to
6534         NATIVE_OR_CROSS_LINKER.
6535         * testsuite/Makefile.in: Regenerate.
6536
6537 2010-10-20  Doug Kwan  <dougkwan@google.com>
6538
6539         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
6540         without SHF_LINK_ORDER flags.
6541         * layout.cc (Layout::choose_output_section): Do not filter
6542         SHF_LINK_ORDER flag in a relocatable link.
6543
6544 2010-10-17  Cary Coutant  <ccoutant@google.com>
6545
6546         * output.h (Output_segment::set_section_addresses): Change function
6547         signature.  Update all callers.
6548         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
6549         sections.
6550         (Output_segment::set_section_addresses): Align after last TLS
6551         section.  Add padding before last relro section instead of after.
6552
6553 2010-10-17  Doug Kwan  <dougkwan@google.com>
6554
6555         * gold/arm.cc (Target_arm::got_section): Use correct order and set
6556         GOT output section to be writable.
6557
6558 2010-10-14  Cary Coutant  <ccoutant@google.com>
6559
6560         * debug.h (DEBUG_INCREMENTAL): New flag.
6561         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
6562         * gold.cc (queue_initial_tasks): Check parameters for incremental link
6563         mode.
6564         * incremental.cc (report_command_line): Ignore all forms of
6565         --incremental.
6566         * layout.cc (Layout::Layout): Check parameters for incremental link
6567         mode.
6568         * options.cc (General_options::parse_incremental): New function.
6569         (General_options::parse_no_incremental): New function.
6570         (General_options::parse_incremental_full): New function.
6571         (General_options::parse_incremental_update): New function.
6572         (General_options::incremental_mode_): New data member.
6573         (General_options::finalize): Check incremental_mode_.
6574         * options.h (General_options): Update help text for --incremental.
6575         Add --no-incremental, --incremental-full, --incremental-update.
6576         (General_options::Incremental_mode): New enum type.
6577         (General_options::incremental_mode): New function.
6578         (General_options::incremental_mode_): New data member.
6579         * parameters.cc (Parameters::incremental_mode_): New data member.
6580         (Parameters::set_options): Set incremental_mode_.
6581         (Parameters::set_incremental_full): New function.
6582         (Parameters::incremental): New function.
6583         (Parameters::incremental_update): New function.
6584         (set_parameters_incremental_full): New function.
6585         * parameters.h (Parameters::set_incremental_full): New function.
6586         (Parameters::incremental): New function.
6587         (Parameters::incremental_update): New function.
6588         (Parameters::incremental_mode_): New data member.
6589         (set_parameters_incremental_full): New function.
6590         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
6591         incremental link mode.
6592         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
6593         (Sized_relobj::do_relocate_sections): Likewise.
6594         * testsuite/Makefile.am (incremental_test): Use --incremental-full
6595         option.
6596         * testsuite/Makefile.in: Regenerate.
6597         * testsuite/incremental_test.sh: Filter all forms of --incremental.
6598
6599 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6600
6601         * script-sections.h (class Script_sections): Make
6602         Sections_elements typedef public.
6603         * script-sections.cc (class Sort_output_sections): Add elements_
6604         field.  Add constructor which sets it; change all callers.
6605         (Sort_output_sections::is_before): New function.
6606         (Sort_output_sections::operator()): Call is_before.
6607         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
6608         conditional.
6609         * testsuite/script_test_10.sh: New test. Test script section
6610         order.
6611         * testsuite/script_test_10.t: Likewise.
6612         * testsuite/script_test_10.s: Likewise.
6613         * testsuite/Makefile.am: Wrap the cross linker tests and the
6614         common tests into NATIVE_OR_CROSS_LINKER.
6615         (check_SCRIPTS): Add script_test_10.sh.
6616         (check_DATA): Add script_test_10.stdout.
6617         (script_test_10.o, script_test_10): New targets.
6618         (script_test_10.stdout): New target.
6619         * configure, testsuite/Makefile.in: Regenerate.
6620
6621 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6622
6623         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
6624         error for the deprecated relocations.
6625         (Target_arm::Scan::global): Likewise.
6626         (Target_arm::Relocate::relocate): Likewise.
6627
6628 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
6629
6630         * fileread.cc (Input_file::find_file): Initialize *found_name
6631         and *namep when using the fallback search for case 4.
6632
6633 2010-10-11  Cary Coutant  <ccoutant@google.com>
6634
6635         * options.h (class General_options): Redefine -z lazy as an alias for
6636         the negation of -z now.
6637
6638 2010-10-11  Ian Lance Taylor  <iant@google.com>
6639
6640         * resolve.cc (symbol_to_bits): Report the value of the unsupported
6641         binding.
6642
6643 2010-10-06  Nick Clifton  <nickc@redhat.com>
6644
6645         * script-sections.cc(class Memory_region): Remove
6646         current_lma_offset_ field.  Rename current_vma_offset_ to
6647         current_offset_.  Add last_section_ field.
6648         (Memory_region::get_current_vma_address): Rename to
6649         get_current_address.
6650         (Memory_region::get_current_lma_address): Delete.
6651         (Memory_region::increment_vma_offset): Rename to
6652         increment_offset.
6653         (Memory_region::increment_lma_offset): Delete.
6654         (Memory_region::attributes_compatible): New method.  Returns
6655         true if the provided section is compatible with the region.
6656         (Memory_region::get_last_section): New method.  Returns the last
6657         section to use the region.
6658         (Memory_region::set_last_section): New method.  Stores the last
6659         section to use the region.
6660         (Script_sections::block_in_region): New method.  Returns true if
6661         a block of memory is contained within a region.
6662         (Script_sections::find_memory_region): New method.  Locates a
6663         memory region to be used to set a VMA or LMA address.
6664         (Output_section_definition::set_section_addresses): Add code to
6665         check for addresses set by memory regions.
6666         (Output_segment::set_section_addresses): Remove memory region
6667         walking code.
6668         (Script_sections::create_segment): Add a warning if a header
6669         segment is created outside of any region.
6670         * script-sections.h (class Script_sections): Add prototypes for
6671         find_memory_region and block_in_region methods.
6672         * testsuite/memory_test.s: Use .long instead of .word.
6673         * testsuite/memory_test.t: Add some more output sections.
6674         * testsuite/memory_test.sh: Update expected output.
6675
6676 2010-10-02  Doug Kwan  <dougkwan@google.com>
6677
6678         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
6679         defintion to symtab.h
6680         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
6681         declaration to defintion.
6682
6683 2010-10-01  Nick Clifton  <nickc@redhat.com>
6684
6685         * expression.cc (eval): Replace dummy argument with NULL.
6686         (eval_maybe_dot): Check for a NULL result section pointer.
6687         (Symbol_expression::value): Likewise.
6688         (Dot_expression::value): Likewise.
6689         (BINARY_EXPRESSION): Likewise.
6690         (Max_expression::value): Likewise.
6691         (Min_expression::value): Likewise.
6692         (Absolute_expression::value): Likewise.
6693         (Addr_expression::value_from_output_section): Likewise.
6694         (Loaddddr_expression::value_from_output_section): Likewise.
6695         (Segment_start_expression::value): Likewise.
6696         * script-sections.cc
6697         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
6698         argument with NULL.
6699         (Sections_elememt_dot_assignment::set_section_addresses):
6700         Likewise.
6701         (Output_data_expression::do_write_to_buffer): Likewise.
6702         (Output_section_definition::finalize_symbols): Likewise.
6703         (Output_section_definition::set_section_addresses): Likewise.
6704
6705 2010-09-30  Doug Kwan  <dougkwan@google.com>
6706
6707         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
6708
6709 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
6710
6711         * target.h (Target::can_icf_inline_merge_sections): New virtual
6712         function.
6713         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
6714         virtual function.
6715         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
6716         virtual function.
6717         * icf.cc (get_section_contents): Inline merge sections only when
6718         target allows it.
6719
6720 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6721
6722         * configure: Regenerate.
6723
6724 2010-09-17  Ian Lance Taylor  <iant@google.com>
6725
6726         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
6727         * testsuite/Makefile.am (memory_test.o): New target.
6728         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
6729         memory_test.t.
6730         * testsuite/Makefile.in: Rebuild.
6731
6732 2010-09-17  Doug Kwan  <dougkwan@google.com>
6733
6734         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
6735         defintion if relocation uses GOT entries of the symbol.
6736         * testsuite/icf_safe_test.sh: Fix test.
6737         * testsuite/icf_safe_so_test.sh: Fix test.
6738
6739 2010-09-16  Cary Coutant  <ccoutant@google.com>
6740
6741         * script_sections.cc (class Memory_region): Remove "NULL" from
6742         vector initializations.
6743
6744 2010-09-15  Cary Coutant  <ccoutant@google.com>
6745
6746         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
6747         Resolve forwarding symbols.
6748
6749 2010-09-15  Doug Kwan  <dougkwan@google.com>
6750
6751         * gold/testsuite/script_test_3.t: Add ARM special sections.
6752         * gold/testsuite/script_test_4.t: Same.
6753         * gold/testsuite/script_test_5.t: Same.
6754         * gold/testsuite/script_test_6.t: Same.
6755         * gold/testsuite/script_test_7.t: Same.
6756         * gold/testsuite/script_test_7.t: Same.
6757         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
6758
6759 2010-09-14  Cary Coutant  <ccoutant@google.com>
6760
6761         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
6762         (Target_x86_64::Relocate::relocate_tls): Replace check for
6763         saw_tls_block_reloc_ with test for executable section.
6764
6765 2010-09-12  Cary Coutant  <ccoutant@google.com>
6766
6767         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
6768         position-independent executables to shared libraries need dynamic
6769         relocations.
6770         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
6771         position-independent executables.
6772         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
6773         * testsuite/Makefile.in: Regenerate.
6774
6775 2010-09-10  Nick Clifton  <nickc@redhat.com>
6776
6777         PR gold/11997
6778         * testsuite/memory_test.t: Discard any sections that are not
6779         needed.
6780
6781 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
6782
6783         PR gold/11996
6784         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
6785         "This::" to work around a bug in gcc 4.2.
6786
6787         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
6788
6789 2010-09-09  Rafael Espindola  <espindola@google.com>
6790
6791         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
6792         sections with different PF_X flags in the same segment.
6793         (Layout::find_first_load_seg): Search all segments to find the first
6794         one.
6795         * options.h (rosegment): New.
6796
6797 2010-09-08  Rafael Espindola  <espindola@google.com>
6798
6799         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
6800
6801 2010-09-08  Doug Kwan  <dougkwan@google.com>
6802
6803         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
6804         (Arm_relobj::do_relocate_sections): Add new parameter for output
6805         file to match the parent.
6806         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
6807         of local symbols instead of input values.  Update code to track
6808         changes in gold::relocate_section.
6809         * object.cc (Sized_relobj::compute_final_local_value): New methods.
6810         (Sized_relobj::compute_final_local_value_internal): New methods.
6811         (Sized_relobj::do_finalize_local_symbols): Move code from loop
6812         body into private version of Sized_relobj::compute_final_local_value.
6813         Call the inline method.
6814         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
6815         merged symbol value if there is one.
6816         (Symbol_value::has_output_value): New method defintiion.
6817         (Sized_relobj::Compute_final_local_value_status): New enum type.
6818         (Sized_relobj::compute_final_local_value): New methods.
6819         (Sized_relobj::compute_final_local_value_internal): New methods.
6820         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
6821         and arm_cortex_a8.sh.
6822         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
6823         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
6824         New tests.
6825         * Makefile.in: Regenerate.
6826         * testsuite/arm_bl_out_of_range.s: Update test.
6827         * testsuite/thumb_bl_out_of_range.s: Ditto.
6828         * testsuite/thumb_blx_out_of_range.s: Ditto.
6829         * testsuite/arm_branch_out_of_range.sh: New file.
6830         * testsuite/arm_cortex_a8.sh: Ditto.
6831         * testsuite/arm_cortex_a8_b.s: Ditto.
6832         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
6833         * testsuite/arm_cortex_a8_b_local.s: Ditto.
6834         * testsuite/arm_cortex_a8_bl.s: Ditto.
6835         * testsuite/arm_cortex_a8_blx.s: Ditto.
6836         * testsuite/arm_cortex_a8_local.s: Ditto.
6837         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
6838         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
6839
6840 2010-09-08  Rafael Espindola  <espindola@google.com>
6841
6842         * Makefile.am (memory_test.stdout): Run readelf with -W.
6843         * Makefile.in: Regenerate.
6844         * testsuite/memory_test.sh: Make the regexps accept both 32 and
6845         64 bit output.
6846
6847 2010-09-08  Rafael Espindola  <espindola@google.com>
6848
6849         * script-sections.cc (Script_sections::add_memory_region): Convert
6850         field precision to int.
6851         * script.cc (script_set_section_region, script_set_section_region):
6852         Convert field precision to int.
6853
6854 2010-09-08  Rafael Espindola  <espindola@google.com>
6855
6856         * arm.cc (do_finalize_sections): Create the __exidx_start and
6857         __exdix_end symbols even when the section is missing.
6858
6859 2010-09-08  Nick Clifton  <nickc@redhat.com>
6860
6861         * README: Remove claim that MEMORY is not supported.
6862         * expression.cc (script_exp_function_origin)
6863         (script_exp_function_length): Move from here to ...
6864         * script.cc: ... here.
6865         (script_set_section_region, script_add_memory)
6866         (script_parse_memory_attr, script_include_directive): New
6867         functions.
6868         * script-sections.cc
6869         (class Memory_region): New class.
6870         (class Output_section_definition): Add set_memory_region,
6871         set_section_vma, set_section_lma and get_section_name methods.
6872         (class Script_Sections): Add add_memory_region,
6873         find_memory_region, find_memory_region_origin,
6874         find_memory_region_length and set_memory_region methods.
6875         Have set_section_addresses method walk the list of set memory
6876         regions.
6877         Extend the print methos to display memory regions.
6878         * script-sections.h: Add prototypes for new methods.
6879         Add enum for MEMORY region attributes.
6880         * yyscript.y: Add support for parsing MEMORY regions.
6881         * script-c.h: Add prototypes for new functions.
6882         * testsuite/Makefile.am: Add test of MEMORY region functionality.
6883         * testsuite/Makefile.in: Regenerate.
6884         * testsuite/memory_test.sh: New script.
6885         * testsuite/memory_test.s: New assembler source file.
6886         * testsuite/memory_test.t: New linker script.
6887
6888 2010-08-27  Doug Kwan  <dougkwan@google.com>
6889
6890         * gold/resolve.cc (Symbol_table::should_override): Let a weak
6891         reference override an existing dynamic weak reference.
6892         * testsuite/Makefile.am: Add new test dyn_weak_ref.
6893         * testsuite/Makefile.in: Regenerate.
6894         * testsuite/dyn_weak_ref.sh: New file.
6895         * testsuite/dyn_weak_ref_1.c: Ditto.
6896         * testsuite/dyn_weak_ref_2.c: Ditto.
6897
6898 2010-08-27  Ian Lance Taylor  <iant@google.com>
6899
6900         * incremental.h (class Incremental_input_entry): Add virtual
6901         destructor.
6902
6903 2010-08-27  Ian Lance Taylor  <iant@google.com>
6904
6905         * testsuite/start_lib_test_3.c: Mark t3 as used.
6906
6907 2010-08-27  Nick Clifton  <nickc@redhat.com>
6908
6909         * options.cc (version_script): Fix small typo in previous
6910         whitespace tidyup.
6911
6912 2010-08-25  Nick Clifton  <nickc@redhat.com>
6913
6914         * archive.cc: Formatting fixes: Remove whitespace between
6915         typename and following asterisk.  Remove whitespace between
6916         function name and opening parenthesis.
6917         * archive.h: Likewise.
6918         * arm.cc: Likewise.
6919         * attributes.cc: Likewise.
6920         * attributes.h: Likewise.
6921         * common.cc: Likewise.
6922         * copy-relocs.cc: Likewise.
6923         * dirsearch.h: Likewise.
6924         * dynobj.cc: Likewise.
6925         * ehframe.cc: Likewise.
6926         * ehframe.h: Likewise.
6927         * expression.cc: Likewise.
6928         * fileread.cc: Likewise.
6929         * fileread.h: Likewise.
6930         * gc.h: Likewise.
6931         * gold-threads.cc: Likewise.
6932         * gold.cc: Likewise.
6933         * i386.cc: Likewise.
6934         * icf.h: Likewise.
6935         * incremental-dump.cc: Likewise.
6936         * incremental.cc: Likewise.
6937         * layout.cc: Likewise.
6938         * layout.h: Likewise.
6939         * main.cc: Likewise.
6940         * merge.cc: Likewise.
6941         * merge.h: Likewise.
6942         * object.cc: Likewise.
6943         * object.h: Likewise.
6944         * options.cc: Likewise.
6945         * options.h: Likewise.
6946         * output.cc: Likewise.
6947         * output.h: Likewise.
6948         * plugin.cc: Likewise.
6949         * plugin.h: Likewise.
6950         * powerpc.cc: Likewise.
6951         * reloc.cc: Likewise.
6952         * script-c.h: Likewise.
6953         * script-sections.cc: Likewise.
6954         * script.cc: Likewise.
6955         * stringpool.cc: Likewise.
6956         * symtab.cc: Likewise.
6957         * symtab.h: Likewise.
6958         * target.cc: Likewise.
6959         * timer.cc: Likewise.
6960         * timer.h: Likewise.
6961         * version.cc: Likewise.
6962         * x86_64.cc: Likewise.
6963
6964 2010-08-24  Nick Clifton  <nickc@redhat.com>
6965
6966         PR 11899
6967         * layout.cc (segment_precedes): Sort segments by their physical
6968         addresses, if they have been set.
6969
6970 2010-08-23  Cary Coutant  <ccoutant@google.com>
6971
6972         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
6973         symbols data.
6974         (Lib_group::include_member): Unlock object after deleting its
6975         symbols data.
6976         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
6977         the bug fixed here.
6978
6979 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
6980             Cary Coutant  <ccoutant@google.com>
6981
6982         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
6983         constructor, and set_blocker.
6984         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
6985         readsyms_blocker_.
6986         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
6987         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
6988         * testsuite/Makefile.am (start_lib_test): New test case.
6989         * testsuite/Makefile.in: Regenerate.
6990         * testsuite/start_lib_test_main.c: New file.
6991         * testsuite/start_lib_test_1.c: New file.
6992         * testsuite/start_lib_test_2.c: New file.
6993         * testsuite/start_lib_test_3.c: New file.
6994
6995 2010-08-19  Ian Lance Taylor  <iant@google.com>
6996
6997         * Makefile.in: Rebuild with automake 1.11.1.
6998         * aclocal.m4: Likewise.
6999         * testsuite/Makefile.in: Likewise.
7000
7001 2010-08-19  Ian Lance Taylor  <iant@google.com>
7002
7003         PR 10893
7004         * i386.cc (class Output_data_plt_i386): Update declarations.
7005         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
7006         local_ifuncs_ fields.
7007         (Target_i386::do_plt_section_for_global): New function.
7008         (Target_i386::do_plt_section_for_local): New function.
7009         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
7010         parameter; change all callers.  Initialize global_ifuncs_ and
7011         local_ifuncs_.  If doing a static link define __rel_iplt_start and
7012         __rel_iplt_end.
7013         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
7014         (Output_data_plt_i386::add_local_ifunc_entry): New function.
7015         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
7016         symbols.
7017         (Target_i386::make_plt_section): New function, broken out of
7018         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
7019         (Target_i386::make_plt_entry): Call make_plt_section.
7020         (Target_i386::make_local_ifunc_plt_entry): New function.
7021         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
7022         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
7023         R_386_IRELATIVE to switch.
7024         (Target_i386::Scan::global): Likewise.
7025         (Target_i386::Relocate::relocate): Likewise.
7026         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
7027         switch.
7028         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
7029         (Target_x86_64::do_plt_section_for_global): New function.
7030         (Target_x86_64::do_plt_section_for_local): New function.
7031         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
7032         parameter; change all callers.  If doing a static link define
7033         __rela_iplt_start and __rela_iplt_end.
7034         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
7035         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
7036         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
7037         to point to .plt.
7038         (Target_x86_64::make_local_ifunc_plt_entry): New function.
7039         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
7040         switch.
7041         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
7042         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
7043         R_X86_64_IRELATIVE to switch.
7044         (Target_x86_64::Scan::global): Likewise.
7045         (Target_x86_64::Relocate::relocate): Likewise.
7046         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
7047         switch.
7048         * target.h (class Target): Add plt_section_for_global and
7049         plt_section_for_local functions.  Add do_plt_section_for_global
7050         and do_plt_section_for_local virtual functions.
7051         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
7052         clarifying comments.
7053         (Symbol::use_plt_offset): Handle IFUNC symbol.
7054         * object.cc (Sized_relobj::Sized_relobj): Initialize
7055         local_plt_offsets_.
7056         (Sized_relobj::local_has_plt_offset): New function.
7057         (Sized_relobj::local_plt_offset): New function.
7058         (Sized_relobj::set_local_plt_offset): New function.
7059         (Sized_relobj::do_count): Handle IFUNC symbol.
7060         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
7061         a bit away from input_shndx_ field.  Add set_is_func_symbol and
7062         is_ifunc_symbol functions.
7063         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
7064         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
7065         local_plt_offsets_ field.
7066         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
7067         * output.h (class Output_section_data): Add non-const
7068         output_section function.
7069         (class Output_data_got): Update declarations.
7070         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
7071         Add use_plt_offset parameter to global and local constructors.
7072         Change all callers.  Change local_sym_index_ field to 31 bits.
7073         Change GSYM_CODE and CONSTANT_CODE accordingly.
7074         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
7075         doing a static link don't set sh_link field.
7076         (Output_data_got::Got_entry::write): Use PLT offset if
7077         appropriate.
7078         (Output_data_got::add_global_plt): New function.
7079         (Output_data_got::add_local_plt): New function.
7080         * target-reloc.h (relocate_section): Handle IFUNC symbol.
7081         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
7082         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
7083         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
7084         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
7085         IFUNC conditional.
7086         * testsuite/ifunc-sel.h: New file.
7087         * testsuite/ifuncmain1.c: New file.
7088         * testsuite/ifuncmain1vis.c: New file.
7089         * testsuite/ifuncmod1.c: New file.
7090         * testsuite/ifuncdep2.c: New file.
7091         * testsuite/ifuncmain2.c: New file.
7092         * testsuite/ifuncmain3.c: New file.
7093         * testsuite/ifuncmod3.c: New file.
7094         * testsuite/ifuncmain4.c: New file.
7095         * testsuite/ifuncmain5.c: New file.
7096         * testsuite/ifuncmod5.c: New file.
7097         * testsuite/ifuncmain6pie.c: New file.
7098         * testsuite/ifuncmod6.c: New file.
7099         * testsuite/ifuncmain7.c: New file.
7100         * configure, testsuite/Makefile.in: Rebuild.
7101
7102 2010-08-18  Ian Lance Taylor  <iant@google.com>
7103
7104         * incremental.cc
7105         (Output_section_incremental_inputs::write_input_files): Add cast
7106         to avoid signed/unsigned comparison warning.
7107         (Output_section_incremental_inputs::write_info_blocks): Likewise.
7108
7109 2010-08-12  Cary Coutant  <ccoutant@google.com>
7110
7111         * common.cc (Sort_commons::operator()): Remove unnecessary code.
7112
7113 2010-08-13  Ian Lance Taylor  <iant@google.com>
7114
7115         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
7116
7117 2010-08-12  Cary Coutant  <ccoutant@google.com>
7118             Doug Kwan  <dougkwan@google.com>
7119
7120         * resolve.cc (Symbol_table::should_override): When a weak dynamic
7121         defintion overrides non-weak undef, remember that the original undef
7122         is not weak.
7123         * symtab.cc (Symbol_table::sized_write_global): For undef without
7124         an original weak binding, set binding to global in output.
7125         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
7126         * testsuite/Makefile.in: Regenerate.
7127         * testsuite/strong_ref_weak_def.sh: New file.
7128         * testsuite/strong_ref_weak_def_1.c: Ditto.
7129         * testsuite/strong_ref_weak_def_2.c: Ditto.
7130
7131 2010-08-12  Cary Coutant  <ccoutant@google.com>
7132
7133         * testsuite/incremental_test.sh: Rewrite.
7134         * testsuite/incremental_test_1.c: Rewrite.
7135         * testsuite/incremental_test_2.c: Rewrite.
7136
7137 2010-08-12  Cary Coutant  <ccoutant@google.com>
7138
7139         * arm.cc (Target_arm::got_size): Add const.
7140         (Target_arm::got_entry_count): New function.
7141         (Target_arm::plt_entry_count): New function.
7142         (Target_arm::first_plt_entry_offset): New function.
7143         (Target_arm::plt_entry_size): New function.
7144         (Output_data_plt_arm::entry_count): New function.
7145         (Output_data_plt_arm::first_plt_entry_offset): New function.
7146         (Output_data_plt_arm::get_plt_entry_size): New function.
7147         * i386.cc (Target_i386::got_size): Add const.
7148         (Target_i386::got_entry_count): New function.
7149         (Target_i386::plt_entry_count): New function.
7150         (Target_i386::first_plt_entry_offset): New function.
7151         (Target_i386::plt_entry_size): New function.
7152         (Output_data_plt_i386::entry_count): New function.
7153         (Output_data_plt_i386::first_plt_entry_offset): New function.
7154         (Output_data_plt_i386::get_plt_entry_size): New function.
7155         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
7156         find_incremental_inputs_sections.  Dump incremental_got_plt section.
7157         * incremental.cc: Include target.h.
7158         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
7159         parameter.  Adjust all callers.  Find incremental_got_plt section.
7160         (Incremental_inputs::create_data_sections): Create incremental_got_plt
7161         section.
7162         (Output_section_incremental_inputs::set_final_data_size): Calculate
7163         size of incremental_got_plt section.
7164         (Output_section_incremental_inputs::do_write): Write the
7165         incremental_got_plt section.
7166         (Got_plt_view_info): New struct.
7167         (Local_got_offset_visitor): New class.
7168         (Global_got_offset_visitor): New class.
7169         (Global_symbol_visitor_got_plt): New class.
7170         (Output_section_incremental_inputs::write_got_plt): New function.
7171         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
7172         Add parameter.  Adjust all callers.
7173         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
7174         (Incremental_inputs::got_plt_section): New function.
7175         (Incremental_inputs::got_plt_section_): New data member.
7176         (Incremental_got_plt_reader): New class.
7177         * layout.cc (Layout::create_incremental_info_sections): Add the
7178         incremental_got_plt section.
7179         * object.h (Got_offset_list::get_list): New function.
7180         (Got offset_list::for_all_got_offsets): New function.
7181         (Sized_relobj::local_got_offset_list): New function.
7182         * powerpc.cc (Target_powerpc::got_size): Add const.
7183         (Target_powerpc::got_entry_count): New function.
7184         (Target_powerpc::plt_entry_count): New function.
7185         (Target_powerpc::first_plt_entry_offset): New function.
7186         (Target_powerpc::plt_entry_size): New function.
7187         (Output_data_plt_powerpc::entry_count): New function.
7188         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
7189         (Output_data_plt_powerpc::get_plt_entry_size): New function.
7190         * sparc.cc (Target_sparc::got_size): Add const.
7191         (Target_sparc::got_entry_count): New function.
7192         (Target_sparc::plt_entry_count): New function.
7193         (Target_sparc::first_plt_entry_offset): New function.
7194         (Target_sparc::plt_entry_size): New function.
7195         (Output_data_plt_sparc::entry_count): New function.
7196         (Output_data_plt_sparc::first_plt_entry_offset): New function.
7197         (Output_data_plt_sparc::get_plt_entry_size): New function.
7198         * symtab.h (Symbol::got_offset_list): New function.
7199         (Symbol_table::for_all_symbols): New function.
7200         * target.h (Sized_target::got_entry_count): New function.
7201         (Sized_target::plt_entry_count): New function.
7202         (Sized_target::plt_entry_size): New function.
7203         * x86_64.cc (Target_x86_64::got_size): Add const.
7204         (Target_x86_64::got_entry_count): New function.
7205         (Target_x86_64::plt_entry_count): New function.
7206         (Target_x86_64::first_plt_entry_offset): New function.
7207         (Target_x86_64::plt_entry_size): New function.
7208         (Output_data_plt_x86_64::entry_count): New function.
7209         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
7210         (Output_data_plt_x86_64::get_plt_entry_size): New function.
7211
7212 2010-08-12  Cary Coutant  <ccoutant@google.com>
7213
7214         * archive.cc: Include incremental.h.
7215         (Archive::Archive): Initialize incremental_info_.
7216         (Archive::include_member): Record archive members in incremental info.
7217         (Add_archive_symbols::run): Record begin and end of an archive in
7218         incremental info.
7219         (Lib_group::include_member): Record objects in incremental info.
7220         * archive.h (Incremental_archive_entry): Forward declaration.
7221         (Archive::set_incremental_info): New member function.
7222         (Archive::incremental_info): New member function.
7223         (Archive::Unused_symbol_iterator): New class.
7224         (Archive::unused_symbols_begin): New member function.
7225         (Archive::unused_symbols_end): New member function.
7226         (Archive::incremental_info_): New data member.
7227         * incremental-dump.cc (find_input_containing_global): New function.
7228         (dump_incremental_inputs): Dump new incremental info sections.
7229         * incremental.cc: Include symtab.h.
7230         (Output_section_incremental_inputs): New class.
7231         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
7232         new incremental info sections.
7233         (Sized_incremental_binary::do_check_inputs): Likewise.
7234         (Incremental_inputs::report_archive): Remove.
7235         (Incremental_inputs::report_archive_begin): New function.
7236         (Incremental_inputs::report_archive_end): New function.
7237         (Incremental_inputs::report_object): New function.
7238         (Incremental_inputs::finalize_inputs): Remove.
7239         (Incremental_inputs::report_input_section): New function.
7240         (Incremental_inputs::report_script): Rewrite.
7241         (Incremental_inputs::finalize): Do nothing but finalize string table.
7242         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
7243         (Incremental_inputs::sized_create_inputs_section_data): Remove.
7244         (Incremental_inputs::create_data_sections): New function.
7245         (Incremental_inputs::relocs_entsize): New function.
7246         (Output_section_incremental_inputs::set_final_data_size): New function.
7247         (Output_section_incremental_inputs::do_write): New function.
7248         (Output_section_incremental_inputs::write_header): New function.
7249         (Output_section_incremental_inputs::write_input_files): New function.
7250         (Output_section_incremental_inputs::write_info_blocks): New function.
7251         (Output_section_incremental_inputs::write_symtab): New function.
7252         * incremental.h (Incremental_script_entry): Forward declaration.
7253         (Incremental_object_entry): Forward declaration.
7254         (Incremental_archive_entry): Forward declaration.
7255         (Incremental_inputs): Forward declaration.
7256         (Incremental_inputs_header_data): Remove.
7257         (Incremental_inputs_header): Remove.
7258         (Incremental_inputs_header_write): Remove.
7259         (Incremental_inputs_entry_data): Remove.
7260         (Incremental_inputs_entry): Remove.
7261         (Incremental_inputs_entry_write): Remove.
7262         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
7263         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
7264         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
7265         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
7266         Likewise.
7267         (Incremental_input_entry): New class.
7268         (Incremental_script_entry): New class.
7269         (Incremental_object_entry): New class.
7270         (Incremental_archive_entry): New class.
7271         (Incremental_inputs::Incremental_inputs): Initialize new data members.
7272         (Incremental_inputs::report_inputs): Remove.
7273         (Incremental_inputs::report_archive): Remove.
7274         (Incremental_inputs::report_archive_begin): New function.
7275         (Incremental_inputs::report_archive_end): New function.
7276         (Incremental_inputs::report_object): Change prototype.
7277         (Incremental_inputs::report_input_section): New function.
7278         (Incremental_inputs::report_script): Change prototype.
7279         (Incremental_inputs::get_reloc_count): New function.
7280         (Incremental_inputs::set_reloc_count): New function.
7281         (Incremental_inputs::create_data_sections): New function.
7282         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
7283         (Incremental_inputs::inputs_section): New function.
7284         (Incremental_inputs::symtab_section): New function.
7285         (Incremental_inputs::relocs_section): New function.
7286         (Incremental_inputs::get_stringpool): Add const.
7287         (Incremental_inputs::command_line): Add const.
7288         (Incremental_inputs::inputs): Remove.
7289         (Incremental_inputs::command_line_key): New function.
7290         (Incremental_inputs::input_file_count): New function.
7291         (Incremental_inputs::input_files): New function.
7292         (Incremental_inputs::relocs_entsize): New function.
7293         (Incremental_inputs::sized_create_inputs_section_data): Remove.
7294         (Incremental_inputs::finalize_inputs): Remove.
7295         (Incremental_inputs::Input_info): Remove.
7296         (Incremental_inputs::lock_): Remove.
7297         (Incremental_inputs::inputs_): Change type.
7298         (Incremental_inputs::inputs_map_): Remove.
7299         (Incremental_inputs::current_object_entry_): New data member.
7300         (Incremental_inputs::inputs_section_): New data member.
7301         (Incremental_inputs::symtab_section_): New data member.
7302         (Incremental_inputs::relocs_section_): New data member.
7303         (Incremental_inputs::reloc_count_): New data member.
7304         (Incremental_inputs_reader): New class.
7305         (Incremental_symtab_reader): New class.
7306         (Incremental_relocs_reader): New class.
7307         * layout.cc (Layout::finalize): Move finalization of incremental info
7308         and creation of incremental info sections to follow finalization of
7309         symbol table.  Set offsets for postprocessing sections.
7310         (Layout::create_incremental_info_sections): Call
7311         Incremental_inputs::create_data_sections.  Add incremental symtab
7312         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
7313         sections to layout after input sections.
7314         * layout.h (struct Timespec): Forward declaration.
7315         (Layout::incremental_inputs): Add const.
7316         (Layout::create_incremental_info_sections): Add parameter.
7317         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
7318         * object.cc: Include incremental.h.
7319         (Relobj::finalize_incremental_relocs): New function.
7320         (Sized_relobj::do_layout): Record input sections in incremental info.
7321         * object.h (Object::output_section): New function.
7322         (Object::output_section_offset): Moved from Relobj.
7323         (Object::get_incremental_reloc_base): New function.
7324         (Object::get_incremental_reloc_count): New function.
7325         (Object::do_output_section): New function.
7326         (Object::do_output_section_offset): Moved from Relobj.
7327         (Object::do_get_incremental_reloc_base): New function.
7328         (Object::do_get_incremental_reloc_count): New function.
7329         (Object::Object): Initialize new data members.
7330         (Relobj::output_section): Renamed do_output_section and moved to
7331         protected.
7332         (Relobj::output_section_offset): Moved to Object.
7333         (Relobj::do_get_incremental_reloc_base): New function.
7334         (Relobj::do_get_incremental_reloc_count): New function.
7335         (Relobj::allocate_incremental_reloc_counts): New function.
7336         (Relobj::count_incremental_reloc): New function.
7337         (Relobj::finalize_incremental_relocs): New function.
7338         (Relobj::next_incremental_reloc_index): New function.
7339         (Relobj::reloc_counts_): New data member.
7340         (Relobj::reloc_bases_): New data member.
7341         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
7342         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
7343         (Sized_relobj::incremental_relocs_scan): New function.
7344         (Sized_relobj::incremental_relocs_scan_reltype): New function.
7345         (Sized_relobj::incremental_relocs_write): New function.
7346         (Sized_relobj::incremental_relocs_write_reltype): New function.
7347         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
7348         incremental link.
7349         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
7350         archives and object files elsewhere.
7351         (Add_symbols::run): Report object files here.
7352         (Finish_group::run): Report end of archive at end of group.
7353         * reloc.cc: Include layout.h, incremental.h.
7354         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
7355         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
7356         (Sized_relobj::incremental_relocs_scan): New function.
7357         (Sized_relobj::incremental_relocs_scan_reltype): New function.
7358         (Sized_relobj::do_relocate_sections): Write incremental relocations.
7359         (Sized_relobj::incremental_relocs_write): New function.
7360         (Sized_relobj::incremental_relocs_write_reltype): New function.
7361         * script.cc (read_input_script): Rewrite test for incremental link.
7362         Change call to Incremental_inputs::report_script.
7363         * symtab.h (Symbol_table::first_global_index): New function.
7364         (Symbol_table::output_count): New function.
7365
7366 2010-08-12  Doug Kwan  <dougkwan@google.com>
7367
7368         * arm.cc (Target_arm::merge_object_attributes): Check command line
7369         options --no-wchar-size-warning and --no-enum-size-warning.
7370         * options.h (General_options): Add ld-compatible options
7371         --no-enum-size-warning and --no-wchar-size-warning.
7372
7373 2010-08-04  Ian Lance Taylor  <iant@google.com>
7374
7375         * x86_64.cc (Target_x86_64::Scan::local): Use
7376         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
7377         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
7378         (Target_x86_64::Scan::global): Likewise.
7379         (Target_x86_64::Relocate::relocate): Likewise.
7380         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
7381         Likewise.
7382
7383 2010-08-03  Cary Coutant  <ccoutant@google.com>
7384
7385         * merge.cc (Output_merge_string::do_add_input_section): Count strings
7386         to reserve space in merged_strings vector. Keep total input size
7387         for stats.
7388         (Output_merge_string::do_print_merge_stats): Print total input size.
7389         * merge.h (Output_merge_string): Add input_size_ field.
7390         * stringpool.cc (Stringpool_template::string_length): Move
7391         implementations out of Stringpool_template class and place in
7392         stringpool.h.
7393         * stringpool.h (string_length): Move out of Stringpool_template.
7394
7395 2010-08-03  Ian Lance Taylor  <iant@google.com>
7396
7397         PR 11712
7398         * layout.cc (relaxation_loop_body): If address of load segment is
7399         set, adjust address to include headers if possible.
7400
7401 2010-08-03  Ian Lance Taylor  <iant@google.com>
7402
7403         * version.cc (version_string): Bump to 1.10.
7404
7405 2010-08-03  Ian Lance Taylor  <iant@google.com>
7406
7407         PR 11805
7408         * layout.h (enum Output_section_order): Define.
7409         (class Layout): Update declarations.
7410         * layout.cc (Layout::get_output_section): Add order parameter.
7411         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
7412         is_first_non_relro parameters.  Change all callers.
7413         (Layout::choose_output_section): Likewise.
7414         (Layout::add_output_section_data): Likewise.
7415         (Layout::make_output_section): Likewise.  Set order.
7416         (Layout::default_section_order): New function.
7417         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
7418         * output.cc (Output_section::Output_section): Initialize order_.
7419         Don't initialize deleted fields.
7420         (Output_segment::Output_segment): Don't initialize deleted
7421         fields.
7422         (Output_segment::add_output_section_to_load): New function
7423         replacing add_output_section.  Change all callers to call this or
7424         add_output_section_to_nonload.
7425         (Output_segment::add_output_section_to_nonload): New function.
7426         (Output_segment::remove_output_section): Rewrite.
7427         (Output_segment::add_initial_output_data): Likewise.
7428         (Output_segment::has_any_data_sections): Likewise.
7429         (Output_segment::is_first_section_relro): Likewise.
7430         (Output_segment::maximum_alignment): Likewise.
7431         (Output_segment::has_dynamic_reloc): New function replacing
7432         dynamic_reloc_count.  Change all callers.
7433         (Output_segment::has_dynamic_reloc_list): New function replacing
7434         dynamic_reloc_count_list.  Change all callers.
7435         (Output_segment::set_section_addresses): Rewrite.
7436         (Output_segment::set_offset): Rewrite.
7437         (Output_segment::find_first_and_last_list): Remove.
7438         (Output_segment::set_tls_offsets): Rewrite.
7439         (Output_segment::first_section_load_address): Likewise.
7440         (Output_segment::output_section_count): Likewise.
7441         (Output_segment::section_with_lowest_load_address): Likewise.
7442         (Output_segment::write_section_headers): Likewise.
7443         (Output_segment::print_sections_to_map): Likewise.
7444         * output.h (class Output_data): Remove dynamic_reloc_count_
7445         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
7446         (Output_data::add_dynamic_reloc): Rewrite.
7447         (Output_data::has_dynamic_reloc): New function.
7448         (Output_data::dynamic_reloc_count): Remove.
7449         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
7450         is_last_relro_, is_first_non_relro_, is_interp_,
7451         is_dynamic_linker_section_ fields.  Add order and set_order
7452         functions.  Remove is_relro_local, set_is_relro_local,
7453         is_last_relro, set_is_last_relro, is_first_non_relro,
7454         set_is_first_non_relro functions, is_interp, set_is_interp,
7455         is_dynamic_linker_section, and set_is_dynamic_linker_section
7456         functions.
7457         (class Output_segment): Change Output_data_list from std::list to
7458         std:;vector.  Add output_lists_ field.  Remove output_data_ and
7459         output_bss_ fields.  Update declarations.
7460
7461 2010-08-02  Ian Lance Taylor  <iant@google.com>
7462
7463         * arm.cc (Target_arm::gc_process_relocs): Use typename.
7464         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
7465         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
7466
7467 2010-08-02  Ian Lance Taylor  <iant@google.com>
7468
7469         PR 11855
7470         * script.cc (Script_options::Script_options): Initialize
7471         symbol_definitions_ and symbol_references_.
7472         (Script_options::add_symbol_assignment): Update
7473         symbol_definitions_ and symbol_references_.
7474         (Script_options::add_symbol_reference): New function.
7475         (script_symbol): New function.
7476         * script.h (class Script_options): Add symbol_definitions_ and
7477         symbol_references_ fields.
7478         (Script_options::referenced_const_iterator): New type.
7479         (Script_options::referenced_begin): New function.
7480         (Script_options::referenced_end): New function.
7481         (Script_options::is_referenced): New function.
7482         (Script_options::any_unreferenced): New function.
7483         * script-c.h (script_symbol): Declare.
7484         * yyscript.y (exp): Call script_symbol.
7485         * symtab.cc: Include "script.h".
7486         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
7487         Change all callers.  Check symbols referenced by scripts.
7488         (Symbol_table::add_undefined_symbols_from_command_line): Add
7489         layout parameter.  Change all callers.
7490         (Symbol_table::do_add_undefined_symbols_from_command_line):
7491         Likewise.  Break out loop body.  Check symbols referenced by
7492         scripts.
7493         (Symbol_table::add_undefined_symbol_from_command_line): New
7494         function broken out of
7495         do_add_undefined_symbols_from_command_line.
7496         * symtab.h (class Symbol_table): Update declarations.
7497         * archive.cc: Include "layout.h".
7498         (Archive::should_include_member): Add layout parameter.  Change
7499         all callers.  Check for symbol mentioned in expression.
7500         * archive.h (class Archive): Update declaration.
7501         * object.cc (Sized_relobj::do_should_include_member): Add layout
7502         parameter.
7503         * object.h (Object::should_include_member): Add layout parameter.
7504         Change all callers.
7505         (Object::do_should_include_member): Add layout parameter.
7506         (class Sized_relobj): Update declaration.
7507         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
7508         parameter.
7509         * dynobj.h (class Sized_dynobj): Update declaration.
7510         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
7511         layout parameter.
7512         * plugin.h (class Sized_pluginobj): Update declaration.
7513
7514 2010-08-02  Ian Lance Taylor  <iant@google.com>
7515
7516         PR 11866
7517         * output.cc (Output_segment::set_offset): Search for the first and
7518         last sections rather than assuming that the list is in order.
7519         (Output_segment::find_first_and_last_list): New function.
7520         * output.h (class Output_segment): Update declarations.
7521         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
7522         (relro_strip_test_SOURCES): New variable.
7523         (relro_strip_test_DEPENDENCIES): New variable.
7524         (relro_strip_test_LDFLAGS): New variable.
7525         (relro_strip_test_LDADD): New variable.
7526         (relro_strip_test.so): New target.
7527
7528 2010-08-02  Ian Lance Taylor  <iant@google.com>
7529
7530         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
7531         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
7532         (Target_i386::got_tlsdesc_section): New function.
7533         (Target_i386::got_section): Create space for GOT entries for
7534         TLSDESC relocations.
7535         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
7536         R_386_TLS_GOTDESC.
7537         (Target_i386::Scan::global): Likewise.
7538         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
7539         using TLSDESC GOT.
7540         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
7541         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
7542         (Target_x86_64::got_tlsdesc_section): New function.
7543         (Target_x86_64::got_section): Create space for GOT entries for
7544         TLSDESC relocations.
7545         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
7546         R_386_TLS_GOTDESC.
7547         (Target_x86_64::Scan::global): Likewise.
7548         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
7549         using TLSDESC GOT.
7550
7551 2010-08-02  Ian Lance Taylor  <iant@google.com>
7552
7553         * testsuite/final_layout.sh: Use dc to convert from hex to
7554         decimal.
7555
7556 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
7557
7558         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
7559         paramter to the call to gold::gc_process_relocs.
7560         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
7561         paramter to the call to gold::gc_process_relocs.
7562         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
7563         parameter to the call to gold::gc_process_relocs.
7564         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
7565         template parameter to the call to gold::gc_process_relocs.
7566         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
7567         paramter to the call to gold::gc_process_relocs.
7568         * gc.h (get_embedded_addend_size): New function.
7569         (gc_process_relocs): Save the size of the reloc for use by ICF.
7570         * icf.cc (get_section_contents): Get the addend from the text section
7571         for SHT_REL relocation sections.
7572         * icf.h (Icf::Reloc_addend_size_info): New typedef.
7573         (Icf::Reloc_info): Add new member reloc_addend_size_info.
7574         * int_encoding.h (read_from_pointer): New overloaded function.
7575         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
7576         * testsuite/icf_sht_rel_addend_test.sh: New file.
7577         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
7578         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
7579
7580 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7581
7582         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
7583         * Makefile.in: Regenerate.
7584         * testsuite/Makefile.in: Regenerate.
7585
7586 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
7587
7588         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
7589         * gold/testsuite/debug_msg.cc: Likewise.
7590         * gold/testsuite/odr_violation1.cc
7591         * gold/testsuite/odr_violation2.cc
7592
7593 2010-07-21  Cary Coutant  <ccoutant@google.com>
7594
7595         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
7596         string, and length fields.
7597         (Output_merge_string::Merged_strings_list): New type.
7598         (Output_merge_string::Merged_strings_lists): New typedef.
7599         (Output_merge_string): Replace merged_strings_ with
7600         merged_strings_lists_.
7601         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
7602         Merged_strings_list per input object and section.  Don't store pointer
7603         to the string.  Don't store length with each merged string entry.
7604         (Output_merge_string::finalize_merged_data): Loop over list of merged
7605         strings lists.  Recompute length of each merged string.
7606
7607 2010-07-15  Cary Coutant  <ccoutant@google.com>
7608
7609         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
7610         here.
7611
7612 2010-07-14  Ian Lance Taylor  <iant@google.com>
7613
7614         * descriptors.cc (Descriptors::open): Report correct name in error
7615         message.
7616
7617 2010-07-13  Doug Kwan  <dougkwan@google.com>
7618
7619         * arm.cc (Arm_input_section::Arm_input_section): For a
7620         SHT_ARM_EXIDX section, always keeps the input sections.
7621         (Arm_input_section::set_exidx_section_link): New method.
7622         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
7623         has_errors_ to false.
7624         (Arm_exidx_input_section::has_errors,
7625         Arm_exidx_input_section::set_has_errors): New methods.
7626         (Arm_exidx_input_section::has_errors_): New data member.
7627         (Arm_relobj::get_exidx_shndx_list): New method.
7628         (Arm_output_section::append_text_sections_to_list): Do not skip
7629         section without SHF_EXECINSTR.
7630         (Arm_output_section::fix_exidx_coverage): Skip input sections with
7631         errors.
7632         (Arm_relobj::make_exidx_input_section): Add new parameter for text
7633         section header.  Make error messages more verbose.  Check for
7634         a non-executable section linked to an EXIDX section.
7635         (Arm_relobj::do_read_symbols): Remove error checking, which has been
7636         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
7637         check that there is no deferred EXIDX section if we exit early.
7638         Instead of not making an EXIDX section in case of an error, make one
7639         and set the has_errors flag of it.
7640         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
7641         in a relocatable link.
7642         (Target_arm::do_relax): Look for the EXIDX output section instead of
7643         assuming that it is called .ARM.exidx.
7644         (Target_arm::fix_exidx_coverage): Add a new parameter for input
7645         section list.  Do not check for SHF_EXECINSTR section flags but
7646         skip any input section with errors.
7647         * output.cc (Output_section::Output_section): Initialize
7648         always_keeps_input_sections_ to false.
7649         (Output_section::add_input_section): Check for
7650         always_keeps_input_sections_.
7651         *  output.h (Output_section::always_keeps_input_sections,
7652         Output_section::set_always_keeps_input_sections): New methods.
7653         (Output_section::always_keeps_input_sections): New data member.
7654
7655 2010-07-13  Rafael Espindola  <espindola@google.com>
7656
7657         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
7658         * fileread.h (Input_file): Add try_extra_search_path and find_file.
7659
7660 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
7661             Ian Lance Taylor  <iant@google.com>
7662
7663         * output.h (Output_section_lookup_maps::add_merge_section):
7664         Correct check of whether value was inserted.
7665         (Output_section_lookup_maps::add_merge_input_section): Likewise.
7666         (Output_section_lookup_maps::add_relaxed_input_section):
7667         Likewise.
7668         * arm.cc (Target_arm::got_section): Remove used local os.
7669         * i386.cc (Target_i386::got_section): Likewise.
7670         * x86_64.cc (Target_x86_64::got_section): Likewise.
7671         * sparc.cc (Target_sparc::got_section): Likewise.
7672         (Target_sparc::relocate): Remove unused local have_got_offset.
7673         * powerpc.cc (Target_powerpc::relocate): Likewise.
7674
7675 2010-07-13  Ian Lance Taylor  <iant@google.com>
7676
7677         * compressed_output.cc (zlib_decompress): Fix signature in
7678         !HAVE_ZLIB_H case.
7679
7680         * archive.cc (Archive::include_member): Unlock an external member
7681         of a thin archive.  Don't bother to delete an object we know is
7682         NULL.
7683
7684 2010-07-12  Cary Coutant  <ccoutant@google.com>
7685
7686         * compressed_output.cc (zlib_decompress): New function.
7687         (get_uncompressed_size): New function.
7688         (decompress_input_section): New function.
7689         * compressed_output.h (get_uncompressed_size): New function.
7690         (decompress_input_section): New function.
7691         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
7692         Handle compressed debug sections.
7693         * layout.cc (is_compressed_debug_section): New function.
7694         (Layout::output_section_name): Map compressed section names to
7695         canonical names.
7696         * layout.h (is_compressed_debug_section): New function.
7697         (is_debug_info_section): Recognize compressed debug sections.
7698         * merge.cc: Include compressed_output.h.
7699         (Output_merge_data::do_add_input_section): Handle compressed
7700         debug sections.
7701         (Output_merge_string::do_add_input_section): Handle compressed
7702         debug sections.
7703         * object.cc: Include compressed_output.h.
7704         (Sized_relobj::Sized_relobj): Initialize new data members.
7705         (build_compressed_section_map): New function.
7706         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
7707         * object.h (Object::section_is_compressed): New method.
7708         (Object::do_section_is_compressed): New method.
7709         (Sized_relobj::Compressed_section_map): New type.
7710         (Sized_relobj::do_section_is_compressed): New method.
7711         (Sized_relobj::compressed_sections_): New data member.
7712         * output.cc (Output_section::add_input_section): Handle compressed
7713         debug sections.
7714         * reloc.cc: Include compressed_output.h.
7715         (Sized_relobj::write_sections): Handle compressed debug sections.
7716
7717 2010-07-08  Cary Coutant  <ccoutant@google.com>
7718
7719         * resolve.cc (Symbol_table::resolve): Remember whether undef was
7720         weak when resolving to a dynamic def.
7721         (Symbol_table::should_override): Add adjust_dyndef flag; set it
7722         for weak undef/dynamic def cases. Adjust callers.
7723         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
7724         undef_binding_weak_.
7725         (Symbol_table::sized_write_globals): Adjust symbol binding.
7726         (Symbol_table::sized_write_symbol): Add binding parameter.
7727         * symtab.h (Symbol::set_undef_binding): New method.
7728         (Symbol::is_undef_binding_weak): New method.
7729         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
7730         (Symbol_table::should_override): Add new parameter.
7731         (Symbol_table::sized_write_symbol): Add new parameter.
7732
7733         * testsuite/weak_undef_file1.cc: Add new test case.
7734         * testsuite/weak_undef_file2.cc: Fix header comment.
7735         * testsuite/weak_undef_test.cc: Add new test case.
7736
7737 2010-06-29  Doug Kwan  <dougkwan@google.com>
7738
7739         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
7740         Initialize USE_SYMBOL_.
7741         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
7742         definition.
7743         (Arm_reloc_property::uses_symbol_): New data member declaration.
7744         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
7745         uses symbol value and symbol is undefined but not weakly undefined.
7746
7747 2010-06-28  Rafael Espindola  <espindola@google.com>
7748
7749         * plugin.cc (Plugin::load): Use dlerror.
7750
7751 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
7752
7753         * symtab.cc (detect_odr_violations): When reporting an ODR
7754         violation, report an object where the symbol is defined.
7755
7756 2010-06-25  Doug Kwan  <dougkwan@google.com>
7757
7758         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
7759         (Target_arm::section_may_have_icf_unsafe_pointers): New method
7760         definition.
7761         (Target_arm::Scan::local_reloc_may_be_function_pointer,
7762         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
7763         target hook to detect function points.
7764         (Target_arm::Scan::possible_function_pointer_reloc): New method.
7765         * icf.h (Icf::check_section_for_function_pointers): Change type of
7766         parameter SECTION_NAME to const reference to std::string.  Use
7767         target hook to determine if section may have unsafe pointers.
7768         * target.h (Target::section_may_have_icf_unsafe_pointers): New
7769         method definition.
7770
7771 2010-06-21  Rafael Espindola  <espindola@google.com>
7772
7773         * fileread.cc (Input_file::find_fie): New
7774         (Input_file::open): Use Input_file::find_fie.
7775         * fileread.h (Input_file::find_fie): New
7776         * plugin.cc (set_extra_library_path): New.
7777         (Plugin::load): Add set_extra_library_path to the transfer vector.
7778         (Plugin_manager::set_extra_library_path): New.
7779         (Plugin_manager::add_input_file): Use the extra search path if set.
7780         (set_extra_library_path(): New.
7781         * plugin.h (Plugin_manager): Add set_extra_library_path and
7782         extra_search_path_.
7783
7784 2010-06-19  Cary Coutant  <ccoutant@google.com>
7785
7786         * layout.cc (gdb_sections): Add .debug_types.
7787         (lines_only_debug_sections): Likewise.
7788
7789 2010-06-18  Rafael Espindola  <espindola@google.com>
7790
7791         * plugin.cc (add_input_file,add_input_library)
7792         (Plugin_manager::add_input_file): Make filename arguments const.
7793         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
7794         const.
7795
7796 2010-06-16  Doug Kwan  <dougkwan@google.com>
7797
7798         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
7799         .ARM.attributes section if we have not merged any input
7800         attributes sections.
7801
7802 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7803
7804         * arm.cc: Allow combining objects with no EABI version
7805         information.
7806
7807 2010-06-15  Rafael Espindola  <espindola@google.com>
7808
7809         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
7810
7811 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7812
7813         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
7814         (struct iovec): Correct !HAVE_READV definition.
7815
7816 2010-06-10  Cary Coutant  <ccoutant@google.com>
7817
7818         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
7819         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
7820         reloc sections.
7821         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
7822
7823         PR 11683
7824         * symtab.h (Symbol::is_placeholder): New member function.
7825         * target-reloc.h (relocate_section): Check for placeholder symbols.
7826
7827         * testsuite/Makefile.am (plugin_test_8): New test.
7828         (plugin_test_9): New test.
7829         * testsuite/Makefile.in: Regenerate.
7830
7831 2010-06-09  Nick Clifton  <nickc@redhat.com>
7832
7833         * yyscript.y (input_list_element): Allow strings prefixed with
7834         the '-' character.  Treat these as libraries.
7835         * script.cc (script_add_library): New function.  Adds a library
7836         specified by "-l<name>" found in an input script.
7837         * script-c.h: Add prototype for script_add_library.
7838
7839 2010-06-07  Doug Kwan  <dougkwan@google.com>
7840
7841         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
7842         Restrict stub-group size to be within long conditional branch
7843         range when working around cortex-A8 erratum.
7844
7845 2010-06-07  Damien Diederen  <dd@crosstwine.com>
7846
7847         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
7848         #ifdef typo.
7849
7850 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
7851
7852         PR gold/11658
7853         * output.cc
7854         (Output_section::Input_section_sort_entry::compare_section_ordering):
7855         Change to return non-zero correctly.
7856         (Output_section::Input_section_sort_section_order_index_compare
7857         ::operator()): Change to fix ambiguity in comparisons.
7858
7859 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
7860
7861         * gold.h (is_wildcard_string): New function.
7862         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
7863         (Layout::layout_eh_frame): Ditto.
7864         (Layout::find_section_order_index): New method.
7865         (Layout::read_layout_from_file): New method.
7866         * layout.h (Layout::find_section_order_index): New method.
7867         (Layout::read_layout_from_file): New method.
7868         (Layout::input_section_position_): New private member.
7869         (Layout::input_section_glob_): New private member.
7870         * main.cc (main): Call read_layout_from_file here.
7871         * options.h (--section-ordering-file): New option.
7872         * output.cc (Output_section::input_section_order_specified_): New
7873         member.
7874         (Output_section::Output_section): Initialize new member.
7875         (Output_section::add_input_section): Add new parameter.
7876         Keep input sections when --section-ordering-file is used.
7877         (Output_section::set_final_data_size): Sort input sections when
7878         section ordering file is specified.
7879         (Output_section::Input_section_sort_entry): Add new parameter.
7880         Check sorting type.
7881         (Output_section::Input_section_sort_entry::compare_section_ordering):
7882         New method.
7883         (Output_section::Input_section_sort_compare::operator()): Change to
7884         consider section_order_index.
7885         (Output_section::Input_section_sort_init_fini_compare::operator()):
7886         Change to consider section_order_index.
7887         (Output_section::Input_section_sort_section_order_index_compare
7888         ::operator()): New method.
7889         (Output_section::sort_attached_input_sections): Change to sort
7890         according to section order when specified.
7891         (Output_section::add_input_section<32, true>): Add new parameter.
7892         (Output_section::add_input_section<64, true>): Add new parameter.
7893         (Output_section::add_input_section<32, false>): Add new parameter.
7894         (Output_section::add_input_section<64, false>): Add new parameter.
7895         * output.h (Output_section::add_input_section): Add new parameter.
7896         (Output_section::input_section_order_specified): New
7897         method.
7898         (Output_section::set_input_section_order_specified): New method.
7899         (Input_section::Input_section): Initialize section_order_index_.
7900         (Input_section::section_order_index): New method.
7901         (Input_section::set_section_order_index): New method.
7902         (Input_section::section_order_index_): New member.
7903         (Input_section::Input_section_sort_section_order_index_compare): New
7904         struct.
7905         (Output_section::input_section_order_specified_): New member.
7906         * script-sections.cc (is_wildcard_string): Delete and move modified
7907         method to gold.h.
7908         (Output_section_element_input::Output_section_element_input): Modify
7909         call to is_wildcard_string.
7910         (Output_section_element_input::Input_section_pattern
7911         ::Input_section_pattern): Ditto.
7912         (Output_section_element_input::Output_section_element_input): Ditto.
7913         * testsuite/Makefile.am (final_layout): New test case.
7914         * testsuite/Makefile.in: Regenerate.
7915         * testsuite/final_layout.cc: New file.
7916         * testsuite/final_layout.sh: New file.
7917
7918 2010-06-01  Rafael Espindola  <espindola@google.com>
7919
7920         * plugin.cc (Plugin::load): Pass the output name to the plugin.
7921
7922 2010-06-01  Rafael Espindola  <espindola@google.com>
7923
7924         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
7925         visibility of symbols.
7926
7927 2010-05-27  Doug Kwan  <dougkwan@google.com>
7928
7929         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
7930         from start of output section instead of address for a local symbol
7931         in a merged or relaxed section when doing a relocatable link.
7932
7933 2010-05-26  Rafael Espindola  <espindola@google.com>
7934
7935         PR 11604
7936         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
7937         adding sections the garbage collector removed.
7938         * gold/testsuite/Makefile.am: Add test.
7939         * gold/testsuite/Makefile.in: Regenerate.
7940         * gold/testsuite/plugin_test_7.sh: New.
7941         * gold/testsuite/plugin_test_7_1.c: New.
7942         * gold/testsuite/plugin_test_7_2.c: New.
7943
7944 2010-05-26  Rafael Espindola  <espindola@google.com>
7945
7946         * script-sections.cc (Output_section_definition::set_section_addresses):
7947         Check for --section-start.
7948
7949 2010-05-26  Doug Kwan  <dougkwan@google.com>
7950
7951         * arm.cc (Arm_scan_relocatable_relocs): New class.
7952         (Target_arm::relocate_special_relocatable): New method.
7953         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
7954         (Arm_relocate_functions::thumb_branch_common): Same.
7955         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
7956         instead of Default_scan_relocatable_relocs.
7957         * target-reloc.h (relocate_for_relocatable): Let target handle
7958         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
7959         * target.h (Sized_target::relocate_special_relocatable): New method.
7960
7961 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7962
7963         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
7964
7965 2010-05-23  Doug Kwan  <dougkwan@google.com>
7966
7967         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
7968         instead of a cast.
7969         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
7970         with a direct branch, not a conditional branch, to a stub.
7971         * merge.cc (Output_merge_base::record_input_section): New method
7972         defintion.
7973         (Output_merge_data::do_add_input_section): Record input section if
7974         keeps-input-sections flag is set.
7975         (Output_merge_string::do_add_input_section): Ditto.
7976         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
7977         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
7978         INPUT_SECTIONS_.
7979         (Output_merge_base::keeps_input_sections,
7980         Output_merge_base::set_keeps_input_sections,
7981         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
7982         method definitions.
7983         (Output_merge_base::Input_sections): New type declaration.
7984         (Output_merge_base::input_sections_begin,
7985         Output_merge_base::input_sections_end,
7986         Output_merge_base::do_set_keeps_input_sections): New method definitions.
7987         (Output_merge_base::bool keeps_input_sections_,
7988         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
7989         Output_merge_base::input_sections_): New data members.
7990         (Output_merge_data::do_set_keeps_input_sections): New method
7991         defintion.
7992         (Output_merge_string::do_set_keeps_input_sections): Ditto.
7993         * output.cc (Output_section::Input_section::relobj): Move method
7994         defintion from class declaration to here and handle merge sections.
7995         (Output_section::Input_section::shndx): Ditto.
7996         (Output_section::Output_section): Remove initializations of removed
7997         data members and initialize new data member LOOKUP_MAPS_.
7998         (Output_section::add_input_section): Set keeps-input-sections flag
7999         for a newly created merge output section as appropriate.  Adjust code
8000         to use Output_section_lookup_maps class.
8001         (Output_section::add_relaxed_input_section): Adjst code for lookup
8002         maps code refactoring.
8003         (Output_section::add_merge_input_section): Add a new parameter
8004         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
8005         class.  If adding input section to a newly created merge output
8006         section fails, remove the new merge section.
8007         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
8008         Adjust code for use of the Output_section_lookup_maps class.
8009         (Output_section::find_merge_section): Ditto.
8010         (Output_section::build_lookup_maps): New method defintion.
8011         (Output_section::find_relaxed_input_section): Adjust code to use
8012         Output_section_lookup_maps class.
8013         (Output_section::get_input_sections): Export merge sections.  Adjust
8014         code to use Output_section_lookup_maps class.
8015         (Output_section:::add_script_input_section): Adjust code to use
8016         Output_section_lookup_maps class.  Update lookup maps for merge
8017         sections also.
8018         (Output_section::discard_states): Use Output_section_lookup_maps.
8019         (Output_section::restore_states): Same.
8020         * output.h (Merge_section_properties): Move class defintion out of
8021         Output_section.
8022         (Output_section_lookup_maps): New class.
8023         (Output_section::Input_section::is_merge_section): New method
8024         defintion.
8025         (Output_section::Input_section::relobj): Move defintion out of class
8026         defintion.  Declare method only.
8027         (Output_section::Input_section::shndx): Ditto.
8028         (Output_section::Input_section::output_merge_base): New method defintion.
8029         (Output_section::Input_section::u2_.pomb): New union field.
8030         (Output_section::Merge_section_by_properties_map,
8031         Output_section::Output_section_data_by_input_section_map,
8032         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
8033         Remove types.
8034         (Output_section::add_merge_input_section): Add new parameter
8035         KEEPS_INPUT_SECTIONS.
8036         (Output_section::build_lookup_maps): New method declaration.
8037         (Output_section::merge_section_map_,
8038         Output_section::merge_section_by_properties_map_,
8039         Output_section::relaxed_input_section_map_,
8040         Output_section::is_relaxed_input_section_map_valid_): Remove data
8041         members.
8042         (Output_section::lookup_maps_): New data member.
8043
8044 2010-05-21  Doug Kwan  <dougkwan@google.com>
8045
8046         PR gold/11619
8047         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
8048         avoid a compilation error.
8049
8050 2010-05-19  Rafael Espindola  <espindola@google.com>
8051
8052         * script-sections.cc (Output_section_definition::allocate_to_segment):
8053         Update the phdrs_list even when the output section is NULL.
8054         * testsuite/Makefile.am: Add test.
8055         * testsuite/Makefile.in: Regenerate.
8056         * testsuite/script_test_9.cc: New.
8057         * testsuite/script_test_9.sh: New.
8058         * testsuite/script_test_9.t: New.
8059
8060 2010-05-19  Doug Kwan  <dougkwan@google.com>
8061
8062         * arm.cc (Arm_input_section::original_size): New method.
8063         (Arm_input_section::do_addralign): Add a cast.
8064         (Arm_input_section::do_output_offset): Remove static cast.
8065         (Arm_input_section::original_addralign,
8066          Arm_input_section::original_size_): Change type to uint32_t.
8067         (Arm_input_section::init): Add safe casts for section alignment
8068         and size.
8069         (Arm_input_section::set_final_data_size): Do not set address and
8070         offset of stub table.
8071         (Arm_output_section::fix_exidx_coverage): Change use of of
8072         Output_section::Simple_input_section to that of
8073         Output_section::Input_section.
8074         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
8075         except for the first pass.
8076         * output.cc (Output_section::get_input_sections): Change type of
8077         input_sections to std::list<Input_section>.
8078         (Output_section::add_script_input_section): Rename from
8079         Output_section::add_simple_input_section.  Change type of SIS
8080         parameter from Simple_input_section to Input_section.
8081         * output.h (Output_section::Simple_input_section): Remove class.
8082         (Output_section::Input_section): Change class visibility to public.
8083         (Output_section::Input_section::addralign): Use stored alignments
8084         for special input sections if set.
8085         (Output_section::Input_section::set_addralign): New method.
8086         (Output_section::get_input_sections): Change parameter type from
8087         list of Simple_input_section to list of Input_section.
8088         (Output_section::add_script_input_section): Rename from
8089         Output_section::add_simple_input_section. Change first parameter's
8090         type from Simple_input_section to Input_section and remove the
8091         second and third parameters.
8092         * script-sections.cc (Input_section::Input_section_list): Change
8093         type to list of Output_section::Input_section/
8094         (Input_section_info::Input_section_info): Change parameter type of
8095         INPUT_SECTION to Output_section::Input_section.
8096         (Input_section_info::input_section): Change return type.
8097         (Input_section_info::input_section_): Change type to
8098         Output_section::Input_section.
8099         (Output_section_element_input::set_section_addresses): Adjust code
8100         to use Output_section::Input_section instead of
8101         Output_section::Simple_input_section.  Adjust code for renaming
8102         of Output_section::add_simple_input_section.
8103         (Orphan_output_section::set_section_addresses): Ditto.
8104
8105 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8106
8107         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
8108         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
8109
8110 2010-05-18  Rafael Espindola  <espindola@google.com>
8111
8112         * options.cc (General_options::finalize): Handle -nostdlib.
8113         * options.h (nostdlib): New option.
8114         * script.cc (script_add_search_dir): Handle -nostdlib.
8115
8116 2010-05-12  Doug Kwan  <dougkwan@google.com>
8117
8118         * arm.cc (Target_arm::do_finalize_sections): Create an empty
8119         attributes section only if there no attributes section after merging.
8120         (Target_arm::merge_object_attributes): Move value of
8121         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
8122         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
8123         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
8124         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
8125         and arm_attr_merge_7.stdout.
8126         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
8127         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
8128         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
8129         arm_attr_merge_7b.o): New rules.
8130         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
8131         arm_attr_merge_7
8132         * testsuite/Makefile.in: Regenerate.
8133         * testsuite/arm_attr_merge.sh: New file.
8134         * testsuite/arm_attr_merge_[67][ab].s: Same.
8135
8136 2010-05-05  Nick Clifton  <nickc@redhat.com>
8137
8138         * po/es.po: Updated Spanish translation.
8139
8140 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
8141
8142         * Makefile.am (install-exec-local): Properly install gold as
8143         default cross linker.
8144         * Makefile.in: Regenerated.
8145
8146 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
8147             Nick Clifton  <nickc@redhat.com>
8148
8149         * configure.ac (install_as_default): Define and set to false
8150         unless --enable-gold or --enable-gold=both/gold has been
8151         specified.
8152         * configure: Regenerate.
8153
8154         * Makefile.am (install-exec-local): Install the executable as
8155         'ld.gold'.  If install_as_default is true then also install it as
8156         'ld'.
8157         * Makefile.in: Regenerated.
8158
8159 2010-04-24  Ian Lance Taylor  <iant@google.com>
8160
8161         * layout.cc (Layout::layout_reloc): In relocatable link don't
8162         combine reloc sections for grouped sections.
8163
8164 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
8165
8166         * gc.h (gc_process_relocs): Pass information on relocs pointing to
8167         sections that are not ordinary to icf.
8168         * icf.cc (get_section_contents): Handle relocation pointing to section
8169         with no object or shndx information.
8170         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
8171         * testsuite/Makefile.in: Regenerate.
8172         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
8173         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
8174
8175 2010-04-22  Ian Lance Taylor  <iant@google.com>
8176
8177         * expression.cc (Expression::Expression_eval_info): Add
8178         result_alignment_pointer field.
8179         (Expression::eval_with_dot): Add result_alignment_pointer
8180         parameter.  Change all callers.
8181         (Expression::eval_maybe_dot): Likewise.
8182         (class Binary_expression): Add alignment_pointer parameter to
8183         left_value and right_value.  Change all callers.
8184         (BINARY_EXPRESSION): Set result alignment.
8185         (class Trinary_expression): Add alignment_pointer parameter to
8186         arg2_value and arg3_value.  Change all callers.
8187         (Trinary_cond::value): Set result alignment.
8188         (Max_expression::value, Min_expression::value): Likewise.
8189         (Align_expression::value): Likewise.
8190         * script-sections.cc (class Sections_element): Add dot_alignment
8191         parameter to set_section_addresses virtual function.  Update
8192         instantiations.
8193         (class Output_section_element): Likewise.
8194         (Script_sections::create_segments): Add dot_alignment parameter.
8195         Change all callers.
8196         (Script_sections::create_segments_from_phdrs_clause): Likewise.
8197         (Script_sections::set_phdrs_clause_addresses): Likewise.
8198         * script-sections.h: Update declarations.
8199         * script.h: Update declarations.
8200         * output.h (Output_segment::set_minimum_p_align): Don't decrease
8201         min_p_align.
8202         * testsuite/script_test_3.t: Set large alignment.
8203         * testsuite/script_test_3.sh: Make sure that at least one LOAD
8204         segment has expected alignment.
8205
8206 2010-04-22  Nick Clifton  <nickc@redhat.com>
8207
8208         * po/gold.pot: Updated by the Translation project.
8209         * po/vi.po: Updated Vietnamese translation.
8210
8211 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
8212
8213         * testsuite/Makefile.am (check_PROGRAMS): Add
8214         icf_virtual_function_folding_test.
8215         * testsuite/Makefile.in: Regenerated.
8216
8217 2010-04-15  Andrew Haley  <aph@redhat.com>
8218
8219         * options.h (merge_exidx_entries): New option.
8220         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
8221         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
8222         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
8223         (Target_arm::merge_exidx_entries): New function.
8224         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
8225         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
8226         to Arm_exidx_fixup constructor.
8227         Add new arg, merge_exidx_entries.
8228         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
8229         Arm_output_section::fix_exidx_coverage.
8230
8231 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
8232
8233         * icf.cc (get_section_contents): Check for preemptible functions.
8234         Ignore addend when appropriate.
8235         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
8236         section folded.
8237         (add_from_relobj): Check for section folded.
8238         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
8239         * symtab.h (should_add_dynsym_entry): Add new parameter.
8240         * target-reloc.h (scan_relocs): Check for section folded.
8241         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
8242         Check reloc types for function pointers in shared objects.
8243         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
8244         case.
8245         (icf_preemptible_functions_test): New test case.
8246         (icf_string_merge_test): New test case.
8247         * testsuite.Makefile.in: Regenerate.
8248         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
8249         bar_glob.  Refactor code.
8250         * testsuite/icf_preemptible_functions_test.cc: New file.
8251         * testsuite/icf_preemptible_functions_test.sh: New file.
8252         * testsuite/icf_string_merge_test.cc: New file.
8253         * testsuite/icf_string_merge_test.sh: New file.
8254         * testsuite/icf_virtual_function_folding_test.cc: New file.
8255         * testsuite/icf_virtual_function_folding_test.sh: New file.
8256
8257 2010-04-14  Doug Kwan  <dougkwan@google.com>
8258
8259         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
8260         for local symbol recounting if we remove a section due to ICF.
8261         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
8262         there are no regular objects in input.
8263
8264 2010-04-13  Doug Kwan  <dougkwan@google.com>
8265
8266         * arm.cc (Arm_input_section::set_final_data_size): Compute
8267         accurate final data size instead of using current data size.
8268
8269 2010-04-09  Doug Kwan  <dougkwan@google.com>
8270
8271         * layout.cc (Layout::choose_output_section): Handle script section
8272         types.
8273         (Layout::make_output_section_for_script): Add section type parameter.
8274         Handle script section types.
8275         * layout.h (Layout::make_output_section_for_script): Add section
8276         type parameter.
8277         * output.cc (Output_section::Output_section): Initialize data member
8278         is_noload_.
8279         (Output_section::do_reset_address_and_file_offset): Do not set address
8280         to 0 if section is a NOLOAD section.
8281         * output.h (Output_section::is_noload): New method.
8282         (Output_section::set_is_noload): Ditto.
8283         (Output_section::is_noload_): New data member.
8284         * script-c.h (Script_section_type): New enum type.
8285         (struct Parser_output_section_header): Add new file section_type.
8286         * script-sections.cc (Sections_element::output_section_name): Add
8287         parameter for returning script section type.
8288         (Output_section_definition::output_section_name): Ditto.
8289         (Output_section_definition::section_type)P; New method.
8290         (Output_section_definiton::script_section_type_name): Ditto.
8291         (Output_section_definition::script_section_type_): New data member.
8292         (Output_section_definition::Output_section_definition): Initialize
8293         data member Output_section_definition::script_section_type_.
8294         (Output_section_definition::create_sections): Pass script section type
8295         to Layout::make_output_section_for_script.
8296         (Output_section_definition::output_section_name): Return script
8297         section type to caller.
8298         (Output_section_definition::set_section_address): Do not advance
8299         dot value and load address if section type is NOLOAD.  Set address
8300         of NOLOAD sections regardless of section flags.
8301         (Output_section_definition::print): Print section type if it is
8302         not SCRIPT_SECTION_TYPE_NONE.
8303         (Output_section_definition::section_type): New method.
8304         (Output_section_definition::script_section_type_name): Ditto.
8305         (Script_sections::output_section_name): Add new parameter
8306         PSECTION_TYPE for returning script section type.  Pass it to
8307         section elements.  Handle discard sections.
8308         (Sort_output_sections::operator()): Handle NOLOAD sections.
8309         * script-sections.h (Script_sections::Section_type): New enum type.
8310         (Script_sections::output_section_name): Add a new parameter for
8311         returning script section type.
8312         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
8313         INFO and NOLOAD.
8314         * yyscript.y (union): Add new field SECTION_TYPE.
8315         (COPY, DSECT, INFO, NOLOAD): New tokens.
8316         (opt_address_and_section_type): Change type to output_section_header.
8317         (section_type): New non-terminal
8318         (section_header): Handle section type.
8319         (opt_address_and_section_type): Return section type value.
8320
8321 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
8322
8323         * testsuite/plugin_common_test_1.c (foo): Add prototype.
8324         * testsuite/plugin_common_test_2.c (foo): Likewise.
8325
8326 2010-04-08  Doug Kwan  <dougkwan@google.com>
8327
8328         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
8329         Output_merge_data.
8330         * output.cc (Output_section::add_merge_input_section): Simplify
8331         code and return status of Output_merge_base::add_input_section.
8332         Update merge section map only if Output_merge_base::add_input_section
8333         returns true.
8334
8335 2010-04-07  Doug Kwan  <dougkwan@google.com>
8336
8337         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
8338         if section is marked as containing instructions but has no mapping
8339         symbols.
8340         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
8341         correct section index.
8342         (Arm_relobj::find_linked_text_section): Ditto.
8343
8344 2010-04-07  Cary Coutant  <ccoutant@google.com>
8345
8346         * archive.cc (include_member): Destroy Read_symbols_data object before
8347         releasing file.
8348         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
8349         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
8350         (Read_symbols_data::~Read_symbols_data) New destructor.
8351         (Section_relocs::Section_relocs) New constructor.
8352         (Section_relocs::~Section_relocs) New destructor.
8353         (Read_relocs_data::Read_relocs_data) New constructor.
8354         (Read_relocs_data::~Read_relocs_data) New destructor.
8355         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
8356         pointers to NULL after deleting.
8357
8358 2010-04-07  Doug Kwan  <dougkwan@google.com>
8359
8360         * arm.cc: Replace "endianity" with "endianness" in comments.
8361         (Arm_exidx_cantunwind): Ditto.
8362         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
8363         (Arm_relobj::merge_flags_and_attributes): New method.
8364         (Arm_relobj::merge_flags_and_attributes_): New data member.
8365         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
8366         (Arm_relobj::scan_sections_for_stubs): Ditto.
8367         (Arm_relobj::do_read_symbols): Check to see if we really want to
8368         merge processor-specific flags and attributes.  Exit early if
8369         an object is empty except for section names and the undefined symbol.
8370         (Target_arm::do_finalize_sections): Move check for ELF format to
8371         Arm_relobj::do_read_symbols.  Merge processor specific flags and
8372         attributes from a regular object only when we have determined that
8373         it is aapropriate.  Do not create an .ARM.attributes section in
8374         output if there is no regular input object.
8375         (Target_arm::merge_processor_specific_flags): Check
8376         --warn-mismatch before printing any error.
8377         (Target_arm::merge_object_attributes): Ditto.
8378         * gold.cc (queue_middle_tasks): Handle the case in which there is
8379         no regular object in input.
8380         * options.cc (General_options::parse_EB): New method.
8381         (General_options::parse_EL): Same.
8382         (General_options::General_options): Initialize endianness_.
8383         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
8384         New options.
8385         (General_options::Endianness): New enum.
8386         (General_options::endianness): New method.
8387         (General_options::endianness_): New data member.
8388         * parameters.cc (Parameters::set_options): Check target endianness.
8389         (Parameters::set_target_once): Ditto.
8390         (Parameters::check_target_endianness): New method.
8391         (parameters_force_valid_target): If either -EL or -EB is specified,
8392         use it to define endianness of default target.
8393         * parameters.h (Parameters::check_target_endianness): New method
8394         declaration.
8395         * target.h (class Target): Change "endianity" to "endianness"
8396         in comments.
8397
8398 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8399
8400         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
8401         * configure: Regenerate.
8402         * Makefile.in: Regenerate.
8403         * testsuite/Makefile.in: Regenerate.
8404
8405 2010-04-06  Cary Coutant  <ccoutant@google.com>
8406
8407         gcc PR lto/42757
8408         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
8409         prevailing definitions of common symbols.
8410         * testsuite/plugin_test_6.sh: New test case.
8411         * testsuite/plugin_common_test_1.c: New test case.
8412         * testsuite/plugin_common_test_2.c: New test case.
8413         * testsuite/Makefile.am (plugin_test_6): New test case.
8414         * testsuite/Makefile.in: Regenerate.
8415
8416 2010-04-06  Nick Clifton  <nickc@redhat.com>
8417
8418         * po/vi.po: New Vietnamese translation.
8419
8420 2010-03-30  Doug Kwan  <dougkwan@google.com>
8421
8422         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
8423
8424 2010-03-25  Doug Kwan  <dougkwan@google.com>
8425
8426         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
8427         to avoid a conversion warning on a 32-bit host.
8428
8429 2010-03-24  Ian Lance Taylor  <iant@google.com>
8430
8431         * testsuite/script_test_3.t: Add a TLS segment.
8432         * testsuite/Makefile.am (check_PROGRAMS): Add
8433         tls_phdrs_script_test.
8434         (tls_phdrs_script_test_SOURCES): Define.
8435         (tls_phdrs_script_test_DEPENDENCIES): Define.
8436         (tls_phdrs_script_test_LDFLAGS): Define.
8437         (tls_phdrs_script_test_LDADD): Define.
8438         * testsuite/Makefile.in: Rebuild.
8439
8440 2010-03-23  Cary Coutant  <ccoutant@google.com>
8441
8442         * fileread.cc (find_or_make_view): Fix comment.
8443
8444 2010-03-23  Ian Lance Taylor  <iant@google.com>
8445
8446         * script-sections.cc (class Orphan_section_placement): Define
8447         PLACE_TLS and PLACE_TLS_BSS.
8448         (Orphan_section_placement::Orphan_section_placement): Initialize
8449         new places.
8450         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
8451         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
8452         (tls_script_test_SOURCES): Define.
8453         (tls_script_test_DEPENDENCIES): Define.
8454         (tls_script_test_LDFLAGS): Define.
8455         (tls_script_test_LDADD): Define.
8456         * testsuite/Makefile.in: Rebuild.
8457
8458 2010-03-22  Doug Kwan  <dougkwan@google.com>
8459
8460         * arm.cc (Arm_relocate_functions::abs8,
8461         Arm_relocate_functions::abs16): Use correct check for overflow
8462         specified in the ARM ELF specs.
8463         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
8464         target of a BLX instruction specially.
8465         (Reloc_stub::stub_type_for_reloc): Ditto.
8466         (Relocate::relocate): Use symbolic names instead of numeric relocation
8467         codes to report error.
8468         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
8469         workaround.
8470         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
8471         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
8472         thumb2_blx_out_of_range.stdout
8473         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
8474         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
8475         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
8476         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
8477         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
8478         thumb2_blx_in_range, thumb2_blx_in_range.o,
8479         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
8480         thumb2_blx_out_of_range.o): New rules.
8481         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
8482         thumb2_blx_in_range and thumb2_blx_out_of_range.
8483         * testsuite/Makefile.in: Regenerate.
8484         * arm_branch_in_range.sh: Add tests for THUMB BLX.
8485         * testsuite/thumb_blx_in_range.s: New file.
8486         * testsuite/thumb_blx_out_of_range.s: New file.
8487
8488 2010-03-22  Rafael Espindola  <espindola@google.com>
8489
8490         * archive.cc (Should_include): Move to archive.h.
8491         (should_include_member): Make it a member of Archive.
8492         (Lib_group): New.
8493         (Add_lib_group_symbols): New.
8494         * archive.h: Include options.h.
8495         (Archive_member): Moved from Archive.
8496         (Should_include): Moved from archive.cc.
8497         (Lib_group): New.
8498         (Add_lib_group_symbols): New.
8499         * dynobj.cc (do_should_include_member): New.
8500         * dynobj.h (do_should_include_member): New.
8501         * gold.cc (queue_initial_tasks): Update call to queue.
8502         * main.cc (main): Print lib group stats.
8503         * object.cc (do_should_include_member): New.
8504         * object.h: Include archive.h.
8505         (Object::should_include_member): New.
8506         (Object::do_should_include_member): New.
8507         (Sized_relobj::do_should_include_member): New.
8508         * options.cc (General_options::parse_start_lib): New.
8509         (General_options::parse_end_lib): New.
8510         (Input_arguments::add_file): Handle lib groups.
8511         (Input_arguments::start_group): Check we are not in a lib.
8512         (Input_arguments::start_lib): New.
8513         (Input_arguments::end_lib): New.
8514         * options.h (General_options): Add start_lib and end_lib.
8515         (Input_argument::lib_): New.
8516         (Input_argument::lib): New.
8517         (Input_argument::is_lib): New.
8518         (Input_file_lib): New.
8519         (Input_arguments::in_lib_): New.
8520         (Input_arguments::in_lib): New.
8521         (Input_arguments::start_lib): New.
8522         (Input_arguments::end_lib_): New.
8523         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
8524         in unused members as preempted.
8525         (Sized_pluginobj::do_should_include_member): New.
8526         * plugin.h (Sized_pluginobj::do_should_include_member): New.
8527         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
8528         return the blocker.
8529         (Read_symbols::do_whole_lib_group): New.
8530         (Read_symbols::do_lib_group): New.
8531         (Read_symbols::do_read_symbols): Handle lib groups.
8532         (Read_symbols::get_name): Handle lib groups.
8533         * readsyms.h (Read_symbols): Add an archive member pointer.
8534         (Read_symbols::do_whole_lib_group): New.
8535         (Read_symbols::do_lib_group): New.
8536         (Read_symbols::member_): New.
8537         * script.cc (read_input_script): Update call to queue_soon.
8538
8539 2010-03-19  Doug Kwan  <dougkwan@google.com>
8540
8541         * arm.cc (Stub_table::Stub_table): Initialize new data members
8542         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
8543         (Stub_table::add_reloc_stub): Assign stub offset and update
8544         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
8545         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
8546         New data members.
8547         (Stub_table::update_data_size_and_addralign): Use
8548         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
8549         instead of going over all reloc stubs.
8550         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
8551         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
8552         Stringpool_template::offset_ to size of Stringpool_char.
8553         (Stringpool_template::new_key_offset): Remove code to initialize
8554         Stringpool_template::offset_.
8555         * stringpool.h (Stringpool_template::set_no_zero_null): Set
8556         Stringpool_template::offset_ to zero.
8557
8558 2010-03-15  Doug Kwan  <dougkwan@google.com>
8559
8560         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
8561         offset_.
8562         (Stringpool_template::new_key_offset): New method.
8563         (Stringpool_template::add_string): Assign offsets when adding new
8564         strings.
8565         (Stringpool_template::set_string_offsets): Do not set string offsets
8566         when not optimizing.
8567         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
8568         member size_.
8569         (Chunked_vector::clear): Clear size_.
8570         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
8571         (Chunked_vector::size): Return size_.
8572         (Chunked_vector::push_back): Use size_ to find insert position.
8573         (Chunked_vector::size_): New data member.
8574         (Stringpool_template::set_no_zero_null): Assert string set is empty.
8575         (Stringpool_template::new_key_offset): New method declaration.
8576         (Stringpool_template::offset_): New data member.
8577
8578 2010-03-15   Rafael Espindola  <espindola@google.com>
8579
8580         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
8581         Add_symbols' constructor.
8582         * readsyms.h (Add_symbols): Remove the input_group member.
8583
8584 2010-03-10  Ian Lance Taylor  <iant@google.com>
8585
8586         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
8587         target to ask whether a reference to a symbol requires a stack
8588         split.
8589         * target.h (Target::is_call_to_non_split): New function.
8590         (Target::do_is_call_to_non_split): Declare virtual function.
8591         * target.cc: Include "symtab.h".
8592         (Target::do_is_call_to_non_split): New function.
8593         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
8594
8595 2010-03-10  Cary Coutant  <ccoutant@google.com>
8596
8597         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
8598         (File_read::open[1]): Remove initial mapping of whole_file_view_.
8599         (File_read::open[2]): Add whole_file_view_ to list of views.
8600         (File_read::make_view): Remove test of whole_file_view_.
8601         (File_read::find_or_make_view): Create whole_file_view_ if
8602         necessary.
8603         (File_read::clear_views): Replace bool parameter with enum;
8604         adjust all callers.  Don't delete views with permanent data;
8605         do delete cached views and views from archives if
8606         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
8607         if clearing the corresponding view.
8608         * fileread.h (File_read::Clear_views_mode): New enum.
8609         (File_read::View::is_permanent_view): New method.
8610         (File_read::clear_views): Replace bool parameter
8611         with enum; adjust all callers.
8612         * options.h (General_options): Change keep_files_mapped option;
8613         add map_whole_files.
8614         * readsyms.cc (Add_symbols::run): Delete sd_ object before
8615         releasing the file.
8616         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
8617         the file.
8618
8619 2010-03-10  David S. Miller  <davem@davemloft.net>
8620
8621         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
8622
8623 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
8624
8625         * icf.cc (get_section_contents): Add '@' marker after processing the
8626         merge reloc.
8627
8628 2010-03-08  Doug Kwan  <dougkwan@google.com>
8629
8630         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
8631         due to a conversion warning.
8632         (Arm_relobj::update_output_local_symbol_count): Check for local
8633         symbol with unset output index.
8634
8635 2010-03-05  Ian Lance Taylor  <iant@google.com>
8636
8637         * options.h (class General_options): Add --spare-dynamic-tags.
8638         * output.cc (Output_data_dynamic::set_final_data_size): Implement
8639         --spare-dynamic-tags.
8640
8641 2010-03-05  Ian Lance Taylor  <iant@google.com>
8642
8643         * incremental.cc: Include "libiberty.h".
8644
8645 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
8646
8647         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
8648         function, is_info_ member.
8649         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
8650         (Versions::Versions): Update caller.
8651         (Versions::define_base_version): Likewise.
8652         (Versions::add_def): Likewise.
8653
8654 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
8655
8656         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
8657         (Scan::possible_function_pointer_reloc): New function.
8658         (Scan::local_reloc_may_be_function_pointer): Change to call
8659         possible_function_pointer_reloc.
8660         (Scan::global_reloc_may_be_function_pointer): Ditto.
8661         * icf.h (Icf::check_section_for_function_pointers): Change to reject
8662         relocations in ".data.rel.ro._ZTV" section.
8663         * testsuite/icf_safe_so_test.sh: Change to pass i386.
8664         * testsuite/icf_safe_so_test.cc: Ditto.
8665         * testsuite/icf_safe_test.cc: Ditto.
8666         * testsuite/icf_safe_test.sh: Ditto.
8667
8668 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8669             Ian Lance Taylor  <iant@google.com>
8670
8671         * target-reloc.h (relocate_section): Check the symbol table index
8672         for -1U before setting the local symbol index.
8673         (scan_relocatable_relocs): If copying the relocation, record that
8674         the local symbol is required.
8675         * object.h (Symbol_value::is_output_symtab_index_set): New
8676         function.
8677         (Symbol_value::may_be_discarded_from_output_symtab): New
8678         function.
8679         (Symbol_value::has_output_symtab_entry): New function.
8680         (Symbol_value::needs_output_symtab_entry): Remove.
8681         (Symbol_value::output_symtab_index): Make sure the symbol index is
8682         set.
8683         (Symbol_value::set_output_symtab_index): Make sure the symbol
8684         index is not set.  Make sure the new index is valid.
8685         (Symbol_value::set_must_have_output_symtab_entry): New function.
8686         (Symbol_value::has_output_dynsym_entry): New function.
8687         (Symbol_value::set_output_dynsym_index): Make sure the new index
8688         is valid.
8689         (Sized_relobj::set_must_have_output_symtab_entry): New function.
8690         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
8691         local symbol if permitted.
8692         (Sized_relobj::do_finalize_local_symbols): Call
8693         is_output_symtab_index_set rather than needs_output_symtab_entry.
8694         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
8695         rather than needs_output_symtab_entry.  Call
8696         has_output_dynsym_entry rather than needs_output_dynsym_entry.
8697         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
8698         is_output_symtab_index_set rather than needs_output_symtab_entry.
8699         * testsuite/discard_locals_relocatable_test.c: New file.
8700         * testsuite/discard_locals_test.sh: Test -r.
8701         * testsuite/Makefile.am (check_DATA): Add
8702         discard_locals_relocatable_test1.syms,
8703         discard_local_relocatable_test2.syms.
8704         (MOSTLYCLEANFILES): Likewise.  Also add
8705         discard_locals_relocatable_test1.lout and
8706         discard_locals_relocatable_test2.out.
8707         (discard_locals_relocatable_test1.syms): New target.
8708         (discard_locals_relocatable_test.o): New target.
8709         (discard_locals_relocatable_test1.out): New target.
8710         (discard_locals_relocatable_test2.syms): New target.
8711         (discard_locals_relocatable_test2.out): New target.
8712         (various): Add missing ../ld-new dependencies.
8713         * testsuite/Makefile.in: Rebuild.
8714
8715 2010-03-03  Nick Clifton  <nickc@redhat.com>
8716
8717         * po/fi.po: New Finnish translation.
8718
8719 2010-03-01  Doug Kwan  <dougkwan@google.com>
8720
8721         * layout.cc (Layout::Layout): Force section types of .init_array*,
8722         .preinit_array* and .fini_array* sections.
8723         * output.cc (Output_section::Input_section_sort_entry::has_priority):
8724         Fix check of return value of std::string::find.().
8725         (Output_section::Input_section_sort_compare::operator()): Remove
8726         comment about .init_array.
8727         (Output_section::Input_section_sort_init_fini_compare::operator()):
8728         New method.
8729         (Output_section::sort_attached_input_sections): Handle .init_array
8730         and .fini_array specially.
8731         * output.h (Output_section::Inut_section_sort_compare): Update
8732         comment.
8733         (Output_section::Input_section_sort_init_fini_compare): New struct.
8734
8735 2010-02-26  Doug Kwan  <dougkwan@google.com>
8736
8737         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
8738         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
8739         * testsuite/debug_msg.sh: Avoid matching source line number for
8740         use of global variable undef_int.
8741
8742 2010-02-26  Doug Kwan  <dougkwan@google.com>
8743
8744         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
8745         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
8746         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
8747         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
8748         * options.cc (General_options::General_options): Initialize member
8749         fix_v4bx_.
8750         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
8751         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
8752         and rm_no_fix_v4bx.stdout
8753         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
8754         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
8755         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
8756         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
8757         and arm_no_fix_v4bx.
8758         * Makefile.in: Regenerate.
8759         * testsuite/arm_fix_v4bx.s: New file.
8760         * testsuite/arm_fix_v4bx.sh: Ditto.
8761
8762 2010-02-24  Doug Kwan  <dougkwan@google.com>
8763
8764         * arm.cc (Target_arm::got_section): Make the .got section the first
8765         non RELRO section in the data segment.
8766         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
8767         suffixes of section names.
8768
8769 2010-02-24  Doug Kwan  <dougkwan@google.com>
8770
8771         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
8772         flags and attributes merging if an input file is a binary file.
8773         * fileread.cc (Input_file::open): Record format of original file.
8774         * fileread.h (Input_file::Format): New enum type.
8775         (Input_file::Input_file): Initialize data member format_.
8776         (Input_file::format): New method definition.
8777         (Input_file::format_):: New data member.
8778
8779 2010-02-24  Doug Kwan  <dougkwan@google.com>
8780
8781         * arm.cc (Arm_output_data_got): New class.
8782         (ARM_TCB_SIZE): New constant
8783         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
8784         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
8785         If user uses a script with a SECTIONS clause, issue only a warning
8786         for a misplaced EXIDX input section.  Otherwise, issue an error.
8787         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
8788         garbage collection.
8789         (Target_arm::got_mode_index_entry): Handle static linking.
8790         (Target_arm::Scan::local): Ditto.
8791         (Target_arm::Scan::global): Ditto.
8792         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
8793         all incorrectly implemented relocations.
8794         (Target_arm::fix_exidx_coverage): Pass layout to
8795         Arm_output_section::fix_exidx_coverage.
8796         * layout.cc (Layout::section_name_mapping): Remove trailing dots
8797         from ".ARM.exidx." and ".ARM.extab.".
8798
8799 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8800
8801         * arm.cc (Target_arm::do_finalize_sections): Create attribute
8802         section if it does not already exist.
8803         * attributes.cc (Attributes_section_data::Attributes_section_data):
8804         Don't crash if size is zero.
8805
8806 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8807             Ian Lance Taylor  <iant@google.com>
8808
8809         * gold.cc (queue_middle_tasks): If no input files were opened,
8810         exit.
8811         * workqueue.h (Task_function::Task_function): Assert that there is
8812         a blocker.
8813
8814 2010-02-22  Doug Kwan  <dougkwan@google.com>
8815
8816         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
8817         * icf.cc (get_section_contents): Cast snprintf arguments to long long
8818         types to avoid warnings due to different uint64_t implementations
8819         on different hosts.
8820
8821 2010-02-21  Doug Kwan  <dougkwan@google.com>
8822
8823         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
8824         handling of the maximum backward branch offset.
8825         (Arm_relocate_functions::thumb_branch_common): Ditto.
8826         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
8827         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
8828         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
8829         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
8830         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
8831         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
8832         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
8833         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
8834         thumb_bl_out_of_range thumb_bl_out_of_range.o,
8835         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
8836         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
8837         thumb2_bl_out_of_range.o): New rules.
8838         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
8839         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
8840         thumb2_bl_out_of_range
8841         * testsuite/Makefile.in: Regenerate.
8842         * testsuite/arm_bl_in_range.s: New file.
8843         * testsuite/arm_bl_out_of_range.s: Ditto.
8844         * testsuite/arm_branch_in_range.sh: Ditto.
8845         * testsuite/arm_branch_range.t: Ditto.
8846         * testsuite/thumb2_branch_range.t: Ditto.
8847         * testsuite/thumb_bl_in_range.s: Ditto.
8848         * testsuite/thumb_bl_out_of_range.s: Ditto.
8849         * testsuite/thumb_branch_range.t: Ditto.
8850
8851 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
8852
8853         * gc.h (gc_process_relocs): Change vectors to point to the new list.
8854         Add reloc offset information.
8855         * icf.cc (get_section_contents): Change iterators to point to the new
8856         vectors. Add reloc offset information to the contents.
8857         * icf.h (Icf::Sections_reachable_info): New typedef.
8858         (Icf::Sections_reachable_list): New typedef.
8859         (Icf::Offset_info): New typedef.
8860         (Icf::Reloc_info): New struct typedef.
8861         (Icf::Reloc_info_list): New typedef.
8862         (Icf::symbol_reloc_list): Delete method.
8863         (Icf::addend_reloc_list): Delete method.
8864         (Icf::section_reloc_list): Delete method.
8865         (Icf::reloc_info_list): New method.
8866         (Icf::reloc_info_list_): New member.
8867
8868 2010-02-19  Doug Kwan  <dougkwan@google.com>
8869
8870         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
8871         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
8872         * arm.cc (Arm_relocation_functions): New forward declaration.
8873         (Target_arm::Target_arm): Initialize new data members
8874         got_mod_index_offset_ and tls_base_symbol_defined_.
8875         (Target_arm::Relocate::relocate_tls): New method.
8876         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
8877          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
8878         New methods.
8879         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
8880         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
8881         (Target_arm::got_mod_index_offset_,
8882         Target_arm::tls_base_symbol_defined_): New data members.
8883         (Target_arm::Scan::local, Target::Scan::global,
8884         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
8885         relocations.
8886
8887 2010-02-18  Doug Kwan  <dougkwan@google.com>
8888
8889         * arm.cc (Arm_relobj::find_linked_text_section): New method.
8890         (Arm_relobj::make_exidx_input_section): Pass section index of linked
8891         text section as a parameter becuase some broken tools may not set
8892         the link in section header.
8893         (Target_arm::has_got_section): New method.
8894         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
8895         without any mapping symbol as data only.  Remove warning.
8896         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
8897         link in its section header, try to discover the link by inspecting the
8898         REL31 relocation at the beginning of the section.
8899         (Target_arm::Scan::check_non_pic): Report name of offending relocation
8900         in error message.
8901         (Target_arm::Scan::global): Treat any reference to the symbol
8902         _GLOBAL_OFFSET_TABLE_ as a GOT access.
8903
8904 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
8905
8906         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
8907         (Scan::global_reloc_may_be_function_pointer): New function.
8908         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
8909         (Scan::global_reloc_may_be_function_pointer): New function.
8910         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
8911         (Scan::global_reloc_may_be_function_pointer): New function.
8912         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
8913         (Scan::global_reloc_may_be_function_pointer): New function.
8914         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
8915         (Scan::global_reloc_may_be_function_pointer): New function.
8916         (Scan::possible_function_pointer_reloc): New function.
8917         (Target_x86_64::can_check_for_function_pointers): New function.
8918         * gc.h (gc_process_relocs): Scan relocation types to determine if
8919         function pointers were taken for targets that support it.
8920         * icf.cc (Icf::find_identical_sections): Include functions for
8921         folding in safe ICF whose pointer is not taken.
8922         * icf.h (Secn_fptr_taken_set): New typedef.
8923         (fptr_section_id_): New member.
8924         (section_has_function_pointers): New function.
8925         (set_section_has_function_pointers): New function.
8926         (check_section_for_function_pointers): New function.
8927         * options.h: Fix comment for safe ICF option.
8928         * target.h (can_check_for_function_pointers): New function.
8929         * testsuite/Makefile.am: Add icf_safe_so_test test case.
8930         Modify icf_safe_test for X86-64.
8931         * testsuite/Makefile.in: Regenerate.
8932         * testsuite/icf_safe_so_test.cc: New file.
8933         * testsuite/icf_safe_so_test.sh: New file.
8934         * testsuite/icf_safe_test.cc (kept_func_3): New function.
8935         (main): Change to take pointer to function kept_func_3.
8936         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
8937         folding is done correctly for X86-64.
8938
8939 2010-02-12  David S. Miller  <davem@davemloft.net>
8940
8941         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
8942         is_symbolless parameter.
8943         (Output_reloc<SHT_REL>::is_symbolless): New.
8944         (Output_reloc<SHT_REL>::is_symbolless_): New.
8945         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
8946         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
8947         (Output_reloc<SHT_RELA>::is_symbolless): New.
8948         (Output_data_reloc::add_global): Handle is_symbolless.
8949         (Output_data_reloc::add_global_relative): Likewise.
8950         (Output_data_reloc::add_local): Likewise.
8951         (Output_data_reloc::add_local_relative): Likewise.
8952         (Output_data_reloc::add_symbolless_global_addend): New.
8953         (Output_data_reloc::add_symbolless_local_addend): New.
8954         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
8955         is_symbolless.
8956         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
8957         instead of ->is_relative_
8958         (Output_reloc::write): Likewise.
8959         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
8960         (Output_reloc::write_rel): Simplify.
8961
8962         * sparc.cc (Target_sparc::Scan::local): Use
8963         ->add_symbolless_local_addend as needed.
8964         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
8965         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
8966         based upon relocation offset.
8967
8968 2010-02-11  Doug Kwan  <dougkwan@google.com>
8969
8970         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
8971         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
8972         beginning of function.
8973         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
8974         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
8975         parameter is_32bit in calls to should_apply_static_reloc.
8976         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
8977         (check_DATA): Add arm_abs_global.stdout.
8978         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
8979         arm_abs_global.stdout): New rules.
8980         (MOSTLLYCLEANFILES): Add arm_abs_global
8981         * Makefile.in: Regenerate.
8982         * testsuite/arm_abs_global.s: New file.
8983         * testsuite/arm_abs_global.sh: Ditto.
8984         * testsuite/arm_abs_lib.s: Ditto.
8985
8986 2010-02-11  Ian Lance Taylor  <iant@google.com>
8987
8988         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
8989         Read_relocs task.
8990         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
8991         Allocate_commons_task first.
8992         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
8993         task, rather than symtab_lock_.
8994         (Gc_process_relocs::~Gc_process_relocs): New function.
8995         (Gc_process_relocs::is_runnable): Check this_blocker_.
8996         (Gc_process_relocs::locks): Use next_blocker_ rather than
8997         blocker_.
8998         (Scan_relocs::~Scan_relocs): New function.
8999         (Scan_relocs::is_runnable): Check this_blocker_ rather than
9000         symtab_lock_.
9001         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
9002         next_blocker_.
9003         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
9004         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
9005         constructor accordingly.
9006         (class Gc_process_relocs): Likewise.
9007         (class Scan_relocs): Likewise.
9008         * common.h (class Allocate_commons_task): Remove symtab_lock_
9009         field, and corresponding constructor parameter.
9010         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
9011         symtab_lock_.
9012         (Allocate_commons_task::locks): Likewise.
9013
9014 2010-02-11  Ian Lance Taylor  <iant@google.com>
9015
9016         * gold-threads.h (class Once): Define.
9017         (class Initialize_lock): Rewrite as child of Once.
9018         * gold-threads.cc (class Once_initialize): Define.
9019         (once_pointer_control): New static variable.
9020         (once_pointer, once_arg): New static variables.
9021         (c_run_once): New static function.
9022         (Once::Once, Once::run_once, Once::internal_run): New functions.
9023         (class Initialize_lock_once): Remove.
9024         (initialize_lock_control): Remove.
9025         (initialize_lock_pointer): Remove.
9026         (initialize_lock_once): Remove.
9027         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
9028         (Initialize_lock::initialize): Rewrite.
9029         (Initialize_lock::do_run_once): New function.
9030         * archive.cc (Archive::interpret_header): Only clear name if it is
9031         not already empty.
9032         * fileread.cc: Include "gold-threads.h"
9033         (file_counts_lock): New static variable.
9034         (file_counts_initialize_lock): Likewise.
9035         (File_read::release): Only increment counts when using --stats.
9036         Use a lock around the increment.
9037         * parameters.cc (class Set_parameters_target_once): Define.
9038         (set_parameters_target_once): New static variable.
9039         (Parameters::Parameters): Move here from parameters.h.
9040         (Parameters::set_target): Rewrite.
9041         (Parameters::set_target_once): New function.
9042         (Parameters::clear_target): Move here and rewrite.
9043         * parameters.h (class Parameters): Update declarations.  Add
9044         set_parameters_target_once_ field.
9045         (Parameters::Parameters): Move to parameters.cc.
9046         (Parameters::clear_target): Likewise.
9047         * readsyms.cc (Read_symbols::do_group): Create a Start_group
9048         task.
9049         (Start_group::~Start_group): New function.
9050         (Start_group::is_runnable): New function.
9051         (Start_group::locks, Start_group::run): New functions.
9052         (Finish_group::run): Change saw_undefined to size_t.
9053         * readsyms.h (class Start_group): Define.
9054         (class Finish_group): Change saw_undefined_ field to size_t.
9055         (Finish_group::Finish_group): Remove saw_undefined and
9056         this_blocker parameters.  Change all callers.
9057         (Finish_group::set_saw_undefined): New function.
9058         (Finish_group::set_blocker): New function.
9059         * symtab.h (class Symbol_table): Change saw_undefined to return
9060         size_t.  Change saw_undefined_ field to size_t.
9061         * target-select.cc (Set_target_once::do_run_once): New function.
9062         (Target_selector::Target_selector): Initialize set_target_once_
9063         field.  Don't initialize lock_ and initialize_lock_ fields.
9064         (Target_selector::instantiate_target): Rewrite.
9065         (Target_selector::set_target): New function.
9066         * target-select.h (class Set_target_once): Define.
9067         (class Target_selector): Update declarations.  Make
9068         Set_target_once a friend.  Remove lock_ and initialize_lock_
9069         fields.  Add set_target_once_ field.
9070
9071 2010-02-10  Ian Lance Taylor  <iant@google.com>
9072
9073         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
9074         queueing any tasks.
9075         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
9076         (queue_middle_tasks): Add all blockers before queueing any tasks.
9077         (queue_final_tasks): Likewise.
9078         * token.h (Task_token::add_blockers): New function.
9079         * object.h (Input_objects::number_of_relobjs): New function.
9080
9081 2010-02-10  Ian Lance Taylor  <iant@google.com>
9082
9083         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
9084         shared, not if not position independent.
9085         * x86_64.cc (Relocate::relocate_tls): Likewise.
9086         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
9087         (tls_pie_pic_test): New target.
9088         * testsuite/Makefile.in: Rebuild.
9089
9090         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
9091         (tls_test_main_pie.o, tls_test_pie.o): New targets.
9092         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
9093         * testsuite/Makefile.in: Rebuild.
9094
9095 2010-02-09  David S. Miller  <davem@davemloft.net>
9096
9097         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
9098         R_SPARC_RELATIVE using ->add_local_relative().
9099         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
9100
9101         * output.h (Output_data_dynamic::add_section_size): New method
9102         that takes two Output_data objects.
9103         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
9104         entry param.  Handle it in initializers.
9105         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
9106         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
9107         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
9108         arg.
9109         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
9110         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
9111         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
9112         for dynrel_includes_plt.
9113         * i386.cc (Target_i386::do_finalize_sections): Likewise.
9114         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
9115         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
9116         before .rela.plt
9117         (Target_sparc::do_finalize_sections): Update to pass true for
9118         dynrel_includes_plt.
9119         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
9120         output before .rela.plt
9121         (Target_powerpc::do_finalize_sections): Update to pass true for
9122         dynrel_includes_plt when 32-bit.
9123
9124 2010-02-08  Doug Kwan  <dougkwan@google.com>
9125
9126         * arm.cc (Arm_relobj::simple_input_section_output_address): New
9127         method.
9128         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
9129         Arm_relobj::scan_section_for_cortex_a8_stubs,
9130         Arm_relobj::do_relocation_section): Instead of calling
9131         Output_section::output_address, use faster
9132         Arm_relobj::simple_input_section_output_address.
9133
9134 2010-02-08  David S. Miller  <davem@davemloft.net>
9135
9136         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
9137         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
9138         relocation helper function.
9139
9140         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
9141         just like R_SPARC_GOT{10,13,22}.
9142         (Target_sparc::Scan::local): Likewise.
9143         (Target_sparc::Relocate:relocate): Likewise.
9144
9145 2010-02-06  Ian Lance Taylor  <iant@google.com>
9146
9147         * configure.ac: Rewrite targetobjs duplicate removal code to use
9148         only shell constructs.
9149         * configure: Rebuild.
9150
9151 2010-02-05  Doug Kwan  <dougkwan@google.com>
9152
9153         PR 11247
9154         * arm.cc (Arm_relobj::section_is_scannable): New method.
9155         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
9156         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
9157
9158 2010-02-04  Doug Kwan  <dougkwan@google.com>
9159
9160         PR 11247
9161         * arm-reloc-property.cc (cstdio): Include.
9162         * configure.ac (targetobjs): Remove duplicates.
9163         * configure: Regenerate.
9164         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
9165         big and little endian version for a given address size.
9166
9167 2010-02-03  Doug Kwan  <dougkwan@google.com>
9168
9169         * arm-reloc-property.cc
9170         (Arm_reloc_property_table::reloc_name_in_error_message): New method
9171         definition.
9172         * arm-reloc-property.h
9173         (Arm_reloc_property_table::get_implemented_static_reloc_property):
9174         New method definition.
9175         (Arm_reloc_property_table::reloc_name_in_error_message): New method
9176         declaration.
9177         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
9178         overflow to N.
9179         (GOT_PREL): Change implemented to Y.
9180         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
9181         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
9182         (Arm_relocate_functions::movw_abs_nc): Remove method.
9183         (Arm_relocate_functions::movt_abs): Ditto.
9184         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
9185         (Arm_relocate_functions::thm_movt_abs): Ditto.
9186         (Arm_relocate_functions::movw_rel_nc): Ditto.
9187         (Arm_relocate_functions::movw_rel): Ditto.
9188         (Arm_relocate_functions::movt_rel): Ditto.
9189         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
9190         (Arm_relocate_functions:thm_movw_rel): Ditto.
9191         (Arm_relocate_functions:thm_movt_rel): Ditto.
9192         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
9193         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
9194         New method definitions.
9195         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
9196         (Arm_relocation_functions::arm_grp_ldr): Ditto.
9197         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
9198         (Arm_relocation_functions::arm_grp_ldc): Ditto.
9199         (Target_arm::Relocate::relocate): Check for non-static or
9200         unimplemented relocation code and exit early.  Change calls to
9201         Target_arm::reloc_uses_thumb_bit and
9202         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
9203         instead.  Refactor code to handle similar relocations to increase
9204         code sharing.  Remove check for unsupported relocation code in switch
9205         statement.
9206         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
9207         relocation property table to find out size.  Change error message to
9208         print out the name of a relocation code instead of the numeric value.
9209         (Target_arm::scan_reloc_for_stub): Use relocation property table
9210         instead of calling Target_arm::reloc_uses_thumb_bit().
9211
9212 2010-02-02  Doug Kwan  <dougkwan@google.com>
9213
9214         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
9215         types of relaxed input section.
9216
9217 2010-02-02  Doug Kwan  <dougkwan@google.com>
9218
9219         * Makefile.am (HFILES): Add arm-reloc-property.h.
9220         (DEFFILES): New.
9221         (TARGETSOURCES): Add arm-reloc-property.cc
9222         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
9223         (libgold_a_SOURCES): $(DEFFILES)
9224         * Makefile.in: Regenerate.
9225         * arm-reloc-property.cc: New file.
9226         * arm-reloc-property.h: New file.
9227         * arm-reloc.def: New file.
9228         * arm.cc: Update comments.
9229         (arm-reloc-property.h): New included header.
9230         (arm_reloc_property_table): New global variable.
9231         (Target_arm::do_select_as_default_target): New method definition.
9232         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
9233         arm-reloc-property to targ_extra_obj.
9234         * parameters.cc (set_parameters_target): Call
9235         Target::select_as_default_target().
9236         * target.h (Target::select_as_default_target): New method definition.
9237         (Target::do_select_as_default_target): Same.
9238
9239 2010-02-01  Doug Kwan  <dougkwan@google.com>
9240
9241         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
9242         first_output_text_section_.
9243         (Arm_exidx_fixup::first_output_text_section): New method definition.
9244         (Arm_exidx_fixup::first_output_text_section_): New data member.
9245         (Arm_exidx_fixup::process_exidx_section): Record the first text
9246         output section seen.
9247         (Arm_output_section::fix_exidx_coverage): Set correct linked section
9248         and entsize in output section header.
9249
9250 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9251
9252         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
9253         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
9254         (Arm_relocate_functions::thm_alu11): New Method.
9255         (Arm_relocate_functions::thm_pc8): New Method.
9256         (Arm_relocate_functions::thm_pc12): New Method.
9257         (Target_arm::Scan::local): Handle the relocations.
9258         (Target_arm::Scan::global): Likewise.
9259         (Target_arm::Relocate::relocate): Likewise.
9260         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9261
9262 2010-01-29  Doug Kwan  <dougkwan@google.com>
9263
9264         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
9265         of relocation types as ld.
9266
9267 2010-01-29  Doug Kwan  <dougkwan@google.com>
9268
9269         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
9270         to public.
9271         (Arm_relocate_functions::thumb_branch_common): Ditto.
9272         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
9273         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
9274         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
9275         Arm_relocate_functions::jump24): Remove.
9276         (Target_arm::Relocate::relocate): Adjust code to call
9277         Arm_relocation_functions::arm_branch_common and
9278         Arm_relocation_functions::thumb_branch_common instead of their removed
9279         wrappers.  Merge switch-cases together to reduce source code size.
9280
9281 2010-01-29  Doug Kwan  <dougkwan@google.com>
9282
9283         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
9284         output_local_symbol_count_needs_update_.
9285         (Arm_relobj::output_local_symbol_count_needs_update,
9286          Arm_relobj::set_output_local_symbol_count_needs_update,
9287          Arm_relobj::update_output_local_symbol_count): New methods.
9288         (Arm_relobj::output_local_symbol_count_needs_update_): New data
9289         member.
9290         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
9291         of pointed function as in a R_ARM_PREL31 relocation.
9292         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
9293         for output local symbol count updating.
9294         (Target_arm::do_relax): Update output local symbol counts in objects
9295         if necessary.
9296         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
9297
9298 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9299
9300         * arm.cc: Added support for the ARM relocations:
9301         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
9302         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
9303         (Arm_relocate_functions::movw_rel_nc): Renamed (was
9304         movw_prel_nc).
9305         (Arm_relocate_functions::movw_rel): New method.
9306         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
9307         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
9308         thm_movw_prel_nc).
9309         (Arm_relocate_functions::thm_movw_rel): New method.
9310         (Arm_relocate_functions::thm_movt_rel): Renamed (was
9311         thm_movt_prel).
9312         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
9313         relocations.
9314         (Target_arm::Scan::global): Likewise.
9315         (Target_arm::Relocate::relocate): Likewise.
9316         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9317         Likewise.
9318
9319 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9320
9321         * arm.cc: Added support for ARM group relocations.
9322         (Target_arm::reloc_needs_sym_origin): New method.
9323         (Arm_relocate_functions::calc_grp_kn): New method.
9324         (Arm_relocate_functions::calc_grp_residual): New method.
9325         (Arm_relocate_functions::calc_grp_gn): New method.
9326         (Arm_relocate_functions::arm_grp_alu): New Method.
9327         (Arm_relocate_functions::arm_grp_ldr): New Method.
9328         (Arm_relocate_functions::arm_grp_ldrs): New Method.
9329         (Arm_relocate_functions::arm_grp_ldc): New Method.
9330         (Target_arm::Scan::local): Handle the ARM group relocations.
9331         (Target_arm::Scan::global): Likewise.
9332         (Target_arm::Relocate::relocate): Likewise.
9333         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9334         Likewise.
9335
9336 2010-01-26  Doug Kwan  <dougkwan@google.com>
9337
9338         * arm.cc (set): Include.
9339         (class Arm_exidx_fixup): Change type of last_input_section_ to const
9340         pointer type.
9341         (Arm_output_section::Text_section_list): New type.
9342         (Arm_output_section::append_text_sections_to_list): New method.
9343         (Arm_output_section::fix_exidx_coverage): Ditto.
9344         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
9345         (Arm_relobj::convert_input_section_to_relaxed_section): Use
9346         Relobj::set_section_offset() instead of
9347         Sized_relobj::invalidate_section_offset().
9348         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
9349         parameter for section headers. Ignore relocation sections for
9350         unallocated sections and EXIDX sections.
9351         (Target_arm::fix_exidx_coverage): New method.
9352         (Target_arm::output_section_address_less_than): New type.
9353         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
9354         linked text section instead of the EXIDX section.
9355         (Arm_output_section::create_stub_group): Add an assertion to check
9356         that this is not an EXIDX output section.
9357         (Arm_output_section::append_text_sections_to_list): New method.
9358         (Arm_output_section::fix_exidx_coverage): Ditto.
9359         (Arm_relobj::scan_sections_for_stubs): Adjust call to
9360         Arm_relobj::section_needs_reloc_stub_scanning.
9361         (Target_arm::do_relax): Fix EXIDX output section coverage in the
9362         first pass.
9363         (Target_arm::fix_exidx_coverage): New method.
9364         * object.h (Relobj::set_output_section): New method.
9365         (Sized_relobj::invalidate_section_offset): Remove method.
9366         (Sized_relobj::do_invalidate_section_offset): Remove method.
9367         (Sized_relobj::do_set_section_offset): Handle offset value -1.
9368
9369 2010-01-25  Doug Kwan  <dougkwan@google.com>
9370
9371         * arm.cc (Arm_exidx_merged_section::do_output_offset):
9372         Fix warning due to signed and unsigned comparison on a 32-bit host.
9373
9374 2010-01-22  Doug Kwan  <dougkwan@google.com>
9375
9376         * arm.cc (Target_arm::do_relax): Record an output section for section
9377         offset adjustment it contains any stub table that has changed.
9378         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
9379         offsets in an output section if necessary.
9380         * output.cc (Output_section::Output_section): Initialize
9381         section_offsets_need_adjustments_.
9382         (Output_section::add_input_section_for_script): Renamed to
9383         Output_section::add_simple_input_section.
9384         (Output_section::save_states): Add a comment.
9385         (Output_section::discard_states): New method defintion.
9386         (Output_section::adjust_section_offsets): Same.
9387         * output.h (Output_section::add_input_section_for_script): Renamed to
9388         Output_section::add_simple_input_section.
9389         (Output_section::discard_states): New method declaration.
9390         (Output_section::adjust_section_offsets): Same.
9391         (Output_section::section_offsets_need_adjustment,
9392         Output_section::set_section_offsets_need_adjustment): New method
9393         definitions.
9394         (Output_section::section_offsets_need_adjustment_): New data member.
9395         * script-sections.cc
9396         (Output_section_element_input::set_section_address): Adjust code for
9397         renaming of Output_section::add_input_section_for_script.
9398         (Orphan_output_section::set_section_address): Same.
9399
9400 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9401
9402         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
9403         Fix_v4bx enum values .
9404         * gold/options.h (General_options): New option definitions.
9405         (General_options::fix_v4bx): New method.
9406         (General_options::Fix_v4bx): New enum.
9407         * gold/options.cc (General_options::parse_fix_v4bx): New method.
9408         (General_options::parse_fix_v4bx_interworking): New method.
9409
9410 2010-01-22  Doug Kwan  <dougkwan@google.com>
9411
9412         * arm.cc (Arm_exidx_fixup): New class.
9413
9414 2010-01-21  Doug Kwan  <dougkwan@google.com>
9415
9416         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
9417         classes.
9418         (Arm_exidx_section_offset_map): New type.
9419
9420 2010-01-21  Doug Kwan  <dougkwan@google.com>
9421
9422         * arm.cc (Arm_exidx_input_section): New class.
9423         (Arm_relobj::exidx_input_section_by_link,
9424         Arm_relobj::exidx_input_section_by_shndx,
9425         Arm_relobj::make_exidx_input_section): New methods.
9426         (read_arm_attributes_section): Remove.
9427         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
9428         information about them.
9429         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
9430         to here.
9431
9432 2010-01-20  Doug Kwan  <dougkwan@google.com>
9433
9434         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
9435         Input_section_specifier to Section_id.
9436         (Target_arm::new_arm_input_section: Adjust code for change of key
9437         type.
9438         (Target_arm::find_arm_input_section): Ditto.
9439         * gc.h (object.h): Include for Section_id nand Section_id_hash.
9440         (Section_id): Remove.
9441         (Garbage_collection::Section_id_hash): Remove.
9442         * icf.h (object.h): Include for Section_id nand Section_id_hash.
9443         (Section_id): Remove.
9444         (Icf::Section_id_hash): Remove.
9445         * object.h (Section_id, Const_section_id, Section_id_hash,
9446         Const_section_id_hash): New type definitions.
9447         * output.cc (Output_section::add_relaxed_input_section): Change to
9448         use Const_section_id instead of Input_section_specifier as key type.
9449         (Output_section::add_merge_input_section): Ditto.
9450         (Output_section::build_relaxation_map): Change to use Section_id
9451         instead of Input_section_specifier as key type.
9452         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
9453         Ditto.
9454         (Output_section::convert_input_sections_to_relaxed_sections): Change
9455         to use Const_section_id instead of Input_section_specifier as key type.
9456         (Output_section::find_merge_section): Ditto.
9457         (Output_section::find_relaxed_input_section): Ditto.
9458         * output.h (Input_section_specifier): Remove class.
9459         (Output_section::Output_section_data_by_input_section_map): Change
9460         key type to Const_section_id.
9461         (Output_section::Output_relaxed_input_section_by_input_section_map):
9462         Ditto.
9463         (Output_section::Relaxation_map): Change key type to Section_id.
9464
9465 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9466
9467         * gold/arm.cc: Added support for R_ARM_V4BX relocation
9468         (class Arm_v4bx_stub): New class.
9469         (DEF_STUBS): Updated definition to support v4_veneer_bx.
9470         (Stub_factory::make_arm_v4bx_stub): New method.
9471         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
9472         (Stub_table::empty): Handle v4bx stubs.
9473         (Stub_table::add_arm_v4bx_stub): New method.
9474         (Stub_table::find_arm_v4bx_stub): New method.
9475         (Arm_relocate_functions::v4bx): New method.
9476         (Target_arm::fix_v4bx): New method.
9477         (Target_arm::Target_arm): Handle R_ARM_V4BX.
9478         (Stub_table::relocate_stubs): Likewise.
9479         (Stub_table::do_write): Likewise.
9480         (Stub_table::update_data_size_and_addralign): Likewise.
9481         (Stub_table::finalize_stubs):  Likewise.
9482         (Target_arm::Scan::local): Likewise.
9483         (Target_arm::Scan::global): Likewise.
9484         (Target_arm::do_finalize_sections): Likewise.
9485         (Target_arm::Relocate::relocate): Likewise.
9486         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9487         Likewise.
9488         (Target_arm::scan_reloc_for_stub): Likewise.
9489         (Target_arm::scan_reloc_section_for_stubs): Likewise.
9490
9491 2010-01-19  Ian Lance Taylor  <iant@google.com>
9492
9493         * output.cc (Output_section_headers::do_sized_write): Write large
9494         segment count to sh_info field.
9495         (Output_file_header::do_sized_write): For large segment count,
9496         write PN_XNUM to e_phnum field.
9497
9498 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9499
9500         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
9501         (Arm_relocate_functions::thm_jump8): New function.
9502         (Arm_relocate_functions::thm_jump11): New function.
9503         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
9504         R_ARM_THM_JUMP11.
9505         (Target_arm::Scan::global): Likewise.
9506         (Target_arm::Relocate::relocate): Likewise.
9507         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9508         Likewise.
9509
9510 2010-01-14  Doug Kwan  <dougkwan@google.com>
9511
9512         * arm.cc (map, utility): Include headers.
9513         (Target_arm::apply_cortex_a8_workaround): New method.
9514         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
9515         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
9516         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
9517         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
9518         the --[no-]fix-cortex-a8 command line options.
9519         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
9520         (Target_arm::relocate_stub): Use addend in instruction template.
9521         * options.h (DEFINE_bool): Set the user-set flag.
9522         (General_options): Add --[no-]-fix-cortex options.
9523         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
9524         : Update fast look-up map after conversion.
9525
9526 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
9527
9528         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
9529         in the first pass of do_layout.
9530
9531 2010-01-13  Doug Kwan  <dougkwan@google.com>
9532
9533         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
9534         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
9535         apparent compiler problem of not folding static constant integral
9536         data members of elfcpp::Elf_sizes<32>.
9537
9538 2010-01-13  Doug Kwan  <dougkwan@google.com>
9539
9540         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
9541         Arm_relobj::section_needs_cortex_a8_stub_scanning,
9542         Arm_relobj::scan_section_for_cortex_a8_erratum,
9543         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
9544         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
9545         sections to scan for relocation stubs into a new method
9546         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
9547         relocation and Cortex-A8 stub scanning.
9548         (Target_arm::do_relax): Force stubs to be after stubbed sections
9549         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
9550         the beginning of a new relaxation pass.  Update a comment.
9551         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
9552
9553 2010-01-12  Ian Lance Taylor  <iant@google.com>
9554
9555         * target-reloc.h (visibility_error): New inline function.
9556         (relocate_section): Call visibility_error.
9557         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
9558         (MOSTLYCLEANFILES): Likewise.
9559         (protected_4_pic.o, protected_3.err): New targets.
9560         * testsuite/protected_4.cc: New file.
9561
9562 2010-01-12  Doug Kwan  <dougkwan@google.com>
9563
9564         * arm.cc (Cortex_a8_reloc): New class.
9565         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
9566         and cortex_a8_relocs_info_.
9567         (Target_arm::fix_cortex_a8): New method definition.
9568         (Target_arm::Cortex_a8_relocs_info): New type.
9569         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
9570         New data member declarations.
9571         (Target_arm::scan_reloc_for_stub): Record information about
9572         relocations for THUMB branches that might be exempted from the
9573         Cortex-A8 workaround.
9574         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
9575         at the beginning of a relaxation pass.
9576
9577 2010-01-12  Doug Kwan  <dougkwan@google.com>
9578
9579         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
9580         (Arm_relobj::Mapping_symbol_position,
9581          Arm_reloj::Mapping_symbol_position_less,
9582          Arm_relobj::Mapping_symbols_info): New types.
9583         (Target_arm::is_mapping_symbol_name): New method definition.
9584         (Arm_relobj::do_count_local_symbols): Save information about mapping
9585         symbols.
9586
9587 2010-01-11  Doug Kwan  <dougkwan@google.com>
9588
9589         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
9590         Arm_relocate_functions::thumb32_branch_upper,
9591         Arm_relocate_functions::thumb32_branch_lower,
9592         Arm_relocate_functions::thumb32_cond_branch_offset,
9593         Arm_relocate_functions::thumb32_cond_branch_upper,
9594         Arm_relocate_functions::thumb32_cond_branch_lower,
9595         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
9596         branch offset encoding.
9597         (Arm_relocate_functions::thumb_branch_common): Use new branch
9598         offset encoding methods to avoid code duplication.
9599         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
9600         (Stub_addend_reader::operator()): Use new branch encoding method
9601         to avoid code duplication.
9602
9603 2010-01-11  Doug Kwan  <dougkwan@google.com>
9604
9605         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
9606         (Target_arm::do_finalize_sections): Define special EXIDX section
9607         symbols only if referenced.
9608         * gc.h (Garbage_collection::add_reference): New method.
9609         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
9610         code duplication.
9611
9612 2010-01-11  Ian Lance Taylor  <iant@google.com>
9613
9614         * script.cc (Version_script_info::build_expression_list_lookup):
9615         Change complaing about duplicate wildcard match from error to
9616         warning.
9617
9618         * script.cc (class Lazy_demangler): Recreate--revert part of patch
9619         of 2009-12-30.
9620         (Version_script_info::Version_script_info): Initialize globs_,
9621         default_version_, default_is_global_, and exact_.  Don't
9622         initialize globals_ or locals_.
9623         (Version_script_info::build_lookup_tables): Build local symbols
9624         first.
9625         (Version_script_info::unquote): New function.
9626         (Version_script_info::add_exact_match): New function.
9627         (Version_script_info::build_expression_list_lookup): Remove lookup
9628         parameter.  Add is_global parameter.  Change all callers.  Handle
9629         wildcard pattern specially.  Unquote pattern.  Call
9630         add_exact_match.
9631         (Version_script_info::get_name_to_match): New function.
9632         (Version_script_info::get_symbol_version): New function.
9633         (Version_script_info::get_symbol_version_helper): Remove.
9634         (Version_script_info::check_unmatched_names): Call unquote.
9635         * script.h (class Version_script_info): Change get_symbol_version
9636         to be non-inline and add is_global parameter; change all callers.
9637         Rewrite symbol_is_local.  Update declarations.  Define struct
9638         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
9639         Remove globals_ and locals_ members.  Add exact_, globs_,
9640         default_version_, is_global_.
9641         (Version_script_info::Glob): Remove pattern, add expression and
9642         is_global.  Update constructor.  Change all callers.
9643         * dynobj.cc (Versions::finalize): Mark the version symbol as the
9644         default version.
9645         (Versions::symbol_section_contents): If a symbol is undefined, or
9646         defined in a dynamic object, set the version index to
9647         VER_NDX_LOCAL.
9648         * symtab.cc (Symbol_table::add_from_relobj): Don't call
9649         symbol_is_local.
9650         (Symbol_table::add_from_pluginobj): Likewise.
9651         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
9652
9653 2010-01-11  Doug Kwan  <dougkwan@google.com>
9654
9655         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
9656         (incremental_dump_LDADD): Add linking option for libintl.
9657         * Makefile.in: Regenerate.
9658
9659 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
9660
9661         PR gold/11144
9662         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
9663         instead of -Ds.
9664         * testsuite/Makefile.in: Regenerated.
9665
9666 2010-01-10  Doug Kwan  <dougkwan@google.com>
9667
9668         * options.h (DEFINE_var): Use parentheses around argument varname__
9669         in macro body to avoid any unintended subsequent substitutions.
9670
9671 2010-01-10  Ian Lance Taylor  <iant@google.com>
9672
9673         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
9674         candidates before doing symbol resolution.
9675
9676         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
9677         ODR candidates if only one is weak.
9678
9679 2010-01-08  Ian Lance Taylor  <iant@google.com>
9680
9681         * script.cc (Version_script_info::build_expression_list_lookup):
9682         Don't warn about ambiguous version, just record the ambiguity.
9683         (Version_script_info::get_symbol_version_helper): Give error if
9684         version is ambiguous.
9685
9686 2010-01-08  Doug Kwan  <dougkwan@google.com>
9687
9688         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
9689         prev_data_size_ and prev_addralign_.  Remove initializer for
9690         deleted data member has_been_changed_.
9691         (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
9692         to determine if the table is empty.
9693         (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
9694         Remove.
9695         (Stub_table::add_reloc_stub): Define method in class definition
9696         instead of just declaring it there.
9697         (Stub_table::add_cortex_a8_stub): New method definition.
9698         (Stub_table::update_data_size_and_addralign): Ditto.
9699         (Stub_table::finalize_stubs): Ditto.
9700         (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
9701         (Stub_table::do_addralign_): Return address alignment in the
9702         (Stub_table::do_reset_address_and_file_offset): Define method in
9703         class definition instead of declaring it there.  Set current data
9704         size to be the data size of the previous pass.
9705         (Stub_table::set_final_data_size): Use current data size as the
9706         final data size.
9707         (Stub_table::relocate_stub): Change parameter type of stub from
9708         Reloc_stub pointer to Stub pointer.
9709         (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
9710         (Stub_table::Cortex_a8_stub_list): New typedef.
9711         (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
9712          Stub_table::prev_addralign_): New data member.
9713         (Arm_relobj::Arm_relobj): Initialize data member
9714         section_has_cortex_a8_workaround_.
9715         (Arm_relobj::section_has_cortex_a8_workaround,
9716          Arm_relobj::mark_section_for_cortex_a8_workaround): New method
9717          definitions.
9718         (Arm_relobj::section_has_cortex_a8_workaround_): New data member
9719         declarations.
9720         (Target_arm::relocate_stub): Change parameter type of stub from
9721         Reloc_stub pointer to Stub pointer.
9722         (Insn_template::size, Insn_template::alignment): Handle
9723         THUMB16_SPECIAL_TYPE.
9724         (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
9725          Stub_table::update_data_size_and_addralign,
9726          Stub_table::apply_cortex_a8_workaround_to_address_range): New method
9727         definitions.
9728         (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
9729         (Stub_table::do_write): Ditto.
9730         (Target_arm::do_relax): Adjust code for changes in Stub_table.
9731
9732 2010-01-08  Ian Lance Taylor  <iant@google.com>
9733
9734         PR 11108
9735         * symtab.h (class Symbol): Remove fields is_target_special_ and
9736         has_plt_offset_.  Add field is_defined_in_discarded_section_.
9737         (Symbol::is_defined_in_discarded_section): New function.
9738         (Symbol::set_is_defined_in_discarded_section): New function.
9739         (Symbol::has_plt_offset): Rewrite.
9740         (Symbol::set_plt_offset): Verify that new offset is not -1U.
9741         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
9742         Don't initialize is_target_special_ or has_plt_offset_.
9743         Initialize is_defined_in_discarded_section_.
9744         (Symbol_table::add_from_relobj): If appropriate, set
9745         is_defined_in_discarded_section.
9746         * resolve.cc (Symbol::override_base_with_special): Don't test
9747         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
9748         * target-reloc.h (relocate_section): Do special handling for
9749         symbols defined in discarded sections for global symbols as well
9750         as local symbols.
9751
9752 2010-01-08  Ian Lance Taylor  <iant@google.com>
9753
9754         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
9755         the SHT_SYMTAB case.
9756
9757 2010-01-08  Ian Lance Taylor  <iant@google.com>
9758
9759         * object.cc (Sized_relobj::do_layout): Don't get confused if
9760         layout_eh_frame returns NULL.
9761
9762 2010-01-08  Ian Lance Taylor  <iant@google.com>
9763
9764         PR 11084
9765         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
9766         dynamic symbol table, use the normal symbol table.
9767         (Sized_dynobj::do_read_symbols): Remove assertion about type of
9768         symbol table.
9769
9770 2010-01-08  Ian Lance Taylor  <iant@google.com>
9771
9772         PR 11072
9773         * layout.cc (Layout::include_section): Remove .gnu_debuglink
9774         sections.
9775
9776 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
9777
9778         * version.cc (print_version): Change to "Copyright 2010".
9779
9780 2010-01-08  Ian Lance Taylor  <iant@google.com>
9781
9782         PR 10287
9783         PR 11063
9784         * i386.cc (class Target_i386): Change return type of plt_section
9785         to be non-const.
9786         (class Output_data_plt_i386): Add tls_desc_rel_ field.
9787         (Output_data_plt_i386::Output_data_plt_i386): Initialize
9788         tls_desc_rel_ field.
9789         (Output_data_plt_i386::rel_tls_desc): New function.
9790         (Target_i386::rel_tls_desc_section): New function.
9791         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
9792         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
9793         R_386_TLS_DESC reloc in rel_tls_desc_section.
9794         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
9795         Define struct Tlsdesc_info.
9796         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
9797         (Target_x86_64::do_reloc_symbol_index): New function.
9798         (Target_x86_64::add_tlsdesc_info): New function.
9799         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
9800         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
9801         tlsdesc_rel_ field.
9802         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
9803         all callers.
9804         (Output_data_plt_x86_64::rela_tlsdesc): New function.
9805         (Target_x86_64::rela_tlsdesc_section): New function.
9806         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
9807         handling.
9808         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
9809         (Target_x86_64::do_reloc_addend): New function.
9810         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
9811         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
9812         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
9813         (Output_reloc::type): New function.
9814         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
9815         (Output_reloc::is_target_specific): New function.
9816         (Output_reloc::target_arg): New function.
9817         (class Output_reloc) [SHT_RELA]: Add four new constructors for
9818         absolute relocs and target specific relocs.
9819         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
9820         add_target_specific.
9821         (class Output_data_reloc) [SHT_RELA]: Likewise.
9822         * output.cc (Output_reloc::Output_reloc): Add four new versions
9823         for absolute relocs and target specific relocs.
9824         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
9825         (Output_reloc::get_symbol_index): Likewise.
9826         (Output_reloc::local_section_offset): Check that local_sym_index_
9827         is not TARGET_CODE or 0.
9828         (Output_reloc::symbol_value): Likewise.
9829         (Output_reloc::write) [SHT_RELA]: Call target for target specific
9830         reloc.
9831         * target.h (class Target): Add reloc_symbol_index and reloc_addend
9832         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
9833         functions.
9834         * layout.cc (add_target_dynamic_tags): Use output section for
9835         DT_PLTRELSZ and DT_JMPREL.
9836
9837 2010-01-07  Ian Lance Taylor  <iant@google.com>
9838
9839         PR 11061
9840         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
9841         function.
9842         (class Output_data_reloc_generic): Define.
9843         (class Output_data_reloc_base): Change base class to
9844         Output_data_reloc_generic.  Change add() method to call
9845         bump_relative_reloc_count for a relative reloc.  Remove
9846         sort_relocs_ field.
9847         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
9848         to sort_relocs().
9849         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
9850         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
9851         appropriate.
9852         * layout.h (class Layout): Update declaration.
9853
9854 2010-01-07  Ian Lance Taylor  <iant@google.com>
9855
9856         * output.h (class Output_data): Add const version of
9857         output_section and do_output_section.
9858         (class Output_section_data): Add const version of
9859         do_output_section.
9860         (class Output_section): Likewise.
9861         * layout.cc (Layout::add_target_dynamic_tags): New function.
9862         * layout.h (class Layout): Update declarations.
9863         * arm.cc (Target_arm::do_finalize_sections): Use
9864         add_target_dynamic_tags.
9865         * i386.cc (Target_i386::do_finalize_sections): Likewise.
9866         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
9867         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
9868         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
9869
9870 2010-01-07  Ian Lance Taylor  <iant@google.com>
9871
9872         PR 11042
9873         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
9874         object as needed.
9875
9876 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
9877             Ian Lance Taylor  <iant@google.com>
9878
9879         PR 11019
9880         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
9881         Xindex::read_symtab_xindex.
9882
9883 2010-01-07  Doug Kwan  <dougkwan@google.com>
9884
9885         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
9886         (Insn_template::thumb16_bcond_insn): New method declaration.
9887         (Insn_template): Fix spelling.
9888         (Stub::thumb16_special): New method declaration.
9889         (Stub::do_write): Define virtual method which was previously pure
9890         virtual.
9891         (Stub::do_thumb16_special): New method declaration.
9892         (Stub::do_fixed_endian_write): New template member.
9893         (Reloc_stub::do_write): Remove.
9894         (Reloc_stub::do_fixed_endian_write): Remove.
9895         (Cortex_a8_stub): New class definition.
9896         (Stub_factory::make_cortex_a8_stub): New method definition.
9897         (Stub_factory::Stub_factory): Add missing static storage class
9898         qualifier for elf32_arm_stub_a8_veneer_blx.
9899
9900 2010-01-07  Ian Lance Taylor  <iant@google.com>
9901
9902         PR 10980
9903         * options.h (class General_options): Add --warn-unresolved-symbols
9904         and --error-unresolved-symbols.
9905         * errors.cc (Errors::undefined_symbol): Implement
9906         --warn-unresolved-symbols.
9907
9908         * options.h (class General_options): Add -z text and -z textoff.
9909         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
9910
9911 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
9912
9913         * gc.h (Garbage_collection::Cident_section_map): New typedef.
9914         (Garbage_collection::cident_sections): New function.
9915         (Garbage_collection::add_cident_section): New function.
9916         (Garbage_collection::cident_sections_): New member.
9917         (gc_process_relocs): Add references to sections whose names are C
9918         identifiers.
9919         * gold.h (cident_section_start_prefix): New constant.
9920         (cident_section_stop_prefix): New constant.
9921         (is_cident): New function.
9922         * layout.cc (Layout::define_section_symbols): Replace string constants
9923         with the newly defined constants.
9924         * object.cc (Sized_relobj::do_layout): Track sections whose names are
9925         C identifiers.
9926         * testsuite/Makefile.am: Add gc_orphan_section_test.
9927         * testsuite/Makefile.in: Regenerate.
9928         * testsuite/gc_orphan_section_test.cc: New file.
9929         * testsuite/gc_orphan_section_test.sh: New file.
9930
9931 2010-01-06  Ian Lance Taylor  <iant@google.com>
9932
9933         PR 10980
9934         * options.h (class General_options): Add --warn-shared-textrel.
9935         * layout.cc (Layout::finish_dynamic_section): Implement
9936         --warn-shared-textrel.
9937
9938         PR 10980
9939         * options.h (class General_options): Add --warn-multiple-gp.
9940
9941 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9942
9943         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
9944         $(THREADSLIB) and $(LIBDL).
9945         * Makefile.in: Rebuild.
9946
9947 2010-01-06  Ian Lance Taylor  <iant@google.com>
9948
9949         PR 10980
9950         * options.cc (General_options::parse_section_start): New function.
9951         (General_options::section_start): New function.
9952         (General_options::General_options): Initialize all members.
9953         * options.h: Include <map>
9954         (class General_options): Add --section-start.  Add section_starts_
9955         member.
9956         * layout.cc (Layout::attach_allocated_section_to_segment): If
9957         --section-start was used, set the address of the segment.  Remove
9958         local sort_sections.
9959         (Layout::relaxation_loop_body): If the address of the load segment
9960         has been set by --section-start, don't use it.
9961         * output.h (Output_segment::update_flags_for_output_section): New
9962         function.
9963         * output.cc (Output_segment::add_output_section): Call
9964         update_flags_for_output_section.
9965
9966 2010-01-05  Ian Lance Taylor  <iant@google.com>
9967
9968         PR 10980
9969         * options.h (class General_options): Add --undefined-version.
9970         * script.cc (struct Version_expression): Add was_matched_by_symbol
9971         field.
9972         (Version_script_info::matched_symbol): New function.
9973         (Version_script_info::get_symbol_version_helper): Call
9974         matched_symbol.
9975         (Version_script_info::check_unmatched_names): New function.
9976         * script.h (class Version_script_info): Update declarations.
9977         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
9978
9979         * options.h (class General_options): Use DEFINE_bool_alias for
9980         allow_multiple_definition.
9981         * resolve.cc (Symbol_table::should_override): Don't test
9982         allow_multiple_definition.
9983
9984         PR 10980
9985         * options.h (class General_options): Add --cref.
9986         * main.cc (main): Print cref table if --cref.  Don't close mapfile
9987         until after printing cref table.
9988         * cref.cc: Include "symtab.h".
9989         (class Cref_inputs): Define Cref_table_compare and Cref_table.
9990         (Cref_table_compare::operator()): New function.
9991         (Cref_inputs::gather_cref): New function.
9992         (filecol): New static const.
9993         (Cref_inputs::print_cref): New function.
9994         (Cref::print_cref): New function.
9995         * cref.h: Include <cstdio>.
9996         (class Cref): Update declarations.
9997         * mapfile.h (Mapfile::file): New function.
9998         * object.h (class Object): Define Symbols.  Declare virtual
9999         do_get_global_symbols.
10000         (Object::get_global_symbols): New function.
10001         * object.cc (Input_objects::add_object): Pass object to cref_ if
10002         --cref.
10003         (Input_objects::archive_start): Likewise.
10004         (Input_objects::archive_stop): Likewise.
10005         (Input_objects::print_cref): New function.
10006         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
10007         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
10008         --cref.
10009         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
10010         function.
10011         * plugin.h (class Sized_pluginobj): Update declarations.
10012
10013 2010-01-05  Ian Lance Taylor  <iant@google.com>
10014
10015         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
10016         to is_default_version.  Rename insdef to insdefault.
10017         (Symbol_table::add_from_relobj): Rename def to is_default_version
10018         and local to is_forced_local.
10019         (Symbol_table::add_from_pluginobj): Likewise.
10020         (Symbol_table::add_from_dynobj): Likewise.
10021         (Symbol_table::define_special_symbol): Rename insdef to
10022         insdefault.
10023
10024 2010-01-04  Ian Lance Taylor  <iant@google.com>
10025
10026         PR 10980
10027         * options.h (class General_options): Add
10028         --allow-multiple-definition and -z muldefs.
10029         * resolve.cc (Symbol_table::should_override): Don't warn about a
10030         multiple symbol definition if --allow-multiple-definition or -z
10031         muldefs.
10032
10033         PR 10980
10034         * options.h (class General_options): Add --add-needed and
10035         --copy-dt-needed-entries.  Tweak --as-needed help entry.
10036         * object.cc (Input_objects::check_dynamic_dependencies): Give an
10037         error if --copy-dt-needed-entries aka --add-needed is used and
10038         would cause a change in behaviour.
10039
10040         PR 10980
10041         * options.h (class General_options): Add -G as a short version of
10042         --shared.  Add no-op options -assert, -g, and -i.
10043
10044 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
10045
10046         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
10047         check for .text or .gnu.linkonce.t sections.
10048         * icf.cc (Icf::find_identical_sections): Ditto.
10049         Change the detection for mangled function name within the section
10050         name.
10051         * icf.h (is_section_foldable_candidate): New function.
10052
10053 2009-12-30  Ian Lance Taylor  <iant@google.com>
10054
10055         PR 10980
10056         * options.h (class General_options): Permit two dashes with
10057         --retain-symbols-file.
10058
10059 2009-12-30  Ian Lance Taylor  <iant@google.com>
10060
10061         PR 10979
10062         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
10063         don't put the file header and segment headers in the text
10064         segment.
10065
10066         PR 10979
10067         * common.cc (Sort_commons::operator()): Stabilize sort when both
10068         entries are NULL.
10069         (Symbol_table::do_allocate_commons_list): When allocating common
10070         symbols, skip a symbol which is no longer common.
10071         * symtab.h (Symbol::is_common): Test whether the symbol comes from
10072         an object before checking its type.
10073         * testsuite/common_test_2.c: New file.
10074         * testsuite/common_test_3.c: New file.
10075         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
10076         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
10077         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
10078         (common_test_2_pic.o, common_test_2.so): New targets.
10079         (common_test_3_pic.o, common_test_3.so): New targets.
10080         * testsuite/Makefile.in: Rebuild.
10081
10082         PR 10979
10083         * script.cc (read_input_script): If we see a new SECTIONS clause,
10084         and we have added an input section, give an error.
10085         * layout.h (class Layout): Add have_added_input_section function.
10086         Add have_added_input_section_ field.
10087         * layout.cc (Layout::Layout): Initialize
10088         have_added_input_section_.
10089         (Layout::layout): Set have_added_input_section_.
10090         (Layout::layout_eh_frame): Likewise.
10091
10092 2009-12-30  Ian Lance Taylor  <iant@google.com>
10093
10094         PR 10931
10095         * options.h (class General_options): Add --sort-common option.
10096         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
10097         * common.cc (Sort_common): Add sort_order parameter to
10098         constructor.  Add sort_order_ field.
10099         (Sort_commons::operator): Check sort_order_.
10100         (Symbol_table::allocate_commons): Determine the sort order.
10101         (Symbol_table::do_allocate_commons): Add sort_order parameter.
10102         Change all callers.
10103         (Symbol_table::do_allocate_commons_list): Likewise.
10104
10105 2009-12-30  Ian Lance Taylor  <iant@google.com>
10106
10107         PR 10916
10108         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
10109         symbols from this object, don't change the visibility of an
10110         undefined symbol.
10111         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
10112
10113 2009-12-30  Ian Lance Taylor  <iant@google.com>
10114
10115         PR 10861
10116         * script.h (class Version_script_info): Define Language enum.
10117         Update declarations.  Define Glob, Exact, and Lookup types.  Add
10118         new fields globals_, locals_, and is_finalized_.
10119         * script.cc: Various formatting fixes.
10120         (class Parser_closure): Change language_stack_ from a vector of
10121         std::string to one of Version_script_info::Language.  Adjust all
10122         uses accordingly.
10123         (class Lazy_demangler): Remove.
10124         (struct Version_expression): Change language from std::string to
10125         Version_script_info::Language.
10126         (Version_script_info::Version_script_info): New function.
10127         (Version_script_info::~Version_script_info): Don't call clear.
10128         (Version_script_info::finalize): New function.
10129         (Version_script_info::build_lookup_tables): New function.
10130         (Version_script_info::build_expression_list_lookup): New
10131         function.
10132         (Version_script_info::get_symbol_version_helper): Rewrite to use
10133         lookup tables.
10134         (Version_script_info::print_expression_list): Adjust to use
10135         Version_script_info::Language.
10136         (script_push_lex_into_version_mode): Check that the version script
10137         has not been finalized.
10138         (version_script_push_lang): Change language string to
10139         Version_script_info::Language.
10140         * options.cc (Command_line::version_script): New function.
10141         * options.h (class General_options): Add finalize_dynamic_list
10142         function.  Change version_script from declaration to definition.
10143         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
10144         * testsuite/version_script.map: Remove duplicate def of foo.
10145         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
10146         version_script.map.
10147         * testsuite/Makefile.in: Rebuild.
10148
10149 2009-12-30  Ian Lance Taylor  <iant@google.com>
10150
10151         PR 10843
10152         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
10153         if the input symbol index is 0, make the output symbol index 0.
10154
10155 2009-12-30  Ian Lance Taylor  <iant@google.com>
10156
10157         PR 10670
10158         * options.h (class General_options): Add -x/--discard-all.
10159         * object.cc (Sized_relobj::do_count_local_symbols): Handle
10160         --discard-all.  If the local symbol needs a dynamic entry, check
10161         that before handling --discard-locals.
10162
10163 2009-12-30  Ian Lance Taylor  <iant@google.com>
10164
10165         PR 10450
10166         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
10167         flags to PF_R.
10168         (Output_segment::add_output_section): Don't change the flags if
10169         the type is PT_TLS.
10170
10171         PR 10450
10172         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
10173         GNU hash table if they need a dynamic value.  Otherwise, don't add
10174         them if they are defined in a dynamic object or are forced local.
10175
10176 2009-12-29  Ian Lance Taylor  <iant@google.com>
10177
10178         PR 10450
10179         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
10180         .gnu.hash table for a 32-bit target.
10181
10182         PR 10450
10183         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
10184         regular and a dynamic object only needs a dynamic symbol table
10185         entry if it is externally visible.
10186
10187         PR 10450
10188         * i386.cc (class Target_i386): Initialize global_offset_table_ in
10189         constructor.  Add global_offset_table_ field.
10190         (Target_i386::got_section): Set global_offset_table_.
10191         (Target_i386::do_finalize_sections): Set global_offset_table_
10192         size.
10193         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
10194         in constructor.  Add global_offset_table_ field.
10195         (Target_x86_64::got_section): Set global_offset_table_.
10196         (Target_x86_64::do_finalize_sections): Set global_offset_table_
10197         size.
10198
10199         * layout.cc (Layout::Layout): Initialize increase_relro_.
10200         (Layout::get_output_section): Add is_relro, is_last_relro, and
10201         is_first_non_relro parameters.  Change all callers.
10202         (Layout::choose_output_section): Likewise.
10203         (Layout::add_output_section_data): Likewise.
10204         (Layout::make_output_section): Likewise.
10205         (Layout::set_segment_offsets): Clear increase_relro when using a
10206         linker script.
10207         * layout.h (class Layout): Add increase_relro method.  Add
10208         increase_relro_ field.  Update declarations.
10209         * output.cc (Output_section::Output_section): Initialize
10210         is_last_relro_ and is_first_non_relro_.
10211         (Output_segment::add_output_section): Group relro sections is
10212         do_sort is true.  Handle is_last_relro and is_first_non_relro.
10213         (Output_segment::maximum_alignment): Remove relro handling.
10214         (Output_segment::set_section_addresses): Add increase_relro
10215         parameter.  Change all callers.  Add initial alignment to align
10216         relro sections on separate page.  Remove old relro handling.
10217         (Output_segment::set_section_list_addresses): Remove in_relro
10218         parameter.  Change all callers.
10219         (Output_segment::set_offset): Add increase parameter.  Change all
10220         callers.  Remove old relro handling.
10221         * output.h (class Output_section): Add new methods: is_last_relro,
10222         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
10223         Add is_last_relro_ and is_first_non_relro_ fields.
10224         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
10225         Create separate .got.plt section.  Call increase_relro.
10226         * x86_64.cc (Target_x86_64::got_section): Likewise.
10227         * testsuite/relro_script_test.t: Add .got.plt.
10228
10229         PR 10450
10230         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
10231         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
10232         (Layout::finalize): Call set_dynamic_symbol_size.
10233         (Layout::set_dynamic_symbol_size): New function.
10234         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
10235         set_dynamic_symbol_size.
10236
10237         PR 10450
10238         * output.h (class Output_section): Add is_entsize_zero_ field.
10239         * output.cc (Output_section::Output_section): Initialize
10240         is_entsize_zero_.
10241         (Output_section::set_entsize): If two different entsizes are
10242         requested, force it to zero.
10243         (Output_section::add_input_section): Set flags for .debug_str
10244         before updating section flags.  Set entsize.
10245         (Output_section::update_flags_for_input_section): Set SHF_MERGE
10246         and SHF_STRING if all input sections have those flags.
10247
10248 2009-12-29   Rafael Espindola  <espindola@google.com>
10249
10250         * main.cc (main): Fix the sys time reporting.
10251         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
10252         reporting.
10253
10254 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
10255
10256         * options.cc (General_options::parse_version): Allow -v to exit
10257         without an error if there is nothing to link.
10258
10259 2009-12-29  Ian Lance Taylor  <iant@google.com>
10260
10261         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
10262         using a version of gcc before 4.1.
10263         * configure: Rebuild.
10264
10265 2009-12-28  Chris Demetriou  <cgd@google.com>
10266
10267         * attributes.cc (Output_attributes_section_data::do_write): Use
10268         std::vector::front rather than std::vector::data.
10269
10270 2009-12-28  Ian Lance Taylor  <iant@google.com>
10271
10272         * symtab.h (class Symbol_table): Add enum Defined.
10273         * resolve.cc (Symbol_table::should_override): Add defined
10274         parameter.  Change all callers.  Test whether object is NULL
10275         before calling a method on it.
10276         (Symbol_table::report_resolve_problem): Add defined parameter.
10277         Change all callers.
10278         (Symbol_table::should_override_with_special): Likewise.
10279         * symtab.cc (Symbol_table::define_in_output_data): Add defined
10280         parameter.  Change all callers.
10281         (Symbol_table::do_define_in_output_data): Likewise.
10282         (Symbol_table::define_in_output_segment): Likewise.
10283         (Symbol_table::do_define_in_output_segment): Likewise.
10284         (Symbol_table::define_as_constant): Likewise.
10285         (Symbol_table::do_define_as_constant): Likewise.
10286         * script.h (class Symbol_assignment): Add is_defsym parameter to
10287         constructor; change all callers.
10288         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
10289         parameter.  Change all callers.  Add is_defsym_ field.
10290         (class Parser_closure): Add parsing_defsym parameter to
10291         constructor; change all callers.  Add parsing_defsym accessor
10292         function.  Add parsing_defsym_ field.
10293
10294 2009-12-28  Ian Lance Taylor  <iant@google.com>
10295
10296         * gold.cc (queue_middle_tasks): Fix formatting.
10297         * object.cc (Relobj::is_section_name_included): Likewise.
10298
10299 2009-12-23  Ian Lance Taylor  <iant@google.com>
10300
10301         * i386.cc (Target_i386::do_calls_non_split): Recognize
10302         -fsplit-stack prologue for a function with a static chain.
10303         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
10304         -fsplit-stack prologue when using %r11.
10305
10306 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
10307
10308         * options.cc (General_options::parse_version): Make -v continue and do
10309         the link like GNU ld does.
10310
10311 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
10312
10313         * Makefile.am (CCFILES): Add timer.cc.
10314         (HFILES): Add timer.h.
10315         * configure.ac: Check for sysconf and times.
10316         * main.cc: include timer.h.
10317         (main): Use Timer instead of get_run_time.
10318         * timer.cc: New.
10319         * timer.h: New.
10320         * workqueue.cc: include timer.h.
10321         (Workqueue::find_and_run_task):
10322         Report user, sys and wall time.
10323         * Makefile.in: Regenerate.
10324         * config.in: Regenerate.
10325         * configure: Regenerate.
10326
10327 2009-12-16  Doug Kwan  <dougkwan@google.com>
10328
10329         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
10330         sections.
10331         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
10332         relaxed input sections.
10333         * output.cc (Output_section::find_relaxed_input_section): Change
10334         return type to Output_relaxed_input_section pointer.  Adjust code
10335         for new type of relaxed_input_section_map_.
10336         * output.h (Output_section::find_relaxed_input_section): Change
10337         return type to Output_relaxed_input_section pointer.
10338         (Output_section::Output_relaxed_input_section_by_input_section_map):
10339         New type.
10340         (Output_section::relaxed_input_section_map_): Change type to
10341         Output_section::Output_relaxed_input_section_by_input_section_map.
10342         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
10343         input section.
10344
10345 2009-12-15  Ian Lance Taylor  <iant@google.com>
10346
10347         * layout.cc (Layout::create_shstrtab): Only write out after input
10348         sections if we are compressing debug sections.
10349
10350 2009-12-15  Ian Lance Taylor  <iant@google.com>
10351
10352         * archive.cc (Archive::add_symbols): Only look up a symbol without
10353         a version if there is, in fact, a version.
10354
10355 2009-12-14  Ian Lance Taylor  <iant@google.com>
10356
10357         Revert -Wshadow changes, all changes from:
10358         2009-12-11  Doug Kwan  <dougkwan@google.com>
10359         2009-12-11  Nick Clifton  <nickc@redhat.com>
10360         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
10361
10362 2009-12-11  Doug Kwan  <dougkwan@google.com>
10363
10364         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
10365         due to -Wshadow.
10366         * attributes.cc (Object_attribute::size): Ditto.
10367         (Attributes_section_data::size): Ditto.
10368         (Attributes_section_data::Attributes_section_data): Ditto.
10369         (Output_attributes_section_data::do_write): Ditto.
10370         * attributes.h (Object_attribute::set_type): Ditto.
10371         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
10372
10373 2009-12-11  Nick Clifton  <nickc@redhat.com>
10374
10375         * archive.cc: Fix shadowed variable warnings.
10376         * arm.cc: Likewise.
10377         * compressed_output.cc: Likewise.
10378         * compressed_output.h: Likewise.
10379         * configure: Likewise.
10380         * dwarf_reader.cc: Likewise.
10381         * dynobj.cc: Likewise.
10382         * dynobj.h: Likewise.
10383         * ehframe.cc: Likewise.
10384         * ehframe.h: Likewise.
10385         * errors.cc: Likewise.
10386         * expression.cc: Likewise.
10387         * fileread.cc: Likewise.
10388         * fileread.h: Likewise.
10389         * freebsd.h: Likewise.
10390         * i386.cc: Likewise.
10391         * icf.cc: Likewise.
10392         * incremental.h: Likewise.
10393         * layout.cc: Likewise.
10394         * layout.h: Likewise.
10395         * mapfile.cc: Likewise.
10396         * merge.cc: Likewise.
10397         * merge.h: Likewise.
10398         * object.cc: Likewise.
10399         * object.h: Likewise.
10400         * options.h: Likewise.
10401         * output.cc: Likewise.
10402         * output.h: Likewise.
10403         * parameters.cc: Likewise.
10404         * plugin.cc: Likewise.
10405         * powerpc.cc: Likewise.
10406         * reduced_debug_output.cc: Likewise.
10407         * reduced_debug_output.h: Likewise.
10408         * reloc.cc: Likewise.
10409         * reloc.h: Likewise.
10410         * resolve.cc: Likewise.
10411         * script-sections.cc: Likewise.
10412         * script.cc: Likewise.
10413         * script.h: Likewise.
10414         * sparc.cc: Likewise.
10415         * symtab.cc: Likewise.
10416         * symtab.h: Likewise.
10417         * target-select.cc: Likewise.
10418         * target-select.h: Likewise.
10419         * token.h: Likewise.
10420         * workqueue.cc: Likewise.
10421         * workqueue.h: Likewise.
10422         * x86_64.cc: Likewise.
10423
10424 2009-12-10  Doug Kwan  <dougkwan@google.com>
10425
10426         * arm.cc (attributes.h): New include.
10427         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
10428         (Arm_relobj::~Arm_relobj): Delete object pointed by
10429         attributes_section_data_.
10430         (Arm_relobj::attributes_section_data): New method definition.
10431         (Arm_relobj::attributes_section_data_): New data member declaration.
10432         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
10433         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
10434         attributes_section_data_.
10435         (Arm_dynobj::attributes_section_data): New method definition.
10436         (Arm_dynobj::attributes_section_data_): New data member declaration.
10437         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
10438         initialization value of may_use_blx_ to false.
10439         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
10440         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
10441         object attributes to compute results instead of hard-coding.
10442         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
10443         Target_arm::get_secondary_compatible_arch,
10444         Target_arm::set_secondary_compatible_arch
10445         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
10446         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
10447         New method declarations.
10448         (Target_arm::get_aeabi_object_attribute): New method definition.
10449         (Target_arm::attributes_section_data_): New data member declaration.
10450         (read_arm_attributes_section): New template definition.
10451         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
10452         (Arm_dynobj::do_read_symbols): Ditto.
10453         (Target_arm::do_finalize_sections): Merge attributes sections from
10454         input.  Check for BLX use after attributes section merging.
10455         Fix __exidx_start and __exidx_end visibility.  Create an
10456         .ARM.attributes section if necessary.
10457         (Target_arm::get_secondary_compatible_arch,
10458         Target_arm::set_secondary_compatible_arch,
10459         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
10460         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
10461         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
10462         New method definitions.
10463
10464 2009-12-09  Ian Lance Taylor  <iant@google.com>
10465
10466         * plugin.cc (Plugin::load): Don't cast from void* to a function
10467         pointer.
10468
10469 2009-12-09  Ian Lance Taylor  <iant@google.com>
10470
10471         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
10472         information fields.
10473
10474 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
10475
10476         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
10477         Replace two_file_shared_1.so with two_file_shared_2.so.
10478         * testsuite/Makefile.in: Regenerated.
10479
10480 2009-12-08  Doug Kwan  <dougkwan@google.com>
10481
10482         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
10483         (HFILES): Add attributes.h and int_encoding.h.
10484         * Makefile.in: Regenerate.
10485         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
10486         function definitions to int_encoding.cc
10487         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
10488         prototypes to int_encoding.h
10489         * reduced_debug_output.cc (int_encoding.h): New include.
10490         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
10491         function definitions to int_encoding.cc
10492         (insert_into_vector, read_from_pointer): Move template definitions to
10493         int_encoding.h
10494         * attributes.cc: New file.
10495         * attributes.h: New file.
10496         * int_encoding.cc: New file.
10497         * int_encoding.h: New file.
10498
10499 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
10500
10501         PR gold/11055
10502         * incremental-dump.cc (dump_incremental_inputs): New.
10503         (main): Use dump_incremental_inputs.
10504
10505 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
10506
10507         PR gold/10893
10508         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
10509         checking elfcpp::STT_FUNC.
10510         (Target_i386::Relocate::relocate): Likewise.
10511         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
10512
10513         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
10514         symbols from shared libraries into normal FUNC symbols.
10515
10516         * symtab.h (Symbol): Add is_func and use it.
10517
10518 2009-12-05  Doug Kwan  <dougkwan@google.com>
10519
10520         * arm.cc (Target_arm::arm_info): Initialize new fields
10521         attributes_section and attributes_vendor.
10522         * i386.cc (Target_i386::i386_info): Same.
10523         * object.cc (Sized_relobj::do_layout): Skip attribute section.
10524         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
10525         fields attributes_section and attributes_vendor.
10526         * sparc.cc (Target_sparc::sparc_info): Same.
10527         * target.h (Target::attributes_section, Target::attributes_vendor,
10528         Target::is_attributes_section, Target::attribute_arg_type,
10529         Target::attributes_order): New method definitions.
10530         (Target::Target_info::attributes_section,
10531         Target::Target_info::attributes_vendor): New fields.
10532         (Target::do_attribute_arg_type, Target::do_attributes_order): New
10533         virtual method definitions.
10534         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
10535         attributes_section and attributes_vendor.
10536         * testsuite/testfile.cc (Target_test::test_target_info): Same.
10537
10538 2009-12-05  Doug Kwan  <dougkwan@google.com>
10539
10540         * arm.cc: Update comments about interworking and stub generation.
10541         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
10542         considered as non-PIC.
10543         (Arm_relocate_functions::base_abs): Fix formatting.
10544         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
10545         of function to use GOT entry address instead of offset.
10546         (Target_arm::Scan::global): Issue an error if a symbol would need a
10547         PLT does not get one because it is untyped.  Remove code to create
10548         dynamic symbols for relative branches.
10549         (Target_arm::Relocate::relocate: Use 0 instead of false since function
10550         takes unsigned integer instead of boolean.
10551
10552 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
10553
10554         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
10555         (two_file_test_LDADD): Likewise.
10556         (common_test_1_LDADD): Likewise.
10557         (exception_test_LDADD) Likewise.
10558         (weak_test_LDADD): Likewise.
10559         (many_sections_test_LDADD): Likewise.
10560         (initpri1_LDADD): Likewise.
10561         (script_test_1_LDADD): Likewise.
10562         (script_test_2_LDADD): Likewise.
10563         (justsyms_LDADD): Likewise.
10564         (binary_test_LDADD): Likewise.
10565         (large_LDADD): Likewise.
10566         * testsuite/Makefile.in: Regenerated.
10567
10568 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
10569
10570         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
10571         (Symbol_table::override_with_special): Likewise.
10572         (Symbol_table::add_from_object): Likewise.
10573
10574 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
10575
10576         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
10577         Don't set the data_offset twice.
10578
10579 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
10580
10581         * testsuite/Makefile.in: Regenerate.
10582
10583 2009-12-03  Doug Kwan  <dougkwan@google.com>
10584
10585         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
10586         (Target_arm::do_finalize_sections): Add parameter for symbol table
10587         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
10588         * i386.cc (Target_i386::do_finalize_sections): Add an additional
10589         parameter for symbol table pointer.
10590         * layout.cc (Layout::finalize): Call Target::finalize_sections with
10591         an additional parameter for a pointer to symbol table.
10592         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
10593         parameter for a symbol table pointer.
10594         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
10595         * target.h (Target::finalize_sections, Target::do_finalize_sections):
10596         Ditto.
10597         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
10598         parameter for a symbol table pointer.
10599
10600 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
10601
10602         * incremental.cc (Incremental_inputs_header)
10603         (Incremental_inputs_header_write, Incremental_inputs_entry)
10604         (Incremental_inputs_entry_write): Move ...
10605         * incremental.h (Incremental_inputs_header)
10606         (Incremental_inputs_header_write, Incremental_inputs_entry)
10607         (Incremental_inputs_entry_write): here.
10608
10609 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10610
10611         * incremental.cc (make_sized_incremental_binary): Set the target.
10612         Error if it is incompatible.
10613         * output.h (Output_file): Add filename method.
10614
10615 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10616
10617         * incremental.cc (Incremental_inputs_entry): Remove unused argument
10618         from the get_* methods.
10619
10620 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10621
10622         * incremental-dump.cc (main): Check that the offeset of a script is 0.
10623         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
10624         Write 0 for the data_offset of scripts.
10625
10626 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10627
10628         * testsuite/Makefile.am: Add the incremental_test.sh test.
10629         * testsuite/incremental_test.sh: New.
10630         * testsuite/incremental_test_1.c: New.
10631         * testsuite/incremental_test_2.c: New.
10632
10633 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
10634
10635         * incremental-dump.cc (main): Fix typos.
10636
10637 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
10638
10639         PR gold/11025
10640         * incremental-dump.cc (main): Use llu to print 64 bit values.
10641
10642 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
10643             H.J. Lu  <hongjiu.lu@intel.com>
10644
10645         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
10646         $(LIBDL).
10647         (incremental_dump_LDADD): Likewise.
10648         * Makefile.in: Regenerated.
10649
10650 2009-11-25  Doug Kwan  <dougkwan@google.com>
10651
10652         Revert:
10653
10654         2009-11-25  Doug Kwan  <dougkwan@google.com>
10655
10656                 * arm.cc (Target_arm::Target_arm): Move method definition
10657                 outside of class definition.  Add code to handle
10658                 --target1-rel, --target1-abs and --target2= options.
10659                 (Target_arm::get_reloc_reloc_type): Change method to be
10660                 non-static and const.
10661                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
10662                 New data 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):
10666                 Adjust call to Target_arm::get_real_reloc_type.
10667                 (Target_arm::get_real_reloc_type): Use command line options
10668                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
10669                 * options.h (--target1-rel, --target1-abs, --target2): New
10670                 ARM-only options.
10671
10672 2009-11-25  Doug Kwan  <dougkwan@google.com>
10673
10674         * arm.cc (Target_arm::Target_arm): Move method definition outside of
10675         class definition.  Add code to handle --target1-rel, --target1-abs
10676         and --target2= options.
10677         (Target_arm::get_reloc_reloc_type): Change method to be non-static
10678         and const.
10679         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
10680         member declaration.
10681         (Target_arm::Scan::local, Target_arm::Scan::global,
10682         Target_arm::Relocate::relocate,
10683         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
10684         call to Target_arm::get_real_reloc_type.
10685         (Target_arm::get_real_reloc_type): Use command line options to
10686         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
10687         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
10688         options.
10689
10690 2009-11-25  Doug Kwan  <dougkwan@google.com>
10691
10692         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
10693         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
10694         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
10695         formatting.
10696         (Arm_relocate_functions::thm_call): Replace body with a call to
10697         Arm_relocate_functions::thumb_branch_common.
10698         (Arm_relocate_functions::thm_jump24,
10699         Arm_relocate_functions::thm_xpc22): New method definitions.
10700         (Arm_relocate_functions::thumb_branch_common): New method definition.
10701         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
10702         operator.
10703         (Target_arm::Relocate::relocate): Adjust call to thm_call.
10704         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
10705
10706 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
10707
10708         * Makefile.am: Build incremental-dump
10709         * Makefile.in: Regenerate.
10710         * incremental-dump.cc: New.
10711         * incremental.cc (Incremental_inputs_header_data,
10712         Incremental_inputs_entry_data): Move to incremental.h
10713         * incremental.h: (Incremental_inputs_header_data,
10714         Incremental_inputs_entry_data): Move from incremental.cc
10715
10716 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
10717
10718         * incremental.cc (Incremental_inputs_header,
10719         Incremental_inputs_header_write, Incremental_inputs_entry,
10720         Incremental_inputs_entry_write): Add a typedef with the data type.
10721
10722 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
10723
10724         * incremental.cc (Incremental_inputs_header,
10725         Incremental_inputs_header_write, Incremental_inputs_entry,
10726         Incremental_inputs_entry_write): Update comment about which
10727         type has the filed descriptions.
10728
10729 2009-11-15  Doug Kwan  <dougkwan@google.com>
10730
10731         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
10732         (Arm_relocate_functions::arm_branch_common): Change method defintion
10733         in class definition to a method declaration and update list of formal
10734         parameters.
10735         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
10736         Arm_relocation_functions::jump24): Adjust call to
10737         Arm_relocate_functions::arm_branch_common.  Update list of formal
10738         parameters.
10739         (Arm_relocate_functions::xpc25): New method definition.
10740         (Arm_relocate_functions::arm_branch_common): Move method defintion
10741         out from class definition.  Use stubs for mode-switching and extending
10742         branch ranges.
10743         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
10744         specially.  Change code to enable use of stubs in ARM branches.
10745
10746 2009-11-10  Doug Kwan  <dougkwan@google.com>
10747
10748         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
10749         in method declaration.
10750         (Target_arm::relocate_stub): New method declaration.
10751         (Target_arm::default_target): Change to return a pointer instead of
10752         a const reference.
10753         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
10754         Target_arm::default_target.
10755         (Arm_Relobj::do_relocate_sections): Remove options paramater in
10756         method definition.
10757         (Target_arm::relocate_section): Adjust view.
10758         (Target_arm::relocate_stub): New method definition.
10759
10760 2009-11-10  Doug Kwan  <dougkwan@google.com>
10761
10762         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
10763         a format warning.
10764         * incremental.cc (open_incremental_binary): Initialized local
10765         variables to avoid warnings.
10766         * object.cc (make_elf_object): Ditto.
10767         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
10768         a format warning.
10769
10770 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
10771
10772         PR gold/10930
10773         * testsuite/plugin_test.c: Include "config.h".
10774
10775 2009-11-09  Doug Kwan  <dougkwan@google.com>
10776
10777         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
10778         (arm_symbol_value): Remove.
10779         (Arm_relocate_functions::arm_branch_common,
10780         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
10781         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
10782         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
10783         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
10784         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
10785         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
10786         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
10787         Arm_relocate_functions::thm_mobw_abs_nc,
10788         Arm_relocate_functions::thm_mov_abs,
10789         Arm_relocate_functions::movw_prel_nc,
10790         Arm_relocate_functions::thm_movt_abs,
10791         Arm_relocate_functions::movt_prel,
10792         Arm_relocate_functions::thm_movw_prel_nc,
10793         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
10794         (Target_arm::Relocate::relocate): Only decompose address into two
10795         parts if relocation type uses the thumb-bit and pass the actual
10796         bit instead of a flag indicating that the thumb-bit is used.  Adjust
10797         calls to methods in Arm_relocate_functions for this change.
10798
10799 2009-11-08  Ian Lance Taylor  <iant@google.com>
10800
10801         PR 10925
10802         * reloc.cc: Instantiate
10803         Sized_relobj::initialize_input_to_output_maps and
10804         Sized_relobj:free_input_to_output_maps.
10805
10806 2009-11-06  Ian Lance Taylor  <iant@google.com>
10807
10808         PR 10876
10809         * defstd.cc (in_segment): Set only_if_ref true for "end".
10810
10811 2009-11-06  Doug Kwan  <dougkwan@google.com>
10812
10813         * arm.cc (class Reloc_stub): Correct a comment.
10814         (Target_arm::Target_arm): Initialize arm_input_section_map_.
10815         (Target_arm::scan_section_for_stubs): New method declaration.
10816         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
10817         Change methods from private to protected.
10818         (Target_arm::do_may_relax): New method definition.
10819         (Target_arm::do_relax, Target_arm::group_sections,
10820         Target_arm::scan_reloc_for_stub,
10821         Target_arm::scan_reloc_section_for_stubs): New method declarations.
10822         (Target_arm::arm_input_section_map_): New data member declaration.
10823         (Target_arm::scan_reloc_for_stub,
10824         Target_arm::scan_reloc_section_for_stubs,
10825         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
10826         Target_arm::do_relax): New method definitions.
10827
10828 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
10829
10830         * configure.ac: Check for (struct stat)::st_mtim
10831         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
10832         * config.in: Regenerate.
10833         * configure: Regenerate.
10834
10835 2009-11-05  Ian Lance Taylor  <iant@google.com>
10836
10837         PR 10910
10838         * output.cc (Output_segment::add_output_section): Add missing
10839         return statement.
10840
10841 2009-11-04  Ian Lance Taylor  <iant@google.com>
10842
10843         PR 10880
10844         * object.h (class Object): Add is_needed and set_is_needed
10845         methods.  Add is_needed_ field.  Make bool fields into bitfields.
10846         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
10847         defined in a dynamic object and referenced by a regular object,
10848         set is_needed for the dynamic object.
10849         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
10850         if the file is marked with as_needed and it is not needed.
10851
10852 2009-11-04  Ian Lance Taylor  <iant@google.com>
10853
10854         PR 10887
10855         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
10856         tags if data is discarded by linker script.
10857         * i386.cc (Target_i386::do_finalize_sections): Likewise.
10858         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
10859         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
10860         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
10861
10862 2009-11-04  Ian Lance Taylor  <iant@google.com>
10863
10864         * layout.cc (Layout::get_output_section): Add is_interp and
10865         is_dynamic_linker_section parameters.  Change all callers.
10866         (Layout::choose_output_section): Likewise.
10867         (Layout::make_output_section): Likewise.
10868         (Layout::add_output_section_data): Add is_dynamic_linker_section
10869         parameter.  Change all callers.
10870         * layout.h (class Layout): Update declarations.
10871         * output.h (class Output_section): Add is_interp, set_is_interp,
10872         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
10873         Add is_interp_, is_dynamic_linker_section_ fields.  Change
10874         generate_code_fills_at_write_ to a bitfield.
10875         * output.cc (Output_section::Output_sections): Initialize new
10876         fields.
10877         (Output_segment::add_output_section): Add do_sort parameter.
10878         Change all callers.
10879
10880 2009-11-03  Ian Lance Taylor  <iant@google.com>
10881
10882         PR 10860
10883         * options.h (class General_options): Add --warn-common.
10884         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
10885         merging two common symbols.
10886         (Symbol_table::should_override): Handle --warn-common when merging
10887         a common symbol with a defined symbol.  Use report_resolve_problem
10888         for multiple definitions.
10889         (Symbol_table::report_resolve_problem): New function.
10890         * symtab.h (class Symbol_table): Declare report_resolve_problem.
10891
10892 2009-11-03  Doug Kwan  <dougkwan@google.com>
10893
10894         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
10895         stub_factory_.
10896         (Target_arm::stub_factory): New method definition.
10897         (Target_arm::new_arm_input_section,
10898         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
10899         Target_arm::reloc_uses_thumb_bit): New method declarations.
10900         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
10901         New type definitions.
10902         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
10903         member declarations.
10904         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
10905         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
10906         New method definitions.
10907
10908 2009-11-03  Ian Lance Taylor  <iant@google.com>
10909
10910         * options.h (class General_options): Add --warn_constructors.
10911
10912 2009-11-03  Ian Lance Taylor  <iant@google.com>
10913
10914         PR 10893
10915         * defstd.cc (in_section): Add entries for __rel_iplt_start,
10916         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
10917
10918 2009-11-03  Ian Lance Taylor  <iant@google.com>
10919
10920         PR 10895
10921         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
10922         --msgid-bugs-address.
10923         (install-pdf): New target.
10924         (install-data_yes): Look up one directory to find mkinstalldirs.
10925
10926 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
10927
10928         * po/Make-in (.po.gmo): Don't generate .gmo files in source
10929         tree.
10930
10931 2009-10-30  Doug Kwan  <dougkwan@google.com>
10932
10933         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
10934
10935 2009-10-30  Doug Kwan  <dougkwan@google.com>
10936
10937         * arm.cc (Stub_addend_reader): New struct template definition
10938         and partial specializations.
10939         (Stub_addend_reader::operator()): New method definition for a
10940         partially specialized template.
10941
10942 2009-10-30  Doug Kwan  <dougkwan@google.com>
10943
10944         * arm.cc (Arm_relobj::processor_specific_flags): New method
10945         definition.
10946         (Arm_relobj::do_read_symbols): New method declaration.
10947         (Arm_relobj::processor_specific_flags_): New data member declaration.
10948         (Arm_dynobj): New class definition.
10949         (Target_arm::do_finalize_sections): Add input_objects parameter.
10950         (Target_arm::do_adjust_elf_header): New method declaration.
10951         (Target_arm::are_eabi_versions_compatible,
10952         (Target_arm::merge_processor_specific_flags): New method declaration.
10953         (Target_arm::do_make_elf_object): New overloaded method definitions
10954         and declaration.
10955         (Arm_relobj::do_read_symbols): New method definition.
10956         (Arm_dynobj::do_read_symbols): Ditto.
10957         (Target_arm::do_finalize_sections): Add input_objects parameters.
10958         Merge processor-specific flags from all input objects.
10959         (Target_arm::are_eabi_versions_compatible,
10960         Target_arm::merge_processor_specific_flags,
10961         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
10962         New method definitions.
10963         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
10964         Input_objects pointer type parameter.
10965         * layout.cc (Layout::finalize): Pass input objects to target's.
10966         finalize_sections function.
10967         * output.cc (Output_file_header::do_sized_write): Set ELF file
10968         header's processor-specific flags.
10969         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
10970         Input_objects pointer type parameter.
10971         * sparc.cc (Target_sparc::do_finalize_sections): Same.
10972         * target.h (Input_objects): New forward class declaration.
10973         (Target::processor_specific_flags,
10974         Target::are_processor_specific_flags_sect): New method definitions.
10975         (Target::finalize_sections): Add input_objects parameter.
10976         (Target::Target): Initialize processor_specific_flags_ and
10977         are_processor_specific_flags_set_.
10978         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
10979         parameter.
10980         (Target::set_processor_specific_flags): New method definition.
10981         (Target::processor_specific_flags_,
10982         Target::are_processor_specific_flags_set_): New data member
10983         declarations.
10984         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
10985         Input_objects pointer type parameter.
10986
10987 2009-10-30  Doug Kwan  <dougkwan@google.com>
10988
10989         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
10990
10991 2009-10-28  Ian Lance Taylor  <iant@google.com>
10992
10993         * object.h (class Relobj): Drop options parameter from
10994         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
10995         do_scan_relocs, do_relocate.  Change all callers.
10996         (class Sized_relobj): Drop options parameters from
10997         do_gc_process_relocs, do_scan_relocs, do_relocate,
10998         do_relocate_sections, relocate_sections, emit_relocs_scan,
10999         emit_relocs_scan_reltype.  Change all callers.
11000         (struct Relocate_info): Remove options field and all references to
11001         it.
11002         * reloc.h (class Read_relocs): Remove options constructor
11003         parameter and options_ field.  Change all callers.
11004         (class Gc_process_relocs, class Scan_relocs): Likewise.
11005         (class Relocate_task): Likewise.
11006         * target-reloc.h (scan_relocs): Remove options parameter.  Change
11007         all callers.
11008         (scan_relocatable_relocs): Likewise.
11009         * target.h (class Sized_target): Remove options parameter from
11010         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
11011         all callers.
11012         * gc.h (gc_process_relocs): Remove options parameter.  Change all
11013         callers.
11014         * arm.cc: Update functions to remove options parameters.
11015         * i386.cc: Likewise.
11016         * powerpc.cc: Likewise.
11017         * sparc.cc: Likewise.
11018         * x86_64.cc: Likewise.
11019         * testsuite/testfile.cc: Likewise.
11020
11021 2009-10-28  Doug Kwan  <dougkwan@google.com>
11022
11023         * arm.cc (Arm_relobj): New class definition.
11024         (Arm_relobj::scan_sections_for_stubs,
11025         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
11026         New method definitions.
11027
11028 2009-10-28  Cary Coutant  <ccoutant@google.com>
11029
11030         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
11031         (Plugin::cleanup_done_): New member.
11032         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
11033         (Plugin_manager::cleanup_done_): Remove.
11034         (Plugin_manager::add_input_file): Edit error message.
11035         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
11036         (Plugin_manager::cleanup): Remove use of cleanup_done_.
11037
11038 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
11039
11040         * fileread.cc: (File_read::View::~View): Use the new
11041         data_ownership_ filed.
11042         (File_read::~File_read): Dispose the new whole_file_view_.
11043         (File_read::open): Mmap the whole file if needed.
11044         (File_read::open): Use whole_file_view_ instead of contents_.
11045         (File_read::find_view): Use whole_file_view_ if applicable.
11046         (File_read::do_read): Use whole_file_view_ instead of contents_.
11047         (File_read::make_view): Use whole_file_view_ instead of contents_,
11048         update File_read::View::View call.
11049         (File_read::find_or_make_view): Update File_read::View::View
11050         call.
11051         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
11052         remove contents_
11053         (File_read::View::Data_ownership): New enum.
11054         (File_read::View::View): Replace bool mapped_ with Data_ownership
11055         argument.
11056         (File_read::View::mapped_): Remove (replaced by data_ownership_).
11057         (File_read::View::data_ownership_): New field.
11058         (File_read::contents_): Remove (replaced by whole_file_view_).
11059         (File_read::whole_file_view_): New field.
11060         * options.h (class General_options): Add --keep-files-mapped.
11061
11062 2009-10-27  Cary Coutant  <ccoutant@google.com>
11063
11064         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
11065         * testsuite/Makefile.am (plugin_test_5): New test case.
11066         * testsuite/Makefile.in: Regenerate.
11067
11068 2009-10-25  Doug Kwan  <dougkwan@google.com>
11069
11070         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
11071         from private to protected to allow access by child class.
11072         (Sized_relobj::do_relocate_sections): New method declaration.
11073         (Sized_relobj::relocate_sections): Virtualize.
11074         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
11075         Sized_relobj::relocate_sections.  Instantiate template explicitly
11076         for different target sizes and endianity.
11077
11078 2009-10-24  Doug Kwan  <dougkwan@google.com>
11079
11080         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
11081         (Arm_input_section::as_arm_input_section): New method.
11082         (Arm_output_section): New class definition.
11083         (Arm_output_section::create_stub_group,
11084         Arm_output_section::group_sections): New method definitions.
11085
11086 2009-10-22  Doug Kwan  <dougkwan@google.com>
11087
11088         * arm.cc (Arm_input_section): New class definition.
11089         (Arm_input_section::init, Arm_input_section:do_write,
11090         Arm_input_section::set_final_data_size,
11091         Arm_input_section::do_reset_address_and_file_offset): New method
11092         definitions.
11093
11094 2009-10-21  Doug Kwan  <dougkwan@google.com>
11095
11096         * arm.cc (Stub_table, Arm_input_section): New forward class
11097         declarations.
11098         (Stub_table): New class defintion.
11099         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
11100         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
11101         New method definition.
11102
11103 2009-10-21  Doug Kwan  <dougkwan@google.com>
11104
11105         * arm.cc: Update copyright comments.
11106         (Target_arm): New forward class template declaration.
11107         (Arm_address): New type.
11108         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
11109         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
11110         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
11111         constants.
11112         (Insn_template): Same.
11113         (DEF_STUBS): New macro.
11114         (Stub_type): New enum type.
11115         (Stub_template): New class definition.
11116         (Stub): Same.
11117         (Reloc_stub): Same.
11118         (Stub_factory): Same.
11119         (Target_arm::Target_arm): Initialize may_use_blx_ and
11120         should_force_pic_veneer_.
11121         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
11122         Target_arm::should_force_pic_veneer,
11123         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
11124         Target_arm::using_thumb_only, Target_arm:;default_target): New
11125         method defintions.
11126         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
11127         New data member declarations.
11128         (Insn_template::size, Insn_template::alignment): New method defintions.
11129         (Stub_template::Stub_template): New method definition.
11130         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
11131         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
11132         (Stub_factory::Stub_factory): New method definition.
11133         * gold.h (string_hash): New template.
11134         * output.h (Input_section_specifier::hash_value): Use
11135         gold::string_hash.
11136         (Input_section_specifier::string_hash): Remove.
11137         * stringpool.cc (Stringpool_template::string_hash): Use
11138         gold::string_hash.
11139
11140 2009-10-20  Doug Kwan  <dougkwan@google.com>
11141
11142         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
11143         symbols of relaxed input sections.
11144         * output.h (Output_section::find_relaxed_input_section): Make
11145         method public.
11146
11147 2009-10-16  Doug Kwan  <dougkwan@google.com>
11148
11149         * dynobj.cc (Versions::Versions): Initialize version_script_.
11150         Only insert base version symbol definition for a shared object
11151         if version script defines any version versions.
11152         (Versions::define_base_version): New method definition.
11153         (Versions::add_def): Check that base version is not needed.
11154         (Versions::add_need): Define base version lazily.
11155         * dynobj.h (Versions::define_base_version): New method declaration.
11156         (Versions::needs_base_version_): New data member declaration.
11157         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
11158         (check_DATA): Add no_version_test.stdout.
11159         (libno_version_test.so, no_version_test.o no_version_test.stdout):
11160         New make rules.
11161         * testsuite/Makefile.in: Regenerate.
11162         * testsuite/no_version_test.c: New file.
11163         * testsuite/no_version_test.sh: Ditto.
11164
11165 2009-10-16  Doug Kwan  <dougkwan@google.com>
11166
11167         * expression.cc (class Segment_start_expression): New class definition.
11168         (Segment_start_expression::value): New method definition.
11169         (script_exp_function_segment_start): Return a new
11170         Segment_start_expression.
11171         * gold/script-c.h (script_saw_segment_start_expression): New function
11172         prototype.
11173         * script-sections.cc (Script_sections::Script_sections): Initialize
11174         SAW_SEGMENT_START_EXPRESSION_ to false.
11175         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
11176         and -Tbbs options to specify section addresses if given in
11177         command line and no SEGMENT_START expression is seen in a script.
11178         * script-sections.h (Script_sections::saw_segment_start_expression,
11179         Script_sections::set_saw_segment_start_expression): New method
11180         definition.
11181         (Script_sections::saw_segment_start_expression_): New data member
11182         declaration.
11183         * script.cc (script_saw_segment_start_expression): New function.
11184         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
11185         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
11186         script_test_7.sh and script_test_8.sh.
11187         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
11188         script_test_8.stdout.
11189         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
11190         (script_test_6, script_test_6.stdout, script_test_7,
11191         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
11192         * Makefile.in: Regenerate.
11193         * testsuite/script_test_6.sh: New file.
11194         * testsuite/script_test_6.t: Same.
11195         * testsuite/script_test_7.sh: Same.
11196         * testsuite/script_test_7.t: Same.
11197         * testsuite/script_test_8.sh: Same.
11198
11199 2009-10-16  Doug Kwan  <dougkwan@google.com>
11200
11201         * output.cc (Output_segment::set_section_list_address): Cast
11202         expressions to unsigned long long type to avoid format warnings.
11203
11204 2009-10-15  Ian Lance Taylor  <iant@google.com>
11205
11206         * script.cc (Script_options::add_symbol_assignment): Always add a
11207         dot assignment to script_sections_.
11208         * script-sections.cc (Script_sections::add_dot_assignment):
11209         Initialize if necessary.
11210
11211         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
11212         program headers with no load segment if there is a linker script.
11213
11214         * layout.cc (Layout::set_segment_offsets): Align the file offset
11215         to the segment aligment for -N or -n with no load segment.
11216         * output.cc (Output_segment::add_output_section): Don't crash if
11217         the first section is a TLS section.
11218         (Output_segment::set_section_list_addresses): Print an error
11219         message if the address moves backward in a linker script.
11220         * script-sections.cc
11221         (Output_section_element_input::set_section_addresses): Don't
11222         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
11223         (Orphan_output_section::set_section_addresses): Likewise.
11224
11225 2009-10-15  Doug Kwan  <dougkwan@google.com>
11226
11227         * layout.cc (Layout::finish_dynamic_section): Generate tags
11228         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
11229         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
11230         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
11231
11232 2009-10-14  Ian Lance Taylor  <iant@google.com>
11233
11234         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
11235         fields.
11236         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
11237         data_shdr fields of relinfo.
11238         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
11239         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
11240         R_386_TLS_LDO_32, adjust based on section flags.
11241         (Target_i386::Relocate::fix_up_ldo): Remove.
11242
11243 2009-10-13  Ian Lance Taylor  <iant@google.com>
11244
11245         Add support for -pie.
11246         * options.h (class General_options): Add -pie and
11247         --pic-executable.
11248         (General_options::output_is_position_independent): Test -pie.
11249         (General_options::output_is_executable): Return true if not shared
11250         and not relocatable.
11251         (General_options::output_is_pie): Remove.
11252         * options.cc (General_options::finalize): Reject incompatible uses
11253         of -pie.
11254         * gold.cc (queue_middle_tasks): A -pie link is not static.
11255         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
11256         * symtab.cc (Symbol::final_value_is_known): Return false if
11257         output_is_position_independent.
11258         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
11259         output_is_position_independent.
11260         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
11261         output_is_position_independent.
11262         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
11263         output_is_position_independent.
11264         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
11265         two_file_pie_test.
11266         (basic_pie_test.o, basic_pie_test): New targets.
11267         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
11268         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
11269         (two_file_pie_test): New target.
11270         * testsuite/Makefile.in: Rebuild.
11271         * README: Remove note saying that -pie is not supported.
11272
11273 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
11274
11275         * options.h (class General_options): Add -init and -fini.
11276         * layout.cc (Layout::finish_dynamic_section): Emit
11277         given init and fini functions.
11278
11279 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
11280
11281         * gc.h (gc_process_relocs): Check if icf is enabled using new
11282         function.
11283         * gold.cc (queue_initial_tasks): Likewise.
11284         (queue_middle_tasks): Likewise.
11285         * object.cc (do_layout): Likewise.
11286         * symtab.cc (is_section_folded): Likewise.
11287         * main.cc (main): Likewise.
11288         * reloc.cc (Read_relocs::run): Likewise.
11289         (Sized_relobj::do_scan_relocs): Likewise.
11290         * icf.cc (is_function_ctor_or_dtor): New function.
11291         (Icf::find_identical_sections): Check if function is ctor or dtor when
11292         safe icf is chosen.
11293         * options.h (General_options::icf): Change option to be an enum.
11294         (Icf_status): New enum.
11295         (icf_enabled): New method.
11296         (icf_safe_folding): New method.
11297         (set_icf_status): New method.
11298         (icf_status_): New variable.
11299         * (options.cc) (General_options::finalize): Set icf_status_.
11300         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
11301         icf_test and icf_keep_unique_test to use the --icf enum flag.
11302         * testsuite/icf_safe_test.sh: New file.
11303         * testsuite/icf_safe_test.cc: New file.
11304
11305 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
11306
11307         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
11308         includes to gc.h and icf.h.
11309         * arm.cc: Include gc.h.
11310         * gold.cc: Likewise.
11311         * i386.cc: Likewise.
11312         * powerpc.cc: Likewise.
11313         * sparc.cc: Likewise.
11314         * x86_64.cc: Likewise.
11315         * gc.h: Include icf.h.
11316
11317 2009-10-11  Ian Lance Taylor  <iant@google.com>
11318
11319         * plugin.cc: Include "gold.h" before other header files.
11320
11321 2009-10-10  Chris Demetriou  <cgd@google.com>
11322
11323         * options.h (Input_file_argument::Input_file_type): New enum.
11324         (Input_file_argument::is_lib_): Replace with...
11325         (Input_file_argument::type_): New member.
11326         (Input_file_argument::Input_file_argument): Take Input_file_type
11327         'type' rather than boolean 'is_lib' as second argument.
11328         (Input_file_argument::is_lib): Use type_.
11329         (Input_file_argument::is_searched_file): New function.
11330         (Input_file_argument::may_need_search): Handle is_searched_file.
11331         * options.cc (General_options::parse_library): Support -l:filename.
11332         (General_options::parse_just_symbols): Update for Input_file_argument
11333         changes.
11334         (Command_line::process): Likewise.
11335         * archive.cc (Archive::get_file_and_offset): Likewise.
11336         * plugin.cc (Plugin_manager::release_input_file): Likewise.
11337         * script.cc (read_script_file, script_add_file): Likewise.
11338         * fileread.cc (Input_file::Input_file): Likewise.
11339         (Input_file::will_search_for): Handle is_searched_file.
11340         (Input_file::open): Likewise.
11341         * readsyms.cc (Read_symbols::get_name): Likewise.
11342         * testsuite/Makefile.am (searched_file_test): New test.
11343         * testsuite/Makefile.in: Regenerate.
11344         * testsuite/searched_file_test.cc: New file.
11345         * testsuite/searched_file_test_lib.cc: New file.
11346
11347 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11348             Ian Lance Taylor  <iant@google.com>
11349
11350         * descriptor.cc: Include <cstdio> and "binary-io.h".
11351         (Descriptors::open): Open the files in binary mode always.
11352         * script.cc (Lex::get_token): Treat \r as whitespace.
11353
11354 2009-10-09  Ian Lance Taylor  <iant@google.com>
11355
11356         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
11357
11358 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11359             Ian Lance Taylor  <iant@google.com>
11360
11361         * configure.ac: Check for readv function also.
11362         * fileread.cc (readv): Define if not HAVE_READV.
11363         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
11364         does not exist.
11365         * config.in: Regenerate.
11366         * configure: Regenerate.
11367
11368 2009-10-09  Doug Kwan  <dougkwan@google.com>
11369
11370         * layout.cc (Layout::make_output_section): Call target hook to make
11371         ordinary output section.
11372         (Layout::finalize): Adjust parameter list of call the
11373         Target::may_relax().
11374         * layout.h (class Layout::section_list): New method.
11375         * merge.h (Output_merge_base::entsize): Change visibility to public.
11376         (Output_merge_base::is_string, Output_merge_base::do_is_string):
11377         New methods.
11378         (Output_merge_string::do_is_string): New method.
11379         * object.cc (Sized_relobj::do_setup): renamed from
11380         Sized_relobj::set_up.
11381         * object.h (Sized_relobj::adjust_shndx,
11382         Sized_relobj::initializ_input_to_output_maps,
11383         Sized_relobj::free_input_to_output_maps): Change visibilities to
11384         protected.
11385         (Sized_relobj::setup): Virtualize.
11386         (Sized_relobj::do_setup): New method declaration.
11387         (Sized_relobj::invalidate_section_offset,
11388         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
11389         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
11390         * options.cc (parse_int): New function.
11391         * options.h (parse_int): New declaration.
11392         (DEFINE_int): New macro.
11393         (stub_group_size): New option.
11394         * output.cc (Output_section::Output_section): Initialize memebers
11395         merge_section_map_, merge_section_by_properties_map_,
11396         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
11397         (Output_section::add_input_section): Handled deferred code-fill
11398         generation and remove an old comment.
11399         (Output_section::add_relaxed_input_section): New method definition.
11400         (Output_section::add_merge_input_section): Use merge section by
11401         properties map to speed to search.  Update merge section maps
11402         as appropriate.
11403         (Output_section::build_relaxation_map): New method definition.
11404         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
11405         Same.
11406         (Output_section::relax_input_section): Renamed to
11407         Output_section::convert_input_sections_to_relaxed_sections and change
11408         interface to take a vector of pointers to relaxed sections.
11409         (Output_section::find_merge_section,
11410         Output_section::find_relaxed_input_section): New method definitions.
11411         (Output_section::is_input_address_mapped,
11412         Output_section::output_offset, Output_section::output_address):
11413         Use output section data maps to speed up searching.
11414         (Output_section::find_starting_output_address): Add comments.
11415         (Output_section::do_write,
11416         Output_section::write_to_postprocessing_buffer): Do code-fill
11417         generation as appropriate.
11418         (Output_section::get_input_sections): Invalidate relaxed input section
11419         map.
11420         (Output_section::restore_states): Adjust type of checkpoint .
11421         Invalidate relaxed input section map.
11422         * output.h (Output_merge_base): New class declaration.
11423         (Input_section_specifier): New class defintion.
11424         (class Output_relaxed_input_section) Change base class to
11425         Output_section_data_build.
11426         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
11427         base class initializer.
11428         (Output_section::add_relaxed_input_section): New method declaration.
11429         (Output_section::Input_section): Change visibility to protected.
11430         (Output_section::Input_section::relobj,
11431         Output_section::Input_section::shndx): Handle relaxed input sections.
11432         Output_section::input_sections) Change visibility to protected.  Also
11433         define overload to return a non-const pointer.
11434         (Output_section::Merge_section_properties): New class defintion.
11435         (Output_section::Merge_section_by_properties_map,
11436         Output_section::Output_section_data_by_input_section_map,
11437         Output_section::Relaxation_map): New types.
11438         (Output_section::relax_input_section): Rename method to
11439         Output_section::convert_input_sections_to_relaxed_sections and change
11440         interface to take a vector of relaxed section pointers.
11441         (Output_section::find_merge_section,
11442         Output_section::find_relaxed_input_section,
11443         Output_section::build_relaxation_map,
11444         Output_section::convert_input_sections_in_list_to_relaxed_sections):
11445         New method declarations.
11446         (Output_section::merge_section_map_
11447         Output_section::merge_section_by_properties_map_,
11448         Output_section::relaxed_input_section_map_,
11449         Output_section::is_relaxed_input_section_map_valid_,
11450         Output_section::generate_code_fills_at_write_): New data members.
11451         * script-sections.cc
11452         (Output_section_element_input::set_section_addresses): Call
11453         current_data_size and addralign methods of relaxed input sections.
11454         (Orphan_output_section::set_section_addresses): Call current_data_size
11455         and addralign methods of relaxed input sections.
11456         * symtab.cc (Symbol_table::compute_final_value): Extract template
11457         from the body of Symbol_table::sized_finalize_symbol.
11458         (Symbol_table::sized_finalized_symbol): Call
11459         Symbol_table::compute_final_value.
11460         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
11461         (Symbol_table::compute_final_value): New templated method declaration.
11462         * target.cc (Target::do_make_output_section): New method defintion.
11463         * target.h (Target::make_output_section): New method declaration.
11464         (Target::relax): Add more parameters for input objects, symbol table
11465         and layout.  Adjust call to do_relax.
11466         (Target::do_make_output_section): New method declaration.
11467         (Target::do_relax): Add parameters for input objects, symbol table
11468         and layout.
11469
11470 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11471
11472         * pread.c: Include stdio.h.
11473
11474 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11475
11476         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
11477         defined.
11478
11479 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11480
11481         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
11482         Change read_shndx type to unsigned int.
11483         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
11484         int.
11485         (Sized_dwarf_line_info::read_line_mappings): Likewise.
11486         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
11487         Change read_shndx type to unsigned int.
11488         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
11489         int.
11490         (Sized_dwarf_line_info::read_line_mappings): Likewise.
11491         * layout.cc (Layout::create_symtab_sections): Cast the result of
11492         local_symcount * symsize to off_t in the gold_assert.
11493
11494 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11495
11496         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
11497         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
11498         R_ARM_BASE_ABS.
11499         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
11500         (Arm_relocate_functions::thm_abs5): New function.
11501         (Arm_relocate_functions::abs12): New function.
11502         (Arm_relocate_functions::abs16): New function.
11503         (Arm_relocate_functions::base_abs): New function.
11504         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
11505         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
11506         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
11507         R_ARM_BASE_ABS.
11508         (Scan::global): Likewise.
11509         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
11510         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
11511         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
11512         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
11513         R_ARM_BASE_ABS.
11514
11515 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11516
11517         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
11518         (Arm_relocate_functions::movt_prel): New function.
11519         (Arm_relocate_functions::thm_movw_prel_nc): New function.
11520         (Arm_relocate_functions::thm_movt_prel): New function.
11521         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
11522         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
11523         (Scan::global, Relocate::relocate): Likewise.
11524         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11525
11526 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
11527
11528         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
11529         Incremental_checker.
11530         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
11531         unsigned int.
11532         (class Incremental_inputs_header): New class.
11533         (Incremental_inputs_header_writer): Edit comment.
11534         (Incremental_inputs_entry): New class.
11535         (Incremental_inputs_entry_writer): Edit comment.
11536         (Sized_incremental_binary::do_find_incremental_inputs_section):
11537         Add *strtab_shndx parameter, fill it.
11538         (Sized_incremental_binary::do_check_inputs): New method.
11539         (Incremental_checker::can_incrementally_link_output_file): Use
11540         Sized_incremental_binary::check_inputs.
11541         (Incremental_inputs::report_command_line): Save command line in
11542         command_line_.
11543         * incremental.h:
11544         (Incremental_binary::find_incremental_inputs_section): New
11545         method.
11546         (Incremental_binary::do_find_incremental_inputs_section): Add
11547         strtab_shndx parameter.
11548         (Incremental_binary::do_check_inputs): New pure virtual method.
11549         (Sized_incremental_binary::do_check_inputs): Declare.
11550         (Incremental_checker::Incremental_checker): Add incremental_inputs
11551         parameter, use it to initialize incremental_inputs_.
11552         (Incremental_checker::incremental_inputs_): New field.
11553         (Incremental_checker::command_line): New method.
11554         (Incremental_checker::inputs): New method.
11555         (Incremental_checker::command_line_): New field.
11556
11557 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
11558
11559         * incremental.cc: Include <cstdarg> and "target-select.h".
11560         (vexplain_no_incremental): New function.
11561         (explain_no_incremental): New function.
11562         (Incremental_binary::error): New method.
11563         (Sized_incremental_binary::do_find_incremental_inputs_section): New
11564         method.
11565         (make_sized_incremental_binary): New function.
11566         (open_incremental_binary): New function.
11567         (can_incrementally_link_file): Add checks if output is ELF and has
11568         inputs section.
11569         * incremental.h: Include "elfcpp_file.h" and "output.h".
11570         (Incremental_binary): New class.
11571         (Sized_incremental_binary): New class.
11572         (open_incremental_binary): Declare.
11573         * object.cc (is_elf_object): Use
11574         elfcpp::Elf_recognizer::is_elf_file.
11575         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
11576         * output.h (Output_file::filesize): New method.
11577
11578 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11579
11580         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
11581         New function.
11582         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
11583         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
11584         function.
11585         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
11586         function.
11587         (Arm_relocate_functions::movw_abs_nc): New function.
11588         (Arm_relocate_functions::movt_abs): New function.
11589         (Arm_relocate_functions::thm_movw_abs_nc): New function.
11590         (Arm_relocate_functions::thm_movt_abs): New function.
11591         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
11592         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
11593         (Scan::global): Likewise.
11594         (Relocate::relocate): Likewise.
11595         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11596
11597 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11598
11599         * arm.cc (Arm_relocate_functions::got_prel) New function.
11600         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
11601         (Relocate::relocate): Likewise.
11602         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11603
11604 2009-10-06  Ian Lance Taylor  <iant@google.com>
11605
11606         * options.h (class General_options): Define
11607         split_stack_adjust_size parameter.
11608         * object.h (class Object): Add uses_split_stack_ and
11609         has_no_split_stack_ fields.  Add uses_split_stack and
11610         has_no_split_stack accessor functions.  Declare
11611         handle_split_stack_section.
11612         (class Reloc_symbol_changes): Define.
11613         (class Sized_relobj): Define Function_offsets.  Declare
11614         split_stack_adjust, split_stack_adjust_reltype, and
11615         find_functions.
11616         * object.cc (Object::handle_split_stack_section): New function.
11617         (Sized_relobj::do_layout): Call handle_split_stack_section.
11618         * dynobj.cc (Sized_dynobj::do_layout): Call
11619         handle_split_stack_section.
11620         * reloc.cc (Sized_relobj::relocate_sections): Call
11621         split_stack_adjust for executable sections in split_stack
11622         objects.  Pass reloc_map to relocate_section.
11623         (Sized_relobj::split_stack_adjust): New function.
11624         (Sized_relobj::split_stack_adjust_reltype): New function.
11625         (Sized_relobj::find_functions): New function.
11626         * target-reloc.h: Include "object.h".
11627         (relocate_section): Add reloc_symbol_changes parameter.  Change
11628         all callers.
11629         * target.h (class Target): Add calls_non_split method.  Declare
11630         do_calls_non_split virtual method.  Declare match_view and
11631         set_view_to_nop.
11632         * target.cc: Include "elfcpp.h".
11633         (Target::do_calls_non_split): New function.
11634         (Target::match_view): New function.
11635         (Target::set_view_to_nop): New function.
11636         * gold.cc (queue_middle_tasks): Give an error if mixing
11637         split-stack and non-split-stack objects with -r.
11638         * i386.cc (Target_i386::relocate_section): Add
11639         reloc_symbol_changes parameter.
11640         (Target_i386::do_calls_non_split): New function.
11641         * x86_64.cc (Target_x86_64::relocate_section): Add
11642         reloc_symbol_changes parameter.
11643         (Target_x86_64::do_calls_non_split): New function.
11644         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
11645         parameter.
11646         * powerpc.cc (Target_powerpc::relocate_section): Add
11647         reloc_symbol_changes parameter.
11648         * sparc.cc (Target_sparc::relocate_section): Add
11649         reloc_symbol_changes parameter.
11650         * configure.ac: Call AM_CONDITIONAL for the default target.
11651         * configure: Rebuild.
11652         * testsuite/Makefile.am (TEST_AS): New variable.
11653         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
11654         (check_DATA): Add split_i386 and split_x86_64 files.
11655         (SPLIT_DEFSYMS): Define.
11656         (split_i386_[1234n].o): New targets.
11657         (split_i386_[124]): New targets.
11658         (split_i386_[1234r].stdout): New targets.
11659         (split_x86_64_[1234n].o): New targets.
11660         (split_x86_64_[124]): New targets.
11661         (split_x86_64_[1234r].stdout): New targets.
11662         (MOSTLYCLEANFILES): Add new executables.
11663         * testsuite/split_i386.sh: New file.
11664         * testsuite/split_x86_64.sh: New file.
11665         * testsuite/split_i386_1.s: New file.
11666         * testsuite/split_i386_2.s: New file.
11667         * testsuite/split_i386_3.s: New file.
11668         * testsuite/split_i386_4.s: New file.
11669         * testsuite/split_i386_n.s: New file.
11670         * testsuite/split_x86_64_1.s: New file.
11671         * testsuite/split_x86_64_2.s: New file.
11672         * testsuite/split_x86_64_3.s: New file.
11673         * testsuite/split_x86_64_4.s: New file.
11674         * testsuite/split_x86_64_n.s: New file.
11675         * testsuite/testfile.cc (Target_test): Update relocation_section
11676         function.
11677         * testsuite/Makefile.in: Rebuild.
11678
11679 2009-10-06  Ian Lance Taylor  <iant@google.com>
11680
11681         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
11682         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
11683         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
11684         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
11685         the address on ldo_addrs_.
11686         (Target_i386::Relocate::fix_up_ldo): New function.
11687
11688 2009-10-06   Rafael Espindola  <espindola@google.com>
11689
11690         * plugin.cc (add_input_library): New.
11691         (Plugin::load): Add add_input_library to tv.
11692         (Plugin_manager::add_input_file): Add the is_lib argument.
11693         (add_input_file): Update call to Plugin_manager::add_input_file.
11694         (add_input_library): New.
11695         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
11696
11697 2009-09-30  Doug Kwan  <dougkwan@google.com>
11698
11699         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
11700         symbol and call Symbol::may_need_copy_reloc to determine if
11701         a copy reloc is needed.
11702         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
11703         nocopyreloc is given in command line.
11704         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
11705         given in command line.
11706         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
11707         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
11708         of the removed Target_i386::may_need_copy_reloc.
11709         * options.h (copyreloc): New option with default value false.
11710         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
11711         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
11712         instead of the removed Target_powerpc::may_need_copy_reloc.
11713         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
11714         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
11715         instead of the removed Target_sparc::may_need_copy_reloc.
11716         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
11717         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
11718         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
11719         instead of the removed Target_x86_64::may_need_copy_reloc.
11720
11721 2009-09-30  Ian Lance Taylor  <iant@google.com>
11722
11723         * object.h (class Object): Remove target_ field, and target,
11724         sized_target, and set_target methods.
11725         (Object::sized_target): Remove.
11726         (class Sized_relobj): Update declarations.  Remove sized_target.
11727         * object.cc (Sized_relobj::setup): Remove target parameter.
11728         Change all callers.
11729         (Input_objects::add_object): Don't do anything with the target.
11730         (make_elf_sized_object): Add punconfigured parameter.  Change all
11731         callers.  Set or test parameter target.
11732         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
11733         Change all callers.
11734         * parameters.cc (Parameters::set_target): Change parameter type to
11735         be non-const.
11736         (Parameters::default_target): Remove.
11737         (set_parameters_target): Change parameter type to be non-const.
11738         (parameters_force_valid_target): New function.
11739         (parameters_clear_target): New function.
11740         * parameters.h (class Parameters): Update declarations.  Remove
11741         default_target method.  Add sized_target and clear_target
11742         methods.  Change target_ to be non-const.
11743         (set_parameters_target): Update declaration.
11744         (parameters_force_valid_target): Declare.
11745         (parameters_clear_target): Declare.
11746         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
11747         as NULL if we aren't searching.
11748         (Add_symbols::run): Don't check for compatible target.
11749         * fileread.cc (Input_file::open_binary): Call
11750         parameters_force_valid_target.
11751         * gold.cc (queue_middle_tasks): Likewise.
11752         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
11753         set_target on object.
11754         * dynobj.h (class Sized_dynobj): Update declarations.
11755         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
11756         make_elf_object returns NULL.
11757         (Archive::include_member): Don't check whether object target is
11758         compatible.
11759         * output.cc (Output_section::add_input_section): Get target from
11760         parameters.
11761         (Output_section::relax_input_section): Likewise.
11762         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
11763         parameters.
11764         (Sized_relobj::do_scan_relocs): Likewise.
11765         (Sized_relobj::relocate_sections): Likewise.
11766         * resolve.cc (Symbol_table::resolve): Likewise.
11767         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
11768         parameter.  Change all callers.
11769         (Symbol_table::add_from_object): Get target from parameters.
11770         (Symbol_table::add_from_relobj): Don't check object target.
11771         (Symbol_table::add_from_dynobj): Likewise.
11772         (Symbol_table::define_special_symbol): Get target from
11773         parameters.
11774         * symtab.h (class Symbol_table): Update declaration.
11775         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
11776         parameter.  Change all callers.  Clear parameter target.
11777         (Binary_test): Test target here.
11778         * testsuite/object_unittest.cc (gold_testsuite): Remove
11779         target_test_pointer parameter.  Change all callers.
11780         (Object_test): Test target here.
11781
11782 2009-09-26  Ian Lance Taylor  <iant@google.com>
11783
11784         * testsuite/initpri1.c: Don't try to use constructor priorities if
11785         compiling with gcc before 4.3.
11786
11787 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
11788
11789         * testsuite/retain_symbols_file_test.sh (check_present): Change
11790         output file name to retain_symbols_file_test.stdout.
11791         (check_absent): Likewise.
11792
11793 2009-09-18  Craig Silverstein  <csilvers@google.com>
11794
11795         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
11796         * options.cc: Include <cerrno> and <fstream>.
11797         (General_options::finalize): Parse -retain-symbols-file tag.
11798         * options.h: New flag.
11799         (General_options): New method should_retain_symbol, new
11800         variable symbols_to_retain.
11801         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
11802         should_retain_symbol map.
11803         * testsuite/Makefile.am (retain_symbols_file_test): New test.
11804         * testsuite/Makefile.in: Regenerate.
11805         * testsuite/retain_symbols_file_test.sh: New file.
11806
11807 2009-09-18  Nick Clifton  <nickc@redhat.com>
11808
11809         * po/es.po: Updated Spanish translation.
11810
11811 2009-09-17  Doug Kwan  <dougkwan@google.com>
11812
11813         * debug.h (DEBUG_RELAXATION): New constant.
11814         (DEBUG_ALL): Add DEBUG_RELAXATION.
11815         (debug_string_to_enum): Add relaxation debug option.
11816         * layout.cc
11817         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
11818         Layout::Relaxation_debug_check::read_sections,
11819         Layout::Relaxation_debug_check::read_sections): New method definitions.
11820         (Layout::Layout): Initialize data members
11821         record_output_section_data_from_scrips_,
11822         script_output_section_data_list_ and relaxation_debug_check_.
11823         (Layout::save_segments, Layout::restore_segments,
11824         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
11825         Layout::relaxation_loop_body): New method definitions.
11826         (Layout::finalize): Support relaxation.  Move section layout code to
11827         Layout::relaxation_loop_body.
11828         (Layout::set_asection_address_from_script): Move code for orphan
11829         section placement out.
11830         (Layout::place_orphan_sections_in_script): New method definition.
11831         * layout.h (Output_segment_headers, Output_file_header):
11832         New forward class declarations.
11833         (Layout::~Layout): Define.
11834         (Layout::new_output_section_data_from_script): New method definition.
11835         (Layout::place_orphan_sections_in_script): New method declaration.
11836         (Layout::Segment_states): New type declaration.
11837         (Layout::save_segments, Layout::restore_segments,
11838         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
11839         Layout::relaxation_loop_body): New method declarations.
11840         (Layout::Output_section_data_list): New type declaration.
11841         (Layout::Relaxation_debug_check): New class definition.
11842         (Layout::record_output_section_data_from_script_,
11843         Layout::script_output_section_data_list_, Layout::segment_states_,
11844         Layout::relaxation_debug_check_): New data members.
11845         * output.cc: (Output_section_headers::do_size): New method definition.
11846         (Output_section_headers::Output_section_headers): Move size
11847         computation to Output_section_headers::do_size.
11848         (Output_segment_headers::do_size): New method definition.
11849         (Output_file_header::Output_file_header): Move size computation to
11850         Output_file_header::do_size and call it.
11851         (Output_file_header::do_size): New method definition.
11852         (Output_data_group::Output_data_group): Adjust call to
11853         Output_section_data.
11854         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
11855         (Output_symtab_xindex::do_write): Add array bound check.
11856         (Output_section::Input_section::print_to_mapfile): Handle
11857         RELAXED_INPUT_SECTION_CODE.
11858         (Output_section::Output_section): Initialize data member checkpoint_.
11859         (Output_section::~Output_section): Delete checkpoint object pointed
11860         by checkpoint_.
11861         (Output_section::add_input_section): Always add an Input_section if
11862         relaxing.
11863         (Output_section::add_merge_input_section): Add assert.
11864         (Output_section::relax_input_section): New method definition.
11865         (Output_section::set_final_data_size): Set load address to zero for
11866         an unallocated section.
11867         (Output_section::do_address_and_file_offset_have_reset_values):
11868         New method definition.
11869         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
11870         Handle relaxed input section.
11871         (Output_section::sort_attached_input_sections): Checkpoint input
11872         section list lazily.
11873         (Output_section::get_input_sections): Change type of input_sections to
11874         list of Simple_input_section pointers.  Checkpoint input section list
11875         lazily.  Also handle relaxed input sections.
11876         (Output_section::add_input_section_for_script): Take a reference to
11877         a Simple_input_section object instead of Relobj pointer and section
11878         index as parameter.  Handle relaxed input sections.
11879         (Output_section::save_states, Output_section::restore_states): New
11880         method definitions.
11881         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
11882         (Output_data::is_data_size_fixed): New method definition.
11883         (Output_data::reset_addresss_and_file_offset): Do not reset data size
11884         if it is fixed.
11885         (Output_data::address_and_file_offset_have_reset_values): New method
11886         definition.
11887         (Output_data::do_address_and_file_offset_have_reset_values): New method
11888         definition.
11889         (Output_data::set_data_size): Check that data size is not fixed.
11890         (Output_data::fix_data_size): New method definition.
11891         (Output_data::is_data_size_fixed_): New data member.
11892         (Output_section_headers::set_final_data_size): New method definition.
11893         (Output_section_headers::do_size): New method declaration.
11894         (Output_segment_headers::set_final_data_size): New method definition.
11895         (Output_segment_headers::do_size): New method declaration.
11896         (Output_file_header::set_final_data_size)::New method definition.
11897         (Output_file_header::do_size)::New method declaration.
11898         (Output_section_data::Output_section_data): Add new parameter
11899         is_data_size_fixed and use it to fix data size.
11900         (Output_data_const::Output_data_const): Adjust call to base class
11901         constructor and fix data size.
11902         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
11903         base class constructor and fix data size.
11904         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
11905         base class constructor and fix data size.
11906         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
11907         class constructor and fix data size.
11908         (Output_data_group::set_final_data_size): New method definition.
11909         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
11910         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
11911         class constructor and fix data size.
11912         (Output_relaxed_input_section): New class definition.
11913         (Output_section::Simple_input_section): New class definition.
11914         (Output_section::get_input_sections): Adjust parameter list.
11915         (Output_section::add_input_section_for_script): Same.
11916         (Output_section::save_states, Output_section::restore_states,
11917         Output_section::do_address_and_file_offset_have_reset_values,
11918         (Output_section::Input_section::Input_section): Handle
11919         RELAXED_INPUT_SECTION_CODE.  Add new overload for
11920         Output_relaxed_input_section.
11921         (Output_section::Input_section::is_input_section,
11922         Output_section::Input_section::set_output_section): Handle relaxed
11923         input section.
11924         (Output_section::Input_section::is_relaxed_input_section,
11925         Output_section::Input_section::output_section_data,
11926         Output_section::Input_section::relaxed_input_section): New method
11927         definitions.
11928         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
11929         value.
11930         (Output_section::Input_section::u1_): Update comments.
11931         (Output_section::Input_section::u2_): Add new union member poris.
11932         (Output_section::Checkpoint_output_section): New classs definition.
11933         (Output_section::relax_input_section): New method declaration.
11934         (Output_section::checkpoint_): New data member.
11935         (Output_segment): Update comments.
11936         (Output_segment::Output_segment): Un-privatize copy constructor.
11937         (Output_segment::operator=): Un-privatize.
11938         * script-sections.cc (Output_section_element::Input_section_list):
11939         Change element type to Output_section::Simple_input_section.
11940         (Output_section_element_dot_assignment::set_section_addresses):
11941         Register output section data for relaxation clean up.
11942         (Output_data_exression::Output_data_expression): Adjust call to base
11943         constructor to fix data size.
11944         (Output_section_element_data::set_section_addresses): Register
11945         Output_data_expression object for relaxation clean up.
11946         (struct Input_section_info): Replace Relobj pointer and section index
11947         pair with Output_section::Simple_input_section and Convert struct to a
11948         class.
11949         (Input_section_sorter::operator()): Adjust access to
11950         Input_section_info data member to use accessors.
11951         (Output_section_element_input::set_section_addresses): Use layout
11952         parameter.  Adjust code to use Output_section::Simple_input_section
11953         and Input_secction_info classes.  Register filler for relaxation
11954         clean up.
11955         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
11956         and section index pair with Output_section::Simple_input_section
11957         class.  Adjust code accordingly.
11958         (Phdrs_element::release_segment): New method definition.
11959         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
11960         segment list.
11961         (Script_sections::release_segments): New method definition.
11962         * gold/script-sections.h (Script_sections::release_segments): New
11963         method declaration.
11964         * gold/target.h (Target::may_relax, Target::relax,
11965         Target::do_may_relax, Target::do_relax): New method definitions.
11966
11967 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11968
11969         * arm.cc (has_signed_unsigned_overflow): New function.
11970         (Arm_relocate_functions::abs8): New function.
11971         (Target_arm::Scan::local): Handle R_ARM_ABS8.
11972         (Target_arm::Scan::global): Likewise.
11973         (Target_arm::relocate::relocate): Likewise.
11974         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
11975         Likewise.
11976
11977 2009-09-16  Cary Coutant  <ccoutant@google.com>
11978
11979         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
11980         * testsuite/Makefile.in: Regenerate.
11981
11982 2009-09-11  Nick Clifton  <nickc@redhat.com>
11983
11984         * po/gold.pot: Updated by the Translation project.
11985
11986 2009-09-08  Cary Coutant  <ccoutant@google.com>
11987
11988         * output.cc (Output_file::open): Add execute permission to empty file.
11989         * testsuite/Makefile.am (permission_test): New test.
11990         * testsuite/Makefile.in: Regenerate.
11991
11992 2009-09-02  Ian Lance Taylor  <iant@google.com>
11993
11994         * output.cc (Output_file::resize): Call map_no_anonymous rather
11995         than map.
11996
11997 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
11998
11999         * gold.cc: Include "incremental.h".
12000         (queue_initial_tasks): Call Incremental_checker methods.
12001         * incremental.cc: Include "output.h".
12002         (Incremental_checker::can_incrementally_link_output_file): New
12003         method.
12004         * incremental.h (Incremental_checker): New class.
12005
12006         * output.cc (Output_file::open_for_modification): New method.
12007         (Output_file::map_anonymous): Changed return type to bool.  Record
12008         map in base_ field.
12009         (Output_file::map_no_anonymous): New method, broken out of map.
12010         (Output_file::map): Use map_no_anonymous and map_anonymous.
12011         * output.h (class Output_file): Update declarations.
12012
12013 2009-08-24  Cary Coutant  <ccoutant@google.com>
12014
12015         * options.h (Command_line::Pre_options): New class.
12016         (Command_line::pre_options): New member.
12017         * options.cc (gold::options::ready_to_register): New variable.
12018         (One_option::register_option): Do nothing if not registering options.
12019         Assert if same short option registered twice.
12020         (General_options::General_options): Turn off option registration when
12021         done constructing.
12022         (Command_line::Pre_options::Pre_options): New constructor.
12023
12024 2009-08-24  Cary Coutant  <ccoutant@google.com>
12025
12026         * options.h (General_options::no_keep_memory): Remove incorrect
12027         short option.
12028
12029 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
12030
12031         * Makefile.am (am__skiplex, am__skipyacc): New.
12032         * Makefile.in: Regenerate.
12033
12034 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
12035
12036         * Makefile.am (AM_CPPFLAGS): Renamed from ...
12037         (INCLUDES): ... this.
12038         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
12039         (AM_CPPFLAGS): Renamed from ...
12040         (INCLUDE): ... this.
12041         * Makefile.in, testsuite/Makefile.in: Regenerate.
12042
12043         * Makefile.in: Regenerate.
12044         * aclocal.m4: Likewise.
12045         * config.in: Likewise.
12046         * configure: Likewise.
12047         * testsuite/Makefile.in: Likewise.
12048
12049         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
12050         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
12051         * Makefile.in: Regenerate.
12052         * testsuite/Makefile.in: Regenerate.
12053
12054 2009-08-19  Cary Coutant  <ccoutant@google.com>
12055
12056         * resolve.cc (Symbol_table::resolve): Don't complain about defined
12057         symbols in shared libraries overridden by hidden or internal symbols
12058         in the main program.
12059
12060 2009-08-19  Chris Demetriou  <cgd@google.com>
12061
12062         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
12063         checking source file names in error messages.
12064
12065 2009-08-18  Doug Kwan  <dougkwan@google.com>
12066
12067         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
12068         an elcpp::Ehdr as parameter.  Adjust call to set_target.
12069         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
12070         an elfcpp::Ehdr as parameter.
12071         * object.cc (Object::set_target): Remove the version that looks up
12072         a target and sets it.
12073         (Sized_relobj::setup): Take a Target object instead of
12074         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
12075         (make_elf_sized_object): Find target and ask target to
12076         make an ELF object.
12077         * object.h: (Object::set_target): Remove the version that looks up
12078         a target and sets it.
12079         (Sized_relobj::setup): Take a Target object instead of
12080         an elfcpp:Ehdr as parameter.
12081         * target.cc: Include dynobj.h.
12082         (Target::do_make_elf_object_implementation): New.
12083         (Target::do_make_elf_object): New.
12084         * target.h (Target::make_elf_object): New template declaration.
12085         (Target::do_make_elf_object): New method declarations.
12086         (Target::do_make_elf_object_implementation): New template declaration.
12087
12088 2009-08-14  Ian Lance Taylor  <iant@google.com>
12089
12090         * gold.h (FUNCTION_NAME): Define.
12091         (gold_unreachable): Use FUNCTION_NAME.
12092
12093 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
12094
12095         * icf.cc (Icf::find_identical_sections): Issue a warning when a
12096         symbol in the --keep-unique list is not found.
12097
12098 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
12099
12100         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
12101         been maked as --keep-unique.
12102         (Icf::unfold_section): New function.
12103         * icf.h (Icf::unfold_section): New function.
12104         * options.h (General_options::keep_unique): New option.
12105         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
12106         * testsuite/Makefile.in: Regenerate.
12107         * testsuite/icf_keep_unique_test.sh: New file.
12108         * testsuite/icf_keep_unique_test.cc: New file.
12109
12110 2009-08-12  Cary Coutant  <ccoutant@google.com>
12111
12112         PR 10471
12113         * resolve.cc (Symbol_table::resolve): Check for references from
12114         dynamic objects to hidden and internal symbols.
12115         * testsuite/Makefile.am (hidden_test.sh): New test.
12116         * testsuite/Makefile.in: Regenerate.
12117         * testsuite/hidden_test.sh: New script.
12118         * testsuite/hidden_test_1.c: New test source.
12119         * testsuite/hidden_test_main.c: New test source.
12120
12121 2009-08-11  Doug Kwan  <dougkwan@google.com>
12122
12123         * arm.cc: Update comments.
12124         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
12125         segment to locate the .ARM.exidx section if present.
12126
12127 2009-08-09  Doug Kwan  <dougkwan@google.com>
12128
12129         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
12130         patch.
12131
12132 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
12133         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
12134         compiler warnings.
12135
12136 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
12137
12138         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
12139         valid tls_segment only for non-debug-section relocations.
12140         * testsuite/Makefile.am: Add gc_tls_test.
12141         * testsuite/Makefile.in: Regenerate.
12142         * testsuite/gc_tls_test.cc: New file.
12143         * testsuite/gc_tls_test.sh: New file.
12144
12145 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
12146
12147         * icf.cc: New file.
12148         * icf.h: New file.
12149         * Makefile.am (CCFILES): Add icf.cc.
12150         (HFILES): Add icf.h
12151         * Makefile.in: Regenerate.
12152         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
12153         * gc.h (gc_process_relocs): Populate lists used by icf to contain
12154         section, symbol and addend information for the relocs.
12155         * gold.cc (queue_middle_tasks): Call identical code folding.
12156         * gold.h: Add defines for multimap.
12157         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
12158         to the call of finalize_local_symbols.
12159         * main.cc (main): Create object of class Icf.
12160         * object.cc (Sized_relobj::do_layout): Allow this function to be
12161         called twice during icf.
12162         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
12163         to sections marked as identical by icf.
12164         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
12165         when available.
12166         (Sized_relobj::do_section_entsize): New function.
12167         * object.h (Object::section_entsize): New function.
12168         (Object::do_section_entsize): New pure virtual function.
12169         (Relobj::finalize_local_symbols): Add new parameter.
12170         (Relobj::do_section_entsize): New function.
12171         * options.h (General_options::icf): New option.
12172         (General_options::icf_iterations): New option.
12173         (General_options::print_icf_sections): New option.
12174         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
12175         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
12176         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
12177         icf.
12178         * symtab.cc (Symbol_table::is_section_folded): New function.
12179         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
12180         to sections marked as identical by icf.
12181         * symtab.h (Symbol_table::set_icf): New function.
12182         (Symbol_table::icf): New function.
12183         (Symbol_table::is_section_folded): New function.
12184         (Symbol_table::icf_): New data member.
12185         * target-reloc.h (relocate_section): Ignore sections folded by icf.
12186         * testsuite/Makefile.am: Add commands to build icf_test.
12187         * testsuite/Makefile.in: Regenerate.
12188         * testsuite/icf_test.sh: New file.
12189         * testsuite/icf_test.cc: New file.
12190
12191 2009-07-24  Chris Demetriou  <cgd@google.com>
12192
12193         * layout.cc (is_compressible_debug_section): Fix incorrect
12194         comment about compressed section names.
12195
12196 2009-07-20  Ian Lance Taylor  <ian@airs.com>
12197
12198         PR 10419
12199         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
12200
12201 2009-07-16  Ian Lance Taylor  <iant@google.com>
12202
12203         PR 10400
12204         * layout.h: #include <map>.
12205         (class Kept_section): Change from struct to class.  Add accessors
12206         and setters.  Add section size to Comdat_group mapping.  Change
12207         Comdat_group to std::map.  Add is_comdat_ field.  Add
12208         linkonce_size field in union.
12209         (class Layout): Update declaration of find_or_add_kept_section.
12210         Don't declare find_kept_object.
12211         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
12212         parameter.  Add object, shndx, is_comdat, and is_group_name
12213         parameters.  Change all callers.  Adjust for new Kept_section.
12214         (Layout::find_kept_object): Remove.
12215         * object.cc (Sized_relobj::include_section_group): Update use of
12216         Kept_section.  Rename secnum to shndx.  Only record
12217         Kept_comdat_section if sections are the same size.
12218         (Sized_relobj::include_linkonce_section): Update use of
12219         Kept_section.  Only record Kept_comdat_section if sections are the
12220         same size.  Set size of linkonce section.
12221         (Sized_relobj::map_to_kept_section): Update call to
12222         get_kept_comdat_section.
12223         * object.h (class Sized_relobj): Rename fields in
12224         Kept_comdat_section to drop trailing underscores; change object
12225         field to Relobj*.  Change Kept_comdat_section_table to store
12226         struct rather than pointer.
12227         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
12228         Add kept_object and kept_shndx parameters.  Change all callers.
12229         (Sized_relobj::get_kept_comdat_section): Change return type to
12230         bool.  Add kept_object and kept_shndx parameters.  Change all
12231         callers.
12232         * plugin.cc (Pluginobj::include_comdat_group): Update call to
12233         Layout::find_or_add_kept_section.
12234
12235 2009-07-09  Ian Lance Taylor  <iant@google.com>
12236
12237         * merge.cc (Object_merge_map::initialize_input_to_output_map):
12238         Reserve space in the hash table.
12239
12240 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
12241
12242         * fileread.cc (File_read::get_mtime): New method.
12243         * fileread.h (Timespec): New structure.
12244         (File_read::get_mtime): New method.
12245         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
12246         Renamed from timestamp_nsec.
12247         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
12248         Elf_Xword.
12249         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
12250         timestamp_nsec.
12251         (Incremental_inputs::report_archive): Save mtime; style fix.
12252         (Incremental_inputs::report_obejct): Save mtime; style fix.
12253         (Incremental_inputs::report_script): Save mtime; style fix.
12254         (Incremental_inputs::finalize_inputs): Style fix.
12255         (Incremental_inputs::finalize): Style fix.
12256         (Incremental_inputs::create_input_section_data): Store inputs
12257         mtime.
12258         * incremental.h (Incremental_inputs::report_script): Add mtime
12259         argument.
12260         (Incremental_inputs::Input_info::Input_info): Intialize only one
12261         union member.
12262         (Incremental_inputs::Input_info::archive): Move to nameless
12263         union.
12264         (Incremental_inputs::Input_info::obejct): Move to nameless union.
12265         (Incremental_inputs::Input_info::script): Move to nameless union.
12266         (Incremental_inputs::mtime): New field.
12267         * script.cc (read_input_script): Pass file mtime to
12268         Incremental_input.
12269         * script.h (Script_info::inputs): Style fix.
12270
12271 2009-07-01  Ian Lance Taylor  <ian@airs.com>
12272
12273         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
12274         instead of 32.
12275
12276 2009-06-24  Ian Lance Taylor  <iant@google.com>
12277
12278         PR 10156
12279         * layout.cc (Layout::choose_output_section): If we find an
12280         existing section, update the flags.
12281         (Layout::create_notes): New function, broken out of
12282         Layout::finalize.
12283         (Layout::finalize): Don't create note sections.
12284         (Layout::create_note): Don't crash if linker script discards
12285         section.
12286         (Layout::create_gold_note): Likewise.
12287         (Layout::create_build_id): Likewise.  Don't set
12288         after_input_sections on the section.
12289         (Layout::create_executable_stack_info): Remove target parameter.
12290         Change caller.
12291         * layout.h (class Layout): Declare create_notes.  Update
12292         declaration of create_executable_stack_info.
12293         * gold.cc (queue_middle_tasks): Call create_notes.
12294         * output.cc (Output_section::update_flags_for_input_section): Move
12295         here from output.h.  If SHF_ALLOC flag is newly set, mark address
12296         invalid.
12297         * output.h (Output_data::mark_address_invalid): New function.
12298         (class Output_section): Only declare, not define,
12299         update_flags_for_input_section.  Remove set_flags.
12300
12301 2009-06-24  Ian Lance Taylor  <iant@google.com>
12302
12303         * script-sections.cc (Output_section_definition::
12304         set_section_addresses): Rename shadowing local load_address to
12305         laddr.
12306
12307 2009-06-24  Ian Lance Taylor  <iant@google.com>
12308
12309         PR 10244
12310         * reloc.cc (relocate_sections): Skip empty relocation sections.
12311
12312 2009-06-23  Ian Lance Taylor  <iant@google.com>
12313
12314         PR 10156
12315         * layout.cc (Layout::create_note): Use choose_output_section
12316         rather than make_output_section.
12317
12318 2009-06-23  Ian Lance Taylor  <iant@google.com>
12319
12320         PR 10237
12321         * options.cc (General_options::parse_V): Set printed_version_.
12322         (General_options::General_options): Initialize printed_version_.
12323         * options.h (class General_options): Add printed_version_ field.
12324         * gold.cc (queue_initial_tasks): If there are no input files,
12325         don't give a fatal error if we printed the version information.
12326         (queue_middle_tasks): If using -r with a shared object, give a
12327         fatal error rather than an ordinary error.
12328
12329 2009-06-23  Ian Lance Taylor  <iant@google.com>
12330
12331         PR 10219
12332         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
12333         (Layout::make_output_section): Set have_stabstr_section_ if we see
12334         a .stab*str section.
12335         (Layout::finalize): Call link_stabs_sections.
12336         (Layout::link_stabs_sections): New file.
12337         * layout.h (class Layout): Add have_stabstr_section_ field.
12338         Declare link_stabs_sections.
12339
12340 2009-06-23  Doug Kwan  <dougkwan@google.com>
12341
12342         * Makefile.am (libgold_a_LIBADD): New.
12343         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
12344         * Makefile.in: Regenerate.
12345         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
12346         * configure: Regenerate.
12347         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
12348         * fileread.cc: Include sys/state.h
12349         * gold.h: Declare memmem and strndup if found missing.
12350         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
12351
12352 2009-06-23  Ian Lance Taylor  <iant@google.com>
12353
12354         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
12355         * configure: Rebuild.
12356
12357 2009-06-23  Ian Lance Taylor  <iant@google.com>
12358
12359         PR 10147
12360         * object.cc (Object::section_contents): Don't try to get a view if
12361         the section has length zero.
12362         (Object::handle_gnu_warning_section): If the section is empty, use
12363         the name of the section as the warning.
12364
12365 2009-06-23  Ian Lance Taylor  <iant@google.com>
12366
12367         PR 10133
12368         * stringpool.h (class Stringpool_template): Add optimize_ field.
12369         (Stringpool_template::set_optimize): New function.
12370         * stringpool.cc (Stringpool_template::Stringpool_template):
12371         Initialize optimize_ field.
12372         (Stringpool_template::set_string_offsets): Test local optimize
12373         fild rather than parameter.
12374         * layout.cc (Layout::Layout): Call set_optimize on the section
12375         name stringpool.
12376
12377 2009-06-22  Ian Lance Taylor  <iant@google.com>
12378
12379         PR 10030
12380         * yyscript.y: Parse TARGET.
12381         * script.cc (script_set_target): New function.
12382         * script-c.h (script_set_target): Declare.
12383         * options.cc (General_options::string_to_object_format): Rename
12384         from string_to_object_format in anonymous namespace.  Change
12385         callers.
12386         * options.h (class General_options): Declare
12387         string_to_object_format.
12388
12389 2009-06-22  Ian Lance Taylor  <iant@google.com>
12390
12391         * script-sections.cc (Script_sections::create_segments): Don't put
12392         program headers in a PT_LOAD segment if -n or -N.
12393
12394 2009-06-22  Ian Lance Taylor  <iant@google.com>
12395
12396         PR 10141
12397         * options.h (class General_options): Add -z lazy and -z now.  Sort
12398         -z options into alphabetical order.
12399         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
12400
12401 2009-06-21  Ian Lance Taylor  <iant@google.com>
12402
12403         * layout.cc (Layout::make_output_section): Call
12404         Target::new_output_section.
12405         (Layout::attach_allocated_section_to_segment): Put large section
12406         sections in a separate load segment with the large segment flag
12407         set.
12408         (Layout::segment_precedes): Sort large data segments after other
12409         load segments.
12410         (align_file_offset): New static function.
12411         (Layout::set_segment_offsets): Use align_file_offset.
12412         * output.h (class Output_section): Add is_small_section_ and
12413         is_large_section_ fields.
12414         (Output_section::is_small_section): New function.
12415         (Output_section::set_is_small_section):  New function.
12416         (Output_section::is_large_section): New function.
12417         (Output_section::set_is_large_section): New function.
12418         (Output_section::is_large_data_section): New function.
12419         (class Output_segment): Add is_large_data_segment_ field.
12420         (Output_segment::is_large_data_segment): New function.
12421         (Output_segment::set_is_large_data_segment): New function.
12422         * output.cc (Output_section::Output_section): Initialize new
12423         fields.
12424         (Output_segment::Output_segment): Likewise.
12425         (Output_segment::add_output_section): Add assertion that large
12426         data sections always go in large data segments.  Force small data
12427         sections to the end of the list of data sections.  Force small BSS
12428         sections to the start of the list of BSS sections.  For large BSS
12429         sections to the end of the list of BSS sections.
12430         * symtab.h (class Symbol): Declare is_common_shndx.
12431         (Symbol::is_defined): Check Symbol::is_common_shndx.
12432         (Symbol::is_common): Likewise.
12433         (class Symbol_table): Define enum Commons_section_type.  Update
12434         declarations.  Add small_commons_ and large_commons_ fields.
12435         * symtab.cc (Symbol::is_common_shndx): New function.
12436         (Symbol_table::Symbol_table): Initialize new fields.
12437         (Symbol_table::add_from_object): Put small and large common
12438         symbols in the right list.
12439         (Symbol_table::sized_finalized_symbol): Check
12440         Symbol::is_common_shndx.
12441         (Symbol_table::sized_write_globals): Likewise.
12442         * common.cc (Symbol_table::do_allocate_commons): Allocate new
12443         common symbol lists.  Don't call do_allocate_commons_list if the
12444         list is empty.
12445         (Symbol_table::do_allocate_commons_list): Remove is_tls
12446         parameter.  Add comons_section_type parameter.  Change all
12447         callers.  Handle small and large common symbols.
12448         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
12449         Symbol::is_common_shndx.
12450         * resolve.cc (symbol_to_bits): Likewise.
12451         * target.h (Target::small_common_shndx): New function.
12452         (Target::small_common_section_flags): New function.
12453         (Target::large_common_shndx): New function.
12454         (Target::large_common_section_flags): New function.
12455         (Target::new_output_section): New function.
12456         (Target::Target_info): Add small_common_shndx, large_common_shndx,
12457         small_common_section_flags, and large_common_section_flags
12458         fields.
12459         (Target::do_new_output_section): New virtual function.
12460         * arm.cc (Target_arm::arm_info): Initialize new fields.
12461         * i386.cc (Target_i386::i386_info): Likewise.
12462         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
12463         Likewise.
12464         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
12465         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
12466         (Target_x86_64::do_new_output_section): New function.
12467         * configure.ac: Define conditional MCMODEL_MEDIUM.
12468         * testsuite/Makefile.am (check_PROGRAMS): Add large.
12469         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
12470         (large_LDFLAGS): Define.
12471         * testsuite/large.c: New file.
12472         * testsuite/testfile.cc (Target_test::test_target_info):
12473         Initialize new fields.
12474         * configure, testsuite/Makefile.in: Rebuild.
12475
12476 2009-06-05  Doug Kwan  <dougkwan@google.com>
12477
12478         * Makefile.am (CCFILES): Add target.cc.
12479         * Makefile.in: Regenerate.
12480         * i386.cc (class Target_i386): Define new virtual method to
12481         override do_is_local_label_name in parent.
12482         * object.cc (Sized_relobj::do_count_local_symbols): Discard
12483         local symbols if --discard-locals or -X is given.
12484         * options.h (class General_options): Declare new options
12485         '--discard-locals' and '-X' for discarding locals.
12486         * target.h (class Target): Define new methods is_local_label_name.
12487         Declare new virtual method do_is_local_label_name.
12488         * target.cc: New file.
12489         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
12490         (check_SCRIPTS): Add discard_locals_test.sh.
12491         (check_DATA): Add discard_local_tests.syms.
12492         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
12493         (discard_local_tests.syms, discard_locals_test.o): New make rules.
12494         * testsuite/Makefile.in: Regenerate.
12495         * testsuite/discard_locals_test.c: New file.
12496         * testsuite/discard_locals_test.sh: Same.
12497
12498 2009-06-05  Doug Kwan  <dougkwan@google.com>
12499
12500         * object.cc (Sized_relobj::Sized_relobj): Initialize
12501         discarded_eh_frame_shndx_ to -1U.
12502         (Sized_relobj::do_layout): Record index of a discard .eh_frame
12503         section.
12504         (Sized_relobj::do_count_local_symbols): Skip local symbols in
12505         a discarded .eh_frame section.
12506         (Sized_relobj::do_finalize_local_symbols): Ditto.
12507         * object.h (class Sized_relobj): Declare new member
12508         discarded_eh_frame_shndx_.
12509         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
12510         (local_labels_test.o, local_labels_test): New rules.
12511         * testsuite/Makefile.in: Regenerate.
12512
12513 2009-06-04  Doug Kwan  <dougkwan@google.com>
12514
12515         * layout.cc (Layout::section_name_mapping): Add mapping for
12516         special ARM sections.
12517
12518 2009-06-03  Doug Kwan  <dougkwan@google.com>
12519
12520         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
12521         (utils::has_overflow): Same.
12522
12523 2009-06-03  Ian Lance Taylor  <iant@google.com>
12524
12525         * layout.cc (Layout::section_name_mapping): New array, replacing
12526         Layout::linkonce_mapping.
12527         (Layout::section_name_mapping_count): New variable, replacing
12528         Layout::linkonce_mapping_count.
12529         (Layout::linkonce_output_name): Remove.
12530         (Layout::output_section_name): Rewrite.
12531         * layout.h (class Layout): Rename Linkonce_mapping to
12532         Section_name_mapping, linkonce_mapping to section_name_mapping,
12533         linkonce_mapping_count to section_name_mapping_count.  Don't
12534         declare linkonce_output_name.
12535
12536 2009-06-03  Doug Kwan  <dougkwan@google.com>
12537
12538         * gold/arm.cc (namespace utils): New.
12539         (Target_arm::reloc_is_non_pic): Define new method.
12540         (class Arm_relocate_functions): New.
12541         (Target_arm::Relocate::relocate): Handle relocation types used by
12542         Android.
12543
12544 2009-06-03  Ian Lance Taylor  <iant@google.com>
12545
12546         * arm.cc (Target_arm::scan::global): Use || instead of |.
12547
12548 2009-06-02  Doug Kwan  <dougkwan@google.com>
12549
12550         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
12551         issued_non_pic_error_.
12552         (class Target_arm::Scan): Declare new method check_non_pic.
12553         Define new method symbol_needs_plt_entry.
12554         Declare new data member issued_non_pic_error_.
12555         (class Target_arm::Relocate): Declare new method
12556         should_apply_static_reloc.
12557         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
12558         (Target_arm::Scan::check_non_pic): Define new method.
12559         (Target_arm::Scan::local): Handle a small subset of reloc types used
12560         by Android.
12561         (Target_arm::Scan::local): Same.
12562         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
12563
12564 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
12565
12566         * incremental.cc (Incremental_inputs::report_command_line): Filter
12567         out --incremental-* options.
12568
12569 2009-05-29  Doug Kwan  <dougkwan@google.com>
12570
12571         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
12572         template class.
12573         (class Target_arm): Update comment.
12574         (Target_arm::Target_arm): Initialize new data members GOT_,
12575         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
12576         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
12577         and Target_arm::rel_dyn_section.
12578         Declare new_enum Target_arm::Got_type.
12579         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
12580         and DYNBSS_.
12581         Update commments for member do_dynsym_value.
12582         (Target_arm::got_size, Target_arm::plt_section,
12583         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
12584         new methods inside class defintion.
12585         (Target_arm::got_section): Define new method.
12586         (Target_arm::rel_dyn_section): Same.
12587         (Output_data_plt_arm): New template class.
12588         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
12589         (Output_data_plt_arm:do_adjust_output_section): Define new method.
12590         (Output_data_plt_arm::add_entry): Same.
12591         (Output_data_plt_arm::first_plt_entry): Define new
12592         static data member for PLT instruction template.
12593         (Output_data_plt_arm::plt_entry): Same.
12594         (Output_data_plt_arm::do_write): Define new method.
12595         (Target_arm::make_plt_entry): Same.
12596         (Target_arm::do_finalize_sections): Same.
12597         (Target_arm::do_dynsym_value): Same.
12598
12599 2009-05-28  Doug Kwan  <dougkwan@google.com>
12600
12601         * Makefile.am (TARGETSOURCES): Add arm.cc.
12602         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
12603         * Makefile.in: Regenerate.
12604         * arm.cc: New file.
12605         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
12606
12607 2009-05-26  Doug Kwan  <dougkwan@google.com>
12608
12609         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
12610         (General_options::check_excluded_libs): Strip off directories in
12611         archive name before matching like GNU ld does.
12612         * testsuite/Makefile.am (MOSTLYCLEANFILES,
12613         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
12614         (exclude_libs_test_LDFLAGS): Add linker option
12615         -Wl,--exclude-libs,libexclude_libs_test_3
12616         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
12617         an explicit archive without using -l.
12618         (alt/libexclude_libs_test_3.a): New make rule.
12619         * testsuite/Makefile.in: Regenerate.
12620         * testsuite/exclude_libs_test.c : Declare lib3_default().
12621         (main): Call it.
12622         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
12623         * exclude_libs_test_3.c: New file.
12624
12625 2009-05-26  Nick Clifton  <nickc@redhat.com>
12626
12627         * po/id.po: New Indonesian translation.
12628         * po/gold.pot: Updated template file.
12629
12630 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
12631
12632         * testsuite/Makefile.am: Add -ffunction-sections to compile
12633         gc_comdat_test files.  Add -Wl,--gc-sections to build
12634         gc_comdat_test.
12635         * testsuite/Makefile.in: Regenerate.
12636         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
12637
12638 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
12639
12640         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
12641         kept comdat section was garbage collected.
12642         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
12643         * testsuite/Makefile.in: Regenerate.
12644         * testsuite/gc_comdat_test.sh: New file.
12645         * testsuite/gc_comdat_test_1.cc: New file.
12646         * testsuite/gc_comdat_test_2.cc: New file.
12647
12648 2009-05-19  Doug Kwan  <dougkwan@google.com>
12649
12650         * archive.cc (Archive::Archive): Move constructor from archive.h
12651         to here.  Initialize no_export_.
12652         (Archive::get_elf_object_for_member): Set no_export flag of object.
12653         * archive.h (Archive::Archive): Move constructor body to
12654         archive.cc.
12655         (Archive::no_export): New method.
12656         (Archive::no_export_): New field.
12657         * object.h (Object::Object): Initialize no_export_ to false.
12658         (Object::no_export, Object::set_no_export): New methods.
12659         (Object::no_export_): New field.
12660         * options.cc (General_options::parse_exclude_libs): New method.
12661         (General_options::check_excluded_libs) Same.
12662         * options.h (exclude_libs): New option.
12663         (General_options::check_excluded_libs): New method declaration.
12664         (General_options::excluded_libs_): New field.
12665         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
12666         default or protected visibility if an object has no-export flag set.
12667         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
12668         (check_SCRIPTS): Add exclude_libs_test.sh.
12669         (check_DATA): Add exclude_libs_test.syms.
12670         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
12671         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
12672         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
12673         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
12674         (exclude_libs_test.syms, libexclude_libs_test_1.a,
12675         libexclude_libs_test_2.a): New rules.
12676         * testsuite/Makefile.in: Regenerate.
12677         * testsuite/exclude_libs_test.c: New file.
12678         * testsuite/exclude_libs_test.sh: Ditto.
12679         * testsuite/exclude_libs_test_1.c: Ditto.
12680         * testsuite/exclude_libs_test_2.c: Ditto.
12681
12682 2009-05-15  Ian Lance Taylor  <iant@google.com>
12683
12684         * configure.ac: Check for declarations for cases where libiberty.h
12685         checks HAVE_DECL_xxx.
12686         * configure, config.in: Rebuild.
12687
12688 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
12689
12690         * gold.h (Incremental_argument_list): Remove (invalid) forward
12691         declaration.
12692         * incremental.cc (Incremental_inputs::report_achive): New method.
12693         (Incremental_inputs::report_object): New method.
12694         (Incremental_inputs::report_script): New method.
12695         (Incremental_inputs::finalize_inputs): New method.
12696         (Incremental_inputs::finalize): Call finalize_inputs().
12697         (Incremental_inputs::sized_create_incremental_inputs_section_data):
12698         Create inputs entries.
12699         * incremental.h (Incremental_input_type): New enum.
12700         (Incremental_inputs::Incremental_input): Initialize new fields.
12701         (Incremental_inputs::report_inputs): New method.
12702         (Incremental_inputs::report_achive): New method.
12703         (Incremental_inputs::report_object): New method.
12704         (Incremental_inputs::report_script): New method.
12705         (Incremental_inputs::finalize_inputs): New method.
12706         (Incremental_inputs::Input_info): New struct.
12707         (Incremental_inputs::Input_info_map): New typedef.
12708         (Incremental_inputs::lock_): New field.
12709         (Incremental_inputs::Inputs_): New field.
12710         (Incremental_inputs::Inputs_map): New field.
12711         * main.cc (main): Call Incremental_input::report_inputs.
12712         * options.h (Input_argument_list): Typedef moved from
12713         Input_arguments.
12714         (Input_file_group::Files): Remove, use ::Input_argument_list.
12715         (Input_file_group::Input_argument_list): Remove, use
12716         ::Input_argument_list.
12717         * plugin.cc (Plugin_manager::add_input_file): Add error in
12718         incremental build.
12719         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
12720         functions.
12721         * script.cc (read_input_script): Call
12722         Incremental_input::report_script.
12723         * script.h (Script_info): New class.
12724
12725 2009-04-27  Ian Lance Taylor  <iant@google.com>
12726
12727         * x86_64.cc (do_adjust_output_section): Set entsize to
12728         plt_entry_size.
12729
12730 2009-04-23  Elliott Hughes  <enh@google.com>
12731
12732         * output.cc (Output_file::close): After short writes, continue
12733         writing from the correct offset in the buffer being written.
12734
12735 2009-04-23  Chris Demetriou  <cgd@google.com>
12736
12737         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
12738         * configure: Regenerate.
12739         * config.in: Regenerate.
12740         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
12741         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
12742
12743 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
12744
12745         * incremental.cc (Incremental_inputs_header_data): Renamed from
12746         Incremental_input_header_data.
12747         (Incremental_inputs_header_data::data_size): New field.
12748         (Incremental_inputs_header_data::put_input_file_count): Renamed
12749         from input_file_count.
12750         (Incremental_inputs_header_data::put_command_line_offset): Renamed
12751         from command_line_offset.
12752         (Incremental_inputs_header_data::put_reserved): Renamed from
12753         put_reserved.
12754         (Incremental_inputs_entry_data): Renamed from
12755         Incremental_input_entry_data.
12756         (Incremental_inputs_entry_data::data_size): New field.
12757         (Incremental_inputs::report_command_line): New method.
12758         (Incremental_inputs::finalize): New method.
12759         (Incremental_inputs::create_incremental_inputs_data): New method.
12760         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
12761         * incremental.h: New file.
12762         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
12763         (Layout::finalize): Create incremental inputs section in
12764         incremental builds.
12765         (Layout::create_incremental_info_sections): New method.
12766         * layout.h (Layout::incremental_inputs): New method.
12767         (Layout::create_incremental_info_sections): New method.
12768         (Layout::incremental_inputs_): New field.
12769         * main.cc (main): Notify Incremental_input of the command line.
12770
12771 2009-04-01  Ian Lance Taylor  <iant@google.com>
12772             Mikolaj Zalewski  <mikolajz@google.com>
12773
12774         * gold.h (reserve_unordered_map): Define, three versions, one for
12775         each version of Unordered_map.
12776         * layout.cc (Layout::Layout): Remove options parameter.  Add
12777         number_of_input_files parameter.  Don't initialize options_.
12778         Initialize number_of_input_files_ and resized_signatures_.  Move
12779         sections_are_attached_.
12780         (Layout::layout_group): Reserve space for group_signatures_.
12781         (Layout::find_or_add_kept_section): Change name parameter to be a
12782         reference.  Resize signatures_ map when it gets large enough.
12783         (Layout::layout_eh_frame): Use parameters->options() instead of
12784         this->options_.
12785         (Layout::make_output_section): Likewise.
12786         (Layout::attach_allocated_section_to_segment): Likewise.
12787         (Layout::finalize, Layout::create_executable_stack): Likewise.
12788         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
12789         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
12790         * layout.h (class Layout): Update declarations.  Remove options_
12791         field.  Add number_of_input_files_ and resized_signatures_
12792         fields.  Move sections_are_attached_ field.
12793         * main.cc (main): Pass number of input files to Layout
12794         constructor.  Don't pass options.
12795
12796 2009-03-30  Ian Lance Taylor  <iant@google.com>
12797
12798         * ffsll.c (ffsll): Correct implementation.
12799
12800 2009-03-27  Ian Lance Taylor  <iant@google.com>
12801
12802         * ffsll.c: New file.
12803         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
12804         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
12805         * ftruncate.c (ftruncate): Declare before definition.
12806         * mremap.c (mremap): Likewise.
12807         * pread.c (pread): Likewise.
12808         * configure, Makefile.in, config.in: Rebuild.
12809
12810         * mremap.c: New file.
12811         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
12812         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
12813         (mremap): Declare if HAVE_MREMAP is not defined.
12814         * configure, Makefile.in, config.in: Rebuild.
12815
12816 2009-03-27  Cary Coutant  <ccoutant@google.com>
12817
12818         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
12819         position independent.
12820         * sparc.cc (Target_sparc::check_non_pic): Likewise.
12821         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
12822
12823 2009-03-24  Cary Coutant  <ccoutant@google.com>
12824
12825         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
12826         an executable.
12827         (needs_dynamic_reloc): Likewise.
12828
12829 2009-03-24  Ian Lance Taylor  <iant@google.com>
12830
12831         * yyscript.y (file_cmd): Recognize EXTERN.
12832         (extern_name_list, extern_name_list_body): New nonterminals.
12833         * script.cc (script_add_extern): Define.
12834         * script-c.h (script_add_extern): Declare.
12835
12836 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
12837
12838         * object.cc (is_elf_object): Define.
12839         * object.h (is_elf_object): Declare.
12840         * archive.cc (Archive::get_elf_object_for_member): Call
12841         is_elf_object.
12842         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
12843
12844 2009-03-24  Elliott Hughes  <enh@google.com>
12845
12846         * output.cc (Output_file::map_anonymous): Define.
12847         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
12848         try an anonymous one.  Report the size if the mmap fails.
12849         * output.h (class Output_file): Declare map_anonymous.
12850
12851 2009-03-24  Ian Lance Taylor  <iant@google.com>
12852
12853         * target-select.cc (instantiate_target): Don't acquire the lock if
12854         the instantiated_target_ field has already been set.
12855
12856 2009-03-23  Ian Lance Taylor  <iant@google.com>
12857
12858         * gold-threads.h (class Initialize_lock): Define.
12859         * gold-threads.cc (class Initialize_lock_once): Define.
12860         (initialize_lock_control): New static variable.
12861         (initialize_lock_pointer): New static variable.
12862         (initialize_lock_once): New static function.
12863         (Initialize_lock::Initialize_lock): Define.
12864         (Initialize_lock::initialize): Define.
12865         * target-select.h: Include "gold-threads.h".
12866         (class Target_selector): Add lock_ and initialize_lock_ fields.
12867         Don't define instantiate_target, just declare it.
12868         * target-select.cc (Target_selector::Target_selector): Initialize
12869         new fields.
12870         (Target_selector::instantiate_target): Define.
12871         * descriptors.h: Include "gold-threads.h".
12872         (class Descriptors): Add initialize_lock_ field.
12873         * descriptors.cc (Descriptors::Descriptors): Initialize new
12874         field.
12875         (Descriptors::open): Use initialize_lock_ field
12876         * errors.h (class Errors): Add initialize_lock_ field.
12877         * errors.cc (Errors::Errors): Initialize new field.
12878         (Errors::initialize_lock): Use initialize_lock_ field.
12879         * powerpc.cc (class Target_selector_powerpc): Remove
12880         instantiated_target_ field.  In do_recognize call
12881         instantiate_target rather than do_instantiate_target.  In
12882         do_instantiate_target just allocate a new target.
12883         * sparc.cc (class Target_selector_sparc): Likewise.
12884
12885         * freebsd.h: New file.
12886         * i386.cc: Include "freebsd.h".
12887         (Target_i386): Derive from Target_freebsd rather than
12888         Sized_target.
12889         (Target_selector_i386): Derive from Target_selector_freebsd rather
12890         than Target_selector.
12891         * x86_64.cc: Include "freebsd.h".
12892         (Target_x86_64): Derive from Target_freebsd rather than
12893         Sized_target.
12894         (Target_selector_x86_64): Derive from Target_selector_freebsd
12895         rather than Target_selector.
12896         * target.h (class Target): Add adjust_elf_header and
12897         do_adjust_elf_header.
12898         * output.cc (Output_file_header:: do_sized_write): Call target
12899         adjust_elf_header routine.
12900         * configure.tgt: Set targ_osabi.
12901         * configure.ac: Define GOLD_DEFAULT_OSABI.
12902         * parameters.cc (Parameters::default_target): Pass
12903         GOLD_DEFAULT_OSABI to select_target.
12904         * target-select.h (class Target_selector): Make instantiate_target
12905         protected rather than private.
12906         * Makefile.am (HFILES): Add freebsd.h.
12907         * configure, Makefile.in, config.in: Rebuild.
12908
12909         * merge.cc (do_add_input_section): Correct pend value.  Change
12910         message about last entry not being null terminated from error to
12911         warning.
12912
12913 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
12914
12915         * incremental.cc: New file.
12916         * Makefile.am (CCFILES): Add incremental.cc.
12917         * Makefile.in: Rebuild.
12918
12919 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
12920
12921         * layout.cc (Layout::output_section_name): Preserve names
12922         of '.note.' sections.
12923
12924 2009-03-19  Ian Lance Taylor  <iant@google.com>
12925
12926         * descriptors.cc (Descriptors::open): Check that the options are
12927         valid before using them.
12928
12929 2009-03-18  Ian Lance Taylor  <iant@google.com>
12930
12931         * script-sections.h: Include <list>.
12932         (class Script_sections): Change Sections_elements from std::vector
12933         to std::list.  Typedef public Elements_iterator.  Add
12934         orphan_section_placement_, data_segment_align_start_, and
12935         saw_data_segment_align_ fields.  Remove data_segment_align_index_
12936         field.
12937         * script-sections.cc (class Orphan_section_placement): New class.
12938         (class Sections_element): Add virtual functions is_relro and
12939         orphan_section_init.  Remove virtual function place_orphan_here.
12940         (class Output_section_definition): Add is_relro and
12941         orphan_section_init.  Remove place_orphan_here.
12942         (class Orphan_output_section): Likewise.
12943         (Script_sections::Script_sections): Update for field changes.
12944         (Script_sections::data_segment_align): Set saw_data_segment_align_
12945         and data_segment_align_start_, not data_segment_align_index.
12946         (Script_sections::data_segment_relro_end): Check
12947         saw_data_segment_align_.  Use data_segment_align_start_ rather
12948         than data_segment_align_index_.
12949         (Script_sections::place_orphan): Rewrite to use
12950         Orphan_section_placement.
12951
12952 2009-03-17  Ian Lance Taylor  <iant@google.com>
12953
12954         * archive.cc (Archive::add_symbols): Check for a version attached
12955         to the symbol name in the archive map.
12956         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
12957         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
12958         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
12959         (ver_test_11.a): New target.
12960         * testsuite/Makefile.in: Rebuild.
12961
12962         * configure.ac: Check for chsize and posix_fallocate.  Replace
12963         ftruncate.
12964         * ftruncate.c: New file, from gnulib.
12965         * output.cc (posix_fallocate): Define dummy version if not
12966         HAVE_POSIX_FALLOCATE.
12967         (Output_file::map): Call posix_fallocate rather than lseek and
12968         write.
12969         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
12970         * configure, Makefile.in, config.in: Rebuild.
12971
12972 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
12973
12974         * layout.h (Layout::create_note): Add section_name parameter.
12975         * layout.cc (Layout::create_note): Likewise.
12976         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
12977
12978 2009-03-17  Ian Lance Taylor  <iant@google.com>
12979
12980         * descriptors.cc: Include "options.h".
12981         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
12982         (Descriptors::open): Always use O_CLOEXEC when opening a new
12983         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
12984         then set FD_CLOEXEC.
12985
12986         * sparc.cc (class Target_sparc): Add has_got_section.
12987         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
12988         make sure we have a GOT section.
12989
12990         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
12991         (Target_sparc::Scan::local): Likewise.
12992         (Target_sparc::Scan::global): Likewise.
12993         (Target_sparc::Relocate::relocate): Likewise.
12994         (Target_sparc::Relocate::relocate_tls): Likewise.
12995
12996         * symtab.cc (Symbol_table::define_default_version): New function,
12997         broken out of add_from_object.
12998         (Symbol_table::add_from_object): Call define_default_version.
12999         (Symbol_table::define_special_symbol): Add resolve_oldsym
13000         parameter.  Change all callers.  If the version for a symbol comes
13001         from a version script, resolve it with the symbol with the same
13002         name with no version.  Also add the symbol without a version if
13003         appropriate.
13004         (do_define_in_output_data): If resolving with oldsym, don't delete
13005         sym.
13006         (do_define_in_output_segment): Likewise.
13007         (do_define_as_constant): Likewise.
13008         * symtab.h (class Symbol_table): Update declarations.
13009
13010 2009-03-13  Ian Lance Taylor  <iant@google.com>
13011
13012         * readsyms.cc (Read_symbols::incompatible_warning): New function.
13013         (Read_symbols::requeue): New function.
13014         (Read_symbols::do_read_symbols): If make_elf_object fails because
13015         the target type is not configured, and the file was searched for,
13016         issue a warning and retry with the next directory.
13017         (Add_symbols::run): If the file has an incompatible format, and
13018         it was searched for, requeue the Read_symbols task.  On error,
13019         release the object.
13020         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
13021         dirindex parameter to constructor.  Change all callers.  Declare
13022         incompatible_warning and requeue.
13023         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
13024         input_argument_ and input_group_ fields.  Add them to
13025         constructor.  Change all callers.
13026         (class Read_script): Add dirindex_ field.  Add it to constructor.
13027         Change all callers.
13028         * archive.cc (Archive::setup): Remove input_objects parameter.
13029         Change all callers.
13030         (Archive::get_file_and_offset): Likewise.
13031         (Archive::read_all_symbols): Likewise.
13032         (Archive::read_symbols): Likewise.
13033         (Archive::get_elf_object_for_member): Remove input_objects
13034         parameter.  Add punconfigured parameter.  Change all callers.
13035         (Archive::add_symbols): Change return type to bool.  Check return
13036         value of include_member.
13037         (Archive::include_all_members): Likewise.
13038         (Archive::include_member): Change return type to bool.  Return
13039         false if first included object has incompatible target.  Set
13040         included_member_ field.
13041         (Add_archive_symbols::run): If add_symbols returns false, requeue
13042         Read_symbols task.
13043         * archive.h (class Archive): Add included_member_ field.
13044         Initialize it in constructor.  Add input_file and searched_for
13045         methods.  Update declarations.
13046         (class Add_archive_symbols): Add dirpath_, dirindex_, and
13047         input_argument_ fields.  Add them to constructor.  Change all
13048         callers.
13049         * script.cc: Include "target-select.h".
13050         (class Parser_closure): Add skip_on_incompatible_target_ and
13051         found_incompatible_target_ fields.  Add
13052         skip_on_incompatible_target parameter to constructor.  Change all
13053         callers.  Add methods skip_on_incompatible_target,
13054         clear_skip_on_incompatible_target, found_incompatible_target, and
13055         set_found_incompatible_target.
13056         (read_input_script): Add dirindex parameter.  Change all callers.
13057         If parser finds an incompatible target, requeue Read_symbols
13058         task.
13059         (script_set_symbol): Clear skip_on_incompatible_target in
13060         closure.
13061         (script_add_assertion, script_parse_option): Likewise.
13062         (script_start_sections, script_add_phdr): Likewise.
13063         (script_check_output_format): New function.
13064         * script.h (read_input_script): Update declaration.
13065         * script-c.h (script_check_output_format): Declare.
13066         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
13067         (ignore_cmd): Remove OUTPUT_FORMAT.
13068         * fileread.cc (Input_file::Input_file): Add explicit this.
13069         (Input_file::will_search_for): New function.
13070         (Input_file::open): Add pindex parameter.  Change all callers.
13071         * fileread.h (class Input_file): Add input_file_argument method.
13072         Declare will_search_for.  Update declarations.
13073         * object.cc (make_elf_object): Add punconfigured parameter.
13074         Change all callers.
13075         * object.h (class Object): Make input_file public.  Add
13076         searched_for method.
13077         (make_elf_object): Update declaration.
13078         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
13079         restart search.
13080         * dirsearch.h (class Dirsearch): Update declaration.
13081         * options.h (class General_options): Add --warn-search-mismatch.
13082         * parameters.cc (Parameters::is_compatible_target): New function.
13083         * parameters.h (class Parameters): Declare is_compatible_target.
13084         * workqueue.cc (Workqueue::add_blocker): New function.
13085         * workqueue.h (class Workqueue): Declare add_blocker.
13086
13087         * fileread.cc (Input_file::open): Remove options parameter.
13088         Change all callers.
13089         (Input_file::open_binary): Likewise.
13090         * script.cc (read_input_script): Likewise.
13091         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
13092         options parameter from constructor.  Change all callers.
13093         (class Read_script): Likewise.
13094         * fileread.h (class Input_file): Update declarations.
13095         * script.h (read_input_script): Update declaration.
13096
13097 2009-03-10  Nick Clifton  <nickc@redhat.com>
13098
13099         * po/es.po: New Spanish translation.
13100
13101 2009-03-06  Cary Coutant  <ccoutant@google.com>
13102
13103         * options.cc (parse_short_option): Keep dash_z from registering itself.
13104
13105 2009-03-03  Ian Lance Taylor  <iant@google.com>
13106
13107         PR 9918
13108         * target-reloc.h (relocate_section): Pass output_section to
13109         relocate.
13110         * i386.cc (Target_i386::should_apply_static_reloc): Add
13111         output_section parameter.  Change all callers.
13112         (Target_i386::Relocate::relocate): Add output_section parameter.
13113         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
13114         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
13115         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
13116         * testsuite/two_file_shared.sh: New script.
13117         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
13118         (check_DATA): Add two_file_shared.dbg.
13119         (two_file_shared.dbg): New target.
13120         * testsuite/Makefile.in: Rebuild.
13121
13122 2009-03-01  Ian Lance Taylor  <iant@google.com>
13123
13124         * configure.ac: Check for byteswap.h.
13125         * configure: Rebuild.
13126         * config.in: Rebuild.
13127
13128 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
13129
13130         * layout.cc (Layout::find_or_add_kept_section): New function.
13131         (Layout::add_comdat): Removed.
13132         * layout.h (struct Kept_section): Move out of class Layout.
13133         Remove trailing underscores from field names.  Add group_sections
13134         field.  Rename group_ field to is_group.  Change all uses.
13135         (class Layout): Declare find_or_add_kept_section, not add_comdat.
13136         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
13137         comdat_groups_ field.
13138         (Sized_relobj::include_section_group): Use
13139         find_or_add_kept_section and Kept_section::group_sections.
13140         (Sized_relobj::include_linkonce_section): Likewise.
13141         * object.cc (class Sized_relobj): Don't define Comdat_group or
13142         Comdat_group_table.  Remove find_comdat_group and
13143         add_comdat_group.  Remove comdat_groups_ field.
13144         * plugin.cc (include_comdat_group): Use
13145         Layout::find_or_add_kept_section.
13146
13147 2009-02-28  Ian Lance Taylor  <iant@google.com>
13148
13149         * README: --gc-sections and map files are now supported.  Document
13150         some build requirements.
13151
13152         PR 6992
13153         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
13154         relocatable link set the value of the section symbol to zero.
13155         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
13156         relocatable link don't include the section address in the local
13157         symbol value.
13158
13159 2009-02-27  Ian Lance Taylor  <iant@google.com>
13160
13161         PR 6811
13162         * options.h (class Search_directory): Add is_system_directory.
13163         (class General_options): Declare is_in_system_directory.
13164         * options.cc (get_relative_sysroot): Make static.
13165         (get_default_sysroot): Make static.
13166         (General_optoins::is_in_system_directory): New function.
13167         * fileread.cc (Input_file::is_in_system_directory): New function.
13168         * fileread.h (class Input_file): Declare is_in_system_directory.
13169         * object.h (class Object): Add is_in_system_directory.
13170         (class Input_objects): Remove system_library_directory_ field.
13171         * object.cc (Input_objects::add_object): Don't set
13172         system_library_directory_.
13173         (input_objects::found_in_system_library_directory): Remove.
13174         * symtab.cc (Symbol_table::write_globals): Remove input_objects
13175         parameter.  Change all callers.
13176         (Symbol_table::sized_write_globals): Likewise.
13177         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
13178         Call Object::is_in_system_directory.
13179         * symtab.h (class Symbol_table): Update declarations.
13180
13181         PR 5990
13182         * descriptors.h (Open_descriptor): Add is_on_stack field.
13183         * descriptors.cc (Descriptors::open): If the descriptor is on the
13184         top of the stack, remove it.  Initialize is_on_stack field.
13185         (Descriptors::release): Only add pod to stack if it is not on the
13186         stack already.
13187         (Descriptors::close_some_descriptor): Clear stack_next and
13188         is_on_stack fields.
13189
13190         PR 7091
13191         * output.cc (Output_section::find_starting_output_address): Rename
13192         from starting_output_address; add PADDR parameter; change return
13193         type.
13194         * output.h (class Output_section): Declare
13195         find_starting_output_address instead of starting_output_address.
13196         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
13197         section symbol for which we can't find a merge section.
13198
13199         PR 9836
13200         * symtab.cc (Symbol_table::add_from_object): If the visibility is
13201         hidden or internal, force the symbol to be local.
13202         * resolve.cc (Symbol::override_visibility): Define.
13203         (Symbol::override_base): Use override_visibility.
13204         (Symbol_table::resolve): Likewise.
13205         (Symbol::override_base_with_special): Likewise.
13206         (Symbol_table::override_with_special): If the visibility is hidden
13207         or internal, force the symbol to be local.
13208         * symtab.h (class Symbol): Add set_visibility and
13209         override_visibility.
13210         * testsuite/ver_test_1.sh: New file.
13211         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
13212         (check_DATA): Add ver_test_1.syms.
13213         (ver_test_1.syms): New target.
13214         * testsuite/Makefile.in: Rebuild.
13215
13216 2009-02-25  Cary Coutant  <ccoutant@google.com>
13217
13218         * layout.cc (Layout::choose_output_section): Don't rename sections
13219         when using a linker script that has a SECTIONS clause.
13220         * Makefile.in: Regenerate.
13221
13222         * testsuite/Makefile.am (script_test_5.sh): New test case.
13223         * testsuite/Makefile.in: Regenerate.
13224         * testsuite/script_test_5.cc: New file.
13225         * testsuite/script_test_5.sh: New file.
13226         * testsuite/script_test_5.t: New file.
13227
13228 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
13229
13230         * archive.cc (Archive::include_member): Update calls to add_symbols.
13231         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
13232         the Layout argument.
13233         * dynobj.h (do_add_symbols): Add the Layout argument.
13234         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
13235         Layout argument.
13236         * object.h (Object::add_symbols): Add the Layout argument.
13237         (Object::do_add_symbols): Add the Layout argument.
13238         (Sized_relobj::do_add_symbols): Add the Layout argument.
13239         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
13240         Unify the two versions.
13241         (Add_plugin_symbols): Remove.
13242         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
13243         (Sized_pluginobj::do_add_symbols): Unify the two versions.
13244         (Add_plugin_symbols): Remove.
13245         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
13246         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
13247         (Add_symbols::run): Make it work with Pulginobj.
13248
13249 2009-02-06  Ian Lance Taylor  <iant@google.com>
13250
13251         * object.cc (Sized_relobj::do_layout): Make info message start
13252         with lower case letter.
13253
13254 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
13255
13256         * binary.cc: Fix file comment.
13257
13258         * options.h (enum Incremental_disposition): Define.
13259         (class General_options): Add new options: --incremental,
13260         --incremental_changed, --incremental_unchanged,
13261         --incremental_unknown.  Add incremental_disposition_ and
13262         implicit_incremental_ fields.
13263         (General_options::incremental_disposition): New function.
13264         (class Position_dependent_options): Add incremental_disposition
13265         option.
13266         (Position_dependent_options::copy_from_options): Set incremental
13267         dispositions.
13268         * options.cc (General_options::parse_incremental_changed): New
13269         function.
13270         (General_options::parse_incremental_unchanged): New function.
13271         (General_options::parse_incremental_unknown): New function.
13272         (General_options::General_options): Initialize new fields
13273         incremental_disposition_ and implicit_incremental_.
13274         (General_options::finalize): Check for uasge of --incremental-*
13275         without --incremental.
13276
13277 2009-02-06  Chris Demetriou  <cgd@google.com>
13278
13279         * gold.h (gold_undefined_symbol): Change to take only a Symbol
13280         pointer and to report location as the file name associated with
13281         the symbol.
13282         (gold_undefined_symbol_at_location): New function to replace the
13283         old gold_undefined_symbol functionality.
13284         * target-reloc.h (relocate_section): Update to use
13285         gold_undefined_symbol_at_location.
13286         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
13287         Call gold_undefined_symbol function rather than gold_error.
13288         * errors.h (Errors::undefined_symbol): Take location as a
13289         string, rather than calculating it from a relocation.
13290         * errors.cc (Errors::fatal): Print "fatal error:" before the
13291         formatted message.
13292         (Errors::error, Errors::error_at_location): Print "error: "
13293         before the formatted message.
13294         (Errors::undefined_symbol): Take location as a string, rather
13295         than calculating it from a relocation.
13296         (gold_undefined_symbol_at_location): New function akin to
13297         old gold_undefined_symbol, calculates location from relocation.
13298         (gold_undefined_symbol): Change to take only a Symbol pointer
13299         and to report location as the file name associated with the symbol.
13300         * testsuite/debug_msg.sh: Update for changed error messages.
13301         * testsuite/undef_symbol.sh: Likewise.
13302
13303 2009-02-04  Duncan Sands  <baldrick@free.fr>
13304
13305         PR 9812
13306         * reduced_debug_output.h
13307         (Output_reduced_debug_abbrev_section::failed): Use format for
13308         gold_warning.
13309         (Output_reduced_debug_info_section::faild): Likewise.
13310
13311 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
13312
13313         * script.cc (Lazy_demangler): New class.
13314         (Version_script_info::get_symbol_version_helper): Demangle a
13315         symbol only once.
13316
13317 2009-01-29  Cary Coutant  <ccoutant@google.com>
13318
13319         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
13320         to __tls_get_addr.
13321         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
13322
13323 2009-01-28  Ian Lance Taylor  <iant@google.com>
13324
13325         * version.cc (version_string): Bump to 1.9.
13326
13327         * gold.h: Include <cstring> and <stdint.h>.
13328         * version.cc: Include <cstdio>.
13329         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
13330         warning.
13331         * reduced_debug_output.cc (insert_into_vector): Rename from
13332         Insert_into_vector; change all callers.  Use Swap_unaligned to
13333         avoid aliasing issue; remove union since it is unnecessary.
13334
13335 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
13336
13337         * Makefile.am (CCFILES): Add gc.cc.
13338         (HFILES): Add gc.h.
13339         * Makefile.in: Regenerate.
13340         * gold.cc (Gc_runner): New class.
13341         (queue_initial_tasks): Call garbage collection related tasks
13342         when corresponding options are invoked.
13343         (queue_middle_gc_tasks): New function.
13344         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
13345         processed early before laying out sections during garbage collection.
13346         * gold.h (queue_middle_gc_tasks): New function.
13347         (is_prefix_of): Move from "layout.cc".
13348         * i386.cc (Target_i386::gc_process_relocs): New function.
13349         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
13350         * main.cc (main): Create object of class "Garbage_collection".
13351         * object.cc (Relobj::copy_symbols_data): New function.
13352         (Relobj::is_section_name_included): New function.
13353         (Sized_relobj::do_layout): Allow this function to be called twice
13354         during garbage collection and defer layout of section during the
13355         first call.
13356         * object.h (Relobj::get_symbols_data): New function.
13357         (Relobj::is_section_name_included): New function.
13358         (Relobj::copy_symbols_data): New function.
13359         (Relobj::set_symbols_data): New function.
13360         (Relobj::get_relocs_data): New function.
13361         (Relobj::set_relocs_data): New function.
13362         (Relobj::is_output_section_offset_invalid): New pure virtual function.
13363         (Relobj::gc_process_relocs): New function.
13364         (Relobj::do_gc_process_relocs): New pure virtual function.
13365         (Relobj::sd_): New data member.
13366         (Sized_relobj::is_output_section_offset_invalid): New function.
13367         (Sized_relobj::do_gc_process_relocs): New function.
13368         * options.h (General_options::gc_sections): Modify to not be a no-op.
13369         (General_options::print_gc_sections): New option.
13370         * plugin.cc (Plugin_finish::run): Remove function call to
13371         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
13372         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
13373         * reloc.cc (Read_relocs::run): Add task to process relocs and
13374         determine unreferenced sections when doing garbage collection.
13375         (Gc_process_relocs): New class.
13376         (Sized_relobj::do_gc_process_relocs): New function.
13377         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
13378         sections that are garbage collected.
13379         * reloc.h (Gc_process_relocs): New class.
13380         * sparc.cc (Target_sparc::gc_process_relocs): New function.
13381         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
13382         symbols whose corresponding sections are garbage collected.
13383         (Symbol_table::Symbol_table): Add new parameter for the garbage
13384         collection object.
13385         (Symbol_table::gc_mark_undef_symbols): New function.
13386         (Symbol_table::gc_mark_symbol_for_shlib): New function.
13387         (Symbol_table::gc_mark_dyn_syms): New function.
13388         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
13389         as garbage.
13390         (Symbol_table::add_from_object): Likewise.
13391         (Symbol_table::add_from_relobj): When building shared objects, do not
13392         treat externally visible symbols as garbage.
13393         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
13394         table information for static and relocatable links.
13395         * symtab.h (Symbol_table::set_gc): New function.
13396         (Symbol_table::gc): New function.
13397         (Symbol_table::gc_mark_undef_symbols): New function.
13398         (Symbol_table::gc_mark_symbol_for_shlib): New function.
13399         (Symbol_table::gc_mark_dyn_syms): New function.
13400         (Symbol_table::gc_): New data member.
13401         * target.h (Sized_target::gc_process_relocs): New pure virtual
13402         function.
13403         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
13404         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
13405
13406 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
13407
13408         * options.h (General_options::gc_sections): Define as a no-op for now.
13409         (General_options::no_keep_memory): Ditto.
13410         (General_options::Bshareable): Define.
13411         * options.cc (General_options::finalize): Honor -Bshareable.
13412
13413 2009-01-20  Andreas Schwab  <schwab@suse.de>
13414
13415         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
13416         read the value in the contents, since we don't use it.  Use the
13417         template endianness when writing.
13418         (Relocate::relocate): Use it for R_PPC_REL16_HA.
13419
13420 2009-01-19  Andreas Schwab  <schwab@suse.de>
13421
13422         * configure.tgt (powerpc64-*): Fix targ_obj.
13423
13424 2009-01-15  Ian Lance Taylor  <iant@google.com>
13425
13426         * object.cc (Sized_relobj::write_local_symbols): Don't write out
13427         local symbols when stripping all symbols.
13428
13429 2009-01-14  Cary Coutant  <ccoutant@google.com>
13430
13431         * output.cc (Output_reloc): Add explicit instantiations.
13432
13433 2009-01-14  Cary Coutant  <ccoutant@google.com>
13434
13435         * archive.cc (Archive::get_elf_object_for_member): Remove call
13436         to File_read::claim_for_plugin.
13437         * descriptors.cc (Descriptors::open): Remove reference to
13438         is_claimed.
13439         (Descriptors::claim_for_plugin): Remove.
13440         * descriptors.h (Descriptors::claim_for_plugin): Remove.
13441         (Descriptors::is_claimed): Remove.
13442         (claim_descriptor_for_plugin): Remove.
13443         * fileread.cc (File_read::claim_for_plugin): Remove.
13444         * fileread.h (File_read::claim_for_plugin): Remove.
13445         (File_read::descriptor): Reopen descriptor if necessary.
13446         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
13447         (Plugin_manager::all_symbols_read): Add task parameter. Change
13448         all callers.
13449         (Plugin_manager::get_input_file): New function.
13450         (Plugin_manager::release_input_file): New function.
13451         (Pluginobj::Pluginobj): Add filesize parameter and initialize
13452         corresponding data member.
13453         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
13454         and pass to base constructor. Change all callers.
13455         (get_input_file, release_input_file): New functions.
13456         (make_sized_plugin_object): Add filesize parameter. Change all callers.
13457         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
13458         (Plugin_manager::all_symbols_read): Add task parameter.
13459         (Plugin_manager::get_input_file): New function.
13460         (Plugin_manager::release_input_file): New function.
13461         (Plugin_manager::task_): New data member.
13462         (Pluginobj::Pluginobj): Add filesize parameter.
13463         (Pluginobj::filename): New function.
13464         (Pluginobj::descriptor): New function.
13465         (Pluginobj::filesize): New function.
13466         (Pluginobj::filesize_): New data member.
13467         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
13468         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
13469         File_read::claim_for_plugin; use Object::unlock to unlock the file.
13470
13471         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
13472         with archive libraries.
13473         * testsuite/Makefile.in: Regenerate.
13474         * testsuite/plugin_test.c (struct sym_info): New type.
13475         (get_input_file, release_input_file): New static variables.
13476         (onload): Capture new transfer vector entries.
13477         (claim_file_hook): Stop reading at end of file according to filesize.
13478         Factor out parsing of readelf output into separate function.
13479         (all_symbols_read_hook): Exercise get_input_file and release_input_file
13480         APIs and get the source file name from the symbol table.  Convert
13481         source file name to corresponding object file name.  Print info
13482         message when adding new input files.
13483         (parse_readelf_line): New function.
13484         * testsuite/plugin_test_1.sh: Add checks for new info messages.
13485         * testsuite/plugin_test_2.sh: Likewise.
13486         * testsuite/plugin_test_3.sh: Likewise.
13487         * testsuite/plugin_test_4.sh: New test case.
13488
13489 2009-01-07  Ian Lance Taylor  <iant@google.com>
13490
13491         * version.cc (version_string): Bump to 1.8.
13492
13493 2008-12-23  Cary Coutant  <ccoutant@google.com>
13494
13495         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
13496         * plugin.cc (Plugin_manager::finish): Rename as
13497         layout_deferred_objects.  Move cleanup to separate function.
13498         (Plugin_manager::cleanup): New function.
13499         (Plugin_finish::run): Call layout_deferred_objects and cleanup
13500         separately.
13501         * plugin.h (Plugin_manager::finish): Rename as
13502         layout_deferred_objects.
13503         (Plugin_manager::cleanup): New function.
13504         (Plugin_manager::cleanup_done): New field.
13505
13506 2008-12-23  Cary Coutant  <ccoutant@google.com>
13507
13508         * plugin.cc (is_visible_from_outside): New function.
13509         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
13510         so we don't return "IR only" status for exported symbols or -r links.
13511
13512         * testsuite/Makefile.am (plugin_test_3): New test case.
13513         * testsuite/Makefile.in: Regenerate.
13514         * testsuite/plugin_test_3.sh: New file.
13515
13516 2008-12-22  Cary Coutant  <ccoutant@google.com>
13517
13518         * object.cc (Sized_relobj::layout_section): New function.
13519         (Sized_relobj::do_layout): Defer layout of input sections until after
13520         plugin has provided replacement files.
13521         (Sized_relobj::do_layout_deferred_sections): New function.
13522         * object.h (Relobj::set_section_offset): Remove virtual keyword.
13523         (Relobj::layout_deferred_sections): New function.
13524         (Relobj::do_layout_deferred_sections): New function.
13525         (Sized_relobj::do_layout_deferred_sections): New function.
13526         (Sized_relobj::layout_section): New function.
13527         (Sized_relobj::Deferred_layout): New structure.
13528         (Sized_relobj::deferred_layout_): New field.
13529         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
13530         Change all callers.  Layout deferred sections.
13531         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
13532         references.
13533         (Plugin_hook::run): Move code from do_plugin_hook inline.
13534         (Plugin_hook::do_plugin_hook): Remove.
13535         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
13536         (Plugin_manager::finish): Renamed, was cleanup.
13537         (Plugin_manager::should_defer_layout): New function.
13538         (Plugin_manager::add_deferred_layout_object): New function.
13539         (Plugin_manager::Deferred_layout_list): New type.
13540         (Plugin_manager::deferred_layout_objects_): New field.
13541         (Plugin_hook::do_plugin_hook): Remove.
13542
13543 2008-12-17  Ian Lance Taylor  <iant@google.com>
13544
13545         * options.h (class General_options): Add --no case for
13546         --export-dynamic.
13547
13548 2008-12-16  Cary Coutant  <ccoutant@google.com>
13549
13550         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
13551         vector.
13552         (Plugin_manager::claim_file): Create plugin object even if
13553         plugin did not call the add_symbols callback.
13554         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
13555         asking for more symbols than were added.
13556         * testsuite/Makefile.am (plugin_test_1): Add test case with
13557         no global symbols.
13558         (empty.syms): New target.
13559         * testsuite/Makefile.in: Regenerate.
13560         * testsuite/plugin_test.c (claim_file_hook): Add new debug
13561         message. Don't call add_symbols if no globals.
13562         (all_symbols_read_hook): Don't provide replacement for empty
13563         claimed file.
13564
13565 2008-12-12  Ian Lance Taylor  <iant@google.com>
13566
13567         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
13568         r_type == 0 for a local symbol with r_sym == 0.
13569         (scan_relocatable_relocs): Pass r_sym to
13570         local_non_section_strategy.
13571         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
13572         r_sym parameter.
13573
13574         * configure.ac: Update test for TLS descriptors: they are
13575         supported as of glibc 2.9.
13576         * configure: Rebuild.
13577
13578 2008-12-11  Ian Lance Taylor  <iant@google.com>
13579
13580         PR 7091
13581         * target-reloc.h (Default_scan_relocatable_relocs): For each
13582         function, map r_type == 0 to RELOC_DISCARD.
13583
13584 2008-12-10  Cary Coutant  <ccoutant@google.com>
13585
13586         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
13587         object to override a kept COMDAT group from a plugin object.
13588
13589 2008-12-09  Ian Lance Taylor  <iant@google.com>
13590
13591         PR 7088
13592         * yyscript.y (file_cmd): Handle INPUT.
13593
13594         * testsuite/initpri1.c: Change all declarations to be full
13595         prototypes by adding void, to avoid compiler warnings.
13596
13597 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
13598
13599         * options.cc (General_options::parse_plugin_opt): New.
13600         (General_options::add_plugin): The argument now is just the filename.
13601         (General_options::add_plugin_option): New.
13602         * options.h (plugin_opt): New.
13603         (add_plugin): Change argument name.
13604         (add_plugin_option): New.
13605         * plugin.cc (Plugin::load): Don't parse the plugin option.
13606         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
13607         (Plugin::add_option): New.
13608         (Plugin::args_): Change type.
13609         (Plugin::filename_): New.
13610         (Plugin_manager::add_plugin_option): New.
13611         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
13612         * testsuite/Makefile.in: Regenerate.
13613
13614 2008-12-05  Cary Coutant  <ccoutant@google.com>
13615
13616         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
13617         Handle --strip-lto-sections option.
13618         * options.h (strip_lto_sections): New option.
13619
13620 2008-12-01  Cary Coutant  <ccoutant@google.com>
13621
13622         * plugin.cc (ld_plugin_message): Change format parameter to const.
13623         Fix mismatch between new[] and delete.
13624
13625 2008-11-14  Cary Coutant  <ccoutant@google.com>
13626
13627         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
13628         instead of -1U.
13629
13630 2008-11-05  Craig Silverstein  <csilvers@google.com>
13631
13632         * options.cc (General_options::parse_dynamic_list): New function.
13633         * options.h (General_options): New flags dynamic_list,
13634         dynamic_list_data, dynamic_list_cpp_new, and
13635         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
13636         (General_options::in_dynamic_list): New function.
13637         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
13638         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
13639         (Lex::can_continue_name): Likewise.
13640         (yylex): Likewise.
13641         (read_script_file): New parameter script_options.
13642         (read_dynamic_list): New function.
13643         (Script_options::define_dynamic_list): New function.
13644         (dynamic_list_keyword_parsecodes): New variable.
13645         (dynamic_list_keywords): New variable.
13646         * script.h (Script_options::define_dynamic_list): New function
13647         prototype.
13648         (read_dynamic_list): New function prototype.
13649         * symtab.cc (strprefix): New macro.
13650         (Symbol::should_add_dynsym_entry): Support dynamic_list,
13651         dynamic_list_data, dynamic_list_cpp_new, and
13652         dynamic_list_cpp_typeinfo.
13653         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
13654         (dynamic_list_expr): New rule.
13655         (dynamic_list_nodes): Likewise.
13656         (dynamic_list_node): Likewise.
13657         * testsuite/Makefile.am (dynamic_list): New test.
13658         * testsuite/Makefile.in: Regenerated.
13659         * testsuite/dynamic_list.t: New file.
13660         * testsuite/dynamic_list.sh: New file.
13661
13662 2008-11-05  Craig Silverstein  <csilvers@google.com>
13663
13664         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
13665         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
13666         (t11_last): Likewise.
13667         * testsuite/ver_test_6.c (main): Likewise.
13668
13669 2008-10-07  Cary Coutant  <ccoutant@google.com>
13670
13671         * options.c (General_options::finalize): Add check for -static and
13672         -shared.
13673         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
13674         is not empty.
13675
13676 2008-10-02  Cary Coutant  <ccoutant@google.com>
13677
13678         * plugin.cc (make_sized_plugin_object): Fix conditional
13679         compilation to work when not all targets are enabled.
13680
13681 2008-09-29  Cary Coutant  <ccoutant@google.com>
13682
13683         * archive.cc (Archive::get_file_and_offset): Use filename instead
13684         of name to get library path.
13685         (Archive::include_member): Unlock external member of a thin archive.
13686
13687         * testsuite/Makefile.am (TEST_AR): New variable.
13688         (thin_archive_test_1): New test.
13689         (thin_archive_test_2): New test.
13690         * testsuite/Makefile.in: Regenerate.
13691         * testsuite/thin_archive_main.cc: New file.
13692         * testsuite/thin_archive_test_1.cc: New file.
13693         * testsuite/thin_archive_test_2.cc: New file.
13694         * testsuite/thin_archive_test_3.cc: New file.
13695         * testsuite/thin_archive_test_4.cc: New file.
13696
13697 2008-09-29  Cary Coutant  <ccoutant@google.com>
13698
13699         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
13700         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
13701         instead of -1U.
13702         (Sized_relobj::do_finalize_local_symbols): Likewise.
13703         (Sized_relobj::map_to_kept_section): Likewise.
13704         * object.h (Sized_relobj::invalid_address): New constant.
13705         (Sized_relobj::do_output_section_offset): Check for invalid_address
13706         and return -1ULL.
13707         * output.cc (Output_reloc::local_section_offset): Use constant
13708         invalid_address instead of -1U.
13709         (Output_reloc::get_address): Likewise.
13710         (Output_section::output_address): Change -1U to -1ULL.
13711         * output.h (Output_reloc::invalid_address): New constant.
13712         * reloc.cc (Sized_relobj::write_sections): Use constant
13713         invalid_address instead of -1U.
13714         (Sized_relobj::relocate_sections): Likewise.
13715         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
13716         values for merge sections.
13717         * target-reloc.h (relocate_for_relocatable): Use constant
13718         invalid_address instead of -1U.
13719
13720 2008-09-19  Cary Coutant  <ccoutant@google.com>
13721
13722         Add plugin functionality for link-time optimization (LTO).
13723         * configure.ac (plugins): Add --enable-plugins option.
13724         * configure: Regenerate.
13725         * config.in: Regenerate.
13726         * Makefile.am (LIBDL): New variable.
13727         (CCFILES): Add plugin.cc.
13728         (HFILES): Add plugin.h.
13729         (ldadd_var): Add LIBDL.
13730         * Makefile.in: Regenerate.
13731
13732         * archive.cc: Include "plugin.h".
13733         (Archive::setup): Don't preread archive symbols when using a plugin.
13734         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
13735         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
13736         files.
13737         (Archive::include_member): Add symbols from plugin objects.
13738         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
13739         * descriptors.cc (Descriptors::open): Check for file descriptors
13740         abandoned by plugins.
13741         (Descriptors::claim_for_plugin): New function.
13742         * descriptors.h (Descriptors::claim_for_plugin): New function.
13743         (Open_descriptor::is_claimed): New field.
13744         (claim_descriptor_for_plugin): New function.
13745         * fileread.cc (File_read::claim_for_plugin): New function.
13746         * fileread.h (File_read::claim_for_plugin): New function.
13747         (File_read::descriptor): New function.
13748         * gold.cc: Include "plugin.h".
13749         (queue_initial_tasks): Add task to call plugin hooks for generating
13750         new object files.
13751         * main.cc: Include "plugin.h".
13752         (main): Load plugin libraries.
13753         * object.h (Pluginobj): Declare.
13754         (Object::pluginobj): New function.
13755         (Object::do_pluginobj): New function.
13756         (Object::set_target): New function.
13757         * options.cc: Include "plugin.h".
13758         (General_options::parse_plugin): New function.
13759         (General_options::General_options): Initialize plugins_ field.
13760         (General_options::add_plugin): New function.
13761         * options.h (Plugin_manager): Declare.
13762         (General_options): Add --plugin option.
13763         (General_options::has_plugins): New function.
13764         (General_options::plugins): New function.
13765         (General_options::add_plugin): New function.
13766         (General_options::plugins_): New field.
13767         * plugin.cc: New file.
13768         * plugin.h: New file.
13769         * readsyms.cc: Include "plugin.h".
13770         (Read_symbols::do_read_symbols): Check for archive before checking
13771         for ELF file.  Call plugin hooks to claim files.
13772         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
13773         from a real object file; force override when processing replacement
13774         files.
13775         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
13776         (Symbol::init_base_object): Likewise.
13777         (Symbol::init_base_output_data): Likewise.
13778         (Symbol::init_base_output_segment): Likewise.
13779         (Symbol::init_base_constant): Likewise.
13780         (Symbol::init_base_undefined): Likewise.
13781         (Symbol::output_section): Assert that object is not a plugin.
13782         (Symbol_table::add_from_pluginobj): New function.
13783         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
13784         undefined.
13785         (Symbol_table::sized_write_globals): Likewise.
13786         (Symbol_table::add_from_pluginobj): Instantiate template.
13787         * symtab.h (Sized_pluginobj): Declare.
13788         (Symbol::in_real_elf): New function.
13789         (Symbol::set_in_real_elf): New function.
13790         (Symbol::in_real_elf_): New field.
13791         (Symbol_table::add_from_pluginobj): New function.
13792
13793         * testsuite/Makefile.am (AM_CFLAGS): New variable.
13794         (LIBDL): New variable.
13795         (LDADD): Add LIBDL.
13796         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
13797         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
13798         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
13799         (MOSTLYCLEANFILES): Likewise.
13800         * testsuite/Makefile.in: Regenerate.
13801         * testsuite/plugin_test.c: New file.
13802         * testsuite/plugin_test_1.sh: New file.
13803         * testsuite/plugin_test_2.sh: New file.
13804
13805 2008-09-16  Ian Lance Taylor  <iant@google.com>
13806
13807         * target-reloc.h (relocate_section): Check whether a symbol is
13808         defined by the ABI before reporting an undefined symbol error.
13809         * target.h (Target::is_defined_by_abi): Make parameter const.
13810         (Target::do_is_defined_by_abi): Likewise.
13811         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
13812         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
13813         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
13814         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
13815         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
13816         * testsuite/Makefile.in: Rebuild.
13817
13818         * fileread.cc (make_view): Add casts to avoid warning.
13819
13820 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
13821
13822         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
13823         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
13824
13825 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
13826
13827         * options.h (General_options::output_is_executable): New.
13828         (General_options::output_is_pie): New.
13829         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
13830         for shared libraries.
13831         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
13832
13833 2008-09-11  Chris Demetriou  <cgd@google.com>
13834
13835         * options.h (origin): New -z option.
13836         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
13837         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
13838         in DT_FLAGS_1.
13839
13840 2008-09-05  Cary Coutant  <ccoutant@google.com>
13841
13842         * fileread.cc (File_read::make_view): Add check for attempt to map
13843         beyond end of file.
13844
13845 2008-09-05  Cary Coutant  <ccoutant@google.com>
13846
13847         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
13848         explicit instantiations.
13849
13850 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
13851
13852         PR gold/6858
13853         * options.cc (General_options::finalize): Allow undefined symbols
13854         in shlibs if linking -shared.
13855
13856         PR gold/6859
13857         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
13858         symbols as not needing a dynsym entry.
13859
13860 2008-08-20  Craig Silverstein  <csilvers@google.com>
13861
13862         * fileread.cc (File_read::open): Do not lock the file unless it
13863         was successfully opened.
13864
13865 2008-08-14  Cary Coutant  <ccoutant@google.com>
13866
13867         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
13868         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
13869         * testsuite/tls_test.cc (struct int128): 128-bit struct
13870         for testing TLS relocs with non-zero addend.
13871         (v12): New TLS variable.
13872         (t12): New test.
13873         (t_last): Add check for v12.
13874         * testsuite/tls_test.h (t12): New function.
13875         * testsuite/tls_test_main.cc (thread_routine): Call new test.
13876
13877 2008-08-13  Ian Lance Taylor  <iant@google.com>
13878
13879         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
13880         set tls_segment_ or relro_segment_.
13881         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
13882         when appropriate.
13883         * output.h (Output_section::clear_is_relro): New function.
13884         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
13885         sections specially even when output_data_ is empty.
13886         (Output_segment::maximum_alignment): When first section is relro,
13887         only force alignment for PT_LOAD segments.
13888         * script.cc (script_data_segment_align): New function.
13889         (script_data_segment_relro_end): New function.
13890         * script-c.h (script_data_segment_align): Declare.
13891         (script_data_segment_relro_end): Declare.
13892         * script-sections.h (class Script_sections): Declare
13893         data_segment_align and data_segment_relro_end.  Add fields
13894         segment_align_index_ and saw_relro_end_.
13895         * script-sections.cc (class Sections_element): Add set_is_relro
13896         virtual function.  Add new bool* parameter to place_orphan_here.
13897         Add get_output_section virtual function.
13898         (class Output_section_definition): Add set_is_relro.  Add new
13899         bool* parameter to place_orphan_here.  Add get_output_section.
13900         Add is_relro_ field.
13901         (Output_section_definition::Output_section_definition): Initialize
13902         evaluated_address_, evaluated_load_address, evaluated_addralign_,
13903         and is_relro_ fields.
13904         (Output_section_definition::place_orphan_here): Add is_relro
13905         parameter.
13906         (Output_section_definition::set_section_addresses): Set relro for
13907         output section.
13908         (Output_section_definition::alternate_constraint): Likewise.
13909         (class Orphan_output_section): Add new bool* parameter to
13910         place_orphan_here.  Add get_output_section.
13911         (Orphan_output_section::place_orphan_here): Add is_relro
13912         parameter.
13913         (Script_sections::Script_sections): Initialize
13914         data_segment_align_index_ and saw_relro_end_.
13915         (Script_sections::data_segment_align): New function.
13916         (Script_sections::data_segment_relro_end): New function.
13917         (Script_sections::place_orphan): Set or clear is_relro.
13918         (Script_sections::set_section_addresses): Force alignment of first
13919         TLS section.
13920         * yyscript.y (exp): Call script_data_segment_align and
13921         script_data_segment_relro_end.
13922         * testsuite/relro_script_test.t: New file.
13923         * testsuite/relro_test.cc (using_script): Declare.
13924         (t1, t2): Test using_script.
13925         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
13926         (relro_script_test_SOURCES): Define.
13927         (relro_script_test_DEPENDENCIES): Define.
13928         (relro_script_test_LDFLAGS): Define.
13929         (relro_script_test_LDADD): Define.
13930         (relro_script_test.so): New target.
13931         * testsuite/Makefile.in: Rebuild.
13932
13933 2008-08-06  Cary Coutant <ccoutant@google.com>
13934
13935         * archive.cc (Archive::total_archives, Archive::total_members)
13936         (Archive::total_members_loaded): New variables.
13937         (Archive::setup): Add parameter.  Add option to preread
13938         archive symbols.
13939         (Archive::read_armap): Add counter.
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::add_symbols): Add counters.
13945         (Archive::include_all_members): Use armap to find members if it's
13946         already built.
13947         (Archive::include_member): Skip reading symbols if already read.
13948         Factored code into Archive::get_file_and_offset and
13949         Archive::get_elf_object_for_member.  Changed call to
13950         Mapfile::report_include_archive_member.
13951         (Archive::print_stats): New function.
13952         * archive.h: Declare Object and Read_symbols_data classes.
13953         (Archive::Archive): Add initializers for new members.
13954         (Archive::setup): Add parameter.
13955         (Archive::print_stats): New function.
13956         (Archive::total_archives, Archive::total_members)
13957         (Archive::total_members_loaded): New variables.
13958         (Archive::get_file_and_offset): New function.
13959         (Archive::get_elf_object_for_member): New function.
13960         (Archive::read_all_symbols): New function.
13961         (Archive::read_symbols): New function.
13962         (Archive::Archive_member): New class.
13963         (Archive::members_): New member.
13964         (Archive::num_members_): New member.
13965         * main.cc: Include archive.h.
13966         (main): Call Archive::print_stats.
13967         * mapfile.cc (Mapfile::report_include_archive_member): Delete
13968         archive parameter; member_name is now the fully-decorated name.
13969         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
13970         * options.h: (General_options): Add --preread-archive-symbols option.
13971         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
13972         Archive::setup.
13973
13974 2008-08-04  Ian Lance Taylor  <iant@google.com>
13975
13976         * symtab.h (Symbol::use_plt_offset): New function.
13977         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
13978         * powerpc.cc (Relocate::relocate): Likewise.
13979         * sparc.cc (Relocate::relocate): Likewise.
13980         * x86_64.cc (Relocate::relocate): Likewise.
13981         * testsuite/weak_plt.sh: New test.
13982         * testsuite/weak_plt_main.cc: New test.
13983         * testsuite/weak_plt_shared.cc: New test.
13984         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
13985         (check_PROGRAMS): Add weak_plt.
13986         (check_DATA): Add weak_plt_shared.so.
13987         (weak_plt_main_pic.o, weak_plt): New targets.
13988         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
13989         * testsuite/Makefile.in: Rebuild.
13990
13991         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
13992         gcctestdir/ld.
13993         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
13994         * testsuite/Makefile.in: Rebuild.
13995
13996 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
13997
13998         * Makefile.am (POTFILES.in): Set LC_ALL=C.
13999         * Makefile.in: Regenerate.
14000         * po/POTFILES.in: Regenerate.
14001
14002 2008-07-29  Ian Lance Taylor  <iant@google.com>
14003
14004         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
14005         symbols before other symbols.
14006         * testsuite/script_test_2.cc (test_addr): Declare.
14007         (test_addr_alias): Declare.
14008         (main): Check that test_addr and test_addr_alias have the right
14009         values.
14010         * testsuite/script_test_2.t: Define test_addr_alias and
14011         test_addr.
14012
14013 2008-07-24  Ian Lance Taylor  <iant@google.com>
14014
14015         PR 5990
14016         * descriptors.cc: New file.
14017         * descriptors.h: New file.
14018         * gold-threads.h (class Hold_optional_lock): New class.
14019         * fileread.cc: Include "descriptors.h".
14020         (File_read::~File_read): Release descriptor rather than closing
14021         it.
14022         (File_read::open) [file]: Call open_descriptor rather than open.
14023         Set is_descriptor_opened_.
14024         (File_read::open) [memory]: Assert that descriptor is not open.
14025         (File_read::reopen_descriptor): New function.
14026         (File_read::release): Release descriptor.
14027         (File_read::do_read): Make non-const.  Reopen descriptor.
14028         (File_read::read): Make non-const.
14029         (File_read::make_view): Reopen descriptor.
14030         (File_read::do_readv): Likewise.
14031         * fileread.h (class File_read): Add is_descriptor_opened_ field.
14032         Update declarations.
14033         * layout.cc: Include "descriptors.h".
14034         (Layout::create_build_id): Use open_descriptor rather than open.
14035         * output.cc: Include "descriptors.h".
14036         (Output_file::open): Use open_descriptor rather than open.
14037         * archive.cc (Archive::const_iterator): Change Archive to be
14038         non-const.
14039         (Archive::begin, Archive::end): Make non-const.
14040         (Archive::count_members): Likewise.
14041         * archive.h (class Archive): Update declarations.
14042         * object.h (Object::read): Make non-const.
14043         * Makefile.am (CCFILES): Add descriptors.cc.
14044         (HFILES): Add descriptors.h.
14045         * Makefile.in: Rebuild.
14046
14047         PR 6716
14048         * gold.h: Always include <clocale>.  Add Solaris workarounds
14049         following code in binutils/sysdep.h.
14050
14051         PR 6048
14052         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
14053         this->eh_frame_hdr_ is NULL before using it.
14054
14055         * dynobj.cc (Versions::Versions): Update comment.
14056
14057         * dynobj.cc (Versions::Versions): If there is an soname, use it as
14058         the base version name.
14059
14060         * stringpool.cc (Stringpool_template::add_with_length): Set key to
14061         array size plus one.
14062         (Stringpool_template::set_string_offsets): Subtract one from key
14063         before using it as an array index.
14064         (Stringpool_template::get_offset_with_length): Likewise.
14065         (Stringpool_template::write_to_buffer): Likewise.
14066         * stringpool.h (Stringpool_template::get_offset_from_key):
14067         Likewise.
14068
14069 2008-07-23  Ian Lance Taylor  <iant@google.com>
14070
14071         PR 6658
14072         * object.h (Merged_symbol_value::value): Do our best to handle a
14073         negative addend.
14074
14075         PR 6647
14076         * script.cc (Version_script_info::get_versions): Don't add empty
14077         version tag to return value.
14078         (Version_script_info::get_symbol_version_helper): Change return
14079         type to bool.  Add pversion parameter.  Change all callers.
14080         (script_register_vers_node): Don't require a non-NULL tag.
14081         * script.h (class Version_script_info): Update declarations.
14082         (Version_script_info::get_symbol_version): Change return type to
14083         bool.  Add version parameter.  Change all callers.
14084         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
14085         handling.  Handle an empty version from a version script.
14086         (Symbol_table::define_special_symbol): Likewise.
14087         * testsuite/ver_test_10.script: New file.
14088         * testsuite/ver_test_10.sh: New file.
14089         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
14090         (check_DATA): Add ver_test_10.syms.
14091         (ver_test_10.syms, ver_test_10.so): New target.
14092         * testsuite/Makefile.in: Rebuild.
14093
14094 2008-07-23  Simon Baldwin  <simonb@google.com>
14095
14096         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
14097         to zero for undefined symbols from dynamic libraries.
14098
14099 2008-07-23  Ian Lance Taylor  <iant@google.com>
14100
14101         * symtab.cc (Symbol_table::resolve): Remove version parameter.
14102         Change all callers.
14103         * symtab.h (class Symbol_table): Update declaration.
14104         * testsuite/ver_test_9.cc: New file.
14105         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
14106         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
14107         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
14108         (ver_test_9.so, ver_test_9.o): New targets.
14109         * testsuite/Makefile.in: Rebuild.
14110
14111 2008-07-22  Ian Lance Taylor  <iant@google.com>
14112
14113         * options.h (class General_options): Define --check-sections.
14114         * layout.cc (Layout::set_segment_offsets): Handle
14115         --check-sections.
14116
14117         * options.h (class General_options): Define -n/--nmagic and
14118         -N/--omagic.
14119         * options.cc (General_options::finalize): For -n/--nmagic or
14120         -N/--omagic, set -static.
14121         * layout.cc (Layout::attach_allocated_section_to_segment): If
14122         -N/--omagic, don't put read-only and read-write sections in
14123         different segments.
14124         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
14125         finding a read-only segment.
14126         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
14127         don't set the minimum segment alignment to the common page size,
14128         and don't set the file offset to the address modulo the page size.
14129         * script-sections.cc (Script_sections::create_segments): If
14130         -n/--omagic, don't put read-only and read-write sections in
14131         different segments.
14132
14133         * cref.cc: New file.
14134         * cref.h: New file.
14135         * options.h (class General_options): Add --print-symbol-counts.
14136         * main.cc (main): Issue defined symbol report if requested.
14137         * archive.cc (Archive::interpret_header): Make into a const member
14138         function.
14139         (Archive::add_symbols): Call Input_objects::archive_start and
14140         archive_stop.
14141         (Archive::const_iterator): Define new class.
14142         (Archive::begin, Archive::end): New functions.
14143         (Archive::include_all_members): Rewrite to use iterator.
14144         (Archive::count_members): New function.
14145         * archive.h (class Archive): Update declarations.
14146         (Archive::filename): New function.
14147         * object.cc: Include "cref.h".
14148         (Sized_relobj::Sized_relobj): Initialize defined_count_.
14149         (Sized_relobj::do_get_global_symbol_counts): New function.
14150         (Input_objects::add_object): Add object to cross-referencer.
14151         (Input_objects::archive_start): New function.
14152         (Input_objects::archive_stop): New function.
14153         (Input_objects::print_symbol_counts): New function.
14154         * object.h: Declare Cref and Archive.
14155         (Object::get_global_symbol_counts): New function.
14156         (Object::do_get_global_symbol_counts): New pure virtual function.
14157         (class Sized_relobj): Add defined_count_ field.  Update
14158         declarations.
14159         (class Input_objects): Add cref_ field.  Update constructor.
14160         Update declarations.
14161         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
14162         defined_count_.
14163         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
14164         symbol counts.
14165         (Sized_dynobj::do_get_global_symbol_counts): New function.
14166         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
14167         defined_count_.  Update declarations.  Define Symbols typedef.
14168         * symtab.cc (Symbol_table::add_from_relobj): Add defined
14169         parameter.  Change all callers.
14170         (Symbol_table::add_from_dynobj): Add sympointers and defined
14171         parameters.  Change all callers.
14172         * symtab.h (class Symbol_table): Update declarations.
14173         * Makefile.am (CCFILES): Add cref.cc.
14174         (HFILES): Add cref.h.
14175         * Makefile.in: Rebuild.
14176
14177 2008-07-22  Simon Baldwin  <simonb@google.com>
14178
14179         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
14180         to zero when writing undefined symbols.
14181
14182 2008-07-22  Ian Lance Taylor  <iant@google.com>
14183
14184         * output.cc (Output_section::add_input_section): Don't try to
14185         merge empty merge sections.
14186
14187 2008-07-21  Craig Silverstein  <csilvers@google.com>
14188
14189         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
14190         Include symbol version in error message.
14191
14192 2008-07-20  Chris Demetriou  <cgd@google.com>
14193
14194         * configure.ac (gold_cv_c_random_seed): New configured variable.
14195         (RANDOM_SEED_CFLAGS): New substituted variable.
14196         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
14197         * configure: Rebuild.
14198         * Makefile.in: Likewise.
14199         * testsuite/Makefile.in: Likewise.
14200
14201 2008-07-18  Ian Lance Taylor  <iant@google.com>
14202
14203         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
14204         where we see NAME/NULL and NAME/VERSION  as separate symbols.
14205         * testsuite/ver_test_main.cc (main): Call t4.
14206         (t4, t4_2a): Define.
14207         * testsuite/ver_test_2.cc (t4_2): Define.
14208         * testsuite/ver_test_2.script: Put t4_2a in VER2.
14209         * testsuite/ver_test_4.cc (t4_2a): Define.
14210         * testsuite/ver_test_4.script: Put t4_2a in VER2.
14211         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
14212
14213 2008-07-17  Ian Lance Taylor  <iant@google.com>
14214
14215         * dynobj.cc (Versions::add_def): If we give an error about a
14216         missing version, go ahead and create the version anyhow.
14217
14218 2008-07-10  Ian Lance Taylor  <iant@google.com>
14219
14220         Handle output sections with more than 0x7fffffff bytes.
14221         * object.h (class Relobj): Change map_to_output_ to
14222         output_sections_, and just keep a section pointer.  Change all
14223         uses.  Move comdat group support to Sized_relobj.
14224         (Relobj::is_section_specially_mapped): Remove.
14225         (Relobj::output_section): Remove poff parameter.  Change all
14226         callers.
14227         (Relobj::output_section_offset): New function.
14228         (Relobj::set_section_offset): Rewrite.
14229         (Relobj::map_to_output): Remove.
14230         (Relobj::output_sections): New function.
14231         (Relobj::do_output_section_offset): New pure virtual function.
14232         (Relobj::do_set_section_offset): Likewise.
14233         (class Sized_relobj): Add section_offsets_ field.  Add comdat
14234         group support from Relobj.  Update declarations.
14235         (Sized_relobj::get_output_section_offset): New function.
14236         (Sized_relobj::do_output_section_offset): New function.
14237         (Sized_relobj::do_set_section_offset): New function.
14238         * object.cc (Relobj::output_section_address): Remove.
14239         (Sized_relobj::Sized_relobj): Initialize new fields.
14240         (Sized_relobj::include_section_group): Cast find_kept_object to
14241         Sized_relobj.
14242         (Sized_relobj::include_linkonce_section): Likewise.
14243         (Sized_relobj::do_layout): Use separate arrays for output section
14244         and output offset.
14245         (Sized_relobj::do_count_local_symbols): Change map_to_output to
14246         output_sections.
14247         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
14248         output_sections and section_offsets.
14249         (Sized_relobj::write_local_symbols): Likewise.
14250         (map_to_kept_section): Compute output address directly.
14251         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
14252         output_sections and section_offsets.
14253         (Sized_relobj::write_sections): Likewise.
14254         (Sized_relobj::relocate_sections): Likewise.
14255         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
14256         * output.h (class Output_reloc): Update declarations.  Change
14257         u2_.relobj to Sized_relobj*.
14258         (class Output_data_reloc): Change add functions to use
14259         Sized_relobj*.
14260         * output.cc (Output_reloc::Output_reloc): Change relobj to
14261         Sized_relobj*.
14262         (Output_reloc::local_section_offset): Change return type to
14263         Elf_Addr.  Use get_output_section_offset.
14264         (Output_reloc::get_address): Likewise.
14265         (Output_section::is_input_address_mapped): Don't call
14266         is_section_specially_mapped.
14267         (Output_section::output_offset): Likewise.
14268         (Output_section::output_address): Likewise.
14269         (Output_section::starting_output_address): Likewise.
14270         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
14271         parameter to Sized_relobj*.
14272         (Copy_relocs::need_copy_reloc): Likewise.
14273         (Copy_relocs::save): Likewise.
14274         * copy-relocs.h (class Copy_relocs): Update declarations.
14275         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
14276         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
14277         * target-reloc.h (relocate_for_relocatable): Change
14278         offset_in_output_section type to Elf_Addr.  Change code that uses
14279         it as well.
14280         * layout.cc (Layout::layout): Always set *off.
14281         * mapfile.cc (Mapfile::print_input_section): Use
14282         output_section_offset.
14283         * i386.cc (Target_i386::copy_reloc): Change object parameter to
14284         Sized_relobj*.
14285         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
14286         * sparc.cc (Target_sparc::copy_reloc): Likewise.
14287         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
14288
14289 2008-07-03  Ian Lance Taylor  <iant@google.com>
14290
14291         * layout.cc (Layout::include_section): Do not discard unrecognized
14292         SHT_STRTAB sections.
14293
14294 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
14295
14296         * script.cc (Lex::can_continue_name): Make '?' allowable in
14297         version-script names.
14298         * testsuite/version_script.map: Change glob pattern to use '?'
14299
14300 2008-06-30  Manish Singh  <yosh@gimp.org>
14301
14302         PR 6585
14303         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
14304         Correct typo.
14305
14306 2008-06-30  Ian Lance Taylor  <iant@google.com>
14307
14308         PR 6660
14309         PR 6682
14310         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
14311         versions]: Don't try to read the value in the contents, since we
14312         don't use it.  Use the template endianness when writing.
14313
14314 2008-06-25  Cary Coutant  <ccoutant@google.com>
14315
14316         * fileread.cc (File_read::make_view): Assert on zero-length view.
14317         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
14318         symbol table when there are no symbols to read.
14319
14320 2008-06-23  Craig Silverstein  <csilvers@google.com>
14321
14322         * version.cc (version_string): Bump to 1.7
14323
14324 2008-06-18  Craig Silverstein  <csilvers@google.com>
14325
14326         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
14327         constant 0xFFFF to type Valtype.
14328         (Powerpc_relocate_functions::rel16_ha): Likewise.
14329
14330 2008-06-17  Ian Lance Taylor  <iant@google.com>
14331
14332         * output.h (Output_section::Input_section): Initialize p2align_ to
14333         zero for Output_section_data constructors.
14334         (Output_section::Input_section::addralign): If not an input
14335         section, return the alignment of the Output_section_data.
14336         * testsuite/copy_test.cc: New file.
14337         * testsuite/copy_test_1.cc: New file.
14338         * testsuite/copy_test_2.cc: New file.
14339         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
14340         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
14341         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
14342         (copy_test_1_pic.o, copy_test_1.so): New targets.
14343         (copy_test_2_pic.o, copy_test_2.so): New targets.
14344         * testsuite/Makefile.in: Rebuild.
14345
14346         * script-sections.cc (Script_sections::place_orphan): Initialize
14347         local variable exact.
14348
14349 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
14350
14351         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
14352
14353 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
14354             David S. Miller  <davem@davemloft.net>
14355
14356         * powerpc.cc: New file.
14357         * Makefile.am (TARGETSOURCES): Add powerpc.cc
14358         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
14359         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
14360         * Makefile.in: Rebuild.
14361
14362 2008-06-09  Ian Lance Taylor  <iant@google.com>
14363
14364         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
14365         <exception>.
14366         (throwing, orig_terminate): New static variables.
14367         (terminate_handler): New static function.
14368         (t2): Set terminate handler.
14369
14370 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
14371
14372         PR 6584
14373         * binary.cc (Binary_to_elf::sized_convert): Fix .data
14374         alignment.
14375
14376 2008-05-30  Cary Coutant  <ccoutant@google.com>
14377
14378         * archive.cc (Archive::include_all_members) Correct to step
14379         over symbol table and extended name table in thin archives.
14380
14381 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
14382
14383         PR 6407
14384         * target-reloc.h (relocate_for_relocatable): Fix new_offset
14385         calculation.
14386
14387 2008-05-28  Caleb Howe  <cshowe@google.com>
14388
14389         * reduced_debug_output.cc: New file.
14390         * reduced_debug_output.h: New file.
14391         * options.h (class General_options): Add --strip-debug-non-line.
14392         * options.cc (General_options::finalize): Add strip_debug_non_line
14393         to the strip heirarchy.
14394         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
14395         fields.
14396         * layout.cc: Include "reduced_debug_output.h".
14397         (Layout::Layout): Initialize new fields.
14398         (line_only_debug_sections): New static array.
14399         (is_lines_only_debug_sections): New static inline function.
14400         (Layout::include_section): Handle --strip-debug-non-line.
14401         (Layout::make_output_section): If --strip-debug-non-line, build
14402         new output sections for .debug_abbrev and .debug_info.
14403         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
14404         gold.  Warn about possible overflow.
14405         (read_signed_LEB_128): Likewise.
14406         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
14407         (read_signed_LEB_128): Declare.
14408         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
14409         (HFILES): Add reduced_debug_output.h.
14410         * Makefile.in: Rebuild.
14411
14412 2008-05-21  Ian Lance Taylor  <iant@google.com>
14413
14414         * mapfile.cc: New file.
14415         * mapfile.h: New file.
14416         * options.h (class General_options): Add -M/--print-map and -Map.
14417         * options.cc (General_options::finalize): Make -M equivalent to
14418         -Map -.
14419         * main.cc: Include <cstdio> and "mapfile.h".
14420         (main): Open mapfile if requested.
14421         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
14422         constructor.  Change caller.
14423         (queue_initial_tasks): Add mapfile parameter.  Change caller.
14424         (queue_middle_tasks): Likewise.
14425         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
14426         declarations.
14427         * archive.cc: Include "mapfile.h".
14428         (Archive::add_symbols): Add mapfile parameter.  Change all
14429         callers.  Pass mapfile, symbol, and reason to include_member.
14430         (Archive::include_all_members): Add mapfile parameter.  Change all
14431         callers.
14432         (Archive::include_member): Add mapfile, sym, and why parameters.
14433         Change all callers.  Report inclusion to map file.
14434         * archive.h: Include "fileread.h".
14435         (class Archive): Update declarations.
14436         (Archive::file): New const method.
14437         (class Add_archive_symbols): Add mapfile_ field.  Update
14438         constructor.  Change all callers.
14439         * readsyms.h (class Read_symbols): Likewise.
14440         (class Finish_group): Likewise.
14441         (class Read_script): Likewise.
14442         * common.cc: Include "mapfile.h".
14443         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
14444         all callers.
14445         (Symbol_table::do_allocate_commons): Likewise.
14446         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
14447         symbol allocation to mapfile.
14448         * common.h (class Allocate_commons_task): Add mapfile_ field.
14449         Update constructor.  Change all callers.
14450         * symtab.h (class Symbol_table): Update declarations.
14451         * layout.cc: Include "mapfile.h".
14452         (Layout_task_runner::run): Print information to mapfile.
14453         (Layout::create_gold_note): Change Output_data_fixed_space to
14454         Output_data_zero_fill.
14455         (Layout::create_build_id): Likewise.
14456         (Layout::print_to_mapfile): New function.
14457         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
14458         constructor.  Change caller.
14459         (class Layout): Declare print_to_mapfile.
14460         * output.cc (Output_section::Input_section::print_to_mapfile): New
14461         function.
14462         (Output_section::add_input_section): If producing a map, always
14463         add to input_sections_ list.
14464         (Output_section::do_print_to_mapfile): New function.
14465         (Output_segment::print_sections_to_mapfile): New function.
14466         (Output_segment::print_section_list_to_mapfile): New function.
14467         * output.h: Include "mapfile.h".
14468         (Output_data::print_to_mapfile): New function.
14469         (Output_data::do_print_to_mapfile): New virtual function.
14470         (Output_segment_headers::do_print_to_mapfile): New function.
14471         (Output_file_header::do_print_to_mapfile): New function.
14472         (Output_data_const::do_print_to_mapfile): New function.
14473         (class Output_data_const_buffer): Add map_name_ field.  Update
14474         constructor.  Change all callers.  Add do_print_to_mapfile
14475         function.
14476         (class Output_data_fixed_space): Likewise.
14477         (class Output_data_space): Likewise.
14478         (class Output_data_zero_fill): New class.
14479         (Output_data_strtab::do_print_to_mapfile): New function.
14480         (Output_data_reloc_base::do_print_to_mapfile): New function.
14481         (Output_relocatable_relocs::do_print_to_mapfile): New function.
14482         (Output_data_group::do_print_to_mapfile): New function.
14483         (Output_data_got::do_print_to_mapfile): New function.
14484         (Output_data_dynamic::do_print_to_mapfile): New function.
14485         (Output_symtab_xindex::do_print_to_mapfile): New function.
14486         (class Output_section): Declare do_print_to_mapflie.  Declare
14487         print_to_mapfile in Input_section.
14488         (class Output_segment): Declare new functions.
14489         * object.h (Sized_relobj::symbol_count): New function.
14490         * script-sections.cc
14491         (Output_section_element_dot_assignment::set_section_addresses):
14492         Change Output_data_fixed_space to Output_data_zero_fill.
14493         (Output_data_expression::do_print_to_mapfile): New function.
14494         * script.cc (read_input_script): Add mapfile parameter.  Change
14495         all callers.
14496         * script.h (read_input_script): Update declaration.
14497         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
14498         (Eh_frame::do_print_to_mapfile): New function.
14499         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
14500         (Output_merge_string::do_print_to_mapfile): New function.
14501         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
14502         function.
14503         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
14504         function.
14505         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
14506         function.
14507         * Makefile.am (CCFILES): Add mapfile.cc.
14508         (HFILES): Add mapfile.h.
14509         * Makefile.in: Rebuild.
14510
14511 2008-05-19  Ian Lance Taylor  <iant@google.com>
14512
14513         * options.h (class General_options): Add -z relro.
14514         * layout.cc (Layout::Layout): Initialize relro_segment_.
14515         (Layout::add_output_section_data): Return the output section.
14516         (Layout::make_output_section): Rcognize relro sections and mark
14517         them appropriately.
14518         (Layout::attach_allocated_section_to_segment): Put relro sections
14519         in a PT_GNU_RELRO segment.
14520         (Layout::create_initial_dynamic_sections): Mark the .dynamic
14521         section as relro.
14522         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
14523         PT_TLS segments.
14524         (Layout::linkonce_mapping): Map d.rel.ro.local to
14525         .data.rel.ro.local.
14526         (Layout::output_section_name): Us .data.rel.ro.local for any
14527         section which begins with that.
14528         * layout.h (class Layout): Update add_output_section_data
14529         declaration.  Add relro_segment_ field.
14530         * output.cc (Output_section::Output_section): Initialize is_relro_
14531         and is_relro_local_ fields.
14532         (Output_segment::add_output_section): Group relro sections.
14533         (Output_segment::is_first_section_relro): New function.
14534         (Output_segment::maximum_alignment): If there is a relro section,
14535         align the segment to the common page size.
14536         (Output_segment::set_section_addresses): Track whether we are
14537         looking at relro sections.  If the last section is a relro
14538         section, align to the common page size.
14539         (Output_segment::set_section_list_addresses): Add in_relro
14540         parameter.  Change all callers.  Align to the page size when
14541         moving from relro to non-relro section.
14542         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
14543         segment.
14544         * output.h (class Output_section): Add is_relro_ and
14545         is_relro_local_ fields.
14546         (Output_section::is_relro): New function.
14547         (Output_section::set_is_relro): New function.
14548         (Output_section::is_relro_local): New function.
14549         (Output_section::set_is_relro_local): New function.
14550         (class Output_segment): Update declarations.
14551         * i386.cc (Target_i386::got_section): Mark .got section as relro.
14552         * sparc.cc (Target_sparc::got_section): Likewise.
14553         * x86_64.cc (Target_x86_64::got_section): Likewise.
14554         * testsuite/relro_test_main.cc: New file.
14555         * testsuite/relro_test.cc: New file.
14556         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
14557         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
14558         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
14559         (relro_test.so, relro_test_pic.o): New targets.
14560         * testsuite/Makefile.in: Rebuild.
14561
14562 2008-05-16  Ian Lance Taylor  <iant@google.com>
14563
14564         * output.cc (Output_segment::add_output_section): Remove front
14565         parameter.
14566         * output.h (class Output_segment): Remove
14567         add_initial_output_section and overloaded add_output_section.
14568         Update declaration of remaining add_output_section.
14569         * layout.cc (Layout::create_interp): Call add_output_section
14570         rather than add_initial_output_section.
14571         (Layout::finish_dynamic_section): Likewise.
14572
14573         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
14574         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
14575         know the dynamic type.
14576         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
14577         field.  Initialize it in constructor.
14578         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
14579         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
14580         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
14581         reloc.
14582
14583         * output.cc (Output_reloc::get_address): Change return type to
14584         Elf_Addr.
14585         * output.h (class Output_reloc): Update get_address declaration.
14586         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
14587         for section addresses.
14588
14589 2008-05-09  Ian Lance Taylor  <iant@google.com>
14590
14591         PR 6493
14592         * gold.cc (gold_nomem): Use return value of write.
14593
14594 2008-05-08  Ian Lance Taylor  <iant@google.com>
14595
14596         * symtab.c (Symbol::init_base_output_data): Add version
14597         parameter.  Change all callers.
14598         (Symbol::init_base_output_segment): Likewise.
14599         (Symbol::init_base_constant): Likewise.
14600         (Symbol::init_base_undefined): Likewise.
14601         (Sized_symbol::init_output_data): Likewise.
14602         (Sized_symbol::init_output_segment): Likewise.
14603         (Sized_symbol::init_constant): Likewise.
14604         (Sized_symbol::init_undefined): Likewise.
14605         (Symbol_table::do_define_in_output_data): If the new symbol has a
14606         version, mark it as the default.
14607         (Symbol_table::do_define_in_output_segment): Likewise.
14608         (Symbol_table::do_define_as_constant): Likewise.
14609         * symtab.h (class Symbol): Update declarations.
14610         (class Sized_symbol): Likewise.
14611         * resolve.cc (Symbol::override_version): New function.
14612         (Symbol::override_base): Call override_version.
14613         (Symbol::override_base_with_special): Likewise.
14614         * testsuite/ver_script_8.script: New file.
14615         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
14616         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
14617         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
14618         (ver_test_8_1.so, ver_test_8_2.so): New targets.
14619
14620 2008-05-06  Ian Lance Taylor  <iant@google.com>
14621
14622         PR 6049
14623         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
14624         functions.
14625         (class General_options): Remove existing --undefined, and add
14626         --no-undefined instead.  Add new --undefined as synonym for -u.
14627         * archive.cc (Archive::add_symbols): Check whether symbol was
14628         named with -u.
14629         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
14630         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
14631         all uses.  Add IS_UNDEFINED.  Update declarations to split
14632         different versions of init_base.  Declare init_base_undefined.
14633         (Symbol::is_defined): Handle IS_UNDEFINED.
14634         (Symbol::is_undefined): Likewise.
14635         (Symbol::is_weak_undefined): Call is_undefined.
14636         (Symbol::is_absolute): Handle IS_CONSTANT.
14637         (class Sized_symbol): Update declarations to split different
14638         versions of init.  Declare init_undefined.
14639         (class Symbol_table): Declare new functions.
14640         * symtab.cc (Symbol::init_base_object): Rename from init_base.
14641         Change all callers.
14642         (Symbol::init_base_output_data): Likewise.
14643         (Symbol::init_base_output_segment): Likewise.
14644         (Symbol::init_base_constant): Likewise.
14645         (Symbol::init_base_undefined): New function.
14646         (Sized_symbol::init_object): Rename from init.  Change all
14647         callers.
14648         (Sized_symbol::init_output_data): Likewise.
14649         (Sized_symbol::init_output_segment): Likewise.
14650         (Sized_symbol::init_constant): Likewise.
14651         (Sized_symbol::init_undefined): New function.
14652         (Symbol_table::add_undefined_symbols_from_command_line): New
14653         function.
14654         (Symbol_table::do_add_undefined_symbols_from_command_line): New
14655         function.
14656         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
14657         (Symbol::output_section): Likewise.
14658         (Symbol::set_output_section): Likewise.
14659         (Symbol_table::sized_finalize_symbol): Likewise.
14660         (Symbol_table::sized_write_globals): Likewise.
14661         * resolve.cc (Symbol_table::should_override): Likewise.
14662         (Symbol::override_base_with_special): Likewise.
14663
14664         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
14665         symbol, change it to have default visibility.
14666         * testsuite/protected_1.cc: New file.
14667         * testsuite/protected_2.cc: New file.
14668         * testsuite/protected_3.cc: New file.
14669         * testsuite/protected_main_1.cc: New file.
14670         * testsuite/protected_main_2.cc: New file.
14671         * testsuite/protected_main_3.cc: New file.
14672         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
14673         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
14674         (protected_1_LDFLAGS, protected_1_LDADD): Define.
14675         (protected_1.so): New target.
14676         (protected_1_pic.o, protected_2_pic.o): New targets.
14677         (protected_3_pic.o): New target.
14678         (check_PROGRAMS): Add protected_2.
14679         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
14680         (protected_2_LDFLAGS, protected_2_LDADD): Define.
14681         * testsuite/Makefile.in: Rebuild.
14682
14683         * options.h (DEFINE_var): Add set_user_set_##varname__.
14684         (DEFINE_bool_alias): New macro.
14685         (class General_options): Define -Bstatic using DEFINE_bool_alias
14686         rather than DEFINE_special.  Add --undefined as an alias for -z
14687         defs.
14688         * options.cc (General_options::parse_Bstatic): Remove.
14689
14690         * options.h (class General_options): Add --fatal-warnings.
14691         * main.cc (main): Implement --fatal-warnings.
14692         * errors.h (Errors::warning_count): New function.
14693
14694         * options.h (class General_options): Add -Bsymbolic-functions.
14695         * symtab.h (Symbol::is_preemptible): Check for
14696         -Bsymbolic-functions.
14697
14698 2008-05-05  Ian Lance Taylor  <iant@google.com>
14699
14700         * options.h (DEFINE_bool): For DASH_Z, create the negative option
14701         as noVARNAME rather than no-VARNAME.
14702         (class General_options): Add option -z combreloc.
14703         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
14704         get_address.
14705         (Output_reloc::sort_before) [SHT_REL]: New function.
14706         (Output_reloc::sort_before) [SHT_RELA]: New function.
14707         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
14708         Sort_relocs_comparison.
14709         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
14710         parameter.  Change all callers.
14711         (Output_data_reloc::Output_data_reloc) [both versions]: Add
14712         sort_relocs parameter.  Change all callers.
14713         * output.cc (Output_reloc::get_address): New function, broken out
14714         of write_rel.
14715         (Output_reloc::write_rel): Call it.
14716         (Output_reloc::compare): New function.
14717         (Output_data_reloc_base::do_write): Optionally sort relocs.
14718
14719         * configure.ac: If targ_extra_obj is set, link it in.
14720         * configure.tgt: Initialize all variables.
14721         (x86_64*): Set targ_extra_obj and targ_extra_size.
14722         * configure: Rebuild.
14723
14724         * object.cc (Sized_relobj::include_section_group): Adjust section
14725         indexes read from group data.  Build vector to pass to
14726         layout_group.
14727         * layout.cc (Layout::layout_group): Add flags and shndxes
14728         parameters.  Remove contents parameter.  Change caller.  Update
14729         explicit instantiations.
14730         * layout.h (class Layout): Update layout_group declaration.
14731         * output.cc (Output_data_group::Output_data_group): Add flags and
14732         input_shndxes parameters.  Remove contents parameter.  Change
14733         caller.
14734         (Output_data_group::do_write): Change input_sections_ to
14735         input_shndxes_.
14736         * output.h (class Output_data_group): Update constructor
14737         declaration.  Rename input_sections_ to input_shndxes_.
14738         * testsuite/many_sections_test.cc: Add template.
14739
14740 2008-04-30  Cary Coutant  <ccoutant@google.com>
14741
14742         * target-reloc.h (relocate_section): Fix dead-pointer bug.
14743
14744         * layout.cc (Layout::include_section): Refactored check for debug
14745         info section.
14746         (Layout::add_comdat): Add new parameters.  Change type
14747         of signature parameter.  Add object and shndx to signatures table.
14748         (Layout::find_kept_object): New function.
14749         * layout.h: Include <cstring>.
14750         (Layout::is_debug_info_section): New function.
14751         (Layout::add_comdat): Add new parameters.
14752         (Layout::find_kept_object): New function.
14753         (Layout::Kept_section): New struct.
14754         (Layout::Signatures): Change type of map range.
14755         * object.cc (Relobj::output_section_address): New function.
14756         (Sized_relobj::include_section_group): Add new parameters.  Change
14757         calls to Layout::add_comdat.  Change to build table of kept comdat
14758         groups and table mapping discarded sections to kept sections.
14759         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
14760         (Sized_relobj::do_layout): Change calls to include_section_group and
14761         include_linkonce_section.
14762         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
14763         value to zero when section is discarded.
14764         (Sized_relobj::map_to_kept_section): New function.
14765         * object.h (Relobj::output_section_address): New function.
14766         (Relobj::Comdat_group): New type.
14767         (Relobj::find_comdat_group): New function.
14768         (Relobj::Comdat_group_table): New type.
14769         (Relobj::Kept_comdat_section): New type.
14770         (Relobj::Kept_comdat_section_table): New type.
14771         (Relobj::add_comdat_group): New function.
14772         (Relobj::set_kept_comdat_section): New function.
14773         (Relobj::get_kept_comdat_section): New function.
14774         (Relobj::comdat_groups_): New field.
14775         (Relobj::kept_comdat_sections_): New field.
14776         (Symbol_value::input_value): Update comment.
14777         (Sized_relobj::map_to_kept_section) New function.
14778         (Sized_relobj::include_linkonce_section): Add new parameter.
14779         * target-reloc.h (Comdat_behavior): New type.
14780         (get_comdat_behavior): New function.
14781         (relocate_section): Add code to map a discarded section to the
14782         corresponding kept section when applying a relocation.
14783
14784 2008-04-30  Craig Silverstein  <csilvers@google.com>
14785
14786         * dwarf_reader.cc (next_generation_count): New static var.
14787         (Addr2line_cache_entry): New struct.
14788         (addr2line_cache): New static var.
14789         (Dwarf_line_info::one_addr2line): Added caching.
14790         (Dwarf_line_info::clear_addr2line_cache): New function.
14791         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
14792         cache-size parameter.
14793         (Dwarf_line_info::one_addr2line_cache): New function.
14794         * symtab.cc (Symbol_table::detect_odr_violations): Pass
14795         new cache-size argument to one_addr2line(), and clear cache.
14796
14797 2008-04-28  Cary Coutant  <ccoutant@google.com>
14798
14799         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
14800         R_386_PC8 relocations.
14801
14802 2008-04-23  Ian Lance Taylor  <iant@google.com>
14803
14804         * object.cc (Sized_relobj::include_section_group): Check for
14805         invalid section group.
14806
14807         * object.cc (make_elf_object): Correct test for 64-bit ELF file
14808         header size.
14809
14810         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
14811         than read for file header.
14812         * archive.cc (Archive::include_member): Likewise.
14813
14814 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
14815
14816         * aclocal.m4: Regenerate.
14817         * configure: Regenerate.
14818
14819 2008-04-19  Ian Lance Taylor  <iant@google.com>
14820
14821         * version.cc (version_string): Bump to 1.6.
14822
14823         * testsuite/Makefile.am (many_sections_r_test): New target.
14824         (many_sections_r_test_SOURCES): Remove.
14825         (many_sections_r_test_DEPENDENCIES): Remove.
14826         (many_sections_r_test_LDFLAGS): Remove.
14827         (many_sections_r_test_LDADD): Remove.
14828
14829         * object.cc (Sized_relobj::do_add_symbols): Always pass
14830         local_symbol_count_ to add_from_relobj.
14831
14832         * testsuite/Makefile.am (many_sections_check.h): Only check one in
14833         every thousand variables.
14834         * testsuite/Makefile.in: Rebuild.
14835
14836         * object.cc (Xindex::initialize_symtab_xindex): New function.
14837         (Xindex::read_symtab_xindex): New function.
14838         (Xindex::sym_xindex_to_shndx): New function.
14839         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
14840         available.
14841         (Sized_relobj::do_initialize_xindex): New function.
14842         (Sized_relobj::do_read_symbols): Adjust section links.
14843         (Sized_relobj::symbol_section_and_value): Add is_ordinary
14844         parameter.  Change all callers.
14845         (Sized_relobj::include_section_group): Adjust section links and
14846         symbol section indexes.
14847         (Sized_relobj::do_layout): Adjust section links.
14848         (Sized_relobj::do_count_local_symbols): Adjust section links and
14849         symbol section indexes.
14850         (Sized_relobj::do_finalize_local_symbols): Distinguish between
14851         ordinary and special symbols.
14852         (Sized_relobj::write_local_symbols): Add symtab_xindex and
14853         dynsym_xindex parameters.  Change all callers.  Adjust section
14854         links.  Use SHN_XINDEX when needed.
14855         (Sized_relobj::get_symbol_location_info): Adjust section links.
14856         Don't get fooled by special symbols.
14857         * object.h (class Xindex): Define.
14858         (class Object): Add xindex_ parameter.  Declare virtual functoin
14859         do_initialize_xindex.
14860         (Object::adjust_sym_shndx): New function.
14861         (Object::set_xindex): New protected function.
14862         (class Symbol_value): Add is_ordinary_shndx_ field.
14863         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
14864         (Symbol_value::value): Assert ordinary section.
14865         (Symbol_value::initialize_input_to_output_map): Likewise.
14866         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
14867         Change all callers.
14868         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
14869         all callers.
14870         (class Sized_relobj): Update declarations.
14871         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
14872         parameter.  Change all callers.
14873         (Sized_relobj::adjust_shndx): New function.
14874         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
14875         field.
14876         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
14877         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
14878         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
14879         (Sized_dynobj::read_dynsym_section): Adjust section links.
14880         (Sized_dynobj::read_dynamic): Likewise.
14881         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
14882         section links.
14883         (Sized_dynobj::do_initialize_xindex): New function.
14884         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
14885         do_initialize_xindex.
14886         (Sized_dynobj::adjust_shndx): New function.
14887         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
14888         dynsym_xindex_ fields.
14889         (Layout::finalize): Add a call to set_section_indexes before
14890         creating the symtab sections.
14891         (Layout::set_section_indexes): Don't do anything if the section
14892         already has a section index.
14893         (Layout::create_symtab_sections): Add shnum parameter.  Change
14894         caller.  Create .symtab_shndx section if needed.
14895         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
14896         caller.
14897         (Layout::allocated_output_section_count): New function.
14898         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
14899         needed.
14900         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
14901         fields.  Update declarations.
14902         (Layout::symtab_xindex): New function.
14903         (Layout::dynsym_xindex): New function.
14904         (class Write_symbols_task): Add layout_ field.
14905         (Write_symbols_task::Write_symbols_task): Add layout parameter.
14906         Change caller.
14907         * output.cc (Output_section_headers::Output_section_headers): Add
14908         shstrtab_section parameter.  Change all callers.
14909         (Output_section_headers::do_sized_write): Store overflow values
14910         for section count and section string table section index in
14911         section header zero.
14912         (Output_file_header::do_sized_write): Check for overflow of
14913         section count and section string table section index.
14914         (Output_symtab_xindex::do_write): New function.
14915         (Output_symtab_xindex::endian_do_write): New function.
14916         * output.h (class Output_section_headers): Add shstrtab_section_.
14917         Update declarations.
14918         (class Output_symtab_xindex): Define.
14919         (Output_section::has_out_shndx): New function.
14920         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
14921         field.
14922         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
14923         Change all callers.
14924         (Sized_symbol::init): Likewise.
14925         (Symbol::output_section): Check for ordinary symbol.
14926         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
14927         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
14928         callers.
14929         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
14930         Change all callers.  Simplify handling of symbols from sections
14931         not included in the link.
14932         (Symbol_table::add_from_dynobj): Handle ordinary symbol
14933         distinction.
14934         (Weak_alias_sorter::operator()): Assert that symbols are
14935         ordinary.
14936         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
14937         distinction.
14938         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
14939         parameters.  Change all callers.
14940         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
14941         symbol distinction.  Use SHN_XINDEX when needed.
14942         (Symbol_table::write_section_symbol): Add symtab_xindex
14943         parameter.  Change all callers.
14944         (Symbol_table::sized_write_section_symbol): Likewise.  Use
14945         SHN_XINDEX when needed.
14946         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
14947         declarations.
14948         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
14949         (Symbol::is_defined): Check is_ordinary.
14950         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
14951         (Symbol::is_absolute, Symbol::is_common): Likewise.
14952         (class Sized_symbol): Update declarations.
14953         (class Symbol_table): Update declarations.
14954         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
14955         parameters.  Change all callers.
14956         (Sized_symbol::override): Likewise.
14957         (Symbol_table::override): Likewise.
14958         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
14959         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
14960         is_ordinary, and orig_st_shndx parameters.  Change all callers.
14961         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
14962         to be in an ordinary section.
14963         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
14964         object and is_ordinary parameters.  Change all callers.
14965         (Sized_dwarf_line_info::read_relocs): Add object parameter.
14966         Change all callers.  Don't add undefined or non-ordinary symbols
14967         to reloc_map_.
14968         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
14969         Change all callers.
14970         * dwarf_reader.h (class Sized_dwarf_line_info): Update
14971         declarations.
14972         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
14973         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
14974         (Sized_relobj::relocate_sections): Likewise.
14975         * target-reloc.h (scan_relocs): Adjust section symbol index.
14976         (scan_relocatable_relocs): Likewise.
14977         * i386.cc (Scan::local): Check for ordinary symbols.
14978         * sparc.cc (Scan::local): Likewise.
14979         * x86_64.cc (Scan::local): Likewise.
14980         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
14981         to symbol_section_and_value.
14982         * testsuite/many_sections_test.cc: New file.
14983         * testsuite/Makefile.am (BUILT_SOURCES): Define.
14984         (check_PROGRAMS): Add many_sections_test.
14985         (many_sections_test_SOURCES): Define.
14986         (many_sections_test_DEPENDENCIES): Define.
14987         (many_sections_test_LDFLAGS): Define.
14988         (BUILT_SOURCES): Add many_sections_define.h.
14989         (many_sections_define.h): New target.
14990         (BUILT_SOURCES): Add many_sections_check.h.
14991         (many_sections_check.h): New target.
14992         (check_PROGRAMS): Add many_sections_r_test.
14993         (many_sections_r_test_SOURCES): Define.
14994         (many_sections_r_test_DEPENDENCIES): Define.
14995         (many_sections_r_test_LDFLAGS): Define.
14996         (many_sections_r_test_LDADD): Define.
14997         (many_sections_r_test.o): New target.
14998         * testsuite/Makefile.in: Rebuild.
14999
15000 2008-04-17  Cary Coutant  <ccoutant@google.com>
15001
15002         * errors.cc (Errors::info): New function.
15003         (gold_info): New function.
15004         * errors.h (Errors::info): New function.
15005         * gold.h (gold_info): New function.
15006         * object.cc (Input_objects::add_object): Print trace output.
15007         * options.cc (options::parse_set): New function.
15008         (General_options::parse_wrap): Deleted.
15009         (General_options::General_options): Deleted initializer.
15010         * options.h (options::String_set): New typedef.
15011         (options::parse_set): New function.
15012         (DEFINE_set): New macro.
15013         (General_options::wrap): Changed to use DEFINE_set. Changed
15014         callers of any_wrap_symbols and is_wrap_symbol.
15015         (General_options::trace, General_options::trace_symbol):
15016         New options.
15017         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
15018         (General_options::wrap_symbols_): Deleted.
15019         * symtab.cc (Symbol_table::add_from_object): Print trace output.
15020
15021 2008-04-17  David S. Miller  <davem@davemloft.net>
15022
15023         * options.cc (General_options::parse_V): New function.
15024         * options.h: Add entries for -V and -Qy.
15025
15026 2008-04-17  Ian Lance Taylor  <iant@google.com>
15027
15028         * common.cc (Symbol_table::allocate_commons): Remove options
15029         parameter.  Change caller.
15030         (Symbol_table::do_allocate_commons): Remove options parameter.
15031         Change caller.  Just call do_allocate_commons_list twice.
15032         (Symbol_table::do_allocate_commons_list): New function, broken out
15033         of do_allocate_commons.
15034         * common.h (class Allocate_commons_task): Remove options_ field.
15035         Update constructor.
15036         * symtab.cc (Symbol_table::Symbol_table): Initialize
15037         tls_commons_.
15038         (Symbol_table::add_from_object): Put TLS common symbols on
15039         tls_commons_ list.
15040         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
15041         which are IN_OUTPUT_DATA.
15042         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
15043         allocate_commons and do_allocate_commons declarations.  Declare
15044         do_allocate_commons_list.
15045         * gold.cc (queue_middle_tasks): Update creation of
15046         Allocate_commons_task to not pass options.
15047         * testsuite/Makefile.am (INCLUDES): Add -I.. .
15048         (TLS_TEST_C_FLAGS): New variable.
15049         (tls_test_c_pic.o): New target.
15050         (tls_test_shared.so): Link in tls_test_c_pic.o.
15051         (tls_test_c_pic_ie.o): New target.
15052         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
15053         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
15054         (tls_test_c.o): New target.
15055         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
15056         (tls_pic_test_LDADD): Likewise.
15057         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
15058         (tls_shared_gd_to_ie_test_LDADD): Likewise.
15059         (tls_test_c_gnu2.o): New target.
15060         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
15061         tls_test_c_gnu2.o.
15062         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
15063         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
15064         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
15065         * testsuite/tls_test.cc: Include "config.h".
15066         (t_last): Call t11_last.
15067         * testsuite/tls_test.h (t11, t11_last): Declare.
15068         * testsuite/tls_test_c.c: New file.
15069         * testsuite/tls_test_main.cc (thread_routine): Call t11.
15070         * configure.ac: Check for OpenMP support.
15071         * configure, config.in, Makefile.in: Rebuild.
15072         * testsuite/Makefile.in: Rebuild.
15073
15074 2008-04-16  Cary Coutant  <ccoutant@google.com>
15075
15076         * i386.cc (Target_i386::define_tls_base_symbol): New function.
15077         (Target_i386::tls_base_symbol_defined_): New field.
15078         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
15079         (Target_i386::Scan::global): Likewise.
15080         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
15081         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
15082         (Target_x86_64::tls_base_symbol_defined_): New field.
15083         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
15084         (Target_x86_64::Scan::global): Likewise.
15085
15086 2008-04-16  Cary Coutant  <ccoutant@google.com>
15087
15088         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
15089         (Symbol::needs_plt_entry): Allow weak undefined symbols.
15090         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
15091         building shared libraries.
15092         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
15093         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
15094         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
15095         * testsuite/Makefile.in: Rebuild.
15096         * testsuite/weak_undef.h: New file.
15097         * testsuite/weak_undef_file1.cc: Add extra test cases.
15098         * testsuite/weak_undef_file2.cc: Likewise.
15099         * testsuite/weak_undef_test.cc: Likewise.
15100
15101 2008-04-16  David S. Miller  <davem@davemloft.net>
15102
15103         * sparc.cc (Target_sparc::Scan): Change from struct to class.
15104         Add issued_non_pic_error_ field.  Declare check_non_pic.
15105         (Target_sparc::Scan::check_non_pic): New function.
15106         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
15107         (Target_sparc::Scan::global): Likewise.
15108
15109         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
15110         * configure: Rebuild.
15111
15112         * options.h (DEFINE_enable): New macro.
15113         (new_dtags): New enable option.
15114         (initfirst, interpose, loadfltr, nodefaultlib,
15115         nodelete, nodlopen, nodump): New -z options.
15116         * layout.cc (Layout:finish_dynamic_section): If new
15117         dtags enabled, emit DT_RUNPATH.  Also, emit a
15118         DT_FLAGS_1 containing any specified -z flags.
15119
15120 2008-04-16  Ian Lance Taylor  <iant@google.com>
15121
15122         * copy-relocs.cc: New file.
15123         * copy-relocs.h: New file.
15124         * reloc.cc: Remove Copy_relocs code.
15125         * reloc.h: Likewise.
15126         * reloc-types.h (struct Reloc_types) [both versions]: Add
15127         get_reloc_addend_noerror.
15128         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
15129         variants of add_global which take an addend which must be zero.
15130         * i386.cc: Include "copy-relocs.h".
15131         (class Target_i386): Change type of copy_relocs_ to variable,
15132         update initializer.
15133         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
15134         Change all callers.
15135         (Target_i386::do_finalize_sections): Change handling of
15136         copy_relocs_.
15137         * sparc.cc: Include "copy-relocs.h".
15138         (class Target_sparc): Change type of copy_relocs_ to variable,
15139         update initializer.
15140         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
15141         Change all callers.
15142         (Target_sparc::do_finalize_sections): Change handling of
15143         copy_relocs_.
15144         * x86_64.cc: Include "copy-relocs.h".
15145         (class Target_x86_64): Change type of copy_relocs_ to variable,
15146         update initializer.
15147         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
15148         class.  Change all callers.
15149         (Target_x86_64::do_finalize_sections): Change handling of
15150         copy_relocs_.
15151         * Makefile.am (CCFILES): Add copy-relocs.cc.
15152         (HFILES): Add copy-relocs.h.
15153
15154         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
15155
15156         * testsuite/script_test_4.sh: Permit leading zeroes.
15157
15158 2008-04-15  Ian Lance Taylor  <iant@google.com>
15159
15160         * script-sections.cc (Script_sections::create_segments): Use
15161         header_size_adjustment even when there is enough room for the
15162         headers.
15163         * testsuite/script_test_4.sh: New file.
15164         * testsuite/script_test_4.t: New file.
15165         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
15166         (check_DATA): Add script_test_4.stdout.
15167         (MOSTLYCLEANFILES): Likewise.
15168         (script_test_4): New target.
15169         (script_test_4.stdout): New target.
15170         * testsuite/Makefile.in: Rebuild.
15171
15172         * sparc.cc: Add definitions for Output_data_plt_sparc class
15173         constants.
15174
15175 2008-04-14  David S. Miller  <davem@davemloft.net>
15176
15177         * sparc.cc: New file.
15178         * Makefile.am (TARGETSOURCES): Add sparc.cc
15179         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
15180         * configure.tgt: Document targ_extra_size and
15181         targ_extra_big_endian.  Add entries for sparc-* and
15182         sparc64-*.
15183         * configure.ac: Handle targ_extra_size and
15184         targ_extra_big_endian.
15185         * Makefile.in: Rebuild.
15186         * configure: Likewise.
15187         * po/POTFILES.in: Likewise.
15188         * po/gold.pot: Likewise.
15189
15190 2008-04-14  Ian Lance Taylor  <iant@google.com>
15191
15192         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
15193         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
15194         in the name/type/flags to section mapping.  Don't call
15195         allocate_output_section.
15196         (Layout::choose_output_section): Change parameter from adjust_name
15197         to is_input_section.  Don't permit input sections after sections
15198         are attached to segments.  Don't call allocate_output_section.
15199         (Layout::layout_eh_frame): Call update_flags_for_input_section,
15200         not write_enable_output_section.
15201         (Layout::make_output_section): Don't push to
15202         unattached_section_list_ nor call attach_to_segment.  Call
15203         attach_section_to_segment if sections are attached.
15204         (Layout::attach_sections_to_segments): New function.
15205         (Layout::attach_section_to_segment): New function.
15206         (Layout::attach_allocated_section_to_segment): Rename from
15207         attach_to_segment.  Remove flags parameter.
15208         (Layout::allocate_output_section): Remove function.
15209         (Layout::write_enable_output_section): Remove function.
15210         * layout.h (class Layout): Update for above changes.  Add new
15211         field sections_are_attached_.
15212         * output.h (Output_section::update_flags_for_input_section): New
15213         function.
15214         * output.cc (Output_section::add_input_section): Call
15215         update_flags_for_input_section.
15216         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
15217
15218 2008-04-11  Cary Coutant  <ccoutant@google.com>
15219
15220         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
15221         thought unnecessary.
15222         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
15223
15224 2008-04-11  Ian Lance Taylor  <iant@google.com>
15225
15226         * output.h (class Output_section_data): Remove inline definition
15227         of set_addralign.
15228         * output.cc (Output_section_data::set_addralign): New function.
15229
15230 2008-04-11  Cary Coutant  <ccoutant@google.com>
15231
15232         Add support for TLS descriptors for i386 and x86_64.
15233         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
15234         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
15235         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
15236         GOT_TYPE_TLS_DESC.
15237         (Target_i386::got_mod_index_entry): Remove unnecessary code.
15238         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
15239         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
15240         relocations.
15241         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
15242         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
15243         Fix problem with initial-exec relocations.
15244         (Target_i386::Relocate::relocate_tls): Likewise.
15245         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
15246         relaxation.
15247         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
15248         support for section-plus-offset dynamic table entries.
15249         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
15250         (Output_data_dynamic::Dynamic_entry): Add support for
15251         section-plus-offset dynamic table entries.
15252         (Output_data_dynamic::Classification): Likewise.
15253         (Output_data_dynamic::classification_): Renamed offset_.
15254         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
15255         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
15256         (Target_x86_64::make_plt_section): New function.
15257         (Target_x86_64::reserve_tlsdesc_entries): New function.
15258         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
15259         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
15260         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
15261         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
15262         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
15263         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
15264         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
15265         add extra PLT entry for TLS descriptors.
15266         (Output_data_plt_x86_64::got_): New field.
15267         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
15268         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
15269         fields.
15270         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
15271         descriptors.
15272         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
15273         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
15274         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
15275         R_386_TLS_DESC_CALL relocations.
15276         (Target_x86_64::Scan::global): Likewise.
15277         (Target_x86_64::do_finalize_sections): Add dynamic table entries
15278         for TLS descriptors.
15279         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
15280         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
15281         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
15282         GD-to-IE relaxation.
15283         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
15284         and TLS_DESCRIPTORS.
15285         * Makefile.in: Rebuild.
15286         * configure: Rebuild.
15287         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
15288         (tls_test_shared2.so): New target.
15289         (tls_shared_gd_to_ie_test_SOURCES): New variable.
15290         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
15291         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
15292         (tls_shared_gd_to_ie_test_LDADD): New variable.
15293         (tls_shared_gnu2_gd_to_ie_test): New target.
15294         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
15295         New targets.
15296         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
15297         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
15298         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
15299         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
15300         (tls_shared_gnu2_test): New target.
15301         (tls_test_gnu2_shared.so): New target.
15302         (tls_shared_gnu2_test_SOURCES): New variable.
15303         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
15304         (tls_shared_gnu2_test_LDFLAGS): New variable.
15305         (tls_shared_gnu2_test_LDADD): New variable.
15306         * testsuite/Makefile.in: Rebuild.
15307         * testsuite/Makefile.
15308
15309 2008-04-11  Ian Lance Taylor  <iant@google.com>
15310
15311         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
15312         justsyms.t.
15313         * testsuite/Makefile.in: Rebuild.
15314
15315         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
15316         long.
15317         * testsuite/script_test_2.cc (main): Adjust test.
15318
15319 2008-04-11  David S. Miller  <davem@davemloft.net>
15320             Ian Lance Taylor  <iant@google.com>
15321
15322         * options.h (General_options): Add entries for '-Y' and
15323         '-relax'.
15324         * options.cc (General_options:finalize): If -Y was used, add those
15325         entries to the library path instead of the default "/lib" and
15326         "/usr/lib".
15327
15328 2008-04-11  David S. Miller  <davem@davemloft.net>
15329
15330         * testsuite/justsyms.t: Start at 0x100.
15331         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
15332         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
15333         long.
15334         * testsuite/script_test_2.cc: Adjust string and section length
15335         checks.
15336
15337 2008-04-09  Ian Lance Taylor  <iant@google.com>
15338
15339         PR gold/5996
15340         * script-sections.cc (Sections_element::allocate_to_segment): Add
15341         orphan parameter.
15342         (Output_section_definition::allocate_to_segment): Likewise.
15343         (Orphan_output_section::allocate_to_segment): Likewise.
15344         (Script_sections::attach_sections_using_phdrs_clause): Don't
15345         propagate non-PT_LOAD segments to orphan sections.
15346         * testsuite/Makefile.am (script_test_3.stdout): Generate using
15347         readelf rather than objdump.
15348         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
15349         .interp section and PT_INTERP segment are the same size.
15350         * testsuite/Makefile.in: Rebuild.
15351
15352         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
15353         aliases for symbols defined in the same object.
15354         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
15355         (weak_alias_test_SOURCES): New variable.
15356         (weak_alias_test_DEPENDENCIES): New variable.
15357         (weak_alias_test_LDFLAGS): New variable.
15358         (weak_alias_test_LDADD): New variable.
15359         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
15360         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
15361         (weak_alias_test_3.o): New target.
15362         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
15363         * testsuite/weak_alias_test_main.cc: New file.
15364         * testsuite/weak_alias_test_1.cc: New file.
15365         * testsuite/weak_alias_test_2.cc: New file.
15366         * testsuite/weak_alias_test_3.cc: New file.
15367
15368 2008-04-08  Ian Lance Taylor  <iant@google.com>
15369
15370         * options.h (class General_options): Add --noinhibit-exec option.
15371         * main.cc (main): Check --noinhibit-exec.
15372
15373         * options.h (class General_options): Define --wrap as a special
15374         option.  Add wrap_symbols_ field.
15375         (General_options::any_wrap_symbols): New function.
15376         (General_options::is_wrap_symbol): New function.
15377         * options.cc (General_options::parse_wrap): New function.
15378         (General_options::General_options): Initialize wrap_symbols_.
15379         * symtab.cc (Symbol_table::wrap_symbol): New function.
15380         (Symbol_table::add_from_object): Handle --wrap.
15381         * symtab.h (class Symbol_table): Declare wrap_symbol.
15382         * target.h (Target::wrap_char): New function.
15383         (Target::Target_info): Add wrap_char field.
15384         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
15385         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
15386         * testsuite/testfile.cc (Target_test::test_target_info):
15387         Likewise.
15388
15389         * errors.cc (Errors::undefined_symbol): Mention symbol version if
15390         there is one.
15391
15392         * layout.h (class Layout): Add added_eh_frame_data_ field.
15393         * layout.cc (Layout::Layout): Initialize new field.
15394         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
15395         output section until we find a section we merged successfully.
15396         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
15397         that the size be non-zero.
15398
15399         * merge.cc (Object_merge_map::get_output_offset): Remove inline
15400         qualifier.
15401
15402 2008-04-08  Craig Silverstein  <csilvers@google.com>
15403
15404         * configure.ac: Export new conditional variable HAVE_ZLIB.
15405         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
15406         on HAVE_ZLIB.
15407         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
15408         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15409
15410 2008-04-07  Ian Lance Taylor  <iant@google.com>
15411
15412         * version.cc (version_string): Set to "1.5".
15413
15414         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
15415         Add issued_non_pic_error_ field.  Declare check_non_pic.
15416         (Target_x86_64::Scan::check_non_pic): New function.
15417         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
15418         (Target_x86_64::Scan::global): Likewise.
15419
15420         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
15421         addend parameter.  Change caller.  Handle merge sections.
15422         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
15423         Address to Addend.  Don't add in the result of
15424         local_section_offset, pass down the addend and use the returned
15425         value.
15426         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
15427         Update declarations of local_section_offset and symbol_value.
15428         * testsuite/two_file_test_1.cc (t18): New function.
15429         * testsuite/two_file_test_2.cc (f18): New function.
15430         * testsuite/two_file_test_main.cc (main): Call t18.
15431         * testsuite/two_file_test.h (t18, f18): Declare.
15432
15433         * configure.ac: Don't test for objdump, c++filt, or readelf.
15434         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
15435         conditionals.
15436         (TEST_READELF): New variable.
15437         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
15438         (check_PROGRAMS): Add two_file_strip_test.
15439         (two_file_strip_test): New target.
15440         (check_PROGRAMS): Add two_file_same_shared_strip_test.
15441         (two_file_same_shared_strip_test_SOURCES): New variable.
15442         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
15443         (two_file_same_shared_strip_test_LDFLAGS): New variable.
15444         (two_file_same_shared_strip_test_LDADD): New variable.
15445         (two_file_shared_strip.so): New target.
15446         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
15447         (ver_test_5.syms, ver_test_7.syms): Likewise.
15448         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
15449         (strip_test_3.stdout): Use TEST_OBJDUMP.
15450         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15451
15452 2008-04-04  Cary Coutant  <ccoutant@google.com>
15453
15454         * symtab.h (Symbol::is_weak_undefined): New function.
15455         (Symbol::is_strong_undefined): New function.
15456         (Symbol::is_absolute): New function.
15457         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
15458         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
15459         absolute symbols.
15460         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
15461         (weak_undef_test): New target.
15462         * testsuite/Makefile.in: Rebuild.
15463         * testsuite/weak_undef_file1.cc: New file.
15464         * testsuite/weak_undef_file2.cc: New file.
15465         * testsuite/weak_undef_test.cc: New file.
15466
15467 2008-04-03  Craig Silverstein  <csilvers@google.com>
15468
15469         * compressed_output.h (class Output_compressed_section): Use
15470         unsigned buffer.
15471         * compressed_output.cc (zlib_compress): Use unsigned buffers,
15472         add zlib header.
15473         (zlib_compressed_suffix): Removed.
15474         (Output_compressed_section::set_final_data_size): Use unsigned
15475         buffers.
15476         * testsuite/Makefile.am (flagstest_compress_debug_sections):
15477         Fix linker invocation.
15478         (flagstest_o_specialfile_and_compress_debug_sections):
15479         Likewise.
15480         * testsuite/Makefile.in: Regenerated.
15481
15482 2008-04-02  David S. Miller  <davem@davemloft.net>
15483
15484         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
15485         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
15486
15487 2008-04-02  Craig Silverstein  <csilvers@google.com>
15488
15489         * TODO: New file.
15490
15491 2008-04-02  Ian Lance Taylor  <iant@google.com>
15492
15493         * fileread.cc (File_read::find_view): Add byteshift and vshifted
15494         parameters.  Update for new key type to views_.  Change all
15495         callers.
15496         (File_read::read): Adjust for byteshift in returned view.
15497         (File_read::add_view): New function, broken out of
15498         find_and_make_view.
15499         (File_read::make_view): New function, broken out of
15500         find_and_make_view.
15501         (File_read::find_or_make_view): Add offset and aligned
15502         parameters.  Rewrite accordingly.  Change all callers.
15503         (File_read::get_view): Add offset and aligned parameters.  Adjust
15504         for byteshift in return value.
15505         (File_read::get_lasting_view): Likewise.
15506         * fileread.h (class File_read): Update declarations.
15507         (class File_read::View): Add byteshift_ field.  Add byteshift to
15508         constructor.  Add byteshift method.
15509         * archive.h (Archive::clear_uncached_views): New function.
15510         (Archive::get_view): Add aligned parameter.  Change all callers.
15511         * object.h (Object::get_view): Add aligned parameter.  Change all
15512         callers.
15513         (Object::get_lasting_view): Likewise.
15514
15515         * fileread.cc (File_read::release): Don't call clear_views if
15516         there are multiple objects.
15517         * fileread.h (File_read::clear_uncached_views): New function.
15518         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
15519         on the archive.
15520
15521 2008-03-31  Cary Coutant  <ccoutant@google.com>
15522
15523         Add thin archive support.
15524         * archive.cc (Archive::armagt): New const.
15525         (Archive::setup): Remove task parameter and calls to unlock.
15526         (Archive::unlock_nested_archives): New function.
15527         (Archive::read_header): Add nested_off parameter. Change
15528         all callers.
15529         (Archive::interpret_header): Likewise.
15530         (Archive::include_all_members): Change to handle thin
15531         archives.
15532         (Archive::include_member): Likewise.
15533         * archive.h (Archive::Archive): Add new parameters and
15534         initializers.
15535         (Archive::armagt): New const.
15536         (Archive::setup): Remove task parameter.
15537         (Archive::unlock_nested_archives): New function.
15538         (Archive::read_header): Add nested_off parameter.
15539         (Archive::interpret_header): Likewise.
15540         (Archive::Nested_archive_table): New typedef.
15541         (Archive::is_thin_archive_): New field.
15542         (Archive::nested_archives_): New field.
15543         (Archive::options_): New field.
15544         (Archive::dirpath_): New field.
15545         (Archive::task_): New field.
15546         * readsyms.cc (Read_symbols::do_read_symbols): Add check
15547         for thin archives.  Pass additional parameters to
15548         Archive::Archive.  Unlock the archive file after calling
15549         Archive::setup.
15550
15551 2008-03-29  Ian Lance Taylor  <iant@google.com>
15552
15553         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
15554         version symbol to be local.
15555         * testsuite/ver_test_4.sh: New file.
15556         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
15557         (check_DATA): Add ver_test_4.syms.
15558         (ver_test_4.syms): New target.
15559         * testsuite/Makefile.in: Rebuild.
15560
15561         * output.cc
15562         (Output_section::Input_section_sort_entry::has_priority): New
15563         function.
15564         (Output_section::Input_section_sort_entry::match_file_name): New
15565         function.
15566         (Output_section::Input_section_sort_entry::match_section_name):
15567         Remove.
15568         (Output_section::Input_section_sort_entry::match_section_name_prefix):
15569         Remove.
15570         (Output_section::Input_section_sort_entry::match_section_file):
15571         Remove.
15572         (Output_section::Input_section_sort_compare::operator()): Rewrite
15573         using new Input_section_sort_entry functions.  Sort crtbegin and
15574         crtend first.  Sort sections with no priority before sections with
15575         a priority.
15576         * testsuite/initpri1.c (d3): Check j != 4.
15577         (cd5): New constructor/destructor function.
15578         (main): Check j != 2.
15579
15580         * symtab.cc (Symbol_table::add_from_object): If we don't use the
15581         new symbol when resolving, don't call set_is_default.
15582         * testsuite/ver_test_7.cc: New file.
15583         * testsuite/ver_test_7.sh: New file.
15584         * testsuite/Makefile.am (ver_test_7.so): New target.
15585         (ver_test_7.o): New target.
15586         (check_SCRIPTS): Add ver_test_7.sh.
15587         (check_DATA): Add ver_test_7.syms.
15588         (ver_test_7.syms): New target.
15589
15590 2008-03-28  Ian Lance Taylor  <iant@google.com>
15591
15592         * layout.cc (Layout::layout): If we see an input section with a
15593         name that needs sorting, set the must_sort flag for the output
15594         section.
15595         (Layout::make_output_section): If the name of the output section
15596         indicates that it might require sorting, set the may_sort flag.
15597         * output.h (Output_section::may_sort_attached_input_sections): New
15598         function.
15599         (Output_section::set_may_sort_attached_input_sections): New
15600         function.
15601         (Output_section::must_sort_attached_input_sections): New
15602         function.
15603         (Output_section::set_must_sort_attached_input_sections): New
15604         function.
15605         (class Output_section): Declare Input_section_sort_entry.  Define
15606         Input_section_sort_compare.  Declare
15607         sort_attached_input_sections.  Add new fields:
15608         may_sort_attached_input_sections_,
15609         must_sort_attached_input_sections_,
15610         attached_input_sections_are_sorted_.
15611         * output.cc (Output_section::Output_section): Initialize new
15612         fields.
15613         (Output_section::add_input_section): Add an entry to
15614         input_sections_ if may_sort or must_sort are true.
15615         (Output_section::set_final_data_size): Call
15616         sort_attached_input_sections if necessary.
15617         (Output_section::Input_section_sort_entry): Define new class.
15618         (Output_section::Input_section_sort_compare::operator()): New
15619         function.
15620         (Output_section::sort_attached_input_sections): New function.
15621         * configure.ac: Check whether the compiler supports constructor
15622         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
15623         * testsuite/initpri1.c: New file.
15624         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
15625         CONSTRUCTOR_PRIORITY.
15626         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
15627         (initpri1_LDFLAGS): New variable.
15628         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15629
15630 2008-03-27  Ian Lance Taylor  <iant@google.com>
15631
15632         * common.cc (Sort_commons::operator): Correct sorting algorithm.
15633         * testsuite/common_test_1.c: New file.
15634         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
15635         (common_test_1_SOURCES): New variable.
15636         (common_test_1_DEPENDENCIES): New variable.
15637         (common_test_1_LDFLAGS): New variable.
15638
15639         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
15640         and commons_ correctly when NAME/VERSION does not override
15641         NAME/NULL.
15642         * testsuite/ver_test_6.c: New file.
15643         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
15644         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
15645         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
15646
15647 2008-03-26  Ian Lance Taylor  <iant@google.com>
15648
15649         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
15650         of an undefined symbol from a version script.
15651         * testsuite/Makefile.am (ver_test_5.so): New target.
15652         (ver_test_5.o): New target.
15653         (check_SCRIPTS): Add ver_test_5.sh.
15654         (check_DATA): Add ver_test_5.syms.
15655         (ver_test_5.syms): New target.
15656         * testsuite/ver_test_5.cc: New file.
15657         * testsuite/ver_test_5.script: New file.
15658         * testsuite/ver_test_5.sh: New file.
15659         * Makefile.in, testsuite/Makefile.in: Rebuild.
15660
15661         PR gold/5986
15662         Fix problems building gold with gcc 4.3.0.
15663         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
15664         (gold_error_at_location, gold_warning_at_location): Use it.
15665         * configure.ac: Check whether we can compile and use a template
15666         function with a printf attribute.
15667         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
15668         when jumping over bytes.
15669         * object.cc: Instantiate Object::read_section_data.
15670         * debug.h: Include <cstring>
15671         * dwarf_reader.cc: Include <algorithm>
15672         * main.cc: Include <cstring>.
15673         * options.cc: Include <cstring>.
15674         * output.cc: Include <cstring>.
15675         * script.cc: Include <cstring>.
15676         * script.h: Include <string>.
15677         * symtab.cc: Include <cstring> and <algorithm>.
15678         * target-select.cc: Include <cstring>.
15679         * version.cc: Include <string>.
15680         * testsuite/testmain.cc: Include <cstdlib>.
15681         * configure, config.in: Rebuild.
15682
15683 2008-03-25  Ian Lance Taylor  <iant@google.com>
15684
15685         * options.cc: Include "../bfd/bfdver.h".
15686         (options::help): Print bug reporting address.
15687
15688         * version.cc (print_version): Adjust output for current value of
15689         BFD_VERSION_STRING.
15690
15691         * NEWS: New file.
15692
15693         * options.cc (options::help): Print list of supported targets.
15694         * target-select.h: Include <vector>.
15695         (class Target_selector): Make machine_, size_, and is_big_endian_
15696         fields const.  Add bfd_name_ and instantiated_target_ fields.
15697         (Target_selector::Target_selector): Add bfd_name parameter.
15698         (Target_selector::recognize): Make non-virtual, call
15699         do_recognize.
15700         (Target_selector::recognize_by_name): Make non-virtual, call
15701         do_recognize_by_name.
15702         (Target_selector::supported_names): New function.
15703         (Target_selector::bfd_name): New function.
15704         (Target_selector::do_instantiate_target): New pure virtual
15705         function.
15706         (Target_selector::do_recognize): New virtual function.
15707         (Target_selector::do_recognize_by_name): New virtual function.
15708         (Target_selector::instantiate_target): New private function.
15709         (supported_target_names): Declare.
15710         * target-select.cc (Target_selector::Target_selector): Update for
15711         new parameter and fields.
15712         (select_target_by_name): Check that the name matches before
15713         calling recognize_by_name.
15714         (supported_target_names): New function.
15715         * i386.cc (class Target_selector_i386): Update Target_selector
15716         constructor call.  Remove recognize and recognize_by_name.  Add
15717         do_instantiate_target.
15718         * x86_64.cc (class Target_selector_x86_64): Likewise.
15719         * testsuite/testfile.cc (class Target_selector_test): Update for
15720         changes to Target_selector.
15721
15722         * README: Rewrite, with some notes on unsupported features.
15723
15724 2008-03-24  Cary Coutant  <ccoutant@google.com>
15725
15726         * i386.cc (Target_i386::Got_type): New enum declaration.
15727         (Target_i386::Scan::local): Updated callers of Output_data_got
15728         member functions.
15729         (Target_i386::Scan::global): Likewise.
15730         (Target_i386::Relocate::relocate): Likewise.
15731         (Target_i386::Relocate::relocate_tls): Likewise.
15732         * object.h (Got_offset_list): New class.
15733         (Sized_relobj::local_has_got_offset): Added got_type parameter.
15734         (Sized_relobj::local_got_offset): Likewise.
15735         (Sized_relobj::set_local_got_offset): Likewise.
15736         (Sized_relobj::local_has_tls_got_offset): Removed.
15737         (Sized_relobj::local_tls_got_offset): Removed.
15738         (Sized_relobj::set_local_tls_got_offset): Removed.
15739         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
15740         * output.cc (Output_data_got::add_global): Added got_type parameter.
15741         (Output_data_got::add_global_with_rel): Likewise.
15742         (Output_data_got::add_global_with_rela): Likewise.
15743         (Output_data_got::add_global_pair_with_rel): New function.
15744         (Output_data_got::add_global_pair_with_rela): New function.
15745         (Output_data_got::add_local): Added got_type parameter.
15746         (Output_data_got::add_local_with_rel): Likewise.
15747         (Output_data_got::add_local_with_rela): Likewise.
15748         (Output_data_got::add_local_pair_with_rel): New function.
15749         (Output_data_got::add_local_pair_with_rela): New function.
15750         (Output_data_got::add_global_tls): Removed.
15751         (Output_data_got::add_global_tls_with_rel): Removed.
15752         (Output_data_got::add_global_tls_with_rela): Removed.
15753         (Output_data_got::add_local_tls): Removed.
15754         (Output_data_got::add_local_tls_with_rel): Removed.
15755         (Output_data_got::add_local_tls_with_rela): Removed.
15756         * output.h (Output_data_got::add_global): Added got_type parameter.
15757         (Output_data_got::add_global_with_rel): Likewise.
15758         (Output_data_got::add_global_with_rela): Likewise.
15759         (Output_data_got::add_global_pair_with_rel): New function.
15760         (Output_data_got::add_global_pair_with_rela): New function.
15761         (Output_data_got::add_local): Added got_type parameter.
15762         (Output_data_got::add_local_with_rel): Likewise.
15763         (Output_data_got::add_local_with_rela): Likewise.
15764         (Output_data_got::add_local_pair_with_rel): New function.
15765         (Output_data_got::add_local_pair_with_rela): New function.
15766         (Output_data_got::add_global_tls): Removed.
15767         (Output_data_got::add_global_tls_with_rel): Removed.
15768         (Output_data_got::add_global_tls_with_rela): Removed.
15769         (Output_data_got::add_local_tls): Removed.
15770         (Output_data_got::add_local_tls_with_rel): Removed.
15771         (Output_data_got::add_local_tls_with_rela): Removed.
15772         * resolve.cc (Symbol::override_base_with_special): Removed
15773         reference to has_got_offset_ field.
15774         * symtab.cc (Symbol::init_fields): Replaced initialization
15775         of got_offset_ with got_offsets_.  Removed initialization
15776         of has_got_offset_
15777         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
15778         (Symbol::got_offset): Likewise.
15779         (Symbol::set_got_offset): Likewise.
15780         (Symbol::has_tls_got_offset): Removed.
15781         (Symbol::tls_got_offset): Removed.
15782         (Symbol::set_tls_got_offset): Removed.
15783         (Symbol::got_offset_): Removed.
15784         (Symbol::tls_mod_got_offset_): Removed.
15785         (Symbol::tls_pair_got_offset_): Removed.
15786         (Symbol::got_offsets_): New field.
15787         (Symbol::has_got_offset): Removed.
15788         (Symbol::has_tls_mod_got_offset): Removed.
15789         (Symbol::has_tls_pair_got_offset): Removed.
15790         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
15791         (Target_x86_64::Scan::local): Updated callers of Output_data_got
15792         member functions.
15793         (Target_x86_64::Scan::global): Likewise.
15794         (Target_x86_64::Relocate::relocate): Likewise.
15795         (Target_x86_64::Relocate::relocate_tls): Likewise.
15796
15797 2008-03-25  Ben Elliston  <bje@au.ibm.com>
15798
15799         * yyscript.y: Fix spelling error in comment.
15800
15801 2008-03-24  Ian Lance Taylor  <iant@google.com>
15802
15803         * options.h (class General_options): Define build_id option.
15804         * layout.h (class Layout): Declare write_build_id, create_note,
15805         create_build_id.  Add build_id_note_ member.
15806         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
15807         "libiberty.h", "md5.h", "sha1.h".
15808         (Layout::Layout): Initialize eh_frame_data_,
15809         eh_frame_hdr_section_, and build_id_note_.
15810         (Layout::finalize): Call create_build_id.
15811         (Layout::create_note): New function, broken out of
15812         Layout::create_gold_note.
15813         (Layout::create_gold_note): Call create_note.
15814         (Layout::create_build_id): New function.
15815         (Layout::write_build_id): New function.
15816         (Close_task_runner::run): Call write_build_id.
15817
15818         * x86_64.cc: Correct license to GPLv3.
15819
15820 2008-03-23  Ian Lance Taylor  <iant@google.com>
15821
15822         * options.cc: Include "demangle.h".
15823         (parse_optional_string): New function.
15824         (parse_long_option): Handle takes_optional_argument.
15825         (parse_short_option): Update dash_z initializer.  Handle
15826         takes_optional_argument.
15827         (General_options::General_options): Initialize do_demangle_.
15828         (General_options::finalize): Set do_demangle_.  Handle demangling
15829         style.
15830         * options.h (parse_optional_string): Declare.
15831         (struct One_option): Add optional_arg field.  Update constructor.
15832         Update call constructor calls.  Add takes_optional_argument
15833         function.
15834         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
15835         (DEFINE_optional_string): Define.
15836         (General_options::demangle): Change from DEFINE_bool to
15837         DEFINE_optional_string.
15838         (General_options::no_demangle): New function.
15839         (General_options::do_demangle): New function.
15840         (General_options::set_do_demangle): New function.
15841         (General_options::execstack_status_): Move definition to end of
15842         class definition.
15843         (General_options::static_): Likewise.
15844         (General_options::do_demangle_): New field.
15845         * object.cc (big_endian>::get_symbol_location_info): Call
15846         Options::do_demangle, not Options::demangle.
15847         * symtab.cc (demangle): Likewise.
15848
15849 2008-03-22  Ian Lance Taylor  <iant@google.com>
15850
15851         * gold.h: Include <cstddef> and <sys/types.h>
15852         * options.h: Include <cstring>.
15853
15854 2008-03-21  Ian Lance Taylor  <iant@google.com>
15855
15856         * Added source code to GNU binutils.
15857 \f
15858 Copyright (C) 2008-2014 Free Software Foundation, Inc.
15859
15860 Copying and distribution of this file, with or without modification,
15861 are permitted in any medium without royalty provided the copyright
15862 notice and this notice are preserved.
15863
15864 Local Variables:
15865 mode: change-log
15866 left-margin: 8
15867 fill-column: 74
15868 version-control: never
15869 End: