powerpc gold, fix pr17566
[platform/upstream/binutils.git] / gold / ChangeLog
1 2014-12-03  Alan Modra  <amodra@gmail.com>
2
3         PR 17566
4         * powerpc.cc (Target_powerpc::Scan::local): Use add_local_section
5         when adding dynamic relocations against section symbols.
6
7 2014-11-26  Alan Modra  <amodra@gmail.com>
8
9         * powerpc.cc (Stub_control::set_output_and_owner): New function.
10         (Target_powerpc::group_sections): Use it.
11
12 2014-11-25  Cary Coutant  <ccoutant@google.com>
13
14         PR gold/17639
15         * object.cc (Sized_relobj_file): Initialize is_deferred_layout_.
16         (Sized_relobj_file::do_layout): Handle deferred sections properly
17         during GC pass 1. Don't add reloc sections to deferred list twice.
18         * object.h (Sized_relobj_file::is_deferred_layout): New function.
19         (Sized_relobj_file::is_deferred_layout_): New data member.
20
21 2014-11-21  Alan Modra  <amodra@gmail.com>
22
23         * powerpc.cc (Target_powerpc::Relocate::relocate): Correct test
24         for undefined weaks.
25
26 2014-11-20  Alan Modra  <amodra@gmail.com>
27
28         * powerpc.cc (Stub_control::Stub_control): Init stub14_group_size_
29         from --stub-group-size parameter divided by 1024.
30         (Powerpc_relocate_functions::rela, rela_ua): Add fieldsize
31         template parameter.  Update all uses.
32         (Target_powerpc::Relocate::relocate): Rename has_plt_value to
33         has_stub_value.  Set for long branches.  Don't report overflow for
34         branch to undefined weak symbols.  Print info message on
35         overflowing branch to stub.
36
37 2014-11-20  Alan Modra  <amodra@gmail.com>
38
39         * powerpc.cc (Target_powerpc::do_relax): Add __go_go to thread_starters.
40
41 2014-10-28  Alan Modra  <amodra@gmail.com>
42
43         Apply trunk patches
44         2014-10-22  Alan Modra  <amodra@gmail.com>
45         * powerpc.cc (do_relax): Add gcc-4.9 libgomp functions to
46         thread_starter.
47
48 2014-09-30  Cary Coutant  <ccoutant@google.com>
49
50         PR gold/17432
51         * resolve.cc (Symbol_table::resolve): Fix local shadowing error.
52
53 2014-09-30  Kito Cheng  <kito@0xlab.org>
54
55         PR gold/13597
56         * layout.cc (Layout::create_dynamic_symtab): Build gnu-style
57         hash table before sysv-style hash table.
58
59 2014-09-29  Sriraman Tallam  <tmsriram@google.com>
60
61         * options.h (--pic-executable): Add negative to alias to -no-pie.
62
63 2014-09-26  Cary Coutant  <ccoutant@google.com>
64
65         PR gold/16773
66         * object.cc (Sized_relobj_file): Compute value of section symbols
67         for TLS sections the same as TLS symbols.
68
69 2014-09-25  Cary Coutant  <ccoutant@google.com>
70
71         PR gold/17432
72         * resolve.cc (Symbol_table::resolve): Override common placeholder
73         symbols, but adjust sizes.
74         * symtab.cc (Symbol_table::add_from_object): Don't add placeholder
75         symbols to common lists.
76
77 2014-09-24  Alan Modra  <amodra@gmail.com>
78
79         * po/POTFILES.in: Regenerate.
80
81 2014-09-23  Taiju Tsuiki  <tzik@google.com>
82             Cary Coutant  <ccoutant@google.com>
83
84         PR gold/14860
85         * gold.cc (queue_final_tasks): Add Write_sections_task as a blocker
86         on input_sections_blocker.
87         * layout.cc (Write_sections_task::locks): Unblock
88         input_sections_blocker_.
89         * layout.h (Write_sections_task::Write_sections_task): Add
90         input_sections_blocker.
91         * testsuite/Makefile.am (exception_x86_64_bnd_test): Add gcctestdir/ld
92         to DEPENDENCIES.
93         * testsuite/Makefile.in: Regenerate.
94
95 2014-09-18  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
96
97         * testsuite/Makefile.am (plugin_test_10): New test.
98         * testsuite/Makefile.in: Regenerate
99         * testsuite/plugin_common_test_2.c (c1): Align to 8.
100         * testsuite/plugin_test_10.sh: New file.
101
102 2014-09-17  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
103
104         * plugin.cc (Sized_pluginobj::do_add_symbols): Ignore isym->size.
105         * resolve.cc (Symbol_table::resolve): Don't override common symbols
106         during the replacement phase.
107
108 2014-09-17  Han Shen  <shenhan@google.com>
109             Jing Yu  <jingyu@google.com>
110
111         * aarch64-reloc.def: Add TLSGD_ADR_PAGE21, TLSGD_ADD_LO12_NC,
112         TLSDESC_ADR_PAGE21, TLSDESC_LD64_LO12, TLSDESC_ADD_LO12, TLSDESC_CALL.
113         * aarch64.cc (Target_aarch64): Add data members
114         got_irelative_, got_tlsdesc_, rela_irelative_, got_mod_index_offset_,
115         tlsdesc_reloc_info_, tls_base_symbol_defined_. Initialize them in
116         constructor.
117         (Target_aarch64::do_reloc_symbol_index): New method.
118         (Target_aarch64::do_reloc_addend): New method.
119         (Target_aarch64::add_tlsdesc_info): New method.
120         (Target_aarch64::do_dynsym_value): New method.
121         (Target_aarch64::do_make_data_plt): Add new parameters: got,
122         got_irelative. Pass them to Output_data_plt_aarch64_standard.
123         (Target_aarch64::make_data_plt): Add new parameters: got,
124         got_irelative. Pass them to do_make_data_plt.
125         (Target_aarch64::Relocate): Add skip_call_tls_get_addr_ variable.
126         (Target_aarch64::Relocate:tls_gd_to_le): New method.
127         (Target_aarch64::Relocate:tls_ie_to_le): New method.
128         (Target_aarch64::Relocate:tls_desc_gd_to_le): New method.
129         (Target_aarch64::Relocate:tls_desc_gd_to_ie): New method.
130         (Target_aarch64::got_tlsdesc_section): New method.
131         (Target_aarch64::make_local_ifunc_plt_entry): New method.
132         (Target_aarch64::define_tls_base_symbol): New method.
133         (Target_aarch64::reserve_tlsdesc_entries): New method.
134         (Target_aarch64::got_mod_index_entry): New method.
135         (Target_aarch64::rela_tlsdesc_section): New method.
136         (Target_aarch64::rela_irelative_section): New method.
137         (Target_aarch64::Tlsdesc_info): New struct.
138         (Target_aarch64::got_section): Create .got.plt space for IRELATIVE
139         relocations and tlsdesc relocations.
140         (Target_aarch64::optimize_tls_reloc): Implement method.
141         (Output_data_plt_aarch64): Add member variables: tlsdesc_rel_, got_,
142         got_irelative_, irelative_count_, tlsdesc_got_offset_. Initialize them
143         in constructor.
144         (Output_data_plt_aarch64::reserve_tlsdesc_entry): New method.
145         (Output_data_plt_aarch64::has_tlsdesc_entry): New method.
146         (Output_data_plt_aarch64::get_tlsdesc_got_offset): New method.
147         (Output_data_plt_aarch64::get_tlsdesc_plt_offset): New method.
148         (Output_data_plt_aarch64::rela_tlsdesc): New method.
149         (Output_data_plt_aarch64::rela_irelative): New method.
150         (Output_data_plt_aarch64::entry_count): Count IRELATIVE relocations.
151         (Output_data_plt_aarch64::first_plt_entry_offset): Add const attribute.
152         (Output_data_plt_aarch64::get_plt_tlsdesc_entry_size): New method.
153         (Output_data_plt_aarch64::fill_tlsdesc_entry): New method.
154         (Output_data_plt_aarch64::do_get_plt_tlsdesc_entry_size): New method.
155         (Output_data_plt_aarch64::do_fill_tlsdesc_entry): New method.
156         (Output_data_plt_aarch64_standard): New member variables:
157         plt_tlsdesc_entry_size, tlsdesc_plt_entry.
158         (Output_data_plt_aarch64_standard::Output_data_plt_aarch64_standard):
159         New parameter: got, got_irelative.
160         (Output_data_plt_aarch64_standard::do_get_plt_entry_size): New method.
161         (Output_data_plt_aarch64_standard::do_fill_tlsdesc_entry): New method.
162         (Output_data_plt_aarch64::do_write): Replace got_address with
163         gotplt_address. Add irelative_count_ to count. Write tlsdesc entry.
164         (AArch64_relocate_functions::update_movnz): New method.
165         (AArch64_relocate_functions): Correct format.
166         (AArch64_relocate_functions::movnz): New method.
167         (Target_aarch64::Scan::local): Correct format. Move r_sym, got to
168         before the switch. Add new cases to switch.
169         Check ie_to_le relaxation on tlsie relocations. Add code handling
170         tlsgd tlsdesc cases.
171         (Target_aarch64::Scan::global): Move arp to front. Do copy_reloc when
172         needed. Add new cases to switch. Insert dynamic RELATIVE relocation
173         when needed. Add code handling tlsgd, tlsie, tlsdesc cases.
174         Call reloc_name_in_error_message to print unsupported reloc.
175         (Target_aarch64::make_plt_section): Pass got_ and got_irelative_ to
176         make_data_plt.
177         (Target_aarch64::do_finalize_sections): Emit relocs to save COPY
178         relocs. Fill in some more dynamic tags.
179         (Target_aarch64::Relocate::relocate): Handle tlsgd, tlsdesc relocs.
180         Skip call tls_get_addr when tlsgd is relaxed.
181         (Target_aarch64::Relocate::relocate_tls): Correct format. Add code
182         handling tlsgd, tlsdesc relocs, and tls gd->le, ie->le, tlsdesc->le,
183         tlsdesc->ie relaxation.
184
185 2014-09-03  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
186
187         * mips.cc (Target_mips_nacl): New class.
188         (Target_selector_mips_nacl): New class.
189         (target_selector_mips32): Rename from target_selector_mips32be and use
190         Target_selector_mips_nacl instead of Target_selector_mips.
191         (target_selector_mips32el): Rename from target_selector_mips32 and use
192         Target_selector_mips_nacl instead of Target_selector_mips.
193         (target_selector_mips64): Rename from target_selector_mips64be and use
194         Target_selector_mips_nacl instead of Target_selector_mips.
195         (target_selector_mips64el): Rename from target_selector_mips64 and use
196         Target_selector_mips_nacl instead of Target_selector_mips.
197         (Target_mips::mips_info): Add const attribute.
198
199 2014-09-02  Cary Coutant  <ccoutant@google.com>
200
201         * dwp.cc (Sized_relobj_dwo::do_section_name): Add const attribute.
202         * dynobj.h (Sized_dynobj::do_section_name): Likewise.
203         * incremental.cc (Sized_relobj_incr::do_section_name): Likewise.
204         (Sized_incr_dynobj::do_section_name): Likewise.
205         * incremental.h (Sized_relobj_incr::do_section_name): Likewise.
206         (Sized_incr_dynobj::do_section_name): Likewise.
207         * object.h (Object::section_name): Likewise.
208         (Object::do_section_name): Likewise.
209         (Sized_relobj_file::do_section_name): Likewise.
210         * plugin.cc (Sized_pluginobj::do_section_name): Likewise.
211         * plugin.h (Sized_pluginobj::do_section_name): Likewise.
212
213 2014-09-02  Cary Coutant  <ccoutant@google.com>
214
215         PR gold/17005
216         * ehframe.cc (Fde::write): Add output_offset parameter.
217         (Cie::write): Likewise.
218         (Eh_frame::set_final_data_size): Account for offset within output
219         section.
220         (Eh_frame::do_sized_write): Likewise.
221         * ehframe.h (Fde::write): Add output_offset parameter.
222         (Cie::write): Likewise.
223         * output.cc (Output_section::Input_section_sort_entry): Remove
224         section_has_name_; add output_section_name parameter. Use
225         output section name for non-input sections.
226         (Output_section::Input_section_sort_entry::section_has_name): Remove.
227         (Output_section::Input_section_sort_entry::section_has_name_): Remove.
228         (Output_section::Input_section_sort_compare): Remove logic for
229         sections without names.
230         (Output_section::Input_section_sort_init_fini_compare): Likewise.
231         (Output_section::Input_section_sort_section_prefix_special_ordering_compare):
232         Likewise.
233         (Output_section::Input_section_sort_section_name_compare): Likewise.
234
235 2014-08-29 Han Shen <shenhan@google.com>
236            Jing Yu <jingyu@google.com>
237
238         * aarch64-reloc-property.cc
239         (AArch64_reloc_property_table::reloc_name_in_error_message): Fix bug in
240         reference reloc property in the table.
241         * aarch64-reloc.def: Add TLSLE reloc types and fix some errors in
242         3 other entries.
243         * aarch64.cc: (Output_data_got_aarch64::add_static_reloc):
244         2 new overloaded methods.
245         (Output_data_got_aarch64::do_write): Add code to write out
246         static relocs.
247         (class Output_data_got_aarch64::Static_reloc): New class to wrap
248         static relocs.
249         (Output_data_got_aarch64::static_relocs): New vector to
250         hold static relocs.
251         (Target_aarch64::TCB_SIZE): New const static memeber.
252         (Target_aarch64::tcb_size): New method.
253         (Target_aarch64::Relocate::relocate): Add code handling new reloc types.
254         (Target_aarch64::Relocate::relocate_tls): New method.
255         (Target_aarch64::Scan::local): Add code handling new reloc types.
256         (Target_aarch64::Scan::global): Add code handling new reloc types.
257
258 2014-08-13  Sriraman Tallam  <tmsriram@google.com>
259
260         * options.h (-no-pie): Add option.
261
262 2014-08-08  Jing Yu  <jingyu@google.com>
263             Han Shen  <shenhan@google.com>
264
265         * Makefile.am (HFILES): Add aarch64-reloc-property.h.
266         (DEFFILES): add aarch64-reloc.def.
267         (TARGETSOURCES): Add aarch64-reloc-property.cc.
268         (ALL_TARGETOBJS): Add aarch64-reloc-property.$(OBJEXT).
269         * Makefile.in: Regenerate.
270         * aarch64-reloc-property.cc: New file.
271         * aarch64-reloc-property.h: New file.
272         * aarch64-reloc.def: New file.
273         * aarch64.cc: Include aarch64-reloc-property.h. Replace spaces
274         with tab to make the format consistent.
275         (Output_data_got_aarch64::symbol_table_): New method.
276         (Target_aarch64::do_plt_address_for_global): New method.
277         (Target_aarch64::do_plt_address_for_local): New method.
278         (Target_aarch64::do_select_as_default_target): New method.
279         (Target_aarch64::do_make_data_plt): New method.
280         (Target_aarch64::make_data_plt): New method.
281         (Output_data_plt_aarch64::has_irelative_section): New method.
282         (Output_data_plt_aarch64::address_for_global): New method.
283         (Output_data_plt_aarch64::address_for_local): New method.
284         (Output_data_plt_aarch64::irelative_rel_): New parameter.
285         (Output_data_plt_aarch64::add_entry): Implement contents.
286         (Output_data_plt_aarch64::set_final_data_size): Fix typo.
287         (Output_data_plt_aarch64::do_write): Remove useless got_base. Set
288         the got_pov entry to plt0.
289         (Output_data_plt_aarch64_standard::do_fill_first_plt_entry):
290         Implement contents.
291         (Output_data_plt_aarch64_standard::do_fill_plt_entry): Implement.
292         (AArch64_howto): New struct.
293         (aarch64_howto[]): New static const array.
294         (AArch64_relocate_functions): New class.
295         (Target_aarch64::Scan::get_reference_flags): Remove method.
296         (Target_aarch64::Scan::local): Implement to support a few relocations.
297         (Target_aarch64::Scan::global): Implement to support a few relocations.
298         (Target_aarch64::make_plt_section): Implement contents.
299         (Target_aarch64::make_plt_entry): Implement contents.
300         (Target_aarch64::do_finalize_sections): Implement contents.
301         (Target_aarch64::Relocate::relocate): Implement a few relocations.
302         (Target_aarch64::relocate_section): Implement contents.
303
304 2014-08-06  Alan Modra  <amodra@gmail.com>
305
306         * testsuite/defsym_test.sh: Allow ppc64le localentry annotation.
307
308 2014-08-06  Alan Modra  <amodra@gmail.com>
309
310         PR 13227
311         * symtab.cc (Symbol_table::add_from_relobj): Warn on __gnu_lto_slim.
312
313 2014-07-21  Sriraman Tallam  <tmsriram@google.com>
314
315         * object.cc (Relobj::is_section_name_included): Add
316         ".rodata.nptl_version" to not garbage collect this section.
317
318 2014-07-08  Cary Coutant  <ccoutant@google.com>
319
320         * expression.cc (struct Expression::Expression_eval_info): Add
321         new fields type_pointer, vis_pointer, and nonvis_pointer.
322         (Expression::eval_maybe_dot): Add type_pointer, vis_pointer, and
323         nonvis_pointer parameters. Adjust all calls.
324         (Symbol_expression::value): Update type, visibility, and nonvis bits
325         in caller.
326         * script.cc (Symbol_assignment::sized_finalize): Update type,
327         visibility, and remaining st_other bits for new symbol.
328         * script.h: (Expression::eval_maybe_dot): Add type_pointer,
329         vis_pointer, and nonvis_pointer parameters.
330         * symtab.h (Symbol::set_type): New method.
331
332         * testsuite/Makefile.am (defsym_test): New test.
333         * testsuite/Makefile.in: Regenerate.
334         * testsuite/defsym_test.c: New file.
335         * testsuite/defsym_test.sh: New file.
336
337 2014-07-08  Cary Coutant  <ccoutant@google.com>
338
339         PR gold/15639
340         * dynobj.h (Sized_dynobj::base_read_symbols): New method.
341         * dynobj.cc (Sized_dynobj::do_read_symbols): Move body to...
342         (Sized_dynobj::base_read_symbols): ...new method.
343         * object.h (Sized_relobj_file::base_read_symbols): New method.
344         * object.cc (Sized_relobj_file::do_read_symbols): Move body to...
345         (Sized_relobj_file::base_read_symbols): ...new method.
346         * arm.cc (Arm_relobj::do_read_symbols): Call base_read_symbols.
347         * mips.cc: (Mips_relobj::do_read_symbols): Likewise.
348         * powerpc.cc (Powerpc_dynobj::do_read_symbols): Likewise.
349
350 2014-07-04  Alan Modra  <amodra@gmail.com>
351
352         * po/POTFILES.in: Regenerate.
353
354 2014-07-02  Jing Yu  <jingyu@google.com>
355
356         * aarch64.cc: New file
357         * Makefile.am (TARGETSOURCES): Add aarch64.cc
358         (ALL_TARGETOBJS): Add aarch64.$(OBJEXT)
359         * Makefile.in: Regenerate.
360         * configure.tgt: Add entries for aarch64*.
361         * configure.ac:  Likewise.
362         * configure: Likewise.
363
364 2014-06-27  Alan Modra  <amodra@gmail.com>
365
366         * symtab.cc (Symbol::should_add_dynsym_entry): Don't make inline.
367
368 2014-06-24  Cary Coutant  <ccoutant@google.com>
369
370         * dwp.cc (Dwo_file::read): Allow files with no .debug_types
371         sections.
372         (Dwo_file::sized_read_unit_index): Likewise.
373
374 2014-06-23  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
375
376         * mips.cc: New file.
377         * Makefile.am (TARGETSOURCES): Add mips.cc
378         (ALL_TARGETOBJS): Add mips.$(OBJEXT)
379         * configure.tgt: Add entries for mips*.
380         * configure.ac: Likewise.
381         * Makefile.in: Regenerate.
382         * configure: Likewise.
383
384 2014-06-09  Cary Coutant  <ccoutant@google.com>
385
386         * dwarf_reader.cc (Dwarf_pubnames_table::read_header): Check that
387         unit_length is within section bounds.
388
389 2014-06-09  Cary Coutant  <ccoutant@google.com>
390
391         PR gold/16980
392         * layout.cc (Layout::print_to_mapfile): Print unattached sections in
393         map.
394
395 2014-06-07  Alan Modra  <amodra@gmail.com>
396
397         * powerpc.cc (relocate): Treat field of cmpli insn as a bitfield.
398
399 2014-06-06  Cary Coutant  <ccoutant@google.com>
400
401         * dwarf_reader.h (Dwarf_pubnames_table): Remove output_section_offset_.
402         * dwarf_reader.cc (Dwarf_pubnames_table::read_section): Likewise.
403         (Dwarf_pubnames_table::read_header): Likewise.
404         * layout.cc (gdb_fast_lookup_sections): Add .debug_gnu_pubnames and
405         .debug_gnu_pubtypes.
406
407 2014-06-05  Joel Brobecker  <brobecker@adacore.com>
408
409         * Makefile.am (CONFIG_STATUS_DEPENDENCIES): New.
410         * Makefile.in, configure: Regenerate.
411
412 2014-06-03  Alan Modra  <amodra@gmail.com>
413
414         * powerpc.cc (addis_12_2): Define.
415         (Stub_table::do_write): Support fusion on ELFv2 stubs.
416
417 2014-06-03  Alan Modra  <amodra@gmail.com>
418
419         * testsuite/plugin_test.c (parse_readelf_line): Skip non-visibility
420         st_other output.
421
422 2014-06-02  Alan Modra  <amodra@gmail.com>
423
424         * powerpc.cc (Target_powerpc::local_reloc_may_be_function_pointer):
425         Only ignore relocs on ELFv1.
426         (Target_powerpc::global_reloc_may_be_function_pointer): Likewise.
427
428 2014-05-30  Cary Coutant  <ccoutant@google.com>
429
430         * testsuite/Makefile.am (ehdr_start_test_4): Fix typo in -B option.
431         * testsuite/Makefile.in: Regenerate.
432         * testsuite/ehdr_start_test_4.sh: Look for "U" instead of "w".
433
434 2014-05-27  H.J. Lu  <hongjiu.lu@intel.com>
435
436         PR gold/16945
437         * x86_64.cc (Target_x86_64::Relocate::relocate): Use signed int
438         for got_offset.  Properly get GOT address for R_X86_64_PLTOFF64.
439
440 2014-05-15  Alan Modra  <amodra@gmail.com>
441
442         * powerpc.cc (do_plt_fde_location): Handle zero length .glink.
443         Compare FDE contents with DW_CFA_nop rather than 0.
444
445 2014-05-13  Sriraman Tallam  <tmsriram@google.com>
446
447         * symtab.h (may_need_copy_reloc): Remove check for position independent
448         code.
449         * x86_64.cc (Target_x86_64<size>::Scan::global): Add check for no
450         position independence before pc absolute may_need_copy_reloc call.
451         Add check for executable output befor pc relative may_need_copy_reloc
452         call.
453         * i386.cc: Ditto.
454         * arm.cc: Ditto.
455         * sparc.cc: Ditto.
456         * tilegx.cc: Ditto.
457         * powerpc.cc: Add check for no position independence before
458         may_need_copy_reloc calls.
459         * testsuite/pie_copyrelocs_test.cc: New file.
460         * testsuite/pie_copyrelocs_shared_test.cc: New file.
461         * Makefile.am (pie_copyrelocs_test): New test.
462         * Makefile.in: Regenerate.
463
464 2014-05-08  Martin Liška  <mliska@suse.cz>
465
466         * output.cc (Sized_relobj_file::do_layout): Fix typo in info message.
467
468 2014-05-06  Cary Coutant  <ccoutant@google.com>
469
470         PR gold/16900
471         * i386.cc (Output_data_got_plt_i386): New class.
472         (Output_data_plt_i386::Output_data_plt_i386): Change type of got_plt
473         parameter. Change all callers.
474         (Output_data_plt_i386::layout_): Remove.
475         (Output_data_plt_i386::got_plt_): Change type.
476         (Target_i386::got_plt_): Change type. Change all references.
477         (Target_i386::got_section): Create instance of new class.
478         (Output_data_got_plt_i386::do_write): New function.
479         * x86_64.cc (Output_data_got_plt_x86_64): New class.
480         (Output_data_plt_x86_64::Output_data_plt_x86_64): Change type of got_plt
481         parameter. Change all callers.
482         (Output_data_plt_x86_64::layout_): Remove.
483         (Output_data_plt_x86_64::got_plt_): Change type.
484         (Target_x86_64::got_plt_): Change type. Change all references.
485         (Target_x86_64::got_section): Create instance of new class.
486         (Output_data_got_plt_x86_64::do_write): New function.
487         (Output_data_plt_x86_64::do_write): Don't write reserved words in GOT.
488         (Target_x86_64<size>::init_got_plt_for_update): Create instance of new
489         class.
490
491 2014-05-05  Cary Coutant  <ccoutant@google.com>
492
493         * gdb-index.cc (Gdb_index_info_reader): Don't complain about language
494         if we have pubnames/pubtypes.
495
496 2014-05-02  Cary Coutant  <ccoutant@google.com>
497
498         * defstd.cc (in_segment): Define __ehdr_start here...
499         * layout.cc (Layout::finalize): ...Instead of here.  Set the
500         output segment when known.
501         * resolve.cc (Symbol::override_base_with_special): Remember
502         the original binding.
503         * symtab.cc (Symbol::set_output_segment): New function.
504         (Symbol::set_undefined): New function.
505         * symtab.h (Symbol::is_weak_undefined): Check original undef
506         binding.
507         (Symbol::is_strong_undefined): New function.
508         (Symbol::set_output_segment): New function.
509         (Symbol::set_undefined): New function.
510         * target-reloc.h (is_strong_undefined): Remove.
511         (issue_undefined_symbol_error): Call Symbol::is_weak_undefined.
512         Check for hidden undefs.
513         (relocate_section): Call Symbol::is_strong_undefined.
514
515         * testsuite/Makefile.am (ehdr_start_test_1)
516         (ehdr_start_test_2, ehdr_start_test_3)
517         (ehdr_start_test_4, ehdr_start_test_5): New test cases.
518         * testsuite/Makefile.in: Regenerate.
519         * testsuite/ehdr_start_def.cc: New source file.
520         * testsuite/ehdr_start_test.cc: New source file.
521         * testsuite/ehdr_start_test.t: New linker script.
522         * testsuite/ehdr_start_test_4.sh: New shell script.
523
524 2014-04-23  Cary Coutant  <ccoutant@google.com>
525
526         PR gold/16870
527         * x86_64.cc (Target_x86_64::Relocate::relocate): Add missing break.
528
529 2014-04-15  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
530
531         * layout.cc (Layout::include_section): Allow a target to decide
532         whether to include a section.
533         * target.h (Target::should_include_section): New function.
534         (Target::do_should_include_section): New function.
535
536 2014-04-15  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
537
538         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Remove and
539         inline into ...
540         (Copy_relocs::emit): ... here.
541         * copy-relocs.h (Copy_reloc_entry): Change from class to struct.
542         (Copy_reloc_entry::make_copy_reloc): Change from private to protected.
543         (Copy_reloc_entry::entries_): Change from private to protected.
544
545 2014-04-02  Sriraman Tallam  <tmsriram@google.com>
546
547         * icf.cc (get_section_contents): Replace copies of reloc
548         vectors with const references.
549
550 2014-04-02  Cary Coutant  <ccoutant@google.com>
551
552         * configure.ac (HAVE_PUBNAMES): Use C instead of C++.
553         (HAVE_NO_USE_LINKER_PLUGIN): Check for -fno-use-linker-plugin.
554         * configure: Regenerate.
555         * testsuite/Makefile.am (OPT_NO_PLUGINS): New macro for
556         -fno-use-linker-plugin.
557         (LINK1, CXXLINK1): Add it to the link command.
558         * testsuite/Makefile.in: Regenerate.
559
560 2014-03-12  Alan Modra  <amodra@gmail.com>
561
562         * Makefile.in: Regenerate.
563
564 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
565
566         * symtab.h (Symbol::set_nonvis): New function.
567
568 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
569
570         * symtab.cc (Sized_symbol<32>::init_output_data):
571         Instantiate the template.
572         (Sized_symbol<64>::init_output_data): Likewise.
573
574 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
575
576         * symtab.cc (Symbol_table::sized_write_globals): Allow a target to
577         adjust dynamic symbol value.
578         * target.h (Target::adjust_dyn_symbol): New function.
579         (Target::do_adjust_dyn_symbol): New function.
580
581 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
582
583         * output.cc (Output_data_dynamic::Dynamic_entry::write):
584         Get the value of DYNAMIC_CUSTOM dynamic entry.
585         * output.h (Output_data_dynamic::add_custom): New function.
586         (Dynamic_entry::Dynamic_entry): New constructor for DYNAMIC_CUSTOM
587         dynamic entry.
588         (enum Dynamic_entry::Classification): Add DYNAMIC_CUSTOM.
589         * target.h (Target::dynamic_tag_custom_value): New function.
590         (Target::do_dynamic_tag_custom_value): New function.
591
592 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
593
594         * symtab.cc (Symbol_table::set_dynsym_indexes): Allow a target to set
595         dynsym indexes.
596         * target.h (Target::has_custom_set_dynsym_indexes): New function.
597         (Target::do_has_custom_set_dynsym_indexes): New function.
598         (Target::set_dynsym_indexes): New function.
599         (Target::do_set_dynsym_indexes): New function.
600
601 2014-03-07  Alan Modra  <amodra@gmail.com>
602
603         * powerpc.cc (Powerpc_relocate_functions::Overflow_check): Add
604         CHECK_UNSIGNED, CHECK_LOW_INSN, CHECK_HIGH_INSN.
605         (Powerpc_relocate_functions::has_overflow_unsigned): New function.
606         (Powerpc_relocate_functions::has_overflow_bitfield,
607         overflowed): Use the above.
608         (Target_powerpc::Relocate::relocate): Correct overflow checking
609         for a number of relocations.  Modify overflow test for 16-bit
610         fields in instructions to signed/unsigned according to whether
611         the field takes a signed or unsigned value.
612
613 2014-03-05  Alan Modra  <amodra@gmail.com>
614
615         Update copyright years.
616
617 2014-03-05  Alan Modra  <amodra@gmail.com>
618
619         * powerpc.cc (Target_powerpc::Scan::local, global): Support
620         R_PPC64_ADDR64_LOCAL.
621         (Target_powerpc::Relocate::relocate): Likewise.
622
623 2014-03-03  Alan Modra  <amodra@gmail.com>
624
625         * dwp.cc (print_version): Update copyright year to current.
626
627 2014-02-10  Alan Modra  <amodra@gmail.com>
628
629         * po/gold.pot: Regenerate.
630
631 2014-02-06  Cary Coutant  <ccoutant@google.com>
632
633         Fix problem where -u is ignored when a weak undef is seen.
634
635         * archive.cc (Library_base::should_include_member): Reorder
636         code to check for -u option if a weak undef has already been seen.
637         * testsuite/Makefile.am (weak_undef_test_2): New test case.
638         * testsuite/Makefile.in: Regenerate.
639         * testsuite/weak_undef_file3.cc: New file.
640         * testsuite/weak_undef_file4.cc: New file.
641         * testsuite/weak_undef_test_2.cc: New file.
642
643 2014-02-05  Cary Coutant  <ccoutant@google.com>
644
645         Fix issues with gold undefined symbol diagnostics.
646
647         PR binutils/15435
648         * errors.cc (Errors::undefined_symbol): Move undef vtable symbol
649         check to here.
650         * target-reloc.h (is_strong_undefined): New function.
651         (relocate_section): Move undef vtable symbol check from here.
652         Check for is_strong_undefined.
653
654 2014-02-05  Cary Coutant  <ccoutant@google.com>
655
656         Fix problems with the --dynamic-list option.
657
658         PR gold/13577
659         * options.cc (General_options::parse_dynamic_list):
660         Set have_dynamic_list_.
661         (General_options::General_options): Initialize have_dynamic_list_.
662         (General_options::finalize): Turn off -Bsymbolic and
663         -Bsymbolic-functions if --dynamic-list provided.
664         * options.h (General_options::have_dynamic_list): New function.
665         (General_options::have_dynamic_list_): New data member.
666         * symtab.h (Symbol::is_preemptible): Handle --dynamic-list
667         correctly.
668
669         PR gold/16530
670         * symtab.cc (Symbol_table::add_from_relobj): If symbol is named
671         in --dynamic-list, mark it.
672
673         * testsuite/Makefile.am (gc_dynamic_list_test.sh): New test case.
674         (dynamic_list_2): New test case.
675         * testsuite/Makefile.in: Regenerate.
676         * testsuite/dynamic_list_2.cc: New file.
677         * testsuite/dynamic_list_2.t: New file.
678         * testsuite/dynamic_list_lib1.cc: New file.
679         * testsuite/dynamic_list_lib2.cc: New file.
680         * testsuite/gc_dynamic_list_test.c: New file.
681         * testsuite/gc_dynamic_list_test.sh: New file.
682         * testsuite/gc_dynamic_list_test.t: New file.
683
684 2014-01-28  Cary Coutant  <ccoutant@google.com>
685
686         Add .gdb_index version 7 support.
687
688         * gold/dwarf_reader.cc: include <utility> (for make_pair).
689         (Dwarf_abbrev_table::do_read_abbrevs): Check for compressed
690         debug sections.
691         (Dwarf_ranges_table::read_ranges_table): Likewise.
692         (Dwarf_pubnames_table::read_section): Check for GNU-style
693         sections, and for compressed debug sections.
694         (Dwarf_pubnames_table::read_header): Compute end address of table.
695         (Dwarf_pubnames_table::next_name): Return flag_byte.  Check
696         for end of list by offset, not by offset == 0.
697         (Dwarf_info_reader::do_read_string_table): Check for compressed
698         debug sections.
699         * gold/dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
700         Initialize new data members.
701         (Dwarf_pubnames_table::next_name): return flag_byte.
702         (Dwarf_pubnames_table::end_of_table_): New data member.
703         (Dwarf_pubnames_table::is_gnu_style_): New data member.
704         * gold/gdb-index.cc (gdb_index_version): Update to version 7.
705         (Gdb_index_info_reader::read_pubtable): Read flag_byte.
706         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Don't
707         read skeleton type unit DIEs.
708         (Gdb_index::add_symbol): Add flag_byte; adjust all callers.
709         (Gdb_index::do_write): Write flag_byte.
710         * gold/gdb-index.h (Gdb_index::add_symbol): Add flags parameter.
711         (Gdb_index::Cu_vector): Store flags along with cu indexes.
712         * gold/testsuite/gdb_index_test_3.sh: Allow versions 4-7.
713         * gold/testsuite/gdb_index_test_comm.sh: Likewise.
714
715 2014-01-08  H.J. Lu  <hongjiu.lu@intel.com>
716
717         * version.cc (print_version): Update copyright year to 2014.
718
719 2013-12-19  Dimitry Andric  <dimitry@andric.com>
720
721         * stringpool.cc (Stringpool_template::reserve): Add
722         HAVE_UNORDERED_MAP case.
723         * stringpool.cc (Stringpool_template::print_stats): Likewise.
724
725 2013-12-18  Cary Coutant  <ccoutant@google.com>
726
727         * configure.ac: Check for <unordered_set> and <unordered_map>.
728         * config.in: Regenerate.
729         * configure: Regenerate.
730         * system.h: Use <unordered_set> and <unordered_map> if available.
731
732 2013-12-10  Roland McGrath  <mcgrathr@google.com>
733
734         * Makefile.am (install-exec-local): Prefix $(INSTALL_PROGRAM) uses
735         with $(INSTALL_PROGRAM_ENV).
736         * Makefile.in: Regenerate.
737
738 2013-11-22  Cary Coutant  <ccoutant@google.com>
739
740         * configure.ac: Add check for which library is needed for
741         dlopen.
742         * configure: Regenerate.
743
744 2013-11-22  Cary Coutant  <ccoutant@google.com>
745
746         * testsuite/Makefile.am (exception_x86_64_bnd_test): Use in-tree
747         assembler.
748         * testsuite/Makefile.in: Regenerate.
749
750 2013-11-17  H.J. Lu  <hongjiu.lu@intel.com>
751
752         * x86_64.cc (Target_x86_64<size>::Scan::get_reference_flags):
753         Handle R_X86_64_PC32_BND and R_X86_64_PLT32_BND just like
754         R_X86_64_PC32 and R_X86_64_PLT32, respectively.
755         (Target_x86_64<size>::Scan::local): Likewise.
756         (Target_x86_64<size>::Scan::global): Likewise.
757         (Target_x86_64<size>::Relocate::relocate): Likewise.
758         (Target_x86_64<size>::Relocatable_size_for_reloc::get_size_for_reloc):
759         Likewise.
760         (Target_x86_64<size>::Scan::check_non_pic(): Handle
761         R_X86_64_PC32_BND.
762
763         * testsuite/Makefile.am (check_PROGRAMS): Add
764         exception_x86_64_bnd_test.
765         (exception_x86_64_bnd_test_SOURCES): New macro.
766         (exception_x86_64_bnd_test_DEPENDENCIES): Likewise.
767         (exception_x86_64_bnd_test_LDFLAGS): Likewise.
768         (exception_x86_64_bnd_test_LDADD): Likewise.
769         (exception_x86_64_bnd_1.o): New rule.
770         (exception_x86_64_bnd_2.o): Likewise.
771         * testsuite/Makefile.in: Regenerated.
772
773 2013-11-15  Alan Modra  <amodra@gmail.com>
774
775         * powerpc.cc (Target_powerpc::glink_section): Provide non-const
776         accessor.
777         (Target_powerpc::Branch_info::make_stub): Make global entry stubs.
778         Only call ppc64_local_entry_offset for 64-bit.  Restrict
779         symval_for_branch lookup to ELFv1.
780         (Stub_table::add_plt_call_entry): Use unsigned int off.
781         (Output_data_glink::Address, invalid_address): New.
782         (Output_data_glink::add_eh_frame): Move out of line.  Add
783         support for ELFv2.
784         (Output_data_glink::add_global_entry, find_global_entry,
785         global_entry_address): New functions.
786         (Output_data_glink::global_entry_stubs_, end_branch_table_,
787         ge_size): New variables.
788         (Output_data_glink::set_final_data_size): Add global entry
789         stub sizing.
790         (Output_data_glink::do_write): Write global entry stubs.
791         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Add target
792         parameter.  Return true for ELFv2.  Adjust callers.
793         (Target_powerpc::Scan::local, global): Restrict opd lookup to
794         ELFv1.  Similarly for ifunc and dynamic relocation processing
795         specific to ELFv1.  Recognize that symbols are defined on
796         their plt entries for ELFv2.
797         (Target_powerpc::symval_for_branch): Assert if called for
798         ELFv2 or ppc32.
799         (Target_powerpc::Relocate::relocate): Use global entry plt
800         stub for symbol value if such exists on ELFv2.
801         (Target_powerpc::Relocate::relocate): Don't call
802         symval_for_branch when ELFv2.  Do adjust for local entry
803         offset when ELFv2.
804         (Target_powerpc::do_dynsym_value): Set symbols to global entry
805         plt stub for ELFv2.
806         (Target_powerpc::do_plt_address_for_global): Similarly.
807
808 2013-11-14  Cary Coutant  <ccoutant@google.com>
809
810         Revert patch -- this did not fix the problem, and there is
811         no race there.
812
813         2013-11-14  Cary Coutant  <ccoutant@google.com>
814
815             PR gold/14860
816             * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
817             (Ehframe_hdr::set_final_data_size): Allocate a Lock.
818             * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
819             updating fde_offsets_.
820             (Eh_frame_hdr::lock_): New data member.
821
822 2013-11-14  Cary Coutant  <ccoutant@google.com>
823
824         * dwp.cc (Dwo_file_entry): New type.
825         (File_list): Use Dwo_file_entry.
826         (Dwo_file::verify): New function.
827         (Dwo_file::verify_dwo_list): New function.
828         (Dwo_file::sized_verify_dwo_list): New function.
829         (Dwo_name_info_reader::visit_compilation_unit): Add dwo_id to file
830         list.
831         (Dwp_options): New enum type.
832         (dwp_options): Add --verify-only.
833         (usage): Likewise.
834         (main): Likewise.
835         * dwp.h (gold_info): Add declaration.
836
837 2013-11-14  Cary Coutant  <ccoutant@google.com>
838
839         PR gold/14860
840         * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
841         (Ehframe_hdr::set_final_data_size): Allocate a Lock.
842         * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
843         updating fde_offsets_.
844         (Eh_frame_hdr::lock_): New data member.
845
846 2013-11-06  Cary Coutant  <ccoutant@google.com>
847
848         PR gold/15758
849         * object.cc (Sized_relobj_file::do_layout): Handle .eh_frame sections
850         before reloc sections.
851
852 2013-11-04  Alan Modra  <amodra@gmail.com>
853
854         * symtab.h (Symbol::Reference_flags): Add FUNC_DESC_ABI.
855         (Symbol::needs_dynamic_reloc): Test new flag.
856         * powerpc.cc (needs_dynamic_reloc, use_plt_offset): Delete.
857         (Target_powerpc::Scan::get_reference_flags): Add target param.
858         Return FUNC_DESC_ABI for 64-bit ELFv1.
859         (Target_powerpc::Branch_info::make_stub): Adjust get_reference_flags
860         call.
861         (Target_powerpc::Scan::global): Use Symbol::needs_dynamic_reloc.
862         (Target_powerpc::Relocate::relocate): Use Symbol::use_plt_offset.
863
864 2013-10-31  Cary Coutant  <ccoutant@google.com>
865
866         Restore support for dwp v2 DWARF package file format.
867
868         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
869         tu_length parameter.  Adjust all callers.
870         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
871         * dwp.cc: Include dwarf.h.
872         (Section_bounds): New struct type.
873         (Unit_set): New struct type.
874         (Dwo_file::Dwo_file): Initialize new data member.
875         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
876         Combine and rename to...
877         (Dwo_file::read_unit_index): ...this.
878         (Dwo_file::sized_read_compunit_index)
879         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
880         (Dwo_file::sized_read_unit_index): ...this.
881         (Dwo_file::copy_section): Remove section_name, is_str_offsets
882         parameters; add section_id parameter.
883         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
884         (Dwo_file::add_unit_set): ...this.
885         (Dwo_file::shndx_map_): Remove.
886         (Dwo_file::sect_offsets_): New data member.
887         (Dwp_output_file::Dwp_output_file): Initialize new data members.
888         (Dwp_output_file::add_section): Rename to...
889         (Dwp_output_file::add_contribution): ...this.
890         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
891         (Dwp_output_file::add_tu_set): Likewise.
892         (Dwp_output_file::Contribution): New type.
893         (Dwp_output_file::Section::contributions): New data member.
894         (Dwp_output_file::Cu_or_tu_set): Remove.
895         (Dwp_output_file::Section::Section): New ctor.
896         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
897         (Dwp_output_file::Dwp_index::Section_table): New type.
898         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
899         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
900         parameter.
901         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
902         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
903         (Dwp_output_file::Dwp_index::section_table): New member function.
904         (Dwp_output_file::Dwp_index::section_table_end): New member function.
905         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
906         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
907         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
908         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
909         (Dwp_output_file::Dwp_index::section_table_): New data member.
910         (Dwp_output_file::Dwp_index::section_mask_): New data member.
911         (Dwp_output_file::add_output_section): New member function.
912         (Dwp_output_file::write_new_section): New member function.
913         (Dwp_output_file::write_contributions): New member function.
914         (Dwp_output_file::section_id_map_): New data member.
915         (class Dwo_id_info_reader): Remove.
916         (class Unit_reader): New class.
917         (get_dwarf_section_name): New function.
918         (Dwo_file::read_executable): Adjust initializations of class data.
919         (Dwo_file::read): Add support for v2 package file format.
920         (Dwo_file::read_unit_index): Likewise.
921         (Dwo_file::sized_read_unit_index): Likewise.
922         (Dwo_file::copy_section): Likewise.
923         (Dwo_file::add_unit_set): Likewise.
924         (Dwp_output_file::add_output_section): Likewise.
925         (Dwp_output_file::add_contribution): Likewise.
926         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
927         for empty slot.
928         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
929         file format.
930         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
931         slot.
932         (Dwp_output_file::initialize): Remove unused function.
933         (Dwp_output_file::finalize): Add support for v2 package file format.
934         (Dwp_output_file::write_index): Likewise.
935         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
936         function prototype.
937
938 2013-10-31  Cary Coutant  <ccoutant@google.com>
939
940         * configure.ac: Fix check for -fmerge-constants.
941         * configure.ac: Regenerate.
942
943 2013-10-30  Roland McGrath  <mcgrathr@google.com>
944
945         * x86_64.cc (Output_data_plt_x86_64_nacl::first_plt_entry):
946         Correct 9-byte nop sequence to match what the assembler generates.
947
948 2013-10-30  Alan Modra  <amodra@gmail.com>
949
950         * powerpc.cc (Powerpc_relobj::abiversion, set_abiversion,
951         ppc64_local_entry_offset, ppc64_local_entry_offset,
952         do_read_symbols): New functions.
953         (Powerpc_relobj::e_flags_, st_other_): New vars.
954         (Powerpc_relobj::Powerpc_relobj): Call set_abiversion.
955         (Powerpc_dynobj::abiversion, set_abiversion): New functions.
956         (Powerpc_relobj::e_flags_): New var.
957         (Target_powerpc::first_plt_entry_offset, plt_entry_size): Inline
958         and adjust for ELFv2.
959         (Target_powerpc::abiversion, set_abiversion, stk_toc): New functions.
960         (Powerpc_relobj::do_find_special_sections): Check no .opd in ELFv2.
961         (Powerpc_dynobj::do_find_special_sections): Likewise.
962         (Target_powerpc::do_define_standard_symbols): Define ".TOC.".
963         (Target_powerpc::Branch_info::make_stub): Adjust stub destination
964         to ELFv2 local entry.
965         (Target_powerpc::do_relax): No thread safe barriers needed for
966         ELFv2.
967         (Output_data_plt_powerpc::initial_plt_entry_size_,
968         plt_entry_size): Delete.  Replace all uses with
969         first_plt_entry_offset() and plt_entry_size().
970         (Output_data_plt_powerpc::Output_data_plt_powerpc): Remove
971         reserved_size parm.  Update callers.
972         (Output_data_plt_powerpc::entry_count): Update.
973         (Output_data_plt_powerpc::first_plt_entry_offset): Make private
974         and use Target_powerpc::first_plt_entry_offset().
975         (Output_data_plt_powerpc::get_plt_entry_size): Similarly and
976         rename to plt_entry_size.
977         (Output_data_plt_powerpc::add_ifunc_entry,
978         add_local_ifunc_entry): Adjust reloc for ELFv2.
979         (glink_eh_frame_fde_64): Rename to glink_eh_frame_fde_64v1.
980         (glink_eh_frame_fde_64v2): New.
981         (Stub_table::plt_call_size): Support ELFv2 sizing.
982         (Output_data_glink::add_eh_frame): Use the new FDE.
983         (Output_data_glink::set_final_data_size): Adjust for ELFv2 glink.
984         (Stub_table::do_write): Write ELFv2 stubs and glink.
985         (Target_powerpc::Relocate::relocate): Replaces nop after call
986         with ld 2,24(1) and adjust local offset destination for ELFv2.
987
988 2013-10-30  Alan Modra  <amodra@gmail.com>
989
990         * powerpc.cc (Target_powerpc::Scan::check_non_pic): Handle new relocs.
991         (Target_powerpc::Scan::global, local): Likewise.
992         (Target_powerpc::Relocate::relocate): Likewise.  Check for overflow
993         on all ppc64 @h and @ha relocs.
994
995 2013-10-14  Alan Modra  <amodra@gmail.com>
996
997         * output.h (Output_data_got::add_constant): Tidy.
998         (Output_data_got::add_constant_pair): New function.
999         * powerpc.cc (Output_data_got_powerpc): Override all Output_data_got
1000         methods used so as to first call reserve_ent().
1001
1002 2013-10-11  Roland McGrath  <mcgrathr@google.com>
1003
1004         * powerpc.cc (Output_data_got_powerpc): Remove unused methods
1005         add_got_entry and add_got_entry_pair.
1006
1007         * configure.ac (TLS_GNU2_DIALECT): Use -Werror in test.
1008         (HAVE_PUBNAMES): Likewise.
1009         * configure: Regenerate.
1010
1011         * testsuite/Makefile.am: Replace '-T foo' with '-Wl,-T,foo' throughout.
1012         * testsuite/Makefile.in: Regenerate.
1013
1014         * target.h (Target::adjust_elf_header, Target::do_adjust_elf_header):
1015         Remove const from declaration.
1016         * target.cc (Sized_target::do_adjust_elf_header): Update definition.
1017         * sparc.cc (Target_sparc::do_adjust_elf_header): Likewise.
1018         * output.h (Output_file_header): Remove const from member target_
1019         and corresponding constructor argument.
1020         * output.cc (Output_file_header::Output_file_header): Update prototype.
1021         (Output_file_header::do_sized_write): Use this->target_ in place
1022         of parameters()->target().
1023
1024         * testsuite/undef_symbol.cc (Foo::get_a): New method.
1025
1026         * configure.ac (MERGE_CONSTANTS_FLAG): New check.
1027         * configure: Regenerate.
1028         * Makefile.in: Regenerate.
1029         * testsuite/merge_string_literals_1.c: Renamed to have .cc suffix.
1030         * testsuite/merge_string_literals_2.c: Likewise.
1031         * testsuite/Makefile.am
1032         (merge_string_literals_1.o, merge_string_literals_2.o): Update deps.
1033         (AM_CFLAGS, AM_CXXFLAGS): Use $(MERGE_CONSTANTS_FLAG) in place of
1034         literal -fmerge-constants.
1035         * testsuite/Makefile.in: Regenerate.
1036
1037         * i386.cc (Target_i386): Remove unused member dynbss_.
1038         * arm.cc (Target_arm): Likewise.
1039         * powerpc.cc (Target_powerpc): Likewise.
1040         * sparc.cc (Target_sparc): Likewise.
1041         * tilegx.cc (Target_tilegx): Likewise.
1042         * x86_64.cc (Target_x86_64): Likewise.
1043         * dwarf_reader.h (Dwarf_info_reader): Remove unused members
1044         type_signature_, type_offset_.
1045         * plugin.h (Plugin_hook): Remove unused member layout_.
1046         * readsyms.h (Add_symbols): Remove unused members dirpath_, dirindex_,
1047         mapfile_.
1048         (Read_member): Remove unused members input_objects_, symtab_,
1049         mapfile_, layout_.
1050         (Check_library): Remove unused member symtab_.
1051         * archive.h (Lib_group): Remove unused member lib_.
1052         * archive.cc (Lib_group::Lib_group): Update initializer.
1053         * incremental.h (Incremental_binary): Remove unused member target_.
1054         (Incremental_script_entry): Removed unused member script_.
1055         * layout.h (Write_symbols_task): Remove unused member input_objects_.
1056         * icf.h (Icf): Remove unused member num_tracked_relocs.
1057
1058         * gold-threads.h (Once): Conditionalize member was_run_lock_ on
1059         [ENABLE_THREADS && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4], matching
1060         its only use.
1061         * gold-threads.cc (Once::Once): Likewise conditionalize initializer.
1062
1063         * archive.h: Use struct rather than class for forward declaration
1064         of Read_symbols_data.
1065
1066 2013-10-07  Cary Coutant  <ccoutant@google.com>
1067
1068         PR gold/16010
1069         * testsuite/Makefile.am (icf_test): Fix dependencies.
1070         (icf_safe_test): Likewise.
1071         (icf_safe_so_test): Likewise.
1072         (large_symbol_alignment): Add empty _LDADD rule.
1073         * testsuite/Makefile.in: Regenerate.
1074
1075 2013-09-03  Pavel Chupin  <pavel.v.chupin@intel.com>
1076
1077         PR gold/15927
1078         * x86_64.cc (Target_x86_64<size>::Scan::global): Use relative
1079         relocation for R_X86_64_32 on x32.
1080
1081 2013-08-27  Roland McGrath  <mcgrathr@google.com>
1082
1083         * output.cc (Output_segment::set_section_addresses): Take new
1084         Target* argument.  If target->isolate_execinstr() and the segment
1085         is executable and starts at a target->abi_pagesize() boundary,
1086         pad its end out to a target->abi_pagesize() boundary with code fill.
1087         * output.h (Output_segment::set_section_addresses): Update decl.
1088         * layout.h (Layout::check_output_data_for_reset_values): Take new
1089         argument RELAX_OUTPUTS.
1090         (Layout): New member relax_output_list_.
1091         (Layout::add_relax_output): New method.
1092         * layout.cc (Layout::Layout): Update constructor.
1093         (Layout::reset_relax_output): New method.
1094         (Layout::clean_up_after_relaxation): Call it.
1095         (Layout::prepare_for_relaxation): Update caller.
1096         (Layout::set_segment_offsets): Update callers of set_section_addresses.
1097         Call reset_relax_output before re-processing segments for
1098         isolate_execinstr case.
1099         (Layout::write_data): Handle relax_output_list_.
1100         (Layout::Relaxation_debug_check::check_output_data_for_reset_values):
1101         Take new argument RELAX_OUTPUTS.  Assert it's an empty collection.
1102
1103 2013-08-23  Yuri Chornoivan  <yurchor@ukr.net>
1104
1105         PR binutils/15834
1106         * object.h: Fix typos.
1107
1108 2013-08-16  Roland McGrath  <mcgrathr@google.com>
1109
1110         * i386.cc (Target_i386_nacl::do_code_fill): New virtual function.
1111         * x86_64.cc (Target_x86_64_nacl::do_code_fill): New virtual function.
1112
1113 2013-08-07  Cary Coutant  <ccoutant@google.com>
1114
1115         Revert support for v2 DWP files:
1116
1117         2013-03-01  Cary Coutant  <ccoutant@google.com>
1118
1119             Add dwp support for v2 DWARF package file format.
1120             * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
1121             tu_length parameter.  Adjust all callers.
1122             * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
1123             * dwp.cc: Include dwarf.h.
1124             (Section_bounds): New struct type.
1125             (Unit_set): New struct type.
1126             (Dwo_file::Dwo_file): Initialize new data member.
1127             (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
1128             Combine and rename to...
1129             (Dwo_file::read_unit_index): ...this.
1130             (Dwo_file::sized_read_compunit_index)
1131             (Dwo_file::sized_read_typeunit_index): Combine and rename to...
1132             (Dwo_file::sized_read_unit_index): ...this.
1133             (Dwo_file::copy_section): Remove section_name, is_str_offsets
1134             parameters; add section_id parameter.
1135             (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
1136             (Dwo_file::add_unit_set): ...this.
1137             (Dwo_file::shndx_map_): Remove.
1138             (Dwo_file::sect_offsets_): New data member.
1139             (Dwp_output_file::Dwp_output_file): Initialize new data members.
1140             (Dwp_output_file::add_section): Rename to...
1141             (Dwp_output_file::add_contribution): ...this.
1142             (Dwp_output_file::add_cu_set): Combine parameters into a struct.
1143             (Dwp_output_file::add_tu_set): Likewise.
1144             (Dwp_output_file::Contribution): New type.
1145             (Dwp_output_file::Section::contributions): New data member.
1146             (Dwp_output_file::Cu_or_tu_set): Remove.
1147             (Dwp_output_file::Section::Section): New ctor.
1148             (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
1149             (Dwp_output_file::Dwp_index::Section_table): New type.
1150             (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
1151             (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
1152             parameter.
1153             (Dwp_output_file::Dwp_index::shndx_pool): Remove.
1154             (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
1155             (Dwp_output_file::Dwp_index::section_table): New member function.
1156             (Dwp_output_file::Dwp_index::section_table_end): New member function.
1157             (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
1158             (Dwp_output_file::Dwp_index::section_table_rows): New member function.
1159             (Dwp_output_file::Dwp_index::section_table_cols): New member function.
1160             (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
1161             (Dwp_output_file::Dwp_index::section_table_): New data member.
1162             (Dwp_output_file::Dwp_index::section_mask_): New data member.
1163             (Dwp_output_file::add_output_section): New member function.
1164             (Dwp_output_file::write_new_section): New member function.
1165             (Dwp_output_file::write_contributions): New member function.
1166             (Dwp_output_file::section_id_map_): New data member.
1167             (class Dwo_id_info_reader): Remove.
1168             (class Unit_reader): New class.
1169             (get_dwarf_section_name): New function.
1170             (Dwo_file::read_executable): Adjust initializations of class data.
1171             (Dwo_file::read): Add support for v2 package file format.
1172             (Dwo_file::read_unit_index): Likewise.
1173             (Dwo_file::sized_read_unit_index): Likewise.
1174             (Dwo_file::copy_section): Likewise.
1175             (Dwo_file::add_unit_set): Likewise.
1176             (Dwp_output_file::add_output_section): Likewise.
1177             (Dwp_output_file::add_contribution): Likewise.
1178             (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
1179             for empty slot.
1180             (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
1181             file format.
1182             (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
1183             slot.
1184             (Dwp_output_file::initialize): Remove unused function.
1185             (Dwp_output_file::finalize): Add support for v2 package file format.
1186             (Dwp_output_file::write_index): Likewise.
1187             * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
1188             function prototype.
1189
1190 2013-07-31  Cary Coutant  <ccoutant@google.com>
1191
1192         * object.cc (Sized_relobj::do_output_section_address): New function.
1193         (Sized_relobj): Instantiate explicitly.
1194         * object.h (Object::output_section_address): New function.
1195         (Object::do_output_section_address): New function.
1196         (Sized_relobj::do_output_section_address): New function.
1197         * powerpc.cc (Target_powerpc::symval_for_branch): Use it.
1198
1199 2013-07-30  Cary Coutant  <ccoutant@google.com>
1200             Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1201
1202         * parameters.cc (Parameters::entry): Return target-specific entry
1203         symbol name.
1204         * target.h (Target::entry_symbol_name): New function.
1205         (Target_info::entry_symbol_name): New data member.
1206
1207         * arm.cc (Target_arm::arm_info): Add entry_symbol_name.
1208         * i386.cc (Target_i386::i386_info): Likewise.
1209         (Target_i386_nacl::i386_nacl_info): Likewise.
1210         * sparc.cc (Target_sparc::sparc_info): Likewise.
1211         * tilegx.cc (Target_tilegx::tilegx_info): Likewise.
1212         * x86_64.cc: (Target_x86_64::x86_64_info) Likewise.
1213         (Target_x86_64_nacl::x86_64_nacl_info) Likewise.
1214         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
1215
1216 2013-07-22  Sterling Augustine  <saugustine@google.com>
1217
1218         * dwarf_reader.cc (Dwarf_pubnames_table::read_section):
1219         Convert parameter shndx to local variable. Add parameters symtab
1220         and symtab_size.  Scan over section names.  Find relocation
1221         section corresponding to current section.  Create and initialize
1222         reloc_mapper_ and reloc_type_.
1223         (Dwarf_pubnames_table::read_header):  Add assertion.  Change
1224         unit_length to off_t.  Initialize member unit_length_.  Fill in field
1225         cu_offset_.
1226         * dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
1227         Initialize new fields unit_length_ and cu_offset_.
1228         (Dwarf_pubnames_table::read_section): Update prototype.
1229         (Dwarf_pubnames_table::cu_offset): New member function.
1230         (Dwarf_pubnames_table::subsection_size): Likewise.
1231         (Dwarf_pubnames_table::cu_offset_, Dwarf_pubnames_table::unit_length):
1232         New fields.
1233         (Dwarf_info_reader::symtab, Dwarf_info_reader::symtab_size): Make
1234         member functions public.
1235         * gdb_index.cc (Gdb_index_info_reader::read_pubnames_and_pubtypes):
1236         Update comment.  Rework logic.  Move repeated parts to...
1237         (Gdb_index_info_reader::read_pubtable): ...here. New function.
1238         (Gdb_index::Gdb_index): Initialize new fields, pubnames_table_,
1239         pubtypes_table_, and stmt_list_offset.
1240         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
1241         Gdb_index::find_pubtype_offset,
1242         Gdb_index::map_pubnames_and_types_to_dies): Define new functions.
1243         (Gdb_index::pubnames_read): Update prototype and rework logic.
1244         * gdb_index.h (Gdb_index_info_reader, Dwarf_pubnames_table):
1245         Forward declare.
1246         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
1247         Gdb_index::find_pubtype_offset, Gdb_index::pubnames_table)
1248         Gdb_index::pubtypes_table, Gdb_index::map_pubnames_and_types_to_dies,
1249         Gdb_index::map_pubtable_to_dies):
1250         Declare functions.
1251         (Gdb_index::pubnames_read): Update declaration.
1252         (Gdb_index::Pubname_offset_map): New type.
1253         (Gdb_index::cu_pubname_map_, Gdb_index::cu_pubtype_map_,
1254         Gdb_index::pubnames_table_, Gdb_index::pubtypes_table_,
1255         Gdb_index::stmt_list_offset): Declare.
1256         (Gdb_index::pubnames_shndx_, Gdb_index::pubnames_offet_,
1257         Gdb_index::pubtypes_object_, Gdb_index::pubtypes_shndx_)
1258         Gdb_index::pubtypes_offset_): Remove.
1259
1260 2013-07-19  Roland McGrath  <mcgrathr@google.com>
1261
1262         * options.h (General_options): Add -Trodata-segment option.
1263         * parameters.cc (Parameters::check_rodata_segment): New function.
1264         (Parameters::set_target_once): Call it.
1265         * parameters.h (Parameters): Declare it (private member function).
1266         * layout.cc (load_seg_unusable_for_headers): New function, broken
1267         out of Layout::relaxation_loop_body.  If TARGET->isolate_execinstr()
1268         then validate rodata segment rather than text segment.
1269         (relaxation_loop_body): Call that.
1270         (is_text_segment): New function.  Don't admit a non-executable
1271         segment if TARGET->isolate_execinstr().
1272         (set_segment_offsets): Call it.  Honor -Trodata-segment option.
1273
1274 2013-07-15  Shawn Landden  <shawnlandden@gmail.com>
1275
1276         PR gold/15070
1277         * fileread.h (File_read::get_view): Clarify comment about ALIGNED.
1278         * nacl.h (Sniff_file::View::View): Request aligned view.
1279
1280 2013-07-11  Cary Coutant  <ccoutant@google.com>
1281
1282         * powerpc.cc (Target_powerpc::write_branch_lookup_table): Use
1283         correct BRLT entry size.
1284
1285 2013-07-03  Alan Modra  <amodra@gmail.com>
1286
1287         * powerpc.cc (Target_powerpc::Relocate::relocate): Update self-call
1288         comment.
1289
1290 2013-07-01  Cary Coutant  <ccoutant@google.com>
1291
1292         * dwarf_reader.cc (Dwarf_ranges_table::read_ranges_table): Save
1293         reloc_type_.
1294         (Dwarf_ranges_table::read_range_list): Call lookup_reloc.
1295         (Dwarf_ranges_table::lookup_reloc): New function.
1296         * dwarf_reader.h (Dwarf_ranges_table::Dwarf_ranges_table): Initialize
1297         reloc_type_.
1298         (Dwarf_ranges_table::lookup_reloc): New function.
1299         (Dwarf_ranges_table::reloc_type_): New data member.
1300
1301 2013-06-27  Jing Yu  <jingyu@google.com>
1302
1303         PR gold/15662
1304         * powerpc.cc (Output_data_brlt_powerpc::reset_brlt_sizes): New
1305         function.
1306         (Output_data_brlt_powerpc::finalize_brlt_sizes): New function.
1307         (Target_powerpc::do_relax): Call the above.
1308
1309 2013-06-27  Cary Coutant  <ccoutant@google.com>
1310
1311         * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
1312         on garbage collected .opd section.
1313
1314 2013-06-27  Alan Modra  <amodra@gmail.com>
1315
1316         * powerpc.cc (Target_powerpc::do_gc_add_reference): Test dst_shndx
1317         is non-zero.
1318         (Target_powerpc::do_gc_mark_symbols): Likewise for sym->shndx().
1319         (Target_powerpc::do_function_location): Likewise for loc->shndx.
1320
1321 2013-06-14  Cary Coutant  <ccoutant@google.com>
1322
1323         * resolve.cc (Symbol::override_base): Don't override st_type
1324         from plugin placeholder symbols.
1325         (Symbol_table::resolve): Likewise.
1326         (Symbol_table::should_override): Don't complain about TLS mismatch
1327         if the TO symbol is a plugin placeholder.
1328         * testsuite/Makefile.am (plugin_test_tls): New test.
1329         * testsuite/Makefile.in: Regenerate.
1330         * testsuite/plugin_test_tls.sh: New test script.
1331         * testsuite/two_file_test_2_tls.cc: New test source.
1332         * testsuite/two_file_test_tls.cc: New test source.
1333
1334 2013-06-05  Alexander Ivchenko  <alexander.ivchenko@intel.com>
1335
1336         * layout.cc (Layout::set_segment_offsets): Taking care of the case when
1337         the maximum segment alignment is larger than the page size.
1338         * testsuite/Makefile.am (large_symbol_alignment): Test that Gold
1339         correctly aligns the symbols with large alignemnt.
1340         * testsuite/Makefile.in: Regenerate.
1341         * testsuite/large_symbol_alignment.cc: New file.
1342
1343 2013-05-30  Alexander Ivchenko  <alexander.ivchenko@intel.com>
1344             Sriraman Tallam  <tmsriram@google.com>
1345
1346         * options.h (sort_section): New option.
1347         * output.h (Input_section_sort_section_prefix_special_ordering_compare):
1348         Rename from Input_section_sort_section_name_special_ordering_compare.
1349         (Input_section_sort_section_name_compare): New struct.
1350         * output.cc (Output_section::Input_section_sort_section_name_compare::
1351         operator()): New function.
1352         (Output_section::sort_attached_input_sections): Use new sort function
1353         for .text if --sort-section=name is specified.
1354         * layout.cc (Layout::make_output_section):
1355         Add sorting by name when --sort-section=name is specified.
1356         * testsuite/Makefile.am (text_section_grouping): Test option
1357         --sort-section=name.
1358         * testsuite/Makefile.in: Regenerate.
1359         * testsuite/section_sorting_name.cc: New file.
1360         * testsuite/section_sorting_name.sh: New file.
1361
1362 2013-05-21  Cary Coutant  <ccoutant@google.com>
1363
1364         * symtab.h (Symbol::is_cxx_vtable): New function.
1365         * target-reloc.h (relocate_section): Check for vtable symbol.
1366         * testsuite/Makefile.am (missing_key_func.sh): New test case.
1367         * testsuite/Makefile.in: Regenerate.
1368         * testsuite/missing_key_func.cc: New test source.
1369         * testsuite/missing_key_func.sh: New test script.
1370
1371 2013-05-21  Cary Coutant  <ccoutant@google.com>
1372
1373         * object.cc (Sized_relobj_file::get_symbol_location_info): Set
1374         type of enclosing symbol.
1375         (Relocate_info::location): Check symbol type when describing symbol.
1376         * object.h (Symbol_location_info): Remove unused line_number;
1377         add enclosing_symbol_type.
1378         * testsuite/debug_msg.sh: Adjust expected output.
1379
1380 2013-05-13  Cary Coutant  <ccoutant@google.com>
1381
1382         * configure.ac: Export DEFAULT_TARGET.
1383         * configure: Regenerate.
1384         * Makefile.in: Regenerate.
1385         * testsuite/Makefile.am: Add .EXPORT_ALL_VARIABLES.
1386         * testsuite/Makefile.in: Regenerate.
1387         * testsuite/debug_msg.sh: Delete duplicate tests.
1388         Don't check undef_int error message match for powerpc where the
1389         source file and line number aren't available.
1390
1391 2013-05-10  Roland McGrath  <mcgrathr@google.com>
1392
1393         * options.h (General_options): Add --rosegment-gap option.
1394         * options.cc (finalize): --rosegment-gap implies --rosegment.
1395         * layout.cc (set_segment_offsets): Let user option override
1396         target->rosegment_gap().
1397
1398 2013-05-10  Roland McGrath  <mcgrathr@google.com>
1399
1400         * options.h (General_options): Remove leading space from help
1401         messages for -nostdlib and --rosegment.
1402
1403 2013-05-03  Maciej W. Rozycki  <macro@codesourcery.com>
1404
1405         PR ld/15365
1406         * layout.cc (Layout::finalize): Make __ehdr_start STV_HIDDEN.
1407
1408 2013-05-03  Alan Modra  <amodra@gmail.com>
1409
1410         * merge.cc (Output_merge_string::do_add_input_section): Correct
1411         scan for number of strings.  Rename vars to avoid shadowing.
1412         Include missing terminator in input_size_.
1413
1414 2013-05-01  H.J. Lu  <hongjiu.lu@intel.com>
1415
1416         * merge.cc (Output_merge_string<Char_type>::do_add_input_section):
1417         Restore empty string handling.
1418
1419 2013-05-01  Cary Coutant  <ccoutant@google.com>
1420
1421         * stringpool.cc (Stringpool_template::new_key_offset): Fix
1422         uninitialized warning.
1423
1424 2013-04-29  Alexander Ivchenko  <alexander.ivchenko@intel.com>
1425
1426         * output.cc (Output_section::add_merge_input_section): Allow
1427         to merge sections if the alignment is more than character size.
1428         * merge.h (Output_merge_string::Output_merge_string): Remove
1429         assert.
1430         * merge.cc (Output_merge_string<Char_type>::do_add_input_section): Count
1431         only not-null strings. Check the alignment of strings.
1432         * stringpool.h
1433         (Stringpool_template<Stringpool_char>::Stringpool_template): Add
1434         alignment as the argument.
1435         (Stringpool_template<Stringpool_char>::addralign_): New class member.
1436         * stringpool.cc (Stringpool_template<Stringpool_char>::new_key_offset):
1437         Align non-zero length strings according to the addralign_.
1438         (Stringpool_template<Stringpool_char>::set_string_offsets):
1439         Updating offsets according to the given alignment.
1440         * testsuite/Makefile.am (text_section_grouping): Test if string
1441         literals are getting merged.
1442         * testsuite/Makefile.in: Regenerate.
1443         * testsuite/merge_string_literals_1.c: New file.
1444         * testsuite/merge_string_literals_2.c: Ditto.
1445         * testsuite/merge_string_literals.sh: Ditto.
1446
1447 2013-04-26  Ian Lance Taylor  <iant@google.com>
1448
1449         * target-reloc.h (relocate_section): If the reloc offset is out of
1450         range, pass VIEW as NULL to relocate.relocate.
1451         * arm.cc (Target_arm:Relocate::relocate): Check for a NULL view.
1452         * i386.cc (Target_i386::Relocate::relocate): Likewise.
1453         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
1454         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
1455         * tilegx.cc (Target_tilegx::Relocate::relocate): Likewise.
1456         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
1457
1458 2013-04-26  Geoff Pike  <gpike@chromium.org>
1459
1460         * gold.cc (queue_final_tasks): invoke layout->queue_build_id_tasks().
1461         * layout.cc (Hash_task): New class.
1462         (Layout::queue_build_id_tasks): New function.
1463         (Layout::write_build_id): Handle single-thread portion of build ID
1464         computation.  (In some cases, all of it is single-threaded.)  Replace
1465         {sha1,md5}_process_bytes with {sha1,md5}_buffer to get the same
1466         functionality in fewer lines of code.
1467         * layout.h (Layout::queue_build_id_tasks): New function declaration.
1468         * options.h (General_options): make "--build-id" default to tree
1469         rather than sha1.  Add two new options related to --build-id=tree:
1470         --build-id-chunk-size-for-treehash and
1471         --build-id-min-file-size-for-treehash.
1472         * Makefile.am: add testing of --build-id=tree and related new options
1473         (these tests will be invoked by "make check").
1474         * Makefile.in: Regenerate.
1475
1476 2013-04-25  Alan Modra  <amodra@gmail.com>
1477
1478         * configure.tgt: Add powerpcle and powerpc64le.
1479
1480 2013-04-22  Alan Modra  <amodra@gmail.com>
1481
1482         PR gold/15355
1483         * layout.cc (Layout::segment_precedes): Allow more than one
1484         segment with the same type and flags.
1485
1486 2013-04-15  Cary Coutant  <ccoutant@google.com>
1487
1488         * layout.cc (Layout::set_relocatable_section_offsets): Don't
1489         allocate space in file for BSS sections.
1490
1491 2013-04-15  Cary Coutant  <ccoutant@google.com>
1492
1493         * script-sections.cc (Orphan_output_section): Reset address
1494         to zero after each orphaned section for relocatable links.
1495
1496 2013-04-15  Cary Coutant  <ccoutant@google.com>
1497
1498         * symtab.cc (Symbol_table::sized_write_globals): Subtract
1499         section starting address for relocatable link.
1500         * testsuite/Makefile.am (script_test_11): New test.
1501         * testsuite/Makefile.in: Regenerate.
1502         * testsuite/script_test_11.c: New source file.
1503         * testsuite/script_test_11.t: New linker script.
1504
1505 2013-04-13  Alan Modra  <amodra@gmail.com>
1506
1507         * powerpc.cc (Stub_control::can_add_to_stub_group): Don't set
1508         owner when sections are not adjacent and exceed group size.
1509         (Target_powerpc::group_sections): Handle corner case.
1510         (Target_powerpc::Branch_info::make_stub): Handle case where
1511         stub table doesn't exist due to branches in non-exec sections.
1512         (Target_powerpc::Relocate::relocate): Likewise.
1513
1514 2013-04-11  Alan Modra  <amodra@gmail.com>
1515
1516         PR gold/15354
1517         * powerpc.cc (Target_powerpc::make_brlt_section): Name section
1518         .branch_lt to match bfd ld.  Adjust comments throughout file.
1519
1520 2013-04-04  Ian Lance Taylor  <iant@google.com>
1521
1522         GCC PR c++/56840
1523         * object.cc (do_layout_deferred_sections): Handle .eh_frame
1524         sections before checking whether they are included in the link.
1525
1526 2013-03-29  Sriraman Tallam  <tmsriram@google.com>
1527
1528         * archive.cc (Archive::get_elf_object_for_member):  Create the elf
1529         object before calling the plugin claim_file handler.  Pass the elf
1530         object of the archive to the plugin. Delete the elf object if the
1531         plugin claims the file.
1532
1533 2013-03-21  Alan Modra  <amodra@gmail.com>
1534
1535         * layout.cc (Layout::set_segment_offsets): Accept writable .text
1536         segment when omagic.
1537
1538 2013-03-21  Alan Modra  <amodra@gmail.com>
1539
1540         * dwp.cc (Dwp_output_file::add_contribution): Avoid signed/unsigned
1541         comparison warning.
1542         * layout.cc (Layout::create_dynamic_symtab): Avoid "may be used
1543         uninitialized" warning.
1544
1545 2013-03-20  Alan Modra  <amodra@gmail.com>
1546
1547         * symtab.h (Symbol::clear_version): New function.
1548         * symtab.cc (Symbol_table::set_dynsym_indexes): Don't set object
1549         is_needed by weak references.  Clear version for symbols defined
1550         in as-needed objects that are not needed.
1551
1552 2013-03-15  Alan Modra  <amodra@gmail.com>
1553
1554         * powerpc.cc (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Make
1555         static and public.  Add report_err param.  Return false for data refs.
1556         (Target_powerpc::rela_dyn_section): New overloaded function.
1557         (Target_powerpc::plt_, iplt_): Elucidate.
1558         (Output_data_plt_powerpc::entry_count): Handle current_data_size()==0.
1559         (Output_data_plt_powerpc::do_write): Don't write .iplt.
1560         (Output_data_plt_powerpc::plt_entry_count): Don't add .iplt entries.
1561         (Target_powerpc::Scan::local, global): Adjust reloc_needs_plt_for_ifunc
1562         calls.  Put ifunc dynamic relocs in irela_dyn_section.  Only
1563         push_branch and make_plt_entry for ifunc syms when
1564         reloc_needs_plt_for_ifunc.
1565         (Target_powerpc::Relocate::relocate): Don't use plt entry value
1566         for ifunc unless reloc_needs_plt_for_ifunc.
1567
1568 2013-03-15  Alan Modra  <amodra@gmail.com>
1569
1570         * gc.h (gc_process_relocs): Don't look through function descriptors.
1571         * icf.cc (get_section_contents): Do so here instead.
1572
1573 2013-03-13  Alan Modra  <amodra@gmail.com>
1574
1575         * powerpc.cc (is_branch_reloc): Forward declare.
1576         (Target_powerpc::do_can_check_for_function_pointers): New predicate.
1577         (Target_powerpc::Scan::local_reloc_may_be_function_pointer): Return
1578         false for 64-bit, true for 32-bit non-branch relocs.
1579         (Target_powerpc::Scan::global_reloc_may_be_function_pointer): Likewise.
1580         * testsuite/Makefile.am (icf_test): Use linker map file instead of
1581         nm output.
1582         (icf_safe_test): Generate linker map file as well as nm output.
1583         (icf_safe_so_test): Likewise.
1584         * testsuite/Makefile.in: Regenerate.
1585         * testsuite/icf_test.sh: Parse linker map file to determine
1586         section folding.
1587         * testsuite/icf_safe_test.sh: Likewise.  Expect folding for PowerPC.
1588         * testsuite/icf_safe_so_test.sh: Likewise.
1589         (X86_32_or_ARM_specific_safe_fold): Merge into..
1590         (arch_specific_safe_fold): ..this.
1591         (X86_64_specific_safe_fold): Delete unused function.
1592
1593 2013-03-12  Alan Modra  <amodra@gmail.com>
1594
1595         * gc.h (gc_process_relocs): Look through function descriptors
1596         to determine shndx, symvalue and addend used by ICF.  Tidy
1597         variable duplication.
1598
1599 2013-03-11  Alan Modra  <amodra@gmail.com>
1600
1601         * gold.cc (queue_middle_tasks): Move detect_odr_violations..
1602         * layout.cc (Layout_task_runner::run): ..to here.
1603         * symtab.h (struct Symbol_location): Extract from..
1604         (class Symbol_table): ..here.
1605         * symtab.cc (Symbol_table::linenos_from_loc): Invoke function_location.
1606         * target.h (class Target): Add function_location and
1607         do_function_location functions.
1608         (class Sized_target): Add do_function_location.
1609         * object.h (class Sized_relobj_file): Move find_shdr..
1610         (class Object): ..to here.
1611         * object.cc: Likewise.  Update to suit.  Instantiate.
1612         (Sized_relobj_file::find_eh_frame): Update find_shdr call.
1613         * powerpc.cc (class Powerpc_dynobj): New.
1614         (Target_powerpc::do_function_location): New function.
1615         (Powerpc_relobj::do_find_special_sections): Update find_shdr call.
1616         (Powerpc_dynobj::do_read_symbols): New function.
1617         (Target_powerpc::do_make_elf_object): Make a Powerpc_dynobj.
1618
1619 2013-03-08  Ian Lance Taylor  <iant@google.com>
1620
1621         * options.cc (General_options::string_to_object_format): Accept
1622         "default".
1623
1624 2013-03-08  Alan Modra  <amodra@gmail.com>
1625
1626         * ehframe.h (Post_fdes) Make it a vector of Post_fde rather than
1627         pointer to Post_fde.
1628         (struct Post_fde): Move definition to here..
1629         * ehframe.cc (struct Post_fde): ..from here.
1630         (Cie::write): Don't alloc Post_fde.
1631         (Eh_frame::do_sized_write): Update.  Don't free Post_fde.
1632
1633 2013-03-07  Alan Modra  <amodra@gmail.com>
1634
1635         * testsuite/discard_locals_relocatable_test.c: Add a powerpc
1636         relocation referencing .LC0.
1637         * testsuite/discard_locals_test.sh: Remove FIXMEs.
1638
1639 2013-03-07  Alan Modra  <amodra@gmail.com>
1640
1641         * testsuite/ifunc-sel.h (ifunc_sel, ifunc_one): Mark
1642         always_inline.  Add assembly for powerpc to avoid GOT.
1643
1644 2013-03-07  Alan Modra  <amodra@gmail.com>
1645
1646         * testsuite/script_test_10.sh: Don't test .bss section
1647         header number.
1648
1649 2013-03-06  Alan Modra  <amodra@gmail.com>
1650
1651         * powerpc.cc (class Powerpc_relobj): Move some member functions.
1652         (Target_powerpc::symval_for_branch):  Add symtab param.  Update
1653         all callers.  Handle folded sections.
1654         (Target_powerpc::do_gc_add_reference): Don't cast dynamic object
1655         to Powerpc_relobj.
1656         (Global_symbol_visitor_opd::operator()): Likewise.
1657
1658 2013-03-04  Alan Modra  <amodra@gmail.com>
1659
1660         * testsuite/Makefile.am (final_layout_script.lds): Add .sbss.
1661         * testsuite/Makefile.in: Regenerate.
1662
1663 2013-03-01  Cary Coutant  <ccoutant@google.com>
1664
1665         Add dwp support for v2 DWARF package file format.
1666         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
1667         tu_length parameter.  Adjust all callers.
1668         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
1669         * dwp.cc: Include dwarf.h.
1670         (Section_bounds): New struct type.
1671         (Unit_set): New struct type.
1672         (Dwo_file::Dwo_file): Initialize new data member.
1673         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
1674         Combine and rename to...
1675         (Dwo_file::read_unit_index): ...this.
1676         (Dwo_file::sized_read_compunit_index)
1677         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
1678         (Dwo_file::sized_read_unit_index): ...this.
1679         (Dwo_file::copy_section): Remove section_name, is_str_offsets
1680         parameters; add section_id parameter.
1681         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
1682         (Dwo_file::add_unit_set): ...this.
1683         (Dwo_file::shndx_map_): Remove.
1684         (Dwo_file::sect_offsets_): New data member.
1685         (Dwp_output_file::Dwp_output_file): Initialize new data members.
1686         (Dwp_output_file::add_section): Rename to...
1687         (Dwp_output_file::add_contribution): ...this.
1688         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
1689         (Dwp_output_file::add_tu_set): Likewise.
1690         (Dwp_output_file::Contribution): New type.
1691         (Dwp_output_file::Section::contributions): New data member.
1692         (Dwp_output_file::Cu_or_tu_set): Remove.
1693         (Dwp_output_file::Section::Section): New ctor.
1694         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
1695         (Dwp_output_file::Dwp_index::Section_table): New type.
1696         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
1697         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
1698         parameter.
1699         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
1700         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
1701         (Dwp_output_file::Dwp_index::section_table): New member function.
1702         (Dwp_output_file::Dwp_index::section_table_end): New member function.
1703         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
1704         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
1705         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
1706         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
1707         (Dwp_output_file::Dwp_index::section_table_): New data member.
1708         (Dwp_output_file::Dwp_index::section_mask_): New data member.
1709         (Dwp_output_file::add_output_section): New member function.
1710         (Dwp_output_file::write_new_section): New member function.
1711         (Dwp_output_file::write_contributions): New member function.
1712         (Dwp_output_file::section_id_map_): New data member.
1713         (class Dwo_id_info_reader): Remove.
1714         (class Unit_reader): New class.
1715         (get_dwarf_section_name): New function.
1716         (Dwo_file::read_executable): Adjust initializations of class data.
1717         (Dwo_file::read): Add support for v2 package file format.
1718         (Dwo_file::read_unit_index): Likewise.
1719         (Dwo_file::sized_read_unit_index): Likewise.
1720         (Dwo_file::copy_section): Likewise.
1721         (Dwo_file::add_unit_set): Likewise.
1722         (Dwp_output_file::add_output_section): Likewise.
1723         (Dwp_output_file::add_contribution): Likewise.
1724         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
1725         for empty slot.
1726         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
1727         file format.
1728         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
1729         slot.
1730         (Dwp_output_file::initialize): Remove unused function.
1731         (Dwp_output_file::finalize): Add support for v2 package file format.
1732         (Dwp_output_file::write_index): Likewise.
1733         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
1734         function prototype.
1735
1736 2013-03-01  Cary Coutant  <ccoutant@google.com>
1737
1738         * dwarf_reader.cc (Dwarf_info_reader::check_buffer): Move
1739         function into class definition in header file.
1740         (Dwarf_info_reader::warn_corrupt_debug_section): New function.
1741         * dwarf_reader.h (Dwarf_info_reader::warn_corrupt_debug_section):
1742         New function.
1743         (Dwarf_info_reader::check_buffer): Move here from .cc file.
1744
1745 2013-02-28  Alan Modra  <amodra@gmail.com>
1746
1747         * target.h (Target::plt_fde_location, do_plt_fde_location): Declare.
1748         * target.cc (Target::do_plt_fde_location): New function.
1749         * ehframe.h (class FDE): Add post_map field to u_.from_linker,
1750         accessor function, and constructor param.
1751         (struct Post_fde, Post_fdes): Declare.
1752         (Cie::write): Add post_fdes param.
1753         * ehframe.cc (Fde::write): Use plt_fde_location.
1754         (struct Post_fde): Define.
1755         (Cie::write): Stash FDEs added post merge mapping.
1756         (Eh_frame::add_ehframe_for_plt): Assert no new CIEs after mapping.
1757         Adjust Fde constructor call.  Bump final_data_size_ for post map FDEs.
1758         (Eh_frame::do_sized_write): Arrange to write post map FDES after
1759         other FDEs.
1760         * powerpc.cc (Target_powerpc::do_plt_fde_location): New function.
1761         (Target_powerpc::has_glink): New function.
1762         (Target_powerpc::do_relax): Add eh_frame info for stubs.
1763         (struct Eh_cie, eh_frame_cie, glink_eh_frame_fde_64,
1764         glink_eh_frame_fde_32, default_fde): New data.
1765         (Stub_table::eh_frame_added_): New var.
1766         (Stub_table::find_long_branch_entry, stub_address, stub_offset):
1767         Make const.
1768         (Stub_table::add_eh_frame): New function.
1769         (Output_data_glink::add_eh_frame): New function.
1770         (Target_powerpc::make_glink_section): Call add_eh_frame.
1771
1772 2013-02-15  Ian Lance Taylor  <iant@google.com>
1773
1774         * options.h (DEFINE_uint64_alias): Define.
1775         (class General_options): Add -Ttext-segment as an alias for
1776         -Ttext.
1777
1778 2013-02-15  Alan Modra  <amodra@gmail.com>
1779
1780         * powerpc.cc (Stub_table::plt_off): New function, extracted from..
1781         (Stub_table::do_write): ..here, two places.
1782         (Stub_table::plt_call_size): Use it here too.
1783
1784 2013-02-11  Ian Lance Taylor  <iant@google.com>
1785
1786         * descriptors.cc (Descriptors::close_all): New function.
1787         * descriptors.h (class Descriptors): Declare close_all.
1788         (close_all_descriptors): New inline function.
1789         * plugin.cc: Include "descriptors.h".
1790         (Plugin_manager::cleanup): Call close_all_descriptors.
1791
1792 2013-02-06  Alan Modra  <amodra@gmail.com>
1793
1794         * README: Update coding style link.
1795
1796 2013-01-28  Cary Coutant  <ccoutant@google.com>
1797
1798         * dwp.cc (File_list): New typedef.
1799         (Dwo_name_info_reader): New class.
1800         (Dwo_id_info_reader::Dwo_id_info_reader): Remove unused parameters.
1801         (Dwo_id_info_reader::visit_top_die): Remove unused member function.
1802         (Dwo_file::~Dwo_file): Delete input_file_ after obj_.
1803         (Dwo_file::read_executable): New function.
1804         (Dwo_file::read): Move common setup code to ...
1805         (Dwo_file::make_object): ... here.
1806         (dwp_options): Add --exec/-e.
1807         (usage): Likewise.
1808         (main): Likewise.
1809
1810 2013-01-24  Sriraman Tallam  <tmsriram@google.com>
1811
1812         * layout.cc (Layout::layout): Check for option text_reorder.
1813         (Layout::make_output_section): Ditto.
1814         * options.h (text_reorder): New option.
1815         * output.cc (Input_section_sort_compare): Remove special ordering
1816         of section names.
1817         (Output_section::
1818          Input_section_sort_section_name_special_ordering_compare::
1819          operator()): New function.
1820         (Output_section::sort_attached_input_sections): Use new sort function
1821         for .text.
1822         * output.h (Input_section_sort_section_name_special_ordering_compare):
1823         New struct.
1824         * testsuite/Makefile.am (text_section_grouping): Test option
1825         --no-text-reorder
1826         * testsuite/Makefile.in: Regenerate.
1827         * testsuite/text_section_grouping.sh: Check order of functions without
1828         default text reordering.
1829
1830 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
1831
1832         * options.h (General_options): Change default to true for new_dtags.
1833
1834 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
1835
1836         * layout.cc (Layout::finish_dynamic_section): Only add DT_RPATH
1837         when enable_new_dtags is false.  Only add DT_RUNPATH when
1838         enable_new_dtags is true.
1839
1840 2013-01-17  Serge Pavlov  <serge.v.pavlov@gmail.com>
1841
1842         * powerpc.cc (Stub_table::find_plt_call_entry): Make types
1843         used in declaration and definition consistent.
1844         (Target_powerpc::symval_for_branch): Ditto.
1845
1846 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
1847
1848         * testsuite/plugin_final_layout.cc: Fix comment.
1849
1850 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
1851
1852         * layout.cc (Layout::layout): Do not do default sorting for
1853         text sections when section ordering is specified.
1854         (make_output_section): Ditto.
1855         * testsuite/plugin_final_layout.cc: Name the function sections
1856         to catch reordering issues.
1857
1858 2013-01-15  Alan Modra  <amodra@gmail.com>
1859
1860         * powerpc.cc (Target_powerpc::do_relax): Default shared libs to
1861         plt-thread-safe.
1862
1863 2013-01-15  Alan Modra  <amodra@gmail.com>
1864
1865         * testsuite/Makefile.am (final_layout_script.lds): Handle .got section.
1866         * testsuite/Makefile.in: Regenerate.
1867
1868 2013-01-14  Alan Modra  <amodra@gmail.com>
1869
1870         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add various output files.
1871         * testsuite/Makefile.in: Regenerate.
1872
1873 2013-01-11  Pavel Chupin  <pavel.v.chupin@intel.com>
1874
1875         PR bfd/14430
1876         Fix mingw gold build with plugins enabled
1877         * Makefile.am: Replace -ldl with @DLOPEN_LIBS@.
1878         * configure.ac: Export DLOPEN_LIBS and add headers check.
1879         * plugin.cc: Handle non-dlfcn case.
1880         * Makefile.in: Regenerate.
1881         * config.in: Regenerate.
1882         * configure: Regenerate.
1883         * testsuite/Makefile.in: Regenerate.
1884
1885 2013-01-09  Sriraman Tallam  <tmsriram@google.com>
1886
1887         * output.h (sort_attached_input_sections): Change to be public.
1888         * script-sections.cc
1889         (Output_section_definition::set_section_addresses): Sort
1890         attached input sections according to section order before linker
1891         script assigns section addresses.
1892         (Orphan_output_section::set_section_addresses): Sort
1893         attached input sections according to section order before linker
1894         script assigns section addresses.
1895         * Makefile.am (final_layout.sh): Use a simple linker script to
1896         check if section ordering still works.
1897         * Makefile.in: Regenerate.
1898
1899 2013-01-09  Ben Cheng  <bccheng@google.com>
1900
1901         * arm.cc (Target_arm::attributes_accept_div): New function.
1902         (Target_arm::attributes_forbid_div): New function.
1903         (Target_arm::merge_object_attributes): Merge the Tag_DIV_use
1904         attribute using the same new functions as what bfd/elf32_arm.c
1905         does.
1906
1907 2013-01-07  Cary Coutant  <ccoutant@google.com>
1908
1909         PR gold/14993
1910         * output.cc (Output_section::add_input_section): For incremental
1911         updates, don't track input sections that are allocated from patch
1912         space.
1913
1914 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
1915             Ian Lance Taylor  <iant@google.com>
1916
1917         PR gold/14897
1918         * configure.ac (--enable-ld): Removed.
1919         (install_as_default): Set to yes only for --enable-gold=default
1920         or --disable-ld.
1921         * configure: Regenerated.
1922
1923 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
1924
1925         * options.h (General_options): Add -fuse-ld= for GCC linker
1926         option compatibility.
1927
1928 2013-01-04  Cary Coutant  <ccoutant@google.com>
1929
1930         * configure.ac: Fix typo restoring CXXFLAGS.
1931         * configure: Regenerate.
1932
1933 2013-01-04  Cary Coutant  <ccoutant@google.com>
1934
1935         * testsuite/Makefile.am (CXXLINK_S): New macro.
1936         (debug_msg_so.err, debug_msg_ndebug.err): Use CXXLINK_S.
1937         * testsuite/Makefile.in: Regenerate.
1938
1939 2013-01-02  H.J. Lu  <hongjiu.lu@intel.com>
1940
1941         * version.cc (print_version): Update copyright year to 2013.
1942
1943 2012-12-20  Ian Lance Taylor  <iant@google.com>
1944
1945         * layout.cc (Layout::special_ordering_of_input_section): New
1946         function.
1947         (Layout::layout): If input section requires special ordering, must
1948         sort input sections.
1949         (Layout::make_output_section): May sort .text input sections.
1950         (Layout::is_section_name_prefix_grouped): Remove.
1951         * layout.h (class Layout): Declare
1952         special_ordering_of_input_section.  Don't declare
1953         is_section_name_prefix_grouped.
1954         * output.cc (Output_section::add_input_section): Revert last
1955         change.
1956         (Output_section::Input_section_sort::match_file_name): Don't crash
1957         if called on output section data.
1958         (Output_section::Input_section_sort_compare): Sort based on
1959         special ordering.
1960         (Output_section::Input_section_sort_section_order_index_compare):
1961         Revert last patch.
1962         (Output_section::sort_attached_input_sections): Likewise.
1963
1964 2012-12-18  Sriraman Tallam  <tmsriram@google.com>
1965
1966         * layout.cc (Layout::is_section_name_prefix_grouped): New function.
1967         * layout.h (Layout::is_section_name_prefix_grouped): New function.
1968         * output.cc (Output_section::add_input_section): Check if section
1969         name contains special prefix.  Keep input sections to sort such
1970         sections.
1971         (Output_section::Input_section_sort_section_order_index_compare
1972          ::operator()): Group sections according to prefixes.
1973         (Output_section::sort_attached_input_sections): Add condition to
1974         Input_section_entry constructor call.
1975         * testsuite/Makefile.am (text_section_grouping): New test.
1976         * testsuite/Makefile.in: Regenerate.
1977         * testsuite/text_section_grouping.cc: New file.
1978         * testsuite/text_section_grouping.sh: New file.
1979
1980 2012-12-17  Nick Clifton  <nickc@redhat.com>
1981
1982         * Makefile.am: Add copyright notice.
1983         * NEWS: Likewise.
1984         * README: Likewise.
1985         * configure.ac: Likewise.
1986         * ftruncate.c: Likewise.
1987         * Makefile.in: Regenerate.
1988
1989 2012-12-14  Cary Coutant  <ccoutant@google.com>
1990
1991         * testsuite/Makefile.am (exception_separate_shared_12_test): Add
1992         --no-as-needed flag.
1993         (exception_separate_shared_12_test): Likewise.
1994         (incremental_copy_test): Likewise.
1995         * testsuite/Makefile.in: Regenerate.
1996
1997 2012-12-14  Cary Coutant  <ccoutant@google.com>
1998
1999         * dwp.cc (Dwp_output_file::add_cu_set): Check for duplicate CUs.
2000         (Dwp_output_file::Dwp_index::enter_set): Add assert.
2001
2002 2012-12-12  Alan Modra  <amodra@gmail.com>
2003
2004         * powerpc.cc (class Track_tls): New.
2005         (class Relocate, class Scan): Inherit Track_tls.
2006         (Target_powerpc::Scan::local, global): Track tls optimization
2007         and avoid creating plt entry for __tls_get_addr if all uses
2008         are optimized away.
2009         (Target_powerpc::Relocate::relocate): Update to use Track_tls.
2010
2011 2012-12-12  Alan Modra  <amodra@gmail.com>
2012
2013         * options.h (General_options): Add --toc-sort/--no-toc-sort.
2014         Replace no_toc_optimize with toc_optimize.
2015         * output.h (Output_section::input_sections): Provide non-const variant.
2016         * powerpc.cc (Powerpc_relobj::has_small_toc_reloc_,
2017         set_has_small_toc_reloc, has_small_toc_reloc): New variable and
2018         accessors.
2019         (Target_powerpc::Scan::local, global): Call set_has_small_toc_reloc.
2020         (class Sort_toc_sections): New.
2021         (Target_powerpc::do_finalize_sections): Sort toc sections.
2022         (Target_powerpc::Relocate::relocate): Update toc_optimize test.
2023
2024 2012-12-10  Roland McGrath  <mcgrathr@google.com>
2025
2026         * testsuite/binary_unittest.cc (read_all): New function.
2027         (Sized_binary_test): Use it instead of ::read.
2028         * fileread.cc (do_read): Don't assume pread always reads the whole
2029         amount in a single call.
2030
2031 2012-12-10  Alan Modra  <amodra@gmail.com>
2032
2033         * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
2034         Set EM_PPC64 or EM_PPC here.
2035         (Target_selector_powerpc::do_recognize): Delete.
2036
2037 2012-12-10  Alan Modra  <amodra@gmail.com>
2038
2039         * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
2040         stub_table_.
2041         (Target_powerpc::Branch_info::make_stub): Don't omit addend.
2042
2043 2012-12-07  Roland McGrath  <mcgrathr@google.com>
2044
2045         * testsuite/binary_unittest.cc (Sized_binary_test):
2046         Use open_descriptor rather than ::open.
2047
2048 2012-12-07  Alan Modra  <amodra@gmail.com>
2049
2050         * powerpc.cc (Stub_table::do_write): Delete redundant Address
2051         typedef and invalid_address constant.
2052         (Output_data_glink, Stub_table, Target_powerpc): Explicitly
2053         instantiate constants.
2054
2055 2012-12-06  Roland McGrath  <mcgrathr@google.com>
2056
2057         * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
2058         Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
2059         * aclocal.m4: Regenerate.
2060         * configure: Regenerate.
2061         * Makefile.in: Regenerate.
2062         * testsuite/Makefile.in: Regenerate.
2063
2064 2012-12-07  Alan Modra  <amodra@gmail.com>
2065
2066         * options.h (General_options): Add no_toc_optimize.
2067         * powerpc.cc (ok_lo_toc_insn): New function.
2068         (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
2069
2070 2012-12-06  Alan Modra  <amodra@gmail.com>
2071
2072         * options.h (General_options): Add plt_align, plt_static_chain,
2073         plt_thread_safe.  Update stub_group_size help text.
2074         * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
2075         for new plt_thread_safe_ var.
2076         (use_plt_offset): Correct comments.
2077         (Target_powerpc::do_relax): Look for thread creation symbols to
2078         determine default plt_thread_safe value.  Clear plt call stubs
2079         as well as branch stubs each iteration.
2080         (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
2081         insn constants.
2082         (l, hi, ha, write_insn): Move earlier.
2083         (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
2084         (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
2085         plt stubs too.
2086         (Stub_table::update_size): Adjust.
2087         (Stub_table::prev_size, set_prev_size): Delete.
2088         (Stub_table::stub_align): Let --plt-align affect result.
2089         (Stub_table::plt_call_size): Calculate sizes for various stubs.
2090         (Stub_table::branch_stub_size): Use last_plt_size in address calc.
2091         (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
2092         (Stub_table::do_write): Support more stub variants.
2093
2094 2012-12-04  Alan Modra  <amodra@gmail.com>
2095
2096         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
2097         (Target_powerpc::do_define_standard_symbols): New function.
2098
2099 2012-12-03  Alan Modra  <amodra@gmail.com>
2100
2101         * output.h: Formatting, whitespace.
2102
2103 2012-12-03  Alan Modra  <amodra@gmail.com>
2104
2105         * layout.h (Layout::get_executable_sections): Declare.
2106         * layout.cc (Layout::get_executable_sections): New function.
2107         * arm.cc (Target_arm::group_sections): Use it.
2108         (Arm_output_section::group_sections): Delete now redundant test.
2109         * output.cc (Output_reloc::Output_reloc): Add is_relative.
2110         param to handle relative relocs.
2111         * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
2112         (Output_data_reloc::add_absolute): Adjust.
2113         (Output_data_reloc::add_relative): New function.
2114         (Output_data::reset_data_size): New function.
2115         (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
2116         (Output_section::set_addralign): New function.
2117         (Output_section::checkpoint_set_addralign): New function.
2118         (Output_section::clear_section_offsets_need_adjustment): New function.
2119         (Output_section::input_sections): Make public.
2120         * powerpc.cc (class Output_data_brlt_powerpc): New.
2121         (class Stub_table, class Stub_control): New.
2122         (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
2123         stub_table_, set_stub_table, stub_table): New vectors and accessor
2124         functions.
2125         (Target_powerpc::do_may_relax, do_relax, push_branch,
2126         new_stub_table, stub_tables, brlt_section, group_sections,
2127         add_branch_lookup_table, find_branch_lookup_table,
2128         write_branch_lookup_table, make_brlt_section): New functions.
2129         (Target_powerpc::struct Sort_sections, class Branch_info): New.
2130         (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
2131         branch_info_): New vars.
2132         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
2133         make call stubs here.
2134         (Output_data_glink): Remove all call stub handling from this class.
2135         (Target_powerpc::Scan::local, global): Save interesting branch
2136         relocs and relocs for ifunc.  Adjust calls to plt entry functions.
2137         (Target_powerpc::do_finalize_sections): Only make reg save/restore
2138         functions on final link.
2139         (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
2140         Handle long branch destinations too.
2141         (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
2142         do_plt_address_for_local): Adjust lookup of plt call stubs.
2143
2144 2012-11-30  Alan Modra  <amodra@gmail.com>
2145
2146         * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
2147         relocs against protected symbols when building 32-bit shared libs.
2148
2149 2012-11-30  Alan Modra  <amodra@gmail.com>
2150
2151         * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
2152         param.  Call got_section() to make .got.  Update all callers
2153         and their callers and so on.
2154
2155 2012-11-30  Alan Modra  <amodra@gmail.com>
2156
2157         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
2158         _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
2159         (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
2160         value if it already exists.
2161
2162 2012-11-19  H.J. Lu  <hongjiu.lu@intel.com>
2163
2164         PR gold/14858
2165         * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
2166
2167 2012-11-14  Roland McGrath  <mcgrathr@google.com>
2168
2169         * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
2170         than bfc instruction for data sandboxing.
2171
2172 2012-11-08  Alan Modra  <amodra@gmail.com>
2173
2174         * po/POTFILES.in: Regenerate.
2175
2176 2012-11-05  Alan Modra  <amodra@gmail.com>
2177
2178         * configure.ac: Apply 2012-09-10 change to config.in here.
2179         * configure: Regenerate.
2180
2181 2012-11-05  Alan Modra  <amodra@gmail.com>
2182
2183         * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
2184         (struct Opd_ent): Use "Address" rather than "Offset".
2185         (Output_data_got_powerpc::got_base_offset): Return Valtype.
2186         (Target_powerpc::got_section): Make public.
2187         (Target_powerpc::scan_relocs): Move code setting symbols..
2188         (Powerpc_relobj::do_scan_relocs): ..to here, new function.
2189         Create _SDA_BASE_ only when referenced.
2190
2191 2012-11-02  Roland McGrath  <mcgrathr@google.com>
2192
2193         * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
2194         from last change.
2195
2196 2012-11-01  Roland McGrath  <mcgrathr@google.com>
2197
2198         * target.h (Sized_target::relocate_relocs): Use Elf_Off
2199         for offset_in_output_section parameter.
2200         (Sized_target::relocate_special_relocatable): Likewise.
2201         * arm.cc (Target_arm::relocate_relocs): Likewise.
2202         (Target_arm::relocate_special_relocatable): Likewise.
2203         * i386.cc (Target_i386::relocate_relocs): Likewise.
2204         * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
2205         * sparc.cc (Target_sparc::relocate_relocs): Likewise.
2206         * target-reloc.h (relocate_relocs): Likewise.
2207         * testsuite/testfile.cc (Target_test): Likewise.
2208         * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
2209         * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
2210
2211         * system.h: Move inclusion of <clocale> to after <libintl.h> in
2212         [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
2213
2214         * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
2215         parameter, which is unused in the [!F_SETFD] case.
2216
2217         * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
2218         SYMNDX to off_t before comparing it to this->data_size().
2219         * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
2220         * incremental.cc (Output_section_incremental_inputs::do_write):
2221         Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
2222
2223         * nacl.cc: Include "libiberty.h" for vasprintf declaration.
2224
2225 2012-10-30  Steve McIntyre  <steve.mcintyre@linaro.org>
2226
2227         * gold.cc (Target_arm::do_adjust_elf_header): Add the
2228         hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
2229         in EABI_VER5.
2230
2231 2012-10-29  Cary Coutant  <ccoutant@google.com>
2232
2233         * dwp.cc (usage): Add file and exit status parameters;
2234         add --help and --version options.
2235         (print_version): New function.
2236         (main): Add --help and --version options.
2237
2238 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
2239
2240         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
2241         final_layout_sequence.txt.
2242         * testsuite/Makefile.in: Regenerated.
2243
2244 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
2245
2246         * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
2247         COMPILE generated by automake.
2248         (LINK1): Likewise.
2249         (CXXCOMPILE1): Likewise.
2250         (CXXLINK1): Likewise.
2251         (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
2252         (LINK): Likewise.
2253         (CXXCOMPILE): Likewise.
2254         (CXXLINK): Likewise.
2255         * testsuite/Makefile.in: Regenerated.
2256
2257 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
2258
2259         * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
2260         on bad fwrite return.
2261
2262 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
2263
2264         * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
2265         on val.
2266
2267 2012-10-23  Cary Coutant  <ccoutant@google.com>
2268
2269         * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
2270         * testsuite/Makefile.in: Regenerate.
2271         * testsuite/dwp_test.h: New source file.
2272         * testsuite/dwp_test_1.cc: New source file.
2273         * testsuite/dwp_test_1.s: New source file.
2274         * testsuite/dwp_test_1.sh: New source file.
2275         * testsuite/dwp_test_1b.cc: New source file.
2276         * testsuite/dwp_test_1b.s: New source file.
2277         * testsuite/dwp_test_2.cc: New source file.
2278         * testsuite/dwp_test_2.s: New source file.
2279         * testsuite/dwp_test_2.sh: New source file.
2280         * testsuite/dwp_test_main.cc: New source file.
2281         * testsuite/dwp_test_main.s: New source file.
2282
2283 2012-10-23  Cary Coutant  <ccoutant@google.com>
2284
2285         * dwp.h: New header file.
2286         * dwp.cc: New source file.
2287         * gold.h: Move shared declarations to system.h.
2288         * system.h: New header file.
2289         * Makefile.am: Add dwp.
2290         * Makefile.in: Regenerate.
2291
2292 2012-10-23  Cary Coutant  <ccoutant@google.com>
2293
2294         * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
2295         Dwarf_info_reader::read_from_pointer.
2296         (Dwarf_pubnames_table::read_header): Likewise.
2297         (Dwarf_pubnames_table::next_name): Likewise.
2298         (Dwarf_die::read_attributes): Likewise.
2299         (Dwarf_die::skip_attributes): Likewise.
2300         (Dwarf_info_reader::read_from_pointer): New function template.
2301         * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
2302         (Dwarf_pubnames_table): Likewise.
2303         (Dwarf_info_reader::read_from_pointer): New function template.
2304         * gdb-index.cc (Gdb_index_info_reader): Adjust call to
2305         Dwarf_pubnames_table ctor.
2306
2307 2012-10-23  Cary Coutant  <ccoutant@google.com>
2308
2309         * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
2310         abbrev_shndx.
2311         * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
2312         abbrev_shndx_.
2313         (Dwarf_info_reader::set_abbrev_shndx): New method.
2314         (Dwarf_info_reader::abbrev_shndx_): New data member.
2315
2316 2012-10-23  Cary Coutant  <ccoutant@google.com>
2317
2318         * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
2319         from object, not parameters.
2320         (Dwarf_info_reader::parse): Likewise.
2321         * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
2322         (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
2323         (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
2324         methods.
2325
2326 2012-10-23  Cary Coutant  <ccoutant@google.com>
2327
2328         * fileread.cc (Input_file::Input_file): New constructor.
2329         * fileread.h (class Input_file): Add new constructor.
2330
2331 2012-10-18  Alan Modra  <amodra@gmail.com>
2332
2333         PR gold/14727
2334         * object.cc (Relobj::is_section_name_included): Also match
2335         .sdata personality section.
2336
2337 2012-10-18  Alan Modra  <amodra@gmail.com>
2338
2339         * target-reloc.h (class Default_comdat_behavior): New, package up..
2340         (get_comdat_behaviour): ..this.
2341         (relocate_section): Add Relocate_comdat_behavior template arg,
2342         adjust code to suit.
2343         * arm.cc (Target_arm::relocate_section): Adjust to suit.
2344         (Target_arm::scan_reloc_section): Likewise.
2345         * i386.cc (Target_i386::relocate_section): Likewise.
2346         * sparc.cc (Target_sparc::relocate_section): Likewise.
2347         * tilegx.cc (Target_tilegx::relocate_section): Likewise.
2348         * x86_64.cc (Target_x86_64::relocate_section): Likewise.
2349         * powerpc.cc (class Relocate_comdat_behavior): New.
2350         (Target_powerpc::relocate_section): Don't zap opd relocs.  Supply
2351         gold::relocate_section with new template arg.
2352
2353 2012-10-18  Alan Modra  <amodra@gmail.com>
2354
2355         * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
2356         dynamic relocs for GOT_TPREL got entries, without symbol if
2357         resolving locally.
2358         (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
2359         (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
2360         (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
2361
2362 2012-10-17  Alan Modra  <amodra@gmail.com>
2363
2364         PR gold/14726
2365         * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
2366
2367 2012-10-16  Sriraman Tallam  <tmsriram@google.com>
2368
2369         * layout.cc (Layout::include_section): Keep sections marked
2370         SHF_EXCLUDE when doing relocatable links.
2371
2372 2012-10-16  Alan Modra  <amodra@gmail.com>
2373
2374         * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
2375         (Target_powerpc::do_finalize_sections): Call it.
2376         (Output_data_save_res): New class and supporting functions.
2377         (Target_powerpc::symval_for_branch): Only look up .opd entry for
2378         normal symbols defined in object files.
2379
2380 2012-10-12  Alan Modra  <amodra@gmail.com>
2381
2382         * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
2383         (struct Opd_ent): Make "discard" a bit field.  Add "gc_mark".
2384         (Target_powerpc::do_gc_mark_symbol): Delay marking function code
2385         section if scan_opd_relocs not yet called.
2386         (Target_powerpc::gc_process_relocs): Call process_gc_mark.
2387
2388 2012-10-12  Alan Modra  <amodra@gmail.com>
2389
2390         * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
2391         add_local_ifunc_entry): Revert last change.
2392         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
2393
2394 2012-10-05  Alan Modra  <amodra@gmail.com>
2395
2396         * powerpc.cc (Target_powerpc::do_plt_address_for_local,
2397         do_plt_address_for_global): New functions.
2398         (Output_data_got_powerpc::do_write): Don't segfault when linking
2399         statically.
2400         (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
2401         add_local_ifunc_entry): Return true on adding entry..
2402         (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
2403         glink->add_entry call.  Remove unused symtab param.  Adjust calls.
2404         (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
2405         (Target_powerpc::make_iplt_section): Remove symtab param.  Don't
2406         set up symbols here.
2407         (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
2408         syms here.  Do so even when no .iplt.  Don't segfault when linking
2409         statically.
2410         (Output_data_glink::add_entry, find_entry): Rearrange params.  Add
2411         new variants without reloc param.
2412         (Glink_sym_ent::Glink_sym_ent): Likewise.
2413         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
2414         reloc when refs will resolve to plt call stub.
2415         (Target_powerpc::Scan::local): Correct ifunc handling.  Allow
2416         R_PPC_PLTREL24 to resolve locally.
2417         (Target_powerpc::Scan::global): Correct ifunc handling.
2418         (Target_powerpc::Relocate::relocate): Correct local sym glink
2419         lookup.  Don't destroy "value" when we have a plt call stub,
2420         and when checking plt call validity.
2421         (Target_powerpc::do_dynsym_value): Simplify.
2422
2423 2012-10-05  Alan Modra  <amodra@gmail.com>
2424
2425         * i386.cc (Output_data_plt_i386::address_for_global,
2426         address_for_local): Add plt offset to returned value.  Adjust uses.
2427         * sparc.cc (Output_data_plt_sparc::address_for_global,
2428         address_for_local): Likewise.
2429         * tilegx.cc (Output_data_plt_tilegx::address_for_global,
2430         address_for_local): Likewise.
2431         * x86_64.cc (Output_data_plt_x86_64::address_for_global,
2432         address_for_local): Likewise.
2433         * target.h (Target::plt_address_for_global, plt_address_for_local):
2434         Update comment.
2435         * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
2436         (Output_data_got::Got_entry::write): Nor here.
2437         * output.h: Comment fix.
2438
2439 2012-10-02  Jiong Wang  <jiwang@tilera.com>
2440
2441         * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
2442         global_offset_table_ value for larget got.
2443         (Target_tilegx::Relocate::relocate): Handle adjusted got value.
2444
2445 2012-09-29  Alan Modra  <amodra@gmail.com>
2446
2447         * powerpc.cc (Target_powerpc::iplt_): New output section.
2448         (Target_powerpc::iplt_section, make_iplt_section,
2449         reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
2450         (Target_powerpc::make_plt_entry): Handle ifunc syms.
2451         Target_powerpc::plt_entry_count): Count iplt entries too.
2452         (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
2453         reloc section in constructor.  New params.
2454         (Target_powerpc::make_plt_section): Create reloc section here instead.
2455         (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
2456         functions.
2457         (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
2458         (Output_data_glink::add_entry, find_entry): New functions to
2459         deal with local syms.
2460         (Glink_sym_ent): Add support for local syms.
2461         (Output_data_glink::do_write): Handle ifunc plt entries.
2462         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
2463         (Target_powerpc::Scan::local, global): Handle ifunc syms.
2464         (Target_powerpc::Relocate::relocate): Likewise.
2465         (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
2466
2467 2012-09-25  Alan Modra  <amodra@gmail.com>
2468
2469         * object.h (Sized_relobj_file::adjust_local_symbol,
2470         do_adjust_local_symbol): New functions.
2471         * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
2472         * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
2473         (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
2474         and irregular opd entry spacing.
2475         (Powerpc_relobj::do_read_relocs): Add opd size checks.
2476         (Global_symbol_visitor_opd): New functor.
2477         (Target_powerpc::do_finalize_sections): Omit global symbols defined
2478         on deleted opd entries.
2479
2480 2012-09-15  Jiong Wang  <jiwang@tilera.com>
2481
2482         * tilegx.cc: New file.
2483         * Makefile.am (TARGETSOURCES): Add tilegx.cc
2484         (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
2485         * configure.tgt: Add entries for tilegx*.
2486         * configure.ac: Likewise.
2487         * Makefile.in: Rebuild.
2488         * configure: Likewise.
2489         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
2490         tilegx.
2491
2492 2012-09-13  Alan Modra  <amodra@gmail.com>
2493
2494         * target-reloc.h (scan_relocs): Call scan.local for relocs
2495         against symbols in discarded sections.  Pass is_discarded
2496         param.
2497         * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
2498         Add is_discarded param.
2499         * powerpc (Target_powerpc::Scan::local): Likewise.  Use
2500         is_discarded to flag opd entry as discarded.  Don't emit dyn
2501         relocs on such entries.
2502         (Target_powerpc::Scan::global): Similarly detect and handle
2503         such opd entries.
2504         (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
2505         opd_ent_.  Update all uses.
2506         (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
2507         (Target_powerpc::relocate_section): Zero out discarded opd
2508         entry relocs.
2509
2510 2012-09-12  Ian Lance Taylor  <iant@google.com>
2511
2512         PR gold/14570
2513         * output.cc: Rename Output_data_got template parameter from size
2514         to got_size for all functions.  Compile all variants of
2515         Output_data_got.
2516         (Output_data_got::Got_entry::write): Correct use of size for
2517         symbol value.  Use local_is_tls rather than casting to
2518         Sized_relobj_file.
2519         * object.h (class Object): Add local_is_tls and do_local_is_tls.
2520         (class Sized_relobj_file): Add do_local_is_tls.
2521         * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
2522
2523 2012-09-11  Alan Modra  <amodra@gmail.com>
2524
2525         PR gold/14566
2526         * layout.cc (Layout::set_segment_offsets): When using
2527         common-page-size alignment, ensure we are on a new max-page-size
2528         page.
2529         * output.cc (Output_segment::set_section_addresses): Use
2530         abi_pagesize, not common_pagesize for relro boundary.
2531         (Output_segment::set_offset): Likewise.
2532
2533 2012-09-11  Alan Modra  <amodra@gmail.com>
2534
2535         * output.h (Output_data_got::add_global_tls, add_local_tls,
2536         add_local_tls_pair): New functions.
2537         (Output_data_got::add_local_pair_with_rel): Remove second
2538         reloc param.  Expand comment.
2539         (Output_data_got::Got_entry): Rename use_plt_offset_ to
2540         use_plt_or_tls_offset_, similarly for constructor param.
2541         (Output_data_got::Got_entry::write): Add got_index param.
2542         * output.cc (Output_data_got::add_global_tls, add_local_tls,
2543         add_local_tls_pair): New functions.
2544         (Output_data_got::Got_entry::write): Handle tls symbols
2545         with use_plt_or_tls_offset_ set specially.
2546         (Output_data_got::add_local_pair_with_rel): Only one reloc.
2547         (Output_data_got::do_write): Replace iterator with index, pass
2548         index to entry write function.
2549         * target.h (Target::tls_offset_for_local, tls_offset_for_global,
2550         do_tls_offset_for_local, do_tls_offset_for_global): New functions.
2551         * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
2552         call.
2553         * i386.cc (Target_i386::Scan::local): Likewise.
2554         * sparc.cc (Target_sparc::Scan::local): Likewise.
2555         * x86_64.cc (Target_x86_64::Scan::local): Likewise.
2556         * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
2557         do_tls_offset_for_global): New functions.
2558         (Target_powerpc::Scan::local): Correct TLS relocations and got
2559         entry values.
2560         (Target_powerpc::Scan::global): Don't emit unnecessary
2561         dynamic relocations on TLS GOT entries.
2562
2563 2012-09-10  Matthias Klose  <doko@ubuntu.com>
2564
2565         * config.in: Disable sanity check for kfreebsd.
2566
2567 2012-09-10  Sterling Augustine  <saugustine@google.com>
2568
2569         * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
2570         (Gdb_index::pubtypes_read): New parameter.
2571         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
2572         to calls.
2573         * gdb-index.h (Gdb_index): New fields pubnames_object_ and
2574         pubtypes_object_.
2575
2576 2012-09-09  Alan Modra  <amodra@gmail.com>
2577
2578         * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
2579         (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
2580         * gc.h (gc_process_relocs): Call target gc_add_reference.
2581         * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
2582         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
2583         (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
2584         unnecessary cast.
2585         * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
2586         to cater for when we don't need code offset.  Update use.
2587         (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
2588         (Powerpc_relobj::access_from_map, add_reference, opd_valid,
2589         set_opd_valid): New functions.
2590         (Target_powerpc::do_gc_add_reference): New function.
2591         (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
2592         stashed refs.
2593         (Target_powerpc::do_gc_mark_symbol): New function.
2594
2595 2012-09-06  Cary Coutant  <ccoutant@google.com>
2596
2597         * dwarf_reader.cc (Dwarf_die::read_attributes): Add
2598         DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
2599         (Dwarf_die::skip_attributes): Likewise.
2600         * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
2601         * testsuite/gdb_index_test.cc (inline_func_1): New function.
2602         (main): Call it.
2603         * testsuite/gdb_index_test_comm.sh: Check index for inline function.
2604
2605 2012-09-05  H.J. Lu  <hongjiu.lu@intel.com>
2606
2607         * testsuite/script_test_3.t: Add .got.plt output section
2608         statement.
2609         * testsuite/script_test_4.t: Likewise.
2610
2611 2012-09-05  Alan Modra  <amodra@gmail.com>
2612
2613         * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
2614         update all uses and lose "enum" when using type.
2615
2616 2012-09-05  Alan Modra  <amodra@gmail.com>
2617
2618         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
2619         * configure: Regenerate.
2620         * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
2621         (plugin_final_layout.stdout): Likewise.
2622         (memory_test): Set page sizes to 0x1000.
2623         * testsuite/Makefile.in: Regenerate.
2624         * testsuite/discard_locals_test.sh: Add FIXME comment.
2625         * testsuite/justsyms_exec.c: Disable function test for powerpc64.
2626         * testsuite/pr14265.t: Add .got output section statement.
2627         * testsuite/script_test_2.t: Likewise.
2628         * testsuite/script_test_3.t: Likewise.
2629         * testsuite/script_test_4.t: Likewise.
2630         * testsuite/script_test_5.t: Likewise.
2631         * testsuite/script_test_6.t: Likewise.
2632         * testsuite/script_test_7.t: Likewise.
2633         * testsuite/script_test_9.t: Likewise.
2634
2635 2012-09-05  Alan Modra  <amodra@gmail.com>
2636
2637         * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
2638         (Powerpc_relocate_functions::Status): New typedef.
2639         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
2640         (Target_powerpc::Scan::local): Handle REL64.
2641         (Target_powerpc::Scan::global): Likewise, and dynamic relocs
2642         for REL32 and REL64.
2643         (Target_powerpc::symval_for_branch): New function, extracted from..
2644         (Target_powerpc::Relocate::relocate): ..here.  Correct plt call
2645         checks.  Report overflow errors.
2646
2647 2012-09-05  Alan Modra  <amodra@gmail.com>
2648
2649         * object.h (Sized_relobj_file::emit_relocs): Delete.
2650         (Sized_relobj_file::emit_relocs_reltype): Delete.
2651         * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
2652         relocate_relocs for --emit-relocs.
2653         (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
2654         * output.h: Update comment.
2655         (Output_segment::first_section): New function.
2656         (Output_segment::first_section_load_address): Use first_section.
2657         * output.cc (Output_segment::first_section): New function extracted..
2658         (Output_segment::first_section_load_address): ..from here.  Delete.
2659         * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
2660         * target.h (Sized_target::relocate_for_relocatable): Likewise.
2661         * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
2662         adjust call to target.h function.
2663         * i386.cc (Target_i386): Likewise.
2664         * sparc.cc (Target_sparc): Likewise.
2665         * x86_64.cc (Target_x86_64): Likewise.
2666         * powerpc.cc (Target_powerpc): Likewise.
2667         (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS.  Ensure
2668         first tls section has section symbol for optimised local dynamic
2669         output relocs.
2670         (Target_powerpc::Relocate::relocate): Correct local dynamic value.
2671         (Target_powerpc::relocate_relocs): Adjust relocs emitted for
2672         optimised tls code.
2673         * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
2674         Rename to relocate_relocs.  Update error message.
2675
2676 2012-09-04  Andreas Schwab  <schwab@linux-m68k.org>
2677
2678         * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
2679         --just-symbols.
2680
2681 2012-08-31  Alan Modra  <amodra@gmail.com>
2682
2683         * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
2684         (Powerpc_relobj::toc_base_offset): New stub function.
2685         (Target_powerpc): Add tp_offset, dtp_offset.  Rename
2686         got_mod_index_offset to tlsld_got_offset.  Update all refs.
2687         (Target_powerpc::Relocate::enum skip_tls): New.
2688         (Target_powerpc::call_tls_get_addr_): New var.
2689         (Target_powerpc::is_branch_reloc): Move to file scope.
2690         (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
2691         (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
2692         New functions.
2693         (Target_powerpc::enum Got_type): Delete old values, add new ones.
2694         (powerpc_info): Correct common_pagesize for ppc64.
2695         (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
2696         (Powerpc_relocate_functions): Add overflow check enums and functions.
2697         Add non-shift version of rela, rela_ua.  Delete all rel public
2698         functions.  Delete addr16_lo.  Add addr64, addr64_u, addr32,
2699         addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
2700         addr16_ha3, addr14 functions.
2701         (Output_data_got_powerpc::add_constant_pair): New function.
2702         (Output_data_got_powerpc::got_base_offset): Likewise.
2703         (Output_data_got_powerpc::do_write): Correct 64-bit got header.
2704         (instruction constants): Sort, add some more.
2705         (Output_data_glink::do_write): Add and use Address typedef.  Use
2706         object->toc_base_offset() stub for 64-bit.
2707         (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
2708         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
2709         (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
2710         for R_PPC64_TOC.  Handle more relocs.  Generate got entries for TLS.
2711         Always treat .opd relocs as against locally defined symbol.
2712         Correct condition for RELATIVE relocs.
2713         (Target_powerpc::do_finalize_sections): Test for NULL sections.
2714         (Target_powerpc::Relocate::relocate): Use plt call stub as value
2715         for 32-bit syms with a plt entry.  Correct ppc64 toc base
2716         calculations.  Handle TLS relocs, and more.  Add overflow
2717         checking and adjust for Powerpc_relocate_functions changes.
2718         (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
2719         Reinstate --emit-relocs code with FIXME.
2720
2721 2012-08-30  Alan Modra  <amodra@gmail.com>
2722
2723         * layout.cc (Layout::set_segment_offsets): Set p_align to
2724         abi_pagesize, not common_pagesize.
2725         (Layout::relaxation_loop_body): Similarly use abi_pagesize
2726         to determine whether file header can go in segment.
2727
2728 2012-08-30  Alan Modra  <amodra@gmail.com>
2729
2730         * output.h (Output_reloc::Output_reloc <output section>): Add
2731         is_relative param.  Adjust calls.
2732         (Output_reloc::add_output_section_relative): New functions.
2733         * output.cc (Output_reloc::Output_reloc <output section>): Handle
2734         is_relative.
2735         (Output_reloc::symbol_value): Handle SECTION_CODE.
2736
2737 2012-08-24  Sriraman Tallam  <tmsriram@google.com>
2738
2739         * gold.cc (queue_middle_tasks): Call layout again when unique
2740         segments for sections is desired.
2741         * layout.cc (Layout::Layout): Initialize new members.
2742         (Layout::get_output_section_flags): New function.
2743         (Layout::choose_output_section): Call get_output_section_flags.
2744         (Layout::layout): Make output section for mapping to a unique segment.
2745         (Layout::insert_section_segment_map): New function.
2746         (Layout::attach_allocated_section_to_segment): Make unique segment for
2747         output sections marked so.
2748         (Layout::segment_precedes): Check for unique segments when sorting.
2749         * layout.h (Layout::Unique_segment_info): New struct.
2750         (Layout::Section_segment_map): New typedef.
2751         (Layout::insert_section_segment_map): New function.
2752         (Layout::get_output_section_flags): New function.
2753         (Layout::is_unique_segment_for_sections_specified): New function.
2754         (Layout::set_unique_segment_for_sections_specified): New function.
2755         (Layout::unique_segment_for_sections_specified_): New member.
2756         (Layout::section_segment_map_): New member.
2757         * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
2758         Rename is_gc_pass_one to is_pass_one.
2759         Rename is_gc_pass_two to is_pass_two.
2760         Rename is_gc_or_icf to is_two_pass.
2761         Check for which pass based on whether symbols data is present.
2762         Make it two pass when unique segments for sections is desired.
2763         * output.cc (Output_section::Output_section): Initialize new
2764         members.
2765         * output.h (Output_section::is_unique_segment): New function.
2766         (Output_section::set_is_unique_segment): New function.
2767         (Output_section::is_unique_segment_): New member.
2768         (Output_section::extra_segment_flags): New function.
2769         (Output_section::set_extra_segment_flags): New function.
2770         (Output_section::extra_segment_flags_): New member.
2771         (Output_section::segment_alignment): New function.
2772         (Output_section::set_segment_alignment): New function.
2773         (Output_section::segment_alignment_): New member.
2774         (Output_segment::Output_segment): Initialize is_unique_segment_.
2775         (Output_segment::is_unique_segment): New function.
2776         (Output_segment::set_is_unique_segment): New function.
2777         (Output_segment::is_unique_segment_): New member.
2778         * plugin.cc (allow_unique_segment_for_sections): New function.
2779         (unique_segment_for_sections): New function.
2780         (Plugin::load): Add new functions to transfer vector.
2781         * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
2782         * Makefile.in: Regenerate.
2783         * testsuite/plugin_final_layout.sh: Check if unique segment
2784         functionality works.
2785         * testsuite/plugin_section_order.c (onload): Check if new interfaces
2786         are available.
2787         (allow_unique_segment_for_sections): New global.
2788         (unique_segment_for_sections): New global.
2789         (claim_file_hook): Call allow_unique_segment_for_sections.
2790         (all_symbols_read_hook): Call unique_segment_for_sections.
2791
2792 2012-08-22  Cary Coutant  <ccoutant@google.com>
2793
2794         * layout.cc (Layout::include_section): Don't assert on GROUP
2795         sections with --emit-relocs.
2796
2797 2012-08-21  Cary Coutant  <ccoutant@google.com>
2798
2799         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
2800         if --export-dynamic-symbol names an undef symbol.
2801
2802 2012-08-18  Alan Modra  <amodra@gmail.com>
2803
2804         * powerpc.cc: Formatting and white space.
2805         (Powerpc_relobj): Rename got2_section_ to special_.
2806         Add opd_ent_shndx_ and opd_ent_off_ vectors.
2807         (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
2808         scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
2809         (Target_powerpc): Add Address typedef and invalid_address.  Use
2810         throughout.
2811         (Target_powerpc::is_branch_reloc): New function.
2812         (Powerpc_relocate_functions): Add Address typedef, use throughout.
2813         (Powerpc_relocate_functions:rela, rela_ua): Correct type used
2814         for dst_mask, value and addend.
2815         (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
2816         (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
2817         (Output_data_glink::do_write): Correct toc base.  Don't try to use
2818         uint16_t for 24-bit offset.  Use get_output_section_offset and
2819         check return.
2820         (Target_powerpc::Scan::local): Handle more relocs.
2821         (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
2822         (Target_powerpc::Relocate::relocate): Correct toc base calculation.
2823         Plug in toc restoring insn after plt calls.  Translate branches
2824         to function descriptor symbols to corresponding entry point.
2825         (Target_powerpc::relocate_for_relocatable): Check return from
2826         get_output_section_offset.
2827         * symtab.h: Comment typo.
2828
2829 2012-08-14  Ian Lance Taylor  <iant@google.com>
2830
2831         * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
2832         unsupported_relocal_local to call unsupported_reloc_global.
2833
2834 2012-08-14  Nick Clifton  <nickc@redhat.com>
2835
2836         PR ld/14265
2837         * script-sections.cc (Sections_element::output_section_name): Add
2838         keep return parameter.
2839         (Output_section_element::match_name): Add keep return parameter.
2840         Return the value of the keep_ member.
2841         * script-sections.h (class Output_section): Update
2842         output_section_name prototype.
2843         * layout.cc (Layout::keep_input_section): New public member
2844         function.
2845         (Layout::choose_output_section): Pass keep parameter to
2846         output_section_name.
2847         * layout.h (class Layout): Add keep_input_section.
2848         * object.cc (Sized_relobj_file::do_layout): Check for kept input
2849         sections.
2850         * testsuite/Makefile.am: Add a test.
2851         * testsuite/Makefile.in: Regenerate.
2852         * testsuite/pr14265.c: Source file for the test.
2853         * testsuite/pr14265.t: Linker script for the test.
2854         * testsuite/pr14265.sh: Shell script for the test.
2855
2856 2012-08-14  Alan Modra  <amodra@gmail.com>
2857
2858         * target.h (Target::output_section_name): New function.
2859         (Target::do_output_section_name): New function.
2860         * layout.cc (Layout::choose_output_section): Call the above.
2861         * powerpc.cc (Target_powerpc::do_output_section_name): New function.
2862
2863 2012-08-14  Alan Modra  <amodra@gmail.com>
2864
2865         * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
2866         (Output_data_got_powerpc::do_write): Don't rely on base class lookup
2867         for replace_constant call.
2868         (Output_data_plt_powerpc::do_print_to_mapfile): New function.
2869         (Output_data_glink::do_print_to_mapfile): New function.
2870         (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
2871         (Target_powerpc::Relocate::relocate): Likewise.
2872
2873 2012-08-14  Alan Modra  <amodra@gmail.com>
2874
2875         * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
2876         (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
2877         (Output_data_glink::add_entry,find_entry): Remove shndx param.
2878         (class Glink_sym_ent): Rename from struct Glink_sym_ent.  Remove
2879         all references to shndx_.  Handle special case for R_PPC_PLTREL24
2880         here.
2881         (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
2882         (Output_data_glink::do_write): Retrieve got2_shdnx from object.
2883         (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
2884         here.
2885         (Target_powerpc::Scan::global): Nor on make_plt_entry call.
2886         (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
2887
2888 2012-08-12  Alan Modra  <amodra@gmail.com>
2889
2890         * powerpc.cc: Whitespace fixes.  Wrap overly long lines.
2891         (glink insn constants): Use uint32_t.
2892         (Output_data_glink::add_entry): Use insert, not [] operator.
2893
2894 2012-08-11  Alan Modra  <amodra@gmail.com>
2895
2896         * object.h (Sized_relobj_file::find_shdr): New function.
2897         (Sized_relobj_file::find_special_sections): New function.
2898         * object.cc (Sized_relobj_file::find_shdr): New function.
2899         (Sized_relobj_file::find_eh_frame): Use find_shdr.
2900         (Sized_relobj_file::find_special_sections): New function, split out..
2901         (Sized_relobj_file::do_read_symbols): ..from here.
2902         * output.h (Output_data_got::replace_constant): New function.
2903         (Output_data_got::num_entries): New function.
2904         (Output_data_got::last_got_offset,set_got_size): Use num_entries.
2905         (Output_data_got::got_offset): Protected rather than private.
2906         (Output_data_got::replace_got_entry): New function.
2907         * output.cc (Output_data_got::replace_got_entry): New function.
2908         * powerpc.cc (class Powerpc_relobj): New.
2909         (class Powerpc_relocate_functions): Delete all psymval variants or
2910         convert to value,addend type.  Delete pcrela, pcrela_unaligned.
2911         Implement _ha functions using corresponding _hi function.
2912         (Powerpc_relobj::find_special_sections): New function.
2913         (Target_powerpc::do_make_elf_object): New function.
2914         (class Output_data_got_powerpc): New.
2915         (class Output_data_glink): New.
2916         (class Powerpc_scan_relocatable_reloc): New.
2917         Many more changes througout file.
2918
2919 2012-08-09  Nick Clifton  <nickc@redhat.com>
2920
2921         * po/vi.po: Updated Vietnamese translation.
2922
2923 2012-08-07  Ian Lance Taylor  <iant@google.com>
2924
2925         * layout.cc (Layout::add_target_dynamic_tags): If
2926         dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
2927         plt_rel.
2928
2929 2012-07-30  Nick Clifton  <nickc@redhat.com>
2930
2931         * po/gold.pot: Updated template.
2932         * po/es.po: Updated Spanish translation.
2933
2934 2012-07-18  Cary Coutant  <ccoutant@google.com>
2935
2936         PR gold/14344
2937         * configure.ac: Add check for -gpubnames support.
2938         * configure: Regenerate.
2939         * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
2940         support; force -gno-pubnames.
2941         (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
2942         support.
2943         (gdb_index_test_4): New test.
2944         * testsuite/Makefile.in: Regenerate.
2945         * testsuite/gdb_index_test_1.sh: Refactor code into common file.
2946         * testsuite/gdb_index_test_2.sh: Likewise.
2947         * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
2948         * testsuite/gdb_index_test_4.sh: New script.
2949         * testsuite/gdb_index_test_comm.sh: New script with common code;
2950         don't look for space after colon.
2951
2952 2012-07-16  Sriraman Tallam  <tmsriram@google.com>
2953
2954         * gold.cc (queue_middle_tasks): Update function order only after
2955         deferred objects due to plugins are processed.
2956
2957 2012-07-11  Ian Lance Taylor  <iant@google.com>
2958
2959         * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
2960         (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
2961         (Target_arm::scan_reloc_for_stub): Likewise.
2962         * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
2963         * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
2964         * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
2965         * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
2966         * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
2967
2968 2012-07-10  Dodji Seketeli  <dodji@redhat.com>
2969             Ian Lance Taylor  <iant@google.com>
2970
2971         PR gold/14309
2972         * configure.ac: Test whether std::tr1::hash<off_t> works.
2973         * gold.h: Add a specialization for std::tr1::hash<off_t> if
2974         needed.
2975         * output.h (class Output_fill): Add virtual destructor.
2976         * configure, config.in: Rebuild.
2977
2978 2012-06-22  Roland McGrath  <mcgrathr@google.com>
2979
2980         * layout.cc (finalize): Define __ehdr_start symbol if applicable.
2981
2982 2012-06-12  Rafael Ávila de Espíndola <respindola@mozilla.com>
2983
2984         * plugin.cc (Plugin::load): Handle position independent executables.
2985
2986 2012-06-06  Cary Coutant  <ccoutant@google.com>
2987
2988         * layout.cc (gdb_sections): Remove ".debug_" prefixes,
2989         add .debug_macro.
2990         (lines_only_debug_sections): Likewise.
2991         (gdb_fast_lookup_sections): New static array.
2992         (is_gdb_debug_section): Rename formal parameter.
2993         (is_lines_only_debug_section): Likewise.
2994         (is_gdb_fast_lookup_section): New function.
2995         (Layout::include_section): Check for ".zdebug_" prefix; pass
2996         section name suffix to is_gdb_debug_section, et al.; check for
2997         fast-lookup sections when building .gdb_index.
2998         * options.h (--strip-debug-gdb): Update GDB version number.
2999
3000 2012-06-06  Cary Coutant  <ccoutant@google.com>
3001
3002         * configure.ac: Add check for fallocate.
3003         * configure: Regenerate.
3004         * config.in: Regenerate.
3005
3006         * options.h (class General_options): Add --mmap-output-file and
3007         --posix-fallocate options.
3008         * output.cc: (posix_fallocate): Remove; replace with...
3009         (gold_fallocate): New function.
3010         (Output_file::map_no_anonymous): Call gold_fallocate.
3011         (Output_file::map): Check --mmap-output-file option.
3012
3013 2012-06-05  Jing Yu  <jingyu@google.com>
3014
3015         * gold.h (textdomain): Add do {} to empty while(0).
3016         (bindtextdomain): Likewise.
3017
3018 2012-06-04  Cary Coutant  <ccoutant@google.com>
3019
3020         * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
3021         has_dynsym_index.
3022
3023 2012-05-25  Sriraman Tallam  <tmsriram@google.com>
3024
3025         * symtab.cc (Symbol_table::define_special_symbol):
3026         Initialize *poldsym to prevent uninitialized variable errors.
3027
3028 2012-05-23  Cary Coutant  <ccoutant@google.com>
3029
3030         * layout.cc (Layout::section_name_mapping): Add rules to handle
3031         exact match on .data.rel.ro.local or .data.rel.ro.
3032         (Layout::output_section_name): Check for exact matches.
3033
3034 2012-05-23  Cary Coutant  <ccoutant@google.com>
3035
3036         * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
3037         more carefully.
3038
3039 2012-05-22  Cary Coutant  <ccoutant@google.com>
3040
3041         * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
3042         object before exporting symbol.
3043
3044 2012-05-21  H.J. Lu  <hongjiu.lu@intel.com>
3045
3046         * testsuite/tls_test.cc: Include "config.h" first.
3047         * testsuite/tls_test_c.c: Likewise.
3048
3049 2012-05-17  Daniel Richard G.  <skunk@iskunk.org>
3050             Nick Clifton  <nickc@redhat.com>
3051
3052         PR 14072
3053         * configure.in: Add check that sysdep.h has been included before
3054         any system header files.
3055         * configure: Regenerate.
3056         * config.in: Regenerate.
3057
3058 2012-05-14  Cary Coutant  <ccoutant@google.com>
3059
3060         * layout.cc (Layout::make_output_section): Mark .tdata section
3061         as RELRO.
3062         * testsuite/relro_test.cc: Add a TLS variable.
3063
3064 2012-05-10  H.J. Lu  <hongjiu.lu@intel.com>
3065
3066         PR gold/14091
3067         * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
3068         R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
3069         R_X86_64_64.
3070
3071 2012-05-08  Cary Coutant  <ccoutant@google.com>
3072
3073         * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
3074         (lines_only_debug_sections): Likewise.
3075
3076 2012-05-02  Roland McGrath  <mcgrathr@google.com>
3077
3078         * nacl.cc: New file.
3079         * nacl.h: New file.
3080         * Makefile.am (CCFILES, HFILES): Add them.
3081         * Makefile.in: Regenerate.
3082         * i386.cc (Output_data_plt_i386_nacl): New class.
3083         (Output_data_plt_i386_nacl_exec): New class.
3084         (Output_data_plt_i386_nacl_dyn): New class.
3085         (Target_i386_nacl): New class.
3086         (Target_selector_i386_nacl): New class.
3087         (target_selector_i386): Use it instead of Target_selector_i386.
3088         * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
3089         (Target_x86_64_nacl): New class.
3090         (Target_selector_x86_64_nacl): New class.
3091         (target_selector_x86_64, target_selector_x32): Use it instead of
3092         Target_selector_x86_64.
3093         * arm.cc (Output_data_plt_arm_nacl): New class.
3094         (Target_arm_nacl): New class.
3095         (Target_selector_arm_nacl): New class.
3096         (target_selector_arm, target_selector_armbe): Use it instead of
3097         Target_selector_arm.
3098
3099         * target-select.cc (select_target): Take new Input_file* and off_t
3100         arguments, pass them on to recognize method of selector.
3101         * object.cc (make_elf_sized_object): Update caller.
3102         * parameters.cc (parameters_force_valid_target): Likewise.
3103         * incremental.cc (make_sized_incremental_binary): Likewise.
3104         * target-select.h: Update decl.
3105         (Target_selector::recognize): Take new Input_file* argument,
3106         pass it on to do_recognize.
3107         (Target_selector::do_recognize): Take new Input_file* argument.
3108         * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
3109         * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
3110         * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
3111         * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
3112
3113         * target.h (Target::Target_info): New members isolate_execinstr
3114         and rosegment_gap.
3115         (Target::isolate_execinstr, Target::rosegment_gap): New methods.
3116         * arm.cc (Target_arm::arm_info): Update initializer.
3117         * i386.cc (Target_i386::i386_info): Likewise.
3118         * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
3119         * sparc.cc (Target_sparc::sparc_info): Likewise.
3120         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
3121         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
3122         * layout.cc (Layout::attach_allocated_section_to_segment):
3123         Take new const Target* argument.  If target->isolate_execinstr(), act
3124         like --rosegment.
3125         (Layout::find_first_load_seg): Take new const Target* argument;
3126         if target->isolate_execinstr(), reject PF_X segments.
3127         (Layout::relaxation_loop_body): Update caller.
3128         (Layout::set_segment_offsets): If target->isolate_execinstr(),
3129         reset file offset to zero when we hit LOAD_SEG, and then do a second
3130         loop over the segments before LOAD_SEG to reassign offsets after
3131         addresses have been determined.  Handle target->rosegment_gap().
3132         (Layout::attach_section_to_segment): Take new const Target* argument;
3133         pass it to attach_allocated_section_to_segment.
3134         (Layout::make_output_section): Update caller.
3135         (Layout::attach_sections_to_segments): Take new const Target* argument;
3136         pass it to attach_section_to_segment.
3137         * gold.cc (queue_middle_tasks): Update caller.
3138         * layout.h (Layout): Update method decls with new arguments.
3139
3140         * arm.cc (Target_arm::Target_arm): Take optional argument for the
3141         Target_info pointer to use.
3142         (Target_arm::do_make_data_plt): New virtual method.
3143         (Target_arm::make_data_plt): New method that calls it.
3144         (Target_arm::make_plt_entry): Use it.
3145         (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
3146         for the section alignment.
3147         (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
3148         method.
3149         (Output_data_plt_arm::first_plt_entry_offset): Call it.
3150         (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
3151         method.
3152         (Output_data_plt_arm::get_plt_entry_size): Call it.
3153         (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
3154         (Output_data_plt_arm::fill_plt_entry): New method that calls it.
3155         (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
3156         method.
3157         (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
3158         (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
3159         method instead of sizeof(plt_entry).
3160         (Output_data_plt_arm::add_entry): Likewise.
3161         Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
3162         (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
3163         than static method.
3164         (Target_arm::plt_entry_size): Likewise.
3165         (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
3166         Move to ...
3167         (Output_data_plt_arm_standard): ... here, new class.
3168         (Output_data_plt_arm::do_write): Move guts of PLT filling to...
3169         (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
3170         (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
3171
3172         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
3173         Take additional argument for the PLT entry size.
3174         (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
3175         Use get_plt_entry_size method rather than plt_entry_size variable.
3176         (Output_data_plt_x86_64::reserve_slot): Likewise.
3177         (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
3178         (Output_data_plt_x86_64::add_entry): Likewise.
3179         (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
3180         (Output_data_plt_x86_64::address_for_global): Likewise.
3181         (Output_data_plt_x86_64::address_for_local): Likewise.
3182         (Output_data_plt_x86_64::set_final_data_size): Likewise.
3183         (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
3184         Make method non-static.
3185         (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
3186         method.
3187         (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
3188         (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
3189         (Output_data_plt_x86_64::add_eh_frame): New method to call it.
3190         (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
3191         virtual method.
3192         (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
3193         (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
3194         virtual method.
3195         (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
3196         (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
3197         virtual method.
3198         (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
3199         (Output_data_plt_x86_64::plt_entry_size)
3200         (Output_data_plt_x86_64::first_plt_entry)
3201         (Output_data_plt_x86_64::plt_entry)
3202         (Output_data_plt_x86_64::tlsdesc_plt_entry)
3203         (Output_data_plt_x86_64::plt_eh_frame_fde_size)
3204         (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
3205         (Output_data_plt_x86_64_standard): ... here, new class.
3206         (Target_x86_64::Target_x86_64): Take optional argument for the
3207         Target_info pointer to use.
3208         (Target_x86_64::do_make_data_plt): New virtual method.
3209         (Target_x86_64::make_data_plt): New method to call it.
3210         (Target_x86_64::init_got_plt_for_update): Use that.
3211         Call this->plt_->add_eh_frame method here.
3212         (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
3213         (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
3214         rather than static method.
3215         (Target_x86_64::plt_entry_size): Likewise.
3216         (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
3217         rather than plt_entry_size variable.  Move guts of PLT filling to...
3218         (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
3219         (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
3220         (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
3221
3222         * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
3223         additional argument for the section alignment.
3224         Don't do add_eh_frame_for_plt here.
3225         (Output_data_plt_i386::first_plt_entry_offset): Make the method
3226         non-static.  Use get_plt_entry_size method rather than plt_entry_size
3227         variable.
3228         (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
3229         method.
3230         (Output_data_plt_i386::get_plt_entry_size): Call it.
3231         (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
3232         (Output_data_plt_i386::add_eh_frame): New method to call it.
3233         (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
3234         method.
3235         (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
3236         (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
3237         method.
3238         (Output_data_plt_i386::fill_plt_entry): New method to call it.
3239         (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
3240         method instead of plt_entry_size.
3241         (Output_data_plt_i386::plt_entry_size)
3242         (Output_data_plt_i386::plt_eh_frame_fde_size)
3243         (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
3244         (Output_data_plt_i386_standard): ... here, new class.
3245         (Output_data_plt_i386_exec): New class.
3246         (Output_data_plt_i386::exec_first_plt_entry): Move to ...
3247         (Output_data_plt_i386_exec::first_plt_entry): ... here.
3248         (Output_data_plt_i386::exec_plt_entry): Move to ...
3249         (Output_data_plt_i386_exec::plt_entry): ... here.
3250         (Output_data_plt_i386_dyn): New class.
3251         (Output_data_plt_i386::first_plt_entry): Move to ...
3252         (Output_data_plt_i386_dyn::first_plt_entry): ... here.
3253         (Output_data_plt_i386::dyn_plt_entry): Move to ...
3254         (Output_data_plt_i386_dyn::plt_entry): ... here.
3255         (Target_i386::Target_i386): Take optional argument for the Target_info
3256         pointer to use.
3257         (Target_i386::do_make_data_plt): New virtual method.
3258         (Target_i386::make_data_plt): New method to call it.
3259         (Target_i386::make_plt_section): Use that.
3260         Call this->plt_->add_eh_frame method here.
3261         (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
3262         rather than plt_entry_size variable.
3263         (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
3264         (Output_data_plt_i386::address_for_local): Likewise.
3265         (Output_data_plt_i386::do_write): Likewise.
3266         Move guts of PLT filling to...
3267         (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
3268         (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
3269         (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
3270         (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
3271
3272 2012-05-01  Cary Coutant  <ccoutant@google.com>
3273
3274         * dwarf_reader.cc (Dwarf_die::read_attributes)
3275         (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
3276         (Dwarf_die::uint_attribute): Remove DW_FORM_null.
3277         * reduced_debug_output.cc
3278         (Output_reduced_debug_info_section::get_die_end): Remove
3279         DW_FORM_GNU_ref_index.  Add default case.
3280
3281 2012-04-26  Mark Wielaard  <mjw@redhat.com>
3282
3283         * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
3284         * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
3285         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
3286         DW_AT_high_pc as offset from DW_AT_low_pc.
3287
3288         * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
3289         * testsuite/Makefile.in: Regenerate.
3290         * testsuite/gdb_index_test_3.c: New test source file.
3291         * testsuite/gdb_index_test_3.sh: New test source file.
3292
3293 2012-04-25  Ian Lance Taylor  <iant@google.com>
3294
3295         * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
3296         pointer.
3297         (Stub_addend_reader::operator()): Declare Arm_relocate_functions
3298         as a class, not a struct.
3299         (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
3300         (Target_arm::apply_cortex_a8_workaround): Likewise.
3301         * gc.h: Declare Reloc_types as a struct, not a class.
3302         * object.h: Declare Symbols_data as a struct.
3303         * reloc.h: Declare Read_relocs_data as a struct.
3304         * target.h: Declare Relocate_info as a struct.
3305
3306 2012-04-24  David S. Miller  <davem@davemloft.net>
3307
3308         * sparc.cc (Target_sparc::Relocate::relax_call): New function.
3309         (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
3310         and R_SPARC_WPLT30.
3311
3312 2012-04-24  Cary Coutant  <ccoutant@google.com>
3313
3314         * incremental-dump.cc (find_input_containing_global): Replace
3315         magic number with symbolic constant.
3316         (dump_incremental_inputs): Update version number.
3317         * incremental.cc (Output_section_incremental_inputs): Update version
3318         number; import symbolic constants from Incremental_inputs_reader.
3319         (Incremental_inputs::create_data_sections): Align relocations
3320         section correctly for 64-bit targets.
3321         (Output_section_incremental_inputs::set_final_data_size): Use symbolic
3322         constants; add padding.
3323         (Output_section_incremental_inputs::write_header): Add assert for
3324         header_size.
3325         (Output_section_incremental_inputs::write_input_files): Add assert
3326         for input_entry_size.
3327         (Output_section_incremental_inputs::write_info_blocks): Add padding;
3328         add assert for object_info_size, input_section_entry_size,
3329         global_sym_entry_size.
3330         * incremental.h (Incremental_inputs_reader): Add symbolic constants
3331         for data structure sizes; use them.
3332         (Incremental_input_entry_reader): Import symbolic constants from
3333         Incremental_inputs_reader; use them.
3334
3335 2012-04-23  David S. Miller  <davem@davemloft.net>
3336
3337         * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
3338         and elf_flags_set_.
3339         (Target_sparc::Target_sparc): Initialize new fields.
3340         (Target_sparc::do_make_elf_object): New function.
3341         (Target_sparc::do_adjust_elf_header): New function.
3342
3343 2012-04-23  Cary Coutant  <ccoutant@google.com>
3344
3345         * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
3346         CU range table of gdb index.
3347
3348 2012-04-20  David S. Miller  <davem@davemloft.net>
3349
3350         * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
3351         instead of false.
3352
3353 2012-04-16  David S. Miller  <davem@davemloft.net>
3354
3355         * sparc.cc (Target_sparc::got_address): New function.
3356         (Sparc_relocate_functions::gdop_hix22): New function.
3357         (Sparc_relocate_functions::gdop_lox10): New function.
3358         (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
3359         relocs.
3360         (Target_sparc::Scan::local): Likewise if the global symbol is not
3361         preemptible and is not IFUNC.
3362         (Target_sparc::Relocate::relocate): Perform GOTDATA code
3363         transformations for local and non-preemptible non-IFUNC global
3364         symbols.
3365
3366         * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
3367         writing out 64-bit part of ranges.
3368
3369         * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
3370         -fpic and -fpie respectively.
3371         * Makefile.in: Regenerate.
3372
3373         * sparc.cc (class Target_sparc): Add rela_ifunc_.
3374         (Target_sparc::Target_sparc): Initialize new field.
3375         (Target_sparc::do_plt_section_for_global): New function.
3376         (Target_sparc::do_plt_section_for_local): New function.
3377         (Target_sparc::reloc_needs_plt_for_ifunc): New function.
3378         (Target_sparc::make_plt_section): New function, broken out of
3379         make_plt_entry.  Use ORDER_NON_RELRO_FIRST for ".plt".
3380         (Target_sparc::make_plt_entry): Call make_plt_section.
3381         (Target_sparc::make_local_ifunc_plt_entry): New function.
3382         (Target_sparc::rela_ifunc_section): New function.
3383         (Target_sparc::plt_section): Remove const.
3384         (Output_data_plt_sparc): Update declarations.  Define Global_ifunc
3385         and Local_ifunc types.  Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
3386         and ifunc_count_ fields.
3387         (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
3388         (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
3389         (Output_data_plt_sparc::add_local_ifunc_entry): New function.
3390         (Output_data_plt_sparc::rela_ifunc): New function.
3391         (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
3392         (Output_data_plt_sparc::has_ifunc_section): New function.
3393         (Output_data_plt_sparc::entry_count): Include ifunc_count_.
3394         (Output_data_plt_sparc::address_for_global): New function.
3395         (Output_data_plt_sparc::address_for_local): New function.
3396         (Output_data_plt_sparc::plt_index_to_offset): New function.
3397         (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
3398         and entry_count.
3399         (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
3400         entry_count.
3401         (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
3402         R_SPARC_JMP_IREL to switch.
3403         (Target_sparc::Scan::check_non_pic): Likewise.
3404         (Target_sparc::Scan::local): Handle IFUNC symbols.
3405         (Target_sparc::Scan::local): Likewise.
3406         (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
3407         and plt_address_for_local.
3408         (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
3409         Define __rel_iplt_start and __rel_iplt_end if doing a static link.
3410
3411         * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
3412         (class Output_data_reloc): Adjust calls to Output_reloc_type.
3413         (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
3414         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
3415         global relocs too.
3416         (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
3417         * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
3418         calls.
3419         * sparc.cc (Target_sparc::Scan::global): Likewise.
3420         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
3421
3422 2012-04-16  Cary Coutant  <ccoutant@google.com>
3423
3424         * archive.cc (Library_base::should_include_member): Check for
3425         --export-dynamic-symbol.
3426         * options.h (class General_options): Add --export-dynamic-symbol.
3427         * symtab.cc (Symbol::should_add_dynsym_entry): Check for
3428         --export-dynamic-symbol.
3429         (Symbol_table::gc_mark_undef_symbols): Likewise.
3430         (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
3431
3432 2012-04-12  David S. Miller  <davem@davemloft.net>
3433
3434         * sparc.cc (Reloc::wdisp10): New relocation method.
3435         (Reloc::h34): Likewise.
3436         (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
3437         (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
3438         R_SPARC_WDISP10.
3439         (Target_sparc::Scan::local): Likewise.
3440         (Target_sparc::Scan::global): Likewise.
3441         (Target_sparc::Relocate::relocate): Likewise.
3442
3443 2012-04-09  Cary Coutant  <ccoutant@google.com>
3444
3445         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
3446         low_pc == 0.
3447
3448 2012-04-06  Ian Lance Taylor  <iant@google.com>
3449
3450         * timer.cc: #include <unistd.h>.
3451
3452 2012-04-06  Roland McGrath  <mcgrathr@google.com>
3453
3454         * configure.in (AC_CHECK_HEADERS): Add locale.h.
3455         * config.in: Regenerate.
3456         * configure: Regenerate.
3457
3458 2012-04-05  Nick Clifton  <nickc@redhat.com>
3459
3460         * configure.ac (AC_CHECK_FUNCS): Add setlocale.
3461         (AM_LC_MESSAGES): Add.
3462         * aclocal.m4: Regenerate.
3463         * config.in: Regenerate.
3464         * configure: Regenerate.
3465
3466 2012-03-21  Cary Coutant  <ccoutant@google.com>
3467
3468         * Makefile.am: Add gdb-index.cc, gdb-index.h.
3469         * Makefile.in: Regenerate.
3470         * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
3471         (Sized_elf_reloc_mapper::symbol_section): New function.
3472         (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
3473         (make_elf_reloc_mapper): New function.
3474         (Dwarf_abbrev_table::clear_abbrev_codes): New function.
3475         (Dwarf_abbrev_table::do_read_abbrevs): New function.
3476         (Dwarf_abbrev_table::do_get_abbrev): New function.
3477         (Dwarf_ranges_table::read_ranges_table): New function.
3478         (Dwarf_ranges_table::read_range_list): New function.
3479         (Dwarf_pubnames_table::read_section): New function.
3480         (Dwarf_pubnames_table::read_header): New function.
3481         (Dwarf_pubnames_table::next_name): New function.
3482         (Dwarf_die::Dwarf_die): New function.
3483         (Dwarf_die::read_attributes): New function.
3484         (Dwarf_die::skip_attributes): New function.
3485         (Dwarf_die::set_name): New function.
3486         (Dwarf_die::set_linkage_name): New function.
3487         (Dwarf_die::attribute): New function.
3488         (Dwarf_die::string_attribute): New function.
3489         (Dwarf_die::int_attribute): New function.
3490         (Dwarf_die::uint_attribute): New function.
3491         (Dwarf_die::ref_attribute): New function.
3492         (Dwarf_die::child_offset): New function.
3493         (Dwarf_die::sibling_offset): New function.
3494         (Dwarf_info_reader::check_buffer): New function.
3495         (Dwarf_info_reader::parse): New function.
3496         (Dwarf_info_reader::do_parse): New function.
3497         (Dwarf_info_reader::do_read_string_table): New function.
3498         (Dwarf_info_reader::lookup_reloc): New function.
3499         (Dwarf_info_reader::get_string): New function.
3500         (Dwarf_info_reader::visit_compilation_unit): New function.
3501         (Dwarf_info_reader::visit_type_unit): New function.
3502         (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
3503         Sized_elf_reloc_mapper.
3504         (Sized_dwarf_line_info::symbol_section): Remove function.
3505         (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
3506         (Sized_dwarf_line_info::read_line_mappings): Remove object
3507         parameter, adjust callers.
3508         (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
3509         * dwarf_reader.h: Include <sys/types.h>.
3510         (class Track_relocs): Remove forward declaration.
3511         (class Elf_reloc_mapper): New class.
3512         (class Sized_elf_reloc_mapper): New class.
3513         (class Dwarf_abbrev_table): New class.
3514         (class Dwarf_range_list): New class.
3515         (class Dwarf_ranges_table): New class.
3516         (class Dwarf_pubnames_table): New class.
3517         (class Dwarf_die): New class.
3518         (class Dwarf_info_reader): New class.
3519         (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
3520         (Sized_dwarf_line_info::symbol_section): Remove member function.
3521         * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
3522         base class.
3523         * gdb-index.cc: New source file.
3524         * gdb-index.h: New source file.
3525         * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
3526         and .debug_types sections, call Layout::add_to_gdb_index.
3527         (Sized_relobj_incr::do_section_name): Implement.
3528         (Sized_relobj_incr::do_section_contents): Adjust parameter list and
3529         return type; Implement.
3530         (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
3531         return type.
3532         * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
3533         parameter list and return type.
3534         (Sized_incr_dynobj::do_section_contents): Likewise.
3535         * layout.cc: Include gdb-index.h.
3536         (Layout::Layout): Initialize gdb_index_data_.
3537         (Layout::init_fixed_output_section): Check for .gdb_index section.
3538         (Layout::add_to_gdb_index): New function. Instantiate.
3539         * layout.h: Add forward declaration for class Gdb_index.
3540         (Layout::add_to_gdb_index): New member function.
3541         (Layout::gdb_index_data_): New data member.
3542         * main.cc: Include gdb-index.h.
3543         (main): Print statistics for gdb index.
3544         * object.cc (Object::section_contents): Move code into
3545         do_section_contents.
3546         (need_decompressed_section): Check for sections needed when building
3547         gdb index.
3548         (build_compressed_section_map): Likewise.
3549         (Sized_relobj_file::do_read_symbols): Need local symbols when building
3550         gdb index.
3551         (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
3552         sections; call Layout::add_to_gdb_index.
3553         (Sized_relobj_file::do_decompressed_section_contents): Call
3554         do_section_contents directly.
3555         * object.h (Object::do_section_contents): Adjust parameter list and
3556         return type.
3557         (Object::do_decompressed_section_contents): Call do_section_contents
3558         directly.
3559         (Sized_relobj_file::do_section_contents): Adjust parameter list and
3560         return type.
3561         * options.h (class General_options): Add --gdb-index option.
3562         * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
3563         list and return type.
3564         * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
3565         * reloc.h (Track_relocs::checkpoint): New function.
3566         (Track_relocs::reset): New function.
3567
3568         * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
3569         New test cases.
3570         * testsuite/Makefile.in: Regenerate.
3571         * testsuite/gdb_index_test.cc: New test source file.
3572         * testsuite/gdb_index_test_1.sh: New test source file.
3573         * testsuite/gdb_index_test_2.sh: New test source file.
3574
3575 2012-03-19  Doug Kwan  <dougkwan@google.com>
3576
3577         * arm.cc (Target_arm::do_define_standard_symbols): New method.
3578         (Target_arm::do_finalize_sections): Remove code which defines
3579         __exidx_start and __exidx_end.  Make symbol table parameter
3580         anonymous as it is not used.
3581         * gold.cc (queue_middle_tasks): Call target hook to define any
3582         target-specific symbols.
3583         * target.h (Target::define_standard_symbols): New method.
3584         (Target::do_define_standard_symbols): Same.
3585         * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
3586         * testsuite/Makefile.in: Regenerate.
3587         * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
3588         and __exidx_end.
3589         * testsuite/arm_exidx_test.sh: Check that no unused dynamic
3590         relocations are generated for __exidx_start and __exidx_end.
3591
3592 2012-03-16  Doug Kwan  <dougkwan@google.com>
3593
3594         * testsuite/Makefile.am: Disable test initpri3b.
3595         * testsuite/Makefile.in: Regenerate.
3596
3597 2012-03-15  Doug Kwan  <dougkwan@google.com>
3598
3599         * arm.cc (Target_arm::got_section): Make .got section read-only
3600         if -z now is given.
3601
3602 2012-03-15  Ian Lance Taylor  <iant@google.com>
3603
3604         PR gold/13850
3605         * layout.cc (Layout::make_output_section): Correctly mark
3606         SHT_INIT_ARRAY, et. al., as relro.
3607
3608 2012-03-14  Doug Kwan  <dougkwan@google.com>
3609
3610         * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
3611         dynamic relocations for protected symbols in shared objects.
3612
3613 2012-03-13  Ian Lance Taylor  <iant@google.com>
3614
3615         * resolve.cc (Symbol_table::resolve): When merging common symbols,
3616         keep the larger alignment.
3617
3618 2012-03-12  Cary Coutant  <ccoutant@google.com>
3619
3620         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
3621         handling of DW_LNE_define_file.
3622
3623 2012-03-12  Cary Coutant  <ccoutant@google.com>
3624
3625         * reduced_debug_output.cc
3626         (Output_reduced_debug_info_section::get_die_end): Add new FORM
3627         codes to switch.
3628
3629 2012-02-29  Cary Coutant  <ccoutant@google.com>
3630
3631         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
3632
3633 2012-02-29  Cary Coutant  <ccoutant@google.com>
3634
3635         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
3636         Call Object::decompressed_section_contents.
3637         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
3638         New dtor.
3639         (Sized_dwarf_line_info::buffer_start_): New data member.
3640         * merge.cc (Output_merge_data::do_add_input_section): Call
3641         Object::decompressed_section_contents.
3642         (Output_merge_string::do_add_input_section): Likewise.
3643         * object.cc (need_decompressed_section): New function.
3644         (build_compressed_section_map): Decompress sections needed later.
3645         (Sized_relobj_file::do_decompressed_section_contents): New function.
3646         (Sized_relobj_file::do_discard_decompressed_sections): New function.
3647         * object.h (Object::decompressed_section_contents): New function.
3648         (Object::discard_decompressed_sections): New function.
3649         (Object::do_decompressed_section_contents): New function.
3650         (Object::do_discard_decompressed_sections): New function.
3651         (Compressed_section_info): New type.
3652         (Compressed_section_map): Include decompressed section contents.
3653         (Sized_relobj_file::do_decompressed_section_contents): New function.
3654         (Sized_relobj_file::do_discard_decompressed_sections): New function.
3655
3656 2012-02-16  Cary Coutant  <ccoutant@google.com>
3657
3658         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
3659         * testsuite/Makefile.in: Regenerate.
3660
3661 2012-02-14  Cary Coutant  <ccoutant@google.com>
3662
3663         * options.cc (General_options::finalize): Disallow -pie and -static.
3664
3665 2012-02-03  Doug Kwan  <dougkwan@google.com>
3666
3667         * arm.cc (Arm_relocate_functions::abs8,
3668         Arm_relocate_functions::abs16): Use
3669         Bits::has_signed_unsigned_overflow32.
3670         (Arm_relocate_functions::thm_abs8): Correct range of
3671         overflow check.
3672         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
3673         in assertions.
3674
3675 2012-02-02  Doug Kwan  <dougkwan@google.com>
3676
3677         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
3678         position independent outputs, not just shared objects.
3679
3680 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
3681
3682         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
3683         * configure: Regenerated.
3684
3685 2012-01-27  Ian Lance Taylor  <iant@google.com>
3686
3687         * reloc.h (Bits): New class with static functions, copied from
3688         namespace utils in arm.cc.
3689         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
3690         instead.
3691
3692 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
3693
3694         * incremental.cc (write_info_blocks): Correct relocation offset.
3695
3696 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
3697
3698         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
3699         (Relocate::tls_gd_to_le): Likewise.
3700
3701 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
3702
3703         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
3704
3705 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
3706
3707         * configure.ac: Check if -mcmodel=medium works.
3708         * configure: Regenerated.
3709
3710 2012-01-24  Cary Coutant  <ccoutant@google.com>
3711
3712         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
3713         definition and ...
3714         (read_unsigned_LEB_128_x): ... this new function.
3715         (read_signed_LEB_128): Replaced with inline definition and ...
3716         (read_signed_LEB_128_x): ... this new function.
3717         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
3718         (read_unsigned_LEB_128): Add inline definition.
3719         (read_signed_LEB_128_x): New function.
3720         (read_signed_LEB_128): Add inline definition.
3721         * testsuite/Makefile.am (leb128_unittest): New unit test.
3722         * testsuite/Makefile.in: Regenerate.
3723         * testsuite/leb128_unittest.cc: New unit test.
3724
3725 2012-01-23  Ian Lance Taylor  <iant@google.com>
3726
3727         PR gold/13617
3728         * i386.cc (Target_i386::do_code_fill): When using a jmp
3729         instruction, pad with nop instructions.
3730         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
3731
3732 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
3733
3734         * x86_64.cc (gc_process_relocs): Add typename on types used in
3735         template.
3736         (scan_relocs): Likewise.
3737         (relocate_section): Likewise.
3738         (apply_relocation): Likewise.
3739
3740 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
3741
3742         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
3743         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
3744         under x32.
3745
3746 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
3747
3748         * x86_64.cc: Initial support for x32.
3749
3750 2012-01-03  Cary Coutant  <ccoutant@google.com>
3751
3752         * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
3753         Use abstract base class for GOT.
3754         * gold/output.h (class Output_data_got_base): New abstract base class.
3755         (class Output_data_got): Derive from new base class, adjust ctors.
3756         (Output_data_got::reserve_slot): Make virtual; rename to
3757         do_reserve_slot; Adjust callers.
3758         * gold/target.h (Sized_target::init_got_plt_for_update): Return
3759         pointer to abstract base class.
3760         * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
3761
3762 2011-12-18  Ian Lance Taylor  <iant@google.com>
3763
3764         * object.h (Relobj::local_symbol_value): New function.
3765         (Relobj::local_plt_offset): New function.
3766         (Relobj::local_has_got_offset): New function.
3767         (Relobj::local_got_offset): New function.
3768         (Relobj::set_local_got_offset): New function.
3769         (Relobj::do_local_symbol_value): New pure virtual function.
3770         (Relobj::do_local_plt_offset): Likewise.
3771         (Relobj::do_local_has_got_offset): Likewise.
3772         (Relobj::do_local_got_offset): Likewise.
3773         (Relobj::do_set_local_got_offset): Likewise.
3774         (Sized_relobj::do_local_has_got_offset): Rename from
3775         local_has_got_offset.
3776         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
3777         (Sized_relobj::do_set_local_got_offset): Rename from
3778         set_local_got_offset.
3779         (Sized_relobj_file::do_local_plt_offset): Rename from
3780         local_plt_offset.
3781         (Sized_relobj_file::do_local_symbol_value): New function.
3782         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
3783         local_plt_offset.
3784         * output.cc (Output_data_got::Got_entry::write): Change object to
3785         Relobj.  Use local_symbol_value.
3786         (Output_data_got::add_global_with_rel): Change rel_dyn to
3787         Output_data_reloc_generic*.  Use add_global_generic.
3788         (Output_data_got::add_global_with_rela): Remove.  Change all
3789         callers to use add_global_with_rel.
3790         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
3791         Output_data_reloc_generic*.  Use add_global_generic.
3792         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
3793         callers to use add_global_pair_with_rel.
3794         (Output_data_got::add_local): Change object to Relobj*.
3795         (Output_data_got::add_local_plt): Likewise.
3796         (Output_data_got::add_local_with_rel): Change object to Relobj*,
3797         change rel_dyn to Output_data_reloc_generic*.  Use
3798         add_local_generic.
3799         (Output_data_got::add_local_with_rela): Remove.  Change all
3800         callers to use all_local_with_rel.
3801         (Output_data_got::add_local_pair_with_rel): Change object to
3802         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
3803         add_output_section_generic.
3804         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
3805         callers to use add_local_pair_with_rel.
3806         (Output_data_got::reserve_local): Change object to Relobj*.
3807         * output.h: (class Output_data_reloc_generic): Add pure virtual
3808         declarations for add_global_generic, add_local_generic,
3809         add_output_section_generic.
3810         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
3811         functions for Output_data_reloc_generic.  Update declarations for
3812         changes listed in output.cc.
3813         (class Output_data_got): Change template parameter to got_size.
3814         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
3815         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
3816         function.
3817         (Sized_relobj_incr::do_local_plt_offset): New function.
3818         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
3819         add_global_generic.
3820
3821 2011-12-17  Cary Coutant  <ccoutant@google.com>
3822
3823         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
3824         * resolve.cc (Symbol_table::resolve): Likewise.
3825         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
3826         arrays.
3827         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
3828
3829 2011-12-16  Ian Lance Taylor  <iant@google.com>
3830
3831         * output.h (Output_data_reloc_generic::add): Only call
3832         add_dynamic_reloc if this is a dynamic reloc section.
3833
3834 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
3835
3836         PR gold/13505
3837         * target-reloc.h (apply_relocation): Replace <64, false> with
3838         <size, big_endian>.
3839
3840 2011-11-25  Nick Clifton  <nickc@redhat.com>
3841
3842         * po/it.po: New Italian translation.
3843
3844 2011-11-17  Sterling Augustine  <saugustine@google.com>
3845
3846         * script.cc (script_include_directive): Implement.
3847         (read_script_file): New local variables name and search_path. Update
3848         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
3849         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
3850         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
3851
3852 2011-11-11  Sterling Augustine  <saugustine@google.com>
3853
3854         * yyscript.y (section_cmd): Add support for INCLUDE directive.
3855         (file_or_sections_cmd): Likewise.
3856
3857 2011-11-11  Doug Kwan  <dougkwan@google.com>
3858
3859         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
3860         if --just-symbols is given.
3861
3862 2011-11-10  Doug Kwan  <dougkwan@google.com>
3863
3864         PR gold/13362
3865         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
3866         when processing data relocs.
3867         * reloc.h (Relocate_functions::rel_unaligned): New method.
3868         (Relocate_functions::pcrel_unaligned): Ditto.
3869         (Relocate_functions::rel32_unaligned): Ditto.
3870         (Relocate_functions::pcrel32_unaligned): Ditto.
3871
3872 2011-11-09  Doug Kwan  <dougkwan@google.com>
3873
3874         PR gold/13362
3875         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
3876         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
3877         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
3878         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
3879         (Relocate_functions::rel_unaligned): New.
3880         (Relocate_functions::rel32_unaligned): New.
3881         * target-reloc.h (relocate_for_relocatable): Add code to handle
3882         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
3883         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
3884         arm_unaligned_reloc_r): New targets.
3885         * testsuite/Makefile.in: Regenerate.
3886         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
3887         linking.
3888
3889 2011-11-02  Ian Lance Taylor  <iant@google.com>
3890
3891         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
3892         NATIVE_LINKER.
3893         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
3894         * options.cc (General_options::finalize): Use library search path
3895         from configure script if specified.  If not native and no sysroot,
3896         only search TOOLLIBDIR.
3897         * options.h (Search_directory::Search_directory): Change name to
3898         const std::string&.
3899         (General_options::add_to_library_path_with_sysroot): Change arg to
3900         const std::string&.
3901         * configure, Makefile.in, config.in: Rebuild.
3902
3903 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
3904
3905         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
3906         we are working around the ARM1176 Erratum.
3907         * options.h (General_options::fix_arm1176): Add option.
3908         * testsuite/Makefile.am: Add testcases, and keep current ones
3909         working.
3910         * testsuite/Makefile.in: Regenerate.
3911         * testsuite/arm_fix_1176.s: New file.
3912         * testsuite/arm_fix_1176.sh: Likewise.
3913
3914 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
3915
3916         * arm.cc (Target_arm::Target_arm): Remove initialisation of
3917         may_use_blx_.
3918         (Target_arm::may_use_blx): Remove method.
3919         (Target_arm::set_may_use_blx): Likewise.
3920         (Target_arm::may_use_v4t_interworking): New method.
3921         (Target_arm::may_use_v5t_interworking): Likewise.
3922         (Target_arm::may_use_blx_): Remove member variable.
3923         (Arm_relocate_functions::arm_branch_common): Check for v5T
3924         interworking.
3925         (Arm_relocate_functions::thumb_branch_common): Likewise.
3926         (Reloc_stub::stub_type_for_reloc): Likewise.
3927         (Target_arm::do_finalize_sections): Correct interworking checks.
3928         * testsuite/Makefile.am: Add new tests.
3929         * testsuite/Makefile.in: Regenerate.
3930         * testsuite/arm_farcall_arm_arm.s: New test.
3931         * testsuite/arm_farcall_arm_arm.sh: Likewise.
3932         * testsuite/arm_farcall_arm_thumb.s: Likewise.
3933         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
3934         * testsuite/arm_farcall_thumb_arm.s: Likewise.
3935         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
3936         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
3937         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
3938
3939 2011-10-31  Cary Coutant  <ccoutant@google.com>
3940
3941         PR gold/13023
3942         * expression.cc (Expression::eval_with_dot): Add
3943         is_section_dot_assignment parameter.
3944         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
3945         absolute and assigning to dot within a section.
3946         * script-sections.cc
3947         (Output_section_element_assignment::set_section_addresses): Pass
3948         dot_section to set_if_absolute.
3949         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
3950         as is_section_dot_assignment flag to eval_with_dot.
3951         (Output_section_element_dot_assignment::set_section_addresses):
3952         Likewise.
3953         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
3954         parameter.  Also set value if relative to dot_section; set the
3955         symbol's output_section.
3956         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
3957         parameter.  Adjust all callers.
3958         (Expression::eval_maybe_dot): Likewise.
3959         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
3960         Adjust all callers.
3961         * testsuite/script_test_2.t: Test assignment of an absolute value
3962         to dot within an output section element.
3963
3964 2011-10-31  Cary Coutant  <ccoutant@google.com>
3965
3966         * options.h (class General_options): Add --[no-]gnu-unique options.
3967         * symtab.cc (Symbol_table::sized_write_globals): Convert
3968         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
3969
3970 2011-10-31  Cary Coutant  <ccoutant@google.com>
3971
3972         PR gold/13359
3973         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
3974         unnecessary assertion.
3975         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
3976
3977 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
3978
3979         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
3980         gc_mark_symbol.
3981         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
3982         gc_mark_symbol.
3983         Change to just keep the section associated with symbol.
3984         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
3985         they are externally visible and --export-dynamic is turned on.
3986         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
3987
3988 2011-10-19  Ian Lance Taylor  <iant@google.com>
3989
3990         PR gold/13163
3991         * script-sections.cc
3992         (Output_section_element_dot_assignment::needs_output_section): New
3993         function.
3994
3995 2011-10-19  Ian Lance Taylor  <iant@google.com>
3996
3997         PR gold/13204
3998         * layout.cc (Layout::segment_precedes): Don't assert failure if a
3999         --section-start option was seen.
4000         * options.h (General_options::any_section_start): New function.
4001
4002 2011-10-18  David S. Miller  <davem@davemloft.net>
4003
4004         PR binutils/13301
4005         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
4006         member to track relocation locations that have moved during TLS
4007         reloc optimizations.
4008         (Target_sparc::Relocate::Relocate): Initialize to NULL.
4009         (Target_sparc::Relocate::relocate): Adjust view down by 4
4010         bytes if it matches reloc_adjust_addr_.
4011         (Target_sparc::Relocate::relocate_tls): Always move the
4012         __tls_get_addr call delay slot instruction forward 4 bytes when
4013         performing relaxation.
4014
4015 2011-10-18  Cary Coutant  <ccoutant@google.com>
4016
4017         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
4018         (Output_file::map_no_anonymous): Check for non-zero
4019         return code from posix_fallocate.
4020
4021 2011-10-17  Cary Coutant  <ccoutant@google.com>
4022
4023         PR gold/13245
4024         * plugin.cc (is_visible_from_outside): Check for symbols
4025         referenced from dynamic objects.
4026         * resolve.cc (Symbol_table::resolve): Don't count references
4027         from dynamic objects as references from real ELF files.
4028         * testsuite/plugin_test_2.sh: Adjust expected result.
4029
4030 2011-10-17  Cary Coutant  <ccoutant@google.com>
4031
4032         * gold.cc: Include timer.h.
4033         (queue_middle_tasks): Stamp time.
4034         (queue_final_tasks): Likewise.
4035         * main.cc (main): Store timer in parameters.  Print timers
4036         for each pass.
4037         * parameters.cc (Parameters::Parameters): Initialize timer_.
4038         (Parameters::set_timer): New function.
4039         (set_parameters_timer): New function.
4040         * parameters.h (Parameters::set_timer): New function.
4041         (Parameters::timer): New function.
4042         (Parameters::timer_): New data member.
4043         (set_parameters_timer): New function.
4044         * timer.cc (Timer::stamp): New function.
4045         (Timer::get_pass_time): New function.
4046         * timer.h (Timer::stamp): New function.
4047         (Timer::get_pass_time): New function.
4048         (Timer::pass_times_): New data member.
4049
4050 2011-10-17  Cary Coutant  <ccoutant@google.com>
4051
4052         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
4053         task for members of lib groups.
4054
4055 2011-10-17  Cary Coutant  <ccoutant@google.com>
4056
4057         PR gold/13288
4058         * fileread.cc (File_read::find_view): Add assert.
4059         (File_read::make_view): Move bounds check (replace with assert)...
4060         (File_read::find_or_make_view): ... to here.
4061
4062 2011-10-12  Cary Coutant  <ccoutant@google.com>
4063
4064         * output.cc (Output_file::open_base_file): Handle case where
4065         ::read returns less than requested size.
4066
4067 2011-10-10  Cary Coutant  <ccoutant@google.com>
4068
4069         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
4070         Initialize defined_count_.
4071         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
4072         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
4073         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
4074         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
4075         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
4076         * incremental.h (Sized_relobj_incr::defined_count_): New data
4077         member.
4078         (Sized_incr_dynobj::defined_count_): New data member.
4079         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
4080         Return zeroes instead of internal error.
4081
4082 2011-10-10  Cary Coutant  <ccoutant@google.com>
4083
4084         PR gold/13249
4085         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
4086         (Output_reloc::symbol_value): Return PLT offset if flag is set.
4087         * output.h (class Output_reloc): Add use_plt_offset flag.
4088         (Output_reloc::type_): Adjust size of bit field.
4089         (Output_reloc::use_plt_offset_): New bit field.
4090         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
4091         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
4092         flag.  Adjust all callers.
4093         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
4094         creating RELATIVE relocations.
4095
4096 2011-10-10  Nick Clifton  <nickc@redhat.com>
4097
4098         * po/es.po: Updated Spanish translation.
4099         * po/fi.po: Updated Finnish translation.
4100
4101 2011-10-03   Diego Novillo  <dnovillo@google.com>
4102
4103         * options.cc (parse_uint): Fix dereference of RETVAL.
4104
4105 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
4106
4107         * layout.h (section_order_map_): New member.
4108         (get_section_order_map): New member function.
4109         * output.cc (Output_section::add_input_section): Check for patterns
4110         only when --section-ordering-file is specified.
4111         * gold.cc (queue_middle_tasks): Delay updating order of sections till
4112         output_sections have been formed.
4113         * layout.cc (Layout_Layout): Initialize section_order_map_.
4114         * plugin.cc (update_section_order): Store order in order_map. Do not
4115         update the order.
4116         * testsuite/Makefile.am: Add test case for plugin_final_layout.
4117         * testsuite/Makefile.in: Regenerate.
4118         * testsuite/plugin_section_order.c: New file.
4119         * testsuite/plugin_final_layout.cc: New file.
4120         * testsuite/plugin_final_layout.sh: New file.
4121
4122 2011-09-29  Cary Coutant  <ccoutant@google.com>
4123
4124         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
4125         Check for NULL.
4126         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
4127         symbols during incremental update.
4128         (Symbol_table::add_from_dynobj): Likewise.
4129
4130 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4131             Ian Lance Taylor  <iant@google.com>
4132
4133         * symtab.cc (Symbol_table::define_special_symbol): Always
4134         canonicalize version string.
4135
4136 2011-09-26  Cary Coutant  <ccoutant@google.com>
4137
4138         * gold.cc (queue_initial_tasks): Move option checks ...
4139         * options.cc (General_options::finalize): ... to here. Disable
4140         some options; make others fatal.
4141
4142 2011-09-26  Cary Coutant  <ccoutant@google.com>
4143
4144         gcc PR lto/47247
4145         * plugin.cc (get_symbols_v2): New function.
4146         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
4147         (is_referenced_from_outside): New function.
4148         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
4149         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
4150         (get_symbols): Pass version parameter.
4151         (get_symbols_v2): New function.
4152         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
4153         parameter.
4154         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
4155         (onload): Add LDPT_GET_SYMBOLS_V2.
4156         (all_symbols_read_hook): Use get_symbols_v2; check for
4157         LDPR_PREVAILING_DEF_IRONLY_EXP.
4158         * testsuite/plugin_test_3.sh: Update expected results.
4159
4160 2011-09-23  Simon Baldwin  <simonb@google.com>
4161
4162         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
4163         configuration options.
4164         * configure: Regenerate.
4165         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
4166         * Makefile.in: Regenerate.
4167         * testsuite/Makefile.in: Regenerate.
4168
4169 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
4170
4171         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
4172
4173 2011-09-19  Cary Coutant  <ccoutant@google.com>
4174
4175         * incremental.cc (can_incremental_update): Fix typo in comment.
4176         * incremental.h (can_incremental_update): Likewise.
4177
4178 2011-09-18  Cary Coutant  <ccoutant@google.com>
4179
4180         * incremental.cc (can_incremental_update): New function.
4181         * incremental.h (can_incremental_update): New function.
4182         * layout.cc (Layout::init_fixed_output_section): Call it.
4183         (Layout::make_output_section): Don't allow patch space in .eh_frame.
4184         * object.cc (Sized_relobj_file::do_layout): Call
4185         can_incremental_update.
4186
4187 2011-09-13  Cary Coutant  <ccoutant@google.com>
4188
4189         * configure.ac: Check for glibc support for gnu_indirect_function
4190         support with static linking, setting automake conditional
4191         IFUNC_STATIC.
4192         * Makefile.in: Regenerate.
4193         * configure: Regenerate.
4194
4195         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
4196         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
4197         for IFUNC_STATIC.
4198         * testsuite/Makefile.in: Regenerate.
4199
4200 2011-09-13  Cary Coutant  <ccoutant@google.com>
4201
4202         * incremental.cc (Sized_relobj_incr::do_layout): Call
4203         report_comdat_group for kept comdat sections.
4204         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
4205         * testsuite/Makefile.in: Regenerate.
4206         * testsuite/incr_comdat_test_1.cc: New source file.
4207         * testsuite/incr_comdat_test_2_v1.cc: New source file.
4208         * testsuite/incr_comdat_test_2_v2.cc: New source file.
4209         * testsuite/incr_comdat_test_2_v3.cc: New source file.
4210
4211 2011-09-13  Ian Lance Taylor  <iant@google.com>
4212
4213         * object.cc (Sized_relobj_file::do_layout): Remove unused local
4214         variable external_symbols_offset.
4215
4216 2011-09-12  Ian Lance Taylor  <iant@google.com>
4217
4218         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
4219         triggered if object has no symbols.
4220
4221 2011-09-09  David S. Miller  <davem@davemloft.net>
4222
4223         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
4224         (Output_fill_debug_line::do_write): Likewise.
4225
4226 2011-08-29  Cary Coutant  <ccoutant@google.com>
4227
4228         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
4229         casts to match formatting specs.
4230         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
4231
4232 2011-08-26  Cary Coutant  <ccoutant@google.com>
4233
4234         * layout.cc (Free_list::allocate): Provide guarantee of minimum
4235         remaining hole size when allocating.
4236         (Layout::make_output_section): Set fill methods for debug sections.
4237         * layout.h (Free_list::Free_list_node): Move from private to
4238         public.
4239         (Free_list::set_min_hole_size): New function.
4240         (Free_list::begin, Free_list::end): New functions.
4241         (Free_list::min_hole_): New data member.
4242         * output.cc: Include dwarf.h.
4243         (Output_fill_debug_info::do_minimum_hole_size): New function.
4244         (Output_fill_debug_info::do_write): New function.
4245         (Output_fill_debug_line::do_minimum_hole_size): New function.
4246         (Output_fill_debug_line::do_write): New function.
4247         (Output_section::Output_section): Initialize new data member.
4248         (Output_section::set_final_data_size): Ensure patch space is larger
4249         than minimum hole size.
4250         (Output_section::do_write): Fill holes in debug sections.
4251         * output.h (Output_fill): New class.
4252         (Output_fill_debug_info): New class.
4253         (Output_fill_debug_line): New class.
4254         (Output_section::set_free_space_fill): New function.
4255         (Output_section::free_space_fill_): New data member.
4256         * testsuite/Makefile.am (incremental_test_3): Add
4257         --incremental-patch option.
4258         (incremental_test_4): Likewise.
4259         (incremental_test_5): Likewise.
4260         (incremental_test_6): Likewise.
4261         (incremental_copy_test): Likewise.
4262         (incremental_common_test_1): Likewise.
4263         * testsuite/Makefile.in: Regenerate.
4264
4265 2011-08-26  Nick Clifton  <nickc@redhat.com>
4266
4267         * po/es.po: Updated Spanish translation.
4268
4269 2011-08-01  Cary Coutant  <ccoutant@google.com>
4270
4271         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
4272         * gold/testsuite/Makefile.in: Regenerate.
4273         * gold/testsuite/justsyms_exec.c: New source file.
4274         * gold/testsuite/justsyms_lib.c: New source file.
4275
4276 2011-08-01  Cary Coutant  <ccoutant@google.com>
4277
4278         * layout.cc (Layout::set_segment_offsets): Don't realign text
4279         segment if -Ttext was specified.
4280         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
4281         file type.
4282         * object.h (Sized_relobj_file::e_type): New function.
4283         (Sized_relobj_file::e_type_): New data member.
4284         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
4285         base address for ET_EXEC files.
4286         * target.cc (Target::do_make_elf_object_implementation): Allow
4287         ET_EXEC files with --just-symbols option.
4288
4289 2011-07-28  Cary Coutant  <ccoutant@google.com>
4290
4291         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
4292         Add thread_number parameter.
4293         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
4294         * workqueue-threads.cc
4295         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
4296         current thread if its thread number is greater than desired thread
4297         count.
4298         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
4299         Add thread_number parameter.
4300         (Workqueue::should_cancel_thread): Likewise.
4301         (Workqueue::find_runnable_or_wait): Pass thread_number to
4302         should_cancel_thread.
4303         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
4304         parameter.
4305
4306 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
4307
4308         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
4309         only after checking if it cannot be forced local.
4310         * symtab.h (is_externally_visible): Check if the symbol is not forced
4311         local.
4312
4313 2011-07-15  Ian Lance Taylor  <iant@google.com>
4314
4315         * options.h (class General_options): Add --print-output-format.
4316         Move -EL next to -EB, for  better --help output.
4317         * target-select.cc: Include <cstdio>, "options.h", and
4318         "parameters.h".
4319         (Target_selector::do_target_bfd_name): New function.
4320         (print_output_format): New function.
4321         * target-select.h (class Target_selector): Update declarations.
4322         (Target_selector::target_bfd_name): New function.
4323         (print_output_format): Declare.
4324         * main.cc: Include "target-select.h".
4325         (main): Handle --print-output-format.
4326         * gold.cc: Include "target-select.h".
4327         (queue_initial_tasks): Handle --print-output-format when there are
4328         no input files.
4329         * parameters.cc (parameters_force_valid_target): Give a better
4330         error message if -EB/-EL does not match target.
4331         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
4332         function.
4333
4334 2011-07-15  Ian Lance Taylor  <iant@google.com>
4335
4336         * i386.cc (class Output_data_plt_i386): Add layout_ field.
4337         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
4338         (Output_data_plt_i386::do_write): Write address of .dynamic
4339         section to first entry in .got.plt section.
4340         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
4341         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
4342         Initialize layout_.
4343         (Output_data_plt_x86_64::do_write): Write address of .dynamic
4344         section to first entry in .got.plt section.
4345         * layout.h (Layout::dynamic_section): New function.
4346
4347 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
4348
4349         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
4350         to claim_file call.
4351         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
4352         input_section_position_, and input_section_glob_.
4353         (read_layout_from_file): Call function section_ordering_specified.
4354         * layout.h (is_section_ordering_specified): New function.
4355         (section_ordering_specified): New function.
4356         (section_ordering_specified_): New boolean member.
4357         * main.cc(main): Call load_plugins after layout object is defined.
4358         * output.cc (Output_section::add_input_section): Use
4359         function section_ordering_specified to check if section ordering is
4360         needed.
4361         * output.cc (Output_section::add_relaxed_input_section): Use
4362         function section_ordering_specified to check if section ordering is
4363         needed.
4364         (Output_section::update_section_layout): New function.
4365         (Output_section::sort_attached_input_sections): Check if input section
4366         must be reordered.
4367         * output.h (Output_section::update_section_layout): New function.
4368         * plugin.cc (get_section_count): New function.
4369         (get_section_type): New function.
4370         (get_section_name): New function.
4371         (get_section_contents): New function.
4372         (update_section_order): New function.
4373         (allow_section_ordering): New function.
4374         (Plugin::load): Add the new interfaces to the transfer vector.
4375         (Plugin_manager::load_plugins): New parameter.
4376         (Plugin_manager::all_symbols_read): New parameter.
4377         (Plugin_manager::claim_file): New parameter. Save the elf object for
4378         unclaimed objects.
4379         (Plugin_manager::get_elf_object): New function.
4380         (Plugin_manager::get_view): Change to directly use the bool to check
4381         if get_view is called from claim_file_hook.
4382         * plugin.h (input_objects): New function
4383         (Plugin__manager::load_plugins): New parameter.
4384         (Plugin_manager::claim_file): New parameter.
4385         (Plugin_manager::get_elf_object): New function.
4386         (Plugin_manager::in_claim_file_handler): New function.
4387         (Plugin_manager::in_claim_file_handler_): New member.
4388         (layout): New function.
4389         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
4390         handler with an extra parameter. Make the elf object before calling
4391         claim_file handler.
4392         * testsuite/plugin_test.c (get_section_count): New function pointer.
4393         (get_section_type): New function pointer.
4394         (get_section_name): New function pointer.
4395         (get_section_contents): New function pointer.
4396         (update_section_order): New function pointer.
4397         (allow_section_ordering): New function pointer.
4398         (onload): Check if the new interfaces exist.
4399
4400 2011-07-13  Ian Lance Taylor  <iant@google.com>
4401
4402         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
4403         relro section.
4404         * x86_64.cc (Target_x86_64::got_section): Likewise.
4405         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
4406         (relro_now_test_SOURCES): New variable.
4407         (relro_now_test_DEPENDENCIES): New variable.
4408         (relro_now_test_LDFLAGS): New variable.
4409         (relro_now_test_LDADD): New variable.
4410         (relro_now_test.so): New target.
4411         * testsuite/Makefile.in: Rebuild.
4412
4413 2011-07-12  Ian Lance Taylor  <iant@google.com>
4414
4415         PR gold/12980
4416         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
4417         GLOB_DAT relocation rather than a RELATIVE relocation for a
4418         protected symbol when creating a shared library.
4419         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
4420         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
4421         * testsuite/protected_main_1.cc (main): Test that protected
4422         function has same address.
4423
4424 2011-07-11  Ian Lance Taylor  <iant@google.com>
4425
4426         PR gold/12979
4427         * options.h (class General_options): Add -Bgroup.
4428         * options.cc (General_options::finalize): If -Bgroup is set,
4429         default to --unresolved-symbols=report-all.
4430         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
4431         * target-reloc.h (issue_undefined_symbol_error): Handle
4432         --unresolved-symbols=report-all.
4433
4434 2011-07-08  Ian Lance Taylor  <iant@google.com>
4435
4436         PR gold/11985
4437         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
4438         if linker script discards key sections.
4439         (Layout::create_dynamic_symtab): Likewise.
4440         (Layout::assign_local_dynsym_offsets): Likewise.
4441         (Layout::sized_create_version_sections): Likewise.
4442         (Layout::create_interp): Likewise.
4443         (Layout::finish_dynamic_section): Likewise.
4444         (Layout::set_dynamic_symbol_size): Likewise.
4445
4446 2011-07-08  Ian Lance Taylor  <iant@google.com>
4447
4448         PR gold/12386
4449         * options.h (class General_options): Add --unresolved-symbols.
4450         * target-reloc.h (issue_undefined_symbol_error): Check
4451         --unresolved-symbols.  Add comments.
4452
4453 2011-07-08  Ian Lance Taylor  <iant@google.com>
4454
4455         * testsuite/odr_violation2.cc (Ordering::operator()): Make
4456         expression more complex.
4457
4458 2011-07-08  Ian Lance Taylor  <iant@google.com>
4459
4460         PR gold/11317
4461         * target-reloc.h (issue_undefined_symbol_error): New inline
4462         function, broken out of relocate_section.
4463         (relocate_section): Call issue_undefined_symbol_error.
4464         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
4465         there is no TLS segment if we are about to issue an undefined
4466         symbol error.
4467         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
4468
4469 2011-07-08  Ian Lance Taylor  <iant@google.com>
4470
4471         PR gold/12279
4472         * resolve.cc (Symbol_table::should_override): Add fromtype
4473         parameter.  Change all callers.  Give error when linking together
4474         TLS and non-TLS symbol.
4475         (Symbol_table::should_override_with_special): Add fromtype
4476         parameter.  Change all callers.
4477         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
4478         there is no TLS segment if we have reported some errors.
4479         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
4480
4481 2011-07-08  Ian Lance Taylor  <iant@google.com>
4482
4483         PR gold/12372
4484         * target.h (Target::plt_address_for_global): New function.
4485         (Target::plt_address_for_local): New function.
4486         (Target::plt_section_for_global): Remove.
4487         (Target::plt_section_for_local): Remove.
4488         (Target::do_plt_address_for_global): New virtual function.
4489         (Target::do_plt_address_for_local): New virtual function.
4490         (Target::do_plt_section_for_global): Remove.
4491         (Target::do_plt_section_for_local): Remove.
4492         (Target::register_global_plt_entry): Add Symbol_table and Layout
4493         parameters.
4494         * output.cc (Output_data_got::Got_entry::write): Use
4495         plt_address_for_global and plt_address_for_local.
4496         * layout.cc (Layout::add_target_dynamic_tags): Use size and
4497         address of output section.
4498         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
4499         got_irelative_, and irelative_count_ fields.  Update
4500         declarations.
4501         (Output_data_plt_i386::has_irelative_section): New function.
4502         (Output_data_plt_i386::entry_count): Add irelative_count_.
4503         (Output_data_plt_i386::set_final_data_size): Likewise.
4504         (class Target_i386): Add got_irelative_ and rel_irelative_
4505         fields.  Update declarations.
4506         (Target_i386::Target_i386): Initialize new fields.
4507         (Target_i386::do_plt_address_for_global): New function replacing
4508         do_plt_section_for_global.
4509         (Target_i386::do_plt_address_for_local): New function replacing
4510         do_plt_section_for_local.
4511         (Target_i386::got_section): Create got_irelative_.
4512         (Target_i386::rel_irelative_section): New function.
4513         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
4514         fields.  Don't define __rel_iplt_{start,end}.
4515         (Output_data_plt_i386::add_entry): Add symtab and layout
4516         parameters.  Change all callers.  Use different PLT and GOT for
4517         IFUNC symbols.
4518         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
4519         layout parameters.  Change all callers.  Use different PLT and
4520         GOT.
4521         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
4522         (Output_data_plt_i386::rel_irelative): New function.
4523         (Output_data_plt_i386::address_for_global): New function.
4524         (Output_data_plt_i386::address_for_local): New function.
4525         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
4526         IRELATIVE GOT when changing IFUNC GOT entries.
4527         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
4528         reloc.
4529         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
4530         if we didn't create an IRELATIVE GOT.
4531         (Target_i386::Relocate::relocate): Use plt_address_for_global and
4532         plt_address_for_local.
4533         (Target_i386::do_dynsym_value): Use plt_address_for_global.
4534         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
4535         got_irelative_, and irelative_count_ fields.  Update
4536         declarations.
4537         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
4538         Initialize new fields.  Remove symtab parameter.  Change all
4539         callers.
4540         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
4541         irelative_count_.
4542         (Output_data_plt_x86_64::has_irelative_section): New function.
4543         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
4544         (class Target_x86_64): Add got_irelative_ and rel_irelative_
4545         fields.  Update declarations.
4546         (Target_x86_64::Target_x86_64): Initialize new fields.
4547         (Target_x86_64::do_plt_address_for_global): New function replacing
4548         do_plt_section_for_global.
4549         (Target_x86_64::do_plt_address_for_local): New function replacing
4550         do_plt_section_for_local.
4551         (Target_x86_64::got_section): Create got_irelative_.
4552         (Target_x86_64::rela_irelative_section): New function.
4553         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
4554         all callers.  Don't create __rel_iplt_{start,end}.
4555         (Output_data_plt_x86_64::add_entry): Add symtab and layout
4556         parameters.  Change all callers.  Use different PLT and GOT for
4557         IFUNC symbols.
4558         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
4559         layout parameters.  Change all callers.  Use different PLT and
4560         GOT.
4561         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
4562         parameters.  Change all callers.  Use different PLT and GOT for
4563         IFUNC symbols.
4564         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
4565         (Output_data_plt_x86_64::rela_irelative): New function.
4566         (Output_data_plt_x86_64::address_for_global): New function.
4567         (Output_data_plt_x86_64::address_for_local): New function.
4568         (Output_data_plt_x86_64::set_final_data_size): Likewise.
4569         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
4570         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
4571         (Target_x86_64::register_global_plt_entry): Add symtab and layout
4572         parameters.
4573         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
4574         reloc.
4575         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
4576         symbols if we didn't create an IRELATIVE GOT.
4577         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
4578         plt_address_for_local.
4579         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
4580         * testsuite/ifuncvar1.c: New test file.
4581         * testsuite/ifuncvar2.c: New test file.
4582         * testsuite/ifuncvar3.c: New test file.
4583         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
4584         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
4585         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
4586         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
4587         * testsuite/Makefile.in: Rebuild.
4588
4589 2011-07-07  Cary Coutant  <ccoutant@google.com>
4590
4591         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
4592         (two_file_test_1_ndebug.o): Likewise.
4593         (two_file_test_1b_ndebug.o): Likewise.
4594         (two_file_test_2_ndebug.o): Likewise.
4595         (two_file_test_main_ndebug.o): Likewise.
4596         (incremental_test_2): Link with no-debug versions.
4597
4598 2011-07-06  Cary Coutant  <ccoutant@google.com>
4599
4600         * gold/incremental.cc
4601         (Output_section_incremental_inputs::write_info_blocks): Check for
4602         hidden and internal symbols.
4603
4604 2011-07-06  Cary Coutant  <ccoutant@google.com>
4605
4606         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
4607         Check disposition for startup file.
4608         (Incremental_inputs::report_command_line): Ignore
4609         --incremental-startup-unchanged option.
4610         * options.cc (General_options::parse_incremental_startup_unchanged):
4611         New function.
4612         (General_options::General_options): Initialize new data member.
4613         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
4614         (General_options): Add --incremental-startup-unchanged option.
4615         (General_options::incremental_startup_disposition): New function.
4616         (General_options::incremental_startup_disposition_): New data member.
4617
4618 2011-07-06  Cary Coutant  <ccoutant@google.com>
4619
4620         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
4621         input file index to Script_info ctor.
4622         (Sized_incremental_binary::do_file_has_changed): Find the
4623         command-line argument for files named in scripts.
4624         * incremental.h (Script_info::Script_info): New ctor
4625         with input file index.
4626         (Script_info::input_file_index): New function.
4627         (Script_info::input_file_index_): New data member.
4628         (Incremental_binary::get_library): Add const.
4629         (Incremental_binary::get_script_info): Add const.
4630         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
4631         * testsuite/Makefile.am (incremental_test_5): New test case.
4632         (incremental_test_6): New test case.
4633         * testsuite/Makefile.in: Regenerate.
4634
4635 2011-07-06  Cary Coutant  <ccoutant@google.com>
4636
4637         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
4638         debug output when command lines differ.
4639
4640 2011-07-06  Cary Coutant  <ccoutant@google.com>
4641
4642         * incremental.cc (Incremental_inputs::report_command_line): Ignore
4643         --incremental-patch option.
4644         * layout.cc (Free_list::allocate): Extend allocation beyond original
4645         end if enabled.
4646         (Layout::make_output_section): Mark sections that should get
4647         patch space.
4648         * options.cc (parse_percent): New function.
4649         * options.h (parse_percent): New function.
4650         (DEFINE_percent): New macro.
4651         (General_options): Add --incremental-patch option.
4652         * output.cc (Output_section::Output_section): Initialize new data
4653         members.
4654         (Output_section::add_input_section): Print section name when out
4655         of patch space.
4656         (Output_section::add_output_section_data): Likewise.
4657         (Output_section::set_final_data_size): Add patch space when
4658         doing --incremental-full.
4659         (Output_section::do_reset_address_and_file_offset): Remove patch
4660         space.
4661         (Output_segment::set_section_list_addresses): Print debug output
4662         only if --incremental-update.
4663         * output.h (Output_section::set_is_patch_space_allowed): New function.
4664         (Output_section::is_patch_space_allowed_): New data member.
4665         (Output_section::patch_space_): New data member.
4666         * parameters.cc (Parameters::incremental_full): New function.
4667         * parameters.h (Parameters::incremental_full): New function
4668         * testsuite/Makefile.am (incremental_test_2): Add test for
4669         --incremental-patch option.
4670         * testsuite/Makefile.in: Regenerate.
4671         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
4672         (t18): Remove function body.
4673
4674 2011-07-05  Doug Kwan  <dougkwan@google.com>
4675
4676         PR gold/12771
4677         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
4678         Arm_Address type for relocation result.
4679         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
4680         overflow check.
4681         (Arm_relocate_functions::abs32): Use unaligned access.
4682         (Arm_relocate_functions::rel32): Ditto.
4683         (Arm_relocate_functions::prel31): Ditto.
4684         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
4685         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
4686         static data relocations.
4687         * testsuite/Makefile.in: Regnerate.
4688         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
4689
4690 2011-07-05  Ian Lance Taylor  <iant@google.com>
4691
4692         PR gold/12392
4693         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
4694         symbols if necessary.
4695         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
4696
4697 2011-07-05  Ian Lance Taylor  <iant@google.com>
4698
4699         PR gold/12952
4700         * resolve.cc (Symbol::override_base_with_special): Simply override
4701         version with special symbol version, ignoring previous version.
4702
4703 2011-07-05  Ian Lance Taylor  <iant@google.com>
4704
4705         * object.cc (Sized_relobj_file::include_section_group): Add
4706         information to comment about signature location.
4707
4708 2011-07-02  Ian Lance Taylor  <iant@google.com>
4709
4710         PR gold/12957
4711         * options.h (class General_options): Add -f and -F.
4712         * options.cc (General_options::finalize): Fatal error if -f/-F
4713         are used without -shared.
4714         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
4715
4716 2011-07-02  Ian Lance Taylor  <iant@google.com>
4717
4718         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
4719
4720 2011-07-01  Ian Lance Taylor  <iant@google.com>
4721
4722         PR gold/12525
4723         PR gold/12952
4724         * resolve.cc (Symbol::override_base_with_special): Don't override
4725         the version if the overriding symbol has a different name.
4726         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
4727         all callers.  If we give an error about an undefined version,
4728         define the base version if necessary.
4729         * dynobj.h (class Versions): Update declaration.
4730         * testsuite/weak_alias_test_5.cc: New file.
4731         * testsuite/weak_alias_test.script: New file.
4732         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
4733         and versioned_alias have the right value, and call t2.
4734         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
4735         weak_alias_test_5.so.
4736         (weak_alias_test_LDADD): Likewise.
4737         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
4738         * testsuite/Makefile.in: Rebuild.
4739
4740 2011-07-01  Ian Lance Taylor  <iant@google.com>
4741
4742         PR gold/12525
4743         * options.h (class General_options): Support -z notext.
4744         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
4745         -Wl,-z,notext.
4746         (two_file_shared_nonpic.so): Likewise.
4747         (two_file_shared_mixed.so): Likewise.
4748         (two_file_shared_mixed_1.so): Likewise.
4749         (weak_undef_lib_nonpic.so): Likewise.
4750         (alt/weak_undef_lib_nonpic.so): Likewise.
4751         (tls_test_shared_nonpic.so): Likewise.
4752         * testsuite/Makefile.in: Rebuild.
4753
4754 2011-07-01  Ian Lance Taylor  <iant@google.com>
4755
4756         PR gold/12525
4757         * configure.ac: Test whether static linking works, setting
4758         the automake conditional HAVE_STATIC.
4759         * testsuite/Makefile.am: Disable tests using -static if
4760         HAVE_STATIC is not true.
4761         * configure, testsuite/Makefile.in: Rebuild.
4762
4763 2011-07-01  Ian Lance Taylor  <iant@google.com>
4764
4765         PR gold/12525
4766         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
4767         Assert if we see DW_EH_PE_indirect.
4768         * target.h (Target::ehframe_datarel_base): New function.
4769         (Target::do_ehframe_datarel_base): New target function.
4770         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
4771         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
4772         function.
4773
4774 2011-07-01  Ian Lance Taylor  <iant@google.com>
4775
4776         PR gold/12571
4777         * options.h (class General_options): Add
4778         --ld-generated-unwind-info.
4779         * ehframe.cc (Fde::write): Add address parameter.  Change all
4780         callers.  If associated with PLT, fill in address and size.
4781         (Cie::set_output_offset): Only add merge mapping if there is an
4782         object.
4783         (Cie::write): Add address parameter.  Change all callers.
4784         (Eh_frame::add_ehframe_for_plt): New function.
4785         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
4786         input_offset_ fields into union u_, with new plt field.
4787         (Fde::Fde): Adjust for new union field.
4788         (Fde::Fde) [Output_data version]: New constructor.
4789         (Fde::add_mapping): Only add merge mapping if there is an object.
4790         (class Cie): Update declarations.
4791         (class Eh_frame): Declare add_ehframe_for_plt.
4792         * layout.cc (Layout::layout_eh_frame): Break out code into
4793         make_eh_frame_section, and call it.
4794         (Layout::make_eh_frame_section): New function.
4795         (Layout::add_eh_frame_for_plt): New function.
4796         * layout.h (class Layout): Update declarations.
4797         * merge.cc (Merge_map::add_mapping): Add assertion.
4798         * i386.cc: Include "dwarf.h".
4799         (class Output_data_plt_i386): Make first_plt_entry,
4800         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
4801         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
4802         and plt_eh_frame_fde.
4803         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
4804         boundary.  Call add_eh_frame_for_plt if appropriate.
4805         * x86_64.cc: Include "dwarf.h".
4806         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
4807         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
4808         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
4809         and plt_eh_frame_fde.
4810         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
4811         appropriate.
4812
4813 2011-06-29  Ian Lance Taylor  <iant@google.com>
4814
4815         PR gold/12629
4816         * object.cc (Sized_relobj_file::layout_section): Change shdr
4817         parameter to be const.
4818         (Sized_relobj_file::layout_eh_frame_section): New function, broken
4819         out of do_layout.
4820         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
4821         appropriate.  Call layout_eh_frame_section.
4822         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
4823         sections.
4824         * object.h (class Sized_relobj_file): Update declarations.
4825
4826 2011-06-29  Ian Lance Taylor  <iant@google.com>
4827
4828         PR gold/12652
4829         * script.cc (Token::integer_value): Accept trailing M/m/K/k
4830         modifier.
4831         (Lex::gather_token): Accept trailing M/m/K/k for integers.
4832
4833 2011-06-29  Ian Lance Taylor  <iant@google.com>
4834
4835         PR gold/12675
4836         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
4837         SHT_X86_64_UNWIND.
4838         * layout.cc (Layout::layout_eh_frame): Likewise.
4839
4840 2011-06-29  Ian Lance Taylor  <iant@google.com>
4841
4842         PR gold/12695
4843         * layout.cc (Layout::symtab_section_shndx): New function.
4844         * layout.h (class Layout): Declare symtab_section_shndx.
4845         * output.cc (Output_section::write_header): Call it.
4846
4847 2011-06-29  Ian Lance Taylor  <iant@google.com>
4848
4849         PR gold/12818
4850         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
4851         symbols which are not used in a relocation.
4852
4853 2011-06-28  Ian Lance Taylor  <iant@google.com>
4854
4855         PR gold/12898
4856         * layout.cc (Layout::segment_precedes): Don't crash if a linker
4857         script create indistinguishable segments.
4858         (Layout::set_segment_offsets): Use stable_sort when sorting
4859         segments.  Pass this to Compare_segments constructor.
4860         * layout.h (class Layout): Make segment_precedes non-static.
4861         (class Compare_segments): Change from struct to class.  Add
4862         layout_ field.  Add constructor.
4863         * script-sections.cc
4864         (Script_sections::attach_sections_using_phdrs_clause): Rename
4865         local orphan to is_orphan.  Don't report failure to put empty
4866         section in segment.  On attachment failure, report name of
4867         section, and attach to first PT_LOAD segment.
4868
4869 2011-06-28  Ian Lance Taylor  <iant@google.com>
4870
4871         PR gold/12934
4872         * target-select.cc (Target_selector::Target_selector): Add
4873         emulation parameter.  Change all callers.
4874         (select_target_by_bfd_name): Rename from select_target_by_name.
4875         Change all callers.
4876         (select_target_by_emulation): New function.
4877         (supported_emulation_names): New function.
4878         * target-select.h (class Target_selector): Add emulation_ field.
4879         Update declarations.
4880         (Target_selector::recognize_by_bfd_name): Rename from
4881         recognize_by_name.  Change all callers.
4882         (Target_selector::supported_bfd_names): Rename from
4883         supported_names.  Change all callers.
4884         (Target_selector::recognize_by_emulation): New function.
4885         (Target_selector::supported_emulations): New function.
4886         (Target_selector::emulation): New function.
4887         (Target_selector::do_recognize_by_bfd_name): Rename from
4888         do_recognize_by_name.  Change all callers.
4889         (Target_selector::do_supported_bfd_names): Rename from
4890         do_supported_names.  Change all callers.
4891         (Target_selector::do_recognize_by_emulation): New function.
4892         (Target_selector::do_supported_emulations): New function.
4893         (select_target_by_bfd_name): Change name in declaration.
4894         (select_target_by_emulation): Declare.
4895         (supported_emulation_names): Declare.
4896         * parameters.cc (parameters_force_valid_target): Try to find
4897         target based on emulation from -m option.
4898         * options.h (class General_options): Change doc string for -m.
4899         * options.cc (help): Print emulations.
4900         (General_options::parse_V): Likewise.
4901         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
4902         Add emulation parameter.  Change all callers.
4903
4904 2011-06-28  Ian Lance Taylor  <iant@google.com>
4905
4906         * target.h (class Target): Add osabi_ field.
4907         (Target::osabi): New function.
4908         (Target::set_osabi): New function.
4909         (Target::Target): Initialize osabi_.
4910         (Target::do_adjust_elf_header): Make pure virtual.
4911         (Sized_target::do_adjust_elf_header): Declare.
4912         * target.cc (Sized_target::do_adjust_elf_header): New function.
4913         (class Sized_target): Instantiate all versions.
4914         * freebsd.h (class Target_freebsd): Remove.
4915         (Target_selector_freebsd::do_recognize): Call set_osabi on
4916         Target.
4917         (Target_selector_freebsd::do_recognize_by_name): Likewise.
4918         (Target_selector_freebsd::set_osabi): Remove.
4919         * i386.cc (class Target_i386): Inherit from Sized_target rather
4920         than Target_freebsd.
4921         * x86_64.cc (class Target_x86_64): Likewise.
4922
4923 2011-06-28  Ian Lance Taylor  <iant@google.com>
4924
4925         * target.h (Target::can_check_for_function_pointers): Rewrite.
4926         Make non-virtual.
4927         (Target::can_icf_inline_merge_sections): Likewise.
4928         (Target::section_may_have_icf_unsafe_poineters): Likewise.
4929         (Target::Target_info): Add can_icf_inline_merge_sections field.
4930         (Target::do_can_check_for_function_pointers): New virtual
4931         function.
4932         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
4933         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
4934         from can_check_for_function_pointers, move in file.
4935         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
4936         section_may_have_icf_unsafe_poineters, move in file.
4937         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
4938         * i386.cc (Target_i386::do_can_check_for_function_pointers):
4939         Rename from can_check_for_function_pointers, move in file.
4940         (Target_i386::can_icf_inline_merge_sections): Remove.
4941         (Target_i386::i386_info): Initialize
4942         can_icf_inline_merge_sections.
4943         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
4944         Initialize can_icf_inline_merge_sections.
4945         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
4946         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
4947         Rename from can_check_for_function_pointers, move in file.
4948         (Target_x86_64::can_icf_inline_merge_sections): Remove.
4949         (Target_x86_64::x86_64_info): Initialize
4950         can_icf_inline_merge_sections.
4951         * testsuite/testfile.cc (Target_test::test_target_info):
4952         Likewise.
4953         * icf.cc (get_section_contents): Correct formatting.
4954
4955 2011-06-27  Ian Lance Taylor  <iant@google.com>
4956
4957         * symtab.cc (Symbol::versioned_name): New function.
4958         (Symbol_table::add_to_final_symtab): Use versioned_name when
4959         appropriate.
4960         (Symbol_table::sized_write_symbol): Likewise.
4961         * symtab.h (class Symbol): Declare versioned_name.
4962         * stringpool.h (class Stringpool_template): Add variant of add
4963         which takes a std::basic_string.
4964         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
4965         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
4966         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
4967         (ver_test_12.o): New target.
4968         * testsuite/Makefile.in: Rebuild.
4969
4970 2011-06-27  Doug Kwan  <dougkwan@google.com>
4971
4972         * arm.cc (Arm_relocate_functions::thm_jump8,
4973         Arm_relocate_functions::thm_jump11): Use a wider signed
4974         type to compute offset.
4975         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
4976         arm_thm_jump8.
4977         * testsuite/Makefile.in: Regenerate.
4978         * testsuite/arm_branch_in_range.sh: Check test results of
4979         arm_thm_jump11 and arm_thm_jump8.
4980         * testsuite/arm_thm_jump11.s: New test source file.
4981         * testsuite/arm_thm_jump11.t: New linker script.
4982         * testsuite/arm_thm_jump8.s: New test source file.
4983         * testsuite/arm_thm_jump8.t: New linker script.
4984
4985 2011-06-24  Ian Lance Taylor  <iant@google.com>
4986
4987         * layout.cc: Include "object.h".
4988         (ctors_sections_in_init_array): New static variable.
4989         (Layout::is_ctors_in_init_array): New function.
4990         (Layout::layout): Add entry to ctors_sections_in_init_array if
4991         appropriate.
4992         * layout.h (class Layout): Declare is_ctors_in_init_array.
4993         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
4994         is_ctors_reverse_view is set.
4995         (Sized_relobj_file::write_sections): Add layout parameter.  Change
4996         all callers.  Set is_ctors_reverse_view field of View_size.
4997         (Sized_relobj_file::reverse_words): New function.
4998         * object.h (Sized_relobj_file::View_size): Add
4999         is_ctors_reverse_view field.
5000         (class Sized_relobj_file): Update declarations.
5001         * testsuite/initpri3.c: New test.
5002         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
5003         initpri3b.
5004         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
5005         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
5006         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
5007         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
5008         * testsuite/Makefile.in: Rebuild.
5009
5010 2011-06-24  Cary Coutant  <ccoutant@google.com>
5011
5012         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
5013         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
5014         (debug_msg_cdebug.err): New targets.
5015         * testsuite/Makefile.in: Regenerate.
5016         * testsuite/debug_msg.sh: Check output of link with compressed debug.
5017         Fix checks for link with shared library.
5018
5019 2011-06-24  Doug Kwan  <dougkwan@google.com>
5020
5021         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
5022         skip empty text sections.
5023         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
5024
5025 2011-06-22  Ian Lance Taylor  <iant@google.com>
5026
5027         PR gold/12910
5028         * options.h (class General_options): Add --ctors-in-init-array.
5029         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
5030         friends as SHT_PROGBITS for merging sections.
5031         (Layout::layout): Remove special handling of .init_array and
5032         friends.  Don't sort if doing relocatable link.  Sort for .ctors
5033         and .dtors if ctors_in_init_array.
5034         (Layout::make_output_section): Force correct section types for
5035         .init_array and friends.  Don't sort if doing relocatable link,
5036         Don't sort .ctors and .dtors if ctors_in_init_array.
5037         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
5038         (Layout::output_section_name): Add relobj parameter.  Change all
5039         callers.  Handle .ctors. and .dtors. in code rather than table.
5040         Handle .ctors and .dtors if ctors_in_init_array.
5041         (Layout::match_file_name): New function, moved from output.cc.
5042         * layout.h (class Layout): Update declarations.
5043         * output.cc: Include "layout.h".
5044         (Input_section_sort_entry::get_priority): New function.
5045         (Input_section_sort_entry::match_file_name): Just call
5046         Layout::match_file_name.
5047         (Output_section::Input_section_sort_init_fini_compare::operator()):
5048         Handle .ctors and .dtors.  Sort by explicit priority rather than
5049         by name.
5050         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
5051         * testsuite/initpri2.c: New test.
5052         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
5053         (check_PROGRAMS): Add initpri2.
5054         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
5055         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
5056         * configure, testsuite/Makefile.in: Rebuild.
5057
5058 2011-06-19  Ian Lance Taylor  <iant@google.com>
5059
5060         PR gold/12880
5061         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
5062         .interp section to a PT_INTERP segment even if we have seen a
5063         --dynamic-linker option.  Don't do it if we have seen a PHDRS
5064         clause in a linker script.
5065         (Layout::finalize): Don't create a .interp section if we've
5066         already create a PT_INTERP segment.
5067         (Layout::create_interp): Always call choose_output_section (revert
5068         patch of 2011-06-17).  Don't create PT_INTERP segment.
5069         * script-sections.cc
5070         (Script_sections::create_note_and_tls_segments): Add a .interp
5071         section to a PT_INTERP segment even if we have seen a
5072         --dynamic-linker option.
5073
5074 2011-06-18  Ian Lance Taylor  <iant@google.com>
5075
5076         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
5077         merely because a non-PT_LOAD segment has a dynamic reloc.
5078
5079 2011-06-18  Ian Lance Taylor  <iant@google.com>
5080
5081         * layout.cc (Layout::finish_dynamic_section): Don't create
5082         DT_FLAGS entry if not needed.
5083
5084 2011-06-18  Ian Lance Taylor  <iant@google.com>
5085
5086         PR gold/12745
5087         * layout.cc (Layout::layout_eh_frame): Correct handling of
5088         writable .eh_frame section.
5089
5090 2011-06-17  Ian Lance Taylor  <iant@google.com>
5091
5092         PR gold/12893
5093         * resolve.cc (Symbol_table::resolve): Don't give an error if a
5094         symbol is redefined with the exact same object and value.
5095
5096 2011-06-17  Ian Lance Taylor  <iant@google.com>
5097
5098         PR gold/12880
5099         * layout.h (class Layout): Add interp_segment_ field.
5100         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
5101         (Layout::attach_allocated_section_to_segment): If making shared
5102         library, put .interp section in PT_INTERP segment.
5103         (Layout::finalize): Also call create_interp if -dynamic-linker
5104         option was used.
5105         (Layout::create_interp): Assert that there is no PT_INTERP
5106         segment.  If not using a SECTIONS clause, use make_output_section.
5107         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
5108         * script-sections.cc
5109         (Script_sections::create_note_and_tls_segments): If making shared
5110         library, put .interp section in PT_INTERP segment.
5111
5112 2011-06-17  Ian Lance Taylor  <iant@google.com>
5113
5114         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
5115         when making a shared library.
5116
5117 2011-06-17  Ian Lance Taylor  <iant@google.com>
5118
5119         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
5120         parameter.  Change all callers.  Don't issue warning about PC32
5121         against locally defined symbol.
5122
5123 2011-06-16  Ian Lance Taylor  <iant@google.com>
5124
5125         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
5126         occurs in same object.
5127
5128 2011-06-14  Alan Modra  <amodra@gmail.com>
5129
5130         * po/POTFILES.in: Regenerate.
5131
5132 2011-06-09  Ian Lance Taylor  <iant@google.com>
5133
5134         * script-sections.cc
5135         (Orphan_output_section::set_section_addresses): For a relocatable
5136         link set address to 0.
5137
5138 2011-06-09  Cary Coutant  <ccoutant@google.com>
5139
5140         PR gold/12804
5141         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
5142         used with --compress-debug-sections.
5143         * gold/object.cc (Sized_relobj_file::do_layout): Report
5144         uncompressed size of compressed input sections.
5145
5146 2011-06-08  Cary Coutant  <ccoutant@google.com>
5147
5148         PR gold/12804
5149         * testsuite/two_file_test_2_v1.cc: Change initialization of
5150         v2 to keep it in .data.
5151
5152 2011-06-07  Cary Coutant  <ccoutant@google.com>
5153
5154         * common.cc (Symbol_table::do_allocate_commons_list): Call
5155         gold_fallback.
5156         * errors.cc (Errors::fatal): Adjust call to gold_exit.
5157         (Errors::fallback): New function.
5158         (gold_fallback): New function.
5159         * errors.h (Errors::fallback): New function.
5160         * gold.cc (gold_exit): Change status parameter to enum; adjust
5161         all callers.
5162         (queue_initial_tasks): Call gold_fallback.
5163         * gold.h: Include cstdlib.
5164         (Exit_status): New enum type.
5165         (gold_exit): Change status parameter to enum.
5166         (gold_fallback): New function.
5167         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
5168         (Layout::create_symtab_sections): Likewise.
5169         (Layout::create_shdrs): Likewise.
5170         * main.cc (main): Adjust call to gold_exit.
5171         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
5172         (Output_data_got::add_got_entry_pair): Likewise.
5173         (Output_section::add_input_section): Likewise.
5174         (Output_section::add_output_section_data): Likewise.
5175         (Output_segment::set_section_list_addresses): Likewise.
5176         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
5177
5178 2011-06-07  Cary Coutant  <ccoutant@google.com>
5179
5180         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
5181         for incremental links.
5182         * output.cc (Output_segment::set_section_list_addresses): Remove
5183         FIXME and test for TLS or BSS.
5184
5185 2011-06-07  Cary Coutant  <ccoutant@google.com>
5186
5187         * testsuite/Makefile.am: Add incremental_copy_test,
5188         incremental_common_test_1.
5189         * testsuite/Makefile.in: Regenerate.
5190         * testsuite/common_test_1_v1.c: New source file.
5191         * testsuite/common_test_1_v2.c: New source file.
5192         * testsuite/copy_test_v1.cc: New source file.
5193
5194 2011-06-07  Cary Coutant  <ccoutant@google.com>
5195
5196         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
5197         update, allocate common from bss section's free list.
5198         * incremental-dump.cc (dump_incremental_inputs): Print flag for
5199         linker-defined symbols.
5200         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
5201         Skip GOT and PLT entries that are no longer referenced.
5202         (Output_section_incremental_inputs::write_info_blocks): Mark
5203         linker-defined symbols.
5204         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
5205         * output.cc (Output_section::allocate): New function.
5206         * output.h (Output_section::allocate): New function.
5207         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
5208         linker-defined symbols.
5209         (Symbol::override_base_with_special): Copy is_predefined_ flag.
5210         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
5211         (Symbol::init_base_output_data): Likewise.
5212         (Symbol::init_base_output_segment): Likewise.
5213         (Symbol::init_base_constant): Likewise.
5214         (Sized_symbol::init_output_data): Likewise.
5215         (Sized_symbol::init_output_segment): Likewise.
5216         (Sized_symbol::init_constant): Likewise.
5217         (Symbol_table::do_define_in_output_data): Likewise.
5218         (Symbol_table::do_define_in_output_segment): Likewise.
5219         (Symbol_table::do_define_as_constant): Likewise.
5220         * symtab.h (Symbol::is_predefined): New function.
5221         (Symbol::init_base_output_data): Add is_predefined parameter.
5222         (Symbol::init_base_output_segment): Likewise.
5223         (Symbol::init_base_constant): Likewise.
5224         (Symbol::is_predefined_): New data member.
5225         (Sized_symbol::init_output_data): Add is_predefined parameter.
5226         (Sized_symbol::init_output_segment): Likewise.
5227         (Sized_symbol::init_constant): Likewise.
5228         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
5229
5230 2011-06-07  Cary Coutant  <ccoutant@google.com>
5231
5232         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
5233         instead of emit_copy_reloc.
5234         (Copy_relocs::emit_copy_reloc): Refactor.
5235         (Copy_relocs::make_copy_reloc): New function.
5236         (Copy_relocs::add_copy_reloc): Remove.
5237         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
5238         section.
5239         (Copy_relocs::make_copy_reloc): New function.
5240         (Copy_relocs::add_copy_reloc): Remove.
5241         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
5242         unchanged input files.
5243         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
5244         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
5245         Reserve BSS space for COPY relocations.
5246         (Sized_incremental_binary::do_emit_copy_relocs): New function.
5247         (Output_section_incremental_inputs::write_info_blocks): Record
5248         whether a symbol is copied from a shared object.
5249         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
5250         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
5251         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
5252         (Incremental_input_entry_reader::get_output_symbol_index): Add
5253         is_copy parameter.
5254         (Incremental_binary::emit_copy_relocs): New function.
5255         (Incremental_binary::do_emit_copy_relocs): New function.
5256         (Sized_incremental_binary::Sized_incremental_binary): Initialize
5257         new data member.
5258         (Sized_incremental_binary::add_copy_reloc): New function.
5259         (Sized_incremental_binary::do_emit_copy_relocs): New function.
5260         (Sized_incremental_binary::Copy_reloc): New struct.
5261         (Sized_incremental_binary::Copy_relocs): New typedef.
5262         (Sized_incremental_binary::copy_relocs_): New data member.
5263         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
5264         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
5265         * target.h (Sized_target::emit_copy_reloc): New function.
5266         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
5267
5268 2011-06-02  Cary Coutant  <ccoutant@google.com>
5269
5270         PR gold/12163
5271         * gold/archive.cc (Archive::Archive): Initialize new data member.
5272         (Archive::include_all_members): Return if archive has already been
5273         included.
5274         * gold/archive.h (Archive::include_all_members_): New data member.
5275
5276 2011-06-02  Nick Clifton  <nickc@redhat.com>
5277
5278         * dynobj.h: Fix spelling mistake in comment.
5279         * output.cc: Likewise.
5280
5281 2011-05-31  Doug Kwan  <dougkwan@google.com>
5282             Asier Llano
5283
5284         PR gold/12826
5285         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
5286         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
5287         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
5288         redundant arm_exidx_test.so.
5289         * testsuite/Makefile.in: Regenerate.
5290         (check_SCRIPTS): Add pr12826.sh
5291         (check_DATA): Add pr12826.stdout
5292         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
5293         * testsuite/pr12826.sh: New file.
5294         * testsuite/pr12826_1.s: Ditto.
5295         * testsuite/pr12826_1.s: Ditto.
5296
5297 2011-05-30  Ian Lance Taylor  <iant@google.com>
5298
5299         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
5300         sections.
5301
5302 2011-05-29  Ian Lance Taylor  <iant@google.com>
5303
5304         PR gold/12804
5305         * testsuite/Makefile.am: Use different file name for two_file_test
5306         temporary file for each incremental test.
5307         * testsuite/Makefile.in: Rebuild.
5308
5309 2011-05-29  Ian Lance Taylor  <iant@google.com>
5310
5311         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
5312         binary input file is empty.
5313
5314 2011-05-27  Ian Lance Taylor  <iant@google.com>
5315
5316         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
5317         (ver_test_9.so): Likewise.
5318         * testsuite/Makefile.in: Rebuild.
5319
5320 2011-05-26 Cary Coutant  <ccoutant@google.com>
5321
5322         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
5323         * incremental.cc (Incremental_inputs::report_input_section): Fix
5324         comment, indentation.
5325         (Incremental_inputs::report_comdat_group): New function.
5326         (Output_section_incremental_inputs::set_final_data_size): Adjust size
5327         of data for incremental input file entry.
5328         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
5329         group count, COMDAT group signatures.
5330         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
5331         an unchanged input file.
5332         * incremental.h (Incremental_object_entry::Incremental_object_entry):
5333         Initialize new data member.
5334         (Incremental_object_entry::add_comdat_group): New function.
5335         (Incremental_object_entry::get_comdat_group_count): New function.
5336         (Incremental_object_entry::get_comdat_signature_key): New function.
5337         (Incremental_object_entry::groups_): New data member.
5338         (Incremental_inputs::report_comdat_group): New function.
5339         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
5340         data for incremental input file entry.
5341         (Incremental_input_entry_reader::get_comdat_group_count): New function.
5342         (Incremental_input_entry_reader::get_input_section): Adjust size of
5343         data for incremental input file entry.
5344         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
5345         (Incremental_input_entry_reader::get_comdat_group_signature): New
5346         function.
5347         * object.cc (Sized_relobj::include_section_group): Report kept
5348         COMDAT groups for incremental links.
5349
5350 2011-05-24  David Meyer  <pdox@google.com>
5351
5352         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
5353         with name parameter.  Add found_name parameter.
5354         * fileread.cc (Input_file::find_file): Adjust code accordingly.
5355         * dirsearch.h (class Dirsearch): Update declaration.
5356
5357 2011-05-24  Ian Lance Taylor  <iant@google.com>
5358
5359         * archive.cc (Library_base::should_include_member): Pull in object
5360         from archive if it defines the entry symbol.
5361         * parameters.cc (Parameters::entry): New function.
5362         * parameters.h (class Parameters): Declare entry.
5363         * output.h (class Output_file_header): Remove entry_ field.
5364         * output.cc (Output_file_header::Output_file_header): Remove entry
5365         parameter.  Change all callers.
5366         (Output_file_header::entry): Use parameters->entry.
5367         * gold.cc (queue_middle_tasks): Likewise.
5368         * plugin.cc (Plugin_hook::run): Likewise.
5369
5370 2011-05-24 Cary Coutant  <ccoutant@google.com>
5371
5372         * gold.cc (queue_initial_tasks): Pass incremental base filename
5373         to Output_file::open_base_file; don't print error message.
5374         * incremental-dump.cc (main): Adjust call to
5375         Output_file::open_for_modification.
5376         * incremental-dump.cc (main): Likewise.
5377         * incremental.cc (Incremental_inputs::report_command_line):
5378         Ignore --incremental-base option when comparing command lines.
5379         Ignore parameter when given as separate argument.
5380         * options.h (class General_options): Add --incremental-base.
5381         * output.cc (Output_file::Output_file):
5382         (Output_file::open_base_file): Add base_name and writable parameters;
5383         read base file into new file; print error message here.
5384         (Output_file::map_no_anonymous): Add writable parameter; adjust all
5385         callers.
5386         * output.h (Output_file::open_for_modification): Rename to...
5387         (Output_file::open_base_file): ...this; add base_name and
5388         writable parameters; adjust all callers.
5389         (Output_file::map_no_anonymous): Add writable parameter; adjust all
5390         callers.
5391         * testsuite/Makefile.am (incremental_test_4): Test
5392         --incremental-base.
5393         * testsuite/Makefile.in: Regenerate.
5394
5395 2011-05-24 Cary Coutant  <ccoutant@google.com>
5396
5397         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
5398         incremental_test_4.
5399         * testsuite/Makefile.in: Regenerate.
5400         * testsuite/two_file_test_1_v1.cc: New test source file.
5401         * testsuite/two_file_test_1b_v1.cc: New test source file.
5402         * testsuite/two_file_test_2_v1.cc: New test source file.
5403
5404 2011-05-24 Cary Coutant  <ccoutant@google.com>
5405
5406         * dynobj.h (Dynobj::do_dynobj): New function.
5407         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
5408         flag and soname for shared objects.
5409         * incremental.cc (Incremental_inputs::report_object): Make
5410         either Incremental_object_entry or Incremental_dynobj_entry; add
5411         soname to string table.
5412         (Incremental_inputs::report_input_section): Add assertion.
5413         (Output_section_incremental_inputs::set_final_data_size): Adjust
5414         type of input file entry for shared libraries; adjust size of
5415         shared library info entry.
5416         (Output_section_incremental_inputs::write_input_files): Write
5417         as_needed flag for shared libraries.
5418         (Output_section_incremental_inputs::write_info_blocks): Adjust type
5419         of input file entry for shared libraries; write soname.
5420         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
5421         soname from incremental info.
5422         * incremental.h (enum Incremental_input_flags): Add
5423         INCREMENTAL_INPUT_AS_NEEDED.
5424         (Incremental_input_entry::Incremental_input_entry): Initialize new
5425         data member.
5426         (Incremental_input_entry::set_as_needed): New function.
5427         (Incremental_input_entry::as_needed): New function.
5428         (Incremental_input_entry::do_dynobj_entry): New function.
5429         (Incremental_input_entry::as_needed_): New data member.
5430         (Incremental_object_entry::Incremental_object_entry): Don't check
5431         for shared library.
5432         (Incremental_object_entry::do_type): Likewise.
5433         (class Incremental_dynobj_entry): New class.
5434         (Incremental_input_entry_reader::as_needed): New function.
5435         (Incremental_input_entry_reader::get_soname): New function.
5436         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
5437         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
5438         size of shared library info entry.
5439         * layout.cc (Layout::finish_dynamic_section): Don't test for
5440         incremental link when adding DT_NEEDED entries.
5441         * object.h (Object::Object): Initialize new data member.
5442         (Object::dynobj): New function.
5443         (Object::set_as_needed): New function.
5444         (Object::as_needed): New function.
5445         (Object::do_dynobj): New function.
5446         (Object::as_needed_): New data member.
5447
5448 2011-05-24 Cary Coutant  <ccoutant@google.com>
5449
5450         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
5451         info; adjust display of GOT entries.
5452         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
5453         vector of input objects; remove file_status_.
5454         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
5455         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
5456         got_plt reader; call target hooks to reserve GOT entries.
5457         (Output_section_incremental_inputs::set_final_data_size): Adjust size
5458         of input file info header and GOT info entry.
5459         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
5460         relocation info.
5461         (Got_plt_view_info::got_descriptor): Remove.
5462         (Got_plt_view_info::sym_index): New data member.
5463         (Got_plt_view_info::input_index): New data member.
5464         (Local_got_offset_visitor::visit): Write input file index.
5465         (Global_got_offset_visitor::visit): Write 0 for input file index.
5466         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
5467         with sym_index and input_index.
5468         (Output_section_incremental_inputs::write_got_plt): Adjust size of
5469         incremental info GOT entry; replace got_descriptor with input_index.
5470         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
5471         map from input file index to object.
5472         (Sized_relobj_incr::do_layout): Replace direct data member reference
5473         with accessor function.
5474         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
5475         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
5476         Adjust size of input file info header.
5477         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
5478         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
5479         (Incremental_input_entry_reader::get_input_section): Adjust size of
5480         input file info header.
5481         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
5482         of incremental info GOT entry.
5483         (Incremental_got_plt_reader::get_got_desc): Remove.
5484         (Incremental_got_plt_reader::get_got_symndx): New function.
5485         (Incremental_got_plt_reader::get_got_input_index): New function.
5486         (Sized_incremental_binary::Sized_incremental_binary): Remove
5487         file_status_; add input_objects_.
5488         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
5489         (Sized_incremental_binary::set_file_is_unchanged): Remove.
5490         (Sized_incremental_binary::file_is_unchanged): Remove.
5491         (Sized_incremental_binary::set_input_object): New function.
5492         (Sized_incremental_binary::input_object): New function.
5493         (Sized_incremental_binary::file_status_): Remove.
5494         (Sized_incremental_binary::input_objects_): New data member.
5495         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
5496         references.
5497         (Sized_relobj_incr::invalid_address): Move to base class.
5498         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
5499         class.
5500         (Sized_relobj_incr::do_output_section_offset): Likewise.
5501         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
5502         (Sized_relobj_incr::section_offsets_): Likewise.
5503         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
5504         function.
5505         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
5506         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
5507         with accessor function.
5508         (Sized_relobj_file::do_layout): Likewise.
5509         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
5510         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
5511         (Sized_relobj_file::compute_final_local_value): Replace refs to
5512         section_offsets_ with accessor function.
5513         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
5514         * object.h (Relobj::Relobj): Initialize new data members.
5515         (Relobj::add_dyn_reloc): New function.
5516         (Relobj::first_dyn_reloc): New function.
5517         (Relobj::dyn_reloc_count): New function.
5518         (Relobj::first_dyn_reloc_): New data member.
5519         (Relobj::dyn_reloc_count_): New data member.
5520         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
5521         references.
5522         (Sized_relobj::Address): New typedef.
5523         (Sized_relobj::invalid_address): Move here from child class.
5524         (Sized_relobj::Sized_relobj): Initialize new data members.
5525         (Sized_relobj::sized_relobj): New function.
5526         (Sized_relobj::is_output_section_offset_invalid): Move here from
5527         child class.
5528         (Sized_relobj::get_output_section_offset): Likewise.
5529         (Sized_relobj::local_has_got_offset): Likewise.
5530         (Sized_relobj::local_got_offset): Likewise.
5531         (Sized_relobj::set_local_got_offset): Likewise.
5532         (Sized_relobj::do_for_all_local_got_entries): Likewise.
5533         (Sized_relobj::clear_got_offsets): New function.
5534         (Sized_relobj::section_offsets): Move here from child class.
5535         (Sized_relobj::do_output_section_offset): Likewise.
5536         (Sized_relobj::do_set_section_offset): Likewise.
5537         (Sized_relobj::Local_got_offsets): Likewise.
5538         (Sized_relobj::local_got_offsets_): Likewise.
5539         (Sized_relobj::section_offsets_): Likewise.
5540         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
5541         references.
5542         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
5543         class.
5544         (Sized_relobj_file::sized_relobj): New function
5545         (Sized_relobj_file::local_has_got_offset): Move to base class.
5546         (Sized_relobj_file::local_got_offset): Likewise.
5547         (Sized_relobj_file::set_local_got_offset): Likewise.
5548         (Sized_relobj_file::get_output_section_offset): Likewise.
5549         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
5550         (Sized_relobj_file::do_output_section_offset): Likewise.
5551         (Sized_relobj_file::do_set_section_offset): Likewise.
5552         (Sized_relobj_file::Local_got_offsets): Likewise.
5553         (Sized_relobj_file::local_got_offsets_): Likewise.
5554         (Sized_relobj_file::section_offsets_): Likewise.
5555         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
5556         (all constructors).
5557         (set_needs_dynsym_index): Convert relobj to derived class pointer.
5558         (Output_reloc::get_symbol_index): Likewise.
5559         (Output_reloc::local_section_offset): Likewise.
5560         (Output_reloc::get_address): Likewise.
5561         (Output_reloc::symbol_value): Likewise.
5562         (Output_data_got::reserve_slot): Move to class definition.
5563         (Output_data_got::reserve_local): New function.
5564         (Output_data_got::reserve_slot_for_global): Remove.
5565         (Output_data_got::reserve_global): New function.
5566         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
5567         (all constructors, two instantiations).
5568         (Output_reloc::get_relobj): New function (two instantiations).
5569         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
5570         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
5571         (Output_data_reloc::add_global): Adjust type of relobj.
5572         (Output_data_reloc::add_global_relative): Likewise.
5573         (Output_data_reloc::add_symbolless_global_addend): Likewise.
5574         (Output_data_reloc::add_local): Likewise.
5575         (Output_data_reloc::add_local_relative): Likewise.
5576         (Output_data_reloc::add_symbolless_local_addend): Likewise.
5577         (Output_data_reloc::add_local_section): Likewise.
5578         (Output_data_reloc::add_output_section): Likewise.
5579         (Output_data_reloc::add_absolute): Likewise.
5580         (Output_data_reloc::add_target_specific): Likewise.
5581         (Output_data_got::reserve_slot): Move definition here.
5582         (Output_data_got::reserve_local): New function.
5583         (Output_data_got::reserve_global): New function.
5584         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
5585         section_offsets_ with accessor function.
5586         (Sized_relobj_file::write_sections): Likewise.
5587         (Sized_relobj_file::do_relocate_sections): Likewise.
5588         * target.h (Sized_target::reserve_local_got_entry): New function.
5589         (Sized_target::reserve_global_got_entry): New function.
5590         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
5591         (Target_x86_64::reserve_global_got_entry): New function.
5592         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
5593
5594 2011-05-23 Cary Coutant  <ccoutant@google.com>
5595
5596         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
5597         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
5598         bit when checking got_type.
5599         * incremental.cc (Sized_incremental_binary::setup_readers):
5600         Store symbol table and string table locations; initialize bit vector
5601         of file status flags.
5602         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
5603         unchanged files.
5604         (Sized_incremental_binary::do_process_got_plt): New function.
5605         (Sized_incremental_binary::get_symtab_view): Use stored locations.
5606         (Output_section_incremental_inputs::set_final_data_size): Record
5607         file index for each input file.
5608         (Output_section_incremental_inputs::write_got_plt): Store file index
5609         instead of input entry offset for each GOT entry.
5610         * incremental.h
5611         (Incremental_input_entry::Incremental_input_entry): Initialize new
5612         data member.
5613         (Incremental_input_entry::set_offset): Store file index.
5614         (Incremental_input_entry::get_file_index): New function.
5615         (Incremental_input_entry::file_index_): New data member.
5616         (Incremental_binary::process_got_plt): New function.
5617         (Incremental_binary::do_process_got_plt): New function.
5618         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
5619         data members.
5620         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
5621         (Sized_incremental_binary::set_file_is_unchanged): New function.
5622         (Sized_incremental_binary::file_is_unchanged): New function.
5623         (Sized_incremental_binary::do_process_got_plt): New function.
5624         (Sized_incremental_binary::file_status_): New data member.
5625         (Sized_incremental_binary::main_symtab_loc_): New data member.
5626         (Sized_incremental_binary::main_strtab_loc_): New data member.
5627         * output.cc (Output_data_got::Got_entry::write): Add case
5628         RESERVED_CODE.
5629         (Output_data_got::add_global): Call add_got_entry.
5630         (Output_data_got::add_global_plt): Likewise.
5631         (Output_data_got::add_global_with_rel): Likewise.
5632         (Output_data_got::add_global_with_rela): Likewise.
5633         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
5634         (Output_data_got::add_global_pair_with_rela): Likewise.
5635         (Output_data_got::add_local): Call add_got_entry.
5636         (Output_data_got::add_local_plt): Likewise.
5637         (Output_data_got::add_local_with_rel): Likewise.
5638         (Output_data_got::add_local_with_rela): Likewise.
5639         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
5640         (Output_data_got::add_local_pair_with_rela): Likewise.
5641         (Output_data_got::reserve_slot): New function.
5642         (Output_data_got::reserve_slot_for_global): New function.
5643         (Output_data_got::add_got_entry): New function.
5644         (Output_data_got::add_got_entry_pair): New function.
5645         (Output_section::add_output_section_data): Edit FIXME.
5646         * output.h
5647         (Output_section_data_build::Output_section_data_build): New
5648         constructor with size parameter.
5649         (Output_data_space::Output_data_space): Likewise.
5650         (Output_data_got::Output_data_got): Initialize new data member; new
5651         constructor with size parameter.
5652         (Output_data_got::add_constant): Call add_got_entry.
5653         (Output_data_got::reserve_slot): New function.
5654         (Output_data_got::reserve_slot_for_global): New function.
5655         (class Output_data_got::Got_entry): Add RESERVED_CODE.
5656         (Output_data_got::add_got_entry): New function.
5657         (Output_data_got::add_got_entry_pair): New function.
5658         (Output_data_got::free_list_): New data member.
5659         * target.h (Sized_target::init_got_plt_for_update): New function.
5660         (Sized_target::register_global_plt_entry): New function.
5661         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
5662         Initialize new data member; call init; add constructor with PLT count.
5663         (Output_data_plt_x86_64::init): New function.
5664         (Output_data_plt_x86_64::add_relocation): New function.
5665         (Output_data_plt_x86_64::reserve_slot): New function.
5666         (Output_data_plt_x86_64::free_list_): New data member.
5667         (Target_x86_64::init_got_plt_for_update): New function.
5668         (Target_x86_64::register_global_plt_entry): New function.
5669         (Output_data_plt_x86_64::add_entry): Allocate from free list for
5670         incremental updates.
5671         (Output_data_plt_x86_64::add_relocation): New function.
5672         * testsuite/object_unittest.cc (Object_test): Set default options.
5673
5674 2011-05-16  Ian Lance Taylor  <iant@google.com>
5675
5676         * options.h (class General_options): Make -i a synonym for -r.
5677
5678 2011-05-16  Ian Lance Taylor  <iant@google.com>
5679
5680         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
5681
5682 2011-05-10 Cary Coutant  <ccoutant@google.com>
5683
5684         * object.cc (Sized_relobj::do_count_local_symbols): Check for
5685         strip_all (-s).
5686
5687 2011-05-06  Ian Lance Taylor  <iant@google.com>
5688
5689         * layout.cc (Layout::layout): If the output section flags change,
5690         update the ordering.
5691
5692 2011-04-25 Cary Coutant  <ccoutant@google.com>
5693
5694         * incremental-dump.cc (dump_incremental_inputs): Print local
5695         symbol info for each input file.
5696         * incremental.cc
5697         (Output_section_incremental_inputs::set_final_data_size): Add local
5698         symbol info to input file entries in incremental info.
5699         (Output_section_incremental_inputs::write_info_blocks): Likewise.
5700         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
5701         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
5702         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
5703         implementation.
5704         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
5705         (Sized_incr_relobj::do_relocate): Write the local symbols.
5706         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
5707         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
5708         Adjust size of input file header.
5709         (Incremental_inputs_reader::get_local_symbol_offset): New function.
5710         (Incremental_inputs_reader::get_local_symbol_count): New function.
5711         (Incremental_inputs_reader::get_input_section): Adjust size of input
5712         file header.
5713         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
5714         (Sized_incr_relobj::This): New typedef.
5715         (Sized_incr_relobj::sym_size): New const data member.
5716         (Sized_incr_relobj::Local_symbol): New struct.
5717         (Sized_incr_relobj::do_output_local_symbol_count): New function.
5718         (Sized_incr_relobj::do_local_symbol_offset): New function.
5719         (Sized_incr_relobj::local_symbol_count_): New data member.
5720         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
5721         (Sized_incr_relobj::local_symbol_index_): New data member.
5722         (Sized_incr_relobj::local_symbol_offset_): New data member.
5723         (Sized_incr_relobj::local_dynsym_offset_): New data member.
5724         (Sized_incr_relobj::local_symbols_): New data member.
5725         * object.h (Relobj::output_local_symbol_count): New function.
5726         (Relobj::local_symbol_offset): New function.
5727         (Relobj::do_output_local_symbol_count): New function.
5728         (Relobj::do_local_symbol_offset): New function.
5729         (Sized_relobj::do_output_local_symbol_count): New function.
5730         (Sized_relobj::do_local_symbol_offset): New function.
5731
5732 2011-04-22  Vladimir Simonov  <sv@sw.ru>
5733
5734         * descriptors.cc (set_close_on_exec): New function.
5735         (Descriptors::open): Use set_close_on_exec.
5736         * output.cc (S_ISLNK): Define if not defined.
5737
5738 2011-04-22 Cary Coutant  <ccoutant@google.com>
5739
5740         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
5741         global symbol map.
5742         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
5743         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
5744         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
5745         relocations.
5746         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
5747         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
5748         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
5749         * incremental.h
5750         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
5751         function.
5752         (Incremental_binary::apply_incremental_relocs): New function.
5753         (Incremental_binary::do_apply_incremental_relocs): New function.
5754         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
5755         data member.
5756         (Sized_incremental_binary::add_global_symbol): New function.
5757         (Sized_incremental_binary::global_symbol): New function.
5758         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
5759         (Sized_incremental_binary::symbol_map_): New data member.
5760         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
5761         * target.h (Sized_target::apply_relocation): New function.
5762         * target-reloc.h (apply_relocation): New function.
5763         * x86_64.cc (Target_x86_64::apply_relocation): New function.
5764
5765 2011-04-22  Doug Kwan  <dougkwan@google.com>
5766
5767         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
5768         flag of a SHT_ARM_EXIDX section.
5769         * testsuite/Makefile.am (arm_exidx_test): New test rules.
5770         * testsuite/Makefile.in: Regenerate.
5771         * testsuite/arm_exidx_test.s: New file.
5772         * testsuite/arm_exidx_test.sh: Same.
5773
5774 2011-04-20 Cary Coutant  <ccoutant@google.com>
5775
5776         PR gold/12689
5777         * archive.h (Incremental_archive_entry::Archive_member):
5778         Initialize arg_serial_ (second constructor).
5779
5780 2011-04-17  Ian Lance Taylor  <iant@google.com>
5781
5782         * object.cc (Relocate_info::location): Simplify location string.
5783         * errors.cc (Errors::error_at_location): Don't print program
5784         name.
5785         (Errors::warning_at_location): Likewise.
5786         (Errors::undefined_symbol): Likewise.
5787         * testsuite/debug_msg.sh: Update accordingly.
5788
5789 2011-04-14 Cary Coutant  <ccoutant@google.com>
5790
5791         * gold/layout.cc (Layout::symtab_section_offset): New function.
5792         * gold/layout.h (Layout::symtab_section_offset): New function.
5793         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
5794
5795 2011-04-12  Ian Lance Taylor  <iant@google.com>
5796
5797         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
5798         with MREMAP_MAYMOVE.
5799         * output.h (class Output_file): Add map_is_allocated_ field.
5800         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
5801         not available, provide stubs.  If mremap is not available, #define
5802         it to gold_mremap.
5803         (MREMAP_MAYMOVE): Define if not defined.
5804         (Output_file::Output_file): Initialize map_is_allocated_.
5805         (Output_file::resize): Check map_is_allocated_.
5806         (Output_file::map_anonymous): If mmap fails, use malloc.
5807         (Output_file::unmap): Don't do anything for an anonymous map.
5808         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
5809         is not available, provide stubs.
5810         (File_read::View::~View): Use free rather than delete[].
5811         (File_read::make_view): Use malloc rather than new[].  If mmap
5812         fails, use malloc.
5813         (File_read::find_or_make_view): Use malloc rather than new[].
5814         * gold.h: Remove HAVE_REMAP code.
5815         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
5816         exists.  Rename mremap to gold_mremap.  If mmap is not available
5817         don't do anything.
5818         * configure, config.in: Rebuild.
5819
5820 2011-04-11  Ian Lance Taylor  <iant@google.com>
5821
5822         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
5823         initialize local variable v.
5824
5825 2011-04-11  Cary Coutant  <ccoutant@google.com>
5826
5827         * archive.cc (Archive::include_member): Adjust call to
5828         report_object.
5829         (Add_archive_symbols::run): Track argument serial numbers.
5830         (Lib_group::include_member): Likewise.
5831         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
5832         * archive.h (Incremental_archive_entry::Archive_member):
5833         Initialize arg_serial_.
5834         (Archive_member::arg_serial_): New data member.
5835         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
5836         (Sized_dynobj::do_add_symbols): Track symbols when doing an
5837         incremental link.
5838         (Sized_dynobj::do_for_all_local_got_entries): New function.
5839         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
5840         function.
5841         * fileread.cc (get_mtime): New function.
5842         * fileread.h (get_mtime): New function.
5843         * gold.cc (queue_initial_tasks): Check for incremental update.
5844         (process_incremental_input): New function.
5845         (queue_middle_tasks): Don't force valid target for incremental
5846         update.
5847         * incremental-dump.cc (find_input_containing_global): Adjust
5848         size of symbol info entry.
5849         (dump_incremental_inputs): Dump argument serial number and
5850         in_system_directory flag; bias shndx by 1; print symbol names
5851         when dumping per-file symbol lists; use new symbol info readers.
5852         * incremental.cc
5853         (Output_section_incremental_inputs:update_data_size): New function.
5854         (Sized_incremental_binary::setup_readers): Setup input readers
5855         for each input file; build maps for files added from libraries
5856         and scripts.
5857         (Sized_incremental_binary::check_input_args): New function.
5858         (Sized_incremental_binary::do_check_inputs): Build map of argument
5859         serial numbers to input arguments.
5860         (Sized_incremental_binary::do_file_has_changed): Rename
5861         do_file_is_unchanged to this; compare file modification times.
5862         (Sized_incremental_binary::do_init_layout): New function.
5863         (Sized_incremental_binary::do_reserve_layout): New function.
5864         (Sized_incremental_binary::do_get_input_reader): Remove.
5865         (Sized_incremental_binary::get_symtab_view): New function.
5866         (Incremental_checker::can_incrementally_link_output_file): Remove.
5867         (Incremental_inputs::report_command_line): Exclude --debug options.
5868         (Incremental_inputs::report_archive_begin): Add parameter; track
5869         argument serial numbers; don't put input file entry for archive
5870         before archive members.
5871         (Incremental_inputs::report_archive_end): Put input file entry
5872         for archive after archive members.
5873         (Incremental_inputs::report_object): Add parameter; track argument
5874         serial numbers and in_system_directory flag.
5875         (Incremental_inputs::report_script): Add parameter; track argument
5876         serial numbers.
5877         (Output_section_incremental_inputs::set_final_data_size): Adjust
5878         size of symbol info entry; check for forwarding symbols.
5879         (Output_section_incremental_inputs::write_input_files): Write
5880         in_system_directory flag and argument serial number.
5881         (Output_section_incremental_inputs::write_info_blocks): Map section
5882         indices between incremental info and original input file; store
5883         input section index for each symbol.
5884         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
5885         change operator() to visit().
5886         (class Global_got_offset_visitor): Likewise.
5887         (class Global_symbol_visitor_got_plt):
5888         (Output_section_incremental_inputs::write_got_plt): Use new visitor
5889         classes.
5890         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
5891         (Sized_incr_relobj::do_read_symbols): New function.
5892         (Sized_incr_relobj::do_layout): New function.
5893         (Sized_incr_relobj::do_layout_deferred_sections): New function.
5894         (Sized_incr_relobj::do_add_symbols): New function.
5895         (Sized_incr_relobj::do_should_include_member): New function.
5896         (Sized_incr_relobj::do_for_all_global_symbols): New function.
5897         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
5898         (Sized_incr_relobj::do_section_size): New function.
5899         (Sized_incr_relobj::do_section_name): New function.
5900         (Sized_incr_relobj::do_section_contents): New function.
5901         (Sized_incr_relobj::do_section_flags): New function.
5902         (Sized_incr_relobj::do_section_entsize): New function.
5903         (Sized_incr_relobj::do_section_address): New function.
5904         (Sized_incr_relobj::do_section_type): New function.
5905         (Sized_incr_relobj::do_section_link): New function.
5906         (Sized_incr_relobj::do_section_info): New function.
5907         (Sized_incr_relobj::do_section_addralign): New function.
5908         (Sized_incr_relobj::do_initialize_xindex): New function.
5909         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
5910         (Sized_incr_relobj::do_read_relocs): New function.
5911         (Sized_incr_relobj::do_gc_process_relocs): New function.
5912         (Sized_incr_relobj::do_scan_relocs): New function.
5913         (Sized_incr_relobj::do_count_local_symbols): New function.
5914         (Sized_incr_relobj::do_finalize_local_symbols): New function.
5915         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
5916         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
5917         (Sized_incr_relobj::do_relocate): New function.
5918         (Sized_incr_relobj::do_set_section_offset): New function.
5919         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
5920         (Sized_incr_dynobj::do_read_symbols): New function.
5921         (Sized_incr_dynobj::do_layout): New function.
5922         (Sized_incr_dynobj::do_add_symbols): New function.
5923         (Sized_incr_dynobj::do_should_include_member): New function.
5924         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
5925         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
5926         (Sized_incr_dynobj::do_section_size): New function.
5927         (Sized_incr_dynobj::do_section_name): New function.
5928         (Sized_incr_dynobj::do_section_contents): New function.
5929         (Sized_incr_dynobj::do_section_flags): New function.
5930         (Sized_incr_dynobj::do_section_entsize): New function.
5931         (Sized_incr_dynobj::do_section_address): New function.
5932         (Sized_incr_dynobj::do_section_type): New function.
5933         (Sized_incr_dynobj::do_section_link): New function.
5934         (Sized_incr_dynobj::do_section_info): New function.
5935         (Sized_incr_dynobj::do_section_addralign): New function.
5936         (Sized_incr_dynobj::do_initialize_xindex): New function.
5937         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
5938         (make_sized_incremental_object): New function.
5939         (Incremental_library::copy_unused_symbols): New function.
5940         (Incremental_library::do_for_all_unused_symbols): New function.
5941         * incremental.h (enum Incremental_input_flags): New type.
5942         (class Incremental_checker): Remove.
5943         (Incremental_input_entry::Incremental_input_entry): Add argument
5944         serial number.
5945         (Incremental_input_entry::arg_serial): New function.
5946         (Incremental_input_entry::set_is_in_system_directory): New function.
5947         (Incremental_input_entry::is_in_system_directory): New function.
5948         (Incremental_input_entry::arg_serial_): New data member.
5949         (Incremental_input_entry::is_in_system_directory_): New data member.
5950         (class Script_info): Move here from script.h.
5951         (Script_info::Script_info): Add filename parameter.
5952         (Script_info::filename): New function.
5953         (Script_info::filename_): New data member.
5954         (Incremental_script_entry::Incremental_script_entry): Add argument
5955         serial number.
5956         (Incremental_object_entry::Incremental_object_entry): Likewise.
5957         (Incremental_object_entry::add_input_section): Build list of input
5958         sections with map to original shndx.
5959         (Incremental_object_entry::get_input_section_index): New function.
5960         (Incremental_object_entry::shndx_): New data member.
5961         (Incremental_object_entry::name_key_): Rename; adjust all refs.
5962         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
5963         (Incremental_archive_entry::Incremental_archive_entry): Add argument
5964         serial number.
5965         (Incremental_inputs::report_archive_begin): Likewise.
5966         (Incremental_inputs::report_object): Likewise.
5967         (Incremental_inputs::report_script): Likewise.
5968         (class Incremental_global_symbol_reader): New class.
5969         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
5970         and store flags and input file type.
5971         (Incremental_input_entry_reader::arg_serial): New function.
5972         (Incremental_input_entry_reader::type): Extract type from flags.
5973         (Incremental_input_entry_reader::is_in_system_directory): New function.
5974         (Incremental_input_entry_reader::get_input_section_count): Call
5975         accessor function for type.
5976         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
5977         function for type; adjust size of global symbol entry.
5978         (Incremental_input_entry_reader::get_global_symbol_count): Call
5979         accessor function for type.
5980         (Incremental_input_entry_reader::get_object_count): Likewise.
5981         (Incremental_input_entry_reader::get_object_offset): Likewise.
5982         (Incremental_input_entry_reader::get_member_count): Likewise.
5983         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
5984         (Incremental_input_entry_reader::get_member_offset): Likewise.
5985         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
5986         (Incremental_input_entry_reader::Global_symbol_info): Remove.
5987         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
5988         (Incremental_input_entry_reader::get_global_symbol_reader): New
5989         function.
5990         (Incremental_input_entry_reader::get_output_symbol_index): New
5991         function.
5992         (Incremental_input_entry_reader::type_): Remove.
5993         (Incremental_input_entry_reader::flags_): New data member.
5994         (Incremental_inputs_reader::input_file_offset): New function.
5995         (Incremental_inputs_reader::input_file_index): New function.
5996         (Incremental_inputs_reader::input_file): Call input_file_offset.
5997         (Incremental_inputs_reader::input_file_at_offset): New function.
5998         (Incremental_relocs_reader::get_r_type): Reformat.
5999         (Incremental_relocs_reader::get_r_shndx): Reformat.
6000         (Incremental_relocs_reader::get_r_offset): Reformat.
6001         (Incremental_relocs_reader::data): New function.
6002         (Incremental_binary::Incremental_binary): Initialize new data members.
6003         (Incremental_binary::check_inputs): Add cmdline parameter.
6004         (Incremental_binary::file_is_unchanged): Remove.
6005         (Input_reader::arg_serial): New function.
6006         (Input_reader::get_unused_symbol_count): New function.
6007         (Input_reader::get_unused_symbol): New function.
6008         (Input_reader::do_arg_serial): New function.
6009         (Input_reader::do_get_unused_symbol_count): New function.
6010         (Input_reader::do_get_unused_symbol): New function.
6011         (Incremental_binary::input_file_count): New function.
6012         (Incremental_binary::get_input_reader): Change signature to use
6013         index instead of filename.
6014         (Incremental_binary::file_has_changed): New function.
6015         (Incremental_binary::get_input_argument): New function.
6016         (Incremental_binary::get_library): New function.
6017         (Incremental_binary::get_script_info): New function.
6018         (Incremental_binary::init_layout): New function.
6019         (Incremental_binary::reserve_layout): New function.
6020         (Incremental_binary::output_file): New function.
6021         (Incremental_binary::do_check_inputs): New function.
6022         (Incremental_binary::do_file_is_unchanged): Remove.
6023         (Incremental_binary::do_file_has_changed): New function.
6024         (Incremental_binary::do_init_layout): New function.
6025         (Incremental_binary::do_reserve_layout): New function.
6026         (Incremental_binary::do_input_file_count): New function.
6027         (Incremental_binary::do_get_input_reader): Change signature.
6028         (Incremental_binary::input_args_map_): New data member.
6029         (Incremental_binary::library_map_): New data member.
6030         (Incremental_binary::script_map_): New data member.
6031         (Sized_incremental_binary::Sized_incremental_binary): Initialize
6032         new data members.
6033         (Sized_incremental_binary::output_section): New function.
6034         (Sized_incremental_binary::inputs_reader): Add const.
6035         (Sized_incremental_binary::symtab_reader): Add const.
6036         (Sized_incremental_binary::relocs_reader): Add const.
6037         (Sized_incremental_binary::got_plt_reader): Add const.
6038         (Sized_incremental_binary::get_symtab_view): New function.
6039         (Sized_incremental_binary::Inputs_reader): New typedef.
6040         (Sized_incremental_binary::Input_entry_reader): New typedef.
6041         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
6042         (Sized_incremental_binary::do_file_is_unchanged): Remove.
6043         (Sized_incremental_binary::do_file_has_changed): New function.
6044         (Sized_incremental_binary::do_init_layout): New function.
6045         (Sized_incremental_binary::do_reserve_layout): New function.
6046         (Sized_input_reader::Inputs_reader): Remove.
6047         (Sized_input_reader::Input_entry_reader): Remove.
6048         (Sized_input_reader::do_arg_serial): New function.
6049         (Sized_input_reader::do_get_unused_symbol_count): New function.
6050         (Sized_input_reader::do_get_unused_symbol): New function.
6051         (Sized_incremental_binary::do_input_file_count): New function.
6052         (Sized_incremental_binary::do_get_input_reader): Change signature;
6053         use index instead of filename.
6054         (Sized_incremental_binary::section_map_): New data member.
6055         (Sized_incremental_binary::input_entry_readers_): New data member.
6056         (class Sized_incr_relobj): New class.
6057         (class Sized_incr_dynobj): New class.
6058         (make_sized_incremental_object): New function.
6059         (class Incremental_library): New class.
6060         * layout.cc (Free_list::num_lists): New static data member.
6061         (Free_list::num_nodes): New static data member.
6062         (Free_list::num_removes): New static data member.
6063         (Free_list::num_remove_visits): New static data member.
6064         (Free_list::num_allocates): New static data member.
6065         (Free_list::num_allocate_visits): New static data member.
6066         (Free_list::init): New function.
6067         (Free_list::remove): New function.
6068         (Free_list::allocate): New function.
6069         (Free_list::dump): New function.
6070         (Free_list::print_stats): New function.
6071         (Layout_task_runner::run): Resize output file for incremental updates.
6072         (Layout::Layout): Initialize new data members.
6073         (Layout::set_incremental_base): New function.
6074         (Layout::init_fixed_output_section): New function.
6075         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
6076         incremental updates.
6077         (Layout::create_gold_note): Do not create gold note section for
6078         incremental updates.
6079         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
6080         for incremental updates.
6081         (Layout::set_section_offsets): For incremental updates, allocate space
6082         from free list.
6083         (Layout::create_symtab_sections): Layout with offsets relative to
6084         start of section; for incremental updates, allocate space from free
6085         list.
6086         (Layout::create_shdrs): For incremental updates, allocate space from
6087         free list.
6088         (Layout::finish_dynamic_section): For incremental updates, do not
6089         check --as-needed (fixed in subsequent patch).
6090         * layout.h (class Free_list): New class.
6091         (Layout::set_incremental_base): New function.
6092         (Layout::incremental_base): New function.
6093         (Layout::init_fixed_output_section): New function.
6094         (Layout::allocate): New function.
6095         (Layout::incremental_base_): New data member.
6096         (Layout::free_list_): New data member.
6097         * main.cc (main): Print Free_list statistics.
6098         * object.cc (Relobj::finalize_incremental_relocs): Add
6099         clear_counts parameter; clear counts only when clear_counts is set.
6100         (Sized_relobj::Sized_relobj): Initialize new base class.
6101         (Sized_relobj::do_layout): Don't report special sections.
6102         (Sized_relobj::do_for_all_local_got_entries): New function.
6103         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
6104         symtab_off to all symbol table offsets.
6105         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
6106         * object.h (class Got_offset_list): Move to top of file.
6107         (Object::Object): Allow case where input_file == NULL.
6108         (Object::~Object): Likewise.
6109         (Object::input_file): Assert that input_file != NULL.
6110         (Object::lock): Allow case where input_file == NULL.
6111         (Object::unlock): Likewise.
6112         (Object::is_locked): Likewise.
6113         (Object::token): Likewise.
6114         (Object::release): Likewise.
6115         (Object::is_incremental): New function.
6116         (Object::get_mtime): New function.
6117         (Object::for_all_local_got_entries): New function.
6118         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
6119         (Object::set_is_in_system_directory): New function.
6120         (Object::is_in_system_directory): New function.
6121         (Object::do_is_incremental): New function.
6122         (Object::do_get_mtime): New function.
6123         (Object::do_for_all_local_got_entries): New function.
6124         (Object::is_in_system_directory_): New data member.
6125         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
6126         (class Sized_relobj_base): New class.
6127         (class Sized_relobj): Derive from Sized_relobj_base.
6128         (class Sized_relobj::Symbols): Redeclare from base class.
6129         (class Sized_relobj::local_got_offset_list): Remove.
6130         (class Sized_relobj::Output_sections): Redeclare from base class.
6131         (class Sized_relobj::do_for_all_local_got_entries): New function.
6132         (class Sized_relobj::write_local_symbols): Add offset parameter.
6133         (class Sized_relobj::local_symbol_offset_): Update comment.
6134         (class Sized_relobj::local_dynsym_offset_): Update comment.
6135         * options.cc (Input_arguments::add_file): Remove const.
6136         * options.h (Input_file_argument::Input_file_argument):
6137         Initialize arg_serial_ (all constructors).
6138         (Input_file_argument::set_arg_serial): New function.
6139         (Input_file_argument::arg_serial): New function.
6140         (Input_file_argument::arg_serial_): New data member.
6141         (Input_arguments::Input_arguments): Initialize file_count_.
6142         (Input_arguments::add_file): Remove const.
6143         (Input_arguments::number_of_input_files): New function.
6144         (Input_arguments::file_count_): New data member.
6145         (Command_line::number_of_input_files): Call
6146         Input_arguments::number_of_input_files.
6147         * output.cc (Output_segment_headers::Output_segment_headers):
6148         Set current size.
6149         (Output_section::Input_section::current_data_size): New function.
6150         (Output_section::Output_section): Initialize new data members.
6151         (Output_section::add_input_section): Don't do merge sections for
6152         an incremental link; allocate space from free list for an
6153         incremental update.
6154         (Output_section::add_output_section_data): Allocate space from
6155         free list for an incremental update.
6156         (Output_section::update_data_size): New function.
6157         (Output_section::set_fixed_layout): New function.
6158         (Output_section::reserve): New function.
6159         (Output_segment::set_section_addresses): Remove const.
6160         (Output_segment::set_section_list_addresses): Remove const; allocate
6161         space from free list for an incremental update.
6162         (Output_segment::set_offset): Adjust size of RELRO segment for an
6163         incremental update.
6164         * output.h (Output_data::current_data_size): Move here from
6165         child classes.
6166         (Output_data::pre_finalize_data_size): New function.
6167         (Output_data::update_data_size): New function.
6168         (Output_section_headers::update_data_size): new function.
6169         (Output_section_data_build::current_data_size): Move to Output_data.
6170         (Output_data_strtab::update_data_size): New function.
6171         (Output_section::current_data_size): Move to Output_data.
6172         (Output_section::set_fixed_layout): New function.
6173         (Output_section::has_fixed_layout): New function.
6174         (Output_section::reserve): New function.
6175         (Output_section::update_data_size): New function.
6176         (Output_section::has_fixed_layout_): New data member.
6177         (Output_section::free_list_): New data member.
6178         (Output_segment::set_section_addresses): Remove const.
6179         (Output_segment::set_section_list_addresses): Remove const.
6180         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
6181         New function.
6182         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
6183         New function.
6184         * readsyms.cc (Read_symbols::do_read_symbols): Add library
6185         parameter when calling Add_symbols constructor; store argument
6186         serial number for members of a lib group.
6187         (Add_symbols::locks): Allow case where token == NULL.
6188         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
6189         (Read_member::~Read_member): New function.
6190         (Read_member::is_runnable): New function.
6191         (Read_member::locks): New function.
6192         (Read_member::run): New function.
6193         (Check_script::~Check_script): New function.
6194         (Check_script::is_runnable): New function.
6195         (Check_script::locks): New function.
6196         (Check_script::run): New function.
6197         (Check_library::~Check_library): New function.
6198         (Check_library::is_runnable): New function.
6199         (Check_library::locks): New function.
6200         (Check_library::run): New function.
6201         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
6202         (Add_symbols::library_): New data member.
6203         (class Read_member): New class.
6204         (class Check_script): New class.
6205         (class Check_library): New class.
6206         * reloc.cc (Read_relocs::is_runnable): Allow case where
6207         token == NULL.
6208         (Read_relocs::locks): Likewise.
6209         (Scan_relocs::locks): Likewise.
6210         (Relocate_task::locks): Likewise.
6211         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
6212         to clear counters.
6213         (Sized_relobj::incremental_relocs_scan): Fix comment.
6214         (Sized_relobj::do_relocate): Pass output file offset to
6215         write_local_symbols.
6216         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
6217         from class declaration.
6218         * script.cc (read_input_script): Allocate Script_info; pass
6219         argument serial number to report_script.
6220         * script.h (class Script_info): Move to incremental.h.
6221         * symtab.cc (Symbol_table::add_from_incrobj): New function.
6222         * symtab.h (Symbol_table::add_from_incrobj): New function.
6223         (Symbol_table::set_file_offset): New function.
6224
6225 2011-04-05  Cary Coutant  <ccoutant@google.com>
6226
6227         * incremental-dump.cc (dump_incremental_inputs): Change signature
6228         to take a Sized_incremental_binary; change caller.  Use readers
6229         in Sized_incremental_binary.
6230         * incremental.cc
6231         (Sized_incremental_binary::find_incremental_inputs_sections):
6232         Rename do_find_incremental_inputs_sections to this.
6233         (Sized_incremental_binary::setup_readers): New function.
6234         (Sized_incremental_binary::do_check_inputs): Check
6235         has_incremental_info_ flag; move setup code to setup_readers;
6236         use input readers.
6237         (Sized_incremental_binary::do_file_is_unchanged): New function.
6238         (Sized_incremental_binary::do_get_input_reader): New function.
6239         * incremental.h (class Incremental_binary): Move to end of file.
6240         (Incremental_binary::file_is_unchanged): New function.
6241         (Incremental_binary::do_file_is_unchanged): New function.
6242         (Incremental_binary::Input_reader): New class.
6243         (Incremental_binary::get_input_reader): New function.
6244         (class Sized_incremental_binary): Move to end of file.
6245         (Sized_incremental_binary::Sized_incremental_binary): Setup the
6246         input section reader classes.
6247         (Sized_incremental_binary::has_incremental_info): New function.
6248         (Sized_incremental_binary::inputs_reader): New function.
6249         (Sized_incremental_binary::symtab_reader): New function.
6250         (Sized_incremental_binary::relocs_reader): New function.
6251         (Sized_incremental_binary::got_plt_reader): New function.
6252         (Sized_incremental_binary::do_file_is_unchanged): New function.
6253         (Sized_incremental_binary::Sized_input_reader): New class.
6254         (Sized_incremental_binary::get_input_reader): New function.
6255         (Sized_incremental_binary::find_incremental_inputs_sections):
6256         Rename do_find_incremental_inputs_sections to this.
6257         (Sized_incremental_binary::setup_readers): New function.
6258         (Sized_incremental_binary::has_incremental_info_): New data member.
6259         (Sized_incremental_binary::inputs_reader_): New data member.
6260         (Sized_incremental_binary::symtab_reader_): New data member.
6261         (Sized_incremental_binary::relocs_reader_): New data member.
6262         (Sized_incremental_binary::got_plt_reader_): New data member.
6263         (Sized_incremental_binary::current_input_file_): New data member.
6264
6265 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
6266
6267         PR gold/12640
6268         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
6269         violation.
6270
6271 2011-03-30  Cary Coutant  <ccoutant@google.com>
6272
6273         * archive.cc (Archive::include_member): Adjust call to report_object.
6274         (Add_archive_symbols::run): Add script_info to call to
6275         report_archive_begin.
6276         (Lib_group::include_member): Adjust call to report_object.
6277         (Add_lib_group_symbols::run): Adjust call to report_object.
6278         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
6279         blocks.  Add object count for script input files.
6280         * incremental.cc (Incremental_inputs::report_archive_begin): Add
6281         script_info parameter; change all callers.
6282         (Incremental_inputs::report_object): Add script_info parameter;
6283         change all callers.
6284         (Incremental_inputs::report_script): Store backpointer to
6285         incremental info entry.
6286         (Output_section_incremental_inputs::set_final_data_size): Record
6287         additional information for scripts.
6288         (Output_section_incremental_inputs::write_info_blocks): Likewise.
6289         * incremental.h (Incremental_script_entry::add_object): New function.
6290         (Incremental_script_entry::get_object_count): New function.
6291         (Incremental_script_entry::get_object): New function.
6292         (Incremental_script_entry::objects_): New data member; adjust
6293         constructor.
6294         (Incremental_inputs::report_archive_begin): Add script_info parameter.
6295         (Incremental_inputs::report_object): Add script_info parameter.
6296         (Incremental_inputs_reader::get_object_count): New function.
6297         (Incremental_inputs_reader::get_object_offset): New function.
6298         * options.cc (Input_arguments::add_file): Return reference to
6299         new input argument.
6300         * options.h (Input_argument::set_script_info): New function.
6301         (Input_argument::script_info): New function.
6302         (Input_argument::script_info_): New data member; adjust all
6303         constructors.
6304         (Input_file_group::add_file): Return reference to new input argument.
6305         (Input_file_lib::add_file): Likewise.
6306         (Input_arguments::add_file): Likewise.
6307         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
6308         * script.cc (Parser_closure::Parser_closure): Add script_info
6309         parameter; adjust all callers.
6310         (Parser_closure::script_info): New function.
6311         (Parser_closure::script_info_): New data member.
6312         (read_input_script): Report scripts earlier to incremental info.
6313         (script_add_file): Set script_info in Input_argument.
6314         (script_add_library): Likewise.
6315         * script.h (Script_options::Script_info): Rewrite class.
6316
6317 2011-03-29  Cary Coutant  <ccoutant@google.com>
6318
6319         * archive.cc (Library_base::should_include_member): Move
6320         method here from class Archive.
6321         (Archive::Archive): Initialize base class.
6322         (Archive::should_include_member): Move to base class.
6323         (Archive::do_for_all_unused_symbols): New function.
6324         (Add_archive_symbols::run): Remove redundant access to
6325         incremental_inputs.
6326         (Lib_group::Lib_group): Initialize base class.
6327         (Lib_group::do_filename): New function.
6328         (Lib_group::include_member): Pass pointer to Lib_group to
6329         report_object.
6330         (Lib_group::do_for_all_unused_symbols): New function.
6331         (Add_lib_group_symbols::run): Report archive information for
6332         incremental links.
6333         * archive.h (class Library_base): New base class.
6334         (class Archive): Derive from Library_base.
6335         (Archive::filename): Move to base class.
6336         (Archive::set_incremental_info): Likewise.
6337         (Archive::incremental_info): Likewise.
6338         (Archive::Should_include): Likewise.
6339         (Archive::should_include_member): Likewise.
6340         (Archive::Armap_entry): Remove.
6341         (Archive::Unused_symbol_iterator): Remove.
6342         (Archive::unused_symbols_begin): Remove.
6343         (Archive::unused_symbols_end): Remove.
6344         (Archive::do_filename): New function.
6345         (Archive::do_get_mtime): New function.
6346         (Archive::do_for_all_unused_symbols): New function.
6347         (Archive::task_): Move to base class.
6348         (Archive::incremental_info_): Likewise.
6349         (class Lib_group): Derive from Library_base.
6350         (Lib_group::do_filename): New function.
6351         (Lib_group::do_get_mtime): New function.
6352         (Lib_group::do_for_all_unused_symbols): New function.
6353         (Lib_group::task_): Move to base class.
6354         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
6355         function.
6356         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
6357         function.
6358         * incremental.cc (Incremental_inputs::report_archive_begin):
6359         Use Library_base; call library's get_mtime; add incremental inputs
6360         entry before members.
6361         (class Unused_symbol_visitor): New class.
6362         (Incremental_inputs::report_archive_end): Use Library_base; use
6363         visitor class to record unused symbols; don't add incremental inputs
6364         entry after members.
6365         (Incremental_inputs::report_object): Use Library_base.
6366         * incremental.h
6367         (Incremental_archive_entry::Incremental_archive_entry): Remove
6368         unused Archive parameter.
6369         (Incremental_inputs::report_archive_begin): Use Library_base.
6370         (Incremental_inputs::report_archive_end): Likewise.
6371         (Incremental_inputs::report_object): Likewise.
6372         * object.cc (Sized_relobj::do_for_all_global_symbols): New
6373         function.
6374         * object.h (Object::for_all_global_symbols): New function.
6375         (Object::do_for_all_global_symbols): New function.
6376         (Sized_relobj::do_for_all_global_symbols): New function.
6377         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
6378         function.
6379         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
6380         function.
6381
6382 2011-03-27  Ian Lance Taylor  <iant@google.com>
6383
6384         * archive.cc (Archive::interpret_header): Return -1 if something
6385         goes wrong.  Change callers accordingly.
6386
6387 2011-03-25  Cary Coutant  <ccoutant@google.com>
6388
6389         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
6390         * testsuite/Makefile.in: Regenerate.
6391
6392 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
6393
6394         * plugin.cc (get_view): New.
6395         (Plugin::load): Pass get_view to the plugin.
6396         (Plugin_manager::get_view): New.
6397
6398 2011-03-21  Ian Lance Taylor  <iant@google.com>
6399
6400         * testsuite/final_layout.sh: Rewrite to not use dc.
6401         * testsuite/relro_test.sh: Fail if dc is not present.
6402
6403 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
6404
6405         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
6406         Change == to -eq.
6407         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
6408         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
6409         Change == to -eq.
6410         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
6411         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
6412
6413 2011-03-14  Ian Lance Taylor  <iant@google.com>
6414
6415         * script-sections.cc (Sort_output_sections::script_compare):
6416         Rename from is_before, change return type.
6417         (Sort_output_sections::operator()): Adjust accordingly.
6418
6419 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
6420
6421         PR gold/12572
6422         * testsuite/odr_violation2.cc: Add comment to make all error line
6423         numbers double digits.
6424         * testsuite/debug_msg.sh: Adjust expected errors.
6425
6426 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
6427
6428         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
6429         but mark earlier ones as non-canonical
6430         (offset_to_iterator): Update search target and example
6431         (do_addr2line): Return extra lines in a vector*
6432         (format_file_lineno): Extract from do_addr2line
6433         (one_addr2line): Add vector* out-param
6434         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
6435         when a lineno entry appeared last for its instruction
6436         (Dwarf_line_info): Add vector* out-param
6437         * object.cc (Relocate_info): Pass NULL for the vector* out-param
6438         * symtab.cc (Odr_violation_compare): Include the lineno in the
6439         comparison again.
6440         (linenos_from_loc): New. Combine the canonical line for an
6441         address with its other lines.
6442         (True_if_intersect): New. Helper functor to make
6443         std::set_intersection a query.
6444         (detect_odr_violations): Compare sets of lines instead of just
6445         one line for each function. This became less deterministic, but
6446         has fewer false positives.
6447         * symtab.h: Declarations.
6448         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
6449         mix an optimized and non-optimized object in the same binary
6450         (odr_violation2.so): Same.
6451         * testsuite/Makefile.in: Regenerate from Makefile.am.
6452         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
6453         * testsuite/debug_msg.sh: Update line numbers and add
6454         assertions.
6455         * testsuite/odr_violation1.cc: Use OdrDerived, in a
6456         non-optimized context.
6457         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
6458         isn't inlined, and use OdrDerived in an optimized context.
6459         * testsuite/odr_header1.h: Defines OdrDerived, where
6460         optimization will change the
6461         first-instruction-in-the-destructor's file and line number.
6462         * testsuite/odr_header2.h: Defines OdrBase.
6463
6464 2011-03-09  Ian Lance Taylor  <iant@google.com>
6465
6466         * fileread.cc (File_read::clear_views): Don't delete the whole
6467         file view.
6468
6469 2011-03-08  Ian Lance Taylor  <iant@google.com>
6470
6471         PR gold/12525
6472         * fileread.cc: #include <climits>.
6473         (GOLD_IOV_MAX): Define.
6474         (File_read::read_multiple): Limit number of entries by iov_max.
6475         * fileread.h (class File_read): Always set max_readv_entries to
6476         128.
6477
6478 2011-03-07  Ian Lance Taylor  <iant@google.com>
6479
6480         PR gold/12525
6481         * options.h (class General_options): Add -dy and -dn.
6482
6483 2011-03-02  Cary Coutant  <ccoutant@google.com>
6484
6485         * testsuite/script_test_9.t: Add TLS segment.
6486
6487 2011-03-02  Simon Baldwin  <simonb@google.com>
6488
6489         * configure.ac: Add check for gnu_indirect_function support in
6490         the toolchain building binutils.
6491         * configure: Rebuild.
6492
6493 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
6494
6495         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
6496         plugin only symbols.
6497         (Symbol_table::sized_finalize_symbol) Mark symbol only present
6498         in plugin files as not needed in the symbol table.
6499
6500 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
6501
6502         * output.cc (Output_section::add_input_section): Delay fill
6503         generation for section ordering.
6504
6505 2011-02-09  Ian Lance Taylor  <iant@google.com>
6506
6507         PR gold/12316
6508         * object.h (class Sized_relobj): Remove clear_local_symbols.
6509         * reloc.cc (Sized_relobj::do_relocate): Don't call
6510         clear_local_symbols.
6511
6512 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
6513
6514         * plugin.cc (is_visible_from_outside): Return true for symbols
6515         in the -u option.
6516
6517 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
6518
6519         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
6520         filename.
6521
6522 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
6523
6524         * icf.h (is_section_foldable_candidate): Change type of parameter
6525         to std::string.
6526         * icf.cc (Icf::find_identical_sections): Change type of local variable
6527         section_name to be std::string.
6528         (is_function_ctor_or_dtor): Change type of parameter to std::string.
6529
6530 2011-01-25  Ian Lance Taylor  <iant@google.com>
6531
6532         * script.cc (script_add_extern): Rewrite to use
6533         add_symbol_reference.
6534
6535 2011-01-25  Doug Kwan  <dougkwan@google.com>
6536
6537         * icf.cc (get_section_contents): Always lock section's object.
6538
6539 2011-01-24  Ian Lance Taylor  <iant@google.com>
6540
6541         * options.h (class General_options): Accept
6542         --no-detect-odr-violations.
6543
6544 2011-01-24  Ian Lance Taylor  <iant@google.com>
6545
6546         * version.cc (version_string): Bump to 1.11.
6547
6548 2011-01-24  Ian Lance Taylor  <iant@google.com>
6549
6550         * plugin.cc (class Plugin_rescan): Define new class.
6551         (Plugin_manager::claim_file): Set any_claimed_.
6552         (Plugin_manager::save_archive): New function.
6553         (Plugin_manager::save_input_group): New function.
6554         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
6555         necessary.
6556         (Plugin_manager::new_undefined_symbol): New function.
6557         (Plugin_manager::rescan): New function.
6558         (Plugin_manager::rescannable_defines): New function.
6559         (Plugin_manager::add_input_file): Set any_added_.
6560         * plugin.h (class Plugin_manager): define new fields rescannable_,
6561         undefined_symbols_, any_claimed_, and any_added_.  Declare
6562         Plugin_rescan as friend.  Declare new functions.
6563         (Plugin_manager::Rescannable): Define type.
6564         (Plugin_manager::Rescannable_list): Define type.
6565         (Plugin_manager::Undefined_symbol_list): Define type.
6566         (Plugin_manager::Plugin_manager): Initialize new fields.
6567         * archive.cc (Archive::defines_symbol): New function.
6568         (Add_archive_symbols::run): Pass archive to plugins if any.
6569         * archive.h (class Archive): Declare defines_symbol.
6570         * readsyms.cc (Input_group::~Input_group): New function.
6571         (Finish_group::run): Pass input_group to plugins if any.
6572         * readsyms.h (class Input_group): Declare destructor.
6573         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
6574         any.
6575
6576 2011-01-10  Ian Lance Taylor  <iant@google.com>
6577
6578         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
6579         section as relro.
6580         (Layout::set_segment_offsets): Reset increase_relro before calling
6581         set_section_addresses a second time.
6582
6583 2011-01-04  Cary Coutant  <ccoutant@google.com>
6584
6585         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
6586         sections before NOBITS sections.
6587
6588 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
6589
6590         * version.cc (print_version): Update copyright to 2011.
6591
6592 2010-12-23  Cary Coutant  <ccoutant@google.com>
6593
6594         * output.h (Output_data_reloc::add_output_section): Pass OD instead
6595         of OS to this->add.  Add OD parameter to second form of the function.
6596
6597 2010-12-20  Ian Lance Taylor  <iant@google.com>
6598
6599         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
6600         second of two consecutive entries with same offset.
6601
6602 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6603
6604         * testsuite/Makefile.am (ifuncmain2static_LDADD)
6605         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
6606         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
6607         to avoid unneeded links against $(LDADD).
6608         * testsuite/Makefile.in: Regenerate.
6609
6610 2010-12-15  Ian Lance Taylor  <iant@google.com>
6611
6612         PR gold/12324
6613         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
6614         for R_X86_64_32 and R_X86_64_PC32.
6615         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
6616         ver_matching_def_pic.o.
6617         (ver_matching_def_pic.o): New target.
6618
6619 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6620
6621         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
6622         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
6623         Move definition before File_read::View member definitions.
6624         (File_read::View::~View): Initialize and hold lock before
6625         updating current_mapped_bytes.
6626
6627 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6628
6629         * dwarf_reader.cc: Remove outdated comment.
6630         * gold-threads.cc: Fix typo in error message.
6631         * archive.cc: Fix typos in comments.
6632         * archive.h: Likewise.
6633         * arm-reloc-property.cc: Likewise.
6634         * arm-reloc-property.h: Likewise.
6635         * arm-reloc.def: Likewise.
6636         * arm.cc: Likewise.
6637         * attributes.h: Likewise.
6638         * cref.cc: Likewise.
6639         * ehframe.cc: Likewise.
6640         * fileread.h: Likewise.
6641         * gold.h: Likewise.
6642         * i386.cc: Likewise.
6643         * icf.cc: Likewise.
6644         * incremental.h: Likewise.
6645         * int_encoding.cc: Likewise.
6646         * layout.h: Likewise.
6647         * main.cc: Likewise.
6648         * merge.h: Likewise.
6649         * object.cc: Likewise.
6650         * object.h: Likewise.
6651         * options.cc: Likewise.
6652         * readsyms.cc: Likewise.
6653         * reduced_debug_output.cc: Likewise.
6654         * reloc.cc: Likewise.
6655         * script-sections.cc: Likewise.
6656         * sparc.cc: Likewise.
6657         * symtab.h: Likewise.
6658         * target-reloc.h: Likewise.
6659         * target.cc: Likewise.
6660         * target.h: Likewise.
6661         * timer.cc: Likewise.
6662         * timer.h: Likewise.
6663         * x86_64.cc: Likewise.
6664
6665 2010-12-09  Cary Coutant  <ccoutant@google.com>
6666
6667         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
6668         stack.
6669         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
6670         parameter; change all callers.
6671         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
6672         * options.h (warn_execstack): New option.
6673
6674 2010-12-07  Doug Kwan  <dougkwan@google.com>
6675
6676         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
6677         like function call relocations.
6678
6679 2010-12-07  Ian Lance Taylor  <iant@google.com>
6680
6681         * archive.cc (Archive::get_elf_object_for_member): Permit
6682         punconfigured to be NULL.
6683         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
6684         (Archive::include_member): Pass NULL to get_elf_object_for_member
6685         if we searched for the archive and this is the first included
6686         object.
6687
6688 2010-12-01  Ian Lance Taylor  <iant@google.com>
6689
6690         * dwarf_reader.h (class Sized_dwarf_line_info): Add
6691         track_relocs_type_ field.
6692         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
6693         Set track_relocs_type_.
6694         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
6695         contents when using RELA relocs.
6696         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
6697         reloc_map_.
6698         * reloc.cc (Track_relocs::next_addend): New function.
6699         * reloc.h (class Track_relocs): Declare next_addend.
6700
6701 2010-12-01  Ian Lance Taylor  <iant@google.com>
6702
6703         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
6704         virtual destructor.
6705
6706 2010-12-01  Ian Lance Taylor  <iant@google.com>
6707
6708         * README: Update compilers known to work and fail.
6709
6710 2010-11-23  Matthias Klose  <doko@ubuntu.com>
6711
6712         * configure.in: For --enable-gold, handle value `default' instead of
6713         `both*'.  Always install ld as ld.bfd, install as ld if gold is
6714         not the default.
6715         * configure: Regenerate.
6716
6717 2010-11-18  Doug Kwan  <dougkwan@google.com>
6718
6719         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
6720         and right_alignment to be zero.  Store result alignment only if it is
6721         greater than existing alignment.
6722
6723 2010-11-16  Cary Coutant  <ccoutant@google.com>
6724
6725         PR gold/12220
6726         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
6727         Check for ".zdebug_line".
6728
6729 2010-11-16  Doug Kwan  <dougkwan@google.com>
6730             Cary Coutant  <ccoutant@google.com>
6731
6732         * output.h (Output_segment::set_section_addresses): Pass increase_relro
6733         by reference; adjust all callers.
6734         * output.cc (Output_segment::set_section_addresses): Adjust references
6735         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
6736         list is empty.
6737         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
6738         end at page boundary.
6739
6740 2010-11-16  Cary Coutant  <ccoutant@google.com>
6741
6742         PR gold/12220
6743         * layout.cc (Layout::choose_output_section): Transform names of
6744         compressed sections even when using a script with a SECTIONS clause.
6745         (Layout::output_section_name): Remove code to transform
6746         compressed debug section names.
6747         * output.cc (Output_section::add_input_section): Use uncompressed
6748         section size when tracking input sections.
6749
6750 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
6751
6752         * symtab.h (Symbol::NON_PIC_REF): Remove.
6753         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
6754         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
6755         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
6756         (Symbol::use_plt_offset): Take a flags argument and pass it
6757         directly to needs_dynamic_reloc.  Restrict check for undefined
6758         weak symbols to function calls.
6759         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
6760         (Target_arm::Scan::global): Use it.
6761         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
6762         (Target_arm::Relocate::relocate): Likewise.
6763         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
6764         parameter with an r_type parameter.  Use get_reference_flags
6765         to get the flags.
6766         (Target_arm::Relocate::relocate): Update accordingly.
6767         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
6768         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
6769         (Target_i386::Scan::global): Likewise.
6770         (Target_i386::Relocate::relocate): Likewise.
6771         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
6772         parameter with an r_type parameter.  Use get_reference_flags
6773         to get the flags.
6774         (Target_i386::Relocate::relocate): Update accordingly.
6775         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
6776         (Target_powerpc::Scan::global): Use it.
6777         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
6778         (Target_powerpc::Relocate::relocate): Likewise.
6779         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
6780         (Target_sparc::Scan::global): Use it.
6781         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
6782         (Target_sparc::Relocate::relocate): Likewise.
6783         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
6784         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
6785         (Target_x86_64::Scan::global): Likewise.
6786         (Target_x86_64::Relocate::relocate): Likewise.
6787
6788 2010-11-08  Doug Kwan  <dougkwan@google.com>
6789             Cary Coutant  <ccoutant@google.com>
6790
6791         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
6792         (Arm_exidx_merge_section::section_contents_): New data member.
6793         (Arm_input_section::Arm_input_section): Initialize original_contents_.
6794         (Arm_input_section::~Arm_input_section): De-allocate memory.
6795         (Arm_input_section::original_contents_): New data member.
6796         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
6797         in parameters instead of calling Object::section_contents without
6798         locking.
6799         (Arm_output_section::group_section): New parameter TASK.  Pass it
6800         to callees that need locking objects.
6801         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
6802         to lock EXIDX input sections.  Fix a formatting issue.  Call
6803         Arm_exidx_merged_section::build_contents to create merged section
6804         contents.
6805         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
6806         to lock object of stub table owner.
6807         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
6808         TEXT_SIZE to initialize data member TEXT_SIZE_.
6809         (Arm_exidx_input_section::addralign): Fix typo in comment.
6810         (Arm_exidx_input_section::text_size): New method.
6811         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
6812         that require locking objects.  Lock objects before scanning for stubs
6813         and updating local symbols.
6814         (Arm_input_section<big_endian>::init): Copy contents of original
6815         input section.
6816         (Arm_input_section<big_endian>::do_write): Use saved contents of
6817         original input section instead of calling Object::section_contents
6818         without locking.
6819         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
6820         size without calling Object::section_size().
6821         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
6822         for size.  Allocate a buffer for merged EXIDX entries.
6823         (Arm_exidx_merged_section::build_contents): New method.
6824         (Arm_exidx_merged_section::do_write): Move merge section contents
6825         building code to Arm_exidx_merged_section::build_contetns.  Write
6826         out contetns in buffer instead of building it on the fly.
6827         (Arm_relobj::make_exidx_input_section): Also pass text section size
6828         to Arm_exidx_input_section constructor.
6829         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
6830         (Arm_dynobj::do_read_symbols): Fix memory leak.
6831         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
6832         * target.h: (class Task): Add forward declaration.
6833         (Target::relax): Add new parameter TASK and pass it to
6834         Target::do_relax().
6835         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
6836
6837 2010-11-05  Cary Coutant  <ccoutant@google.com>
6838
6839         PR gold/10708
6840         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
6841         object when reading from the file.
6842         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
6843         second layout pass.
6844         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
6845         when reading section contents.
6846         (get_section_contents): Likewise.
6847         (icf::find_identical_sections): Likewise.
6848         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
6849         object when reading from the file.
6850         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
6851         the object when doing deferred section layout.
6852
6853 2010-11-03  Nick Clifton  <nickc@redhat.com>
6854
6855         PR gold/12001
6856         * script.h (class Symbol_assignment: name): New member.  Returns
6857         the name of the symbol.
6858         * scrfipt.cc (Script_options::is_pending_assignment): New member.
6859         Returns true if the given symbol name is on the list of
6860         assignments wating to be processed.
6861         * archive.cc (should_incldue_member): If the symbol is undefined,
6862         check to see if it is on the list of symbols pending assignment.
6863
6864 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
6865
6866         * script-sections.cc (Script_sections::find_memory_region): Check
6867         for a NULL output section pointer.
6868
6869 2010-10-29  Doug Kwan  <dougkwan@google.com>
6870
6871         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
6872         Output_section::add_relaxed_input_section.
6873         * output.cc (Output_section::add_relaxed_input_section): Add new
6874         arguments LAYOUT and NAME.  Set section order index.
6875         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
6876         Copy section order index.
6877         * output.h (Output_section::add_relaxed_input_section): Add new
6878         arguments LAYOUT and NAME.
6879
6880 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6881
6882         * testsuite/Makefile.am: Move gcctestdir/ld rule to
6883         NATIVE_OR_CROSS_LINKER.
6884         * testsuite/Makefile.in: Regenerate.
6885
6886 2010-10-20  Doug Kwan  <dougkwan@google.com>
6887
6888         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
6889         without SHF_LINK_ORDER flags.
6890         * layout.cc (Layout::choose_output_section): Do not filter
6891         SHF_LINK_ORDER flag in a relocatable link.
6892
6893 2010-10-17  Cary Coutant  <ccoutant@google.com>
6894
6895         * output.h (Output_segment::set_section_addresses): Change function
6896         signature.  Update all callers.
6897         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
6898         sections.
6899         (Output_segment::set_section_addresses): Align after last TLS
6900         section.  Add padding before last relro section instead of after.
6901
6902 2010-10-17  Doug Kwan  <dougkwan@google.com>
6903
6904         * gold/arm.cc (Target_arm::got_section): Use correct order and set
6905         GOT output section to be writable.
6906
6907 2010-10-14  Cary Coutant  <ccoutant@google.com>
6908
6909         * debug.h (DEBUG_INCREMENTAL): New flag.
6910         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
6911         * gold.cc (queue_initial_tasks): Check parameters for incremental link
6912         mode.
6913         * incremental.cc (report_command_line): Ignore all forms of
6914         --incremental.
6915         * layout.cc (Layout::Layout): Check parameters for incremental link
6916         mode.
6917         * options.cc (General_options::parse_incremental): New function.
6918         (General_options::parse_no_incremental): New function.
6919         (General_options::parse_incremental_full): New function.
6920         (General_options::parse_incremental_update): New function.
6921         (General_options::incremental_mode_): New data member.
6922         (General_options::finalize): Check incremental_mode_.
6923         * options.h (General_options): Update help text for --incremental.
6924         Add --no-incremental, --incremental-full, --incremental-update.
6925         (General_options::Incremental_mode): New enum type.
6926         (General_options::incremental_mode): New function.
6927         (General_options::incremental_mode_): New data member.
6928         * parameters.cc (Parameters::incremental_mode_): New data member.
6929         (Parameters::set_options): Set incremental_mode_.
6930         (Parameters::set_incremental_full): New function.
6931         (Parameters::incremental): New function.
6932         (Parameters::incremental_update): New function.
6933         (set_parameters_incremental_full): New function.
6934         * parameters.h (Parameters::set_incremental_full): New function.
6935         (Parameters::incremental): New function.
6936         (Parameters::incremental_update): New function.
6937         (Parameters::incremental_mode_): New data member.
6938         (set_parameters_incremental_full): New function.
6939         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
6940         incremental link mode.
6941         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
6942         (Sized_relobj::do_relocate_sections): Likewise.
6943         * testsuite/Makefile.am (incremental_test): Use --incremental-full
6944         option.
6945         * testsuite/Makefile.in: Regenerate.
6946         * testsuite/incremental_test.sh: Filter all forms of --incremental.
6947
6948 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6949
6950         * script-sections.h (class Script_sections): Make
6951         Sections_elements typedef public.
6952         * script-sections.cc (class Sort_output_sections): Add elements_
6953         field.  Add constructor which sets it; change all callers.
6954         (Sort_output_sections::is_before): New function.
6955         (Sort_output_sections::operator()): Call is_before.
6956         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
6957         conditional.
6958         * testsuite/script_test_10.sh: New test. Test script section
6959         order.
6960         * testsuite/script_test_10.t: Likewise.
6961         * testsuite/script_test_10.s: Likewise.
6962         * testsuite/Makefile.am: Wrap the cross linker tests and the
6963         common tests into NATIVE_OR_CROSS_LINKER.
6964         (check_SCRIPTS): Add script_test_10.sh.
6965         (check_DATA): Add script_test_10.stdout.
6966         (script_test_10.o, script_test_10): New targets.
6967         (script_test_10.stdout): New target.
6968         * configure, testsuite/Makefile.in: Regenerate.
6969
6970 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6971
6972         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
6973         error for the deprecated relocations.
6974         (Target_arm::Scan::global): Likewise.
6975         (Target_arm::Relocate::relocate): Likewise.
6976
6977 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
6978
6979         * fileread.cc (Input_file::find_file): Initialize *found_name
6980         and *namep when using the fallback search for case 4.
6981
6982 2010-10-11  Cary Coutant  <ccoutant@google.com>
6983
6984         * options.h (class General_options): Redefine -z lazy as an alias for
6985         the negation of -z now.
6986
6987 2010-10-11  Ian Lance Taylor  <iant@google.com>
6988
6989         * resolve.cc (symbol_to_bits): Report the value of the unsupported
6990         binding.
6991
6992 2010-10-06  Nick Clifton  <nickc@redhat.com>
6993
6994         * script-sections.cc(class Memory_region): Remove
6995         current_lma_offset_ field.  Rename current_vma_offset_ to
6996         current_offset_.  Add last_section_ field.
6997         (Memory_region::get_current_vma_address): Rename to
6998         get_current_address.
6999         (Memory_region::get_current_lma_address): Delete.
7000         (Memory_region::increment_vma_offset): Rename to
7001         increment_offset.
7002         (Memory_region::increment_lma_offset): Delete.
7003         (Memory_region::attributes_compatible): New method.  Returns
7004         true if the provided section is compatible with the region.
7005         (Memory_region::get_last_section): New method.  Returns the last
7006         section to use the region.
7007         (Memory_region::set_last_section): New method.  Stores the last
7008         section to use the region.
7009         (Script_sections::block_in_region): New method.  Returns true if
7010         a block of memory is contained within a region.
7011         (Script_sections::find_memory_region): New method.  Locates a
7012         memory region to be used to set a VMA or LMA address.
7013         (Output_section_definition::set_section_addresses): Add code to
7014         check for addresses set by memory regions.
7015         (Output_segment::set_section_addresses): Remove memory region
7016         walking code.
7017         (Script_sections::create_segment): Add a warning if a header
7018         segment is created outside of any region.
7019         * script-sections.h (class Script_sections): Add prototypes for
7020         find_memory_region and block_in_region methods.
7021         * testsuite/memory_test.s: Use .long instead of .word.
7022         * testsuite/memory_test.t: Add some more output sections.
7023         * testsuite/memory_test.sh: Update expected output.
7024
7025 2010-10-02  Doug Kwan  <dougkwan@google.com>
7026
7027         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
7028         defintion to symtab.h
7029         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
7030         declaration to defintion.
7031
7032 2010-10-01  Nick Clifton  <nickc@redhat.com>
7033
7034         * expression.cc (eval): Replace dummy argument with NULL.
7035         (eval_maybe_dot): Check for a NULL result section pointer.
7036         (Symbol_expression::value): Likewise.
7037         (Dot_expression::value): Likewise.
7038         (BINARY_EXPRESSION): Likewise.
7039         (Max_expression::value): Likewise.
7040         (Min_expression::value): Likewise.
7041         (Absolute_expression::value): Likewise.
7042         (Addr_expression::value_from_output_section): Likewise.
7043         (Loaddddr_expression::value_from_output_section): Likewise.
7044         (Segment_start_expression::value): Likewise.
7045         * script-sections.cc
7046         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
7047         argument with NULL.
7048         (Sections_elememt_dot_assignment::set_section_addresses):
7049         Likewise.
7050         (Output_data_expression::do_write_to_buffer): Likewise.
7051         (Output_section_definition::finalize_symbols): Likewise.
7052         (Output_section_definition::set_section_addresses): Likewise.
7053
7054 2010-09-30  Doug Kwan  <dougkwan@google.com>
7055
7056         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
7057
7058 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
7059
7060         * target.h (Target::can_icf_inline_merge_sections): New virtual
7061         function.
7062         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
7063         virtual function.
7064         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
7065         virtual function.
7066         * icf.cc (get_section_contents): Inline merge sections only when
7067         target allows it.
7068
7069 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7070
7071         * configure: Regenerate.
7072
7073 2010-09-17  Ian Lance Taylor  <iant@google.com>
7074
7075         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
7076         * testsuite/Makefile.am (memory_test.o): New target.
7077         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
7078         memory_test.t.
7079         * testsuite/Makefile.in: Rebuild.
7080
7081 2010-09-17  Doug Kwan  <dougkwan@google.com>
7082
7083         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
7084         defintion if relocation uses GOT entries of the symbol.
7085         * testsuite/icf_safe_test.sh: Fix test.
7086         * testsuite/icf_safe_so_test.sh: Fix test.
7087
7088 2010-09-16  Cary Coutant  <ccoutant@google.com>
7089
7090         * script_sections.cc (class Memory_region): Remove "NULL" from
7091         vector initializations.
7092
7093 2010-09-15  Cary Coutant  <ccoutant@google.com>
7094
7095         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
7096         Resolve forwarding symbols.
7097
7098 2010-09-15  Doug Kwan  <dougkwan@google.com>
7099
7100         * gold/testsuite/script_test_3.t: Add ARM special sections.
7101         * gold/testsuite/script_test_4.t: Same.
7102         * gold/testsuite/script_test_5.t: Same.
7103         * gold/testsuite/script_test_6.t: Same.
7104         * gold/testsuite/script_test_7.t: Same.
7105         * gold/testsuite/script_test_7.t: Same.
7106         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
7107
7108 2010-09-14  Cary Coutant  <ccoutant@google.com>
7109
7110         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
7111         (Target_x86_64::Relocate::relocate_tls): Replace check for
7112         saw_tls_block_reloc_ with test for executable section.
7113
7114 2010-09-12  Cary Coutant  <ccoutant@google.com>
7115
7116         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
7117         position-independent executables to shared libraries need dynamic
7118         relocations.
7119         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
7120         position-independent executables.
7121         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
7122         * testsuite/Makefile.in: Regenerate.
7123
7124 2010-09-10  Nick Clifton  <nickc@redhat.com>
7125
7126         PR gold/11997
7127         * testsuite/memory_test.t: Discard any sections that are not
7128         needed.
7129
7130 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
7131
7132         PR gold/11996
7133         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
7134         "This::" to work around a bug in gcc 4.2.
7135
7136         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
7137
7138 2010-09-09  Rafael Espindola  <espindola@google.com>
7139
7140         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
7141         sections with different PF_X flags in the same segment.
7142         (Layout::find_first_load_seg): Search all segments to find the first
7143         one.
7144         * options.h (rosegment): New.
7145
7146 2010-09-08  Rafael Espindola  <espindola@google.com>
7147
7148         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
7149
7150 2010-09-08  Doug Kwan  <dougkwan@google.com>
7151
7152         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
7153         (Arm_relobj::do_relocate_sections): Add new parameter for output
7154         file to match the parent.
7155         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
7156         of local symbols instead of input values.  Update code to track
7157         changes in gold::relocate_section.
7158         * object.cc (Sized_relobj::compute_final_local_value): New methods.
7159         (Sized_relobj::compute_final_local_value_internal): New methods.
7160         (Sized_relobj::do_finalize_local_symbols): Move code from loop
7161         body into private version of Sized_relobj::compute_final_local_value.
7162         Call the inline method.
7163         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
7164         merged symbol value if there is one.
7165         (Symbol_value::has_output_value): New method defintiion.
7166         (Sized_relobj::Compute_final_local_value_status): New enum type.
7167         (Sized_relobj::compute_final_local_value): New methods.
7168         (Sized_relobj::compute_final_local_value_internal): New methods.
7169         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
7170         and arm_cortex_a8.sh.
7171         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
7172         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
7173         New tests.
7174         * Makefile.in: Regenerate.
7175         * testsuite/arm_bl_out_of_range.s: Update test.
7176         * testsuite/thumb_bl_out_of_range.s: Ditto.
7177         * testsuite/thumb_blx_out_of_range.s: Ditto.
7178         * testsuite/arm_branch_out_of_range.sh: New file.
7179         * testsuite/arm_cortex_a8.sh: Ditto.
7180         * testsuite/arm_cortex_a8_b.s: Ditto.
7181         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
7182         * testsuite/arm_cortex_a8_b_local.s: Ditto.
7183         * testsuite/arm_cortex_a8_bl.s: Ditto.
7184         * testsuite/arm_cortex_a8_blx.s: Ditto.
7185         * testsuite/arm_cortex_a8_local.s: Ditto.
7186         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
7187         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
7188
7189 2010-09-08  Rafael Espindola  <espindola@google.com>
7190
7191         * Makefile.am (memory_test.stdout): Run readelf with -W.
7192         * Makefile.in: Regenerate.
7193         * testsuite/memory_test.sh: Make the regexps accept both 32 and
7194         64 bit output.
7195
7196 2010-09-08  Rafael Espindola  <espindola@google.com>
7197
7198         * script-sections.cc (Script_sections::add_memory_region): Convert
7199         field precision to int.
7200         * script.cc (script_set_section_region, script_set_section_region):
7201         Convert field precision to int.
7202
7203 2010-09-08  Rafael Espindola  <espindola@google.com>
7204
7205         * arm.cc (do_finalize_sections): Create the __exidx_start and
7206         __exdix_end symbols even when the section is missing.
7207
7208 2010-09-08  Nick Clifton  <nickc@redhat.com>
7209
7210         * README: Remove claim that MEMORY is not supported.
7211         * expression.cc (script_exp_function_origin)
7212         (script_exp_function_length): Move from here to ...
7213         * script.cc: ... here.
7214         (script_set_section_region, script_add_memory)
7215         (script_parse_memory_attr, script_include_directive): New
7216         functions.
7217         * script-sections.cc
7218         (class Memory_region): New class.
7219         (class Output_section_definition): Add set_memory_region,
7220         set_section_vma, set_section_lma and get_section_name methods.
7221         (class Script_Sections): Add add_memory_region,
7222         find_memory_region, find_memory_region_origin,
7223         find_memory_region_length and set_memory_region methods.
7224         Have set_section_addresses method walk the list of set memory
7225         regions.
7226         Extend the print methos to display memory regions.
7227         * script-sections.h: Add prototypes for new methods.
7228         Add enum for MEMORY region attributes.
7229         * yyscript.y: Add support for parsing MEMORY regions.
7230         * script-c.h: Add prototypes for new functions.
7231         * testsuite/Makefile.am: Add test of MEMORY region functionality.
7232         * testsuite/Makefile.in: Regenerate.
7233         * testsuite/memory_test.sh: New script.
7234         * testsuite/memory_test.s: New assembler source file.
7235         * testsuite/memory_test.t: New linker script.
7236
7237 2010-08-27  Doug Kwan  <dougkwan@google.com>
7238
7239         * gold/resolve.cc (Symbol_table::should_override): Let a weak
7240         reference override an existing dynamic weak reference.
7241         * testsuite/Makefile.am: Add new test dyn_weak_ref.
7242         * testsuite/Makefile.in: Regenerate.
7243         * testsuite/dyn_weak_ref.sh: New file.
7244         * testsuite/dyn_weak_ref_1.c: Ditto.
7245         * testsuite/dyn_weak_ref_2.c: Ditto.
7246
7247 2010-08-27  Ian Lance Taylor  <iant@google.com>
7248
7249         * incremental.h (class Incremental_input_entry): Add virtual
7250         destructor.
7251
7252 2010-08-27  Ian Lance Taylor  <iant@google.com>
7253
7254         * testsuite/start_lib_test_3.c: Mark t3 as used.
7255
7256 2010-08-27  Nick Clifton  <nickc@redhat.com>
7257
7258         * options.cc (version_script): Fix small typo in previous
7259         whitespace tidyup.
7260
7261 2010-08-25  Nick Clifton  <nickc@redhat.com>
7262
7263         * archive.cc: Formatting fixes: Remove whitespace between
7264         typename and following asterisk.  Remove whitespace between
7265         function name and opening parenthesis.
7266         * archive.h: Likewise.
7267         * arm.cc: Likewise.
7268         * attributes.cc: Likewise.
7269         * attributes.h: Likewise.
7270         * common.cc: Likewise.
7271         * copy-relocs.cc: Likewise.
7272         * dirsearch.h: Likewise.
7273         * dynobj.cc: Likewise.
7274         * ehframe.cc: Likewise.
7275         * ehframe.h: Likewise.
7276         * expression.cc: Likewise.
7277         * fileread.cc: Likewise.
7278         * fileread.h: Likewise.
7279         * gc.h: Likewise.
7280         * gold-threads.cc: Likewise.
7281         * gold.cc: Likewise.
7282         * i386.cc: Likewise.
7283         * icf.h: Likewise.
7284         * incremental-dump.cc: Likewise.
7285         * incremental.cc: Likewise.
7286         * layout.cc: Likewise.
7287         * layout.h: Likewise.
7288         * main.cc: Likewise.
7289         * merge.cc: Likewise.
7290         * merge.h: Likewise.
7291         * object.cc: Likewise.
7292         * object.h: Likewise.
7293         * options.cc: Likewise.
7294         * options.h: Likewise.
7295         * output.cc: Likewise.
7296         * output.h: Likewise.
7297         * plugin.cc: Likewise.
7298         * plugin.h: Likewise.
7299         * powerpc.cc: Likewise.
7300         * reloc.cc: Likewise.
7301         * script-c.h: Likewise.
7302         * script-sections.cc: Likewise.
7303         * script.cc: Likewise.
7304         * stringpool.cc: Likewise.
7305         * symtab.cc: Likewise.
7306         * symtab.h: Likewise.
7307         * target.cc: Likewise.
7308         * timer.cc: Likewise.
7309         * timer.h: Likewise.
7310         * version.cc: Likewise.
7311         * x86_64.cc: Likewise.
7312
7313 2010-08-24  Nick Clifton  <nickc@redhat.com>
7314
7315         PR 11899
7316         * layout.cc (segment_precedes): Sort segments by their physical
7317         addresses, if they have been set.
7318
7319 2010-08-23  Cary Coutant  <ccoutant@google.com>
7320
7321         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
7322         symbols data.
7323         (Lib_group::include_member): Unlock object after deleting its
7324         symbols data.
7325         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
7326         the bug fixed here.
7327
7328 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
7329             Cary Coutant  <ccoutant@google.com>
7330
7331         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
7332         constructor, and set_blocker.
7333         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
7334         readsyms_blocker_.
7335         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
7336         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
7337         * testsuite/Makefile.am (start_lib_test): New test case.
7338         * testsuite/Makefile.in: Regenerate.
7339         * testsuite/start_lib_test_main.c: New file.
7340         * testsuite/start_lib_test_1.c: New file.
7341         * testsuite/start_lib_test_2.c: New file.
7342         * testsuite/start_lib_test_3.c: New file.
7343
7344 2010-08-19  Ian Lance Taylor  <iant@google.com>
7345
7346         * Makefile.in: Rebuild with automake 1.11.1.
7347         * aclocal.m4: Likewise.
7348         * testsuite/Makefile.in: Likewise.
7349
7350 2010-08-19  Ian Lance Taylor  <iant@google.com>
7351
7352         PR 10893
7353         * i386.cc (class Output_data_plt_i386): Update declarations.
7354         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
7355         local_ifuncs_ fields.
7356         (Target_i386::do_plt_section_for_global): New function.
7357         (Target_i386::do_plt_section_for_local): New function.
7358         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
7359         parameter; change all callers.  Initialize global_ifuncs_ and
7360         local_ifuncs_.  If doing a static link define __rel_iplt_start and
7361         __rel_iplt_end.
7362         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
7363         (Output_data_plt_i386::add_local_ifunc_entry): New function.
7364         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
7365         symbols.
7366         (Target_i386::make_plt_section): New function, broken out of
7367         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
7368         (Target_i386::make_plt_entry): Call make_plt_section.
7369         (Target_i386::make_local_ifunc_plt_entry): New function.
7370         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
7371         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
7372         R_386_IRELATIVE to switch.
7373         (Target_i386::Scan::global): Likewise.
7374         (Target_i386::Relocate::relocate): Likewise.
7375         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
7376         switch.
7377         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
7378         (Target_x86_64::do_plt_section_for_global): New function.
7379         (Target_x86_64::do_plt_section_for_local): New function.
7380         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
7381         parameter; change all callers.  If doing a static link define
7382         __rela_iplt_start and __rela_iplt_end.
7383         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
7384         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
7385         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
7386         to point to .plt.
7387         (Target_x86_64::make_local_ifunc_plt_entry): New function.
7388         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
7389         switch.
7390         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
7391         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
7392         R_X86_64_IRELATIVE to switch.
7393         (Target_x86_64::Scan::global): Likewise.
7394         (Target_x86_64::Relocate::relocate): Likewise.
7395         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
7396         switch.
7397         * target.h (class Target): Add plt_section_for_global and
7398         plt_section_for_local functions.  Add do_plt_section_for_global
7399         and do_plt_section_for_local virtual functions.
7400         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
7401         clarifying comments.
7402         (Symbol::use_plt_offset): Handle IFUNC symbol.
7403         * object.cc (Sized_relobj::Sized_relobj): Initialize
7404         local_plt_offsets_.
7405         (Sized_relobj::local_has_plt_offset): New function.
7406         (Sized_relobj::local_plt_offset): New function.
7407         (Sized_relobj::set_local_plt_offset): New function.
7408         (Sized_relobj::do_count): Handle IFUNC symbol.
7409         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
7410         a bit away from input_shndx_ field.  Add set_is_func_symbol and
7411         is_ifunc_symbol functions.
7412         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
7413         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
7414         local_plt_offsets_ field.
7415         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
7416         * output.h (class Output_section_data): Add non-const
7417         output_section function.
7418         (class Output_data_got): Update declarations.
7419         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
7420         Add use_plt_offset parameter to global and local constructors.
7421         Change all callers.  Change local_sym_index_ field to 31 bits.
7422         Change GSYM_CODE and CONSTANT_CODE accordingly.
7423         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
7424         doing a static link don't set sh_link field.
7425         (Output_data_got::Got_entry::write): Use PLT offset if
7426         appropriate.
7427         (Output_data_got::add_global_plt): New function.
7428         (Output_data_got::add_local_plt): New function.
7429         * target-reloc.h (relocate_section): Handle IFUNC symbol.
7430         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
7431         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
7432         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
7433         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
7434         IFUNC conditional.
7435         * testsuite/ifunc-sel.h: New file.
7436         * testsuite/ifuncmain1.c: New file.
7437         * testsuite/ifuncmain1vis.c: New file.
7438         * testsuite/ifuncmod1.c: New file.
7439         * testsuite/ifuncdep2.c: New file.
7440         * testsuite/ifuncmain2.c: New file.
7441         * testsuite/ifuncmain3.c: New file.
7442         * testsuite/ifuncmod3.c: New file.
7443         * testsuite/ifuncmain4.c: New file.
7444         * testsuite/ifuncmain5.c: New file.
7445         * testsuite/ifuncmod5.c: New file.
7446         * testsuite/ifuncmain6pie.c: New file.
7447         * testsuite/ifuncmod6.c: New file.
7448         * testsuite/ifuncmain7.c: New file.
7449         * configure, testsuite/Makefile.in: Rebuild.
7450
7451 2010-08-18  Ian Lance Taylor  <iant@google.com>
7452
7453         * incremental.cc
7454         (Output_section_incremental_inputs::write_input_files): Add cast
7455         to avoid signed/unsigned comparison warning.
7456         (Output_section_incremental_inputs::write_info_blocks): Likewise.
7457
7458 2010-08-12  Cary Coutant  <ccoutant@google.com>
7459
7460         * common.cc (Sort_commons::operator()): Remove unnecessary code.
7461
7462 2010-08-13  Ian Lance Taylor  <iant@google.com>
7463
7464         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
7465
7466 2010-08-12  Cary Coutant  <ccoutant@google.com>
7467             Doug Kwan  <dougkwan@google.com>
7468
7469         * resolve.cc (Symbol_table::should_override): When a weak dynamic
7470         defintion overrides non-weak undef, remember that the original undef
7471         is not weak.
7472         * symtab.cc (Symbol_table::sized_write_global): For undef without
7473         an original weak binding, set binding to global in output.
7474         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
7475         * testsuite/Makefile.in: Regenerate.
7476         * testsuite/strong_ref_weak_def.sh: New file.
7477         * testsuite/strong_ref_weak_def_1.c: Ditto.
7478         * testsuite/strong_ref_weak_def_2.c: Ditto.
7479
7480 2010-08-12  Cary Coutant  <ccoutant@google.com>
7481
7482         * testsuite/incremental_test.sh: Rewrite.
7483         * testsuite/incremental_test_1.c: Rewrite.
7484         * testsuite/incremental_test_2.c: Rewrite.
7485
7486 2010-08-12  Cary Coutant  <ccoutant@google.com>
7487
7488         * arm.cc (Target_arm::got_size): Add const.
7489         (Target_arm::got_entry_count): New function.
7490         (Target_arm::plt_entry_count): New function.
7491         (Target_arm::first_plt_entry_offset): New function.
7492         (Target_arm::plt_entry_size): New function.
7493         (Output_data_plt_arm::entry_count): New function.
7494         (Output_data_plt_arm::first_plt_entry_offset): New function.
7495         (Output_data_plt_arm::get_plt_entry_size): New function.
7496         * i386.cc (Target_i386::got_size): Add const.
7497         (Target_i386::got_entry_count): New function.
7498         (Target_i386::plt_entry_count): New function.
7499         (Target_i386::first_plt_entry_offset): New function.
7500         (Target_i386::plt_entry_size): New function.
7501         (Output_data_plt_i386::entry_count): New function.
7502         (Output_data_plt_i386::first_plt_entry_offset): New function.
7503         (Output_data_plt_i386::get_plt_entry_size): New function.
7504         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
7505         find_incremental_inputs_sections.  Dump incremental_got_plt section.
7506         * incremental.cc: Include target.h.
7507         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
7508         parameter.  Adjust all callers.  Find incremental_got_plt section.
7509         (Incremental_inputs::create_data_sections): Create incremental_got_plt
7510         section.
7511         (Output_section_incremental_inputs::set_final_data_size): Calculate
7512         size of incremental_got_plt section.
7513         (Output_section_incremental_inputs::do_write): Write the
7514         incremental_got_plt section.
7515         (Got_plt_view_info): New struct.
7516         (Local_got_offset_visitor): New class.
7517         (Global_got_offset_visitor): New class.
7518         (Global_symbol_visitor_got_plt): New class.
7519         (Output_section_incremental_inputs::write_got_plt): New function.
7520         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
7521         Add parameter.  Adjust all callers.
7522         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
7523         (Incremental_inputs::got_plt_section): New function.
7524         (Incremental_inputs::got_plt_section_): New data member.
7525         (Incremental_got_plt_reader): New class.
7526         * layout.cc (Layout::create_incremental_info_sections): Add the
7527         incremental_got_plt section.
7528         * object.h (Got_offset_list::get_list): New function.
7529         (Got offset_list::for_all_got_offsets): New function.
7530         (Sized_relobj::local_got_offset_list): New function.
7531         * powerpc.cc (Target_powerpc::got_size): Add const.
7532         (Target_powerpc::got_entry_count): New function.
7533         (Target_powerpc::plt_entry_count): New function.
7534         (Target_powerpc::first_plt_entry_offset): New function.
7535         (Target_powerpc::plt_entry_size): New function.
7536         (Output_data_plt_powerpc::entry_count): New function.
7537         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
7538         (Output_data_plt_powerpc::get_plt_entry_size): New function.
7539         * sparc.cc (Target_sparc::got_size): Add const.
7540         (Target_sparc::got_entry_count): New function.
7541         (Target_sparc::plt_entry_count): New function.
7542         (Target_sparc::first_plt_entry_offset): New function.
7543         (Target_sparc::plt_entry_size): New function.
7544         (Output_data_plt_sparc::entry_count): New function.
7545         (Output_data_plt_sparc::first_plt_entry_offset): New function.
7546         (Output_data_plt_sparc::get_plt_entry_size): New function.
7547         * symtab.h (Symbol::got_offset_list): New function.
7548         (Symbol_table::for_all_symbols): New function.
7549         * target.h (Sized_target::got_entry_count): New function.
7550         (Sized_target::plt_entry_count): New function.
7551         (Sized_target::plt_entry_size): New function.
7552         * x86_64.cc (Target_x86_64::got_size): Add const.
7553         (Target_x86_64::got_entry_count): New function.
7554         (Target_x86_64::plt_entry_count): New function.
7555         (Target_x86_64::first_plt_entry_offset): New function.
7556         (Target_x86_64::plt_entry_size): New function.
7557         (Output_data_plt_x86_64::entry_count): New function.
7558         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
7559         (Output_data_plt_x86_64::get_plt_entry_size): New function.
7560
7561 2010-08-12  Cary Coutant  <ccoutant@google.com>
7562
7563         * archive.cc: Include incremental.h.
7564         (Archive::Archive): Initialize incremental_info_.
7565         (Archive::include_member): Record archive members in incremental info.
7566         (Add_archive_symbols::run): Record begin and end of an archive in
7567         incremental info.
7568         (Lib_group::include_member): Record objects in incremental info.
7569         * archive.h (Incremental_archive_entry): Forward declaration.
7570         (Archive::set_incremental_info): New member function.
7571         (Archive::incremental_info): New member function.
7572         (Archive::Unused_symbol_iterator): New class.
7573         (Archive::unused_symbols_begin): New member function.
7574         (Archive::unused_symbols_end): New member function.
7575         (Archive::incremental_info_): New data member.
7576         * incremental-dump.cc (find_input_containing_global): New function.
7577         (dump_incremental_inputs): Dump new incremental info sections.
7578         * incremental.cc: Include symtab.h.
7579         (Output_section_incremental_inputs): New class.
7580         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
7581         new incremental info sections.
7582         (Sized_incremental_binary::do_check_inputs): Likewise.
7583         (Incremental_inputs::report_archive): Remove.
7584         (Incremental_inputs::report_archive_begin): New function.
7585         (Incremental_inputs::report_archive_end): New function.
7586         (Incremental_inputs::report_object): New function.
7587         (Incremental_inputs::finalize_inputs): Remove.
7588         (Incremental_inputs::report_input_section): New function.
7589         (Incremental_inputs::report_script): Rewrite.
7590         (Incremental_inputs::finalize): Do nothing but finalize string table.
7591         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
7592         (Incremental_inputs::sized_create_inputs_section_data): Remove.
7593         (Incremental_inputs::create_data_sections): New function.
7594         (Incremental_inputs::relocs_entsize): New function.
7595         (Output_section_incremental_inputs::set_final_data_size): New function.
7596         (Output_section_incremental_inputs::do_write): New function.
7597         (Output_section_incremental_inputs::write_header): New function.
7598         (Output_section_incremental_inputs::write_input_files): New function.
7599         (Output_section_incremental_inputs::write_info_blocks): New function.
7600         (Output_section_incremental_inputs::write_symtab): New function.
7601         * incremental.h (Incremental_script_entry): Forward declaration.
7602         (Incremental_object_entry): Forward declaration.
7603         (Incremental_archive_entry): Forward declaration.
7604         (Incremental_inputs): Forward declaration.
7605         (Incremental_inputs_header_data): Remove.
7606         (Incremental_inputs_header): Remove.
7607         (Incremental_inputs_header_write): Remove.
7608         (Incremental_inputs_entry_data): Remove.
7609         (Incremental_inputs_entry): Remove.
7610         (Incremental_inputs_entry_write): Remove.
7611         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
7612         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
7613         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
7614         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
7615         Likewise.
7616         (Incremental_input_entry): New class.
7617         (Incremental_script_entry): New class.
7618         (Incremental_object_entry): New class.
7619         (Incremental_archive_entry): New class.
7620         (Incremental_inputs::Incremental_inputs): Initialize new data members.
7621         (Incremental_inputs::report_inputs): Remove.
7622         (Incremental_inputs::report_archive): Remove.
7623         (Incremental_inputs::report_archive_begin): New function.
7624         (Incremental_inputs::report_archive_end): New function.
7625         (Incremental_inputs::report_object): Change prototype.
7626         (Incremental_inputs::report_input_section): New function.
7627         (Incremental_inputs::report_script): Change prototype.
7628         (Incremental_inputs::get_reloc_count): New function.
7629         (Incremental_inputs::set_reloc_count): New function.
7630         (Incremental_inputs::create_data_sections): New function.
7631         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
7632         (Incremental_inputs::inputs_section): New function.
7633         (Incremental_inputs::symtab_section): New function.
7634         (Incremental_inputs::relocs_section): New function.
7635         (Incremental_inputs::get_stringpool): Add const.
7636         (Incremental_inputs::command_line): Add const.
7637         (Incremental_inputs::inputs): Remove.
7638         (Incremental_inputs::command_line_key): New function.
7639         (Incremental_inputs::input_file_count): New function.
7640         (Incremental_inputs::input_files): New function.
7641         (Incremental_inputs::relocs_entsize): New function.
7642         (Incremental_inputs::sized_create_inputs_section_data): Remove.
7643         (Incremental_inputs::finalize_inputs): Remove.
7644         (Incremental_inputs::Input_info): Remove.
7645         (Incremental_inputs::lock_): Remove.
7646         (Incremental_inputs::inputs_): Change type.
7647         (Incremental_inputs::inputs_map_): Remove.
7648         (Incremental_inputs::current_object_entry_): New data member.
7649         (Incremental_inputs::inputs_section_): New data member.
7650         (Incremental_inputs::symtab_section_): New data member.
7651         (Incremental_inputs::relocs_section_): New data member.
7652         (Incremental_inputs::reloc_count_): New data member.
7653         (Incremental_inputs_reader): New class.
7654         (Incremental_symtab_reader): New class.
7655         (Incremental_relocs_reader): New class.
7656         * layout.cc (Layout::finalize): Move finalization of incremental info
7657         and creation of incremental info sections to follow finalization of
7658         symbol table.  Set offsets for postprocessing sections.
7659         (Layout::create_incremental_info_sections): Call
7660         Incremental_inputs::create_data_sections.  Add incremental symtab
7661         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
7662         sections to layout after input sections.
7663         * layout.h (struct Timespec): Forward declaration.
7664         (Layout::incremental_inputs): Add const.
7665         (Layout::create_incremental_info_sections): Add parameter.
7666         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
7667         * object.cc: Include incremental.h.
7668         (Relobj::finalize_incremental_relocs): New function.
7669         (Sized_relobj::do_layout): Record input sections in incremental info.
7670         * object.h (Object::output_section): New function.
7671         (Object::output_section_offset): Moved from Relobj.
7672         (Object::get_incremental_reloc_base): New function.
7673         (Object::get_incremental_reloc_count): New function.
7674         (Object::do_output_section): New function.
7675         (Object::do_output_section_offset): Moved from Relobj.
7676         (Object::do_get_incremental_reloc_base): New function.
7677         (Object::do_get_incremental_reloc_count): New function.
7678         (Object::Object): Initialize new data members.
7679         (Relobj::output_section): Renamed do_output_section and moved to
7680         protected.
7681         (Relobj::output_section_offset): Moved to Object.
7682         (Relobj::do_get_incremental_reloc_base): New function.
7683         (Relobj::do_get_incremental_reloc_count): New function.
7684         (Relobj::allocate_incremental_reloc_counts): New function.
7685         (Relobj::count_incremental_reloc): New function.
7686         (Relobj::finalize_incremental_relocs): New function.
7687         (Relobj::next_incremental_reloc_index): New function.
7688         (Relobj::reloc_counts_): New data member.
7689         (Relobj::reloc_bases_): New data member.
7690         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
7691         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
7692         (Sized_relobj::incremental_relocs_scan): New function.
7693         (Sized_relobj::incremental_relocs_scan_reltype): New function.
7694         (Sized_relobj::incremental_relocs_write): New function.
7695         (Sized_relobj::incremental_relocs_write_reltype): New function.
7696         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
7697         incremental link.
7698         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
7699         archives and object files elsewhere.
7700         (Add_symbols::run): Report object files here.
7701         (Finish_group::run): Report end of archive at end of group.
7702         * reloc.cc: Include layout.h, incremental.h.
7703         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
7704         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
7705         (Sized_relobj::incremental_relocs_scan): New function.
7706         (Sized_relobj::incremental_relocs_scan_reltype): New function.
7707         (Sized_relobj::do_relocate_sections): Write incremental relocations.
7708         (Sized_relobj::incremental_relocs_write): New function.
7709         (Sized_relobj::incremental_relocs_write_reltype): New function.
7710         * script.cc (read_input_script): Rewrite test for incremental link.
7711         Change call to Incremental_inputs::report_script.
7712         * symtab.h (Symbol_table::first_global_index): New function.
7713         (Symbol_table::output_count): New function.
7714
7715 2010-08-12  Doug Kwan  <dougkwan@google.com>
7716
7717         * arm.cc (Target_arm::merge_object_attributes): Check command line
7718         options --no-wchar-size-warning and --no-enum-size-warning.
7719         * options.h (General_options): Add ld-compatible options
7720         --no-enum-size-warning and --no-wchar-size-warning.
7721
7722 2010-08-04  Ian Lance Taylor  <iant@google.com>
7723
7724         * x86_64.cc (Target_x86_64::Scan::local): Use
7725         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
7726         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
7727         (Target_x86_64::Scan::global): Likewise.
7728         (Target_x86_64::Relocate::relocate): Likewise.
7729         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
7730         Likewise.
7731
7732 2010-08-03  Cary Coutant  <ccoutant@google.com>
7733
7734         * merge.cc (Output_merge_string::do_add_input_section): Count strings
7735         to reserve space in merged_strings vector. Keep total input size
7736         for stats.
7737         (Output_merge_string::do_print_merge_stats): Print total input size.
7738         * merge.h (Output_merge_string): Add input_size_ field.
7739         * stringpool.cc (Stringpool_template::string_length): Move
7740         implementations out of Stringpool_template class and place in
7741         stringpool.h.
7742         * stringpool.h (string_length): Move out of Stringpool_template.
7743
7744 2010-08-03  Ian Lance Taylor  <iant@google.com>
7745
7746         PR 11712
7747         * layout.cc (relaxation_loop_body): If address of load segment is
7748         set, adjust address to include headers if possible.
7749
7750 2010-08-03  Ian Lance Taylor  <iant@google.com>
7751
7752         * version.cc (version_string): Bump to 1.10.
7753
7754 2010-08-03  Ian Lance Taylor  <iant@google.com>
7755
7756         PR 11805
7757         * layout.h (enum Output_section_order): Define.
7758         (class Layout): Update declarations.
7759         * layout.cc (Layout::get_output_section): Add order parameter.
7760         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
7761         is_first_non_relro parameters.  Change all callers.
7762         (Layout::choose_output_section): Likewise.
7763         (Layout::add_output_section_data): Likewise.
7764         (Layout::make_output_section): Likewise.  Set order.
7765         (Layout::default_section_order): New function.
7766         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
7767         * output.cc (Output_section::Output_section): Initialize order_.
7768         Don't initialize deleted fields.
7769         (Output_segment::Output_segment): Don't initialize deleted
7770         fields.
7771         (Output_segment::add_output_section_to_load): New function
7772         replacing add_output_section.  Change all callers to call this or
7773         add_output_section_to_nonload.
7774         (Output_segment::add_output_section_to_nonload): New function.
7775         (Output_segment::remove_output_section): Rewrite.
7776         (Output_segment::add_initial_output_data): Likewise.
7777         (Output_segment::has_any_data_sections): Likewise.
7778         (Output_segment::is_first_section_relro): Likewise.
7779         (Output_segment::maximum_alignment): Likewise.
7780         (Output_segment::has_dynamic_reloc): New function replacing
7781         dynamic_reloc_count.  Change all callers.
7782         (Output_segment::has_dynamic_reloc_list): New function replacing
7783         dynamic_reloc_count_list.  Change all callers.
7784         (Output_segment::set_section_addresses): Rewrite.
7785         (Output_segment::set_offset): Rewrite.
7786         (Output_segment::find_first_and_last_list): Remove.
7787         (Output_segment::set_tls_offsets): Rewrite.
7788         (Output_segment::first_section_load_address): Likewise.
7789         (Output_segment::output_section_count): Likewise.
7790         (Output_segment::section_with_lowest_load_address): Likewise.
7791         (Output_segment::write_section_headers): Likewise.
7792         (Output_segment::print_sections_to_map): Likewise.
7793         * output.h (class Output_data): Remove dynamic_reloc_count_
7794         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
7795         (Output_data::add_dynamic_reloc): Rewrite.
7796         (Output_data::has_dynamic_reloc): New function.
7797         (Output_data::dynamic_reloc_count): Remove.
7798         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
7799         is_last_relro_, is_first_non_relro_, is_interp_,
7800         is_dynamic_linker_section_ fields.  Add order and set_order
7801         functions.  Remove is_relro_local, set_is_relro_local,
7802         is_last_relro, set_is_last_relro, is_first_non_relro,
7803         set_is_first_non_relro functions, is_interp, set_is_interp,
7804         is_dynamic_linker_section, and set_is_dynamic_linker_section
7805         functions.
7806         (class Output_segment): Change Output_data_list from std::list to
7807         std:;vector.  Add output_lists_ field.  Remove output_data_ and
7808         output_bss_ fields.  Update declarations.
7809
7810 2010-08-02  Ian Lance Taylor  <iant@google.com>
7811
7812         * arm.cc (Target_arm::gc_process_relocs): Use typename.
7813         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
7814         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
7815
7816 2010-08-02  Ian Lance Taylor  <iant@google.com>
7817
7818         PR 11855
7819         * script.cc (Script_options::Script_options): Initialize
7820         symbol_definitions_ and symbol_references_.
7821         (Script_options::add_symbol_assignment): Update
7822         symbol_definitions_ and symbol_references_.
7823         (Script_options::add_symbol_reference): New function.
7824         (script_symbol): New function.
7825         * script.h (class Script_options): Add symbol_definitions_ and
7826         symbol_references_ fields.
7827         (Script_options::referenced_const_iterator): New type.
7828         (Script_options::referenced_begin): New function.
7829         (Script_options::referenced_end): New function.
7830         (Script_options::is_referenced): New function.
7831         (Script_options::any_unreferenced): New function.
7832         * script-c.h (script_symbol): Declare.
7833         * yyscript.y (exp): Call script_symbol.
7834         * symtab.cc: Include "script.h".
7835         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
7836         Change all callers.  Check symbols referenced by scripts.
7837         (Symbol_table::add_undefined_symbols_from_command_line): Add
7838         layout parameter.  Change all callers.
7839         (Symbol_table::do_add_undefined_symbols_from_command_line):
7840         Likewise.  Break out loop body.  Check symbols referenced by
7841         scripts.
7842         (Symbol_table::add_undefined_symbol_from_command_line): New
7843         function broken out of
7844         do_add_undefined_symbols_from_command_line.
7845         * symtab.h (class Symbol_table): Update declarations.
7846         * archive.cc: Include "layout.h".
7847         (Archive::should_include_member): Add layout parameter.  Change
7848         all callers.  Check for symbol mentioned in expression.
7849         * archive.h (class Archive): Update declaration.
7850         * object.cc (Sized_relobj::do_should_include_member): Add layout
7851         parameter.
7852         * object.h (Object::should_include_member): Add layout parameter.
7853         Change all callers.
7854         (Object::do_should_include_member): Add layout parameter.
7855         (class Sized_relobj): Update declaration.
7856         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
7857         parameter.
7858         * dynobj.h (class Sized_dynobj): Update declaration.
7859         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
7860         layout parameter.
7861         * plugin.h (class Sized_pluginobj): Update declaration.
7862
7863 2010-08-02  Ian Lance Taylor  <iant@google.com>
7864
7865         PR 11866
7866         * output.cc (Output_segment::set_offset): Search for the first and
7867         last sections rather than assuming that the list is in order.
7868         (Output_segment::find_first_and_last_list): New function.
7869         * output.h (class Output_segment): Update declarations.
7870         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
7871         (relro_strip_test_SOURCES): New variable.
7872         (relro_strip_test_DEPENDENCIES): New variable.
7873         (relro_strip_test_LDFLAGS): New variable.
7874         (relro_strip_test_LDADD): New variable.
7875         (relro_strip_test.so): New target.
7876
7877 2010-08-02  Ian Lance Taylor  <iant@google.com>
7878
7879         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
7880         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
7881         (Target_i386::got_tlsdesc_section): New function.
7882         (Target_i386::got_section): Create space for GOT entries for
7883         TLSDESC relocations.
7884         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
7885         R_386_TLS_GOTDESC.
7886         (Target_i386::Scan::global): Likewise.
7887         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
7888         using TLSDESC GOT.
7889         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
7890         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
7891         (Target_x86_64::got_tlsdesc_section): New function.
7892         (Target_x86_64::got_section): Create space for GOT entries for
7893         TLSDESC relocations.
7894         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
7895         R_386_TLS_GOTDESC.
7896         (Target_x86_64::Scan::global): Likewise.
7897         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
7898         using TLSDESC GOT.
7899
7900 2010-08-02  Ian Lance Taylor  <iant@google.com>
7901
7902         * testsuite/final_layout.sh: Use dc to convert from hex to
7903         decimal.
7904
7905 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
7906
7907         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
7908         paramter to the call to gold::gc_process_relocs.
7909         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
7910         paramter to the call to gold::gc_process_relocs.
7911         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
7912         parameter to the call to gold::gc_process_relocs.
7913         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
7914         template parameter to the call to gold::gc_process_relocs.
7915         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
7916         paramter to the call to gold::gc_process_relocs.
7917         * gc.h (get_embedded_addend_size): New function.
7918         (gc_process_relocs): Save the size of the reloc for use by ICF.
7919         * icf.cc (get_section_contents): Get the addend from the text section
7920         for SHT_REL relocation sections.
7921         * icf.h (Icf::Reloc_addend_size_info): New typedef.
7922         (Icf::Reloc_info): Add new member reloc_addend_size_info.
7923         * int_encoding.h (read_from_pointer): New overloaded function.
7924         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
7925         * testsuite/icf_sht_rel_addend_test.sh: New file.
7926         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
7927         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
7928
7929 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7930
7931         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
7932         * Makefile.in: Regenerate.
7933         * testsuite/Makefile.in: Regenerate.
7934
7935 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
7936
7937         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
7938         * gold/testsuite/debug_msg.cc: Likewise.
7939         * gold/testsuite/odr_violation1.cc
7940         * gold/testsuite/odr_violation2.cc
7941
7942 2010-07-21  Cary Coutant  <ccoutant@google.com>
7943
7944         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
7945         string, and length fields.
7946         (Output_merge_string::Merged_strings_list): New type.
7947         (Output_merge_string::Merged_strings_lists): New typedef.
7948         (Output_merge_string): Replace merged_strings_ with
7949         merged_strings_lists_.
7950         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
7951         Merged_strings_list per input object and section.  Don't store pointer
7952         to the string.  Don't store length with each merged string entry.
7953         (Output_merge_string::finalize_merged_data): Loop over list of merged
7954         strings lists.  Recompute length of each merged string.
7955
7956 2010-07-15  Cary Coutant  <ccoutant@google.com>
7957
7958         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
7959         here.
7960
7961 2010-07-14  Ian Lance Taylor  <iant@google.com>
7962
7963         * descriptors.cc (Descriptors::open): Report correct name in error
7964         message.
7965
7966 2010-07-13  Doug Kwan  <dougkwan@google.com>
7967
7968         * arm.cc (Arm_input_section::Arm_input_section): For a
7969         SHT_ARM_EXIDX section, always keeps the input sections.
7970         (Arm_input_section::set_exidx_section_link): New method.
7971         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
7972         has_errors_ to false.
7973         (Arm_exidx_input_section::has_errors,
7974         Arm_exidx_input_section::set_has_errors): New methods.
7975         (Arm_exidx_input_section::has_errors_): New data member.
7976         (Arm_relobj::get_exidx_shndx_list): New method.
7977         (Arm_output_section::append_text_sections_to_list): Do not skip
7978         section without SHF_EXECINSTR.
7979         (Arm_output_section::fix_exidx_coverage): Skip input sections with
7980         errors.
7981         (Arm_relobj::make_exidx_input_section): Add new parameter for text
7982         section header.  Make error messages more verbose.  Check for
7983         a non-executable section linked to an EXIDX section.
7984         (Arm_relobj::do_read_symbols): Remove error checking, which has been
7985         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
7986         check that there is no deferred EXIDX section if we exit early.
7987         Instead of not making an EXIDX section in case of an error, make one
7988         and set the has_errors flag of it.
7989         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
7990         in a relocatable link.
7991         (Target_arm::do_relax): Look for the EXIDX output section instead of
7992         assuming that it is called .ARM.exidx.
7993         (Target_arm::fix_exidx_coverage): Add a new parameter for input
7994         section list.  Do not check for SHF_EXECINSTR section flags but
7995         skip any input section with errors.
7996         * output.cc (Output_section::Output_section): Initialize
7997         always_keeps_input_sections_ to false.
7998         (Output_section::add_input_section): Check for
7999         always_keeps_input_sections_.
8000         *  output.h (Output_section::always_keeps_input_sections,
8001         Output_section::set_always_keeps_input_sections): New methods.
8002         (Output_section::always_keeps_input_sections): New data member.
8003
8004 2010-07-13  Rafael Espindola  <espindola@google.com>
8005
8006         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
8007         * fileread.h (Input_file): Add try_extra_search_path and find_file.
8008
8009 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
8010             Ian Lance Taylor  <iant@google.com>
8011
8012         * output.h (Output_section_lookup_maps::add_merge_section):
8013         Correct check of whether value was inserted.
8014         (Output_section_lookup_maps::add_merge_input_section): Likewise.
8015         (Output_section_lookup_maps::add_relaxed_input_section):
8016         Likewise.
8017         * arm.cc (Target_arm::got_section): Remove used local os.
8018         * i386.cc (Target_i386::got_section): Likewise.
8019         * x86_64.cc (Target_x86_64::got_section): Likewise.
8020         * sparc.cc (Target_sparc::got_section): Likewise.
8021         (Target_sparc::relocate): Remove unused local have_got_offset.
8022         * powerpc.cc (Target_powerpc::relocate): Likewise.
8023
8024 2010-07-13  Ian Lance Taylor  <iant@google.com>
8025
8026         * compressed_output.cc (zlib_decompress): Fix signature in
8027         !HAVE_ZLIB_H case.
8028
8029         * archive.cc (Archive::include_member): Unlock an external member
8030         of a thin archive.  Don't bother to delete an object we know is
8031         NULL.
8032
8033 2010-07-12  Cary Coutant  <ccoutant@google.com>
8034
8035         * compressed_output.cc (zlib_decompress): New function.
8036         (get_uncompressed_size): New function.
8037         (decompress_input_section): New function.
8038         * compressed_output.h (get_uncompressed_size): New function.
8039         (decompress_input_section): New function.
8040         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
8041         Handle compressed debug sections.
8042         * layout.cc (is_compressed_debug_section): New function.
8043         (Layout::output_section_name): Map compressed section names to
8044         canonical names.
8045         * layout.h (is_compressed_debug_section): New function.
8046         (is_debug_info_section): Recognize compressed debug sections.
8047         * merge.cc: Include compressed_output.h.
8048         (Output_merge_data::do_add_input_section): Handle compressed
8049         debug sections.
8050         (Output_merge_string::do_add_input_section): Handle compressed
8051         debug sections.
8052         * object.cc: Include compressed_output.h.
8053         (Sized_relobj::Sized_relobj): Initialize new data members.
8054         (build_compressed_section_map): New function.
8055         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
8056         * object.h (Object::section_is_compressed): New method.
8057         (Object::do_section_is_compressed): New method.
8058         (Sized_relobj::Compressed_section_map): New type.
8059         (Sized_relobj::do_section_is_compressed): New method.
8060         (Sized_relobj::compressed_sections_): New data member.
8061         * output.cc (Output_section::add_input_section): Handle compressed
8062         debug sections.
8063         * reloc.cc: Include compressed_output.h.
8064         (Sized_relobj::write_sections): Handle compressed debug sections.
8065
8066 2010-07-08  Cary Coutant  <ccoutant@google.com>
8067
8068         * resolve.cc (Symbol_table::resolve): Remember whether undef was
8069         weak when resolving to a dynamic def.
8070         (Symbol_table::should_override): Add adjust_dyndef flag; set it
8071         for weak undef/dynamic def cases. Adjust callers.
8072         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
8073         undef_binding_weak_.
8074         (Symbol_table::sized_write_globals): Adjust symbol binding.
8075         (Symbol_table::sized_write_symbol): Add binding parameter.
8076         * symtab.h (Symbol::set_undef_binding): New method.
8077         (Symbol::is_undef_binding_weak): New method.
8078         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
8079         (Symbol_table::should_override): Add new parameter.
8080         (Symbol_table::sized_write_symbol): Add new parameter.
8081
8082         * testsuite/weak_undef_file1.cc: Add new test case.
8083         * testsuite/weak_undef_file2.cc: Fix header comment.
8084         * testsuite/weak_undef_test.cc: Add new test case.
8085
8086 2010-06-29  Doug Kwan  <dougkwan@google.com>
8087
8088         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
8089         Initialize USE_SYMBOL_.
8090         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
8091         definition.
8092         (Arm_reloc_property::uses_symbol_): New data member declaration.
8093         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
8094         uses symbol value and symbol is undefined but not weakly undefined.
8095
8096 2010-06-28  Rafael Espindola  <espindola@google.com>
8097
8098         * plugin.cc (Plugin::load): Use dlerror.
8099
8100 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
8101
8102         * symtab.cc (detect_odr_violations): When reporting an ODR
8103         violation, report an object where the symbol is defined.
8104
8105 2010-06-25  Doug Kwan  <dougkwan@google.com>
8106
8107         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
8108         (Target_arm::section_may_have_icf_unsafe_pointers): New method
8109         definition.
8110         (Target_arm::Scan::local_reloc_may_be_function_pointer,
8111         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
8112         target hook to detect function points.
8113         (Target_arm::Scan::possible_function_pointer_reloc): New method.
8114         * icf.h (Icf::check_section_for_function_pointers): Change type of
8115         parameter SECTION_NAME to const reference to std::string.  Use
8116         target hook to determine if section may have unsafe pointers.
8117         * target.h (Target::section_may_have_icf_unsafe_pointers): New
8118         method definition.
8119
8120 2010-06-21  Rafael Espindola  <espindola@google.com>
8121
8122         * fileread.cc (Input_file::find_fie): New
8123         (Input_file::open): Use Input_file::find_fie.
8124         * fileread.h (Input_file::find_fie): New
8125         * plugin.cc (set_extra_library_path): New.
8126         (Plugin::load): Add set_extra_library_path to the transfer vector.
8127         (Plugin_manager::set_extra_library_path): New.
8128         (Plugin_manager::add_input_file): Use the extra search path if set.
8129         (set_extra_library_path(): New.
8130         * plugin.h (Plugin_manager): Add set_extra_library_path and
8131         extra_search_path_.
8132
8133 2010-06-19  Cary Coutant  <ccoutant@google.com>
8134
8135         * layout.cc (gdb_sections): Add .debug_types.
8136         (lines_only_debug_sections): Likewise.
8137
8138 2010-06-18  Rafael Espindola  <espindola@google.com>
8139
8140         * plugin.cc (add_input_file,add_input_library)
8141         (Plugin_manager::add_input_file): Make filename arguments const.
8142         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
8143         const.
8144
8145 2010-06-16  Doug Kwan  <dougkwan@google.com>
8146
8147         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
8148         .ARM.attributes section if we have not merged any input
8149         attributes sections.
8150
8151 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8152
8153         * arm.cc: Allow combining objects with no EABI version
8154         information.
8155
8156 2010-06-15  Rafael Espindola  <espindola@google.com>
8157
8158         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
8159
8160 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8161
8162         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
8163         (struct iovec): Correct !HAVE_READV definition.
8164
8165 2010-06-10  Cary Coutant  <ccoutant@google.com>
8166
8167         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
8168         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
8169         reloc sections.
8170         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
8171
8172         PR 11683
8173         * symtab.h (Symbol::is_placeholder): New member function.
8174         * target-reloc.h (relocate_section): Check for placeholder symbols.
8175
8176         * testsuite/Makefile.am (plugin_test_8): New test.
8177         (plugin_test_9): New test.
8178         * testsuite/Makefile.in: Regenerate.
8179
8180 2010-06-09  Nick Clifton  <nickc@redhat.com>
8181
8182         * yyscript.y (input_list_element): Allow strings prefixed with
8183         the '-' character.  Treat these as libraries.
8184         * script.cc (script_add_library): New function.  Adds a library
8185         specified by "-l<name>" found in an input script.
8186         * script-c.h: Add prototype for script_add_library.
8187
8188 2010-06-07  Doug Kwan  <dougkwan@google.com>
8189
8190         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
8191         Restrict stub-group size to be within long conditional branch
8192         range when working around cortex-A8 erratum.
8193
8194 2010-06-07  Damien Diederen  <dd@crosstwine.com>
8195
8196         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
8197         #ifdef typo.
8198
8199 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
8200
8201         PR gold/11658
8202         * output.cc
8203         (Output_section::Input_section_sort_entry::compare_section_ordering):
8204         Change to return non-zero correctly.
8205         (Output_section::Input_section_sort_section_order_index_compare
8206         ::operator()): Change to fix ambiguity in comparisons.
8207
8208 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
8209
8210         * gold.h (is_wildcard_string): New function.
8211         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
8212         (Layout::layout_eh_frame): Ditto.
8213         (Layout::find_section_order_index): New method.
8214         (Layout::read_layout_from_file): New method.
8215         * layout.h (Layout::find_section_order_index): New method.
8216         (Layout::read_layout_from_file): New method.
8217         (Layout::input_section_position_): New private member.
8218         (Layout::input_section_glob_): New private member.
8219         * main.cc (main): Call read_layout_from_file here.
8220         * options.h (--section-ordering-file): New option.
8221         * output.cc (Output_section::input_section_order_specified_): New
8222         member.
8223         (Output_section::Output_section): Initialize new member.
8224         (Output_section::add_input_section): Add new parameter.
8225         Keep input sections when --section-ordering-file is used.
8226         (Output_section::set_final_data_size): Sort input sections when
8227         section ordering file is specified.
8228         (Output_section::Input_section_sort_entry): Add new parameter.
8229         Check sorting type.
8230         (Output_section::Input_section_sort_entry::compare_section_ordering):
8231         New method.
8232         (Output_section::Input_section_sort_compare::operator()): Change to
8233         consider section_order_index.
8234         (Output_section::Input_section_sort_init_fini_compare::operator()):
8235         Change to consider section_order_index.
8236         (Output_section::Input_section_sort_section_order_index_compare
8237         ::operator()): New method.
8238         (Output_section::sort_attached_input_sections): Change to sort
8239         according to section order when specified.
8240         (Output_section::add_input_section<32, true>): Add new parameter.
8241         (Output_section::add_input_section<64, true>): Add new parameter.
8242         (Output_section::add_input_section<32, false>): Add new parameter.
8243         (Output_section::add_input_section<64, false>): Add new parameter.
8244         * output.h (Output_section::add_input_section): Add new parameter.
8245         (Output_section::input_section_order_specified): New
8246         method.
8247         (Output_section::set_input_section_order_specified): New method.
8248         (Input_section::Input_section): Initialize section_order_index_.
8249         (Input_section::section_order_index): New method.
8250         (Input_section::set_section_order_index): New method.
8251         (Input_section::section_order_index_): New member.
8252         (Input_section::Input_section_sort_section_order_index_compare): New
8253         struct.
8254         (Output_section::input_section_order_specified_): New member.
8255         * script-sections.cc (is_wildcard_string): Delete and move modified
8256         method to gold.h.
8257         (Output_section_element_input::Output_section_element_input): Modify
8258         call to is_wildcard_string.
8259         (Output_section_element_input::Input_section_pattern
8260         ::Input_section_pattern): Ditto.
8261         (Output_section_element_input::Output_section_element_input): Ditto.
8262         * testsuite/Makefile.am (final_layout): New test case.
8263         * testsuite/Makefile.in: Regenerate.
8264         * testsuite/final_layout.cc: New file.
8265         * testsuite/final_layout.sh: New file.
8266
8267 2010-06-01  Rafael Espindola  <espindola@google.com>
8268
8269         * plugin.cc (Plugin::load): Pass the output name to the plugin.
8270
8271 2010-06-01  Rafael Espindola  <espindola@google.com>
8272
8273         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
8274         visibility of symbols.
8275
8276 2010-05-27  Doug Kwan  <dougkwan@google.com>
8277
8278         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
8279         from start of output section instead of address for a local symbol
8280         in a merged or relaxed section when doing a relocatable link.
8281
8282 2010-05-26  Rafael Espindola  <espindola@google.com>
8283
8284         PR 11604
8285         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
8286         adding sections the garbage collector removed.
8287         * gold/testsuite/Makefile.am: Add test.
8288         * gold/testsuite/Makefile.in: Regenerate.
8289         * gold/testsuite/plugin_test_7.sh: New.
8290         * gold/testsuite/plugin_test_7_1.c: New.
8291         * gold/testsuite/plugin_test_7_2.c: New.
8292
8293 2010-05-26  Rafael Espindola  <espindola@google.com>
8294
8295         * script-sections.cc (Output_section_definition::set_section_addresses):
8296         Check for --section-start.
8297
8298 2010-05-26  Doug Kwan  <dougkwan@google.com>
8299
8300         * arm.cc (Arm_scan_relocatable_relocs): New class.
8301         (Target_arm::relocate_special_relocatable): New method.
8302         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
8303         (Arm_relocate_functions::thumb_branch_common): Same.
8304         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
8305         instead of Default_scan_relocatable_relocs.
8306         * target-reloc.h (relocate_for_relocatable): Let target handle
8307         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
8308         * target.h (Sized_target::relocate_special_relocatable): New method.
8309
8310 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8311
8312         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
8313
8314 2010-05-23  Doug Kwan  <dougkwan@google.com>
8315
8316         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
8317         instead of a cast.
8318         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
8319         with a direct branch, not a conditional branch, to a stub.
8320         * merge.cc (Output_merge_base::record_input_section): New method
8321         defintion.
8322         (Output_merge_data::do_add_input_section): Record input section if
8323         keeps-input-sections flag is set.
8324         (Output_merge_string::do_add_input_section): Ditto.
8325         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
8326         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
8327         INPUT_SECTIONS_.
8328         (Output_merge_base::keeps_input_sections,
8329         Output_merge_base::set_keeps_input_sections,
8330         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
8331         method definitions.
8332         (Output_merge_base::Input_sections): New type declaration.
8333         (Output_merge_base::input_sections_begin,
8334         Output_merge_base::input_sections_end,
8335         Output_merge_base::do_set_keeps_input_sections): New method definitions.
8336         (Output_merge_base::bool keeps_input_sections_,
8337         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
8338         Output_merge_base::input_sections_): New data members.
8339         (Output_merge_data::do_set_keeps_input_sections): New method
8340         defintion.
8341         (Output_merge_string::do_set_keeps_input_sections): Ditto.
8342         * output.cc (Output_section::Input_section::relobj): Move method
8343         defintion from class declaration to here and handle merge sections.
8344         (Output_section::Input_section::shndx): Ditto.
8345         (Output_section::Output_section): Remove initializations of removed
8346         data members and initialize new data member LOOKUP_MAPS_.
8347         (Output_section::add_input_section): Set keeps-input-sections flag
8348         for a newly created merge output section as appropriate.  Adjust code
8349         to use Output_section_lookup_maps class.
8350         (Output_section::add_relaxed_input_section): Adjst code for lookup
8351         maps code refactoring.
8352         (Output_section::add_merge_input_section): Add a new parameter
8353         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
8354         class.  If adding input section to a newly created merge output
8355         section fails, remove the new merge section.
8356         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
8357         Adjust code for use of the Output_section_lookup_maps class.
8358         (Output_section::find_merge_section): Ditto.
8359         (Output_section::build_lookup_maps): New method defintion.
8360         (Output_section::find_relaxed_input_section): Adjust code to use
8361         Output_section_lookup_maps class.
8362         (Output_section::get_input_sections): Export merge sections.  Adjust
8363         code to use Output_section_lookup_maps class.
8364         (Output_section:::add_script_input_section): Adjust code to use
8365         Output_section_lookup_maps class.  Update lookup maps for merge
8366         sections also.
8367         (Output_section::discard_states): Use Output_section_lookup_maps.
8368         (Output_section::restore_states): Same.
8369         * output.h (Merge_section_properties): Move class defintion out of
8370         Output_section.
8371         (Output_section_lookup_maps): New class.
8372         (Output_section::Input_section::is_merge_section): New method
8373         defintion.
8374         (Output_section::Input_section::relobj): Move defintion out of class
8375         defintion.  Declare method only.
8376         (Output_section::Input_section::shndx): Ditto.
8377         (Output_section::Input_section::output_merge_base): New method defintion.
8378         (Output_section::Input_section::u2_.pomb): New union field.
8379         (Output_section::Merge_section_by_properties_map,
8380         Output_section::Output_section_data_by_input_section_map,
8381         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
8382         Remove types.
8383         (Output_section::add_merge_input_section): Add new parameter
8384         KEEPS_INPUT_SECTIONS.
8385         (Output_section::build_lookup_maps): New method declaration.
8386         (Output_section::merge_section_map_,
8387         Output_section::merge_section_by_properties_map_,
8388         Output_section::relaxed_input_section_map_,
8389         Output_section::is_relaxed_input_section_map_valid_): Remove data
8390         members.
8391         (Output_section::lookup_maps_): New data member.
8392
8393 2010-05-21  Doug Kwan  <dougkwan@google.com>
8394
8395         PR gold/11619
8396         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
8397         avoid a compilation error.
8398
8399 2010-05-19  Rafael Espindola  <espindola@google.com>
8400
8401         * script-sections.cc (Output_section_definition::allocate_to_segment):
8402         Update the phdrs_list even when the output section is NULL.
8403         * testsuite/Makefile.am: Add test.
8404         * testsuite/Makefile.in: Regenerate.
8405         * testsuite/script_test_9.cc: New.
8406         * testsuite/script_test_9.sh: New.
8407         * testsuite/script_test_9.t: New.
8408
8409 2010-05-19  Doug Kwan  <dougkwan@google.com>
8410
8411         * arm.cc (Arm_input_section::original_size): New method.
8412         (Arm_input_section::do_addralign): Add a cast.
8413         (Arm_input_section::do_output_offset): Remove static cast.
8414         (Arm_input_section::original_addralign,
8415          Arm_input_section::original_size_): Change type to uint32_t.
8416         (Arm_input_section::init): Add safe casts for section alignment
8417         and size.
8418         (Arm_input_section::set_final_data_size): Do not set address and
8419         offset of stub table.
8420         (Arm_output_section::fix_exidx_coverage): Change use of of
8421         Output_section::Simple_input_section to that of
8422         Output_section::Input_section.
8423         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
8424         except for the first pass.
8425         * output.cc (Output_section::get_input_sections): Change type of
8426         input_sections to std::list<Input_section>.
8427         (Output_section::add_script_input_section): Rename from
8428         Output_section::add_simple_input_section.  Change type of SIS
8429         parameter from Simple_input_section to Input_section.
8430         * output.h (Output_section::Simple_input_section): Remove class.
8431         (Output_section::Input_section): Change class visibility to public.
8432         (Output_section::Input_section::addralign): Use stored alignments
8433         for special input sections if set.
8434         (Output_section::Input_section::set_addralign): New method.
8435         (Output_section::get_input_sections): Change parameter type from
8436         list of Simple_input_section to list of Input_section.
8437         (Output_section::add_script_input_section): Rename from
8438         Output_section::add_simple_input_section. Change first parameter's
8439         type from Simple_input_section to Input_section and remove the
8440         second and third parameters.
8441         * script-sections.cc (Input_section::Input_section_list): Change
8442         type to list of Output_section::Input_section/
8443         (Input_section_info::Input_section_info): Change parameter type of
8444         INPUT_SECTION to Output_section::Input_section.
8445         (Input_section_info::input_section): Change return type.
8446         (Input_section_info::input_section_): Change type to
8447         Output_section::Input_section.
8448         (Output_section_element_input::set_section_addresses): Adjust code
8449         to use Output_section::Input_section instead of
8450         Output_section::Simple_input_section.  Adjust code for renaming
8451         of Output_section::add_simple_input_section.
8452         (Orphan_output_section::set_section_addresses): Ditto.
8453
8454 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8455
8456         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
8457         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
8458
8459 2010-05-18  Rafael Espindola  <espindola@google.com>
8460
8461         * options.cc (General_options::finalize): Handle -nostdlib.
8462         * options.h (nostdlib): New option.
8463         * script.cc (script_add_search_dir): Handle -nostdlib.
8464
8465 2010-05-12  Doug Kwan  <dougkwan@google.com>
8466
8467         * arm.cc (Target_arm::do_finalize_sections): Create an empty
8468         attributes section only if there no attributes section after merging.
8469         (Target_arm::merge_object_attributes): Move value of
8470         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
8471         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
8472         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
8473         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
8474         and arm_attr_merge_7.stdout.
8475         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
8476         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
8477         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
8478         arm_attr_merge_7b.o): New rules.
8479         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
8480         arm_attr_merge_7
8481         * testsuite/Makefile.in: Regenerate.
8482         * testsuite/arm_attr_merge.sh: New file.
8483         * testsuite/arm_attr_merge_[67][ab].s: Same.
8484
8485 2010-05-05  Nick Clifton  <nickc@redhat.com>
8486
8487         * po/es.po: Updated Spanish translation.
8488
8489 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
8490
8491         * Makefile.am (install-exec-local): Properly install gold as
8492         default cross linker.
8493         * Makefile.in: Regenerated.
8494
8495 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
8496             Nick Clifton  <nickc@redhat.com>
8497
8498         * configure.ac (install_as_default): Define and set to false
8499         unless --enable-gold or --enable-gold=both/gold has been
8500         specified.
8501         * configure: Regenerate.
8502
8503         * Makefile.am (install-exec-local): Install the executable as
8504         'ld.gold'.  If install_as_default is true then also install it as
8505         'ld'.
8506         * Makefile.in: Regenerated.
8507
8508 2010-04-24  Ian Lance Taylor  <iant@google.com>
8509
8510         * layout.cc (Layout::layout_reloc): In relocatable link don't
8511         combine reloc sections for grouped sections.
8512
8513 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
8514
8515         * gc.h (gc_process_relocs): Pass information on relocs pointing to
8516         sections that are not ordinary to icf.
8517         * icf.cc (get_section_contents): Handle relocation pointing to section
8518         with no object or shndx information.
8519         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
8520         * testsuite/Makefile.in: Regenerate.
8521         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
8522         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
8523
8524 2010-04-22  Ian Lance Taylor  <iant@google.com>
8525
8526         * expression.cc (Expression::Expression_eval_info): Add
8527         result_alignment_pointer field.
8528         (Expression::eval_with_dot): Add result_alignment_pointer
8529         parameter.  Change all callers.
8530         (Expression::eval_maybe_dot): Likewise.
8531         (class Binary_expression): Add alignment_pointer parameter to
8532         left_value and right_value.  Change all callers.
8533         (BINARY_EXPRESSION): Set result alignment.
8534         (class Trinary_expression): Add alignment_pointer parameter to
8535         arg2_value and arg3_value.  Change all callers.
8536         (Trinary_cond::value): Set result alignment.
8537         (Max_expression::value, Min_expression::value): Likewise.
8538         (Align_expression::value): Likewise.
8539         * script-sections.cc (class Sections_element): Add dot_alignment
8540         parameter to set_section_addresses virtual function.  Update
8541         instantiations.
8542         (class Output_section_element): Likewise.
8543         (Script_sections::create_segments): Add dot_alignment parameter.
8544         Change all callers.
8545         (Script_sections::create_segments_from_phdrs_clause): Likewise.
8546         (Script_sections::set_phdrs_clause_addresses): Likewise.
8547         * script-sections.h: Update declarations.
8548         * script.h: Update declarations.
8549         * output.h (Output_segment::set_minimum_p_align): Don't decrease
8550         min_p_align.
8551         * testsuite/script_test_3.t: Set large alignment.
8552         * testsuite/script_test_3.sh: Make sure that at least one LOAD
8553         segment has expected alignment.
8554
8555 2010-04-22  Nick Clifton  <nickc@redhat.com>
8556
8557         * po/gold.pot: Updated by the Translation project.
8558         * po/vi.po: Updated Vietnamese translation.
8559
8560 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
8561
8562         * testsuite/Makefile.am (check_PROGRAMS): Add
8563         icf_virtual_function_folding_test.
8564         * testsuite/Makefile.in: Regenerated.
8565
8566 2010-04-15  Andrew Haley  <aph@redhat.com>
8567
8568         * options.h (merge_exidx_entries): New option.
8569         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
8570         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
8571         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
8572         (Target_arm::merge_exidx_entries): New function.
8573         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
8574         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
8575         to Arm_exidx_fixup constructor.
8576         Add new arg, merge_exidx_entries.
8577         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
8578         Arm_output_section::fix_exidx_coverage.
8579
8580 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
8581
8582         * icf.cc (get_section_contents): Check for preemptible functions.
8583         Ignore addend when appropriate.
8584         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
8585         section folded.
8586         (add_from_relobj): Check for section folded.
8587         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
8588         * symtab.h (should_add_dynsym_entry): Add new parameter.
8589         * target-reloc.h (scan_relocs): Check for section folded.
8590         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
8591         Check reloc types for function pointers in shared objects.
8592         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
8593         case.
8594         (icf_preemptible_functions_test): New test case.
8595         (icf_string_merge_test): New test case.
8596         * testsuite.Makefile.in: Regenerate.
8597         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
8598         bar_glob.  Refactor code.
8599         * testsuite/icf_preemptible_functions_test.cc: New file.
8600         * testsuite/icf_preemptible_functions_test.sh: New file.
8601         * testsuite/icf_string_merge_test.cc: New file.
8602         * testsuite/icf_string_merge_test.sh: New file.
8603         * testsuite/icf_virtual_function_folding_test.cc: New file.
8604         * testsuite/icf_virtual_function_folding_test.sh: New file.
8605
8606 2010-04-14  Doug Kwan  <dougkwan@google.com>
8607
8608         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
8609         for local symbol recounting if we remove a section due to ICF.
8610         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
8611         there are no regular objects in input.
8612
8613 2010-04-13  Doug Kwan  <dougkwan@google.com>
8614
8615         * arm.cc (Arm_input_section::set_final_data_size): Compute
8616         accurate final data size instead of using current data size.
8617
8618 2010-04-09  Doug Kwan  <dougkwan@google.com>
8619
8620         * layout.cc (Layout::choose_output_section): Handle script section
8621         types.
8622         (Layout::make_output_section_for_script): Add section type parameter.
8623         Handle script section types.
8624         * layout.h (Layout::make_output_section_for_script): Add section
8625         type parameter.
8626         * output.cc (Output_section::Output_section): Initialize data member
8627         is_noload_.
8628         (Output_section::do_reset_address_and_file_offset): Do not set address
8629         to 0 if section is a NOLOAD section.
8630         * output.h (Output_section::is_noload): New method.
8631         (Output_section::set_is_noload): Ditto.
8632         (Output_section::is_noload_): New data member.
8633         * script-c.h (Script_section_type): New enum type.
8634         (struct Parser_output_section_header): Add new file section_type.
8635         * script-sections.cc (Sections_element::output_section_name): Add
8636         parameter for returning script section type.
8637         (Output_section_definition::output_section_name): Ditto.
8638         (Output_section_definition::section_type)P; New method.
8639         (Output_section_definiton::script_section_type_name): Ditto.
8640         (Output_section_definition::script_section_type_): New data member.
8641         (Output_section_definition::Output_section_definition): Initialize
8642         data member Output_section_definition::script_section_type_.
8643         (Output_section_definition::create_sections): Pass script section type
8644         to Layout::make_output_section_for_script.
8645         (Output_section_definition::output_section_name): Return script
8646         section type to caller.
8647         (Output_section_definition::set_section_address): Do not advance
8648         dot value and load address if section type is NOLOAD.  Set address
8649         of NOLOAD sections regardless of section flags.
8650         (Output_section_definition::print): Print section type if it is
8651         not SCRIPT_SECTION_TYPE_NONE.
8652         (Output_section_definition::section_type): New method.
8653         (Output_section_definition::script_section_type_name): Ditto.
8654         (Script_sections::output_section_name): Add new parameter
8655         PSECTION_TYPE for returning script section type.  Pass it to
8656         section elements.  Handle discard sections.
8657         (Sort_output_sections::operator()): Handle NOLOAD sections.
8658         * script-sections.h (Script_sections::Section_type): New enum type.
8659         (Script_sections::output_section_name): Add a new parameter for
8660         returning script section type.
8661         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
8662         INFO and NOLOAD.
8663         * yyscript.y (union): Add new field SECTION_TYPE.
8664         (COPY, DSECT, INFO, NOLOAD): New tokens.
8665         (opt_address_and_section_type): Change type to output_section_header.
8666         (section_type): New non-terminal
8667         (section_header): Handle section type.
8668         (opt_address_and_section_type): Return section type value.
8669
8670 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
8671
8672         * testsuite/plugin_common_test_1.c (foo): Add prototype.
8673         * testsuite/plugin_common_test_2.c (foo): Likewise.
8674
8675 2010-04-08  Doug Kwan  <dougkwan@google.com>
8676
8677         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
8678         Output_merge_data.
8679         * output.cc (Output_section::add_merge_input_section): Simplify
8680         code and return status of Output_merge_base::add_input_section.
8681         Update merge section map only if Output_merge_base::add_input_section
8682         returns true.
8683
8684 2010-04-07  Doug Kwan  <dougkwan@google.com>
8685
8686         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
8687         if section is marked as containing instructions but has no mapping
8688         symbols.
8689         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
8690         correct section index.
8691         (Arm_relobj::find_linked_text_section): Ditto.
8692
8693 2010-04-07  Cary Coutant  <ccoutant@google.com>
8694
8695         * archive.cc (include_member): Destroy Read_symbols_data object before
8696         releasing file.
8697         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
8698         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
8699         (Read_symbols_data::~Read_symbols_data) New destructor.
8700         (Section_relocs::Section_relocs) New constructor.
8701         (Section_relocs::~Section_relocs) New destructor.
8702         (Read_relocs_data::Read_relocs_data) New constructor.
8703         (Read_relocs_data::~Read_relocs_data) New destructor.
8704         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
8705         pointers to NULL after deleting.
8706
8707 2010-04-07  Doug Kwan  <dougkwan@google.com>
8708
8709         * arm.cc: Replace "endianity" with "endianness" in comments.
8710         (Arm_exidx_cantunwind): Ditto.
8711         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
8712         (Arm_relobj::merge_flags_and_attributes): New method.
8713         (Arm_relobj::merge_flags_and_attributes_): New data member.
8714         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
8715         (Arm_relobj::scan_sections_for_stubs): Ditto.
8716         (Arm_relobj::do_read_symbols): Check to see if we really want to
8717         merge processor-specific flags and attributes.  Exit early if
8718         an object is empty except for section names and the undefined symbol.
8719         (Target_arm::do_finalize_sections): Move check for ELF format to
8720         Arm_relobj::do_read_symbols.  Merge processor specific flags and
8721         attributes from a regular object only when we have determined that
8722         it is aapropriate.  Do not create an .ARM.attributes section in
8723         output if there is no regular input object.
8724         (Target_arm::merge_processor_specific_flags): Check
8725         --warn-mismatch before printing any error.
8726         (Target_arm::merge_object_attributes): Ditto.
8727         * gold.cc (queue_middle_tasks): Handle the case in which there is
8728         no regular object in input.
8729         * options.cc (General_options::parse_EB): New method.
8730         (General_options::parse_EL): Same.
8731         (General_options::General_options): Initialize endianness_.
8732         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
8733         New options.
8734         (General_options::Endianness): New enum.
8735         (General_options::endianness): New method.
8736         (General_options::endianness_): New data member.
8737         * parameters.cc (Parameters::set_options): Check target endianness.
8738         (Parameters::set_target_once): Ditto.
8739         (Parameters::check_target_endianness): New method.
8740         (parameters_force_valid_target): If either -EL or -EB is specified,
8741         use it to define endianness of default target.
8742         * parameters.h (Parameters::check_target_endianness): New method
8743         declaration.
8744         * target.h (class Target): Change "endianity" to "endianness"
8745         in comments.
8746
8747 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8748
8749         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
8750         * configure: Regenerate.
8751         * Makefile.in: Regenerate.
8752         * testsuite/Makefile.in: Regenerate.
8753
8754 2010-04-06  Cary Coutant  <ccoutant@google.com>
8755
8756         gcc PR lto/42757
8757         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
8758         prevailing definitions of common symbols.
8759         * testsuite/plugin_test_6.sh: New test case.
8760         * testsuite/plugin_common_test_1.c: New test case.
8761         * testsuite/plugin_common_test_2.c: New test case.
8762         * testsuite/Makefile.am (plugin_test_6): New test case.
8763         * testsuite/Makefile.in: Regenerate.
8764
8765 2010-04-06  Nick Clifton  <nickc@redhat.com>
8766
8767         * po/vi.po: New Vietnamese translation.
8768
8769 2010-03-30  Doug Kwan  <dougkwan@google.com>
8770
8771         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
8772
8773 2010-03-25  Doug Kwan  <dougkwan@google.com>
8774
8775         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
8776         to avoid a conversion warning on a 32-bit host.
8777
8778 2010-03-24  Ian Lance Taylor  <iant@google.com>
8779
8780         * testsuite/script_test_3.t: Add a TLS segment.
8781         * testsuite/Makefile.am (check_PROGRAMS): Add
8782         tls_phdrs_script_test.
8783         (tls_phdrs_script_test_SOURCES): Define.
8784         (tls_phdrs_script_test_DEPENDENCIES): Define.
8785         (tls_phdrs_script_test_LDFLAGS): Define.
8786         (tls_phdrs_script_test_LDADD): Define.
8787         * testsuite/Makefile.in: Rebuild.
8788
8789 2010-03-23  Cary Coutant  <ccoutant@google.com>
8790
8791         * fileread.cc (find_or_make_view): Fix comment.
8792
8793 2010-03-23  Ian Lance Taylor  <iant@google.com>
8794
8795         * script-sections.cc (class Orphan_section_placement): Define
8796         PLACE_TLS and PLACE_TLS_BSS.
8797         (Orphan_section_placement::Orphan_section_placement): Initialize
8798         new places.
8799         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
8800         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
8801         (tls_script_test_SOURCES): Define.
8802         (tls_script_test_DEPENDENCIES): Define.
8803         (tls_script_test_LDFLAGS): Define.
8804         (tls_script_test_LDADD): Define.
8805         * testsuite/Makefile.in: Rebuild.
8806
8807 2010-03-22  Doug Kwan  <dougkwan@google.com>
8808
8809         * arm.cc (Arm_relocate_functions::abs8,
8810         Arm_relocate_functions::abs16): Use correct check for overflow
8811         specified in the ARM ELF specs.
8812         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
8813         target of a BLX instruction specially.
8814         (Reloc_stub::stub_type_for_reloc): Ditto.
8815         (Relocate::relocate): Use symbolic names instead of numeric relocation
8816         codes to report error.
8817         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
8818         workaround.
8819         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
8820         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
8821         thumb2_blx_out_of_range.stdout
8822         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
8823         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
8824         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
8825         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
8826         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
8827         thumb2_blx_in_range, thumb2_blx_in_range.o,
8828         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
8829         thumb2_blx_out_of_range.o): New rules.
8830         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
8831         thumb2_blx_in_range and thumb2_blx_out_of_range.
8832         * testsuite/Makefile.in: Regenerate.
8833         * arm_branch_in_range.sh: Add tests for THUMB BLX.
8834         * testsuite/thumb_blx_in_range.s: New file.
8835         * testsuite/thumb_blx_out_of_range.s: New file.
8836
8837 2010-03-22  Rafael Espindola  <espindola@google.com>
8838
8839         * archive.cc (Should_include): Move to archive.h.
8840         (should_include_member): Make it a member of Archive.
8841         (Lib_group): New.
8842         (Add_lib_group_symbols): New.
8843         * archive.h: Include options.h.
8844         (Archive_member): Moved from Archive.
8845         (Should_include): Moved from archive.cc.
8846         (Lib_group): New.
8847         (Add_lib_group_symbols): New.
8848         * dynobj.cc (do_should_include_member): New.
8849         * dynobj.h (do_should_include_member): New.
8850         * gold.cc (queue_initial_tasks): Update call to queue.
8851         * main.cc (main): Print lib group stats.
8852         * object.cc (do_should_include_member): New.
8853         * object.h: Include archive.h.
8854         (Object::should_include_member): New.
8855         (Object::do_should_include_member): New.
8856         (Sized_relobj::do_should_include_member): New.
8857         * options.cc (General_options::parse_start_lib): New.
8858         (General_options::parse_end_lib): New.
8859         (Input_arguments::add_file): Handle lib groups.
8860         (Input_arguments::start_group): Check we are not in a lib.
8861         (Input_arguments::start_lib): New.
8862         (Input_arguments::end_lib): New.
8863         * options.h (General_options): Add start_lib and end_lib.
8864         (Input_argument::lib_): New.
8865         (Input_argument::lib): New.
8866         (Input_argument::is_lib): New.
8867         (Input_file_lib): New.
8868         (Input_arguments::in_lib_): New.
8869         (Input_arguments::in_lib): New.
8870         (Input_arguments::start_lib): New.
8871         (Input_arguments::end_lib_): New.
8872         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
8873         in unused members as preempted.
8874         (Sized_pluginobj::do_should_include_member): New.
8875         * plugin.h (Sized_pluginobj::do_should_include_member): New.
8876         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
8877         return the blocker.
8878         (Read_symbols::do_whole_lib_group): New.
8879         (Read_symbols::do_lib_group): New.
8880         (Read_symbols::do_read_symbols): Handle lib groups.
8881         (Read_symbols::get_name): Handle lib groups.
8882         * readsyms.h (Read_symbols): Add an archive member pointer.
8883         (Read_symbols::do_whole_lib_group): New.
8884         (Read_symbols::do_lib_group): New.
8885         (Read_symbols::member_): New.
8886         * script.cc (read_input_script): Update call to queue_soon.
8887
8888 2010-03-19  Doug Kwan  <dougkwan@google.com>
8889
8890         * arm.cc (Stub_table::Stub_table): Initialize new data members
8891         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
8892         (Stub_table::add_reloc_stub): Assign stub offset and update
8893         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
8894         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
8895         New data members.
8896         (Stub_table::update_data_size_and_addralign): Use
8897         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
8898         instead of going over all reloc stubs.
8899         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
8900         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
8901         Stringpool_template::offset_ to size of Stringpool_char.
8902         (Stringpool_template::new_key_offset): Remove code to initialize
8903         Stringpool_template::offset_.
8904         * stringpool.h (Stringpool_template::set_no_zero_null): Set
8905         Stringpool_template::offset_ to zero.
8906
8907 2010-03-15  Doug Kwan  <dougkwan@google.com>
8908
8909         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
8910         offset_.
8911         (Stringpool_template::new_key_offset): New method.
8912         (Stringpool_template::add_string): Assign offsets when adding new
8913         strings.
8914         (Stringpool_template::set_string_offsets): Do not set string offsets
8915         when not optimizing.
8916         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
8917         member size_.
8918         (Chunked_vector::clear): Clear size_.
8919         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
8920         (Chunked_vector::size): Return size_.
8921         (Chunked_vector::push_back): Use size_ to find insert position.
8922         (Chunked_vector::size_): New data member.
8923         (Stringpool_template::set_no_zero_null): Assert string set is empty.
8924         (Stringpool_template::new_key_offset): New method declaration.
8925         (Stringpool_template::offset_): New data member.
8926
8927 2010-03-15   Rafael Espindola  <espindola@google.com>
8928
8929         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
8930         Add_symbols' constructor.
8931         * readsyms.h (Add_symbols): Remove the input_group member.
8932
8933 2010-03-10  Ian Lance Taylor  <iant@google.com>
8934
8935         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
8936         target to ask whether a reference to a symbol requires a stack
8937         split.
8938         * target.h (Target::is_call_to_non_split): New function.
8939         (Target::do_is_call_to_non_split): Declare virtual function.
8940         * target.cc: Include "symtab.h".
8941         (Target::do_is_call_to_non_split): New function.
8942         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
8943
8944 2010-03-10  Cary Coutant  <ccoutant@google.com>
8945
8946         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
8947         (File_read::open[1]): Remove initial mapping of whole_file_view_.
8948         (File_read::open[2]): Add whole_file_view_ to list of views.
8949         (File_read::make_view): Remove test of whole_file_view_.
8950         (File_read::find_or_make_view): Create whole_file_view_ if
8951         necessary.
8952         (File_read::clear_views): Replace bool parameter with enum;
8953         adjust all callers.  Don't delete views with permanent data;
8954         do delete cached views and views from archives if
8955         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
8956         if clearing the corresponding view.
8957         * fileread.h (File_read::Clear_views_mode): New enum.
8958         (File_read::View::is_permanent_view): New method.
8959         (File_read::clear_views): Replace bool parameter
8960         with enum; adjust all callers.
8961         * options.h (General_options): Change keep_files_mapped option;
8962         add map_whole_files.
8963         * readsyms.cc (Add_symbols::run): Delete sd_ object before
8964         releasing the file.
8965         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
8966         the file.
8967
8968 2010-03-10  David S. Miller  <davem@davemloft.net>
8969
8970         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
8971
8972 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
8973
8974         * icf.cc (get_section_contents): Add '@' marker after processing the
8975         merge reloc.
8976
8977 2010-03-08  Doug Kwan  <dougkwan@google.com>
8978
8979         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
8980         due to a conversion warning.
8981         (Arm_relobj::update_output_local_symbol_count): Check for local
8982         symbol with unset output index.
8983
8984 2010-03-05  Ian Lance Taylor  <iant@google.com>
8985
8986         * options.h (class General_options): Add --spare-dynamic-tags.
8987         * output.cc (Output_data_dynamic::set_final_data_size): Implement
8988         --spare-dynamic-tags.
8989
8990 2010-03-05  Ian Lance Taylor  <iant@google.com>
8991
8992         * incremental.cc: Include "libiberty.h".
8993
8994 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
8995
8996         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
8997         function, is_info_ member.
8998         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
8999         (Versions::Versions): Update caller.
9000         (Versions::define_base_version): Likewise.
9001         (Versions::add_def): Likewise.
9002
9003 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
9004
9005         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
9006         (Scan::possible_function_pointer_reloc): New function.
9007         (Scan::local_reloc_may_be_function_pointer): Change to call
9008         possible_function_pointer_reloc.
9009         (Scan::global_reloc_may_be_function_pointer): Ditto.
9010         * icf.h (Icf::check_section_for_function_pointers): Change to reject
9011         relocations in ".data.rel.ro._ZTV" section.
9012         * testsuite/icf_safe_so_test.sh: Change to pass i386.
9013         * testsuite/icf_safe_so_test.cc: Ditto.
9014         * testsuite/icf_safe_test.cc: Ditto.
9015         * testsuite/icf_safe_test.sh: Ditto.
9016
9017 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9018             Ian Lance Taylor  <iant@google.com>
9019
9020         * target-reloc.h (relocate_section): Check the symbol table index
9021         for -1U before setting the local symbol index.
9022         (scan_relocatable_relocs): If copying the relocation, record that
9023         the local symbol is required.
9024         * object.h (Symbol_value::is_output_symtab_index_set): New
9025         function.
9026         (Symbol_value::may_be_discarded_from_output_symtab): New
9027         function.
9028         (Symbol_value::has_output_symtab_entry): New function.
9029         (Symbol_value::needs_output_symtab_entry): Remove.
9030         (Symbol_value::output_symtab_index): Make sure the symbol index is
9031         set.
9032         (Symbol_value::set_output_symtab_index): Make sure the symbol
9033         index is not set.  Make sure the new index is valid.
9034         (Symbol_value::set_must_have_output_symtab_entry): New function.
9035         (Symbol_value::has_output_dynsym_entry): New function.
9036         (Symbol_value::set_output_dynsym_index): Make sure the new index
9037         is valid.
9038         (Sized_relobj::set_must_have_output_symtab_entry): New function.
9039         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
9040         local symbol if permitted.
9041         (Sized_relobj::do_finalize_local_symbols): Call
9042         is_output_symtab_index_set rather than needs_output_symtab_entry.
9043         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
9044         rather than needs_output_symtab_entry.  Call
9045         has_output_dynsym_entry rather than needs_output_dynsym_entry.
9046         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
9047         is_output_symtab_index_set rather than needs_output_symtab_entry.
9048         * testsuite/discard_locals_relocatable_test.c: New file.
9049         * testsuite/discard_locals_test.sh: Test -r.
9050         * testsuite/Makefile.am (check_DATA): Add
9051         discard_locals_relocatable_test1.syms,
9052         discard_local_relocatable_test2.syms.
9053         (MOSTLYCLEANFILES): Likewise.  Also add
9054         discard_locals_relocatable_test1.lout and
9055         discard_locals_relocatable_test2.out.
9056         (discard_locals_relocatable_test1.syms): New target.
9057         (discard_locals_relocatable_test.o): New target.
9058         (discard_locals_relocatable_test1.out): New target.
9059         (discard_locals_relocatable_test2.syms): New target.
9060         (discard_locals_relocatable_test2.out): New target.
9061         (various): Add missing ../ld-new dependencies.
9062         * testsuite/Makefile.in: Rebuild.
9063
9064 2010-03-03  Nick Clifton  <nickc@redhat.com>
9065
9066         * po/fi.po: New Finnish translation.
9067
9068 2010-03-01  Doug Kwan  <dougkwan@google.com>
9069
9070         * layout.cc (Layout::Layout): Force section types of .init_array*,
9071         .preinit_array* and .fini_array* sections.
9072         * output.cc (Output_section::Input_section_sort_entry::has_priority):
9073         Fix check of return value of std::string::find.().
9074         (Output_section::Input_section_sort_compare::operator()): Remove
9075         comment about .init_array.
9076         (Output_section::Input_section_sort_init_fini_compare::operator()):
9077         New method.
9078         (Output_section::sort_attached_input_sections): Handle .init_array
9079         and .fini_array specially.
9080         * output.h (Output_section::Inut_section_sort_compare): Update
9081         comment.
9082         (Output_section::Input_section_sort_init_fini_compare): New struct.
9083
9084 2010-02-26  Doug Kwan  <dougkwan@google.com>
9085
9086         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
9087         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
9088         * testsuite/debug_msg.sh: Avoid matching source line number for
9089         use of global variable undef_int.
9090
9091 2010-02-26  Doug Kwan  <dougkwan@google.com>
9092
9093         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
9094         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
9095         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
9096         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
9097         * options.cc (General_options::General_options): Initialize member
9098         fix_v4bx_.
9099         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
9100         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
9101         and rm_no_fix_v4bx.stdout
9102         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
9103         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
9104         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
9105         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
9106         and arm_no_fix_v4bx.
9107         * Makefile.in: Regenerate.
9108         * testsuite/arm_fix_v4bx.s: New file.
9109         * testsuite/arm_fix_v4bx.sh: Ditto.
9110
9111 2010-02-24  Doug Kwan  <dougkwan@google.com>
9112
9113         * arm.cc (Target_arm::got_section): Make the .got section the first
9114         non RELRO section in the data segment.
9115         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
9116         suffixes of section names.
9117
9118 2010-02-24  Doug Kwan  <dougkwan@google.com>
9119
9120         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
9121         flags and attributes merging if an input file is a binary file.
9122         * fileread.cc (Input_file::open): Record format of original file.
9123         * fileread.h (Input_file::Format): New enum type.
9124         (Input_file::Input_file): Initialize data member format_.
9125         (Input_file::format): New method definition.
9126         (Input_file::format_):: New data member.
9127
9128 2010-02-24  Doug Kwan  <dougkwan@google.com>
9129
9130         * arm.cc (Arm_output_data_got): New class.
9131         (ARM_TCB_SIZE): New constant
9132         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
9133         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
9134         If user uses a script with a SECTIONS clause, issue only a warning
9135         for a misplaced EXIDX input section.  Otherwise, issue an error.
9136         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
9137         garbage collection.
9138         (Target_arm::got_mode_index_entry): Handle static linking.
9139         (Target_arm::Scan::local): Ditto.
9140         (Target_arm::Scan::global): Ditto.
9141         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
9142         all incorrectly implemented relocations.
9143         (Target_arm::fix_exidx_coverage): Pass layout to
9144         Arm_output_section::fix_exidx_coverage.
9145         * layout.cc (Layout::section_name_mapping): Remove trailing dots
9146         from ".ARM.exidx." and ".ARM.extab.".
9147
9148 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9149
9150         * arm.cc (Target_arm::do_finalize_sections): Create attribute
9151         section if it does not already exist.
9152         * attributes.cc (Attributes_section_data::Attributes_section_data):
9153         Don't crash if size is zero.
9154
9155 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9156             Ian Lance Taylor  <iant@google.com>
9157
9158         * gold.cc (queue_middle_tasks): If no input files were opened,
9159         exit.
9160         * workqueue.h (Task_function::Task_function): Assert that there is
9161         a blocker.
9162
9163 2010-02-22  Doug Kwan  <dougkwan@google.com>
9164
9165         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
9166         * icf.cc (get_section_contents): Cast snprintf arguments to long long
9167         types to avoid warnings due to different uint64_t implementations
9168         on different hosts.
9169
9170 2010-02-21  Doug Kwan  <dougkwan@google.com>
9171
9172         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
9173         handling of the maximum backward branch offset.
9174         (Arm_relocate_functions::thumb_branch_common): Ditto.
9175         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
9176         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
9177         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
9178         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
9179         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
9180         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
9181         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
9182         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
9183         thumb_bl_out_of_range thumb_bl_out_of_range.o,
9184         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
9185         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
9186         thumb2_bl_out_of_range.o): New rules.
9187         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
9188         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
9189         thumb2_bl_out_of_range
9190         * testsuite/Makefile.in: Regenerate.
9191         * testsuite/arm_bl_in_range.s: New file.
9192         * testsuite/arm_bl_out_of_range.s: Ditto.
9193         * testsuite/arm_branch_in_range.sh: Ditto.
9194         * testsuite/arm_branch_range.t: Ditto.
9195         * testsuite/thumb2_branch_range.t: Ditto.
9196         * testsuite/thumb_bl_in_range.s: Ditto.
9197         * testsuite/thumb_bl_out_of_range.s: Ditto.
9198         * testsuite/thumb_branch_range.t: Ditto.
9199
9200 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
9201
9202         * gc.h (gc_process_relocs): Change vectors to point to the new list.
9203         Add reloc offset information.
9204         * icf.cc (get_section_contents): Change iterators to point to the new
9205         vectors. Add reloc offset information to the contents.
9206         * icf.h (Icf::Sections_reachable_info): New typedef.
9207         (Icf::Sections_reachable_list): New typedef.
9208         (Icf::Offset_info): New typedef.
9209         (Icf::Reloc_info): New struct typedef.
9210         (Icf::Reloc_info_list): New typedef.
9211         (Icf::symbol_reloc_list): Delete method.
9212         (Icf::addend_reloc_list): Delete method.
9213         (Icf::section_reloc_list): Delete method.
9214         (Icf::reloc_info_list): New method.
9215         (Icf::reloc_info_list_): New member.
9216
9217 2010-02-19  Doug Kwan  <dougkwan@google.com>
9218
9219         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
9220         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
9221         * arm.cc (Arm_relocation_functions): New forward declaration.
9222         (Target_arm::Target_arm): Initialize new data members
9223         got_mod_index_offset_ and tls_base_symbol_defined_.
9224         (Target_arm::Relocate::relocate_tls): New method.
9225         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
9226          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
9227         New methods.
9228         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
9229         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
9230         (Target_arm::got_mod_index_offset_,
9231         Target_arm::tls_base_symbol_defined_): New data members.
9232         (Target_arm::Scan::local, Target::Scan::global,
9233         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
9234         relocations.
9235
9236 2010-02-18  Doug Kwan  <dougkwan@google.com>
9237
9238         * arm.cc (Arm_relobj::find_linked_text_section): New method.
9239         (Arm_relobj::make_exidx_input_section): Pass section index of linked
9240         text section as a parameter becuase some broken tools may not set
9241         the link in section header.
9242         (Target_arm::has_got_section): New method.
9243         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
9244         without any mapping symbol as data only.  Remove warning.
9245         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
9246         link in its section header, try to discover the link by inspecting the
9247         REL31 relocation at the beginning of the section.
9248         (Target_arm::Scan::check_non_pic): Report name of offending relocation
9249         in error message.
9250         (Target_arm::Scan::global): Treat any reference to the symbol
9251         _GLOBAL_OFFSET_TABLE_ as a GOT access.
9252
9253 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
9254
9255         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
9256         (Scan::global_reloc_may_be_function_pointer): New function.
9257         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
9258         (Scan::global_reloc_may_be_function_pointer): New function.
9259         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
9260         (Scan::global_reloc_may_be_function_pointer): New function.
9261         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
9262         (Scan::global_reloc_may_be_function_pointer): New function.
9263         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
9264         (Scan::global_reloc_may_be_function_pointer): New function.
9265         (Scan::possible_function_pointer_reloc): New function.
9266         (Target_x86_64::can_check_for_function_pointers): New function.
9267         * gc.h (gc_process_relocs): Scan relocation types to determine if
9268         function pointers were taken for targets that support it.
9269         * icf.cc (Icf::find_identical_sections): Include functions for
9270         folding in safe ICF whose pointer is not taken.
9271         * icf.h (Secn_fptr_taken_set): New typedef.
9272         (fptr_section_id_): New member.
9273         (section_has_function_pointers): New function.
9274         (set_section_has_function_pointers): New function.
9275         (check_section_for_function_pointers): New function.
9276         * options.h: Fix comment for safe ICF option.
9277         * target.h (can_check_for_function_pointers): New function.
9278         * testsuite/Makefile.am: Add icf_safe_so_test test case.
9279         Modify icf_safe_test for X86-64.
9280         * testsuite/Makefile.in: Regenerate.
9281         * testsuite/icf_safe_so_test.cc: New file.
9282         * testsuite/icf_safe_so_test.sh: New file.
9283         * testsuite/icf_safe_test.cc (kept_func_3): New function.
9284         (main): Change to take pointer to function kept_func_3.
9285         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
9286         folding is done correctly for X86-64.
9287
9288 2010-02-12  David S. Miller  <davem@davemloft.net>
9289
9290         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
9291         is_symbolless parameter.
9292         (Output_reloc<SHT_REL>::is_symbolless): New.
9293         (Output_reloc<SHT_REL>::is_symbolless_): New.
9294         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
9295         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
9296         (Output_reloc<SHT_RELA>::is_symbolless): New.
9297         (Output_data_reloc::add_global): Handle is_symbolless.
9298         (Output_data_reloc::add_global_relative): Likewise.
9299         (Output_data_reloc::add_local): Likewise.
9300         (Output_data_reloc::add_local_relative): Likewise.
9301         (Output_data_reloc::add_symbolless_global_addend): New.
9302         (Output_data_reloc::add_symbolless_local_addend): New.
9303         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
9304         is_symbolless.
9305         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
9306         instead of ->is_relative_
9307         (Output_reloc::write): Likewise.
9308         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
9309         (Output_reloc::write_rel): Simplify.
9310
9311         * sparc.cc (Target_sparc::Scan::local): Use
9312         ->add_symbolless_local_addend as needed.
9313         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
9314         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
9315         based upon relocation offset.
9316
9317 2010-02-11  Doug Kwan  <dougkwan@google.com>
9318
9319         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
9320         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
9321         beginning of function.
9322         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
9323         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
9324         parameter is_32bit in calls to should_apply_static_reloc.
9325         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
9326         (check_DATA): Add arm_abs_global.stdout.
9327         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
9328         arm_abs_global.stdout): New rules.
9329         (MOSTLLYCLEANFILES): Add arm_abs_global
9330         * Makefile.in: Regenerate.
9331         * testsuite/arm_abs_global.s: New file.
9332         * testsuite/arm_abs_global.sh: Ditto.
9333         * testsuite/arm_abs_lib.s: Ditto.
9334
9335 2010-02-11  Ian Lance Taylor  <iant@google.com>
9336
9337         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
9338         Read_relocs task.
9339         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
9340         Allocate_commons_task first.
9341         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
9342         task, rather than symtab_lock_.
9343         (Gc_process_relocs::~Gc_process_relocs): New function.
9344         (Gc_process_relocs::is_runnable): Check this_blocker_.
9345         (Gc_process_relocs::locks): Use next_blocker_ rather than
9346         blocker_.
9347         (Scan_relocs::~Scan_relocs): New function.
9348         (Scan_relocs::is_runnable): Check this_blocker_ rather than
9349         symtab_lock_.
9350         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
9351         next_blocker_.
9352         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
9353         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
9354         constructor accordingly.
9355         (class Gc_process_relocs): Likewise.
9356         (class Scan_relocs): Likewise.
9357         * common.h (class Allocate_commons_task): Remove symtab_lock_
9358         field, and corresponding constructor parameter.
9359         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
9360         symtab_lock_.
9361         (Allocate_commons_task::locks): Likewise.
9362
9363 2010-02-11  Ian Lance Taylor  <iant@google.com>
9364
9365         * gold-threads.h (class Once): Define.
9366         (class Initialize_lock): Rewrite as child of Once.
9367         * gold-threads.cc (class Once_initialize): Define.
9368         (once_pointer_control): New static variable.
9369         (once_pointer, once_arg): New static variables.
9370         (c_run_once): New static function.
9371         (Once::Once, Once::run_once, Once::internal_run): New functions.
9372         (class Initialize_lock_once): Remove.
9373         (initialize_lock_control): Remove.
9374         (initialize_lock_pointer): Remove.
9375         (initialize_lock_once): Remove.
9376         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
9377         (Initialize_lock::initialize): Rewrite.
9378         (Initialize_lock::do_run_once): New function.
9379         * archive.cc (Archive::interpret_header): Only clear name if it is
9380         not already empty.
9381         * fileread.cc: Include "gold-threads.h"
9382         (file_counts_lock): New static variable.
9383         (file_counts_initialize_lock): Likewise.
9384         (File_read::release): Only increment counts when using --stats.
9385         Use a lock around the increment.
9386         * parameters.cc (class Set_parameters_target_once): Define.
9387         (set_parameters_target_once): New static variable.
9388         (Parameters::Parameters): Move here from parameters.h.
9389         (Parameters::set_target): Rewrite.
9390         (Parameters::set_target_once): New function.
9391         (Parameters::clear_target): Move here and rewrite.
9392         * parameters.h (class Parameters): Update declarations.  Add
9393         set_parameters_target_once_ field.
9394         (Parameters::Parameters): Move to parameters.cc.
9395         (Parameters::clear_target): Likewise.
9396         * readsyms.cc (Read_symbols::do_group): Create a Start_group
9397         task.
9398         (Start_group::~Start_group): New function.
9399         (Start_group::is_runnable): New function.
9400         (Start_group::locks, Start_group::run): New functions.
9401         (Finish_group::run): Change saw_undefined to size_t.
9402         * readsyms.h (class Start_group): Define.
9403         (class Finish_group): Change saw_undefined_ field to size_t.
9404         (Finish_group::Finish_group): Remove saw_undefined and
9405         this_blocker parameters.  Change all callers.
9406         (Finish_group::set_saw_undefined): New function.
9407         (Finish_group::set_blocker): New function.
9408         * symtab.h (class Symbol_table): Change saw_undefined to return
9409         size_t.  Change saw_undefined_ field to size_t.
9410         * target-select.cc (Set_target_once::do_run_once): New function.
9411         (Target_selector::Target_selector): Initialize set_target_once_
9412         field.  Don't initialize lock_ and initialize_lock_ fields.
9413         (Target_selector::instantiate_target): Rewrite.
9414         (Target_selector::set_target): New function.
9415         * target-select.h (class Set_target_once): Define.
9416         (class Target_selector): Update declarations.  Make
9417         Set_target_once a friend.  Remove lock_ and initialize_lock_
9418         fields.  Add set_target_once_ field.
9419
9420 2010-02-10  Ian Lance Taylor  <iant@google.com>
9421
9422         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
9423         queueing any tasks.
9424         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
9425         (queue_middle_tasks): Add all blockers before queueing any tasks.
9426         (queue_final_tasks): Likewise.
9427         * token.h (Task_token::add_blockers): New function.
9428         * object.h (Input_objects::number_of_relobjs): New function.
9429
9430 2010-02-10  Ian Lance Taylor  <iant@google.com>
9431
9432         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
9433         shared, not if not position independent.
9434         * x86_64.cc (Relocate::relocate_tls): Likewise.
9435         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
9436         (tls_pie_pic_test): New target.
9437         * testsuite/Makefile.in: Rebuild.
9438
9439         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
9440         (tls_test_main_pie.o, tls_test_pie.o): New targets.
9441         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
9442         * testsuite/Makefile.in: Rebuild.
9443
9444 2010-02-09  David S. Miller  <davem@davemloft.net>
9445
9446         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
9447         R_SPARC_RELATIVE using ->add_local_relative().
9448         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
9449
9450         * output.h (Output_data_dynamic::add_section_size): New method
9451         that takes two Output_data objects.
9452         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
9453         entry param.  Handle it in initializers.
9454         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
9455         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
9456         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
9457         arg.
9458         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
9459         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
9460         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
9461         for dynrel_includes_plt.
9462         * i386.cc (Target_i386::do_finalize_sections): Likewise.
9463         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
9464         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
9465         before .rela.plt
9466         (Target_sparc::do_finalize_sections): Update to pass true for
9467         dynrel_includes_plt.
9468         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
9469         output before .rela.plt
9470         (Target_powerpc::do_finalize_sections): Update to pass true for
9471         dynrel_includes_plt when 32-bit.
9472
9473 2010-02-08  Doug Kwan  <dougkwan@google.com>
9474
9475         * arm.cc (Arm_relobj::simple_input_section_output_address): New
9476         method.
9477         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
9478         Arm_relobj::scan_section_for_cortex_a8_stubs,
9479         Arm_relobj::do_relocation_section): Instead of calling
9480         Output_section::output_address, use faster
9481         Arm_relobj::simple_input_section_output_address.
9482
9483 2010-02-08  David S. Miller  <davem@davemloft.net>
9484
9485         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
9486         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
9487         relocation helper function.
9488
9489         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
9490         just like R_SPARC_GOT{10,13,22}.
9491         (Target_sparc::Scan::local): Likewise.
9492         (Target_sparc::Relocate:relocate): Likewise.
9493
9494 2010-02-06  Ian Lance Taylor  <iant@google.com>
9495
9496         * configure.ac: Rewrite targetobjs duplicate removal code to use
9497         only shell constructs.
9498         * configure: Rebuild.
9499
9500 2010-02-05  Doug Kwan  <dougkwan@google.com>
9501
9502         PR 11247
9503         * arm.cc (Arm_relobj::section_is_scannable): New method.
9504         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
9505         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
9506
9507 2010-02-04  Doug Kwan  <dougkwan@google.com>
9508
9509         PR 11247
9510         * arm-reloc-property.cc (cstdio): Include.
9511         * configure.ac (targetobjs): Remove duplicates.
9512         * configure: Regenerate.
9513         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
9514         big and little endian version for a given address size.
9515
9516 2010-02-03  Doug Kwan  <dougkwan@google.com>
9517
9518         * arm-reloc-property.cc
9519         (Arm_reloc_property_table::reloc_name_in_error_message): New method
9520         definition.
9521         * arm-reloc-property.h
9522         (Arm_reloc_property_table::get_implemented_static_reloc_property):
9523         New method definition.
9524         (Arm_reloc_property_table::reloc_name_in_error_message): New method
9525         declaration.
9526         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
9527         overflow to N.
9528         (GOT_PREL): Change implemented to Y.
9529         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
9530         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
9531         (Arm_relocate_functions::movw_abs_nc): Remove method.
9532         (Arm_relocate_functions::movt_abs): Ditto.
9533         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
9534         (Arm_relocate_functions::thm_movt_abs): Ditto.
9535         (Arm_relocate_functions::movw_rel_nc): Ditto.
9536         (Arm_relocate_functions::movw_rel): Ditto.
9537         (Arm_relocate_functions::movt_rel): Ditto.
9538         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
9539         (Arm_relocate_functions:thm_movw_rel): Ditto.
9540         (Arm_relocate_functions:thm_movt_rel): Ditto.
9541         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
9542         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
9543         New method definitions.
9544         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
9545         (Arm_relocation_functions::arm_grp_ldr): Ditto.
9546         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
9547         (Arm_relocation_functions::arm_grp_ldc): Ditto.
9548         (Target_arm::Relocate::relocate): Check for non-static or
9549         unimplemented relocation code and exit early.  Change calls to
9550         Target_arm::reloc_uses_thumb_bit and
9551         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
9552         instead.  Refactor code to handle similar relocations to increase
9553         code sharing.  Remove check for unsupported relocation code in switch
9554         statement.
9555         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
9556         relocation property table to find out size.  Change error message to
9557         print out the name of a relocation code instead of the numeric value.
9558         (Target_arm::scan_reloc_for_stub): Use relocation property table
9559         instead of calling Target_arm::reloc_uses_thumb_bit().
9560
9561 2010-02-02  Doug Kwan  <dougkwan@google.com>
9562
9563         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
9564         types of relaxed input section.
9565
9566 2010-02-02  Doug Kwan  <dougkwan@google.com>
9567
9568         * Makefile.am (HFILES): Add arm-reloc-property.h.
9569         (DEFFILES): New.
9570         (TARGETSOURCES): Add arm-reloc-property.cc
9571         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
9572         (libgold_a_SOURCES): $(DEFFILES)
9573         * Makefile.in: Regenerate.
9574         * arm-reloc-property.cc: New file.
9575         * arm-reloc-property.h: New file.
9576         * arm-reloc.def: New file.
9577         * arm.cc: Update comments.
9578         (arm-reloc-property.h): New included header.
9579         (arm_reloc_property_table): New global variable.
9580         (Target_arm::do_select_as_default_target): New method definition.
9581         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
9582         arm-reloc-property to targ_extra_obj.
9583         * parameters.cc (set_parameters_target): Call
9584         Target::select_as_default_target().
9585         * target.h (Target::select_as_default_target): New method definition.
9586         (Target::do_select_as_default_target): Same.
9587
9588 2010-02-01  Doug Kwan  <dougkwan@google.com>
9589
9590         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
9591         first_output_text_section_.
9592         (Arm_exidx_fixup::first_output_text_section): New method definition.
9593         (Arm_exidx_fixup::first_output_text_section_): New data member.
9594         (Arm_exidx_fixup::process_exidx_section): Record the first text
9595         output section seen.
9596         (Arm_output_section::fix_exidx_coverage): Set correct linked section
9597         and entsize in output section header.
9598
9599 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9600
9601         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
9602         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
9603         (Arm_relocate_functions::thm_alu11): New Method.
9604         (Arm_relocate_functions::thm_pc8): New Method.
9605         (Arm_relocate_functions::thm_pc12): New Method.
9606         (Target_arm::Scan::local): Handle the relocations.
9607         (Target_arm::Scan::global): Likewise.
9608         (Target_arm::Relocate::relocate): Likewise.
9609         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9610
9611 2010-01-29  Doug Kwan  <dougkwan@google.com>
9612
9613         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
9614         of relocation types as ld.
9615
9616 2010-01-29  Doug Kwan  <dougkwan@google.com>
9617
9618         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
9619         to public.
9620         (Arm_relocate_functions::thumb_branch_common): Ditto.
9621         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
9622         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
9623         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
9624         Arm_relocate_functions::jump24): Remove.
9625         (Target_arm::Relocate::relocate): Adjust code to call
9626         Arm_relocation_functions::arm_branch_common and
9627         Arm_relocation_functions::thumb_branch_common instead of their removed
9628         wrappers.  Merge switch-cases together to reduce source code size.
9629
9630 2010-01-29  Doug Kwan  <dougkwan@google.com>
9631
9632         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
9633         output_local_symbol_count_needs_update_.
9634         (Arm_relobj::output_local_symbol_count_needs_update,
9635          Arm_relobj::set_output_local_symbol_count_needs_update,
9636          Arm_relobj::update_output_local_symbol_count): New methods.
9637         (Arm_relobj::output_local_symbol_count_needs_update_): New data
9638         member.
9639         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
9640         of pointed function as in a R_ARM_PREL31 relocation.
9641         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
9642         for output local symbol count updating.
9643         (Target_arm::do_relax): Update output local symbol counts in objects
9644         if necessary.
9645         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
9646
9647 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9648
9649         * arm.cc: Added support for the ARM relocations:
9650         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
9651         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
9652         (Arm_relocate_functions::movw_rel_nc): Renamed (was
9653         movw_prel_nc).
9654         (Arm_relocate_functions::movw_rel): New method.
9655         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
9656         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
9657         thm_movw_prel_nc).
9658         (Arm_relocate_functions::thm_movw_rel): New method.
9659         (Arm_relocate_functions::thm_movt_rel): Renamed (was
9660         thm_movt_prel).
9661         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
9662         relocations.
9663         (Target_arm::Scan::global): Likewise.
9664         (Target_arm::Relocate::relocate): Likewise.
9665         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9666         Likewise.
9667
9668 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9669
9670         * arm.cc: Added support for ARM group relocations.
9671         (Target_arm::reloc_needs_sym_origin): New method.
9672         (Arm_relocate_functions::calc_grp_kn): New method.
9673         (Arm_relocate_functions::calc_grp_residual): New method.
9674         (Arm_relocate_functions::calc_grp_gn): New method.
9675         (Arm_relocate_functions::arm_grp_alu): New Method.
9676         (Arm_relocate_functions::arm_grp_ldr): New Method.
9677         (Arm_relocate_functions::arm_grp_ldrs): New Method.
9678         (Arm_relocate_functions::arm_grp_ldc): New Method.
9679         (Target_arm::Scan::local): Handle the ARM group relocations.
9680         (Target_arm::Scan::global): Likewise.
9681         (Target_arm::Relocate::relocate): Likewise.
9682         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9683         Likewise.
9684
9685 2010-01-26  Doug Kwan  <dougkwan@google.com>
9686
9687         * arm.cc (set): Include.
9688         (class Arm_exidx_fixup): Change type of last_input_section_ to const
9689         pointer type.
9690         (Arm_output_section::Text_section_list): New type.
9691         (Arm_output_section::append_text_sections_to_list): New method.
9692         (Arm_output_section::fix_exidx_coverage): Ditto.
9693         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
9694         (Arm_relobj::convert_input_section_to_relaxed_section): Use
9695         Relobj::set_section_offset() instead of
9696         Sized_relobj::invalidate_section_offset().
9697         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
9698         parameter for section headers. Ignore relocation sections for
9699         unallocated sections and EXIDX sections.
9700         (Target_arm::fix_exidx_coverage): New method.
9701         (Target_arm::output_section_address_less_than): New type.
9702         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
9703         linked text section instead of the EXIDX section.
9704         (Arm_output_section::create_stub_group): Add an assertion to check
9705         that this is not an EXIDX output section.
9706         (Arm_output_section::append_text_sections_to_list): New method.
9707         (Arm_output_section::fix_exidx_coverage): Ditto.
9708         (Arm_relobj::scan_sections_for_stubs): Adjust call to
9709         Arm_relobj::section_needs_reloc_stub_scanning.
9710         (Target_arm::do_relax): Fix EXIDX output section coverage in the
9711         first pass.
9712         (Target_arm::fix_exidx_coverage): New method.
9713         * object.h (Relobj::set_output_section): New method.
9714         (Sized_relobj::invalidate_section_offset): Remove method.
9715         (Sized_relobj::do_invalidate_section_offset): Remove method.
9716         (Sized_relobj::do_set_section_offset): Handle offset value -1.
9717
9718 2010-01-25  Doug Kwan  <dougkwan@google.com>
9719
9720         * arm.cc (Arm_exidx_merged_section::do_output_offset):
9721         Fix warning due to signed and unsigned comparison on a 32-bit host.
9722
9723 2010-01-22  Doug Kwan  <dougkwan@google.com>
9724
9725         * arm.cc (Target_arm::do_relax): Record an output section for section
9726         offset adjustment it contains any stub table that has changed.
9727         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
9728         offsets in an output section if necessary.
9729         * output.cc (Output_section::Output_section): Initialize
9730         section_offsets_need_adjustments_.
9731         (Output_section::add_input_section_for_script): Renamed to
9732         Output_section::add_simple_input_section.
9733         (Output_section::save_states): Add a comment.
9734         (Output_section::discard_states): New method defintion.
9735         (Output_section::adjust_section_offsets): Same.
9736         * output.h (Output_section::add_input_section_for_script): Renamed to
9737         Output_section::add_simple_input_section.
9738         (Output_section::discard_states): New method declaration.
9739         (Output_section::adjust_section_offsets): Same.
9740         (Output_section::section_offsets_need_adjustment,
9741         Output_section::set_section_offsets_need_adjustment): New method
9742         definitions.
9743         (Output_section::section_offsets_need_adjustment_): New data member.
9744         * script-sections.cc
9745         (Output_section_element_input::set_section_address): Adjust code for
9746         renaming of Output_section::add_input_section_for_script.
9747         (Orphan_output_section::set_section_address): Same.
9748
9749 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9750
9751         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
9752         Fix_v4bx enum values .
9753         * gold/options.h (General_options): New option definitions.
9754         (General_options::fix_v4bx): New method.
9755         (General_options::Fix_v4bx): New enum.
9756         * gold/options.cc (General_options::parse_fix_v4bx): New method.
9757         (General_options::parse_fix_v4bx_interworking): New method.
9758
9759 2010-01-22  Doug Kwan  <dougkwan@google.com>
9760
9761         * arm.cc (Arm_exidx_fixup): New class.
9762
9763 2010-01-21  Doug Kwan  <dougkwan@google.com>
9764
9765         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
9766         classes.
9767         (Arm_exidx_section_offset_map): New type.
9768
9769 2010-01-21  Doug Kwan  <dougkwan@google.com>
9770
9771         * arm.cc (Arm_exidx_input_section): New class.
9772         (Arm_relobj::exidx_input_section_by_link,
9773         Arm_relobj::exidx_input_section_by_shndx,
9774         Arm_relobj::make_exidx_input_section): New methods.
9775         (read_arm_attributes_section): Remove.
9776         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
9777         information about them.
9778         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
9779         to here.
9780
9781 2010-01-20  Doug Kwan  <dougkwan@google.com>
9782
9783         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
9784         Input_section_specifier to Section_id.
9785         (Target_arm::new_arm_input_section: Adjust code for change of key
9786         type.
9787         (Target_arm::find_arm_input_section): Ditto.
9788         * gc.h (object.h): Include for Section_id nand Section_id_hash.
9789         (Section_id): Remove.
9790         (Garbage_collection::Section_id_hash): Remove.
9791         * icf.h (object.h): Include for Section_id nand Section_id_hash.
9792         (Section_id): Remove.
9793         (Icf::Section_id_hash): Remove.
9794         * object.h (Section_id, Const_section_id, Section_id_hash,
9795         Const_section_id_hash): New type definitions.
9796         * output.cc (Output_section::add_relaxed_input_section): Change to
9797         use Const_section_id instead of Input_section_specifier as key type.
9798         (Output_section::add_merge_input_section): Ditto.
9799         (Output_section::build_relaxation_map): Change to use Section_id
9800         instead of Input_section_specifier as key type.
9801         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
9802         Ditto.
9803         (Output_section::convert_input_sections_to_relaxed_sections): Change
9804         to use Const_section_id instead of Input_section_specifier as key type.
9805         (Output_section::find_merge_section): Ditto.
9806         (Output_section::find_relaxed_input_section): Ditto.
9807         * output.h (Input_section_specifier): Remove class.
9808         (Output_section::Output_section_data_by_input_section_map): Change
9809         key type to Const_section_id.
9810         (Output_section::Output_relaxed_input_section_by_input_section_map):
9811         Ditto.
9812         (Output_section::Relaxation_map): Change key type to Section_id.
9813
9814 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9815
9816         * gold/arm.cc: Added support for R_ARM_V4BX relocation
9817         (class Arm_v4bx_stub): New class.
9818         (DEF_STUBS): Updated definition to support v4_veneer_bx.
9819         (Stub_factory::make_arm_v4bx_stub): New method.
9820         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
9821         (Stub_table::empty): Handle v4bx stubs.
9822         (Stub_table::add_arm_v4bx_stub): New method.
9823         (Stub_table::find_arm_v4bx_stub): New method.
9824         (Arm_relocate_functions::v4bx): New method.
9825         (Target_arm::fix_v4bx): New method.
9826         (Target_arm::Target_arm): Handle R_ARM_V4BX.
9827         (Stub_table::relocate_stubs): Likewise.
9828         (Stub_table::do_write): Likewise.
9829         (Stub_table::update_data_size_and_addralign): Likewise.
9830         (Stub_table::finalize_stubs):  Likewise.
9831         (Target_arm::Scan::local): Likewise.
9832         (Target_arm::Scan::global): Likewise.
9833         (Target_arm::do_finalize_sections): Likewise.
9834         (Target_arm::Relocate::relocate): Likewise.
9835         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9836         Likewise.
9837         (Target_arm::scan_reloc_for_stub): Likewise.
9838         (Target_arm::scan_reloc_section_for_stubs): Likewise.
9839
9840 2010-01-19  Ian Lance Taylor  <iant@google.com>
9841
9842         * output.cc (Output_section_headers::do_sized_write): Write large
9843         segment count to sh_info field.
9844         (Output_file_header::do_sized_write): For large segment count,
9845         write PN_XNUM to e_phnum field.
9846
9847 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9848
9849         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
9850         (Arm_relocate_functions::thm_jump8): New function.
9851         (Arm_relocate_functions::thm_jump11): New function.
9852         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
9853         R_ARM_THM_JUMP11.
9854         (Target_arm::Scan::global): Likewise.
9855         (Target_arm::Relocate::relocate): Likewise.
9856         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9857         Likewise.
9858
9859 2010-01-14  Doug Kwan  <dougkwan@google.com>
9860
9861         * arm.cc (map, utility): Include headers.
9862         (Target_arm::apply_cortex_a8_workaround): New method.
9863         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
9864         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
9865         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
9866         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
9867         the --[no-]fix-cortex-a8 command line options.
9868         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
9869         (Target_arm::relocate_stub): Use addend in instruction template.
9870         * options.h (DEFINE_bool): Set the user-set flag.
9871         (General_options): Add --[no-]-fix-cortex options.
9872         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
9873         : Update fast look-up map after conversion.
9874
9875 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
9876
9877         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
9878         in the first pass of do_layout.
9879
9880 2010-01-13  Doug Kwan  <dougkwan@google.com>
9881
9882         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
9883         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
9884         apparent compiler problem of not folding static constant integral
9885         data members of elfcpp::Elf_sizes<32>.
9886
9887 2010-01-13  Doug Kwan  <dougkwan@google.com>
9888
9889         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
9890         Arm_relobj::section_needs_cortex_a8_stub_scanning,
9891         Arm_relobj::scan_section_for_cortex_a8_erratum,
9892         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
9893         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
9894         sections to scan for relocation stubs into a new method
9895         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
9896         relocation and Cortex-A8 stub scanning.
9897         (Target_arm::do_relax): Force stubs to be after stubbed sections
9898         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
9899         the beginning of a new relaxation pass.  Update a comment.
9900         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
9901
9902 2010-01-12  Ian Lance Taylor  <iant@google.com>
9903
9904         * target-reloc.h (visibility_error): New inline function.
9905         (relocate_section): Call visibility_error.
9906         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
9907         (MOSTLYCLEANFILES): Likewise.
9908         (protected_4_pic.o, protected_3.err): New targets.
9909         * testsuite/protected_4.cc: New file.
9910
9911 2010-01-12  Doug Kwan  <dougkwan@google.com>
9912
9913         * arm.cc (Cortex_a8_reloc): New class.
9914         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
9915         and cortex_a8_relocs_info_.
9916         (Target_arm::fix_cortex_a8): New method definition.
9917         (Target_arm::Cortex_a8_relocs_info): New type.
9918         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
9919         New data member declarations.
9920         (Target_arm::scan_reloc_for_stub): Record information about
9921         relocations for THUMB branches that might be exempted from the
9922         Cortex-A8 workaround.
9923         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
9924         at the beginning of a relaxation pass.
9925
9926 2010-01-12  Doug Kwan  <dougkwan@google.com>
9927
9928         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
9929         (Arm_relobj::Mapping_symbol_position,
9930          Arm_reloj::Mapping_symbol_position_less,
9931          Arm_relobj::Mapping_symbols_info): New types.
9932         (Target_arm::is_mapping_symbol_name): New method definition.
9933         (Arm_relobj::do_count_local_symbols): Save information about mapping
9934         symbols.
9935
9936 2010-01-11  Doug Kwan  <dougkwan@google.com>
9937
9938         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
9939         Arm_relocate_functions::thumb32_branch_upper,
9940         Arm_relocate_functions::thumb32_branch_lower,
9941         Arm_relocate_functions::thumb32_cond_branch_offset,
9942         Arm_relocate_functions::thumb32_cond_branch_upper,
9943         Arm_relocate_functions::thumb32_cond_branch_lower,
9944         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
9945         branch offset encoding.
9946         (Arm_relocate_functions::thumb_branch_common): Use new branch
9947         offset encoding methods to avoid code duplication.
9948         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
9949         (Stub_addend_reader::operator()): Use new branch encoding method
9950         to avoid code duplication.
9951
9952 2010-01-11  Doug Kwan  <dougkwan@google.com>
9953
9954         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
9955         (Target_arm::do_finalize_sections): Define special EXIDX section
9956         symbols only if referenced.
9957         * gc.h (Garbage_collection::add_reference): New method.
9958         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
9959         code duplication.
9960
9961 2010-01-11  Ian Lance Taylor  <iant@google.com>
9962
9963         * script.cc (Version_script_info::build_expression_list_lookup):
9964         Change complaing about duplicate wildcard match from error to
9965         warning.
9966
9967         * script.cc (class Lazy_demangler): Recreate--revert part of patch
9968         of 2009-12-30.
9969         (Version_script_info::Version_script_info): Initialize globs_,
9970         default_version_, default_is_global_, and exact_.  Don't
9971         initialize globals_ or locals_.
9972         (Version_script_info::build_lookup_tables): Build local symbols
9973         first.
9974         (Version_script_info::unquote): New function.
9975         (Version_script_info::add_exact_match): New function.
9976         (Version_script_info::build_expression_list_lookup): Remove lookup
9977         parameter.  Add is_global parameter.  Change all callers.  Handle
9978         wildcard pattern specially.  Unquote pattern.  Call
9979         add_exact_match.
9980         (Version_script_info::get_name_to_match): New function.
9981         (Version_script_info::get_symbol_version): New function.
9982         (Version_script_info::get_symbol_version_helper): Remove.
9983         (Version_script_info::check_unmatched_names): Call unquote.
9984         * script.h (class Version_script_info): Change get_symbol_version
9985         to be non-inline and add is_global parameter; change all callers.
9986         Rewrite symbol_is_local.  Update declarations.  Define struct
9987         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
9988         Remove globals_ and locals_ members.  Add exact_, globs_,
9989         default_version_, is_global_.
9990         (Version_script_info::Glob): Remove pattern, add expression and
9991         is_global.  Update constructor.  Change all callers.
9992         * dynobj.cc (Versions::finalize): Mark the version symbol as the
9993         default version.
9994         (Versions::symbol_section_contents): If a symbol is undefined, or
9995         defined in a dynamic object, set the version index to
9996         VER_NDX_LOCAL.
9997         * symtab.cc (Symbol_table::add_from_relobj): Don't call
9998         symbol_is_local.
9999         (Symbol_table::add_from_pluginobj): Likewise.
10000         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
10001
10002 2010-01-11  Doug Kwan  <dougkwan@google.com>
10003
10004         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
10005         (incremental_dump_LDADD): Add linking option for libintl.
10006         * Makefile.in: Regenerate.
10007
10008 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
10009
10010         PR gold/11144
10011         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
10012         instead of -Ds.
10013         * testsuite/Makefile.in: Regenerated.
10014
10015 2010-01-10  Doug Kwan  <dougkwan@google.com>
10016
10017         * options.h (DEFINE_var): Use parentheses around argument varname__
10018         in macro body to avoid any unintended subsequent substitutions.
10019
10020 2010-01-10  Ian Lance Taylor  <iant@google.com>
10021
10022         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
10023         candidates before doing symbol resolution.
10024
10025         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
10026         ODR candidates if only one is weak.
10027
10028 2010-01-08  Ian Lance Taylor  <iant@google.com>
10029
10030         * script.cc (Version_script_info::build_expression_list_lookup):
10031         Don't warn about ambiguous version, just record the ambiguity.
10032         (Version_script_info::get_symbol_version_helper): Give error if
10033         version is ambiguous.
10034
10035 2010-01-08  Doug Kwan  <dougkwan@google.com>
10036
10037         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
10038         prev_data_size_ and prev_addralign_.  Remove initializer for
10039         deleted data member has_been_changed_.
10040         (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
10041         to determine if the table is empty.
10042         (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
10043         Remove.
10044         (Stub_table::add_reloc_stub): Define method in class definition
10045         instead of just declaring it there.
10046         (Stub_table::add_cortex_a8_stub): New method definition.
10047         (Stub_table::update_data_size_and_addralign): Ditto.
10048         (Stub_table::finalize_stubs): Ditto.
10049         (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
10050         (Stub_table::do_addralign_): Return address alignment in the
10051         (Stub_table::do_reset_address_and_file_offset): Define method in
10052         class definition instead of declaring it there.  Set current data
10053         size to be the data size of the previous pass.
10054         (Stub_table::set_final_data_size): Use current data size as the
10055         final data size.
10056         (Stub_table::relocate_stub): Change parameter type of stub from
10057         Reloc_stub pointer to Stub pointer.
10058         (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
10059         (Stub_table::Cortex_a8_stub_list): New typedef.
10060         (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
10061          Stub_table::prev_addralign_): New data member.
10062         (Arm_relobj::Arm_relobj): Initialize data member
10063         section_has_cortex_a8_workaround_.
10064         (Arm_relobj::section_has_cortex_a8_workaround,
10065          Arm_relobj::mark_section_for_cortex_a8_workaround): New method
10066          definitions.
10067         (Arm_relobj::section_has_cortex_a8_workaround_): New data member
10068         declarations.
10069         (Target_arm::relocate_stub): Change parameter type of stub from
10070         Reloc_stub pointer to Stub pointer.
10071         (Insn_template::size, Insn_template::alignment): Handle
10072         THUMB16_SPECIAL_TYPE.
10073         (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
10074          Stub_table::update_data_size_and_addralign,
10075          Stub_table::apply_cortex_a8_workaround_to_address_range): New method
10076         definitions.
10077         (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
10078         (Stub_table::do_write): Ditto.
10079         (Target_arm::do_relax): Adjust code for changes in Stub_table.
10080
10081 2010-01-08  Ian Lance Taylor  <iant@google.com>
10082
10083         PR 11108
10084         * symtab.h (class Symbol): Remove fields is_target_special_ and
10085         has_plt_offset_.  Add field is_defined_in_discarded_section_.
10086         (Symbol::is_defined_in_discarded_section): New function.
10087         (Symbol::set_is_defined_in_discarded_section): New function.
10088         (Symbol::has_plt_offset): Rewrite.
10089         (Symbol::set_plt_offset): Verify that new offset is not -1U.
10090         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
10091         Don't initialize is_target_special_ or has_plt_offset_.
10092         Initialize is_defined_in_discarded_section_.
10093         (Symbol_table::add_from_relobj): If appropriate, set
10094         is_defined_in_discarded_section.
10095         * resolve.cc (Symbol::override_base_with_special): Don't test
10096         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
10097         * target-reloc.h (relocate_section): Do special handling for
10098         symbols defined in discarded sections for global symbols as well
10099         as local symbols.
10100
10101 2010-01-08  Ian Lance Taylor  <iant@google.com>
10102
10103         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
10104         the SHT_SYMTAB case.
10105
10106 2010-01-08  Ian Lance Taylor  <iant@google.com>
10107
10108         * object.cc (Sized_relobj::do_layout): Don't get confused if
10109         layout_eh_frame returns NULL.
10110
10111 2010-01-08  Ian Lance Taylor  <iant@google.com>
10112
10113         PR 11084
10114         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
10115         dynamic symbol table, use the normal symbol table.
10116         (Sized_dynobj::do_read_symbols): Remove assertion about type of
10117         symbol table.
10118
10119 2010-01-08  Ian Lance Taylor  <iant@google.com>
10120
10121         PR 11072
10122         * layout.cc (Layout::include_section): Remove .gnu_debuglink
10123         sections.
10124
10125 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
10126
10127         * version.cc (print_version): Change to "Copyright 2010".
10128
10129 2010-01-08  Ian Lance Taylor  <iant@google.com>
10130
10131         PR 10287
10132         PR 11063
10133         * i386.cc (class Target_i386): Change return type of plt_section
10134         to be non-const.
10135         (class Output_data_plt_i386): Add tls_desc_rel_ field.
10136         (Output_data_plt_i386::Output_data_plt_i386): Initialize
10137         tls_desc_rel_ field.
10138         (Output_data_plt_i386::rel_tls_desc): New function.
10139         (Target_i386::rel_tls_desc_section): New function.
10140         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
10141         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
10142         R_386_TLS_DESC reloc in rel_tls_desc_section.
10143         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
10144         Define struct Tlsdesc_info.
10145         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
10146         (Target_x86_64::do_reloc_symbol_index): New function.
10147         (Target_x86_64::add_tlsdesc_info): New function.
10148         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
10149         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
10150         tlsdesc_rel_ field.
10151         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
10152         all callers.
10153         (Output_data_plt_x86_64::rela_tlsdesc): New function.
10154         (Target_x86_64::rela_tlsdesc_section): New function.
10155         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
10156         handling.
10157         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
10158         (Target_x86_64::do_reloc_addend): New function.
10159         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
10160         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
10161         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
10162         (Output_reloc::type): New function.
10163         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
10164         (Output_reloc::is_target_specific): New function.
10165         (Output_reloc::target_arg): New function.
10166         (class Output_reloc) [SHT_RELA]: Add four new constructors for
10167         absolute relocs and target specific relocs.
10168         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
10169         add_target_specific.
10170         (class Output_data_reloc) [SHT_RELA]: Likewise.
10171         * output.cc (Output_reloc::Output_reloc): Add four new versions
10172         for absolute relocs and target specific relocs.
10173         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
10174         (Output_reloc::get_symbol_index): Likewise.
10175         (Output_reloc::local_section_offset): Check that local_sym_index_
10176         is not TARGET_CODE or 0.
10177         (Output_reloc::symbol_value): Likewise.
10178         (Output_reloc::write) [SHT_RELA]: Call target for target specific
10179         reloc.
10180         * target.h (class Target): Add reloc_symbol_index and reloc_addend
10181         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
10182         functions.
10183         * layout.cc (add_target_dynamic_tags): Use output section for
10184         DT_PLTRELSZ and DT_JMPREL.
10185
10186 2010-01-07  Ian Lance Taylor  <iant@google.com>
10187
10188         PR 11061
10189         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
10190         function.
10191         (class Output_data_reloc_generic): Define.
10192         (class Output_data_reloc_base): Change base class to
10193         Output_data_reloc_generic.  Change add() method to call
10194         bump_relative_reloc_count for a relative reloc.  Remove
10195         sort_relocs_ field.
10196         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
10197         to sort_relocs().
10198         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
10199         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
10200         appropriate.
10201         * layout.h (class Layout): Update declaration.
10202
10203 2010-01-07  Ian Lance Taylor  <iant@google.com>
10204
10205         * output.h (class Output_data): Add const version of
10206         output_section and do_output_section.
10207         (class Output_section_data): Add const version of
10208         do_output_section.
10209         (class Output_section): Likewise.
10210         * layout.cc (Layout::add_target_dynamic_tags): New function.
10211         * layout.h (class Layout): Update declarations.
10212         * arm.cc (Target_arm::do_finalize_sections): Use
10213         add_target_dynamic_tags.
10214         * i386.cc (Target_i386::do_finalize_sections): Likewise.
10215         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
10216         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
10217         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
10218
10219 2010-01-07  Ian Lance Taylor  <iant@google.com>
10220
10221         PR 11042
10222         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
10223         object as needed.
10224
10225 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
10226             Ian Lance Taylor  <iant@google.com>
10227
10228         PR 11019
10229         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
10230         Xindex::read_symtab_xindex.
10231
10232 2010-01-07  Doug Kwan  <dougkwan@google.com>
10233
10234         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
10235         (Insn_template::thumb16_bcond_insn): New method declaration.
10236         (Insn_template): Fix spelling.
10237         (Stub::thumb16_special): New method declaration.
10238         (Stub::do_write): Define virtual method which was previously pure
10239         virtual.
10240         (Stub::do_thumb16_special): New method declaration.
10241         (Stub::do_fixed_endian_write): New template member.
10242         (Reloc_stub::do_write): Remove.
10243         (Reloc_stub::do_fixed_endian_write): Remove.
10244         (Cortex_a8_stub): New class definition.
10245         (Stub_factory::make_cortex_a8_stub): New method definition.
10246         (Stub_factory::Stub_factory): Add missing static storage class
10247         qualifier for elf32_arm_stub_a8_veneer_blx.
10248
10249 2010-01-07  Ian Lance Taylor  <iant@google.com>
10250
10251         PR 10980
10252         * options.h (class General_options): Add --warn-unresolved-symbols
10253         and --error-unresolved-symbols.
10254         * errors.cc (Errors::undefined_symbol): Implement
10255         --warn-unresolved-symbols.
10256
10257         * options.h (class General_options): Add -z text and -z textoff.
10258         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
10259
10260 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
10261
10262         * gc.h (Garbage_collection::Cident_section_map): New typedef.
10263         (Garbage_collection::cident_sections): New function.
10264         (Garbage_collection::add_cident_section): New function.
10265         (Garbage_collection::cident_sections_): New member.
10266         (gc_process_relocs): Add references to sections whose names are C
10267         identifiers.
10268         * gold.h (cident_section_start_prefix): New constant.
10269         (cident_section_stop_prefix): New constant.
10270         (is_cident): New function.
10271         * layout.cc (Layout::define_section_symbols): Replace string constants
10272         with the newly defined constants.
10273         * object.cc (Sized_relobj::do_layout): Track sections whose names are
10274         C identifiers.
10275         * testsuite/Makefile.am: Add gc_orphan_section_test.
10276         * testsuite/Makefile.in: Regenerate.
10277         * testsuite/gc_orphan_section_test.cc: New file.
10278         * testsuite/gc_orphan_section_test.sh: New file.
10279
10280 2010-01-06  Ian Lance Taylor  <iant@google.com>
10281
10282         PR 10980
10283         * options.h (class General_options): Add --warn-shared-textrel.
10284         * layout.cc (Layout::finish_dynamic_section): Implement
10285         --warn-shared-textrel.
10286
10287         PR 10980
10288         * options.h (class General_options): Add --warn-multiple-gp.
10289
10290 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10291
10292         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
10293         $(THREADSLIB) and $(LIBDL).
10294         * Makefile.in: Rebuild.
10295
10296 2010-01-06  Ian Lance Taylor  <iant@google.com>
10297
10298         PR 10980
10299         * options.cc (General_options::parse_section_start): New function.
10300         (General_options::section_start): New function.
10301         (General_options::General_options): Initialize all members.
10302         * options.h: Include <map>
10303         (class General_options): Add --section-start.  Add section_starts_
10304         member.
10305         * layout.cc (Layout::attach_allocated_section_to_segment): If
10306         --section-start was used, set the address of the segment.  Remove
10307         local sort_sections.
10308         (Layout::relaxation_loop_body): If the address of the load segment
10309         has been set by --section-start, don't use it.
10310         * output.h (Output_segment::update_flags_for_output_section): New
10311         function.
10312         * output.cc (Output_segment::add_output_section): Call
10313         update_flags_for_output_section.
10314
10315 2010-01-05  Ian Lance Taylor  <iant@google.com>
10316
10317         PR 10980
10318         * options.h (class General_options): Add --undefined-version.
10319         * script.cc (struct Version_expression): Add was_matched_by_symbol
10320         field.
10321         (Version_script_info::matched_symbol): New function.
10322         (Version_script_info::get_symbol_version_helper): Call
10323         matched_symbol.
10324         (Version_script_info::check_unmatched_names): New function.
10325         * script.h (class Version_script_info): Update declarations.
10326         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
10327
10328         * options.h (class General_options): Use DEFINE_bool_alias for
10329         allow_multiple_definition.
10330         * resolve.cc (Symbol_table::should_override): Don't test
10331         allow_multiple_definition.
10332
10333         PR 10980
10334         * options.h (class General_options): Add --cref.
10335         * main.cc (main): Print cref table if --cref.  Don't close mapfile
10336         until after printing cref table.
10337         * cref.cc: Include "symtab.h".
10338         (class Cref_inputs): Define Cref_table_compare and Cref_table.
10339         (Cref_table_compare::operator()): New function.
10340         (Cref_inputs::gather_cref): New function.
10341         (filecol): New static const.
10342         (Cref_inputs::print_cref): New function.
10343         (Cref::print_cref): New function.
10344         * cref.h: Include <cstdio>.
10345         (class Cref): Update declarations.
10346         * mapfile.h (Mapfile::file): New function.
10347         * object.h (class Object): Define Symbols.  Declare virtual
10348         do_get_global_symbols.
10349         (Object::get_global_symbols): New function.
10350         * object.cc (Input_objects::add_object): Pass object to cref_ if
10351         --cref.
10352         (Input_objects::archive_start): Likewise.
10353         (Input_objects::archive_stop): Likewise.
10354         (Input_objects::print_cref): New function.
10355         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
10356         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
10357         --cref.
10358         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
10359         function.
10360         * plugin.h (class Sized_pluginobj): Update declarations.
10361
10362 2010-01-05  Ian Lance Taylor  <iant@google.com>
10363
10364         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
10365         to is_default_version.  Rename insdef to insdefault.
10366         (Symbol_table::add_from_relobj): Rename def to is_default_version
10367         and local to is_forced_local.
10368         (Symbol_table::add_from_pluginobj): Likewise.
10369         (Symbol_table::add_from_dynobj): Likewise.
10370         (Symbol_table::define_special_symbol): Rename insdef to
10371         insdefault.
10372
10373 2010-01-04  Ian Lance Taylor  <iant@google.com>
10374
10375         PR 10980
10376         * options.h (class General_options): Add
10377         --allow-multiple-definition and -z muldefs.
10378         * resolve.cc (Symbol_table::should_override): Don't warn about a
10379         multiple symbol definition if --allow-multiple-definition or -z
10380         muldefs.
10381
10382         PR 10980
10383         * options.h (class General_options): Add --add-needed and
10384         --copy-dt-needed-entries.  Tweak --as-needed help entry.
10385         * object.cc (Input_objects::check_dynamic_dependencies): Give an
10386         error if --copy-dt-needed-entries aka --add-needed is used and
10387         would cause a change in behaviour.
10388
10389         PR 10980
10390         * options.h (class General_options): Add -G as a short version of
10391         --shared.  Add no-op options -assert, -g, and -i.
10392
10393 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
10394
10395         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
10396         check for .text or .gnu.linkonce.t sections.
10397         * icf.cc (Icf::find_identical_sections): Ditto.
10398         Change the detection for mangled function name within the section
10399         name.
10400         * icf.h (is_section_foldable_candidate): New function.
10401
10402 2009-12-30  Ian Lance Taylor  <iant@google.com>
10403
10404         PR 10980
10405         * options.h (class General_options): Permit two dashes with
10406         --retain-symbols-file.
10407
10408 2009-12-30  Ian Lance Taylor  <iant@google.com>
10409
10410         PR 10979
10411         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
10412         don't put the file header and segment headers in the text
10413         segment.
10414
10415         PR 10979
10416         * common.cc (Sort_commons::operator()): Stabilize sort when both
10417         entries are NULL.
10418         (Symbol_table::do_allocate_commons_list): When allocating common
10419         symbols, skip a symbol which is no longer common.
10420         * symtab.h (Symbol::is_common): Test whether the symbol comes from
10421         an object before checking its type.
10422         * testsuite/common_test_2.c: New file.
10423         * testsuite/common_test_3.c: New file.
10424         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
10425         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
10426         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
10427         (common_test_2_pic.o, common_test_2.so): New targets.
10428         (common_test_3_pic.o, common_test_3.so): New targets.
10429         * testsuite/Makefile.in: Rebuild.
10430
10431         PR 10979
10432         * script.cc (read_input_script): If we see a new SECTIONS clause,
10433         and we have added an input section, give an error.
10434         * layout.h (class Layout): Add have_added_input_section function.
10435         Add have_added_input_section_ field.
10436         * layout.cc (Layout::Layout): Initialize
10437         have_added_input_section_.
10438         (Layout::layout): Set have_added_input_section_.
10439         (Layout::layout_eh_frame): Likewise.
10440
10441 2009-12-30  Ian Lance Taylor  <iant@google.com>
10442
10443         PR 10931
10444         * options.h (class General_options): Add --sort-common option.
10445         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
10446         * common.cc (Sort_common): Add sort_order parameter to
10447         constructor.  Add sort_order_ field.
10448         (Sort_commons::operator): Check sort_order_.
10449         (Symbol_table::allocate_commons): Determine the sort order.
10450         (Symbol_table::do_allocate_commons): Add sort_order parameter.
10451         Change all callers.
10452         (Symbol_table::do_allocate_commons_list): Likewise.
10453
10454 2009-12-30  Ian Lance Taylor  <iant@google.com>
10455
10456         PR 10916
10457         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
10458         symbols from this object, don't change the visibility of an
10459         undefined symbol.
10460         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
10461
10462 2009-12-30  Ian Lance Taylor  <iant@google.com>
10463
10464         PR 10861
10465         * script.h (class Version_script_info): Define Language enum.
10466         Update declarations.  Define Glob, Exact, and Lookup types.  Add
10467         new fields globals_, locals_, and is_finalized_.
10468         * script.cc: Various formatting fixes.
10469         (class Parser_closure): Change language_stack_ from a vector of
10470         std::string to one of Version_script_info::Language.  Adjust all
10471         uses accordingly.
10472         (class Lazy_demangler): Remove.
10473         (struct Version_expression): Change language from std::string to
10474         Version_script_info::Language.
10475         (Version_script_info::Version_script_info): New function.
10476         (Version_script_info::~Version_script_info): Don't call clear.
10477         (Version_script_info::finalize): New function.
10478         (Version_script_info::build_lookup_tables): New function.
10479         (Version_script_info::build_expression_list_lookup): New
10480         function.
10481         (Version_script_info::get_symbol_version_helper): Rewrite to use
10482         lookup tables.
10483         (Version_script_info::print_expression_list): Adjust to use
10484         Version_script_info::Language.
10485         (script_push_lex_into_version_mode): Check that the version script
10486         has not been finalized.
10487         (version_script_push_lang): Change language string to
10488         Version_script_info::Language.
10489         * options.cc (Command_line::version_script): New function.
10490         * options.h (class General_options): Add finalize_dynamic_list
10491         function.  Change version_script from declaration to definition.
10492         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
10493         * testsuite/version_script.map: Remove duplicate def of foo.
10494         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
10495         version_script.map.
10496         * testsuite/Makefile.in: Rebuild.
10497
10498 2009-12-30  Ian Lance Taylor  <iant@google.com>
10499
10500         PR 10843
10501         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
10502         if the input symbol index is 0, make the output symbol index 0.
10503
10504 2009-12-30  Ian Lance Taylor  <iant@google.com>
10505
10506         PR 10670
10507         * options.h (class General_options): Add -x/--discard-all.
10508         * object.cc (Sized_relobj::do_count_local_symbols): Handle
10509         --discard-all.  If the local symbol needs a dynamic entry, check
10510         that before handling --discard-locals.
10511
10512 2009-12-30  Ian Lance Taylor  <iant@google.com>
10513
10514         PR 10450
10515         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
10516         flags to PF_R.
10517         (Output_segment::add_output_section): Don't change the flags if
10518         the type is PT_TLS.
10519
10520         PR 10450
10521         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
10522         GNU hash table if they need a dynamic value.  Otherwise, don't add
10523         them if they are defined in a dynamic object or are forced local.
10524
10525 2009-12-29  Ian Lance Taylor  <iant@google.com>
10526
10527         PR 10450
10528         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
10529         .gnu.hash table for a 32-bit target.
10530
10531         PR 10450
10532         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
10533         regular and a dynamic object only needs a dynamic symbol table
10534         entry if it is externally visible.
10535
10536         PR 10450
10537         * i386.cc (class Target_i386): Initialize global_offset_table_ in
10538         constructor.  Add global_offset_table_ field.
10539         (Target_i386::got_section): Set global_offset_table_.
10540         (Target_i386::do_finalize_sections): Set global_offset_table_
10541         size.
10542         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
10543         in constructor.  Add global_offset_table_ field.
10544         (Target_x86_64::got_section): Set global_offset_table_.
10545         (Target_x86_64::do_finalize_sections): Set global_offset_table_
10546         size.
10547
10548         * layout.cc (Layout::Layout): Initialize increase_relro_.
10549         (Layout::get_output_section): Add is_relro, is_last_relro, and
10550         is_first_non_relro parameters.  Change all callers.
10551         (Layout::choose_output_section): Likewise.
10552         (Layout::add_output_section_data): Likewise.
10553         (Layout::make_output_section): Likewise.
10554         (Layout::set_segment_offsets): Clear increase_relro when using a
10555         linker script.
10556         * layout.h (class Layout): Add increase_relro method.  Add
10557         increase_relro_ field.  Update declarations.
10558         * output.cc (Output_section::Output_section): Initialize
10559         is_last_relro_ and is_first_non_relro_.
10560         (Output_segment::add_output_section): Group relro sections is
10561         do_sort is true.  Handle is_last_relro and is_first_non_relro.
10562         (Output_segment::maximum_alignment): Remove relro handling.
10563         (Output_segment::set_section_addresses): Add increase_relro
10564         parameter.  Change all callers.  Add initial alignment to align
10565         relro sections on separate page.  Remove old relro handling.
10566         (Output_segment::set_section_list_addresses): Remove in_relro
10567         parameter.  Change all callers.
10568         (Output_segment::set_offset): Add increase parameter.  Change all
10569         callers.  Remove old relro handling.
10570         * output.h (class Output_section): Add new methods: is_last_relro,
10571         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
10572         Add is_last_relro_ and is_first_non_relro_ fields.
10573         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
10574         Create separate .got.plt section.  Call increase_relro.
10575         * x86_64.cc (Target_x86_64::got_section): Likewise.
10576         * testsuite/relro_script_test.t: Add .got.plt.
10577
10578         PR 10450
10579         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
10580         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
10581         (Layout::finalize): Call set_dynamic_symbol_size.
10582         (Layout::set_dynamic_symbol_size): New function.
10583         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
10584         set_dynamic_symbol_size.
10585
10586         PR 10450
10587         * output.h (class Output_section): Add is_entsize_zero_ field.
10588         * output.cc (Output_section::Output_section): Initialize
10589         is_entsize_zero_.
10590         (Output_section::set_entsize): If two different entsizes are
10591         requested, force it to zero.
10592         (Output_section::add_input_section): Set flags for .debug_str
10593         before updating section flags.  Set entsize.
10594         (Output_section::update_flags_for_input_section): Set SHF_MERGE
10595         and SHF_STRING if all input sections have those flags.
10596
10597 2009-12-29   Rafael Espindola  <espindola@google.com>
10598
10599         * main.cc (main): Fix the sys time reporting.
10600         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
10601         reporting.
10602
10603 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
10604
10605         * options.cc (General_options::parse_version): Allow -v to exit
10606         without an error if there is nothing to link.
10607
10608 2009-12-29  Ian Lance Taylor  <iant@google.com>
10609
10610         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
10611         using a version of gcc before 4.1.
10612         * configure: Rebuild.
10613
10614 2009-12-28  Chris Demetriou  <cgd@google.com>
10615
10616         * attributes.cc (Output_attributes_section_data::do_write): Use
10617         std::vector::front rather than std::vector::data.
10618
10619 2009-12-28  Ian Lance Taylor  <iant@google.com>
10620
10621         * symtab.h (class Symbol_table): Add enum Defined.
10622         * resolve.cc (Symbol_table::should_override): Add defined
10623         parameter.  Change all callers.  Test whether object is NULL
10624         before calling a method on it.
10625         (Symbol_table::report_resolve_problem): Add defined parameter.
10626         Change all callers.
10627         (Symbol_table::should_override_with_special): Likewise.
10628         * symtab.cc (Symbol_table::define_in_output_data): Add defined
10629         parameter.  Change all callers.
10630         (Symbol_table::do_define_in_output_data): Likewise.
10631         (Symbol_table::define_in_output_segment): Likewise.
10632         (Symbol_table::do_define_in_output_segment): Likewise.
10633         (Symbol_table::define_as_constant): Likewise.
10634         (Symbol_table::do_define_as_constant): Likewise.
10635         * script.h (class Symbol_assignment): Add is_defsym parameter to
10636         constructor; change all callers.
10637         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
10638         parameter.  Change all callers.  Add is_defsym_ field.
10639         (class Parser_closure): Add parsing_defsym parameter to
10640         constructor; change all callers.  Add parsing_defsym accessor
10641         function.  Add parsing_defsym_ field.
10642
10643 2009-12-28  Ian Lance Taylor  <iant@google.com>
10644
10645         * gold.cc (queue_middle_tasks): Fix formatting.
10646         * object.cc (Relobj::is_section_name_included): Likewise.
10647
10648 2009-12-23  Ian Lance Taylor  <iant@google.com>
10649
10650         * i386.cc (Target_i386::do_calls_non_split): Recognize
10651         -fsplit-stack prologue for a function with a static chain.
10652         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
10653         -fsplit-stack prologue when using %r11.
10654
10655 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
10656
10657         * options.cc (General_options::parse_version): Make -v continue and do
10658         the link like GNU ld does.
10659
10660 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
10661
10662         * Makefile.am (CCFILES): Add timer.cc.
10663         (HFILES): Add timer.h.
10664         * configure.ac: Check for sysconf and times.
10665         * main.cc: include timer.h.
10666         (main): Use Timer instead of get_run_time.
10667         * timer.cc: New.
10668         * timer.h: New.
10669         * workqueue.cc: include timer.h.
10670         (Workqueue::find_and_run_task):
10671         Report user, sys and wall time.
10672         * Makefile.in: Regenerate.
10673         * config.in: Regenerate.
10674         * configure: Regenerate.
10675
10676 2009-12-16  Doug Kwan  <dougkwan@google.com>
10677
10678         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
10679         sections.
10680         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
10681         relaxed input sections.
10682         * output.cc (Output_section::find_relaxed_input_section): Change
10683         return type to Output_relaxed_input_section pointer.  Adjust code
10684         for new type of relaxed_input_section_map_.
10685         * output.h (Output_section::find_relaxed_input_section): Change
10686         return type to Output_relaxed_input_section pointer.
10687         (Output_section::Output_relaxed_input_section_by_input_section_map):
10688         New type.
10689         (Output_section::relaxed_input_section_map_): Change type to
10690         Output_section::Output_relaxed_input_section_by_input_section_map.
10691         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
10692         input section.
10693
10694 2009-12-15  Ian Lance Taylor  <iant@google.com>
10695
10696         * layout.cc (Layout::create_shstrtab): Only write out after input
10697         sections if we are compressing debug sections.
10698
10699 2009-12-15  Ian Lance Taylor  <iant@google.com>
10700
10701         * archive.cc (Archive::add_symbols): Only look up a symbol without
10702         a version if there is, in fact, a version.
10703
10704 2009-12-14  Ian Lance Taylor  <iant@google.com>
10705
10706         Revert -Wshadow changes, all changes from:
10707         2009-12-11  Doug Kwan  <dougkwan@google.com>
10708         2009-12-11  Nick Clifton  <nickc@redhat.com>
10709         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
10710
10711 2009-12-11  Doug Kwan  <dougkwan@google.com>
10712
10713         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
10714         due to -Wshadow.
10715         * attributes.cc (Object_attribute::size): Ditto.
10716         (Attributes_section_data::size): Ditto.
10717         (Attributes_section_data::Attributes_section_data): Ditto.
10718         (Output_attributes_section_data::do_write): Ditto.
10719         * attributes.h (Object_attribute::set_type): Ditto.
10720         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
10721
10722 2009-12-11  Nick Clifton  <nickc@redhat.com>
10723
10724         * archive.cc: Fix shadowed variable warnings.
10725         * arm.cc: Likewise.
10726         * compressed_output.cc: Likewise.
10727         * compressed_output.h: Likewise.
10728         * configure: Likewise.
10729         * dwarf_reader.cc: Likewise.
10730         * dynobj.cc: Likewise.
10731         * dynobj.h: Likewise.
10732         * ehframe.cc: Likewise.
10733         * ehframe.h: Likewise.
10734         * errors.cc: Likewise.
10735         * expression.cc: Likewise.
10736         * fileread.cc: Likewise.
10737         * fileread.h: Likewise.
10738         * freebsd.h: Likewise.
10739         * i386.cc: Likewise.
10740         * icf.cc: Likewise.
10741         * incremental.h: Likewise.
10742         * layout.cc: Likewise.
10743         * layout.h: Likewise.
10744         * mapfile.cc: Likewise.
10745         * merge.cc: Likewise.
10746         * merge.h: Likewise.
10747         * object.cc: Likewise.
10748         * object.h: Likewise.
10749         * options.h: Likewise.
10750         * output.cc: Likewise.
10751         * output.h: Likewise.
10752         * parameters.cc: Likewise.
10753         * plugin.cc: Likewise.
10754         * powerpc.cc: Likewise.
10755         * reduced_debug_output.cc: Likewise.
10756         * reduced_debug_output.h: Likewise.
10757         * reloc.cc: Likewise.
10758         * reloc.h: Likewise.
10759         * resolve.cc: Likewise.
10760         * script-sections.cc: Likewise.
10761         * script.cc: Likewise.
10762         * script.h: Likewise.
10763         * sparc.cc: Likewise.
10764         * symtab.cc: Likewise.
10765         * symtab.h: Likewise.
10766         * target-select.cc: Likewise.
10767         * target-select.h: Likewise.
10768         * token.h: Likewise.
10769         * workqueue.cc: Likewise.
10770         * workqueue.h: Likewise.
10771         * x86_64.cc: Likewise.
10772
10773 2009-12-10  Doug Kwan  <dougkwan@google.com>
10774
10775         * arm.cc (attributes.h): New include.
10776         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
10777         (Arm_relobj::~Arm_relobj): Delete object pointed by
10778         attributes_section_data_.
10779         (Arm_relobj::attributes_section_data): New method definition.
10780         (Arm_relobj::attributes_section_data_): New data member declaration.
10781         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
10782         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
10783         attributes_section_data_.
10784         (Arm_dynobj::attributes_section_data): New method definition.
10785         (Arm_dynobj::attributes_section_data_): New data member declaration.
10786         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
10787         initialization value of may_use_blx_ to false.
10788         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
10789         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
10790         object attributes to compute results instead of hard-coding.
10791         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
10792         Target_arm::get_secondary_compatible_arch,
10793         Target_arm::set_secondary_compatible_arch
10794         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
10795         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
10796         New method declarations.
10797         (Target_arm::get_aeabi_object_attribute): New method definition.
10798         (Target_arm::attributes_section_data_): New data member declaration.
10799         (read_arm_attributes_section): New template definition.
10800         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
10801         (Arm_dynobj::do_read_symbols): Ditto.
10802         (Target_arm::do_finalize_sections): Merge attributes sections from
10803         input.  Check for BLX use after attributes section merging.
10804         Fix __exidx_start and __exidx_end visibility.  Create an
10805         .ARM.attributes section if necessary.
10806         (Target_arm::get_secondary_compatible_arch,
10807         Target_arm::set_secondary_compatible_arch,
10808         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
10809         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
10810         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
10811         New method definitions.
10812
10813 2009-12-09  Ian Lance Taylor  <iant@google.com>
10814
10815         * plugin.cc (Plugin::load): Don't cast from void* to a function
10816         pointer.
10817
10818 2009-12-09  Ian Lance Taylor  <iant@google.com>
10819
10820         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
10821         information fields.
10822
10823 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
10824
10825         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
10826         Replace two_file_shared_1.so with two_file_shared_2.so.
10827         * testsuite/Makefile.in: Regenerated.
10828
10829 2009-12-08  Doug Kwan  <dougkwan@google.com>
10830
10831         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
10832         (HFILES): Add attributes.h and int_encoding.h.
10833         * Makefile.in: Regenerate.
10834         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
10835         function definitions to int_encoding.cc
10836         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
10837         prototypes to int_encoding.h
10838         * reduced_debug_output.cc (int_encoding.h): New include.
10839         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
10840         function definitions to int_encoding.cc
10841         (insert_into_vector, read_from_pointer): Move template definitions to
10842         int_encoding.h
10843         * attributes.cc: New file.
10844         * attributes.h: New file.
10845         * int_encoding.cc: New file.
10846         * int_encoding.h: New file.
10847
10848 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
10849
10850         PR gold/11055
10851         * incremental-dump.cc (dump_incremental_inputs): New.
10852         (main): Use dump_incremental_inputs.
10853
10854 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
10855
10856         PR gold/10893
10857         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
10858         checking elfcpp::STT_FUNC.
10859         (Target_i386::Relocate::relocate): Likewise.
10860         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
10861
10862         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
10863         symbols from shared libraries into normal FUNC symbols.
10864
10865         * symtab.h (Symbol): Add is_func and use it.
10866
10867 2009-12-05  Doug Kwan  <dougkwan@google.com>
10868
10869         * arm.cc (Target_arm::arm_info): Initialize new fields
10870         attributes_section and attributes_vendor.
10871         * i386.cc (Target_i386::i386_info): Same.
10872         * object.cc (Sized_relobj::do_layout): Skip attribute section.
10873         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
10874         fields attributes_section and attributes_vendor.
10875         * sparc.cc (Target_sparc::sparc_info): Same.
10876         * target.h (Target::attributes_section, Target::attributes_vendor,
10877         Target::is_attributes_section, Target::attribute_arg_type,
10878         Target::attributes_order): New method definitions.
10879         (Target::Target_info::attributes_section,
10880         Target::Target_info::attributes_vendor): New fields.
10881         (Target::do_attribute_arg_type, Target::do_attributes_order): New
10882         virtual method definitions.
10883         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
10884         attributes_section and attributes_vendor.
10885         * testsuite/testfile.cc (Target_test::test_target_info): Same.
10886
10887 2009-12-05  Doug Kwan  <dougkwan@google.com>
10888
10889         * arm.cc: Update comments about interworking and stub generation.
10890         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
10891         considered as non-PIC.
10892         (Arm_relocate_functions::base_abs): Fix formatting.
10893         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
10894         of function to use GOT entry address instead of offset.
10895         (Target_arm::Scan::global): Issue an error if a symbol would need a
10896         PLT does not get one because it is untyped.  Remove code to create
10897         dynamic symbols for relative branches.
10898         (Target_arm::Relocate::relocate: Use 0 instead of false since function
10899         takes unsigned integer instead of boolean.
10900
10901 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
10902
10903         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
10904         (two_file_test_LDADD): Likewise.
10905         (common_test_1_LDADD): Likewise.
10906         (exception_test_LDADD) Likewise.
10907         (weak_test_LDADD): Likewise.
10908         (many_sections_test_LDADD): Likewise.
10909         (initpri1_LDADD): Likewise.
10910         (script_test_1_LDADD): Likewise.
10911         (script_test_2_LDADD): Likewise.
10912         (justsyms_LDADD): Likewise.
10913         (binary_test_LDADD): Likewise.
10914         (large_LDADD): Likewise.
10915         * testsuite/Makefile.in: Regenerated.
10916
10917 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
10918
10919         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
10920         (Symbol_table::override_with_special): Likewise.
10921         (Symbol_table::add_from_object): Likewise.
10922
10923 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
10924
10925         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
10926         Don't set the data_offset twice.
10927
10928 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
10929
10930         * testsuite/Makefile.in: Regenerate.
10931
10932 2009-12-03  Doug Kwan  <dougkwan@google.com>
10933
10934         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
10935         (Target_arm::do_finalize_sections): Add parameter for symbol table
10936         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
10937         * i386.cc (Target_i386::do_finalize_sections): Add an additional
10938         parameter for symbol table pointer.
10939         * layout.cc (Layout::finalize): Call Target::finalize_sections with
10940         an additional parameter for a pointer to symbol table.
10941         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
10942         parameter for a symbol table pointer.
10943         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
10944         * target.h (Target::finalize_sections, Target::do_finalize_sections):
10945         Ditto.
10946         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
10947         parameter for a symbol table pointer.
10948
10949 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
10950
10951         * incremental.cc (Incremental_inputs_header)
10952         (Incremental_inputs_header_write, Incremental_inputs_entry)
10953         (Incremental_inputs_entry_write): Move ...
10954         * incremental.h (Incremental_inputs_header)
10955         (Incremental_inputs_header_write, Incremental_inputs_entry)
10956         (Incremental_inputs_entry_write): here.
10957
10958 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10959
10960         * incremental.cc (make_sized_incremental_binary): Set the target.
10961         Error if it is incompatible.
10962         * output.h (Output_file): Add filename method.
10963
10964 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10965
10966         * incremental.cc (Incremental_inputs_entry): Remove unused argument
10967         from the get_* methods.
10968
10969 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10970
10971         * incremental-dump.cc (main): Check that the offeset of a script is 0.
10972         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
10973         Write 0 for the data_offset of scripts.
10974
10975 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10976
10977         * testsuite/Makefile.am: Add the incremental_test.sh test.
10978         * testsuite/incremental_test.sh: New.
10979         * testsuite/incremental_test_1.c: New.
10980         * testsuite/incremental_test_2.c: New.
10981
10982 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
10983
10984         * incremental-dump.cc (main): Fix typos.
10985
10986 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
10987
10988         PR gold/11025
10989         * incremental-dump.cc (main): Use llu to print 64 bit values.
10990
10991 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
10992             H.J. Lu  <hongjiu.lu@intel.com>
10993
10994         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
10995         $(LIBDL).
10996         (incremental_dump_LDADD): Likewise.
10997         * Makefile.in: Regenerated.
10998
10999 2009-11-25  Doug Kwan  <dougkwan@google.com>
11000
11001         Revert:
11002
11003         2009-11-25  Doug Kwan  <dougkwan@google.com>
11004
11005                 * arm.cc (Target_arm::Target_arm): Move method definition
11006                 outside of class definition.  Add code to handle
11007                 --target1-rel, --target1-abs and --target2= options.
11008                 (Target_arm::get_reloc_reloc_type): Change method to be
11009                 non-static and const.
11010                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
11011                 New data member declaration.
11012                 (Target_arm::Scan::local, Target_arm::Scan::global,
11013                 Target_arm::Relocate::relocate,
11014                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
11015                 Adjust call to Target_arm::get_real_reloc_type.
11016                 (Target_arm::get_real_reloc_type): Use command line options
11017                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
11018                 * options.h (--target1-rel, --target1-abs, --target2): New
11019                 ARM-only options.
11020
11021 2009-11-25  Doug Kwan  <dougkwan@google.com>
11022
11023         * arm.cc (Target_arm::Target_arm): Move method definition outside of
11024         class definition.  Add code to handle --target1-rel, --target1-abs
11025         and --target2= options.
11026         (Target_arm::get_reloc_reloc_type): Change method to be non-static
11027         and const.
11028         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
11029         member declaration.
11030         (Target_arm::Scan::local, Target_arm::Scan::global,
11031         Target_arm::Relocate::relocate,
11032         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
11033         call to Target_arm::get_real_reloc_type.
11034         (Target_arm::get_real_reloc_type): Use command line options to
11035         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
11036         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
11037         options.
11038
11039 2009-11-25  Doug Kwan  <dougkwan@google.com>
11040
11041         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
11042         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
11043         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
11044         formatting.
11045         (Arm_relocate_functions::thm_call): Replace body with a call to
11046         Arm_relocate_functions::thumb_branch_common.
11047         (Arm_relocate_functions::thm_jump24,
11048         Arm_relocate_functions::thm_xpc22): New method definitions.
11049         (Arm_relocate_functions::thumb_branch_common): New method definition.
11050         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
11051         operator.
11052         (Target_arm::Relocate::relocate): Adjust call to thm_call.
11053         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
11054
11055 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
11056
11057         * Makefile.am: Build incremental-dump
11058         * Makefile.in: Regenerate.
11059         * incremental-dump.cc: New.
11060         * incremental.cc (Incremental_inputs_header_data,
11061         Incremental_inputs_entry_data): Move to incremental.h
11062         * incremental.h: (Incremental_inputs_header_data,
11063         Incremental_inputs_entry_data): Move from incremental.cc
11064
11065 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
11066
11067         * incremental.cc (Incremental_inputs_header,
11068         Incremental_inputs_header_write, Incremental_inputs_entry,
11069         Incremental_inputs_entry_write): Add a typedef with the data type.
11070
11071 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
11072
11073         * incremental.cc (Incremental_inputs_header,
11074         Incremental_inputs_header_write, Incremental_inputs_entry,
11075         Incremental_inputs_entry_write): Update comment about which
11076         type has the filed descriptions.
11077
11078 2009-11-15  Doug Kwan  <dougkwan@google.com>
11079
11080         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
11081         (Arm_relocate_functions::arm_branch_common): Change method defintion
11082         in class definition to a method declaration and update list of formal
11083         parameters.
11084         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
11085         Arm_relocation_functions::jump24): Adjust call to
11086         Arm_relocate_functions::arm_branch_common.  Update list of formal
11087         parameters.
11088         (Arm_relocate_functions::xpc25): New method definition.
11089         (Arm_relocate_functions::arm_branch_common): Move method defintion
11090         out from class definition.  Use stubs for mode-switching and extending
11091         branch ranges.
11092         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
11093         specially.  Change code to enable use of stubs in ARM branches.
11094
11095 2009-11-10  Doug Kwan  <dougkwan@google.com>
11096
11097         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
11098         in method declaration.
11099         (Target_arm::relocate_stub): New method declaration.
11100         (Target_arm::default_target): Change to return a pointer instead of
11101         a const reference.
11102         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
11103         Target_arm::default_target.
11104         (Arm_Relobj::do_relocate_sections): Remove options paramater in
11105         method definition.
11106         (Target_arm::relocate_section): Adjust view.
11107         (Target_arm::relocate_stub): New method definition.
11108
11109 2009-11-10  Doug Kwan  <dougkwan@google.com>
11110
11111         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
11112         a format warning.
11113         * incremental.cc (open_incremental_binary): Initialized local
11114         variables to avoid warnings.
11115         * object.cc (make_elf_object): Ditto.
11116         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
11117         a format warning.
11118
11119 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
11120
11121         PR gold/10930
11122         * testsuite/plugin_test.c: Include "config.h".
11123
11124 2009-11-09  Doug Kwan  <dougkwan@google.com>
11125
11126         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
11127         (arm_symbol_value): Remove.
11128         (Arm_relocate_functions::arm_branch_common,
11129         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
11130         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
11131         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
11132         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
11133         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
11134         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
11135         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
11136         Arm_relocate_functions::thm_mobw_abs_nc,
11137         Arm_relocate_functions::thm_mov_abs,
11138         Arm_relocate_functions::movw_prel_nc,
11139         Arm_relocate_functions::thm_movt_abs,
11140         Arm_relocate_functions::movt_prel,
11141         Arm_relocate_functions::thm_movw_prel_nc,
11142         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
11143         (Target_arm::Relocate::relocate): Only decompose address into two
11144         parts if relocation type uses the thumb-bit and pass the actual
11145         bit instead of a flag indicating that the thumb-bit is used.  Adjust
11146         calls to methods in Arm_relocate_functions for this change.
11147
11148 2009-11-08  Ian Lance Taylor  <iant@google.com>
11149
11150         PR 10925
11151         * reloc.cc: Instantiate
11152         Sized_relobj::initialize_input_to_output_maps and
11153         Sized_relobj:free_input_to_output_maps.
11154
11155 2009-11-06  Ian Lance Taylor  <iant@google.com>
11156
11157         PR 10876
11158         * defstd.cc (in_segment): Set only_if_ref true for "end".
11159
11160 2009-11-06  Doug Kwan  <dougkwan@google.com>
11161
11162         * arm.cc (class Reloc_stub): Correct a comment.
11163         (Target_arm::Target_arm): Initialize arm_input_section_map_.
11164         (Target_arm::scan_section_for_stubs): New method declaration.
11165         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
11166         Change methods from private to protected.
11167         (Target_arm::do_may_relax): New method definition.
11168         (Target_arm::do_relax, Target_arm::group_sections,
11169         Target_arm::scan_reloc_for_stub,
11170         Target_arm::scan_reloc_section_for_stubs): New method declarations.
11171         (Target_arm::arm_input_section_map_): New data member declaration.
11172         (Target_arm::scan_reloc_for_stub,
11173         Target_arm::scan_reloc_section_for_stubs,
11174         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
11175         Target_arm::do_relax): New method definitions.
11176
11177 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
11178
11179         * configure.ac: Check for (struct stat)::st_mtim
11180         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
11181         * config.in: Regenerate.
11182         * configure: Regenerate.
11183
11184 2009-11-05  Ian Lance Taylor  <iant@google.com>
11185
11186         PR 10910
11187         * output.cc (Output_segment::add_output_section): Add missing
11188         return statement.
11189
11190 2009-11-04  Ian Lance Taylor  <iant@google.com>
11191
11192         PR 10880
11193         * object.h (class Object): Add is_needed and set_is_needed
11194         methods.  Add is_needed_ field.  Make bool fields into bitfields.
11195         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
11196         defined in a dynamic object and referenced by a regular object,
11197         set is_needed for the dynamic object.
11198         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
11199         if the file is marked with as_needed and it is not needed.
11200
11201 2009-11-04  Ian Lance Taylor  <iant@google.com>
11202
11203         PR 10887
11204         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
11205         tags if data is discarded by linker script.
11206         * i386.cc (Target_i386::do_finalize_sections): Likewise.
11207         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
11208         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
11209         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
11210
11211 2009-11-04  Ian Lance Taylor  <iant@google.com>
11212
11213         * layout.cc (Layout::get_output_section): Add is_interp and
11214         is_dynamic_linker_section parameters.  Change all callers.
11215         (Layout::choose_output_section): Likewise.
11216         (Layout::make_output_section): Likewise.
11217         (Layout::add_output_section_data): Add is_dynamic_linker_section
11218         parameter.  Change all callers.
11219         * layout.h (class Layout): Update declarations.
11220         * output.h (class Output_section): Add is_interp, set_is_interp,
11221         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
11222         Add is_interp_, is_dynamic_linker_section_ fields.  Change
11223         generate_code_fills_at_write_ to a bitfield.
11224         * output.cc (Output_section::Output_sections): Initialize new
11225         fields.
11226         (Output_segment::add_output_section): Add do_sort parameter.
11227         Change all callers.
11228
11229 2009-11-03  Ian Lance Taylor  <iant@google.com>
11230
11231         PR 10860
11232         * options.h (class General_options): Add --warn-common.
11233         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
11234         merging two common symbols.
11235         (Symbol_table::should_override): Handle --warn-common when merging
11236         a common symbol with a defined symbol.  Use report_resolve_problem
11237         for multiple definitions.
11238         (Symbol_table::report_resolve_problem): New function.
11239         * symtab.h (class Symbol_table): Declare report_resolve_problem.
11240
11241 2009-11-03  Doug Kwan  <dougkwan@google.com>
11242
11243         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
11244         stub_factory_.
11245         (Target_arm::stub_factory): New method definition.
11246         (Target_arm::new_arm_input_section,
11247         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
11248         Target_arm::reloc_uses_thumb_bit): New method declarations.
11249         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
11250         New type definitions.
11251         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
11252         member declarations.
11253         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
11254         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
11255         New method definitions.
11256
11257 2009-11-03  Ian Lance Taylor  <iant@google.com>
11258
11259         * options.h (class General_options): Add --warn_constructors.
11260
11261 2009-11-03  Ian Lance Taylor  <iant@google.com>
11262
11263         PR 10893
11264         * defstd.cc (in_section): Add entries for __rel_iplt_start,
11265         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
11266
11267 2009-11-03  Ian Lance Taylor  <iant@google.com>
11268
11269         PR 10895
11270         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
11271         --msgid-bugs-address.
11272         (install-pdf): New target.
11273         (install-data_yes): Look up one directory to find mkinstalldirs.
11274
11275 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
11276
11277         * po/Make-in (.po.gmo): Don't generate .gmo files in source
11278         tree.
11279
11280 2009-10-30  Doug Kwan  <dougkwan@google.com>
11281
11282         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
11283
11284 2009-10-30  Doug Kwan  <dougkwan@google.com>
11285
11286         * arm.cc (Stub_addend_reader): New struct template definition
11287         and partial specializations.
11288         (Stub_addend_reader::operator()): New method definition for a
11289         partially specialized template.
11290
11291 2009-10-30  Doug Kwan  <dougkwan@google.com>
11292
11293         * arm.cc (Arm_relobj::processor_specific_flags): New method
11294         definition.
11295         (Arm_relobj::do_read_symbols): New method declaration.
11296         (Arm_relobj::processor_specific_flags_): New data member declaration.
11297         (Arm_dynobj): New class definition.
11298         (Target_arm::do_finalize_sections): Add input_objects parameter.
11299         (Target_arm::do_adjust_elf_header): New method declaration.
11300         (Target_arm::are_eabi_versions_compatible,
11301         (Target_arm::merge_processor_specific_flags): New method declaration.
11302         (Target_arm::do_make_elf_object): New overloaded method definitions
11303         and declaration.
11304         (Arm_relobj::do_read_symbols): New method definition.
11305         (Arm_dynobj::do_read_symbols): Ditto.
11306         (Target_arm::do_finalize_sections): Add input_objects parameters.
11307         Merge processor-specific flags from all input objects.
11308         (Target_arm::are_eabi_versions_compatible,
11309         Target_arm::merge_processor_specific_flags,
11310         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
11311         New method definitions.
11312         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
11313         Input_objects pointer type parameter.
11314         * layout.cc (Layout::finalize): Pass input objects to target's.
11315         finalize_sections function.
11316         * output.cc (Output_file_header::do_sized_write): Set ELF file
11317         header's processor-specific flags.
11318         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
11319         Input_objects pointer type parameter.
11320         * sparc.cc (Target_sparc::do_finalize_sections): Same.
11321         * target.h (Input_objects): New forward class declaration.
11322         (Target::processor_specific_flags,
11323         Target::are_processor_specific_flags_sect): New method definitions.
11324         (Target::finalize_sections): Add input_objects parameter.
11325         (Target::Target): Initialize processor_specific_flags_ and
11326         are_processor_specific_flags_set_.
11327         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
11328         parameter.
11329         (Target::set_processor_specific_flags): New method definition.
11330         (Target::processor_specific_flags_,
11331         Target::are_processor_specific_flags_set_): New data member
11332         declarations.
11333         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
11334         Input_objects pointer type parameter.
11335
11336 2009-10-30  Doug Kwan  <dougkwan@google.com>
11337
11338         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
11339
11340 2009-10-28  Ian Lance Taylor  <iant@google.com>
11341
11342         * object.h (class Relobj): Drop options parameter from
11343         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
11344         do_scan_relocs, do_relocate.  Change all callers.
11345         (class Sized_relobj): Drop options parameters from
11346         do_gc_process_relocs, do_scan_relocs, do_relocate,
11347         do_relocate_sections, relocate_sections, emit_relocs_scan,
11348         emit_relocs_scan_reltype.  Change all callers.
11349         (struct Relocate_info): Remove options field and all references to
11350         it.
11351         * reloc.h (class Read_relocs): Remove options constructor
11352         parameter and options_ field.  Change all callers.
11353         (class Gc_process_relocs, class Scan_relocs): Likewise.
11354         (class Relocate_task): Likewise.
11355         * target-reloc.h (scan_relocs): Remove options parameter.  Change
11356         all callers.
11357         (scan_relocatable_relocs): Likewise.
11358         * target.h (class Sized_target): Remove options parameter from
11359         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
11360         all callers.
11361         * gc.h (gc_process_relocs): Remove options parameter.  Change all
11362         callers.
11363         * arm.cc: Update functions to remove options parameters.
11364         * i386.cc: Likewise.
11365         * powerpc.cc: Likewise.
11366         * sparc.cc: Likewise.
11367         * x86_64.cc: Likewise.
11368         * testsuite/testfile.cc: Likewise.
11369
11370 2009-10-28  Doug Kwan  <dougkwan@google.com>
11371
11372         * arm.cc (Arm_relobj): New class definition.
11373         (Arm_relobj::scan_sections_for_stubs,
11374         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
11375         New method definitions.
11376
11377 2009-10-28  Cary Coutant  <ccoutant@google.com>
11378
11379         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
11380         (Plugin::cleanup_done_): New member.
11381         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
11382         (Plugin_manager::cleanup_done_): Remove.
11383         (Plugin_manager::add_input_file): Edit error message.
11384         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
11385         (Plugin_manager::cleanup): Remove use of cleanup_done_.
11386
11387 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
11388
11389         * fileread.cc: (File_read::View::~View): Use the new
11390         data_ownership_ filed.
11391         (File_read::~File_read): Dispose the new whole_file_view_.
11392         (File_read::open): Mmap the whole file if needed.
11393         (File_read::open): Use whole_file_view_ instead of contents_.
11394         (File_read::find_view): Use whole_file_view_ if applicable.
11395         (File_read::do_read): Use whole_file_view_ instead of contents_.
11396         (File_read::make_view): Use whole_file_view_ instead of contents_,
11397         update File_read::View::View call.
11398         (File_read::find_or_make_view): Update File_read::View::View
11399         call.
11400         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
11401         remove contents_
11402         (File_read::View::Data_ownership): New enum.
11403         (File_read::View::View): Replace bool mapped_ with Data_ownership
11404         argument.
11405         (File_read::View::mapped_): Remove (replaced by data_ownership_).
11406         (File_read::View::data_ownership_): New field.
11407         (File_read::contents_): Remove (replaced by whole_file_view_).
11408         (File_read::whole_file_view_): New field.
11409         * options.h (class General_options): Add --keep-files-mapped.
11410
11411 2009-10-27  Cary Coutant  <ccoutant@google.com>
11412
11413         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
11414         * testsuite/Makefile.am (plugin_test_5): New test case.
11415         * testsuite/Makefile.in: Regenerate.
11416
11417 2009-10-25  Doug Kwan  <dougkwan@google.com>
11418
11419         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
11420         from private to protected to allow access by child class.
11421         (Sized_relobj::do_relocate_sections): New method declaration.
11422         (Sized_relobj::relocate_sections): Virtualize.
11423         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
11424         Sized_relobj::relocate_sections.  Instantiate template explicitly
11425         for different target sizes and endianity.
11426
11427 2009-10-24  Doug Kwan  <dougkwan@google.com>
11428
11429         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
11430         (Arm_input_section::as_arm_input_section): New method.
11431         (Arm_output_section): New class definition.
11432         (Arm_output_section::create_stub_group,
11433         Arm_output_section::group_sections): New method definitions.
11434
11435 2009-10-22  Doug Kwan  <dougkwan@google.com>
11436
11437         * arm.cc (Arm_input_section): New class definition.
11438         (Arm_input_section::init, Arm_input_section:do_write,
11439         Arm_input_section::set_final_data_size,
11440         Arm_input_section::do_reset_address_and_file_offset): New method
11441         definitions.
11442
11443 2009-10-21  Doug Kwan  <dougkwan@google.com>
11444
11445         * arm.cc (Stub_table, Arm_input_section): New forward class
11446         declarations.
11447         (Stub_table): New class defintion.
11448         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
11449         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
11450         New method definition.
11451
11452 2009-10-21  Doug Kwan  <dougkwan@google.com>
11453
11454         * arm.cc: Update copyright comments.
11455         (Target_arm): New forward class template declaration.
11456         (Arm_address): New type.
11457         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
11458         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
11459         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
11460         constants.
11461         (Insn_template): Same.
11462         (DEF_STUBS): New macro.
11463         (Stub_type): New enum type.
11464         (Stub_template): New class definition.
11465         (Stub): Same.
11466         (Reloc_stub): Same.
11467         (Stub_factory): Same.
11468         (Target_arm::Target_arm): Initialize may_use_blx_ and
11469         should_force_pic_veneer_.
11470         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
11471         Target_arm::should_force_pic_veneer,
11472         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
11473         Target_arm::using_thumb_only, Target_arm:;default_target): New
11474         method defintions.
11475         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
11476         New data member declarations.
11477         (Insn_template::size, Insn_template::alignment): New method defintions.
11478         (Stub_template::Stub_template): New method definition.
11479         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
11480         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
11481         (Stub_factory::Stub_factory): New method definition.
11482         * gold.h (string_hash): New template.
11483         * output.h (Input_section_specifier::hash_value): Use
11484         gold::string_hash.
11485         (Input_section_specifier::string_hash): Remove.
11486         * stringpool.cc (Stringpool_template::string_hash): Use
11487         gold::string_hash.
11488
11489 2009-10-20  Doug Kwan  <dougkwan@google.com>
11490
11491         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
11492         symbols of relaxed input sections.
11493         * output.h (Output_section::find_relaxed_input_section): Make
11494         method public.
11495
11496 2009-10-16  Doug Kwan  <dougkwan@google.com>
11497
11498         * dynobj.cc (Versions::Versions): Initialize version_script_.
11499         Only insert base version symbol definition for a shared object
11500         if version script defines any version versions.
11501         (Versions::define_base_version): New method definition.
11502         (Versions::add_def): Check that base version is not needed.
11503         (Versions::add_need): Define base version lazily.
11504         * dynobj.h (Versions::define_base_version): New method declaration.
11505         (Versions::needs_base_version_): New data member declaration.
11506         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
11507         (check_DATA): Add no_version_test.stdout.
11508         (libno_version_test.so, no_version_test.o no_version_test.stdout):
11509         New make rules.
11510         * testsuite/Makefile.in: Regenerate.
11511         * testsuite/no_version_test.c: New file.
11512         * testsuite/no_version_test.sh: Ditto.
11513
11514 2009-10-16  Doug Kwan  <dougkwan@google.com>
11515
11516         * expression.cc (class Segment_start_expression): New class definition.
11517         (Segment_start_expression::value): New method definition.
11518         (script_exp_function_segment_start): Return a new
11519         Segment_start_expression.
11520         * gold/script-c.h (script_saw_segment_start_expression): New function
11521         prototype.
11522         * script-sections.cc (Script_sections::Script_sections): Initialize
11523         SAW_SEGMENT_START_EXPRESSION_ to false.
11524         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
11525         and -Tbbs options to specify section addresses if given in
11526         command line and no SEGMENT_START expression is seen in a script.
11527         * script-sections.h (Script_sections::saw_segment_start_expression,
11528         Script_sections::set_saw_segment_start_expression): New method
11529         definition.
11530         (Script_sections::saw_segment_start_expression_): New data member
11531         declaration.
11532         * script.cc (script_saw_segment_start_expression): New function.
11533         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
11534         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
11535         script_test_7.sh and script_test_8.sh.
11536         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
11537         script_test_8.stdout.
11538         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
11539         (script_test_6, script_test_6.stdout, script_test_7,
11540         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
11541         * Makefile.in: Regenerate.
11542         * testsuite/script_test_6.sh: New file.
11543         * testsuite/script_test_6.t: Same.
11544         * testsuite/script_test_7.sh: Same.
11545         * testsuite/script_test_7.t: Same.
11546         * testsuite/script_test_8.sh: Same.
11547
11548 2009-10-16  Doug Kwan  <dougkwan@google.com>
11549
11550         * output.cc (Output_segment::set_section_list_address): Cast
11551         expressions to unsigned long long type to avoid format warnings.
11552
11553 2009-10-15  Ian Lance Taylor  <iant@google.com>
11554
11555         * script.cc (Script_options::add_symbol_assignment): Always add a
11556         dot assignment to script_sections_.
11557         * script-sections.cc (Script_sections::add_dot_assignment):
11558         Initialize if necessary.
11559
11560         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
11561         program headers with no load segment if there is a linker script.
11562
11563         * layout.cc (Layout::set_segment_offsets): Align the file offset
11564         to the segment aligment for -N or -n with no load segment.
11565         * output.cc (Output_segment::add_output_section): Don't crash if
11566         the first section is a TLS section.
11567         (Output_segment::set_section_list_addresses): Print an error
11568         message if the address moves backward in a linker script.
11569         * script-sections.cc
11570         (Output_section_element_input::set_section_addresses): Don't
11571         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
11572         (Orphan_output_section::set_section_addresses): Likewise.
11573
11574 2009-10-15  Doug Kwan  <dougkwan@google.com>
11575
11576         * layout.cc (Layout::finish_dynamic_section): Generate tags
11577         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
11578         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
11579         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
11580
11581 2009-10-14  Ian Lance Taylor  <iant@google.com>
11582
11583         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
11584         fields.
11585         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
11586         data_shdr fields of relinfo.
11587         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
11588         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
11589         R_386_TLS_LDO_32, adjust based on section flags.
11590         (Target_i386::Relocate::fix_up_ldo): Remove.
11591
11592 2009-10-13  Ian Lance Taylor  <iant@google.com>
11593
11594         Add support for -pie.
11595         * options.h (class General_options): Add -pie and
11596         --pic-executable.
11597         (General_options::output_is_position_independent): Test -pie.
11598         (General_options::output_is_executable): Return true if not shared
11599         and not relocatable.
11600         (General_options::output_is_pie): Remove.
11601         * options.cc (General_options::finalize): Reject incompatible uses
11602         of -pie.
11603         * gold.cc (queue_middle_tasks): A -pie link is not static.
11604         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
11605         * symtab.cc (Symbol::final_value_is_known): Return false if
11606         output_is_position_independent.
11607         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
11608         output_is_position_independent.
11609         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
11610         output_is_position_independent.
11611         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
11612         output_is_position_independent.
11613         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
11614         two_file_pie_test.
11615         (basic_pie_test.o, basic_pie_test): New targets.
11616         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
11617         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
11618         (two_file_pie_test): New target.
11619         * testsuite/Makefile.in: Rebuild.
11620         * README: Remove note saying that -pie is not supported.
11621
11622 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
11623
11624         * options.h (class General_options): Add -init and -fini.
11625         * layout.cc (Layout::finish_dynamic_section): Emit
11626         given init and fini functions.
11627
11628 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
11629
11630         * gc.h (gc_process_relocs): Check if icf is enabled using new
11631         function.
11632         * gold.cc (queue_initial_tasks): Likewise.
11633         (queue_middle_tasks): Likewise.
11634         * object.cc (do_layout): Likewise.
11635         * symtab.cc (is_section_folded): Likewise.
11636         * main.cc (main): Likewise.
11637         * reloc.cc (Read_relocs::run): Likewise.
11638         (Sized_relobj::do_scan_relocs): Likewise.
11639         * icf.cc (is_function_ctor_or_dtor): New function.
11640         (Icf::find_identical_sections): Check if function is ctor or dtor when
11641         safe icf is chosen.
11642         * options.h (General_options::icf): Change option to be an enum.
11643         (Icf_status): New enum.
11644         (icf_enabled): New method.
11645         (icf_safe_folding): New method.
11646         (set_icf_status): New method.
11647         (icf_status_): New variable.
11648         * (options.cc) (General_options::finalize): Set icf_status_.
11649         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
11650         icf_test and icf_keep_unique_test to use the --icf enum flag.
11651         * testsuite/icf_safe_test.sh: New file.
11652         * testsuite/icf_safe_test.cc: New file.
11653
11654 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
11655
11656         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
11657         includes to gc.h and icf.h.
11658         * arm.cc: Include gc.h.
11659         * gold.cc: Likewise.
11660         * i386.cc: Likewise.
11661         * powerpc.cc: Likewise.
11662         * sparc.cc: Likewise.
11663         * x86_64.cc: Likewise.
11664         * gc.h: Include icf.h.
11665
11666 2009-10-11  Ian Lance Taylor  <iant@google.com>
11667
11668         * plugin.cc: Include "gold.h" before other header files.
11669
11670 2009-10-10  Chris Demetriou  <cgd@google.com>
11671
11672         * options.h (Input_file_argument::Input_file_type): New enum.
11673         (Input_file_argument::is_lib_): Replace with...
11674         (Input_file_argument::type_): New member.
11675         (Input_file_argument::Input_file_argument): Take Input_file_type
11676         'type' rather than boolean 'is_lib' as second argument.
11677         (Input_file_argument::is_lib): Use type_.
11678         (Input_file_argument::is_searched_file): New function.
11679         (Input_file_argument::may_need_search): Handle is_searched_file.
11680         * options.cc (General_options::parse_library): Support -l:filename.
11681         (General_options::parse_just_symbols): Update for Input_file_argument
11682         changes.
11683         (Command_line::process): Likewise.
11684         * archive.cc (Archive::get_file_and_offset): Likewise.
11685         * plugin.cc (Plugin_manager::release_input_file): Likewise.
11686         * script.cc (read_script_file, script_add_file): Likewise.
11687         * fileread.cc (Input_file::Input_file): Likewise.
11688         (Input_file::will_search_for): Handle is_searched_file.
11689         (Input_file::open): Likewise.
11690         * readsyms.cc (Read_symbols::get_name): Likewise.
11691         * testsuite/Makefile.am (searched_file_test): New test.
11692         * testsuite/Makefile.in: Regenerate.
11693         * testsuite/searched_file_test.cc: New file.
11694         * testsuite/searched_file_test_lib.cc: New file.
11695
11696 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11697             Ian Lance Taylor  <iant@google.com>
11698
11699         * descriptor.cc: Include <cstdio> and "binary-io.h".
11700         (Descriptors::open): Open the files in binary mode always.
11701         * script.cc (Lex::get_token): Treat \r as whitespace.
11702
11703 2009-10-09  Ian Lance Taylor  <iant@google.com>
11704
11705         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
11706
11707 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11708             Ian Lance Taylor  <iant@google.com>
11709
11710         * configure.ac: Check for readv function also.
11711         * fileread.cc (readv): Define if not HAVE_READV.
11712         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
11713         does not exist.
11714         * config.in: Regenerate.
11715         * configure: Regenerate.
11716
11717 2009-10-09  Doug Kwan  <dougkwan@google.com>
11718
11719         * layout.cc (Layout::make_output_section): Call target hook to make
11720         ordinary output section.
11721         (Layout::finalize): Adjust parameter list of call the
11722         Target::may_relax().
11723         * layout.h (class Layout::section_list): New method.
11724         * merge.h (Output_merge_base::entsize): Change visibility to public.
11725         (Output_merge_base::is_string, Output_merge_base::do_is_string):
11726         New methods.
11727         (Output_merge_string::do_is_string): New method.
11728         * object.cc (Sized_relobj::do_setup): renamed from
11729         Sized_relobj::set_up.
11730         * object.h (Sized_relobj::adjust_shndx,
11731         Sized_relobj::initializ_input_to_output_maps,
11732         Sized_relobj::free_input_to_output_maps): Change visibilities to
11733         protected.
11734         (Sized_relobj::setup): Virtualize.
11735         (Sized_relobj::do_setup): New method declaration.
11736         (Sized_relobj::invalidate_section_offset,
11737         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
11738         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
11739         * options.cc (parse_int): New function.
11740         * options.h (parse_int): New declaration.
11741         (DEFINE_int): New macro.
11742         (stub_group_size): New option.
11743         * output.cc (Output_section::Output_section): Initialize memebers
11744         merge_section_map_, merge_section_by_properties_map_,
11745         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
11746         (Output_section::add_input_section): Handled deferred code-fill
11747         generation and remove an old comment.
11748         (Output_section::add_relaxed_input_section): New method definition.
11749         (Output_section::add_merge_input_section): Use merge section by
11750         properties map to speed to search.  Update merge section maps
11751         as appropriate.
11752         (Output_section::build_relaxation_map): New method definition.
11753         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
11754         Same.
11755         (Output_section::relax_input_section): Renamed to
11756         Output_section::convert_input_sections_to_relaxed_sections and change
11757         interface to take a vector of pointers to relaxed sections.
11758         (Output_section::find_merge_section,
11759         Output_section::find_relaxed_input_section): New method definitions.
11760         (Output_section::is_input_address_mapped,
11761         Output_section::output_offset, Output_section::output_address):
11762         Use output section data maps to speed up searching.
11763         (Output_section::find_starting_output_address): Add comments.
11764         (Output_section::do_write,
11765         Output_section::write_to_postprocessing_buffer): Do code-fill
11766         generation as appropriate.
11767         (Output_section::get_input_sections): Invalidate relaxed input section
11768         map.
11769         (Output_section::restore_states): Adjust type of checkpoint .
11770         Invalidate relaxed input section map.
11771         * output.h (Output_merge_base): New class declaration.
11772         (Input_section_specifier): New class defintion.
11773         (class Output_relaxed_input_section) Change base class to
11774         Output_section_data_build.
11775         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
11776         base class initializer.
11777         (Output_section::add_relaxed_input_section): New method declaration.
11778         (Output_section::Input_section): Change visibility to protected.
11779         (Output_section::Input_section::relobj,
11780         Output_section::Input_section::shndx): Handle relaxed input sections.
11781         Output_section::input_sections) Change visibility to protected.  Also
11782         define overload to return a non-const pointer.
11783         (Output_section::Merge_section_properties): New class defintion.
11784         (Output_section::Merge_section_by_properties_map,
11785         Output_section::Output_section_data_by_input_section_map,
11786         Output_section::Relaxation_map): New types.
11787         (Output_section::relax_input_section): Rename method to
11788         Output_section::convert_input_sections_to_relaxed_sections and change
11789         interface to take a vector of relaxed section pointers.
11790         (Output_section::find_merge_section,
11791         Output_section::find_relaxed_input_section,
11792         Output_section::build_relaxation_map,
11793         Output_section::convert_input_sections_in_list_to_relaxed_sections):
11794         New method declarations.
11795         (Output_section::merge_section_map_
11796         Output_section::merge_section_by_properties_map_,
11797         Output_section::relaxed_input_section_map_,
11798         Output_section::is_relaxed_input_section_map_valid_,
11799         Output_section::generate_code_fills_at_write_): New data members.
11800         * script-sections.cc
11801         (Output_section_element_input::set_section_addresses): Call
11802         current_data_size and addralign methods of relaxed input sections.
11803         (Orphan_output_section::set_section_addresses): Call current_data_size
11804         and addralign methods of relaxed input sections.
11805         * symtab.cc (Symbol_table::compute_final_value): Extract template
11806         from the body of Symbol_table::sized_finalize_symbol.
11807         (Symbol_table::sized_finalized_symbol): Call
11808         Symbol_table::compute_final_value.
11809         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
11810         (Symbol_table::compute_final_value): New templated method declaration.
11811         * target.cc (Target::do_make_output_section): New method defintion.
11812         * target.h (Target::make_output_section): New method declaration.
11813         (Target::relax): Add more parameters for input objects, symbol table
11814         and layout.  Adjust call to do_relax.
11815         (Target::do_make_output_section): New method declaration.
11816         (Target::do_relax): Add parameters for input objects, symbol table
11817         and layout.
11818
11819 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11820
11821         * pread.c: Include stdio.h.
11822
11823 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11824
11825         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
11826         defined.
11827
11828 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11829
11830         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
11831         Change read_shndx type to unsigned int.
11832         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
11833         int.
11834         (Sized_dwarf_line_info::read_line_mappings): Likewise.
11835         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
11836         Change read_shndx type to unsigned int.
11837         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
11838         int.
11839         (Sized_dwarf_line_info::read_line_mappings): Likewise.
11840         * layout.cc (Layout::create_symtab_sections): Cast the result of
11841         local_symcount * symsize to off_t in the gold_assert.
11842
11843 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11844
11845         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
11846         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
11847         R_ARM_BASE_ABS.
11848         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
11849         (Arm_relocate_functions::thm_abs5): New function.
11850         (Arm_relocate_functions::abs12): New function.
11851         (Arm_relocate_functions::abs16): New function.
11852         (Arm_relocate_functions::base_abs): New function.
11853         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
11854         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
11855         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
11856         R_ARM_BASE_ABS.
11857         (Scan::global): Likewise.
11858         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
11859         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
11860         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
11861         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
11862         R_ARM_BASE_ABS.
11863
11864 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11865
11866         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
11867         (Arm_relocate_functions::movt_prel): New function.
11868         (Arm_relocate_functions::thm_movw_prel_nc): New function.
11869         (Arm_relocate_functions::thm_movt_prel): New function.
11870         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
11871         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
11872         (Scan::global, Relocate::relocate): Likewise.
11873         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11874
11875 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
11876
11877         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
11878         Incremental_checker.
11879         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
11880         unsigned int.
11881         (class Incremental_inputs_header): New class.
11882         (Incremental_inputs_header_writer): Edit comment.
11883         (Incremental_inputs_entry): New class.
11884         (Incremental_inputs_entry_writer): Edit comment.
11885         (Sized_incremental_binary::do_find_incremental_inputs_section):
11886         Add *strtab_shndx parameter, fill it.
11887         (Sized_incremental_binary::do_check_inputs): New method.
11888         (Incremental_checker::can_incrementally_link_output_file): Use
11889         Sized_incremental_binary::check_inputs.
11890         (Incremental_inputs::report_command_line): Save command line in
11891         command_line_.
11892         * incremental.h:
11893         (Incremental_binary::find_incremental_inputs_section): New
11894         method.
11895         (Incremental_binary::do_find_incremental_inputs_section): Add
11896         strtab_shndx parameter.
11897         (Incremental_binary::do_check_inputs): New pure virtual method.
11898         (Sized_incremental_binary::do_check_inputs): Declare.
11899         (Incremental_checker::Incremental_checker): Add incremental_inputs
11900         parameter, use it to initialize incremental_inputs_.
11901         (Incremental_checker::incremental_inputs_): New field.
11902         (Incremental_checker::command_line): New method.
11903         (Incremental_checker::inputs): New method.
11904         (Incremental_checker::command_line_): New field.
11905
11906 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
11907
11908         * incremental.cc: Include <cstdarg> and "target-select.h".
11909         (vexplain_no_incremental): New function.
11910         (explain_no_incremental): New function.
11911         (Incremental_binary::error): New method.
11912         (Sized_incremental_binary::do_find_incremental_inputs_section): New
11913         method.
11914         (make_sized_incremental_binary): New function.
11915         (open_incremental_binary): New function.
11916         (can_incrementally_link_file): Add checks if output is ELF and has
11917         inputs section.
11918         * incremental.h: Include "elfcpp_file.h" and "output.h".
11919         (Incremental_binary): New class.
11920         (Sized_incremental_binary): New class.
11921         (open_incremental_binary): Declare.
11922         * object.cc (is_elf_object): Use
11923         elfcpp::Elf_recognizer::is_elf_file.
11924         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
11925         * output.h (Output_file::filesize): New method.
11926
11927 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11928
11929         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
11930         New function.
11931         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
11932         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
11933         function.
11934         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
11935         function.
11936         (Arm_relocate_functions::movw_abs_nc): New function.
11937         (Arm_relocate_functions::movt_abs): New function.
11938         (Arm_relocate_functions::thm_movw_abs_nc): New function.
11939         (Arm_relocate_functions::thm_movt_abs): New function.
11940         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
11941         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
11942         (Scan::global): Likewise.
11943         (Relocate::relocate): Likewise.
11944         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11945
11946 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11947
11948         * arm.cc (Arm_relocate_functions::got_prel) New function.
11949         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
11950         (Relocate::relocate): Likewise.
11951         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11952
11953 2009-10-06  Ian Lance Taylor  <iant@google.com>
11954
11955         * options.h (class General_options): Define
11956         split_stack_adjust_size parameter.
11957         * object.h (class Object): Add uses_split_stack_ and
11958         has_no_split_stack_ fields.  Add uses_split_stack and
11959         has_no_split_stack accessor functions.  Declare
11960         handle_split_stack_section.
11961         (class Reloc_symbol_changes): Define.
11962         (class Sized_relobj): Define Function_offsets.  Declare
11963         split_stack_adjust, split_stack_adjust_reltype, and
11964         find_functions.
11965         * object.cc (Object::handle_split_stack_section): New function.
11966         (Sized_relobj::do_layout): Call handle_split_stack_section.
11967         * dynobj.cc (Sized_dynobj::do_layout): Call
11968         handle_split_stack_section.
11969         * reloc.cc (Sized_relobj::relocate_sections): Call
11970         split_stack_adjust for executable sections in split_stack
11971         objects.  Pass reloc_map to relocate_section.
11972         (Sized_relobj::split_stack_adjust): New function.
11973         (Sized_relobj::split_stack_adjust_reltype): New function.
11974         (Sized_relobj::find_functions): New function.
11975         * target-reloc.h: Include "object.h".
11976         (relocate_section): Add reloc_symbol_changes parameter.  Change
11977         all callers.
11978         * target.h (class Target): Add calls_non_split method.  Declare
11979         do_calls_non_split virtual method.  Declare match_view and
11980         set_view_to_nop.
11981         * target.cc: Include "elfcpp.h".
11982         (Target::do_calls_non_split): New function.
11983         (Target::match_view): New function.
11984         (Target::set_view_to_nop): New function.
11985         * gold.cc (queue_middle_tasks): Give an error if mixing
11986         split-stack and non-split-stack objects with -r.
11987         * i386.cc (Target_i386::relocate_section): Add
11988         reloc_symbol_changes parameter.
11989         (Target_i386::do_calls_non_split): New function.
11990         * x86_64.cc (Target_x86_64::relocate_section): Add
11991         reloc_symbol_changes parameter.
11992         (Target_x86_64::do_calls_non_split): New function.
11993         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
11994         parameter.
11995         * powerpc.cc (Target_powerpc::relocate_section): Add
11996         reloc_symbol_changes parameter.
11997         * sparc.cc (Target_sparc::relocate_section): Add
11998         reloc_symbol_changes parameter.
11999         * configure.ac: Call AM_CONDITIONAL for the default target.
12000         * configure: Rebuild.
12001         * testsuite/Makefile.am (TEST_AS): New variable.
12002         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
12003         (check_DATA): Add split_i386 and split_x86_64 files.
12004         (SPLIT_DEFSYMS): Define.
12005         (split_i386_[1234n].o): New targets.
12006         (split_i386_[124]): New targets.
12007         (split_i386_[1234r].stdout): New targets.
12008         (split_x86_64_[1234n].o): New targets.
12009         (split_x86_64_[124]): New targets.
12010         (split_x86_64_[1234r].stdout): New targets.
12011         (MOSTLYCLEANFILES): Add new executables.
12012         * testsuite/split_i386.sh: New file.
12013         * testsuite/split_x86_64.sh: New file.
12014         * testsuite/split_i386_1.s: New file.
12015         * testsuite/split_i386_2.s: New file.
12016         * testsuite/split_i386_3.s: New file.
12017         * testsuite/split_i386_4.s: New file.
12018         * testsuite/split_i386_n.s: New file.
12019         * testsuite/split_x86_64_1.s: New file.
12020         * testsuite/split_x86_64_2.s: New file.
12021         * testsuite/split_x86_64_3.s: New file.
12022         * testsuite/split_x86_64_4.s: New file.
12023         * testsuite/split_x86_64_n.s: New file.
12024         * testsuite/testfile.cc (Target_test): Update relocation_section
12025         function.
12026         * testsuite/Makefile.in: Rebuild.
12027
12028 2009-10-06  Ian Lance Taylor  <iant@google.com>
12029
12030         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
12031         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
12032         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
12033         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
12034         the address on ldo_addrs_.
12035         (Target_i386::Relocate::fix_up_ldo): New function.
12036
12037 2009-10-06   Rafael Espindola  <espindola@google.com>
12038
12039         * plugin.cc (add_input_library): New.
12040         (Plugin::load): Add add_input_library to tv.
12041         (Plugin_manager::add_input_file): Add the is_lib argument.
12042         (add_input_file): Update call to Plugin_manager::add_input_file.
12043         (add_input_library): New.
12044         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
12045
12046 2009-09-30  Doug Kwan  <dougkwan@google.com>
12047
12048         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
12049         symbol and call Symbol::may_need_copy_reloc to determine if
12050         a copy reloc is needed.
12051         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
12052         nocopyreloc is given in command line.
12053         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
12054         given in command line.
12055         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
12056         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
12057         of the removed Target_i386::may_need_copy_reloc.
12058         * options.h (copyreloc): New option with default value false.
12059         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
12060         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
12061         instead of the removed Target_powerpc::may_need_copy_reloc.
12062         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
12063         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
12064         instead of the removed Target_sparc::may_need_copy_reloc.
12065         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
12066         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
12067         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
12068         instead of the removed Target_x86_64::may_need_copy_reloc.
12069
12070 2009-09-30  Ian Lance Taylor  <iant@google.com>
12071
12072         * object.h (class Object): Remove target_ field, and target,
12073         sized_target, and set_target methods.
12074         (Object::sized_target): Remove.
12075         (class Sized_relobj): Update declarations.  Remove sized_target.
12076         * object.cc (Sized_relobj::setup): Remove target parameter.
12077         Change all callers.
12078         (Input_objects::add_object): Don't do anything with the target.
12079         (make_elf_sized_object): Add punconfigured parameter.  Change all
12080         callers.  Set or test parameter target.
12081         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
12082         Change all callers.
12083         * parameters.cc (Parameters::set_target): Change parameter type to
12084         be non-const.
12085         (Parameters::default_target): Remove.
12086         (set_parameters_target): Change parameter type to be non-const.
12087         (parameters_force_valid_target): New function.
12088         (parameters_clear_target): New function.
12089         * parameters.h (class Parameters): Update declarations.  Remove
12090         default_target method.  Add sized_target and clear_target
12091         methods.  Change target_ to be non-const.
12092         (set_parameters_target): Update declaration.
12093         (parameters_force_valid_target): Declare.
12094         (parameters_clear_target): Declare.
12095         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
12096         as NULL if we aren't searching.
12097         (Add_symbols::run): Don't check for compatible target.
12098         * fileread.cc (Input_file::open_binary): Call
12099         parameters_force_valid_target.
12100         * gold.cc (queue_middle_tasks): Likewise.
12101         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
12102         set_target on object.
12103         * dynobj.h (class Sized_dynobj): Update declarations.
12104         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
12105         make_elf_object returns NULL.
12106         (Archive::include_member): Don't check whether object target is
12107         compatible.
12108         * output.cc (Output_section::add_input_section): Get target from
12109         parameters.
12110         (Output_section::relax_input_section): Likewise.
12111         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
12112         parameters.
12113         (Sized_relobj::do_scan_relocs): Likewise.
12114         (Sized_relobj::relocate_sections): Likewise.
12115         * resolve.cc (Symbol_table::resolve): Likewise.
12116         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
12117         parameter.  Change all callers.
12118         (Symbol_table::add_from_object): Get target from parameters.
12119         (Symbol_table::add_from_relobj): Don't check object target.
12120         (Symbol_table::add_from_dynobj): Likewise.
12121         (Symbol_table::define_special_symbol): Get target from
12122         parameters.
12123         * symtab.h (class Symbol_table): Update declaration.
12124         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
12125         parameter.  Change all callers.  Clear parameter target.
12126         (Binary_test): Test target here.
12127         * testsuite/object_unittest.cc (gold_testsuite): Remove
12128         target_test_pointer parameter.  Change all callers.
12129         (Object_test): Test target here.
12130
12131 2009-09-26  Ian Lance Taylor  <iant@google.com>
12132
12133         * testsuite/initpri1.c: Don't try to use constructor priorities if
12134         compiling with gcc before 4.3.
12135
12136 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
12137
12138         * testsuite/retain_symbols_file_test.sh (check_present): Change
12139         output file name to retain_symbols_file_test.stdout.
12140         (check_absent): Likewise.
12141
12142 2009-09-18  Craig Silverstein  <csilvers@google.com>
12143
12144         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
12145         * options.cc: Include <cerrno> and <fstream>.
12146         (General_options::finalize): Parse -retain-symbols-file tag.
12147         * options.h: New flag.
12148         (General_options): New method should_retain_symbol, new
12149         variable symbols_to_retain.
12150         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
12151         should_retain_symbol map.
12152         * testsuite/Makefile.am (retain_symbols_file_test): New test.
12153         * testsuite/Makefile.in: Regenerate.
12154         * testsuite/retain_symbols_file_test.sh: New file.
12155
12156 2009-09-18  Nick Clifton  <nickc@redhat.com>
12157
12158         * po/es.po: Updated Spanish translation.
12159
12160 2009-09-17  Doug Kwan  <dougkwan@google.com>
12161
12162         * debug.h (DEBUG_RELAXATION): New constant.
12163         (DEBUG_ALL): Add DEBUG_RELAXATION.
12164         (debug_string_to_enum): Add relaxation debug option.
12165         * layout.cc
12166         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
12167         Layout::Relaxation_debug_check::read_sections,
12168         Layout::Relaxation_debug_check::read_sections): New method definitions.
12169         (Layout::Layout): Initialize data members
12170         record_output_section_data_from_scrips_,
12171         script_output_section_data_list_ and relaxation_debug_check_.
12172         (Layout::save_segments, Layout::restore_segments,
12173         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
12174         Layout::relaxation_loop_body): New method definitions.
12175         (Layout::finalize): Support relaxation.  Move section layout code to
12176         Layout::relaxation_loop_body.
12177         (Layout::set_asection_address_from_script): Move code for orphan
12178         section placement out.
12179         (Layout::place_orphan_sections_in_script): New method definition.
12180         * layout.h (Output_segment_headers, Output_file_header):
12181         New forward class declarations.
12182         (Layout::~Layout): Define.
12183         (Layout::new_output_section_data_from_script): New method definition.
12184         (Layout::place_orphan_sections_in_script): New method declaration.
12185         (Layout::Segment_states): New type declaration.
12186         (Layout::save_segments, Layout::restore_segments,
12187         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
12188         Layout::relaxation_loop_body): New method declarations.
12189         (Layout::Output_section_data_list): New type declaration.
12190         (Layout::Relaxation_debug_check): New class definition.
12191         (Layout::record_output_section_data_from_script_,
12192         Layout::script_output_section_data_list_, Layout::segment_states_,
12193         Layout::relaxation_debug_check_): New data members.
12194         * output.cc: (Output_section_headers::do_size): New method definition.
12195         (Output_section_headers::Output_section_headers): Move size
12196         computation to Output_section_headers::do_size.
12197         (Output_segment_headers::do_size): New method definition.
12198         (Output_file_header::Output_file_header): Move size computation to
12199         Output_file_header::do_size and call it.
12200         (Output_file_header::do_size): New method definition.
12201         (Output_data_group::Output_data_group): Adjust call to
12202         Output_section_data.
12203         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
12204         (Output_symtab_xindex::do_write): Add array bound check.
12205         (Output_section::Input_section::print_to_mapfile): Handle
12206         RELAXED_INPUT_SECTION_CODE.
12207         (Output_section::Output_section): Initialize data member checkpoint_.
12208         (Output_section::~Output_section): Delete checkpoint object pointed
12209         by checkpoint_.
12210         (Output_section::add_input_section): Always add an Input_section if
12211         relaxing.
12212         (Output_section::add_merge_input_section): Add assert.
12213         (Output_section::relax_input_section): New method definition.
12214         (Output_section::set_final_data_size): Set load address to zero for
12215         an unallocated section.
12216         (Output_section::do_address_and_file_offset_have_reset_values):
12217         New method definition.
12218         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
12219         Handle relaxed input section.
12220         (Output_section::sort_attached_input_sections): Checkpoint input
12221         section list lazily.
12222         (Output_section::get_input_sections): Change type of input_sections to
12223         list of Simple_input_section pointers.  Checkpoint input section list
12224         lazily.  Also handle relaxed input sections.
12225         (Output_section::add_input_section_for_script): Take a reference to
12226         a Simple_input_section object instead of Relobj pointer and section
12227         index as parameter.  Handle relaxed input sections.
12228         (Output_section::save_states, Output_section::restore_states): New
12229         method definitions.
12230         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
12231         (Output_data::is_data_size_fixed): New method definition.
12232         (Output_data::reset_addresss_and_file_offset): Do not reset data size
12233         if it is fixed.
12234         (Output_data::address_and_file_offset_have_reset_values): New method
12235         definition.
12236         (Output_data::do_address_and_file_offset_have_reset_values): New method
12237         definition.
12238         (Output_data::set_data_size): Check that data size is not fixed.
12239         (Output_data::fix_data_size): New method definition.
12240         (Output_data::is_data_size_fixed_): New data member.
12241         (Output_section_headers::set_final_data_size): New method definition.
12242         (Output_section_headers::do_size): New method declaration.
12243         (Output_segment_headers::set_final_data_size): New method definition.
12244         (Output_segment_headers::do_size): New method declaration.
12245         (Output_file_header::set_final_data_size)::New method definition.
12246         (Output_file_header::do_size)::New method declaration.
12247         (Output_section_data::Output_section_data): Add new parameter
12248         is_data_size_fixed and use it to fix data size.
12249         (Output_data_const::Output_data_const): Adjust call to base class
12250         constructor and fix data size.
12251         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
12252         base class constructor and fix data size.
12253         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
12254         base class constructor and fix data size.
12255         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
12256         class constructor and fix data size.
12257         (Output_data_group::set_final_data_size): New method definition.
12258         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
12259         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
12260         class constructor and fix data size.
12261         (Output_relaxed_input_section): New class definition.
12262         (Output_section::Simple_input_section): New class definition.
12263         (Output_section::get_input_sections): Adjust parameter list.
12264         (Output_section::add_input_section_for_script): Same.
12265         (Output_section::save_states, Output_section::restore_states,
12266         Output_section::do_address_and_file_offset_have_reset_values,
12267         (Output_section::Input_section::Input_section): Handle
12268         RELAXED_INPUT_SECTION_CODE.  Add new overload for
12269         Output_relaxed_input_section.
12270         (Output_section::Input_section::is_input_section,
12271         Output_section::Input_section::set_output_section): Handle relaxed
12272         input section.
12273         (Output_section::Input_section::is_relaxed_input_section,
12274         Output_section::Input_section::output_section_data,
12275         Output_section::Input_section::relaxed_input_section): New method
12276         definitions.
12277         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
12278         value.
12279         (Output_section::Input_section::u1_): Update comments.
12280         (Output_section::Input_section::u2_): Add new union member poris.
12281         (Output_section::Checkpoint_output_section): New classs definition.
12282         (Output_section::relax_input_section): New method declaration.
12283         (Output_section::checkpoint_): New data member.
12284         (Output_segment): Update comments.
12285         (Output_segment::Output_segment): Un-privatize copy constructor.
12286         (Output_segment::operator=): Un-privatize.
12287         * script-sections.cc (Output_section_element::Input_section_list):
12288         Change element type to Output_section::Simple_input_section.
12289         (Output_section_element_dot_assignment::set_section_addresses):
12290         Register output section data for relaxation clean up.
12291         (Output_data_exression::Output_data_expression): Adjust call to base
12292         constructor to fix data size.
12293         (Output_section_element_data::set_section_addresses): Register
12294         Output_data_expression object for relaxation clean up.
12295         (struct Input_section_info): Replace Relobj pointer and section index
12296         pair with Output_section::Simple_input_section and Convert struct to a
12297         class.
12298         (Input_section_sorter::operator()): Adjust access to
12299         Input_section_info data member to use accessors.
12300         (Output_section_element_input::set_section_addresses): Use layout
12301         parameter.  Adjust code to use Output_section::Simple_input_section
12302         and Input_secction_info classes.  Register filler for relaxation
12303         clean up.
12304         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
12305         and section index pair with Output_section::Simple_input_section
12306         class.  Adjust code accordingly.
12307         (Phdrs_element::release_segment): New method definition.
12308         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
12309         segment list.
12310         (Script_sections::release_segments): New method definition.
12311         * gold/script-sections.h (Script_sections::release_segments): New
12312         method declaration.
12313         * gold/target.h (Target::may_relax, Target::relax,
12314         Target::do_may_relax, Target::do_relax): New method definitions.
12315
12316 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
12317
12318         * arm.cc (has_signed_unsigned_overflow): New function.
12319         (Arm_relocate_functions::abs8): New function.
12320         (Target_arm::Scan::local): Handle R_ARM_ABS8.
12321         (Target_arm::Scan::global): Likewise.
12322         (Target_arm::relocate::relocate): Likewise.
12323         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
12324         Likewise.
12325
12326 2009-09-16  Cary Coutant  <ccoutant@google.com>
12327
12328         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
12329         * testsuite/Makefile.in: Regenerate.
12330
12331 2009-09-11  Nick Clifton  <nickc@redhat.com>
12332
12333         * po/gold.pot: Updated by the Translation project.
12334
12335 2009-09-08  Cary Coutant  <ccoutant@google.com>
12336
12337         * output.cc (Output_file::open): Add execute permission to empty file.
12338         * testsuite/Makefile.am (permission_test): New test.
12339         * testsuite/Makefile.in: Regenerate.
12340
12341 2009-09-02  Ian Lance Taylor  <iant@google.com>
12342
12343         * output.cc (Output_file::resize): Call map_no_anonymous rather
12344         than map.
12345
12346 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
12347
12348         * gold.cc: Include "incremental.h".
12349         (queue_initial_tasks): Call Incremental_checker methods.
12350         * incremental.cc: Include "output.h".
12351         (Incremental_checker::can_incrementally_link_output_file): New
12352         method.
12353         * incremental.h (Incremental_checker): New class.
12354
12355         * output.cc (Output_file::open_for_modification): New method.
12356         (Output_file::map_anonymous): Changed return type to bool.  Record
12357         map in base_ field.
12358         (Output_file::map_no_anonymous): New method, broken out of map.
12359         (Output_file::map): Use map_no_anonymous and map_anonymous.
12360         * output.h (class Output_file): Update declarations.
12361
12362 2009-08-24  Cary Coutant  <ccoutant@google.com>
12363
12364         * options.h (Command_line::Pre_options): New class.
12365         (Command_line::pre_options): New member.
12366         * options.cc (gold::options::ready_to_register): New variable.
12367         (One_option::register_option): Do nothing if not registering options.
12368         Assert if same short option registered twice.
12369         (General_options::General_options): Turn off option registration when
12370         done constructing.
12371         (Command_line::Pre_options::Pre_options): New constructor.
12372
12373 2009-08-24  Cary Coutant  <ccoutant@google.com>
12374
12375         * options.h (General_options::no_keep_memory): Remove incorrect
12376         short option.
12377
12378 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
12379
12380         * Makefile.am (am__skiplex, am__skipyacc): New.
12381         * Makefile.in: Regenerate.
12382
12383 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
12384
12385         * Makefile.am (AM_CPPFLAGS): Renamed from ...
12386         (INCLUDES): ... this.
12387         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
12388         (AM_CPPFLAGS): Renamed from ...
12389         (INCLUDE): ... this.
12390         * Makefile.in, testsuite/Makefile.in: Regenerate.
12391
12392         * Makefile.in: Regenerate.
12393         * aclocal.m4: Likewise.
12394         * config.in: Likewise.
12395         * configure: Likewise.
12396         * testsuite/Makefile.in: Likewise.
12397
12398         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
12399         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
12400         * Makefile.in: Regenerate.
12401         * testsuite/Makefile.in: Regenerate.
12402
12403 2009-08-19  Cary Coutant  <ccoutant@google.com>
12404
12405         * resolve.cc (Symbol_table::resolve): Don't complain about defined
12406         symbols in shared libraries overridden by hidden or internal symbols
12407         in the main program.
12408
12409 2009-08-19  Chris Demetriou  <cgd@google.com>
12410
12411         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
12412         checking source file names in error messages.
12413
12414 2009-08-18  Doug Kwan  <dougkwan@google.com>
12415
12416         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
12417         an elcpp::Ehdr as parameter.  Adjust call to set_target.
12418         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
12419         an elfcpp::Ehdr as parameter.
12420         * object.cc (Object::set_target): Remove the version that looks up
12421         a target and sets it.
12422         (Sized_relobj::setup): Take a Target object instead of
12423         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
12424         (make_elf_sized_object): Find target and ask target to
12425         make an ELF object.
12426         * object.h: (Object::set_target): Remove the version that looks up
12427         a target and sets it.
12428         (Sized_relobj::setup): Take a Target object instead of
12429         an elfcpp:Ehdr as parameter.
12430         * target.cc: Include dynobj.h.
12431         (Target::do_make_elf_object_implementation): New.
12432         (Target::do_make_elf_object): New.
12433         * target.h (Target::make_elf_object): New template declaration.
12434         (Target::do_make_elf_object): New method declarations.
12435         (Target::do_make_elf_object_implementation): New template declaration.
12436
12437 2009-08-14  Ian Lance Taylor  <iant@google.com>
12438
12439         * gold.h (FUNCTION_NAME): Define.
12440         (gold_unreachable): Use FUNCTION_NAME.
12441
12442 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
12443
12444         * icf.cc (Icf::find_identical_sections): Issue a warning when a
12445         symbol in the --keep-unique list is not found.
12446
12447 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
12448
12449         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
12450         been maked as --keep-unique.
12451         (Icf::unfold_section): New function.
12452         * icf.h (Icf::unfold_section): New function.
12453         * options.h (General_options::keep_unique): New option.
12454         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
12455         * testsuite/Makefile.in: Regenerate.
12456         * testsuite/icf_keep_unique_test.sh: New file.
12457         * testsuite/icf_keep_unique_test.cc: New file.
12458
12459 2009-08-12  Cary Coutant  <ccoutant@google.com>
12460
12461         PR 10471
12462         * resolve.cc (Symbol_table::resolve): Check for references from
12463         dynamic objects to hidden and internal symbols.
12464         * testsuite/Makefile.am (hidden_test.sh): New test.
12465         * testsuite/Makefile.in: Regenerate.
12466         * testsuite/hidden_test.sh: New script.
12467         * testsuite/hidden_test_1.c: New test source.
12468         * testsuite/hidden_test_main.c: New test source.
12469
12470 2009-08-11  Doug Kwan  <dougkwan@google.com>
12471
12472         * arm.cc: Update comments.
12473         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
12474         segment to locate the .ARM.exidx section if present.
12475
12476 2009-08-09  Doug Kwan  <dougkwan@google.com>
12477
12478         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
12479         patch.
12480
12481 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
12482         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
12483         compiler warnings.
12484
12485 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
12486
12487         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
12488         valid tls_segment only for non-debug-section relocations.
12489         * testsuite/Makefile.am: Add gc_tls_test.
12490         * testsuite/Makefile.in: Regenerate.
12491         * testsuite/gc_tls_test.cc: New file.
12492         * testsuite/gc_tls_test.sh: New file.
12493
12494 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
12495
12496         * icf.cc: New file.
12497         * icf.h: New file.
12498         * Makefile.am (CCFILES): Add icf.cc.
12499         (HFILES): Add icf.h
12500         * Makefile.in: Regenerate.
12501         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
12502         * gc.h (gc_process_relocs): Populate lists used by icf to contain
12503         section, symbol and addend information for the relocs.
12504         * gold.cc (queue_middle_tasks): Call identical code folding.
12505         * gold.h: Add defines for multimap.
12506         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
12507         to the call of finalize_local_symbols.
12508         * main.cc (main): Create object of class Icf.
12509         * object.cc (Sized_relobj::do_layout): Allow this function to be
12510         called twice during icf.
12511         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
12512         to sections marked as identical by icf.
12513         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
12514         when available.
12515         (Sized_relobj::do_section_entsize): New function.
12516         * object.h (Object::section_entsize): New function.
12517         (Object::do_section_entsize): New pure virtual function.
12518         (Relobj::finalize_local_symbols): Add new parameter.
12519         (Relobj::do_section_entsize): New function.
12520         * options.h (General_options::icf): New option.
12521         (General_options::icf_iterations): New option.
12522         (General_options::print_icf_sections): New option.
12523         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
12524         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
12525         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
12526         icf.
12527         * symtab.cc (Symbol_table::is_section_folded): New function.
12528         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
12529         to sections marked as identical by icf.
12530         * symtab.h (Symbol_table::set_icf): New function.
12531         (Symbol_table::icf): New function.
12532         (Symbol_table::is_section_folded): New function.
12533         (Symbol_table::icf_): New data member.
12534         * target-reloc.h (relocate_section): Ignore sections folded by icf.
12535         * testsuite/Makefile.am: Add commands to build icf_test.
12536         * testsuite/Makefile.in: Regenerate.
12537         * testsuite/icf_test.sh: New file.
12538         * testsuite/icf_test.cc: New file.
12539
12540 2009-07-24  Chris Demetriou  <cgd@google.com>
12541
12542         * layout.cc (is_compressible_debug_section): Fix incorrect
12543         comment about compressed section names.
12544
12545 2009-07-20  Ian Lance Taylor  <ian@airs.com>
12546
12547         PR 10419
12548         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
12549
12550 2009-07-16  Ian Lance Taylor  <iant@google.com>
12551
12552         PR 10400
12553         * layout.h: #include <map>.
12554         (class Kept_section): Change from struct to class.  Add accessors
12555         and setters.  Add section size to Comdat_group mapping.  Change
12556         Comdat_group to std::map.  Add is_comdat_ field.  Add
12557         linkonce_size field in union.
12558         (class Layout): Update declaration of find_or_add_kept_section.
12559         Don't declare find_kept_object.
12560         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
12561         parameter.  Add object, shndx, is_comdat, and is_group_name
12562         parameters.  Change all callers.  Adjust for new Kept_section.
12563         (Layout::find_kept_object): Remove.
12564         * object.cc (Sized_relobj::include_section_group): Update use of
12565         Kept_section.  Rename secnum to shndx.  Only record
12566         Kept_comdat_section if sections are the same size.
12567         (Sized_relobj::include_linkonce_section): Update use of
12568         Kept_section.  Only record Kept_comdat_section if sections are the
12569         same size.  Set size of linkonce section.
12570         (Sized_relobj::map_to_kept_section): Update call to
12571         get_kept_comdat_section.
12572         * object.h (class Sized_relobj): Rename fields in
12573         Kept_comdat_section to drop trailing underscores; change object
12574         field to Relobj*.  Change Kept_comdat_section_table to store
12575         struct rather than pointer.
12576         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
12577         Add kept_object and kept_shndx parameters.  Change all callers.
12578         (Sized_relobj::get_kept_comdat_section): Change return type to
12579         bool.  Add kept_object and kept_shndx parameters.  Change all
12580         callers.
12581         * plugin.cc (Pluginobj::include_comdat_group): Update call to
12582         Layout::find_or_add_kept_section.
12583
12584 2009-07-09  Ian Lance Taylor  <iant@google.com>
12585
12586         * merge.cc (Object_merge_map::initialize_input_to_output_map):
12587         Reserve space in the hash table.
12588
12589 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
12590
12591         * fileread.cc (File_read::get_mtime): New method.
12592         * fileread.h (Timespec): New structure.
12593         (File_read::get_mtime): New method.
12594         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
12595         Renamed from timestamp_nsec.
12596         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
12597         Elf_Xword.
12598         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
12599         timestamp_nsec.
12600         (Incremental_inputs::report_archive): Save mtime; style fix.
12601         (Incremental_inputs::report_obejct): Save mtime; style fix.
12602         (Incremental_inputs::report_script): Save mtime; style fix.
12603         (Incremental_inputs::finalize_inputs): Style fix.
12604         (Incremental_inputs::finalize): Style fix.
12605         (Incremental_inputs::create_input_section_data): Store inputs
12606         mtime.
12607         * incremental.h (Incremental_inputs::report_script): Add mtime
12608         argument.
12609         (Incremental_inputs::Input_info::Input_info): Intialize only one
12610         union member.
12611         (Incremental_inputs::Input_info::archive): Move to nameless
12612         union.
12613         (Incremental_inputs::Input_info::obejct): Move to nameless union.
12614         (Incremental_inputs::Input_info::script): Move to nameless union.
12615         (Incremental_inputs::mtime): New field.
12616         * script.cc (read_input_script): Pass file mtime to
12617         Incremental_input.
12618         * script.h (Script_info::inputs): Style fix.
12619
12620 2009-07-01  Ian Lance Taylor  <ian@airs.com>
12621
12622         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
12623         instead of 32.
12624
12625 2009-06-24  Ian Lance Taylor  <iant@google.com>
12626
12627         PR 10156
12628         * layout.cc (Layout::choose_output_section): If we find an
12629         existing section, update the flags.
12630         (Layout::create_notes): New function, broken out of
12631         Layout::finalize.
12632         (Layout::finalize): Don't create note sections.
12633         (Layout::create_note): Don't crash if linker script discards
12634         section.
12635         (Layout::create_gold_note): Likewise.
12636         (Layout::create_build_id): Likewise.  Don't set
12637         after_input_sections on the section.
12638         (Layout::create_executable_stack_info): Remove target parameter.
12639         Change caller.
12640         * layout.h (class Layout): Declare create_notes.  Update
12641         declaration of create_executable_stack_info.
12642         * gold.cc (queue_middle_tasks): Call create_notes.
12643         * output.cc (Output_section::update_flags_for_input_section): Move
12644         here from output.h.  If SHF_ALLOC flag is newly set, mark address
12645         invalid.
12646         * output.h (Output_data::mark_address_invalid): New function.
12647         (class Output_section): Only declare, not define,
12648         update_flags_for_input_section.  Remove set_flags.
12649
12650 2009-06-24  Ian Lance Taylor  <iant@google.com>
12651
12652         * script-sections.cc (Output_section_definition::
12653         set_section_addresses): Rename shadowing local load_address to
12654         laddr.
12655
12656 2009-06-24  Ian Lance Taylor  <iant@google.com>
12657
12658         PR 10244
12659         * reloc.cc (relocate_sections): Skip empty relocation sections.
12660
12661 2009-06-23  Ian Lance Taylor  <iant@google.com>
12662
12663         PR 10156
12664         * layout.cc (Layout::create_note): Use choose_output_section
12665         rather than make_output_section.
12666
12667 2009-06-23  Ian Lance Taylor  <iant@google.com>
12668
12669         PR 10237
12670         * options.cc (General_options::parse_V): Set printed_version_.
12671         (General_options::General_options): Initialize printed_version_.
12672         * options.h (class General_options): Add printed_version_ field.
12673         * gold.cc (queue_initial_tasks): If there are no input files,
12674         don't give a fatal error if we printed the version information.
12675         (queue_middle_tasks): If using -r with a shared object, give a
12676         fatal error rather than an ordinary error.
12677
12678 2009-06-23  Ian Lance Taylor  <iant@google.com>
12679
12680         PR 10219
12681         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
12682         (Layout::make_output_section): Set have_stabstr_section_ if we see
12683         a .stab*str section.
12684         (Layout::finalize): Call link_stabs_sections.
12685         (Layout::link_stabs_sections): New file.
12686         * layout.h (class Layout): Add have_stabstr_section_ field.
12687         Declare link_stabs_sections.
12688
12689 2009-06-23  Doug Kwan  <dougkwan@google.com>
12690
12691         * Makefile.am (libgold_a_LIBADD): New.
12692         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
12693         * Makefile.in: Regenerate.
12694         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
12695         * configure: Regenerate.
12696         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
12697         * fileread.cc: Include sys/state.h
12698         * gold.h: Declare memmem and strndup if found missing.
12699         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
12700
12701 2009-06-23  Ian Lance Taylor  <iant@google.com>
12702
12703         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
12704         * configure: Rebuild.
12705
12706 2009-06-23  Ian Lance Taylor  <iant@google.com>
12707
12708         PR 10147
12709         * object.cc (Object::section_contents): Don't try to get a view if
12710         the section has length zero.
12711         (Object::handle_gnu_warning_section): If the section is empty, use
12712         the name of the section as the warning.
12713
12714 2009-06-23  Ian Lance Taylor  <iant@google.com>
12715
12716         PR 10133
12717         * stringpool.h (class Stringpool_template): Add optimize_ field.
12718         (Stringpool_template::set_optimize): New function.
12719         * stringpool.cc (Stringpool_template::Stringpool_template):
12720         Initialize optimize_ field.
12721         (Stringpool_template::set_string_offsets): Test local optimize
12722         fild rather than parameter.
12723         * layout.cc (Layout::Layout): Call set_optimize on the section
12724         name stringpool.
12725
12726 2009-06-22  Ian Lance Taylor  <iant@google.com>
12727
12728         PR 10030
12729         * yyscript.y: Parse TARGET.
12730         * script.cc (script_set_target): New function.
12731         * script-c.h (script_set_target): Declare.
12732         * options.cc (General_options::string_to_object_format): Rename
12733         from string_to_object_format in anonymous namespace.  Change
12734         callers.
12735         * options.h (class General_options): Declare
12736         string_to_object_format.
12737
12738 2009-06-22  Ian Lance Taylor  <iant@google.com>
12739
12740         * script-sections.cc (Script_sections::create_segments): Don't put
12741         program headers in a PT_LOAD segment if -n or -N.
12742
12743 2009-06-22  Ian Lance Taylor  <iant@google.com>
12744
12745         PR 10141
12746         * options.h (class General_options): Add -z lazy and -z now.  Sort
12747         -z options into alphabetical order.
12748         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
12749
12750 2009-06-21  Ian Lance Taylor  <iant@google.com>
12751
12752         * layout.cc (Layout::make_output_section): Call
12753         Target::new_output_section.
12754         (Layout::attach_allocated_section_to_segment): Put large section
12755         sections in a separate load segment with the large segment flag
12756         set.
12757         (Layout::segment_precedes): Sort large data segments after other
12758         load segments.
12759         (align_file_offset): New static function.
12760         (Layout::set_segment_offsets): Use align_file_offset.
12761         * output.h (class Output_section): Add is_small_section_ and
12762         is_large_section_ fields.
12763         (Output_section::is_small_section): New function.
12764         (Output_section::set_is_small_section):  New function.
12765         (Output_section::is_large_section): New function.
12766         (Output_section::set_is_large_section): New function.
12767         (Output_section::is_large_data_section): New function.
12768         (class Output_segment): Add is_large_data_segment_ field.
12769         (Output_segment::is_large_data_segment): New function.
12770         (Output_segment::set_is_large_data_segment): New function.
12771         * output.cc (Output_section::Output_section): Initialize new
12772         fields.
12773         (Output_segment::Output_segment): Likewise.
12774         (Output_segment::add_output_section): Add assertion that large
12775         data sections always go in large data segments.  Force small data
12776         sections to the end of the list of data sections.  Force small BSS
12777         sections to the start of the list of BSS sections.  For large BSS
12778         sections to the end of the list of BSS sections.
12779         * symtab.h (class Symbol): Declare is_common_shndx.
12780         (Symbol::is_defined): Check Symbol::is_common_shndx.
12781         (Symbol::is_common): Likewise.
12782         (class Symbol_table): Define enum Commons_section_type.  Update
12783         declarations.  Add small_commons_ and large_commons_ fields.
12784         * symtab.cc (Symbol::is_common_shndx): New function.
12785         (Symbol_table::Symbol_table): Initialize new fields.
12786         (Symbol_table::add_from_object): Put small and large common
12787         symbols in the right list.
12788         (Symbol_table::sized_finalized_symbol): Check
12789         Symbol::is_common_shndx.
12790         (Symbol_table::sized_write_globals): Likewise.
12791         * common.cc (Symbol_table::do_allocate_commons): Allocate new
12792         common symbol lists.  Don't call do_allocate_commons_list if the
12793         list is empty.
12794         (Symbol_table::do_allocate_commons_list): Remove is_tls
12795         parameter.  Add comons_section_type parameter.  Change all
12796         callers.  Handle small and large common symbols.
12797         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
12798         Symbol::is_common_shndx.
12799         * resolve.cc (symbol_to_bits): Likewise.
12800         * target.h (Target::small_common_shndx): New function.
12801         (Target::small_common_section_flags): New function.
12802         (Target::large_common_shndx): New function.
12803         (Target::large_common_section_flags): New function.
12804         (Target::new_output_section): New function.
12805         (Target::Target_info): Add small_common_shndx, large_common_shndx,
12806         small_common_section_flags, and large_common_section_flags
12807         fields.
12808         (Target::do_new_output_section): New virtual function.
12809         * arm.cc (Target_arm::arm_info): Initialize new fields.
12810         * i386.cc (Target_i386::i386_info): Likewise.
12811         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
12812         Likewise.
12813         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
12814         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
12815         (Target_x86_64::do_new_output_section): New function.
12816         * configure.ac: Define conditional MCMODEL_MEDIUM.
12817         * testsuite/Makefile.am (check_PROGRAMS): Add large.
12818         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
12819         (large_LDFLAGS): Define.
12820         * testsuite/large.c: New file.
12821         * testsuite/testfile.cc (Target_test::test_target_info):
12822         Initialize new fields.
12823         * configure, testsuite/Makefile.in: Rebuild.
12824
12825 2009-06-05  Doug Kwan  <dougkwan@google.com>
12826
12827         * Makefile.am (CCFILES): Add target.cc.
12828         * Makefile.in: Regenerate.
12829         * i386.cc (class Target_i386): Define new virtual method to
12830         override do_is_local_label_name in parent.
12831         * object.cc (Sized_relobj::do_count_local_symbols): Discard
12832         local symbols if --discard-locals or -X is given.
12833         * options.h (class General_options): Declare new options
12834         '--discard-locals' and '-X' for discarding locals.
12835         * target.h (class Target): Define new methods is_local_label_name.
12836         Declare new virtual method do_is_local_label_name.
12837         * target.cc: New file.
12838         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
12839         (check_SCRIPTS): Add discard_locals_test.sh.
12840         (check_DATA): Add discard_local_tests.syms.
12841         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
12842         (discard_local_tests.syms, discard_locals_test.o): New make rules.
12843         * testsuite/Makefile.in: Regenerate.
12844         * testsuite/discard_locals_test.c: New file.
12845         * testsuite/discard_locals_test.sh: Same.
12846
12847 2009-06-05  Doug Kwan  <dougkwan@google.com>
12848
12849         * object.cc (Sized_relobj::Sized_relobj): Initialize
12850         discarded_eh_frame_shndx_ to -1U.
12851         (Sized_relobj::do_layout): Record index of a discard .eh_frame
12852         section.
12853         (Sized_relobj::do_count_local_symbols): Skip local symbols in
12854         a discarded .eh_frame section.
12855         (Sized_relobj::do_finalize_local_symbols): Ditto.
12856         * object.h (class Sized_relobj): Declare new member
12857         discarded_eh_frame_shndx_.
12858         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
12859         (local_labels_test.o, local_labels_test): New rules.
12860         * testsuite/Makefile.in: Regenerate.
12861
12862 2009-06-04  Doug Kwan  <dougkwan@google.com>
12863
12864         * layout.cc (Layout::section_name_mapping): Add mapping for
12865         special ARM sections.
12866
12867 2009-06-03  Doug Kwan  <dougkwan@google.com>
12868
12869         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
12870         (utils::has_overflow): Same.
12871
12872 2009-06-03  Ian Lance Taylor  <iant@google.com>
12873
12874         * layout.cc (Layout::section_name_mapping): New array, replacing
12875         Layout::linkonce_mapping.
12876         (Layout::section_name_mapping_count): New variable, replacing
12877         Layout::linkonce_mapping_count.
12878         (Layout::linkonce_output_name): Remove.
12879         (Layout::output_section_name): Rewrite.
12880         * layout.h (class Layout): Rename Linkonce_mapping to
12881         Section_name_mapping, linkonce_mapping to section_name_mapping,
12882         linkonce_mapping_count to section_name_mapping_count.  Don't
12883         declare linkonce_output_name.
12884
12885 2009-06-03  Doug Kwan  <dougkwan@google.com>
12886
12887         * gold/arm.cc (namespace utils): New.
12888         (Target_arm::reloc_is_non_pic): Define new method.
12889         (class Arm_relocate_functions): New.
12890         (Target_arm::Relocate::relocate): Handle relocation types used by
12891         Android.
12892
12893 2009-06-03  Ian Lance Taylor  <iant@google.com>
12894
12895         * arm.cc (Target_arm::scan::global): Use || instead of |.
12896
12897 2009-06-02  Doug Kwan  <dougkwan@google.com>
12898
12899         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
12900         issued_non_pic_error_.
12901         (class Target_arm::Scan): Declare new method check_non_pic.
12902         Define new method symbol_needs_plt_entry.
12903         Declare new data member issued_non_pic_error_.
12904         (class Target_arm::Relocate): Declare new method
12905         should_apply_static_reloc.
12906         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
12907         (Target_arm::Scan::check_non_pic): Define new method.
12908         (Target_arm::Scan::local): Handle a small subset of reloc types used
12909         by Android.
12910         (Target_arm::Scan::local): Same.
12911         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
12912
12913 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
12914
12915         * incremental.cc (Incremental_inputs::report_command_line): Filter
12916         out --incremental-* options.
12917
12918 2009-05-29  Doug Kwan  <dougkwan@google.com>
12919
12920         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
12921         template class.
12922         (class Target_arm): Update comment.
12923         (Target_arm::Target_arm): Initialize new data members GOT_,
12924         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
12925         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
12926         and Target_arm::rel_dyn_section.
12927         Declare new_enum Target_arm::Got_type.
12928         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
12929         and DYNBSS_.
12930         Update commments for member do_dynsym_value.
12931         (Target_arm::got_size, Target_arm::plt_section,
12932         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
12933         new methods inside class defintion.
12934         (Target_arm::got_section): Define new method.
12935         (Target_arm::rel_dyn_section): Same.
12936         (Output_data_plt_arm): New template class.
12937         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
12938         (Output_data_plt_arm:do_adjust_output_section): Define new method.
12939         (Output_data_plt_arm::add_entry): Same.
12940         (Output_data_plt_arm::first_plt_entry): Define new
12941         static data member for PLT instruction template.
12942         (Output_data_plt_arm::plt_entry): Same.
12943         (Output_data_plt_arm::do_write): Define new method.
12944         (Target_arm::make_plt_entry): Same.
12945         (Target_arm::do_finalize_sections): Same.
12946         (Target_arm::do_dynsym_value): Same.
12947
12948 2009-05-28  Doug Kwan  <dougkwan@google.com>
12949
12950         * Makefile.am (TARGETSOURCES): Add arm.cc.
12951         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
12952         * Makefile.in: Regenerate.
12953         * arm.cc: New file.
12954         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
12955
12956 2009-05-26  Doug Kwan  <dougkwan@google.com>
12957
12958         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
12959         (General_options::check_excluded_libs): Strip off directories in
12960         archive name before matching like GNU ld does.
12961         * testsuite/Makefile.am (MOSTLYCLEANFILES,
12962         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
12963         (exclude_libs_test_LDFLAGS): Add linker option
12964         -Wl,--exclude-libs,libexclude_libs_test_3
12965         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
12966         an explicit archive without using -l.
12967         (alt/libexclude_libs_test_3.a): New make rule.
12968         * testsuite/Makefile.in: Regenerate.
12969         * testsuite/exclude_libs_test.c : Declare lib3_default().
12970         (main): Call it.
12971         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
12972         * exclude_libs_test_3.c: New file.
12973
12974 2009-05-26  Nick Clifton  <nickc@redhat.com>
12975
12976         * po/id.po: New Indonesian translation.
12977         * po/gold.pot: Updated template file.
12978
12979 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
12980
12981         * testsuite/Makefile.am: Add -ffunction-sections to compile
12982         gc_comdat_test files.  Add -Wl,--gc-sections to build
12983         gc_comdat_test.
12984         * testsuite/Makefile.in: Regenerate.
12985         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
12986
12987 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
12988
12989         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
12990         kept comdat section was garbage collected.
12991         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
12992         * testsuite/Makefile.in: Regenerate.
12993         * testsuite/gc_comdat_test.sh: New file.
12994         * testsuite/gc_comdat_test_1.cc: New file.
12995         * testsuite/gc_comdat_test_2.cc: New file.
12996
12997 2009-05-19  Doug Kwan  <dougkwan@google.com>
12998
12999         * archive.cc (Archive::Archive): Move constructor from archive.h
13000         to here.  Initialize no_export_.
13001         (Archive::get_elf_object_for_member): Set no_export flag of object.
13002         * archive.h (Archive::Archive): Move constructor body to
13003         archive.cc.
13004         (Archive::no_export): New method.
13005         (Archive::no_export_): New field.
13006         * object.h (Object::Object): Initialize no_export_ to false.
13007         (Object::no_export, Object::set_no_export): New methods.
13008         (Object::no_export_): New field.
13009         * options.cc (General_options::parse_exclude_libs): New method.
13010         (General_options::check_excluded_libs) Same.
13011         * options.h (exclude_libs): New option.
13012         (General_options::check_excluded_libs): New method declaration.
13013         (General_options::excluded_libs_): New field.
13014         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
13015         default or protected visibility if an object has no-export flag set.
13016         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
13017         (check_SCRIPTS): Add exclude_libs_test.sh.
13018         (check_DATA): Add exclude_libs_test.syms.
13019         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
13020         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
13021         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
13022         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
13023         (exclude_libs_test.syms, libexclude_libs_test_1.a,
13024         libexclude_libs_test_2.a): New rules.
13025         * testsuite/Makefile.in: Regenerate.
13026         * testsuite/exclude_libs_test.c: New file.
13027         * testsuite/exclude_libs_test.sh: Ditto.
13028         * testsuite/exclude_libs_test_1.c: Ditto.
13029         * testsuite/exclude_libs_test_2.c: Ditto.
13030
13031 2009-05-15  Ian Lance Taylor  <iant@google.com>
13032
13033         * configure.ac: Check for declarations for cases where libiberty.h
13034         checks HAVE_DECL_xxx.
13035         * configure, config.in: Rebuild.
13036
13037 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
13038
13039         * gold.h (Incremental_argument_list): Remove (invalid) forward
13040         declaration.
13041         * incremental.cc (Incremental_inputs::report_achive): New method.
13042         (Incremental_inputs::report_object): New method.
13043         (Incremental_inputs::report_script): New method.
13044         (Incremental_inputs::finalize_inputs): New method.
13045         (Incremental_inputs::finalize): Call finalize_inputs().
13046         (Incremental_inputs::sized_create_incremental_inputs_section_data):
13047         Create inputs entries.
13048         * incremental.h (Incremental_input_type): New enum.
13049         (Incremental_inputs::Incremental_input): Initialize new fields.
13050         (Incremental_inputs::report_inputs): New method.
13051         (Incremental_inputs::report_achive): New method.
13052         (Incremental_inputs::report_object): New method.
13053         (Incremental_inputs::report_script): New method.
13054         (Incremental_inputs::finalize_inputs): New method.
13055         (Incremental_inputs::Input_info): New struct.
13056         (Incremental_inputs::Input_info_map): New typedef.
13057         (Incremental_inputs::lock_): New field.
13058         (Incremental_inputs::Inputs_): New field.
13059         (Incremental_inputs::Inputs_map): New field.
13060         * main.cc (main): Call Incremental_input::report_inputs.
13061         * options.h (Input_argument_list): Typedef moved from
13062         Input_arguments.
13063         (Input_file_group::Files): Remove, use ::Input_argument_list.
13064         (Input_file_group::Input_argument_list): Remove, use
13065         ::Input_argument_list.
13066         * plugin.cc (Plugin_manager::add_input_file): Add error in
13067         incremental build.
13068         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
13069         functions.
13070         * script.cc (read_input_script): Call
13071         Incremental_input::report_script.
13072         * script.h (Script_info): New class.
13073
13074 2009-04-27  Ian Lance Taylor  <iant@google.com>
13075
13076         * x86_64.cc (do_adjust_output_section): Set entsize to
13077         plt_entry_size.
13078
13079 2009-04-23  Elliott Hughes  <enh@google.com>
13080
13081         * output.cc (Output_file::close): After short writes, continue
13082         writing from the correct offset in the buffer being written.
13083
13084 2009-04-23  Chris Demetriou  <cgd@google.com>
13085
13086         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
13087         * configure: Regenerate.
13088         * config.in: Regenerate.
13089         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
13090         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
13091
13092 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
13093
13094         * incremental.cc (Incremental_inputs_header_data): Renamed from
13095         Incremental_input_header_data.
13096         (Incremental_inputs_header_data::data_size): New field.
13097         (Incremental_inputs_header_data::put_input_file_count): Renamed
13098         from input_file_count.
13099         (Incremental_inputs_header_data::put_command_line_offset): Renamed
13100         from command_line_offset.
13101         (Incremental_inputs_header_data::put_reserved): Renamed from
13102         put_reserved.
13103         (Incremental_inputs_entry_data): Renamed from
13104         Incremental_input_entry_data.
13105         (Incremental_inputs_entry_data::data_size): New field.
13106         (Incremental_inputs::report_command_line): New method.
13107         (Incremental_inputs::finalize): New method.
13108         (Incremental_inputs::create_incremental_inputs_data): New method.
13109         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
13110         * incremental.h: New file.
13111         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
13112         (Layout::finalize): Create incremental inputs section in
13113         incremental builds.
13114         (Layout::create_incremental_info_sections): New method.
13115         * layout.h (Layout::incremental_inputs): New method.
13116         (Layout::create_incremental_info_sections): New method.
13117         (Layout::incremental_inputs_): New field.
13118         * main.cc (main): Notify Incremental_input of the command line.
13119
13120 2009-04-01  Ian Lance Taylor  <iant@google.com>
13121             Mikolaj Zalewski  <mikolajz@google.com>
13122
13123         * gold.h (reserve_unordered_map): Define, three versions, one for
13124         each version of Unordered_map.
13125         * layout.cc (Layout::Layout): Remove options parameter.  Add
13126         number_of_input_files parameter.  Don't initialize options_.
13127         Initialize number_of_input_files_ and resized_signatures_.  Move
13128         sections_are_attached_.
13129         (Layout::layout_group): Reserve space for group_signatures_.
13130         (Layout::find_or_add_kept_section): Change name parameter to be a
13131         reference.  Resize signatures_ map when it gets large enough.
13132         (Layout::layout_eh_frame): Use parameters->options() instead of
13133         this->options_.
13134         (Layout::make_output_section): Likewise.
13135         (Layout::attach_allocated_section_to_segment): Likewise.
13136         (Layout::finalize, Layout::create_executable_stack): Likewise.
13137         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
13138         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
13139         * layout.h (class Layout): Update declarations.  Remove options_
13140         field.  Add number_of_input_files_ and resized_signatures_
13141         fields.  Move sections_are_attached_ field.
13142         * main.cc (main): Pass number of input files to Layout
13143         constructor.  Don't pass options.
13144
13145 2009-03-30  Ian Lance Taylor  <iant@google.com>
13146
13147         * ffsll.c (ffsll): Correct implementation.
13148
13149 2009-03-27  Ian Lance Taylor  <iant@google.com>
13150
13151         * ffsll.c: New file.
13152         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
13153         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
13154         * ftruncate.c (ftruncate): Declare before definition.
13155         * mremap.c (mremap): Likewise.
13156         * pread.c (pread): Likewise.
13157         * configure, Makefile.in, config.in: Rebuild.
13158
13159         * mremap.c: New file.
13160         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
13161         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
13162         (mremap): Declare if HAVE_MREMAP is not defined.
13163         * configure, Makefile.in, config.in: Rebuild.
13164
13165 2009-03-27  Cary Coutant  <ccoutant@google.com>
13166
13167         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
13168         position independent.
13169         * sparc.cc (Target_sparc::check_non_pic): Likewise.
13170         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
13171
13172 2009-03-24  Cary Coutant  <ccoutant@google.com>
13173
13174         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
13175         an executable.
13176         (needs_dynamic_reloc): Likewise.
13177
13178 2009-03-24  Ian Lance Taylor  <iant@google.com>
13179
13180         * yyscript.y (file_cmd): Recognize EXTERN.
13181         (extern_name_list, extern_name_list_body): New nonterminals.
13182         * script.cc (script_add_extern): Define.
13183         * script-c.h (script_add_extern): Declare.
13184
13185 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
13186
13187         * object.cc (is_elf_object): Define.
13188         * object.h (is_elf_object): Declare.
13189         * archive.cc (Archive::get_elf_object_for_member): Call
13190         is_elf_object.
13191         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
13192
13193 2009-03-24  Elliott Hughes  <enh@google.com>
13194
13195         * output.cc (Output_file::map_anonymous): Define.
13196         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
13197         try an anonymous one.  Report the size if the mmap fails.
13198         * output.h (class Output_file): Declare map_anonymous.
13199
13200 2009-03-24  Ian Lance Taylor  <iant@google.com>
13201
13202         * target-select.cc (instantiate_target): Don't acquire the lock if
13203         the instantiated_target_ field has already been set.
13204
13205 2009-03-23  Ian Lance Taylor  <iant@google.com>
13206
13207         * gold-threads.h (class Initialize_lock): Define.
13208         * gold-threads.cc (class Initialize_lock_once): Define.
13209         (initialize_lock_control): New static variable.
13210         (initialize_lock_pointer): New static variable.
13211         (initialize_lock_once): New static function.
13212         (Initialize_lock::Initialize_lock): Define.
13213         (Initialize_lock::initialize): Define.
13214         * target-select.h: Include "gold-threads.h".
13215         (class Target_selector): Add lock_ and initialize_lock_ fields.
13216         Don't define instantiate_target, just declare it.
13217         * target-select.cc (Target_selector::Target_selector): Initialize
13218         new fields.
13219         (Target_selector::instantiate_target): Define.
13220         * descriptors.h: Include "gold-threads.h".
13221         (class Descriptors): Add initialize_lock_ field.
13222         * descriptors.cc (Descriptors::Descriptors): Initialize new
13223         field.
13224         (Descriptors::open): Use initialize_lock_ field
13225         * errors.h (class Errors): Add initialize_lock_ field.
13226         * errors.cc (Errors::Errors): Initialize new field.
13227         (Errors::initialize_lock): Use initialize_lock_ field.
13228         * powerpc.cc (class Target_selector_powerpc): Remove
13229         instantiated_target_ field.  In do_recognize call
13230         instantiate_target rather than do_instantiate_target.  In
13231         do_instantiate_target just allocate a new target.
13232         * sparc.cc (class Target_selector_sparc): Likewise.
13233
13234         * freebsd.h: New file.
13235         * i386.cc: Include "freebsd.h".
13236         (Target_i386): Derive from Target_freebsd rather than
13237         Sized_target.
13238         (Target_selector_i386): Derive from Target_selector_freebsd rather
13239         than Target_selector.
13240         * x86_64.cc: Include "freebsd.h".
13241         (Target_x86_64): Derive from Target_freebsd rather than
13242         Sized_target.
13243         (Target_selector_x86_64): Derive from Target_selector_freebsd
13244         rather than Target_selector.
13245         * target.h (class Target): Add adjust_elf_header and
13246         do_adjust_elf_header.
13247         * output.cc (Output_file_header:: do_sized_write): Call target
13248         adjust_elf_header routine.
13249         * configure.tgt: Set targ_osabi.
13250         * configure.ac: Define GOLD_DEFAULT_OSABI.
13251         * parameters.cc (Parameters::default_target): Pass
13252         GOLD_DEFAULT_OSABI to select_target.
13253         * target-select.h (class Target_selector): Make instantiate_target
13254         protected rather than private.
13255         * Makefile.am (HFILES): Add freebsd.h.
13256         * configure, Makefile.in, config.in: Rebuild.
13257
13258         * merge.cc (do_add_input_section): Correct pend value.  Change
13259         message about last entry not being null terminated from error to
13260         warning.
13261
13262 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
13263
13264         * incremental.cc: New file.
13265         * Makefile.am (CCFILES): Add incremental.cc.
13266         * Makefile.in: Rebuild.
13267
13268 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
13269
13270         * layout.cc (Layout::output_section_name): Preserve names
13271         of '.note.' sections.
13272
13273 2009-03-19  Ian Lance Taylor  <iant@google.com>
13274
13275         * descriptors.cc (Descriptors::open): Check that the options are
13276         valid before using them.
13277
13278 2009-03-18  Ian Lance Taylor  <iant@google.com>
13279
13280         * script-sections.h: Include <list>.
13281         (class Script_sections): Change Sections_elements from std::vector
13282         to std::list.  Typedef public Elements_iterator.  Add
13283         orphan_section_placement_, data_segment_align_start_, and
13284         saw_data_segment_align_ fields.  Remove data_segment_align_index_
13285         field.
13286         * script-sections.cc (class Orphan_section_placement): New class.
13287         (class Sections_element): Add virtual functions is_relro and
13288         orphan_section_init.  Remove virtual function place_orphan_here.
13289         (class Output_section_definition): Add is_relro and
13290         orphan_section_init.  Remove place_orphan_here.
13291         (class Orphan_output_section): Likewise.
13292         (Script_sections::Script_sections): Update for field changes.
13293         (Script_sections::data_segment_align): Set saw_data_segment_align_
13294         and data_segment_align_start_, not data_segment_align_index.
13295         (Script_sections::data_segment_relro_end): Check
13296         saw_data_segment_align_.  Use data_segment_align_start_ rather
13297         than data_segment_align_index_.
13298         (Script_sections::place_orphan): Rewrite to use
13299         Orphan_section_placement.
13300
13301 2009-03-17  Ian Lance Taylor  <iant@google.com>
13302
13303         * archive.cc (Archive::add_symbols): Check for a version attached
13304         to the symbol name in the archive map.
13305         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
13306         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
13307         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
13308         (ver_test_11.a): New target.
13309         * testsuite/Makefile.in: Rebuild.
13310
13311         * configure.ac: Check for chsize and posix_fallocate.  Replace
13312         ftruncate.
13313         * ftruncate.c: New file, from gnulib.
13314         * output.cc (posix_fallocate): Define dummy version if not
13315         HAVE_POSIX_FALLOCATE.
13316         (Output_file::map): Call posix_fallocate rather than lseek and
13317         write.
13318         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
13319         * configure, Makefile.in, config.in: Rebuild.
13320
13321 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
13322
13323         * layout.h (Layout::create_note): Add section_name parameter.
13324         * layout.cc (Layout::create_note): Likewise.
13325         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
13326
13327 2009-03-17  Ian Lance Taylor  <iant@google.com>
13328
13329         * descriptors.cc: Include "options.h".
13330         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
13331         (Descriptors::open): Always use O_CLOEXEC when opening a new
13332         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
13333         then set FD_CLOEXEC.
13334
13335         * sparc.cc (class Target_sparc): Add has_got_section.
13336         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
13337         make sure we have a GOT section.
13338
13339         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
13340         (Target_sparc::Scan::local): Likewise.
13341         (Target_sparc::Scan::global): Likewise.
13342         (Target_sparc::Relocate::relocate): Likewise.
13343         (Target_sparc::Relocate::relocate_tls): Likewise.
13344
13345         * symtab.cc (Symbol_table::define_default_version): New function,
13346         broken out of add_from_object.
13347         (Symbol_table::add_from_object): Call define_default_version.
13348         (Symbol_table::define_special_symbol): Add resolve_oldsym
13349         parameter.  Change all callers.  If the version for a symbol comes
13350         from a version script, resolve it with the symbol with the same
13351         name with no version.  Also add the symbol without a version if
13352         appropriate.
13353         (do_define_in_output_data): If resolving with oldsym, don't delete
13354         sym.
13355         (do_define_in_output_segment): Likewise.
13356         (do_define_as_constant): Likewise.
13357         * symtab.h (class Symbol_table): Update declarations.
13358
13359 2009-03-13  Ian Lance Taylor  <iant@google.com>
13360
13361         * readsyms.cc (Read_symbols::incompatible_warning): New function.
13362         (Read_symbols::requeue): New function.
13363         (Read_symbols::do_read_symbols): If make_elf_object fails because
13364         the target type is not configured, and the file was searched for,
13365         issue a warning and retry with the next directory.
13366         (Add_symbols::run): If the file has an incompatible format, and
13367         it was searched for, requeue the Read_symbols task.  On error,
13368         release the object.
13369         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
13370         dirindex parameter to constructor.  Change all callers.  Declare
13371         incompatible_warning and requeue.
13372         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
13373         input_argument_ and input_group_ fields.  Add them to
13374         constructor.  Change all callers.
13375         (class Read_script): Add dirindex_ field.  Add it to constructor.
13376         Change all callers.
13377         * archive.cc (Archive::setup): Remove input_objects parameter.
13378         Change all callers.
13379         (Archive::get_file_and_offset): Likewise.
13380         (Archive::read_all_symbols): Likewise.
13381         (Archive::read_symbols): Likewise.
13382         (Archive::get_elf_object_for_member): Remove input_objects
13383         parameter.  Add punconfigured parameter.  Change all callers.
13384         (Archive::add_symbols): Change return type to bool.  Check return
13385         value of include_member.
13386         (Archive::include_all_members): Likewise.
13387         (Archive::include_member): Change return type to bool.  Return
13388         false if first included object has incompatible target.  Set
13389         included_member_ field.
13390         (Add_archive_symbols::run): If add_symbols returns false, requeue
13391         Read_symbols task.
13392         * archive.h (class Archive): Add included_member_ field.
13393         Initialize it in constructor.  Add input_file and searched_for
13394         methods.  Update declarations.
13395         (class Add_archive_symbols): Add dirpath_, dirindex_, and
13396         input_argument_ fields.  Add them to constructor.  Change all
13397         callers.
13398         * script.cc: Include "target-select.h".
13399         (class Parser_closure): Add skip_on_incompatible_target_ and
13400         found_incompatible_target_ fields.  Add
13401         skip_on_incompatible_target parameter to constructor.  Change all
13402         callers.  Add methods skip_on_incompatible_target,
13403         clear_skip_on_incompatible_target, found_incompatible_target, and
13404         set_found_incompatible_target.
13405         (read_input_script): Add dirindex parameter.  Change all callers.
13406         If parser finds an incompatible target, requeue Read_symbols
13407         task.
13408         (script_set_symbol): Clear skip_on_incompatible_target in
13409         closure.
13410         (script_add_assertion, script_parse_option): Likewise.
13411         (script_start_sections, script_add_phdr): Likewise.
13412         (script_check_output_format): New function.
13413         * script.h (read_input_script): Update declaration.
13414         * script-c.h (script_check_output_format): Declare.
13415         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
13416         (ignore_cmd): Remove OUTPUT_FORMAT.
13417         * fileread.cc (Input_file::Input_file): Add explicit this.
13418         (Input_file::will_search_for): New function.
13419         (Input_file::open): Add pindex parameter.  Change all callers.
13420         * fileread.h (class Input_file): Add input_file_argument method.
13421         Declare will_search_for.  Update declarations.
13422         * object.cc (make_elf_object): Add punconfigured parameter.
13423         Change all callers.
13424         * object.h (class Object): Make input_file public.  Add
13425         searched_for method.
13426         (make_elf_object): Update declaration.
13427         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
13428         restart search.
13429         * dirsearch.h (class Dirsearch): Update declaration.
13430         * options.h (class General_options): Add --warn-search-mismatch.
13431         * parameters.cc (Parameters::is_compatible_target): New function.
13432         * parameters.h (class Parameters): Declare is_compatible_target.
13433         * workqueue.cc (Workqueue::add_blocker): New function.
13434         * workqueue.h (class Workqueue): Declare add_blocker.
13435
13436         * fileread.cc (Input_file::open): Remove options parameter.
13437         Change all callers.
13438         (Input_file::open_binary): Likewise.
13439         * script.cc (read_input_script): Likewise.
13440         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
13441         options parameter from constructor.  Change all callers.
13442         (class Read_script): Likewise.
13443         * fileread.h (class Input_file): Update declarations.
13444         * script.h (read_input_script): Update declaration.
13445
13446 2009-03-10  Nick Clifton  <nickc@redhat.com>
13447
13448         * po/es.po: New Spanish translation.
13449
13450 2009-03-06  Cary Coutant  <ccoutant@google.com>
13451
13452         * options.cc (parse_short_option): Keep dash_z from registering itself.
13453
13454 2009-03-03  Ian Lance Taylor  <iant@google.com>
13455
13456         PR 9918
13457         * target-reloc.h (relocate_section): Pass output_section to
13458         relocate.
13459         * i386.cc (Target_i386::should_apply_static_reloc): Add
13460         output_section parameter.  Change all callers.
13461         (Target_i386::Relocate::relocate): Add output_section parameter.
13462         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
13463         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
13464         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
13465         * testsuite/two_file_shared.sh: New script.
13466         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
13467         (check_DATA): Add two_file_shared.dbg.
13468         (two_file_shared.dbg): New target.
13469         * testsuite/Makefile.in: Rebuild.
13470
13471 2009-03-01  Ian Lance Taylor  <iant@google.com>
13472
13473         * configure.ac: Check for byteswap.h.
13474         * configure: Rebuild.
13475         * config.in: Rebuild.
13476
13477 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
13478
13479         * layout.cc (Layout::find_or_add_kept_section): New function.
13480         (Layout::add_comdat): Removed.
13481         * layout.h (struct Kept_section): Move out of class Layout.
13482         Remove trailing underscores from field names.  Add group_sections
13483         field.  Rename group_ field to is_group.  Change all uses.
13484         (class Layout): Declare find_or_add_kept_section, not add_comdat.
13485         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
13486         comdat_groups_ field.
13487         (Sized_relobj::include_section_group): Use
13488         find_or_add_kept_section and Kept_section::group_sections.
13489         (Sized_relobj::include_linkonce_section): Likewise.
13490         * object.cc (class Sized_relobj): Don't define Comdat_group or
13491         Comdat_group_table.  Remove find_comdat_group and
13492         add_comdat_group.  Remove comdat_groups_ field.
13493         * plugin.cc (include_comdat_group): Use
13494         Layout::find_or_add_kept_section.
13495
13496 2009-02-28  Ian Lance Taylor  <iant@google.com>
13497
13498         * README: --gc-sections and map files are now supported.  Document
13499         some build requirements.
13500
13501         PR 6992
13502         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
13503         relocatable link set the value of the section symbol to zero.
13504         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
13505         relocatable link don't include the section address in the local
13506         symbol value.
13507
13508 2009-02-27  Ian Lance Taylor  <iant@google.com>
13509
13510         PR 6811
13511         * options.h (class Search_directory): Add is_system_directory.
13512         (class General_options): Declare is_in_system_directory.
13513         * options.cc (get_relative_sysroot): Make static.
13514         (get_default_sysroot): Make static.
13515         (General_optoins::is_in_system_directory): New function.
13516         * fileread.cc (Input_file::is_in_system_directory): New function.
13517         * fileread.h (class Input_file): Declare is_in_system_directory.
13518         * object.h (class Object): Add is_in_system_directory.
13519         (class Input_objects): Remove system_library_directory_ field.
13520         * object.cc (Input_objects::add_object): Don't set
13521         system_library_directory_.
13522         (input_objects::found_in_system_library_directory): Remove.
13523         * symtab.cc (Symbol_table::write_globals): Remove input_objects
13524         parameter.  Change all callers.
13525         (Symbol_table::sized_write_globals): Likewise.
13526         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
13527         Call Object::is_in_system_directory.
13528         * symtab.h (class Symbol_table): Update declarations.
13529
13530         PR 5990
13531         * descriptors.h (Open_descriptor): Add is_on_stack field.
13532         * descriptors.cc (Descriptors::open): If the descriptor is on the
13533         top of the stack, remove it.  Initialize is_on_stack field.
13534         (Descriptors::release): Only add pod to stack if it is not on the
13535         stack already.
13536         (Descriptors::close_some_descriptor): Clear stack_next and
13537         is_on_stack fields.
13538
13539         PR 7091
13540         * output.cc (Output_section::find_starting_output_address): Rename
13541         from starting_output_address; add PADDR parameter; change return
13542         type.
13543         * output.h (class Output_section): Declare
13544         find_starting_output_address instead of starting_output_address.
13545         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
13546         section symbol for which we can't find a merge section.
13547
13548         PR 9836
13549         * symtab.cc (Symbol_table::add_from_object): If the visibility is
13550         hidden or internal, force the symbol to be local.
13551         * resolve.cc (Symbol::override_visibility): Define.
13552         (Symbol::override_base): Use override_visibility.
13553         (Symbol_table::resolve): Likewise.
13554         (Symbol::override_base_with_special): Likewise.
13555         (Symbol_table::override_with_special): If the visibility is hidden
13556         or internal, force the symbol to be local.
13557         * symtab.h (class Symbol): Add set_visibility and
13558         override_visibility.
13559         * testsuite/ver_test_1.sh: New file.
13560         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
13561         (check_DATA): Add ver_test_1.syms.
13562         (ver_test_1.syms): New target.
13563         * testsuite/Makefile.in: Rebuild.
13564
13565 2009-02-25  Cary Coutant  <ccoutant@google.com>
13566
13567         * layout.cc (Layout::choose_output_section): Don't rename sections
13568         when using a linker script that has a SECTIONS clause.
13569         * Makefile.in: Regenerate.
13570
13571         * testsuite/Makefile.am (script_test_5.sh): New test case.
13572         * testsuite/Makefile.in: Regenerate.
13573         * testsuite/script_test_5.cc: New file.
13574         * testsuite/script_test_5.sh: New file.
13575         * testsuite/script_test_5.t: New file.
13576
13577 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
13578
13579         * archive.cc (Archive::include_member): Update calls to add_symbols.
13580         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
13581         the Layout argument.
13582         * dynobj.h (do_add_symbols): Add the Layout argument.
13583         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
13584         Layout argument.
13585         * object.h (Object::add_symbols): Add the Layout argument.
13586         (Object::do_add_symbols): Add the Layout argument.
13587         (Sized_relobj::do_add_symbols): Add the Layout argument.
13588         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
13589         Unify the two versions.
13590         (Add_plugin_symbols): Remove.
13591         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
13592         (Sized_pluginobj::do_add_symbols): Unify the two versions.
13593         (Add_plugin_symbols): Remove.
13594         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
13595         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
13596         (Add_symbols::run): Make it work with Pulginobj.
13597
13598 2009-02-06  Ian Lance Taylor  <iant@google.com>
13599
13600         * object.cc (Sized_relobj::do_layout): Make info message start
13601         with lower case letter.
13602
13603 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
13604
13605         * binary.cc: Fix file comment.
13606
13607         * options.h (enum Incremental_disposition): Define.
13608         (class General_options): Add new options: --incremental,
13609         --incremental_changed, --incremental_unchanged,
13610         --incremental_unknown.  Add incremental_disposition_ and
13611         implicit_incremental_ fields.
13612         (General_options::incremental_disposition): New function.
13613         (class Position_dependent_options): Add incremental_disposition
13614         option.
13615         (Position_dependent_options::copy_from_options): Set incremental
13616         dispositions.
13617         * options.cc (General_options::parse_incremental_changed): New
13618         function.
13619         (General_options::parse_incremental_unchanged): New function.
13620         (General_options::parse_incremental_unknown): New function.
13621         (General_options::General_options): Initialize new fields
13622         incremental_disposition_ and implicit_incremental_.
13623         (General_options::finalize): Check for uasge of --incremental-*
13624         without --incremental.
13625
13626 2009-02-06  Chris Demetriou  <cgd@google.com>
13627
13628         * gold.h (gold_undefined_symbol): Change to take only a Symbol
13629         pointer and to report location as the file name associated with
13630         the symbol.
13631         (gold_undefined_symbol_at_location): New function to replace the
13632         old gold_undefined_symbol functionality.
13633         * target-reloc.h (relocate_section): Update to use
13634         gold_undefined_symbol_at_location.
13635         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
13636         Call gold_undefined_symbol function rather than gold_error.
13637         * errors.h (Errors::undefined_symbol): Take location as a
13638         string, rather than calculating it from a relocation.
13639         * errors.cc (Errors::fatal): Print "fatal error:" before the
13640         formatted message.
13641         (Errors::error, Errors::error_at_location): Print "error: "
13642         before the formatted message.
13643         (Errors::undefined_symbol): Take location as a string, rather
13644         than calculating it from a relocation.
13645         (gold_undefined_symbol_at_location): New function akin to
13646         old gold_undefined_symbol, calculates location from relocation.
13647         (gold_undefined_symbol): Change to take only a Symbol pointer
13648         and to report location as the file name associated with the symbol.
13649         * testsuite/debug_msg.sh: Update for changed error messages.
13650         * testsuite/undef_symbol.sh: Likewise.
13651
13652 2009-02-04  Duncan Sands  <baldrick@free.fr>
13653
13654         PR 9812
13655         * reduced_debug_output.h
13656         (Output_reduced_debug_abbrev_section::failed): Use format for
13657         gold_warning.
13658         (Output_reduced_debug_info_section::faild): Likewise.
13659
13660 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
13661
13662         * script.cc (Lazy_demangler): New class.
13663         (Version_script_info::get_symbol_version_helper): Demangle a
13664         symbol only once.
13665
13666 2009-01-29  Cary Coutant  <ccoutant@google.com>
13667
13668         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
13669         to __tls_get_addr.
13670         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
13671
13672 2009-01-28  Ian Lance Taylor  <iant@google.com>
13673
13674         * version.cc (version_string): Bump to 1.9.
13675
13676         * gold.h: Include <cstring> and <stdint.h>.
13677         * version.cc: Include <cstdio>.
13678         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
13679         warning.
13680         * reduced_debug_output.cc (insert_into_vector): Rename from
13681         Insert_into_vector; change all callers.  Use Swap_unaligned to
13682         avoid aliasing issue; remove union since it is unnecessary.
13683
13684 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
13685
13686         * Makefile.am (CCFILES): Add gc.cc.
13687         (HFILES): Add gc.h.
13688         * Makefile.in: Regenerate.
13689         * gold.cc (Gc_runner): New class.
13690         (queue_initial_tasks): Call garbage collection related tasks
13691         when corresponding options are invoked.
13692         (queue_middle_gc_tasks): New function.
13693         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
13694         processed early before laying out sections during garbage collection.
13695         * gold.h (queue_middle_gc_tasks): New function.
13696         (is_prefix_of): Move from "layout.cc".
13697         * i386.cc (Target_i386::gc_process_relocs): New function.
13698         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
13699         * main.cc (main): Create object of class "Garbage_collection".
13700         * object.cc (Relobj::copy_symbols_data): New function.
13701         (Relobj::is_section_name_included): New function.
13702         (Sized_relobj::do_layout): Allow this function to be called twice
13703         during garbage collection and defer layout of section during the
13704         first call.
13705         * object.h (Relobj::get_symbols_data): New function.
13706         (Relobj::is_section_name_included): New function.
13707         (Relobj::copy_symbols_data): New function.
13708         (Relobj::set_symbols_data): New function.
13709         (Relobj::get_relocs_data): New function.
13710         (Relobj::set_relocs_data): New function.
13711         (Relobj::is_output_section_offset_invalid): New pure virtual function.
13712         (Relobj::gc_process_relocs): New function.
13713         (Relobj::do_gc_process_relocs): New pure virtual function.
13714         (Relobj::sd_): New data member.
13715         (Sized_relobj::is_output_section_offset_invalid): New function.
13716         (Sized_relobj::do_gc_process_relocs): New function.
13717         * options.h (General_options::gc_sections): Modify to not be a no-op.
13718         (General_options::print_gc_sections): New option.
13719         * plugin.cc (Plugin_finish::run): Remove function call to
13720         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
13721         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
13722         * reloc.cc (Read_relocs::run): Add task to process relocs and
13723         determine unreferenced sections when doing garbage collection.
13724         (Gc_process_relocs): New class.
13725         (Sized_relobj::do_gc_process_relocs): New function.
13726         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
13727         sections that are garbage collected.
13728         * reloc.h (Gc_process_relocs): New class.
13729         * sparc.cc (Target_sparc::gc_process_relocs): New function.
13730         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
13731         symbols whose corresponding sections are garbage collected.
13732         (Symbol_table::Symbol_table): Add new parameter for the garbage
13733         collection object.
13734         (Symbol_table::gc_mark_undef_symbols): New function.
13735         (Symbol_table::gc_mark_symbol_for_shlib): New function.
13736         (Symbol_table::gc_mark_dyn_syms): New function.
13737         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
13738         as garbage.
13739         (Symbol_table::add_from_object): Likewise.
13740         (Symbol_table::add_from_relobj): When building shared objects, do not
13741         treat externally visible symbols as garbage.
13742         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
13743         table information for static and relocatable links.
13744         * symtab.h (Symbol_table::set_gc): New function.
13745         (Symbol_table::gc): New function.
13746         (Symbol_table::gc_mark_undef_symbols): New function.
13747         (Symbol_table::gc_mark_symbol_for_shlib): New function.
13748         (Symbol_table::gc_mark_dyn_syms): New function.
13749         (Symbol_table::gc_): New data member.
13750         * target.h (Sized_target::gc_process_relocs): New pure virtual
13751         function.
13752         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
13753         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
13754
13755 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
13756
13757         * options.h (General_options::gc_sections): Define as a no-op for now.
13758         (General_options::no_keep_memory): Ditto.
13759         (General_options::Bshareable): Define.
13760         * options.cc (General_options::finalize): Honor -Bshareable.
13761
13762 2009-01-20  Andreas Schwab  <schwab@suse.de>
13763
13764         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
13765         read the value in the contents, since we don't use it.  Use the
13766         template endianness when writing.
13767         (Relocate::relocate): Use it for R_PPC_REL16_HA.
13768
13769 2009-01-19  Andreas Schwab  <schwab@suse.de>
13770
13771         * configure.tgt (powerpc64-*): Fix targ_obj.
13772
13773 2009-01-15  Ian Lance Taylor  <iant@google.com>
13774
13775         * object.cc (Sized_relobj::write_local_symbols): Don't write out
13776         local symbols when stripping all symbols.
13777
13778 2009-01-14  Cary Coutant  <ccoutant@google.com>
13779
13780         * output.cc (Output_reloc): Add explicit instantiations.
13781
13782 2009-01-14  Cary Coutant  <ccoutant@google.com>
13783
13784         * archive.cc (Archive::get_elf_object_for_member): Remove call
13785         to File_read::claim_for_plugin.
13786         * descriptors.cc (Descriptors::open): Remove reference to
13787         is_claimed.
13788         (Descriptors::claim_for_plugin): Remove.
13789         * descriptors.h (Descriptors::claim_for_plugin): Remove.
13790         (Descriptors::is_claimed): Remove.
13791         (claim_descriptor_for_plugin): Remove.
13792         * fileread.cc (File_read::claim_for_plugin): Remove.
13793         * fileread.h (File_read::claim_for_plugin): Remove.
13794         (File_read::descriptor): Reopen descriptor if necessary.
13795         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
13796         (Plugin_manager::all_symbols_read): Add task parameter. Change
13797         all callers.
13798         (Plugin_manager::get_input_file): New function.
13799         (Plugin_manager::release_input_file): New function.
13800         (Pluginobj::Pluginobj): Add filesize parameter and initialize
13801         corresponding data member.
13802         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
13803         and pass to base constructor. Change all callers.
13804         (get_input_file, release_input_file): New functions.
13805         (make_sized_plugin_object): Add filesize parameter. Change all callers.
13806         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
13807         (Plugin_manager::all_symbols_read): Add task parameter.
13808         (Plugin_manager::get_input_file): New function.
13809         (Plugin_manager::release_input_file): New function.
13810         (Plugin_manager::task_): New data member.
13811         (Pluginobj::Pluginobj): Add filesize parameter.
13812         (Pluginobj::filename): New function.
13813         (Pluginobj::descriptor): New function.
13814         (Pluginobj::filesize): New function.
13815         (Pluginobj::filesize_): New data member.
13816         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
13817         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
13818         File_read::claim_for_plugin; use Object::unlock to unlock the file.
13819
13820         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
13821         with archive libraries.
13822         * testsuite/Makefile.in: Regenerate.
13823         * testsuite/plugin_test.c (struct sym_info): New type.
13824         (get_input_file, release_input_file): New static variables.
13825         (onload): Capture new transfer vector entries.
13826         (claim_file_hook): Stop reading at end of file according to filesize.
13827         Factor out parsing of readelf output into separate function.
13828         (all_symbols_read_hook): Exercise get_input_file and release_input_file
13829         APIs and get the source file name from the symbol table.  Convert
13830         source file name to corresponding object file name.  Print info
13831         message when adding new input files.
13832         (parse_readelf_line): New function.
13833         * testsuite/plugin_test_1.sh: Add checks for new info messages.
13834         * testsuite/plugin_test_2.sh: Likewise.
13835         * testsuite/plugin_test_3.sh: Likewise.
13836         * testsuite/plugin_test_4.sh: New test case.
13837
13838 2009-01-07  Ian Lance Taylor  <iant@google.com>
13839
13840         * version.cc (version_string): Bump to 1.8.
13841
13842 2008-12-23  Cary Coutant  <ccoutant@google.com>
13843
13844         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
13845         * plugin.cc (Plugin_manager::finish): Rename as
13846         layout_deferred_objects.  Move cleanup to separate function.
13847         (Plugin_manager::cleanup): New function.
13848         (Plugin_finish::run): Call layout_deferred_objects and cleanup
13849         separately.
13850         * plugin.h (Plugin_manager::finish): Rename as
13851         layout_deferred_objects.
13852         (Plugin_manager::cleanup): New function.
13853         (Plugin_manager::cleanup_done): New field.
13854
13855 2008-12-23  Cary Coutant  <ccoutant@google.com>
13856
13857         * plugin.cc (is_visible_from_outside): New function.
13858         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
13859         so we don't return "IR only" status for exported symbols or -r links.
13860
13861         * testsuite/Makefile.am (plugin_test_3): New test case.
13862         * testsuite/Makefile.in: Regenerate.
13863         * testsuite/plugin_test_3.sh: New file.
13864
13865 2008-12-22  Cary Coutant  <ccoutant@google.com>
13866
13867         * object.cc (Sized_relobj::layout_section): New function.
13868         (Sized_relobj::do_layout): Defer layout of input sections until after
13869         plugin has provided replacement files.
13870         (Sized_relobj::do_layout_deferred_sections): New function.
13871         * object.h (Relobj::set_section_offset): Remove virtual keyword.
13872         (Relobj::layout_deferred_sections): New function.
13873         (Relobj::do_layout_deferred_sections): New function.
13874         (Sized_relobj::do_layout_deferred_sections): New function.
13875         (Sized_relobj::layout_section): New function.
13876         (Sized_relobj::Deferred_layout): New structure.
13877         (Sized_relobj::deferred_layout_): New field.
13878         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
13879         Change all callers.  Layout deferred sections.
13880         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
13881         references.
13882         (Plugin_hook::run): Move code from do_plugin_hook inline.
13883         (Plugin_hook::do_plugin_hook): Remove.
13884         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
13885         (Plugin_manager::finish): Renamed, was cleanup.
13886         (Plugin_manager::should_defer_layout): New function.
13887         (Plugin_manager::add_deferred_layout_object): New function.
13888         (Plugin_manager::Deferred_layout_list): New type.
13889         (Plugin_manager::deferred_layout_objects_): New field.
13890         (Plugin_hook::do_plugin_hook): Remove.
13891
13892 2008-12-17  Ian Lance Taylor  <iant@google.com>
13893
13894         * options.h (class General_options): Add --no case for
13895         --export-dynamic.
13896
13897 2008-12-16  Cary Coutant  <ccoutant@google.com>
13898
13899         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
13900         vector.
13901         (Plugin_manager::claim_file): Create plugin object even if
13902         plugin did not call the add_symbols callback.
13903         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
13904         asking for more symbols than were added.
13905         * testsuite/Makefile.am (plugin_test_1): Add test case with
13906         no global symbols.
13907         (empty.syms): New target.
13908         * testsuite/Makefile.in: Regenerate.
13909         * testsuite/plugin_test.c (claim_file_hook): Add new debug
13910         message. Don't call add_symbols if no globals.
13911         (all_symbols_read_hook): Don't provide replacement for empty
13912         claimed file.
13913
13914 2008-12-12  Ian Lance Taylor  <iant@google.com>
13915
13916         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
13917         r_type == 0 for a local symbol with r_sym == 0.
13918         (scan_relocatable_relocs): Pass r_sym to
13919         local_non_section_strategy.
13920         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
13921         r_sym parameter.
13922
13923         * configure.ac: Update test for TLS descriptors: they are
13924         supported as of glibc 2.9.
13925         * configure: Rebuild.
13926
13927 2008-12-11  Ian Lance Taylor  <iant@google.com>
13928
13929         PR 7091
13930         * target-reloc.h (Default_scan_relocatable_relocs): For each
13931         function, map r_type == 0 to RELOC_DISCARD.
13932
13933 2008-12-10  Cary Coutant  <ccoutant@google.com>
13934
13935         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
13936         object to override a kept COMDAT group from a plugin object.
13937
13938 2008-12-09  Ian Lance Taylor  <iant@google.com>
13939
13940         PR 7088
13941         * yyscript.y (file_cmd): Handle INPUT.
13942
13943         * testsuite/initpri1.c: Change all declarations to be full
13944         prototypes by adding void, to avoid compiler warnings.
13945
13946 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
13947
13948         * options.cc (General_options::parse_plugin_opt): New.
13949         (General_options::add_plugin): The argument now is just the filename.
13950         (General_options::add_plugin_option): New.
13951         * options.h (plugin_opt): New.
13952         (add_plugin): Change argument name.
13953         (add_plugin_option): New.
13954         * plugin.cc (Plugin::load): Don't parse the plugin option.
13955         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
13956         (Plugin::add_option): New.
13957         (Plugin::args_): Change type.
13958         (Plugin::filename_): New.
13959         (Plugin_manager::add_plugin_option): New.
13960         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
13961         * testsuite/Makefile.in: Regenerate.
13962
13963 2008-12-05  Cary Coutant  <ccoutant@google.com>
13964
13965         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
13966         Handle --strip-lto-sections option.
13967         * options.h (strip_lto_sections): New option.
13968
13969 2008-12-01  Cary Coutant  <ccoutant@google.com>
13970
13971         * plugin.cc (ld_plugin_message): Change format parameter to const.
13972         Fix mismatch between new[] and delete.
13973
13974 2008-11-14  Cary Coutant  <ccoutant@google.com>
13975
13976         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
13977         instead of -1U.
13978
13979 2008-11-05  Craig Silverstein  <csilvers@google.com>
13980
13981         * options.cc (General_options::parse_dynamic_list): New function.
13982         * options.h (General_options): New flags dynamic_list,
13983         dynamic_list_data, dynamic_list_cpp_new, and
13984         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
13985         (General_options::in_dynamic_list): New function.
13986         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
13987         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
13988         (Lex::can_continue_name): Likewise.
13989         (yylex): Likewise.
13990         (read_script_file): New parameter script_options.
13991         (read_dynamic_list): New function.
13992         (Script_options::define_dynamic_list): New function.
13993         (dynamic_list_keyword_parsecodes): New variable.
13994         (dynamic_list_keywords): New variable.
13995         * script.h (Script_options::define_dynamic_list): New function
13996         prototype.
13997         (read_dynamic_list): New function prototype.
13998         * symtab.cc (strprefix): New macro.
13999         (Symbol::should_add_dynsym_entry): Support dynamic_list,
14000         dynamic_list_data, dynamic_list_cpp_new, and
14001         dynamic_list_cpp_typeinfo.
14002         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
14003         (dynamic_list_expr): New rule.
14004         (dynamic_list_nodes): Likewise.
14005         (dynamic_list_node): Likewise.
14006         * testsuite/Makefile.am (dynamic_list): New test.
14007         * testsuite/Makefile.in: Regenerated.
14008         * testsuite/dynamic_list.t: New file.
14009         * testsuite/dynamic_list.sh: New file.
14010
14011 2008-11-05  Craig Silverstein  <csilvers@google.com>
14012
14013         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
14014         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
14015         (t11_last): Likewise.
14016         * testsuite/ver_test_6.c (main): Likewise.
14017
14018 2008-10-07  Cary Coutant  <ccoutant@google.com>
14019
14020         * options.c (General_options::finalize): Add check for -static and
14021         -shared.
14022         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
14023         is not empty.
14024
14025 2008-10-02  Cary Coutant  <ccoutant@google.com>
14026
14027         * plugin.cc (make_sized_plugin_object): Fix conditional
14028         compilation to work when not all targets are enabled.
14029
14030 2008-09-29  Cary Coutant  <ccoutant@google.com>
14031
14032         * archive.cc (Archive::get_file_and_offset): Use filename instead
14033         of name to get library path.
14034         (Archive::include_member): Unlock external member of a thin archive.
14035
14036         * testsuite/Makefile.am (TEST_AR): New variable.
14037         (thin_archive_test_1): New test.
14038         (thin_archive_test_2): New test.
14039         * testsuite/Makefile.in: Regenerate.
14040         * testsuite/thin_archive_main.cc: New file.
14041         * testsuite/thin_archive_test_1.cc: New file.
14042         * testsuite/thin_archive_test_2.cc: New file.
14043         * testsuite/thin_archive_test_3.cc: New file.
14044         * testsuite/thin_archive_test_4.cc: New file.
14045
14046 2008-09-29  Cary Coutant  <ccoutant@google.com>
14047
14048         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
14049         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
14050         instead of -1U.
14051         (Sized_relobj::do_finalize_local_symbols): Likewise.
14052         (Sized_relobj::map_to_kept_section): Likewise.
14053         * object.h (Sized_relobj::invalid_address): New constant.
14054         (Sized_relobj::do_output_section_offset): Check for invalid_address
14055         and return -1ULL.
14056         * output.cc (Output_reloc::local_section_offset): Use constant
14057         invalid_address instead of -1U.
14058         (Output_reloc::get_address): Likewise.
14059         (Output_section::output_address): Change -1U to -1ULL.
14060         * output.h (Output_reloc::invalid_address): New constant.
14061         * reloc.cc (Sized_relobj::write_sections): Use constant
14062         invalid_address instead of -1U.
14063         (Sized_relobj::relocate_sections): Likewise.
14064         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
14065         values for merge sections.
14066         * target-reloc.h (relocate_for_relocatable): Use constant
14067         invalid_address instead of -1U.
14068
14069 2008-09-19  Cary Coutant  <ccoutant@google.com>
14070
14071         Add plugin functionality for link-time optimization (LTO).
14072         * configure.ac (plugins): Add --enable-plugins option.
14073         * configure: Regenerate.
14074         * config.in: Regenerate.
14075         * Makefile.am (LIBDL): New variable.
14076         (CCFILES): Add plugin.cc.
14077         (HFILES): Add plugin.h.
14078         (ldadd_var): Add LIBDL.
14079         * Makefile.in: Regenerate.
14080
14081         * archive.cc: Include "plugin.h".
14082         (Archive::setup): Don't preread archive symbols when using a plugin.
14083         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
14084         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
14085         files.
14086         (Archive::include_member): Add symbols from plugin objects.
14087         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
14088         * descriptors.cc (Descriptors::open): Check for file descriptors
14089         abandoned by plugins.
14090         (Descriptors::claim_for_plugin): New function.
14091         * descriptors.h (Descriptors::claim_for_plugin): New function.
14092         (Open_descriptor::is_claimed): New field.
14093         (claim_descriptor_for_plugin): New function.
14094         * fileread.cc (File_read::claim_for_plugin): New function.
14095         * fileread.h (File_read::claim_for_plugin): New function.
14096         (File_read::descriptor): New function.
14097         * gold.cc: Include "plugin.h".
14098         (queue_initial_tasks): Add task to call plugin hooks for generating
14099         new object files.
14100         * main.cc: Include "plugin.h".
14101         (main): Load plugin libraries.
14102         * object.h (Pluginobj): Declare.
14103         (Object::pluginobj): New function.
14104         (Object::do_pluginobj): New function.
14105         (Object::set_target): New function.
14106         * options.cc: Include "plugin.h".
14107         (General_options::parse_plugin): New function.
14108         (General_options::General_options): Initialize plugins_ field.
14109         (General_options::add_plugin): New function.
14110         * options.h (Plugin_manager): Declare.
14111         (General_options): Add --plugin option.
14112         (General_options::has_plugins): New function.
14113         (General_options::plugins): New function.
14114         (General_options::add_plugin): New function.
14115         (General_options::plugins_): New field.
14116         * plugin.cc: New file.
14117         * plugin.h: New file.
14118         * readsyms.cc: Include "plugin.h".
14119         (Read_symbols::do_read_symbols): Check for archive before checking
14120         for ELF file.  Call plugin hooks to claim files.
14121         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
14122         from a real object file; force override when processing replacement
14123         files.
14124         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
14125         (Symbol::init_base_object): Likewise.
14126         (Symbol::init_base_output_data): Likewise.
14127         (Symbol::init_base_output_segment): Likewise.
14128         (Symbol::init_base_constant): Likewise.
14129         (Symbol::init_base_undefined): Likewise.
14130         (Symbol::output_section): Assert that object is not a plugin.
14131         (Symbol_table::add_from_pluginobj): New function.
14132         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
14133         undefined.
14134         (Symbol_table::sized_write_globals): Likewise.
14135         (Symbol_table::add_from_pluginobj): Instantiate template.
14136         * symtab.h (Sized_pluginobj): Declare.
14137         (Symbol::in_real_elf): New function.
14138         (Symbol::set_in_real_elf): New function.
14139         (Symbol::in_real_elf_): New field.
14140         (Symbol_table::add_from_pluginobj): New function.
14141
14142         * testsuite/Makefile.am (AM_CFLAGS): New variable.
14143         (LIBDL): New variable.
14144         (LDADD): Add LIBDL.
14145         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
14146         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
14147         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
14148         (MOSTLYCLEANFILES): Likewise.
14149         * testsuite/Makefile.in: Regenerate.
14150         * testsuite/plugin_test.c: New file.
14151         * testsuite/plugin_test_1.sh: New file.
14152         * testsuite/plugin_test_2.sh: New file.
14153
14154 2008-09-16  Ian Lance Taylor  <iant@google.com>
14155
14156         * target-reloc.h (relocate_section): Check whether a symbol is
14157         defined by the ABI before reporting an undefined symbol error.
14158         * target.h (Target::is_defined_by_abi): Make parameter const.
14159         (Target::do_is_defined_by_abi): Likewise.
14160         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
14161         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
14162         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
14163         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
14164         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
14165         * testsuite/Makefile.in: Rebuild.
14166
14167         * fileread.cc (make_view): Add casts to avoid warning.
14168
14169 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
14170
14171         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
14172         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
14173
14174 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
14175
14176         * options.h (General_options::output_is_executable): New.
14177         (General_options::output_is_pie): New.
14178         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
14179         for shared libraries.
14180         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
14181
14182 2008-09-11  Chris Demetriou  <cgd@google.com>
14183
14184         * options.h (origin): New -z option.
14185         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
14186         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
14187         in DT_FLAGS_1.
14188
14189 2008-09-05  Cary Coutant  <ccoutant@google.com>
14190
14191         * fileread.cc (File_read::make_view): Add check for attempt to map
14192         beyond end of file.
14193
14194 2008-09-05  Cary Coutant  <ccoutant@google.com>
14195
14196         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
14197         explicit instantiations.
14198
14199 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
14200
14201         PR gold/6858
14202         * options.cc (General_options::finalize): Allow undefined symbols
14203         in shlibs if linking -shared.
14204
14205         PR gold/6859
14206         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
14207         symbols as not needing a dynsym entry.
14208
14209 2008-08-20  Craig Silverstein  <csilvers@google.com>
14210
14211         * fileread.cc (File_read::open): Do not lock the file unless it
14212         was successfully opened.
14213
14214 2008-08-14  Cary Coutant  <ccoutant@google.com>
14215
14216         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
14217         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
14218         * testsuite/tls_test.cc (struct int128): 128-bit struct
14219         for testing TLS relocs with non-zero addend.
14220         (v12): New TLS variable.
14221         (t12): New test.
14222         (t_last): Add check for v12.
14223         * testsuite/tls_test.h (t12): New function.
14224         * testsuite/tls_test_main.cc (thread_routine): Call new test.
14225
14226 2008-08-13  Ian Lance Taylor  <iant@google.com>
14227
14228         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
14229         set tls_segment_ or relro_segment_.
14230         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
14231         when appropriate.
14232         * output.h (Output_section::clear_is_relro): New function.
14233         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
14234         sections specially even when output_data_ is empty.
14235         (Output_segment::maximum_alignment): When first section is relro,
14236         only force alignment for PT_LOAD segments.
14237         * script.cc (script_data_segment_align): New function.
14238         (script_data_segment_relro_end): New function.
14239         * script-c.h (script_data_segment_align): Declare.
14240         (script_data_segment_relro_end): Declare.
14241         * script-sections.h (class Script_sections): Declare
14242         data_segment_align and data_segment_relro_end.  Add fields
14243         segment_align_index_ and saw_relro_end_.
14244         * script-sections.cc (class Sections_element): Add set_is_relro
14245         virtual function.  Add new bool* parameter to place_orphan_here.
14246         Add get_output_section virtual function.
14247         (class Output_section_definition): Add set_is_relro.  Add new
14248         bool* parameter to place_orphan_here.  Add get_output_section.
14249         Add is_relro_ field.
14250         (Output_section_definition::Output_section_definition): Initialize
14251         evaluated_address_, evaluated_load_address, evaluated_addralign_,
14252         and is_relro_ fields.
14253         (Output_section_definition::place_orphan_here): Add is_relro
14254         parameter.
14255         (Output_section_definition::set_section_addresses): Set relro for
14256         output section.
14257         (Output_section_definition::alternate_constraint): Likewise.
14258         (class Orphan_output_section): Add new bool* parameter to
14259         place_orphan_here.  Add get_output_section.
14260         (Orphan_output_section::place_orphan_here): Add is_relro
14261         parameter.
14262         (Script_sections::Script_sections): Initialize
14263         data_segment_align_index_ and saw_relro_end_.
14264         (Script_sections::data_segment_align): New function.
14265         (Script_sections::data_segment_relro_end): New function.
14266         (Script_sections::place_orphan): Set or clear is_relro.
14267         (Script_sections::set_section_addresses): Force alignment of first
14268         TLS section.
14269         * yyscript.y (exp): Call script_data_segment_align and
14270         script_data_segment_relro_end.
14271         * testsuite/relro_script_test.t: New file.
14272         * testsuite/relro_test.cc (using_script): Declare.
14273         (t1, t2): Test using_script.
14274         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
14275         (relro_script_test_SOURCES): Define.
14276         (relro_script_test_DEPENDENCIES): Define.
14277         (relro_script_test_LDFLAGS): Define.
14278         (relro_script_test_LDADD): Define.
14279         (relro_script_test.so): New target.
14280         * testsuite/Makefile.in: Rebuild.
14281
14282 2008-08-06  Cary Coutant <ccoutant@google.com>
14283
14284         * archive.cc (Archive::total_archives, Archive::total_members)
14285         (Archive::total_members_loaded): New variables.
14286         (Archive::setup): Add parameter.  Add option to preread
14287         archive symbols.
14288         (Archive::read_armap): Add counter.
14289         (Archive::get_file_and_offset): New function.
14290         (Archive::get_elf_object_for_member): New function.
14291         (Archive::read_all_symbols): New function.
14292         (Archive::read_symbols): New function.
14293         (Archive::add_symbols): Add counters.
14294         (Archive::include_all_members): Use armap to find members if it's
14295         already built.
14296         (Archive::include_member): Skip reading symbols if already read.
14297         Factored code into Archive::get_file_and_offset and
14298         Archive::get_elf_object_for_member.  Changed call to
14299         Mapfile::report_include_archive_member.
14300         (Archive::print_stats): New function.
14301         * archive.h: Declare Object and Read_symbols_data classes.
14302         (Archive::Archive): Add initializers for new members.
14303         (Archive::setup): Add parameter.
14304         (Archive::print_stats): New function.
14305         (Archive::total_archives, Archive::total_members)
14306         (Archive::total_members_loaded): New variables.
14307         (Archive::get_file_and_offset): New function.
14308         (Archive::get_elf_object_for_member): New function.
14309         (Archive::read_all_symbols): New function.
14310         (Archive::read_symbols): New function.
14311         (Archive::Archive_member): New class.
14312         (Archive::members_): New member.
14313         (Archive::num_members_): New member.
14314         * main.cc: Include archive.h.
14315         (main): Call Archive::print_stats.
14316         * mapfile.cc (Mapfile::report_include_archive_member): Delete
14317         archive parameter; member_name is now the fully-decorated name.
14318         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
14319         * options.h: (General_options): Add --preread-archive-symbols option.
14320         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
14321         Archive::setup.
14322
14323 2008-08-04  Ian Lance Taylor  <iant@google.com>
14324
14325         * symtab.h (Symbol::use_plt_offset): New function.
14326         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
14327         * powerpc.cc (Relocate::relocate): Likewise.
14328         * sparc.cc (Relocate::relocate): Likewise.
14329         * x86_64.cc (Relocate::relocate): Likewise.
14330         * testsuite/weak_plt.sh: New test.
14331         * testsuite/weak_plt_main.cc: New test.
14332         * testsuite/weak_plt_shared.cc: New test.
14333         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
14334         (check_PROGRAMS): Add weak_plt.
14335         (check_DATA): Add weak_plt_shared.so.
14336         (weak_plt_main_pic.o, weak_plt): New targets.
14337         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
14338         * testsuite/Makefile.in: Rebuild.
14339
14340         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
14341         gcctestdir/ld.
14342         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
14343         * testsuite/Makefile.in: Rebuild.
14344
14345 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
14346
14347         * Makefile.am (POTFILES.in): Set LC_ALL=C.
14348         * Makefile.in: Regenerate.
14349         * po/POTFILES.in: Regenerate.
14350
14351 2008-07-29  Ian Lance Taylor  <iant@google.com>
14352
14353         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
14354         symbols before other symbols.
14355         * testsuite/script_test_2.cc (test_addr): Declare.
14356         (test_addr_alias): Declare.
14357         (main): Check that test_addr and test_addr_alias have the right
14358         values.
14359         * testsuite/script_test_2.t: Define test_addr_alias and
14360         test_addr.
14361
14362 2008-07-24  Ian Lance Taylor  <iant@google.com>
14363
14364         PR 5990
14365         * descriptors.cc: New file.
14366         * descriptors.h: New file.
14367         * gold-threads.h (class Hold_optional_lock): New class.
14368         * fileread.cc: Include "descriptors.h".
14369         (File_read::~File_read): Release descriptor rather than closing
14370         it.
14371         (File_read::open) [file]: Call open_descriptor rather than open.
14372         Set is_descriptor_opened_.
14373         (File_read::open) [memory]: Assert that descriptor is not open.
14374         (File_read::reopen_descriptor): New function.
14375         (File_read::release): Release descriptor.
14376         (File_read::do_read): Make non-const.  Reopen descriptor.
14377         (File_read::read): Make non-const.
14378         (File_read::make_view): Reopen descriptor.
14379         (File_read::do_readv): Likewise.
14380         * fileread.h (class File_read): Add is_descriptor_opened_ field.
14381         Update declarations.
14382         * layout.cc: Include "descriptors.h".
14383         (Layout::create_build_id): Use open_descriptor rather than open.
14384         * output.cc: Include "descriptors.h".
14385         (Output_file::open): Use open_descriptor rather than open.
14386         * archive.cc (Archive::const_iterator): Change Archive to be
14387         non-const.
14388         (Archive::begin, Archive::end): Make non-const.
14389         (Archive::count_members): Likewise.
14390         * archive.h (class Archive): Update declarations.
14391         * object.h (Object::read): Make non-const.
14392         * Makefile.am (CCFILES): Add descriptors.cc.
14393         (HFILES): Add descriptors.h.
14394         * Makefile.in: Rebuild.
14395
14396         PR 6716
14397         * gold.h: Always include <clocale>.  Add Solaris workarounds
14398         following code in binutils/sysdep.h.
14399
14400         PR 6048
14401         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
14402         this->eh_frame_hdr_ is NULL before using it.
14403
14404         * dynobj.cc (Versions::Versions): Update comment.
14405
14406         * dynobj.cc (Versions::Versions): If there is an soname, use it as
14407         the base version name.
14408
14409         * stringpool.cc (Stringpool_template::add_with_length): Set key to
14410         array size plus one.
14411         (Stringpool_template::set_string_offsets): Subtract one from key
14412         before using it as an array index.
14413         (Stringpool_template::get_offset_with_length): Likewise.
14414         (Stringpool_template::write_to_buffer): Likewise.
14415         * stringpool.h (Stringpool_template::get_offset_from_key):
14416         Likewise.
14417
14418 2008-07-23  Ian Lance Taylor  <iant@google.com>
14419
14420         PR 6658
14421         * object.h (Merged_symbol_value::value): Do our best to handle a
14422         negative addend.
14423
14424         PR 6647
14425         * script.cc (Version_script_info::get_versions): Don't add empty
14426         version tag to return value.
14427         (Version_script_info::get_symbol_version_helper): Change return
14428         type to bool.  Add pversion parameter.  Change all callers.
14429         (script_register_vers_node): Don't require a non-NULL tag.
14430         * script.h (class Version_script_info): Update declarations.
14431         (Version_script_info::get_symbol_version): Change return type to
14432         bool.  Add version parameter.  Change all callers.
14433         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
14434         handling.  Handle an empty version from a version script.
14435         (Symbol_table::define_special_symbol): Likewise.
14436         * testsuite/ver_test_10.script: New file.
14437         * testsuite/ver_test_10.sh: New file.
14438         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
14439         (check_DATA): Add ver_test_10.syms.
14440         (ver_test_10.syms, ver_test_10.so): New target.
14441         * testsuite/Makefile.in: Rebuild.
14442
14443 2008-07-23  Simon Baldwin  <simonb@google.com>
14444
14445         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
14446         to zero for undefined symbols from dynamic libraries.
14447
14448 2008-07-23  Ian Lance Taylor  <iant@google.com>
14449
14450         * symtab.cc (Symbol_table::resolve): Remove version parameter.
14451         Change all callers.
14452         * symtab.h (class Symbol_table): Update declaration.
14453         * testsuite/ver_test_9.cc: New file.
14454         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
14455         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
14456         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
14457         (ver_test_9.so, ver_test_9.o): New targets.
14458         * testsuite/Makefile.in: Rebuild.
14459
14460 2008-07-22  Ian Lance Taylor  <iant@google.com>
14461
14462         * options.h (class General_options): Define --check-sections.
14463         * layout.cc (Layout::set_segment_offsets): Handle
14464         --check-sections.
14465
14466         * options.h (class General_options): Define -n/--nmagic and
14467         -N/--omagic.
14468         * options.cc (General_options::finalize): For -n/--nmagic or
14469         -N/--omagic, set -static.
14470         * layout.cc (Layout::attach_allocated_section_to_segment): If
14471         -N/--omagic, don't put read-only and read-write sections in
14472         different segments.
14473         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
14474         finding a read-only segment.
14475         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
14476         don't set the minimum segment alignment to the common page size,
14477         and don't set the file offset to the address modulo the page size.
14478         * script-sections.cc (Script_sections::create_segments): If
14479         -n/--omagic, don't put read-only and read-write sections in
14480         different segments.
14481
14482         * cref.cc: New file.
14483         * cref.h: New file.
14484         * options.h (class General_options): Add --print-symbol-counts.
14485         * main.cc (main): Issue defined symbol report if requested.
14486         * archive.cc (Archive::interpret_header): Make into a const member
14487         function.
14488         (Archive::add_symbols): Call Input_objects::archive_start and
14489         archive_stop.
14490         (Archive::const_iterator): Define new class.
14491         (Archive::begin, Archive::end): New functions.
14492         (Archive::include_all_members): Rewrite to use iterator.
14493         (Archive::count_members): New function.
14494         * archive.h (class Archive): Update declarations.
14495         (Archive::filename): New function.
14496         * object.cc: Include "cref.h".
14497         (Sized_relobj::Sized_relobj): Initialize defined_count_.
14498         (Sized_relobj::do_get_global_symbol_counts): New function.
14499         (Input_objects::add_object): Add object to cross-referencer.
14500         (Input_objects::archive_start): New function.
14501         (Input_objects::archive_stop): New function.
14502         (Input_objects::print_symbol_counts): New function.
14503         * object.h: Declare Cref and Archive.
14504         (Object::get_global_symbol_counts): New function.
14505         (Object::do_get_global_symbol_counts): New pure virtual function.
14506         (class Sized_relobj): Add defined_count_ field.  Update
14507         declarations.
14508         (class Input_objects): Add cref_ field.  Update constructor.
14509         Update declarations.
14510         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
14511         defined_count_.
14512         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
14513         symbol counts.
14514         (Sized_dynobj::do_get_global_symbol_counts): New function.
14515         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
14516         defined_count_.  Update declarations.  Define Symbols typedef.
14517         * symtab.cc (Symbol_table::add_from_relobj): Add defined
14518         parameter.  Change all callers.
14519         (Symbol_table::add_from_dynobj): Add sympointers and defined
14520         parameters.  Change all callers.
14521         * symtab.h (class Symbol_table): Update declarations.
14522         * Makefile.am (CCFILES): Add cref.cc.
14523         (HFILES): Add cref.h.
14524         * Makefile.in: Rebuild.
14525
14526 2008-07-22  Simon Baldwin  <simonb@google.com>
14527
14528         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
14529         to zero when writing undefined symbols.
14530
14531 2008-07-22  Ian Lance Taylor  <iant@google.com>
14532
14533         * output.cc (Output_section::add_input_section): Don't try to
14534         merge empty merge sections.
14535
14536 2008-07-21  Craig Silverstein  <csilvers@google.com>
14537
14538         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
14539         Include symbol version in error message.
14540
14541 2008-07-20  Chris Demetriou  <cgd@google.com>
14542
14543         * configure.ac (gold_cv_c_random_seed): New configured variable.
14544         (RANDOM_SEED_CFLAGS): New substituted variable.
14545         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
14546         * configure: Rebuild.
14547         * Makefile.in: Likewise.
14548         * testsuite/Makefile.in: Likewise.
14549
14550 2008-07-18  Ian Lance Taylor  <iant@google.com>
14551
14552         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
14553         where we see NAME/NULL and NAME/VERSION  as separate symbols.
14554         * testsuite/ver_test_main.cc (main): Call t4.
14555         (t4, t4_2a): Define.
14556         * testsuite/ver_test_2.cc (t4_2): Define.
14557         * testsuite/ver_test_2.script: Put t4_2a in VER2.
14558         * testsuite/ver_test_4.cc (t4_2a): Define.
14559         * testsuite/ver_test_4.script: Put t4_2a in VER2.
14560         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
14561
14562 2008-07-17  Ian Lance Taylor  <iant@google.com>
14563
14564         * dynobj.cc (Versions::add_def): If we give an error about a
14565         missing version, go ahead and create the version anyhow.
14566
14567 2008-07-10  Ian Lance Taylor  <iant@google.com>
14568
14569         Handle output sections with more than 0x7fffffff bytes.
14570         * object.h (class Relobj): Change map_to_output_ to
14571         output_sections_, and just keep a section pointer.  Change all
14572         uses.  Move comdat group support to Sized_relobj.
14573         (Relobj::is_section_specially_mapped): Remove.
14574         (Relobj::output_section): Remove poff parameter.  Change all
14575         callers.
14576         (Relobj::output_section_offset): New function.
14577         (Relobj::set_section_offset): Rewrite.
14578         (Relobj::map_to_output): Remove.
14579         (Relobj::output_sections): New function.
14580         (Relobj::do_output_section_offset): New pure virtual function.
14581         (Relobj::do_set_section_offset): Likewise.
14582         (class Sized_relobj): Add section_offsets_ field.  Add comdat
14583         group support from Relobj.  Update declarations.
14584         (Sized_relobj::get_output_section_offset): New function.
14585         (Sized_relobj::do_output_section_offset): New function.
14586         (Sized_relobj::do_set_section_offset): New function.
14587         * object.cc (Relobj::output_section_address): Remove.
14588         (Sized_relobj::Sized_relobj): Initialize new fields.
14589         (Sized_relobj::include_section_group): Cast find_kept_object to
14590         Sized_relobj.
14591         (Sized_relobj::include_linkonce_section): Likewise.
14592         (Sized_relobj::do_layout): Use separate arrays for output section
14593         and output offset.
14594         (Sized_relobj::do_count_local_symbols): Change map_to_output to
14595         output_sections.
14596         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
14597         output_sections and section_offsets.
14598         (Sized_relobj::write_local_symbols): Likewise.
14599         (map_to_kept_section): Compute output address directly.
14600         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
14601         output_sections and section_offsets.
14602         (Sized_relobj::write_sections): Likewise.
14603         (Sized_relobj::relocate_sections): Likewise.
14604         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
14605         * output.h (class Output_reloc): Update declarations.  Change
14606         u2_.relobj to Sized_relobj*.
14607         (class Output_data_reloc): Change add functions to use
14608         Sized_relobj*.
14609         * output.cc (Output_reloc::Output_reloc): Change relobj to
14610         Sized_relobj*.
14611         (Output_reloc::local_section_offset): Change return type to
14612         Elf_Addr.  Use get_output_section_offset.
14613         (Output_reloc::get_address): Likewise.
14614         (Output_section::is_input_address_mapped): Don't call
14615         is_section_specially_mapped.
14616         (Output_section::output_offset): Likewise.
14617         (Output_section::output_address): Likewise.
14618         (Output_section::starting_output_address): Likewise.
14619         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
14620         parameter to Sized_relobj*.
14621         (Copy_relocs::need_copy_reloc): Likewise.
14622         (Copy_relocs::save): Likewise.
14623         * copy-relocs.h (class Copy_relocs): Update declarations.
14624         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
14625         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
14626         * target-reloc.h (relocate_for_relocatable): Change
14627         offset_in_output_section type to Elf_Addr.  Change code that uses
14628         it as well.
14629         * layout.cc (Layout::layout): Always set *off.
14630         * mapfile.cc (Mapfile::print_input_section): Use
14631         output_section_offset.
14632         * i386.cc (Target_i386::copy_reloc): Change object parameter to
14633         Sized_relobj*.
14634         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
14635         * sparc.cc (Target_sparc::copy_reloc): Likewise.
14636         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
14637
14638 2008-07-03  Ian Lance Taylor  <iant@google.com>
14639
14640         * layout.cc (Layout::include_section): Do not discard unrecognized
14641         SHT_STRTAB sections.
14642
14643 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
14644
14645         * script.cc (Lex::can_continue_name): Make '?' allowable in
14646         version-script names.
14647         * testsuite/version_script.map: Change glob pattern to use '?'
14648
14649 2008-06-30  Manish Singh  <yosh@gimp.org>
14650
14651         PR 6585
14652         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
14653         Correct typo.
14654
14655 2008-06-30  Ian Lance Taylor  <iant@google.com>
14656
14657         PR 6660
14658         PR 6682
14659         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
14660         versions]: Don't try to read the value in the contents, since we
14661         don't use it.  Use the template endianness when writing.
14662
14663 2008-06-25  Cary Coutant  <ccoutant@google.com>
14664
14665         * fileread.cc (File_read::make_view): Assert on zero-length view.
14666         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
14667         symbol table when there are no symbols to read.
14668
14669 2008-06-23  Craig Silverstein  <csilvers@google.com>
14670
14671         * version.cc (version_string): Bump to 1.7
14672
14673 2008-06-18  Craig Silverstein  <csilvers@google.com>
14674
14675         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
14676         constant 0xFFFF to type Valtype.
14677         (Powerpc_relocate_functions::rel16_ha): Likewise.
14678
14679 2008-06-17  Ian Lance Taylor  <iant@google.com>
14680
14681         * output.h (Output_section::Input_section): Initialize p2align_ to
14682         zero for Output_section_data constructors.
14683         (Output_section::Input_section::addralign): If not an input
14684         section, return the alignment of the Output_section_data.
14685         * testsuite/copy_test.cc: New file.
14686         * testsuite/copy_test_1.cc: New file.
14687         * testsuite/copy_test_2.cc: New file.
14688         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
14689         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
14690         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
14691         (copy_test_1_pic.o, copy_test_1.so): New targets.
14692         (copy_test_2_pic.o, copy_test_2.so): New targets.
14693         * testsuite/Makefile.in: Rebuild.
14694
14695         * script-sections.cc (Script_sections::place_orphan): Initialize
14696         local variable exact.
14697
14698 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
14699
14700         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
14701
14702 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
14703             David S. Miller  <davem@davemloft.net>
14704
14705         * powerpc.cc: New file.
14706         * Makefile.am (TARGETSOURCES): Add powerpc.cc
14707         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
14708         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
14709         * Makefile.in: Rebuild.
14710
14711 2008-06-09  Ian Lance Taylor  <iant@google.com>
14712
14713         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
14714         <exception>.
14715         (throwing, orig_terminate): New static variables.
14716         (terminate_handler): New static function.
14717         (t2): Set terminate handler.
14718
14719 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
14720
14721         PR 6584
14722         * binary.cc (Binary_to_elf::sized_convert): Fix .data
14723         alignment.
14724
14725 2008-05-30  Cary Coutant  <ccoutant@google.com>
14726
14727         * archive.cc (Archive::include_all_members) Correct to step
14728         over symbol table and extended name table in thin archives.
14729
14730 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
14731
14732         PR 6407
14733         * target-reloc.h (relocate_for_relocatable): Fix new_offset
14734         calculation.
14735
14736 2008-05-28  Caleb Howe  <cshowe@google.com>
14737
14738         * reduced_debug_output.cc: New file.
14739         * reduced_debug_output.h: New file.
14740         * options.h (class General_options): Add --strip-debug-non-line.
14741         * options.cc (General_options::finalize): Add strip_debug_non_line
14742         to the strip heirarchy.
14743         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
14744         fields.
14745         * layout.cc: Include "reduced_debug_output.h".
14746         (Layout::Layout): Initialize new fields.
14747         (line_only_debug_sections): New static array.
14748         (is_lines_only_debug_sections): New static inline function.
14749         (Layout::include_section): Handle --strip-debug-non-line.
14750         (Layout::make_output_section): If --strip-debug-non-line, build
14751         new output sections for .debug_abbrev and .debug_info.
14752         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
14753         gold.  Warn about possible overflow.
14754         (read_signed_LEB_128): Likewise.
14755         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
14756         (read_signed_LEB_128): Declare.
14757         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
14758         (HFILES): Add reduced_debug_output.h.
14759         * Makefile.in: Rebuild.
14760
14761 2008-05-21  Ian Lance Taylor  <iant@google.com>
14762
14763         * mapfile.cc: New file.
14764         * mapfile.h: New file.
14765         * options.h (class General_options): Add -M/--print-map and -Map.
14766         * options.cc (General_options::finalize): Make -M equivalent to
14767         -Map -.
14768         * main.cc: Include <cstdio> and "mapfile.h".
14769         (main): Open mapfile if requested.
14770         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
14771         constructor.  Change caller.
14772         (queue_initial_tasks): Add mapfile parameter.  Change caller.
14773         (queue_middle_tasks): Likewise.
14774         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
14775         declarations.
14776         * archive.cc: Include "mapfile.h".
14777         (Archive::add_symbols): Add mapfile parameter.  Change all
14778         callers.  Pass mapfile, symbol, and reason to include_member.
14779         (Archive::include_all_members): Add mapfile parameter.  Change all
14780         callers.
14781         (Archive::include_member): Add mapfile, sym, and why parameters.
14782         Change all callers.  Report inclusion to map file.
14783         * archive.h: Include "fileread.h".
14784         (class Archive): Update declarations.
14785         (Archive::file): New const method.
14786         (class Add_archive_symbols): Add mapfile_ field.  Update
14787         constructor.  Change all callers.
14788         * readsyms.h (class Read_symbols): Likewise.
14789         (class Finish_group): Likewise.
14790         (class Read_script): Likewise.
14791         * common.cc: Include "mapfile.h".
14792         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
14793         all callers.
14794         (Symbol_table::do_allocate_commons): Likewise.
14795         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
14796         symbol allocation to mapfile.
14797         * common.h (class Allocate_commons_task): Add mapfile_ field.
14798         Update constructor.  Change all callers.
14799         * symtab.h (class Symbol_table): Update declarations.
14800         * layout.cc: Include "mapfile.h".
14801         (Layout_task_runner::run): Print information to mapfile.
14802         (Layout::create_gold_note): Change Output_data_fixed_space to
14803         Output_data_zero_fill.
14804         (Layout::create_build_id): Likewise.
14805         (Layout::print_to_mapfile): New function.
14806         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
14807         constructor.  Change caller.
14808         (class Layout): Declare print_to_mapfile.
14809         * output.cc (Output_section::Input_section::print_to_mapfile): New
14810         function.
14811         (Output_section::add_input_section): If producing a map, always
14812         add to input_sections_ list.
14813         (Output_section::do_print_to_mapfile): New function.
14814         (Output_segment::print_sections_to_mapfile): New function.
14815         (Output_segment::print_section_list_to_mapfile): New function.
14816         * output.h: Include "mapfile.h".
14817         (Output_data::print_to_mapfile): New function.
14818         (Output_data::do_print_to_mapfile): New virtual function.
14819         (Output_segment_headers::do_print_to_mapfile): New function.
14820         (Output_file_header::do_print_to_mapfile): New function.
14821         (Output_data_const::do_print_to_mapfile): New function.
14822         (class Output_data_const_buffer): Add map_name_ field.  Update
14823         constructor.  Change all callers.  Add do_print_to_mapfile
14824         function.
14825         (class Output_data_fixed_space): Likewise.
14826         (class Output_data_space): Likewise.
14827         (class Output_data_zero_fill): New class.
14828         (Output_data_strtab::do_print_to_mapfile): New function.
14829         (Output_data_reloc_base::do_print_to_mapfile): New function.
14830         (Output_relocatable_relocs::do_print_to_mapfile): New function.
14831         (Output_data_group::do_print_to_mapfile): New function.
14832         (Output_data_got::do_print_to_mapfile): New function.
14833         (Output_data_dynamic::do_print_to_mapfile): New function.
14834         (Output_symtab_xindex::do_print_to_mapfile): New function.
14835         (class Output_section): Declare do_print_to_mapflie.  Declare
14836         print_to_mapfile in Input_section.
14837         (class Output_segment): Declare new functions.
14838         * object.h (Sized_relobj::symbol_count): New function.
14839         * script-sections.cc
14840         (Output_section_element_dot_assignment::set_section_addresses):
14841         Change Output_data_fixed_space to Output_data_zero_fill.
14842         (Output_data_expression::do_print_to_mapfile): New function.
14843         * script.cc (read_input_script): Add mapfile parameter.  Change
14844         all callers.
14845         * script.h (read_input_script): Update declaration.
14846         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
14847         (Eh_frame::do_print_to_mapfile): New function.
14848         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
14849         (Output_merge_string::do_print_to_mapfile): New function.
14850         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
14851         function.
14852         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
14853         function.
14854         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
14855         function.
14856         * Makefile.am (CCFILES): Add mapfile.cc.
14857         (HFILES): Add mapfile.h.
14858         * Makefile.in: Rebuild.
14859
14860 2008-05-19  Ian Lance Taylor  <iant@google.com>
14861
14862         * options.h (class General_options): Add -z relro.
14863         * layout.cc (Layout::Layout): Initialize relro_segment_.
14864         (Layout::add_output_section_data): Return the output section.
14865         (Layout::make_output_section): Rcognize relro sections and mark
14866         them appropriately.
14867         (Layout::attach_allocated_section_to_segment): Put relro sections
14868         in a PT_GNU_RELRO segment.
14869         (Layout::create_initial_dynamic_sections): Mark the .dynamic
14870         section as relro.
14871         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
14872         PT_TLS segments.
14873         (Layout::linkonce_mapping): Map d.rel.ro.local to
14874         .data.rel.ro.local.
14875         (Layout::output_section_name): Us .data.rel.ro.local for any
14876         section which begins with that.
14877         * layout.h (class Layout): Update add_output_section_data
14878         declaration.  Add relro_segment_ field.
14879         * output.cc (Output_section::Output_section): Initialize is_relro_
14880         and is_relro_local_ fields.
14881         (Output_segment::add_output_section): Group relro sections.
14882         (Output_segment::is_first_section_relro): New function.
14883         (Output_segment::maximum_alignment): If there is a relro section,
14884         align the segment to the common page size.
14885         (Output_segment::set_section_addresses): Track whether we are
14886         looking at relro sections.  If the last section is a relro
14887         section, align to the common page size.
14888         (Output_segment::set_section_list_addresses): Add in_relro
14889         parameter.  Change all callers.  Align to the page size when
14890         moving from relro to non-relro section.
14891         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
14892         segment.
14893         * output.h (class Output_section): Add is_relro_ and
14894         is_relro_local_ fields.
14895         (Output_section::is_relro): New function.
14896         (Output_section::set_is_relro): New function.
14897         (Output_section::is_relro_local): New function.
14898         (Output_section::set_is_relro_local): New function.
14899         (class Output_segment): Update declarations.
14900         * i386.cc (Target_i386::got_section): Mark .got section as relro.
14901         * sparc.cc (Target_sparc::got_section): Likewise.
14902         * x86_64.cc (Target_x86_64::got_section): Likewise.
14903         * testsuite/relro_test_main.cc: New file.
14904         * testsuite/relro_test.cc: New file.
14905         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
14906         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
14907         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
14908         (relro_test.so, relro_test_pic.o): New targets.
14909         * testsuite/Makefile.in: Rebuild.
14910
14911 2008-05-16  Ian Lance Taylor  <iant@google.com>
14912
14913         * output.cc (Output_segment::add_output_section): Remove front
14914         parameter.
14915         * output.h (class Output_segment): Remove
14916         add_initial_output_section and overloaded add_output_section.
14917         Update declaration of remaining add_output_section.
14918         * layout.cc (Layout::create_interp): Call add_output_section
14919         rather than add_initial_output_section.
14920         (Layout::finish_dynamic_section): Likewise.
14921
14922         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
14923         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
14924         know the dynamic type.
14925         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
14926         field.  Initialize it in constructor.
14927         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
14928         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
14929         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
14930         reloc.
14931
14932         * output.cc (Output_reloc::get_address): Change return type to
14933         Elf_Addr.
14934         * output.h (class Output_reloc): Update get_address declaration.
14935         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
14936         for section addresses.
14937
14938 2008-05-09  Ian Lance Taylor  <iant@google.com>
14939
14940         PR 6493
14941         * gold.cc (gold_nomem): Use return value of write.
14942
14943 2008-05-08  Ian Lance Taylor  <iant@google.com>
14944
14945         * symtab.c (Symbol::init_base_output_data): Add version
14946         parameter.  Change all callers.
14947         (Symbol::init_base_output_segment): Likewise.
14948         (Symbol::init_base_constant): Likewise.
14949         (Symbol::init_base_undefined): Likewise.
14950         (Sized_symbol::init_output_data): Likewise.
14951         (Sized_symbol::init_output_segment): Likewise.
14952         (Sized_symbol::init_constant): Likewise.
14953         (Sized_symbol::init_undefined): Likewise.
14954         (Symbol_table::do_define_in_output_data): If the new symbol has a
14955         version, mark it as the default.
14956         (Symbol_table::do_define_in_output_segment): Likewise.
14957         (Symbol_table::do_define_as_constant): Likewise.
14958         * symtab.h (class Symbol): Update declarations.
14959         (class Sized_symbol): Likewise.
14960         * resolve.cc (Symbol::override_version): New function.
14961         (Symbol::override_base): Call override_version.
14962         (Symbol::override_base_with_special): Likewise.
14963         * testsuite/ver_script_8.script: New file.
14964         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
14965         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
14966         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
14967         (ver_test_8_1.so, ver_test_8_2.so): New targets.
14968
14969 2008-05-06  Ian Lance Taylor  <iant@google.com>
14970
14971         PR 6049
14972         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
14973         functions.
14974         (class General_options): Remove existing --undefined, and add
14975         --no-undefined instead.  Add new --undefined as synonym for -u.
14976         * archive.cc (Archive::add_symbols): Check whether symbol was
14977         named with -u.
14978         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
14979         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
14980         all uses.  Add IS_UNDEFINED.  Update declarations to split
14981         different versions of init_base.  Declare init_base_undefined.
14982         (Symbol::is_defined): Handle IS_UNDEFINED.
14983         (Symbol::is_undefined): Likewise.
14984         (Symbol::is_weak_undefined): Call is_undefined.
14985         (Symbol::is_absolute): Handle IS_CONSTANT.
14986         (class Sized_symbol): Update declarations to split different
14987         versions of init.  Declare init_undefined.
14988         (class Symbol_table): Declare new functions.
14989         * symtab.cc (Symbol::init_base_object): Rename from init_base.
14990         Change all callers.
14991         (Symbol::init_base_output_data): Likewise.
14992         (Symbol::init_base_output_segment): Likewise.
14993         (Symbol::init_base_constant): Likewise.
14994         (Symbol::init_base_undefined): New function.
14995         (Sized_symbol::init_object): Rename from init.  Change all
14996         callers.
14997         (Sized_symbol::init_output_data): Likewise.
14998         (Sized_symbol::init_output_segment): Likewise.
14999         (Sized_symbol::init_constant): Likewise.
15000         (Sized_symbol::init_undefined): New function.
15001         (Symbol_table::add_undefined_symbols_from_command_line): New
15002         function.
15003         (Symbol_table::do_add_undefined_symbols_from_command_line): New
15004         function.
15005         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
15006         (Symbol::output_section): Likewise.
15007         (Symbol::set_output_section): Likewise.
15008         (Symbol_table::sized_finalize_symbol): Likewise.
15009         (Symbol_table::sized_write_globals): Likewise.
15010         * resolve.cc (Symbol_table::should_override): Likewise.
15011         (Symbol::override_base_with_special): Likewise.
15012
15013         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
15014         symbol, change it to have default visibility.
15015         * testsuite/protected_1.cc: New file.
15016         * testsuite/protected_2.cc: New file.
15017         * testsuite/protected_3.cc: New file.
15018         * testsuite/protected_main_1.cc: New file.
15019         * testsuite/protected_main_2.cc: New file.
15020         * testsuite/protected_main_3.cc: New file.
15021         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
15022         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
15023         (protected_1_LDFLAGS, protected_1_LDADD): Define.
15024         (protected_1.so): New target.
15025         (protected_1_pic.o, protected_2_pic.o): New targets.
15026         (protected_3_pic.o): New target.
15027         (check_PROGRAMS): Add protected_2.
15028         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
15029         (protected_2_LDFLAGS, protected_2_LDADD): Define.
15030         * testsuite/Makefile.in: Rebuild.
15031
15032         * options.h (DEFINE_var): Add set_user_set_##varname__.
15033         (DEFINE_bool_alias): New macro.
15034         (class General_options): Define -Bstatic using DEFINE_bool_alias
15035         rather than DEFINE_special.  Add --undefined as an alias for -z
15036         defs.
15037         * options.cc (General_options::parse_Bstatic): Remove.
15038
15039         * options.h (class General_options): Add --fatal-warnings.
15040         * main.cc (main): Implement --fatal-warnings.
15041         * errors.h (Errors::warning_count): New function.
15042
15043         * options.h (class General_options): Add -Bsymbolic-functions.
15044         * symtab.h (Symbol::is_preemptible): Check for
15045         -Bsymbolic-functions.
15046
15047 2008-05-05  Ian Lance Taylor  <iant@google.com>
15048
15049         * options.h (DEFINE_bool): For DASH_Z, create the negative option
15050         as noVARNAME rather than no-VARNAME.
15051         (class General_options): Add option -z combreloc.
15052         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
15053         get_address.
15054         (Output_reloc::sort_before) [SHT_REL]: New function.
15055         (Output_reloc::sort_before) [SHT_RELA]: New function.
15056         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
15057         Sort_relocs_comparison.
15058         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
15059         parameter.  Change all callers.
15060         (Output_data_reloc::Output_data_reloc) [both versions]: Add
15061         sort_relocs parameter.  Change all callers.
15062         * output.cc (Output_reloc::get_address): New function, broken out
15063         of write_rel.
15064         (Output_reloc::write_rel): Call it.
15065         (Output_reloc::compare): New function.
15066         (Output_data_reloc_base::do_write): Optionally sort relocs.
15067
15068         * configure.ac: If targ_extra_obj is set, link it in.
15069         * configure.tgt: Initialize all variables.
15070         (x86_64*): Set targ_extra_obj and targ_extra_size.
15071         * configure: Rebuild.
15072
15073         * object.cc (Sized_relobj::include_section_group): Adjust section
15074         indexes read from group data.  Build vector to pass to
15075         layout_group.
15076         * layout.cc (Layout::layout_group): Add flags and shndxes
15077         parameters.  Remove contents parameter.  Change caller.  Update
15078         explicit instantiations.
15079         * layout.h (class Layout): Update layout_group declaration.
15080         * output.cc (Output_data_group::Output_data_group): Add flags and
15081         input_shndxes parameters.  Remove contents parameter.  Change
15082         caller.
15083         (Output_data_group::do_write): Change input_sections_ to
15084         input_shndxes_.
15085         * output.h (class Output_data_group): Update constructor
15086         declaration.  Rename input_sections_ to input_shndxes_.
15087         * testsuite/many_sections_test.cc: Add template.
15088
15089 2008-04-30  Cary Coutant  <ccoutant@google.com>
15090
15091         * target-reloc.h (relocate_section): Fix dead-pointer bug.
15092
15093         * layout.cc (Layout::include_section): Refactored check for debug
15094         info section.
15095         (Layout::add_comdat): Add new parameters.  Change type
15096         of signature parameter.  Add object and shndx to signatures table.
15097         (Layout::find_kept_object): New function.
15098         * layout.h: Include <cstring>.
15099         (Layout::is_debug_info_section): New function.
15100         (Layout::add_comdat): Add new parameters.
15101         (Layout::find_kept_object): New function.
15102         (Layout::Kept_section): New struct.
15103         (Layout::Signatures): Change type of map range.
15104         * object.cc (Relobj::output_section_address): New function.
15105         (Sized_relobj::include_section_group): Add new parameters.  Change
15106         calls to Layout::add_comdat.  Change to build table of kept comdat
15107         groups and table mapping discarded sections to kept sections.
15108         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
15109         (Sized_relobj::do_layout): Change calls to include_section_group and
15110         include_linkonce_section.
15111         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
15112         value to zero when section is discarded.
15113         (Sized_relobj::map_to_kept_section): New function.
15114         * object.h (Relobj::output_section_address): New function.
15115         (Relobj::Comdat_group): New type.
15116         (Relobj::find_comdat_group): New function.
15117         (Relobj::Comdat_group_table): New type.
15118         (Relobj::Kept_comdat_section): New type.
15119         (Relobj::Kept_comdat_section_table): New type.
15120         (Relobj::add_comdat_group): New function.
15121         (Relobj::set_kept_comdat_section): New function.
15122         (Relobj::get_kept_comdat_section): New function.
15123         (Relobj::comdat_groups_): New field.
15124         (Relobj::kept_comdat_sections_): New field.
15125         (Symbol_value::input_value): Update comment.
15126         (Sized_relobj::map_to_kept_section) New function.
15127         (Sized_relobj::include_linkonce_section): Add new parameter.
15128         * target-reloc.h (Comdat_behavior): New type.
15129         (get_comdat_behavior): New function.
15130         (relocate_section): Add code to map a discarded section to the
15131         corresponding kept section when applying a relocation.
15132
15133 2008-04-30  Craig Silverstein  <csilvers@google.com>
15134
15135         * dwarf_reader.cc (next_generation_count): New static var.
15136         (Addr2line_cache_entry): New struct.
15137         (addr2line_cache): New static var.
15138         (Dwarf_line_info::one_addr2line): Added caching.
15139         (Dwarf_line_info::clear_addr2line_cache): New function.
15140         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
15141         cache-size parameter.
15142         (Dwarf_line_info::one_addr2line_cache): New function.
15143         * symtab.cc (Symbol_table::detect_odr_violations): Pass
15144         new cache-size argument to one_addr2line(), and clear cache.
15145
15146 2008-04-28  Cary Coutant  <ccoutant@google.com>
15147
15148         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
15149         R_386_PC8 relocations.
15150
15151 2008-04-23  Ian Lance Taylor  <iant@google.com>
15152
15153         * object.cc (Sized_relobj::include_section_group): Check for
15154         invalid section group.
15155
15156         * object.cc (make_elf_object): Correct test for 64-bit ELF file
15157         header size.
15158
15159         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
15160         than read for file header.
15161         * archive.cc (Archive::include_member): Likewise.
15162
15163 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
15164
15165         * aclocal.m4: Regenerate.
15166         * configure: Regenerate.
15167
15168 2008-04-19  Ian Lance Taylor  <iant@google.com>
15169
15170         * version.cc (version_string): Bump to 1.6.
15171
15172         * testsuite/Makefile.am (many_sections_r_test): New target.
15173         (many_sections_r_test_SOURCES): Remove.
15174         (many_sections_r_test_DEPENDENCIES): Remove.
15175         (many_sections_r_test_LDFLAGS): Remove.
15176         (many_sections_r_test_LDADD): Remove.
15177
15178         * object.cc (Sized_relobj::do_add_symbols): Always pass
15179         local_symbol_count_ to add_from_relobj.
15180
15181         * testsuite/Makefile.am (many_sections_check.h): Only check one in
15182         every thousand variables.
15183         * testsuite/Makefile.in: Rebuild.
15184
15185         * object.cc (Xindex::initialize_symtab_xindex): New function.
15186         (Xindex::read_symtab_xindex): New function.
15187         (Xindex::sym_xindex_to_shndx): New function.
15188         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
15189         available.
15190         (Sized_relobj::do_initialize_xindex): New function.
15191         (Sized_relobj::do_read_symbols): Adjust section links.
15192         (Sized_relobj::symbol_section_and_value): Add is_ordinary
15193         parameter.  Change all callers.
15194         (Sized_relobj::include_section_group): Adjust section links and
15195         symbol section indexes.
15196         (Sized_relobj::do_layout): Adjust section links.
15197         (Sized_relobj::do_count_local_symbols): Adjust section links and
15198         symbol section indexes.
15199         (Sized_relobj::do_finalize_local_symbols): Distinguish between
15200         ordinary and special symbols.
15201         (Sized_relobj::write_local_symbols): Add symtab_xindex and
15202         dynsym_xindex parameters.  Change all callers.  Adjust section
15203         links.  Use SHN_XINDEX when needed.
15204         (Sized_relobj::get_symbol_location_info): Adjust section links.
15205         Don't get fooled by special symbols.
15206         * object.h (class Xindex): Define.
15207         (class Object): Add xindex_ parameter.  Declare virtual functoin
15208         do_initialize_xindex.
15209         (Object::adjust_sym_shndx): New function.
15210         (Object::set_xindex): New protected function.
15211         (class Symbol_value): Add is_ordinary_shndx_ field.
15212         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
15213         (Symbol_value::value): Assert ordinary section.
15214         (Symbol_value::initialize_input_to_output_map): Likewise.
15215         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
15216         Change all callers.
15217         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
15218         all callers.
15219         (class Sized_relobj): Update declarations.
15220         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
15221         parameter.  Change all callers.
15222         (Sized_relobj::adjust_shndx): New function.
15223         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
15224         field.
15225         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
15226         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
15227         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
15228         (Sized_dynobj::read_dynsym_section): Adjust section links.
15229         (Sized_dynobj::read_dynamic): Likewise.
15230         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
15231         section links.
15232         (Sized_dynobj::do_initialize_xindex): New function.
15233         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
15234         do_initialize_xindex.
15235         (Sized_dynobj::adjust_shndx): New function.
15236         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
15237         dynsym_xindex_ fields.
15238         (Layout::finalize): Add a call to set_section_indexes before
15239         creating the symtab sections.
15240         (Layout::set_section_indexes): Don't do anything if the section
15241         already has a section index.
15242         (Layout::create_symtab_sections): Add shnum parameter.  Change
15243         caller.  Create .symtab_shndx section if needed.
15244         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
15245         caller.
15246         (Layout::allocated_output_section_count): New function.
15247         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
15248         needed.
15249         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
15250         fields.  Update declarations.
15251         (Layout::symtab_xindex): New function.
15252         (Layout::dynsym_xindex): New function.
15253         (class Write_symbols_task): Add layout_ field.
15254         (Write_symbols_task::Write_symbols_task): Add layout parameter.
15255         Change caller.
15256         * output.cc (Output_section_headers::Output_section_headers): Add
15257         shstrtab_section parameter.  Change all callers.
15258         (Output_section_headers::do_sized_write): Store overflow values
15259         for section count and section string table section index in
15260         section header zero.
15261         (Output_file_header::do_sized_write): Check for overflow of
15262         section count and section string table section index.
15263         (Output_symtab_xindex::do_write): New function.
15264         (Output_symtab_xindex::endian_do_write): New function.
15265         * output.h (class Output_section_headers): Add shstrtab_section_.
15266         Update declarations.
15267         (class Output_symtab_xindex): Define.
15268         (Output_section::has_out_shndx): New function.
15269         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
15270         field.
15271         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
15272         Change all callers.
15273         (Sized_symbol::init): Likewise.
15274         (Symbol::output_section): Check for ordinary symbol.
15275         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
15276         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
15277         callers.
15278         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
15279         Change all callers.  Simplify handling of symbols from sections
15280         not included in the link.
15281         (Symbol_table::add_from_dynobj): Handle ordinary symbol
15282         distinction.
15283         (Weak_alias_sorter::operator()): Assert that symbols are
15284         ordinary.
15285         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
15286         distinction.
15287         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
15288         parameters.  Change all callers.
15289         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
15290         symbol distinction.  Use SHN_XINDEX when needed.
15291         (Symbol_table::write_section_symbol): Add symtab_xindex
15292         parameter.  Change all callers.
15293         (Symbol_table::sized_write_section_symbol): Likewise.  Use
15294         SHN_XINDEX when needed.
15295         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
15296         declarations.
15297         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
15298         (Symbol::is_defined): Check is_ordinary.
15299         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
15300         (Symbol::is_absolute, Symbol::is_common): Likewise.
15301         (class Sized_symbol): Update declarations.
15302         (class Symbol_table): Update declarations.
15303         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
15304         parameters.  Change all callers.
15305         (Sized_symbol::override): Likewise.
15306         (Symbol_table::override): Likewise.
15307         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
15308         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
15309         is_ordinary, and orig_st_shndx parameters.  Change all callers.
15310         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
15311         to be in an ordinary section.
15312         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
15313         object and is_ordinary parameters.  Change all callers.
15314         (Sized_dwarf_line_info::read_relocs): Add object parameter.
15315         Change all callers.  Don't add undefined or non-ordinary symbols
15316         to reloc_map_.
15317         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
15318         Change all callers.
15319         * dwarf_reader.h (class Sized_dwarf_line_info): Update
15320         declarations.
15321         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
15322         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
15323         (Sized_relobj::relocate_sections): Likewise.
15324         * target-reloc.h (scan_relocs): Adjust section symbol index.
15325         (scan_relocatable_relocs): Likewise.
15326         * i386.cc (Scan::local): Check for ordinary symbols.
15327         * sparc.cc (Scan::local): Likewise.
15328         * x86_64.cc (Scan::local): Likewise.
15329         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
15330         to symbol_section_and_value.
15331         * testsuite/many_sections_test.cc: New file.
15332         * testsuite/Makefile.am (BUILT_SOURCES): Define.
15333         (check_PROGRAMS): Add many_sections_test.
15334         (many_sections_test_SOURCES): Define.
15335         (many_sections_test_DEPENDENCIES): Define.
15336         (many_sections_test_LDFLAGS): Define.
15337         (BUILT_SOURCES): Add many_sections_define.h.
15338         (many_sections_define.h): New target.
15339         (BUILT_SOURCES): Add many_sections_check.h.
15340         (many_sections_check.h): New target.
15341         (check_PROGRAMS): Add many_sections_r_test.
15342         (many_sections_r_test_SOURCES): Define.
15343         (many_sections_r_test_DEPENDENCIES): Define.
15344         (many_sections_r_test_LDFLAGS): Define.
15345         (many_sections_r_test_LDADD): Define.
15346         (many_sections_r_test.o): New target.
15347         * testsuite/Makefile.in: Rebuild.
15348
15349 2008-04-17  Cary Coutant  <ccoutant@google.com>
15350
15351         * errors.cc (Errors::info): New function.
15352         (gold_info): New function.
15353         * errors.h (Errors::info): New function.
15354         * gold.h (gold_info): New function.
15355         * object.cc (Input_objects::add_object): Print trace output.
15356         * options.cc (options::parse_set): New function.
15357         (General_options::parse_wrap): Deleted.
15358         (General_options::General_options): Deleted initializer.
15359         * options.h (options::String_set): New typedef.
15360         (options::parse_set): New function.
15361         (DEFINE_set): New macro.
15362         (General_options::wrap): Changed to use DEFINE_set. Changed
15363         callers of any_wrap_symbols and is_wrap_symbol.
15364         (General_options::trace, General_options::trace_symbol):
15365         New options.
15366         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
15367         (General_options::wrap_symbols_): Deleted.
15368         * symtab.cc (Symbol_table::add_from_object): Print trace output.
15369
15370 2008-04-17  David S. Miller  <davem@davemloft.net>
15371
15372         * options.cc (General_options::parse_V): New function.
15373         * options.h: Add entries for -V and -Qy.
15374
15375 2008-04-17  Ian Lance Taylor  <iant@google.com>
15376
15377         * common.cc (Symbol_table::allocate_commons): Remove options
15378         parameter.  Change caller.
15379         (Symbol_table::do_allocate_commons): Remove options parameter.
15380         Change caller.  Just call do_allocate_commons_list twice.
15381         (Symbol_table::do_allocate_commons_list): New function, broken out
15382         of do_allocate_commons.
15383         * common.h (class Allocate_commons_task): Remove options_ field.
15384         Update constructor.
15385         * symtab.cc (Symbol_table::Symbol_table): Initialize
15386         tls_commons_.
15387         (Symbol_table::add_from_object): Put TLS common symbols on
15388         tls_commons_ list.
15389         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
15390         which are IN_OUTPUT_DATA.
15391         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
15392         allocate_commons and do_allocate_commons declarations.  Declare
15393         do_allocate_commons_list.
15394         * gold.cc (queue_middle_tasks): Update creation of
15395         Allocate_commons_task to not pass options.
15396         * testsuite/Makefile.am (INCLUDES): Add -I.. .
15397         (TLS_TEST_C_FLAGS): New variable.
15398         (tls_test_c_pic.o): New target.
15399         (tls_test_shared.so): Link in tls_test_c_pic.o.
15400         (tls_test_c_pic_ie.o): New target.
15401         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
15402         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
15403         (tls_test_c.o): New target.
15404         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
15405         (tls_pic_test_LDADD): Likewise.
15406         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
15407         (tls_shared_gd_to_ie_test_LDADD): Likewise.
15408         (tls_test_c_gnu2.o): New target.
15409         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
15410         tls_test_c_gnu2.o.
15411         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
15412         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
15413         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
15414         * testsuite/tls_test.cc: Include "config.h".
15415         (t_last): Call t11_last.
15416         * testsuite/tls_test.h (t11, t11_last): Declare.
15417         * testsuite/tls_test_c.c: New file.
15418         * testsuite/tls_test_main.cc (thread_routine): Call t11.
15419         * configure.ac: Check for OpenMP support.
15420         * configure, config.in, Makefile.in: Rebuild.
15421         * testsuite/Makefile.in: Rebuild.
15422
15423 2008-04-16  Cary Coutant  <ccoutant@google.com>
15424
15425         * i386.cc (Target_i386::define_tls_base_symbol): New function.
15426         (Target_i386::tls_base_symbol_defined_): New field.
15427         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
15428         (Target_i386::Scan::global): Likewise.
15429         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
15430         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
15431         (Target_x86_64::tls_base_symbol_defined_): New field.
15432         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
15433         (Target_x86_64::Scan::global): Likewise.
15434
15435 2008-04-16  Cary Coutant  <ccoutant@google.com>
15436
15437         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
15438         (Symbol::needs_plt_entry): Allow weak undefined symbols.
15439         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
15440         building shared libraries.
15441         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
15442         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
15443         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
15444         * testsuite/Makefile.in: Rebuild.
15445         * testsuite/weak_undef.h: New file.
15446         * testsuite/weak_undef_file1.cc: Add extra test cases.
15447         * testsuite/weak_undef_file2.cc: Likewise.
15448         * testsuite/weak_undef_test.cc: Likewise.
15449
15450 2008-04-16  David S. Miller  <davem@davemloft.net>
15451
15452         * sparc.cc (Target_sparc::Scan): Change from struct to class.
15453         Add issued_non_pic_error_ field.  Declare check_non_pic.
15454         (Target_sparc::Scan::check_non_pic): New function.
15455         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
15456         (Target_sparc::Scan::global): Likewise.
15457
15458         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
15459         * configure: Rebuild.
15460
15461         * options.h (DEFINE_enable): New macro.
15462         (new_dtags): New enable option.
15463         (initfirst, interpose, loadfltr, nodefaultlib,
15464         nodelete, nodlopen, nodump): New -z options.
15465         * layout.cc (Layout:finish_dynamic_section): If new
15466         dtags enabled, emit DT_RUNPATH.  Also, emit a
15467         DT_FLAGS_1 containing any specified -z flags.
15468
15469 2008-04-16  Ian Lance Taylor  <iant@google.com>
15470
15471         * copy-relocs.cc: New file.
15472         * copy-relocs.h: New file.
15473         * reloc.cc: Remove Copy_relocs code.
15474         * reloc.h: Likewise.
15475         * reloc-types.h (struct Reloc_types) [both versions]: Add
15476         get_reloc_addend_noerror.
15477         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
15478         variants of add_global which take an addend which must be zero.
15479         * i386.cc: Include "copy-relocs.h".
15480         (class Target_i386): Change type of copy_relocs_ to variable,
15481         update initializer.
15482         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
15483         Change all callers.
15484         (Target_i386::do_finalize_sections): Change handling of
15485         copy_relocs_.
15486         * sparc.cc: Include "copy-relocs.h".
15487         (class Target_sparc): Change type of copy_relocs_ to variable,
15488         update initializer.
15489         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
15490         Change all callers.
15491         (Target_sparc::do_finalize_sections): Change handling of
15492         copy_relocs_.
15493         * x86_64.cc: Include "copy-relocs.h".
15494         (class Target_x86_64): Change type of copy_relocs_ to variable,
15495         update initializer.
15496         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
15497         class.  Change all callers.
15498         (Target_x86_64::do_finalize_sections): Change handling of
15499         copy_relocs_.
15500         * Makefile.am (CCFILES): Add copy-relocs.cc.
15501         (HFILES): Add copy-relocs.h.
15502
15503         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
15504
15505         * testsuite/script_test_4.sh: Permit leading zeroes.
15506
15507 2008-04-15  Ian Lance Taylor  <iant@google.com>
15508
15509         * script-sections.cc (Script_sections::create_segments): Use
15510         header_size_adjustment even when there is enough room for the
15511         headers.
15512         * testsuite/script_test_4.sh: New file.
15513         * testsuite/script_test_4.t: New file.
15514         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
15515         (check_DATA): Add script_test_4.stdout.
15516         (MOSTLYCLEANFILES): Likewise.
15517         (script_test_4): New target.
15518         (script_test_4.stdout): New target.
15519         * testsuite/Makefile.in: Rebuild.
15520
15521         * sparc.cc: Add definitions for Output_data_plt_sparc class
15522         constants.
15523
15524 2008-04-14  David S. Miller  <davem@davemloft.net>
15525
15526         * sparc.cc: New file.
15527         * Makefile.am (TARGETSOURCES): Add sparc.cc
15528         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
15529         * configure.tgt: Document targ_extra_size and
15530         targ_extra_big_endian.  Add entries for sparc-* and
15531         sparc64-*.
15532         * configure.ac: Handle targ_extra_size and
15533         targ_extra_big_endian.
15534         * Makefile.in: Rebuild.
15535         * configure: Likewise.
15536         * po/POTFILES.in: Likewise.
15537         * po/gold.pot: Likewise.
15538
15539 2008-04-14  Ian Lance Taylor  <iant@google.com>
15540
15541         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
15542         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
15543         in the name/type/flags to section mapping.  Don't call
15544         allocate_output_section.
15545         (Layout::choose_output_section): Change parameter from adjust_name
15546         to is_input_section.  Don't permit input sections after sections
15547         are attached to segments.  Don't call allocate_output_section.
15548         (Layout::layout_eh_frame): Call update_flags_for_input_section,
15549         not write_enable_output_section.
15550         (Layout::make_output_section): Don't push to
15551         unattached_section_list_ nor call attach_to_segment.  Call
15552         attach_section_to_segment if sections are attached.
15553         (Layout::attach_sections_to_segments): New function.
15554         (Layout::attach_section_to_segment): New function.
15555         (Layout::attach_allocated_section_to_segment): Rename from
15556         attach_to_segment.  Remove flags parameter.
15557         (Layout::allocate_output_section): Remove function.
15558         (Layout::write_enable_output_section): Remove function.
15559         * layout.h (class Layout): Update for above changes.  Add new
15560         field sections_are_attached_.
15561         * output.h (Output_section::update_flags_for_input_section): New
15562         function.
15563         * output.cc (Output_section::add_input_section): Call
15564         update_flags_for_input_section.
15565         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
15566
15567 2008-04-11  Cary Coutant  <ccoutant@google.com>
15568
15569         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
15570         thought unnecessary.
15571         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
15572
15573 2008-04-11  Ian Lance Taylor  <iant@google.com>
15574
15575         * output.h (class Output_section_data): Remove inline definition
15576         of set_addralign.
15577         * output.cc (Output_section_data::set_addralign): New function.
15578
15579 2008-04-11  Cary Coutant  <ccoutant@google.com>
15580
15581         Add support for TLS descriptors for i386 and x86_64.
15582         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
15583         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
15584         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
15585         GOT_TYPE_TLS_DESC.
15586         (Target_i386::got_mod_index_entry): Remove unnecessary code.
15587         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
15588         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
15589         relocations.
15590         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
15591         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
15592         Fix problem with initial-exec relocations.
15593         (Target_i386::Relocate::relocate_tls): Likewise.
15594         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
15595         relaxation.
15596         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
15597         support for section-plus-offset dynamic table entries.
15598         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
15599         (Output_data_dynamic::Dynamic_entry): Add support for
15600         section-plus-offset dynamic table entries.
15601         (Output_data_dynamic::Classification): Likewise.
15602         (Output_data_dynamic::classification_): Renamed offset_.
15603         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
15604         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
15605         (Target_x86_64::make_plt_section): New function.
15606         (Target_x86_64::reserve_tlsdesc_entries): New function.
15607         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
15608         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
15609         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
15610         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
15611         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
15612         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
15613         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
15614         add extra PLT entry for TLS descriptors.
15615         (Output_data_plt_x86_64::got_): New field.
15616         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
15617         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
15618         fields.
15619         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
15620         descriptors.
15621         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
15622         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
15623         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
15624         R_386_TLS_DESC_CALL relocations.
15625         (Target_x86_64::Scan::global): Likewise.
15626         (Target_x86_64::do_finalize_sections): Add dynamic table entries
15627         for TLS descriptors.
15628         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
15629         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
15630         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
15631         GD-to-IE relaxation.
15632         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
15633         and TLS_DESCRIPTORS.
15634         * Makefile.in: Rebuild.
15635         * configure: Rebuild.
15636         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
15637         (tls_test_shared2.so): New target.
15638         (tls_shared_gd_to_ie_test_SOURCES): New variable.
15639         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
15640         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
15641         (tls_shared_gd_to_ie_test_LDADD): New variable.
15642         (tls_shared_gnu2_gd_to_ie_test): New target.
15643         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
15644         New targets.
15645         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
15646         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
15647         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
15648         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
15649         (tls_shared_gnu2_test): New target.
15650         (tls_test_gnu2_shared.so): New target.
15651         (tls_shared_gnu2_test_SOURCES): New variable.
15652         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
15653         (tls_shared_gnu2_test_LDFLAGS): New variable.
15654         (tls_shared_gnu2_test_LDADD): New variable.
15655         * testsuite/Makefile.in: Rebuild.
15656         * testsuite/Makefile.
15657
15658 2008-04-11  Ian Lance Taylor  <iant@google.com>
15659
15660         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
15661         justsyms.t.
15662         * testsuite/Makefile.in: Rebuild.
15663
15664         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
15665         long.
15666         * testsuite/script_test_2.cc (main): Adjust test.
15667
15668 2008-04-11  David S. Miller  <davem@davemloft.net>
15669             Ian Lance Taylor  <iant@google.com>
15670
15671         * options.h (General_options): Add entries for '-Y' and
15672         '-relax'.
15673         * options.cc (General_options:finalize): If -Y was used, add those
15674         entries to the library path instead of the default "/lib" and
15675         "/usr/lib".
15676
15677 2008-04-11  David S. Miller  <davem@davemloft.net>
15678
15679         * testsuite/justsyms.t: Start at 0x100.
15680         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
15681         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
15682         long.
15683         * testsuite/script_test_2.cc: Adjust string and section length
15684         checks.
15685
15686 2008-04-09  Ian Lance Taylor  <iant@google.com>
15687
15688         PR gold/5996
15689         * script-sections.cc (Sections_element::allocate_to_segment): Add
15690         orphan parameter.
15691         (Output_section_definition::allocate_to_segment): Likewise.
15692         (Orphan_output_section::allocate_to_segment): Likewise.
15693         (Script_sections::attach_sections_using_phdrs_clause): Don't
15694         propagate non-PT_LOAD segments to orphan sections.
15695         * testsuite/Makefile.am (script_test_3.stdout): Generate using
15696         readelf rather than objdump.
15697         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
15698         .interp section and PT_INTERP segment are the same size.
15699         * testsuite/Makefile.in: Rebuild.
15700
15701         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
15702         aliases for symbols defined in the same object.
15703         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
15704         (weak_alias_test_SOURCES): New variable.
15705         (weak_alias_test_DEPENDENCIES): New variable.
15706         (weak_alias_test_LDFLAGS): New variable.
15707         (weak_alias_test_LDADD): New variable.
15708         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
15709         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
15710         (weak_alias_test_3.o): New target.
15711         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
15712         * testsuite/weak_alias_test_main.cc: New file.
15713         * testsuite/weak_alias_test_1.cc: New file.
15714         * testsuite/weak_alias_test_2.cc: New file.
15715         * testsuite/weak_alias_test_3.cc: New file.
15716
15717 2008-04-08  Ian Lance Taylor  <iant@google.com>
15718
15719         * options.h (class General_options): Add --noinhibit-exec option.
15720         * main.cc (main): Check --noinhibit-exec.
15721
15722         * options.h (class General_options): Define --wrap as a special
15723         option.  Add wrap_symbols_ field.
15724         (General_options::any_wrap_symbols): New function.
15725         (General_options::is_wrap_symbol): New function.
15726         * options.cc (General_options::parse_wrap): New function.
15727         (General_options::General_options): Initialize wrap_symbols_.
15728         * symtab.cc (Symbol_table::wrap_symbol): New function.
15729         (Symbol_table::add_from_object): Handle --wrap.
15730         * symtab.h (class Symbol_table): Declare wrap_symbol.
15731         * target.h (Target::wrap_char): New function.
15732         (Target::Target_info): Add wrap_char field.
15733         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
15734         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
15735         * testsuite/testfile.cc (Target_test::test_target_info):
15736         Likewise.
15737
15738         * errors.cc (Errors::undefined_symbol): Mention symbol version if
15739         there is one.
15740
15741         * layout.h (class Layout): Add added_eh_frame_data_ field.
15742         * layout.cc (Layout::Layout): Initialize new field.
15743         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
15744         output section until we find a section we merged successfully.
15745         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
15746         that the size be non-zero.
15747
15748         * merge.cc (Object_merge_map::get_output_offset): Remove inline
15749         qualifier.
15750
15751 2008-04-08  Craig Silverstein  <csilvers@google.com>
15752
15753         * configure.ac: Export new conditional variable HAVE_ZLIB.
15754         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
15755         on HAVE_ZLIB.
15756         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
15757         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15758
15759 2008-04-07  Ian Lance Taylor  <iant@google.com>
15760
15761         * version.cc (version_string): Set to "1.5".
15762
15763         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
15764         Add issued_non_pic_error_ field.  Declare check_non_pic.
15765         (Target_x86_64::Scan::check_non_pic): New function.
15766         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
15767         (Target_x86_64::Scan::global): Likewise.
15768
15769         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
15770         addend parameter.  Change caller.  Handle merge sections.
15771         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
15772         Address to Addend.  Don't add in the result of
15773         local_section_offset, pass down the addend and use the returned
15774         value.
15775         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
15776         Update declarations of local_section_offset and symbol_value.
15777         * testsuite/two_file_test_1.cc (t18): New function.
15778         * testsuite/two_file_test_2.cc (f18): New function.
15779         * testsuite/two_file_test_main.cc (main): Call t18.
15780         * testsuite/two_file_test.h (t18, f18): Declare.
15781
15782         * configure.ac: Don't test for objdump, c++filt, or readelf.
15783         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
15784         conditionals.
15785         (TEST_READELF): New variable.
15786         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
15787         (check_PROGRAMS): Add two_file_strip_test.
15788         (two_file_strip_test): New target.
15789         (check_PROGRAMS): Add two_file_same_shared_strip_test.
15790         (two_file_same_shared_strip_test_SOURCES): New variable.
15791         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
15792         (two_file_same_shared_strip_test_LDFLAGS): New variable.
15793         (two_file_same_shared_strip_test_LDADD): New variable.
15794         (two_file_shared_strip.so): New target.
15795         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
15796         (ver_test_5.syms, ver_test_7.syms): Likewise.
15797         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
15798         (strip_test_3.stdout): Use TEST_OBJDUMP.
15799         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15800
15801 2008-04-04  Cary Coutant  <ccoutant@google.com>
15802
15803         * symtab.h (Symbol::is_weak_undefined): New function.
15804         (Symbol::is_strong_undefined): New function.
15805         (Symbol::is_absolute): New function.
15806         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
15807         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
15808         absolute symbols.
15809         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
15810         (weak_undef_test): New target.
15811         * testsuite/Makefile.in: Rebuild.
15812         * testsuite/weak_undef_file1.cc: New file.
15813         * testsuite/weak_undef_file2.cc: New file.
15814         * testsuite/weak_undef_test.cc: New file.
15815
15816 2008-04-03  Craig Silverstein  <csilvers@google.com>
15817
15818         * compressed_output.h (class Output_compressed_section): Use
15819         unsigned buffer.
15820         * compressed_output.cc (zlib_compress): Use unsigned buffers,
15821         add zlib header.
15822         (zlib_compressed_suffix): Removed.
15823         (Output_compressed_section::set_final_data_size): Use unsigned
15824         buffers.
15825         * testsuite/Makefile.am (flagstest_compress_debug_sections):
15826         Fix linker invocation.
15827         (flagstest_o_specialfile_and_compress_debug_sections):
15828         Likewise.
15829         * testsuite/Makefile.in: Regenerated.
15830
15831 2008-04-02  David S. Miller  <davem@davemloft.net>
15832
15833         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
15834         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
15835
15836 2008-04-02  Craig Silverstein  <csilvers@google.com>
15837
15838         * TODO: New file.
15839
15840 2008-04-02  Ian Lance Taylor  <iant@google.com>
15841
15842         * fileread.cc (File_read::find_view): Add byteshift and vshifted
15843         parameters.  Update for new key type to views_.  Change all
15844         callers.
15845         (File_read::read): Adjust for byteshift in returned view.
15846         (File_read::add_view): New function, broken out of
15847         find_and_make_view.
15848         (File_read::make_view): New function, broken out of
15849         find_and_make_view.
15850         (File_read::find_or_make_view): Add offset and aligned
15851         parameters.  Rewrite accordingly.  Change all callers.
15852         (File_read::get_view): Add offset and aligned parameters.  Adjust
15853         for byteshift in return value.
15854         (File_read::get_lasting_view): Likewise.
15855         * fileread.h (class File_read): Update declarations.
15856         (class File_read::View): Add byteshift_ field.  Add byteshift to
15857         constructor.  Add byteshift method.
15858         * archive.h (Archive::clear_uncached_views): New function.
15859         (Archive::get_view): Add aligned parameter.  Change all callers.
15860         * object.h (Object::get_view): Add aligned parameter.  Change all
15861         callers.
15862         (Object::get_lasting_view): Likewise.
15863
15864         * fileread.cc (File_read::release): Don't call clear_views if
15865         there are multiple objects.
15866         * fileread.h (File_read::clear_uncached_views): New function.
15867         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
15868         on the archive.
15869
15870 2008-03-31  Cary Coutant  <ccoutant@google.com>
15871
15872         Add thin archive support.
15873         * archive.cc (Archive::armagt): New const.
15874         (Archive::setup): Remove task parameter and calls to unlock.
15875         (Archive::unlock_nested_archives): New function.
15876         (Archive::read_header): Add nested_off parameter. Change
15877         all callers.
15878         (Archive::interpret_header): Likewise.
15879         (Archive::include_all_members): Change to handle thin
15880         archives.
15881         (Archive::include_member): Likewise.
15882         * archive.h (Archive::Archive): Add new parameters and
15883         initializers.
15884         (Archive::armagt): New const.
15885         (Archive::setup): Remove task parameter.
15886         (Archive::unlock_nested_archives): New function.
15887         (Archive::read_header): Add nested_off parameter.
15888         (Archive::interpret_header): Likewise.
15889         (Archive::Nested_archive_table): New typedef.
15890         (Archive::is_thin_archive_): New field.
15891         (Archive::nested_archives_): New field.
15892         (Archive::options_): New field.
15893         (Archive::dirpath_): New field.
15894         (Archive::task_): New field.
15895         * readsyms.cc (Read_symbols::do_read_symbols): Add check
15896         for thin archives.  Pass additional parameters to
15897         Archive::Archive.  Unlock the archive file after calling
15898         Archive::setup.
15899
15900 2008-03-29  Ian Lance Taylor  <iant@google.com>
15901
15902         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
15903         version symbol to be local.
15904         * testsuite/ver_test_4.sh: New file.
15905         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
15906         (check_DATA): Add ver_test_4.syms.
15907         (ver_test_4.syms): New target.
15908         * testsuite/Makefile.in: Rebuild.
15909
15910         * output.cc
15911         (Output_section::Input_section_sort_entry::has_priority): New
15912         function.
15913         (Output_section::Input_section_sort_entry::match_file_name): New
15914         function.
15915         (Output_section::Input_section_sort_entry::match_section_name):
15916         Remove.
15917         (Output_section::Input_section_sort_entry::match_section_name_prefix):
15918         Remove.
15919         (Output_section::Input_section_sort_entry::match_section_file):
15920         Remove.
15921         (Output_section::Input_section_sort_compare::operator()): Rewrite
15922         using new Input_section_sort_entry functions.  Sort crtbegin and
15923         crtend first.  Sort sections with no priority before sections with
15924         a priority.
15925         * testsuite/initpri1.c (d3): Check j != 4.
15926         (cd5): New constructor/destructor function.
15927         (main): Check j != 2.
15928
15929         * symtab.cc (Symbol_table::add_from_object): If we don't use the
15930         new symbol when resolving, don't call set_is_default.
15931         * testsuite/ver_test_7.cc: New file.
15932         * testsuite/ver_test_7.sh: New file.
15933         * testsuite/Makefile.am (ver_test_7.so): New target.
15934         (ver_test_7.o): New target.
15935         (check_SCRIPTS): Add ver_test_7.sh.
15936         (check_DATA): Add ver_test_7.syms.
15937         (ver_test_7.syms): New target.
15938
15939 2008-03-28  Ian Lance Taylor  <iant@google.com>
15940
15941         * layout.cc (Layout::layout): If we see an input section with a
15942         name that needs sorting, set the must_sort flag for the output
15943         section.
15944         (Layout::make_output_section): If the name of the output section
15945         indicates that it might require sorting, set the may_sort flag.
15946         * output.h (Output_section::may_sort_attached_input_sections): New
15947         function.
15948         (Output_section::set_may_sort_attached_input_sections): New
15949         function.
15950         (Output_section::must_sort_attached_input_sections): New
15951         function.
15952         (Output_section::set_must_sort_attached_input_sections): New
15953         function.
15954         (class Output_section): Declare Input_section_sort_entry.  Define
15955         Input_section_sort_compare.  Declare
15956         sort_attached_input_sections.  Add new fields:
15957         may_sort_attached_input_sections_,
15958         must_sort_attached_input_sections_,
15959         attached_input_sections_are_sorted_.
15960         * output.cc (Output_section::Output_section): Initialize new
15961         fields.
15962         (Output_section::add_input_section): Add an entry to
15963         input_sections_ if may_sort or must_sort are true.
15964         (Output_section::set_final_data_size): Call
15965         sort_attached_input_sections if necessary.
15966         (Output_section::Input_section_sort_entry): Define new class.
15967         (Output_section::Input_section_sort_compare::operator()): New
15968         function.
15969         (Output_section::sort_attached_input_sections): New function.
15970         * configure.ac: Check whether the compiler supports constructor
15971         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
15972         * testsuite/initpri1.c: New file.
15973         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
15974         CONSTRUCTOR_PRIORITY.
15975         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
15976         (initpri1_LDFLAGS): New variable.
15977         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15978
15979 2008-03-27  Ian Lance Taylor  <iant@google.com>
15980
15981         * common.cc (Sort_commons::operator): Correct sorting algorithm.
15982         * testsuite/common_test_1.c: New file.
15983         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
15984         (common_test_1_SOURCES): New variable.
15985         (common_test_1_DEPENDENCIES): New variable.
15986         (common_test_1_LDFLAGS): New variable.
15987
15988         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
15989         and commons_ correctly when NAME/VERSION does not override
15990         NAME/NULL.
15991         * testsuite/ver_test_6.c: New file.
15992         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
15993         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
15994         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
15995
15996 2008-03-26  Ian Lance Taylor  <iant@google.com>
15997
15998         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
15999         of an undefined symbol from a version script.
16000         * testsuite/Makefile.am (ver_test_5.so): New target.
16001         (ver_test_5.o): New target.
16002         (check_SCRIPTS): Add ver_test_5.sh.
16003         (check_DATA): Add ver_test_5.syms.
16004         (ver_test_5.syms): New target.
16005         * testsuite/ver_test_5.cc: New file.
16006         * testsuite/ver_test_5.script: New file.
16007         * testsuite/ver_test_5.sh: New file.
16008         * Makefile.in, testsuite/Makefile.in: Rebuild.
16009
16010         PR gold/5986
16011         Fix problems building gold with gcc 4.3.0.
16012         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
16013         (gold_error_at_location, gold_warning_at_location): Use it.
16014         * configure.ac: Check whether we can compile and use a template
16015         function with a printf attribute.
16016         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
16017         when jumping over bytes.
16018         * object.cc: Instantiate Object::read_section_data.
16019         * debug.h: Include <cstring>
16020         * dwarf_reader.cc: Include <algorithm>
16021         * main.cc: Include <cstring>.
16022         * options.cc: Include <cstring>.
16023         * output.cc: Include <cstring>.
16024         * script.cc: Include <cstring>.
16025         * script.h: Include <string>.
16026         * symtab.cc: Include <cstring> and <algorithm>.
16027         * target-select.cc: Include <cstring>.
16028         * version.cc: Include <string>.
16029         * testsuite/testmain.cc: Include <cstdlib>.
16030         * configure, config.in: Rebuild.
16031
16032 2008-03-25  Ian Lance Taylor  <iant@google.com>
16033
16034         * options.cc: Include "../bfd/bfdver.h".
16035         (options::help): Print bug reporting address.
16036
16037         * version.cc (print_version): Adjust output for current value of
16038         BFD_VERSION_STRING.
16039
16040         * NEWS: New file.
16041
16042         * options.cc (options::help): Print list of supported targets.
16043         * target-select.h: Include <vector>.
16044         (class Target_selector): Make machine_, size_, and is_big_endian_
16045         fields const.  Add bfd_name_ and instantiated_target_ fields.
16046         (Target_selector::Target_selector): Add bfd_name parameter.
16047         (Target_selector::recognize): Make non-virtual, call
16048         do_recognize.
16049         (Target_selector::recognize_by_name): Make non-virtual, call
16050         do_recognize_by_name.
16051         (Target_selector::supported_names): New function.
16052         (Target_selector::bfd_name): New function.
16053         (Target_selector::do_instantiate_target): New pure virtual
16054         function.
16055         (Target_selector::do_recognize): New virtual function.
16056         (Target_selector::do_recognize_by_name): New virtual function.
16057         (Target_selector::instantiate_target): New private function.
16058         (supported_target_names): Declare.
16059         * target-select.cc (Target_selector::Target_selector): Update for
16060         new parameter and fields.
16061         (select_target_by_name): Check that the name matches before
16062         calling recognize_by_name.
16063         (supported_target_names): New function.
16064         * i386.cc (class Target_selector_i386): Update Target_selector
16065         constructor call.  Remove recognize and recognize_by_name.  Add
16066         do_instantiate_target.
16067         * x86_64.cc (class Target_selector_x86_64): Likewise.
16068         * testsuite/testfile.cc (class Target_selector_test): Update for
16069         changes to Target_selector.
16070
16071         * README: Rewrite, with some notes on unsupported features.
16072
16073 2008-03-24  Cary Coutant  <ccoutant@google.com>
16074
16075         * i386.cc (Target_i386::Got_type): New enum declaration.
16076         (Target_i386::Scan::local): Updated callers of Output_data_got
16077         member functions.
16078         (Target_i386::Scan::global): Likewise.
16079         (Target_i386::Relocate::relocate): Likewise.
16080         (Target_i386::Relocate::relocate_tls): Likewise.
16081         * object.h (Got_offset_list): New class.
16082         (Sized_relobj::local_has_got_offset): Added got_type parameter.
16083         (Sized_relobj::local_got_offset): Likewise.
16084         (Sized_relobj::set_local_got_offset): Likewise.
16085         (Sized_relobj::local_has_tls_got_offset): Removed.
16086         (Sized_relobj::local_tls_got_offset): Removed.
16087         (Sized_relobj::set_local_tls_got_offset): Removed.
16088         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
16089         * output.cc (Output_data_got::add_global): Added got_type parameter.
16090         (Output_data_got::add_global_with_rel): Likewise.
16091         (Output_data_got::add_global_with_rela): Likewise.
16092         (Output_data_got::add_global_pair_with_rel): New function.
16093         (Output_data_got::add_global_pair_with_rela): New function.
16094         (Output_data_got::add_local): Added got_type parameter.
16095         (Output_data_got::add_local_with_rel): Likewise.
16096         (Output_data_got::add_local_with_rela): Likewise.
16097         (Output_data_got::add_local_pair_with_rel): New function.
16098         (Output_data_got::add_local_pair_with_rela): New function.
16099         (Output_data_got::add_global_tls): Removed.
16100         (Output_data_got::add_global_tls_with_rel): Removed.
16101         (Output_data_got::add_global_tls_with_rela): Removed.
16102         (Output_data_got::add_local_tls): Removed.
16103         (Output_data_got::add_local_tls_with_rel): Removed.
16104         (Output_data_got::add_local_tls_with_rela): Removed.
16105         * output.h (Output_data_got::add_global): Added got_type parameter.
16106         (Output_data_got::add_global_with_rel): Likewise.
16107         (Output_data_got::add_global_with_rela): Likewise.
16108         (Output_data_got::add_global_pair_with_rel): New function.
16109         (Output_data_got::add_global_pair_with_rela): New function.
16110         (Output_data_got::add_local): Added got_type parameter.
16111         (Output_data_got::add_local_with_rel): Likewise.
16112         (Output_data_got::add_local_with_rela): Likewise.
16113         (Output_data_got::add_local_pair_with_rel): New function.
16114         (Output_data_got::add_local_pair_with_rela): New function.
16115         (Output_data_got::add_global_tls): Removed.
16116         (Output_data_got::add_global_tls_with_rel): Removed.
16117         (Output_data_got::add_global_tls_with_rela): Removed.
16118         (Output_data_got::add_local_tls): Removed.
16119         (Output_data_got::add_local_tls_with_rel): Removed.
16120         (Output_data_got::add_local_tls_with_rela): Removed.
16121         * resolve.cc (Symbol::override_base_with_special): Removed
16122         reference to has_got_offset_ field.
16123         * symtab.cc (Symbol::init_fields): Replaced initialization
16124         of got_offset_ with got_offsets_.  Removed initialization
16125         of has_got_offset_
16126         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
16127         (Symbol::got_offset): Likewise.
16128         (Symbol::set_got_offset): Likewise.
16129         (Symbol::has_tls_got_offset): Removed.
16130         (Symbol::tls_got_offset): Removed.
16131         (Symbol::set_tls_got_offset): Removed.
16132         (Symbol::got_offset_): Removed.
16133         (Symbol::tls_mod_got_offset_): Removed.
16134         (Symbol::tls_pair_got_offset_): Removed.
16135         (Symbol::got_offsets_): New field.
16136         (Symbol::has_got_offset): Removed.
16137         (Symbol::has_tls_mod_got_offset): Removed.
16138         (Symbol::has_tls_pair_got_offset): Removed.
16139         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
16140         (Target_x86_64::Scan::local): Updated callers of Output_data_got
16141         member functions.
16142         (Target_x86_64::Scan::global): Likewise.
16143         (Target_x86_64::Relocate::relocate): Likewise.
16144         (Target_x86_64::Relocate::relocate_tls): Likewise.
16145
16146 2008-03-25  Ben Elliston  <bje@au.ibm.com>
16147
16148         * yyscript.y: Fix spelling error in comment.
16149
16150 2008-03-24  Ian Lance Taylor  <iant@google.com>
16151
16152         * options.h (class General_options): Define build_id option.
16153         * layout.h (class Layout): Declare write_build_id, create_note,
16154         create_build_id.  Add build_id_note_ member.
16155         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
16156         "libiberty.h", "md5.h", "sha1.h".
16157         (Layout::Layout): Initialize eh_frame_data_,
16158         eh_frame_hdr_section_, and build_id_note_.
16159         (Layout::finalize): Call create_build_id.
16160         (Layout::create_note): New function, broken out of
16161         Layout::create_gold_note.
16162         (Layout::create_gold_note): Call create_note.
16163         (Layout::create_build_id): New function.
16164         (Layout::write_build_id): New function.
16165         (Close_task_runner::run): Call write_build_id.
16166
16167         * x86_64.cc: Correct license to GPLv3.
16168
16169 2008-03-23  Ian Lance Taylor  <iant@google.com>
16170
16171         * options.cc: Include "demangle.h".
16172         (parse_optional_string): New function.
16173         (parse_long_option): Handle takes_optional_argument.
16174         (parse_short_option): Update dash_z initializer.  Handle
16175         takes_optional_argument.
16176         (General_options::General_options): Initialize do_demangle_.
16177         (General_options::finalize): Set do_demangle_.  Handle demangling
16178         style.
16179         * options.h (parse_optional_string): Declare.
16180         (struct One_option): Add optional_arg field.  Update constructor.
16181         Update call constructor calls.  Add takes_optional_argument
16182         function.
16183         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
16184         (DEFINE_optional_string): Define.
16185         (General_options::demangle): Change from DEFINE_bool to
16186         DEFINE_optional_string.
16187         (General_options::no_demangle): New function.
16188         (General_options::do_demangle): New function.
16189         (General_options::set_do_demangle): New function.
16190         (General_options::execstack_status_): Move definition to end of
16191         class definition.
16192         (General_options::static_): Likewise.
16193         (General_options::do_demangle_): New field.
16194         * object.cc (big_endian>::get_symbol_location_info): Call
16195         Options::do_demangle, not Options::demangle.
16196         * symtab.cc (demangle): Likewise.
16197
16198 2008-03-22  Ian Lance Taylor  <iant@google.com>
16199
16200         * gold.h: Include <cstddef> and <sys/types.h>
16201         * options.h: Include <cstring>.
16202
16203 2008-03-21  Ian Lance Taylor  <iant@google.com>
16204
16205         * Added source code to GNU binutils.
16206 \f
16207 Copyright (C) 2008-2014 Free Software Foundation, Inc.
16208
16209 Copying and distribution of this file, with or without modification,
16210 are permitted in any medium without royalty provided the copyright
16211 notice and this notice are preserved.
16212
16213 Local Variables:
16214 mode: change-log
16215 left-margin: 8
16216 fill-column: 74
16217 version-control: never
16218 End: